From e9eb4d4e0a581958e90604bb628a7f81e56bf16e Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 10 Jun 2021 22:13:43 +1000 Subject: Match z_effect.c (#176) --- src/code/code_0x800AF710.c | 316 --------------------------------------------- src/code/game.c | 52 ++++---- src/code/z_effect.c | 314 ++++++++++++++++++++++++++++++++++++++++++++ src/code/z_rcp.c | 164 +++++++++++------------ 4 files changed, 422 insertions(+), 424 deletions(-) delete mode 100644 src/code/code_0x800AF710.c create mode 100644 src/code/z_effect.c (limited to 'src/code') diff --git a/src/code/code_0x800AF710.c b/src/code/code_0x800AF710.c deleted file mode 100644 index ca0e75642..000000000 --- a/src/code/code_0x800AF710.c +++ /dev/null @@ -1,316 +0,0 @@ -#include -#include - -EffInfo sEffInfoTable[] = { - { - sizeof(EffSparkParams), - (eff_init_func)EffectSpark_Init, - (eff_destroy_func)EffectSpark_Destroy, - (eff_update_func)EffectSpark_Update, - (eff_draw_func)EffectSpark_Draw, - }, - { - sizeof(EffectBlure), - (eff_init_func)EffectBlure_Init1, - (eff_destroy_func)EffectBlure_Destroy, - (eff_update_func)EffectBlure_Update, - (eff_draw_func)EffectBlure_Draw, - }, - { - sizeof(EffectBlure), - (eff_init_func)EffectBlure_Init2, - (eff_destroy_func)EffectBlure_Destroy, - (eff_update_func)EffectBlure_Update, - (eff_draw_func)EffectBlure_Draw, - }, - { - sizeof(EffShieldParticleParams), - (eff_init_func)EffectShieldParticle_Init, - (eff_destroy_func)EffectShieldParticle_Destroy, - (eff_update_func)EffectShieldParticle_Update, - (eff_draw_func)EffectShieldParticle_Draw, - }, - { - sizeof(EffTireMarkParams), - (eff_init_func)EffectTireMark_Init, - (eff_destroy_func)EffectTireMark_Destroy, - (eff_update_func)EffectTireMark_Update, - (eff_draw_func)EffectTireMark_Draw, - }, -}; - -GlobalContext* Effect_GetContext(void) { - return sEffTable.globalCtx; -} - -void* Effect_GetParams(s32 index) { - if (index == 46) { - return NULL; - } - - if (index < 3) { - if (sEffTable.sparks[index].base.active == 1) { - return &sEffTable.sparks[index].params; - } else { - return NULL; - } - } - - index -= 3; - if (index < 25) { - if (sEffTable.blures[index].base.active == 1) { - return &sEffTable.blures[index].params; - } else { - return NULL; - } - } - - index -= 25; - if (index < 3) { - if (sEffTable.shieldParticles[index].base.active == 1) { - return &sEffTable.shieldParticles[index].params; - } else { - return NULL; - } - } - - index -= 3; - if (index < 15) { - if (sEffTable.tireMarks[index].base.active == 1) { - return &sEffTable.tireMarks[index].params; - } else { - return NULL; - } - } - - return NULL; -} - -void Effect_InitCommon(EffCommon* common) { - common->active = 0; - common->unk1 = 0; - common->unk2 = 0; -} - -void Effect_Init(GlobalContext* globalCtx) { - s32 i; - - for (i = 0; i < 3; i++) { - Effect_InitCommon(&sEffTable.sparks[i].base); - } - - for (i = 0; i < 25; i++) { - Effect_InitCommon(&sEffTable.blures[i].base); - } - - //! @bug This is probably supposed to loop over shieldParticles, not blures again - for (i = 0; i < 3; i++) { - Effect_InitCommon(&sEffTable.blures[i].base); - } - - for (i = 0; i < 15; i++) { - Effect_InitCommon(&sEffTable.tireMarks[i].base); - } - - sEffTable.globalCtx = globalCtx; -} - -void Effect_Add(GlobalContext* globalCtx, s32* index, s32 type, u8 param_4, u8 param_5, void* initParams) { - u32 slotFound; - s32 i; - void* params; - EffCommon* common; - - params = NULL; - *index = 46; - common = NULL; - - if (func_8016A01C(globalCtx) != 1) { - slotFound = 0; - switch (type) { - case 0: - for (i = 0; i < 3; i++) { - if (sEffTable.sparks[i].base.active == 0) { - slotFound = 1; - *index = i; - params = &sEffTable.sparks[i].params; - common = &sEffTable.sparks[i].base; - break; - } - } - break; - case 1: - case 2: - for (i = 0; i < 25; i++) { - if (sEffTable.blures[i].base.active == 0) { - slotFound = 1; - *index = i + 3; - params = &sEffTable.blures[i].params; - common = &sEffTable.blures[i].base; - break; - } - } - break; - case 3: - for (i = 0; i < 3; i++) { - if (sEffTable.shieldParticles[i].base.active == 0) { - slotFound = 1; - *index = i + 28; - params = &sEffTable.shieldParticles[i].params; - common = &sEffTable.shieldParticles[i].base; - break; - } - } - break; - case 4: - for (i = 0; i < 15; i++) { - if (sEffTable.tireMarks[i].base.active == 0) { - slotFound = 1; - *index = i + 31; - params = &sEffTable.tireMarks[i].params; - common = &sEffTable.tireMarks[i].base; - break; - } - } - break; - } - - if (slotFound) { - sEffInfoTable[type].init(params, initParams); - common->unk2 = param_4; - common->unk1 = param_5; - common->active = 1; - } - } -} - -#ifdef NON_MATCHING -// Contents of s2 and s3 swapped -void Effect_DrawAll(GraphicsContext* gCtxt) { - s32 i; - - for (i = 0; i < 3; i++) { - if (sEffTable.sparks[i].base.active) { - sEffInfoTable[0].draw(&sEffTable.sparks[i].params, gCtxt); - } - } - - for (i = 0; i < 25; i++) { - if (sEffTable.blures[i].base.active) { - sEffInfoTable[1].draw(&sEffTable.blures[i].params, gCtxt); - } - } - - for (i = 0; i < 3; i++) { - if (sEffTable.shieldParticles[i].base.active) { - sEffInfoTable[3].draw(&sEffTable.shieldParticles[i].params, gCtxt); - } - } - - for (i = 0; i < 15; i++) { - if (sEffTable.tireMarks[i].base.active) { - sEffInfoTable[4].draw(&sEffTable.tireMarks[i].params, gCtxt); - } - } -} -#else -#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x800AF710/Effect_DrawAll.asm") -#endif - -#ifdef NON_MATCHING -// 15 is being placed in s5 instead of at -void Effect_UpdateAll(GlobalContext* globalCtx) { - s32 i; - - for (i = 0; i < 3; i++) { - if (sEffTable.sparks[i].base.active) { - if (sEffInfoTable[0].update(&sEffTable.sparks[i].params) == 1) { - Effect_Destroy(globalCtx, i); - } - } - } - - for (i = 0; i < 25; i++) { - if (sEffTable.blures[i].base.active) { - if (sEffInfoTable[1].update(&sEffTable.blures[i].params) == 1) { - Effect_Destroy(globalCtx, i + 3); - } - } - } - - for (i = 0; i < 3; i++) { - if (sEffTable.shieldParticles[i].base.active) { - if (sEffInfoTable[3].update(&sEffTable.shieldParticles[i].params) == 1) { - Effect_Destroy(globalCtx, i + 28); - } - } - } - - for (i = 0; i < 15; i++) { - if (sEffTable.tireMarks[i].base.active) { - if (sEffInfoTable[4].update(&sEffTable.tireMarks[i].params) == 1) { - Effect_Destroy(globalCtx, i + 31); - } - } - } -} -#else -#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x800AF710/Effect_UpdateAll.asm") -#endif - -void Effect_Destroy(GlobalContext* globalCtx, s32 index) { - if (index == 46) { - return; - } - - if (index < 3) { - sEffTable.sparks[index].base.active = 0; - sEffInfoTable[0].destroy(&sEffTable.sparks[index].params); - return; - } - - index -= 3; - if (index < 25) { - sEffTable.blures[index].base.active = 0; - sEffInfoTable[1].destroy(&sEffTable.blures[index].params); - return; - } - - index -= 25; - if (index < 3) { - sEffTable.shieldParticles[index].base.active = 0; - sEffInfoTable[3].destroy(&sEffTable.shieldParticles[index].params); - return; - } - - index -= 3; - if (index < 15) { - sEffTable.tireMarks[index].base.active = 0; - sEffInfoTable[4].destroy(&sEffTable.tireMarks[index].params); - return; - } -} - -void Effect_DestroyAll(GlobalContext* globalCtx) { - s32 i; - - for (i = 0; i < 3; i++) { - sEffTable.sparks[i].base.active = 0; - sEffInfoTable[0].destroy(&sEffTable.sparks[i].params); - } - - for (i = 0; i < 25; i++) { - sEffTable.blures[i].base.active = 0; - sEffInfoTable[1].destroy(&sEffTable.blures[i].params); - } - - for (i = 0; i < 3; i++) { - sEffTable.shieldParticles[i].base.active = 0; - sEffInfoTable[3].destroy(&sEffTable.shieldParticles[i].params); - } - - for (i = 0; i < 15; i++) { - sEffTable.tireMarks[i].base.active = 0; - sEffInfoTable[4].destroy(&sEffTable.tireMarks[i].params); - } -} diff --git a/src/code/game.c b/src/code/game.c index 8b97cef83..2100f99a9 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -67,19 +67,19 @@ void Game_Nop80173534(GameState* ctxt) { ; } -void GameState_Draw(GameState* ctxt, GraphicsContext* gCtxt) { +void GameState_Draw(GameState* ctxt, GraphicsContext* gfxCtx) { Gfx* nextDisplayList; Gfx* _polyOpa; // Unused vars impact regalloc Gfx* temp_t2; u32 temp_v1; - _polyOpa = gCtxt->polyOpa.p; - nextDisplayList = Graph_GfxPlusOne(gCtxt->polyOpa.p); - gSPDisplayList(gCtxt->overlay.p++, nextDisplayList); + _polyOpa = gfxCtx->polyOpa.p; + nextDisplayList = Graph_GfxPlusOne(gfxCtx->polyOpa.p); + gSPDisplayList(gfxCtx->overlay.p++, nextDisplayList); if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) { - GameState_SetFBFilter(&nextDisplayList, (u32)gCtxt->zbuffer); + GameState_SetFBFilter(&nextDisplayList, (u32)gfxCtx->zbuffer); } if (R_ENABLE_ARENA_DBG < 0) { @@ -88,36 +88,36 @@ void GameState_Draw(GameState* ctxt, GraphicsContext* gCtxt) { gSPEndDisplayList(nextDisplayList++); Graph_BranchDlist(_polyOpa, nextDisplayList); - gCtxt->polyOpa.p = nextDisplayList; + gfxCtx->polyOpa.p = nextDisplayList; lblUnk:; // Label prevents reordering, if(1) around the above block don't seem to help unlike in OoT - func_800E9F78(gCtxt); + func_800E9F78(gfxCtx); if (R_ENABLE_ARENA_DBG != 0) { - SpeedMeter_DrawTimeEntries(&D_801F7FF0, gCtxt); - SpeedMeter_DrawAllocEntries(&D_801F7FF0, gCtxt, ctxt); + SpeedMeter_DrawTimeEntries(&D_801F7FF0, gfxCtx); + SpeedMeter_DrawAllocEntries(&D_801F7FF0, gfxCtx, ctxt); } } -void Game_ResetSegments(GraphicsContext* gCtxt) { - gSPSegment(gCtxt->polyOpa.p++, 0, 0); - gSPSegment(gCtxt->polyOpa.p++, 0xF, gCtxt->framebuffer); - gSPSegment(gCtxt->polyXlu.p++, 0, 0); - gSPSegment(gCtxt->polyXlu.p++, 0xF, gCtxt->framebuffer); - gSPSegment(gCtxt->overlay.p++, 0, 0); - gSPSegment(gCtxt->overlay.p++, 0xF, gCtxt->framebuffer); +void Game_ResetSegments(GraphicsContext* gfxCtx) { + gSPSegment(gfxCtx->polyOpa.p++, 0, 0); + gSPSegment(gfxCtx->polyOpa.p++, 0xF, gfxCtx->framebuffer); + gSPSegment(gfxCtx->polyXlu.p++, 0, 0); + gSPSegment(gfxCtx->polyXlu.p++, 0xF, gfxCtx->framebuffer); + gSPSegment(gfxCtx->overlay.p++, 0, 0); + gSPSegment(gfxCtx->overlay.p++, 0xF, gfxCtx->framebuffer); } -void func_801736DC(GraphicsContext* gCtxt) { +void func_801736DC(GraphicsContext* gfxCtx) { Gfx* nextDisplayList; Gfx* _polyOpa; - nextDisplayList = Graph_GfxPlusOne(_polyOpa = gCtxt->polyOpa.p); - gSPDisplayList(gCtxt->overlay.p++, nextDisplayList); + nextDisplayList = Graph_GfxPlusOne(_polyOpa = gfxCtx->polyOpa.p); + gSPDisplayList(gfxCtx->overlay.p++, nextDisplayList); gSPEndDisplayList(nextDisplayList++); Graph_BranchDlist(_polyOpa, nextDisplayList); - gCtxt->polyOpa.p = nextDisplayList; + gfxCtx->polyOpa.p = nextDisplayList; } void Game_UpdateInput(GameState* ctxt) { @@ -185,16 +185,16 @@ void Game_ResizeHeap(GameState* ctxt, u32 size) { } } -void Game_StateInit(GameState* ctxt, GameStateFunc gameStateInit, GraphicsContext* gCtxt) { - ctxt->gfxCtx = gCtxt; +void Game_StateInit(GameState* ctxt, GameStateFunc gameStateInit, GraphicsContext* gfxCtx) { + ctxt->gfxCtx = gfxCtx; ctxt->frames = 0U; ctxt->main = NULL; ctxt->destroy = NULL; ctxt->running = 1; - gCtxt->unk274 = D_801FBB88; - gCtxt->viConfigFeatures = gViConfigFeatures; - gCtxt->viConfigXScale = gViConfigXScale; - gCtxt->viConfigYScale = gViConfigYScale; + gfxCtx->unk274 = D_801FBB88; + gfxCtx->viConfigFeatures = gViConfigFeatures; + gfxCtx->viConfigXScale = gViConfigXScale; + gfxCtx->viConfigYScale = gViConfigYScale; ctxt->nextGameStateInit = NULL; ctxt->nextGameStateSize = 0U; diff --git a/src/code/z_effect.c b/src/code/z_effect.c new file mode 100644 index 000000000..d857dec90 --- /dev/null +++ b/src/code/z_effect.c @@ -0,0 +1,314 @@ +#include +#include + +EffInfo sEffInfoTable[] = { + { + sizeof(EffSparkParams), + (eff_init_func)EffectSpark_Init, + (eff_destroy_func)EffectSpark_Destroy, + (eff_update_func)EffectSpark_Update, + (eff_draw_func)EffectSpark_Draw, + }, + { + sizeof(EffectBlure), + (eff_init_func)EffectBlure_Init1, + (eff_destroy_func)EffectBlure_Destroy, + (eff_update_func)EffectBlure_Update, + (eff_draw_func)EffectBlure_Draw, + }, + { + sizeof(EffectBlure), + (eff_init_func)EffectBlure_Init2, + (eff_destroy_func)EffectBlure_Destroy, + (eff_update_func)EffectBlure_Update, + (eff_draw_func)EffectBlure_Draw, + }, + { + sizeof(EffShieldParticleParams), + (eff_init_func)EffectShieldParticle_Init, + (eff_destroy_func)EffectShieldParticle_Destroy, + (eff_update_func)EffectShieldParticle_Update, + (eff_draw_func)EffectShieldParticle_Draw, + }, + { + sizeof(EffTireMarkParams), + (eff_init_func)EffectTireMark_Init, + (eff_destroy_func)EffectTireMark_Destroy, + (eff_update_func)EffectTireMark_Update, + (eff_draw_func)EffectTireMark_Draw, + }, +}; + +GlobalContext* Effect_GetContext(void) { + return sEffTable.globalCtx; +} + +void* Effect_GetParams(s32 index) { + if (index == TOTAL_EFFECT_COUNT) { + return NULL; + } + + if (index < SPARK_COUNT) { + if (sEffTable.sparks[index].base.active == 1) { + return &sEffTable.sparks[index].params; + } else { + return NULL; + } + } + + index -= SPARK_COUNT; + if (index < BLURE_COUNT) { + if (sEffTable.blures[index].base.active == 1) { + return &sEffTable.blures[index].params; + } else { + return NULL; + } + } + + index -= BLURE_COUNT; + if (index < SHIELD_PARTICLE_COUNT) { + if (sEffTable.shieldParticles[index].base.active == 1) { + return &sEffTable.shieldParticles[index].params; + } else { + return NULL; + } + } + + index -= SHIELD_PARTICLE_COUNT; + if (index < TIRE_MARK_COUNT) { + if (sEffTable.tireMarks[index].base.active == 1) { + return &sEffTable.tireMarks[index].params; + } else { + return NULL; + } + } + + return NULL; +} + +void Effect_InitCommon(EffCommon* common) { + common->active = 0; + common->unk1 = 0; + common->unk2 = 0; +} + +void Effect_Init(GlobalContext* globalCtx) { + s32 i; + + for (i = 0; i < SPARK_COUNT; i++) { + Effect_InitCommon(&sEffTable.sparks[i].base); + } + + for (i = 0; i < BLURE_COUNT; i++) { + Effect_InitCommon(&sEffTable.blures[i].base); + } + + //! @bug This is probably supposed to loop over shieldParticles, not blures again + for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { + Effect_InitCommon(&sEffTable.blures[i].base); + } + + for (i = 0; i < TIRE_MARK_COUNT; i++) { + Effect_InitCommon(&sEffTable.tireMarks[i].base); + } + + sEffTable.globalCtx = globalCtx; +} + +void Effect_Add(GlobalContext* globalCtx, s32* index, s32 type, u8 param_4, u8 param_5, void* initParams) { + u32 slotFound; + s32 i; + void* params; + EffCommon* common; + + params = NULL; + *index = TOTAL_EFFECT_COUNT; + common = NULL; + + if (func_8016A01C(globalCtx) != 1) { + slotFound = 0; + switch (type) { + case 0: + for (i = 0; i < SPARK_COUNT; i++) { + if (sEffTable.sparks[i].base.active == 0) { + slotFound = 1; + *index = i; + params = &sEffTable.sparks[i].params; + common = &sEffTable.sparks[i].base; + break; + } + } + break; + case 1: + case 2: + for (i = 0; i < BLURE_COUNT; i++) { + if (sEffTable.blures[i].base.active == 0) { + slotFound = 1; + *index = i + 3; + params = &sEffTable.blures[i].params; + common = &sEffTable.blures[i].base; + break; + } + } + break; + case 3: + for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { + if (sEffTable.shieldParticles[i].base.active == 0) { + slotFound = 1; + *index = i + 28; + params = &sEffTable.shieldParticles[i].params; + common = &sEffTable.shieldParticles[i].base; + break; + } + } + break; + case 4: + for (i = 0; i < TIRE_MARK_COUNT; i++) { + if (sEffTable.tireMarks[i].base.active == 0) { + slotFound = 1; + *index = i + 31; + params = &sEffTable.tireMarks[i].params; + common = &sEffTable.tireMarks[i].base; + break; + } + } + break; + } + + if (slotFound) { + sEffInfoTable[type].init(params, initParams); + common->unk2 = param_4; + common->unk1 = param_5; + common->active = 1; + } + } +} + +void Effect_DrawAll(GraphicsContext* gfxCtx) { + s32 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); + } + } + + for (i = 0; i < BLURE_COUNT; i++) { + if (1) { if (gfxCtx) {} } // necessary to match + if (sEffTable.blures[i].base.active) { + sEffInfoTable[1].draw(&sEffTable.blures[i].params, gfxCtx); + } + } + + for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { + if (1) {} // necessary to match + if (sEffTable.shieldParticles[i].base.active) { + sEffInfoTable[3].draw(&sEffTable.shieldParticles[i].params, gfxCtx); + } + } + + if (1) {} // necessary to match + for (i = 0; i < TIRE_MARK_COUNT; i++) { + if (sEffTable.tireMarks[i].base.active) { + sEffInfoTable[4].draw(&sEffTable.tireMarks[i].params, gfxCtx); + } + } +} + +void Effect_UpdateAll(GlobalContext* globalCtx) { + s32 i; + + for (i = 0; i < SPARK_COUNT; i++) { + if (1) {} // necessary to match + if (sEffTable.sparks[i].base.active) { + if (sEffInfoTable[0].update(&sEffTable.sparks[i].params) == 1) { + Effect_Destroy(globalCtx, i); + } + } + } + + for (i = 0; i < BLURE_COUNT; i++) { + if (1) {} // necessary to match + if (sEffTable.blures[i].base.active) { + if (sEffInfoTable[1].update(&sEffTable.blures[i].params) == 1) { + Effect_Destroy(globalCtx, i + 3); + } + } + } + + for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { + if (1) {} // necessary to match + if (sEffTable.shieldParticles[i].base.active) { + if (sEffInfoTable[3].update(&sEffTable.shieldParticles[i].params) == 1) { + Effect_Destroy(globalCtx, i + 28); + } + } + } + + for (i = 0; i < TIRE_MARK_COUNT; i++) { + if (1) {} // necessary to match + if (sEffTable.tireMarks[i].base.active) { + if (sEffInfoTable[4].update(&sEffTable.tireMarks[i].params) == 1) { + Effect_Destroy(globalCtx, i + 31); + } + } + } +} + +void Effect_Destroy(GlobalContext* globalCtx, s32 index) { + if (index == TOTAL_EFFECT_COUNT) { + return; + } + + if (index < SPARK_COUNT) { + sEffTable.sparks[index].base.active = 0; + sEffInfoTable[0].destroy(&sEffTable.sparks[index].params); + return; + } + + index -= SPARK_COUNT; + if (index < BLURE_COUNT) { + sEffTable.blures[index].base.active = 0; + sEffInfoTable[1].destroy(&sEffTable.blures[index].params); + return; + } + + index -= BLURE_COUNT; + if (index < SHIELD_PARTICLE_COUNT) { + sEffTable.shieldParticles[index].base.active = 0; + sEffInfoTable[3].destroy(&sEffTable.shieldParticles[index].params); + return; + } + + index -= SHIELD_PARTICLE_COUNT; + if (index < TIRE_MARK_COUNT) { + sEffTable.tireMarks[index].base.active = 0; + sEffInfoTable[4].destroy(&sEffTable.tireMarks[index].params); + return; + } +} + +void Effect_DestroyAll(GlobalContext* globalCtx) { + s32 i; + + for (i = 0; i < SPARK_COUNT; i++) { + sEffTable.sparks[i].base.active = 0; + sEffInfoTable[0].destroy(&sEffTable.sparks[i].params); + } + + for (i = 0; i < BLURE_COUNT; i++) { + sEffTable.blures[i].base.active = 0; + sEffInfoTable[1].destroy(&sEffTable.blures[i].params); + } + + for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { + sEffTable.shieldParticles[i].base.active = 0; + sEffInfoTable[3].destroy(&sEffTable.shieldParticles[i].params); + } + + for (i = 0; i < TIRE_MARK_COUNT; i++) { + sEffTable.tireMarks[i].base.active = 0; + sEffInfoTable[4].destroy(&sEffTable.tireMarks[i].params); + } +} diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index ba4e532d2..3c955f155 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -843,36 +843,36 @@ Gfx* func_8012C014(Gfx* gfx) { return gfx; } -void func_8012C058(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x3A]); +void func_8012C058(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x3A]); } -void func_8012C080(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x39]); +void func_8012C080(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x39]); } -void func_8012C0A8(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x32]); +void func_8012C0A8(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x32]); } -void func_8012C0D0(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x33]); +void func_8012C0D0(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x33]); } -void func_8012C0F8(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x34]); +void func_8012C0F8(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x34]); } -void func_8012C120(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x35]); +void func_8012C120(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x35]); } -void func_8012C148(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x36]); +void func_8012C148(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x36]); } -void func_8012C170(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x37]); +void func_8012C170(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x37]); } Gfx* func_8012C198(Gfx* gfx) { @@ -880,8 +880,8 @@ Gfx* func_8012C198(Gfx* gfx) { return gfx; } -void func_8012C1C0(GraphicsContext* gCtxt) { - gCtxt->polyOpa.p = func_8012C198(gCtxt->polyOpa.p); +void func_8012C1C0(GraphicsContext* gfxCtx) { + gfxCtx->polyOpa.p = func_8012C198(gfxCtx->polyOpa.p); } Gfx* func_8012C1EC(Gfx* gfx) { @@ -889,20 +889,20 @@ Gfx* func_8012C1EC(Gfx* gfx) { return gfx; } -void func_8012C214(GraphicsContext* gCtxt) { - gCtxt->polyOpa.p = func_8012C1EC(gCtxt->polyOpa.p); +void func_8012C214(GraphicsContext* gfxCtx) { + gfxCtx->polyOpa.p = func_8012C1EC(gfxCtx->polyOpa.p); } -void func_8012C240(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x19]); +void func_8012C240(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]); } void func_8012C268(GlobalContext* globalCtx) { func_8012C28C(globalCtx->state.gfxCtx); } -void func_8012C28C(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x19]); +void func_8012C28C(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x19]); } Gfx* func_8012C2B4(Gfx* gfx) { @@ -910,8 +910,8 @@ Gfx* func_8012C2B4(Gfx* gfx) { return gfx; } -void func_8012C2DC(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x19]); +void func_8012C2DC(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]); } Gfx* func_8012C304(Gfx* gfx) { @@ -919,16 +919,16 @@ Gfx* func_8012C304(Gfx* gfx) { return gfx; } -void func_8012C32C(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x1F]); +void func_8012C32C(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1F]); } -void func_8012C354(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x20]); +void func_8012C354(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x20]); } -void func_8012C37C(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x21]); +void func_8012C37C(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x21]); } Gfx* func_8012C3A4(Gfx* gfx) { @@ -941,20 +941,20 @@ Gfx* func_8012C3CC(Gfx* gfx) { return gfx; } -void func_8012C3F4(GraphicsContext* gCtxt) { - gCtxt->polyOpa.p = func_8012C3CC(gCtxt->polyOpa.p); +void func_8012C3F4(GraphicsContext* gfxCtx) { + gfxCtx->polyOpa.p = func_8012C3CC(gfxCtx->polyOpa.p); } -void func_8012C420(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x23]); +void func_8012C420(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x23]); } -void func_8012C448(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x2C]); +void func_8012C448(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x2C]); } -void func_8012C470(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x24]); +void func_8012C470(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x24]); } Gfx* func_8012C498(Gfx* gfx) { @@ -962,36 +962,36 @@ Gfx* func_8012C498(Gfx* gfx) { return gfx; } -void func_8012C4C0(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x1C]); +void func_8012C4C0(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1C]); } -void func_8012C4E8(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x2B]); +void func_8012C4E8(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2B]); } -void func_8012C510(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x2D]); +void func_8012C510(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2D]); } -void func_8012C538(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->overlay.p++, &sSetupDL[6 * 0x2E]); +void func_8012C538(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->overlay.p++, &sSetupDL[6 * 0x2E]); } -void func_8012C560(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x26]); +void func_8012C560(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x26]); } -void func_8012C588(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x4]); +void func_8012C588(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x4]); } -void func_8012C5B0(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x25]); +void func_8012C5B0(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x25]); } -void func_8012C5D8(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x2]); +void func_8012C5D8(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2]); } Gfx* func_8012C600(Gfx* gfx) { @@ -999,12 +999,12 @@ Gfx* func_8012C600(Gfx* gfx) { return gfx; } -void func_8012C628(GraphicsContext* gCtxt) { - gCtxt->polyOpa.p = func_8012C600(gCtxt->polyOpa.p); +void func_8012C628(GraphicsContext* gfxCtx) { + gfxCtx->polyOpa.p = func_8012C600(gfxCtx->polyOpa.p); } -void func_8012C654(GraphicsContext* gCtxt) { - gCtxt->overlay.p = func_8012C600(gCtxt->overlay.p); +void func_8012C654(GraphicsContext* gfxCtx) { + gfxCtx->overlay.p = func_8012C600(gfxCtx->overlay.p); } void func_8012C680(Gfx** gfxp) { @@ -1013,16 +1013,16 @@ void func_8012C680(Gfx** gfxp) { *gfxp = gfx; } -void func_8012C6AC(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x28]); +void func_8012C6AC(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x28]); } -void func_8012C6D4(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyOpa.p++, &sSetupDL[6 * 0x29]); +void func_8012C6D4(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x29]); } -void func_8012C6FC(GraphicsContext* gCtxt) { - gSPDisplayList(gCtxt->polyXlu.p++, &sSetupDL[6 * 0x2F]); +void func_8012C6FC(GraphicsContext* gfxCtx) { + gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x2F]); } Gfx* func_8012C724(Gfx* gfx) { @@ -1225,20 +1225,20 @@ Gfx* Gfx_PrimColor(GraphicsContext* gfxCtx, s32 lodfrac, s32 r, s32 g, s32 b, s3 #ifdef NON_MATCHING // regalloc, some reorderings -void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u8 b) { +void func_8012CF0C(GraphicsContext* gfxCtx, s32 iParm2, s32 iParm3, u8 r, u8 g, u8 b) { s32 i; Gfx* gfx; gSegments[0] = 0; gSegments[14] = (u32)graphDlEntry; - gSegments[15] = (u32)gCtxt->framebuffer; + gSegments[15] = (u32)gfxCtx->framebuffer; gfx = graphDlEntry + 0x16; gSPDisplayList(gfx + 0, &D_0E000140); gSPDisplayList(gfx + 1, D_801C1CA0); gDPSetColorImage(gfx + 2, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, 0x0F000000); - if (gCtxt->zbuffer != NULL) { - gDPSetDepthImage(gfx + 3, gCtxt->zbuffer); + if (gfxCtx->zbuffer != NULL) { + gDPSetDepthImage(gfx + 3, gfxCtx->zbuffer); } else { gDPSetDepthImage(gfx + 3, 0x0F000000); } @@ -1249,16 +1249,16 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u gSPEndDisplayList(gfx + 1); gfx = graphDlEntry + 0x9; - if (gCtxt->zbuffer == NULL) { + if (gfxCtx->zbuffer == NULL) { gSPEndDisplayList(gfx + 0); } else { - gDPSetColorImage(gfx + 0, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, gCtxt->zbuffer); + gDPSetColorImage(gfx + 0, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, gfxCtx->zbuffer); gDPPipeSync(gfx + 1); gDPSetCycleType(gfx + 2, G_CYC_FILL); gDPSetRenderMode(gfx + 3, G_RM_NOOP, G_RM_NOOP2); gDPSetFillColor(gfx + 4, (GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0) << 16) | GPACK_RGBA5551(0xFF, 0xFF, 0xF0, 0)); gSPDisplayList(gfx + 5, &D_0E0002C8); - gDPSetColorImage(gfx + 6, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, gCtxt->zbuffer); + gDPSetColorImage(gfx + 6, G_IM_FMT_RGBA, G_IM_SIZ_16b, D_801FBBCC, gfxCtx->zbuffer); gSPEndDisplayList(gfx + 7); } @@ -1289,27 +1289,27 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u } gSPEndDisplayList(gfx + i); - gSPDisplayList(gCtxt->polyOpa.p++, graphDlEntry + 0x16); - gSPDisplayList(gCtxt->polyXlu.p++, graphDlEntry + 0x16); - gSPDisplayList(gCtxt->overlay.p++, graphDlEntry + 0x16); - gSPDisplayList(gCtxt->unk1B8.p++, graphDlEntry + 0x16); + gSPDisplayList(gfxCtx->polyOpa.p++, graphDlEntry + 0x16); + gSPDisplayList(gfxCtx->polyXlu.p++, graphDlEntry + 0x16); + gSPDisplayList(gfxCtx->overlay.p++, graphDlEntry + 0x16); + gSPDisplayList(gfxCtx->unk1B8.p++, graphDlEntry + 0x16); if (iParm3) { - gSPDisplayList(gCtxt->polyOpa.p++, &D_0E000048); + gSPDisplayList(gfxCtx->polyOpa.p++, &D_0E000048); } if (iParm2) { - gSPDisplayList(gCtxt->polyOpa.p++, &D_0E000088); + gSPDisplayList(gfxCtx->polyOpa.p++, &D_0E000088); } } #else #pragma GLOBAL_ASM("./asm/non_matchings/code/z_rcp/func_8012CF0C.asm") #endif -void func_8012D374(GraphicsContext* gCtxt, u8 r, u8 g, u8 b) { +void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { if ((R_PAUSE_MENU_MODE < 2) && (D_801F6D10 < 2)) { - func_8012CF0C(gCtxt, 1, 1, r, g, b); + func_8012CF0C(gfxCtx, 1, 1, r, g, b); } else { - func_8012CF0C(gCtxt, 0, 0, r, g, b); + func_8012CF0C(gfxCtx, 0, 0, r, g, b); } } -- cgit v1.2.3