diff options
| author | fig02 <fig02srl@gmail.com> | 2020-06-13 22:59:58 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-13 22:59:58 -0400 |
| commit | 031d946db7134194b03a7b08018944ee0b0db7df (patch) | |
| tree | 5402070e1c3b5fb67284538c4a4e277c3520abf5 /src/code | |
| parent | df3bfbc16885008e7ce69f8a84d1715b13d4029f (diff) | |
z_select decompiled, 1 non matching left (#202)
* First pass z_select
* lots of progress. 2 non matchings and data stuff needed
* match Select_LoadGame
* z_select almost ok, 1 func left
* remove comments
* remove comments and add description
* remove unused flg_set asm
* set_next_gamestate macro
* pr suggestions 1
* pr suggestions 2
* map -> scene
* pr suggestions 3
Co-authored-by: Kelebek1 <eeeedddccc@hotmail.co.uk>
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/flg_set.c | 4 | ||||
| -rw-r--r-- | src/code/game.c | 4 | ||||
| -rw-r--r-- | src/code/gfxprint.c | 4 | ||||
| -rw-r--r-- | src/code/graph.c | 4 | ||||
| -rw-r--r-- | src/code/speed_meter.c | 10 | ||||
| -rw-r--r-- | src/code/z_debug.c | 4 | ||||
| -rw-r--r-- | src/code/z_demo.c | 4 | ||||
| -rw-r--r-- | src/code/z_game_dlftbls.c | 2 | ||||
| -rw-r--r-- | src/code/z_parameter.c | 9 | ||||
| -rw-r--r-- | src/code/z_play.c | 4 | ||||
| -rw-r--r-- | src/code/z_sample.c | 40 |
11 files changed, 38 insertions, 51 deletions
diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 7d0ae5ae1..941c6f803 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -50,7 +50,7 @@ void FlagSet_Update(GlobalContext* globalCtx) { gfx = Graph_GfxPlusOne(polyOpa); gSPDisplayList(gfxCtx->overlay.p++, gfx); - GfxPrint_Ctor(&printer); + GfxPrint_Init(&printer); GfxPrint_Open(&printer, gfx); GfxPrint_SetColor(&printer, 0xFA, 0x32, 0x32, 0xFF); GfxPrint_SetPos(&printer, 4, 13); @@ -137,7 +137,7 @@ void FlagSet_Update(GlobalContext* globalCtx) { } gfx = GfxPrint_Close(&printer); - GfxPrint_Dtor(&printer); + GfxPrint_Destroy(&printer); gSPEndDisplayList(gfx++); Graph_BranchDlist(polyOpa, gfx); gfxCtx->polyOpa.p = gfx; diff --git a/src/code/game.c b/src/code/game.c index 5144c4ac9..2584e0cf5 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -175,11 +175,11 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { } if (R_ENABLE_AUDIO_DBG & 1) { - GfxPrint_Ctor(&printChars); + GfxPrint_Init(&printChars); GfxPrint_Open(&printChars, newDList); func_800EEA50(&printChars); newDList = GfxPrint_Close(&printChars); - GfxPrint_Dtor(&printChars); + GfxPrint_Destroy(&printChars); } if (R_ENABLE_ARENA_DBG < 0) { diff --git a/src/code/gfxprint.c b/src/code/gfxprint.c index 57414bc2c..9b859c212 100644 --- a/src/code/gfxprint.c +++ b/src/code/gfxprint.c @@ -341,7 +341,7 @@ GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size) { return this; } -void GfxPrint_Ctor(GfxPrint* this) { +void GfxPrint_Init(GfxPrint* this) { this->flag &= ~GFXPRINT_OPEN; this->callback = &GfxPrint_Callback; @@ -364,7 +364,7 @@ void GfxPrint_Ctor(GfxPrint* this) { } } -void GfxPrint_Dtor(GfxPrint* this) { +void GfxPrint_Destroy(GfxPrint* this) { } void GfxPrint_Open(GfxPrint* this, Gfx* dlist) { diff --git a/src/code/graph.c b/src/code/graph.c index 789139c5c..60b9f9296 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -112,7 +112,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) { if (gameStateInitFunc == TitleSetup_Init) { return &gGameStateOverlayTable[0]; } - if (gameStateInitFunc == func_80801E44) { + if (gameStateInitFunc == Select_Init) { return &gGameStateOverlayTable[1]; } if (gameStateInitFunc == Title_Init) { @@ -389,7 +389,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { if (D_8012DBC0 && CHECK_PAD(gameState->input[0].press, Z_TRIG) && CHECK_PAD(gameState->input[0].cur, L_TRIG | R_TRIG)) { gSaveContext.gameMode = 0; - SET_NEXT_GAMESTATE(gameState, func_80801E44, char[0x240]); // TODO : SelectContext + SET_NEXT_GAMESTATE(gameState, Select_Init, SelectContext); gameState->running = false; } diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index 0e04fa954..d30b10c46 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -56,7 +56,6 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) { u32 pad2[3]; Gfx* gfx; Gfx* dispRefs[5]; - Viewport viewport; uly = this->y; lry = this->y + 2; @@ -78,8 +77,8 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) { View_Init(&view, gfxCtx); view.flags = 0xA; - VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0); - View_SetViewport(&view, &viewport); + SET_FULLSCREEN_VIEWPORT(&view); + gfx = gfxCtx->overlay.p; func_800AB9EC(&view, 0xF, &gfx); @@ -123,8 +122,6 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC View view; Gfx* gfx; Gfx* dispRefs[5]; - Viewport viewport; - u32 pad2; if (this->maxval == 0) { osSyncPrintf(VT_FGCOL(RED)); @@ -136,9 +133,8 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC View_Init(&view, gfxCtx); view.flags = 0xA; - VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0); + SET_FULLSCREEN_VIEWPORT(&view); - View_SetViewport(&view, &viewport); gfx = gfxCtx->overlay.p; func_800AB9EC(&view, 0xF, &gfx); diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 2d58b91ec..287c83ea2 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -224,7 +224,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) { Gfx* dispRefs[4]; // stores state of GfxCtx next ptrs Graph_OpenDisps(dispRefs, gfxCtx, "../z_debug.c", 628); - GfxPrint_Ctor(&gfxPrint); + GfxPrint_Init(&gfxPrint); sp78 = gfxCtx->polyOpa.p; tempRet = Graph_GfxPlusOne(gfxCtx->polyOpa.p); gSPDisplayList(gfxCtx->overlay.p++, tempRet); @@ -245,5 +245,5 @@ void func_80063D7C(GraphicsContext* gfxCtx) { gfxCtx->polyOpa.p = sp7C; if (0) {} Graph_CloseDisps(dispRefs, gfxCtx, "../z_debug.c", 664); - GfxPrint_Dtor(&gfxPrint); + GfxPrint_Destroy(&gfxPrint); } diff --git a/src/code/z_demo.c b/src/code/z_demo.c index e047aca3b..a5f5867d1 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -59,7 +59,7 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte GfxPrint printer; u8 pad2[8]; - GfxPrint_Ctor(&printer); + GfxPrint_Init(&printer); GfxPrint_Open(&printer, *dlist); GfxPrint_SetPos(&printer, 22, 25); GfxPrint_SetColor(&printer, 255, 255, 55, 32); @@ -70,7 +70,7 @@ void Cutscene_DrawDebugInfo(GlobalContext* globalCtx, Gfx** dlist, CutsceneConte GfxPrint_SetPos(&printer, 4, 26); GfxPrint_Printf(&printer, "%s", "SKIP=(START) or (Cursole Right)"); *dlist = GfxPrint_Close(&printer); - GfxPrint_Dtor(&printer); + GfxPrint_Destroy(&printer); } void func_8006450C(GlobalContext* globalCtx, CutsceneContext* csCtx) { diff --git a/src/code/z_game_dlftbls.c b/src/code/z_game_dlftbls.c index 03241b33f..c7bfa9dd6 100644 --- a/src/code/z_game_dlftbls.c +++ b/src/code/z_game_dlftbls.c @@ -10,7 +10,7 @@ GameStateOverlay gGameStateOverlayTable[] = { GAMESTATE_OVERLAY_INTERNAL(TitleSetup_Init, TitleSetup_Destroy, sizeof(GameState)), - GAMESTATE_OVERLAY(select, func_80801E44, func_80801E0C, 0x240), // TODO : sizeof(SelectContext) + GAMESTATE_OVERLAY(select, Select_Init, Select_Destroy, sizeof(SelectContext)), GAMESTATE_OVERLAY(title, Title_Init, Title_Destroy, sizeof(TitleContext)), GAMESTATE_OVERLAY_INTERNAL(Gameplay_Init, Gameplay_Destroy, sizeof(GlobalContext)), GAMESTATE_OVERLAY(opening, Opening_Init, Opening_Destroy, sizeof(OpeningContext)), diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 9aa14118b..c4a8f5cb2 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -3094,14 +3094,7 @@ void func_8008A8B8(GlobalContext* globalCtx, s32 topY, s32 bottomY, s32 leftX, s } void func_8008A994(InterfaceContext* interfaceCtx) { - Viewport viewport; - - // clang-format off - viewport.bottomY = SCREEN_HEIGHT; viewport.rightX = SCREEN_WIDTH; - viewport.topY = 0; viewport.leftX = 0; - // clang-format on - - View_SetViewport(&interfaceCtx->view, &viewport); + SET_FULLSCREEN_VIEWPORT(&interfaceCtx->view); func_800AB2C4(&interfaceCtx->view); } diff --git a/src/code/z_play.c b/src/code/z_play.c index a98d9076a..66a07154c 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1135,14 +1135,12 @@ void Gameplay_Draw(GlobalContext* globalCtx) { if ((globalCtx->transitionMode == 3) || (globalCtx->transitionMode == 11) || (globalCtx->transitionCtx.transitionType >= 56)) { View view; // 0xA0 - Viewport viewport; // 0x90 View_Init(&view, gfxCtx); view.flags = 2 | 8; - VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0); + SET_FULLSCREEN_VIEWPORT(&view); - View_SetViewport(&view, &viewport); func_800AB9EC(&view, 15, &gfxP); globalCtx->transitionCtx.draw(&globalCtx->transitionCtx.data, &gfxP); } diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 4997f7bbe..3805e4414 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -52,31 +52,31 @@ void Sample_Destroy(SampleContext* this) { void Sample_SetupView(SampleContext* this) { View* view; GraphicsContext* gfxCtx; - Viewport viewport; - Vec3f v1; - Vec3f v2; - Vec3f v3; - + view = &this->view; gfxCtx = this->state.gfxCtx; + View_Init(view, gfxCtx); - - VIEWPORT_INIT(viewport, SCREEN_HEIGHT, SCREEN_WIDTH, 0, 0); - - View_SetViewport(view, &viewport); + SET_FULLSCREEN_VIEWPORT(view); func_800AA460(view, 60, 10, 12800); - v1.x = 0; - v1.y = 0; - v2.x = 0; - v2.y = 0; - v2.z = 0; - v3.x = 0; - v3.z = 0; - v1.z = 3000; - v3.y = 1; - - func_800AA358(view, &v1, &v2, &v3); + { + Vec3f v1; + Vec3f v2; + Vec3f v3; + + v1.x = 0; + v1.y = 0; + v2.x = 0; + v2.y = 0; + v2.z = 0; + v3.x = 0; + v3.z = 0; + v1.z = 3000; + v3.y = 1; + + func_800AA358(view, &v1, &v2, &v3); + } } void Sample_LoadTitleStatic(SampleContext* this) { |
