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:
parent
154f44b6da
commit
2e6279bc8e
912 changed files with 40489 additions and 41078 deletions
|
@ -9,12 +9,12 @@
|
|||
|
||||
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
|
||||
|
||||
void EnDs_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDs_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDs_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDs_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnDs_Init(Actor* thisx, PlayState* play);
|
||||
void EnDs_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnDs_Update(Actor* thisx, PlayState* play);
|
||||
void EnDs_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void EnDs_Wait(EnDs* this, GlobalContext* globalCtx);
|
||||
void EnDs_Wait(EnDs* this, PlayState* play);
|
||||
|
||||
const ActorInit En_Ds_InitVars = {
|
||||
ACTOR_EN_DS,
|
||||
|
@ -28,11 +28,11 @@ const ActorInit En_Ds_InitVars = {
|
|||
(ActorFunc)EnDs_Draw,
|
||||
};
|
||||
|
||||
void EnDs_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnDs_Init(Actor* thisx, PlayState* play) {
|
||||
EnDs* this = (EnDs*)thisx;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gPotionShopLadySkel, &gPotionShopLadyAnim, this->jointTable,
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &gPotionShopLadySkel, &gPotionShopLadyAnim, this->jointTable,
|
||||
this->morphTable, 6);
|
||||
Animation_PlayOnce(&this->skelAnime, &gPotionShopLadyAnim);
|
||||
|
||||
|
@ -47,36 +47,36 @@ void EnDs_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->unk_1E4 = 0.0f;
|
||||
}
|
||||
|
||||
void EnDs_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnDs_Destroy(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void EnDs_Talk(EnDs* this, GlobalContext* globalCtx) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
|
||||
void EnDs_Talk(EnDs* this, PlayState* play) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, play)) {
|
||||
this->actionFunc = EnDs_Wait;
|
||||
this->actor.flags &= ~ACTOR_FLAG_16;
|
||||
}
|
||||
this->unk_1E8 |= 1;
|
||||
}
|
||||
|
||||
void EnDs_TalkNoEmptyBottle(EnDs* this, GlobalContext* globalCtx) {
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
|
||||
Message_CloseTextbox(globalCtx);
|
||||
void EnDs_TalkNoEmptyBottle(EnDs* this, PlayState* play) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
||||
Message_CloseTextbox(play);
|
||||
this->actionFunc = EnDs_Wait;
|
||||
}
|
||||
this->unk_1E8 |= 1;
|
||||
}
|
||||
|
||||
void EnDs_TalkAfterGiveOddPotion(EnDs* this, GlobalContext* globalCtx) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
|
||||
void EnDs_TalkAfterGiveOddPotion(EnDs* this, PlayState* play) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, play)) {
|
||||
this->actionFunc = EnDs_Talk;
|
||||
} else {
|
||||
this->actor.flags |= ACTOR_FLAG_16;
|
||||
func_8002F2CC(&this->actor, globalCtx, 1000.0f);
|
||||
func_8002F2CC(&this->actor, play, 1000.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDs_DisplayOddPotionText(EnDs* this, GlobalContext* globalCtx) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
|
||||
void EnDs_DisplayOddPotionText(EnDs* this, PlayState* play) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, play)) {
|
||||
this->actor.textId = 0x504F;
|
||||
this->actionFunc = EnDs_TalkAfterGiveOddPotion;
|
||||
this->actor.flags &= ~ACTOR_FLAG_8;
|
||||
|
@ -84,47 +84,47 @@ void EnDs_DisplayOddPotionText(EnDs* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnDs_GiveOddPotion(EnDs* this, GlobalContext* globalCtx) {
|
||||
if (Actor_HasParent(&this->actor, globalCtx)) {
|
||||
void EnDs_GiveOddPotion(EnDs* this, PlayState* play) {
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
this->actor.parent = NULL;
|
||||
this->actionFunc = EnDs_DisplayOddPotionText;
|
||||
gSaveContext.timer2State = 0;
|
||||
} else {
|
||||
func_8002F434(&this->actor, globalCtx, GI_ODD_POTION, 10000.0f, 50.0f);
|
||||
func_8002F434(&this->actor, play, GI_ODD_POTION, 10000.0f, 50.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDs_TalkAfterBrewOddPotion(EnDs* this, GlobalContext* globalCtx) {
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
|
||||
Message_CloseTextbox(globalCtx);
|
||||
void EnDs_TalkAfterBrewOddPotion(EnDs* this, PlayState* play) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
|
||||
Message_CloseTextbox(play);
|
||||
this->actionFunc = EnDs_GiveOddPotion;
|
||||
func_8002F434(&this->actor, globalCtx, GI_ODD_POTION, 10000.0f, 50.0f);
|
||||
func_8002F434(&this->actor, play, GI_ODD_POTION, 10000.0f, 50.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDs_BrewOddPotion3(EnDs* this, GlobalContext* globalCtx) {
|
||||
void EnDs_BrewOddPotion3(EnDs* this, PlayState* play) {
|
||||
if (this->brewTimer > 0) {
|
||||
this->brewTimer -= 1;
|
||||
} else {
|
||||
this->actionFunc = EnDs_TalkAfterBrewOddPotion;
|
||||
Message_ContinueTextbox(globalCtx, 0x504D);
|
||||
Message_ContinueTextbox(play, 0x504D);
|
||||
}
|
||||
|
||||
Math_StepToF(&this->unk_1E4, 0, 0.03f);
|
||||
Environment_AdjustLights(globalCtx, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f);
|
||||
Environment_AdjustLights(play, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f);
|
||||
}
|
||||
|
||||
void EnDs_BrewOddPotion2(EnDs* this, GlobalContext* globalCtx) {
|
||||
void EnDs_BrewOddPotion2(EnDs* this, PlayState* play) {
|
||||
if (this->brewTimer > 0) {
|
||||
this->brewTimer -= 1;
|
||||
} else {
|
||||
this->actionFunc = EnDs_BrewOddPotion3;
|
||||
this->brewTimer = 60;
|
||||
Flags_UnsetSwitch(globalCtx, 0x3F);
|
||||
Flags_UnsetSwitch(play, 0x3F);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDs_BrewOddPotion1(EnDs* this, GlobalContext* globalCtx) {
|
||||
void EnDs_BrewOddPotion1(EnDs* this, PlayState* play) {
|
||||
if (this->brewTimer > 0) {
|
||||
this->brewTimer -= 1;
|
||||
} else {
|
||||
|
@ -133,23 +133,23 @@ void EnDs_BrewOddPotion1(EnDs* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
Math_StepToF(&this->unk_1E4, 1.0f, 0.01f);
|
||||
Environment_AdjustLights(globalCtx, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f);
|
||||
Environment_AdjustLights(play, this->unk_1E4 * (2.0f - this->unk_1E4), 0.0f, 0.1f, 1.0f);
|
||||
}
|
||||
|
||||
void EnDs_OfferOddPotion(EnDs* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
void EnDs_OfferOddPotion(EnDs* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
|
||||
switch (play->msgCtx.choiceIndex) {
|
||||
case 0: // yes
|
||||
this->actionFunc = EnDs_BrewOddPotion1;
|
||||
this->brewTimer = 60;
|
||||
Flags_SetSwitch(globalCtx, 0x3F);
|
||||
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
|
||||
Flags_SetSwitch(play, 0x3F);
|
||||
play->msgCtx.msgMode = MSGMODE_PAUSED;
|
||||
player->exchangeItemId = EXCH_ITEM_NONE;
|
||||
break;
|
||||
case 1: // no
|
||||
Message_ContinueTextbox(globalCtx, 0x504C);
|
||||
Message_ContinueTextbox(play, 0x504C);
|
||||
this->actionFunc = EnDs_Talk;
|
||||
}
|
||||
}
|
||||
|
@ -165,48 +165,48 @@ s32 EnDs_CheckRupeesAndBottle() {
|
|||
}
|
||||
}
|
||||
|
||||
void EnDs_GiveBluePotion(EnDs* this, GlobalContext* globalCtx) {
|
||||
if (Actor_HasParent(&this->actor, globalCtx)) {
|
||||
void EnDs_GiveBluePotion(EnDs* this, PlayState* play) {
|
||||
if (Actor_HasParent(&this->actor, play)) {
|
||||
this->actor.parent = NULL;
|
||||
this->actionFunc = EnDs_Talk;
|
||||
} else {
|
||||
func_8002F434(&this->actor, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f);
|
||||
func_8002F434(&this->actor, play, GI_POTION_BLUE, 10000.0f, 50.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void EnDs_OfferBluePotion(EnDs* this, GlobalContext* globalCtx) {
|
||||
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) {
|
||||
switch (globalCtx->msgCtx.choiceIndex) {
|
||||
void EnDs_OfferBluePotion(EnDs* this, PlayState* play) {
|
||||
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
|
||||
switch (play->msgCtx.choiceIndex) {
|
||||
case 0: // yes
|
||||
switch (EnDs_CheckRupeesAndBottle()) {
|
||||
case 0: // have less than 100 rupees
|
||||
Message_ContinueTextbox(globalCtx, 0x500E);
|
||||
Message_ContinueTextbox(play, 0x500E);
|
||||
break;
|
||||
case 1: // have 100 rupees but no empty bottle
|
||||
Message_ContinueTextbox(globalCtx, 0x96);
|
||||
Message_ContinueTextbox(play, 0x96);
|
||||
this->actionFunc = EnDs_TalkNoEmptyBottle;
|
||||
return;
|
||||
case 2: // have 100 rupees and empty bottle
|
||||
Rupees_ChangeBy(-100);
|
||||
this->actor.flags &= ~ACTOR_FLAG_16;
|
||||
func_8002F434(&this->actor, globalCtx, GI_POTION_BLUE, 10000.0f, 50.0f);
|
||||
func_8002F434(&this->actor, play, GI_POTION_BLUE, 10000.0f, 50.0f);
|
||||
this->actionFunc = EnDs_GiveBluePotion;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 1: // no
|
||||
Message_ContinueTextbox(globalCtx, 0x500D);
|
||||
Message_ContinueTextbox(play, 0x500D);
|
||||
}
|
||||
this->actionFunc = EnDs_Talk;
|
||||
}
|
||||
}
|
||||
|
||||
void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
void EnDs_Wait(EnDs* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
s16 yawDiff;
|
||||
|
||||
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
|
||||
if (func_8002F368(globalCtx) == EXCH_ITEM_ODD_MUSHROOM) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, play)) {
|
||||
if (func_8002F368(play) == EXCH_ITEM_ODD_MUSHROOM) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
player->actor.textId = 0x504A;
|
||||
|
@ -227,23 +227,23 @@ void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) {
|
|||
this->actor.textId = 0x5048;
|
||||
|
||||
if ((ABS(yawDiff) < 0x2151) && (this->actor.xzDistToPlayer < 200.0f)) {
|
||||
func_8002F298(&this->actor, globalCtx, 100.0f, EXCH_ITEM_ODD_MUSHROOM);
|
||||
func_8002F298(&this->actor, play, 100.0f, EXCH_ITEM_ODD_MUSHROOM);
|
||||
this->unk_1E8 |= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnDs_Update(Actor* thisx, PlayState* play) {
|
||||
EnDs* this = (EnDs*)thisx;
|
||||
|
||||
if (SkelAnime_Update(&this->skelAnime) != 0) {
|
||||
this->skelAnime.curFrame = 0.0f;
|
||||
}
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
this->actionFunc(this, play);
|
||||
|
||||
if (this->unk_1E8 & 1) {
|
||||
func_80038290(globalCtx, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos);
|
||||
func_80038290(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos);
|
||||
} else {
|
||||
Math_SmoothStepToS(&this->unk_1D8.x, 0, 6, 0x1838, 100);
|
||||
Math_SmoothStepToS(&this->unk_1D8.y, 0, 6, 0x1838, 100);
|
||||
|
@ -252,7 +252,7 @@ void EnDs_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
s32 EnDs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
s32 EnDs_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
EnDs* this = (EnDs*)thisx;
|
||||
|
||||
if (limbIndex == 5) {
|
||||
|
@ -262,7 +262,7 @@ s32 EnDs_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
|
|||
return false;
|
||||
}
|
||||
|
||||
void EnDs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
void EnDs_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
static Vec3f sMultVec = { 1100.0f, 500.0f, 0.0f };
|
||||
EnDs* this = (EnDs*)thisx;
|
||||
|
||||
|
@ -271,10 +271,10 @@ void EnDs_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
|
|||
}
|
||||
}
|
||||
|
||||
void EnDs_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnDs_Draw(Actor* thisx, PlayState* play) {
|
||||
EnDs* this = (EnDs*)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,
|
||||
EnDs_OverrideLimbDraw, EnDs_PostLimbDraw, this);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
struct EnDs;
|
||||
|
||||
typedef void (*EnDsActionFunc)(struct EnDs*, GlobalContext*);
|
||||
typedef void (*EnDsActionFunc)(struct EnDs*, PlayState*);
|
||||
|
||||
typedef struct EnDs {
|
||||
/* 0x0000 */ Actor actor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue