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:
parent
154f44b6da
commit
2e6279bc8e
912 changed files with 40489 additions and 41078 deletions
|
@ -13,20 +13,20 @@
|
|||
#define FU_RESET_LOOK_ANGLE (1 << 0)
|
||||
#define FU_WAIT (1 << 1)
|
||||
|
||||
void EnFu_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFu_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFu_Init(Actor* thisx, PlayState* play);
|
||||
void EnFu_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnFu_Update(Actor* thisx, PlayState* play);
|
||||
void EnFu_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx);
|
||||
void func_80A1DA04(EnFu* this, GlobalContext* globalCtx);
|
||||
void EnFu_WaitChild(EnFu* this, PlayState* play);
|
||||
void func_80A1DA04(EnFu* this, PlayState* play);
|
||||
|
||||
void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx);
|
||||
void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx);
|
||||
void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx);
|
||||
void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx);
|
||||
void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx);
|
||||
void func_80A1DB60(EnFu* this, GlobalContext* globalCtx);
|
||||
void EnFu_WaitAdult(EnFu* this, PlayState* play);
|
||||
void EnFu_TeachSong(EnFu* this, PlayState* play);
|
||||
void EnFu_WaitForPlayback(EnFu* this, PlayState* play);
|
||||
void func_80A1DBA0(EnFu* this, PlayState* play);
|
||||
void func_80A1DBD4(EnFu* this, PlayState* play);
|
||||
void func_80A1DB60(EnFu* this, PlayState* play);
|
||||
|
||||
const ActorInit En_Fu_InitVars = {
|
||||
ACTOR_EN_FU,
|
||||
|
@ -71,16 +71,16 @@ typedef enum {
|
|||
/* 0x01 */ FU_FACE_MAD
|
||||
} EnFuFace;
|
||||
|
||||
void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFu_Init(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnFu* this = (EnFu*)thisx;
|
||||
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelanime, &gWindmillManSkel, &gWindmillManPlayStillAnim, this->jointTable,
|
||||
SkelAnime_InitFlex(play, &this->skelanime, &gWindmillManSkel, &gWindmillManPlayStillAnim, this->jointTable,
|
||||
this->morphTable, FU_LIMB_MAX);
|
||||
Animation_PlayLoop(&this->skelanime, &gWindmillManPlayStillAnim);
|
||||
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);
|
||||
if (!LINK_IS_ADULT) {
|
||||
|
@ -95,15 +95,15 @@ void EnFu_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->actor.targetMode = 6;
|
||||
}
|
||||
|
||||
void EnFu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFu_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnFu* this = (EnFu*)thisx;
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
Collider_DestroyCylinder(play, &this->collider);
|
||||
}
|
||||
|
||||
s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFunc actionFunc) {
|
||||
s32 func_80A1D94C(EnFu* this, PlayState* play, u16 textID, EnFuActionFunc actionFunc) {
|
||||
s16 yawDiff;
|
||||
|
||||
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
|
||||
if (Actor_ProcessTalkRequest(&this->actor, play)) {
|
||||
this->actionFunc = actionFunc;
|
||||
return true;
|
||||
}
|
||||
|
@ -111,15 +111,15 @@ s32 func_80A1D94C(EnFu* this, GlobalContext* globalCtx, u16 textID, EnFuActionFu
|
|||
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
|
||||
|
||||
if ((ABS(yawDiff) < 0x2301) && (this->actor.xzDistToPlayer < 100.0f)) {
|
||||
func_8002F2CC(&this->actor, globalCtx, 100.0f);
|
||||
func_8002F2CC(&this->actor, play, 100.0f);
|
||||
} else {
|
||||
this->behaviorFlags |= FU_RESET_LOOK_ANGLE;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void func_80A1DA04(EnFu* this, GlobalContext* globalCtx) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
|
||||
void func_80A1DA04(EnFu* this, PlayState* play) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, play)) {
|
||||
this->behaviorFlags &= ~FU_WAIT;
|
||||
this->actionFunc = EnFu_WaitChild;
|
||||
|
||||
|
@ -130,8 +130,8 @@ void func_80A1DA04(EnFu* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) {
|
||||
u16 textID = Text_GetFaceReaction(globalCtx, 0xB);
|
||||
void EnFu_WaitChild(EnFu* this, PlayState* play) {
|
||||
u16 textID = Text_GetFaceReaction(play, 0xB);
|
||||
|
||||
if (textID == 0) {
|
||||
textID = GET_EVENTCHKINF(EVENTCHKINF_67) ? 0x5033 : 0x5032;
|
||||
|
@ -139,7 +139,7 @@ void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) {
|
|||
|
||||
// if ACTOR_FLAG_8 is set and textID is 0x5033, change animation
|
||||
// if func_80A1D94C returns 1, actionFunc is set to func_80A1DA04
|
||||
if (func_80A1D94C(this, globalCtx, textID, func_80A1DA04)) {
|
||||
if (func_80A1D94C(this, play, textID, func_80A1DA04)) {
|
||||
if (textID == 0x5033) {
|
||||
Animation_Change(&this->skelanime, &gWindmillManPlayAndMoveHeadAnim, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(&gWindmillManPlayAndMoveHeadAnim), ANIMMODE_ONCE, -4.0f);
|
||||
|
@ -147,105 +147,105 @@ void EnFu_WaitChild(EnFu* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_80A1DB60(EnFu* this, GlobalContext* globalCtx) {
|
||||
if (globalCtx->csCtx.state == CS_STATE_IDLE) {
|
||||
void func_80A1DB60(EnFu* this, PlayState* play) {
|
||||
if (play->csCtx.state == CS_STATE_IDLE) {
|
||||
this->actionFunc = EnFu_WaitAdult;
|
||||
SET_EVENTCHKINF(EVENTCHKINF_5B);
|
||||
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
|
||||
void func_80A1DBA0(EnFu* this, PlayState* play) {
|
||||
if (Actor_TextboxIsClosing(&this->actor, play)) {
|
||||
this->actionFunc = EnFu_WaitAdult;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
void func_80A1DBD4(EnFu* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_04) {
|
||||
if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) {
|
||||
this->actionFunc = EnFu_WaitAdult;
|
||||
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_04;
|
||||
this->actor.flags &= ~ACTOR_FLAG_16;
|
||||
} else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_03) {
|
||||
} else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) {
|
||||
func_80078884(NA_SE_SY_CORRECT_CHIME);
|
||||
this->actionFunc = func_80A1DB60;
|
||||
this->actor.flags &= ~ACTOR_FLAG_16;
|
||||
globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSongOfStormsCs);
|
||||
play->csCtx.segment = SEGMENTED_TO_VIRTUAL(gSongOfStormsCs);
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
Item_Give(globalCtx, ITEM_SONG_STORMS);
|
||||
globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00;
|
||||
Item_Give(play, ITEM_SONG_STORMS);
|
||||
play->msgCtx.ocarinaMode = OCARINA_MODE_00;
|
||||
SET_EVENTCHKINF(EVENTCHKINF_65);
|
||||
} else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_02) {
|
||||
} else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) {
|
||||
player->stateFlags2 &= ~PLAYER_STATE2_24;
|
||||
this->actionFunc = EnFu_WaitAdult;
|
||||
} else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) {
|
||||
} else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) {
|
||||
player->stateFlags2 |= PLAYER_STATE2_23;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
void EnFu_WaitForPlayback(EnFu* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
player->stateFlags2 |= PLAYER_STATE2_23;
|
||||
// if dialog state is 7, player has played back the song
|
||||
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) {
|
||||
func_8010BD58(globalCtx, OCARINA_ACTION_PLAYBACK_STORMS);
|
||||
if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) {
|
||||
func_8010BD58(play, OCARINA_ACTION_PLAYBACK_STORMS);
|
||||
this->actionFunc = func_80A1DBD4;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
void EnFu_TeachSong(EnFu* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
player->stateFlags2 |= PLAYER_STATE2_23;
|
||||
// if dialog state is 2, start song demonstration
|
||||
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
|
||||
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) {
|
||||
this->behaviorFlags &= ~FU_WAIT;
|
||||
// Ocarina is set to harp here but is immediately overwritten to the grind organ in the message system
|
||||
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_HARP);
|
||||
func_8010BD58(globalCtx, OCARINA_ACTION_TEACH_STORMS);
|
||||
func_8010BD58(play, OCARINA_ACTION_TEACH_STORMS);
|
||||
this->actionFunc = EnFu_WaitForPlayback;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) {
|
||||
void EnFu_WaitAdult(EnFu* this, PlayState* play) {
|
||||
static s16 yawDiff;
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
|
||||
if (GET_EVENTCHKINF(EVENTCHKINF_5B)) {
|
||||
func_80A1D94C(this, globalCtx, 0x508E, func_80A1DBA0);
|
||||
func_80A1D94C(this, play, 0x508E, func_80A1DBA0);
|
||||
} else if (player->stateFlags2 & PLAYER_STATE2_24) {
|
||||
this->actor.textId = 0x5035;
|
||||
Message_StartTextbox(globalCtx, this->actor.textId, NULL);
|
||||
Message_StartTextbox(play, this->actor.textId, NULL);
|
||||
this->actionFunc = EnFu_TeachSong;
|
||||
this->behaviorFlags |= FU_WAIT;
|
||||
} else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
|
||||
} else if (Actor_ProcessTalkRequest(&this->actor, play)) {
|
||||
this->actionFunc = func_80A1DBA0;
|
||||
} else if (ABS(yawDiff) < 0x2301) {
|
||||
if (this->actor.xzDistToPlayer < 100.0f) {
|
||||
this->actor.textId = 0x5034;
|
||||
func_8002F2CC(&this->actor, globalCtx, 100.0f);
|
||||
func_8002F2CC(&this->actor, play, 100.0f);
|
||||
player->stateFlags2 |= PLAYER_STATE2_23;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFu_Update(Actor* thisx, PlayState* play) {
|
||||
s32 pad;
|
||||
EnFu* this = (EnFu*)thisx;
|
||||
|
||||
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->behaviorFlags & FU_WAIT) && (SkelAnime_Update(&this->skelanime) != 0)) {
|
||||
Animation_Change(&this->skelanime, this->skelanime.animation, 1.0f, 0.0f,
|
||||
Animation_GetLastFrame(this->skelanime.animation), ANIMMODE_ONCE, 0.0f);
|
||||
}
|
||||
this->actionFunc(this, globalCtx);
|
||||
this->actionFunc(this, play);
|
||||
if (this->behaviorFlags & FU_RESET_LOOK_ANGLE) {
|
||||
Math_SmoothStepToS(&this->lookAngleOffset.x, 0, 6, 6200, 100);
|
||||
Math_SmoothStepToS(&this->lookAngleOffset.y, 0, 6, 6200, 100);
|
||||
|
@ -253,11 +253,11 @@ void EnFu_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Math_SmoothStepToS(&this->unk_2A2.y, 0, 6, 6200, 100);
|
||||
this->behaviorFlags &= ~FU_RESET_LOOK_ANGLE;
|
||||
} else {
|
||||
func_80038290(globalCtx, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos);
|
||||
func_80038290(play, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos);
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
s32 EnFu_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
EnFu* this = (EnFu*)thisx;
|
||||
s32 pad;
|
||||
|
||||
|
@ -278,13 +278,13 @@ s32 EnFu_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
|
|||
}
|
||||
|
||||
if (limbIndex == FU_LIMB_CHEST_MUSIC_BOX) {
|
||||
rot->y += (Math_SinS((globalCtx->state.frames * (limbIndex * 50 + 0x814))) * 200.0f);
|
||||
rot->z += (Math_CosS((globalCtx->state.frames * (limbIndex * 50 + 0x940))) * 200.0f);
|
||||
rot->y += (Math_SinS((play->state.frames * (limbIndex * 50 + 0x814))) * 200.0f);
|
||||
rot->z += (Math_CosS((play->state.frames * (limbIndex * 50 + 0x940))) * 200.0f);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
void EnFu_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
EnFu* this = (EnFu*)thisx;
|
||||
|
||||
if (limbIndex == FU_LIMB_HEAD) {
|
||||
|
@ -292,19 +292,19 @@ void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
|
|||
}
|
||||
}
|
||||
|
||||
void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFu_Draw(Actor* thisx, PlayState* play) {
|
||||
static void* sEyesSegments[] = { gWindmillManEyeClosedTex, gWindmillManEyeAngryTex };
|
||||
static void* sMouthSegments[] = { gWindmillManMouthOpenTex, gWindmillManMouthAngryTex };
|
||||
s32 pad;
|
||||
EnFu* this = (EnFu*)thisx;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fu.c", 773);
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_en_fu.c", 773);
|
||||
|
||||
func_800943C8(globalCtx->state.gfxCtx);
|
||||
func_800943C8(play->state.gfxCtx);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->facialExpression]));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthSegments[this->facialExpression]));
|
||||
SkelAnime_DrawFlexOpa(globalCtx, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount,
|
||||
SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount,
|
||||
EnFu_OverrideLimbDraw, EnFu_PostLimbDraw, this);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fu.c", 791);
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_en_fu.c", 791);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
struct EnFu;
|
||||
|
||||
typedef void (*EnFuActionFunc)(struct EnFu*, GlobalContext*);
|
||||
typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*);
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ FU_LIMB_ROOT,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue