diff options
| author | Anghelo Carvajal <angheloalf95@gmail.com> | 2021-06-17 08:54:18 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-17 08:54:18 -0400 |
| commit | 3098abd4f6f9249131b79a0213e440bfa243662d (patch) | |
| tree | 135094a9376b5c65beb0d0e80e15e23fcb3ff8a3 /src/code | |
| parent | 52d36d7373f94ce5f4b14d9461b5fedc65601888 (diff) | |
Add current missing functions prototypes (#181)
* First bash
* Another batch
* Another bunch
* Update actorfixer
* run format
* Apply suggestions from code review
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
* Suggestion
* context renaming
* Update include/functions.h
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
* Fix renamings
* fix
Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/code_0x800CAAD0.c | 40 | ||||
| -rw-r--r-- | src/code/code_0x800CAE10.c | 8 | ||||
| -rw-r--r-- | src/code/game.c | 104 | ||||
| -rw-r--r-- | src/code/sys_matrix.c | 10 | ||||
| -rw-r--r-- | src/code/z_actor.c | 64 | ||||
| -rw-r--r-- | src/code/z_bgcheck.c | 4 | ||||
| -rw-r--r-- | src/code/z_eff_footmark.c | 2 | ||||
| -rw-r--r-- | src/code/z_effect.c | 8 | ||||
| -rw-r--r-- | src/code/z_effect_soft_sprite.c | 22 | ||||
| -rw-r--r-- | src/code/z_room.c | 62 | ||||
| -rw-r--r-- | src/code/z_scene.c | 8 | ||||
| -rw-r--r-- | src/code/z_skelanime.c | 64 | ||||
| -rw-r--r-- | src/code/z_view.c | 2 | ||||
| -rw-r--r-- | src/code/z_vr_box.c | 12 |
14 files changed, 206 insertions, 204 deletions
diff --git a/src/code/code_0x800CAAD0.c b/src/code/code_0x800CAAD0.c index a21e3885a..0db62aca0 100644 --- a/src/code/code_0x800CAAD0.c +++ b/src/code/code_0x800CAAD0.c @@ -5,7 +5,7 @@ // Perhaps it is called something like z_bgcheck_attach.c // The functions will use the BgCheck2 prefix for now. -void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* actor) { +void BgCheck2_UpdateActorPosition(CollisionContext* colCtx, s32 index, Actor* actor) { MtxF prevMatrix; MtxF prevMatrixInv; MtxF currMatrix; @@ -17,22 +17,22 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac } SkinMatrix_SetScaleRotateYRPTranslate( - &prevMatrix, bgCtxt->dyna.bgActors[index].prevTransform.scale.x, - bgCtxt->dyna.bgActors[index].prevTransform.scale.y, bgCtxt->dyna.bgActors[index].prevTransform.scale.z, - bgCtxt->dyna.bgActors[index].prevTransform.rot.x, bgCtxt->dyna.bgActors[index].prevTransform.rot.y, - bgCtxt->dyna.bgActors[index].prevTransform.rot.z, bgCtxt->dyna.bgActors[index].prevTransform.pos.x, - bgCtxt->dyna.bgActors[index].prevTransform.pos.y, bgCtxt->dyna.bgActors[index].prevTransform.pos.z); + &prevMatrix, colCtx->dyna.bgActors[index].prevTransform.scale.x, + colCtx->dyna.bgActors[index].prevTransform.scale.y, colCtx->dyna.bgActors[index].prevTransform.scale.z, + colCtx->dyna.bgActors[index].prevTransform.rot.x, colCtx->dyna.bgActors[index].prevTransform.rot.y, + colCtx->dyna.bgActors[index].prevTransform.rot.z, colCtx->dyna.bgActors[index].prevTransform.pos.x, + colCtx->dyna.bgActors[index].prevTransform.pos.y, colCtx->dyna.bgActors[index].prevTransform.pos.z); if (SkinMatrix_Invert(&prevMatrix, &prevMatrixInv) == 2) { return; } SkinMatrix_SetScaleRotateYRPTranslate( - &currMatrix, bgCtxt->dyna.bgActors[index].curTransform.scale.x, - bgCtxt->dyna.bgActors[index].curTransform.scale.y, bgCtxt->dyna.bgActors[index].curTransform.scale.z, - bgCtxt->dyna.bgActors[index].curTransform.rot.x, bgCtxt->dyna.bgActors[index].curTransform.rot.y, - bgCtxt->dyna.bgActors[index].curTransform.rot.z, bgCtxt->dyna.bgActors[index].curTransform.pos.x, - bgCtxt->dyna.bgActors[index].curTransform.pos.y, bgCtxt->dyna.bgActors[index].curTransform.pos.z); + &currMatrix, colCtx->dyna.bgActors[index].curTransform.scale.x, + colCtx->dyna.bgActors[index].curTransform.scale.y, colCtx->dyna.bgActors[index].curTransform.scale.z, + colCtx->dyna.bgActors[index].curTransform.rot.x, colCtx->dyna.bgActors[index].curTransform.rot.y, + colCtx->dyna.bgActors[index].curTransform.rot.z, colCtx->dyna.bgActors[index].curTransform.pos.x, + colCtx->dyna.bgActors[index].curTransform.pos.y, colCtx->dyna.bgActors[index].curTransform.pos.z); SkinMatrix_Vec3fMtxFMultXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv); SkinMatrix_Vec3fMtxFMultXYZ(&currMatrix, &posWithInv, &newPos); @@ -40,14 +40,14 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac actor->world.pos = newPos; } -void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* actor) { +void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 index, Actor* actor) { s16 angleChange; if (BgCheck_IsActorMeshIndexValid(index) == 0) { return; } - angleChange = bgCtxt->dyna.bgActors[index].curTransform.rot.y - bgCtxt->dyna.bgActors[index].prevTransform.rot.y; + angleChange = colCtx->dyna.bgActors[index].curTransform.rot.y - colCtx->dyna.bgActors[index].prevTransform.rot.y; if (actor->id == 0) { ((ActorPlayer*)actor)->unkAD4 += angleChange; @@ -57,14 +57,14 @@ void BgCheck2_UpdateActorYRotation(CollisionContext* bgCtxt, s32 index, Actor* a actor->world.rot.y += angleChange; } -void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) { +void BgCheck2_AttachToMesh(CollisionContext* colCtx, Actor* actor, s32 index) { DynaPolyActor* meshActor; if (BgCheck_IsActorMeshIndexValid(index) == 0) { return; } - meshActor = BgCheck_GetActorOfMesh(bgCtxt, index); + meshActor = BgCheck_GetActorOfMesh(colCtx, index); if (meshActor != NULL) { func_800CAE88(meshActor); @@ -77,7 +77,7 @@ void BgCheck2_AttachToMesh(CollisionContext* bgCtxt, Actor* actor, s32 index) { } } -u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* bgCtxt, s32 index, Actor* actor) { +u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* colCtx, s32 index, Actor* actor) { u32 wasUpdated = 0; DynaPolyActor* meshActor; @@ -85,23 +85,23 @@ u32 BgCheck2_UpdateActorAttachedToMesh(CollisionContext* bgCtxt, s32 index, Acto return 0; } - if (((bgCtxt->dyna.bgActorFlags[index] & 2) != 0) || ((bgCtxt->dyna.bgActorFlags[index] & 1) == 0)) { + if (((colCtx->dyna.bgActorFlags[index] & 2) != 0) || ((colCtx->dyna.bgActorFlags[index] & 1) == 0)) { return 0; } - meshActor = BgCheck_GetActorOfMesh(bgCtxt, index); + meshActor = BgCheck_GetActorOfMesh(colCtx, index); if (meshActor == NULL) { return 0; } if ((meshActor->unk154 & 1) != 0) { - BgCheck2_UpdateActorPosition(bgCtxt, index, actor); + BgCheck2_UpdateActorPosition(colCtx, index, actor); wasUpdated = 1; } if ((meshActor->unk154 & 2) != 0) { - BgCheck2_UpdateActorYRotation(bgCtxt, index, actor); + BgCheck2_UpdateActorYRotation(colCtx, index, actor); wasUpdated = 1; } diff --git a/src/code/code_0x800CAE10.c b/src/code/code_0x800CAE10.c index 21758e164..472d31b60 100644 --- a/src/code/code_0x800CAE10.c +++ b/src/code/code_0x800CAE10.c @@ -29,10 +29,10 @@ void func_800CAE9C(DynaPolyActor* actor) { actor->unk_158 |= 2; } -void func_800CAEB0(CollisionContext* bgCtxt, s32 index) { +void func_800CAEB0(CollisionContext* colCtx, s32 index) { DynaPolyActor* actor; - actor = BgCheck_GetActorOfMesh(bgCtxt, index); + actor = BgCheck_GetActorOfMesh(colCtx, index); if (actor != (DynaPolyActor*)0x0) { func_800CAE9C(actor); } @@ -42,10 +42,10 @@ void func_800CAEE0(DynaPolyActor* actor) { actor->unk_158 |= 4; } -void func_800CAEF4(CollisionContext* bgCtxt, s32 index) { +void func_800CAEF4(CollisionContext* colCtx, s32 index) { DynaPolyActor* actor; - actor = BgCheck_GetActorOfMesh(bgCtxt, index); + actor = BgCheck_GetActorOfMesh(colCtx, index); if (actor != (DynaPolyActor*)0x0) { func_800CAEE0(actor); } diff --git a/src/code/game.c b/src/code/game.c index 2100f99a9..a26cff424 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -63,11 +63,11 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) { *gfx = _gfx; } -void Game_Nop80173534(GameState* ctxt) { +void Game_Nop80173534(GameState* gamestate) { ; } -void GameState_Draw(GameState* ctxt, GraphicsContext* gfxCtx) { +void GameState_Draw(GameState* gamestate, GraphicsContext* gfxCtx) { Gfx* nextDisplayList; Gfx* _polyOpa; // Unused vars impact regalloc @@ -95,7 +95,7 @@ lblUnk:; // Label prevents reordering, if(1) around the above block don't seem t if (R_ENABLE_ARENA_DBG != 0) { SpeedMeter_DrawTimeEntries(&D_801F7FF0, gfxCtx); - SpeedMeter_DrawAllocEntries(&D_801F7FF0, gfxCtx, ctxt); + SpeedMeter_DrawAllocEntries(&D_801F7FF0, gfxCtx, gamestate); } } @@ -120,46 +120,46 @@ void func_801736DC(GraphicsContext* gfxCtx) { gfxCtx->polyOpa.p = nextDisplayList; } -void Game_UpdateInput(GameState* ctxt) { - Padmgr_GetInput(ctxt->input, 1); +void Game_UpdateInput(GameState* gamestate) { + Padmgr_GetInput(gamestate->input, 1); } -void Game_Update(GameState* ctxt) { +void Game_Update(GameState* gamestate) { GraphicsContext* _gCtx; - _gCtx = ctxt->gfxCtx; + _gCtx = gamestate->gfxCtx; - Game_ResetSegments(ctxt->gfxCtx); + Game_ResetSegments(gamestate->gfxCtx); - ctxt->main(ctxt); + gamestate->main(gamestate); if (R_PAUSE_MENU_MODE != 2) { - GameState_Draw(ctxt, _gCtx); + GameState_Draw(gamestate, _gCtx); func_801736DC(_gCtx); } } -void Game_IncrementFrameCount(GameState* ctxt) { - Game_Nop80173534(ctxt); - ctxt->frames++; +void Game_IncrementFrameCount(GameState* gamestate) { + Game_Nop80173534(gamestate); + gamestate->frames++; } -void Game_InitHeap(GameState* ctxt, u32 size) { +void Game_InitHeap(GameState* gamestate, u32 size) { GameState* _ctx; void* buf; - _ctx = ctxt; + _ctx = gamestate; buf = Gamealloc_Alloc(&_ctx->alloc, size); if (buf) { - THA_Ct(&ctxt->heap, buf, size); + THA_Ct(&gamestate->heap, buf, size); return; } - THA_Ct(&ctxt->heap, NULL, 0); + THA_Ct(&gamestate->heap, NULL, 0); assert_fail("../game.c", 0x40B); } -void Game_ResizeHeap(GameState* ctxt, u32 size) { +void Game_ResizeHeap(GameState* gamestate, u32 size) { GameAlloc* alloc; void* buf; u32 systemMaxFree; @@ -167,9 +167,9 @@ void Game_ResizeHeap(GameState* ctxt, u32 size) { u32 bytesAllocated; void* heapStart; - heapStart = ctxt->heap.bufp; - alloc = &ctxt->alloc; - THA_Dt(&ctxt->heap); + heapStart = gamestate->heap.bufp; + alloc = &gamestate->alloc; + THA_Dt(&gamestate->heap); Gamealloc_Free(alloc, heapStart); StartHeap_AnalyzeArena(&systemMaxFree, &bytesFree, &bytesAllocated); size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size); @@ -178,32 +178,32 @@ void Game_ResizeHeap(GameState* ctxt, u32 size) { } if (buf = Gamealloc_Alloc(alloc, size)) { - THA_Ct(&ctxt->heap, buf, size); + THA_Ct(&gamestate->heap, buf, size); } else { - THA_Ct(&ctxt->heap, 0, 0); + THA_Ct(&gamestate->heap, 0, 0); assert_fail("../game.c", 0x432); } } -void Game_StateInit(GameState* ctxt, GameStateFunc gameStateInit, GraphicsContext* gfxCtx) { - ctxt->gfxCtx = gfxCtx; - ctxt->frames = 0U; - ctxt->main = NULL; - ctxt->destroy = NULL; - ctxt->running = 1; +void Game_StateInit(GameState* gamestate, GameStateFunc gameStateInit, GraphicsContext* gfxCtx) { + gamestate->gfxCtx = gfxCtx; + gamestate->frames = 0U; + gamestate->main = NULL; + gamestate->destroy = NULL; + gamestate->running = 1; gfxCtx->unk274 = D_801FBB88; gfxCtx->viConfigFeatures = gViConfigFeatures; gfxCtx->viConfigXScale = gViConfigXScale; gfxCtx->viConfigYScale = gViConfigYScale; - ctxt->nextGameStateInit = NULL; - ctxt->nextGameStateSize = 0U; + gamestate->nextGameStateInit = NULL; + gamestate->nextGameStateSize = 0U; lblUnk:; - Gamealloc_Init(&ctxt->alloc); - Game_InitHeap(ctxt, 0x100000); - Game_SetFramerateDivisor(ctxt, 3); + Gamealloc_Init(&gamestate->alloc); + Game_InitHeap(gamestate, 0x100000); + Game_SetFramerateDivisor(gamestate, 3); - gameStateInit(ctxt); + gameStateInit(gamestate); func_80140CE0(&D_801F8010); func_801420C0(&D_801F8020); @@ -212,16 +212,16 @@ lblUnk:; func_801773A0(&D_801F7FF0); func_8013ED9C(); - osSendMesg(&ctxt->gfxCtx->unk5C, NULL, 1); + osSendMesg(&gamestate->gfxCtx->unk5C, NULL, 1); } -void Game_StateFini(GameState* ctxt) { +void Game_StateFini(GameState* gamestate) { func_80172BC0(); func_8019E014(); - osRecvMesg(&ctxt->gfxCtx->unk5C, 0, 1); + osRecvMesg(&gamestate->gfxCtx->unk5C, 0, 1); - if (ctxt->destroy != 0) { - ctxt->destroy(ctxt); + if (gamestate->destroy != 0) { + gamestate->destroy(gamestate); } func_8013EDD0(); @@ -230,28 +230,28 @@ void Game_StateFini(GameState* ctxt) { func_801420F4(&D_801F8020); func_80141900(&sMonoColors); func_80140900(&D_801F8048); - THA_Dt(&ctxt->heap); - Gamealloc_FreeAll(&ctxt->alloc); + THA_Dt(&gamestate->heap); + Gamealloc_FreeAll(&gamestate->alloc); } -GameStateFunc Game_GetNextStateInit(GameState* ctxt) { - return ctxt->nextGameStateInit; +GameStateFunc Game_GetNextStateInit(GameState* gamestate) { + return gamestate->nextGameStateInit; } -u32 Game_GetNextStateSize(GameState* ctxt) { - return ctxt->nextGameStateSize; +u32 Game_GetNextStateSize(GameState* gamestate) { + return gamestate->nextGameStateSize; } -u32 Game_GetShouldContinue(GameState* ctxt) { - return ctxt->running; +u32 Game_GetShouldContinue(GameState* gamestate) { + return gamestate->running; } -s32 Game_GetHeapFreeSize(GameState* ctxt) { - return THA_GetSize(&ctxt->heap); +s32 Game_GetHeapFreeSize(GameState* gamestate) { + return THA_GetSize(&gamestate->heap); } -s32 func_80173B48(GameState* ctxt) { +s32 func_80173B48(GameState* gamestate) { s32 result; - result = OS_CYCLES_TO_NSEC(ctxt->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0); + result = OS_CYCLES_TO_NSEC(gamestate->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0); return result; } diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c index d626da455..20283638a 100644 --- a/src/code/sys_matrix.c +++ b/src/code/sys_matrix.c @@ -1,25 +1,25 @@ #include <ultra64.h> #include <global.h> -void Matrix_Init(GameState* state) { - sMatrixStack = (MtxF*)THA_AllocEndAlign16(&state->heap, 0x500); +void SysMatrix_StateAlloc(GameState* gamestate) { + sMatrixStack = (MtxF*)THA_AllocEndAlign16(&gamestate->heap, 0x500); sCurrentMatrix = sMatrixStack; } -void Matrix_Push(void) { +void SysMatrix_StatePush(void) { MtxF* prev = sCurrentMatrix; sCurrentMatrix++; Matrix_MtxFCopy(sCurrentMatrix, prev); } -void Matrix_Pop(void) { +void SysMatrix_StatePop(void) { sCurrentMatrix--; } #pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_CopyCurrentState.asm") -#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_Put.asm") +#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_SetCurrentState.asm") #pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetCurrentState.asm") diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 5162f95b2..b0a92b62e 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -54,7 +54,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf } func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx); - Matrix_Put(&mtx); + SysMatrix_SetCurrentState(&mtx); if (dlist != D_04076BC0) { Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); @@ -118,7 +118,7 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]); arg6 *= (4.5f - (light->l.dir[1] * D_801DCA1C)); arg6 = (arg6 < 1.0f) ? 1.0f : arg6; - Matrix_Put(arg2); + SysMatrix_SetCurrentState(arg2); Matrix_RotateY(sp58, MTXMODE_APPLY); Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY); @@ -147,16 +147,16 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, #pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B5040.asm") -void Actor_TargetContextInit(TargetContext* targetCtxt, Actor* actor, GlobalContext* globalCtx) { - targetCtxt->unk90 = NULL; - targetCtxt->unk8C = NULL; - targetCtxt->unk3C = NULL; - targetCtxt->unk38 = NULL; - targetCtxt->unk4B = 0; - targetCtxt->unk4C = 0; - targetCtxt->unk40 = 0; - func_800B5040(targetCtxt, actor, actor->category, globalCtx); - func_800B4F78(targetCtxt, actor->category, globalCtx); +void Actor_TargetContextInit(TargetContext* targetCtx, Actor* actor, GlobalContext* globalCtx) { + targetCtx->unk90 = NULL; + targetCtx->unk8C = NULL; + targetCtx->unk3C = NULL; + targetCtx->unk38 = NULL; + targetCtx->unk4B = 0; + targetCtx->unk4C = 0; + targetCtx->unk40 = 0; + func_800B5040(targetCtx, actor, actor->category, globalCtx); + func_800B4F78(targetCtx, actor->category, globalCtx); } #pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B5208.asm") @@ -235,34 +235,34 @@ void Actor_SetCollectibleFlag(GlobalContext* globalCtx, s32 index) { } } -void Actor_TitleCardContextInit(GlobalContext* globalCtx, TitleCardContext* titleCtxt) { - titleCtxt->fadeOutDelay = 0; - titleCtxt->fadeInDelay = 0; - titleCtxt->color = 0; - titleCtxt->alpha = 0; +void Actor_TitleCardContextInit(GlobalContext* globalCtx, TitleCardContext* titleCardCtx) { + titleCardCtx->fadeOutDelay = 0; + titleCardCtx->fadeInDelay = 0; + titleCardCtx->color = 0; + titleCardCtx->alpha = 0; } -void Actor_TitleCardCreate(GlobalContext* globalCtx, TitleCardContext* titleCtxt, u32 texture, s16 param_4, s16 param_5, +void Actor_TitleCardCreate(GlobalContext* globalCtx, TitleCardContext* titleCardCtx, u32 texture, s16 param_4, s16 param_5, u8 param_6, u8 param_7) { - titleCtxt->texture = texture; - titleCtxt->unk4 = param_4; - titleCtxt->unk6 = param_5; - titleCtxt->unk8 = param_6; - titleCtxt->unk9 = param_7; - titleCtxt->fadeOutDelay = 80; - titleCtxt->fadeInDelay = 0; + titleCardCtx->texture = texture; + titleCardCtx->unk4 = param_4; + titleCardCtx->unk6 = param_5; + titleCardCtx->unk8 = param_6; + titleCardCtx->unk9 = param_7; + titleCardCtx->fadeOutDelay = 80; + titleCardCtx->fadeInDelay = 0; } #pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_Nop800B5E50.asm") -void Actor_TitleCardUpdate(GlobalContext* globalCtx, TitleCardContext* titleCtxt) { - if (DECR(titleCtxt->fadeInDelay) == 0) { - if (DECR(titleCtxt->fadeOutDelay) == 0) { - Math_StepToS(&titleCtxt->alpha, 0, 30); - Math_StepToS(&titleCtxt->color, 0, 70); +void Actor_TitleCardUpdate(GlobalContext* globalCtx, TitleCardContext* titleCardCtx) { + if (DECR(titleCardCtx->fadeInDelay) == 0) { + if (DECR(titleCardCtx->fadeOutDelay) == 0) { + Math_StepToS(&titleCardCtx->alpha, 0, 30); + Math_StepToS(&titleCardCtx->color, 0, 70); } else { - Math_StepToS(&titleCtxt->alpha, 255, 10); - Math_StepToS(&titleCtxt->color, 255, 20); + Math_StepToS(&titleCardCtx->alpha, 255, 10); + Math_StepToS(&titleCardCtx->color, 255, 20); } } } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 180a749c2..17853d3b8 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -162,8 +162,8 @@ void BgCheck_CreateVertexFromVec3f(Vec3s* vertex, Vec3f* vector) { #pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C40B4.asm") -f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly** arg1, s32* arg2, Actor* actor, Vec3f* pos) { - return func_800C3D50(0, bgCtxt, 2, arg1, arg2, pos, actor, 28, 1.0f, 0); +f32 func_800C411C(CollisionContext* colCtx, CollisionPoly** arg1, s32* arg2, Actor* actor, Vec3f* pos) { + return func_800C3D50(0, colCtx, 2, arg1, arg2, pos, actor, 28, 1.0f, 0); } #pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C4188.asm") diff --git a/src/code/z_eff_footmark.c b/src/code/z_eff_footmark.c index 538a98e7f..279b65a60 100644 --- a/src/code/z_eff_footmark.c +++ b/src/code/z_eff_footmark.c @@ -107,7 +107,7 @@ void EffFootmark_Draw(GlobalContext* globalCtx) { for (footmark = globalCtx->footmarks, i = 0; i < 100; i++, footmark++) { if (footmark->actor != NULL) { - Matrix_Put(&footmark->displayMatrix); + SysMatrix_SetCurrentState(&footmark->displayMatrix); Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1); gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD); diff --git a/src/code/z_effect.c b/src/code/z_effect.c index 8f8b99efe..be1225bb9 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -187,7 +187,7 @@ void Effect_Add(GlobalContext* globalCtx, s32* index, s32 type, u8 param_4, u8 p void Effect_DrawAll(GraphicsContext* gfxCtx) { s32 i; - for (i = 0; i < SPARK_COUNT; i++) { + for (i = 0; i < SPARK_COUNT; i++) { if (1) {} // necessary to match if (sEffTable.sparks[i].base.active) { sEffInfoTable[0].draw(&sEffTable.sparks[i].params, gfxCtx); @@ -195,8 +195,10 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) { } for (i = 0; i < BLURE_COUNT; i++) { - if (1) { if (gfxCtx) {} } // necessary to match - if (sEffTable.blures[i].base.active) { + if (1) { + if (gfxCtx) {} + } // necessary to match + if (sEffTable.blures[i].base.active) { sEffInfoTable[1].draw(&sEffTable.blures[i].params, gfxCtx); } } diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 7546f6ed9..73bd5b4bd 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -10,7 +10,8 @@ void EffectSS_Init(GlobalContext* globalCtx, s32 numEntries) { EffectSS2Info.searchIndex = 0; EffectSS2Info.size = numEntries; - for (effectsSs = &EffectSS2Info.data_table[0]; effectsSs < &EffectSS2Info.data_table[EffectSS2Info.size]; effectsSs++) { + for (effectsSs = &EffectSS2Info.data_table[0]; effectsSs < &EffectSS2Info.data_table[EffectSS2Info.size]; + effectsSs++) { EffectSS_ResetEntry(effectsSs); } @@ -97,7 +98,7 @@ s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry) { // Search for a unused entry i = EffectSS2Info.searchIndex; foundFree = false; - while(true) { + while (true) { if (EffectSS2Info.data_table[i].life == -1) { foundFree = true; break; @@ -118,12 +119,12 @@ s32 EffectSS_FindFreeSpace(s32 priority, s32* tableEntry) { if (foundFree == true) { *tableEntry = i; return false; - } - + } + // If all slots are in use, search for a slot with a lower priority // Note that a lower priority is representend by a higher value i = EffectSS2Info.searchIndex; - while(true) { + while (true) { // Equal priority should only be considered "lower" if flag 0 is set if ((priority <= EffectSS2Info.data_table[i].priority) && !((priority == EffectSS2Info.data_table[i].priority) && (EffectSS2Info.data_table[i].flags & 1))) { @@ -181,14 +182,13 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init return; } - Load2_LoadOverlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd, - entry->loadedRamAddr); + Load2_LoadOverlay(entry->vromStart, entry->vromEnd, entry->vramStart, entry->vramEnd, entry->loadedRamAddr); } - overlayInfo = (void*)(u32)(entry->overlayInfo != NULL - ? (ParticleOverlayInfo*)(-((u32)entry->vramStart - (u32)entry->loadedRamAddr) + - (u32)entry->overlayInfo) - : NULL); + overlayInfo = (void*)(u32)( + entry->overlayInfo != NULL + ? (ParticleOverlayInfo*)(-((u32)entry->vramStart - (u32)entry->loadedRamAddr) + (u32)entry->overlayInfo) + : NULL); } if (overlayInfo->init != NULL) { diff --git a/src/code/z_room.c b/src/code/z_room.c index 84f93b778..eda1b6e76 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -63,39 +63,39 @@ void Room_DrawType1Mesh(GlobalContext* globalCtx, Room* room, u32 flags) { } } -void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtxt) { +void Room_Init(GlobalContext* globalCtx, RoomContext* roomCtx) { s32 i; - roomCtxt->currRoom.num = -1; - roomCtxt->currRoom.segment = NULL; - roomCtxt->unk78 = 1; - roomCtxt->unk79 = 0; + roomCtx->currRoom.num = -1; + roomCtx->currRoom.segment = NULL; + roomCtx->unk78 = 1; + roomCtx->unk79 = 0; for (i = 0; i < 3; i++) { - roomCtxt->unk7A[i] = 0; + roomCtx->unk7A[i] = 0; } } #pragma GLOBAL_ASM("./asm/non_matchings/code/z_room/Room_AllocateAndLoad.asm") #ifdef NON_MATCHING -s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtxt, s32 index) { +s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtx, s32 index) { u32 size; // XXX: this should use a branch-likely - if (roomCtxt->unk31 == 0) { - roomCtxt->prevRoom = roomCtxt->currRoom; - roomCtxt->currRoom.num = index; - roomCtxt->currRoom.segment = NULL; - roomCtxt->unk31 = 1; + if (roomCtx->unk31 == 0) { + roomCtx->prevRoom = roomCtx->currRoom; + roomCtx->currRoom.num = index; + roomCtx->currRoom.segment = NULL; + roomCtx->unk31 = 1; size = globalCtx->roomAddrs[index].vromEnd - globalCtx->roomAddrs[index].vromStart; - roomCtxt->activeRoomVram = - (void*)((s32)roomCtxt->roomMemPages[roomCtxt->activeMemPage] - (size + 8) * roomCtxt->activeMemPage + 8) & + roomCtx->activeRoomVram = + (void*)((s32)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage + 8) & 0xfffffff0; - osCreateMesgQueue(&roomCtxt->loadQueue, roomCtxt->loadMsg, 1); - DmaMgr_SendRequestImpl(&roomCtxt->dmaRequest, roomCtxt->activeRoomVram, globalCtx->roomAddrs[index].vromStart, - size, 0, &roomCtxt->loadQueue, NULL); - roomCtxt->activeMemPage ^= 1; + osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1); + DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, globalCtx->roomAddrs[index].vromStart, + size, 0, &roomCtx->loadQueue, NULL); + roomCtx->activeMemPage ^= 1; return 1; } @@ -106,19 +106,19 @@ s32 Room_StartRoomTransition(GlobalContext* globalCtx, RoomContext* roomCtxt, s3 #pragma GLOBAL_ASM("./asm/non_matchings/code/z_room/Room_StartRoomTransition.asm") #endif -s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtxt) { - if (roomCtxt->unk31 == 1) { - if (!osRecvMesg(&roomCtxt->loadQueue, NULL, OS_MESG_NOBLOCK)) { - roomCtxt->unk31 = 0; - roomCtxt->currRoom.segment = roomCtxt->activeRoomVram; +s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) { + if (roomCtx->unk31 == 1) { + if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK)) { + roomCtx->unk31 = 0; + roomCtx->currRoom.segment = roomCtx->activeRoomVram; // TODO: Segment number enum - gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtxt->activeRoomVram); + gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram); - Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtxt->currRoom.segment); + Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtx->currRoom.segment); func_80123140(globalCtx, PLAYER); Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); - if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtxt->currRoom.num != 1)) && + if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && (globalCtx->sceneNum != SCENE_IKNINSIDE)) { globalCtx->kankyoContext.unkC3 = 0xff; globalCtx->kankyoContext.unkE0 = 0; @@ -144,13 +144,13 @@ void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags) { return; } -void func_8012EBF8(GlobalContext* globalCtx, RoomContext* roomCtxt) { - roomCtxt->prevRoom.num = -1; - roomCtxt->prevRoom.segment = NULL; +void func_8012EBF8(GlobalContext* globalCtx, RoomContext* roomCtx) { + roomCtx->prevRoom.num = -1; + roomCtx->prevRoom.segment = NULL; func_800BA798(globalCtx, &globalCtx->actorCtx); Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); - if (-1 < roomCtxt->currRoom.num) { - func_8010A33C(globalCtx, roomCtxt->currRoom.num); + if (-1 < roomCtx->currRoom.num) { + func_8010A33C(globalCtx, roomCtx->currRoom.num); func_8010A2DC(globalCtx); } func_801A3CD8(globalCtx->roomContext.currRoom.echo); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 78c57d478..c6ff04391 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -24,8 +24,8 @@ s32 Object_Spawn(ObjectContext* objectCtx, s16 id) { return objectCtx->num - 1; } -void Object_InitBank(GameState* state, ObjectContext* objectCtx) { - GlobalContext* globalCtx = (GlobalContext*)state; +void Object_InitBank(GameState* gamestate, ObjectContext* objectCtx) { + GlobalContext* globalCtx = (GlobalContext*)gamestate; s32 pad; u32 spaceSize; s32 i; @@ -50,7 +50,7 @@ void Object_InitBank(GameState* state, ObjectContext* objectCtx) { for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = 0; } // clang-format on - objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocEndAlign16(&state->heap, spaceSize); + objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocEndAlign16(&gamestate->heap, spaceSize); objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize); objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP); @@ -328,7 +328,7 @@ void Scene_HeaderCmdTransiActorList(GlobalContext* globalCtx, SceneCmd* cmd) { } // Init function for the transition system. -void Transition_Init(GameState* state, TransitionContext* transitionCtx) { +void Transition_Init(GameState* gamestate, TransitionContext* transitionCtx) { transitionCtx->nbTransitionActors = 0; } diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 07ab415ad..5dabb6a27 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -40,7 +40,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skele GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; rot = limbDrawTable[limbIndex]; @@ -71,7 +71,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skele postLimbDraw, actor, dListIndex); } - Matrix_Pop(); + SysMatrix_StatePop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_LodDrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -98,7 +98,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDra gfxCtx = globalCtx->state.gfxCtx; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]); pos.x = limbDrawTable[0].x; @@ -130,7 +130,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDra postLimbDraw, actor, dListIndex); } - Matrix_Pop(); + SysMatrix_StatePop(); } /* @@ -147,7 +147,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** ske GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; @@ -183,7 +183,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** ske postLimbDraw, actor, dListIndex, mtx); } - Matrix_Pop(); + SysMatrix_StatePop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -217,7 +217,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbD gfxCtx = globalCtx->state.gfxCtx; gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]); pos.x = limbDrawTable[0].x; @@ -253,7 +253,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbD postLimbDraw, actor, dListIndex, &mtx); } - Matrix_Pop(); + SysMatrix_StatePop(); } /* @@ -268,7 +268,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; @@ -298,7 +298,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton postLimbDraw, actor); } - Matrix_Pop(); + SysMatrix_StatePop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_DrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw, @@ -322,7 +322,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTa gfxCtx = globalCtx->state.gfxCtx; - Matrix_Push(); + SysMatrix_StatePush(); rootLimb = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]); pos.x = limbDrawTable[0].x; @@ -352,7 +352,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTa postLimbDraw, actor); } - Matrix_Pop(); + SysMatrix_StatePop(); } void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, @@ -365,7 +365,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skelet GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; @@ -400,7 +400,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skelet postLimbDraw, actor, limbMatricies); } - Matrix_Pop(); + SysMatrix_StatePop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { SkelAnime_DrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -429,7 +429,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDraw gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]); @@ -467,7 +467,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDraw postLimbDraw, actor, &mtx); } - Matrix_Pop(); + SysMatrix_StatePop(); } void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, @@ -480,7 +480,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s32 pad2; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; @@ -495,7 +495,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) { SysMatrix_RotateAndTranslateState(&pos, &rot); - Matrix_Push(); + SysMatrix_StatePush(); unkDraw(globalCtx, limbIndex, actor); if (dList[1] != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; @@ -510,7 +510,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec (*mtx)++; } } - Matrix_Pop(); + SysMatrix_StatePop(); } if (postLimbDraw != NULL) { @@ -522,7 +522,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec unkDraw, actor, mtx); } - Matrix_Pop(); + SysMatrix_StatePop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { func_80134148(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw, @@ -551,7 +551,7 @@ void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTab gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]); @@ -565,7 +565,7 @@ void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTab if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) { SysMatrix_RotateAndTranslateState(&pos, &rot); - Matrix_Push(); + SysMatrix_StatePush(); unkDraw(globalCtx, 1, actor); if (dList[1] != NULL) { Gfx* polyTemp = gfxCtx->polyOpa.p; @@ -579,7 +579,7 @@ void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTab SysMatrix_GetStateAsRSPMatrix(mtx++); } } - Matrix_Pop(); + SysMatrix_StatePop(); } if (postLimbDraw != NULL) { @@ -591,7 +591,7 @@ void func_801343C0(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTab unkDraw, actor, &mtx); } - Matrix_Pop(); + SysMatrix_StatePop(); } /* @@ -641,7 +641,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleto Vec3f pos; Vec3s rot; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; @@ -671,7 +671,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, void** skeleto postLimbDraw, actor, gfx); } - Matrix_Pop(); + SysMatrix_StatePop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -697,7 +697,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawT return NULL; } - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]); @@ -726,7 +726,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawT postLimbDraw, actor, gfx); } - Matrix_Pop(); + SysMatrix_StatePop(); return gfx; } @@ -744,7 +744,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, void** skele Vec3f pos; Vec3s rot; - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[limbIndex]); limbIndex++; @@ -780,7 +780,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, void** skele postLimbDraw, actor, mtx, gfx); } - Matrix_Pop(); + SysMatrix_StatePop(); if (limbEntry->nextLimbIndex != LIMB_DONE) { gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, @@ -808,7 +808,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDra gSPSegment(gfx++, 0xD, mtx); - Matrix_Push(); + SysMatrix_StatePush(); limbEntry = (StandardLimb*)Lib_SegmentedToVirtual(skeleton[0]); @@ -844,7 +844,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDra postLimbDraw, actor, &mtx, gfx); } - Matrix_Pop(); + SysMatrix_StatePop(); return gfx; } diff --git a/src/code/z_view.c b/src/code/z_view.c index ad8dfad5d..7e2d7d62c 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -258,7 +258,7 @@ s32 View_StepQuake(View* view, RSPMatrix* matrix) { } SysMatrix_FromRSPMatrix(matrix, &mf); - Matrix_Put(&mf); + SysMatrix_SetCurrentState(&mf); SysMatrix_RotateStateAroundXAxis(view->currQuakeRot.x); SysMatrix_InsertYRotation_f(view->currQuakeRot.y, 1); SysMatrix_InsertZRotation_f(view->currQuakeRot.z, 1); diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c index cfed6f783..9f413f3fe 100644 --- a/src/code/z_vr_box.c +++ b/src/code/z_vr_box.c @@ -38,7 +38,7 @@ void func_80143148(SkyboxContext* skyboxCtx, s32 arg1) { #ifdef NON_MATCHING // Matches besides rodata, since rodata is not merged into the asm in code files yet. -void func_801431E8(GameState* state, SkyboxContext* skyboxCtx, s16 skyType) { +void func_801431E8(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType) { GlobalContext* globalCtx = (GlobalContext*)state; u32 size; void* offset; @@ -139,22 +139,22 @@ void func_80143324(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyTy } } -void func_801434E4(GameState* state, SkyboxContext* skyboxCtx, s16 skyType) { +void func_801434E4(GameState* gamestate, SkyboxContext* skyboxCtx, s16 skyType) { skyboxCtx->skyboxShouldDraw = 0; skyboxCtx->rotX = skyboxCtx->rotY = skyboxCtx->rotZ = 0.0f; - func_801431E8(state, skyboxCtx, skyType); + func_801431E8(gamestate, skyboxCtx, skyType); if (skyType != 0) { - skyboxCtx->unk17C = THA_AllocEndAlign16(&state->heap, 0x3840); + skyboxCtx->unk17C = THA_AllocEndAlign16(&gamestate->heap, 0x3840); if (skyType == 5) { // Allocate enough space for the vertices for a 6 sided skybox (cube) - skyboxCtx->roomVtx = THA_AllocEndAlign16(&state->heap, sizeof(Vtx) * 32 * 6); + skyboxCtx->roomVtx = THA_AllocEndAlign16(&gamestate->heap, sizeof(Vtx) * 32 * 6); func_80143148(skyboxCtx, 6); } else { // Allocate enough space for the vertices for a 5 sided skybox (bottom is missing) - skyboxCtx->roomVtx = THA_AllocEndAlign16(&state->heap, sizeof(Vtx) * 32 * 5); + skyboxCtx->roomVtx = THA_AllocEndAlign16(&gamestate->heap, sizeof(Vtx) * 32 * 5); func_80143148(skyboxCtx, 5); } } |
