mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-22 06:52:03 +00:00
PlayState Rename (#1231)
* global context -> play * fix PlayState* PlayState
This commit is contained in:
parent
154f44b6da
commit
2e6279bc8e
912 changed files with 40489 additions and 41078 deletions
|
@ -11,18 +11,18 @@
|
|||
|
||||
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9)
|
||||
|
||||
void EnFw_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFw_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnFw_Init(Actor* thisx, PlayState* play);
|
||||
void EnFw_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnFw_Update(Actor* thisx, PlayState* play);
|
||||
void EnFw_Draw(Actor* thisx, PlayState* play);
|
||||
void EnFw_UpdateEffects(EnFw* this);
|
||||
void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_DrawEffects(EnFw* this, PlayState* play);
|
||||
void EnFw_SpawnEffectDust(EnFw* this, Vec3f* initialPos, Vec3f* initialSpeed, Vec3f* accel, u8 initialTimer, f32 scale,
|
||||
f32 scaleStep);
|
||||
void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_Run(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx);
|
||||
void EnFw_Bounce(EnFw* this, PlayState* play);
|
||||
void EnFw_Run(EnFw* this, PlayState* play);
|
||||
void EnFw_JumpToParentInitPos(EnFw* this, PlayState* play);
|
||||
void EnFw_TurnToParentInitPos(EnFw* this, PlayState* play);
|
||||
|
||||
const ActorInit En_Fw_InitVars = {
|
||||
ACTOR_EN_FW,
|
||||
|
@ -98,8 +98,8 @@ s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) {
|
|||
return true;
|
||||
}
|
||||
|
||||
s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
s32 EnFw_PlayerInRange(EnFw* this, PlayState* play) {
|
||||
Player* player = GET_PLAYER(play);
|
||||
CollisionPoly* poly;
|
||||
s32 bgId;
|
||||
Vec3f collisionPos;
|
||||
|
@ -112,8 +112,8 @@ s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (BgCheck_EntityLineTest1(&globalCtx->colCtx, &this->actor.world.pos, &player->actor.world.pos, &collisionPos,
|
||||
&poly, true, false, false, true, &bgId)) {
|
||||
if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &player->actor.world.pos, &collisionPos, &poly,
|
||||
true, false, false, true, &bgId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ Vec3f* EnFw_GetPosAdjAroundCircle(Vec3f* dst, EnFw* this, f32 radius, s16 dir) {
|
|||
return dst;
|
||||
}
|
||||
|
||||
s32 EnFw_CheckCollider(EnFw* this, GlobalContext* globalCtx) {
|
||||
s32 EnFw_CheckCollider(EnFw* this, PlayState* play) {
|
||||
ColliderInfo* info;
|
||||
|
||||
if (this->collider.base.acFlags & AC_HIT) {
|
||||
|
@ -147,7 +147,7 @@ s32 EnFw_CheckCollider(EnFw* this, GlobalContext* globalCtx) {
|
|||
this->collider.base.acFlags &= ~AC_HIT;
|
||||
if (Actor_ApplyDamage(&this->actor) <= 0) {
|
||||
if (this->actor.parent->colChkInfo.health <= 8) {
|
||||
Enemy_StartFinishingBlow(globalCtx, &this->actor);
|
||||
Enemy_StartFinishingBlow(play, &this->actor);
|
||||
this->actor.parent->colChkInfo.health = 0;
|
||||
} else {
|
||||
this->actor.parent->colChkInfo.health -= 8;
|
||||
|
@ -184,15 +184,14 @@ s32 EnFw_SpawnDust(EnFw* this, u8 timer, f32 scale, f32 scaleStep, s32 dustCnt,
|
|||
return 0;
|
||||
}
|
||||
|
||||
void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFw_Init(Actor* thisx, PlayState* play) {
|
||||
EnFw* this = (EnFw*)thisx;
|
||||
|
||||
SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gFlareDancerCoreSkel, NULL, this->jointTable, this->morphTable,
|
||||
11);
|
||||
SkelAnime_InitFlex(play, &this->skelAnime, &gFlareDancerCoreSkel, NULL, this->jointTable, this->morphTable, 11);
|
||||
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENFW_ANIM_0);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f);
|
||||
Collider_InitJntSph(globalCtx, &this->collider);
|
||||
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->sphs);
|
||||
Collider_InitJntSph(play, &this->collider);
|
||||
Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->sphs);
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x10), &D_80A1FB94);
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
this->runDirection = -this->actor.params;
|
||||
|
@ -200,20 +199,20 @@ void EnFw_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
this->actor.gravity = -1.0f;
|
||||
}
|
||||
|
||||
void EnFw_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFw_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnFw* this = (EnFw*)thisx;
|
||||
|
||||
Collider_DestroyJntSph(globalCtx, &this->collider);
|
||||
Collider_DestroyJntSph(play, &this->collider);
|
||||
}
|
||||
|
||||
void EnFw_Bounce(EnFw* this, GlobalContext* globalCtx) {
|
||||
void EnFw_Bounce(EnFw* this, PlayState* play) {
|
||||
if (EnFw_DoBounce(this, 3, 8.0f) && this->bounceCnt == 0) {
|
||||
this->returnToParentTimer = Rand_S16Offset(300, 150);
|
||||
this->actionFunc = EnFw_Run;
|
||||
}
|
||||
}
|
||||
|
||||
void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
||||
void EnFw_Run(EnFw* this, PlayState* play) {
|
||||
f32 tmpAngle;
|
||||
s16 curFrame;
|
||||
f32 facingDir;
|
||||
|
@ -229,7 +228,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this->damageTimer == 0 && this->explosionTimer == 0 && EnFw_CheckCollider(this, globalCtx)) {
|
||||
if (this->damageTimer == 0 && this->explosionTimer == 0 && EnFw_CheckCollider(this, play)) {
|
||||
if (this->actor.parent->colChkInfo.health > 0) {
|
||||
if (!this->lastDmgHook) {
|
||||
this->actor.velocity.y = 6.0f;
|
||||
|
@ -253,14 +252,14 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (this->explosionTimer == 0) {
|
||||
bomb = (EnBom*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_BOM, this->bompPos.x, this->bompPos.y,
|
||||
bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->bompPos.x, this->bompPos.y,
|
||||
this->bompPos.z, 0, 0, 0x600, 0);
|
||||
if (bomb != NULL) {
|
||||
bomb->timer = 0;
|
||||
}
|
||||
flareDancer = this->actor.parent;
|
||||
flareDancer->params |= 0x4000;
|
||||
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, 0xA0);
|
||||
Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0xA0);
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
@ -300,7 +299,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
|||
|
||||
this->actor.world.rot = this->actor.shape.rot;
|
||||
|
||||
if (this->slideTimer == 0 && EnFw_PlayerInRange(this, globalCtx)) {
|
||||
if (this->slideTimer == 0 && EnFw_PlayerInRange(this, play)) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLAME_MAN_SURP);
|
||||
this->slideSfxTimer = 8;
|
||||
this->slideTimer = 8;
|
||||
|
@ -330,7 +329,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) {
|
||||
void EnFw_TurnToParentInitPos(EnFw* this, PlayState* play) {
|
||||
s16 angleToParentInit;
|
||||
|
||||
angleToParentInit = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.parent->home.pos);
|
||||
|
@ -346,7 +345,7 @@ void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) {
|
||||
void EnFw_JumpToParentInitPos(EnFw* this, PlayState* play) {
|
||||
if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y <= 0.0f) {
|
||||
this->actor.parent->params |= 0x8000;
|
||||
Actor_Kill(&this->actor);
|
||||
|
@ -356,29 +355,27 @@ void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnFw_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFw_Update(Actor* thisx, PlayState* play) {
|
||||
EnFw* this = (EnFw*)thisx;
|
||||
|
||||
SkelAnime_Update(&this->skelAnime);
|
||||
if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) {
|
||||
// not attached to hookshot.
|
||||
Actor_MoveForward(&this->actor);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 20.0f, 0.0f,
|
||||
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
|
||||
this->actionFunc(this, globalCtx);
|
||||
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 20.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
|
||||
this->actionFunc(this, play);
|
||||
if (this->damageTimer == 0 && this->explosionTimer == 0 && this->actionFunc == EnFw_Run) {
|
||||
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 EnFw_OverrideLimbDraw(GlobalContext* globalContext, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
void* thisx) {
|
||||
s32 EnFw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
void EnFw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
EnFw* this = (EnFw*)thisx;
|
||||
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
|
@ -395,15 +392,15 @@ void EnFw_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
|
|||
Collider_UpdateSpheres(limbIndex, &this->collider);
|
||||
}
|
||||
|
||||
void EnFw_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
void EnFw_Draw(Actor* thisx, PlayState* play) {
|
||||
EnFw* this = (EnFw*)thisx;
|
||||
|
||||
EnFw_UpdateEffects(this);
|
||||
Matrix_Push();
|
||||
EnFw_DrawEffects(this, globalCtx);
|
||||
EnFw_DrawEffects(this, play);
|
||||
Matrix_Pop();
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
func_80093D18(play->state.gfxCtx);
|
||||
SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
|
||||
EnFw_OverrideLimbDraw, EnFw_PostLimbDraw, this);
|
||||
}
|
||||
|
||||
|
@ -448,7 +445,7 @@ void EnFw_UpdateEffects(EnFw* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) {
|
||||
void EnFw_DrawEffects(EnFw* this, PlayState* play) {
|
||||
static void* dustTextures[] = {
|
||||
gDust8Tex, gDust7Tex, gDust6Tex, gDust5Tex, gDust4Tex, gDust3Tex, gDust2Tex, gDust1Tex,
|
||||
};
|
||||
|
@ -458,10 +455,10 @@ void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) {
|
|||
s16 i;
|
||||
s16 idx;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fw.c", 1191);
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_en_fw.c", 1191);
|
||||
|
||||
materialFlag = false;
|
||||
func_80093D84(globalCtx->state.gfxCtx);
|
||||
func_80093D84(play->state.gfxCtx);
|
||||
if (1) {}
|
||||
|
||||
for (i = 0; i < EN_FW_EFFECT_COUNT; i++, eff++) {
|
||||
|
@ -477,9 +474,9 @@ void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) {
|
|||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW);
|
||||
Matrix_ReplaceRotation(&globalCtx->billboardMtxF);
|
||||
Matrix_ReplaceRotation(&play->billboardMtxF);
|
||||
Matrix_Scale(eff->scale, eff->scale, 1.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fw.c", 1229),
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_fw.c", 1229),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
idx = eff->timer * (8.0f / eff->initialTimer);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(dustTextures[idx]));
|
||||
|
@ -487,5 +484,5 @@ void EnFw_DrawEffects(EnFw* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fw.c", 1243);
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_en_fw.c", 1243);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
struct EnFw;
|
||||
|
||||
typedef void (*EnFwActionFunc)(struct EnFw* this, GlobalContext* globalCtx);
|
||||
typedef void (*EnFwActionFunc)(struct EnFw* this, PlayState* play);
|
||||
|
||||
#define EN_FW_EFFECT_COUNT 20
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue