1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-20 22:11:16 +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

@ -33,27 +33,27 @@ typedef enum {
/* 8 */ GE2_ACTION_WAITLOOKATPLAYER
} EnGe2Action;
void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx);
void EnGe2_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx);
void EnGe2_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnGe2_Init(Actor* thisx, PlayState* play);
void EnGe2_Destroy(Actor* thisx, PlayState* play);
void EnGe2_Update(Actor* thisx, PlayState* play);
void EnGe2_Draw(Actor* thisx, PlayState* play);
s32 EnGe2_CheckCarpentersFreed(void);
void EnGe2_CaptureClose(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_Stand(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_WaitLookAtPlayer(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_ForceTalk(EnGe2* this, GlobalContext* globalCtx);
void EnGe2_CaptureClose(EnGe2* this, PlayState* play);
void EnGe2_CaptureCharge(EnGe2* this, PlayState* play);
void EnGe2_CaptureTurn(EnGe2* this, PlayState* play);
void EnGe2_KnockedOut(EnGe2* this, PlayState* play);
void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play);
void EnGe2_AboutTurn(EnGe2* this, PlayState* play);
void EnGe2_Walk(EnGe2* this, PlayState* play);
void EnGe2_Stand(EnGe2* this, PlayState* play);
void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play);
void EnGe2_ForceTalk(EnGe2* this, PlayState* play);
// Update functions
void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx);
void EnGe2_UpdateAfterTalk(Actor* thisx, GlobalContext* globalCtx);
void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx);
void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play);
void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play);
void EnGe2_UpdateStunned(Actor* thisx, PlayState* play);
const ActorInit En_Ge2_InitVars = {
ACTOR_EN_GE2,
@ -111,19 +111,19 @@ void EnGe2_ChangeAction(EnGe2* this, s32 i) {
this->stateFlags &= ~GE2_STATE_ANIMCOMPLETE;
}
void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnGe2_Init(Actor* thisx, PlayState* play) {
s32 pad;
EnGe2* this = (EnGe2*)thisx;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22);
SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22);
Animation_PlayLoop(&this->skelAnime, &gGerudoPurpleWalkingAnim);
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 (globalCtx->sceneNum == SCENE_SPOT09) {
if (play->sceneNum == SCENE_SPOT09) {
this->actor.uncullZoneForward = 1000.0f;
} else {
this->actor.uncullZoneForward = 1200.0f;
@ -168,15 +168,15 @@ void EnGe2_Init(Actor* thisx, GlobalContext* globalCtx) {
this->walkDuration = ((this->actor.params & 0xFF00) >> 8) * 10;
}
void EnGe2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnGe2_Destroy(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
// Detection/check functions
s32 Ge2_DetectPlayerInAction(GlobalContext* globalCtx, EnGe2* this) {
s32 Ge2_DetectPlayerInAction(PlayState* play, EnGe2* this) {
f32 visionScale;
visionScale = (!IS_DAY ? 0.75f : 1.5f);
@ -189,14 +189,14 @@ s32 Ge2_DetectPlayerInAction(GlobalContext* globalCtx, EnGe2* this) {
return 2;
}
if (func_8002DDE4(globalCtx)) {
if (func_8002DDE4(play)) {
return 1;
}
return 0;
}
s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) {
Player* player = GET_PLAYER(globalCtx);
s32 Ge2_DetectPlayerInUpdate(PlayState* play, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) {
Player* player = GET_PLAYER(play);
Vec3f posResult;
CollisionPoly* outPoly;
f32 visionScale;
@ -215,7 +215,7 @@ s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos,
return 0;
}
if (BgCheck_AnyLineTest1(&globalCtx->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly,
if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly,
0)) {
return 0;
}
@ -233,26 +233,26 @@ s32 EnGe2_CheckCarpentersFreed(void) {
// Actions
void EnGe2_CaptureClose(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_CaptureClose(EnGe2* this, PlayState* play) {
if (this->timer > 0) {
this->timer--;
} else {
func_8006D074(globalCtx);
func_8006D074(play);
if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) {
globalCtx->nextEntranceIndex = ENTR_SPOT09_1;
play->nextEntranceIndex = ENTR_SPOT09_1;
} else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) {
globalCtx->nextEntranceIndex = ENTR_SPOT12_18;
play->nextEntranceIndex = ENTR_SPOT12_18;
} else {
globalCtx->nextEntranceIndex = ENTR_SPOT12_17;
play->nextEntranceIndex = ENTR_SPOT12_17;
}
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
}
}
void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_CaptureCharge(EnGe2* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100);
this->actor.shape.rot.y = this->actor.world.rot.y;
if (this->actor.xzDistToPlayer < 50.0f) {
@ -263,22 +263,22 @@ void EnGe2_CaptureCharge(EnGe2* this, GlobalContext* globalCtx) {
if (this->timer > 0) {
this->timer--;
} else {
func_8006D074(globalCtx);
func_8006D074(play);
if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) {
globalCtx->nextEntranceIndex = ENTR_SPOT09_1;
play->nextEntranceIndex = ENTR_SPOT09_1;
} else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) {
globalCtx->nextEntranceIndex = ENTR_SPOT12_18;
play->nextEntranceIndex = ENTR_SPOT12_18;
} else {
globalCtx->nextEntranceIndex = ENTR_SPOT12_17;
play->nextEntranceIndex = ENTR_SPOT12_17;
}
globalCtx->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
globalCtx->transitionTrigger = TRANS_TRIGGER_START;
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
}
}
void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_CaptureTurn(EnGe2* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100);
this->actor.shape.rot.y = this->actor.world.rot.y;
@ -289,7 +289,7 @@ void EnGe2_CaptureTurn(EnGe2* this, GlobalContext* globalCtx) {
}
}
void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_KnockedOut(EnGe2* this, PlayState* play) {
static Vec3f effectVelocity = { 0.0f, -0.05f, 0.0f };
static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f };
static Color_RGBA8 effectPrimColor = { 255, 255, 255, 0 };
@ -299,16 +299,16 @@ void EnGe2_KnockedOut(EnGe2* this, GlobalContext* globalCtx) {
this->actor.flags &= ~ACTOR_FLAG_0;
if (this->stateFlags & GE2_STATE_ANIMCOMPLETE) {
effectAngle = (globalCtx->state.frames) * 0x2800;
effectAngle = (play->state.frames) * 0x2800;
effectPos.x = this->actor.focus.pos.x + (Math_CosS(effectAngle) * 5.0f);
effectPos.y = this->actor.focus.pos.y + 10.0f;
effectPos.z = this->actor.focus.pos.z + (Math_SinS(effectAngle) * 5.0f);
EffectSsKiraKira_SpawnDispersed(globalCtx, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor,
EffectSsKiraKira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor,
&effectEnvColor, 1000, 16);
}
}
void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play) {
s32 playerSpotted;
this->actor.speedXZ = 0.0f;
@ -316,7 +316,7 @@ void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) {
if (this->stateFlags & GE2_STATE_TALKED) {
this->stateFlags &= ~GE2_STATE_TALKED;
} else {
playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this);
playerSpotted = Ge2_DetectPlayerInAction(play, this);
if (playerSpotted != 0) {
this->timer = 100;
@ -344,11 +344,11 @@ void EnGe2_TurnPlayerSpotted(EnGe2* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y = this->actor.world.rot.y;
}
void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_AboutTurn(EnGe2* this, PlayState* play) {
s32 playerSpotted;
this->actor.speedXZ = 0.0f;
playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this);
playerSpotted = Ge2_DetectPlayerInAction(play, this);
if (playerSpotted != 0) {
EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED);
@ -365,10 +365,10 @@ void EnGe2_AboutTurn(EnGe2* this, GlobalContext* globalCtx) {
}
}
void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_Walk(EnGe2* this, PlayState* play) {
u8 playerSpotted;
playerSpotted = Ge2_DetectPlayerInAction(globalCtx, this);
playerSpotted = Ge2_DetectPlayerInAction(play, this);
if (playerSpotted != 0) {
this->actor.speedXZ = 0.0f;
EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED);
@ -386,18 +386,18 @@ void EnGe2_Walk(EnGe2* this, GlobalContext* globalCtx) {
}
}
void EnGe2_Stand(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_Stand(EnGe2* this, PlayState* play) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->walkDirection, 2, 0x400, 0x200);
}
void EnGe2_TurnToFacePlayer(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_TurnToFacePlayer(EnGe2* this, PlayState* play) {
s32 pad;
s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if (ABS(angleDiff) <= 0x4000) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100);
this->actor.world.rot.y = this->actor.shape.rot.y;
func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
} else {
if (angleDiff < 0) {
Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100);
@ -410,10 +410,10 @@ void EnGe2_TurnToFacePlayer(EnGe2* this, GlobalContext* globalCtx) {
}
}
void EnGe2_LookAtPlayer(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) {
if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) &&
(this->actor.xzDistToPlayer < 200.0f)) {
func_80038290(globalCtx, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100);
@ -422,8 +422,8 @@ void EnGe2_LookAtPlayer(EnGe2* this, GlobalContext* globalCtx) {
}
}
void EnGe2_SetActionAfterTalk(EnGe2* this, GlobalContext* globalCtx) {
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
void EnGe2_SetActionAfterTalk(EnGe2* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
switch (this->actor.params & 0xFF) {
case GE2_TYPE_PATROLLING:
@ -439,67 +439,66 @@ void EnGe2_SetActionAfterTalk(EnGe2* this, GlobalContext* globalCtx) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.flags &= ~ACTOR_FLAG_16;
}
EnGe2_TurnToFacePlayer(this, globalCtx);
EnGe2_TurnToFacePlayer(this, play);
}
void EnGe2_WaitLookAtPlayer(EnGe2* this, GlobalContext* globalCtx) {
EnGe2_LookAtPlayer(this, globalCtx);
void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play) {
EnGe2_LookAtPlayer(this, play);
}
void EnGe2_WaitTillCardGiven(EnGe2* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) {
void EnGe2_WaitTillCardGiven(EnGe2* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = EnGe2_SetActionAfterTalk;
} else {
func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f);
func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f);
}
}
void EnGe2_GiveCard(EnGe2* this, GlobalContext* globalCtx) {
if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) {
Message_CloseTextbox(globalCtx);
void EnGe2_GiveCard(EnGe2* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
this->actor.flags &= ~ACTOR_FLAG_16;
this->actionFunc = EnGe2_WaitTillCardGiven;
func_8002F434(&this->actor, globalCtx, GI_GERUDO_CARD, 10000.0f, 50.0f);
func_8002F434(&this->actor, play, GI_GERUDO_CARD, 10000.0f, 50.0f);
}
}
void EnGe2_ForceTalk(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_ForceTalk(EnGe2* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
this->actionFunc = EnGe2_GiveCard;
} else {
this->actor.textId = 0x6004;
this->actor.flags |= ACTOR_FLAG_16;
func_8002F1C4(&this->actor, globalCtx, 300.0f, 300.0f, 0);
func_8002F1C4(&this->actor, play, 300.0f, 300.0f, 0);
}
EnGe2_LookAtPlayer(this, globalCtx);
EnGe2_LookAtPlayer(this, play);
}
void EnGe2_SetupCapturePlayer(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_SetupCapturePlayer(EnGe2* this, PlayState* play) {
this->stateFlags |= GE2_STATE_CAPTURING;
this->actor.speedXZ = 0.0f;
EnGe2_ChangeAction(this, GE2_ACTION_CAPTURETURN);
func_8002DF54(globalCtx, &this->actor, 95);
func_8002DF54(play, &this->actor, 95);
func_80078884(NA_SE_SY_FOUND);
Message_StartTextbox(globalCtx, 0x6000, &this->actor);
Message_StartTextbox(play, 0x6000, &this->actor);
}
void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, PlayState* play) {
s32 pad;
s32 pad2;
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
if (!(this->stateFlags & GE2_STATE_ANIMCOMPLETE) && SkelAnime_Update(&this->skelAnime)) {
this->stateFlags |= GE2_STATE_ANIMCOMPLETE;
}
}
void EnGe2_MoveAndBlink(EnGe2* this, GlobalContext* globalCtx) {
void EnGe2_MoveAndBlink(EnGe2* this, PlayState* play) {
Actor_MoveForward(&this->actor);
if (DECR(this->blinkTimer) == 0) {
@ -514,13 +513,13 @@ void EnGe2_MoveAndBlink(EnGe2* this, GlobalContext* globalCtx) {
// Update functions
void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx) {
void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
EnGe2_MaintainColliderAndSetAnimState(this, globalCtx);
this->actionFunc(this, globalCtx);
EnGe2_MaintainColliderAndSetAnimState(this, play);
this->actionFunc(this, play);
if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
if ((this->actor.params & 0xFF) == GE2_TYPE_PATROLLING) {
this->actor.speedXZ = 0.0f;
EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER);
@ -531,29 +530,29 @@ void EnGe2_UpdateFriendly(Actor* thisx, GlobalContext* globalCtx) {
this->actor.textId = 0x6005;
if (this->actor.xzDistToPlayer < 100.0f) {
func_8002F2CC(&this->actor, globalCtx, 100.0f);
func_8002F2CC(&this->actor, play, 100.0f);
}
}
EnGe2_MoveAndBlink(this, globalCtx);
EnGe2_MoveAndBlink(this, play);
}
void EnGe2_UpdateAfterTalk(Actor* thisx, GlobalContext* globalCtx) {
void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
this->stateFlags |= GE2_STATE_TALKED;
EnGe2_MaintainColliderAndSetAnimState(this, globalCtx);
this->actionFunc(this, globalCtx);
EnGe2_MoveAndBlink(this, globalCtx);
EnGe2_MaintainColliderAndSetAnimState(this, play);
this->actionFunc(this, play);
EnGe2_MoveAndBlink(this, play);
}
void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnGe2_Update(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
s32 paramsType;
EnGe2_MaintainColliderAndSetAnimState(this, globalCtx);
EnGe2_MaintainColliderAndSetAnimState(this, play);
if ((this->stateFlags & GE2_STATE_KO) || (this->stateFlags & GE2_STATE_CAPTURING)) {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
} else if (this->collider.base.acFlags & 2) {
if ((this->collider.info.acHitInfo != NULL) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80)) {
Actor_SetColorFilter(&this->actor, 0, 120, 0, 400);
@ -567,29 +566,28 @@ void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) {
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_VO_SK_CRASH);
} else {
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
if (Ge2_DetectPlayerInUpdate(globalCtx, this, &this->actor.focus.pos, this->actor.shape.rot.y,
this->yDetectRange)) {
if (Ge2_DetectPlayerInUpdate(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->yDetectRange)) {
// "Discovered!"
osSyncPrintf(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST);
EnGe2_SetupCapturePlayer(this, globalCtx);
EnGe2_SetupCapturePlayer(this, play);
}
if (((this->actor.params & 0xFF) == GE2_TYPE_STATIONARY) && (this->actor.xzDistToPlayer < 100.0f)) {
// "Discovered!"
osSyncPrintf(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST);
EnGe2_SetupCapturePlayer(this, globalCtx);
EnGe2_SetupCapturePlayer(this, play);
}
}
if (!(this->stateFlags & GE2_STATE_KO)) {
paramsType = this->actor.params & 0xFF; // Not necessary, but looks a bit nicer
if ((paramsType == GE2_TYPE_PATROLLING) || (paramsType == GE2_TYPE_STATIONARY)) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
}
EnGe2_MoveAndBlink(this, globalCtx);
EnGe2_MoveAndBlink(this, play);
if (EnGe2_CheckCarpentersFreed() && !(this->stateFlags & GE2_STATE_KO)) {
this->actor.update = EnGe2_UpdateFriendly;
@ -597,14 +595,13 @@ void EnGe2_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
EnGe2* this = (EnGe2*)thisx;
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 40.0f, 25.0f, 40.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
if ((this->collider.base.acFlags & 2) &&
((this->collider.info.acHitInfo == NULL) || !(this->collider.info.acHitInfo->toucher.dmgFlags & 0x80))) {
@ -615,7 +612,7 @@ void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.speedXZ = 0.0f;
Audio_PlayActorSound2(&this->actor, NA_SE_VO_SK_CRASH);
}
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
if (EnGe2_CheckCarpentersFreed()) {
this->actor.update = EnGe2_UpdateFriendly;
@ -626,7 +623,7 @@ void EnGe2_UpdateStunned(Actor* thisx, GlobalContext* globalCtx2) {
}
}
s32 EnGe2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnGe2* this = (EnGe2*)thisx;
if (limbIndex == 3) {
@ -636,7 +633,7 @@ s32 EnGe2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return 0;
}
void EnGe2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnGe2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f D_80A343B0 = { 600.0f, 700.0f, 0.0f };
EnGe2* this = (EnGe2*)thisx;
@ -645,18 +642,18 @@ void EnGe2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
}
}
void EnGe2_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnGe2_Draw(Actor* thisx, PlayState* play) {
static void* eyeTextures[] = { gGerudoPurpleEyeOpenTex, gGerudoPurpleEyeHalfTex, gGerudoPurpleEyeClosedTex };
s32 pad;
EnGe2* this = (EnGe2*)thisx;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ge2.c", 1274);
OPEN_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1274);
func_800943C8(globalCtx->state.gfxCtx);
func_800943C8(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex]));
func_8002EBCC(&this->actor, globalCtx, 0);
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
func_8002EBCC(&this->actor, play, 0);
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
EnGe2_OverrideLimbDraw, EnGe2_PostLimbDraw, this);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ge2.c", 1291);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1291);
}

View file

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