From 7551dc2b71f7c6587f96c498cbd62cfd05aa292c Mon Sep 17 00:00:00 2001 From: Zelllll <56516451+Zelllll@users.noreply.github.com> Date: Sun, 15 Aug 2021 18:15:58 -0500 Subject: Global Context And General Cleanup (#863) * door context * renames * done * fix unintended change * all nb gone * more nb gone * merge fishing * fix size commentX * door changes suggested by dragorn * fix accidental semicolon * another * change all texture pointers to void* * error fix and format * Update src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c Co-authored-by: Anghelo Carvajal * fix ostime * correct mistake in SkyboxContext * probably fix nonmatching * Update include/z64.h Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * roman's suggestions, fix incorrect type definition in z64scene.h * typo in struct * make typedef use u8 array * forgot one * pull in master and format.sh Co-authored-by: Anghelo Carvajal Co-authored-by: Dragorn421 Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> --- src/code/audio_load.c | 4 +-- src/code/game.c | 4 +-- src/code/z_actor.c | 46 ++++++++++++------------- src/code/z_actor_dlftbls.c | 2 +- src/code/z_bgcheck.c | 54 ++++++++++++++--------------- src/code/z_demo.c | 16 ++++----- src/code/z_kanfont.c | 8 ++--- src/code/z_lifemeter.c | 6 ++-- src/code/z_play.c | 8 ++--- src/code/z_room.c | 12 +++---- src/code/z_scene.c | 14 ++++---- src/code/z_scene_table.c | 84 +++++++++++++++++++++++----------------------- 12 files changed, 129 insertions(+), 129 deletions(-) (limited to 'src/code') diff --git a/src/code/audio_load.c b/src/code/audio_load.c index a5e2b83a7..15a55b0bc 100644 --- a/src/code/audio_load.c +++ b/src/code/audio_load.c @@ -82,8 +82,8 @@ void func_800E1618(s32 arg0) { gAudioContext.unk_288C = gAudioContext.unk_2874; gAudioContext.sampleDmaReqs = - Audio_Alloc(&gAudioContext.notesAndBuffersPool, - 4 * gAudioContext.maxSimultaneousNotes * sizeof(SampleDmaReq) * gAudioContext.audioBufferParameters.presetUnk4); + Audio_Alloc(&gAudioContext.notesAndBuffersPool, 4 * gAudioContext.maxSimultaneousNotes * sizeof(SampleDmaReq) * + gAudioContext.audioBufferParameters.presetUnk4); t2 = 3 * gAudioContext.maxSimultaneousNotes * gAudioContext.audioBufferParameters.presetUnk4; for (i = 0; i < t2; i++) { temp_s0 = &gAudioContext.sampleDmaReqs[gAudioContext.sampleDmaReqCnt]; diff --git a/src/code/game.c b/src/code/game.c index 3f4f063f7..0fbf1a155 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -377,8 +377,8 @@ void GameState_Realloc(GameState* gameState, size_t size) { } void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx) { - u64 startTime; - u64 endTime; + OSTime startTime; + OSTime endTime; // game constructor start osSyncPrintf("game コンストラクタ開始\n"); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 6f275987c..4a8c2b33f 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -680,7 +680,7 @@ void TitleCard_InitBossName(GlobalContext* globalCtx, TitleCardContext* titleCtx void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCtx, void* texture, s32 x, s32 y, s32 width, s32 height, s32 delay) { - Scene* loadedScene = globalCtx->loadedScene; + SceneTableEntry* loadedScene = globalCtx->loadedScene; u32 size = loadedScene->titleFile.vromEnd - loadedScene->titleFile.vromStart; if ((size != 0) && (size <= 0x3000)) { @@ -1757,7 +1757,7 @@ void func_8002F994(Actor* actor, s32 arg1) { // Tests if something hit Jabu Jabu surface, displaying hit splash and playing sfx if true s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos) { if (func_80041D4C(&globalCtx->colCtx, poly, bgId) == 8) { - globalCtx->unk_11D30[0] = 1; + globalCtx->roomCtx.unk_74[0] = 1; CollisionCheck_BlueBlood(globalCtx, NULL, pos); Audio_PlayActorSound2(actor, NA_SE_IT_WALL_HIT_BUYO); return true; @@ -1993,7 +1993,7 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* overlayEntry = &gActorOverlayTable[0]; for (i = 0; i < ARRAY_COUNT(gActorOverlayTable); i++) { overlayEntry->loadedRamAddr = NULL; - overlayEntry->nbLoaded = 0; + overlayEntry->numLoaded = 0; overlayEntry++; } @@ -2037,12 +2037,12 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { sp74 = NULL; unkFlag = 0; - if (globalCtx->nbSetupActors != 0) { + if (globalCtx->numSetupActors != 0) { actorEntry = &globalCtx->setupActorList[0]; - for (i = 0; i < globalCtx->nbSetupActors; i++) { + for (i = 0; i < globalCtx->numSetupActors; i++) { Actor_SpawnEntry(&globalCtx->actorCtx, actorEntry++, globalCtx); } - globalCtx->nbSetupActors = 0; + globalCtx->numSetupActors = 0; } if (actorCtx->unk_02 != 0) { @@ -2275,7 +2275,7 @@ void func_80030FA8(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_actor.c", 6183); } -void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invisibleActors) { +void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) { Actor** invisibleActor; GraphicsContext* gfxCtx; s32 i; @@ -2313,17 +2313,17 @@ void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invi func_80030FA8(gfxCtx); // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY START" - gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 START", nbInvisibleActors); + gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 START", numInvisibleActors); invisibleActor = &invisibleActors[0]; - for (i = 0; i < nbInvisibleActors; i++) { + for (i = 0; i < numInvisibleActors; i++) { // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示", i); Actor_Draw(globalCtx, *(invisibleActor++)); } // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY END" - gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", nbInvisibleActors); + gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", numInvisibleActors); if (globalCtx->roomCtx.curRoom.showInvisActors != 0) { // Translates to: "BLUE SPECTACLES (EXTERIOR)" @@ -2615,7 +2615,7 @@ Actor* Actor_RemoveFromCategory(GlobalContext* globalCtx, ActorContext* actorCtx void Actor_FreeOverlay(ActorOverlay* actorOverlay) { osSyncPrintf(VT_FGCOL(CYAN)); - if (actorOverlay->nbLoaded == 0) { + if (actorOverlay->numLoaded == 0) { if (HREG(20) != 0) { // Translates to: "ACTOR CLIENT IS NOW 0" osSyncPrintf("アクタークライアントが0になりました\n"); @@ -2644,7 +2644,7 @@ void Actor_FreeOverlay(ActorOverlay* actorOverlay) { } } else if (HREG(20) != 0) { // Translates to: "%d OF ACTOR CLIENT REMAINS" - osSyncPrintf("アクタークライアントはあと %d 残っています\n", actorOverlay->nbLoaded); + osSyncPrintf("アクタークライアントはあと %d 残っています\n", actorOverlay->numLoaded); } osSyncPrintf(VT_RST); @@ -2727,7 +2727,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId (u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr, name); osSyncPrintf(VT_RST); - overlayEntry->nbLoaded = 0; + overlayEntry->numLoaded = 0; } actorInit = (void*)(u32)((overlayEntry->initInfo != NULL) @@ -2757,13 +2757,13 @@ Actor* Actor_Spawn(ActorContext* actorCtx, GlobalContext* globalCtx, s16 actorId return NULL; } - ASSERT(overlayEntry->nbLoaded < 255, "actor_dlftbl->clients < 255", "../z_actor.c", 7031); + ASSERT(overlayEntry->numLoaded < 255, "actor_dlftbl->clients < 255", "../z_actor.c", 7031); - overlayEntry->nbLoaded++; + overlayEntry->numLoaded++; if (HREG(20) != 0) { // Translates to: "ACTOR CLIENT No. %d" - osSyncPrintf("アクタークライアントは %d 個目です\n", overlayEntry->nbLoaded); + osSyncPrintf("アクタークライアントは %d 個目です\n", overlayEntry->numLoaded); } Lib_MemSet((u8*)actor, actorInit->instanceSize, 0); @@ -2819,13 +2819,13 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, GlobalContext* void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCtx) { TransitionActorEntry* transitionActor; - u8 nbTransitionActors; + u8 numActors; s32 i; - transitionActor = globalCtx->transitionActorList; - nbTransitionActors = globalCtx->nbTransitionActors; + transitionActor = globalCtx->transiActorCtx.list; + numActors = globalCtx->transiActorCtx.numActors; - for (i = 0; i < nbTransitionActors; i++) { + for (i = 0; i < numActors; i++) { if (transitionActor->id >= 0) { if (((transitionActor->sides[0].room >= 0) && ((transitionActor->sides[0].room == globalCtx->roomCtx.curRoom.num) || @@ -2838,7 +2838,7 @@ void Actor_SpawnTransitionActors(GlobalContext* globalCtx, ActorContext* actorCt (i << 0xA) + transitionActor->params); transitionActor->id = -transitionActor->id; - nbTransitionActors = globalCtx->nbTransitionActors; + numActors = globalCtx->transiActorCtx.numActors; } } transitionActor++; @@ -2897,8 +2897,8 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC } } else { ASSERT(overlayEntry->loadedRamAddr != NULL, "actor_dlftbl->allocp != NULL", "../z_actor.c", 7251); - ASSERT(overlayEntry->nbLoaded > 0, "actor_dlftbl->clients > 0", "../z_actor.c", 7252); - overlayEntry->nbLoaded--; + ASSERT(overlayEntry->numLoaded > 0, "actor_dlftbl->clients > 0", "../z_actor.c", 7252); + overlayEntry->numLoaded--; Actor_FreeOverlay(overlayEntry); } diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index eccf2e948..7d26cb86a 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -519,7 +519,7 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) { overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart; if (overlayEntry->loadedRamAddr != NULL) { FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr, - (u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->nbLoaded, + (u32)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded, overlayEntry->name != NULL ? overlayEntry->name : ""); } } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index ae2c41ef2..32c951d12 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1377,7 +1377,7 @@ u32 BgCheck_InitializeStaticLookup(CollisionContext* colCtx, GlobalContext* glob spA4->ceiling.head = SS_NULL; } - polyMax = colHeader->nbPolygons; + polyMax = colHeader->numPolygons; vtxList = colHeader->vtxList; polyList = colHeader->polyList; sp98 = colCtx->subdivAmount.x * colCtx->subdivAmount.y; @@ -1581,7 +1581,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis BgCheck_SetSubdivisionDimension(colCtx->minBounds.z, colCtx->subdivAmount.z, &colCtx->maxBounds.z, &colCtx->subdivLength.z, &colCtx->subdivLengthInv.z); memSize = colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z + - colCtx->colHeader->nbPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) + + colCtx->colHeader->numPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) + colCtx->dyna.polyListMax * sizeof(CollisionPoly) + colCtx->dyna.vtxListMax * sizeof(Vec3s) + sizeof(CollisionContext); if (customNodeListMax > 0) { @@ -1596,7 +1596,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis } SSNodeList_Initialize(&colCtx->polyNodes); - SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->nbPolygons); + SSNodeList_Alloc(globalCtx, &colCtx->polyNodes, tblMax, colCtx->colHeader->numPolygons); lookupTblMemSize = BgCheck_InitializeStaticLookup(colCtx, globalCtx, colCtx->lookupTbl); osSyncPrintf(VT_FGCOL(GREEN)); @@ -2151,7 +2151,7 @@ s32 BgCheck_CheckLineImpl(CollisionContext* colCtx, u16 xpFlags1, u16 xpFlags2, } } - BgCheck_ResetPolyCheckTbl(&colCtx->polyNodes, colCtx->colHeader->nbPolygons); + BgCheck_ResetPolyCheckTbl(&colCtx->polyNodes, colCtx->colHeader->numPolygons); BgCheck_GetStaticLookupIndicesFromPos(colCtx, posA, (Vec3i*)&subdivMin); BgCheck_GetStaticLookupIndicesFromPos(colCtx, &posBTemp, (Vec3i*)&subdivMax); *posResult = *posB; @@ -2766,29 +2766,29 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 return; } - if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->nbPolygons)) { + if (!(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons)) { osSyncPrintf(VT_FGCOL(RED)); - // do not use if %d[*polyStartIndex + pbgdata->nbPolygons] exceeds %d[dyna->polyListMax] + // do not use if %d[*polyStartIndex + pbgdata->numPolygons] exceeds %d[dyna->polyListMax] osSyncPrintf("DynaPolyInfo_expandSRT():polygon over %dが%dを越えるとダメ\n", - *polyStartIndex + pbgdata->nbPolygons, dyna->polyListMax); + *polyStartIndex + pbgdata->numPolygons, dyna->polyListMax); } - if (!(dyna->vtxListMax >= *vtxStartIndex + pbgdata->nbVertices)) { + if (!(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices)) { osSyncPrintf(VT_FGCOL(RED)); - // do not use if %d[*vtxStartIndex + pbgdata->nbVertices] exceeds %d[dyna->vtxListMax] + // do not use if %d[*vtxStartIndex + pbgdata->numVertices] exceeds %d[dyna->vtxListMax] osSyncPrintf("DynaPolyInfo_expandSRT():vertex over %dが%dを越えるとダメ\n", - *vtxStartIndex + pbgdata->nbVertices, dyna->vtxListMax); + *vtxStartIndex + pbgdata->numVertices, dyna->vtxListMax); } - ASSERT(dyna->polyListMax >= *polyStartIndex + pbgdata->nbPolygons, + ASSERT(dyna->polyListMax >= *polyStartIndex + pbgdata->numPolygons, "pdyna_poly_info->poly_num >= *pstart_poly_index + pbgdata->poly_num", "../z_bgcheck.c", 6687); - ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->nbVertices, + ASSERT(dyna->vtxListMax >= *vtxStartIndex + pbgdata->numVertices, "pdyna_poly_info->vert_num >= *pstart_vert_index + pbgdata->vtx_num", "../z_bgcheck.c", 6688); if (!(dyna->bitFlag & DYNAPOLY_INVALIDATE_LOOKUP) && (BgActor_IsTransformUnchanged(&dyna->bgActors[bgId]) == true)) { s32 pi; - for (pi = *polyStartIndex; pi < *polyStartIndex + pbgdata->nbPolygons; pi++) { + for (pi = *polyStartIndex; pi < *polyStartIndex + pbgdata->numPolygons; pi++) { CollisionPoly* poly = &dyna->polyList[pi]; s16 normalY = poly->normal.y; @@ -2807,8 +2807,8 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 } } - *polyStartIndex += pbgdata->nbPolygons; - *vtxStartIndex += pbgdata->nbVertices; + *polyStartIndex += pbgdata->numPolygons; + *vtxStartIndex += pbgdata->numVertices; } else { SkinMatrix_SetScaleRotateYRPTranslate( &mtx, dyna->bgActors[bgId].curTransform.scale.x, dyna->bgActors[bgId].curTransform.scale.y, @@ -2817,9 +2817,9 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 dyna->bgActors[bgId].curTransform.pos.x, dyna->bgActors[bgId].curTransform.pos.y, dyna->bgActors[bgId].curTransform.pos.z); - numVtxInverse = 1.0f / pbgdata->nbVertices; + numVtxInverse = 1.0f / pbgdata->numVertices; newCenterPoint.x = newCenterPoint.y = newCenterPoint.z = 0.0f; - for (i = 0; i < pbgdata->nbVertices; i++) { + for (i = 0; i < pbgdata->numVertices; i++) { Vec3f vtx; Vec3f vtxT; // Vtx after mtx transform Math_Vec3s_ToVec3f(&vtx, &pbgdata->vtxList[i]); @@ -2846,7 +2846,7 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 sphere->center.z = newCenterPoint.z; newRadiusSq = -100.0f; - for (i = 0; i < pbgdata->nbVertices; i++) { + for (i = 0; i < pbgdata->numVertices; i++) { f32 radiusSq; newVtx.x = dyna->vtxList[*vtxStartIndex + i].x; newVtx.y = dyna->vtxList[*vtxStartIndex + i].y; @@ -2859,7 +2859,7 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 sphere->radius = sqrtf(newRadiusSq) * 1.1f; - for (i = 0; i < pbgdata->nbPolygons; i++) { + for (i = 0; i < pbgdata->numPolygons; i++) { CollisionPoly* newPoly = &dyna->polyList[*polyStartIndex + i]; f32 newNormMagnitude; *newPoly = pbgdata->polyList[i]; @@ -2905,8 +2905,8 @@ void DynaPoly_ExpandSRT(GlobalContext* globalCtx, DynaCollisionContext* dyna, s3 } } - *polyStartIndex += pbgdata->nbPolygons; - *vtxStartIndex += pbgdata->nbVertices; + *polyStartIndex += pbgdata->numPolygons; + *vtxStartIndex += pbgdata->numVertices; } } @@ -4187,11 +4187,11 @@ s32 WaterBox_GetSurfaceImpl(GlobalContext* globalCtx, CollisionContext* colCtx, u32 room; WaterBox* curWaterBox; - if (colHeader->nbWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) { + if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) { return false; } - for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->nbWaterBoxes; + for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = (curWaterBox->properties >> 13) & 0x3F; if (room == (u32)globalCtx->roomCtx.curRoom.num || room == 0x3F) { @@ -4223,12 +4223,12 @@ s32 WaterBox_GetSurface2(GlobalContext* globalCtx, CollisionContext* colCtx, Vec WaterBox* waterBox; WaterBox* waterBoxList = colHeader->waterBoxes; // unused, needed for matching - if (colHeader->nbWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) { + if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) { *outWaterBox = NULL; return -1; } - for (i = 0; i < colHeader->nbWaterBoxes; i++) { + for (i = 0; i < colHeader->numWaterBoxes; i++) { waterBox = &colHeader->waterBoxes[i]; room = WATERBOX_ROOM(waterBox->properties); @@ -4297,11 +4297,11 @@ s32 func_800425B0(GlobalContext* globalCtx, CollisionContext* colCtx, f32 x, f32 u32 room; WaterBox* curWaterBox; - if (colHeader->nbWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) { + if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == PHYSICAL_TO_VIRTUAL(gSegments[0])) { return false; } - for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->nbWaterBoxes; + for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; curWaterBox++) { room = (curWaterBox->properties >> 0xD) & 0x3F; if ((room == (u32)globalCtx->roomCtx.curRoom.num) || (room == 0x3F)) { diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 71bc52ea5..a8d5b318b 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -219,8 +219,8 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } break; case 8: - if (globalCtx->unk_11D30[0] < 0x80) { - globalCtx->unk_11D30[0] += 4; + if (globalCtx->roomCtx.unk_74[0] < 0x80) { + globalCtx->roomCtx.unk_74[0] += 4; } break; case 9: @@ -230,13 +230,13 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* Flags_SetEnv(globalCtx, 1); break; case 11: - if (globalCtx->unk_11D30[0] < 0x672) { - globalCtx->unk_11D30[0] += 0x14; + if (globalCtx->roomCtx.unk_74[0] < 0x672) { + globalCtx->roomCtx.unk_74[0] += 0x14; } if (csCtx->frames == 0x30F) { func_80078884(NA_SE_EV_DEKU_DEATH); } else if (csCtx->frames == 0x2CD) { - globalCtx->unk_11D30[0] = 0; + globalCtx->roomCtx.unk_74[0] = 0; } break; case 12: @@ -247,11 +247,11 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* } break; case 13: - if (globalCtx->unk_11D30[1] == 0) { + if (globalCtx->roomCtx.unk_74[1] == 0) { func_80078884(NA_SE_EV_TRIFORCE_FLASH); } - if (globalCtx->unk_11D30[1] < 0xFF) { - globalCtx->unk_11D30[1] += 5; + if (globalCtx->roomCtx.unk_74[1] < 0xFF) { + globalCtx->roomCtx.unk_74[1] += 5; } break; case 14: diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index c38eb11aa..1bfc0dcf8 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -8,13 +8,13 @@ extern const char D_07000000[]; // start of file extern const char D_070380D4[]; // charset message (id 0xFFFC) extern const char D_0703811C[]; // end marker of last message +// stubbed in PAL void func_8006EE50(Font* font, s16 arg1, s16 arg2) { } -void Font_LoadChar(u32 offset, u8 character, u16 codePointIndex) { - DmaMgr_SendRequest1(((u32)offset + codePointIndex) + 8, - &_nes_font_staticSegmentRomStart[character * FONT_CHAR_TEX_SIZE], FONT_CHAR_TEX_SIZE, - "../z_kanfont.c", 93); +void Font_LoadChar(Font* font, u8 character, u16 codePointIndex) { + DmaMgr_SendRequest1(&font->unk_8[codePointIndex], &_nes_font_staticSegmentRomStart[character * FONT_CHAR_TEX_SIZE], + FONT_CHAR_TEX_SIZE, "../z_kanfont.c", 93); } void Font_LoadMessageBoxEndIcon(Font* font, u16 icon) { diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 68bda8d01..68137f836 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -276,14 +276,14 @@ s32 func_80078E84(GlobalContext* globalCtx) { return 0; } -u64* sHeartTextures[] = { +static void* sHeartTextures[] = { gHeartFullTex, gHeartQuarterTex, gHeartQuarterTex, gHeartQuarterTex, gHeartQuarterTex, gHeartQuarterTex, gHeartHalfTex, gHeartHalfTex, gHeartHalfTex, gHeartHalfTex, gHeartHalfTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, gHeartThreeQuarterTex, }; -u64* sHeartDDTextures[] = { +static void* sHeartDDTextures[] = { gDefenseHeartFullTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartQuarterTex, gDefenseHeartHalfTex, gDefenseHeartHalfTex, gDefenseHeartHalfTex, @@ -294,7 +294,7 @@ u64* sHeartDDTextures[] = { void HealthMeter_Draw(GlobalContext* globalCtx) { s32 pad[5]; - UNK_PTR heartBgImg; + void* heartBgImg; u32 curColorSet; f32 offsetX; f32 offsetY; diff --git a/src/code/z_play.c b/src/code/z_play.c index c6ca9b615..116c3becf 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1447,10 +1447,10 @@ void Gameplay_InitScene(GlobalContext* globalCtx, s32 spawn) { globalCtx->setupExitList = NULL; globalCtx->cUpElfMsgs = NULL; globalCtx->setupPathList = NULL; - globalCtx->nbSetupActors = 0; + globalCtx->numSetupActors = 0; Object_InitBank(globalCtx, &globalCtx->objectCtx); LightContext_Init(globalCtx, &globalCtx->lightCtx); - func_80098CBC(globalCtx, &globalCtx->nbTransitionActors); + TransitionActor_InitContext(&globalCtx->state, &globalCtx->transiActorCtx); func_80096FD4(globalCtx, &globalCtx->roomCtx.curRoom); YREG(15) = 0; gSaveContext.worldMapArea = 0; @@ -1459,7 +1459,7 @@ void Gameplay_InitScene(GlobalContext* globalCtx, s32 spawn) { } void Gameplay_SpawnScene(GlobalContext* globalCtx, s32 sceneNum, s32 spawn) { - Scene* scene = &gSceneTable[sceneNum]; + SceneTableEntry* scene = &gSceneTable[sceneNum]; scene->unk_13 = 0; globalCtx->loadedScene = scene; @@ -1787,7 +1787,7 @@ s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) { return 0; } - transitionActor = &globalCtx->transitionActorList[(u16)actor->params >> 10]; + transitionActor = &globalCtx->transiActorCtx.list[(u16)actor->params >> 10]; frontRoom = transitionActor->sides[0].room; if (frontRoom == transitionActor->sides[1].room) { diff --git a/src/code/z_room.c b/src/code/z_room.c index a0e454ce5..edc03a0eb 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -498,7 +498,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { u32 roomSize; s32 i; - for (i = 0; i < globalCtx->nbRooms; i++) { + for (i = 0; i < globalCtx->numRooms; i++) { roomSize = roomList[i].vromEnd - roomList[i].vromStart; osSyncPrintf("ROOM%d size=%d\n", i, roomSize); if (maxRoomSize < roomSize) { @@ -506,14 +506,14 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { } } - if (globalCtx->nbTransitionActors != 0) { + if (globalCtx->transiActorCtx.numActors != 0) { s32 j; RomFile* roomList = globalCtx->roomList; - TransitionActorEntry* transitionActor = &globalCtx->transitionActorList[0]; + TransitionActorEntry* transitionActor = &globalCtx->transiActorCtx.list[0]; - LOG_NUM("game_play->room_rom_address.num", globalCtx->nbRooms, "../z_room.c", 912); + LOG_NUM("game_play->room_rom_address.num", globalCtx->numRooms, "../z_room.c", 912); - for (j = 0; j < globalCtx->nbTransitionActors; j++) { + for (j = 0; j < globalCtx->transiActorCtx.numActors; j++) { s8 frontRoom = transitionActor->sides[0].room; s8 backRoom = transitionActor->sides[1].room; u32 frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart; @@ -563,7 +563,7 @@ s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum) { roomCtx->curRoom.segment = NULL; roomCtx->status = 1; - ASSERT(roomNum < globalCtx->nbRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); + ASSERT(roomNum < globalCtx->numRooms, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart; roomCtx->unk_34 = (void*)ALIGN16((s32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 64135c47b..7cd3d8c39 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -198,7 +198,7 @@ void func_80098508(GlobalContext* globalCtx, SceneCmd* cmd) { // Scene Command 0x01: Actor List void func_800985DC(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->nbSetupActors = cmd->actorList.num; + globalCtx->numSetupActors = cmd->actorList.num; globalCtx->setupActorList = SEGMENTED_TO_VIRTUAL(cmd->actorList.segment); } @@ -222,7 +222,7 @@ void func_80098674(GlobalContext* globalCtx, SceneCmd* cmd) { // Scene Command 0x04: Room List void func_800987A4(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->nbRooms = cmd->roomList.num; + globalCtx->numRooms = cmd->roomList.num; globalCtx->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.segment); } @@ -327,17 +327,17 @@ void func_80098C24(GlobalContext* globalCtx, SceneCmd* cmd) { // Scene Command 0x0E: Transition Actor List void func_80098C68(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->nbTransitionActors = cmd->transiActorList.num; - globalCtx->transitionActorList = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); + globalCtx->transiActorCtx.numActors = cmd->transiActorList.num; + globalCtx->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.segment); } -void func_80098CBC(GlobalContext* globalCtx, u8* nbTransitionActors) { - *nbTransitionActors = 0; +void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx) { + transiActorCtx->numActors = 0; } // Scene Command 0x0F: Light Setting List void func_80098CC8(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.nbLightSettings = cmd->lightSettingList.num; + globalCtx->envCtx.numLightSettings = cmd->lightSettingList.num; globalCtx->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.segment); } diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index ea81553ea..09d502f37 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -796,7 +796,7 @@ EntranceInfo gEntranceTable[] = { #define UNTITLED_SCENE(name, unk_10, config, unk_12) \ { (u32) _##name##SegmentRomStart, (u32)_##name##SegmentRomEnd, 0, 0, unk_10, config, unk_12, 0 } -Scene gSceneTable[] = { +SceneTableEntry gSceneTable[] = { TITLED_SCENE(ydan_scene, g_pn_06, 1, 19, 2), TITLED_SCENE(ddan_scene, g_pn_08, 1, 20, 3), TITLED_SCENE(bdan_scene, g_pn_07, 1, 21, 4), @@ -1023,11 +1023,11 @@ void func_80099878(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->unk_11D30[0]); + gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->unk_11D30[1]); + gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->roomCtx.unk_74[1]); gSPEndDisplayList(displayListHead); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4956); @@ -1040,7 +1040,7 @@ void func_80099BD8(GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5069); - temp = globalCtx->unk_11D30[0] / 255.0f; + temp = globalCtx->roomCtx.unk_74[0] / 255.0f; gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead); gSPSegment(POLY_OPA_DISP++, 0x08, displayListHead); @@ -1057,7 +1057,7 @@ void func_80099BD8(GlobalContext* globalCtx) { gSPSegment(POLY_OPA_DISP++, 0x0A, displayListHead); gSPSegment(POLY_XLU_DISP++, 0x0A, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0B, displayListHead); @@ -1065,7 +1065,7 @@ void func_80099BD8(GlobalContext* globalCtx) { gDPSetPrimColor(displayListHead++, 0, 0, 89 + (u8)(166.0f * temp), 89 + (u8)(166.0f * temp), 89 + (u8)(166.0f * temp), 255); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0C, displayListHead); @@ -1073,13 +1073,13 @@ void func_80099BD8(GlobalContext* globalCtx) { gDPSetPrimColor(displayListHead++, 0, 0, 255 + (u8)(179.0f * temp), 255 + (u8)(179.0f * temp), 255 + (u8)(179.0f * temp), 255); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[0]); gSPEndDisplayList(displayListHead++); gSPSegment(POLY_OPA_DISP++, 0x0D, displayListHead); gSPSegment(POLY_XLU_DISP++, 0x0D, displayListHead); gDPPipeSync(displayListHead++); - gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[1]); + gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->roomCtx.unk_74[1]); gSPEndDisplayList(displayListHead); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5145); @@ -1272,8 +1272,8 @@ void func_8009B0FC(GlobalContext* globalCtx) { if (1) {} // Necessary to match - spB0 = (globalCtx->unk_11D30[1] >> 8) & 0xFF; - spAC = globalCtx->unk_11D30[1] & 0xFF; + spB0 = (globalCtx->roomCtx.unk_74[1] >> 8) & 0xFF; + spAC = globalCtx->roomCtx.unk_74[1] & 0xFF; gameplayFrames = globalCtx->gameplayFrames; gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[gSaveContext.nightFlag])); @@ -1345,7 +1345,7 @@ void func_8009B86C(GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32)); gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, globalCtx->unk_11D30[0]); + gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, globalCtx->roomCtx.unk_74[0]); gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 145); @@ -1654,7 +1654,7 @@ void func_8009CF84(GlobalContext* globalCtx) { Gfx_TwoTexScrollPrimColor(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 255, 255, 255, - globalCtx->unk_11D30[0] + 127)); + globalCtx->roomCtx.unk_74[0] + 127)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); @@ -1829,16 +1829,16 @@ void func_8009DA30(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } else { if (gSaveContext.dayTime > 0xC555) { - if (globalCtx->unk_11D30[0] != 255) { - Math_StepToS(&globalCtx->unk_11D30[0], 255, 5); + if (globalCtx->roomCtx.unk_74[0] != 255) { + Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5); } } else if (gSaveContext.dayTime >= 0x4000) { - if (globalCtx->unk_11D30[0] != 0) { - Math_StepToS(&globalCtx->unk_11D30[0], 0, 10); + if (globalCtx->roomCtx.unk_74[0] != 0) { + Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10); } } - gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->unk_11D30[0]); + gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]); gSPDisplayList(displayListHead++, &D_03012B20); gSPEndDisplayList(displayListHead); } @@ -1922,9 +1922,9 @@ void func_8009E0B8(GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 128, 128, 128, 128); if (gSaveContext.sceneSetupIndex == 4) { - spA3 = 255 - (u8)globalCtx->unk_11D30[0]; + spA3 = 255 - (u8)globalCtx->roomCtx.unk_74[0]; } else if (gSaveContext.sceneSetupIndex == 6) { - spA0 = globalCtx->unk_11D30[0] + 500; + spA0 = globalCtx->roomCtx.unk_74[0] + 500; } else if (((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) && (gSaveContext.eventChkInf[0] & 0x80)) { spA0 = 2150; } @@ -1941,8 +1941,8 @@ void func_8009E0B8(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); gSPSegment(POLY_OPA_DISP++, 0x0C, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16, 1, 0, - (s16)(-globalCtx->unk_11D30[0] * 0.02f), 32, 16)); + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16, 1, + 0, (s16)(-globalCtx->roomCtx.unk_74[0] * 0.02f), 32, 16)); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7044); } @@ -1954,16 +1954,16 @@ void func_8009E54C(GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7058); if ((gSaveContext.sceneSetupIndex > 3) || (LINK_IS_ADULT && !(gSaveContext.eventChkInf[6] & 0x200))) { - globalCtx->unk_11D30[0] = 87; + globalCtx->roomCtx.unk_74[0] = 87; } gameplayFrames = globalCtx->gameplayFrames; gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, 32, - 32, 0, 0, 0, globalCtx->unk_11D30[0] + 168)); + 32, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168)); gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0, - 16, 64, 0, 0, 0, globalCtx->unk_11D30[0] + 168)); + 16, 64, 0, 0, 0, globalCtx->roomCtx.unk_74[0] + 168)); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, 128); @@ -2079,12 +2079,12 @@ void func_8009EE44(GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128); - if ((globalCtx->unk_11D30[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { - if (globalCtx->unk_11D30[1] == 50) { + if ((globalCtx->roomCtx.unk_74[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { + if (globalCtx->roomCtx.unk_74[1] == 50) { func_8002F7DC(&PLAYER->actor, NA_SE_EV_CHICKEN_CRY_M); - globalCtx->unk_11D30[0] = 1; + globalCtx->roomCtx.unk_74[0] = 1; } - globalCtx->unk_11D30[1]++; + globalCtx->roomCtx.unk_74[1]++; } CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7309); @@ -2180,16 +2180,16 @@ void func_8009F5D4(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } else { if (gSaveContext.dayTime > 0xC000) { - if (globalCtx->unk_11D30[0] != 255) { - Math_StepToS(&globalCtx->unk_11D30[0], 255, 5); + if (globalCtx->roomCtx.unk_74[0] != 255) { + Math_StepToS(&globalCtx->roomCtx.unk_74[0], 255, 5); } } else if (gSaveContext.dayTime >= 0x4000) { - if (globalCtx->unk_11D30[0] != 0) { - Math_StepToS(&globalCtx->unk_11D30[0], 0, 10); + if (globalCtx->roomCtx.unk_74[0] != 0) { + Math_StepToS(&globalCtx->roomCtx.unk_74[0], 0, 10); } } - gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->unk_11D30[0]); + gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, globalCtx->roomCtx.unk_74[0]); gSPDisplayList(displayListHead++, &D_0300AA48); gSPEndDisplayList(displayListHead); } @@ -2339,27 +2339,27 @@ void func_8009FE58(GlobalContext* globalCtx) { 1.f + (0.39999998f * temp * Math_CosS(D_8012A3A0)), 1.f + (1 * temp * Math_CosS(D_8012A39C))); func_800AA7AC(&globalCtx->view, 0.95f); - switch (globalCtx->unk_11D30[0]) { + switch (globalCtx->roomCtx.unk_74[0]) { case 0: break; case 1: - if (globalCtx->unk_11D30[1] < 1200) { - globalCtx->unk_11D30[1] += 200; + if (globalCtx->roomCtx.unk_74[1] < 1200) { + globalCtx->roomCtx.unk_74[1] += 200; } else { - globalCtx->unk_11D30[0]++; + globalCtx->roomCtx.unk_74[0]++; } break; case 2: - if (globalCtx->unk_11D30[1] > 0) { - globalCtx->unk_11D30[1] -= 30; + if (globalCtx->roomCtx.unk_74[1] > 0) { + globalCtx->roomCtx.unk_74[1] -= 30; } else { - globalCtx->unk_11D30[1] = 0; - globalCtx->unk_11D30[0] = 0; + globalCtx->roomCtx.unk_74[1] = 0; + globalCtx->roomCtx.unk_74[0] = 0; } break; } - D_8012A398 += 0.15f + (globalCtx->unk_11D30[1] * 0.001f); + D_8012A398 += 0.15f + (globalCtx->roomCtx.unk_74[1] * 0.001f); } if (globalCtx->roomCtx.curRoom.num == 2) { -- cgit v1.2.3