Skip to content

Commit

Permalink
some aquas docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicdcer committed Jan 16, 2025
1 parent 66c3a4b commit 3aff1d4
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 55 deletions.
12 changes: 6 additions & 6 deletions assets/yaml/us/rev1/ast_aquas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ aAqSquidSkel:
aAqShellDL:
{ type: GFX, offset: 0x6000E10, symbol: aAqShellDL }

D_AQ_6001130:
{ type: TEXTURE, ctype: u16, format: RGBA16, width: 32, height: 32, offset: 0x6001130, symbol: D_AQ_6001130 }
aAqShellTex:
{ type: TEXTURE, ctype: u16, format: RGBA16, width: 32, height: 32, offset: 0x6001130, symbol: aAqShellTex }

aAqAnglerFishAnim:
{ type: SF64:ANIM, offset: 0x6002628, symbol: aAqAnglerFishAnim }
Expand Down Expand Up @@ -380,8 +380,8 @@ D_AQ_601C110:
D_AQ_601D110:
{ type: GFX, offset: 0x601D110, symbol: D_AQ_601D110 }

D_AQ_601DE50:
{ type: SF64:ANIM, offset: 0x601DE50, symbol: D_AQ_601DE50 }
aAqSeaweedAnim2:
{ type: SF64:ANIM, offset: 0x601DE50, symbol: aAqSeaweedAnim2 }

aAqCoralReef2DL:
{ type: GFX, offset: 0x601DE60, symbol: aAqCoralReef2DL }
Expand Down Expand Up @@ -410,8 +410,8 @@ D_AQ_601F830:
D_AQ_601FD70:
{ type: GFX, offset: 0x601FD70, symbol: D_AQ_601FD70 }

aAqSeaweedAnim:
{ type: SF64:ANIM, offset: 0x6020A40, symbol: aAqSeaweedAnim }
aAqSeaweedAnim1:
{ type: SF64:ANIM, offset: 0x6020A40, symbol: aAqSeaweedAnim1 }

aAqSeaweedSkel:
{ type: SF64:SKELETON, offset: 0x6020C6C, symbol: aAqSeaweedSkel }
Expand Down
2 changes: 1 addition & 1 deletion include/gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void Lib_Texture_Mottle(u16 *dst, u16 *src, u8 mode);
s32 Animation_GetLimbIndex(Limb* limb, Limb** skeleton);
void Animation_DrawLimb(s32 mode, Limb* limb, Limb* *skeleton, Vec3f* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* data);
void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, void* data, Matrix* transform);
s16 Animation_GetFrameData(Animation *animationSegmemt, s32 frame, Vec3f *frameTable);
s16 Animation_GetFrameData(Animation *animationSegment, s32 frame, Vec3f *frameTable);
s32 Animation_GetFrameCount(Animation *animationSegment);
void Animation_FindBoundingBox(Gfx* dList, s32 len, Vec3f *min, Vec3f *max, s32 *vtxFound, s32 *vtxCount, Vtx* *vtxList);
void Animation_GetDListBoundingBox(Gfx *dList, s32 len, Vec3f *min, Vec3f *max);
Expand Down
2 changes: 1 addition & 1 deletion src/engine/fox_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -2865,7 +2865,7 @@ void ActorCutscene_Draw(ActorCutscene* this) {
break;

case ACTOR_CS_AQ_SEAWEED:
Animation_GetFrameData(&aAqSeaweedAnim, this->iwork[0], this->vwork);
Animation_GetFrameData(&aAqSeaweedAnim1, this->iwork[0], this->vwork);
gSPClearGeometryMode(gMasterDisp++, G_CULL_BACK);
Animation_DrawSkeleton(1, aAqSeaweedSkel, this->vwork, 0, 0, &this->index, &gIdentityMatrix);
gSPSetGeometryMode(gMasterDisp++, G_CULL_BACK);
Expand Down
4 changes: 2 additions & 2 deletions src/engine/fox_std_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ void Animation_DrawSkeleton(s32 mode, Limb** skeletonSegment, Vec3f* jointTable,
}
}

