diff --git a/src/game/bg.c b/src/game/bg.c index ec7c736c4..3ba2a1c8b 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -832,7 +832,7 @@ Gfx *bgRenderRoomInXray(Gfx *gdl, s32 roomnum) return gdl; } - room0f166df0(roomnum, &globaldrawworldoffset); + roomGetPos(roomnum, &globaldrawworldoffset); sp54.x = player->eraserpos.x - globaldrawworldoffset.x; sp54.y = player->eraserpos.y - globaldrawworldoffset.y; @@ -842,7 +842,7 @@ Gfx *bgRenderRoomInXray(Gfx *gdl, s32 roomnum) sp40[1] = sp54.f[1]; sp40[2] = sp54.f[2]; - gdl = roomPushMtx(gdl, roomnum); + gdl = roomApplyMtx(gdl, roomnum); gdl = bgRenderRoomXrayPass(gdl, roomnum, g_Rooms[roomnum].gfxdata->opablocks, true, sp40); gdl = bgRenderRoomXrayPass(gdl, roomnum, g_Rooms[roomnum].gfxdata->xlublocks, true, sp40); @@ -2756,7 +2756,7 @@ Gfx *bgRenderRoomOpaque(Gfx *gdl, s32 roomnum) return gdl; } - gdl = roomPushMtx(gdl, roomnum); + gdl = roomApplyMtx(gdl, roomnum); gdl = lightsSetForRoom(gdl, roomnum); gdl = bgRenderRoomPass(gdl, roomnum, g_Rooms[roomnum].gfxdata->opablocks, true); @@ -2788,7 +2788,7 @@ Gfx *bgRenderRoomXlu(Gfx *gdl, s32 roomnum) if (g_Rooms[roomnum].gfxdata); if (g_Rooms[roomnum].gfxdata); - gdl = roomPushMtx(gdl, roomnum); + gdl = roomApplyMtx(gdl, roomnum); gdl = bgRenderRoomPass(gdl, roomnum, g_Rooms[roomnum].gfxdata->xlublocks, true); g_Rooms[roomnum].loaded240 = 1; diff --git a/src/game/explosions.c b/src/game/explosions.c index 99ad432bc..18c0aa689 100644 --- a/src/game/explosions.c +++ b/src/game/explosions.c @@ -1243,7 +1243,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) if (roomnum != -1) { struct screenbox screenbox; - struct coord *coord = roomGetPos(roomnum); + struct coord *coord = roomGetPosPtr(roomnum); u32 *colour; s32 tmp; @@ -1256,7 +1256,7 @@ Gfx *explosionRender(struct prop *prop, Gfx *gdl, bool xlupass) gSPClearGeometryMode(gdl++, G_CULL_BOTH | G_FOG); gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gdl = roomPushMtx(gdl, roomnum); + gdl = roomApplyMtx(gdl, roomnum); gSPDisplayList(gdl++, g_TexGdl2); diff --git a/src/game/game_13c510.c b/src/game/game_13c510.c index e383236eb..d221c82af 100644 --- a/src/game/game_13c510.c +++ b/src/game/game_13c510.c @@ -141,7 +141,7 @@ void artifactsCalculateGlaresForRoom(s32 roomnum) roomlights = (struct light *)&g_BgLightsFileData[g_Rooms[roomnum].gfxdata->lightsindex * 0x22]; s1 = &var800a41a0[g_Rooms[roomnum].gfxdata->lightsindex * 3]; - room0f166a6c(&sp138, roomnum); + roomPopulateMtx(&sp138, roomnum); mtx00015f88(currentPlayerGetScaleBg2Gfx(), &sp138); mtx4MultMtx4(camGetMtxF006c(), &sp138, &spf8); diff --git a/src/game/player.c b/src/game/player.c index 7ab09175f..c59eaaafa 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -3813,7 +3813,7 @@ struct var80070ba4 var80070ba4[4][7] = { // [wieldmode][turnmode] void playerSetGlobalDrawWorldOffset(s32 room) { - room0f166df0(room, &g_Vars.currentplayer->globaldrawworldoffset); + roomGetPos(room, &g_Vars.currentplayer->globaldrawworldoffset); g_Vars.currentplayer->globaldrawworldbgoffset = g_Vars.currentplayer->globaldrawworldoffset; diff --git a/src/game/room.c b/src/game/room.c index 71c22e499..b3d50437e 100644 --- a/src/game/room.c +++ b/src/game/room.c @@ -16,22 +16,22 @@ void roomSetLastForOffset(s32 room) g_Vars.currentplayer->lastroomforoffset = room; } -void room0f1668f0(struct roommtx *roommtx, s32 roomnum) +void roomLinkMtx(struct roommtx *roommtx, s32 roomnum) { g_Rooms[roomnum].unk10[g_Vars.currentplayernum] = roommtx->index; roommtx->room1 = roomnum; } -void room0f16692c(struct roommtx *roommtx, s32 roomnum) +void roomUnlinkMtx(struct roommtx *roommtx, s32 roomnum) { g_Rooms[roomnum].unk10[roommtx->playernum] = -1; roommtx->room1 = -1; } -void room0f16696c(struct roommtx *roommtx) +void roomFreeMtx(struct roommtx *roommtx) { if (roommtx->room1 != -1) { - room0f16692c(roommtx, roommtx->room1); + roomUnlinkMtx(roommtx, roommtx->room1); } roommtx->lvframe = 0; @@ -43,7 +43,7 @@ void room0f16696c(struct roommtx *roommtx) /** * Find a free mtx and return it. */ -struct roommtx *room0f1669fc(void) +struct roommtx *roomAllocateMtx(void) { s32 i; @@ -64,7 +64,7 @@ struct roommtx *room0f1669fc(void) return &g_RoomMtxes[0]; } -void room0f166a6c(Mtxf *mtx, s32 roomnum) +void roomPopulateMtx(Mtxf *mtx, s32 roomnum) { mtx4LoadIdentity(mtx); @@ -79,7 +79,7 @@ void room0f166a6c(Mtxf *mtx, s32 roomnum) } } -struct roommtx *room0f166c20(s32 roomnum) +struct roommtx *roomTouchMtx(s32 roomnum) { s32 index = g_Rooms[roomnum].unk10[g_Vars.currentplayernum]; struct roommtx *roommtx; @@ -94,38 +94,38 @@ struct roommtx *room0f166c20(s32 roomnum) } if (index != -1) { - room0f16692c(&g_RoomMtxes[index], roomnum); + roomUnlinkMtx(&g_RoomMtxes[index], roomnum); } - roommtx = room0f1669fc(); + roommtx = roomAllocateMtx(); - room0f1668f0(roommtx, roomnum); + roomLinkMtx(roommtx, roomnum); roommtx->lvframe = g_Vars.lvframenum; roommtx->playernum = g_Vars.currentplayernum; roommtx->room2 = g_Vars.currentplayer->lastroomforoffset; roommtx->somefloat = var8005ef10[0]; - room0f166a6c(&mtx, roomnum); + roomPopulateMtx(&mtx, roomnum); mtx00016054(&mtx, &roommtx->mtx); return roommtx; } -Gfx *roomPushMtx(Gfx *gdl, s32 roomnum) +Gfx *roomApplyMtx(Gfx *gdl, s32 roomnum) { - struct roommtx *roommtx = room0f166c20(roomnum); + struct roommtx *roommtx = roomTouchMtx(roomnum); gSPMatrix(gdl++, &roommtx->mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); return gdl; } -struct coord *roomGetPos(s32 room) +struct coord *roomGetPosPtr(s32 room) { return &g_BgRooms[room].pos; } -void room0f166df0(s32 room, struct coord *globaldrawworldoffset) +void roomGetPos(s32 room, struct coord *globaldrawworldoffset) { *globaldrawworldoffset = g_BgRooms[room].pos; } diff --git a/src/game/smoke.c b/src/game/smoke.c index d6a892150..c72f144b8 100644 --- a/src/game/smoke.c +++ b/src/game/smoke.c @@ -638,9 +638,9 @@ Gfx *smokeRender(struct prop *prop, Gfx *gdl, bool xlupass) } if (roomnum != -1) { - coord = roomGetPos(roomnum); + coord = roomGetPosPtr(roomnum); - room0f166df0(roomnum, &worldoffset); + roomGetPos(roomnum, &worldoffset); if (smoke->parts[0].size > 0) { f32 x = smoke->parts[0].pos.x - worldoffset.x; @@ -661,7 +661,7 @@ Gfx *smokeRender(struct prop *prop, Gfx *gdl, bool xlupass) gSPClearGeometryMode(gdl++, G_CULL_BOTH | G_FOG); gSPMatrix(gdl++, osVirtualToPhysical(camGetOrthogonalMtxL()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gdl = roomPushMtx(gdl, roomnum); + gdl = roomApplyMtx(gdl, roomnum); if (near) { gSPMatrix(gdl++, osVirtualToPhysical(&var800a3448), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW); diff --git a/src/game/wallhit.c b/src/game/wallhit.c index e77d33ec9..56cd8df98 100644 --- a/src/game/wallhit.c +++ b/src/game/wallhit.c @@ -899,7 +899,7 @@ void wallhitCreateWith20Args(struct coord *relpos, struct coord *arg1, struct co obj->hidden2 |= OBJH2FLAG_HASOPA; } } else { - struct coord *roompos = roomGetPos(room); + struct coord *roompos = roomGetPosPtr(room); if (arg2 != NULL) { f32 xdist = arg2->x - relpos->x; @@ -1151,7 +1151,7 @@ Gfx *wallhitRenderOpaBgHits(s32 roomnum, Gfx *gdl) prevtexturenum = -1; prev6b = -1; - gdl = roomPushMtx(gdl, roomnum); + gdl = roomApplyMtx(gdl, roomnum); wallhit = g_Rooms[roomnum].opawallhits; @@ -1211,7 +1211,7 @@ Gfx *wallhitRenderXluBgHits(s32 roomnum, Gfx *gdl) prevtexturenum = -1; prev6b = -1; - gdl = roomPushMtx(gdl, roomnum); + gdl = roomApplyMtx(gdl, roomnum); wallhit = g_Rooms[roomnum].xluwallhits; diff --git a/src/include/game/room.h b/src/include/game/room.h index 12efd9b06..1b9c223e5 100644 --- a/src/include/game/room.h +++ b/src/include/game/room.h @@ -7,14 +7,14 @@ void roomsReset(void); void roomSetLastForOffset(s32 room); -void room0f1668f0(struct roommtx *roommtx, s32 roomnum); -void room0f16692c(struct roommtx *roommtx, s32 roomnum); -void room0f16696c(struct roommtx *roommtx); -struct roommtx *room0f1669fc(void); -void room0f166a6c(Mtxf *matrix, s32 roomnum); -struct roommtx *room0f166c20(s32 roomnum); -Gfx *roomPushMtx(Gfx *gdl, s32 roomnum); -struct coord *roomGetPos(s32 room); -void room0f166df0(s32 room, struct coord *globaldrawworldoffset); +void roomLinkMtx(struct roommtx *roommtx, s32 roomnum); +void roomUnlinkMtx(struct roommtx *roommtx, s32 roomnum); +void roomFreeMtx(struct roommtx *roommtx); +struct roommtx *roomAllocateMtx(void); +void roomPopulateMtx(Mtxf *matrix, s32 roomnum); +struct roommtx *roomTouchMtx(s32 roomnum); +Gfx *roomApplyMtx(Gfx *gdl, s32 roomnum); +struct coord *roomGetPosPtr(s32 room); +void roomGetPos(s32 room, struct coord *globaldrawworldoffset); #endif