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

@ -10,23 +10,23 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_27)
void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx);
void ObjWarp2block_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjWarp2block_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjWarp2block_Draw(Actor* thisx, GlobalContext* globalCtx);
void ObjWarp2block_Init(Actor* thisx, PlayState* play);
void ObjWarp2block_Destroy(Actor* thisx, PlayState* play);
void ObjWarp2block_Update(Actor* thisx, PlayState* play);
void ObjWarp2block_Draw(Actor* thisx, PlayState* play);
void ObjWarp2block_Spawn(ObjWarp2block* this, GlobalContext* globalCtx);
s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx);
void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx);
s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx);
s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx);
s32 func_80BA2304(ObjWarp2block* this, GlobalContext* globalCtx);
void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play);
s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play);
void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play);
s32 func_80BA2218(ObjWarp2block* this, PlayState* play);
s32 func_80BA228C(ObjWarp2block* this, PlayState* play);
s32 func_80BA2304(ObjWarp2block* this, PlayState* play);
void ObjWarp2block_SetInactive(ObjWarp2block* this);
void ObjWarp2block_DoNothing(ObjWarp2block* this, GlobalContext* globalCtx);
void ObjWarp2block_DoNothing(ObjWarp2block* this, PlayState* play);
void func_80BA24E8(ObjWarp2block* this);
void func_80BA24F8(ObjWarp2block* this, GlobalContext* globalCtx);
void func_80BA24F8(ObjWarp2block* this, PlayState* play);
void func_80BA2600(ObjWarp2block* this);
void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx);
void func_80BA2610(ObjWarp2block* this, PlayState* play);
const ActorInit Obj_Warp2block_InitVars = {
ACTOR_OBJ_WARP2BLOCK,
@ -64,17 +64,16 @@ static Color_RGB8 sColors[] = {
{ 80, 110, 140 }, { 70, 160, 225 }, { 80, 100, 130 }, { 100, 110, 190 },
};
void ObjWarp2block_Spawn(ObjWarp2block* this, GlobalContext* globalCtx) {
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x,
this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, 0, 0,
sSpawnData[(this->dyna.actor.params >> 8) & 1].params);
void ObjWarp2block_Spawn(ObjWarp2block* this, PlayState* play) {
Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
this->dyna.actor.world.pos.z, 0, 0, 0, sSpawnData[(this->dyna.actor.params >> 8) & 1].params);
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_DEMO_EFFECT, this->dyna.actor.child->world.pos.x,
Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->dyna.actor.child->world.pos.x,
this->dyna.actor.child->world.pos.y, this->dyna.actor.child->world.pos.z, 0, 0, 0,
sSpawnData[(this->dyna.actor.child->params >> 8) & 1].params);
}
s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) {
s32 func_80BA1ECC(ObjWarp2block* this, PlayState* play) {
s32 pad;
Actor* temp_a3;
Player* player;
@ -86,7 +85,7 @@ s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) {
}
temp_a3 = this->dyna.actor.child;
player = GET_PLAYER(globalCtx);
player = GET_PLAYER(play);
if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) ||
(temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) {
@ -110,7 +109,7 @@ s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) {
return 1;
}
void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx) {
void ObjWarp2block_SwapWithChild(ObjWarp2block* this, PlayState* play) {
Vec3f tempVec;
Vec3s tempRot;
s32 temp;
@ -148,18 +147,18 @@ void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx)
this->dyna.actor.child->params = (this->dyna.actor.child->params & 0x8000) | (temp & 0x7FFF);
if (Math3D_Vec3fDistSq(&this->dyna.actor.world.pos, &this->dyna.actor.home.pos) < 0.01f) {
Flags_UnsetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
Flags_UnsetSwitch(play, this->dyna.actor.params & 0x3F);
} else {
Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F);
Flags_SetSwitch(play, this->dyna.actor.params & 0x3F);
}
}
s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
s32 func_80BA2218(ObjWarp2block* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (func_80BA1ECC(this, globalCtx)) {
if (func_80BA1ECC(this, play)) {
if (player->stateFlags2 & PLAYER_STATE2_24) {
func_8010BD58(globalCtx, OCARINA_ACTION_FREE_PLAY);
func_8010BD58(play, OCARINA_ACTION_FREE_PLAY);
this->func_168 = func_80BA228C;
} else {
player->stateFlags2 |= PLAYER_STATE2_23;
@ -169,12 +168,12 @@ s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx) {
return 0;
}
s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx) {
if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) {
s32 func_80BA228C(ObjWarp2block* this, PlayState* play) {
if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) {
this->func_168 = func_80BA2218;
}
if (globalCtx->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) {
if (play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) {
if (this->unk_172 == 0xFE) {
this->unk_16E = 0x6E;
} else {
@ -187,16 +186,16 @@ s32 func_80BA228C(ObjWarp2block* this, GlobalContext* globalCtx) {
return 0;
}
s32 func_80BA2304(ObjWarp2block* this, GlobalContext* globalCtx) {
s32 ret = this->func_168(this, globalCtx);
s32 func_80BA2304(ObjWarp2block* this, PlayState* play) {
s32 ret = this->func_168(this, play);
this->unk_172 = globalCtx->msgCtx.lastPlayedSong;
this->unk_172 = play->msgCtx.lastPlayedSong;
return ret;
}
void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
void ObjWarp2block_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
ObjWarp2block* this = (ObjWarp2block*)thisx;
CollisionHeader* collisionHeader;
@ -210,12 +209,12 @@ void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) {
if ((this->dyna.actor.params >> 0xF) & 1) {
func_80BA24E8(this);
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
this->dyna.actor.draw = NULL;
}
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &collisionHeader);
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, collisionHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, collisionHeader);
} else {
ObjWarp2block_SetInactive(this);
}
@ -224,10 +223,10 @@ void ObjWarp2block_Init(Actor* thisx, GlobalContext* globalCtx2) {
this->dyna.actor.home.rot.z & 7, (this->dyna.actor.params >> 0xB) & 7);
}
void ObjWarp2block_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void ObjWarp2block_Destroy(Actor* thisx, PlayState* play) {
ObjWarp2block* this = (ObjWarp2block*)thisx;
if ((this->dyna.actor.params >> 0xF) & 1) {
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
}
@ -236,22 +235,22 @@ void ObjWarp2block_SetInactive(ObjWarp2block* this) {
this->dyna.actor.draw = NULL;
}
void ObjWarp2block_DoNothing(ObjWarp2block* this, GlobalContext* globalCtx) {
void ObjWarp2block_DoNothing(ObjWarp2block* this, PlayState* play) {
}
void func_80BA24E8(ObjWarp2block* this) {
this->actionFunc = func_80BA24F8;
}
void func_80BA24F8(ObjWarp2block* this, GlobalContext* globalCtx) {
Actor* current = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;
void func_80BA24F8(ObjWarp2block* this, PlayState* play) {
Actor* current = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head;
while (current != NULL) {
if (current->id == ACTOR_OBJ_WARP2BLOCK && !((current->params >> 0xF) & 1) &&
((this->dyna.actor.params & 0x3F) == (current->params & 0x3F))) {
this->dyna.actor.child = current;
if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) {
ObjWarp2block_SwapWithChild(this, globalCtx);
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
ObjWarp2block_SwapWithChild(this, play);
this->dyna.actor.draw = ObjWarp2block_Draw;
}
func_80BA2600(this);
@ -274,18 +273,18 @@ void func_80BA2600(ObjWarp2block* this) {
this->actionFunc = func_80BA2610;
}
void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx) {
if ((func_80BA2304(this, globalCtx) != 0) && (this->unk_16C <= 0)) {
ObjWarp2block_Spawn(this, globalCtx);
void func_80BA2610(ObjWarp2block* this, PlayState* play) {
if ((func_80BA2304(this, play) != 0) && (this->unk_16C <= 0)) {
ObjWarp2block_Spawn(this, play);
this->unk_16C = 0xA0;
OnePointCutscene_Attention(globalCtx, &this->dyna.actor);
OnePointCutscene_Attention(play, &this->dyna.actor);
this->unk_170 = 0xC;
}
if (this->unk_170 > 0) {
this->unk_170--;
if (this->unk_170 == 0) {
ObjWarp2block_SwapWithChild(this, globalCtx);
ObjWarp2block_SwapWithChild(this, play);
}
}
if (this->unk_16C == 0x32) {
@ -293,27 +292,27 @@ void func_80BA2610(ObjWarp2block* this, GlobalContext* globalCtx) {
}
}
void ObjWarp2block_Update(Actor* thisx, GlobalContext* globalCtx) {
void ObjWarp2block_Update(Actor* thisx, PlayState* play) {
ObjWarp2block* this = (ObjWarp2block*)thisx;
this->actionFunc(this, globalCtx);
this->actionFunc(this, play);
if (this->unk_16C > 0) {
this->unk_16C--;
}
}
void ObjWarp2block_Draw(Actor* thisx, GlobalContext* globalCtx) {
void ObjWarp2block_Draw(Actor* thisx, PlayState* play) {
Color_RGB8* sp44;
sp44 = &sColors[thisx->home.rot.z & 7];
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_warp2block.c", 584);
func_80093D18(globalCtx->state.gfxCtx);
OPEN_DISPS(play->state.gfxCtx, "../z_obj_warp2block.c", 584);
func_80093D18(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_warp2block.c", 588),
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_warp2block.c", 588),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sp44->r, sp44->g, sp44->b, 255);
gSPDisplayList(POLY_OPA_DISP++, gSongOfTimeBlockDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_warp2block.c", 594);
CLOSE_DISPS(play->state.gfxCtx, "../z_obj_warp2block.c", 594);
}

View file

@ -6,8 +6,8 @@
struct ObjWarp2block;
typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, GlobalContext*);
typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, GlobalContext*);
typedef void (*ObjWarp2blockActionFunc)(struct ObjWarp2block*, PlayState*);
typedef s32 (*ObjWarp2blockFunc168)(struct ObjWarp2block*, PlayState*);
typedef struct ObjWarp2block {
/* 0x0000 */ DynaPolyActor dyna;