summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2026-10-13 17:01:15 +0200
committerGitHub <noreply@github.com>2026-10-13 17:01:15 +0200
commit7b067445b801e195970673dd38fa39144bf1cdcc (patch)
tree42778b0419861377ffae16955f68a1dd1bdf28bd /src
parent9b8283298f6f95aee4472563003cb9b8cd461bff (diff)
[cc0 oot] ge2 (#2811)
* [cc0 oot] ge2 * ge2 review
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_En_Ge2/z_en_ge2.c575
-rw-r--r--src/overlays/actors/ovl_En_Ge2/z_en_ge2.h48
2 files changed, 302 insertions, 321 deletions
diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c
index 45102b861..e6f6c7ed5 100644
--- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c
+++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c
@@ -1,9 +1,3 @@
-/*
- * File: z_en_ge2.c
- * Overlay: ovl_En_Ge2
- * Description: Purple-clothed Gerudo
- */
-
#include "z_en_ge2.h"
#include "attributes.h"
@@ -14,8 +8,6 @@
#include "sfx.h"
#include "stack_pad.h"
#include "sys_matrix.h"
-#include "terminal.h"
-#include "translation.h"
#include "z_lib.h"
#include "effect.h"
#include "horse.h"
@@ -27,51 +19,31 @@
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED)
-#define GE2_STATE_ANIMCOMPLETE (1 << 1)
-#define GE2_STATE_KO (1 << 2)
-#define GE2_STATE_CAPTURING (1 << 3)
-#define GE2_STATE_TALKED (1 << 4)
-
-typedef enum EnGe2Type {
- /* 0 */ GE2_TYPE_PATROLLING,
- /* 1 */ GE2_TYPE_STATIONARY,
- /* 2 */ GE2_TYPE_GERUDO_CARD_GIVER
-} EnGe2Type;
-
-typedef enum EnGe2Action {
- /* 0 */ GE2_ACTION_WALK,
- /* 1 */ GE2_ACTION_ABOUTTURN,
- /* 2 */ GE2_ACTION_TURNPLAYERSPOTTED,
- /* 3 */ GE2_ACTION_KNOCKEDOUT,
- /* 4 */ GE2_ACTION_CAPTURETURN,
- /* 5 */ GE2_ACTION_CAPTURECHARGE,
- /* 6 */ GE2_ACTION_CAPTURECLOSE,
- /* 7 */ GE2_ACTION_STAND,
- /* 8 */ GE2_ACTION_WAITLOOKATPLAYER
-} EnGe2Action;
-
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_CheckAllCarpentersRescued(void);
-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
+s32 EnGe2_AreAllCarpentersRescued(void);
+void EnGe2_PlayerCaught(EnGe2* this, PlayState* play);
+void EnGe2_PlayerCaughtRun(EnGe2* this, PlayState* play);
+void EnGe2_PlayerCaughtTurn(EnGe2* this, PlayState* play);
+void EnGe2_Faint(EnGe2* this, PlayState* play);
+void EnGe2_PatrolAlerted(EnGe2* this, PlayState* play);
+void EnGe2_PatrolTurnAround(EnGe2* this, PlayState* play);
+void EnGe2_PatrolWalk(EnGe2* this, PlayState* play);
+void EnGe2_Static(EnGe2* this, PlayState* play);
+void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play);
+void EnGe2_WaitTalk(EnGe2* this, PlayState* play);
void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play);
-void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play);
+void EnGe2_UpdateTalking(Actor* thisx, PlayState* play);
void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2);
+#define EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE (1 << 1)
+#define EN_GE2_STATE_FLAG_2 (1 << 2)
+#define EN_GE2_STATE_FLAG_PLAYER_CAUGHT (1 << 3)
+#define EN_GE2_STATE_FLAG_4 (1 << 4)
+
ActorProfile En_Ge2_Profile = {
/**/ ACTOR_EN_GE2,
/**/ ACTORCAT_NPC,
@@ -104,86 +76,116 @@ static ColliderCylinderInit sCylinderInit = {
{ 20, 60, 0, { 0, 0, 0 } },
};
-static EnGe2ActionFunc sActionFuncs[] = {
- EnGe2_Walk, EnGe2_AboutTurn, EnGe2_TurnPlayerSpotted,
- EnGe2_KnockedOut, EnGe2_CaptureTurn, EnGe2_CaptureCharge,
- EnGe2_CaptureClose, EnGe2_Stand, EnGe2_WaitLookAtPlayer,
-};
+typedef enum EnGe2Action {
+ /* 0 */ EN_GE2_ACTION_PATROL_WALK,
+ /* 1 */ EN_GE2_ACTION_PATROL_TURN_AROUND,
+ /* 2 */ EN_GE2_ACTION_PATROL_ALERTED,
+ /* 3 */ EN_GE2_ACTION_FAINT,
+ /* 4 */ EN_GE2_ACTION_PLAYER_CAUGHT_TURN,
+ /* 5 */ EN_GE2_ACTION_PLAYER_CAUGHT_RUN,
+ /* 6 */ EN_GE2_ACTION_PLAYER_CAUGHT,
+ /* 7 */ EN_GE2_ACTION_STATIC,
+ /* 8 */ EN_GE2_ACTION_LOOK_AT_PLAYER,
+ /* 9 */ EN_GE2_ACTION_MAX
+} EnGe2Action;
-static AnimationHeader* sAnimations[] = {
- &gGerudoPurpleWalkingAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim,
- &gGerudoPurpleFallingToGroundAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleChargingAnim,
- &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim,
+static void (*sActionFuncs[EN_GE2_ACTION_MAX])(EnGe2*, PlayState*) = {
+ EnGe2_PatrolWalk, // EN_GE2_ACTION_PATROL_WALK
+ EnGe2_PatrolTurnAround, // EN_GE2_ACTION_PATROL_TURN_AROUND
+ EnGe2_PatrolAlerted, // EN_GE2_ACTION_PATROL_ALERTED
+ EnGe2_Faint, // EN_GE2_ACTION_FAINT
+ EnGe2_PlayerCaughtTurn, // EN_GE2_ACTION_PLAYER_CAUGHT_TURN
+ EnGe2_PlayerCaughtRun, // EN_GE2_ACTION_PLAYER_CAUGHT_RUN
+ EnGe2_PlayerCaught, // EN_GE2_ACTION_PLAYER_CAUGHT
+ EnGe2_Static, // EN_GE2_ACTION_STATIC
+ EnGe2_LookAtPlayer, // EN_GE2_ACTION_LOOK_AT_PLAYER
};
-
-static u8 sAnimModes[] = {
- ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP,
- ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE,
+static AnimationHeader* sAnims[EN_GE2_ACTION_MAX] = {
+ &gObjectGlaWalkAnim, // EN_GE2_ACTION_PATROL_WALK
+ &gObjectGlaIdleAnim, // EN_GE2_ACTION_PATROL_TURN_AROUND
+ &gObjectGlaIdleAnim, // EN_GE2_ACTION_PATROL_ALERTED
+ &gObjectGlaFaintAnim, // EN_GE2_ACTION_FAINT
+ &gObjectGlaIdleAnim, // EN_GE2_ACTION_PLAYER_CAUGHT_TURN
+ &gObjectGlaRunAnim, // EN_GE2_ACTION_PLAYER_CAUGHT_RUN
+ &gObjectGlaIdleAnim, // EN_GE2_ACTION_PLAYER_CAUGHT
+ &gObjectGlaIdleAnim, // EN_GE2_ACTION_STATIC
+ &gObjectGlaIdleAnim, // EN_GE2_ACTION_LOOK_AT_PLAYER
+};
+static u8 sAnimModes[EN_GE2_ACTION_MAX] = {
+ ANIMMODE_LOOP, // EN_GE2_ACTION_PATROL_WALK
+ ANIMMODE_ONCE, // EN_GE2_ACTION_PATROL_TURN_AROUND
+ ANIMMODE_LOOP, // EN_GE2_ACTION_PATROL_ALERTED
+ ANIMMODE_ONCE, // EN_GE2_ACTION_FAINT
+ ANIMMODE_LOOP, // EN_GE2_ACTION_PLAYER_CAUGHT_TURN
+ ANIMMODE_LOOP, // EN_GE2_ACTION_PLAYER_CAUGHT_RUN
+ ANIMMODE_LOOP, // EN_GE2_ACTION_PLAYER_CAUGHT
+ ANIMMODE_LOOP, // EN_GE2_ACTION_STATIC
+ ANIMMODE_ONCE, // EN_GE2_ACTION_LOOK_AT_PLAYER
};
-void EnGe2_ChangeAction(EnGe2* this, s32 i) {
- this->actionFunc = sActionFuncs[i];
- Animation_Change(&this->skelAnime, sAnimations[i], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[i]),
- sAnimModes[i], -8.0f);
- this->stateFlags &= ~GE2_STATE_ANIMCOMPLETE;
+void EnGe2_SetupAction(EnGe2* this, s32 action) {
+ this->actionFunc = sActionFuncs[action];
+ Animation_Change(&this->skelAnime, sAnims[action], 1.0f, 0.0f, Animation_GetLastFrame(sAnims[action]),
+ sAnimModes[action], -8.0f);
+ this->stateFlags &= ~EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE;
}
void EnGe2_Init(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
- UNUSED s16 params = this->actor.params;
+ STACK_PAD(s32);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
- SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22);
- Animation_PlayLoop(&this->skelAnime, &gGerudoPurpleWalkingAnim);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gObjectGlaSkel, NULL, this->jointTable, this->morphTable,
+ OBJECT_GLA_LIMB_MAX);
+ Animation_PlayLoop(&this->skelAnime, &gObjectGlaWalkAnim);
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 (play->sceneId == SCENE_GERUDO_VALLEY) {
this->actor.cullingVolumeDistance = 1000.0f;
} else {
this->actor.cullingVolumeDistance = 1200.0f;
}
-
- this->yDetectRange = (this->actor.world.rot.z + 1) * 40.0f;
+ this->detectionYRange = (this->actor.world.rot.z + 1) * 40.0f;
this->actor.world.rot.z = 0;
this->actor.shape.rot.z = 0;
-
switch (PARAMS_GET_S(thisx->params, 0, 8)) {
- case GE2_TYPE_PATROLLING:
- EnGe2_ChangeAction(this, GE2_ACTION_WALK);
- if (EnGe2_CheckAllCarpentersRescued()) {
+ case EN_GE2_TYPE_PATROL:
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_WALK);
+ if (EnGe2_AreAllCarpentersRescued()) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
break;
- case GE2_TYPE_STATIONARY:
- EnGe2_ChangeAction(this, GE2_ACTION_STAND);
- if (EnGe2_CheckAllCarpentersRescued()) {
+
+ case EN_GE2_TYPE_STATIC:
+ EnGe2_SetupAction(this, EN_GE2_ACTION_STATIC);
+ if (EnGe2_AreAllCarpentersRescued()) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
break;
- case GE2_TYPE_GERUDO_CARD_GIVER:
- EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER);
- this->actor.update = EnGe2_UpdateAfterTalk;
- this->actionFunc = EnGe2_ForceTalk;
+
+ case EN_GE2_TYPE_GERUDOS_CARD_GIVER:
+ EnGe2_SetupAction(this, EN_GE2_ACTION_LOOK_AT_PLAYER);
+ this->actor.update = EnGe2_UpdateTalking;
+ this->actionFunc = EnGe2_WaitTalk;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
break;
+
default:
ASSERT(0, "0", "../z_en_ge2.c", 418);
break;
}
-
this->stateFlags = 0;
- this->unk_304 = 0; // Set and not used
- this->walkTimer = 0;
- this->playerSpottedParam = 0;
+ this->unk_304 = 0;
+ this->patrolTimer = 0;
+ this->playerNoise = 0;
this->actor.minVelocityY = -4.0f;
this->actor.gravity = -1.0f;
- this->walkDirection = this->actor.world.rot.y;
- this->walkDuration = PARAMS_GET_S(thisx->params, 8, 8) * 10;
+ this->targetYaw = this->actor.world.rot.y;
+ this->patrolTime = PARAMS_GET_S(thisx->params, 8, 8) * 10;
}
void EnGe2_Destroy(Actor* thisx, PlayState* play) {
@@ -192,69 +194,67 @@ void EnGe2_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
}
-// Detection/check functions
-
-s32 Ge2_DetectPlayerInAction(PlayState* play, EnGe2* this) {
- f32 visionScale;
+s32 EnGe2_GetPlayerNoiseLevel(PlayState* play, EnGe2* this) {
+ f32 xzRangeFac;
- visionScale = (!IS_DAY ? 0.75f : 1.5f);
-
- if ((250.0f * visionScale) < this->actor.xzDistToPlayer) {
+ if (!IS_DAY) {
+ xzRangeFac = 0.75f;
+ } else {
+ xzRangeFac = 1.5f;
+ }
+ if ((250.0f * xzRangeFac) < this->actor.xzDistToPlayer) {
return 0;
}
-
if (this->actor.xzDistToPlayer < 50.0f) {
return 2;
}
-
if (func_8002DDE4(play)) {
return 1;
}
return 0;
}
-s32 Ge2_DetectPlayerInUpdate(PlayState* play, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) {
+s32 EnGe2_CanSeePlayer(PlayState* play, EnGe2* this, Vec3f* headPos, s16 yaw, f32 yRange) {
Player* player = GET_PLAYER(play);
- Vec3f posResult;
- CollisionPoly* outPoly;
- f32 visionScale;
-
- visionScale = (!IS_DAY ? 0.75f : 1.5f);
+ Vec3f pos;
+ CollisionPoly* poly;
+ f32 xzRangeFac;
+ s16 relYawTowardsPlayer;
- if ((250.0f * visionScale) < this->actor.xzDistToPlayer) {
- return 0;
+ if (!IS_DAY) {
+ xzRangeFac = 0.75f;
+ } else {
+ xzRangeFac = 1.5f;
}
-
- if (yDetectRange < ABS(this->actor.yDistToPlayer)) {
- return 0;
+ if ((250.0f * xzRangeFac) < this->actor.xzDistToPlayer) {
+ return false;
}
-
- if (ABS((s16)(this->actor.yawTowardsPlayer - yRot)) > 0x2000) {
- return 0;
+ if (yRange < ABS(this->actor.yDistToPlayer)) {
+ return false;
}
-
- if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly,
- false)) {
- return 0;
+ relYawTowardsPlayer = this->actor.yawTowardsPlayer - yaw;
+ if (ABS(relYawTowardsPlayer) > 0x2000) {
+ return false;
}
- return 1;
+ if (BgCheck_AnyLineTest1(&play->colCtx, headPos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &pos, &poly, false)) {
+ return false;
+ }
+ return true;
}
-s32 EnGe2_CheckAllCarpentersRescued(void) {
+s32 EnGe2_AreAllCarpentersRescued(void) {
if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2()) {
return true;
+ } else {
+ return false;
}
- return false;
}
-// Actions
-
-void EnGe2_CaptureClose(EnGe2* this, PlayState* play) {
+void EnGe2_PlayerCaught(EnGe2* this, PlayState* play) {
if (this->timer > 0) {
this->timer--;
} else {
Horse_ResetHorseData(play);
-
if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) {
play->nextEntranceIndex = ENTR_GERUDO_VALLEY_1;
} else if (GET_EVENTCHKINF(EVENTCHKINF_GERUDO_CAUGHT_TOWER_FALL)) {
@@ -262,25 +262,22 @@ void EnGe2_CaptureClose(EnGe2* this, PlayState* play) {
} else {
play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_17;
}
-
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
}
}
-void EnGe2_CaptureCharge(EnGe2* this, PlayState* play) {
+void EnGe2_PlayerCaughtRun(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) {
- EnGe2_ChangeAction(this, GE2_ACTION_CAPTURECLOSE);
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PLAYER_CAUGHT);
this->actor.speed = 0.0f;
}
-
if (this->timer > 0) {
this->timer--;
} else {
Horse_ResetHorseData(play);
-
if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) {
play->nextEntranceIndex = ENTR_GERUDO_VALLEY_1;
} else if (GET_EVENTCHKINF(EVENTCHKINF_GERUDO_CAUGHT_TOWER_FALL)) {
@@ -288,324 +285,300 @@ void EnGe2_CaptureCharge(EnGe2* this, PlayState* play) {
} else {
play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_17;
}
-
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST);
play->transitionTrigger = TRANS_TRIGGER_START;
}
}
-void EnGe2_CaptureTurn(EnGe2* this, PlayState* play) {
+void EnGe2_PlayerCaughtTurn(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.world.rot.y == this->actor.yawTowardsPlayer) {
- EnGe2_ChangeAction(this, GE2_ACTION_CAPTURECHARGE);
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PLAYER_CAUGHT_RUN);
this->timer = 50;
this->actor.speed = 4.0f;
}
}
-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 };
- static Color_RGBA8 effectEnvColor = { 255, 150, 0, 0 };
- s32 effectAngle;
- Vec3f effectPos;
+void EnGe2_Faint(EnGe2* this, PlayState* play) {
+ static Vec3f sEffVel = { 0.0f, -0.05f, 0.0f };
+ static Vec3f sEffAccel = { 0.0f, -0.025f, 0.0f };
+ static Color_RGBA8 sEffPrimColor = { 255, 255, 255, 0 };
+ static Color_RGBA8 sEffEnvColor = { 255, 150, 0, 0 };
+ s32 angle;
+ Vec3f effPos;
this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED;
- if (this->stateFlags & GE2_STATE_ANIMCOMPLETE) {
- 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(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor,
- &effectEnvColor, 1000, 16);
+ if (this->stateFlags & EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE) {
+ angle = play->state.frames * 0x2800;
+ effPos.x = this->actor.focus.pos.x + (Math_CosS(angle) * 5.0f);
+ effPos.y = this->actor.focus.pos.y + 10.0f;
+ effPos.z = this->actor.focus.pos.z + (Math_SinS(angle) * 5.0f);
+ EffectSsKiraKira_SpawnDispersed(play, &effPos, &sEffVel, &sEffAccel, &sEffPrimColor, &sEffEnvColor, 1000, 16);
}
}
-void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play) {
- s32 playerSpotted;
+void EnGe2_PatrolAlerted(EnGe2* this, PlayState* play) {
+ s32 playerNoise;
this->actor.speed = 0.0f;
-
- if (this->stateFlags & GE2_STATE_TALKED) {
- this->stateFlags &= ~GE2_STATE_TALKED;
+ if (this->stateFlags & EN_GE2_STATE_FLAG_4) {
+ this->stateFlags &= ~EN_GE2_STATE_FLAG_4;
} else {
- playerSpotted = Ge2_DetectPlayerInAction(play, this);
-
- if (playerSpotted != 0) {
+ playerNoise = EnGe2_GetPlayerNoiseLevel(play, this);
+ if (playerNoise != 0) {
this->timer = 100;
- this->yawTowardsPlayer = this->actor.yawTowardsPlayer;
-
- if (this->playerSpottedParam < playerSpotted) {
- this->playerSpottedParam = playerSpotted;
+ this->patrolAlertedYaw = this->actor.yawTowardsPlayer;
+ if (this->playerNoise < playerNoise) {
+ this->playerNoise = playerNoise;
}
- } else if (this->actor.world.rot.y == this->yawTowardsPlayer) {
- this->playerSpottedParam = 0;
- EnGe2_ChangeAction(this, GE2_ACTION_ABOUTTURN);
+ } else if (this->actor.world.rot.y == this->patrolAlertedYaw) {
+ this->playerNoise = 0;
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_TURN_AROUND);
return;
}
}
-
- switch (this->playerSpottedParam) {
+ switch (this->playerNoise) {
case 1:
- Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTowardsPlayer, 2, 0x200, 0x100);
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->patrolAlertedYaw, 2, 0x200, 0x100);
break;
+
case 2:
- Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTowardsPlayer, 2, 0x600, 0x180);
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->patrolAlertedYaw, 2, 0x600, 0x180);
break;
}
-
this->actor.shape.rot.y = this->actor.world.rot.y;
}
-void EnGe2_AboutTurn(EnGe2* this, PlayState* play) {
- s32 playerSpotted;
+void EnGe2_PatrolTurnAround(EnGe2* this, PlayState* play) {
+ s32 playerNoise;
this->actor.speed = 0.0f;
- playerSpotted = Ge2_DetectPlayerInAction(play, this);
-
- if (playerSpotted != 0) {
- EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED);
+ playerNoise = EnGe2_GetPlayerNoiseLevel(play, this);
+ if (playerNoise != 0) {
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_ALERTED);
this->timer = 100;
- this->playerSpottedParam = playerSpotted;
- this->yawTowardsPlayer = this->actor.yawTowardsPlayer;
- } else if (this->stateFlags & GE2_STATE_ANIMCOMPLETE) {
- Math_SmoothStepToS(&this->actor.world.rot.y, this->walkDirection, 2, 0x400, 0x200);
+ this->playerNoise = playerNoise;
+ this->patrolAlertedYaw = this->actor.yawTowardsPlayer;
+ } else if (this->stateFlags & EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE) {
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->targetYaw, 2, 0x400, 0x200);
this->actor.shape.rot.y = this->actor.world.rot.y;
}
-
- if (this->actor.shape.rot.y == this->walkDirection) {
- EnGe2_ChangeAction(this, GE2_ACTION_WALK);
+ if (this->actor.shape.rot.y == this->targetYaw) {
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_WALK);
}
}
-void EnGe2_Walk(EnGe2* this, PlayState* play) {
- u8 playerSpotted;
+void EnGe2_PatrolWalk(EnGe2* this, PlayState* play) {
+ u8 playerNoise;
- playerSpotted = Ge2_DetectPlayerInAction(play, this);
- if (playerSpotted != 0) {
+ playerNoise = EnGe2_GetPlayerNoiseLevel(play, this);
+ if (playerNoise != 0) {
this->actor.speed = 0.0f;
- EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED);
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_ALERTED);
this->timer = 100;
- this->playerSpottedParam = playerSpotted;
- this->yawTowardsPlayer = this->actor.yawTowardsPlayer;
- } else if (this->walkTimer >= this->walkDuration) {
- this->walkTimer = 0;
- this->walkDirection += 0x8000;
- EnGe2_ChangeAction(this, GE2_ACTION_ABOUTTURN);
+ this->playerNoise = playerNoise;
+ this->patrolAlertedYaw = this->actor.yawTowardsPlayer;
+ } else if (this->patrolTimer >= this->patrolTime) {
+ this->patrolTimer = 0;
+ this->targetYaw += 0x8000;
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_TURN_AROUND);
this->actor.speed = 0.0f;
} else {
- this->walkTimer++;
+ this->patrolTimer++;
this->actor.speed = 2.0f;
}
}
-void EnGe2_Stand(EnGe2* this, PlayState* play) {
- Math_SmoothStepToS(&this->actor.world.rot.y, this->walkDirection, 2, 0x400, 0x200);
+void EnGe2_Static(EnGe2* this, PlayState* play) {
+ Math_SmoothStepToS(&this->actor.world.rot.y, this->targetYaw, 2, 0x400, 0x200);
}
-void EnGe2_TurnToFacePlayer(EnGe2* this, PlayState* play) {
+void EnGe2_TrackPlayer(EnGe2* this, PlayState* play) {
+ s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
STACK_PAD(s32);
- 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);
+ if (ABS(relYawTowardsPlayer) <= 0x4000) {
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64);
this->actor.world.rot.y = this->actor.shape.rot.y;
- Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
+ Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos);
} else {
- if (angleDiff < 0) {
- Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100);
+ if (relYawTowardsPlayer < 0) {
+ Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 0x1838, 0x100);
} else {
- Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 6200, 0x100);
+ Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 0x1838, 0x100);
}
-
- Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 1000, 100);
+ Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 0x3E8, 0x64);
this->actor.world.rot.y = this->actor.shape.rot.y;
}
}
-void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) {
- if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) &&
- (this->actor.xzDistToPlayer < 200.0f)) {
- Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
+void EnGe2_TrackPlayerIfNear(EnGe2* this, PlayState* play) {
+ s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
+
+ if ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 200.0f)) {
+ Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos);
} else {
- Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100);
- Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100);
- Math_SmoothStepToS(&this->unk_2EE.x, 0, 6, 6200, 100);
- Math_SmoothStepToS(&this->unk_2EE.y, 0, 6, 6200, 100);
+ Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64);
+ Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64);
+ Math_SmoothStepToS(&this->torsoRot.x, 0, 6, 0x1838, 0x64);
+ Math_SmoothStepToS(&this->torsoRot.y, 0, 6, 0x1838, 0x64);
}
}
-void EnGe2_SetActionAfterTalk(EnGe2* this, PlayState* play) {
+void EnGe2_WaitTalkEnd(EnGe2* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
-
switch (PARAMS_GET_S(this->actor.params, 0, 8)) {
- case GE2_TYPE_PATROLLING:
- EnGe2_ChangeAction(this, GE2_ACTION_ABOUTTURN);
+ case EN_GE2_TYPE_PATROL:
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_TURN_AROUND);
break;
- case GE2_TYPE_STATIONARY:
- EnGe2_ChangeAction(this, GE2_ACTION_STAND);
+
+ case EN_GE2_TYPE_STATIC:
+ EnGe2_SetupAction(this, EN_GE2_ACTION_STATIC);
break;
- case GE2_TYPE_GERUDO_CARD_GIVER:
- this->actionFunc = EnGe2_WaitLookAtPlayer;
+
+ case EN_GE2_TYPE_GERUDOS_CARD_GIVER:
+ this->actionFunc = EnGe2_LookAtPlayer;
break;
}
this->actor.update = EnGe2_UpdateFriendly;
this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED;
}
- EnGe2_TurnToFacePlayer(this, play);
+ EnGe2_TrackPlayer(this, play);
}
-void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play) {
- EnGe2_LookAtPlayer(this, play);
+void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) {
+ EnGe2_TrackPlayerIfNear(this, play);
}
-void EnGe2_WaitTillCardGiven(EnGe2* this, PlayState* play) {
+void EnGe2_GiveGerudosCard(EnGe2* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
- this->actionFunc = EnGe2_SetActionAfterTalk;
+ this->actionFunc = EnGe2_WaitTalkEnd;
} else {
Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f);
}
}
-void EnGe2_GiveCard(EnGe2* this, PlayState* play) {
+void EnGe2_Talking(EnGe2* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED;
- this->actionFunc = EnGe2_WaitTillCardGiven;
+ this->actionFunc = EnGe2_GiveGerudosCard;
Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f);
}
}
-void EnGe2_ForceTalk(EnGe2* this, PlayState* play) {
-
+void EnGe2_WaitTalk(EnGe2* this, PlayState* play) {
if (Actor_TalkOfferAccepted(&this->actor, play)) {
- this->actionFunc = EnGe2_GiveCard;
+ this->actionFunc = EnGe2_Talking;
} else {
this->actor.textId = 0x6004;
this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED;
Actor_OfferTalkExchange(&this->actor, play, 300.0f, 300.0f, EXCH_ITEM_NONE);
}
- EnGe2_LookAtPlayer(this, play);
+ EnGe2_TrackPlayerIfNear(this, play);
}
-void EnGe2_SetupCapturePlayer(EnGe2* this, PlayState* play) {
- this->stateFlags |= GE2_STATE_CAPTURING;
+void EnGe2_SetupPlayerCaught(EnGe2* this, PlayState* play) {
+ this->stateFlags |= EN_GE2_STATE_FLAG_PLAYER_CAUGHT;
this->actor.speed = 0.0f;
- EnGe2_ChangeAction(this, GE2_ACTION_CAPTURETURN);
+ EnGe2_SetupAction(this, EN_GE2_ACTION_PLAYER_CAUGHT_TURN);
Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_95);
Sfx_PlaySfxCentered(NA_SE_SY_FOUND);
Message_StartTextbox(play, 0x6000, &this->actor);
}
-void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, PlayState* play) {
+void EnGe2_UpdateImplPre(EnGe2* this, PlayState* play) {
STACK_PADS(s32, 2);
Collider_UpdateCylinder(&this->actor, &this->collider);
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;
+ if (!(this->stateFlags & EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE) && SkelAnime_Update(&this->skelAnime)) {
+ this->stateFlags |= EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE;
}
}
-void EnGe2_MoveAndBlink(EnGe2* this, PlayState* play) {
+void EnGe2_UpdateImplPost(EnGe2* this, PlayState* play) {
Actor_MoveXZGravity(&this->actor);
-
- if (DECR(this->blinkTimer) == 0) {
- this->blinkTimer = Rand_S16Offset(60, 60);
+ if (DECR(this->eyeTimer) == 0) {
+ this->eyeTimer = Rand_S16Offset(60, 60);
}
- this->eyeIndex = this->blinkTimer;
-
- if (this->eyeIndex >= 3) {
- this->eyeIndex = 0;
+ this->eyeTexIndex = this->eyeTimer;
+ if (this->eyeTexIndex >= 3) {
+ this->eyeTexIndex = 0;
}
}
-// Update functions
-
void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
- EnGe2_MaintainColliderAndSetAnimState(this, play);
+ EnGe2_UpdateImplPre(this, play);
this->actionFunc(this, play);
-
- if (Actor_TalkOfferAccepted(&this->actor, play)) {
- if (PARAMS_GET_S(this->actor.params, 0, 8) == GE2_TYPE_PATROLLING) {
- this->actor.speed = 0.0f;
- EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER);
+ if (Actor_TalkOfferAccepted(thisx, play)) {
+ if (PARAMS_GET_S(thisx->params, 0, 8) == EN_GE2_TYPE_PATROL) {
+ thisx->speed = 0.0f;
+ EnGe2_SetupAction(this, EN_GE2_ACTION_LOOK_AT_PLAYER);
}
- this->actionFunc = EnGe2_SetActionAfterTalk;
- this->actor.update = EnGe2_UpdateAfterTalk;
+ this->actionFunc = EnGe2_WaitTalkEnd;
+ thisx->update = EnGe2_UpdateTalking;
} else {
- this->actor.textId = 0x6005;
-
- if (this->actor.xzDistToPlayer < 100.0f) {
- Actor_OfferTalk(&this->actor, play, 100.0f);
+ thisx->textId = 0x6005;
+ if (thisx->xzDistToPlayer < 100.0f) {
+ Actor_OfferTalk(thisx, play, 100.0f);
}
}
- EnGe2_MoveAndBlink(this, play);
+ EnGe2_UpdateImplPost(this, play);
}
-void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play) {
+void EnGe2_UpdateTalking(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
- this->stateFlags |= GE2_STATE_TALKED;
- EnGe2_MaintainColliderAndSetAnimState(this, play);
+ this->stateFlags |= EN_GE2_STATE_FLAG_4;
+ EnGe2_UpdateImplPre(this, play);
this->actionFunc(this, play);
- EnGe2_MoveAndBlink(this, play);
+ EnGe2_UpdateImplPost(this, play);
}
void EnGe2_Update(Actor* thisx, PlayState* play) {
EnGe2* this = (EnGe2*)thisx;
- s32 paramsType;
- EnGe2_MaintainColliderAndSetAnimState(this, play);
-
- if ((this->stateFlags & GE2_STATE_KO) || (this->stateFlags & GE2_STATE_CAPTURING)) {
+ EnGe2_UpdateImplPre(this, play);
+ if ((this->stateFlags & EN_GE2_STATE_FLAG_2) || (this->stateFlags & EN_GE2_STATE_FLAG_PLAYER_CAUGHT)) {
this->actionFunc(this, play);
} else if (this->collider.base.acFlags & AC_HIT) {
if ((this->collider.elem.acHitElem != NULL) &&
(this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) {
- //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the colorfilter.
+ //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the
+ //! colorfilter.
//! Because of the duration being tracked as an unsigned byte it ends up being truncated to 144
Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 400);
this->actor.update = EnGe2_UpdateStunned;
return;
}
-
- EnGe2_ChangeAction(this, GE2_ACTION_KNOCKEDOUT);
+ EnGe2_SetupAction(this, EN_GE2_ACTION_FAINT);
this->timer = 100;
- this->stateFlags |= GE2_STATE_KO;
+ this->stateFlags |= EN_GE2_STATE_FLAG_2;
this->actor.speed = 0.0f;
Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH);
} else {
this->actionFunc(this, play);
-
- if (Ge2_DetectPlayerInUpdate(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->yDetectRange)) {
- PRINTF(VT_FGCOL(GREEN) T("発見!!!!!!!!!!!!\n", "Discovered!!!!!!!!!!!!\n") VT_RST);
- EnGe2_SetupCapturePlayer(this, play);
+ if (EnGe2_CanSeePlayer(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->detectionYRange)) {
+ PRINTF(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST);
+ EnGe2_SetupPlayerCaught(this, play);
}
-
- if ((PARAMS_GET_S(this->actor.params, 0, 8) == GE2_TYPE_STATIONARY) && (this->actor.xzDistToPlayer < 100.0f)) {
- PRINTF(VT_FGCOL(GREEN) T("発見!!!!!!!!!!!!\n", "Discovered!!!!!!!!!!!!\n") VT_RST);
- EnGe2_SetupCapturePlayer(this, play);
+ if ((PARAMS_GET_S(this->actor.params, 0, 8) == EN_GE2_TYPE_STATIC) && (this->actor.xzDistToPlayer < 100.0f)) {
+ PRINTF(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST);
+ EnGe2_SetupPlayerCaught(this, play);
}
}
-
- if (!(this->stateFlags & GE2_STATE_KO)) {
- paramsType = PARAMS_GET_S(this->actor.params, 0, 8); // Not necessary, but looks a bit nicer
- if ((paramsType == GE2_TYPE_PATROLLING) || (paramsType == GE2_TYPE_STATIONARY)) {
- CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
- }
+ if (!(this->stateFlags & EN_GE2_STATE_FLAG_2) && ((PARAMS_GET_S(this->actor.params, 0, 8) == EN_GE2_TYPE_PATROL) ||
+ (PARAMS_GET_S(this->actor.params, 0, 8) == EN_GE2_TYPE_STATIC))) {
+ CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
- EnGe2_MoveAndBlink(this, play);
-
- if (EnGe2_CheckAllCarpentersRescued() && !(this->stateFlags & GE2_STATE_KO)) {
+ EnGe2_UpdateImplPost(this, play);
+ if (EnGe2_AreAllCarpentersRescued() && !(this->stateFlags & EN_GE2_STATE_FLAG_2)) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
}
@@ -618,20 +591,18 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) {
Collider_UpdateCylinder(&this->actor, &this->collider);
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 & AC_HIT) &&
((this->collider.elem.acHitElem == NULL) ||
!(this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT))) {
this->actor.colorFilterTimer = 0;
- EnGe2_ChangeAction(this, GE2_ACTION_KNOCKEDOUT);
+ EnGe2_SetupAction(this, EN_GE2_ACTION_FAINT);
this->timer = 100;
- this->stateFlags |= GE2_STATE_KO;
+ this->stateFlags |= EN_GE2_STATE_FLAG_2;
this->actor.speed = 0.0f;
Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH);
}
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
-
- if (EnGe2_CheckAllCarpentersRescued()) {
+ if (EnGe2_AreAllCarpentersRescued()) {
this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->actor.colorFilterTimer = 0;
@@ -643,34 +614,36 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) {
s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnGe2* this = (EnGe2*)thisx;
- if (limbIndex == 3) {
+ if (limbIndex == OBJECT_GLA_LIMB_HEAD_ROOT) {
rot->x += this->headRot.y;
rot->z += this->headRot.x;
}
- return 0;
+ return false;
}
void EnGe2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
- static Vec3f D_80A343B0 = { 600.0f, 700.0f, 0.0f };
+ static Vec3f sFocusOffset = { 600.0f, 700.0f, 0.0f };
EnGe2* this = (EnGe2*)thisx;
- if (limbIndex == 6) {
- Matrix_MultVec3f(&D_80A343B0, &this->actor.focus.pos);
+ if (limbIndex == OBJECT_GLA_LIMB_HEAD) {
+ Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos);
}
}
void EnGe2_Draw(Actor* thisx, PlayState* play) {
- static void* eyeTextures[] = { gGerudoPurpleEyeOpenTex, gGerudoPurpleEyeHalfTex, gGerudoPurpleEyeClosedTex };
- STACK_PAD(s32);
+ static void* sEyeTextures[] = {
+ gObjectGlaEyeOpenTex,
+ gObjectGlaEyeHalfTex,
+ gObjectGlaEyeClosedTex,
+ };
EnGe2* this = (EnGe2*)thisx;
+ STACK_PAD(s32);
OPEN_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1274);
-
Gfx_SetupDL_37Opa(play->state.gfxCtx);
- gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex]));
+ gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex]));
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(play->state.gfxCtx, "../z_en_ge2.c", 1291);
}
diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h
index 27094a583..67f24cb60 100644
--- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h
+++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h
@@ -4,30 +4,38 @@
#include "ultra64.h"
#include "actor.h"
+#include "assets/objects/object_gla/object_gla.h"
+
+typedef enum EnGe2Type {
+ /* 0 */ EN_GE2_TYPE_PATROL,
+ /* 1 */ EN_GE2_TYPE_STATIC,
+ /* 2 */ EN_GE2_TYPE_GERUDOS_CARD_GIVER // unused and possibly non functional
+} EnGe2Type;
+
struct EnGe2;
typedef void (*EnGe2ActionFunc)(struct EnGe2*, struct PlayState*);
typedef struct EnGe2 {
- /* 0x0000 */ Actor actor;
- /* 0x014C */ ColliderCylinder collider;
- /* 0x0198 */ SkelAnime skelAnime;
- /* 0x01DC */ Vec3s jointTable[22];
- /* 0x0260 */ Vec3s morphTable[22];
- /* 0x02E4 */ s16 eyeIndex;
- /* 0x02E6 */ s16 blinkTimer;
- /* 0x02E8 */ Vec3s headRot;
- /* 0x02EE */ Vec3s unk_2EE;
- /* 0x02F4 */ u16 stateFlags;
- /* 0x02F6 */ s16 walkDirection;
- /* 0x02F8 */ s16 yawTowardsPlayer;
- /* 0x02FC */ f32 yDetectRange;
- /* 0x0300 */ u16 walkDuration;
- /* 0x0302 */ u16 walkTimer;
- /* 0x0304 */ u8 unk_304;
- /* 0x0305 */ u8 timer;
- /* 0x0306 */ u8 playerSpottedParam;
- /* 0x0308 */ EnGe2ActionFunc actionFunc;
-} EnGe2; // size = 0x030C
+ /* 0x000 */ Actor actor;
+ /* 0x14C */ ColliderCylinder collider;
+ /* 0x198 */ SkelAnime skelAnime;
+ /* 0x1DC */ Vec3s jointTable[OBJECT_GLA_LIMB_MAX];
+ /* 0x260 */ Vec3s morphTable[OBJECT_GLA_LIMB_MAX];
+ /* 0x2E4 */ s16 eyeTexIndex;
+ /* 0x2E6 */ s16 eyeTimer;
+ /* 0x2E8 */ Vec3s headRot;
+ /* 0x2EE */ Vec3s torsoRot;
+ /* 0x2F4 */ u16 stateFlags;
+ /* 0x2F6 */ s16 targetYaw;
+ /* 0x2F8 */ s16 patrolAlertedYaw;
+ /* 0x2FC */ f32 detectionYRange;
+ /* 0x300 */ u16 patrolTime;
+ /* 0x302 */ u16 patrolTimer;
+ /* 0x304 */ s8 unk_304; // unused
+ /* 0x305 */ u8 timer;
+ /* 0x306 */ u8 playerNoise;
+ /* 0x308 */ EnGe2ActionFunc actionFunc;
+} EnGe2; // size = 0x30C
#endif