Document object_shn (Shooting Gallery Men and Swamp Guide) (#805)

* Limbs, skeleton, limb DLs, main textures

* Finish documenting object_shn

* Name the eyeIndex variable in syateki_man

* Use limb enum in syateki_man

* One more limb enum I forgot, sorry

* Respond to Elliptic's review
This commit is contained in:
Tom Overton
2022-04-24 10:14:14 -07:00
committed by GitHub
parent 07ce7c8ab3
commit d0d36b603d
6 changed files with 175 additions and 146 deletions
+10 -10
View File
@@ -64,10 +64,10 @@ const ActorInit En_Shn_InitVars = {
};
static AnimationInfoS sAnimations[] = {
{ &object_shn_Anim_00D9D0, 1.0f, 0, -1, 0, 0 },
{ &object_shn_Anim_00D9D0, 1.0f, 0, -1, 0, -4 },
{ &object_shn_Anim_00E6C4, 1.0f, 0, -1, 0, 0 },
{ &object_shn_Anim_00E6C4, 1.0f, 0, -1, 0, -4 },
{ &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, 0 },
{ &gBurlyGuyHandsOnTableAnim, 1.0f, 0, -1, 0, -4 },
{ &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, 0 },
{ &gSwampGuideChinScratchAnim, 1.0f, 0, -1, 0, -4 },
};
static s32 D_80AE7258[] = { 0, 2, 3, 8, 10, 1 };
@@ -345,8 +345,8 @@ void EnShn_Init(Actor* thisx, GlobalContext* globalCtx) {
EnShn* this = THIS;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectShnSkel, NULL, this->jointTable, this->morphTable,
OBJECT_SHN_LIMB_MAX);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBurlyGuySkel, NULL, this->jointTable, this->morphTable,
BURLY_GUY_LIMB_MAX);
this->unk_2E8 = -1;
if (gSaveContext.save.weekEventReg[23] & 8) {
func_80AE615C(this, 0);
@@ -386,16 +386,16 @@ void EnShn_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 EnShn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
EnShn* this = THIS;
if (limbIndex == OBJECT_SHN_LIMB_HEAD) {
if (limbIndex == BURLY_GUY_LIMB_HEAD) {
func_80AE6488(this, globalCtx);
*dList = gObjectShnSwampGuideHead;
*dList = gSwampGuideHeadDL;
}
return false;
}
Vec3f D_80AE7270 = { 1200.0f, 0.0f, 0.0f };
void EnShn_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
if (limbIndex == OBJECT_SHN_LIMB_HEAD) {
if (limbIndex == BURLY_GUY_LIMB_HEAD) {
Matrix_MultiplyVector3fByState(&D_80AE7270, &thisx->focus.pos);
Math_Vec3s_Copy(&thisx->focus.rot, &thisx->world.rot);
}
@@ -418,7 +418,7 @@ void EnShn_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thi
phi_v0 = 0;
}
if (limbIndex == OBJECT_SHN_LIMB_HEAD) {
if (limbIndex == BURLY_GUY_LIMB_HEAD) {
func_8013AD9C((this->unk_2BA + 0x4000), (this->unk_2BC + this->actor.shape.rot.y + 0x4000), &this->unk_1E8,
&this->unk_1F4, phi_v0, phi_v1);
Matrix_StatePop();
+2 -2
View File
@@ -20,8 +20,8 @@ typedef struct EnShn {
/* 0x1E4 */ Player* shnPlayerRef;
/* 0x1E8 */ Vec3f unk_1E8;
/* 0x1F4 */ Vec3s unk_1F4;
/* 0x1FA */ Vec3s jointTable[OBJECT_SHN_LIMB_MAX];
/* 0x25A */ Vec3s morphTable[OBJECT_SHN_LIMB_MAX];
/* 0x1FA */ Vec3s jointTable[BURLY_GUY_LIMB_MAX];
/* 0x25A */ Vec3s morphTable[BURLY_GUY_LIMB_MAX];
/* 0x2BA */ s16 unk_2BA;
/* 0x2BC */ s16 unk_2BC;
/* 0x2BE */ s16 unk_2BE;
@@ -5,7 +5,6 @@
*/
#include "z_en_syateki_man.h"
#include "objects/object_shn/object_shn.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10 | ACTOR_FLAG_8000000)
@@ -48,9 +47,9 @@ const ActorInit En_Syateki_Man_InitVars = {
};
static AnimationInfo sAnimations[] = {
{ &object_shn_Anim_00D9D0, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
{ &object_shn_Anim_00DFEC, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
{ &object_shn_Anim_00D2F8, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
{ &gBurlyGuyHandsOnTableAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
{ &gSwampShootingGalleryManHeadScratchLoopAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f },
{ &gSwampShootingGalleryManHeadScratchEndAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f },
};
static s16 D_809C91C8[] = {
@@ -132,11 +131,11 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.targetMode = 1;
Actor_SetScale(&this->actor, 0.01f);
if (globalCtx->sceneNum == SCENE_SYATEKI_MORI) {
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectShnSkel, &object_shn_Anim_00DFEC, this->jointTable,
this->morphTable, OBJECT_SHN_LIMB_MAX);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBurlyGuySkel, &gSwampShootingGalleryManHeadScratchLoopAnim,
this->jointTable, this->morphTable, BURLY_GUY_LIMB_MAX);
} else {
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gObjectShnSkel, &object_shn_Anim_00D9D0, this->jointTable,
this->morphTable, OBJECT_SHN_LIMB_MAX);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBurlyGuySkel, &gBurlyGuyHandsOnTableAnim, this->jointTable,
this->morphTable, BURLY_GUY_LIMB_MAX);
}
this->actor.colChkInfo.cylRadius = 100;
@@ -154,8 +153,8 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_284 = 0;
this->unk_194 = 0;
this->unk_282 = 0;
this->unk_264 = 0;
this->unk_266 = 0;
this->eyeIndex = 0;
this->blinkTimer = 0;
if (globalCtx->sceneNum == SCENE_SYATEKI_MORI) {
this->path = sp34;
@@ -408,7 +407,7 @@ void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) {
break;
}
if (this->skelAnime.animation == &object_shn_Anim_00D2F8) {
if (this->skelAnime.animation == &gSwampShootingGalleryManHeadScratchEndAnim) {
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 0);
}
@@ -1203,32 +1202,32 @@ void func_809C8BF0(EnSyatekiMan* this, GlobalContext* globalCtx) {
}
}
void func_809C8DE8(EnSyatekiMan* this) {
switch (this->unk_266) {
void EnSyatekiMan_Blink(EnSyatekiMan* this) {
switch (this->blinkTimer) {
case 1:
this->unk_264 = 2;
this->eyeIndex = 2;
break;
case 2:
this->unk_264 = 1;
this->eyeIndex = 1;
break;
case 40:
this->unk_266 = 0;
this->blinkTimer = 0;
default:
this->unk_264 = 0;
this->eyeIndex = 0;
break;
}
this->unk_266++;
this->blinkTimer++;
}
void EnSyatekiMan_Update(Actor* thisx, GlobalContext* globalCtx) {
EnSyatekiMan* this = THIS;
this->actionFunc(this, globalCtx);
func_809C8DE8(this);
EnSyatekiMan_Blink(this);
this->actor.focus.pos.y = 70.0f;
Actor_SetFocus(&this->actor, 70.0f);
if (this->unk_26A != 1) {
@@ -1241,16 +1240,16 @@ s32 EnSyatekiMan_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx**
Actor* thisx) {
EnSyatekiMan* this = THIS;
if ((globalCtx->sceneNum == SCENE_SYATEKI_MIZU) && (limbIndex == 15)) {
*dList = object_shn_DL_00F2D0;
if ((globalCtx->sceneNum == SCENE_SYATEKI_MIZU) && (limbIndex == BURLY_GUY_LIMB_HEAD)) {
*dList = gTownShootingGalleryManHeadDL;
}
if (limbIndex == 15) {
if (limbIndex == BURLY_GUY_LIMB_HEAD) {
Matrix_InsertTranslation(3000.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_InsertZRotation_s(this->unk_258.x, MTXMODE_APPLY);
Matrix_InsertXRotation_s(this->unk_258.y, MTXMODE_APPLY);
Matrix_InsertTranslation(-3000.0f, 0.0f, 0.0f, MTXMODE_APPLY);
} else if (limbIndex == 8) {
} else if (limbIndex == BURLY_GUY_LIMB_TORSO) {
Matrix_InsertXRotation_s(-this->unk_25E.y, MTXMODE_APPLY);
}
@@ -1261,36 +1260,36 @@ void EnSyatekiMan_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
EnSyatekiMan* this = THIS;
Vec3f sp18 = { 1600.0f, 0.0f, 0.0f };
if (limbIndex == 15) {
if (limbIndex == BURLY_GUY_LIMB_HEAD) {
Matrix_MultiplyVector3fByState(&sp18, &this->actor.focus.pos);
}
}
void EnSyatekiMan_Draw(Actor* thisx, GlobalContext* globalCtx) {
static TexturePtr D_809C94B8[] = {
object_shn_Tex_005AC8,
object_shn_Tex_0062C8,
object_shn_Tex_0062C8,
static TexturePtr sEyeTextures[] = {
gSwampShootingGalleryManEyeOpenTex,
gSwampShootingGalleryManEyeHalfTex,
gSwampShootingGalleryManEyeHalfTex,
};
EnSyatekiMan* this = THIS;
s32 pad;
if (globalCtx->sceneNum == SCENE_SYATEKI_MIZU) {
D_809C94B8[0] = object_shn_Tex_00FB90;
D_809C94B8[1] = object_shn_Tex_010390;
D_809C94B8[2] = object_shn_Tex_010390;
sEyeTextures[0] = gTownShootingGalleryManEyeOpenTex;
sEyeTextures[1] = gTownShootingGalleryManEyeClosedTex;
sEyeTextures[2] = gTownShootingGalleryManEyeClosedTex;
} else {
D_809C94B8[0] = object_shn_Tex_005AC8;
D_809C94B8[1] = object_shn_Tex_0062C8;
D_809C94B8[2] = object_shn_Tex_0062C8;
sEyeTextures[0] = gSwampShootingGalleryManEyeOpenTex;
sEyeTextures[1] = gSwampShootingGalleryManEyeHalfTex;
sEyeTextures[2] = gSwampShootingGalleryManEyeHalfTex;
}
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C5B0(globalCtx->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(D_809C94B8[this->unk_264]));
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(D_809C94B8[this->unk_264]));
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex]));
gSPSegment(POLY_OPA_DISP++, 0x09, Lib_SegmentedToVirtual(sEyeTextures[this->eyeIndex]));
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnSyatekiMan_OverrideLimbDraw, EnSyatekiMan_PostLimbDraw, &this->actor);
@@ -2,6 +2,8 @@
#define Z_EN_SYATEKI_MAN_H
#include "global.h"
#include "objects/object_shn/object_shn.h"
struct EnSyatekiMan;
@@ -24,12 +26,12 @@ typedef struct EnSyatekiMan {
/* 0x018C */ Path* path;
/* 0x0190 */ s32 unk_190;
/* 0x0194 */ s32 unk_194;
/* 0x0198 */ Vec3s jointTable[16];
/* 0x01F8 */ Vec3s morphTable[16];
/* 0x0198 */ Vec3s jointTable[BURLY_GUY_LIMB_MAX];
/* 0x01F8 */ Vec3s morphTable[BURLY_GUY_LIMB_MAX];
/* 0x0258 */ Vec3s unk_258;
/* 0x025E */ Vec3s unk_25E;
/* 0x0264 */ s16 unk_264;
/* 0x0266 */ s16 unk_266;
/* 0x0264 */ s16 eyeIndex;
/* 0x0266 */ s16 blinkTimer;
/* 0x0268 */ UNK_TYPE1 unk268[0x2];
/* 0x026A */ s16 unk_26A;
/* 0x026C */ s16 unk_26C;