1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-19 13:35:18 +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

@ -5,34 +5,34 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5)
void EnGo_Init(Actor* thisx, GlobalContext* globalCtx);
void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnGo_Update(Actor* thisx, GlobalContext* globalCtx);
void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnGo_Init(Actor* thisx, PlayState* play);
void EnGo_Destroy(Actor* thisx, PlayState* play);
void EnGo_Update(Actor* thisx, PlayState* play);
void EnGo_Draw(Actor* thisx, PlayState* play);
void func_80A3FEB4(EnGo* this, GlobalContext* globalCtx);
void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx);
void func_80A4008C(EnGo* this, GlobalContext* globalCtx);
void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx);
void EnGo_FireGenericActionFunc(EnGo* this, GlobalContext* globalCtx);
void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx);
void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx);
void func_80A3FEB4(EnGo* this, PlayState* play);
void EnGo_StopRolling(EnGo* this, PlayState* play);
void func_80A4008C(EnGo* this, PlayState* play);
void EnGo_GoronLinkRolling(EnGo* this, PlayState* play);
void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play);
void EnGo_CurledUp(EnGo* this, PlayState* play);
void EnGo_WakeUp(EnGo* this, PlayState* play);
void func_80A40494(EnGo* this, GlobalContext* globalCtx);
void func_80A405CC(EnGo* this, GlobalContext* globalCtx);
void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx);
void func_80A408D8(EnGo* this, GlobalContext* globalCtx);
void func_80A40494(EnGo* this, PlayState* play);
void func_80A405CC(EnGo* this, PlayState* play);
void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play);
void func_80A408D8(EnGo* this, PlayState* play);
void func_80A40B1C(EnGo* this, GlobalContext* globalCtx);
void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx);
void func_80A40C78(EnGo* this, GlobalContext* globalCtx);
void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx);
void func_80A40DCC(EnGo* this, GlobalContext* globalCtx);
void func_80A40B1C(EnGo* this, PlayState* play);
void EnGo_GetItem(EnGo* this, PlayState* play);
void func_80A40C78(EnGo* this, PlayState* play);
void EnGo_Eyedrops(EnGo* this, PlayState* play);
void func_80A40DCC(EnGo* this, PlayState* play);
void EnGo_SpawnEffectDust(EnGo* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, u8 initialTimer, f32 scale,
f32 scaleStep);
void EnGo_UpdateEffects(EnGo* this);
void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx);
void EnGo_DrawEffects(EnGo* this, PlayState* play);
const ActorInit En_Go_InitVars = {
ACTOR_EN_GO,
@ -88,8 +88,8 @@ void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) {
Player* player = GET_PLAYER(globalCtx);
u16 EnGo_GetTextID(PlayState* play, Actor* thisx) {
Player* player = GET_PLAYER(play);
switch (thisx->params & 0xF0) {
case 0x90:
@ -135,7 +135,7 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) {
}
}
case 0x10:
if (Flags_GetSwitch(globalCtx, thisx->params >> 8)) {
if (Flags_GetSwitch(play, thisx->params >> 8)) {
return 0x3052;
} else {
return 0x3051;
@ -195,14 +195,14 @@ u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) {
}
}
s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
s16 EnGo_SetFlagsGetStates(PlayState* play, Actor* thisx) {
s16 unkState = 1;
f32 xzRange;
f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f;
xzRange = thisx->xzDistToPlayer + 1.0f;
switch (Message_GetState(&globalCtx->msgCtx)) {
if (globalCtx) {}
switch (Message_GetState(&play->msgCtx)) {
if (play) {}
case TEXT_STATE_CLOSING:
switch (thisx->textId) {
case 0x3008:
@ -226,7 +226,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
unkState = 0;
break;
case 0x3036:
func_8002F434(thisx, globalCtx, GI_TUNIC_GORON, xzRange, yRange);
func_8002F434(thisx, play, GI_TUNIC_GORON, xzRange, yRange);
SET_INFTABLE(INFTABLE_10D); // EnGo exclusive flag
unkState = 2;
break;
@ -256,10 +256,10 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
}
break;
case TEXT_STATE_CHOICE:
if (Message_ShouldAdvance(globalCtx)) {
if (Message_ShouldAdvance(play)) {
switch (thisx->textId) {
case 0x300A:
if (globalCtx->msgCtx.choiceIndex == 0) {
if (play->msgCtx.choiceIndex == 0) {
if (CUR_UPG_VALUE(UPG_STRENGTH) != 0 || GET_INFTABLE(INFTABLE_EB)) {
thisx->textId = 0x300B;
} else {
@ -268,11 +268,11 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
} else {
thisx->textId = 0x300D;
}
Message_ContinueTextbox(globalCtx, thisx->textId);
Message_ContinueTextbox(play, thisx->textId);
unkState = 1;
break;
case 0x3034:
if (globalCtx->msgCtx.choiceIndex == 0) {
if (play->msgCtx.choiceIndex == 0) {
if (GET_INFTABLE(INFTABLE_10B)) {
thisx->textId = 0x3033;
} else {
@ -283,16 +283,16 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
} else {
thisx->textId = 0x3033;
}
Message_ContinueTextbox(globalCtx, thisx->textId);
Message_ContinueTextbox(play, thisx->textId);
unkState = 1;
break;
case 0x3054:
case 0x3055:
if (globalCtx->msgCtx.choiceIndex == 0) {
if (play->msgCtx.choiceIndex == 0) {
unkState = 2;
} else {
thisx->textId = 0x3056;
Message_ContinueTextbox(globalCtx, thisx->textId);
Message_ContinueTextbox(play, thisx->textId);
unkState = 1;
}
SET_INFTABLE(INFTABLE_B4);
@ -301,14 +301,14 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
}
break;
case TEXT_STATE_EVENT:
if (Message_ShouldAdvance(globalCtx)) {
if (Message_ShouldAdvance(play)) {
switch (thisx->textId) {
case 0x3035:
SET_INFTABLE(INFTABLE_10B);
case 0x3032:
case 0x3033:
thisx->textId = 0x3034;
Message_ContinueTextbox(globalCtx, thisx->textId);
Message_ContinueTextbox(play, thisx->textId);
unkState = 1;
break;
default:
@ -318,7 +318,7 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
}
break;
case TEXT_STATE_DONE:
if (Message_ShouldAdvance(globalCtx)) {
if (Message_ShouldAdvance(play)) {
unkState = 3;
}
break;
@ -332,18 +332,18 @@ s16 EnGo_SetFlagsGetStates(GlobalContext* globalCtx, Actor* thisx) {
return unkState;
}
s32 func_80A3ED24(GlobalContext* globalCtx, EnGo* this, struct_80034A14_arg1* arg2, f32 arg3,
u16 (*getTextId)(GlobalContext*, Actor*), s16 (*unkFunc2)(GlobalContext*, Actor*)) {
s32 func_80A3ED24(PlayState* play, EnGo* this, struct_80034A14_arg1* arg2, f32 arg3,
u16 (*getTextId)(PlayState*, Actor*), s16 (*unkFunc2)(PlayState*, Actor*)) {
if (arg2->unk_00) {
arg2->unk_00 = unkFunc2(globalCtx, &this->actor);
arg2->unk_00 = unkFunc2(play, &this->actor);
return false;
} else if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
} else if (Actor_ProcessTalkRequest(&this->actor, play)) {
arg2->unk_00 = 1;
return true;
} else if (!func_8002F2CC(&this->actor, globalCtx, arg3)) {
} else if (!func_8002F2CC(&this->actor, play, arg3)) {
return false;
} else {
this->actor.textId = getTextId(globalCtx, &this->actor);
this->actor.textId = getTextId(play, &this->actor);
return false;
}
}
@ -355,19 +355,19 @@ void EnGo_ChangeAnim(EnGo* this, s32 index) {
sAnimationInfo[index].morphFrames);
}
s32 EnGo_IsActorSpawned(EnGo* this, GlobalContext* globalCtx) {
s32 EnGo_IsActorSpawned(EnGo* this, PlayState* play) {
if (((this->actor.params) & 0xF0) == 0x90) {
return true;
} else if (globalCtx->sceneNum == SCENE_HIDAN && !Flags_GetSwitch(globalCtx, (this->actor.params) >> 8) &&
LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x10) {
} else if (play->sceneNum == SCENE_HIDAN && !Flags_GetSwitch(play, (this->actor.params) >> 8) && LINK_IS_ADULT &&
(this->actor.params & 0xF0) == 0x10) {
return true;
} else if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) {
} else if (play->sceneNum == SCENE_SPOT18 && LINK_IS_ADULT && (this->actor.params & 0xF0) == 0x00) {
return true;
} else if (globalCtx->sceneNum == SCENE_SPOT16 && LINK_IS_CHILD &&
} else if (play->sceneNum == SCENE_SPOT16 && LINK_IS_CHILD &&
((this->actor.params & 0xF0) == 0x20 || (this->actor.params & 0xF0) == 0x30 ||
(this->actor.params & 0xF0) == 0x40)) {
return true;
} else if (globalCtx->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD &&
} else if (play->sceneNum == SCENE_SPOT18 && LINK_IS_CHILD &&
((this->actor.params & 0xF0) == 0x50 || (this->actor.params & 0xF0) == 0x60 ||
(this->actor.params & 0xF0) == 0x70)) {
return true;
@ -393,8 +393,8 @@ f32 EnGo_GetGoronSize(EnGo* this) {
}
}
void func_80A3F060(EnGo* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_80A3F060(EnGo* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 unkVal;
if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc &&
@ -417,10 +417,10 @@ void func_80A3F0E4(EnGo* this) {
}
}
s32 EnGo_IsCameraModified(EnGo* this, GlobalContext* globalCtx) {
s32 EnGo_IsCameraModified(EnGo* this, PlayState* play) {
f32 xyzDistSq;
s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
Camera* mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN];
Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN];
if (fabsf(yawDiff) > 10920.0f) {
return 0;
@ -462,7 +462,7 @@ void EnGo_UpdateShadow(EnGo* this) {
this->actor.shape.shadowAlpha = shadowAlpha;
}
s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) {
s32 EnGo_FollowPath(EnGo* this, PlayState* play) {
Path* path;
Vec3s* pointPos;
f32 xDist;
@ -472,7 +472,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) {
return false;
}
path = &globalCtx->setupPathList[this->actor.params & 0xF];
path = &play->setupPathList[this->actor.params & 0xF];
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
pointPos += this->unk_218;
xDist = pointPos->x - this->actor.world.pos.x;
@ -487,7 +487,7 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) {
if ((this->actor.params & 0xF0) != 0x00) {
return true;
} else if (Flags_GetSwitch(globalCtx, this->actor.params >> 8)) {
} else if (Flags_GetSwitch(play, this->actor.params >> 8)) {
return true;
} else if (this->unk_218 >= this->actor.shape.rot.z) {
this->unk_218 = 0;
@ -499,14 +499,14 @@ s32 EnGo_FollowPath(EnGo* this, GlobalContext* globalCtx) {
return false;
}
s32 EnGo_SetMovedPos(EnGo* this, GlobalContext* globalCtx) {
s32 EnGo_SetMovedPos(EnGo* this, PlayState* play) {
Path* path;
Vec3s* pointPos;
if ((this->actor.params & 0xF) == 0xF) {
return false;
} else {
path = &globalCtx->setupPathList[this->actor.params & 0xF];
path = &play->setupPathList[this->actor.params & 0xF];
pointPos = SEGMENTED_TO_VIRTUAL(path->points);
pointPos += (path->count - 1);
this->actor.world.pos.x = pointPos->x;
@ -568,8 +568,8 @@ s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) {
}
}
void func_80A3F908(EnGo* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void func_80A3F908(EnGo* this, PlayState* play) {
Player* player = GET_PLAYER(play);
f32 float1;
s32 isUnkCondition;
@ -585,16 +585,15 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) {
}
if ((this->actor.params & 0xF0) == 0x90) {
isUnkCondition =
func_80A3ED24(globalCtx, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates);
isUnkCondition = func_80A3ED24(play, this, &this->unk_1E0, float1, EnGo_GetTextID, EnGo_SetFlagsGetStates);
} else {
isUnkCondition = func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID,
isUnkCondition = func_800343CC(play, &this->actor, &this->unk_1E0.unk_00, float1, EnGo_GetTextID,
EnGo_SetFlagsGetStates);
}
if (((this->actor.params & 0xF0) == 0x90) && (isUnkCondition == true)) {
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_SWORD_BROKEN) {
if (func_8002F368(globalCtx) == EXCH_ITEM_SWORD_BROKEN) {
if (func_8002F368(play) == EXCH_ITEM_SWORD_BROKEN) {
if (GET_INFTABLE(INFTABLE_B4)) {
this->actor.textId = 0x3055;
} else {
@ -607,7 +606,7 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) {
}
if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYEDROPS) {
if (func_8002F368(globalCtx) == EXCH_ITEM_EYEDROPS) {
if (func_8002F368(play) == EXCH_ITEM_EYEDROPS) {
this->actor.textId = 0x3059;
} else {
this->actor.textId = 0x3058;
@ -618,19 +617,19 @@ void func_80A3F908(EnGo* this, GlobalContext* globalCtx) {
}
}
void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnGo_Init(Actor* thisx, PlayState* play) {
EnGo* this = (EnGo*)thisx;
s32 pad;
Vec3f D_80A41B9C = { 0.0f, 0.0f, 0.0f }; // unused
Vec3f D_80A41BA8 = { 0.0f, 0.0f, 0.0f }; // unused
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGoronSkel, NULL, 0, 0, 0);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, 0, 0, 0);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x16), &sColChkInfoInit);
if (!EnGo_IsActorSpawned(this, globalCtx)) {
if (!EnGo_IsActorSpawned(this, play)) {
Actor_Kill(&this->actor);
return;
}
@ -649,7 +648,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) {
case 0x00:
Actor_SetScale(&this->actor, 0.008f);
if (CHECK_OWNED_EQUIP(EQUIP_TYPE_TUNIC, EQUIP_INV_TUNIC_GORON)) {
EnGo_SetMovedPos(this, globalCtx);
EnGo_SetMovedPos(this, play);
EnGo_SetupAction(this, EnGo_CurledUp);
} else {
this->actor.shape.yOffset = 1400.0f;
@ -664,7 +663,7 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) {
break;
case 0x40:
if (GET_INFTABLE(INFTABLE_EB)) {
EnGo_SetMovedPos(this, globalCtx);
EnGo_SetMovedPos(this, play);
}
Actor_SetScale(&this->actor, 0.015f);
EnGo_SetupAction(this, EnGo_CurledUp);
@ -691,34 +690,34 @@ void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
void EnGo_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnGo_Destroy(Actor* thisx, PlayState* play) {
EnGo* this = (EnGo*)thisx;
SkelAnime_Free(&this->skelAnime, globalCtx);
Collider_DestroyCylinder(globalCtx, &this->collider);
SkelAnime_Free(&this->skelAnime, play);
Collider_DestroyCylinder(play, &this->collider);
}
void func_80A3FEB4(EnGo* this, GlobalContext* globalCtx) {
void func_80A3FEB4(EnGo* this, PlayState* play) {
if (!(this->actor.xyzDistToPlayerSq > SQ(1200.0f))) {
EnGo_SetupAction(this, EnGo_StopRolling);
}
}
void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx) {
void EnGo_StopRolling(EnGo* this, PlayState* play) {
EnBom* bomb;
if (DECR(this->unk_20E) == 0) {
if (this->collider.base.ocFlags2 & 1) {
this->collider.base.ocFlags2 &= ~1;
globalCtx->damagePlayer(globalCtx, -4);
func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f);
play->damagePlayer(play, -4);
func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f);
this->unk_20E = 0x10;
}
}
this->actor.speedXZ = 3.0f;
if ((EnGo_FollowPath(this, globalCtx) == true) && (this->unk_218 == 0)) {
bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->actor.world.pos.x,
if ((EnGo_FollowPath(this, play) == true) && (this->unk_218 == 0)) {
bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
if (bomb != NULL) {
bomb->timer = 0;
@ -735,7 +734,7 @@ void EnGo_StopRolling(EnGo* this, GlobalContext* globalCtx) {
}
}
void func_80A4008C(EnGo* this, GlobalContext* globalCtx) {
void func_80A4008C(EnGo* this, PlayState* play) {
if (EnGo_IsRollingOnGround(this, 3, 6.0f)) {
if (this->unk_21A == 0) {
this->actor.shape.yOffset = 0.0f;
@ -746,8 +745,8 @@ void func_80A4008C(EnGo* this, GlobalContext* globalCtx) {
}
}
void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx) {
if ((EnGo_FollowPath(this, globalCtx) == true) && Flags_GetSwitch(globalCtx, this->actor.params >> 8) &&
void EnGo_GoronLinkRolling(EnGo* this, PlayState* play) {
if ((EnGo_FollowPath(this, play) == true) && Flags_GetSwitch(play, this->actor.params >> 8) &&
(this->unk_218 == 0)) {
this->actor.speedXZ = 0.0f;
EnGo_SetupAction(this, func_80A4008C);
@ -761,11 +760,11 @@ void EnGo_GoronLinkRolling(EnGo* this, GlobalContext* globalCtx) {
}
}
void EnGo_FireGenericActionFunc(EnGo* this, GlobalContext* globalCtx) {
void EnGo_FireGenericActionFunc(EnGo* this, PlayState* play) {
}
void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx) {
if ((DECR(this->unk_210) == 0) && EnGo_IsCameraModified(this, globalCtx)) {
void EnGo_CurledUp(EnGo* this, PlayState* play) {
if ((DECR(this->unk_210) == 0) && EnGo_IsCameraModified(this, play)) {
Audio_PlaySoundGeneral(NA_SE_EN_GOLON_WAKE_UP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -774,12 +773,12 @@ void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx) {
EnGo_SetupAction(this, EnGo_WakeUp);
if ((this->actor.params & 0xF0) == 0x90) {
OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 4200, -99, &this->actor, CAM_ID_MAIN);
}
}
}
void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx) {
void EnGo_WakeUp(EnGo* this, PlayState* play) {
f32 frame;
if (this->skelAnime.playSpeed != 0.0f) {
@ -804,14 +803,14 @@ void EnGo_WakeUp(EnGo* this, GlobalContext* globalCtx) {
Audio_PlaySoundGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
EnGo_SetupAction(this, func_80A405CC);
} else if (!EnGo_IsCameraModified(this, globalCtx)) {
} else if (!EnGo_IsCameraModified(this, play)) {
EnGo_ReverseAnimation(this);
this->skelAnime.playSpeed = 0.0f;
EnGo_SetupAction(this, func_80A40494);
}
}
void func_80A40494(EnGo* this, GlobalContext* globalCtx) {
void func_80A40494(EnGo* this, PlayState* play) {
f32 frame;
Math_SmoothStepToF(&this->skelAnime.playSpeed, ((this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f) * -0.5f, 0.1f,
@ -831,7 +830,7 @@ void func_80A40494(EnGo* this, GlobalContext* globalCtx) {
}
}
void func_80A405CC(EnGo* this, GlobalContext* globalCtx) {
void func_80A405CC(EnGo* this, PlayState* play) {
f32 lastFrame;
f32 frame;
@ -854,7 +853,7 @@ void func_80A405CC(EnGo* this, GlobalContext* globalCtx) {
}
}
void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) {
void EnGo_BiggoronActionFunc(EnGo* this, PlayState* play) {
if (((this->actor.params & 0xF0) == 0x90) && (this->unk_1E0.unk_00 == 2)) {
if (gSaveContext.bgsFlag) {
this->unk_1E0.unk_00 = 0;
@ -864,22 +863,22 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) {
this->unk_21E = 100;
this->unk_1E0.unk_00 = 0;
EnGo_SetupAction(this, EnGo_Eyedrops);
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
play->msgCtx.msgMode = MSGMODE_PAUSED;
gSaveContext.timer2State = 0;
OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, CAM_ID_MAIN);
OnePointCutscene_Init(play, 4190, -99, &this->actor, CAM_ID_MAIN);
} else {
this->unk_1E0.unk_00 = 0;
EnGo_SetupAction(this, EnGo_GetItem);
Message_CloseTextbox(globalCtx);
EnGo_GetItem(this, globalCtx);
Message_CloseTextbox(play);
EnGo_GetItem(this, play);
}
}
} else if (((this->actor.params & 0xF0) == 0) && (this->unk_1E0.unk_00 == 2)) {
EnGo_SetupAction(this, EnGo_GetItem);
globalCtx->msgCtx.stateTimer = 4;
globalCtx->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
play->msgCtx.stateTimer = 4;
play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING;
} else {
if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, globalCtx)) {
if ((DECR(this->unk_212) == 0) && !EnGo_IsCameraModified(this, play)) {
EnGo_ReverseAnimation(this);
this->skelAnime.playSpeed = -0.1f;
this->skelAnime.playSpeed *= (this->actor.params & 0xF0) == 0x90 ? 0.5f : 1.0f;
@ -888,7 +887,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) {
}
}
void func_80A408D8(EnGo* this, GlobalContext* globalCtx) {
void func_80A408D8(EnGo* this, PlayState* play) {
f32 frame;
if (this->skelAnime.playSpeed != 0.0f) {
@ -910,7 +909,7 @@ void func_80A408D8(EnGo* this, GlobalContext* globalCtx) {
if (DECR(this->unk_212) == 0) {
EnGo_SetupAction(this, func_80A40494);
} else if (EnGo_IsCameraModified(this, globalCtx)) {
} else if (EnGo_IsCameraModified(this, play)) {
EnGo_ReverseAnimation(this);
Audio_PlaySoundGeneral(NA_SE_EN_GOLON_SIT_DOWN, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -919,12 +918,12 @@ void func_80A408D8(EnGo* this, GlobalContext* globalCtx) {
}
}
void func_80A40A54(EnGo* this, GlobalContext* globalCtx) {
void func_80A40A54(EnGo* this, PlayState* play) {
f32 float1 = ((f32)0x8000 / Animation_GetLastFrame(&gGoronAnim_010590));
f32 float2 = this->skelAnime.curFrame * float1;
this->actor.speedXZ = Math_SinS((s16)float2);
if (EnGo_FollowPath(this, globalCtx) && this->unk_218 == 0) {
if (EnGo_FollowPath(this, play) && this->unk_218 == 0) {
EnGo_ChangeAnim(this, ENGO_ANIM_1);
this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930);
this->actor.speedXZ = 0.0f;
@ -932,21 +931,21 @@ void func_80A40A54(EnGo* this, GlobalContext* globalCtx) {
}
}
void func_80A40B1C(EnGo* this, GlobalContext* globalCtx) {
void func_80A40B1C(EnGo* this, PlayState* play) {
if (GET_INFTABLE(INFTABLE_EB)) {
EnGo_ChangeAnim(this, ENGO_ANIM_3);
EnGo_SetupAction(this, func_80A40A54);
} else {
EnGo_BiggoronActionFunc(this, globalCtx);
EnGo_BiggoronActionFunc(this, play);
}
}
void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) {
void EnGo_GetItem(EnGo* this, PlayState* play) {
f32 xzDist;
f32 yDist;
s32 getItemId;
if (Actor_HasParent(&this->actor, globalCtx)) {
if (Actor_HasParent(&this->actor, play)) {
this->unk_1E0.unk_00 = 2;
this->actor.parent = NULL;
EnGo_SetupAction(this, func_80A40C78);
@ -971,11 +970,11 @@ void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) {
yDist = fabsf(this->actor.yDistToPlayer) + 1.0f;
xzDist = this->actor.xzDistToPlayer + 1.0f;
func_8002F434(&this->actor, globalCtx, getItemId, xzDist, yDist);
func_8002F434(&this->actor, play, getItemId, xzDist, yDist);
}
}
void func_80A40C78(EnGo* this, GlobalContext* globalCtx) {
void func_80A40C78(EnGo* this, PlayState* play) {
if (this->unk_1E0.unk_00 == 3) {
EnGo_SetupAction(this, EnGo_BiggoronActionFunc);
if ((this->actor.params & 0xF0) != 0x90) {
@ -985,47 +984,47 @@ void func_80A40C78(EnGo* this, GlobalContext* globalCtx) {
gSaveContext.bgsFlag = true;
} else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_PRESCRIPTION) {
this->actor.textId = 0x3058;
Message_ContinueTextbox(globalCtx, this->actor.textId);
Message_ContinueTextbox(play, this->actor.textId);
this->unk_1E0.unk_00 = 1;
} else if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) {
this->actor.textId = 0x305C;
Message_ContinueTextbox(globalCtx, this->actor.textId);
Message_ContinueTextbox(play, this->actor.textId);
this->unk_1E0.unk_00 = 1;
Environment_ClearBgsDayCount();
}
}
}
void EnGo_Eyedrops(EnGo* this, GlobalContext* globalCtx) {
void EnGo_Eyedrops(EnGo* this, PlayState* play) {
if (DECR(this->unk_21E) == 0) {
this->actor.textId = 0x305A;
Message_ContinueTextbox(globalCtx, this->actor.textId);
Message_ContinueTextbox(play, this->actor.textId);
this->unk_1E0.unk_00 = 1;
EnGo_SetupAction(this, func_80A40DCC);
}
}
void func_80A40DCC(EnGo* this, GlobalContext* globalCtx) {
void func_80A40DCC(EnGo* this, PlayState* play) {
if (this->unk_1E0.unk_00 == 2) {
EnGo_ChangeAnim(this, ENGO_ANIM_1);
this->skelAnime.curFrame = Animation_GetLastFrame(&gGoronAnim_004930);
Message_CloseTextbox(globalCtx);
Message_CloseTextbox(play);
EnGo_SetupAction(this, EnGo_GetItem);
EnGo_GetItem(this, globalCtx);
EnGo_GetItem(this, play);
}
}
void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnGo_Update(Actor* thisx, PlayState* play) {
s32 pad;
EnGo* this = (EnGo*)thisx;
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
SkelAnime_Update(&this->skelAnime);
if (this->actionFunc == EnGo_BiggoronActionFunc || this->actionFunc == EnGo_FireGenericActionFunc ||
this->actionFunc == func_80A40B1C) {
func_80034F54(globalCtx, this->jointTable, this->morphTable, 18);
func_80034F54(play, this->jointTable, this->morphTable, 18);
}
EnGo_UpdateShadow(this);
@ -1034,22 +1033,22 @@ void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) {
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);
func_80A3F0E4(this);
func_80A3F908(this, globalCtx);
this->actionFunc(this, globalCtx);
func_80A3F060(this, globalCtx);
func_80A3F908(this, play);
this->actionFunc(this, play);
func_80A3F060(this, play);
}
void EnGo_DrawCurledUp(EnGo* this, GlobalContext* globalCtx) {
void EnGo_DrawCurledUp(EnGo* this, PlayState* play) {
Vec3f D_80A41BB4 = { 0.0f, 0.0f, 0.0f };
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2320);
OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2320);
Matrix_Push();
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2326),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2326),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00BD80);
@ -1057,28 +1056,28 @@ void EnGo_DrawCurledUp(EnGo* this, GlobalContext* globalCtx) {
Matrix_MultVec3f(&D_80A41BB4, &this->actor.focus.pos);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2341);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2341);
}
void EnGo_DrawRolling(EnGo* this, GlobalContext* globalCtx) {
void EnGo_DrawRolling(EnGo* this, PlayState* play) {
Vec3f D_80A41BC0 = { 0.0f, 0.0f, 0.0f };
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2355);
OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2355);
Matrix_Push();
func_80093D18(globalCtx->state.gfxCtx);
Matrix_RotateZYX((s16)(globalCtx->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z,
func_80093D18(play->state.gfxCtx);
Matrix_RotateZYX((s16)(play->state.frames * ((s16)this->actor.speedXZ * 1400)), 0, this->actor.shape.rot.z,
MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2368),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2368),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gGoronDL_00C140);
Matrix_MultVec3f(&D_80A41BC0, &this->actor.focus.pos);
Matrix_Pop();
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2383);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2383);
}
s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 EnGo_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnGo* this = (EnGo*)thisx;
Vec3s vec1;
f32 float1;
@ -1111,7 +1110,7 @@ s32 EnGo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limb, Gfx** dList, Vec3f
return 0;
}
void EnGo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnGo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnGo* this = (EnGo*)thisx;
Vec3f D_80A41BCC = { 600.0f, 0.0f, 0.0f };
@ -1120,33 +1119,33 @@ void EnGo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
}
}
void EnGo_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnGo_Draw(Actor* thisx, PlayState* play) {
EnGo* this = (EnGo*)thisx;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2479);
OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2479);
EnGo_UpdateEffects(this);
Matrix_Push();
EnGo_DrawEffects(this, globalCtx);
EnGo_DrawEffects(this, play);
Matrix_Pop();
if (this->actionFunc == EnGo_CurledUp) {
EnGo_DrawCurledUp(this, globalCtx);
EnGo_DrawCurledUp(this, play);
return; // needed for match?
} else if (this->actionFunc == EnGo_GoronLinkRolling || this->actionFunc == func_80A3FEB4 ||
this->actionFunc == EnGo_StopRolling || this->actionFunc == func_80A3FEB4) {
EnGo_DrawRolling(this, globalCtx);
EnGo_DrawRolling(this, play);
return; // needed for match?
} else {
func_800943C8(globalCtx->state.gfxCtx);
func_800943C8(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gGoronCsEyeOpenTex));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gGoronCsMouthNeutralTex));
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable,
this->skelAnime.dListCount, EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2525);
EnGo_DrawEffects(this, globalCtx);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnGo_OverrideLimbDraw, EnGo_PostLimbDraw, &this->actor);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2525);
EnGo_DrawEffects(this, play);
}
}
@ -1199,7 +1198,7 @@ void EnGo_UpdateEffects(EnGo* this) {
}
}
void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) {
void EnGo_DrawEffects(EnGo* this, PlayState* play) {
static void* dustTex[] = { gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex };
EnGoEffect* dustEffect = this->effects;
s16 alpha;
@ -1207,9 +1206,9 @@ void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) {
s16 index;
s16 i;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2626);
OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2626);
materialFlag = false;
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
if (1) {}
for (i = 0; i < EN_GO_EFFECT_COUNT; i++, dustEffect++) {
if (dustEffect->type) {
@ -1224,9 +1223,9 @@ void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha);
gDPPipeSync(POLY_XLU_DISP++);
Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW);
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_go.c", 2664),
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2664),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
index = dustEffect->timer * (8.0f / dustEffect->initialTimer);
@ -1234,5 +1233,5 @@ void EnGo_DrawEffects(EnGo* this, GlobalContext* globalCtx) {
gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50);
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_go.c", 2678);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2678);
}

View file

@ -6,9 +6,9 @@
struct EnGo;
typedef void (*EnGoActionFunc)(struct EnGo*, GlobalContext*);
typedef u16 (*callback1_80A3ED24)(GlobalContext*, struct EnGo*);
typedef s16 (*callback2_80A3ED24)(GlobalContext*, struct EnGo*);
typedef void (*EnGoActionFunc)(struct EnGo*, PlayState*);
typedef u16 (*callback1_80A3ED24)(PlayState*, struct EnGo*);
typedef s16 (*callback2_80A3ED24)(PlayState*, struct EnGo*);
// WIP type docs
// /* 0x00 */ GORON1_CITY_LINK,