1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-20 14:01:15 +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,19 +9,19 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5)
void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx);
void EnMa3_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx);
void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnMa3_Init(Actor* thisx, PlayState* play);
void EnMa3_Destroy(Actor* thisx, PlayState* play);
void EnMa3_Update(Actor* thisx, PlayState* play);
void EnMa3_Draw(Actor* thisx, PlayState* play);
u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* this);
s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* this);
u16 func_80AA2AA0(PlayState* play, Actor* this);
s16 func_80AA2BD4(PlayState* play, Actor* this);
void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx);
s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx);
void func_80AA2E54(EnMa3* this, PlayState* play);
s32 func_80AA2EC8(EnMa3* this, PlayState* play);
s32 func_80AA2F28(EnMa3* this);
void EnMa3_UpdateEyes(EnMa3* this);
void func_80AA3200(EnMa3* this, GlobalContext* globalCtx);
void func_80AA3200(EnMa3* this, PlayState* play);
const ActorInit En_Ma3_InitVars = {
ACTOR_EN_MA3,
@ -71,8 +71,8 @@ static AnimationFrameCountInfo sAnimationInfo[] = {
{ &gMalonAdultSingAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
};
u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) {
Player* player = GET_PLAYER(globalCtx);
u16 func_80AA2AA0(PlayState* play, Actor* thisx) {
Player* player = GET_PLAYER(play);
s16* timer1ValuePtr; // weirdness with this necessary to match
if (!GET_INFTABLE(INFTABLE_B8)) {
@ -98,7 +98,7 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) {
}
}
if (!(player->stateFlags1 & PLAYER_STATE1_23) &&
(Actor_FindNearby(globalCtx, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) {
(Actor_FindNearby(play, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) {
return 0x2001;
}
if (!GET_INFTABLE(INFTABLE_B9)) {
@ -108,30 +108,30 @@ u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) {
}
}
s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) {
s16 func_80AA2BD4(PlayState* play, Actor* thisx) {
s16 ret = 1;
switch (Message_GetState(&globalCtx->msgCtx)) {
switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(globalCtx)) {
globalCtx->nextEntranceIndex = ENTR_SPOT20_0;
if (Message_ShouldAdvance(play)) {
play->nextEntranceIndex = ENTR_SPOT20_0;
gSaveContext.nextCutsceneIndex = 0xFFF0;
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
SET_EVENTINF(EVENTINF_HORSES_0A);
gSaveContext.timer1State = 0xF;
}
break;
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(globalCtx)) {
if (Message_ShouldAdvance(play)) {
SET_INFTABLE(INFTABLE_B9);
if (globalCtx->msgCtx.choiceIndex == 0) {
if (play->msgCtx.choiceIndex == 0) {
if (GET_EVENTCHKINF(EVENTCHKINF_1E)) {
Message_ContinueTextbox(globalCtx, 0x2091);
Message_ContinueTextbox(play, 0x2091);
} else if (HIGH_SCORE(HS_HORSE_RACE) == 0) {
Message_ContinueTextbox(globalCtx, 0x2092);
Message_ContinueTextbox(play, 0x2092);
} else {
Message_ContinueTextbox(globalCtx, 0x2090);
Message_ContinueTextbox(play, 0x2090);
}
}
}
@ -178,8 +178,8 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) {
return ret;
}
void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_80AA2E54(EnMa3* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 phi_a3;
if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &gMalonAdultSingAnim)) {
@ -193,7 +193,7 @@ void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx) {
func_80034A14(&this->actor, &this->unk_1E0, 0, phi_a3);
}
s32 func_80AA2EC8(EnMa3* this, GlobalContext* globalCtx) {
s32 func_80AA2EC8(EnMa3* this, PlayState* play) {
if (LINK_IS_CHILD) {
return 2;
}
@ -238,17 +238,17 @@ void EnMa3_ChangeAnim(EnMa3* this, s32 index) {
sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames);
}
void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnMa3_Init(Actor* thisx, PlayState* play) {
EnMa3* this = (EnMa3*)thisx;
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
SkelAnime_InitFlex(play, &this->skelAnime, &gMalonAdultSkel, NULL, NULL, NULL, 0);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(22), &sColChkInfoInit);
switch (func_80AA2EC8(this, globalCtx)) {
switch (func_80AA2EC8(this, play)) {
case 0:
EnMa3_ChangeAnim(this, ENMA3_ANIM_0);
this->actionFunc = func_80AA3200;
@ -262,37 +262,37 @@ void EnMa3_Init(Actor* thisx, GlobalContext* globalCtx) {
return;
}
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
Actor_SetScale(&this->actor, 0.01f);
this->unk_1E0.unk_00 = (u16)0;
}
void EnMa3_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnMa3_Destroy(Actor* thisx, PlayState* play) {
EnMa3* this = (EnMa3*)thisx;
SkelAnime_Free(&this->skelAnime, globalCtx);
Collider_DestroyCylinder(globalCtx, &this->collider);
SkelAnime_Free(&this->skelAnime, play);
Collider_DestroyCylinder(play, &this->collider);
}
void func_80AA3200(EnMa3* this, GlobalContext* globalCtx) {
void func_80AA3200(EnMa3* this, PlayState* play) {
if (this->unk_1E0.unk_00 == 2) {
this->actor.flags &= ~ACTOR_FLAG_16;
this->unk_1E0.unk_00 = 0;
}
}
void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnMa3_Update(Actor* thisx, PlayState* play) {
EnMa3* this = (EnMa3*)thisx;
s32 pad;
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
SkelAnime_Update(&this->skelAnime);
EnMa3_UpdateEyes(this);
this->actionFunc(this, globalCtx);
func_80AA2E54(this, globalCtx);
func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f,
func_80AA2AA0, func_80AA2BD4);
this->actionFunc(this, play);
func_80AA2E54(this, play);
func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, (f32)this->collider.dim.radius + 150.0f, func_80AA2AA0,
func_80AA2BD4);
if (this->unk_1E0.unk_00 == 0) {
if (this->unk_20A != 0) {
func_800F6584(0);
@ -304,7 +304,7 @@ void EnMa3_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
s32 EnMa3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 EnMa3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnMa3* this = (EnMa3*)thisx;
Vec3s vec;
@ -331,11 +331,11 @@ s32 EnMa3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return false;
}
void EnMa3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnMa3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnMa3* this = (EnMa3*)thisx;
Vec3f vec = { 900.0f, 0.0f, 0.0f };
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 927);
OPEN_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 927);
if (limbIndex == MALON_ADULT_LIMB_HEAD) {
Matrix_MultVec3f(&vec, &this->actor.focus.pos);
@ -345,10 +345,10 @@ void EnMa3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
gSPDisplayList(POLY_OPA_DISP++, gMalonAdultBasketDL);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 950);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 950);
}
void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnMa3_Draw(Actor* thisx, PlayState* play) {
static void* sMouthTextures[] = { gMalonAdultMouthNeutralTex, gMalonAdultMouthSadTex, gMalonAdultMouthHappyTex };
static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex };
EnMa3* this = (EnMa3*)thisx;
@ -356,18 +356,18 @@ void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) {
f32 someFloat;
s32 pad;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 978);
OPEN_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 978);
activeCam = GET_ACTIVE_CAM(globalCtx);
activeCam = GET_ACTIVE_CAM(play);
someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye);
func_800F6268(someFloat, NA_BGM_LONLON);
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex]));
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[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,
EnMa3_OverrideLimbDraw, EnMa3_PostLimbDraw, this);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 1013);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_ma3.c", 1013);
}

View file

@ -6,7 +6,7 @@
struct EnMa3;
typedef void (*EnMa3ActionFunc)(struct EnMa3*, GlobalContext*);
typedef void (*EnMa3ActionFunc)(struct EnMa3*, PlayState*);
typedef enum {
/* 0x00 */ MALON_ADULT_LIMB_NONE,