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

@ -3,21 +3,21 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2)
void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx);
void EnOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx);
void EnOkuta_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnOkuta_Init(Actor* thisx, PlayState* play);
void EnOkuta_Destroy(Actor* thisx, PlayState* play);
void EnOkuta_Update(Actor* thisx, PlayState* play);
void EnOkuta_Draw(Actor* thisx, PlayState* play);
void EnOkuta_SetupWaitToAppear(EnOkuta* this);
void EnOkuta_WaitToAppear(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_WaitToDie(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx);
void EnOkuta_WaitToAppear(EnOkuta* this, PlayState* play);
void EnOkuta_Appear(EnOkuta* this, PlayState* play);
void EnOkuta_Hide(EnOkuta* this, PlayState* play);
void EnOkuta_WaitToShoot(EnOkuta* this, PlayState* play);
void EnOkuta_Shoot(EnOkuta* this, PlayState* play);
void EnOkuta_WaitToDie(EnOkuta* this, PlayState* play);
void EnOkuta_Die(EnOkuta* this, PlayState* play);
void EnOkuta_Freeze(EnOkuta* this, PlayState* play);
void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play);
const ActorInit En_Okuta_InitVars = {
ACTOR_EN_OKUTA,
@ -113,7 +113,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(targetArrowOffset, 6500, ICHAIN_STOP),
};
void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnOkuta_Init(Actor* thisx, PlayState* play) {
EnOkuta* this = (EnOkuta*)thisx;
s32 pad;
WaterBox* outWaterBox;
@ -124,18 +124,18 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) {
this->numShots = (thisx->params >> 8) & 0xFF;
thisx->params &= 0xFF;
if (thisx->params == 0) {
SkelAnime_Init(globalCtx, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable,
this->morphTable, 38);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sOctorockColliderInit);
SkelAnime_Init(play, &this->skelAnime, &gOctorokSkel, &gOctorokAppearAnim, this->jointTable, this->morphTable,
38);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, thisx, &sOctorockColliderInit);
CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit);
if ((this->numShots == 0xFF) || (this->numShots == 0)) {
this->numShots = 1;
}
thisx->floorHeight =
BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &thisx->floorPoly, &floorBgId, thisx, &thisx->world.pos);
BgCheck_EntityRaycastFloor4(&play->colCtx, &thisx->floorPoly, &floorBgId, thisx, &thisx->world.pos);
//! @bug calls WaterBox_GetSurfaceImpl directly
if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, thisx->world.pos.x, thisx->world.pos.z, &ySurface,
if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, thisx->world.pos.x, thisx->world.pos.z, &ySurface,
&outWaterBox) ||
(ySurface <= thisx->floorHeight)) {
Actor_Kill(thisx);
@ -147,9 +147,9 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) {
ActorShape_Init(&thisx->shape, 1100.0f, ActorShadow_DrawCircle, 18.0f);
thisx->flags &= ~ACTOR_FLAG_0;
thisx->flags |= ACTOR_FLAG_4;
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sProjectileColliderInit);
Actor_ChangeCategory(globalCtx, &globalCtx->actorCtx, thisx, ACTORCAT_PROP);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, thisx, &sProjectileColliderInit);
Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_PROP);
this->timer = 30;
thisx->shape.rot.y = 0;
this->actionFunc = EnOkuta_ProjectileFly;
@ -157,41 +157,41 @@ void EnOkuta_Init(Actor* thisx, GlobalContext* globalCtx) {
}
}
void EnOkuta_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnOkuta_Destroy(Actor* thisx, PlayState* play) {
EnOkuta* this = (EnOkuta*)thisx;
Collider_DestroyCylinder(globalCtx, &this->collider);
Collider_DestroyCylinder(play, &this->collider);
}
void EnOkuta_SpawnBubbles(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_SpawnBubbles(EnOkuta* this, PlayState* play) {
s32 i;
for (i = 0; i < 10; i++) {
EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, -10.0f, 10.0f, 30.0f, 0.25f);
EffectSsBubble_Spawn(play, &this->actor.world.pos, -10.0f, 10.0f, 30.0f, 0.25f);
}
}
void EnOkuta_SpawnDust(Vec3f* pos, Vec3f* velocity, s16 scaleStep, GlobalContext* globalCtx) {
void EnOkuta_SpawnDust(Vec3f* pos, Vec3f* velocity, s16 scaleStep, PlayState* play) {
static Vec3f accel = { 0.0f, 0.0f, 0.0f };
static Color_RGBA8 primColor = { 255, 255, 255, 255 };
static Color_RGBA8 envColor = { 150, 150, 150, 255 };
func_8002829C(globalCtx, pos, velocity, &accel, &primColor, &envColor, 0x190, scaleStep);
func_8002829C(play, pos, velocity, &accel, &primColor, &envColor, 0x190, scaleStep);
}
void EnOkuta_SpawnSplash(EnOkuta* this, GlobalContext* globalCtx) {
EffectSsGSplash_Spawn(globalCtx, &this->actor.home.pos, NULL, NULL, 0, 1300);
void EnOkuta_SpawnSplash(EnOkuta* this, PlayState* play) {
EffectSsGSplash_Spawn(play, &this->actor.home.pos, NULL, NULL, 0, 1300);
}
void EnOkuta_SpawnRipple(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_SpawnRipple(EnOkuta* this, PlayState* play) {
Vec3f pos;
pos.x = this->actor.world.pos.x;
pos.y = this->actor.home.pos.y;
pos.z = this->actor.world.pos.z;
if ((globalCtx->gameplayFrames % 7) == 0 &&
if ((play->gameplayFrames % 7) == 0 &&
((this->actionFunc != EnOkuta_Shoot) || ((this->actor.world.pos.y - this->actor.home.pos.y) < 50.0f))) {
EffectSsGRipple_Spawn(globalCtx, &pos, 250, 650, 0);
EffectSsGRipple_Spawn(play, &pos, 250, 650, 0);
}
}
@ -202,12 +202,12 @@ void EnOkuta_SetupWaitToAppear(EnOkuta* this) {
this->actor.world.pos.y = this->actor.home.pos.y;
}
void EnOkuta_SetupAppear(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_SetupAppear(EnOkuta* this, PlayState* play) {
this->actor.draw = EnOkuta_Draw;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
this->actor.flags |= ACTOR_FLAG_0;
Animation_PlayOnce(&this->skelAnime, &gOctorokAppearAnim);
EnOkuta_SpawnBubbles(this, globalCtx);
EnOkuta_SpawnBubbles(this, play);
this->actionFunc = EnOkuta_Appear;
}
@ -222,7 +222,7 @@ void EnOkuta_SetupWaitToShoot(EnOkuta* this) {
this->actionFunc = EnOkuta_WaitToShoot;
}
void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_SetupShoot(EnOkuta* this, PlayState* play) {
Animation_PlayOnce(&this->skelAnime, &gOctorokShootAnim);
if (this->actionFunc != EnOkuta_Shoot) {
this->timer = this->numShots;
@ -230,7 +230,7 @@ void EnOkuta_SetupShoot(EnOkuta* this, GlobalContext* globalCtx) {
this->jumpHeight = this->actor.yDistToPlayer + 20.0f;
this->jumpHeight = CLAMP_MIN(this->jumpHeight, 10.0f);
if (this->jumpHeight > 50.0f) {
EnOkuta_SpawnSplash(this, globalCtx);
EnOkuta_SpawnSplash(this, play);
}
if (this->jumpHeight > 50.0f) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_JUMP);
@ -259,7 +259,7 @@ void EnOkuta_SetupFreeze(EnOkuta* this) {
this->actionFunc = EnOkuta_Freeze;
}
void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_SpawnProjectile(EnOkuta* this, PlayState* play) {
Vec3f pos;
Vec3f velocity;
f32 sinY = Math_SinS(this->actor.shape.rot.y);
@ -268,7 +268,7 @@ void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) {
pos.x = this->actor.world.pos.x + (25.0f * sinY);
pos.y = this->actor.world.pos.y - 6.0f;
pos.z = this->actor.world.pos.z + (25.0f * cosY);
if (Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_OKUTA, pos.x, pos.y, pos.z, this->actor.shape.rot.x,
if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OKUTA, pos.x, pos.y, pos.z, this->actor.shape.rot.x,
this->actor.shape.rot.y, this->actor.shape.rot.z, 0x10) != NULL) {
pos.x = this->actor.world.pos.x + (40.0f * sinY);
pos.z = this->actor.world.pos.z + (40.0f * cosY);
@ -276,19 +276,19 @@ void EnOkuta_SpawnProjectile(EnOkuta* this, GlobalContext* globalCtx) {
velocity.x = 1.5f * sinY;
velocity.y = 0.0f;
velocity.z = 1.5f * cosY;
EnOkuta_SpawnDust(&pos, &velocity, 20, globalCtx);
EnOkuta_SpawnDust(&pos, &velocity, 20, play);
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_THROW);
}
void EnOkuta_WaitToAppear(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_WaitToAppear(EnOkuta* this, PlayState* play) {
this->actor.world.pos.y = this->actor.home.pos.y;
if ((this->actor.xzDistToPlayer < 480.0f) && (this->actor.xzDistToPlayer > 200.0f)) {
EnOkuta_SetupAppear(this, globalCtx);
EnOkuta_SetupAppear(this, play);
}
}
void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_Appear(EnOkuta* this, PlayState* play) {
s32 pad;
if (SkelAnime_Update(&this->skelAnime)) {
@ -309,17 +309,17 @@ void EnOkuta_Appear(EnOkuta* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND);
}
if (Animation_OnFrame(&this->skelAnime, 3.0f) || Animation_OnFrame(&this->skelAnime, 15.0f)) {
EnOkuta_SpawnSplash(this, globalCtx);
EnOkuta_SpawnSplash(this, play);
}
}
void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_Hide(EnOkuta* this, PlayState* play) {
s32 pad;
Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 30.0f);
if (SkelAnime_Update(&this->skelAnime)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_BUBLE);
EnOkuta_SpawnBubbles(this, globalCtx);
EnOkuta_SpawnBubbles(this, play);
EnOkuta_SetupWaitToAppear(this);
} else if (this->skelAnime.curFrame >= 4.0f) {
Actor_SetScale(&this->actor, (6.0f - this->skelAnime.curFrame) * 0.5f * 0.01f);
@ -328,11 +328,11 @@ void EnOkuta_Hide(EnOkuta* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK);
}
if (Animation_OnFrame(&this->skelAnime, 4.0f)) {
EnOkuta_SpawnSplash(this, globalCtx);
EnOkuta_SpawnSplash(this, play);
}
}
void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_WaitToShoot(EnOkuta* this, PlayState* play) {
s16 yawDiff;
s32 absYawDiff;
@ -352,12 +352,12 @@ void EnOkuta_WaitToShoot(EnOkuta* this, GlobalContext* globalCtx) {
yawDiff = Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C, 0x38E);
absYawDiff = ABS(yawDiff);
if ((absYawDiff < 0x38E) && (this->timer == 0) && (this->actor.yDistToPlayer < 200.0f)) {
EnOkuta_SetupShoot(this, globalCtx);
EnOkuta_SetupShoot(this, play);
}
}
}
void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_Shoot(EnOkuta* this, PlayState* play) {
Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C);
if (SkelAnime_Update(&this->skelAnime)) {
if (this->timer != 0) {
@ -366,7 +366,7 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) {
if (this->timer == 0) {
EnOkuta_SetupWaitToShoot(this);
} else {
EnOkuta_SetupShoot(this, globalCtx);
EnOkuta_SetupShoot(this, play);
}
} else {
f32 curFrame = this->skelAnime.curFrame;
@ -375,10 +375,10 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) {
this->actor.world.pos.y = (sinf((0.08333f * M_PI) * curFrame) * this->jumpHeight) + this->actor.home.pos.y;
}
if (Animation_OnFrame(&this->skelAnime, 6.0f)) {
EnOkuta_SpawnProjectile(this, globalCtx);
EnOkuta_SpawnProjectile(this, play);
}
if ((this->jumpHeight > 50.0f) && Animation_OnFrame(&this->skelAnime, 13.0f)) {
EnOkuta_SpawnSplash(this, globalCtx);
EnOkuta_SpawnSplash(this, play);
}
if ((this->jumpHeight > 50.0f) && Animation_OnFrame(&this->skelAnime, 13.0f)) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND);
@ -389,14 +389,14 @@ void EnOkuta_Shoot(EnOkuta* this, GlobalContext* globalCtx) {
}
}
void EnOkuta_WaitToDie(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_WaitToDie(EnOkuta* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime)) {
EnOkuta_SetupDie(this);
}
Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 5.0f);
}
void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_Die(EnOkuta* this, PlayState* play) {
static Vec3f accel = { 0.0f, -0.5f, 0.0f };
static Color_RGBA8 primColor = { 255, 255, 255, 255 };
static Color_RGBA8 envColor = { 150, 150, 150, 0 };
@ -415,11 +415,11 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) {
velocity.x = 0.0f;
velocity.y = -0.5f;
velocity.z = 0.0f;
EnOkuta_SpawnDust(&pos, &velocity, -0x14, globalCtx);
EnOkuta_SpawnDust(&pos, &velocity, -0x14, play);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_DEAD2);
}
if (Animation_OnFrame(&this->skelAnime, 15.0f)) {
EnOkuta_SpawnSplash(this, globalCtx);
EnOkuta_SpawnSplash(this, play);
Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_LAND);
}
if (this->timer < 3) {
@ -430,13 +430,13 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) {
Actor_SetScale(&this->actor, (((this->timer - 5) * 0.04f) + 0.8f) * 0.01f);
} else {
if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.0005f)) {
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_BUBLE);
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x70);
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_BUBLE);
Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x70);
for (i = 0; i < 20; i++) {
velocity.x = (Rand_ZeroOne() - 0.5f) * 7.0f;
velocity.y = Rand_ZeroOne() * 7.0f;
velocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f;
EffectSsDtBubble_SpawnCustomColor(globalCtx, &this->actor.world.pos, &velocity, &accel, &primColor,
EffectSsDtBubble_SpawnCustomColor(play, &this->actor.world.pos, &velocity, &accel, &primColor,
&envColor, Rand_S16Offset(100, 50), 25, 0);
}
Actor_Kill(&this->actor);
@ -445,7 +445,7 @@ void EnOkuta_Die(EnOkuta* this, GlobalContext* globalCtx) {
}
}
void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_Freeze(EnOkuta* this, PlayState* play) {
Vec3f pos;
s16 posParam;
@ -460,15 +460,15 @@ void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) {
pos.y = (this->actor.world.pos.y - 32.0f) + (8.0f * (8 - posParam));
pos.x = this->actor.world.pos.x + ((posParam & 2) ? 10.0f : -10.0f);
pos.z = this->actor.world.pos.z + ((posParam & 1) ? 10.0f : -10.0f);
EffectSsEnIce_SpawnFlyingVec3f(globalCtx, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255,
EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255,
(Rand_ZeroOne() * 0.2f) + 1.9f);
}
Math_ApproachF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 5.0f);
}
void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play) {
Vec3f pos;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
Vec3s shieldRot;
this->timer--;
@ -498,8 +498,8 @@ void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) {
pos.x = this->actor.world.pos.x;
pos.y = this->actor.world.pos.y + 11.0f;
pos.z = this->actor.world.pos.z;
EffectSsHahen_SpawnBurst(globalCtx, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL);
SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK);
EffectSsHahen_SpawnBurst(play, &pos, 6.0f, 0, 1, 2, 15, 7, 10, gOctorokProjectileDL);
SoundSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_OCTAROCK_ROCK);
Actor_Kill(&this->actor);
}
} else if (this->timer == -300) {
@ -552,12 +552,12 @@ void EnOkuta_UpdateHeadScale(EnOkuta* this) {
}
}
void EnOkuta_ColliderCheck(EnOkuta* this, GlobalContext* globalCtx) {
void EnOkuta_ColliderCheck(EnOkuta* this, PlayState* play) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
Actor_SetDropFlag(&this->actor, &this->collider.info, true);
if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) {
Enemy_StartFinishingBlow(globalCtx, &this->actor);
Enemy_StartFinishingBlow(play, &this->actor);
this->actor.colChkInfo.health = 0;
this->actor.flags &= ~ACTOR_FLAG_0;
if (this->actor.colChkInfo.damageEffect == 3) {
@ -569,10 +569,10 @@ void EnOkuta_ColliderCheck(EnOkuta* this, GlobalContext* globalCtx) {
}
}
void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) {
void EnOkuta_Update(Actor* thisx, PlayState* play2) {
EnOkuta* this = (EnOkuta*)thisx;
GlobalContext* globalCtx = globalCtx2;
Player* player = GET_PLAYER(globalCtx);
PlayState* play = play2;
Player* player = GET_PLAYER(play);
WaterBox* outWaterBox;
f32 ySurface;
Vec3f prevPos;
@ -580,9 +580,9 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) {
if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_7 | PLAYER_STATE1_28 | PLAYER_STATE1_29))) {
if (this->actor.params == 0) {
EnOkuta_ColliderCheck(this, globalCtx);
if (!WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x,
this->actor.world.pos.z, &ySurface, &outWaterBox) ||
EnOkuta_ColliderCheck(this, play);
if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z,
&ySurface, &outWaterBox) ||
(ySurface < this->actor.floorHeight)) {
if (this->actor.colChkInfo.health != 0) {
Actor_Kill(&this->actor);
@ -592,7 +592,7 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->actor.home.pos.y = ySurface;
}
}
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
if (this->actor.params == 0) {
EnOkuta_UpdateHeadScale(this);
this->collider.dim.height =
@ -602,15 +602,15 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) {
canRestorePrevPos = false;
Actor_MoveForward(&this->actor);
Math_Vec3f_Copy(&prevPos, &this->actor.world.pos);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 30.0f,
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 15.0f, 30.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) &&
SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) {
SurfaceType_IsIgnoredByProjectiles(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) {
canRestorePrevPos = true;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL;
}
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId)) {
SurfaceType_IsIgnoredByProjectiles(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId)) {
canRestorePrevPos = true;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
}
@ -625,18 +625,18 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) {
}
if (this->actor.params == 0x10) {
this->actor.flags |= ACTOR_FLAG_24;
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
}
if (this->actionFunc != EnOkuta_WaitToAppear) {
if ((this->actionFunc != EnOkuta_Die) && (this->actionFunc != EnOkuta_WaitToDie) &&
(this->actionFunc != EnOkuta_Freeze)) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
}
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
}
Actor_SetFocus(&this->actor, 15.0f);
if ((this->actor.params == 0) && (this->actor.draw != NULL)) {
EnOkuta_SpawnRipple(this, globalCtx);
EnOkuta_SpawnRipple(this, play);
}
}
}
@ -677,8 +677,7 @@ s32 EnOkuta_GetSnoutScale(EnOkuta* this, f32 curFrame, Vec3f* scale) {
return true;
}
s32 EnOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
void* thisx) {
s32 EnOkuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnOkuta* this = (EnOkuta*)thisx;
f32 curFrame = this->skelAnime.curFrame;
Vec3f scale;
@ -701,24 +700,24 @@ s32 EnOkuta_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis
return false;
}
void EnOkuta_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnOkuta_Draw(Actor* thisx, PlayState* play) {
EnOkuta* this = (EnOkuta*)thisx;
s32 pad;
func_80093D18(globalCtx->state.gfxCtx);
func_80093D18(play->state.gfxCtx);
if (this->actor.params == 0) {
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnOkuta_OverrideLimbDraw,
NULL, this);
SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnOkuta_OverrideLimbDraw, NULL,
this);
} else {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1653);
OPEN_DISPS(play->state.gfxCtx, "../z_en_okuta.c", 1653);
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD(this->actor.home.rot.z), MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1657),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_okuta.c", 1657),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gOctorokProjectileDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_okuta.c", 1662);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_okuta.c", 1662);
}
}

View file

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