1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-20 22:11:16 +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,12 +9,12 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4)
void EnMk_Init(Actor* thisx, GlobalContext* globalCtx);
void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnMk_Update(Actor* thisx, GlobalContext* globalCtx);
void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnMk_Init(Actor* thisx, PlayState* play);
void EnMk_Destroy(Actor* thisx, PlayState* play);
void EnMk_Update(Actor* thisx, PlayState* play);
void EnMk_Draw(Actor* thisx, PlayState* play);
void EnMk_Wait(EnMk* this, GlobalContext* globalCtx);
void EnMk_Wait(EnMk* this, PlayState* play);
const ActorInit En_Mk_InitVars = {
ACTOR_EN_MK,
@ -48,18 +48,18 @@ static ColliderCylinderInit sCylinderInit = {
{ 30, 40, 0, { 0, 0, 0 } },
};
void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnMk_Init(Actor* thisx, PlayState* play) {
EnMk* this = (EnMk*)thisx;
s32 swimFlag;
this->actor.minVelocityY = -4.0f;
this->actor.gravity = -1.0f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_mk_Skel_005DF0, &object_mk_Anim_000D88, this->jointTable,
SkelAnime_InitFlex(play, &this->skelAnime, &object_mk_Skel_005DF0, &object_mk_Anim_000D88, this->jointTable,
this->morphTable, 13);
Animation_PlayLoop(&this->skelAnime, &object_mk_Anim_000D88);
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 = 0xFF;
Actor_SetScale(&this->actor, 0.01f);
@ -73,14 +73,14 @@ void EnMk_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
void EnMk_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnMk_Destroy(Actor* thisx, PlayState* play) {
EnMk* this = (EnMk*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
void func_80AACA40(EnMk* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_80AACA40(EnMk* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
this->actor.flags &= ~ACTOR_FLAG_16;
this->actionFunc = EnMk_Wait;
}
@ -88,43 +88,43 @@ void func_80AACA40(EnMk* this, GlobalContext* globalCtx) {
this->flags |= 1;
}
void func_80AACA94(EnMk* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx) != 0) {
void func_80AACA94(EnMk* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play) != 0) {
this->actor.parent = NULL;
this->actionFunc = func_80AACA40;
func_80088AA0(240);
CLEAR_EVENTINF(EVENTINF_10);
} else {
func_8002F434(&this->actor, globalCtx, GI_EYEDROPS, 10000.0f, 50.0f);
func_8002F434(&this->actor, play, GI_EYEDROPS, 10000.0f, 50.0f);
}
}
void func_80AACB14(EnMk* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_80AACB14(EnMk* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
this->actionFunc = func_80AACA94;
func_8002F434(&this->actor, globalCtx, GI_EYEDROPS, 10000.0f, 50.0f);
func_8002F434(&this->actor, play, GI_EYEDROPS, 10000.0f, 50.0f);
}
}
void func_80AACB6C(EnMk* this, GlobalContext* globalCtx) {
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
void func_80AACB6C(EnMk* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
this->actionFunc = func_80AACB14;
}
this->flags |= 1;
}
void func_80AACBAC(EnMk* this, GlobalContext* globalCtx) {
void func_80AACBAC(EnMk* this, PlayState* play) {
if (this->timer > 0) {
this->timer--;
this->actor.shape.rot.y -= 0x800;
} else {
this->actionFunc = func_80AACB6C;
Message_ContinueTextbox(globalCtx, 0x4030);
Message_ContinueTextbox(play, 0x4030);
}
}
void func_80AACC04(EnMk* this, GlobalContext* globalCtx) {
void func_80AACC04(EnMk* this, PlayState* play) {
if (this->timer > 0) {
this->timer--;
} else {
@ -136,7 +136,7 @@ void func_80AACC04(EnMk* this, GlobalContext* globalCtx) {
}
}
void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) {
void func_80AACCA0(EnMk* this, PlayState* play) {
if (this->timer > 0) {
this->timer--;
this->actor.shape.rot.y += 0x800;
@ -149,13 +149,13 @@ void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) {
}
}
void func_80AACD48(EnMk* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_80AACD48(EnMk* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
this->actionFunc = func_80AACCA0;
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
play->msgCtx.msgMode = MSGMODE_PAUSED;
player->exchangeItemId = EXCH_ITEM_NONE;
this->timer = 16;
Animation_Change(&this->skelAnime, &object_mk_Anim_000D88, 1.0f, 0.0f,
@ -166,9 +166,9 @@ void func_80AACD48(EnMk* this, GlobalContext* globalCtx) {
this->flags |= 1;
}
void func_80AACE2C(EnMk* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
Message_ContinueTextbox(globalCtx, 0x4001);
void func_80AACE2C(EnMk* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_ContinueTextbox(play, 0x4001);
Animation_Change(&this->skelAnime, &object_mk_Anim_000AC0, 1.0f, 0.0f,
Animation_GetLastFrame(&object_mk_Anim_000AC0), ANIMMODE_ONCE, -4.0f);
this->flags &= ~2;
@ -178,9 +178,9 @@ void func_80AACE2C(EnMk* this, GlobalContext* globalCtx) {
this->flags |= 1;
}
void func_80AACEE8(EnMk* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
Message_ContinueTextbox(globalCtx, 0x4000);
void func_80AACEE8(EnMk* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_ContinueTextbox(play, 0x4000);
Animation_Change(&this->skelAnime, &object_mk_Anim_000AC0, 1.0f, 0.0f,
Animation_GetLastFrame(&object_mk_Anim_000AC0), ANIMMODE_LOOP, -4.0f);
this->flags &= ~2;
@ -190,33 +190,33 @@ void func_80AACEE8(EnMk* this, GlobalContext* globalCtx) {
this->flags |= 1;
}
void func_80AACFA0(EnMk* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
void func_80AACFA0(EnMk* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = func_80AACA40;
SET_ITEMGETINF(ITEMGETINF_10);
} else {
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f);
func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f);
}
}
void func_80AAD014(EnMk* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_80AAD014(EnMk* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
this->actionFunc = func_80AACFA0;
func_8002F434(&this->actor, globalCtx, GI_HEART_PIECE, 10000.0f, 50.0f);
func_8002F434(&this->actor, play, GI_HEART_PIECE, 10000.0f, 50.0f);
}
this->flags |= 1;
}
void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) {
void EnMk_Wait(EnMk* this, PlayState* play) {
s16 angle;
s32 swimFlag;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
s32 playerExchangeItem;
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
playerExchangeItem = func_8002F368(globalCtx);
if (Actor_ProcessTalkRequest(&this->actor, play)) {
playerExchangeItem = func_8002F368(play);
if (this->actor.textId != 0x4018) {
player->actor.textId = this->actor.textId;
@ -264,7 +264,7 @@ void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) {
}
}
} else {
this->actor.textId = Text_GetFaceReaction(globalCtx, 0x1A);
this->actor.textId = Text_GetFaceReaction(play, 0x1A);
if (this->actor.textId == 0) {
this->actor.textId = 0x4018;
@ -273,13 +273,13 @@ void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) {
angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if ((ABS(angle) < 0x2151) && (this->actor.xzDistToPlayer < 100.0f)) {
func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_FROG);
func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_FROG);
this->flags |= 1;
}
}
}
void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnMk_Update(Actor* thisx, PlayState* play) {
EnMk* this = (EnMk*)thisx;
s32 pad;
Vec3s vec;
@ -287,24 +287,24 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) {
s16 swimFlag;
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);
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
if (!(this->flags & 2) && SkelAnime_Update(&this->skelAnime)) {
this->flags |= 2;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
if (this->flags & 1) {
func_80038290(globalCtx, &this->actor, &this->headRotation, &vec, this->actor.focus.pos);
func_80038290(play, &this->actor, &this->headRotation, &vec, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRotation.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->headRotation.y, 0, 6, 6200, 100);
}
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
if (this->flags & 8) {
if (!(player->stateFlags2 & PLAYER_STATE2_10)) {
@ -342,7 +342,7 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 EnMk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnMk* this = (EnMk*)thisx;
if (limbIndex == 11) {
@ -353,7 +353,7 @@ s32 EnMk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return false;
}
void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnMk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f D_80AAD64C = { 1000.0f, -100.0f, 0.0f };
EnMk* this = (EnMk*)thisx;
@ -362,10 +362,10 @@ void EnMk_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
}
}
void EnMk_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnMk_Draw(Actor* thisx, PlayState* play) {
EnMk* this = (EnMk*)thisx;
func_800943C8(globalCtx->state.gfxCtx);
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_800943C8(play->state.gfxCtx);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnMk_OverrideLimbDraw, EnMk_PostLimbDraw, &this->actor);
}

View file

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