1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-23 07:21:19 +00:00

PlayState Rename (#1231)

* global context -> play

* fix PlayState* PlayState
This commit is contained in:
fig02 2022-05-21 14:23:43 -04:00 committed by GitHub
parent 154f44b6da
commit 2e6279bc8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
912 changed files with 40489 additions and 41078 deletions

View file

@ -9,22 +9,22 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
void EnAni_Init(Actor* thisx, GlobalContext* globalCtx);
void EnAni_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnAni_Update(Actor* thisx, GlobalContext* globalCtx);
void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnAni_Init(Actor* thisx, PlayState* play);
void EnAni_Destroy(Actor* thisx, PlayState* play);
void EnAni_Update(Actor* thisx, PlayState* play);
void EnAni_Draw(Actor* thisx, PlayState* play);
s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId);
void func_809B04F0(EnAni* this, GlobalContext* globalCtx);
void func_809B0524(EnAni* this, GlobalContext* globalCtx);
void func_809B0558(EnAni* this, GlobalContext* globalCtx);
void func_809B05F0(EnAni* this, GlobalContext* globalCtx);
void func_809B064C(EnAni* this, GlobalContext* globalCtx);
void func_809B07F8(EnAni* this, GlobalContext* globalCtx);
void func_809B0988(EnAni* this, GlobalContext* globalCtx);
void func_809B0994(EnAni* this, GlobalContext* globalCtx);
void func_809B0A28(EnAni* this, GlobalContext* globalCtx);
void func_809B0A6C(EnAni* this, GlobalContext* globalCtx);
s32 EnAni_SetText(EnAni* this, PlayState* play, u16 textId);
void func_809B04F0(EnAni* this, PlayState* play);
void func_809B0524(EnAni* this, PlayState* play);
void func_809B0558(EnAni* this, PlayState* play);
void func_809B05F0(EnAni* this, PlayState* play);
void func_809B064C(EnAni* this, PlayState* play);
void func_809B07F8(EnAni* this, PlayState* play);
void func_809B0988(EnAni* this, PlayState* play);
void func_809B0994(EnAni* this, PlayState* play);
void func_809B0A28(EnAni* this, PlayState* play);
void func_809B0A6C(EnAni* this, PlayState* play);
const ActorInit En_Ani_InitVars = {
ACTOR_EN_ANI,
@ -67,17 +67,17 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 850, ICHAIN_STOP),
};
void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnAni_Init(Actor* thisx, PlayState* play) {
s32 pad;
EnAni* this = (EnAni*)thisx;
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, -2800.0f, ActorShadow_DrawCircle, 36.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gRoofManSkel, &gRoofManIdleAnim, this->jointTable,
this->morphTable, 0x10);
SkelAnime_InitFlex(play, &this->skelAnime, &gRoofManSkel, &gRoofManIdleAnim, this->jointTable, this->morphTable,
0x10);
Animation_PlayOnce(&this->skelAnime, &gRoofManIdleAnim);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
if (!LINK_IS_ADULT) {
EnAni_SetupAction(this, func_809B064C);
@ -90,33 +90,33 @@ void EnAni_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.velocity.y = -1.0f;
}
void EnAni_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnAni_Destroy(Actor* thisx, PlayState* play) {
EnAni* this = (EnAni*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
s32 EnAni_SetText(EnAni* this, GlobalContext* globalCtx, u16 textId) {
s32 EnAni_SetText(EnAni* this, PlayState* play, u16 textId) {
this->actor.textId = textId;
this->unk_2A8 |= 1;
func_8002F2CC(&this->actor, globalCtx, 100.0f);
func_8002F2CC(&this->actor, play, 100.0f);
return 0;
}
void func_809B04F0(EnAni* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_809B04F0(EnAni* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
EnAni_SetupAction(this, func_809B064C);
}
}
void func_809B0524(EnAni* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_809B0524(EnAni* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
EnAni_SetupAction(this, func_809B07F8);
}
}
void func_809B0558(EnAni* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
void func_809B0558(EnAni* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
if (!LINK_IS_ADULT) {
EnAni_SetupAction(this, func_809B04F0);
@ -125,23 +125,23 @@ void func_809B0558(EnAni* this, GlobalContext* globalCtx) {
}
SET_ITEMGETINF(ITEMGETINF_15);
} else {
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);
func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 200.0f);
}
}
void func_809B05F0(EnAni* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_809B05F0(EnAni* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
EnAni_SetupAction(this, func_809B0558);
}
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 200.0f);
func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 200.0f);
}
void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
void func_809B064C(EnAni* this, PlayState* play) {
u16 textId;
s16 yawDiff;
u16 textId2;
textId2 = Text_GetFaceReaction(globalCtx, 0xA);
textId2 = Text_GetFaceReaction(play, 0xA);
textId = textId2 & 0xFFFF;
if (!textId) {}
@ -151,7 +151,7 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
}
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
if (this->actor.textId == 0x5056) {
EnAni_SetupAction(this, func_809B04F0);
} else if (this->actor.textId == 0x5055) {
@ -162,22 +162,22 @@ void func_809B064C(EnAni* this, GlobalContext* globalCtx) {
} else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f &&
-80.0f < this->actor.yDistToPlayer) {
if (GET_ITEMGETINF(ITEMGETINF_15)) {
EnAni_SetText(this, globalCtx, 0x5056);
EnAni_SetText(this, play, 0x5056);
} else {
EnAni_SetText(this, globalCtx, 0x5055);
EnAni_SetText(this, play, 0x5055);
}
} else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) {
EnAni_SetText(this, globalCtx, textId);
EnAni_SetText(this, play, textId);
}
}
void func_809B07F8(EnAni* this, GlobalContext* globalCtx) {
void func_809B07F8(EnAni* this, PlayState* play) {
s16 pad;
s16 yawDiff;
u16 textId;
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
if (this->actor.textId == 0x5056) {
EnAni_SetupAction(this, func_809B0524);
} else if (this->actor.textId == 0x5055) {
@ -188,9 +188,9 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) {
} else if (yawDiff > -0x36B0 && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f &&
-80.0f < this->actor.yDistToPlayer) {
if (GET_ITEMGETINF(ITEMGETINF_15)) {
EnAni_SetText(this, globalCtx, 0x5056);
EnAni_SetText(this, play, 0x5056);
} else {
EnAni_SetText(this, globalCtx, 0x5055);
EnAni_SetText(this, play, 0x5055);
}
} else if (yawDiff > -0x3E8 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) {
if (!GET_EVENTCHKINF(EVENTCHKINF_2F)) {
@ -198,15 +198,15 @@ void func_809B07F8(EnAni* this, GlobalContext* globalCtx) {
} else {
textId = GET_ITEMGETINF(ITEMGETINF_15) ? 0x5054 : 0x5053;
}
EnAni_SetText(this, globalCtx, textId);
EnAni_SetText(this, play, textId);
}
}
void func_809B0988(EnAni* this, GlobalContext* globalCtx) {
void func_809B0988(EnAni* this, PlayState* play) {
}
void func_809B0994(EnAni* this, GlobalContext* globalCtx) {
if (globalCtx->csCtx.npcActions[0]->action == 4) {
void func_809B0994(EnAni* this, PlayState* play) {
if (play->csCtx.npcActions[0]->action == 4) {
Animation_Change(&this->skelAnime, &gRoofManGettingUpAfterKnockbackAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gRoofManGettingUpAfterKnockbackAnim), ANIMMODE_ONCE, -4.0f);
this->unk_2AA++;
@ -214,17 +214,17 @@ void func_809B0994(EnAni* this, GlobalContext* globalCtx) {
}
}
void func_809B0A28(EnAni* this, GlobalContext* globalCtx) {
void func_809B0A28(EnAni* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime)) {
this->unk_2AA++;
}
}
void func_809B0A6C(EnAni* this, GlobalContext* globalCtx) {
void func_809B0A6C(EnAni* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime)) {
this->skelAnime.curFrame = 0.0f;
}
if (globalCtx->csCtx.npcActions[0]->action == 2) {
if (play->csCtx.npcActions[0]->action == 2) {
Animation_Change(&this->skelAnime, &gRoofManKnockbackAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gRoofManKnockbackAnim), ANIMMODE_ONCE, 0.0f);
this->actor.shape.shadowDraw = NULL;
@ -232,45 +232,45 @@ void func_809B0A6C(EnAni* this, GlobalContext* globalCtx) {
}
}
void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnAni_Update(Actor* thisx, PlayState* play) {
EnAni* this = (EnAni*)thisx;
s32 pad[2];
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
if ((globalCtx->csCtx.state != CS_STATE_IDLE) && (globalCtx->csCtx.npcActions[0] != NULL)) {
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.npcActions[0] != NULL)) {
switch (this->unk_2AA) {
case 0:
func_809B0A6C(this, globalCtx);
func_809B0A6C(this, play);
break;
case 1:
func_809B0A28(this, globalCtx);
func_809B0A28(this, play);
break;
case 2:
func_809B0994(this, globalCtx);
func_809B0994(this, play);
break;
case 3:
func_809B0A28(this, globalCtx);
func_809B0A28(this, play);
break;
case 4:
func_809B0988(this, globalCtx);
func_809B0988(this, play);
break;
}
if (globalCtx->csCtx.frames == 100) {
if (play->csCtx.frames == 100) {
func_800788CC(NA_SE_IT_EARTHQUAKE);
}
} else {
if (SkelAnime_Update(&this->skelAnime) != 0) {
this->skelAnime.curFrame = 0.0f;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
if (this->unk_2A8 & 1) {
func_80038290(globalCtx, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
this->unk_2A2.z = 0;
this->unk_2A2.y = this->unk_2A2.z;
this->unk_2A2.x = this->unk_2A2.z;
@ -290,7 +290,7 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 EnAni_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnAni* this = (EnAni*)thisx;
if (limbIndex == 15) {
@ -300,7 +300,7 @@ s32 EnAni_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return false;
}
void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnAni_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f sMultVec = { 800.0f, 500.0f, 0.0f };
EnAni* this = (EnAni*)thisx;
@ -309,7 +309,7 @@ void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
}
}
void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnAni_Draw(Actor* thisx, PlayState* play) {
static void* eyeTextures[] = {
gRoofManEyeOpenTex,
gRoofManEyeHalfTex,
@ -318,14 +318,14 @@ void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnAni* this = (EnAni*)thisx;
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ani.c", 719);
OPEN_DISPS(play->state.gfxCtx, "../z_en_ani.c", 719);
func_800943C8(globalCtx->state.gfxCtx);
func_800943C8(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex]));
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, this);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ani.c", 736);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_ani.c", 736);
}

View file

@ -6,7 +6,7 @@
struct EnAni;
typedef void (*EnAniActionFunc)(struct EnAni*, GlobalContext*);
typedef void (*EnAniActionFunc)(struct EnAni*, PlayState*);
typedef struct EnAni {
/* 0x0000 */ Actor actor;