1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-22 06:52:03 +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)
void EnJs_Init(Actor* thisx, GlobalContext* globalCtx);
void EnJs_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnJs_Update(Actor* thisx, GlobalContext* globalCtx);
void EnJs_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnJs_Init(Actor* thisx, PlayState* play);
void EnJs_Destroy(Actor* thisx, PlayState* play);
void EnJs_Update(Actor* thisx, PlayState* play);
void EnJs_Draw(Actor* thisx, PlayState* play);
void func_80A89304(EnJs* this, GlobalContext* globalCtx);
void func_80A89304(EnJs* this, PlayState* play);
const ActorInit En_Js_InitVars = {
ACTOR_EN_JS,
@ -52,35 +52,35 @@ void En_Js_SetupAction(EnJs* this, EnJsActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnJs_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnJs_Init(Actor* thisx, PlayState* play) {
EnJs* this = (EnJs*)thisx;
s32 pad;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 36.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gCarpetMerchantSkel, &gCarpetMerchantSlappingKneeAnim,
this->jointTable, this->morphTable, 13);
SkelAnime_InitFlex(play, &this->skelAnime, &gCarpetMerchantSkel, &gCarpetMerchantSlappingKneeAnim, this->jointTable,
this->morphTable, 13);
Animation_PlayOnce(&this->skelAnime, &gCarpetMerchantSlappingKneeAnim);
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;
Actor_SetScale(&this->actor, 0.01f);
En_Js_SetupAction(this, func_80A89304);
this->unk_284 = 0;
this->actor.gravity = -1.0f;
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_JSJUTAN, this->actor.world.pos.x,
Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_JSJUTAN, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
}
void EnJs_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnJs_Destroy(Actor* thisx, PlayState* play) {
EnJs* this = (EnJs*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
u8 func_80A88F64(EnJs* this, GlobalContext* globalCtx, u16 textId) {
u8 func_80A88F64(EnJs* this, PlayState* play, u16 textId) {
s16 yawDiff;
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
return 1;
} else {
this->actor.textId = textId;
@ -88,7 +88,7 @@ u8 func_80A88F64(EnJs* this, GlobalContext* globalCtx, u16 textId) {
if (ABS(yawDiff) <= 0x1800 && this->actor.xzDistToPlayer < 100.0f) {
this->unk_284 |= 1;
func_8002F2CC(&this->actor, globalCtx, 100.0f);
func_8002F2CC(&this->actor, play, 100.0f);
}
return 0;
}
@ -100,44 +100,44 @@ void func_80A89008(EnJs* this) {
Animation_GetLastFrame(&gCarpetMerchantSlappingKneeAnim), ANIMMODE_ONCE, -4.0f);
}
void func_80A89078(EnJs* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_80A89078(EnJs* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
func_80A89008(this);
this->actor.flags &= ~ACTOR_FLAG_16;
}
}
void func_80A890C0(EnJs* this, GlobalContext* globalCtx) {
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
void func_80A890C0(EnJs* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
En_Js_SetupAction(this, func_80A89078);
} else {
func_8002F2CC(&this->actor, globalCtx, 1000.0f);
func_8002F2CC(&this->actor, play, 1000.0f);
}
}
void func_80A8910C(EnJs* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void func_80A8910C(EnJs* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
this->actor.textId = 0x6078;
En_Js_SetupAction(this, func_80A890C0);
this->actor.flags |= ACTOR_FLAG_16;
}
}
void func_80A89160(EnJs* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
void func_80A89160(EnJs* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
En_Js_SetupAction(this, func_80A8910C);
} else {
func_8002F434(&this->actor, globalCtx, GI_BOMBCHUS_10, 10000.0f, 50.0f);
func_8002F434(&this->actor, play, GI_BOMBCHUS_10, 10000.0f, 50.0f);
}
}
void func_80A891C4(EnJs* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
void func_80A891C4(EnJs* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) {
case 0: // yes
if (gSaveContext.rupees < 200) {
Message_ContinueTextbox(globalCtx, 0x6075);
Message_ContinueTextbox(play, 0x6075);
func_80A89008(this);
} else {
Rupees_ChangeBy(-200);
@ -145,7 +145,7 @@ void func_80A891C4(EnJs* this, GlobalContext* globalCtx) {
}
break;
case 1: // no
Message_ContinueTextbox(globalCtx, 0x6074);
Message_ContinueTextbox(play, 0x6074);
func_80A89008(this);
}
}
@ -157,24 +157,24 @@ void func_80A89294(EnJs* this) {
Animation_GetLastFrame(&gCarpetMerchantIdleAnim), ANIMMODE_ONCE, -4.0f);
}
void func_80A89304(EnJs* this, GlobalContext* globalCtx) {
if (func_80A88F64(this, globalCtx, 0x6077)) {
void func_80A89304(EnJs* this, PlayState* play) {
if (func_80A88F64(this, play, 0x6077)) {
func_80A89294(this);
}
}
void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnJs_Update(Actor* thisx, PlayState* play) {
EnJs* this = (EnJs*)thisx;
s32 pad;
s32 pad2;
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->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1) {
if (SurfaceType_GetSfx(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1) {
Math_ApproachF(&this->actor.shape.yOffset, sREG(80) + -2000.0f, 1.0f, (sREG(81) / 10.0f) + 50.0f);
}
} else {
@ -183,9 +183,9 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) {
if (SkelAnime_Update(&this->skelAnime)) {
this->skelAnime.curFrame = 0.0f;
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
if (this->unk_284 & 1) {
func_80038290(globalCtx, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos);
func_80038290(play, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->unk_278.x, 0, 6, 0x1838, 0x64);
Math_SmoothStepToS(&this->unk_278.y, 0, 6, 0x1838, 0x64);
@ -205,7 +205,7 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 EnJs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnJs* this = (EnJs*)thisx;
if (limbIndex == 12) {
@ -214,7 +214,7 @@ s32 EnJs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return false;
}
void EnJs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnJs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f D_80A896DC = { 0.0f, 0.0f, 0.0f };
EnJs* this = (EnJs*)thisx;
@ -222,10 +222,10 @@ void EnJs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
Matrix_MultVec3f(&D_80A896DC, &this->actor.focus.pos);
}
}
void EnJs_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnJs_Draw(Actor* thisx, PlayState* play) {
EnJs* this = (EnJs*)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,
EnJs_OverrideLimbDraw, EnJs_PostLimbDraw, this);
}

View file

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