1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 06:21: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

@ -4,28 +4,28 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4)
void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx);
void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx);
void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnSkb_Init(Actor* thisx, PlayState* play);
void EnSkb_Destroy(Actor* thisx, PlayState* play);
void EnSkb_Update(Actor* thisx, PlayState* play);
void EnSkb_Draw(Actor* thisx, PlayState* play);
void func_80AFCD60(EnSkb* this);
void func_80AFCDF8(EnSkb* this);
void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx);
void func_80AFCE5C(EnSkb* this, PlayState* play);
void func_80AFCF48(EnSkb* this);
void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx);
void func_80AFCFF0(EnSkb* this, PlayState* play);
void func_80AFD0A4(EnSkb* this);
void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx);
void EnSkb_Advance(EnSkb* this, PlayState* play);
void func_80AFD33C(EnSkb* this);
void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx);
void EnSkb_SetupAttack(EnSkb* this, PlayState* play);
void func_80AFD47C(EnSkb* this);
void func_80AFD508(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD508(EnSkb* this, PlayState* play);
void EnSkb_SetupStunned(EnSkb* this);
void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD880(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD968(EnSkb* this, GlobalContext* globalCtx);
void func_80AFD59C(EnSkb* this, PlayState* play);
void func_80AFD6CC(EnSkb* this, PlayState* play);
void func_80AFD7B4(EnSkb* this, PlayState* play);
void func_80AFD880(EnSkb* this, PlayState* play);
void func_80AFD968(EnSkb* this, PlayState* play);
static ColliderJntSphElementInit sJntSphElementsInit[2] = {
{
@ -116,7 +116,7 @@ void EnSkb_SetupAction(EnSkb* this, EnSkbActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
void EnSkb_SpawnDebris(GlobalContext* globalCtx, EnSkb* this, Vec3f* spawnPos) {
void EnSkb_SpawnDebris(PlayState* play, EnSkb* this, Vec3f* spawnPos) {
Vec3f pos;
Vec3f vel = { 0.0f, 8.0f, 0.0f };
Vec3f accel = { 0.0f, -1.5f, 0.0f };
@ -131,8 +131,8 @@ void EnSkb_SpawnDebris(GlobalContext* globalCtx, EnSkb* this, Vec3f* spawnPos) {
accel.z = Rand_CenteredFloat(1.0f);
vel.y += (Rand_ZeroOne() - 0.5f) * 4.0f;
scale = (Rand_ZeroOne() * 5.0f) + 12.0f;
EffectSsHahen_Spawn(globalCtx, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, 0);
func_80033480(globalCtx, &pos, 10.0f, 1, 150, 0, 1);
EffectSsHahen_Spawn(play, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, 0);
func_80033480(play, &pos, 10.0f, 1, 150, 0, 1);
}
static InitChainEntry sInitChain[] = {
@ -140,7 +140,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP),
};
void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnSkb_Init(Actor* thisx, PlayState* play) {
EnSkb* this = (EnSkb*)thisx;
s16 paramOffsetBody;
s16 paramOffsetArm;
@ -152,12 +152,12 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) {
this->actor.colChkInfo.mass = 0xFE;
this->actor.colChkInfo.health = 2;
this->actor.shape.yOffset = -8000.0f;
SkelAnime_Init(globalCtx, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlingAnim, this->jointTable,
SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlingAnim, this->jointTable,
this->morphTable, 20);
this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD;
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItem);
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderItem);
Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f);
paramOffsetBody = this->actor.params + 0xA;
@ -172,7 +172,7 @@ void EnSkb_Init(Actor* thisx, GlobalContext* globalCtx) {
func_80AFCDF8(this);
}
void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnSkb_Destroy(Actor* thisx, PlayState* play) {
EnSkb* this = (EnSkb*)thisx;
if (this->actor.parent != NULL) {
@ -184,7 +184,7 @@ void EnSkb_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
}
}
Collider_DestroyJntSph(globalCtx, &this->collider);
Collider_DestroyJntSph(play, &this->collider);
}
void func_80AFCD60(EnSkb* this) {
@ -206,7 +206,7 @@ void func_80AFCDF8(EnSkb* this) {
EnSkb_SetupAction(this, func_80AFCE5C);
}
void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx) {
void func_80AFCE5C(EnSkb* this, PlayState* play) {
if (this->skelAnime.curFrame < 4.0f) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
@ -215,8 +215,8 @@ void func_80AFCE5C(EnSkb* this, GlobalContext* globalCtx) {
}
Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 800.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f, 0.0f);
if ((globalCtx->gameplayFrames & 1) != 0) {
EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos);
if ((play->gameplayFrames & 1) != 0) {
EnSkb_SpawnDebris(play, this, &this->actor.world.pos);
}
if ((SkelAnime_Update(&this->skelAnime) != 0) && (0.0f == this->actor.shape.yOffset)) {
func_80AFCD60(this);
@ -234,10 +234,10 @@ void func_80AFCF48(EnSkb* this) {
EnSkb_SetupAction(this, func_80AFCFF0);
}
void func_80AFCFF0(EnSkb* this, GlobalContext* globalCtx) {
void func_80AFCFF0(EnSkb* this, PlayState* play) {
if ((Math_SmoothStepToF(&this->actor.shape.yOffset, -8000.0f, 1.0f, 500.0f, 0.0f) != 0.0f) &&
(globalCtx->gameplayFrames & 1)) {
EnSkb_SpawnDebris(globalCtx, this, &this->actor.world.pos);
(play->gameplayFrames & 1)) {
EnSkb_SpawnDebris(play, this, &this->actor.world.pos);
}
Math_SmoothStepToF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f, 0.0f);
if (SkelAnime_Update(&this->skelAnime) != 0) {
@ -254,13 +254,13 @@ void func_80AFD0A4(EnSkb* this) {
EnSkb_SetupAction(this, EnSkb_Advance);
}
void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx) {
void EnSkb_Advance(EnSkb* this, PlayState* play) {
s32 thisKeyFrame;
s32 prevKeyFrame;
f32 playSpeed;
Player* player = GET_PLAYER(globalCtx);
Player* player = GET_PLAYER(play);
if ((this->unk_283 != 0) && ((globalCtx->gameplayFrames & 0xF) == 0)) {
if ((this->unk_283 != 0) && ((play->gameplayFrames & 0xF) == 0)) {
this->unk_288 = Rand_CenteredFloat(50000.0f);
}
Math_SmoothStepToS(&this->actor.shape.rot.y, (this->actor.yawTowardsPlayer + this->unk_288), 1, 0x2EE, 0);
@ -302,7 +302,7 @@ void func_80AFD33C(EnSkb* this) {
EnSkb_SetupAction(this, EnSkb_SetupAttack);
}
void EnSkb_SetupAttack(EnSkb* this, GlobalContext* globalCtx) {
void EnSkb_SetupAttack(EnSkb* this, PlayState* play) {
s32 frameData;
frameData = this->skelAnime.curFrame;
@ -329,7 +329,7 @@ void func_80AFD47C(EnSkb* this) {
EnSkb_SetupAction(this, func_80AFD508);
}
void func_80AFD508(EnSkb* this, GlobalContext* globalCtx) {
void func_80AFD508(EnSkb* this, PlayState* play) {
if (SkelAnime_Update(&this->skelAnime) != 0) {
func_80AFCD60(this);
}
@ -345,7 +345,7 @@ void EnSkb_SetupStunned(EnSkb* this) {
EnSkb_SetupAction(this, func_80AFD59C);
}
void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) {
void func_80AFD59C(EnSkb* this, PlayState* play) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
this->actor.speedXZ = 0.0f;
}
@ -356,7 +356,7 @@ void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) {
}
if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
if (this->actor.colChkInfo.health == 0) {
func_80AFD7B4(this, globalCtx);
func_80AFD7B4(this, play);
} else {
func_80AFCD60(this);
}
@ -374,12 +374,12 @@ void func_80AFD644(EnSkb* this) {
EnSkb_SetupAction(this, func_80AFD6CC);
}
void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) {
void func_80AFD6CC(EnSkb* this, PlayState* play) {
// this cast is likely not real, but allows for a match
u8* new_var;
new_var = &this->unk_283;
if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) {
if ((this->unk_283 != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) {
if ((*new_var) != 0) {
this->unk_283 = (*new_var) | 2;
}
@ -399,7 +399,7 @@ void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) {
}
}
void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) {
void func_80AFD7B4(EnSkb* this, PlayState* play) {
Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDyingAnim, -4.0f);
this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
@ -408,22 +408,22 @@ void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) {
}
this->unk_280 = 1;
this->actor.flags &= ~ACTOR_FLAG_0;
BodyBreak_Alloc(&this->bodyBreak, 18, globalCtx);
BodyBreak_Alloc(&this->bodyBreak, 18, play);
this->unk_283 |= 4;
EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28);
EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28);
EnSkb_SetupAction(this, func_80AFD880);
}
void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) {
if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, globalCtx, 1)) {
void func_80AFD880(EnSkb* this, PlayState* play) {
if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) {
if (this->actor.scale.x == 0.01f) {
Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0x10);
Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0x10);
} else if (this->actor.scale.x <= 0.015f) {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_BLUE);
Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE);
} else {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED);
Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED);
}
this->unk_283 |= 8;
@ -431,7 +431,7 @@ void func_80AFD880(EnSkb* this, GlobalContext* globalCtx) {
}
}
void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) {
void func_80AFD968(EnSkb* this, PlayState* play) {
s16 pad;
s32 i;
Vec3f flamePos;
@ -443,7 +443,7 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) {
(this->actor.yDistToWater >= 40.0f)) {
this->actor.colChkInfo.health = 0;
this->unk_281 = 0;
func_80AFD7B4(this, globalCtx);
func_80AFD7B4(this, play);
} else if (this->unk_280 >= 3) {
if ((this->collider.base.acFlags & 2) != 0) {
this->collider.base.acFlags &= ~2;
@ -466,16 +466,16 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) {
flamePos.x += Rand_CenteredFloat(20.0f);
flamePos.z += Rand_CenteredFloat(20.0f);
flamePos.y += (Rand_ZeroOne() * 25.0f);
EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, scale, 0, 0, -1);
EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, scale, 0, 0, -1);
}
phi_v1 = 25;
}
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, phi_v1);
if (!Actor_ApplyDamage(&this->actor)) {
func_80AFD7B4(this, globalCtx);
func_80AFD7B4(this, play);
return;
}
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
if (this->unk_283 == 0) {
if ((this->actor.colChkInfo.damageEffect == 0xD) ||
((this->actor.colChkInfo.damageEffect == 0xE) &&
@ -483,7 +483,7 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) {
player->meleeWeaponAnimation <= PLAYER_MWA_LEFT_COMBO_2H) ||
(player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_RIGHT ||
player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT)))) {
BodyBreak_Alloc(&this->bodyBreak, 2, globalCtx);
BodyBreak_Alloc(&this->bodyBreak, 2, play);
this->unk_283 = 1;
}
}
@ -494,43 +494,43 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) {
}
}
void EnSkb_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnSkb_Update(Actor* thisx, PlayState* play) {
EnSkb* this = (EnSkb*)thisx;
s32 pad;
func_80AFD968(this, globalCtx);
func_80AFD968(this, play);
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 60.0f,
Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f,
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 |
UPDBGCHECKINFO_FLAG_4);
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
this->actor.focus.pos = this->actor.world.pos;
this->actor.focus.pos.y += (3000.0f * this->actor.scale.y);
if (this->unk_281 != 0) {
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
}
if (this->unk_280 >= 3) {
if ((this->actor.colorFilterTimer == 0) || ((this->actor.colorFilterParams & 0x4000) == 0)) {
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);
}
s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
s32 EnSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnSkb* this = (EnSkb*)thisx;
s16 color;
s16 pad[2];
if (limbIndex == 11) {
if ((this->unk_283 & 2) == 0) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_skb.c", 972);
color = ABS((s16)(Math_SinS(globalCtx->gameplayFrames * 0x1770) * 95.0f)) + 160;
OPEN_DISPS(play->state.gfxCtx, "../z_en_skb.c", 972);
color = ABS((s16)(Math_SinS(play->gameplayFrames * 0x1770) * 95.0f)) + 160;
gDPPipeSync(POLY_OPA_DISP++);
gDPSetEnvColor(POLY_OPA_DISP++, color, color, color, 255);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skb.c", 978);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_skb.c", 978);
} else {
*dList = NULL;
}
@ -540,7 +540,7 @@ s32 EnSkb_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
return 0;
}
void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnSkb* this = (EnSkb*)thisx;
Collider_UpdateSpheres(limbIndex, &this->collider);
@ -552,9 +552,9 @@ void EnSkb_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve
}
}
void EnSkb_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnSkb_Draw(Actor* thisx, PlayState* play) {
EnSkb* this = (EnSkb*)thisx;
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw,
func_80093D18(play->state.gfxCtx);
SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw,
EnSkb_PostLimbDraw, &this->actor);
}

View file

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