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

@ -9,15 +9,15 @@
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx);
void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx);
void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx);
void EnBlkobj_Init(Actor* thisx, PlayState* play);
void EnBlkobj_Destroy(Actor* thisx, PlayState* play);
void EnBlkobj_Update(Actor* thisx, PlayState* play);
void EnBlkobj_Draw(Actor* thisx, PlayState* play);
void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx);
void EnBlkobj_Wait(EnBlkobj* this, PlayState* play);
void EnBlkobj_SpawnDarkLink(EnBlkobj* this, PlayState* play);
void EnBlkobj_DarkLinkFight(EnBlkobj* this, PlayState* play);
void EnBlkobj_DoNothing(EnBlkobj* this, PlayState* play);
const ActorInit En_Blkobj_InitVars = {
ACTOR_EN_BLKOBJ,
@ -53,32 +53,32 @@ void EnBlkobj_SetupAction(EnBlkobj* this, EnBlkobjActionFunc actionFunc) {
this->timer = 0;
}
void EnBlkobj_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnBlkobj_Init(Actor* thisx, PlayState* play) {
s32 pad;
EnBlkobj* this = (EnBlkobj*)thisx;
CollisionHeader* colHeader = NULL;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyActor_Init(&this->dyna, DPM_UNK);
if (Flags_GetClear(globalCtx, this->dyna.actor.room)) {
if (Flags_GetClear(play, this->dyna.actor.room)) {
this->alpha = 255;
EnBlkobj_SetupAction(this, EnBlkobj_DoNothing);
} else {
CollisionHeader_GetVirtual(&gIllusionRoomCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
EnBlkobj_SetupAction(this, EnBlkobj_Wait);
}
}
void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void EnBlkobj_Destroy(Actor* thisx, PlayState* play) {
s32 pad;
EnBlkobj* this = (EnBlkobj*)thisx;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
void EnBlkobj_Wait(EnBlkobj* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->dyna.actor.xzDistToPlayer < 120.0f) {
EnBlkobj_SetupAction(this, EnBlkobj_SpawnDarkLink);
@ -86,21 +86,20 @@ void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) {
player->stateFlags2 |= PLAYER_STATE2_26;
}
void EnBlkobj_SpawnDarkLink(EnBlkobj* this, GlobalContext* globalCtx) {
void EnBlkobj_SpawnDarkLink(EnBlkobj* this, PlayState* play) {
if (!(this->dyna.actor.flags & ACTOR_FLAG_6)) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TORCH2, this->dyna.actor.world.pos.x,
this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.yawTowardsPlayer, 0,
0);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TORCH2, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
this->dyna.actor.world.pos.z, 0, this->dyna.actor.yawTowardsPlayer, 0, 0);
EnBlkobj_SetupAction(this, EnBlkobj_DarkLinkFight);
}
}
void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx) {
void EnBlkobj_DarkLinkFight(EnBlkobj* this, PlayState* play) {
s32 alphaMod;
if (this->timer == 0) {
if (Actor_Find(&globalCtx->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) {
Flags_SetClear(globalCtx, this->dyna.actor.room);
if (Actor_Find(&play->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) {
Flags_SetClear(play, this->dyna.actor.room);
this->timer++;
}
} else if (this->timer++ > 100) {
@ -112,25 +111,25 @@ void EnBlkobj_DarkLinkFight(EnBlkobj* this, GlobalContext* globalCtx) {
if (this->alpha > 255) {
this->alpha = 255;
EnBlkobj_SetupAction(this, EnBlkobj_DoNothing);
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
}
}
void EnBlkobj_DoNothing(EnBlkobj* this, GlobalContext* globalCtx) {
void EnBlkobj_DoNothing(EnBlkobj* this, PlayState* play) {
}
void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnBlkobj_Update(Actor* thisx, PlayState* play) {
s32 pad;
EnBlkobj* this = (EnBlkobj*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
}
void EnBlkobj_DrawAlpha(GlobalContext* globalCtx, Gfx* dList, s32 alpha) {
void EnBlkobj_DrawAlpha(PlayState* play, Gfx* dList, s32 alpha) {
Gfx* segment;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 322);
OPEN_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 322);
if (alpha == 255) {
segment = sSetupOpaDL;
@ -142,33 +141,33 @@ void EnBlkobj_DrawAlpha(GlobalContext* globalCtx, Gfx* dList, s32 alpha) {
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, alpha);
gSPDisplayList(POLY_XLU_DISP++, dList);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 330);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 330);
}
void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) {
void EnBlkobj_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnBlkobj* this = (EnBlkobj*)thisx;
s32 illusionAlpha;
u32 gameplayFrames;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 349);
OPEN_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 349);
func_80093D84(globalCtx->state.gfxCtx);
func_80093D84(play->state.gfxCtx);
gameplayFrames = globalCtx->gameplayFrames % 128;
gameplayFrames = play->gameplayFrames % 128;
gSPSegment(POLY_XLU_DISP++, 0x0D,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 363),
Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32));
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_blkobj.c", 363),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->alpha != 0) {
EnBlkobj_DrawAlpha(globalCtx, gIllusionRoomNormalDL, this->alpha);
EnBlkobj_DrawAlpha(play, gIllusionRoomNormalDL, this->alpha);
}
illusionAlpha = 255 - this->alpha;
if (illusionAlpha != 0) {
EnBlkobj_DrawAlpha(globalCtx, gIllusionRoomIllusionDL, illusionAlpha);
EnBlkobj_DrawAlpha(play, gIllusionRoomIllusionDL, illusionAlpha);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 375);
CLOSE_DISPS(play->state.gfxCtx, "../z_en_blkobj.c", 375);
}

View file

@ -6,7 +6,7 @@
struct EnBlkobj;
typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, GlobalContext*);
typedef void (*EnBlkobjActionFunc)(struct EnBlkobj*, PlayState*);
typedef struct EnBlkobj {
/* 0x0000 */ DynaPolyActor dyna;