From 21e367a7cb70b166c68891778a6e8ad3aba44daa Mon Sep 17 00:00:00 2001 From: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Date: Tue, 29 Dec 2020 08:50:56 +0000 Subject: Bigmirror OK and documented (#530) * OK * documented (with one odd float value) * delete asm and alter spec * uniformise spawn data to sIsSpawned, fix compile warnings in Bg_Jya_Lift and Bg_Mori_Elevator * translate last printf * re-delete modified asm * addressed review comments * remove outdated comment * addressed comments, made defines * untrack scenes dir * remove scenes dir --- .../actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c | 10 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c | 253 +++++++++++++++++++-- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h | 13 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c | 16 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h | 2 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 10 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h | 2 +- .../actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c | 8 +- 8 files changed, 274 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index a7336d6b6..a62c0ab91 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -24,7 +24,7 @@ void func_80892E0C(BgJya1flift* this); void BgJya1flift_ResetMoveDelay(BgJya1flift* this); void BgJya1flift_DelayMove(BgJya1flift* this, GlobalContext* globalCtx); -static u8 sHasSpawned = false; +static u8 sIsSpawned = false; const ActorInit Bg_Jya_1flift_InitVars = { ACTOR_BG_JYA_1FLIFT, @@ -85,9 +85,9 @@ void BgJya1flift_InitCollision(Actor* thisx, GlobalContext* globalCtx) { void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) { BgJya1flift* this = THIS; // 1 F lift - osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sHasSpawned, globalCtx->roomCtx.curRoom.num); + osSyncPrintf("(1Fリフト)(flag %d)(room %d)\n", sIsSpawned, globalCtx->roomCtx.curRoom.num); this->hasInitialized = false; - if (sHasSpawned) { + if (sIsSpawned) { Actor_Kill(thisx); return; } @@ -100,7 +100,7 @@ void BgJya1flift_Init(Actor* thisx, GlobalContext* globalCtx) { func_80892DB0(this); } thisx->room = -1; - sHasSpawned = true; + sIsSpawned = true; this->hasInitialized = true; } @@ -108,7 +108,7 @@ void BgJya1flift_Destroy(Actor* thisx, GlobalContext* globalCtx) { BgJya1flift* this = THIS; if (this->hasInitialized) { - sHasSpawned = false; + sIsSpawned = false; Collider_DestroyCylinder(globalCtx, &this->collider); DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c index f61af7947..593c0e28b 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c @@ -1,20 +1,29 @@ +/* + * File: z_bg_jya_bigmirror.c + * Overlay: ovl_Bg_Jya_Bigmirror + * Description: Ceiling mirror and puzzle in Spirit Temple top rooms + */ + #include "z_bg_jya_bigmirror.h" #define FLAGS 0x00000030 #define THIS ((BgJyaBigmirror*)thisx) +#define BIGMIR_PUZZLE_COBRA1_SOLVED 1 << 0 +#define BIGMIR_PUZZLE_COBRA2_SOLVED 1 << 1 +#define BIGMIR_PUZZLE_BOMBIWA_DESTROYED 1 << 2 +#define BIGMIR_PUZZLE_IN_STATUE_ROOM 1 << 3 +#define BIGMIR_PUZZLE_IN_1ST_TOP_ROOM 1 << 4 +#define BIGMIR_PUZZLE_IN_2ND_TOP_ROOM 1 << 5 + void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx); void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx); void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx); -extern UNK_TYPE D_0600BC70; -extern UNK_TYPE D_0600BD80; -extern UNK_TYPE D_0600E1B0; -extern UNK_TYPE D_0600E2D0; +static u8 sIsSpawned = false; -/* const ActorInit Bg_Jya_Bigmirror_InitVars = { ACTOR_BG_JYA_BIGMIRROR, ACTORTYPE_BG, @@ -26,21 +35,235 @@ const ActorInit Bg_Jya_Bigmirror_InitVars = { (ActorFunc)BgJyaBigmirror_Update, (ActorFunc)BgJyaBigmirror_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/func_808936E0.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/func_80893750.s") +typedef struct { + /* 0x00 */ Vec3f pos; + /* 0x0C */ s16 params; + /* 0x0E */ s16 solvedRotY; + /* 0x10 */ s16 initRotY; +} BigMirrorDataEntry; // size = 0x14 + +static BigMirrorDataEntry sCobraSpawnData[] = { + { { -560.0f, 1743.0f, -310.0f }, 0xFF01, 0x4000, 0x8000 }, + { { 60.0f, 1743.0f, -310.0f }, 0xFF02, 0x8000, 0xA000 }, +}; + +extern Gfx D_0600BC70[]; +extern Gfx D_0600BD80[]; +extern Gfx D_0600E1B0[]; +extern Gfx D_0600E2D0[]; + +void BgJyaBigmirror_SetRoomFlag(Actor* thisx, GlobalContext* globalCtx) { + BgJyaBigmirror* this = THIS; + + this->puzzleFlags &= ~(BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM); + if (globalCtx->roomCtx.curRoom.num == 5) { + this->puzzleFlags |= BIGMIR_PUZZLE_IN_STATUE_ROOM; + } else if (globalCtx->roomCtx.curRoom.num == 0x19) { + this->puzzleFlags |= BIGMIR_PUZZLE_IN_1ST_TOP_ROOM; + } else if (globalCtx->roomCtx.curRoom.num == 0x1A) { + this->puzzleFlags |= BIGMIR_PUZZLE_IN_2ND_TOP_ROOM; + } +} + +void BgJyaBigmirror_HandleCobra(Actor* thisx, GlobalContext* globalCtx) { + static u8 cobraPuzzleFlags[] = { BIGMIR_PUZZLE_COBRA1_SOLVED, BIGMIR_PUZZLE_COBRA2_SOLVED }; + BgJyaBigmirror* this = THIS; + BigMirrorDataEntry* curSpawnData; + BigmirrorCobra* curCobraInfo; + s32 i; + + if (this->puzzleFlags & (BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM)) { + + for (i = 0; i < 2; i++) { + curSpawnData = &sCobraSpawnData[i]; + curCobraInfo = &this->cobraInfo[i]; + + if (curCobraInfo->cobra != NULL) { + curCobraInfo->rotY = curCobraInfo->cobra->actor.shape.rot.y; + + if (curCobraInfo->rotY == curSpawnData->solvedRotY) { + this->puzzleFlags |= cobraPuzzleFlags[i]; + } else { + this->puzzleFlags &= ~cobraPuzzleFlags[i]; + } + + if (curCobraInfo->cobra->actor.update == NULL) { + // Cobra deleted + osSyncPrintf("Error : コブラ削除された (%s %d)\n", "../z_bg_jya_bigmirror.c", 203); + } + } else { + curCobraInfo->cobra = (BgJyaCobra*)Actor_SpawnAsChild( + &globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, + curSpawnData->pos.y, curSpawnData->pos.z, 0, curCobraInfo->rotY, 0, curSpawnData->params); + this->actor.child = NULL; + + if (&curCobraInfo->cobra->actor == NULL) { + // Cobra generation failed + osSyncPrintf("Error : コブラ発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 221); + } + } + } + } else { + + for (i = 0; i < 2; i++) { + curCobraInfo = &this->cobraInfo[i]; + if (curCobraInfo->cobra != NULL) { + if (curCobraInfo->cobra->actor.child != NULL) { + Actor_Kill(curCobraInfo->cobra->actor.child); + curCobraInfo->cobra->actor.child = NULL; + } + Actor_Kill(&curCobraInfo->cobra->actor); + curCobraInfo->cobra = NULL; + } + } + } +} + +void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, GlobalContext* globalCtx) { + BgJyaBigmirror* this = THIS; + + if (Flags_GetSwitch(globalCtx, 0x29)) { + this->puzzleFlags |= BIGMIR_PUZZLE_BOMBIWA_DESTROYED; + } else { + this->puzzleFlags &= ~(BIGMIR_PUZZLE_BOMBIWA_DESTROYED); + } +} + +void BgJyaBigmirror_HandleMirRay(Actor* thisx, GlobalContext* globalCtx) { + static s16 sMirRayParamss[] = { 0x0005, 0x0007, 0x0008 }; + static Vec3f sMirRayPoss[] = { + { 60.0f, 1802.0f, -1102.0f }, + { -560.0f, 1800.0f, -310.0f }, + { 60.0f, 1800.0f, -310.0f }, + }; + BgJyaBigmirror* this = THIS; + s32 puzzleSolved; + s32 lightBeamToggles[3]; + s32 i; + s32 objBankIndex; + + objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MIR_RAY); + + if ((objBankIndex < 0) || (objBankIndex != this->mirRayObjIndex)) { + this->lightBeams[2] = NULL; + this->lightBeams[1] = NULL; + this->lightBeams[0] = NULL; + } else { + puzzleSolved = !!(this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM)); + + if (puzzleSolved) { + puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED); + + if (puzzleSolved) { + puzzleSolved = !!(this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED); + } + } + lightBeamToggles[0] = puzzleSolved; // Only spawn if puzzle solved + if (1) {} + lightBeamToggles[1] = lightBeamToggles[2] = + this->puzzleFlags & (BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM); + + for (i = 0; i < 3; i++) { + if (lightBeamToggles[i]) { + if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&globalCtx->objectCtx, objBankIndex)) { + this->lightBeams[i] = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_MIR_RAY, sMirRayPoss[i].x, + sMirRayPoss[i].y, sMirRayPoss[i].z, 0, 0, 0, sMirRayParamss[i]); + + if (this->lightBeams[i] == NULL) { + // Mir Ray generation failed + osSyncPrintf("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 310); + } + } + } else { + if (this->lightBeams[i] != NULL) { + Actor_Kill(this->lightBeams[i]); + this->lightBeams[i] = NULL; + } + } + } + } + this->mirRayObjIndex = objBankIndex; +} + +void BgJyaBigmirror_Init(Actor* thisx, GlobalContext* globalCtx) { + BgJyaBigmirror* this = THIS; + + if (sIsSpawned) { + Actor_Kill(&this->actor); + return; + } + + Actor_SetScale(&this->actor, 0.1f); + this->cobraInfo[0].rotY = sCobraSpawnData[0].initRotY; + this->cobraInfo[1].rotY = sCobraSpawnData[1].initRotY; + this->actor.room = -1; + sIsSpawned = true; + this->spawned = true; + this->mirRayObjIndex = -1; + + // jya Bigmirror + osSyncPrintf("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params, this); +} + +void BgJyaBigmirror_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgJyaBigmirror* this = THIS; + + if (this->spawned) { + sIsSpawned = false; + } +} + +void BgJyaBigmirror_Update(Actor* thisx, GlobalContext* globalCtx) { + BgJyaBigmirror_SetRoomFlag(thisx, globalCtx); + BgJyaBigmirror_HandleCobra(thisx, globalCtx); + BgJyaBigmirror_SetBombiwaFlag(thisx, globalCtx); + BgJyaBigmirror_HandleMirRay(thisx, globalCtx); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/func_8089394C.s") +void BgJyaBigmirror_DrawLightBeam(Actor* thisx, GlobalContext* globalCtx) { + static Vec3s D_80893F4C = { 0, 0, 0 }; + BgJyaBigmirror* this = THIS; + Actor* lift; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/func_8089399C.s") + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 435); + func_80093D84(globalCtx->state.gfxCtx); + lift = Actor_Find(&globalCtx->actorCtx, ACTOR_BG_JYA_LIFT, ACTORTYPE_BG); + if (lift != NULL) { + this->liftHeight = lift->posRot.pos.y; + } + func_800D1694(this->actor.posRot.pos.x, this->actor.posRot.pos.y + 40.0f, this->actor.posRot.pos.z, + &this->actor.shape.rot); + // Second float seems to be either this or 1613/1280 + 0.13: both numerators relate to the lift height + Matrix_Scale(0.1f, (this->liftHeight * -(1.0f / 1280.0f)) + (973.0f / 1280.0f + 0.63f) /* 1.3901563f */, 0.1f, + MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 457), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_0600BC70); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/BgJyaBigmirror_Init.s") + if (lift != NULL) { + if (1) {} + func_800D1694(lift->posRot.pos.x, lift->posRot.pos.y, lift->posRot.pos.z, &D_80893F4C); + Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 467), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(POLY_XLU_DISP++, D_0600BD80); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/BgJyaBigmirror_Destroy.s") + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_bigmirror.c", 476); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/BgJyaBigmirror_Update.s") +void BgJyaBigmirror_Draw(Actor* thisx, GlobalContext* globalCtx) { + BgJyaBigmirror* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/func_80893C68.s") + if (this->puzzleFlags & BIGMIR_PUZZLE_IN_1ST_TOP_ROOM) { + Gfx_DrawDListOpa(globalCtx, D_0600E1B0); + Gfx_DrawDListXlu(globalCtx, D_0600E2D0); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Jya_Bigmirror/BgJyaBigmirror_Draw.s") + if ((this->puzzleFlags & + (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM)) && + (this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED) && (this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED)) { + BgJyaBigmirror_DrawLightBeam(&this->actor, globalCtx); + } +} diff --git a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h index 60c5ef556..be19136b7 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h @@ -3,12 +3,23 @@ #include "ultra64.h" #include "global.h" +#include "overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h" struct BgJyaBigmirror; +typedef struct { + /* 0x00 */ BgJyaCobra* cobra; + /* 0x04 */ s16 rotY; +} BigmirrorCobra; // size = 0x08 + typedef struct BgJyaBigmirror { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x28]; + /* 0x014C */ BigmirrorCobra cobraInfo[2]; + /* 0x015C */ u8 puzzleFlags; + /* 0x015D */ u8 spawned; + /* 0x0160 */ Actor* lightBeams[3]; + /* 0x016C */ s32 mirRayObjIndex; + /* 0x0170 */ f32 liftHeight; } BgJyaBigmirror; // size = 0x0174 extern const ActorInit Bg_Jya_Bigmirror_InitVars; diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 3f422b3d4..08789dbad 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -22,7 +22,7 @@ void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx); void BgJyaLift_SetupMove(BgJyaLift* this); void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx); -static s16 D_8089A020 = 0; +static s16 sIsSpawned = false; const ActorInit Bg_Jya_Lift_InitVars = { ACTOR_BG_JYA_LIFT, @@ -52,14 +52,14 @@ void BgJyaLift_InitDynapoly(BgJyaLift* this, GlobalContext* globalCtx, u32 arg2, DynaPolyInfo_SetActorMove(&this->dyna, moveFlag); DynaPolyInfo_Alloc(arg2, &localConst); - this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna, localConst); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localConst); } void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { BgJyaLift* this = THIS; this->unk_16A = 0; - if (D_8089A020) { + if (sIsSpawned) { Actor_Kill(thisx); return; } @@ -69,12 +69,12 @@ void BgJyaLift_Init(Actor* thisx, GlobalContext* globalCtx) { BgJyaLift_InitDynapoly(this, globalCtx, &D_0600D7E8, 0); Actor_ProcessInitChain(thisx, sInitChain); if (Flags_GetSwitch(globalCtx, (thisx->params & 0x3F))) { - BgJyaLift_SetFinalPosY(thisx); + BgJyaLift_SetFinalPosY(this); } else { - BgJyaLift_SetInitPosY(thisx); + BgJyaLift_SetInitPosY(this); } thisx->room = -1; - D_8089A020 = 1; + sIsSpawned = true; this->unk_16A = 1; } @@ -85,7 +85,7 @@ void BgJyaLift_Destroy(Actor* thisx, GlobalContext* globalCtx) { // Goddess Lift DT osSyncPrintf("女神リフト DT\n"); - D_8089A020 = 0; + sIsSpawned = false; DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } } @@ -138,7 +138,7 @@ void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx) { GlobalContext* globalCtx2 = globalCtx; if (this->actionFunc != NULL) { - this->actionFunc(this); + this->actionFunc(this, globalCtx); } if ((this->dyna.unk_160 & 4) && ((this->unk_16B & 4) == 0)) { Camera_ChangeSetting(globalCtx2->cameraPtrs[0], CAM_SET_TEPPEN); diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h index 6fc9b52aa..78dfc0375 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.h @@ -5,7 +5,7 @@ #include "global.h" struct BgJyaLift; -typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*); +typedef void (*BgJyaLiftActionFunc)(struct BgJyaLift*, GlobalContext*); typedef struct BgJyaLift { /* 0x000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index 5cc513f85..577189459 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -18,7 +18,7 @@ void func_808A2008(BgMoriElevator* this, GlobalContext* globalCtx); void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCtx); void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx); -static s16 sIsSpawned = 0; +static s16 sIsSpawned = false; const ActorInit Bg_Mori_Elevator_InitVars = { ACTOR_BG_MORI_ELEVATOR, @@ -99,10 +99,10 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277); } else { switch (sIsSpawned) { - case 0: + case false: // Forest Temple elevator CT osSyncPrintf("森の神殿 elevator CT\n"); - sIsSpawned = 1; + sIsSpawned = true; this->dyna.actor.room = -1; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyInfo_SetActorMove(&this->dyna, DPM_PLAYER); @@ -111,7 +111,7 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) { DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localConst); BgMoriElevator_SetupWaitAfterInit(this); break; - case 1: + case true: Actor_Kill(thisx); break; } @@ -125,7 +125,7 @@ void BgMoriElevator_Destroy(Actor* thisx, GlobalContext* globalCtx) { // Forest Temple elevator DT osSyncPrintf("森の神殿 elevator DT\n"); DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); - sIsSpawned = 0; + sIsSpawned = false; } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h index 3b79053c0..d55593cce 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.h @@ -6,7 +6,7 @@ struct BgMoriElevator; -typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, struct GlobalCtx*); +typedef void (*BgMoriElevatorActionFunc)(struct BgMoriElevator*, GlobalContext*); typedef struct BgMoriElevator { /* 0x0000 */ DynaPolyActor dyna; diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index 25b29caa9..510f2e8fd 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c @@ -22,7 +22,7 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx); extern Gfx D_060049D0[]; -static s16 sAlreadyLoaded = false; +static s16 sIsSpawned = false; const ActorInit Bg_Mori_Idomizu_InitVars = { ACTOR_BG_MORI_IDOMIZU, @@ -52,7 +52,7 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; BgMoriIdomizu* this = THIS; - if (sAlreadyLoaded) { + if (sIsSpawned) { Actor_Kill(&this->actor); return; } @@ -78,7 +78,7 @@ void BgMoriIdomizu_Init(Actor* thisx, GlobalContext* globalCtx) { return; } BgMoriIdomizu_SetupWaitForMoriTex(this); - sAlreadyLoaded = true; + sIsSpawned = true; this->isLoaded = true; this->actor.room = -1; // Forest Temple well water @@ -90,7 +90,7 @@ void BgMoriIdomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) { BgMoriIdomizu* this = THIS; if (this->isLoaded) { - sAlreadyLoaded = false; + sIsSpawned = false; } } -- cgit v1.2.3