s16 Animation_GetFrameData(Animation* animationSegmemt, s32 frame, Vec3f* frameTable) {
Animation* animation = SEGMENTED_TO_VIRTUAL(animationSegmemt);
s16 Animation_GetFrameData(Animation* animationSegment, s32 frame, Vec3f* frameTable) {
Animation* animation = SEGMENTED_TO_VIRTUAL(animationSegment);
u16 limbCount = animation->limbCount;
JointKey* key = SEGMENTED_TO_VIRTUAL(animation->jointKey);
u16* frameData = SEGMENTED_TO_VIRTUAL(animation->frameData);
Expand Down
93 changes: 48 additions & 45 deletions src/overlays/ovl_i3/fox_aq.c
Original file line number Diff line number Diff line change
Expand Up @@ -5280,6 +5280,7 @@ void Aquas_AqSquid_PostLimbDraw(s32 limbIndex, Vec3f* rot, void* thisx) {
Matrix_MultVec3f(gCalcMatrix, &sp34, &this->vwork[11]);
Matrix_GetYRPAngles(gCalcMatrix, &this->vwork[24]);
Matrix_Push(&gCalcMatrix);

switch (gGameFrameCount % 4U) {
case 0:
break;
Expand Down Expand Up @@ -5331,7 +5332,7 @@ void Aquas_AqSquid_Draw(AqSquid* this) {

void Aquas_AqSeaweed_Update(AqSeaweed* this) {
Vec3f frameTable[30];
u16 sp3E;
u16 limbCount;

switch (this->state) {
case 0:
Expand All @@ -5340,11 +5341,11 @@ void Aquas_AqSeaweed_Update(AqSeaweed* this) {
/* fallthrough */
case 1:
this->animFrame += 2;
if (this->animFrame >= Animation_GetFrameCount(&aAqSeaweedAnim)) {
if (this->animFrame >= Animation_GetFrameCount(&aAqSeaweedAnim1)) {
this->animFrame = 0;
}

sp3E = Animation_GetFrameData(&aAqSeaweedAnim, this->animFrame, frameTable);
limbCount = Animation_GetFrameData(&aAqSeaweedAnim1, this->animFrame, frameTable);

if ((fabsf(this->obj.pos.x - gPlayer[0].pos.x) < 150.0f) &&
(fabsf(this->obj.pos.y - gPlayer[0].pos.y) < 500.0f) &&
Expand All @@ -5356,10 +5357,12 @@ void Aquas_AqSeaweed_Update(AqSeaweed* this) {

case 2:
this->animFrame += 2;
if (this->animFrame >= Animation_GetFrameCount(&D_AQ_601DE50)) {
if (this->animFrame >= Animation_GetFrameCount(&aAqSeaweedAnim2)) {
this->animFrame = 0;
}
sp3E = Animation_GetFrameData(&D_AQ_601DE50, this->animFrame, frameTable);

limbCount = Animation_GetFrameData(&aAqSeaweedAnim2, this->animFrame, frameTable);

if ((fabsf(this->obj.pos.x - gPlayer[0].pos.x) > 150.0f) ||
(fabsf(this->obj.pos.y - gPlayer[0].pos.y) > 500.0f) ||
(fabsf(this->obj.pos.z - gPlayer[0].trueZpos) > 700.0f)) {
Expand All @@ -5368,7 +5371,7 @@ void Aquas_AqSeaweed_Update(AqSeaweed* this) {
}
break;
}
Math_SmoothStepToVec3fArray(frameTable, this->vwork, 1, sp3E, this->fwork[0], 100.0f, 0.0f);
Math_SmoothStepToVec3fArray(frameTable, this->vwork, 1, limbCount, this->fwork[0], 100.0f, 0.0f);
Math_SmoothStepToF(&this->fwork[0], 0.5f, 1.0f, 0.008f, 0.0f);
}

Expand Down Expand Up @@ -5396,7 +5399,7 @@ void Aquas_AqBoulder_Init(AqBoulder* this) {

void Aquas_AqBoulder_Update(AqBoulder* this) {
s32 i;
s32 var_s2;
s32 j;
Actor* boulder;

switch (this->state) {
Expand Down Expand Up @@ -5461,8 +5464,7 @@ void Aquas_AqBoulder_Update(AqBoulder* this) {
this->health = this->itemDrop = 0;
Actor_Despawn(this);
if (this->state == 0) {
for (i = 0, var_s2 = 0, boulder = &gActors[0]; (i < ARRAY_COUNT(gActors)) && (var_s2 < 4);
i++, boulder++) {
for (i = 0, j = 0, boulder = &gActors[0]; (i < ARRAY_COUNT(gActors)) && (j < 4); i++, boulder++) {
if (boulder->obj.status == OBJ_FREE) {
Actor_Initialize(boulder);
boulder->obj.status = OBJ_INIT;
Expand All @@ -5476,7 +5478,7 @@ void Aquas_AqBoulder_Update(AqBoulder* this) {
boulder->state = 1;

Object_SetInfo(&boulder->info, boulder->obj.id);
var_s2++;
j++;
}
}
if (i >= ARRAY_COUNT(gActors)) {
Expand Down Expand Up @@ -5543,7 +5545,7 @@ void Aquas_AqCoral_Update(AqCoral* this) {

void Aquas_AqCoral_PostLimbDraw(s32 limbIndex, Vec3f* rot, void* thisx) {
Vec3f sp24 = { 0.0f, 0.0f, 0.0f };
Actor* this = (Actor*) thisx;
AqCoral* this = (AqCoral*) thisx;

if (this->state != 0) {
switch (limbIndex) {
Expand Down Expand Up @@ -5598,8 +5600,8 @@ s32 D_i3_801C04A0[6] = {
};

void Aquas_AqJellyfish_Init(AqJellyfish* this) {
s32 sp64;
s32 sp60;
s32 i;
s32 j;
Vec3f sp54;
Vec3f sp48;
AqJellyfish* jellyfish;
Expand Down Expand Up @@ -5646,7 +5648,7 @@ void Aquas_AqJellyfish_Init(AqJellyfish* this) {

Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp54, &sp48);

for (sp64 = 0, jellyfish = &gActors[0]; sp64 < ARRAY_COUNT(gActors); sp64++, jellyfish++) {
for (i = 0, jellyfish = &gActors[0]; i < ARRAY_COUNT(gActors); i++, jellyfish++) {
if (jellyfish->obj.status == OBJ_FREE) {
Actor_Initialize(jellyfish);
jellyfish->obj.status = OBJ_INIT;
Expand All @@ -5659,7 +5661,7 @@ void Aquas_AqJellyfish_Init(AqJellyfish* this) {
jellyfish->iwork[13] = this->iwork[13];
jellyfish->iwork[18] = this->iwork[18];
jellyfish->iwork[19] = this->iwork[19];
this->iwork[0] = sp64 + 1;
this->iwork[0] = i + 1;
Object_SetInfo(&jellyfish->info, jellyfish->obj.id);
break;
}
Expand All @@ -5673,7 +5675,7 @@ void Aquas_AqJellyfish_Init(AqJellyfish* this) {

Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp54, &sp48);

for (sp60 = 0, jellyfish2 = &gActors[0]; sp60 < ARRAY_COUNT(gActors); sp60++, jellyfish2++) {
for (j = 0, jellyfish2 = &gActors[0]; j < ARRAY_COUNT(gActors); j++, jellyfish2++) {
if (jellyfish2->obj.status == OBJ_FREE) {
Actor_Initialize(jellyfish2);
jellyfish2->obj.status = OBJ_INIT;
Expand All @@ -5687,8 +5689,8 @@ void Aquas_AqJellyfish_Init(AqJellyfish* this) {
jellyfish2->iwork[13] = this->iwork[13];
jellyfish2->iwork[18] = this->iwork[18];
jellyfish2->iwork[19] = this->iwork[19];
jellyfish->iwork[1] = sp60 + 1;
this->iwork[1] = sp60 + 1;
jellyfish->iwork[1] = j + 1;
this->iwork[1] = j + 1;
Object_SetInfo(&jellyfish2->info, jellyfish2->obj.id);
break;
}
Expand All @@ -5698,6 +5700,7 @@ void Aquas_AqJellyfish_Init(AqJellyfish* this) {
this->fwork[20] = this->obj.rot.z;

this->obj.rot.x = this->obj.rot.y = this->obj.rot.z = 0.0f;

D_i3_801C4450++;
if (D_i3_801C4450 > 20) {
D_i3_801C4450 = 0;
Expand Down Expand Up @@ -5747,15 +5750,15 @@ void Aquas_AqJellyfish_Update(AqJellyfish* this) {
case 4:
i = this->iwork[19] + (this->iwork[2] * 2);
this->vel.y = D_i3_801C04A0[i];
if (((gGameFrameCount % 4) == 0)) {
if ((gGameFrameCount % 4) == 0) {
if (fabsf(this->fwork[23] - this->obj.pos.y) >= 100.0f) {
if (this->iwork[20] == 0) {
this->iwork[19]++;
this->iwork[19] &= 1;
this->iwork[20] = 50;
}
} else {
for (i = 0, wall1 = gScenery; i < ARRAY_COUNT(gScenery); i++, wall1++) {
for (i = 0, wall1 = &gScenery[0]; i < ARRAY_COUNT(gScenery); i++, wall1++) {
if ((wall1->obj.status == OBJ_ACTIVE) && (wall1->obj.id == OBJ_SCENERY_AQ_WALL_1) &&
(Object_CheckHitboxCollision(&this->obj.pos, wall1->info.hitbox, &wall1->obj, 0.0f,
0.0f, 0.0f) ||
Expand Down Expand Up @@ -5867,7 +5870,7 @@ void Aquas_AqJellyfish_Update(AqJellyfish* this) {
}
}

if (((gGameFrameCount % 16) == 0)) {
if ((gGameFrameCount % 16) == 0) {
Effect_SpawnTimedSfxAtPos(&sp70->obj.pos, NA_SE_EN_WT_SPARK_BEAM);
}

Expand Down Expand Up @@ -6003,12 +6006,12 @@ void Aquas_AqJellyfish_Update(AqJellyfish* this) {
}

bool Aquas_AqJellyfish_OverrideLimbDraw(s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3f* rot, void* thisx) {
Vec3f sp64 = { 0.0f, 0.0f, 0.0f };
Vec3f sp58;
f32 sp54 = 0.0f;
f32 sp50 = 0.0f;
f32 sp4C = 0.0f;
Actor* this = (Actor*) thisx;
Vec3f lightSrc = { 0.0f, 0.0f, 0.0f };
Vec3f lightDest;
f32 xScale = 0.0f;
f32 yScale = 0.0f;
f32 zScale = 0.0f;
AqJellyfish* this = (AqJellyfish*) thisx;

RCP_SetupDL(&gMasterDisp, SETUPDL_41);

Expand All @@ -6020,15 +6023,15 @@ bool Aquas_AqJellyfish_OverrideLimbDraw(s32 limbIndex, Gfx** dList, Vec3f* pos,

switch (limbIndex) {
case 1:
sp54 = this->fwork[12];
sp50 = this->fwork[15];
sp4C = this->fwork[18];
xScale = this->fwork[12];
yScale = this->fwork[15];
zScale = this->fwork[18];
break;

case 2:
sp54 = this->fwork[13];
sp50 = this->fwork[16];
sp4C = this->fwork[19];
xScale = this->fwork[13];
yScale = this->fwork[16];
zScale = this->fwork[19];
break;

case 3:
Expand All @@ -6047,24 +6050,24 @@ bool Aquas_AqJellyfish_OverrideLimbDraw(s32 limbIndex, Gfx** dList, Vec3f* pos,
break;

case 11:
sp54 = this->fwork[11];
sp50 = this->fwork[14];
sp4C = this->fwork[17];
xScale = this->fwork[11];
yScale = this->fwork[14];
zScale = this->fwork[17];
}

if (sp54 > 0.0f) {
if (xScale > 0.0f) {
Matrix_Translate(gCalcMatrix, pos->x, pos->y, pos->z, MTXF_APPLY);

Matrix_RotateZ(gCalcMatrix, rot->z * M_DTOR, MTXF_APPLY);
Matrix_RotateY(gCalcMatrix, rot->y * M_DTOR, MTXF_APPLY);
Matrix_RotateX(gCalcMatrix, rot->x * M_DTOR, MTXF_APPLY);

if (*dList != NULL) {
Matrix_MultVec3f(gCalcMatrix, &sp64, &sp58);
Display_SetSecondLight(&sp58);
Matrix_MultVec3f(gCalcMatrix, &lightSrc, &lightDest);
Display_SetSecondLight(&lightDest);
Matrix_Mult(gGfxMatrix, gCalcMatrix, MTXF_APPLY);
Matrix_Push(&gGfxMatrix);
Matrix_Scale(gGfxMatrix, sp54, sp50, sp4C, MTXF_APPLY);
Matrix_Scale(gGfxMatrix, xScale, yScale, zScale, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, *dList);
Matrix_Pop(&gGfxMatrix);
Expand Down Expand Up @@ -6245,23 +6248,23 @@ void Aquas_AqStoneColumn_Update(AqStoneColumn* this) {
}

void Aquas_AqStoneColumn_PostLimbDraw(s32 limbIndex, Vec3f* rot, void* thisx) {
Vec3f sp2C = { 0.0f, 0.0f, 0.0f };
Actor* this = (Actor*) thisx;
Vec3f src = { 0.0f, 0.0f, 0.0f };
AqStoneColumn* this = (AqStoneColumn*) thisx;

if (this->state == 3) {
switch (limbIndex) {
case 1:
Matrix_MultVec3f(gCalcMatrix, &sp2C, &this->vwork[4]);
Matrix_MultVec3f(gCalcMatrix, &src, &this->vwork[4]);
Matrix_GetYRPAngles(gCalcMatrix, &this->vwork[5]);
break;

case 2:
Matrix_MultVec3f(gCalcMatrix, &sp2C, &this->vwork[0]);
Matrix_MultVec3f(gCalcMatrix, &src, &this->vwork[0]);
Matrix_GetYRPAngles(gCalcMatrix, &this->vwork[2]);
break;

case 5:
Matrix_MultVec3f(gCalcMatrix, &sp2C, &this->vwork[1]);
Matrix_MultVec3f(gCalcMatrix, &src, &this->vwork[1]);
Matrix_GetYRPAngles(gCalcMatrix, &this->vwork[3]);
break;
}
Expand Down

0 comments on commit 3aff1d4

Please sign in to comment.