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

@ -10,10 +10,10 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
void EnDns_Init(Actor* thisx, GlobalContext* globalCtx);
void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnDns_Update(Actor* thisx, GlobalContext* globalCtx);
void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnDns_Init(Actor* thisx, PlayState* play);
void EnDns_Destroy(Actor* thisx, PlayState* play);
void EnDns_Update(Actor* thisx, PlayState* play);
void EnDns_Draw(Actor* thisx, PlayState* play);
u32 func_809EF5A4(EnDns* this);
u32 func_809EF658(EnDns* this);
@ -32,16 +32,16 @@ void func_809EFACC(EnDns* this);
void func_809EFAFC(EnDns* this);
void func_809EFB40(EnDns* this);
void EnDns_SetupWait(EnDns* this, GlobalContext* globalCtx);
void EnDns_Wait(EnDns* this, GlobalContext* globalCtx);
void EnDns_Talk(EnDns* this, GlobalContext* globalCtx);
void func_809EFDD0(EnDns* this, GlobalContext* globalCtx);
void func_809EFEE8(EnDns* this, GlobalContext* globalCtx);
void func_809EFF50(EnDns* this, GlobalContext* globalCtx);
void func_809EFF98(EnDns* this, GlobalContext* globalCtx);
void func_809F008C(EnDns* this, GlobalContext* globalCtx);
void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx);
void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx);
void EnDns_SetupWait(EnDns* this, PlayState* play);
void EnDns_Wait(EnDns* this, PlayState* play);
void EnDns_Talk(EnDns* this, PlayState* play);
void func_809EFDD0(EnDns* this, PlayState* play);
void func_809EFEE8(EnDns* this, PlayState* play);
void func_809EFF50(EnDns* this, PlayState* play);
void func_809EFF98(EnDns* this, PlayState* play);
void func_809F008C(EnDns* this, PlayState* play);
void EnDns_SetupBurrow(EnDns* this, PlayState* play);
void EnDns_Burrow(EnDns* this, PlayState* play);
const ActorInit En_Dns_InitVars = {
ACTOR_EN_DNS,
@ -132,7 +132,7 @@ static AnimationMinimalInfo sAnimationInfo[] = {
{ &gBusinessScrubNervousTransitionAnim, ANIMMODE_ONCE, 0.0f },
};
void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnDns_Init(Actor* thisx, PlayState* play) {
EnDns* this = (EnDns*)thisx;
if (this->actor.params < 0) {
@ -149,10 +149,10 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) {
osSyncPrintf(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", D_809F0424[this->actor.params],
this->actor.params);
Actor_ProcessInitChain(&this->actor, sInitChain);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim,
SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim,
this->jointTable, this->morphTable, 18);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinderType1(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
this->actor.textId = D_809F040C[this->actor.params];
Actor_SetScale(&this->actor, 0.01f);
@ -167,10 +167,10 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actionFunc = EnDns_SetupWait;
}
void EnDns_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnDns_Destroy(Actor* thisx, PlayState* play) {
EnDns* this = (EnDns*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
void EnDns_ChangeAnim(EnDns* this, u8 index) {
@ -312,17 +312,17 @@ void func_809EFB40(EnDns* this) {
Rupees_ChangeBy(-this->dnsItemEntry->itemPrice);
}
void EnDns_SetupWait(EnDns* this, GlobalContext* globalCtx) {
void EnDns_SetupWait(EnDns* this, PlayState* play) {
if (this->skelAnime.curFrame == this->skelAnime.endFrame) {
this->actionFunc = EnDns_Wait;
EnDns_ChangeAnim(this, ENDNS_ANIM_0);
}
}
void EnDns_Wait(EnDns* this, GlobalContext* globalCtx) {
void EnDns_Wait(EnDns* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 2000, 0);
this->actor.world.rot.y = this->actor.shape.rot.y;
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
this->actionFunc = EnDns_Talk;
} else {
if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isTargeted) {
@ -331,82 +331,82 @@ void EnDns_Wait(EnDns* this, GlobalContext* globalCtx) {
this->actor.flags &= ~ACTOR_FLAG_16;
}
if (this->actor.xzDistToPlayer < 130.0f) {
func_8002F2F4(&this->actor, globalCtx);
func_8002F2F4(&this->actor, play);
}
}
}
void EnDns_Talk(EnDns* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
void EnDns_Talk(EnDns* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) {
case 0: // OK
switch (this->dnsItemEntry->purchaseableCheck(this)) {
case 0:
Message_ContinueTextbox(globalCtx, 0x10A5);
Message_ContinueTextbox(play, 0x10A5);
this->actionFunc = func_809F008C;
break;
case 1:
Message_ContinueTextbox(globalCtx, 0x10A6);
Message_ContinueTextbox(play, 0x10A6);
this->actionFunc = func_809F008C;
break;
case 3:
Message_ContinueTextbox(globalCtx, 0x10DE);
Message_ContinueTextbox(play, 0x10DE);
this->actionFunc = func_809F008C;
break;
case 2:
case 4:
Message_ContinueTextbox(globalCtx, 0x10A7);
Message_ContinueTextbox(play, 0x10A7);
this->actionFunc = func_809EFEE8;
break;
}
break;
case 1: // No way
Message_ContinueTextbox(globalCtx, 0x10A4);
Message_ContinueTextbox(play, 0x10A4);
this->actionFunc = func_809F008C;
}
}
}
void func_809EFDD0(EnDns* this, GlobalContext* globalCtx) {
void func_809EFDD0(EnDns* this, PlayState* play) {
if (this->actor.params == 0x9) {
if (CUR_UPG_VALUE(UPG_STICKS) < 2) {
func_8002F434(&this->actor, globalCtx, GI_STICK_UPGRADE_20, 130.0f, 100.0f);
func_8002F434(&this->actor, play, GI_STICK_UPGRADE_20, 130.0f, 100.0f);
} else {
func_8002F434(&this->actor, globalCtx, GI_STICK_UPGRADE_30, 130.0f, 100.0f);
func_8002F434(&this->actor, play, GI_STICK_UPGRADE_30, 130.0f, 100.0f);
}
} else if (this->actor.params == 0xA) {
if (CUR_UPG_VALUE(UPG_NUTS) < 2) {
func_8002F434(&this->actor, globalCtx, GI_NUT_UPGRADE_30, 130.0f, 100.0f);
func_8002F434(&this->actor, play, GI_NUT_UPGRADE_30, 130.0f, 100.0f);
} else {
func_8002F434(&this->actor, globalCtx, GI_NUT_UPGRADE_40, 130.0f, 100.0f);
func_8002F434(&this->actor, play, GI_NUT_UPGRADE_40, 130.0f, 100.0f);
}
} else {
func_8002F434(&this->actor, globalCtx, this->dnsItemEntry->getItemId, 130.0f, 100.0f);
func_8002F434(&this->actor, play, this->dnsItemEntry->getItemId, 130.0f, 100.0f);
}
}
void func_809EFEE8(EnDns* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
func_809EFDD0(this, globalCtx);
void func_809EFEE8(EnDns* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
func_809EFDD0(this, play);
this->actionFunc = func_809EFF50;
}
}
void func_809EFF50(EnDns* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
void func_809EFF50(EnDns* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = func_809EFF98;
} else {
func_809EFDD0(this, globalCtx);
func_809EFDD0(this, play);
}
}
void func_809EFF98(EnDns* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_809EFF98(EnDns* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (player->stateFlags1 & PLAYER_STATE1_10) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
this->dnsItemEntry->setRupeesAndFlags(this);
this->dropCollectible = 1;
this->maintainCollider = 0;
@ -424,8 +424,8 @@ void func_809EFF98(EnDns* this, GlobalContext* globalCtx) {
}
}
void func_809F008C(EnDns* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(globalCtx)) {
void func_809F008C(EnDns* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
this->maintainCollider = 0;
this->actor.flags &= ~ACTOR_FLAG_0;
EnDns_ChangeAnim(this, ENDNS_ANIM_1);
@ -433,7 +433,7 @@ void func_809F008C(EnDns* this, GlobalContext* globalCtx) {
}
}
void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx) {
void EnDns_SetupBurrow(EnDns* this, PlayState* play) {
f32 frameCount = Animation_GetLastFrame(&gBusinessScrubAnim_4404);
if (this->skelAnime.curFrame == frameCount) {
@ -444,7 +444,7 @@ void EnDns_SetupBurrow(EnDns* this, GlobalContext* globalCtx) {
}
}
void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) {
void EnDns_Burrow(EnDns* this, PlayState* play) {
f32 depth;
Vec3f initPos;
s32 i;
@ -454,7 +454,7 @@ void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) {
initPos.x = this->actor.world.pos.x;
initPos.y = this->yInitPos;
initPos.z = this->actor.world.pos.z;
func_80028990(globalCtx, 20.0f, &initPos);
func_80028990(play, 20.0f, &initPos);
}
this->actor.shape.rot.y += 0x2000;
// Drops only if you bought its item
@ -464,14 +464,14 @@ void EnDns_Burrow(EnDns* this, GlobalContext* globalCtx) {
initPos.y = this->yInitPos;
initPos.z = this->actor.world.pos.z;
for (i = 0; i < 3; i++) {
Item_DropCollectible(globalCtx, &initPos, ITEM00_HEART);
Item_DropCollectible(play, &initPos, ITEM00_HEART);
}
}
Actor_Kill(&this->actor);
}
}
void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnDns_Update(Actor* thisx, PlayState* play) {
EnDns* this = (EnDns*)thisx;
s16 pad;
@ -481,20 +481,20 @@ void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, 0.01f);
SkelAnime_Update(&this->skelAnime);
Actor_MoveForward(&this->actor);
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
if (this->standOnGround) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2);
Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2);
}
if (this->maintainCollider) {
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
}
void EnDns_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnDns_Draw(Actor* thisx, PlayState* play) {
EnDns* this = (EnDns*)thisx;
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
NULL, NULL, &this->actor);
func_80093D18(play->state.gfxCtx);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL,
NULL, &this->actor);
}

View file

@ -6,7 +6,7 @@
struct EnDns;
typedef void (*EnDnsActionFunc)(struct EnDns*, GlobalContext*);
typedef void (*EnDnsActionFunc)(struct EnDns*, PlayState*);
typedef u32 (*EnDnsPurchaseableCheck)(struct EnDns*);
typedef void (*EnDnsSetRupeesAndFlags)(struct EnDns*);