From 2a2fdf7f3edea4b6ce575eb675e8c3a967371b7c Mon Sep 17 00:00:00 2001 From: Roman971 <32455037+Roman971@users.noreply.github.com> Date: Sun, 30 Aug 2020 01:00:17 +0200 Subject: [PATCH] Introduce OPEN_DISPS/CLOSE_DISPS macros (#360) --- include/macros.h | 48 +- include/ultra64/gbi.h | 4 +- include/z64.h | 3 +- src/code/flg_set.c | 161 +-- src/code/game.c | 81 +- src/code/graph.c | 58 +- src/code/speed_meter.c | 21 +- src/code/z_actor.c | 343 +++--- src/code/z_camera.c | 4 +- src/code/z_cheap_proc.c | 22 +- src/code/z_debug.c | 18 +- src/code/z_debug_display.c | 29 +- src/code/z_demo.c | 15 +- src/code/z_draw.c | 437 ++++--- src/code/z_eff_blure.c | 249 ++-- src/code/z_eff_shield_particle.c | 37 +- src/code/z_eff_spark.c | 36 +- src/code/z_eff_ss_dead.c | 66 +- src/code/z_en_a_keep.c | 12 +- src/code/z_en_item00.c | 55 +- src/code/z_fcurve_data_skelanime.c | 18 +- src/code/z_lifemeter.c | 73 +- src/code/z_map_exp.c | 59 +- src/code/z_map_mark.c | 21 +- src/code/z_moji.c | 33 +- src/code/z_parameter.c | 564 +++++---- src/code/z_play.c | 78 +- src/code/z_player_lib.c | 26 +- src/code/z_prenmi.c | 11 +- src/code/z_rcp.c | 427 +++---- src/code/z_room.c | 109 +- src/code/z_sample.c | 23 +- src/code/z_scene_table.c | 1038 +++++++---------- src/code/z_skelanime.c | 117 +- src/code/z_view.c | 89 +- src/code/z_vr_box_draw.c | 72 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 15 +- .../actors/ovl_Arrow_Fire/z_arrow_fire.c | 35 +- .../actors/ovl_Arrow_Ice/z_arrow_ice.c | 33 +- .../actors/ovl_Arrow_Light/z_arrow_light.c | 35 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c | 2 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 11 +- .../ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c | 10 +- .../ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c | 15 +- src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c | 14 +- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c | 19 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 11 +- .../z_bg_hidan_firewall.c | 19 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c | 10 +- .../z_bg_hidan_rsekizou.c | 23 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 12 +- .../actors/ovl_Bg_Jya_Block/z_bg_jya_block.c | 14 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 28 +- src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c | 17 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 15 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 31 +- .../actors/ovl_Bg_Pushbox/z_bg_pushbox.c | 13 +- .../ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c | 10 +- .../z_bg_spot01_idohashira.c | 11 +- .../z_bg_spot01_idomizu.c | 15 +- .../z_bg_spot01_idosoko.c | 10 +- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 15 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c | 10 +- .../z_bg_spot16_doughnut.c | 47 +- .../z_bg_spot17_bakudankabe.c | 46 +- .../ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c | 18 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 22 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 13 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 16 +- src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 10 +- .../actors/ovl_Demo_Geff/z_demo_geff.c | 19 +- src/overlays/actors/ovl_Demo_Go/z_demo_go.c | 10 +- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 36 +- src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c | 40 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 11 +- .../actors/ovl_Door_Gerudo/z_door_gerudo.c | 10 +- src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c | 19 +- src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c | 17 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 10 +- .../actors/ovl_En_Blkobj/z_en_blkobj.c | 24 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 24 +- src/overlays/actors/ovl_En_Bombf/z_en_bombf.c | 28 +- src/overlays/actors/ovl_En_Boom/z_en_boom.c | 12 +- src/overlays/actors/ovl_En_Bx/z_en_bx.c | 78 +- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 13 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.c | 23 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c | 15 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 50 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 25 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 13 +- .../ovl_En_Ganon_Organ/z_en_ganon_organ.c | 26 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 31 +- src/overlays/actors/ovl_En_Guest/z_en_guest.c | 20 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 35 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 11 +- src/overlays/actors/ovl_En_Light/z_en_light.c | 23 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 13 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 21 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 21 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 12 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.c | 10 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 11 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 46 +- src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 35 +- .../ovl_En_Scene_Change/z_en_scene_change.c | 11 +- .../actors/ovl_En_Skjneedle/z_en_skjneedle.c | 13 +- .../ovl_En_Syateki_Niw/z_en_syateki_niw.c | 44 +- src/overlays/actors/ovl_En_Tana/z_en_tana.c | 28 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 65 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 32 +- .../actors/ovl_En_Yukabyun/z_en_yukabyun.c | 14 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 13 +- src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 48 +- .../actors/ovl_End_Title/z_end_title.c | 176 ++- .../actors/ovl_Item_B_Heart/z_item_b_heart.c | 18 +- .../actors/ovl_Magic_Wind/z_magic_wind.c | 24 +- src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c | 12 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 18 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 12 +- .../actors/ovl_Oceff_Spot/z_oceff_spot.c | 21 +- .../actors/ovl_Oceff_Storm/z_oceff_storm.c | 65 +- .../actors/ovl_Oceff_Wipe/z_oceff_wipe.c | 32 +- .../actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c | 29 +- .../actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c | 30 +- .../actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c | 30 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 22 +- .../ovl_Effect_Ss_Blast/z_eff_ss_blast.c | 19 +- .../ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c | 27 +- .../ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c | 50 +- .../ovl_Effect_Ss_Dust/z_eff_ss_dust.c | 45 +- .../ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c | 23 +- src/overlays/gamestates/ovl_select/z_select.c | 55 +- src/overlays/gamestates/ovl_title/z_title.c | 57 +- tools/permuter_settings.toml | 1 + 134 files changed, 3133 insertions(+), 3775 deletions(-) diff --git a/include/macros.h b/include/macros.h index a21374b15b..381239eaa9 100644 --- a/include/macros.h +++ b/include/macros.h @@ -45,9 +45,7 @@ #define CHECK_QUEST_ITEM(item) (gBitFlags[item] & gSaveContext.questItems) -#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ - (curState)->init = newInit; \ - (curState)->size = sizeof(newStruct); +#define CHECK_PAD(state, combo) (~(state.in.button | ~(combo)) == 0) #define LOG(exp, value, format, file, line) \ do { \ @@ -61,7 +59,37 @@ #define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line) #define LOG_HEX(exp, value, file, line) LOG(exp, value, "%x", file, line) -/* +#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ + (curState)->init = newInit; \ + (curState)->size = sizeof(newStruct) + +#define SET_FULLSCREEN_VIEWPORT(view) \ + { \ + Viewport viewport; \ + viewport.bottomY = SCREEN_HEIGHT; \ + viewport.rightX = SCREEN_WIDTH; \ + viewport.topY = 0; \ + viewport.leftX = 0; \ + View_SetViewport(view, &viewport); \ + } \ + (void)0 + +#define OPEN_DISPS_INNER(gfxCtx, file, line) \ + oGfxCtx = gfxCtx; \ + Graph_OpenDisps(dispRefs, gfxCtx, file, line) + +#define OPEN_DISPS(gfxCtx, file, line) \ + { \ + GraphicsContext* oGfxCtx; \ + Gfx* dispRefs[4]; \ + OPEN_DISPS_INNER(gfxCtx, file, line) + +#define CLOSE_DISPS(gfxCtx, file, line) \ + Graph_CloseDisps(dispRefs, gfxCtx, file, line); \ + } \ + (void)0 + +/** * `x` vertex x * `y` vertex y * `z` vertex z @@ -76,16 +104,4 @@ #define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } } -#define SET_FULLSCREEN_VIEWPORT(view) \ - { \ - Viewport viewport; \ - viewport.bottomY = SCREEN_HEIGHT; \ - viewport.rightX = SCREEN_WIDTH; \ - viewport.topY = 0; \ - viewport.leftX = 0; \ - View_SetViewport(view, &viewport); \ - } - -#define CHECK_PAD(state, combo) (~(state.in.button | ~(combo)) == 0) - #endif diff --git a/include/ultra64/gbi.h b/include/ultra64/gbi.h index 9e821d6d9a..5f58904002 100644 --- a/include/ultra64/gbi.h +++ b/include/ultra64/gbi.h @@ -2634,7 +2634,7 @@ _DW({ \ * Macros to turn texture on/off */ # define gSPTexture(pkt, s, t, level, tile, on) \ -{ \ +_DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = (_SHIFTL(G_TEXTURE,24,8) | \ @@ -2642,7 +2642,7 @@ _DW({ \ _SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | \ _SHIFTL((on),1,7)); \ _g->words.w1 = (_SHIFTL((s),16,16) | _SHIFTL((t),0,16)); \ -} +}) # define gsSPTexture(s, t, level, tile, on) \ { \ (_SHIFTL(G_TEXTURE,24,8) | _SHIFTL(BOWTIE_VAL,16,8) | \ diff --git a/include/z64.h b/include/z64.h index 836518fe34..d7ee81021d 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1208,7 +1208,8 @@ typedef struct GlobalContext { /* 0x000B0 */ void* sceneSegment; /* 0x000B4 */ char unk_B4[0x4]; /* 0x000B8 */ View view; - /* 0x001E0 */ Camera cameras[4]; + /* 0x001E0 */ Camera mainCamera; + /* 0x001E0 */ Camera subCameras[3]; /* 0x00790 */ Camera* cameraPtrs[4]; /* 0x007A0 */ s16 activeCamera; /* 0x007A2 */ s16 nextCamera; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index 9f277f3ebe..966c39ba2d 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -36,115 +36,118 @@ void FlagSet_Update(GlobalContext* globalCtx) { { &gSaveContext.eventInf[2], "event_inf[2]" }, { &gSaveContext.eventInf[3], "event_inf[3]" }, }; - GraphicsContext* gfxCtx; - s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + Input* input = &globalCtx->state.input[0]; Gfx* gfx; Gfx* polyOpa; - Gfx* dispRefs[5]; - GfxPrint printer; - Input* input = &globalCtx->state.input[0]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../flg_set.c", 131); - polyOpa = gfxCtx->polyOpa.p; - gfx = Graph_GfxPlusOne(polyOpa); - gSPDisplayList(gfxCtx->overlay.p++, gfx); + OPEN_DISPS(gfxCtx, "../flg_set.c", 131); - GfxPrint_Init(&printer); - GfxPrint_Open(&printer, gfx); - GfxPrint_SetColor(&printer, 250, 50, 50, 255); - GfxPrint_SetPos(&printer, 4, 13); - GfxPrint_Printf(&printer, entries[entryIdx].name); - GfxPrint_SetPos(&printer, 4, 15); + { + GfxPrint printer; + s32 pad; - for (bitIdx = 15; bitIdx >= 0; bitIdx--) { - if (bitIdx == curBit) { - GfxPrint_SetColor(&printer, 200, 200, 200, 255); - } else { - GfxPrint_SetColor(&printer, 100, 100, 100, 255); + polyOpa = oGfxCtx->polyOpa.p; + gfx = Graph_GfxPlusOne(polyOpa); + gSPDisplayList(oGfxCtx->overlay.p++, gfx); + + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, gfx); + GfxPrint_SetColor(&printer, 250, 50, 50, 255); + GfxPrint_SetPos(&printer, 4, 13); + GfxPrint_Printf(&printer, entries[entryIdx].name); + GfxPrint_SetPos(&printer, 4, 15); + + for (bitIdx = 15; bitIdx >= 0; bitIdx--) { + if (bitIdx == curBit) { + GfxPrint_SetColor(&printer, 200, 200, 200, 255); + } else { + GfxPrint_SetColor(&printer, 100, 100, 100, 255); + } + + if (*entries[entryIdx].value & (1 << bitIdx)) { + GfxPrint_Printf(&printer, "1"); + } else { + GfxPrint_Printf(&printer, "0"); + } + + if ((bitIdx % 4) == 0) { + GfxPrint_Printf(&printer, " "); + } } - if (*entries[entryIdx].value & (1 << bitIdx)) { - GfxPrint_Printf(&printer, "1"); - } else { - GfxPrint_Printf(&printer, "0"); - } - - if ((bitIdx % 4) == 0) { - GfxPrint_Printf(&printer, " "); - } - } - - if (CHECK_PAD(input->press, L_JPAD)) { - timer = 10; - curBit++; - } - if (CHECK_PAD(input->press, R_JPAD)) { - curBit--; - timer = 10; - } - - if (timer == 0) { - if (CHECK_PAD(input->cur, L_JPAD)) { + if (CHECK_PAD(input->press, L_JPAD)) { + timer = 10; curBit++; - timer = 2; } - if (CHECK_PAD(input->cur, R_JPAD)) { + if (CHECK_PAD(input->press, R_JPAD)) { curBit--; - timer = 2; + timer = 10; } - } - curBit %= 16; - if (CHECK_PAD(input->press, U_JPAD)) { - entryIdx--; - if (entryIdx < 0) { - entryIdx = 0; + if (timer == 0) { + if (CHECK_PAD(input->cur, L_JPAD)) { + curBit++; + timer = 2; + } + if (CHECK_PAD(input->cur, R_JPAD)) { + curBit--; + timer = 2; + } } - timer = 10; - } - if (CHECK_PAD(input->press, D_JPAD)) { - timer = 10; - entryIdx++; - if (!entries[entryIdx].value) { - entryIdx--; - } - } - if (timer == 0) { - if (CHECK_PAD(input->cur, U_JPAD)) { + curBit %= 16; + if (CHECK_PAD(input->press, U_JPAD)) { entryIdx--; - timer = 2; if (entryIdx < 0) { entryIdx = 0; } + timer = 10; } - if (CHECK_PAD(input->cur, D_JPAD)) { - timer = 2; + if (CHECK_PAD(input->press, D_JPAD)) { + timer = 10; entryIdx++; if (!entries[entryIdx].value) { entryIdx--; } } - } - if (CHECK_PAD(input->press, A_BUTTON)) { - *entries[entryIdx].value ^= (1 << curBit); - } + if (timer == 0) { + if (CHECK_PAD(input->cur, U_JPAD)) { + entryIdx--; + timer = 2; + if (entryIdx < 0) { + entryIdx = 0; + } + } + if (CHECK_PAD(input->cur, D_JPAD)) { + timer = 2; + entryIdx++; + if (!entries[entryIdx].value) { + entryIdx--; + } + } + } - if (timer != 0) { - timer--; - } + if (CHECK_PAD(input->press, A_BUTTON)) { + *entries[entryIdx].value ^= (1 << curBit); + } - gfx = GfxPrint_Close(&printer); - GfxPrint_Destroy(&printer); - gSPEndDisplayList(gfx++); - Graph_BranchDlist(polyOpa, gfx); - gfxCtx->polyOpa.p = gfx; + if (timer != 0) { + timer--; + } + + gfx = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); + + gSPEndDisplayList(gfx++); + Graph_BranchDlist(polyOpa, gfx); + oGfxCtx->polyOpa.p = gfx; + } if (CHECK_PAD(input->press, L_TRIG)) { globalCtx->pauseCtx.flag = 0; } - Graph_CloseDisps(dispRefs, gfxCtx, "../flg_set.c", 241); + CLOSE_DISPS(gfxCtx, "../flg_set.c", 241); } diff --git a/src/code/game.c b/src/code/game.c index 218672a838..8b53efabf6 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -148,13 +148,11 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfx) { void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { Gfx* newDList; Gfx* polyOpaP; - Gfx* dispRefs[5]; - char pad[0x8]; - GfxPrint printChars; - Graph_OpenDisps(dispRefs, gfxCtx, "../game.c", 746); - newDList = Graph_GfxPlusOne(polyOpaP = gfxCtx->polyOpa.p); - gSPDisplayList(gfxCtx->overlay.p++, newDList); + OPEN_DISPS(gfxCtx, "../game.c", 746); + + newDList = Graph_GfxPlusOne(polyOpaP = oGfxCtx->polyOpa.p); + gSPDisplayList(oGfxCtx->overlay.p++, newDList); if (R_ENABLE_FB_FILTER == 1) { GameState_SetFBFilter(&newDList); @@ -166,14 +164,19 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { } if (R_ENABLE_AUDIO_DBG & 1) { - GfxPrint_Init(&printChars); - GfxPrint_Open(&printChars, newDList); - func_800EEA50(&printChars); - newDList = GfxPrint_Close(&printChars); - GfxPrint_Destroy(&printChars); + s32 pad; + GfxPrint printer; + + GfxPrint_Init(&printer); + GfxPrint_Open(&printer, newDList); + func_800EEA50(&printer); + newDList = GfxPrint_Close(&printer); + GfxPrint_Destroy(&printer); } if (R_ENABLE_ARENA_DBG < 0) { + s32 pad; + DebugArena_Display(); SystemArena_Display(); //% 08x bytes left until the death of Hyrule (game_alloc) @@ -181,13 +184,13 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { R_ENABLE_ARENA_DBG = 0; } - if (1) { - gSPEndDisplayList(newDList++); - Graph_BranchDlist(polyOpaP, newDList); - gfxCtx->polyOpa.p = newDList; - } + gSPEndDisplayList(newDList++); + Graph_BranchDlist(polyOpaP, newDList); + oGfxCtx->polyOpa.p = newDList; - Graph_CloseDisps(dispRefs, gfxCtx, "../game.c", 800); + if (1) {} + + CLOSE_DISPS(gfxCtx, "../game.c", 800); func_80063D7C(gfxCtx); @@ -198,41 +201,37 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { } void GameState_SetFrameBuffer(GraphicsContext* gfxCtx) { - Gfx* dispRef[5]; + OPEN_DISPS(gfxCtx, "../game.c", 814); - Graph_OpenDisps(dispRef, gfxCtx, "../game.c", 814); + gSPSegment(oGfxCtx->polyOpa.p++, 0, 0); + gSPSegment(oGfxCtx->polyOpa.p++, 0xF, gfxCtx->curFrameBuffer); + gSPSegment(oGfxCtx->polyOpa.p++, 0xE, gZBuffer); + gSPSegment(oGfxCtx->polyXlu.p++, 0, 0); + gSPSegment(oGfxCtx->polyXlu.p++, 0xF, gfxCtx->curFrameBuffer); + gSPSegment(oGfxCtx->polyXlu.p++, 0xE, gZBuffer); + gSPSegment(oGfxCtx->overlay.p++, 0, 0); + gSPSegment(oGfxCtx->overlay.p++, 0xF, gfxCtx->curFrameBuffer); + gSPSegment(oGfxCtx->overlay.p++, 0xE, gZBuffer); - gSPSegment(gfxCtx->polyOpa.p++, 0, 0); - gSPSegment(gfxCtx->polyOpa.p++, 0xF, gfxCtx->curFrameBuffer); - gSPSegment(gfxCtx->polyOpa.p++, 0xE, gZBuffer); - gSPSegment(gfxCtx->polyXlu.p++, 0, 0); - gSPSegment(gfxCtx->polyXlu.p++, 0xF, gfxCtx->curFrameBuffer); - gSPSegment(gfxCtx->polyXlu.p++, 0xE, gZBuffer); - gSPSegment(gfxCtx->overlay.p++, 0, 0); - gSPSegment(gfxCtx->overlay.p++, 0xF, gfxCtx->curFrameBuffer); - gSPSegment(gfxCtx->overlay.p++, 0xE, gZBuffer); - - Graph_CloseDisps(dispRef, gfxCtx, "../game.c", 838); + CLOSE_DISPS(gfxCtx, "../game.c", 838); } void func_800C49F4(GraphicsContext* gfxCtx) { Gfx* newDlist; Gfx* polyOpaP; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../game.c", 846); + OPEN_DISPS(gfxCtx, "../game.c", 846); - newDlist = Graph_GfxPlusOne(polyOpaP = gfxCtx->polyOpa.p); - gSPDisplayList(gfxCtx->overlay.p++, newDlist); + newDlist = Graph_GfxPlusOne(polyOpaP = oGfxCtx->polyOpa.p); + gSPDisplayList(oGfxCtx->overlay.p++, newDlist); - // necessary to match - if (1) { - gSPEndDisplayList(newDlist++); - Graph_BranchDlist(polyOpaP, newDlist); - gfxCtx->polyOpa.p = newDlist; - } + gSPEndDisplayList(newDlist++); + Graph_BranchDlist(polyOpaP, newDlist); + oGfxCtx->polyOpa.p = newDlist; - Graph_CloseDisps(dispRefs, gfxCtx, "../game.c", 865); + if (1) {} + + CLOSE_DISPS(gfxCtx, "../game.c", 865); } void GameState_ReqPadData(GameState* gameState) { diff --git a/src/code/graph.c b/src/code/graph.c index 0af06f1165..dc958ff005 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -221,12 +221,9 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { task->output_buff_size = (u64*)((u8*)gGfxSPTaskOutputBuffer + sizeof(gGfxSPTaskOutputBuffer)); task->data_ptr = (u64*)gfxCtx->workBuffer; - { - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../graph.c", 828); - task->data_size = (u32)gfxCtx->work.p - (u32)gfxCtx->workBuffer; - Graph_CloseDisps(dispRefs, gfxCtx, "../graph.c", 830); - } + OPEN_DISPS(gfxCtx, "../graph.c", 828); + task->data_size = (u32)oGfxCtx->work.p - (u32)gfxCtx->workBuffer; + CLOSE_DISPS(gfxCtx, "../graph.c", 830); { s32 pad2; } // Necessary to match stack usage @@ -271,46 +268,37 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gameState->unk_A0 = 0; Graph_InitTHGA(gfxCtx); - { - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../graph.c", 966); + OPEN_DISPS(gfxCtx, "../graph.c", 966); - gDPNoOpString(gfxCtx->work.p++, "WORK_DISP 開始", 0); - gDPNoOpString(gfxCtx->polyOpa.p++, "POLY_OPA_DISP 開始", 0); - gDPNoOpString(gfxCtx->polyXlu.p++, "POLY_XLU_DISP 開始", 0); - gDPNoOpString(gfxCtx->overlay.p++, "OVERLAY_DISP 開始", 0); + gDPNoOpString(oGfxCtx->work.p++, "WORK_DISP 開始", 0); + gDPNoOpString(oGfxCtx->polyOpa.p++, "POLY_OPA_DISP 開始", 0); + gDPNoOpString(oGfxCtx->polyXlu.p++, "POLY_XLU_DISP 開始", 0); + gDPNoOpString(oGfxCtx->overlay.p++, "OVERLAY_DISP 開始", 0); - Graph_CloseDisps(dispRefs, gfxCtx, "../graph.c", 975); - } + CLOSE_DISPS(gfxCtx, "../graph.c", 975); GameState_ReqPadData(gameState); GameState_Update(gameState); - { - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../graph.c", 987); + OPEN_DISPS(gfxCtx, "../graph.c", 987); - gDPNoOpString(gfxCtx->work.p++, "WORK_DISP 終了", 0); - gDPNoOpString(gfxCtx->polyOpa.p++, "POLY_OPA_DISP 終了", 0); - gDPNoOpString(gfxCtx->polyXlu.p++, "POLY_XLU_DISP 終了", 0); - gDPNoOpString(gfxCtx->overlay.p++, "OVERLAY_DISP 終了", 0); + gDPNoOpString(oGfxCtx->work.p++, "WORK_DISP 終了", 0); + gDPNoOpString(oGfxCtx->polyOpa.p++, "POLY_OPA_DISP 終了", 0); + gDPNoOpString(oGfxCtx->polyXlu.p++, "POLY_XLU_DISP 終了", 0); + gDPNoOpString(oGfxCtx->overlay.p++, "OVERLAY_DISP 終了", 0); - Graph_CloseDisps(dispRefs, gfxCtx, "../graph.c", 996); - } + CLOSE_DISPS(gfxCtx, "../graph.c", 996); - { - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../graph.c", 999); + OPEN_DISPS(gfxCtx, "../graph.c", 999); - gSPBranchList(gfxCtx->work.p++, gfxCtx->polyOpaBuffer); - gSPBranchList(gfxCtx->polyOpa.p++, gfxCtx->polyXluBuffer); - gSPBranchList(gfxCtx->polyXlu.p++, gfxCtx->overlayBuffer); - gDPPipeSync(gfxCtx->overlay.p++); - gDPFullSync(gfxCtx->overlay.p++); - gSPEndDisplayList(gfxCtx->overlay.p++); + gSPBranchList(oGfxCtx->work.p++, gfxCtx->polyOpaBuffer); + gSPBranchList(oGfxCtx->polyOpa.p++, gfxCtx->polyXluBuffer); + gSPBranchList(oGfxCtx->polyXlu.p++, gfxCtx->overlayBuffer); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPFullSync(oGfxCtx->overlay.p++); + gSPEndDisplayList(oGfxCtx->overlay.p++); - Graph_CloseDisps(dispRefs, gfxCtx, "../graph.c", 1028); - } + CLOSE_DISPS(gfxCtx, "../graph.c", 1028); if (HREG(80) == 10 && HREG(93) == 2) { HREG(80) = 7; diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index 18672eb77b..24b4e8d651 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -52,14 +52,13 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) { View view; u32 pad2[3]; Gfx* gfx; - Gfx* dispRefs[5]; uly = this->y; lry = this->y + 2; - Graph_OpenDisps(dispRefs, gfxCtx, "../speed_meter.c", 225); + OPEN_DISPS(gfxCtx, "../speed_meter.c", 225); - /*! @bug if gIrqMgrRetraceTime is 0, the function won't call Graph_CloseDisps */ + /*! @bug if gIrqMgrRetraceTime is 0, CLOSE_DISPS will never be reached */ if (gIrqMgrRetraceTime == 0) { return; } @@ -76,7 +75,7 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) { SET_FULLSCREEN_VIEWPORT(&view); - gfx = gfxCtx->overlay.p; + gfx = oGfxCtx->overlay.p; func_800AB9EC(&view, 0xF, &gfx); gDPPipeSync(gfx++); @@ -98,8 +97,9 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) { } gDPPipeSync(gfx++); - gfxCtx->overlay.p = gfx; - Graph_CloseDisps(dispRefs, gfxCtx, "../speed_meter.c", 276); + oGfxCtx->overlay.p = gfx; + + CLOSE_DISPS(gfxCtx, "../speed_meter.c", 276); } void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* this, u32 maxval, u32 val, u16 backColor, u16 foreColor, u32 ulx, @@ -118,21 +118,20 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC s32 usedOff; View view; Gfx* gfx; - Gfx* dispRefs[5]; if (this->maxval == 0) { osSyncPrintf(VT_FGCOL(RED)); LOG_NUM("this->maxval", this->maxval, "../speed_meter.c", 313); osSyncPrintf(VT_RST); } else { - Graph_OpenDisps(dispRefs, gfxCtx, "../speed_meter.c", 318); + OPEN_DISPS(gfxCtx, "../speed_meter.c", 318); View_Init(&view, gfxCtx); view.flags = 0xA; SET_FULLSCREEN_VIEWPORT(&view); - gfx = gfxCtx->overlay.p; + gfx = oGfxCtx->overlay.p; func_800AB9EC(&view, 0xF, &gfx); gDPPipeSync(gfx++); @@ -147,8 +146,8 @@ void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxC gDPPipeSync(gfx++); - gfxCtx->overlay.p = gfx; - Graph_CloseDisps(dispRefs, gfxCtx, "../speed_meter.c", 339); + oGfxCtx->overlay.p = gfx; + CLOSE_DISPS(gfxCtx, "../speed_meter.c", 339); } } diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 5f26570d6e..6905dc4f32 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -16,29 +16,26 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global f32 temp1; f32 temp2; MtxF sp60; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (actor->floorPoly != NULL) { temp1 = actor->posRot.pos.y - actor->groundY; if (temp1 >= -50.0f && temp1 < 500.0f) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 1553); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1553); - gfxCtx->polyOpa.p = Gfx_CallSetupDL(gfxCtx->polyOpa.p, 0x2C); + oGfxCtx->polyOpa.p = Gfx_CallSetupDL(oGfxCtx->polyOpa.p, 0x2C); - gDPSetCombineLERP(gfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, - 0, COMBINED); + gDPSetCombineLERP(oGfxCtx->polyOpa.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, + 0, 0, COMBINED); temp1 = (temp1 < 0.0f) ? 0.0f : ((temp1 > 150.0f) ? 150.0f : temp1); temp2 = 1.0f - (temp1 * (1.f / 350)); if (color != NULL) { - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, color->r, color->g, color->b, + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, color->r, color->g, color->b, (u32)(actor->shape.unk_14 * temp2) & 0xFF); } else { - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, (u32)(actor->shape.unk_14 * temp2) & 0xFF); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, (u32)(actor->shape.unk_14 * temp2) & 0xFF); } func_80038A28(actor->floorPoly, actor->posRot.pos.x, actor->groundY, actor->posRot.pos.z, &sp60); @@ -51,11 +48,11 @@ void func_8002B200(Actor* actor, LightMapper* lightMapper, GlobalContext* global temp2 = (1.0f - (temp1 * (1.f / 350))) * actor->shape.unk_10; Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1588), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1588), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dlist); + gSPDisplayList(oGfxCtx->polyOpa.p++, dlist); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 1594); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1594); } } } @@ -75,13 +72,13 @@ void ActorShadow_DrawFunc_Squiggly(Actor* actor, LightMapper* lightMapper, Globa } void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + s32 pad1; f32 sp58; - Gfx* dispRefs[7]; + s32 pad2[2]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 1661); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1661); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, (u32)(((arg3 * 0.00005f) > 1.0f ? 1.0f : (arg3 * 0.00005f)) * arg4) & 0xFF); sp58 = Math_atan2f(light->l.dir[0], light->l.dir[2]); @@ -91,22 +88,20 @@ void func_8002B66C(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, Matrix_RotateY(sp58, MTXMODE_APPLY); Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1687), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 1687), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_04048180); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_04048180); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 1693); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1693); } #ifdef NON_MATCHING // saved register, stack usage and minor ordering differences void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; MtxF spE8; f32 spE0[2]; s32 i; f32* spAC; - Gfx* dispRefs[4]; f32 temp_10; u8 temp_14; f32 temp_f0; @@ -141,10 +136,9 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa temp_s6 = lightMapper->numLights; temp_s6 -= 2; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 1741); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1741); - gfxCtx->polyOpa.p = Gfx_CallSetupDL(gfxCtx->polyOpa.p, 0x2C); + oGfxCtx->polyOpa.p = Gfx_CallSetupDL(oGfxCtx->polyOpa.p, 0x2C); actor->shape.unk_15 = 0; for (i = 0; i < 2; i++) { @@ -212,7 +206,7 @@ void ActorShadow_DrawFunc_Teardrop(Actor* actor, LightMapper* lightMapper, Globa actor->shape.unk_15 = ((spE0[0] + temp_f0) < (spE0[1] - temp_f0)) ? 2 : 1; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 1831); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 1831); } } #else @@ -309,24 +303,23 @@ void func_8002C0C0(TargetContext* targetCtx, Actor* actor, GlobalContext* global void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Actor* actor = targetCtx->targetedActor; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Player* player; - TargetContextEntry* entry; - s16 spCE; - f32 temp1; - Vec3f spBC; - s32 spB8; - f32 spB4; - s32 spB0; - s32 spAC; - f32 var1; - f32 var2; - s32 i; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 2029); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2029); if (targetCtx->unk_48 != 0) { + TargetContextEntry* entry; + Player* player; + s16 spCE; + f32 temp1; + Vec3f spBC; + s32 spB8; + f32 spB4; + s32 spB0; + s32 spAC; + f32 var1; + f32 var2; + s32 i; + player = PLAYER; spCE = 0xFF; @@ -367,7 +360,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z); if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) { - gfxCtx->overlay.p = Gfx_CallSetupDL(gfxCtx->overlay.p, 0x39); + oGfxCtx->overlay.p = Gfx_CallSetupDL(oGfxCtx->overlay.p, 0x39); for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) { entry = &targetCtx->arr_50[spAC]; @@ -382,7 +375,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_Translate(entry->pos.x, entry->pos.y, 0.0f, MTXMODE_NEW); Matrix_Scale(var2, 0.15f, 1.0f, MTXMODE_APPLY); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, entry->color.r, entry->color.g, entry->color.b, + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, entry->color.r, entry->color.g, entry->color.b, (u8)spCE); Matrix_RotateZ((targetCtx->unk_4B & 0x7F) * (M_PI / 64), MTXMODE_APPLY); @@ -391,9 +384,9 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); Matrix_Push(); Matrix_Translate(entry->unk_0C, entry->unk_0C, 0.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2116), + gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2116), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->overlay.p++, D_0404D450); + gSPDisplayList(oGfxCtx->overlay.p++, D_0404D450); Matrix_Pull(); } } @@ -410,20 +403,20 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { if ((actor != NULL) && !(actor->flags & 0x8000000)) { NaviColor* naviColor = &sNaviColorList[actor->type]; - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x7); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x7); Matrix_Translate(actor->posRot2.pos.x, actor->posRot2.pos.y + (actor->unk_4C * actor->scale.y) + 17.0f, actor->posRot2.pos.z, MTXMODE_NEW); Matrix_RotateY((f32)((u16)(globalCtx->gameplayFrames * 3000)) * (M_PI / 32768), MTXMODE_APPLY); Matrix_Scale((iREG(27) + 35) / 1000.0f, (iREG(28) + 60) / 1000.0f, (iREG(29) + 50) / 1000.0f, MTXMODE_APPLY); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 255); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2153), + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, naviColor->inner.r, naviColor->inner.g, naviColor->inner.b, 255); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 2153), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_0400CB70); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_0400CB70); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 2158); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2158); } void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, GlobalContext* globalCtx) { @@ -724,8 +717,6 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { s32 spB8; s32 spB4; s32 spB0; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (titleCtx->unk_C != 0) { spCC = titleCtx->unk_8; @@ -734,8 +725,7 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { spB8 = (titleCtx->unk_6 * 4) - (spC8 * 2); sp38 = spCC * 2; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 2824); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2824); spB0 = spCC * spC8 * gSaveContext.language; spC8 = (spCC * spC8 > 0x1000) ? 0x1000 / spCC : spC8; @@ -743,30 +733,30 @@ void TitleCard_Draw(GlobalContext* globalCtx, TitleCardContext* titleCtx) { if (1) {} // Necessary to match - gfxCtx->overlay.p = func_80093808(gfxCtx->overlay.p); + oGfxCtx->overlay.p = func_80093808(oGfxCtx->overlay.p); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, (u8)titleCtx->unk_E, (u8)titleCtx->unk_E, (u8)titleCtx->unk_E, + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, (u8)titleCtx->unk_E, (u8)titleCtx->unk_E, (u8)titleCtx->unk_E, (u8)titleCtx->unk_C); - gDPLoadTextureBlock(gfxCtx->overlay.p++, titleCtx->texture + spB0, G_IM_FMT_IA, G_IM_SIZ_8b, spCC, spC8, 0, + gDPLoadTextureBlock(oGfxCtx->overlay.p++, titleCtx->texture + spB0, G_IM_FMT_IA, G_IM_SIZ_8b, spCC, spC8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB8, ((sp38 * 2) + spC0) - 4, spB8 + (spC8 * 4) - 1, + gSPTextureRectangle(oGfxCtx->overlay.p++, spC0, spB8, ((sp38 * 2) + spC0) - 4, spB8 + (spC8 * 4) - 1, G_TX_RENDERTILE, 0, 0, 1024, 1024); spC8 = titleCtx->unk_9 - spC8; if (spC8 > 0) { - gDPLoadTextureBlock(gfxCtx->overlay.p++, titleCtx->texture + spB0 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, spCC, + gDPLoadTextureBlock(oGfxCtx->overlay.p++, titleCtx->texture + spB0 + 0x1000, G_IM_FMT_IA, G_IM_SIZ_8b, spCC, spC8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, spC0, spB4, ((sp38 * 2) + spC0) - 4, spB4 + (spC8 * 4) - 1, + gSPTextureRectangle(oGfxCtx->overlay.p++, spC0, spB4, ((sp38 * 2) + spC0) - 4, spB4 + (spC8 * 4) - 1, G_TX_RENDERTILE, 0, 0, 1024, 1024); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 2880); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 2880); } } @@ -1311,22 +1301,24 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* Hilite* func_8002EABC(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) { Hilite* hilite; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_actor.c", 4306); - gfxCtx->polyOpa.p = func_8002E830(object, eye, lightDir, gfxCtx, gfxCtx->polyOpa.p, &hilite); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_actor.c", 4313); + OPEN_DISPS(gfxCtx, "../z_actor.c", 4306); + + oGfxCtx->polyOpa.p = func_8002E830(object, eye, lightDir, gfxCtx, oGfxCtx->polyOpa.p, &hilite); + + CLOSE_DISPS(gfxCtx, "../z_actor.c", 4313); return hilite; } Hilite* func_8002EB44(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext* gfxCtx) { Hilite* hilite; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_actor.c", 4332); - gfxCtx->polyXlu.p = func_8002E830(object, eye, lightDir, gfxCtx, gfxCtx->polyXlu.p, &hilite); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_actor.c", 4339); + OPEN_DISPS(gfxCtx, "../z_actor.c", 4332); + + oGfxCtx->polyXlu.p = func_8002E830(object, eye, lightDir, gfxCtx, oGfxCtx->polyXlu.p, &hilite); + + CLOSE_DISPS(gfxCtx, "../z_actor.c", 4339); return hilite; } @@ -1336,8 +1328,6 @@ void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) { Vec3f lightDir; Gfx* displayListHead; Gfx* displayList; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; lightDir.x = globalCtx->envCtx.unk_2A; lightDir.y = globalCtx->envCtx.unk_2B; @@ -1354,14 +1344,13 @@ void func_8002EBCC(Actor* actor, GlobalContext* globalCtx, s32 flag) { displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 4384); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4384); gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10); gSPEndDisplayList(displayListHead); - gSPSegment(gfxCtx->polyOpa.p++, 0x07, displayList); + gSPSegment(oGfxCtx->polyOpa.p++, 0x07, displayList); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 4394); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4394); } } @@ -1370,8 +1359,6 @@ void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) { Vec3f lightDir; Gfx* displayListHead; Gfx* displayList; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; lightDir.x = globalCtx->envCtx.unk_2A; lightDir.y = globalCtx->envCtx.unk_2B; @@ -1383,14 +1370,13 @@ void func_8002ED80(Actor* actor, GlobalContext* globalCtx, s32 flag) { displayList = Graph_Alloc(globalCtx->state.gfxCtx, 2 * sizeof(Gfx)); displayListHead = displayList; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 4429); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4429); gDPSetHilite1Tile(displayListHead++, 1, hilite, 0x10, 0x10); gSPEndDisplayList(displayListHead); - gSPSegment(gfxCtx->polyXlu.p++, 0x07, displayList); + gSPSegment(oGfxCtx->polyXlu.p++, 0x07, displayList); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 4439); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 4439); } } @@ -1784,8 +1770,6 @@ Color_RGB8 D_80116064 = { 100, 200, 0 }; // saved register, stack usage and minor ordering differences // this also doesn't generate a few useless struct copies void func_8002FBAC(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[6]; Vec3f lightPos; f32 spD8; f32 spD4; @@ -1806,9 +1790,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { f32 phi_f10; f32 phi_f6; - gfxCtx = globalCtx->state.gfxCtx; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 5308); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 5308); if (gSaveContext.respawn[RESPAWN_MODE_TOP].data != 0) { if (LINK_IS_ADULT) { @@ -1904,7 +1886,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { if ((globalCtx->csCtx.state == 0) && (gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex == gSaveContext.entranceIndex) && (globalCtx->roomCtx.curRoom.num == gSaveContext.respawn[RESPAWN_MODE_TOP].roomIndex)) { - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x19); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x19); Matrix_Translate(gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + spD8, @@ -1913,24 +1895,24 @@ void func_8002FBAC(GlobalContext* globalCtx) { Matrix_Mult(&globalCtx->mf_11D60, MTXMODE_APPLY); Matrix_Push(); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 255, 255, 200, spD0); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 100, 200, 0, 255); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 255, 255, 200, spD0); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 100, 200, 0, 255); phi_f10 = (globalCtx->gameplayFrames * 1500) & 0xFFFF; Matrix_RotateZ((phi_f10 * M_PI) / 32768.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5458), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5458), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_04010130); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_04010130); Matrix_Pull(); phi_f6 = ~((globalCtx->gameplayFrames * 1200) & 0xFFFF); Matrix_RotateZ((phi_f6 * M_PI) / 32768.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5463), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 5463), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_04010130); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_04010130); } lightPos.x = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x; @@ -1940,7 +1922,7 @@ void func_8002FBAC(GlobalContext* globalCtx) { Lights_InitType0PositionalLight(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, 500.0f * spD4); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 5474); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 5474); } } #else @@ -2169,15 +2151,10 @@ void Actor_FaultPrint(Actor* actor, char* command) { void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { FaultClient faultClient; LightMapper* lightMapper; - GraphicsContext* gfxCtx; - Camera* camera; - Gfx* dispRefs[3]; Fault_AddClient(&faultClient, Actor_FaultPrint, actor, "Actor_draw"); - gfxCtx = globalCtx->state.gfxCtx; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 6035); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6035); lightMapper = Lights_CreateMapper(&globalCtx->lightCtx, globalCtx->state.gfxCtx); @@ -2185,10 +2162,10 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { func_80079EFC(lightMapper, globalCtx->state.gfxCtx); if (actor->flags & 0x1000) { - camera = &globalCtx->cameras[0]; - func_800D1694(actor->posRot.pos.x + camera->unk_80.x, - actor->posRot.pos.y + (f32)((actor->shape.unk_08 * actor->scale.y) + camera->unk_80.y), - actor->posRot.pos.z + camera->unk_80.z, &actor->shape.rot); + func_800D1694(actor->posRot.pos.x + globalCtx->mainCamera.unk_80.x, + actor->posRot.pos.y + + (f32)((actor->shape.unk_08 * actor->scale.y) + globalCtx->mainCamera.unk_80.y), + actor->posRot.pos.z + globalCtx->mainCamera.unk_80.z, &actor->shape.rot); } else { func_800D1694(actor->posRot.pos.x, actor->posRot.pos.y + (actor->shape.unk_08 * actor->scale.y), actor->posRot.pos.z, &actor->shape.rot); @@ -2197,8 +2174,8 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY); Actor_SetObjectDependency(globalCtx, actor); - gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); - gSPSegment(gfxCtx->polyXlu.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x06, globalCtx->objectCtx.status[actor->objBankIndex].segment); if (actor->dmgEffectTimer != 0) { // Must be inline data to match @@ -2232,7 +2209,7 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) { actor->shape.shadowDrawFunc(actor, lightMapper, globalCtx); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 6119); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6119); Fault_RemoveClient(&faultClient); } @@ -2252,94 +2229,91 @@ void func_80030ED8(Actor* actor) { } void func_80030FA8(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_actor.c", 6161); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_actor.c", 6161); - - gDPLoadTextureBlock(gfxCtx->polyXlu.p++, &D_0401E370, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_MIRROR | G_TX_CLAMP, + gDPLoadTextureBlock(oGfxCtx->polyXlu.p++, &D_0401E370, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->polyXlu.p++, G_TX_RENDERTILE, 384, 224, 892, 732); - gSPTextureRectangle(gfxCtx->polyXlu.p++, 0, 0, 1280, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPSetTileSize(oGfxCtx->polyXlu.p++, G_TX_RENDERTILE, 384, 224, 892, 732); + gSPTextureRectangle(oGfxCtx->polyXlu.p++, 0, 0, 1280, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597); + gDPPipeSync(oGfxCtx->polyXlu.p++); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_actor.c", 6183); + CLOSE_DISPS(gfxCtx, "../z_actor.c", 6183); } void func_8003115C(GlobalContext* globalCtx, s32 nbInvisibleActors, Actor** invisibleActors) { Actor** invisibleActor; GraphicsContext* gfxCtx; s32 i; - Gfx* dispRefs[5]; gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_actor.c", 6197); + OPEN_DISPS(gfxCtx, "../z_actor.c", 6197); // Translates to: "MAGIC LENS START" - gDPNoOpString(gfxCtx->polyOpa.p++, "魔法のメガネ START", 0); + gDPNoOpString(oGfxCtx->polyOpa.p++, "魔法のメガネ START", 0); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPPipeSync(oGfxCtx->polyXlu.p++); if (globalCtx->roomCtx.curRoom.showInvisActors == 0) { - gDPSetOtherMode(gfxCtx->polyXlu.p++, + gDPSetOtherMode(oGfxCtx->polyXlu.p++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | G_RM_CLD_SURF | G_RM_CLD_SURF2); - gDPSetCombineMode(gfxCtx->polyXlu.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 0, 0, 255); + gDPSetCombineMode(oGfxCtx->polyXlu.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 0, 0, 255); } else { - gDPSetOtherMode(gfxCtx->polyXlu.p++, + gDPSetOtherMode(oGfxCtx->polyXlu.p++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) | GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)); - gDPSetCombineLERP(gfxCtx->polyXlu.p++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, - PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0xFF, 74, 74, 74, 74); + gDPSetCombineLERP(oGfxCtx->polyXlu.p++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, + 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0xFF, 74, 74, 74, 74); } - gDPSetPrimDepth(gfxCtx->polyXlu.p++, 0, 0); + gDPSetPrimDepth(oGfxCtx->polyXlu.p++, 0, 0); func_80030FA8(gfxCtx); // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY START" - gDPNoOpString(gfxCtx->polyOpa.p++, "魔法のメガネ 見えないActor表示 START", nbInvisibleActors); + gDPNoOpString(oGfxCtx->polyOpa.p++, "魔法のメガネ 見えないActor表示 START", nbInvisibleActors); invisibleActor = &invisibleActors[0]; for (i = 0; i < nbInvisibleActors; i++) { // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY" - gDPNoOpString(gfxCtx->polyOpa.p++, "魔法のメガネ 見えないActor表示", i); + gDPNoOpString(oGfxCtx->polyOpa.p++, "魔法のメガネ 見えないActor表示", i); Actor_Draw(globalCtx, *(invisibleActor++)); } // Translates to: "MAGIC LENS INVISIBLE ACTOR DISPLAY END" - gDPNoOpString(gfxCtx->polyOpa.p++, "魔法のメガネ 見えないActor表示 END", nbInvisibleActors); + gDPNoOpString(oGfxCtx->polyOpa.p++, "魔法のメガネ 見えないActor表示 END", nbInvisibleActors); if (globalCtx->roomCtx.curRoom.showInvisActors != 0) { // Translates to: "BLUE SPECTACLES (EXTERIOR)" - gDPNoOpString(gfxCtx->polyOpa.p++, "青い眼鏡(外側)", 0); + gDPNoOpString(oGfxCtx->polyOpa.p++, "青い眼鏡(外側)", 0); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPPipeSync(oGfxCtx->polyXlu.p++); - gDPSetOtherMode(gfxCtx->polyXlu.p++, + gDPSetOtherMode(oGfxCtx->polyXlu.p++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2); - gDPSetCombineMode(gfxCtx->polyXlu.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 0, 0, 255); + gDPSetCombineMode(oGfxCtx->polyXlu.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 0, 0, 255); func_80030FA8(gfxCtx); // Translates to: "BLUE SPECTACLES (EXTERIOR)" - gDPNoOpString(gfxCtx->polyOpa.p++, "青い眼鏡(外側)", 1); + gDPNoOpString(oGfxCtx->polyOpa.p++, "青い眼鏡(外側)", 1); } // Translates to: "MAGIC LENS END" - gDPNoOpString(gfxCtx->polyOpa.p++, "魔法のメガネ END", 0); + gDPNoOpString(oGfxCtx->polyOpa.p++, "魔法のメガネ END", 0); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_actor.c", 6284); + CLOSE_DISPS(gfxCtx, "../z_actor.c", 6284); } s32 func_800314B0(GlobalContext* globalCtx, Actor* actor) { @@ -2366,28 +2340,24 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { s32 invisibleActorCounter; Actor* invisibleActors[INVISIBLE_ACTOR_MAX]; ActorListEntry* actorListEntry; - GraphicsContext* gfxCtx; - s32 i; - Gfx* dispRefs[5]; Actor* actor; - ActorOverlay* overlayEntry; - char* actorName; + s32 i; - gfxCtx = globalCtx->state.gfxCtx; invisibleActorCounter = 0; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 6336); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6336); actorListEntry = &actorCtx->actorList[0]; for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++, actorListEntry++) { actor = actorListEntry->first; - while (actor != NULL) { - overlayEntry = actor->overlayEntry; - actorName = overlayEntry->name != NULL ? overlayEntry->name : ""; - gDPNoOpString(gfxCtx->polyOpa.p++, actorName, i); - gDPNoOpString(gfxCtx->polyXlu.p++, actorName, i); + while (actor != NULL) { + ActorOverlay* overlayEntry = actor->overlayEntry; + char* actorName = overlayEntry->name != NULL ? overlayEntry->name : ""; + + gDPNoOpString(oGfxCtx->polyOpa.p++, actorName, i); + gDPNoOpString(oGfxCtx->polyXlu.p++, actorName, i); HREG(66) = i; @@ -2466,7 +2436,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { CollisionCheck_Draw(globalCtx, &globalCtx->colChkCtx); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 6563); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 6563); } void func_80031A28(GlobalContext* globalCtx, ActorContext* actorCtx) { @@ -3444,16 +3414,14 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) f32 var; Vec3f sp50; CollisionPoly* sp4C; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8120); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8120); if (0) {} // Necessary to match - gfxCtx->polyOpa.p = Gfx_CallSetupDL(gfxCtx->polyOpa.p, 0x2C); + oGfxCtx->polyOpa.p = Gfx_CallSetupDL(oGfxCtx->polyOpa.p, 0x2C); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, alpha); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 0, 0, alpha); sp50.x = arg0->x; sp50.y = arg0->y + 1.0f; @@ -3470,22 +3438,22 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, GlobalContext* globalCtx) Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8149), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8149), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_04049210); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_04049210); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8155); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8155); } void func_80033DB8(GlobalContext* globalCtx, s16 arg1, s16 arg2) { - s16 var = Quake_Add(&globalCtx->cameras[0], 3); + s16 var = Quake_Add(&globalCtx->mainCamera, 3); Quake_SetSpeed(var, 20000); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); } void func_80033E1C(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { - s16 var = Quake_Add(&globalCtx->cameras[0], 3); + s16 var = Quake_Add(&globalCtx->mainCamera, 3); Quake_SetSpeed(var, arg3); Quake_SetQuakeValues(var, arg1, 0, 0, 0); Quake_SetCountdown(var, arg2); @@ -3533,14 +3501,11 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) { f32 temp1; f32 temp2; f32 temp3; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; entry = &D_801160DC[arg2]; var = entry->unk_10; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8265); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8265); Matrix_Translate(0.0f, entry->unk_08, 500.0f, MTXMODE_APPLY); Matrix_Get(&spB0); @@ -3557,9 +3522,9 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) { Matrix_Scale(entry->unk_0C, entry->unk_0C, entry->unk_0C, MTXMODE_APPLY); } - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8299), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8299), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, entry->unk_14); + gSPDisplayList(oGfxCtx->polyOpa.p++, entry->unk_14); if (i % 2) { temp3 = entry->unk_00 + entry->unk_00; @@ -3573,11 +3538,11 @@ void func_80033F54(GlobalContext* globalCtx, s32 arg1, s32 arg2) { Matrix_Put(&spB0); Matrix_Scale(arg1 * 0.1f, arg1 * 0.1f, arg1 * 0.1f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8314), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_actor.c", 8314), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, entry->unk_18); + gSPDisplayList(oGfxCtx->polyOpa.p++, entry->unk_18); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8319); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8319); } void func_8003424C(GlobalContext* globalCtx, Vec3f* arg1) { @@ -3825,41 +3790,37 @@ Gfx* func_80034B54(GraphicsContext* gfxCtx) { void func_80034BA0(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, s16 alpha) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8831); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8831); func_80093D18(globalCtx->state.gfxCtx); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 0, alpha); - gDPPipeSync(gfxCtx->polyOpa.p++); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, func_80034B28(globalCtx->state.gfxCtx)); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 0, alpha); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, func_80034B28(globalCtx->state.gfxCtx)); - gfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - overrideLimbDraw, postLimbDraw, actor, gfxCtx->polyOpa.p); + oGfxCtx->polyOpa.p = + SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, + overrideLimbDraw, postLimbDraw, actor, oGfxCtx->polyOpa.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8860); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8860); } void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbDraw2 overrideLimbDraw, PostLimbDraw2 postLimbDraw, Actor* actor, s16 alpha) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8876); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8876); func_80093D84(globalCtx->state.gfxCtx); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 0, alpha); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, func_80034B54(globalCtx->state.gfxCtx)); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, alpha); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, func_80034B54(globalCtx->state.gfxCtx)); - gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - overrideLimbDraw, postLimbDraw, actor, gfxCtx->polyXlu.p); + oGfxCtx->polyXlu.p = + SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, + overrideLimbDraw, postLimbDraw, actor, oGfxCtx->polyXlu.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_actor.c", 8904); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 8904); } s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 5c16693431..a2da2a2ec7 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3175,7 +3175,7 @@ void func_80057C6C(Camera* camera, View* view, CollisionContext* colCtx, GlobalC s32 func_8005AD40(Camera* camera, Actor* doorActor, s16 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6); void func_80057FC4(Camera* camera) { - if (camera != &camera->globalCtx->cameras[0]) { + if (camera != &camera->globalCtx->mainCamera) { camera->unk_154 = camera->setting = CAM_SET_FREE0; camera->unk_14C &= ~0x4; } else if (camera->globalCtx->roomCtx.curRoom.mesh->polygon.type != 1) { @@ -3246,7 +3246,7 @@ void func_80058148(Camera* camera, Player* player) { camera->unk_118 = -1; camera->unk_11C = -1; camera->unk_14C |= 4; - if (camera == &camera->globalCtx->cameras[0]) { + if (camera == &camera->globalCtx->mainCamera) { D_8011D3A0.w = 0xB200; } else { D_8011D3A0.w = 0; diff --git a/src/code/z_cheap_proc.c b/src/code/z_cheap_proc.c index f899bab69d..518b2d359f 100644 --- a/src/code/z_cheap_proc.c +++ b/src/code/z_cheap_proc.c @@ -2,29 +2,23 @@ #include void Gfx_DrawDListOpa(GlobalContext* globalCtx, Gfx* dlist) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 214); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 214); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 216), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 216), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dlist); + gSPDisplayList(oGfxCtx->polyOpa.p++, dlist); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 219); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 219); } void Gfx_DrawDListXlu(GlobalContext* globalCtx, Gfx* dlist) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 228); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 228); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 230), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 230), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, dlist); + gSPDisplayList(oGfxCtx->polyXlu.p++, dlist); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_cheap_proc.c", 233); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_cheap_proc.c", 233); } diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 48caa825dd..41f63005c7 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -220,14 +220,13 @@ void func_80063D7C(GraphicsContext* gfxCtx) { Gfx* sp78; GfxPrint gfxPrint; Gfx* tempRet; - s32 pad; - Gfx* dispRefs[4]; // stores state of GfxCtx next ptrs - Graph_OpenDisps(dispRefs, gfxCtx, "../z_debug.c", 628); + OPEN_DISPS(gfxCtx, "../z_debug.c", 628); + GfxPrint_Init(&gfxPrint); - sp78 = gfxCtx->polyOpa.p; - tempRet = Graph_GfxPlusOne(gfxCtx->polyOpa.p); - gSPDisplayList(gfxCtx->overlay.p++, tempRet); + sp78 = oGfxCtx->polyOpa.p; + tempRet = Graph_GfxPlusOne(oGfxCtx->polyOpa.p); + gSPDisplayList(oGfxCtx->overlay.p++, tempRet); GfxPrint_Open(&gfxPrint, tempRet); if ((OREG(0) == 1) || (OREG(0) == 8)) { @@ -242,8 +241,11 @@ void func_80063D7C(GraphicsContext* gfxCtx) { sp7C = GfxPrint_Close(&gfxPrint); gSPEndDisplayList(sp7C++); Graph_BranchDlist(sp78, sp7C); - gfxCtx->polyOpa.p = sp7C; + oGfxCtx->polyOpa.p = sp7C; + if (0) {} - Graph_CloseDisps(dispRefs, gfxCtx, "../z_debug.c", 664); + + CLOSE_DISPS(gfxCtx, "../z_debug.c", 664); + GfxPrint_Destroy(&gfxPrint); } diff --git a/src/code/z_debug_display.c b/src/code/z_debug_display.c index 399e96d408..d029d25568 100644 --- a/src/code/z_debug_display.c +++ b/src/code/z_debug_display.c @@ -71,47 +71,42 @@ void DebugDisplay_DrawObjects(GlobalContext* globalCtx) { } void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_debug_display.c", 169); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 169); func_80094678(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY); Matrix_RotateRPY(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY); - gDPLoadTextureBlock(gfxCtx->polyXlu.p++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, + gDPLoadTextureBlock(oGfxCtx->polyXlu.p++, texture, G_IM_FMT_I, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 189), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 189), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_04004298); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_04004298); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_debug_display.c", 192); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 192); } void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, u32 dlist, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 211); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_debug_display.c", 211); func_8009435C(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a); - gSPSetLights1(gfxCtx->polyXlu.p++, sDebugObjectLights); + gSPSetLights1(oGfxCtx->polyXlu.p++, sDebugObjectLights); func_800D1694(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot); Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, dlist); + gSPDisplayList(oGfxCtx->polyXlu.p++, dlist); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_debug_display.c", 231); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_debug_display.c", 231); } diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 8bbc1d9b52..8fe0c4689f 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1852,8 +1852,6 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) { Gfx* displayList; Gfx* prevDisplayList; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (0) {} // Necessary to match @@ -1861,18 +1859,17 @@ void func_80068C3C(GlobalContext* globalCtx, CutsceneContext* csCtx) { if (0) {} // Also necessary to match if (BREG(0) != 0) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo.c", 4101); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo.c", 4101); - prevDisplayList = gfxCtx->polyOpa.p; - displayList = Graph_GfxPlusOne(gfxCtx->polyOpa.p); - gSPDisplayList(gfxCtx->overlay.p++, displayList); + prevDisplayList = oGfxCtx->polyOpa.p; + displayList = Graph_GfxPlusOne(oGfxCtx->polyOpa.p); + gSPDisplayList(oGfxCtx->overlay.p++, displayList); Cutscene_DrawDebugInfo(globalCtx, &displayList, csCtx); gSPEndDisplayList(displayList++); Graph_BranchDlist(prevDisplayList, displayList); - gfxCtx->polyOpa.p = displayList; + oGfxCtx->polyOpa.p = displayList; - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo.c", 4108); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo.c", 4108); } csCtx->frames++; diff --git a/src/code/z_draw.c b/src/code/z_draw.c index 12a04eeb33..83f13ce076 100644 --- a/src/code/z_draw.c +++ b/src/code/z_draw.c @@ -167,527 +167,502 @@ void func_800694A0(GlobalContext* globalCtx, s16 drawId) { // All remaining functions in this file are draw functions referenced in the table and called by the function above void func_800694E4(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 556); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 556); func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 560), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 560), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 565); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 565); } void func_800695C0(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 572); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 572); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 5); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 576), + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 5); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 576), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 581); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 581); } void func_8006969C(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 588); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 588); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 592), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 592), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 8), 16, 32)); Matrix_Push(); Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY); func_800D1FD4(&globalCtx->mf_11DA0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 621); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 621); } void func_80069880(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 628); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 628); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 632), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 632), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 641), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 641), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 16, 32, 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 16, 32)); Matrix_Push(); func_800D1FD4(&globalCtx->mf_11DA0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 663); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 663); } void func_80069AC8(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 670); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 670); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 674), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 674), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 683), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 683), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 32, 32, 1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 32, 32)); Matrix_Push(); func_800D1FD4(&globalCtx->mf_11DA0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 704); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 704); } void func_80069CF0(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 712); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 712); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0) % 256, 1 * (globalCtx->state.frames * 2) % 256, 64, 64, 1, 0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 723), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 723), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 730), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 730), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 735); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 735); } void func_80069EB0(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 742); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 742); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 746), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 746), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), 1 * -(globalCtx->state.frames * 5), 32, 32, 1, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 32, 64)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 760), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 760), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 765); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 765); } void func_8006A060(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 772); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 772); func_80093BA8(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 776), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 776), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 783); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 783); } void func_8006A158(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 811); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 811); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 815), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 815), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 5); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 822), + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 5); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 822), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 827); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 827); } void func_8006A2A0(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 834); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 834); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, -1 * (globalCtx->state.frames * 1), 1 * (globalCtx->state.frames * 1), 32, 32, 1, -1 * (globalCtx->state.frames * 1), 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 845), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 845), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 855), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 855), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[5]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[5]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 861); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 861); } void func_8006A4B0(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 868); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 868); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 1), 0 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 1), 0 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 878), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 878), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 883); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 883); } void func_8006A5F0(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 890); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 890); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 6), 1 * (globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 6), 1 * (globalCtx->state.frames * 6), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 901), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 901), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 906); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 906); } void func_8006A73C(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 913); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 913); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 3), 32, 32, 1, 0 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 924), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 924), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 929); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 929); } void func_8006A88C(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 936); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 936); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 * (globalCtx->state.frames * 0), 1 * (globalCtx->state.frames * 1), 32, 32, 1, 0 * (globalCtx->state.frames * 0), 1 * (globalCtx->state.frames * 1), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 947), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 947), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 952); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 952); } void func_8006A9CC(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 959); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 959); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 963), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 963), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 968); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 968); } void func_8006AAA8(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 975); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 975); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 979), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 979), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 986), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 986), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 991); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 991); } void func_8006ABEC(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 998); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 998); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1002), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1002), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1008); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1008); } void func_8006ACE4(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1015); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1015); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1019), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1019), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1027), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1027), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1032); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1032); } void func_8006AE40(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1039); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1039); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1043), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1043), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1050), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1050), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1056); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1056); } void func_8006AF9C(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1063); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1063); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), 1 * -(globalCtx->state.frames * 6), 32, 32, 1, 1 * (globalCtx->state.frames * 1), -1 * (globalCtx->state.frames * 2), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1074), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1074), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1081); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1081); } void func_8006B124(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1088); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1088); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1092), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1092), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1100); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1100); } void func_8006B24C(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1108); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1108); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1112), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1112), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1120), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1120), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1126); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1126); } void func_8006B3C0(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1133); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1133); Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1140), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1140), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1148), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1148), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1154); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1154); } void func_8006B54C(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1162); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1162); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 1 * (globalCtx->state.frames * 2), -1 * (globalCtx->state.frames * 2), 64, 64, 1, 1 * (globalCtx->state.frames * 4), 1 * -(globalCtx->state.frames * 4), 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1173), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1173), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1181); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1181); } void func_8006B6E4(GlobalContext* globalCtx, s16 drawId) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1188); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1188); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1192), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1192), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1200), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1200), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); - gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1207); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1207); } void func_8006B870(GlobalContext* globalCtx, s16 drawId) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1214); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1214); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1218), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1218), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[4]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[5]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[6]); - gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[7]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[4]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[5]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[6]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[7]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_draw.c", 1230); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_draw.c", 1230); } diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index 4555e9e038..af4df1dad2 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -398,13 +398,11 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3 #endif void EffectBlure_SetupSmooth(EffectBlure* this, GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 809); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 809); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x26); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x26); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 813); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 813); } // original name: "SQ_NoInterpolate_disp" @@ -420,9 +418,8 @@ void EffectBlure_DrawElemNoInterpolation(EffectBlure* this, EffectBlureElement* Vec3f sp6C; Vec3f sp60; Vec3f sp54; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 838); + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 838); Math_Vec3s_ToVec3f(&sp6C, &this->elements[0].p2); @@ -498,11 +495,11 @@ void EffectBlure_DrawElemNoInterpolation(EffectBlure* this, EffectBlureElement* vtx[3].v.cn[2] = sp78.b; vtx[3].v.cn[3] = sp78.a; - gSPVertex(gfxCtx->polyXlu.p++, vtx, 4, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 0, 1, 2, 0, 0, 2, 3, 0); + gSPVertex(oGfxCtx->polyXlu.p++, vtx, 4, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 0, 1, 2, 0, 0, 2, 3, 0); } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 932); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 932); } // original name: "SQ_HermiteInterpolate_disp" @@ -533,17 +530,8 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem Color_RGBA8 sp148; Color_RGBA8 sp144; Vec3f sp138; - Gfx* dispRefs[5]; - Vec3f sp118; - Vec3f sp10C; - Vec3f sp100; - Vec3f spF4; - s32 j1; - s32 j2; - Vec3f spE0; - s32 i; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 971); + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 971); Math_Vec3s_ToVec3f(&sp138, &this->elements[0].p2); @@ -561,6 +549,9 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem Math_Vec3f_Diff(&sp18C, &sp1CC, &sp1B4); Math_Vec3f_Diff(&sp180, &sp1C0, &sp1A8); } else { + Vec3f sp118; + Vec3f sp10C; + if (index - 1 < 0) { __assert("index - 1 >= 0", "../z_eff_blure.c", 1005); } @@ -580,6 +571,9 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem Math_Vec3f_Diff(&sp18C, &sp1CC, &sp174); Math_Vec3f_Diff(&sp180, &sp1C0, &sp168); } else { + Vec3f sp100; + Vec3f spF4; + if (index + 2 >= this->numElements) { __assert("index + 2 < this2->now_edge_num", "../z_eff_blure.c", 1032); } @@ -600,6 +594,11 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem // Translates to: "Vertices cannot be secured." osSyncPrintf("z_eff_blure.c::SQ_HermiteInterpolate_disp() 頂点確保できず。\n"); } else { + s32 j1; + s32 j2; + Vec3f spE0; + s32 i; + Math_Vec3f_Diff(&sp1CC, &sp138, &sp158); Math_Vec3f_Scale(&sp158, 10.0f); Math_Vec3f_Diff(&sp1C0, &sp138, &sp14C); @@ -670,17 +669,17 @@ void EffectBlure_DrawElemHermiteInterpolation(EffectBlure* this, EffectBlureElem vtx[j2].v.cn[3] = func_80027E84(sp1A0.a, sp198.a, temp_f28); } - gSPVertex(gfxCtx->polyXlu.p++, vtx, 16, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 0, 1, 3, 0, 0, 3, 2, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 2, 3, 5, 0, 2, 5, 4, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 4, 5, 7, 0, 4, 7, 6, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 6, 7, 9, 0, 6, 9, 8, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 8, 9, 11, 0, 8, 11, 10, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 10, 11, 13, 0, 10, 13, 12, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 12, 13, 15, 0, 12, 15, 14, 0); + gSPVertex(oGfxCtx->polyXlu.p++, vtx, 16, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 0, 1, 3, 0, 0, 3, 2, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 2, 3, 5, 0, 2, 5, 4, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 4, 5, 7, 0, 4, 7, 6, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 6, 7, 9, 0, 6, 9, 8, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 8, 9, 11, 0, 8, 11, 10, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 10, 11, 13, 0, 10, 13, 12, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 12, 13, 15, 0, 12, 15, 14, 0); } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1184); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 1184); } #else Vtx D_80115770 = VTX(0, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF); @@ -696,9 +695,8 @@ void EffectBlure_DrawSmooth(EffectBlure* this, GraphicsContext* gfxCtx) { MtxF sp9C; MtxF sp5C; Mtx* mtx; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1201); + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 1201); if (this->numElements < 2) { return; @@ -724,7 +722,7 @@ void EffectBlure_DrawSmooth(EffectBlure* this, GraphicsContext* gfxCtx) { return; } - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); for (i = 0, elem = &this->elements[0]; elem < &this->elements[this->numElements - 1]; elem++, i++) { if ((elem->state == 0) || ((elem + 1)->state == 0)) { @@ -741,49 +739,44 @@ void EffectBlure_DrawSmooth(EffectBlure* this, GraphicsContext* gfxCtx) { } } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1263); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 1263); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/EffectBlure_DrawSmooth.s") #endif -// EffectBlure_SetupSimple void EffectBlure_SetupSimple(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 1280); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1280); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x26); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x26); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1285); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 1285); } void EffectBlure_SetupSimpleAlt(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 1294); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1294); + gDPPipeSync(oGfxCtx->polyXlu.p++); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x26); - gDPPipeSync(gfxCtx->polyXlu.p++); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x26); + gDPSetCycleType(oGfxCtx->polyXlu.p++, G_CYC_2CYCLE); + gDPSetTextureLUT(oGfxCtx->polyXlu.p++, G_TT_NONE); + gSPTexture(oGfxCtx->polyXlu.p++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); - gDPSetCycleType(gfxCtx->polyXlu.p++, G_CYC_2CYCLE); - gDPSetTextureLUT(gfxCtx->polyXlu.p++, G_TT_NONE); - gSPTexture(gfxCtx->polyXlu.p++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + gDPLoadTextureBlock(oGfxCtx->polyXlu.p++, D_04006020, G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_WRAP, 6, 5, G_TX_NOLOD, G_TX_NOLOD); - gDPLoadTextureBlock(gfxCtx->polyXlu.p++, D_04006020, G_IM_FMT_I, G_IM_SIZ_8b, 64, 32, 0, G_TX_NOMIRROR | G_TX_CLAMP, - G_TX_NOMIRROR | G_TX_WRAP, 6, 5, G_TX_NOLOD, G_TX_NOLOD); + gDPSetCombineLERP(oGfxCtx->polyXlu.p++, TEXEL0, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED); + gDPSetRenderMode(oGfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(oGfxCtx->polyXlu.p++, G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); + gSPSetGeometryMode(oGfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); + gDPPipeSync(oGfxCtx->polyXlu.p++); - gDPSetCombineLERP(gfxCtx->polyXlu.p++, TEXEL0, PRIMITIVE, PRIM_LOD_FRAC, TEXEL0, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, - ENVIRONMENT, COMBINED, ENVIRONMENT, 0, 0, 0, COMBINED); - gDPSetRenderMode(gfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); - gSPClearGeometryMode(gfxCtx->polyXlu.p++, G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); - gSPSetGeometryMode(gfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); - gDPPipeSync(gfxCtx->polyXlu.p++); - - gDPSetEnvColor(gfxCtx->polyXlu.p++, this->altEnvColor.r, this->altEnvColor.g, this->altEnvColor.b, + gDPSetEnvColor(oGfxCtx->polyXlu.p++, this->altEnvColor.r, this->altEnvColor.g, this->altEnvColor.b, this->altEnvColor.a); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1329); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 1329); } void (*sSetupHandlers[])(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) = { @@ -795,79 +788,81 @@ s32 D_80115788 = 0; // unused // original name: "EffectBlureInfo2_disp_makeDisplayList" void EffectBlure_DrawSimpleVertices(GraphicsContext* gfxCtx, EffectBlure* this, Vtx* vtx) { - f32 alphaRatio; - Gfx* dispRefs[5]; - f32 scale; - Vec3f sp1B0; - Vec3f sp1A4; - Vec3f sp198; Mtx* mtx; - MtxF sp154; - MtxF sp114; - MtxF spD4; - MtxF sp94; - s32 i; - s32 j; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1356); + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 1356); sSetupHandlers[this->drawMode](gfxCtx, this, vtx); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPPipeSync(oGfxCtx->polyXlu.p++); - j = 0; + { + Vec3f sp1B0; + Vec3f sp1A4; + Vec3f sp198; + f32 alphaRatio; + MtxF sp154; + MtxF sp114; + MtxF spD4; + MtxF sp94; + f32 scale; + s32 i; + s32 j; - for (i = 0; i < this->numElements - 1; i++) { - if (this->drawMode == 1) { - alphaRatio = (f32)this->elements[i].timer / (f32)this->elemDuration; - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x00, 0x80, this->altPrimColor.r, this->altPrimColor.g, - this->altPrimColor.b, this->altPrimColor.a * (1.0f - alphaRatio)); - gDPPipeSync(gfxCtx->polyXlu.p++); - } + j = 0; - if (1) {} // Necessary to match - - gSPVertex(gfxCtx->polyXlu.p++, &vtx[j], 4, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 0, 1, 3, 0, 0, 3, 2, 0); - - if (this->flags & 4) { - sp1B0.x = ((f32)vtx[4 * i + 0].v.ob[0] + (f32)vtx[4 * i + 1].v.ob[0]) * 0.5f; - sp1B0.y = ((f32)vtx[4 * i + 0].v.ob[1] + (f32)vtx[4 * i + 1].v.ob[1]) * 0.5f; - sp1B0.z = ((f32)vtx[4 * i + 0].v.ob[2] + (f32)vtx[4 * i + 1].v.ob[2]) * 0.5f; - sp1A4.x = ((f32)vtx[4 * i + 2].v.ob[0] + (f32)vtx[4 * i + 3].v.ob[0]) * 0.5f; - sp1A4.y = ((f32)vtx[4 * i + 2].v.ob[1] + (f32)vtx[4 * i + 3].v.ob[1]) * 0.5f; - sp1A4.z = ((f32)vtx[4 * i + 2].v.ob[2] + (f32)vtx[4 * i + 3].v.ob[2]) * 0.5f; - - Math_Vec3f_Diff(&sp1A4, &sp1B0, &sp198); - scale = sqrtf(SQ(sp198.x) + SQ(sp198.y) + SQ(sp198.z)); - - if (fabsf(scale) > 0.0005f) { - scale = 1.0f / scale; - Math_Vec3f_Scale(&sp198, scale); - - SkinMatrix_SetTranslate(&sp154, sp1B0.x, sp1B0.y, sp1B0.z); - func_800A7EC0(&sp114, 0x3FFF, sp198.x, sp198.y, sp198.z); - SkinMatrix_MtxFMtxFMult(&sp154, &sp114, &spD4); - SkinMatrix_SetTranslate(&sp154, -sp1B0.x, -sp1B0.y, -sp1B0.z); - SkinMatrix_MtxFMtxFMult(&spD4, &sp154, &sp94); - - mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp94); - if (mtx == NULL) { - // Translates to: "Forced termination because a matrix cannot be taken" - osSyncPrintf("EffectBlureInfo2_disp_makeDisplayList()マトリックス取れないので,強制終了\n"); - break; - } - - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(gfxCtx->polyXlu.p++, &vtx[j], 4, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 0, 1, 3, 0, 0, 3, 2, 0); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + for (i = 0; i < this->numElements - 1; i++) { + if (this->drawMode == 1) { + alphaRatio = (f32)this->elements[i].timer / (f32)this->elemDuration; + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x00, 0x80, this->altPrimColor.r, this->altPrimColor.g, + this->altPrimColor.b, this->altPrimColor.a * (1.0f - alphaRatio)); + gDPPipeSync(oGfxCtx->polyXlu.p++); } - } - j += 4; + if (1) {} // Necessary to match + + gSPVertex(oGfxCtx->polyXlu.p++, &vtx[j], 4, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 0, 1, 3, 0, 0, 3, 2, 0); + + if (this->flags & 4) { + sp1B0.x = ((f32)vtx[4 * i + 0].v.ob[0] + (f32)vtx[4 * i + 1].v.ob[0]) * 0.5f; + sp1B0.y = ((f32)vtx[4 * i + 0].v.ob[1] + (f32)vtx[4 * i + 1].v.ob[1]) * 0.5f; + sp1B0.z = ((f32)vtx[4 * i + 0].v.ob[2] + (f32)vtx[4 * i + 1].v.ob[2]) * 0.5f; + sp1A4.x = ((f32)vtx[4 * i + 2].v.ob[0] + (f32)vtx[4 * i + 3].v.ob[0]) * 0.5f; + sp1A4.y = ((f32)vtx[4 * i + 2].v.ob[1] + (f32)vtx[4 * i + 3].v.ob[1]) * 0.5f; + sp1A4.z = ((f32)vtx[4 * i + 2].v.ob[2] + (f32)vtx[4 * i + 3].v.ob[2]) * 0.5f; + + Math_Vec3f_Diff(&sp1A4, &sp1B0, &sp198); + scale = sqrtf(SQ(sp198.x) + SQ(sp198.y) + SQ(sp198.z)); + + if (fabsf(scale) > 0.0005f) { + scale = 1.0f / scale; + Math_Vec3f_Scale(&sp198, scale); + + SkinMatrix_SetTranslate(&sp154, sp1B0.x, sp1B0.y, sp1B0.z); + func_800A7EC0(&sp114, 0x3FFF, sp198.x, sp198.y, sp198.z); + SkinMatrix_MtxFMtxFMult(&sp154, &sp114, &spD4); + SkinMatrix_SetTranslate(&sp154, -sp1B0.x, -sp1B0.y, -sp1B0.z); + SkinMatrix_MtxFMtxFMult(&spD4, &sp154, &sp94); + + mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp94); + if (mtx == NULL) { + // Translates to: "Forced termination because a matrix cannot be taken" + osSyncPrintf("EffectBlureInfo2_disp_makeDisplayList()マトリックス取れないので,強制終了\n"); + break; + } + + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(oGfxCtx->polyXlu.p++, &vtx[j], 4, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 0, 1, 3, 0, 0, 3, 2, 0); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + } + } + + j += 4; + } } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_blure.c", 1452); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 1452); } Vtx_t D_8011578C[] = { @@ -996,17 +991,15 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { s32 i; s32 j; s32 phi_t2; - Gfx* sp74[5]; - f32 ratio; - Graph_OpenDisps(sp74, gfxCtx, "../z_eff_blure.c", 1596); + OPEN_DISPS(gfxCtx, "../z_eff_blure.c", 1596); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->numElements != 0) { if (this->flags == 0) { func_800942F0(gfxCtx); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPPipeSync(oGfxCtx->polyXlu.p++); vtx = Graph_Alloc(gfxCtx, sizeof(Vtx[32])); if (vtx == NULL) { @@ -1018,7 +1011,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { elem = &this->elements[i]; if (elem->state == 1) { - ratio = (f32)elem->timer / (f32)this->elemDuration; + f32 ratio = (f32)elem->timer / (f32)this->elemDuration; switch (this->calcMode) { case 1: @@ -1080,7 +1073,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { j = 0; - gSPVertex(gfxCtx->polyXlu.p++, vtx, 32, 0); + gSPVertex(oGfxCtx->polyXlu.p++, vtx, 32, 0); phi_t2 = 0; for (i = 0; i < this->numElements; i++) { @@ -1092,7 +1085,7 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { if (phi_t2 == 0) { phi_t2 = 1; } else { - gSP1Quadrangle(gfxCtx->polyXlu.p++, j - 2, j - 1, j + 1, j, 0); + gSP1Quadrangle(oGfxCtx->polyXlu.p++, j - 2, j - 1, j + 1, j, 0); if (1) {} // Necessary to match @@ -1111,5 +1104,5 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { } } - Graph_CloseDisps(sp74, gfxCtx, "../z_eff_blure.c", 1823); + CLOSE_DISPS(gfxCtx, "../z_eff_blure.c", 1823); } diff --git a/src/code/z_eff_shield_particle.c b/src/code/z_eff_shield_particle.c index efdc19eec9..46a0b9502d 100644 --- a/src/code/z_eff_shield_particle.c +++ b/src/code/z_eff_shield_particle.c @@ -154,37 +154,36 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { EffectShieldParticleElement* elem; Color_RGBA8_n primColor; Color_RGBA8_n envColor; - Gfx* dispRefs[5]; - Mtx* mtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_shield_particle.c", 272); + OPEN_DISPS(gfxCtx, "../z_eff_shield_particle.c", 272); if (this != NULL) { - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x26); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x26); - gDPSetCycleType(gfxCtx->polyXlu.p++, G_CYC_2CYCLE); - gDPPipeSync(gfxCtx->polyXlu.p++); - gSPTexture(gfxCtx->polyXlu.p++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + gDPSetCycleType(oGfxCtx->polyXlu.p++, G_CYC_2CYCLE); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gSPTexture(oGfxCtx->polyXlu.p++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); - gDPLoadTextureBlock(gfxCtx->polyXlu.p++, D_04038FB0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, + gDPLoadTextureBlock(oGfxCtx->polyXlu.p++, D_04038FB0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); if (1) {} // Necessary to match - gDPSetCombineLERP(gfxCtx->polyXlu.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, 0, + gDPSetCombineLERP(oGfxCtx->polyXlu.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, 0, 0, 0, COMBINED, 0, 0, 0, COMBINED); - gDPSetRenderMode(gfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); - gSPClearGeometryMode(gfxCtx->polyXlu.p++, + gDPSetRenderMode(oGfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(oGfxCtx->polyXlu.p++, G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); - gSPSetGeometryMode(gfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); + gSPSetGeometryMode(oGfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); EffectShieldParticle_GetColors(this, &primColor, &envColor); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, primColor.r, primColor.g, primColor.b, primColor.a); - gDPSetEnvColor(gfxCtx->polyXlu.p++, envColor.r, envColor.g, envColor.b, envColor.a); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, primColor.r, primColor.g, primColor.b, primColor.a); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, envColor.r, envColor.g, envColor.b, envColor.a); + gDPPipeSync(oGfxCtx->polyXlu.p++); for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) { + Mtx* mtx; MtxF sp104; MtxF spC4; MtxF sp84; @@ -215,11 +214,11 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) { break; } - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(gfxCtx->polyXlu.p++, sVertices, 4, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 0, 1, 2, 0, 0, 3, 1, 0); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(oGfxCtx->polyXlu.p++, sVertices, 4, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 0, 1, 2, 0, 0, 3, 1, 0); } } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_shield_particle.c", 359); + CLOSE_DISPS(gfxCtx, "../z_eff_shield_particle.c", 359); } diff --git a/src/code/z_eff_spark.c b/src/code/z_eff_spark.c index 6c3a659bb3..3f200b9e50 100644 --- a/src/code/z_eff_spark.c +++ b/src/code/z_eff_spark.c @@ -155,28 +155,28 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { u8 sp1C4; s32 i; s32 j; - Gfx* dispRefs[4]; // sp1AC globalCtx = Effect_GetGlobalCtx(); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_spark.c", 293); + + OPEN_DISPS(gfxCtx, "../z_eff_spark.c", 293); if (this != NULL) { - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x26); - gDPSetCycleType(gfxCtx->polyXlu.p++, G_CYC_2CYCLE); - gDPPipeSync(gfxCtx->polyXlu.p++); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x26); + gDPSetCycleType(oGfxCtx->polyXlu.p++, G_CYC_2CYCLE); + gDPPipeSync(oGfxCtx->polyXlu.p++); - gSPTexture(gfxCtx->polyXlu.p++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); - gDPLoadTextureBlock(gfxCtx->polyXlu.p++, D_04038FB0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, + gSPTexture(oGfxCtx->polyXlu.p++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + gDPLoadTextureBlock(oGfxCtx->polyXlu.p++, D_04038FB0, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); - gDPSetCombineMode(gfxCtx->polyXlu.p++, G_CC_SHADEDECALA, G_CC_PASS2); - gDPSetRenderMode(gfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); - gSPClearGeometryMode(gfxCtx->polyXlu.p++, + gDPSetCombineMode(oGfxCtx->polyXlu.p++, G_CC_SHADEDECALA, G_CC_PASS2); + gDPSetRenderMode(oGfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(oGfxCtx->polyXlu.p++, G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); - gSPSetGeometryMode(gfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); - gDPPipeSync(gfxCtx->polyXlu.p++); + gSPSetGeometryMode(oGfxCtx->polyXlu.p++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); + gDPPipeSync(oGfxCtx->polyXlu.p++); vertices = Graph_Alloc(gfxCtx, this->numElements * sizeof(Vtx[4])); if (vertices == NULL) { @@ -274,15 +274,15 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) { break; } - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPVertex(gfxCtx->polyXlu.p++, &vertices[4 * i], 4, 0); - gSP2Triangles(gfxCtx->polyXlu.p++, 2, 0, 3, 0, 2, 3, 1, 0); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(oGfxCtx->polyXlu.p++, &vertices[4 * i], 4, 0); + gSP2Triangles(oGfxCtx->polyXlu.p++, 2, 0, 3, 0, 2, 3, 1, 0); } - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPPipeSync(oGfxCtx->polyXlu.p++); } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_spark.c", 498); + CLOSE_DISPS(gfxCtx, "../z_eff_spark.c", 498); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/EffectSpark_Draw.s") diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index 885e94b143..5ac7774bc2 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -5,13 +5,10 @@ void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a f32 cos; Gfx* displayListHead; f32 absCos; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 113); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 113); - displayListHead = gfxCtx->polyOpa.p; + displayListHead = oGfxCtx->polyOpa.p; cos = Math_Coss((0x8000 / arg3) * arg2); absCos = ABS(cos); @@ -25,63 +22,54 @@ void func_80026230(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a gSPFogPosition(displayListHead++, 0, (s16)(absCos * 3000.0f) + 1500); - gfxCtx->polyOpa.p = displayListHead; + oGfxCtx->polyOpa.p = displayListHead; if (1) {} // Necessary to match - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 129); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 129); } void func_80026400(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { Gfx* displayListHead; f32 cos; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (arg3 != 0) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 141); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 141); cos = Math_Coss((0x4000 / arg3) * arg2); - displayListHead = gfxCtx->polyOpa.p; + displayListHead = oGfxCtx->polyOpa.p; gDPPipeSync(displayListHead++); gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); gSPFogPosition(displayListHead++, 0, (s16)(2800.0f * ABS(cos)) + 1700); - gfxCtx->polyOpa.p = displayListHead; + oGfxCtx->polyOpa.p = displayListHead; if (1) {} // Necessary to match - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 153); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 153); } } void func_80026608(GlobalContext* globalCtx) { s32 pad; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 159); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 159); - gDPPipeSync(gfxCtx->polyOpa.p++); - gfxCtx->polyOpa.p = func_800BC8A0(globalCtx, gfxCtx->polyOpa.p); + gDPPipeSync(oGfxCtx->polyOpa.p++); + oGfxCtx->polyOpa.p = func_800BC8A0(globalCtx, oGfxCtx->polyOpa.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 164); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 164); } void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; f32 absCos; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 178); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 178); - displayListHead = gfxCtx->polyXlu.p; + displayListHead = oGfxCtx->polyXlu.p; cos = Math_Coss((0x8000 / arg3) * arg2); absCos = ABS(cos); @@ -95,46 +83,40 @@ void func_80026690(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 a gSPFogPosition(displayListHead++, 0, (s16)(absCos * 3000.0f) + 1500); - gfxCtx->polyXlu.p = displayListHead; + oGfxCtx->polyXlu.p = displayListHead; if (1) {} // Necessary to match - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 194); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 194); } void func_80026860(GlobalContext* globalCtx, Color_RGBA8* color, s16 arg2, s16 arg3) { f32 cos; Gfx* displayListHead; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 201); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 201); - displayListHead = gfxCtx->polyXlu.p; + displayListHead = oGfxCtx->polyXlu.p; cos = Math_Coss((0x4000 / arg3) * arg2); gDPPipeSync(displayListHead++); gDPSetFogColor(displayListHead++, color->r, color->g, color->b, color->a); gSPFogPosition(displayListHead++, 0, (s16)(2800.0f * ABS(cos)) + 1700); - gfxCtx->polyXlu.p = displayListHead; + oGfxCtx->polyXlu.p = displayListHead; if (1) {} // Necessary to match - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 212); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 212); } void func_80026A6C(GlobalContext* globalCtx) { s32 pad; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 217); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 217); - gDPPipeSync(gfxCtx->polyXlu.p++); - gfxCtx->polyXlu.p = func_800BC8A0(globalCtx, gfxCtx->polyXlu.p); + gDPPipeSync(oGfxCtx->polyXlu.p++); + oGfxCtx->polyXlu.p = func_800BC8A0(globalCtx, oGfxCtx->polyXlu.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 222); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_eff_ss_dead.c", 222); } diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index a7b7fba35a..0847ad682d 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -319,10 +319,8 @@ void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) { void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 type = thisx->params; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_a_keep.c", 701); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 701); func_80093D18(globalCtx->state.gfxCtx); @@ -331,12 +329,12 @@ void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) { } if (thisx->params == A_OBJ_KNOB) { - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 1, 60, 60, 60, 50); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 1, 60, 60, 60, 50); } - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 712), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 712), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, D_80115484[type]); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_80115484[type]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_a_keep.c", 715); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 715); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 9eea31b153..22436eace8 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -733,11 +733,10 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { * Draw Function used for Rupee types of En_Item00. */ void func_8001EF30(EnItem00* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + s32 pad; s32 iconNb; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1546); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1546); func_80093D18(globalCtx->state.gfxCtx); func_8002EBCC(&this->actor, globalCtx, 0); @@ -750,14 +749,14 @@ void func_8001EF30(EnItem00* this, GlobalContext* globalCtx) { } } - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1562), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80115530[iconNb])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80115530[iconNb])); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_04042440); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_04042440); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1568); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1568); } /** @@ -765,14 +764,12 @@ void func_8001EF30(EnItem00* this, GlobalContext* globalCtx) { */ void func_8001F080(EnItem00* this, GlobalContext* globalCtx) { s32 iconNb; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; iconNb = this->actor.params - 3; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1594); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1594); - gfxCtx->polyOpa.p = func_800BC8A0(globalCtx, gfxCtx->polyOpa.p); + oGfxCtx->polyOpa.p = func_800BC8A0(globalCtx, oGfxCtx->polyOpa.p); if (this->actor.params == ITEM00_BOMBS_SPECIAL) { iconNb = 1; @@ -780,57 +777,55 @@ void func_8001F080(EnItem00* this, GlobalContext* globalCtx) { iconNb -= 3; } - gfxCtx->polyOpa.p = func_800946E4(gfxCtx->polyOpa.p); + oGfxCtx->polyOpa.p = func_800946E4(oGfxCtx->polyOpa.p); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80115544[iconNb])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80115544[iconNb])); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1607), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_0403F070); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_0403F070); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1611); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1611); } /** * Draw Function used for the Heart Container type of En_Item00. */ void func_8001F1F4(EnItem00* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1623); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1623); func_80093D18(globalCtx->state.gfxCtx); func_8002EBCC(&this->actor, globalCtx, 0); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1634), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1634), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_0403BBA0); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_0403BBA0); func_80093D84(globalCtx->state.gfxCtx); func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1644), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1644), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_0403BCD8); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_0403BCD8); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1647); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1647); } /** * Draw Function used for the Piece of Heart type of En_Item00. */ void func_8001F334(EnItem00* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1658); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1658); func_80093D84(globalCtx->state.gfxCtx); func_8002ED80(&this->actor, globalCtx, 0); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1670), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_item00.c", 1670), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_0403B030); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_0403B030); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_item00.c", 1673); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_item00.c", 1673); } /** diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 5aabe18f8b..7e3500fc17 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -102,10 +102,8 @@ s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve) { void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* actor) { SkelCurveLimb* limb = SEGMENTED_TO_VIRTUAL(skelCurve->limbList[limbIndex]); - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279); Matrix_Push(); @@ -138,27 +136,27 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* dList = limb->dList[0]; if (dList != NULL) { - gSPMatrix(gfxCtx->polyOpa.p++, + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 321), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, dList); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList); } } else if (lod == 1) { s32 pad2; dList = limb->dList[0]; if (dList != NULL) { - gSPMatrix(gfxCtx->polyOpa.p++, + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 332), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, dList); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList); } dList = limb->dList[1]; if (dList != NULL) { - gSPMatrix(gfxCtx->polyXlu.p++, + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 338), G_MTX_LOAD | G_MTX_NOPUSH | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, dList); + gSPDisplayList(oGfxCtx->polyXlu.p++, dList); } } else { // FcSkeletonInfo_draw_child (): Not supported @@ -180,7 +178,7 @@ void SkelCurve_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, SkelAnimeCurve* SkelCurve_DrawLimb(globalCtx, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, actor); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371); } void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 883c7a5492..ce770af1b9 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -206,9 +206,8 @@ void Health_Draw(GlobalContext* globalCtx) { s32 curCombineModeSet = 0; u8* curBgImgLoaded = NULL; s32 ddHeartCountMinusOne = gSaveContext.defenseHearts - 1; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_lifemeter.c", 353); + OPEN_DISPS(gfxCtx, "../z_lifemeter.c", 353); if (!(gSaveContext.health % 0x10)) { fullHeartCount--; @@ -223,37 +222,37 @@ void Health_Draw(GlobalContext* globalCtx) { if (i < fullHeartCount) { if (curColorSet != 0) { curColorSet = 0; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], + gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], interfaceCtx->unk_21A[4], 0xFF); } } else if (i == fullHeartCount) { if (curColorSet != 1) { curColorSet = 1; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_202[0], interfaceCtx->unk_202[1], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_202[0], interfaceCtx->unk_202[1], interfaceCtx->unk_202[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_208[0], interfaceCtx->unk_208[1], + gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_208[0], interfaceCtx->unk_208[1], interfaceCtx->unk_208[2], 0xFF); } } else if (i > fullHeartCount) { if (curColorSet != 2) { curColorSet = 2; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2], interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], + gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2], interfaceCtx->unk_21A[4], 0xFF); } } else { if (curColorSet != 3) { curColorSet = 3; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[1], interfaceCtx->unk_20E[3], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, interfaceCtx->unk_20E[1], interfaceCtx->unk_20E[3], interfaceCtx->unk_20E[5], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, interfaceCtx->unk_21A[1], interfaceCtx->unk_21A[3], + gDPSetEnvColor(oGfxCtx->overlay.p++, interfaceCtx->unk_21A[1], interfaceCtx->unk_21A[3], interfaceCtx->unk_21A[5], 0xFF); } } @@ -269,34 +268,34 @@ void Health_Draw(GlobalContext* globalCtx) { if (i < fullHeartCount) { if (curColorSet != 4) { curColorSet = 4; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); + gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); } } else if (i == fullHeartCount) { if (curColorSet != 5) { curColorSet = 5; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDC0[0], D_8015FDC0[1], D_8015FDC0[2], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDC0[0], D_8015FDC0[1], D_8015FDC0[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDC8[0], D_8015FDC8[1], D_8015FDC8[2], 0xFF); + gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDC8[0], D_8015FDC8[1], D_8015FDC8[2], 0xFF); } } else if (i > fullHeartCount) { if (curColorSet != 6) { curColorSet = 6; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDD0[0], D_8015FDD0[1], D_8015FDD0[2], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); + gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDE0[0], D_8015FDE0[1], D_8015FDE0[2], 0xFF); } } else { if (curColorSet != 7) { curColorSet = 7; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, D_8015FDD0[3], D_8015FDD0[4], D_8015FDD0[5], + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, D_8015FDD0[3], D_8015FDD0[4], D_8015FDD0[5], interfaceCtx->healthAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, D_8015FDE0[3], D_8015FDE0[4], D_8015FDE0[5], 0xFF); + gDPSetEnvColor(oGfxCtx->overlay.p++, D_8015FDE0[3], D_8015FDE0[4], D_8015FDE0[5], 0xFF); } } @@ -311,7 +310,7 @@ void Health_Draw(GlobalContext* globalCtx) { if (curBgImgLoaded != heartBgImg) { curBgImgLoaded = heartBgImg; - gDPLoadTextureBlock(gfxCtx->overlay.p++, heartBgImg, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, + gDPLoadTextureBlock(oGfxCtx->overlay.p++, heartBgImg, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); } @@ -321,7 +320,7 @@ void Health_Draw(GlobalContext* globalCtx) { if (curCombineModeSet != 1) { curCombineModeSet = 1; func_80094520(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); } @@ -329,7 +328,7 @@ void Health_Draw(GlobalContext* globalCtx) { if (curCombineModeSet != 3) { curCombineModeSet = 3; func_80094520(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, + gDPSetCombineLERP(oGfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); } } @@ -341,7 +340,7 @@ void Health_Draw(GlobalContext* globalCtx) { temp4 *= 1024.0f; temp1 = 8.0f; temp1 *= 0.68f; - gSPTextureRectangle(gfxCtx->overlay.p++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4), + gSPTextureRectangle(oGfxCtx->overlay.p++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4), (s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4), G_TX_RENDERTILE, 0, 0, (s32)temp4, (s32)temp4); } else { @@ -349,7 +348,7 @@ void Health_Draw(GlobalContext* globalCtx) { if (curCombineModeSet != 2) { curCombineModeSet = 2; func_80094A14(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); } @@ -357,18 +356,18 @@ void Health_Draw(GlobalContext* globalCtx) { if (curCombineModeSet != 4) { curCombineModeSet = 4; func_80094A14(gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, + gDPSetCombineLERP(oGfxCtx->overlay.p++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); } } - if (1) { + { Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); func_800D2CEC(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), -130.0f + offsetX, 94.5f - offsetY, 0.0f); - gSPMatrix(gfxCtx->overlay.p++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD); - gSPVertex(gfxCtx->overlay.p++, sp154, 4, 0); - gSP1Quadrangle(gfxCtx->overlay.p++, 0, 2, 3, 1, 0); + gSPMatrix(oGfxCtx->overlay.p++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPVertex(oGfxCtx->overlay.p++, sp154, 4, 0); + gSP1Quadrangle(oGfxCtx->overlay.p++, 0, 2, 3, 1, 0); } } @@ -379,7 +378,7 @@ void Health_Draw(GlobalContext* globalCtx) { } } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_lifemeter.c", 606); + CLOSE_DISPS(gfxCtx, "../z_lifemeter.c", 606); } u32 Health_IsCritical(void); diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 301bda17b9..2ca226389b 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -314,22 +314,19 @@ void Map_Init(GlobalContext* globalCtx) { #ifdef NON_MATCHING // regalloc and minor ordering differences void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; Player* player = PLAYER; s16 tempX, tempY, tempZ; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_map_exp.c", 565); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 565); if (globalCtx->interfaceCtx.minimapAlpha >= 0xAA) { func_80094A14(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->overlay.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + gSPMatrix(oGfxCtx->overlay.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, 255); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 255); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); tempX = player->actor.posRot.pos.x; tempZ = player->actor.posRot.pos.z; @@ -340,11 +337,11 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { Matrix_RotateX(-1.6f, MTXMODE_APPLY); tempY = (0x7FFF - player->actor.shape.rot.y) / 0x400; Matrix_RotateY(tempY / 10.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 585), + gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 585), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 200, 255, 0, 255); - gSPDisplayList(gfxCtx->overlay.p++, D_0400C820); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 200, 255, 0, 255); + gSPDisplayList(oGfxCtx->overlay.p++, D_0400C820); tempX = sPlayerInitialPosX; tempZ = sPlayerInitialPosZ; @@ -354,14 +351,14 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { Matrix_Scale(VREG(9) / 100.0f, VREG(9) / 100.0f, VREG(9) / 100.0f, MTXMODE_APPLY); Matrix_RotateX(VREG(52) / 10.0f, MTXMODE_APPLY); Matrix_RotateY(sPlayerInitialDirection / 10.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 603), + gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 603), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0xFF, 200, 0, 0, 255); - gSPDisplayList(gfxCtx->overlay.p++, D_0400C820); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0xFF, 200, 0, 0, 255); + gSPDisplayList(oGfxCtx->overlay.p++, D_0400C820); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_map_exp.c", 607); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 607); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/Minimap_DrawCompassIcons.s") @@ -371,10 +368,8 @@ void Minimap_Draw(GlobalContext* globalCtx) { s32 pad[2]; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s32 mapIndex = gSaveContext.mapIndex; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_map_exp.c", 626); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 626); if (globalCtx->pauseCtx.state < 4) { switch (globalCtx->sceneNum) { @@ -390,17 +385,17 @@ void Minimap_Draw(GlobalContext* globalCtx) { case SCENE_ICE_DOUKUTO: if (!R_MINIMAP_TOGGLED) { func_80094520(globalCtx->state.gfxCtx); - gDPSetCombineLERP(gfxCtx->overlay.p++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, - 0, TEXEL0, 0, PRIMITIVE, 0); + gDPSetCombineLERP(oGfxCtx->overlay.p++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, + PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); if (gSaveContext.dungeonItems[mapIndex] & gBitFlags[DUNGEON_MAP]) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha); - gDPLoadTextureBlock_4b(gfxCtx->overlay.p++, interfaceCtx->mapSegment, G_IM_FMT_I, 96, 85, 0, + gDPLoadTextureBlock_4b(oGfxCtx->overlay.p++, interfaceCtx->mapSegment, G_IM_FMT_I, 96, 85, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, R_DGN_MINIMAP_X << 2, R_DGN_MINIMAP_Y << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_DGN_MINIMAP_X << 2, R_DGN_MINIMAP_Y << 2, (R_DGN_MINIMAP_X + 96) << 2, (R_DGN_MINIMAP_Y + 85) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); } @@ -447,16 +442,16 @@ void Minimap_Draw(GlobalContext* globalCtx) { if (!R_MINIMAP_TOGGLED) { func_80094520(globalCtx->state.gfxCtx); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2), interfaceCtx->minimapAlpha); - gDPLoadTextureBlock_4b(gfxCtx->overlay.p++, interfaceCtx->mapSegment, G_IM_FMT_IA, + gDPLoadTextureBlock_4b(oGfxCtx->overlay.p++, interfaceCtx->mapSegment, G_IM_FMT_IA, gMapData->owMinimapWidth[mapIndex], gMapData->owMinimapHeight[mapIndex], 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, R_OW_MINIMAP_X << 2, R_OW_MINIMAP_Y << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_OW_MINIMAP_X << 2, R_OW_MINIMAP_Y << 2, (R_OW_MINIMAP_X + gMapData->owMinimapWidth[mapIndex]) << 2, (R_OW_MINIMAP_Y + gMapData->owMinimapHeight[mapIndex]) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); @@ -468,11 +463,11 @@ void Minimap_Draw(GlobalContext* globalCtx) { ((gMapData->owEntranceFlag[sEntranceIconMapIndex] != 0xFFFF) && (gSaveContext.infTable[26] & gBitFlags[gMapData->owEntranceFlag[mapIndex]]))) { - gDPLoadTextureBlock(gfxCtx->overlay.p++, D_02002500, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, + gDPLoadTextureBlock(oGfxCtx->overlay.p++, D_02002500, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, + gSPTextureRectangle(oGfxCtx->overlay.p++, gMapData->owEntranceIconPosX[sEntranceIconMapIndex] << 2, gMapData->owEntranceIconPosY[sEntranceIconMapIndex] << 2, (gMapData->owEntranceIconPosX[sEntranceIconMapIndex] + 8) << 2, @@ -482,11 +477,11 @@ void Minimap_Draw(GlobalContext* globalCtx) { } if ((globalCtx->sceneNum == SCENE_SPOT08) && (gSaveContext.infTable[26] & gBitFlags[9])) { - gDPLoadTextureBlock(gfxCtx->overlay.p++, D_02002500, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, + gDPLoadTextureBlock(oGfxCtx->overlay.p++, D_02002500, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, 1080, 616, 1112, 648, G_TX_RENDERTILE, 0, 0, 1024, + gSPTextureRectangle(oGfxCtx->overlay.p++, 1080, 616, 1112, 648, G_TX_RENDERTILE, 0, 0, 1024, 1024); } @@ -507,7 +502,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { } } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_map_exp.c", 782); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 782); } s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) { diff --git a/src/code/z_map_mark.c b/src/code/z_map_mark.c index 52836d8ec6..5597c77114 100644 --- a/src/code/z_map_mark.c +++ b/src/code/z_map_mark.c @@ -83,8 +83,6 @@ void MapMark_Draw(GlobalContext* globalCtx) { s32 i; s32 rectLeft; s32 rectTop; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; dungeon = gSaveContext.mapIndex; interfaceCtx = &globalCtx->interfaceCtx; @@ -98,32 +96,31 @@ void MapMark_Draw(GlobalContext* globalCtx) { mapMarkData = &sLoadedMarkDataTable[dungeon][interfaceCtx->mapRoomNum][0]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_map_mark.c", 303); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 303); while (1) { if (mapMarkData->markType == -1) { break; } - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTextureLUT(gfxCtx->overlay.p++, G_TT_NONE); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->minimapAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, interfaceCtx->minimapAlpha); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTextureLUT(oGfxCtx->overlay.p++, G_TT_NONE); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->minimapAlpha); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, interfaceCtx->minimapAlpha); markPoint = &mapMarkData->points[0]; for (i = 0; i < mapMarkData->count; i++) { if ((mapMarkData->markType != 0) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag)) { markInfo = &sMapMarkInfoTable[mapMarkData->markType]; - gDPPipeSync(gfxCtx->overlay.p++); - gDPLoadTextureBlock(gfxCtx->overlay.p++, markInfo->texture, markInfo->imageFormat, G_IM_SIZ_MARK, + gDPPipeSync(oGfxCtx->overlay.p++); + gDPLoadTextureBlock(oGfxCtx->overlay.p++, markInfo->texture, markInfo->imageFormat, G_IM_SIZ_MARK, markInfo->textureWidth, markInfo->textureHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); rectLeft = (GREG(94) + markPoint->x + 204) << 2; rectTop = (GREG(95) + markPoint->y + 140) << 2; - gSPTextureRectangle(gfxCtx->overlay.p++, rectLeft, rectTop, markInfo->rectWidth + rectLeft, + gSPTextureRectangle(oGfxCtx->overlay.p++, rectLeft, rectTop, markInfo->rectWidth + rectLeft, rectTop + markInfo->rectHeight, G_TX_RENDERTILE, 0, 0, markInfo->dsdx, markInfo->dtdy); } @@ -132,7 +129,7 @@ void MapMark_Draw(GlobalContext* globalCtx) { mapMarkData++; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_map_mark.c", 339); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_mark.c", 339); } void MapMark_DrawConditionally(GlobalContext* globalCtx) { diff --git a/src/code/z_moji.c b/src/code/z_moji.c index d7366ceb93..16649a22dc 100644 --- a/src/code/z_moji.c +++ b/src/code/z_moji.c @@ -37,48 +37,47 @@ void func_8007B934(s32 arg0, s32 arg1) { } void func_8007B9A4(GraphicsContext* gfxCtx, u8 arg1) { - Gfx* dispRefs[7]; + s32 pad[2]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_moji.c", 86); + OPEN_DISPS(gfxCtx, "../z_moji.c", 86); if ((u32)gLetterTLUT & 0xF) { osSyncPrintf("moji_tlut --> %X\n", gLetterTLUT); } if (D_8015FFC0 != (arg1 & 3)) { - gDPLoadTLUT(gfxCtx->polyOpa.p++, 16, 256, &gLetterTLUT[arg1 & 3]); + gDPLoadTLUT(oGfxCtx->polyOpa.p++, 16, 256, &gLetterTLUT[arg1 & 3]); D_8015FFC0 = arg1 & 3; } - gSPTextureRectangle(gfxCtx->polyOpa.p++, D_80120120 << 2, D_80120124 << 2, (D_80120120 + 8) << 2, + gSPTextureRectangle(oGfxCtx->polyOpa.p++, D_80120120 << 2, D_80120124 << 2, (D_80120120 + 8) << 2, (D_80120124 + 8) << 2, G_TX_RENDERTILE, (u16)(arg1 & 4) * 64, (u16)(arg1 >> 3) * 256, 1024, 1024); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_moji.c", 123); + CLOSE_DISPS(gfxCtx, "../z_moji.c", 123); } void func_8007BBA8(GraphicsContext* gfxCtx, u8* arg1) { s32 i; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_moji.c", 137); + OPEN_DISPS(gfxCtx, "../z_moji.c", 137); if ((u32)gFontFF & 0xF) { osSyncPrintf("font_ff --> %X\n", gFontFF); } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, sFontColorRed, sFontColorGreen, sFontColorBlue, sFontColorAlpha); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, sFontColorRed, sFontColorGreen, sFontColorBlue, sFontColorAlpha); - gDPSetTextureImage(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, 1, (s32)gFontFF); - gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + gDPSetTextureImage(oGfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, 1, (s32)gFontFF); + gDPSetTile(oGfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->polyOpa.p++); - gDPLoadBlock(gfxCtx->polyOpa.p++, G_TX_LOADTILE, 0, 0, 511, 2048); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + gDPLoadSync(oGfxCtx->polyOpa.p++); + gDPLoadBlock(oGfxCtx->polyOpa.p++, G_TX_LOADTILE, 0, 0, 511, 2048); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetTile(oGfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->polyOpa.p++, G_TX_RENDERTILE, 0, 0, 60, 508); + gDPSetTileSize(oGfxCtx->polyOpa.p++, G_TX_RENDERTILE, 0, 0, 60, 508); D_8015FFC0 = -1; @@ -108,5 +107,5 @@ void func_8007BBA8(GraphicsContext* gfxCtx, u8* arg1) { } } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_moji.c", 181); + CLOSE_DISPS(gfxCtx, "../z_moji.c", 181); } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index d5c48350e0..07a632db25 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2557,11 +2557,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx); void Interface_DrawMagicBar(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 magicBarY; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 2650); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2650); if (gSaveContext.magicLevel != 0) { if (gSaveContext.healthCapacity > 0xA0) { @@ -2572,71 +2569,71 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { func_80094520(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, interfaceCtx->magicAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 100, 50, 50, 255); + gDPSetEnvColor(oGfxCtx->overlay.p++, 100, 50, 50, 255); - gfxCtx->overlay.p = - Gfx_TextureIA8(gfxCtx->overlay.p, D_020038C0, 8, 16, R_MAGIC_BAR_X, magicBarY, 8, 16, 1024, 1024); + oGfxCtx->overlay.p = + Gfx_TextureIA8(oGfxCtx->overlay.p, D_020038C0, 8, 16, R_MAGIC_BAR_X, magicBarY, 8, 16, 1024, 1024); - gfxCtx->overlay.p = Gfx_TextureIA8(gfxCtx->overlay.p, D_02003940, 24, 16, R_MAGIC_BAR_X + 8, magicBarY, - gSaveContext.unk_13F4, 16, 1024, 1024); + oGfxCtx->overlay.p = Gfx_TextureIA8(oGfxCtx->overlay.p, D_02003940, 24, 16, R_MAGIC_BAR_X + 8, magicBarY, + gSaveContext.unk_13F4, 16, 1024, 1024); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_020038C0); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_020038C0); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_MIRROR | G_TX_WRAP, 3, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 63, 2048); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 63, 2048); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_MIRROR | G_TX_WRAP, 3, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 28, 60); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 28, 60); - gSPTextureRectangle(gfxCtx->overlay.p++, ((R_MAGIC_BAR_X + gSaveContext.unk_13F4) + 8) << 2, magicBarY << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, ((R_MAGIC_BAR_X + gSaveContext.unk_13F4) + 8) << 2, magicBarY << 2, ((R_MAGIC_BAR_X + gSaveContext.unk_13F4) + 16) << 2, (magicBarY + 16) << 2, G_TX_RENDERTILE, 256, 0, 1024, 1024); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE, + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, 255); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 255); if (gSaveContext.unk_13F0 == 4) { // Yellow part of the bar being used when casting a spell - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 250, 250, 0, interfaceCtx->magicAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 250, 250, 0, interfaceCtx->magicAlpha); - gDPLoadMultiBlock_4b(gfxCtx->overlay.p++, D_02003AC0, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, + gDPLoadMultiBlock_4b(oGfxCtx->overlay.p++, D_02003AC0, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, (R_MAGIC_FILL_X + gSaveContext.magic) << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); // Fill the rest of the bar with the normal magic color - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, (R_MAGIC_FILL_X + gSaveContext.unk_13F8) << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); } else { // Fill the whole bar with the normal magic color - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha); - gDPLoadMultiBlock_4b(gfxCtx->overlay.p++, D_02003AC0, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, + gDPLoadMultiBlock_4b(oGfxCtx->overlay.p++, D_02003AC0, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPTextureRectangle(gfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_MAGIC_FILL_X << 2, (magicBarY + 3) << 2, (R_MAGIC_FILL_X + gSaveContext.magic) << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); } } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 2731); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2731); } void func_80088AA0(s16 arg0) { @@ -2676,23 +2673,21 @@ void func_80088B34(s16 arg0) { } void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_parameter.c", 2820); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_parameter.c", 2820); - - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, texture); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, texture); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); - gSP1Quadrangle(gfxCtx->overlay.p++, 0, 2, 3, 1, 0); + gSP1Quadrangle(oGfxCtx->overlay.p++, 0, 2, 3, 1, 0); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_parameter.c", 2829); + CLOSE_DISPS(gfxCtx, "../z_parameter.c", 2829); } u8* sCUpLabelTextures[] = { D_02002FC0, D_02002FC0, D_02002FC0 }; @@ -2708,75 +2703,71 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { s16 i; // sp+0x14A s16 cUpAlpha; s32 pad; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 2900); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2900); // B Button Color & Texture // Also loads the Item Button Texture reused by other buttons afterwards - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2), + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2), interfaceCtx->bAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, 255); - gfxCtx->overlay.p = - Gfx_TextureIA8(gfxCtx->overlay.p, &D_02000A00[0], 32, 32, R_ITEM_BTN_X(0), R_ITEM_BTN_Y(0), R_ITEM_BTN_WIDTH(0), - R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) * 2, R_ITEM_BTN_DD(0) * 2); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 255); + oGfxCtx->overlay.p = + Gfx_TextureIA8(oGfxCtx->overlay.p, &D_02000A00[0], 32, 32, R_ITEM_BTN_X(0), R_ITEM_BTN_Y(0), + R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) * 2, R_ITEM_BTN_DD(0) * 2); // C-Left Button Color & Texture - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_BTN_X(1) << 2, R_ITEM_BTN_Y(1) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_ITEM_BTN_X(1) << 2, R_ITEM_BTN_Y(1) << 2, (R_ITEM_BTN_X(1) + R_ITEM_BTN_WIDTH(1)) << 2, (R_ITEM_BTN_Y(1) + R_ITEM_BTN_WIDTH(1)) << 2, G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(1) * 2, R_ITEM_BTN_DD(1) * 2); // C-Down Button Color & Texture - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_BTN_X(2) << 2, R_ITEM_BTN_Y(2) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_ITEM_BTN_X(2) << 2, R_ITEM_BTN_Y(2) << 2, (R_ITEM_BTN_X(2) + R_ITEM_BTN_WIDTH(2)) << 2, (R_ITEM_BTN_Y(2) + R_ITEM_BTN_WIDTH(2)) << 2, G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(2) * 2, R_ITEM_BTN_DD(2) * 2); // C-Right Button Color & Texture - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_BTN_X(3) << 2, R_ITEM_BTN_Y(3) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_ITEM_BTN_X(3) << 2, R_ITEM_BTN_Y(3) << 2, (R_ITEM_BTN_X(3) + R_ITEM_BTN_WIDTH(3)) << 2, (R_ITEM_BTN_Y(3) + R_ITEM_BTN_WIDTH(3)) << 2, G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) * 2, R_ITEM_BTN_DD(3) * 2); if ((globalCtx->pauseCtx.state < 8) || (globalCtx->pauseCtx.state >= 18)) { if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.flag != 0)) { // Start Button Texture, Color & Label - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha); - gSPTextureRectangle(gfxCtx->overlay.p++, sStartButtonLeftPos[gSaveContext.language] << 2, 68, + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha); + gSPTextureRectangle(oGfxCtx->overlay.p++, sStartButtonLeftPos[gSaveContext.language] << 2, 68, (sStartButtonLeftPos[gSaveContext.language] + 22) << 2, 156, G_TX_RENDERTILE, 0, 0, 1462, 1462); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->startAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, 0); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->startAlpha); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 0); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (u32)interfaceCtx->do_actionSegment + 0x300); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0, G_TX_RENDERTILE, 0, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); temp = R_START_LABEL_DD(gSaveContext.language) / 100.0f; - gSPTextureRectangle(gfxCtx->overlay.p++, R_START_LABEL_X(gSaveContext.language) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_START_LABEL_X(gSaveContext.language) << 2, R_START_LABEL_Y(gSaveContext.language) << 2, (R_START_LABEL_X(gSaveContext.language) + (s16)(16.0f / temp)) << 2, (R_START_LABEL_Y(gSaveContext.language) + (s16)(48.0f / temp)) << 2, G_TX_RENDERTILE, 0, @@ -2788,7 +2779,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { (globalCtx->csCtx.state == 0)) { if (!sCUpInvisible) { // C-Up Button Texture, Color & Label (Navi Text) - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) { cUpAlpha = 0; @@ -2799,30 +2790,30 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { cUpAlpha = interfaceCtx->healthAlpha; } - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), cUpAlpha); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gSPTextureRectangle(gfxCtx->overlay.p++, R_C_UP_BTN_X << 2, R_C_UP_BTN_Y << 2, (R_C_UP_BTN_X + 16) << 2, + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), cUpAlpha); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gSPTextureRectangle(oGfxCtx->overlay.p++, R_C_UP_BTN_X << 2, R_C_UP_BTN_Y << 2, (R_C_UP_BTN_X + 16) << 2, (R_C_UP_BTN_Y + 16) << 2, G_TX_RENDERTILE, 0, 0, 2048, 2048); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, cUpAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, 0); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, cUpAlpha); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 0); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, sCUpLabelTextures[gSaveContext.language]); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 63, 1024); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 2, 0, G_TX_RENDERTILE, 0, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 63, 1024); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 2, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 28); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 28); - gSPTextureRectangle(gfxCtx->overlay.p++, R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, (R_C_UP_ICON_X + 32) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, (R_C_UP_ICON_X + 32) << 2, (R_C_UP_ICON_Y + 8) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); } @@ -2833,29 +2824,29 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { } } - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); // Empty C Button Arrows for (i = 1; i < 4; i++) { if (gSaveContext.equips.buttonItems[i] > 0xF0) { if (i == 1) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha); } else if (i == 2) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha); } else { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha); } - gfxCtx->overlay.p = - Gfx_TextureIA8(gfxCtx->overlay.p, &D_02000A00[i + 1], 0x20, 0x20, R_ITEM_BTN_X(i), R_ITEM_BTN_Y(i), + oGfxCtx->overlay.p = + Gfx_TextureIA8(oGfxCtx->overlay.p, &D_02000A00[i + 1], 0x20, 0x20, R_ITEM_BTN_X(i), R_ITEM_BTN_Y(i), R_ITEM_BTN_WIDTH(i), R_ITEM_BTN_WIDTH(i), R_ITEM_BTN_DD(i) * 2, R_ITEM_BTN_DD(i) * 2); } } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3071); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3071); } #else void Interface_DrawItemButtons(GlobalContext* globalCtx); @@ -2863,45 +2854,39 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx); #endif void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3079); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3079); + gDPLoadTextureBlock(oGfxCtx->overlay.p++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); - gDPLoadTextureBlock(gfxCtx->overlay.p++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, - G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - - gSPTextureRectangle(gfxCtx->overlay.p++, R_ITEM_ICON_X(button) << 2, R_ITEM_ICON_Y(button) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_ITEM_ICON_X(button) << 2, R_ITEM_ICON_Y(button) << 2, (R_ITEM_ICON_X(button) + R_ITEM_ICON_WIDTH(button)) << 2, (R_ITEM_ICON_Y(button) + R_ITEM_ICON_WIDTH(button)) << 2, G_TX_RENDERTILE, 0, 0, R_ITEM_ICON_DD(button) * 2, R_ITEM_ICON_DD(button) * 2); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3094); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3094); } void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { - s16 item; - s16 ammo; - GraphicsContext* gfxCtx; s16 i; - Gfx* dispRefs[3]; + s16 ammo; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3105); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3105); - item = gSaveContext.equips.buttonItems[button]; + i = gSaveContext.equips.buttonItems[button]; - if ((item == ITEM_STICK) || (item == ITEM_NUT) || (item == ITEM_BOMB) || (item == ITEM_BOW) || - ((item >= ITEM_BOW_ARROW_FIRE) && (item <= ITEM_BOW_ARROW_LIGHT)) || (item == ITEM_SLINGSHOT) || - (item == ITEM_BOMBCHU) || (item == ITEM_BEAN)) { - if ((item >= ITEM_BOW_ARROW_FIRE) && (item <= ITEM_BOW_ARROW_LIGHT)) { - item = ITEM_BOW; + if ((i == ITEM_STICK) || (i == ITEM_NUT) || (i == ITEM_BOMB) || (i == ITEM_BOW) || + ((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) || (i == ITEM_SLINGSHOT) || (i == ITEM_BOMBCHU) || + (i == ITEM_BEAN)) { + + if ((i >= ITEM_BOW_ARROW_FIRE) && (i <= ITEM_BOW_ARROW_LIGHT)) { + i = ITEM_BOW; } - ammo = AMMO(item); + ammo = AMMO(i); - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); if ((button == 0) && (gSaveContext.minigameState == 1)) { ammo = globalCtx->interfaceCtx.hbaAmmo; @@ -2912,17 +2897,17 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { if (ammo < 0) { ammo = 0; } - } else if (((item == ITEM_BOW) && (AMMO(item) == CUR_CAPACITY(UPG_QUIVER))) || - ((item == ITEM_BOMB) && (AMMO(item) == CUR_CAPACITY(UPG_BOMB_BAG))) || - ((item == ITEM_SLINGSHOT) && (AMMO(item) == CUR_CAPACITY(UPG_BULLET_BAG))) || - ((item == ITEM_STICK) && (AMMO(item) == CUR_CAPACITY(UPG_STICKS))) || - ((item == ITEM_NUT) && (AMMO(item) == CUR_CAPACITY(UPG_NUTS))) || - ((item == ITEM_BOMBCHU) && (ammo == 50)) || ((item == ITEM_BEAN) && (ammo == 15))) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 120, 255, 0, alpha); + } else if (((i == ITEM_BOW) && (AMMO(i) == CUR_CAPACITY(UPG_QUIVER))) || + ((i == ITEM_BOMB) && (AMMO(i) == CUR_CAPACITY(UPG_BOMB_BAG))) || + ((i == ITEM_SLINGSHOT) && (AMMO(i) == CUR_CAPACITY(UPG_BULLET_BAG))) || + ((i == ITEM_STICK) && (AMMO(i) == CUR_CAPACITY(UPG_STICKS))) || + ((i == ITEM_NUT) && (AMMO(i) == CUR_CAPACITY(UPG_NUTS))) || ((i == ITEM_BOMBCHU) && (ammo == 50)) || + ((i == ITEM_BEAN) && (ammo == 15))) { + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 120, 255, 0, alpha); } if (ammo == 0) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 100, 100, 100, alpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 100, 100, 100, alpha); } for (i = 0; ammo >= 10; i++) { @@ -2930,24 +2915,21 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) { } if (i != 0) { - gfxCtx->overlay.p = Gfx_TextureIA8(gfxCtx->overlay.p, &D_020035C0[i], 8, 8, R_ITEM_AMMO_X(button), - R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024); + oGfxCtx->overlay.p = Gfx_TextureIA8(oGfxCtx->overlay.p, &D_020035C0[i], 8, 8, R_ITEM_AMMO_X(button), + R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024); } - gfxCtx->overlay.p = Gfx_TextureIA8(gfxCtx->overlay.p, &D_020035C0[ammo], 8, 8, R_ITEM_AMMO_X(button) + 6, - R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024); + oGfxCtx->overlay.p = Gfx_TextureIA8(oGfxCtx->overlay.p, &D_020035C0[ammo], 8, 8, R_ITEM_AMMO_X(button) + 6, + R_ITEM_AMMO_Y(button), 8, 8, 1024, 1024); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3158); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3158); } void Interface_DrawActionButton(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3172); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3172); Matrix_Translate(0.0f, 0.0f, XREG(18) / 10.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); @@ -2955,17 +2937,17 @@ void Interface_DrawActionButton(GlobalContext* globalCtx) { if (1) {} // Necessary to match - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3177), + gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3177), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPVertex(gfxCtx->overlay.p++, interfaceCtx->vtx_128, 4, 0); + gSPVertex(oGfxCtx->overlay.p++, interfaceCtx->vtx_128, 4, 0); - gDPLoadTextureBlock(gfxCtx->overlay.p++, &D_02000A00[0], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, + gDPLoadTextureBlock(oGfxCtx->overlay.p++, &D_02000A00[0], G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSP1Quadrangle(gfxCtx->overlay.p++, 0, 2, 3, 1, 0); + gSP1Quadrangle(oGfxCtx->overlay.p++, 0, 2, 3, 1, 0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3187); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3187); } void Interface_InitVertices(GlobalContext* globalCtx) { @@ -3115,17 +3097,13 @@ void Interface_Draw(GlobalContext* globalCtx) { s16 phi_s1; s16 phi_s0; s16 sp274; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - s32 pad; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 3405); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3405); - gSPSegment(gfxCtx->overlay.p++, 0x02, interfaceCtx->parameterSegment); - gSPSegment(gfxCtx->overlay.p++, 0x07, interfaceCtx->do_actionSegment); - gSPSegment(gfxCtx->overlay.p++, 0x08, interfaceCtx->icon_itemSegment); - gSPSegment(gfxCtx->overlay.p++, 0x0B, interfaceCtx->mapSegment); + gSPSegment(oGfxCtx->overlay.p++, 0x02, interfaceCtx->parameterSegment); + gSPSegment(oGfxCtx->overlay.p++, 0x07, interfaceCtx->do_actionSegment); + gSPSegment(oGfxCtx->overlay.p++, 0x08, interfaceCtx->icon_itemSegment); + gSPSegment(oGfxCtx->overlay.p++, 0x0B, interfaceCtx->mapSegment); if (pauseCtx->flag == 0) { Interface_InitVertices(globalCtx); @@ -3135,9 +3113,9 @@ void Interface_Draw(GlobalContext* globalCtx) { func_80094520(globalCtx->state.gfxCtx); // Rupee Icon - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 80, 0, 255); - gfxCtx->overlay.p = Gfx_TextureIA8(gfxCtx->overlay.p, D_02001F00, 16, 16, 26, 206, 16, 16, 1024, 1024); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 200, 255, 100, interfaceCtx->magicAlpha); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 80, 0, 255); + oGfxCtx->overlay.p = Gfx_TextureIA8(oGfxCtx->overlay.p, D_02001F00, 16, 16, 26, 206, 16, 16, 1024, 1024); switch (globalCtx->sceneNum) { case SCENE_BMORI1: @@ -3156,16 +3134,16 @@ void Interface_Draw(GlobalContext* globalCtx) { case SCENE_TAKARAYA: if (gSaveContext.dungeonKeys[gSaveContext.mapIndex] >= 0) { // Small Key Icon - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 20, 255); - gfxCtx->overlay.p = - Gfx_TextureIA8(gfxCtx->overlay.p, D_02001E00, 16, 16, 26, 190, 16, 16, 1024, 1024); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 20, 255); + oGfxCtx->overlay.p = + Gfx_TextureIA8(oGfxCtx->overlay.p, D_02001E00, 16, 16, 26, 190, 16, 16, 1024, 1024); // Small Key Counter - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha); - gDPSetCombineLERP(gfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha); + gDPSetCombineLERP(oGfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); interfaceCtx->counterDigits[2] = 0; @@ -3178,14 +3156,14 @@ void Interface_Draw(GlobalContext* globalCtx) { phi_s2 = 42; if (interfaceCtx->counterDigits[2] != 0) { - gfxCtx->overlay.p = - Gfx_TextureI8(gfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[2]], 8, 16, phi_s2, - 190, 8, 16, 1024, 1024); + oGfxCtx->overlay.p = + Gfx_TextureI8(oGfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[2]], 8, 16, + phi_s2, 190, 8, 16, 1024, 1024); phi_s2 = 50; } - gfxCtx->overlay.p = Gfx_TextureI8(gfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[3]], 8, - 16, phi_s2, 190, 8, 16, 1024, 1024); + oGfxCtx->overlay.p = Gfx_TextureI8(oGfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[3]], + 8, 16, phi_s2, 190, 8, 16, 1024, 1024); } phi_s2 = 42; @@ -3198,17 +3176,17 @@ void Interface_Draw(GlobalContext* globalCtx) { phi_s2 = 42; // Rupee Counter - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); if (gSaveContext.rupees == CUR_CAPACITY(UPG_WALLET)) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha); } else if (gSaveContext.rupees != 0) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha); } else { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha); } - gDPSetCombineLERP(gfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, + gDPSetCombineLERP(oGfxCtx->overlay.p++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); interfaceCtx->counterDigits[0] = interfaceCtx->counterDigits[1] = 0; @@ -3232,8 +3210,8 @@ void Interface_Draw(GlobalContext* globalCtx) { phi_s1 = sRupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)]; for (phi_s3 = 0; phi_s3 < phi_s1; phi_s3++, phi_s0++, phi_s2 += 8) { - gfxCtx->overlay.p = Gfx_TextureI8(gfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[phi_s0]], 8, - 16, phi_s2, 206, 8, 16, 1024, 1024); + oGfxCtx->overlay.p = Gfx_TextureI8(oGfxCtx->overlay.p, &D_02003040[interfaceCtx->counterDigits[phi_s0]], 8, + 16, phi_s2, 206, 8, 16, 1024, 1024); } Interface_DrawMagicBar(globalCtx); @@ -3247,9 +3225,9 @@ void Interface_Draw(GlobalContext* globalCtx) { Interface_DrawItemButtons(globalCtx); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (interfaceCtx->unk_1FA == 0) { // B Button Icon & possibly Ammo Count @@ -3258,8 +3236,8 @@ void Interface_Draw(GlobalContext* globalCtx) { if ((player->stateFlags1 & 0x00800000) || (globalCtx->unk_11E5C >= 2) || ((globalCtx->sceneNum == SCENE_BOWLING) && Flags_GetSwitch(globalCtx, 0x38))) { - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawAmmoCount(globalCtx, 0, interfaceCtx->bAlpha); @@ -3267,91 +3245,91 @@ void Interface_Draw(GlobalContext* globalCtx) { } } else { // B Button Do Action Label - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (u32)interfaceCtx->do_actionSegment + 0x180); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0x0000, G_TX_RENDERTILE, 0, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 191, 683); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60); R_B_LABEL_DD = 1024.0f / (WREG(37 + gSaveContext.language) / 100.0f); - gSPTextureRectangle(gfxCtx->overlay.p++, R_B_LABEL_X(gSaveContext.language) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, R_B_LABEL_X(gSaveContext.language) << 2, R_B_LABEL_Y(gSaveContext.language) << 2, (R_B_LABEL_X(gSaveContext.language) + 48) << 2, (R_B_LABEL_Y(gSaveContext.language) + 16) << 2, G_TX_RENDERTILE, 0, 0, R_B_LABEL_DD, R_B_LABEL_DD); } - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); // C-Left Button Icon & Ammo Count if (gSaveContext.equips.buttonItems[1] < 0xF0) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->cLeftAlpha); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x1000), 1); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawAmmoCount(globalCtx, 1, interfaceCtx->cLeftAlpha); } - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); // C-Down Button Icon & Ammo Count if (gSaveContext.equips.buttonItems[2] < 0xF0) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->cDownAlpha); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x2000), 2); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawAmmoCount(globalCtx, 2, interfaceCtx->cDownAlpha); } - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); // C-Right Button Icon & Ammo Count if (gSaveContext.equips.buttonItems[3] < 0xF0) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->cRightAlpha); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); Interface_DrawItemIconTexture(globalCtx, (void*)((u32)interfaceCtx->icon_itemSegment + 0x3000), 3); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, + 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); Interface_DrawAmmoCount(globalCtx, 3, interfaceCtx->cRightAlpha); } // A Button func_80094A14(globalCtx->state.gfxCtx); func_8008A8B8(globalCtx, R_A_BTN_Y, R_A_BTN_Y + 45, R_A_BTN_X, R_A_BTN_X + 45); - gSPClearGeometryMode(gfxCtx->overlay.p++, G_CULL_BOTH); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), + gSPClearGeometryMode(oGfxCtx->overlay.p++, G_CULL_BOTH); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), interfaceCtx->aAlpha); Interface_DrawActionButton(globalCtx); - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); func_8008A8B8(globalCtx, R_A_ICON_Y, R_A_ICON_Y + 45, R_A_ICON_X, R_A_ICON_X + 45); - gSPSetGeometryMode(gfxCtx->overlay.p++, G_CULL_BACK); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + gSPSetGeometryMode(oGfxCtx->overlay.p++, G_CULL_BACK); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, 0); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 0); Matrix_Translate(0.0f, 0.0f, WREG(46 + gSaveContext.language) / 10.0f, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3701), + gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3701), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPVertex(gfxCtx->overlay.p++, &interfaceCtx->vtx_128[4], 4, 0); + gSPVertex(oGfxCtx->overlay.p++, &interfaceCtx->vtx_128[4], 4, 0); if ((interfaceCtx->unk_1EC < 2) || (interfaceCtx->unk_1EC == 3)) { Interface_DrawActionLabel(globalCtx->state.gfxCtx, (void*)(u32)interfaceCtx->do_actionSegment); @@ -3359,16 +3337,16 @@ void Interface_Draw(GlobalContext* globalCtx) { Interface_DrawActionLabel(globalCtx->state.gfxCtx, (void*)((u32)interfaceCtx->do_actionSegment + 0x180)); } - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); func_8008A994(interfaceCtx); if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 3)) { // Inventory Equip Effects - gSPSegment(gfxCtx->overlay.p++, 0x08, pauseCtx->unk_128); + gSPSegment(oGfxCtx->overlay.p++, 0x08, pauseCtx->unk_128); func_80094A14(globalCtx->state.gfxCtx); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); - gSPMatrix(gfxCtx->overlay.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gSPMatrix(oGfxCtx->overlay.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); pauseCtx->vtx_168[16].v.ob[0] = pauseCtx->vtx_168[18].v.ob[0] = pauseCtx->unk_254 / 10; pauseCtx->vtx_168[17].v.ob[0] = pauseCtx->vtx_168[19].v.ob[0] = @@ -3379,25 +3357,25 @@ void Interface_Draw(GlobalContext* globalCtx) { if (pauseCtx->unk_24E < 0xBF) { // Normal Equip (icon goes from the inventory slot to the C button when equipping it) - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, pauseCtx->unk_258); - gSPVertex(gfxCtx->overlay.p++, &pauseCtx->vtx_168[16], 4, 0); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, pauseCtx->unk_258); + gSPVertex(oGfxCtx->overlay.p++, &pauseCtx->vtx_168[16], 4, 0); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, gItemIcons[pauseCtx->unk_24E]); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0x0000, G_TX_LOADTILE, 0, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, gItemIcons[pauseCtx->unk_24E]); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 1023, 128); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 8, 0x0000, G_TX_RENDERTILE, 0, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 1023, 128); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 8, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 124); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 124); } else { // Magic Arrow Equip Effect phi_s3_2 = pauseCtx->unk_24E - 0xBF; - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, sMagicArrowEffectsR[phi_s3_2], sMagicArrowEffectsG[phi_s3_2], - sMagicArrowEffectsB[phi_s3_2], pauseCtx->unk_258); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, sMagicArrowEffectsR[phi_s3_2], + sMagicArrowEffectsG[phi_s3_2], sMagicArrowEffectsB[phi_s3_2], pauseCtx->unk_258); if ((pauseCtx->unk_258 > 0) && (pauseCtx->unk_258 < 0xFF)) { phi_s3_2 = (pauseCtx->unk_258 / 8) / 2; @@ -3411,21 +3389,21 @@ void Interface_Draw(GlobalContext* globalCtx) { pauseCtx->vtx_168[16].v.ob[1] - phi_s3_2 * 2 - 32; } - gSPVertex(gfxCtx->overlay.p++, &pauseCtx->vtx_168[16], 4, 0); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_080895C0); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, + gSPVertex(oGfxCtx->overlay.p++, &pauseCtx->vtx_168[16], 4, 0); + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_080895C0); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 511, 512); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0x0000, G_TX_RENDERTILE, 0, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 511, 512); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 124); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 124); } - gSP1Quadrangle(gfxCtx->overlay.p++, 0, 2, 3, 1, 0); + gSP1Quadrangle(oGfxCtx->overlay.p++, 0, 2, 3, 1, 0); } func_80094520(globalCtx->state.gfxCtx); @@ -3435,29 +3413,29 @@ void Interface_Draw(GlobalContext* globalCtx) { // Carrots rendering if the action corresponds to riding a horse if (interfaceCtx->unk_1EE == 8) { // Load Carrot Icon - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, &D_02002100); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0x0000, G_TX_LOADTILE, 0, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, &D_02002100); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 255, 256); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 4, 0x0000, G_TX_RENDERTILE, 0, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 255, 256); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 4, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 60, 60); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 60, 60); // Draw 6 carrots phi_s1 = ZREG(14); for (phi_s3 = 1; phi_s3 < 7; phi_s3++) { // Carrot Color (based on availability) if ((interfaceCtx->unk_23A == 0) || (interfaceCtx->unk_23A < phi_s3)) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0, 150, 255, interfaceCtx->aAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 0, 150, 255, interfaceCtx->aAlpha); } else { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->aAlpha); } - gSPTextureRectangle(gfxCtx->overlay.p++, phi_s1 << 2, ZREG(15) << 2, (phi_s1 + 16) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, phi_s1 << 2, ZREG(15) << 2, (phi_s1 + 16) << 2, (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); phi_s1 += 16; @@ -3465,42 +3443,42 @@ void Interface_Draw(GlobalContext* globalCtx) { } } else { // Score for the Horseback Archery - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha); // Target Icon - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, D_02002600); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, D_02002600); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadBlock(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 383, 342); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 6, 0x0000, G_TX_RENDERTILE, 0, + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadBlock(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, 383, 342); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 6, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 92, 60); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 92, 60); - gSPTextureRectangle(gfxCtx->overlay.p++, (WREG(32) + 28) << 2, ZREG(15) << 2, (WREG(32) + 52) << 2, + gSPTextureRectangle(oGfxCtx->overlay.p++, (WREG(32) + 28) << 2, ZREG(15) << 2, (WREG(32) + 52) << 2, (ZREG(15) + 16) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); // Score Counter - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); phi_s0 = 0; phi_s1 = WREG(32) + 6 * 9; for (phi_s3 = 0; phi_s3 < 4; phi_s3++) { if (sHBAScoreDigits[phi_s3] != 0 || (phi_s0 != 0) || (phi_s3 >= 3)) { - gfxCtx->overlay.p = - Gfx_TextureI8(gfxCtx->overlay.p, &D_02003040[sHBAScoreDigits[phi_s3]], 8, 16, phi_s1, + oGfxCtx->overlay.p = + Gfx_TextureI8(oGfxCtx->overlay.p, &D_02003040[sHBAScoreDigits[phi_s3]], 8, 16, phi_s1, ZREG(15) - 2, sDigitWidth[0], VREG(42), VREG(43) * 2, VREG(43) * 2); phi_s1 += 9; phi_s0++; } } - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); } } @@ -3881,35 +3859,35 @@ void Interface_Draw(GlobalContext* globalCtx) { } // Clock Icon - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, 255); - gDPSetEnvColor(gfxCtx->overlay.p++, 0, 0, 0, 0); - gfxCtx->overlay.p = Gfx_TextureIA8(gfxCtx->overlay.p, D_02002000, 16, 16, gSaveContext.timerX[sp274], - gSaveContext.timerY[sp274] + 2, 16, 16, 1024, 1024); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, 255); + gDPSetEnvColor(oGfxCtx->overlay.p++, 0, 0, 0, 0); + oGfxCtx->overlay.p = Gfx_TextureIA8(oGfxCtx->overlay.p, D_02002000, 16, 16, gSaveContext.timerX[sp274], + gSaveContext.timerY[sp274] + 2, 16, 16, 1024, 1024); // Timer Counter - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCombineMode(gfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCombineMode(oGfxCtx->overlay.p++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (gSaveContext.timer1State != 0) { if ((gSaveContext.timer1Value < 10) && (gSaveContext.timer1State < 11)) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 50, 0, 255); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 50, 0, 255); } else { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 255, 255); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 255, 255); } } else { if ((gSaveContext.timer2Value < 10) && (gSaveContext.timer2State < 6)) { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 50, 0, 255); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 50, 0, 255); } else { - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 255, 255, 0, 255); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 255, 255, 0, 255); } } for (phi_s3 = 0; phi_s3 < 5; phi_s3++) { - gfxCtx->overlay.p = Gfx_TextureI8(gfxCtx->overlay.p, &D_02003040[sTimerDigits[phi_s3]], 8, 16, - gSaveContext.timerX[sp274] + sTimerDigitLeftPos[phi_s3], - gSaveContext.timerY[sp274], sDigitWidth[phi_s3], VREG(42), - VREG(43) * 2, VREG(43) * 2); + oGfxCtx->overlay.p = Gfx_TextureI8(oGfxCtx->overlay.p, &D_02003040[sTimerDigits[phi_s3]], 8, 16, + gSaveContext.timerX[sp274] + sTimerDigitLeftPos[phi_s3], + gSaveContext.timerY[sp274], sDigitWidth[phi_s3], VREG(42), + VREG(43) * 2, VREG(43) * 2); } } } @@ -3920,13 +3898,13 @@ void Interface_Draw(GlobalContext* globalCtx) { } if (interfaceCtx->unk_244 != 0) { - gDPPipeSync(gfxCtx->overlay.p++); - gSPDisplayList(gfxCtx->overlay.p++, sSetupDL_80125A60); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0, 0, 0, interfaceCtx->unk_244); - gDPFillRectangle(gfxCtx->overlay.p++, 0, 0, gScreenWidth - 1, gScreenHeight - 1); + gDPPipeSync(oGfxCtx->overlay.p++); + gSPDisplayList(oGfxCtx->overlay.p++, sSetupDL_80125A60); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0, 0, 0, 0, interfaceCtx->unk_244); + gDPFillRectangle(oGfxCtx->overlay.p++, 0, 0, gScreenWidth - 1, gScreenHeight - 1); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_parameter.c", 4269); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 4269); } #else s16 D_8015FFE0; diff --git a/src/code/z_play.c b/src/code/z_play.c index 5e40fce7ba..a75b99846a 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -223,18 +223,18 @@ void Gameplay_Init(GlobalContext* globalCtx) { globalCtx->cameraPtrs[i] = NULL; } - func_80057C6C(&globalCtx->cameras[0], &globalCtx->view, &globalCtx->colCtx, globalCtx); - Camera_ChangeStatus(&globalCtx->cameras[0], 7); + func_80057C6C(&globalCtx->mainCamera, &globalCtx->view, &globalCtx->colCtx, globalCtx); + Camera_ChangeStatus(&globalCtx->mainCamera, 7); for (i = 0; i < 3; i++) { - func_80057C6C(&globalCtx->cameras[i + 1], &globalCtx->view, &globalCtx->colCtx, globalCtx); - Camera_ChangeStatus(&globalCtx->cameras[i + 1], 0x100); + func_80057C6C(&globalCtx->subCameras[i], &globalCtx->view, &globalCtx->colCtx, globalCtx); + Camera_ChangeStatus(&globalCtx->subCameras[i], 0x100); } - globalCtx->cameraPtrs[0] = &globalCtx->cameras[0]; + globalCtx->cameraPtrs[0] = &globalCtx->mainCamera; globalCtx->cameraPtrs[0]->uid = 0; globalCtx->activeCamera = 0; - func_8005AC48(&globalCtx->cameras[0], 0xFF); + func_8005AC48(&globalCtx->mainCamera, 0xFF); func_800A9D28(globalCtx, &globalCtx->sub_1F74); func_80112098(globalCtx); func_80110F68(globalCtx); @@ -385,13 +385,13 @@ void Gameplay_Init(GlobalContext* globalCtx) { } player = PLAYER; - func_80058148(&globalCtx->cameras[0], player); - func_8005A444(&globalCtx->cameras[0], 0); + func_80058148(&globalCtx->mainCamera, player); + func_8005A444(&globalCtx->mainCamera, 0); playerStartCamId = player->actor.params & 0xFF; if (playerStartCamId != 0xFF) { osSyncPrintf("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartCamId); - func_8005A7A8(&globalCtx->cameras[0], playerStartCamId); + func_8005A7A8(&globalCtx->mainCamera, playerStartCamId); } if (YREG(15) == 0x20) { @@ -1070,39 +1070,37 @@ void Gameplay_DrawOverlayElements(GlobalContext* globalCtx) { #ifdef NON_MATCHING // regalloc, stack usage and minor ordering differences void Gameplay_Draw(GlobalContext* globalCtx) { + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; LightMapper* sp228; Vec3f sp21C; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; // 0x208 - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_play.c", 3907); + OPEN_DISPS(gfxCtx, "../z_play.c", 3907); gSegments[4] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); gSegments[5] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); gSegments[2] = PHYSICAL_TO_VIRTUAL(globalCtx->sceneSegment); - gSPSegment(gfxCtx->polyOpa.p++, 0x00, NULL); - gSPSegment(gfxCtx->polyXlu.p++, 0x00, NULL); - gSPSegment(gfxCtx->overlay.p++, 0x00, NULL); + gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL); + gSPSegment(oGfxCtx->polyXlu.p++, 0x00, NULL); + gSPSegment(oGfxCtx->overlay.p++, 0x00, NULL); - gSPSegment(gfxCtx->polyOpa.p++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); - gSPSegment(gfxCtx->polyXlu.p++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); - gSPSegment(gfxCtx->overlay.p++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); + gSPSegment(oGfxCtx->overlay.p++, 0x04, globalCtx->objectCtx.status[globalCtx->objectCtx.mainKeepIndex].segment); - gSPSegment(gfxCtx->polyOpa.p++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); - gSPSegment(gfxCtx->polyXlu.p++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); - gSPSegment(gfxCtx->overlay.p++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); + gSPSegment(oGfxCtx->overlay.p++, 0x05, globalCtx->objectCtx.status[globalCtx->objectCtx.subKeepIndex].segment); - gSPSegment(gfxCtx->polyOpa.p++, 0x02, globalCtx->sceneSegment); - gSPSegment(gfxCtx->polyXlu.p++, 0x02, globalCtx->sceneSegment); - gSPSegment(gfxCtx->overlay.p++, 0x02, globalCtx->sceneSegment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x02, globalCtx->sceneSegment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x02, globalCtx->sceneSegment); + gSPSegment(oGfxCtx->overlay.p++, 0x02, globalCtx->sceneSegment); func_80095248(gfxCtx, 0, 0, 0); if ((HREG(80) != 10) || (HREG(82) != 0)) { - gfxCtx->polyOpa.p = func_800BC8A0(globalCtx, gfxCtx->polyOpa.p); - gfxCtx->polyXlu.p = func_800BC8A0(globalCtx, gfxCtx->polyXlu.p); + oGfxCtx->polyOpa.p = func_800BC8A0(globalCtx, oGfxCtx->polyOpa.p); + oGfxCtx->polyXlu.p = func_800BC8A0(globalCtx, oGfxCtx->polyXlu.p); func_800AA460(&globalCtx->view, globalCtx->view.fovy, globalCtx->view.zNear, globalCtx->lightCtx.unk_0C); func_800AAA50(&globalCtx->view, 15); @@ -1122,12 +1120,12 @@ void Gameplay_Draw(GlobalContext* globalCtx) { globalCtx->unk_11DE0 = Matrix_MtxFToMtx(Matrix_CheckFloats(&globalCtx->mf_11DA0, "../z_play.c", 4005), Graph_Alloc(gfxCtx, sizeof(Mtx))); - gSPSegment(gfxCtx->polyOpa.p++, 0x01, globalCtx->unk_11DE0); + gSPSegment(oGfxCtx->polyOpa.p++, 0x01, globalCtx->unk_11DE0); if ((HREG(80) != 10) || (HREG(92) != 0)) { - Gfx* sp1CC = gfxCtx->polyOpa.p; - Gfx* gfxP = Graph_GfxPlusOne(gfxCtx->polyOpa.p); - gSPDisplayList(gfxCtx->overlay.p++, gfxP); + Gfx* sp1CC = oGfxCtx->polyOpa.p; + Gfx* gfxP = Graph_GfxPlusOne(oGfxCtx->polyOpa.p); + gSPDisplayList(oGfxCtx->overlay.p++, gfxP); if ((globalCtx->transitionMode == 3) || (globalCtx->transitionMode == 11) || (globalCtx->transitionCtx.transitionType >= 56)) { @@ -1151,13 +1149,13 @@ void Gameplay_Draw(GlobalContext* globalCtx) { gSPEndDisplayList(gfxP++); Graph_BranchDlist(sp1CC, gfxP); - gfxCtx->polyOpa.p = gfxP; + oGfxCtx->polyOpa.p = gfxP; } if (gTrnsnUnkState == 3) { - Gfx* sp88 = gfxCtx->polyOpa.p; + Gfx* sp88 = oGfxCtx->polyOpa.p; TransitionUnk_Draw(&sTrnsnUnk, &sp88); - gfxCtx->polyOpa.p = sp88; + oGfxCtx->polyOpa.p = sp88; goto Gameplay_Draw_DrawOverlayElements; } else { func_800C0ED8(&globalCtx->preRenderCtx, 0x140, 0xF0, gfxCtx->curFrameBuffer, gZBuffer); @@ -1171,9 +1169,9 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } if (R_PAUSE_MENU_MODE == 3) { - Gfx* sp84 = gfxCtx->polyOpa.p; + Gfx* sp84 = oGfxCtx->polyOpa.p; func_800C24BC(&globalCtx->preRenderCtx, &sp84); - gfxCtx->polyOpa.p = sp84; + oGfxCtx->polyOpa.p = sp84; goto Gameplay_Draw_DrawOverlayElements; } else { s32 sp80; @@ -1288,7 +1286,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } if ((R_PAUSE_MENU_MODE == 1) || (gTrnsnUnkState == 1)) { - Gfx* sp70 = gfxCtx->overlay.p; + Gfx* sp70 = oGfxCtx->overlay.p; globalCtx->preRenderCtx.unk_10 = gfxCtx->curFrameBuffer; globalCtx->preRenderCtx.unk_14 = gZBuffer; func_800C1F20(&globalCtx->preRenderCtx, &sp70); @@ -1299,7 +1297,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } else { gTrnsnUnkState = 2; } - gfxCtx->overlay.p = sp70; + oGfxCtx->overlay.p = sp70; globalCtx->preRenderCtx.unk_A3 = 2; SREG(33) |= 1; } else { @@ -1325,7 +1323,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) { func_80059EC8(ACTIVE_CAM); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_play.c", 4508); + CLOSE_DISPS(gfxCtx, "../z_play.c", 4508); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Gameplay_Draw.s") @@ -1531,7 +1529,7 @@ s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) { CYAN) " " VT_RST "\n", i); - globalCtx->cameraPtrs[i] = &globalCtx->cameras[i]; + globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - 1]; func_80057C6C(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx); globalCtx->cameraPtrs[i]->unk_164 = i; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 1b11906294..1cd544e2cd 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -506,23 +506,20 @@ void func_800906D4(GlobalContext* globalCtx, Player* player, ColliderTrisItemDim void func_800907E4(GlobalContext* globalCtx, Player* player, Vec3f* arg2, s32 arg3) { f32 sp4C; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; sp4C = (player->exchangeItemId != 0) ? 6.0f : 14.0f; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_player_lib.c", 0x961); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 0x961); gSegments[6] = PHYSICAL_TO_VIRTUAL(player->getItemModel); - gSPSegment(gfxCtx->polyOpa.p++, 0x06, player->getItemModel); - gSPSegment(gfxCtx->polyXlu.p++, 0x06, player->getItemModel); + gSPSegment(oGfxCtx->polyOpa.p++, 0x06, player->getItemModel); + gSPSegment(oGfxCtx->polyXlu.p++, 0x06, player->getItemModel); Matrix_Translate(arg2->x + (Math_Sins(player->actor.shape.rot.y) * 3.3f), arg2->y + sp4C, arg2->z + ((3.3f + (IREG(90) / 10.0f)) * Math_Coss(player->actor.shape.rot.y)), MTXMODE_NEW); Matrix_RotateRPY(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); func_800694A0(globalCtx, arg3 - 1); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_player_lib.c", 0x975); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 0x975); } void func_800909B4(GlobalContext* globalCtx, Player* player) { @@ -558,8 +555,6 @@ void func_80090AFC(GlobalContext* globalCtx, Player* player, f32 arg2) { Vec3f sp68; f32 sp64; f32 sp60; - Gfx* dispRefs[5]; // TODO confirm size - GraphicsContext* gfxCtx; D_801260D0 = 0.0f; Matrix_MultVec3f(&D_801260C8, &sp8C); @@ -567,10 +562,9 @@ void func_80090AFC(GlobalContext* globalCtx, Player* player, f32 arg2) { Matrix_MultVec3f(&D_801260C8, &sp80); if (func_8003E188(&globalCtx->colCtx, &sp8C, &sp80, &sp74, &sp9C, 1, 1, 1, 1, &sp98) != 0) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_player_lib.c", 0xA0C); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 0xA0C); - gfxCtx->overlay.p = Gfx_CallSetupDL(gfxCtx->overlay.p, 7); + oGfxCtx->overlay.p = Gfx_CallSetupDL(oGfxCtx->overlay.p, 7); SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &sp74, &sp68, &sp64); @@ -579,12 +573,12 @@ void func_80090AFC(GlobalContext* globalCtx, Player* player, f32 arg2) { Matrix_Translate(sp74.x, sp74.y, sp74.z, MTXMODE_NEW); Matrix_Scale(sp60, sp60, sp60, MTXMODE_APPLY); - gSPMatrix(gfxCtx->overlay.p++, Matrix_NewMtx(gfxCtx, "../z_player_lib.c", 0xA1B), + gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_player_lib.c", 0xA1B), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(gfxCtx->overlay.p++, 0x06, globalCtx->objectCtx.status[player->actor.objBankIndex].segment); - gSPDisplayList(gfxCtx->overlay.p++, &D_0602CB48); + gSPSegment(oGfxCtx->overlay.p++, 0x06, globalCtx->objectCtx.status[player->actor.objBankIndex].segment); + gSPDisplayList(oGfxCtx->overlay.p++, &D_0602CB48); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_player_lib.c", 0xA20); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 0xA20); } } #else diff --git a/src/code/z_prenmi.c b/src/code/z_prenmi.c index c897083e5a..eeae441cea 100644 --- a/src/code/z_prenmi.c +++ b/src/code/z_prenmi.c @@ -26,19 +26,18 @@ void PreNMI_Update(PreNMIContext* prenmiCtx) { void PreNMI_Draw(PreNMIContext* prenmiCtx) { GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx; - Gfx* dispRefs[5]; osSyncPrintf(VT_COL(YELLOW, BLACK) "prenmi_draw\n" VT_RST); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_prenmi.c", 96); + OPEN_DISPS(gfxCtx, "../z_prenmi.c", 96); - gSPSegment(gfxCtx->polyOpa.p++, 0x00, NULL); + gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL); func_80095248(gfxCtx, 0, 0, 0); func_800940B0(gfxCtx); - gDPSetFillColor(gfxCtx->polyOpa.p++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1)); - gDPFillRectangle(gfxCtx->polyOpa.p++, 0, prenmiCtx->timer + 100, SCREEN_WIDTH - 1, prenmiCtx->timer + 100); + gDPSetFillColor(oGfxCtx->polyOpa.p++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1)); + gDPFillRectangle(oGfxCtx->polyOpa.p++, 0, prenmiCtx->timer + 100, SCREEN_WIDTH - 1, prenmiCtx->timer + 100); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_prenmi.c", 112); + CLOSE_DISPS(gfxCtx, "../z_prenmi.c", 112); } void PreNMI_Main(PreNMIContext* prenmiCtx) { diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 63c2d93820..4adc982fc3 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -857,169 +857,137 @@ Gfx* func_80093808(Gfx* gfx) { } void func_80093848(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1293); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1293); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x3A]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x3A]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1297); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1297); } void func_800938B4(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1309); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1309); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x39]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x39]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1313); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1313); } void func_80093920(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1325); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1325); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x32]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x32]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1329); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1329); } void func_8009398C(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1341); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1341); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x33]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x33]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1345); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1345); } void func_800939F8(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1357); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1357); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x34]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x34]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1361); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1361); } void func_80093A64(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1373); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1373); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x35]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x35]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1377); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1377); } void func_80093AD0(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1389); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1389); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x36]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x36]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1393); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1393); } void func_80093B3C(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1405); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1405); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x37]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x37]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1409); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1409); } void func_80093BA8(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1421); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1421); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1A]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1A]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1425); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1425); } void func_80093C14(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1439); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1439); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1443); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1443); } void func_80093C80(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[5]; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - gfxCtx = globalCtx->state.gfxCtx; func_80093D18(gfxCtx); if (globalCtx->roomCtx.curRoom.unk_03 == 3) { - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1460); + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1460); - gDPSetColorDither(gfxCtx->polyOpa.p++, G_CD_DISABLE); + gDPSetColorDither(oGfxCtx->polyOpa.p++, G_CD_DISABLE); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1462); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1462); } } void func_80093D18(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1475); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1475); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x19]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x19]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1479); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1479); } void func_80093D84(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1491); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1491); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x19]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1495); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1495); } void func_80093DF0(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1507); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1507); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1F]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1F]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1511); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1511); } void func_80093E5C(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1523); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1523); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x20]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x20]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1527); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1527); } void func_80093EC8(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1539); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1539); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x21]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x21]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1543); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1543); } Gfx* func_80093F34(Gfx* gfx) { @@ -1033,43 +1001,35 @@ Gfx* func_80093F58(Gfx* gfx) { } void func_80093F7C(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1569); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1569); + oGfxCtx->polyOpa.p = func_80093F58(oGfxCtx->polyOpa.p); - gfxCtx->polyOpa.p = func_80093F58(gfxCtx->polyOpa.p); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1573); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1573); } void func_80093FD8(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1585); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1585); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x23]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x23]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1589); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1589); } void func_80094044(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1601); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1601); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x2C]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x2C]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1605); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1605); } void func_800940B0(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1617); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1617); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x24]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x24]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1621); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1621); } Gfx* func_8009411C(Gfx* gfx) { @@ -1078,83 +1038,67 @@ Gfx* func_8009411C(Gfx* gfx) { } void func_80094140(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1640); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1640); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1C]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x1C]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1644); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1644); } void func_800941AC(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1651); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1651); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2B]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2B]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1655); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1655); } void func_80094218(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1670); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1670); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2D]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2D]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1674); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1674); } void func_80094284(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1681); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1681); + gSPDisplayList(oGfxCtx->overlay.p++, &sSetupDL[6 * 0x2E]); - gSPDisplayList(gfxCtx->overlay.p++, &sSetupDL[6 * 0x2E]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1685); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1685); } void func_800942F0(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1700); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1700); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x26]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x26]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1704); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1704); } void func_8009435C(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1722); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1722); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x04]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x04]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1726); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1726); } void func_800943C8(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1758); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1758); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x25]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x25]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1762); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1762); } void func_80094434(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1775); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1775); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x02]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x02]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1779); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1779); } Gfx* func_800944A0(Gfx* gfx) { @@ -1163,23 +1107,19 @@ Gfx* func_800944A0(Gfx* gfx) { } void func_800944C4(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1799); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1799); + oGfxCtx->polyOpa.p = func_800944A0(oGfxCtx->polyOpa.p); - gfxCtx->polyOpa.p = func_800944A0(gfxCtx->polyOpa.p); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1801); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1801); } void func_80094520(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1809); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1809); + oGfxCtx->overlay.p = func_800944A0(oGfxCtx->overlay.p); - gfxCtx->overlay.p = func_800944A0(gfxCtx->overlay.p); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1811); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1811); } void func_8009457C(Gfx** gfxp) { @@ -1189,33 +1129,27 @@ void func_8009457C(Gfx** gfxp) { } void func_800945A0(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1837); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1837); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x28]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x28]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1841); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1841); } void func_8009460C(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1853); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1853); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x29]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x29]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1857); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1857); } void func_80094678(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1869); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1869); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x2F]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x2F]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1873); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1873); } Gfx* func_800946E4(Gfx* gfx) { @@ -1275,84 +1209,68 @@ Gfx* func_80094968(Gfx* gfx) { } void func_800949A8(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1953); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1953); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2A]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x2A]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1957); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1957); } void func_80094A14(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1964); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1964); + gSPDisplayList(oGfxCtx->overlay.p++, &sSetupDL[6 * 0x2A]); - gSPDisplayList(gfxCtx->overlay.p++, &sSetupDL[6 * 0x2A]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1968); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1968); } void func_80094A80(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 1992); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 1992); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x30]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x30]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 1996); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1996); } void func_80094AEC(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2008); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2008); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x31]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x31]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2012); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2012); } void func_80094B58(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2024); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2024); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x1B]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x1B]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2028); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2028); } void func_80094BC4(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2040); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2040); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x3C]); + gDPSetColorDither(oGfxCtx->polyXlu.p++, G_CD_DISABLE); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x3C]); - gDPSetColorDither(gfxCtx->polyXlu.p++, G_CD_DISABLE); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2043); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2043); } void func_80094C50(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2056); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2056); + gSPDisplayList(oGfxCtx->polyXlu.p++, &sSetupDL[6 * 0x3D]); - gSPDisplayList(gfxCtx->polyXlu.p++, &sSetupDL[6 * 0x3D]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2058); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2058); } void func_80094CBC(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2086); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2086); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x38]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x38]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2090); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2090); } void func_80094D28(Gfx** gfxp) { @@ -1362,13 +1280,11 @@ void func_80094D28(Gfx** gfxp) { } void func_80094D4C(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2112); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2112); + gSPDisplayList(oGfxCtx->polyOpa.p++, &sSetupDL[6 * 0x3B]); - gSPDisplayList(gfxCtx->polyOpa.p++, &sSetupDL[6 * 0x3B]); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2116); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2116); } Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) { @@ -1448,30 +1364,27 @@ Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a) { } void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { - Gfx* dispRefs[5]; - s32 ret; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2386); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2386); + gSPDisplayList(oGfxCtx->polyOpa.p++, sFillSetupDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, sFillSetupDL); + gSPDisplayList(oGfxCtx->overlay.p++, sFillSetupDL); - gSPDisplayList(gfxCtx->polyOpa.p++, sFillSetupDL); - gSPDisplayList(gfxCtx->polyXlu.p++, sFillSetupDL); - gSPDisplayList(gfxCtx->overlay.p++, sFillSetupDL); + gDPSetScissorFrac(oGfxCtx->polyOpa.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); + gDPSetScissorFrac(oGfxCtx->polyXlu.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); + gDPSetScissorFrac(oGfxCtx->overlay.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); - gDPSetScissorFrac(gfxCtx->polyOpa.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); - gDPSetScissorFrac(gfxCtx->polyXlu.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); - gDPSetScissorFrac(gfxCtx->overlay.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); + gDPSetColorImage(oGfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); + gDPSetColorImage(oGfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); + gDPSetColorImage(oGfxCtx->polyXlu.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); + gDPSetColorImage(oGfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - gDPSetColorImage(gfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - gDPSetColorImage(gfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - gDPSetColorImage(gfxCtx->polyXlu.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - gDPSetColorImage(gfxCtx->overlay.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - - gDPSetDepthImage(gfxCtx->polyOpa.p++, gZBuffer); - gDPSetDepthImage(gfxCtx->polyXlu.p++, gZBuffer); - gDPSetDepthImage(gfxCtx->overlay.p++, gZBuffer); + gDPSetDepthImage(oGfxCtx->polyOpa.p++, gZBuffer); + gDPSetDepthImage(oGfxCtx->polyXlu.p++, gZBuffer); + gDPSetDepthImage(oGfxCtx->overlay.p++, gZBuffer); if ((R_PAUSE_MENU_MODE < 2) && (gTrnsnUnkState < 2)) { - ret = ShrinkWindow_GetCurrentVal(); + s32 ret = ShrinkWindow_GetCurrentVal(); if (HREG(80) == 16) { if (HREG(95) != 16) { @@ -1513,44 +1426,42 @@ void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) { } } - gDPSetColorImage(gfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gZBuffer); - gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_FILL); - gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_NOOP, G_RM_NOOP2); - gDPSetFillColor(gfxCtx->polyOpa.p++, + gDPSetColorImage(oGfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gZBuffer); + gDPSetCycleType(oGfxCtx->polyOpa.p++, G_CYC_FILL); + gDPSetRenderMode(oGfxCtx->polyOpa.p++, G_RM_NOOP, G_RM_NOOP2); + gDPSetFillColor(oGfxCtx->polyOpa.p++, (GPACK_RGBA5551(255, 255, 240, 0) << 16) | GPACK_RGBA5551(255, 255, 240, 0)); - gDPFillRectangle(gfxCtx->polyOpa.p++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1); - gDPPipeSync(gfxCtx->polyOpa.p++); + gDPFillRectangle(oGfxCtx->polyOpa.p++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1); + gDPPipeSync(oGfxCtx->polyOpa.p++); - gDPSetColorImage(gfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_FILL); - gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_NOOP, G_RM_NOOP2); - gDPSetFillColor(gfxCtx->polyOpa.p++, (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1)); - gDPFillRectangle(gfxCtx->polyOpa.p++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1); - gDPPipeSync(gfxCtx->polyOpa.p++); + gDPSetColorImage(oGfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); + gDPSetCycleType(oGfxCtx->polyOpa.p++, G_CYC_FILL); + gDPSetRenderMode(oGfxCtx->polyOpa.p++, G_RM_NOOP, G_RM_NOOP2); + gDPSetFillColor(oGfxCtx->polyOpa.p++, (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1)); + gDPFillRectangle(oGfxCtx->polyOpa.p++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1); + gDPPipeSync(oGfxCtx->polyOpa.p++); if (ret > 0) { - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetCycleType(gfxCtx->overlay.p++, G_CYC_FILL); - gDPSetRenderMode(gfxCtx->overlay.p++, G_RM_NOOP, G_RM_NOOP2); - gDPSetFillColor(gfxCtx->overlay.p++, (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1)); - gDPFillRectangle(gfxCtx->overlay.p++, 0, 0, gScreenWidth - 1, ret - 1); - gDPFillRectangle(gfxCtx->overlay.p++, 0, gScreenHeight - ret, gScreenWidth - 1, gScreenHeight - 1); - gDPPipeSync(gfxCtx->overlay.p++); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetCycleType(oGfxCtx->overlay.p++, G_CYC_FILL); + gDPSetRenderMode(oGfxCtx->overlay.p++, G_RM_NOOP, G_RM_NOOP2); + gDPSetFillColor(oGfxCtx->overlay.p++, (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1)); + gDPFillRectangle(oGfxCtx->overlay.p++, 0, 0, gScreenWidth - 1, ret - 1); + gDPFillRectangle(oGfxCtx->overlay.p++, 0, gScreenHeight - ret, gScreenWidth - 1, gScreenHeight - 1); + gDPPipeSync(oGfxCtx->overlay.p++); } } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2497); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2497); } void func_80095974(GraphicsContext* gfxCtx) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_rcp.c", 2503); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_rcp.c", 2503); + gSPDisplayList(oGfxCtx->polyOpa.p++, sFillSetupDL); + gDPSetScissorFrac(oGfxCtx->polyOpa.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); + gDPSetDepthImage(oGfxCtx->polyOpa.p++, gZBuffer); + gDPSetColorImage(oGfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - gSPDisplayList(gfxCtx->polyOpa.p++, sFillSetupDL); - gDPSetScissorFrac(gfxCtx->polyOpa.p++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth * 4.0f, gScreenHeight * 4.0f); - gDPSetDepthImage(gfxCtx->polyOpa.p++, gZBuffer); - gDPSetColorImage(gfxCtx->polyOpa.p++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer); - - Graph_CloseDisps(dispRefs, gfxCtx, "../z_rcp.c", 2513); + CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2513); } diff --git a/src/code/z_room.c b/src/code/z_room.c index 898fd57a1e..5de946fdce 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -37,41 +37,38 @@ void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags) { s32 i; PolygonType0* polygon0; PolygonDlist* polygonDlist; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 193); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 193); if (flags & 1) { func_800342EC(&D_801270A0, globalCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x03, room->segment); func_80093C80(globalCtx); - gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(oGfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } if (flags & 2) { func_8003435C(&D_801270A0, globalCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } polygon0 = &room->mesh->polygon0; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon0->start); for (i = 0; i < polygon0->num; i++) { if ((flags & 1) && (polygonDlist->opa != NULL)) { - gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa); + gSPDisplayList(oGfxCtx->polyOpa.p++, polygonDlist->opa); } if ((flags & 2) && (polygonDlist->xlu != NULL)) { - gSPDisplayList(gfxCtx->polyXlu.p++, polygonDlist->xlu); + gSPDisplayList(oGfxCtx->polyXlu.p++, polygonDlist->xlu); } polygonDlist++; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 239); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 239); } #define SHAPE_SORT_MAX 64 @@ -104,26 +101,24 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { PolygonDlist2* sp78; f32 temp_f0; f32 temp_f2; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; spB0 = NULL; spB4 = NULL; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 287); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 287); if (flags & 1) { func_800342EC(&D_801270A0, globalCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x03, room->segment); func_80093C80(globalCtx); - gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(oGfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } if (flags & 2) { func_8003435C(&D_801270A0, globalCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); } spA4 = &spB8[0]; @@ -199,20 +194,20 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { if (((iREG(86) == 1) && (iREG(89) > sp9C)) || ((iREG(86) == 2) && (iREG(89) == sp9C))) { if ((flags & 1) && (phi_s0->opa != NULL)) { - gSPDisplayList(gfxCtx->polyOpa.p++, phi_s0->opa); + gSPDisplayList(oGfxCtx->polyOpa.p++, phi_s0->opa); } if ((flags & 2) && (phi_s0->xlu != NULL)) { - gSPDisplayList(gfxCtx->polyXlu.p++, phi_s0->xlu); + gSPDisplayList(oGfxCtx->polyXlu.p++, phi_s0->xlu); } } } else { if ((flags & 1) && (phi_s0->opa != NULL)) { - gSPDisplayList(gfxCtx->polyOpa.p++, phi_s0->opa); + gSPDisplayList(oGfxCtx->polyOpa.p++, phi_s0->opa); } if ((flags & 2) && (phi_s0->xlu != NULL)) { - gSPDisplayList(gfxCtx->polyXlu.p++, phi_s0->xlu); + gSPDisplayList(oGfxCtx->polyXlu.p++, phi_s0->xlu); } } @@ -222,7 +217,7 @@ void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags) { iREG(88) = sp9C - 1; - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 430); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 430); } #else #pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_80095D04.s") @@ -337,11 +332,8 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { u32 sp98; u32 sp94; u32 sp90; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 628); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 628); camera = ACTIVE_CAM; sp9C = (camera->setting == 25); @@ -352,42 +344,42 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { sp90 = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4); if (sp94 || sp98) { - gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x03, room->segment); if (sp94) { func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa); + gSPMatrix(oGfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, polygonDlist->opa); } if (sp98) { - // gSPLoadUcodeL(gfxCtx->polyOpa.p++, rspS2DEX)? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, OS_K0_TO_PHYSICAL(D_80113070), OS_K0_TO_PHYSICAL(D_801579A0), 0x800); + // gSPLoadUcodeL(oGfxCtx->polyOpa.p++, rspS2DEX)? + gSPLoadUcodeEx(oGfxCtx->polyOpa.p++, OS_K0_TO_PHYSICAL(D_80113070), OS_K0_TO_PHYSICAL(D_801579A0), 0x800); - if (1) { + { Vec3f sp60; - spA8 = gfxCtx->polyOpa.p; + spA8 = oGfxCtx->polyOpa.p; func_8005AFB4(&sp60, camera); func_8009638C(&spA8, polygon1->single.source, polygon1->single.tlut, polygon1->single.width, polygon1->single.height, polygon1->single.fmt, polygon1->single.siz, polygon1->single.mode0, polygon1->single.tlutCount, (sp60.x + sp60.z) * 1.2f + sp60.y * 0.6f, sp60.y * 2.4f + (sp60.x + sp60.z) * 0.3f); - gfxCtx->polyOpa.p = spA8; + oGfxCtx->polyOpa.p = spA8; } - // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData())? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800); + // gSPLoadUcode(oGfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData())? + gSPLoadUcodeEx(oGfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800); } } if (sp90) { - gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, polygonDlist->xlu); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyXlu.p++, polygonDlist->xlu); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 691); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 691); } BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { @@ -434,11 +426,8 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { u32 sp94; u32 sp90; u32 sp8C; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 752); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 752); camera = ACTIVE_CAM; sp98 = (camera->setting == 25); @@ -450,41 +439,41 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { sp8C = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4); if (sp90 || sp94) { - gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x03, room->segment); if (sp90) { func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa); + gSPMatrix(oGfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, polygonDlist->opa); } if (sp94) { - // gSPLoadUcodeL(gfxCtx->polyOpa.p++, rspS2DEX)? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, OS_K0_TO_PHYSICAL(D_80113070), OS_K0_TO_PHYSICAL(D_801579A0), 0x800); + // gSPLoadUcodeL(oGfxCtx->polyOpa.p++, rspS2DEX)? + gSPLoadUcodeEx(oGfxCtx->polyOpa.p++, OS_K0_TO_PHYSICAL(D_80113070), OS_K0_TO_PHYSICAL(D_801579A0), 0x800); - if (1) { + { Vec3f sp5C; - spA8 = gfxCtx->polyOpa.p; + spA8 = oGfxCtx->polyOpa.p; func_8005AFB4(&sp5C, camera); func_8009638C(&spA8, bgImage->source, bgImage->tlut, bgImage->width, bgImage->height, bgImage->fmt, bgImage->siz, bgImage->mode0, bgImage->tlutCount, (sp5C.x + sp5C.z) * 1.2f + sp5C.y * 0.6f, sp5C.y * 2.4f + (sp5C.x + sp5C.z) * 0.3f); - gfxCtx->polyOpa.p = spA8; + oGfxCtx->polyOpa.p = spA8; } - // gSPLoadUcode(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData())? - gSPLoadUcodeEx(gfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800); + // gSPLoadUcode(oGfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData())? + gSPLoadUcodeEx(oGfxCtx->polyOpa.p++, SysUcode_GetUCode(), SysUcode_GetUCodeData(), 0x800); } } if (sp8C) { - gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment); + gSPSegment(oGfxCtx->polyXlu.p++, 0x03, room->segment); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, polygonDlist->xlu); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyXlu.p++, polygonDlist->xlu); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_room.c", 819); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 819); } // Room Draw Polygon Type 1 diff --git a/src/code/z_sample.c b/src/code/z_sample.c index 6bd1e95203..59ad5a59b3 100644 --- a/src/code/z_sample.c +++ b/src/code/z_sample.c @@ -12,33 +12,32 @@ void Sample_HandleStateChange(SampleContext* this) { void Sample_Draw(SampleContext* this) { GraphicsContext* gfxCtx = this->state.gfxCtx; View* view = &this->view; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_sample.c", 62); + OPEN_DISPS(gfxCtx, "../z_sample.c", 62); - gSPSegment(gfxCtx->polyOpa.p++, 0x00, NULL); - gSPSegment(gfxCtx->polyOpa.p++, 0x01, this->staticSegment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL); + gSPSegment(oGfxCtx->polyOpa.p++, 0x01, this->staticSegment); func_80095248(gfxCtx, 0, 0, 0); view->flags = 1 | 2 | 4; func_800AAA50(view, 15); - if (1) { + { Mtx* mtx = Graph_Alloc(gfxCtx, sizeof(Mtx)); guPosition(mtx, SREG(37), SREG(38), SREG(39), 1.0f, SREG(40), SREG(41), SREG(42)); - gSPMatrix(gfxCtx->polyOpa.p++, mtx, G_MTX_LOAD); + gSPMatrix(oGfxCtx->polyOpa.p++, mtx, G_MTX_LOAD); } - gfxCtx->polyOpa.p = Gfx_SetFog2(gfxCtx->polyOpa.p, 0xFF, 0xFF, 0xFF, 0, 0, 0); + oGfxCtx->polyOpa.p = Gfx_SetFog2(oGfxCtx->polyOpa.p, 0xFF, 0xFF, 0xFF, 0, 0, 0); func_80093D18(gfxCtx); - gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_1CYCLE); - gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); - gDPSetCombineMode(gfxCtx->polyOpa.p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 255, 255, 0, 0); + gDPSetCycleType(oGfxCtx->polyOpa.p++, G_CYC_1CYCLE); + gDPSetRenderMode(oGfxCtx->polyOpa.p++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2); + gDPSetCombineMode(oGfxCtx->polyOpa.p++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 255, 255, 0, 0); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_sample.c", 111); + CLOSE_DISPS(gfxCtx, "../z_sample.c", 111); } void Sample_Main(SampleContext* this) { diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 9d2ed095d0..4473697d32 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -946,15 +946,12 @@ void func_800994A0(GlobalContext* globalCtx) { // Scene Draw Config 0 void func_80099550(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4725); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4725); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDefaultDisplayList); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDefaultDisplayList); - gSPDisplayList(gfxCtx->polyOpa.p++, sDefaultDisplayList); - gSPDisplayList(gfxCtx->polyXlu.p++, sDefaultDisplayList); - - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4735); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4735); } u32 D_8012A2F8[] = { 0x0200BA18, 0x0200CA18 }; @@ -962,46 +959,40 @@ u32 D_8012A2F8[] = { 0x0200BA18, 0x0200CA18 }; // Scene Draw Config 19 void func_800995DC(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; gameplayFrames = globalCtx->gameplayFrames; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4763); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4763); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - { s32 pad; } // Necessary to match stack usage + { s32 pad; } - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A2F8[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A2F8[gSaveContext.nightFlag])); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4783); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4783); } // Scene Draw Config 28 void func_80099760(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4845); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4845); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 0, 64, 32, 1, 0, (gameplayFrames * 2) % 128, 64, 32)); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4859); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4859); } u32 D_8012A300[] = { 0x02012378, 0x02013378 }; @@ -1012,99 +1003,93 @@ void func_80099878(GlobalContext* globalCtx) { u32 gameplayFrames; s32 pad; Gfx* displayListHead; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 6 * sizeof(Gfx)); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4905); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4905); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A300[gSaveContext.nightFlag])); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_8012A308[(s32)(gameplayFrames & 14) >> 1])); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A300[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_8012A308[(s32)(gameplayFrames & 14) >> 1])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 0, 64, 32, 1, 0, (gameplayFrames * 1) % 128, 64, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 2) % 128, 32, 32)); - { s32 pad2[2]; } // Necessary to match stack usage + { s32 pad2[2]; } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->unk_11D30[0]); gSPEndDisplayList(displayListHead++); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 255, 255, 255, globalCtx->unk_11D30[1]); gSPEndDisplayList(displayListHead); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 4956); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 4956); } // Scene Draw Config 30 void func_80099BD8(GlobalContext* globalCtx) { f32 temp; Gfx* displayListHead; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 18 * sizeof(Gfx)); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5069); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5069); temp = globalCtx->unk_11D30[0] / 255.0f; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, displayListHead); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, displayListHead); gDPSetPrimColor(displayListHead++, 0, 0, 255 - (u8)(185.0f * temp), 255 - (u8)(145.0f * temp), 255 - (u8)(105.0f * temp), 255); gSPEndDisplayList(displayListHead++); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, displayListHead); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, displayListHead); gDPSetPrimColor(displayListHead++, 0, 0, 76 + (u8)(6.0f * temp), 76 + (u8)(34.0f * temp), 76 + (u8)(74.0f * temp), 255); gSPEndDisplayList(displayListHead++); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, displayListHead); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[0]); gSPEndDisplayList(displayListHead++); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, displayListHead); - gSPSegment(gfxCtx->polyXlu.p++, 0x0B, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0B, displayListHead); 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]); gSPEndDisplayList(displayListHead++); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, displayListHead); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, displayListHead); 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]); gSPEndDisplayList(displayListHead++); - gSPSegment(gfxCtx->polyOpa.p++, 0x0D, displayListHead); - gSPSegment(gfxCtx->polyXlu.p++, 0x0D, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0D, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0D, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 0, 0, 0, globalCtx->unk_11D30[1]); gSPEndDisplayList(displayListHead); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5145); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5145); if (gSaveContext.sceneSetupIndex == 5) { D_8015FCF0 = 1; @@ -1120,169 +1105,151 @@ void func_80099BD8(GlobalContext* globalCtx) { // Scene Draw Config 31 void func_8009A45C(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5171); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5171); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames % 128), (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); gSPSegment( - gfxCtx->polyOpa.p++, 0x0A, + oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 50) % 2048, 8, 512, 1, 0, (gameplayFrames * 60) % 2048, 8, 512)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0D, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0D, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5212); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5212); } // Scene Draw Config 32 void func_8009A798(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5226); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5226); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 256, 64, 64)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 256, 32, 64, 1, 0, 0, 32, 128)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5264); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5264); } // Scene Draw Config 33 void func_8009A9DC(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5278); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5278); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64, 1, gameplayFrames % 128, (gameplayFrames * 3) % 256, 32, 64)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5301); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5301); } // Scene Draw Config 48 void func_8009AB98(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5317); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5317); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5330); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5330); } // Scene Draw Config 39 void func_8009ACA8(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5346); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5346); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 256, 16)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5367); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5367); } // Scene Draw Config 24 void func_8009AE30(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5384); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5384); gameplayFrames = globalCtx->gameplayFrames; if (globalCtx->sceneNum == SCENE_HAKADAN_BS) { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, (gameplayFrames * 2) % 128, 0, 32, 32)); } else { - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 128, 0, 32, 32, 1, (gameplayFrames * 2) % 128, 0, 32, 32)); } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5416); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5416); } u32 D_8012A328[] = { 0x0200BD20, 0x0200B920 }; @@ -1290,21 +1257,18 @@ u32 D_8012A328[] = { 0x0200BD20, 0x0200B920 }; // Scene Draw Config 40 void func_8009AFE0(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5490); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5490); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); - { s32 pad[2]; } // Necessary to match stack usage + { s32 pad[2]; } - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A328[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A328[gSaveContext.nightFlag])); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5507); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5507); } u32 D_8012A330[] = { 0x02014C30, 0x02015830 }; @@ -1314,11 +1278,8 @@ void func_8009B0FC(GlobalContext* globalCtx) { u32 gameplayFrames; s32 spB0; s32 spAC; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5535); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5535); if (1) {} // Necessary to match @@ -1326,172 +1287,160 @@ void func_8009B0FC(GlobalContext* globalCtx) { spAC = globalCtx->unk_11D30[1] & 0xFF; gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A330[gSaveContext.nightFlag])); if (spB0 == 1) { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, spAC)); } else if (spB0 < 1) { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 255)); } else { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160)); } if (spB0 == 2) { - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, spAC)); } else if (spB0 < 2) { - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 255)); } else { - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160)); } if (spB0 != 0) { - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 180)); } else { - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 160 + (s32)((spAC / 200.0f) * 95.0f))); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 3, 0, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, 185 + (s32)((spAC / 200.0f) * 70.0f))); } - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, gameplayFrames * 1, 32, 32, 1, 0, 127 - (gameplayFrames * 1), 32, 32, 0, 0, 0, 128)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0D, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0D, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames * 4, 0, 32, 32, 1, gameplayFrames * 4, 0, 32, 32, 0, 0, 0, 128)); - { s32 pad[2]; } // Necessary to match stack usage + { s32 pad[2]; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5644); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5644); } // Scene Draw Config 29 void func_8009B86C(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5791); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5791); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames * 1, 0, 32, 32, 1, 0, 0, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, globalCtx->unk_11D30[0]); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, globalCtx->unk_11D30[0]); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 145); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 145); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5808); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5808); } // Scene Draw Config 34 void func_8009B9BC(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5822); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5822); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 4, 16)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 64, 4, 16)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5836); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5836); } // Scene Draw Config 35 void func_8009BAA4(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5850); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5850); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); if (globalCtx->sceneNum == SCENE_HAIRAL_NIWA) { - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 10) % 256, 32, 64)); } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5876); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5876); } // Scene Draw Config 36 void func_8009BC44(GlobalContext* globalCtx) { u32 gameplayFrames; s8 sp83; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (1) {} // Necessary to match sp83 = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5894); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5894); gameplayFrames = globalCtx->gameplayFrames; if (globalCtx->sceneNum == SCENE_GANON_TOU) { - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 256, 64, 64)); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 1) % 256, 64, 64, 1, 0, (gameplayFrames * 1) % 256, 64, 64)); } - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, 32, 1, (gameplayFrames * 1) % 128, (gameplayFrames * 1) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); sp83 = (sp83 >> 1) + 192; - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, sp83, sp83, sp83, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, sp83, sp83, sp83, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5930); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5930); } // Screen Shake for Ganon's Tower Collapse @@ -1517,38 +1466,35 @@ void func_8009BEEC(GlobalContext* globalCtx) { void func_8009C0AC(GlobalContext* globalCtx) { u32 gameplayFrames; s8 sp7B; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (1) {} // Necessary to match sp7B = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 5968); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 5968); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 512, 64, 128, 1, 0, 511 - (gameplayFrames * 1) % 512, 64, 128)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 32, 64, 1, 0, 255 - (gameplayFrames * 1) % 256, 32, 64)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 20) % 2048, 16, 512, 1, 0, (gameplayFrames * 30) % 2048, 16, 512)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); sp7B = (sp7B >> 1) + 192; - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, sp7B, sp7B, sp7B, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, sp7B, sp7B, sp7B, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6004); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6004); if (Flags_GetSwitch(globalCtx, 0x37)) { if ((globalCtx->sceneNum == SCENE_GANON_DEMO) || (globalCtx->sceneNum == SCENE_GANON_FINAL) || @@ -1563,113 +1509,101 @@ u32 D_8012A338[] = { 0x0200FAC0, 0x0200F8C0 }; // Scene Draw Config 37 void func_8009C3EC(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (0) {} // Necessary to match - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6042); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6042); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A338[gSaveContext.nightFlag])); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A338[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - { s32 pad[2]; } // Necessary to match stack usage + { s32 pad[2]; } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6076); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6076); } // Scene Draw Config 42 void func_8009C608(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6151); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6151); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 64, 256, 16)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 60) % 2048, 8, 512, 1, 0, (gameplayFrames * 50) % 2048, 8, 512)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - (gameplayFrames * 1) % 128, 0, 32, 32, 1, (gameplayFrames * 1) % 128, 0, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0B, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0B, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256, 1, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6187); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6187); } // Scene Draw Config 43 void func_8009C8B8(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6201); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6201); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 255 - (gameplayFrames * 10) % 256, 32, 64)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6232); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6232); } // Scene Draw Config 47 void func_8009CAC0(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6249); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6249); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6264); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6264); } u32 D_8012A340[] = { 0x0200F8C0, 0x020100C0 }; @@ -1677,32 +1611,29 @@ u32 D_8012A340[] = { 0x0200F8C0, 0x020100C0 }; // Scene Draw Config 27 void func_8009CC00(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (0) {} // Necessary to match - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6290); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6290); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A340[gSaveContext.nightFlag])); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A340[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - { s32 pad[2]; } // Necessary to match stack usage + { s32 pad[2]; } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6320); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6320); } Gfx* Gfx_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, @@ -1727,76 +1658,68 @@ Gfx* Gfx_TwoTexScrollPrimColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y // Scene Draw Config 50 void func_8009CF84(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6433); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6433); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, 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)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6449); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6449); } // Scene Draw Config 41 void func_8009D0E8(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6463); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6463); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 4) % 128, 0, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 5) % 64, 16, 16)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, + Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 5) % 64, 16, 16)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, 63 - (gameplayFrames * 2) % 64, 16, 16)); gSPSegment( - gfxCtx->polyXlu.p++, 0x0B, + oGfxCtx->polyXlu.p++, 0x0B, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - (gameplayFrames * 3) % 128, 32, 32, 1, 0, 0, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6491); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6491); } u32 D_8012A348[] = { 0x02005210, 0x02005010 }; // Scene Draw Config 44 void func_8009D31C(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - s32 pad[2]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6515); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6515); + { s32 pad[2]; } - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A348[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A348[gSaveContext.nightFlag])); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6528); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6528); } u32 D_8012A350[] = { 0x02006550, 0x02003550 }; @@ -1805,11 +1728,8 @@ u32 D_8012A358[] = { 0x02002350, 0x02001350 }; // Scene Draw Config 45 void func_8009D438(GlobalContext* globalCtx) { s32 var; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6560); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6560); if (LINK_IS_ADULT) { var = 1; @@ -1817,41 +1737,38 @@ void func_8009D438(GlobalContext* globalCtx) { var = gSaveContext.nightFlag; } - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A358[var])); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_8012A350[var])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A358[var])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_8012A350[var])); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6581); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6581); } // Scene Draw Config 46 void func_8009D5B4(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6595); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6595); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 1023 - (gameplayFrames * 3) % 1024, 16, 256, 1, 0, 1023 - (gameplayFrames * 6) % 1024, 16, 256)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6615); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6615); } u32 D_8012A360[] = { 0x02014D90, 0x02014590 }; @@ -1859,77 +1776,68 @@ u32 D_8012A360[] = { 0x02014D90, 0x02014590 }; // Scene Draw Config 22 void func_8009D758(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (0) {} // Necessary to match - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6640); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6640); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A360[gSaveContext.nightFlag])); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A360[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - { s32 pad[2]; } // Necessary to match stack usage + { s32 pad[2]; } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6671); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6671); } u32 D_8012A368[] = { 0x02018920, 0x02018020 }; // Scene Draw Config 25 void func_8009D974(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - s32 pad[2]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6752); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6752); + { s32 pad[2]; } - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A368[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A368[gSaveContext.nightFlag])); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6762); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6762); } // Scene Draw Config 1 void func_8009DA30(GlobalContext* globalCtx) { u32 gameplayFrames; Gfx* displayListHead; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 3 * sizeof(Gfx)); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6814); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6814); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, displayListHead); if ((gSaveContext.dayTime >= 0x4AAC) && (gSaveContext.dayTime <= 0xC555)) { gSPEndDisplayList(displayListHead); @@ -1949,58 +1857,52 @@ void func_8009DA30(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6866); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6866); } u32 D_8012A370[] = { 0x02015B50, 0x02016B50 }; // Scene Draw Config 2 void func_8009DD5C(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - s32 pad[2]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6890); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6890); + { s32 pad[2]; } - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A370[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A370[gSaveContext.nightFlag])); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6903); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6903); } // Scene Draw Config 3 void func_8009DE78(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6917); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6917); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 6) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6948); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6948); } // Scene Draw Config 4 @@ -2009,30 +1911,29 @@ void func_8009E0B8(GlobalContext* globalCtx) { u8 spA3; u16 spA0; Gfx* displayListHead; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; spA3 = 128; spA0 = 500; - gfxCtx = globalCtx->state.gfxCtx; displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 6 * sizeof(Gfx)); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 6965); + if (1) {} + if (1) {} + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 6965); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); if (gSaveContext.sceneSetupIndex == 4) { spA3 = 255 - (u8)globalCtx->unk_11D30[0]; @@ -2042,49 +1943,46 @@ void func_8009E0B8(GlobalContext* globalCtx) { spA0 = 2150; } - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 128, 128, 128, spA3); gSPEndDisplayList(displayListHead++); - gSPSegment(gfxCtx->polyXlu.p++, 0x0B, displayListHead); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0B, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, displayListHead); gDPPipeSync(displayListHead++); gDPSetEnvColor(displayListHead++, 128, 128, 128, spA0 * 0.1f); gSPEndDisplayList(displayListHead); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, + gSPSegment(oGfxCtx->polyOpa.p++, 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)); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7044); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7044); } // Scene Draw Config 5 void func_8009E54C(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7058); + 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; } gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, gameplayFrames, gameplayFrames, 32, 32, 1, 0, 0, 32, 32, 0, 0, 0, globalCtx->unk_11D30[0] + 168)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScrollEnvColor(globalCtx->state.gfxCtx, 0, -gameplayFrames, -gameplayFrames, 32, 32, 1, 0, 0, 16, 64, 0, 0, 0, globalCtx->unk_11D30[0] + 168)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 255, 255, 255, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 255, 255, 255, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7097); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7097); } u32 D_8012A378[] = { 0x02008F98, 0x02008FD8 }; @@ -2093,120 +1991,108 @@ u32 D_8012A378[] = { 0x02008F98, 0x02008FD8 }; void func_8009E730(GlobalContext* globalCtx) { u32 gameplayFrames; u32 var; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7123); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7123); gameplayFrames = globalCtx->gameplayFrames; var = 127 - (gameplayFrames * 1) % 128; if (LINK_IS_ADULT) { var = 0; } - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 64, 32, 1, 0, var, 64, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A378[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A378[gSaveContext.nightFlag])); - { s32 pad[2]; } // Necessary to match stack usage + { s32 pad[2]; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7147); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7147); } // Scene Draw Config 7 void func_8009E8C0(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7161); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7161); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 1) % 128, 0, 32, 32, 1, 0, 0, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 2) % 256, 64, 64, 1, 0, 255 - (gameplayFrames * 2) % 256, 64, 64)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7192); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7192); } // Scene Draw Config 8 void func_8009EAD8(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7206); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7206); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 3) % 1024, 32, 256, 1, 0, (gameplayFrames * 3) % 1024, 32, 256)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 256, 64, 64, 1, 0, (gameplayFrames * 1) % 256, 64, 64)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 2) % 128, 32, 32, 1, 0, (gameplayFrames * 2) % 128, 32, 32)); gSPSegment( - gfxCtx->polyOpa.p++, 0x0B, + oGfxCtx->polyOpa.p++, 0x0B, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - (gameplayFrames * 3) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0D, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0D, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (gameplayFrames * 1) % 64, 16, 16, 1, 0, (gameplayFrames * 1) % 64, 16, 16)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7260); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7260); } // Scene Draw Config 9 void func_8009EE44(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (0) {} // Necessary to match - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7274); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7274); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, 0, 32, 16, 1, gameplayFrames % 128, 0, 32, 16)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, gameplayFrames % 128, 32, 32, 1, gameplayFrames % 128, gameplayFrames % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); if ((globalCtx->unk_11D30[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { if (globalCtx->unk_11D30[1] == 50) { @@ -2216,111 +2102,96 @@ void func_8009EE44(GlobalContext* globalCtx) { globalCtx->unk_11D30[1]++; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7309); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7309); } // Scene Draw Config 10 void func_8009F074(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7323); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7323); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 32, 1, 0, 127 - gameplayFrames % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7339); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7339); } u32 D_8012A380[] = { 0x02009678, 0x0200DE78 }; // Scene Draw Config 11 void func_8009F1B4(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - s32 pad[2]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7363); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7363); + { s32 pad[2]; } - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A380[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A380[gSaveContext.nightFlag])); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7371); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7371); } // Scene Draw Config 12 void func_8009F270(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7385); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7385); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7409); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7409); } // Scene Draw Config 13 void func_8009F40C(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7423); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7423); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 10) % 128, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 3) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7443); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7443); } // Scene Draw Config 14 void func_8009F5D4(GlobalContext* globalCtx) { Gfx* displayListHead; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; displayListHead = Graph_Alloc(globalCtx->state.gfxCtx, 3 * sizeof(Gfx)); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7461); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7461); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, displayListHead); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, displayListHead); if ((gSaveContext.dayTime >= 0x4AAC) && (gSaveContext.dayTime <= 0xC000)) { gSPEndDisplayList(displayListHead); @@ -2340,13 +2211,13 @@ void func_8009F5D4(GlobalContext* globalCtx) { gSPEndDisplayList(displayListHead); } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7495); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7495); } // Scene Draw Config 15 @@ -2354,30 +2225,27 @@ void func_8009F7D4(GlobalContext* globalCtx) { s8 sp6F; s8 sp6E; u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; sp6F = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; sp6E = coss((globalCtx->gameplayFrames * 1500) & 0xFFFF) >> 8; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7512); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7512); gameplayFrames = globalCtx->gameplayFrames; sp6F = (sp6F >> 1) + 192; sp6E = (sp6E >> 1) + 192; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, gameplayFrames % 128, 32, 32, 1, 0, gameplayFrames % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, sp6F, sp6E, 255, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, sp6F, sp6E, 255, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7530); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7530); } u32 D_8012A388[] = { 0x02009808, 0x02008FC8 }; @@ -2385,77 +2253,68 @@ u32 D_8012A388[] = { 0x02009808, 0x02008FC8 }; // Scene Draw Config 16 void func_8009F9D0(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7555); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7555); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, gameplayFrames % 128, 0, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A388[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A388[gSaveContext.nightFlag])); - { s32 pad[2]; } // Necessary to match stack usage + { s32 pad[2]; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7578); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7578); } u32 D_8012A390[] = { 0x020081E0, 0x0200FBE0 }; // Scene Draw Config 17 void func_8009FB74(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - s32 pad[2]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7602); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7602); + { s32 pad[2]; } - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A390[gSaveContext.nightFlag])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8012A390[gSaveContext.nightFlag])); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7615); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7615); } // Scene Draw Config 18 void func_8009FC90(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7630); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7630); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 127 - gameplayFrames % 128, 32, 32, 1, 127 - gameplayFrames % 128, 0, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 3) % 128, 127 - (gameplayFrames * 6) % 128, 32, 32, 1, (gameplayFrames * 6) % 128, 127 - (gameplayFrames * 3) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 64); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 64); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 64); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 64); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7653); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7653); } f32 D_8012A398 = 0.0f; @@ -2468,31 +2327,28 @@ void func_8009FE58(GlobalContext* globalCtx) { static s16 D_8012A3A0 = 4272; u32 gameplayFrames; f32 temp; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7712); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7712); gameplayFrames = globalCtx->gameplayFrames; if (globalCtx->sceneNum == SCENE_BDAN) { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32, 1, 127 - gameplayFrames % 128, (gameplayFrames * 2) % 128, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 255 - (gameplayFrames * 4) % 256, 32, 64, 1, 0, 255 - (gameplayFrames * 4) % 256, 32, 64)); } else { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, (127 - (gameplayFrames * 1)) % 128, (gameplayFrames * 1) % 128, 32, 32)); } - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); if (func_800C0D28(globalCtx) != 1) { D_8012A39C += 1820; @@ -2535,9 +2391,9 @@ void func_8009FE58(GlobalContext* globalCtx) { Matrix_Scale(1.005f, sinf(D_8012A398) * 0.8f, 1.005f, MTXMODE_NEW); } - gSPSegment(gfxCtx->polyOpa.p++, 0x0D, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_scene_table.c", 7809)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0D, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_scene_table.c", 7809)); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7811); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7811); } #else s16 D_8012A39C = 538; @@ -2549,30 +2405,27 @@ void func_8009FE58(GlobalContext* globalCtx); // Scene Draw Config 26 void func_800A0334(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7825); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7825); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128, 1, gameplayFrames % 128, (gameplayFrames * 1) % 512, 32, 128)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128, 32, 32)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7852); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7852); } // Scene Draw Config 52 @@ -2588,25 +2441,22 @@ void func_800A057C(GlobalContext* globalCtx) { // Scene Draw Config 49 void func_800A059C(GlobalContext* globalCtx) { u32 gameplayFrames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7893); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7893); gameplayFrames = globalCtx->gameplayFrames; - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, Gfx_TexScroll(globalCtx->state.gfxCtx, 127 - (gameplayFrames * 2) % 128, 0, 32, 64)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, Gfx_TexScroll(globalCtx->state.gfxCtx, 0, (gameplayFrames * 2) % 512, 128, 128)); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, 128); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 128, 128, 128, 128); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 128, 128, 128, 128); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 7910); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 7910); } void (*sSceneDrawHandlers[])(GlobalContext*) = { @@ -2621,9 +2471,6 @@ void (*sSceneDrawHandlers[])(GlobalContext*) = { }; void Scene_Draw(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - if (HREG(80) == 17) { if (HREG(95) != 17) { HREG(95) = 17; @@ -2642,15 +2489,14 @@ void Scene_Draw(GlobalContext* globalCtx) { HREG(94) = 0; } - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 8104); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 8104); if (HREG(81) == 1) { - gSPDisplayList(gfxCtx->polyOpa.p++, sDefaultDisplayList); - gSPDisplayList(gfxCtx->polyXlu.p++, sDefaultDisplayList); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDefaultDisplayList); + gSPDisplayList(oGfxCtx->polyXlu.p++, sDefaultDisplayList); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_scene_table.c", 8109); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_scene_table.c", 8109); if (HREG(82) == 1) { sSceneDrawHandlers[globalCtx->sceneConfig](globalCtx); diff --git a/src/code/z_skelanime.c b/src/code/z_skelanime.c index 486358b392..2bccd4db10 100644 --- a/src/code/z_skelanime.c +++ b/src/code/z_skelanime.c @@ -34,11 +34,9 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk Gfx* dList; Vec3f pos; Vec3s rot; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 773); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 773); + Matrix_Push(); limbEntry = SEGMENTED_TO_VIRTUAL(skeleton->limbs[limbIndex]); limbIndex++; @@ -52,17 +50,15 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) { Matrix_JointPosition(&pos, &rot); if (dList != NULL) { - do { - if (1) { - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 805), - G_MTX_LOAD); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 805), + G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList); - } - } while (0); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList); } } + if (1) {} + if (postLimbDraw != NULL) { postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor); } @@ -79,7 +75,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk postLimbDraw, actor, dListIndex); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 821); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 821); } /* @@ -92,8 +88,6 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb Gfx* dList; Vec3f pos; Vec3s rot; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -101,8 +95,9 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb osSyncPrintf(VT_RST); return; } - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 849); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 849); + Matrix_Push(); limbEntry = SEGMENTED_TO_VIRTUAL(skeleton->limbs[0]); @@ -116,9 +111,10 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) { Matrix_JointPosition(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 881), G_MTX_LOAD); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 881), + G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList); } } if (postLimbDraw != NULL) { @@ -131,7 +127,8 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb } Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 894); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 894); } /* @@ -145,8 +142,6 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* Gfx* dList[2]; Vec3f pos; Vec3s rot; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; Matrix_Push(); @@ -166,11 +161,10 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* Matrix_JointPosition(&pos, &rot); if (dList[1] != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 945); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 946); - gSPMatrix(gfxCtx->polyOpa.p++, *mtx, G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 949); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 946); + gSPMatrix(oGfxCtx->polyOpa.p++, *mtx, G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList[1]); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 949); (*mtx)++; } else if (dList[0] != NULL) { Matrix_ToMtx(*mtx, "../z_skelanime.c", 954); @@ -206,8 +200,6 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li Vec3f pos; Vec3s rot; Mtx* mtx; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx)); @@ -217,9 +209,10 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li osSyncPrintf(VT_RST); return; } - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1000); - gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1000); + + gSPSegment(oGfxCtx->polyOpa.p++, 0xD, mtx); Matrix_Push(); limbEntry = SEGMENTED_TO_VIRTUAL(skeleton->limbs[0]); @@ -236,8 +229,8 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li Matrix_JointPosition(&pos, &rot); if (dList[1] != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1033); - gSPMatrix(gfxCtx->polyOpa.p++, mtx, G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]); + gSPMatrix(oGfxCtx->polyOpa.p++, mtx, G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList[1]); mtx++; } else if (dList[0] != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1040); @@ -255,7 +248,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1053); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1053); } /* @@ -267,12 +260,9 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele Gfx* dList; Vec3f pos; Vec3s rot; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1076); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1076); Matrix_Push(); limbEntry = SEGMENTED_TO_VIRTUAL(skeleton->limbs[limbIndex]); @@ -286,16 +276,14 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor) == 0)) { Matrix_JointPosition(&pos, &rot); if (dList != NULL) { - do { - if (1) { - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1103), - G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList); - } - } while (0); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1103), + G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList); } } + if (1) {} + if (postLimbDraw != NULL) { postLimbDraw(globalCtx, limbIndex, &dList, &rot, actor); } @@ -312,7 +300,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele actor); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1121); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1121); } void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, @@ -322,8 +310,6 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra Gfx* dList; Vec3f pos; Vec3s rot; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (skeleton == NULL) { osSyncPrintf(VT_FGCOL(RED)); @@ -332,9 +318,8 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra return; } - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1148); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1148); Matrix_Push(); rootLimb = SEGMENTED_TO_VIRTUAL(skeleton->limbs[0]); @@ -348,9 +333,9 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor) == 0)) { Matrix_JointPosition(&pos, &rot); if (dList != NULL) { - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1176), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_skelanime.c", 1176), G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList); } } @@ -365,7 +350,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1190); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1190); } void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable, @@ -375,11 +360,9 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske Gfx* dList[2]; Vec3f pos; Vec3s rot; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1214); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1214); + Matrix_Push(); limbEntry = SEGMENTED_TO_VIRTUAL(skeleton->limbs[limbIndex]); @@ -397,8 +380,8 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske Matrix_JointPosition(&pos, &rot); if (dList[1] != NULL) { Matrix_ToMtx(*limbMatricies, "../z_skelanime.c", 1242); - gSPMatrix(gfxCtx->polyOpa.p++, *limbMatricies, G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]); + gSPMatrix(oGfxCtx->polyOpa.p++, *limbMatricies, G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList[1]); (*limbMatricies)++; } else if (dList[0] != NULL) { Matrix_ToMtx(*limbMatricies, "../z_skelanime.c", 1249); @@ -422,7 +405,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske postLimbDraw, actor, limbMatricies); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1265); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1265); } void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDrawTable, s32 dListCount, @@ -433,8 +416,6 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD Vec3f pos; Vec3s rot; Mtx* mtx; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; mtx = Graph_Alloc(globalCtx->state.gfxCtx, dListCount * sizeof(Mtx)); @@ -445,11 +426,9 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD return; } - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1294); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1294); - - gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx); + gSPSegment(oGfxCtx->polyOpa.p++, 0xD, mtx); Matrix_Push(); @@ -468,8 +447,8 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD Matrix_JointPosition(&pos, &rot); if (dList[1] != NULL) { Matrix_ToMtx(mtx, "../z_skelanime.c", 1327); - gSPMatrix(gfxCtx->polyOpa.p++, mtx, G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dList[1]); + gSPMatrix(oGfxCtx->polyOpa.p++, mtx, G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, dList[1]); mtx++; } else { if (dList[0] != NULL) { @@ -489,7 +468,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD } Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_skelanime.c", 1347); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_skelanime.c", 1347); } /* diff --git a/src/code/z_view.c b/src/code/z_view.c index 9ab4db07ee..5ef8808dee 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -134,7 +134,6 @@ void func_800AA550(View* view) { s32 lrx; s32 lry; GraphicsContext* gfxCtx; - Gfx* dispRefs[5]; gfxCtx = view->gfxCtx; @@ -174,14 +173,14 @@ void func_800AA550(View* view) { __assert("lry <= SCREEN_HT", "../z_view.c", 457); } - Graph_OpenDisps(dispRefs, gfxCtx, "../z_view.c", 459); + OPEN_DISPS(gfxCtx, "../z_view.c", 459); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetScissor(gfxCtx->polyOpa.p++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry); - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetScissor(gfxCtx->polyXlu.p++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetScissor(oGfxCtx->polyOpa.p++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetScissor(oGfxCtx->polyXlu.p++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_view.c", 472); + CLOSE_DISPS(gfxCtx, "../z_view.c", 472); } void func_800AA76C(View* view, f32 x, f32 y, f32 z) { @@ -279,10 +278,10 @@ s32 func_800AAA9C(View* view) { Mtx* projection; Mtx* viewing; GraphicsContext* gfxCtx; - Gfx* dispRefs[5]; gfxCtx = view->gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_view.c", 596); + + OPEN_DISPS(gfxCtx, "../z_view.c", 596); vp = Graph_Alloc(gfxCtx, sizeof(Vp)); LogUtils_CheckNullPointer("vp", vp, "../z_view.c", 601); @@ -291,8 +290,8 @@ s32 func_800AAA9C(View* view) { func_800AA550(view); - gSPViewport(gfxCtx->polyOpa.p++, vp); - gSPViewport(gfxCtx->polyXlu.p++, vp); + gSPViewport(oGfxCtx->polyOpa.p++, vp); + gSPViewport(oGfxCtx->polyXlu.p++, vp); projection = Graph_Alloc(gfxCtx, sizeof(Mtx)); LogUtils_CheckNullPointer("projection", projection, "../z_view.c", 616); @@ -335,10 +334,10 @@ s32 func_800AAA9C(View* view) { func_800AA890(view, projection); - gSPPerspNormalize(gfxCtx->polyOpa.p++, view->normal); - gSPMatrix(gfxCtx->polyOpa.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPPerspNormalize(gfxCtx->polyXlu.p++, view->normal); - gSPMatrix(gfxCtx->polyXlu.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPPerspNormalize(oGfxCtx->polyOpa.p++, view->normal); + gSPMatrix(oGfxCtx->polyOpa.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPPerspNormalize(oGfxCtx->polyXlu.p++, view->normal); + gSPMatrix(oGfxCtx->polyXlu.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); viewing = Graph_Alloc(gfxCtx, sizeof(Mtx)); LogUtils_CheckNullPointer("viewing", viewing, "../z_view.c", 667); @@ -368,10 +367,10 @@ s32 func_800AAA9C(View* view) { osSyncPrintf("\n"); } - gSPMatrix(gfxCtx->polyOpa.p++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); - gSPMatrix(gfxCtx->polyXlu.p++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); + gSPMatrix(oGfxCtx->polyOpa.p++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); + gSPMatrix(oGfxCtx->polyXlu.p++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_view.c", 711); + CLOSE_DISPS(gfxCtx, "../z_view.c", 711); return 1; } @@ -380,10 +379,10 @@ s32 func_800AB0A8(View* view) { Vp* vp; Mtx* projection; GraphicsContext* gfxCtx; - Gfx* dispRefs[5]; gfxCtx = view->gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_view.c", 726); + + OPEN_DISPS(gfxCtx, "../z_view.c", 726); vp = Graph_Alloc(gfxCtx, sizeof(Vp)); LogUtils_CheckNullPointer("vp", vp, "../z_view.c", 730); @@ -392,9 +391,9 @@ s32 func_800AB0A8(View* view) { func_800AA550(view); - gSPViewport(gfxCtx->polyOpa.p++, vp); - gSPViewport(gfxCtx->polyXlu.p++, vp); - gSPViewport(gfxCtx->overlay.p++, vp); + gSPViewport(oGfxCtx->polyOpa.p++, vp); + gSPViewport(oGfxCtx->polyXlu.p++, vp); + gSPViewport(oGfxCtx->overlay.p++, vp); projection = Graph_Alloc(gfxCtx, sizeof(Mtx)); LogUtils_CheckNullPointer("projection", projection, "../z_view.c", 744); @@ -405,10 +404,10 @@ s32 func_800AB0A8(View* view) { view->projection = *projection; - gSPMatrix(gfxCtx->polyOpa.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPMatrix(gfxCtx->polyXlu.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(oGfxCtx->polyOpa.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(oGfxCtx->polyXlu.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_view.c", 762); + CLOSE_DISPS(gfxCtx, "../z_view.c", 762); return 1; } @@ -417,22 +416,22 @@ s32 func_800AB2C4(View* view) { Vp* vp; Mtx* projection; GraphicsContext* gfxCtx; - Gfx* dispRefs[5]; if (1) {} // Necessary to match gfxCtx = view->gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_view.c", 777); + + OPEN_DISPS(gfxCtx, "../z_view.c", 777); vp = Graph_Alloc(gfxCtx, sizeof(Vp)); LogUtils_CheckNullPointer("vp", vp, "../z_view.c", 781); View_ViewportToVp(vp, &view->viewport); view->vp = *vp; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetScissor(gfxCtx->overlay.p++, G_SC_NON_INTERLACE, view->viewport.leftX, view->viewport.topY, + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetScissor(oGfxCtx->overlay.p++, G_SC_NON_INTERLACE, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, view->viewport.bottomY); - gSPViewport(gfxCtx->overlay.p++, vp); + gSPViewport(oGfxCtx->overlay.p++, vp); projection = Graph_Alloc(gfxCtx, sizeof(Mtx)); LogUtils_CheckNullPointer("projection", projection, "../z_view.c", 791); @@ -443,9 +442,9 @@ s32 func_800AB2C4(View* view) { view->projection = *projection; - gSPMatrix(gfxCtx->overlay.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(oGfxCtx->overlay.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_view.c", 801); + CLOSE_DISPS(gfxCtx, "../z_view.c", 801); return 1; } @@ -459,20 +458,20 @@ s32 func_800AB560(View* view) { Mtx* projection; Mtx* viewing; GraphicsContext* gfxCtx; - Gfx* dispRefs[5]; gfxCtx = view->gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_view.c", 816); + + OPEN_DISPS(gfxCtx, "../z_view.c", 816); vp = Graph_Alloc(gfxCtx, sizeof(Vp)); LogUtils_CheckNullPointer("vp", vp, "../z_view.c", 821); View_ViewportToVp(vp, &view->viewport); view->vp = *vp; - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetScissor(gfxCtx->overlay.p++, G_SC_NON_INTERLACE, view->viewport.leftX, view->viewport.topY, + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetScissor(oGfxCtx->overlay.p++, G_SC_NON_INTERLACE, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, view->viewport.bottomY); - gSPViewport(gfxCtx->overlay.p++, vp); + gSPViewport(oGfxCtx->overlay.p++, vp); projection = Graph_Alloc(gfxCtx, sizeof(Mtx)); LogUtils_CheckNullPointer("projection", projection, "../z_view.c", 833); @@ -486,8 +485,8 @@ s32 func_800AB560(View* view) { view->projection = *projection; - gSPPerspNormalize(gfxCtx->overlay.p++, view->normal); - gSPMatrix(gfxCtx->overlay.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPPerspNormalize(oGfxCtx->overlay.p++, view->normal); + gSPMatrix(oGfxCtx->overlay.p++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); viewing = Graph_Alloc(gfxCtx, sizeof(Mtx)); LogUtils_CheckNullPointer("viewing", viewing, "../z_view.c", 848); @@ -505,23 +504,21 @@ s32 func_800AB560(View* view) { view->viewing = *viewing; - gSPMatrix(gfxCtx->overlay.p++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); + gSPMatrix(oGfxCtx->overlay.p++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_view.c", 871); + CLOSE_DISPS(gfxCtx, "../z_view.c", 871); return 1; } s32 func_800AB944(View* view) { - Gfx* dispRefs[5]; - - Graph_OpenDisps(dispRefs, view->gfxCtx, "../z_view.c", 878); + OPEN_DISPS(view->gfxCtx, "../z_view.c", 878); func_800ABE74(view->eye.x, view->eye.y, view->eye.z); guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->lookAt.x, view->lookAt.y, view->lookAt.z, view->up.x, view->up.y, view->up.z); - Graph_CloseDisps(dispRefs, view->gfxCtx, "../z_view.c", 886); + CLOSE_DISPS(view->gfxCtx, "../z_view.c", 886); return 1; } diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index b961271d15..b8cd7f3367 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -12,19 +12,18 @@ Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z) { } void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 alpha, f32 x, f32 y, f32 z) { - Gfx* dispRefs[5]; + OPEN_DISPS(gfxCtx, "../z_vr_box_draw.c", 52); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_vr_box_draw.c", 52); func_800945A0(gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 7, skyboxCtx->staticSegments[0]); - gSPSegment(gfxCtx->polyOpa.p++, 8, skyboxCtx->staticSegments[1]); - gSPSegment(gfxCtx->polyOpa.p++, 9, skyboxCtx->staticSegments[2]); + gSPSegment(oGfxCtx->polyOpa.p++, 7, skyboxCtx->staticSegments[0]); + gSPSegment(oGfxCtx->polyOpa.p++, 8, skyboxCtx->staticSegments[1]); + gSPSegment(oGfxCtx->polyOpa.p++, 9, skyboxCtx->staticSegments[2]); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0x00, 0x00, 0, 0, 0, alpha); - gSPTexture(gfxCtx->polyOpa.p++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON) + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0x00, 0x00, 0, 0, 0, alpha); + gSPTexture(oGfxCtx->polyOpa.p++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON); - sSkyboxDrawMatrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); + sSkyboxDrawMatrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); Matrix_Translate(x, y, z, MTXMODE_NEW); Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); @@ -32,54 +31,55 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb Matrix_RotateY(skyboxCtx->rot.y, MTXMODE_APPLY); Matrix_RotateZ(skyboxCtx->rot.z, MTXMODE_APPLY); Matrix_ToMtx(sSkyboxDrawMatrix, "../z_vr_box_draw.c", 76); - gSPMatrix(gfxCtx->polyOpa.p++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyOpa.p++, sSkyboxDrawMatrix, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetColorDither(gfxCtx->polyOpa.p++, G_CD_MAGICSQ); - gDPSetTextureFilter(gfxCtx->polyOpa.p++, G_TF_BILERP); + gDPSetColorDither(oGfxCtx->polyOpa.p++, G_CD_MAGICSQ); + gDPSetTextureFilter(oGfxCtx->polyOpa.p++, G_TF_BILERP); - gDPLoadTLUT_pal256(gfxCtx->polyOpa.p++, skyboxCtx->staticSegments[2]); - gDPSetTextureLUT(gfxCtx->polyOpa.p++, G_TT_RGBA16); - gDPSetTextureConvert(gfxCtx->polyOpa.p++, G_TC_FILT); + gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, skyboxCtx->staticSegments[2]); + gDPSetTextureLUT(oGfxCtx->polyOpa.p++, G_TT_RGBA16); + gDPSetTextureConvert(oGfxCtx->polyOpa.p++, G_TC_FILT); if (skyboxCtx->unk_140) { - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 1); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 1); - gDPPipeSync(gfxCtx->polyOpa.p++); + gDPPipeSync(oGfxCtx->polyOpa.p++); - gDPLoadTLUT_pal256(gfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 1); + gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 1); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 2); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 3); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 2); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 3); if (skyboxId != 2) { if (skyboxId <= 0x10 || skyboxId >= 0x19) { - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPLoadTLUT_pal256(gfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 2); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 4); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 5); - gDPPipeSync(gfxCtx->polyOpa.p++); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 2); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 4); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 5); + gDPPipeSync(oGfxCtx->polyOpa.p++); if (skyboxCtx->unk_140 != 2) { - gDPLoadTLUT_pal256(gfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 3); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 6); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 7); + gDPLoadTLUT_pal256(oGfxCtx->polyOpa.p++, (u16*)skyboxCtx->staticSegments[2] + 256 * 3); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 6); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 7); } } } } else { - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 2); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 4); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 6); - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 8); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 2); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 4); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 6); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 8); if (skyboxId == 5) { - gSPDisplayList(gfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 10); + gSPDisplayList(oGfxCtx->polyOpa.p++, skyboxCtx->dpList + 150 * 10); } } - gDPPipeSync(gfxCtx->polyOpa.p++); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_vr_box_draw.c", 125); + gDPPipeSync(oGfxCtx->polyOpa.p++); + + CLOSE_DISPS(gfxCtx, "../z_vr_box_draw.c", 125); } void SkyboxDraw_Update(SkyboxContext* skyboxCtx) { diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 73098c669b..d1fa131e1b 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -308,13 +308,10 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Vec3f sp60; f32 sp5C; f32 sp58; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (player->actor.draw != NULL) { if (player->unk_15D == 0xF) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arms_hook.c", 850); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 850); if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); @@ -329,9 +326,9 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80090480(globalCtx, &this->collider.base, &this->unk_1CC, &sp6C, &sp60); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 895), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_0602B288); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_0602B288); Matrix_Translate(this->actor.posRot.pos.x, this->actor.posRot.pos.y, this->actor.posRot.pos.z, MTXMODE_NEW); Math_Vec3f_Diff(&player->unk_3C8, &this->actor.posRot.pos, &sp78); sp58 = SQ(sp78.x) + SQ(sp78.z); @@ -339,11 +336,11 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(Math_atan2f(sp78.x, sp78.z), MTXMODE_APPLY); Matrix_RotateX(Math_atan2f(-sp78.y, sp5C), MTXMODE_APPLY); Matrix_Scale(0.015f, 0.015f, sqrtf(SQ(sp78.y) + sp58) * 0.01f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arms_hook.c", 910), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_0602AFF0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_0602AFF0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arms_hook.c", 913); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arms_hook.c", 913); } } } diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 50f8a4e49d..375acb4ec1 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -194,10 +194,8 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { ArrowFire* this = THIS; s32 pad; u32 stateFrames; - GraphicsContext* gfxCtx; - Actor* tranform; EnArrow* arrow; - Gfx* dispRefs[4]; + Actor* tranform; stateFrames = globalCtx->state.frames; arrow = (EnArrow*)this->actor.parent; @@ -206,9 +204,9 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { if (1) {} tranform = (arrow->hitWall & 2) ? &this->actor : &arrow->actor; - // clang-format off - gfxCtx = globalCtx->state.gfxCtx; Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arrow_fire.c", 618); - // clang-format on + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 618); + Matrix_Translate(tranform->posRot.pos.x, tranform->posRot.pos.y, tranform->posRot.pos.z, MTXMODE_NEW); Matrix_RotateY(tranform->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); Matrix_RotateX(tranform->shape.rot.x * (M_PI / 32768), MTXMODE_APPLY); @@ -217,18 +215,18 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { // Draw red effect over the screen when arrow hits if (this->unk_15C > 0) { - gfxCtx->polyXlu.p = func_800937C0(gfxCtx->polyXlu.p); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, (s32)(40.0f * this->unk_15C) & 0xFF, 0, 0, + oGfxCtx->polyXlu.p = func_800937C0(oGfxCtx->polyXlu.p); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, (s32)(40.0f * this->unk_15C) & 0xFF, 0, 0, (s32)(150.0f * this->unk_15C) & 0xFF); - gDPSetAlphaDither(gfxCtx->polyXlu.p++, G_AD_DISABLE); - gDPSetColorDither(gfxCtx->polyXlu.p++, G_CD_DISABLE); - gDPFillRectangle(gfxCtx->polyXlu.p++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); + gDPSetAlphaDither(oGfxCtx->polyXlu.p++, G_AD_DISABLE); + gDPSetColorDither(oGfxCtx->polyXlu.p++, G_CD_DISABLE); + gDPFillRectangle(oGfxCtx->polyXlu.p++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); } // Draw fire on the arrow func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 255, 200, 0, this->alpha); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 0, 0, 128); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 255, 200, 0, this->alpha); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 0, 0, 128); Matrix_RotateRPY(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); @@ -237,13 +235,14 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->unk_158 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 666), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 666), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 255 - (stateFrames * 2) % 256, 0, 64, 32, 1, 255 - stateFrames % 256, 511 - (stateFrames * 10) % 512, 64, 64)); - gSPDisplayList(gfxCtx->polyXlu.p++, sVertexDL); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arrow_fire.c", 682); + gSPDisplayList(oGfxCtx->polyXlu.p++, sVertexDL); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_fire.c", 682); } } diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index b82c519cd0..78ab62bacd 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -196,9 +196,7 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; Actor* tranform; u32 stateFrames; - GraphicsContext* gfxCtx; EnArrow* arrow; - Gfx* dispRefs[4]; stateFrames = globalCtx->state.frames; arrow = (EnArrow*)this->actor.parent; @@ -207,9 +205,9 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { if (1) {} tranform = (arrow->hitWall & 2) ? &this->actor : &arrow->actor; - // clang-format off - gfxCtx = globalCtx->state.gfxCtx; Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arrow_ice.c", 610); - // clang-format on + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 610); + Matrix_Translate(tranform->posRot.pos.x, tranform->posRot.pos.y, tranform->posRot.pos.z, MTXMODE_NEW); Matrix_RotateY(tranform->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); Matrix_RotateX(tranform->shape.rot.x * (M_PI / 32768), MTXMODE_APPLY); @@ -218,18 +216,18 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { // Draw blue effect over the screen when arrow hits if (this->unk_164 > 0) { - gfxCtx->polyXlu.p = func_800937C0(gfxCtx->polyXlu.p); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0, (s32)(10.0f * this->unk_164) & 0xFF, + oGfxCtx->polyXlu.p = func_800937C0(oGfxCtx->polyXlu.p); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 0, (s32)(10.0f * this->unk_164) & 0xFF, (s32)(50.0f * this->unk_164) & 0xFF, (s32)(150.0f * this->unk_164) & 0xFF); - gDPSetAlphaDither(gfxCtx->polyXlu.p++, G_AD_DISABLE); - gDPSetColorDither(gfxCtx->polyXlu.p++, G_CD_DISABLE); - gDPFillRectangle(gfxCtx->polyXlu.p++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); + gDPSetAlphaDither(oGfxCtx->polyXlu.p++, G_AD_DISABLE); + gDPSetColorDither(oGfxCtx->polyXlu.p++, G_CD_DISABLE); + gDPFillRectangle(oGfxCtx->polyXlu.p++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); } // Draw ice on the arrow func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 170, 255, 255, this->alpha); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 255, 128); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 170, 255, 255, this->alpha); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 128); Matrix_RotateRPY(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); @@ -238,13 +236,14 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->unk_160 * 3.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 660), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 660), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 128, 32, 1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 10) % 512, 4, 16)); - gSPDisplayList(gfxCtx->polyXlu.p++, sVertexDL); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arrow_ice.c", 676); + gSPDisplayList(oGfxCtx->polyXlu.p++, sVertexDL); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_ice.c", 676); } } diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index a8ad430c9e..1e59f5eb7d 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -195,10 +195,8 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { ArrowLight* this = THIS; s32 pad; u32 stateFrames; - GraphicsContext* gfxCtx; - Actor* tranform; EnArrow* arrow; - Gfx* dispRefs[4]; + Actor* tranform; stateFrames = globalCtx->state.frames; arrow = (EnArrow*)this->actor.parent; @@ -207,9 +205,9 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { if (1) {} tranform = (arrow->hitWall & 2) ? &this->actor : &arrow->actor; - // clang-format off - gfxCtx = globalCtx->state.gfxCtx; Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arrow_light.c", 598); - // clang-format on + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 598); + Matrix_Translate(tranform->posRot.pos.x, tranform->posRot.pos.y, tranform->posRot.pos.z, MTXMODE_NEW); Matrix_RotateY(tranform->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY); Matrix_RotateX(tranform->shape.rot.x * (M_PI / 32768), MTXMODE_APPLY); @@ -218,18 +216,18 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { // Draw yellow effect over the screen when arrow hits if (this->unk_164 > 0) { - gfxCtx->polyXlu.p = func_800937C0(gfxCtx->polyXlu.p); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF, + oGfxCtx->polyXlu.p = func_800937C0(oGfxCtx->polyXlu.p); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF, (s32)(40.0f * this->unk_164) & 0xFF, 0, (s32)(150.0f * this->unk_164) & 0xFF); - gDPSetAlphaDither(gfxCtx->polyXlu.p++, G_AD_DISABLE); - gDPSetColorDither(gfxCtx->polyXlu.p++, G_CD_DISABLE); - gDPFillRectangle(gfxCtx->polyXlu.p++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); + gDPSetAlphaDither(oGfxCtx->polyXlu.p++, G_AD_DISABLE); + gDPSetColorDither(oGfxCtx->polyXlu.p++, G_CD_DISABLE); + gDPFillRectangle(oGfxCtx->polyXlu.p++, 0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1); } // Draw light on the arrow func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 255, 255, 170, this->alpha); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 255, 0, 128); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 255, 255, 170, this->alpha); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 255, 0, 128); Matrix_RotateRPY(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_APPLY); @@ -238,13 +236,14 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(this->radius * 0.2f, this->unk_160 * 4.0f, this->radius * 0.2f, MTXMODE_APPLY); Matrix_Translate(0.0f, -700.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_light.c", 648), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_arrow_light.c", 648), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 511 - (stateFrames * 5) % 512, 0, 4, 32, 1, 511 - (stateFrames * 10) % 512, 511 - (stateFrames * 30) % 512, 8, 16)); - gSPDisplayList(gfxCtx->polyXlu.p++, sVertexDL); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_arrow_light.c", 664); + gSPDisplayList(oGfxCtx->polyXlu.p++, sVertexDL); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_arrow_light.c", 664); } } diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index d72b8c68a4..c7e6a52aa0 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -159,7 +159,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) { func_80033480(globalCtx, &sp5C, 20.0f, 1, sp4C * 135.0f, 60, 1); func_8003555C(globalCtx, &sp5C, &D_808718FC, &D_80871908); } - func_8005AA1C(&globalCtx->cameras, 0, sp4C * 0.6f, 3); + func_8005AA1C(&globalCtx->mainCamera, 0, sp4C * 0.6f, 3); Audio_PlaySoundGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index 1482e484d2..bc3a537f5a 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -273,15 +273,14 @@ void BgDodoago_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgDodoago_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 672); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 672); if (Flags_GetEventChkInf(0xB0)) { func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 677), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 677), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_60013500); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_60013500); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 681); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_dodoago.c", 681); } diff --git a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c index 97962d4ccf..eb7349eea6 100644 --- a/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c +++ b/src/overlays/actors/ovl_Bg_Gate_Shutter/z_bg_gate_shutter.c @@ -127,15 +127,13 @@ void BgGateShutter_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgGateShutter_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 323); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 323); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 328), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 328), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06001CD0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001CD0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 333); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gate_shutter.c", 333); } diff --git a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c index 114fb009c6..dfd138731c 100644 --- a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c +++ b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c @@ -102,26 +102,23 @@ void BgGjyoBridge_Update(Actor* thisx, GlobalContext* globalCtx) { void BgGjyoBridge_Draw(Actor* thisx, GlobalContext* globalCtx) { BgGjyoBridge* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 260); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 260); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 8, + gSPSegment(oGfxCtx->polyXlu.p++, 8, Gfx_TexScroll(globalCtx->state.gfxCtx, globalCtx->gameplayFrames & 127, globalCtx->gameplayFrames * -3 & 127, 32, 32)); - gSPSegment(gfxCtx->polyXlu.p++, 9, + gSPSegment(oGfxCtx->polyXlu.p++, 9, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, -globalCtx->gameplayFrames & 127, 32, 32, 1, 0, globalCtx->gameplayFrames & 127, 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 281), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 281), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06000600); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06000600); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 285); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_gjyo_bridge.c", 285); } diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 5584a75e19..efd5baf7cb 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -152,20 +152,18 @@ void BgHaka_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgHaka_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka.c", 401); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_haka.c", 401); func_80093D18(globalCtx->state.gfxCtx); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka.c", 406), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka.c", 406), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_060001B0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_060001B0); Matrix_Translate(0.0f, 0.0f, thisx->minVelocityY * 10.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka.c", 416), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka.c", 416), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_060002A8); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_060002A8); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_haka.c", 421); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka.c", 421); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index 96b39a0ab3..38c1edd8cc 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -196,24 +196,25 @@ void BgHakaTubo_Update(Actor* thisx, GlobalContext* globalCtx) { void BgHakaTubo_DrawFlameCircle(BgHakaTubo* this, GlobalContext* globalCtx) { s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 476); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 476); + func_80093D84(globalCtx->state.gfxCtx); Matrix_Translate(this->dyna.actor.posRot.pos.x, this->dyna.actor.posRot.pos.y + 235.0f, this->dyna.actor.posRot.pos.z, MTXMODE_NEW); Matrix_RotateY(this->dyna.actor.shape.rot.y * 0.0000958738f, MTXMODE_APPLY); Matrix_Scale(0.07f, 0.04f, 0.07f, MTXMODE_APPLY); if (1) {} - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 0, 170, 255, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 0, 170, 255, 255); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, this->fireScroll & 127, 0, 32, 64, 1, 0, (this->fireScroll * -15) & 0xFF, 32, 64)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 497), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 497), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_040184B0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 501); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_040184B0); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_haka_tubo.c", 501); } void BgHakaTubo_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index fcf45902ef..7ff3e58ca3 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -495,11 +495,8 @@ void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { BgHeavyBlock* this = THIS; s32 pad; Player* player = PLAYER; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 904); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 904); if (BgHeavyBlock_LiftedUp == this->actionFunc) { func_800D1694(player->unk_3B0.x, player->unk_3B0.y, player->unk_3B0.z, &thisx->shape.rot); @@ -513,11 +510,11 @@ void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_MultVec3f(&D_80884ED4, &thisx->initPosRot); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 931), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 931), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_060013C0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_060013C0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 935); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 935); } void BgHeavyBlock_DrawPiece(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index bdbd71149f..0d4273c77e 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -192,20 +192,17 @@ void BgHidanFirewall_Update(Actor* thisx, GlobalContext* globalCtx) { void BgHidanFirewall_Draw(Actor* thisx, GlobalContext* globalCtx) { BgHidanFirewall* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 448); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 448); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x14); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x14); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80886D04[this->unk_150])); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0x01, 255, 255, 0, 150); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 0, 0, 255); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 458), + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80886D04[this->unk_150])); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0x01, 255, 255, 0, 150); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 0, 0, 255); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 458), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0600DA80); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0600DA80); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 463); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_firewall.c", 463); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index 81a8e13b9f..d499a18df4 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -152,15 +152,13 @@ void BgHidanKousi_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgHidanKousi_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 350); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 350); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 354), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 354), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_80889E84[thisx->params & 0xFF]); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_80889E84[thisx->params & 0xFF]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 359); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_kousi.c", 359); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index b5f18dbb47..1a7e37485e 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -177,36 +177,35 @@ void BgHidanRsekizou_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 i; s32 pad; MtxF mf; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 564); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 564); + func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 568), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 568), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_0600AD00); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_0600AD00); Matrix_MtxFCopy(&mf, &gMtxFClear); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0x14); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0x14); if ((s16)((func_8005A9F4(ACTIVE_CAM) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= 0) { for (i = 3; i >= 0; i--) { - gfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, gfxCtx->polyXlu.p); + oGfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, oGfxCtx->polyXlu.p); } for (i = 0; i < 4; i++) { - gfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, gfxCtx->polyXlu.p); + oGfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, oGfxCtx->polyXlu.p); } } else { for (i = 3; i >= 0; i--) { - gfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, gfxCtx->polyXlu.p); + oGfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 1, oGfxCtx->polyXlu.p); } for (i = 0; i < 4; i++) { - gfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, gfxCtx->polyXlu.p); + oGfxCtx->polyXlu.p = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, oGfxCtx->polyXlu.p); } } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 600); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 600); } diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 853a67bf3a..5492efb411 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -107,16 +107,14 @@ void BgIngate_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgIngate_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_ingate.c", 240); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 240); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 245), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 245), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06001040); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_ingate.c", 250); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001040); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 250); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index 1231ab962e..4469ad10a0 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -68,17 +68,15 @@ void BgJyaBlock_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgJyaBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 145); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 145); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(&D_05004350)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 153), + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(&D_05004350)); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 153), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 232, 210, 176, 255); - gSPDisplayList(gfxCtx->polyOpa.p++, D_05004CD0); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 232, 210, 176, 255); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_05004CD0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 158); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_block.c", 158); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 92a512cb49..b90f4f7d58 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -291,30 +291,25 @@ void BgJyaMegami_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgJyaMegami_DrawFace(BgJyaMegami* this, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 706); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 706); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sRightSideCrumbles[this->crumbleIndex])); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sLeftSideCrumbles[this->crumbleIndex])); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 716), + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sRightSideCrumbles[this->crumbleIndex])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sLeftSideCrumbles[this->crumbleIndex])); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 716), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06005780); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 720); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06005780); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 720); } void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { s32 pad; BgJyaMegamiPiece* piece; u32 i; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 746); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 746); func_80093D18(globalCtx->state.gfxCtx); for (i = 0; i < ARRAY_COUNT(this->pieces); i++) { @@ -327,11 +322,12 @@ void BgJyaMegami_DrawExplode(BgJyaMegami* this, GlobalContext* globalCtx) { Matrix_Translate(sPiecesInit[i].unk_00.x * -10.0f, sPiecesInit[i].unk_00.y * -10.0f, sPiecesInit[i].unk_00.z * -10.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 778), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 778), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, sDLists[i]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDLists[i]); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 783); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_jya_megami.c", 783); } void BgJyaMegami_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c index 2e933d9f7c..a742127dc8 100644 --- a/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c +++ b/src/overlays/actors/ovl_Bg_Mjin/z_bg_mjin.c @@ -101,24 +101,23 @@ void BgMjin_Update(Actor* thisx, GlobalContext* globalCtx) { void BgMjin_Draw(Actor* thisx, GlobalContext* globalCtx) { BgMjin* this = THIS; u32 dlist; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - s32 objBankIndex; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_mjin.c", 250); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 250); + if (thisx->params != 0) { - objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIDs[thisx->params - 1]); + s32 objBankIndex = Object_GetIndex(&globalCtx->objectCtx, sObjectIDs[thisx->params - 1]); if (objBankIndex >= 0) { gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objBankIndex].segment); } - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000)); dlist = D_06000330; } else { dlist = D_06000140; } func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 285), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 285), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, dlist); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_mjin.c", 288); + gSPDisplayList(oGfxCtx->polyOpa.p++, dlist); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mjin.c", 288); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index d01a69fb4a..508ddaf87b 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -256,15 +256,14 @@ void BgMoriElevator_Update(Actor* thisx, GlobalContext* globalCtx) { void BgMoriElevator_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; BgMoriElevator* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 575); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 575); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 580), + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIndex].segment); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 580), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06002AD0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 584); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06002AD0); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_elevator.c", 584); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 6a41b5438d..4fd3f2ce12 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -228,19 +228,17 @@ void BgMoriHineri_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { - BgMoriHineri* this = THIS; s8 objIndex; MtxF mtx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(&dispRefs, globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 611); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 611); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIdx].segment); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 618), + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, globalCtx->objectCtx.status[this->moriTexObjIdx].segment); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 618), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, sDLists[this->dyna.actor.params]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDLists[this->dyna.actor.params]); if (this->boxObjIdx > 0) { Matrix_Get(&mtx); } @@ -253,21 +251,21 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { } Matrix_RotateRPY(0, -0x8000, this->dyna.actor.shape.rot.z, MTXMODE_APPLY); Matrix_Translate(0.0f, -50.0f, 0.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 652), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 652), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_04049FE0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_04049FE0); } if ((this->boxObjIdx > 0) && ((this->boxObjIdx = Object_GetIndex(&globalCtx->objectCtx, OBJECT_BOX)) > 0) && (Object_IsLoaded(&globalCtx->objectCtx, this->boxObjIdx))) { - gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[this->boxObjIdx].segment); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, &D_80116280[2]); + gSPSegment(oGfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[this->boxObjIdx].segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, &D_80116280[2]); Matrix_Put(&mtx); Matrix_Translate(147.0f, -245.0f, -453.0f, MTXMODE_APPLY); Matrix_RotateY(1.5707964f, MTXMODE_APPLY); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 689), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 689), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000AE8); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000AE8); Matrix_Put(&mtx); Matrix_Translate(167.0f, -218.0f, -453.0f, MTXMODE_APPLY); if (Flags_GetTreasure(globalCtx, 0xE)) { @@ -276,9 +274,10 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(M_PI, MTXMODE_APPLY); } Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 703), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 703), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06001678); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001678); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 709); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_mori_hineri.c", 709); } diff --git a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c index 9aceee02ad..ed101fd6d6 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c @@ -79,13 +79,14 @@ void BgPushbox_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgPushbox_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 263); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 263); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 269), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 269), G_MTX_NOPUSH | G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_06000000); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 272); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_06000000); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_pushbox.c", 272); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index 5d43f4c73d..cf08b33ebf 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c @@ -78,15 +78,13 @@ void BgSpot01Fusya_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgSpot01Fusya_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 210); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 210); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 214), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 214), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000100); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000100); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 219); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_fusya.c", 219); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index c9cf0d1a81..3e16fabfd7 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -324,18 +324,17 @@ void BgSpot01Idohashira_Init(Actor* thisx, GlobalContext* globalCtx) { void func_808AB700(BgSpot01Idohashira* this, GlobalContext* globalCtx) { GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; - GraphicsContext* gfxCtx = localGfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, localGfxCtx, "../z_bg_spot01_idohashira.c", 689); + OPEN_DISPS(localGfxCtx, "../z_bg_spot01_idohashira.c", 689); + func_80093D18(localGfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(localGfxCtx, "../z_bg_spot01_idohashira.c", 699), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(localGfxCtx, "../z_bg_spot01_idohashira.c", 699), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_808AAF34(this, globalCtx); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000420); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000420); - Graph_CloseDisps(dispRefs, localGfxCtx, "../z_bg_spot01_idohashira.c", 708); + CLOSE_DISPS(localGfxCtx, "../z_bg_spot01_idohashira.c", 708); } void BgSpot01Idohashira_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c index 0cc5df6c4a..7d424c55c8 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c @@ -71,21 +71,20 @@ void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx) { u32 frames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 228); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 228); + func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 232), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 232), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); frames = globalCtx->state.frames; - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1, frames % 128, frames & 0x7F, 32, 32)); - gSPDisplayList(gfxCtx->polyXlu.p++, D_060007D0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 244); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_060007D0); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 244); } diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c index c958ef4231..5b584161ef 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c @@ -74,15 +74,13 @@ void BgSpot01Idosoko_Update(Actor* thisx, GlobalContext* globalCtx) { extern u32 D_06003B20; void BgSpot01Idosoko_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 162); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 162); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 166), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 166), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_06003B20); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_06003B20); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 171); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot01_idosoko.c", 171); } diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index d6555d3a89..60623e86da 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -167,20 +167,17 @@ void BgSpot09Obj_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgSpot09Obj_Draw(Actor* thisx, GlobalContext* globalCtx) { - BgSpot09Obj* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[3]; - Gfx_DrawDListOpa(globalCtx, sDLists[thisx->params]); + if (thisx->params == 3) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 388); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 388); + func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 391), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 391), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06008010); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06008010); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 396); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot09_obj.c", 396); } } diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c index e29637ec8b..cc81638051 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c @@ -95,15 +95,13 @@ void BgSpot15Saku_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgSpot15Saku_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 259); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 259); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 263), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 263), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_060003C0); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_060003C0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 268); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot15_saku.c", 268); } diff --git a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c index baf45c7019..2cf5dc520d 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Doughnut/z_bg_spot16_doughnut.c @@ -122,44 +122,45 @@ void BgSpot16Doughnut_UpdateExpanding(Actor* thisx, GlobalContext* globalCtx) { void BgSpot16Doughnut_Draw(Actor* thisx, GlobalContext* globalCtx) { BgSpot16Doughnut* this = THIS; - u32 scroll; - GraphicsContext* gfxCtx; - Gfx* dispRefs[5]; + u32 scroll = globalCtx->gameplayFrames & 0xFFFF; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 210); - scroll = globalCtx->gameplayFrames & 0xFFFF; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 210); func_80093D84(globalCtx->state.gfxCtx); + if (1) {} - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 213), + + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 213), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->fireFlag & 1) { gSPSegment( - gfxCtx->polyXlu.p++, 0x08, + oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * (-1), 0, 16, 32, 1, scroll, scroll * (-2), 16, 32)); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 0, 0, this->envColorAlpha); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06000660); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 0, 0, this->envColorAlpha); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06000660); } else { - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 255, 255, this->envColorAlpha); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, 255); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06000FC0); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 255, 255, this->envColorAlpha); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, 255); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06000FC0); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 238); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 238); } // Draw function for outwardly expanding and dissipating void BgSpot16Doughnut_DrawExpanding(Actor* thisx, GlobalContext* globalCtx) { BgSpot16Doughnut* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 245); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 245); + func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 248), + + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 248), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 255, 255, this->envColorAlpha); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, 255); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06000FC0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 256); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 255, 255, this->envColorAlpha); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, 255); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06000FC0); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot16_doughnut.c", 256); } diff --git a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index 6695ff7a2d..0709472f49 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -127,44 +127,32 @@ void BgSpot17Bakudankabe_Update(Actor* thisx, GlobalContext* globalCtx) { void BgSpot17Bakudankabe_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; - s8 r; - s8 g; - { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + s8 r = coss(globalCtx->gameplayFrames * 1500) >> 8; + s8 g = coss(globalCtx->gameplayFrames * 1500) >> 8; - r = coss(globalCtx->gameplayFrames * 1500) >> 8; - g = coss(globalCtx->gameplayFrames * 1500) >> 8; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 269); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 269); + func_80093D18(globalCtx->state.gfxCtx); - func_80093D18(globalCtx->state.gfxCtx); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 273), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 273), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + r = (r >> 1) + 0xC0; + g = (g >> 1) + 0xC0; - r = (r >> 1) + 0xC0; - g = (g >> 1) + 0xC0; + gDPSetEnvColor(oGfxCtx->polyOpa.p++, r, g, 255, 128); - gDPSetEnvColor(gfxCtx->polyOpa.p++, r, g, 255, 128); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_060008A0); - gSPDisplayList(gfxCtx->polyOpa.p++, D_060008A0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 283); - } + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 283); - { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 286); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 286); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 290), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06000960); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 290), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06000960); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 295); - } + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_bakudankabe.c", 295); } diff --git a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c index f6e9580d3e..c6cc434fb3 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c @@ -55,21 +55,21 @@ void func_808B746C(Actor* thisx, GlobalContext* globalCtx) { } void func_808B7478(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 153); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 153); func_80093D84(globalCtx->state.gfxCtx); Matrix_RotateY((s16)(func_8005A9F4(ACTIVE_CAM) - thisx->shape.rot.y + 0x8000) * 9.58738019108e-05f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 161), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 161), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, (0 - globalCtx->gameplayFrames) & 0x7F, 0x20, 0x20, 1, 0, (0 - globalCtx->gameplayFrames) & 0x7F, 0x20, 0x20)); - do { - gSPDisplayList(gfxCtx->polyXlu.p++, D_06000B40); - } while (0); // necessary to match + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06000B40); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 176); + if (1) {} + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 176); } diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index 300c5657a6..fe33a54894 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -153,25 +153,21 @@ void BgTokiSwd_Update(Actor* thisx, GlobalContext* globalCtx) { } void BgTokiSwd_Draw(Actor* thisx, GlobalContext* globalCtx) { + GlobalContext* globalCtx2 = globalCtx; BgTokiSwd* this = THIS; s32 pad[3]; - GameState* state; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - state = &globalCtx->state; - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx2->state.gfxCtx, "../z_bg_toki_swd.c", 727); - Graph_OpenDisps(dispRefs, state->gfxCtx, "../z_bg_toki_swd.c", 727); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(globalCtx2->state.gfxCtx); - func_8002EBCC(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, globalCtx2, 0); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, - Gfx_TexScroll(globalCtx->state.gfxCtx, 0, -(globalCtx->gameplayFrames % 0x80), 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 742), + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, + Gfx_TexScroll(globalCtx2->state.gfxCtx, 0, -(globalCtx2->gameplayFrames % 0x80), 32, 32)); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx2->state.gfxCtx, "../z_bg_toki_swd.c", 742), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06001BD0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001BD0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 776); + CLOSE_DISPS(globalCtx2->state.gfxCtx, "../z_bg_toki_swd.c", 776); } diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index 925570980d..580aeb3a79 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -226,10 +226,9 @@ void BgTreemouth_Update(Actor* thisx, GlobalContext* globalCtx) { void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; u16 alpha = 500; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 893); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 893); + func_80093D18(globalCtx->state.gfxCtx); if ((gSaveContext.sceneSetupIndex < 4) || LINK_IS_ADULT) { @@ -243,10 +242,10 @@ void BgTreemouth_Draw(Actor* thisx, GlobalContext* globalCtx) { alpha = (globalCtx->unk_11D30[0] + 0x1F4); } - gDPSetEnvColor(gfxCtx->polyOpa.p++, 128, 128, 128, alpha * 0.1f); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 932), + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 128, 128, 128, alpha * 0.1f); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 932), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_060009D0); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_060009D0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 937); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_treemouth.c", 937); } diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index caa10e3bb5..c970724bed 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -189,22 +189,22 @@ void BgYdanHasi_Update(Actor* thisx, GlobalContext* globalCtx) { void BgYdanHasi_Draw(Actor* thisx, GlobalContext* globalCtx) { BgYdanHasi* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (this->dyna.actor.params == 0 || this->dyna.actor.params == 2) { Gfx_DrawDListOpa(globalCtx, D_808BEC24[this->dyna.actor.params]); return; } - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 577); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 577); + func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (0 - globalCtx->gameplayFrames & 0x7F), globalCtx->gameplayFrames & 0x7F, 0x20, 0x20, 1, globalCtx->gameplayFrames & 0x7F, globalCtx->gameplayFrames & 0x7F, 0x20, 0x20)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 592), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 592), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_06005DE0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 597); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_06005DE0); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_ydan_hasi.c", 597); } diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index 4fe09f5a24..b7e1570283 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -128,17 +128,15 @@ void BgZg_Init(Actor* thisx, GlobalContext* globalCtx) { void func_808C0EEC(BgZg* this, GlobalContext* globalCtx) { GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; - GraphicsContext* gfxCtx = localGfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, localGfxCtx, "../z_bg_zg.c", 311); + OPEN_DISPS(localGfxCtx, "../z_bg_zg.c", 311); func_80093D18(localGfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(localGfxCtx, "../z_bg_zg.c", 315), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(localGfxCtx, "../z_bg_zg.c", 315), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06001080); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001080); - Graph_CloseDisps(dispRefs, localGfxCtx, "../z_bg_zg.c", 320); + CLOSE_DISPS(localGfxCtx, "../z_bg_zg.c", 320); } void BgZg_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c index d3b2b487c1..f25d4ac4d4 100644 --- a/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c +++ b/src/overlays/actors/ovl_Demo_Geff/z_demo_geff.c @@ -75,34 +75,33 @@ void DemoGeff_Init(Actor* thisx, GlobalContext* globalCtx) { void func_80977EA8(GlobalContext* globalCtx, Gfx* dlist) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_demo_geff.c", 181); + OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 181); + func_80093D18(gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(gfxCtx, "../z_demo_geff.c", 183), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(gfxCtx, "../z_demo_geff.c", 183), G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, dlist); - gSPPopMatrix(gfxCtx->polyOpa.p++, G_MTX_MODELVIEW); + gSPDisplayList(oGfxCtx->polyOpa.p++, dlist); + gSPPopMatrix(oGfxCtx->polyOpa.p++, G_MTX_MODELVIEW); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_demo_geff.c", 188); + CLOSE_DISPS(gfxCtx, "../z_demo_geff.c", 188); } void func_80977F80(DemoGeff* this, GlobalContext* globalCtx) { s32 pad[2]; s32 objBankIndex = this->objBankIndex; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_demo_geff.c", 204); + OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 204); - gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment); gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objBankIndex].segment); // Necessary to match if (!globalCtx) {} - Graph_CloseDisps(dispRefs, gfxCtx, "../z_demo_geff.c", 212); + CLOSE_DISPS(gfxCtx, "../z_demo_geff.c", 212); } void func_80978030(DemoGeff* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 869b833650..ef55f10c0e 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -335,19 +335,17 @@ void func_8097D29C(DemoGo* this, GlobalContext* globalCtx) { SkelAnime* skelAnime = &this->skelAnime; void* srcSegment8 = D_8097D440[temp]; void* srcSegment9 = &D_0600E680; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_go.c", 732); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_go.c", 732); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(srcSegment8)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(srcSegment9)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(srcSegment8)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(srcSegment9)); SkelAnime_DrawSV(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, NULL, NULL, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_go.c", 746); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_go.c", 746); } void DemoGo_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 184219ca8b..e0a893f5de 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -526,20 +526,20 @@ void func_80985CE8(DemoIm* this, GlobalContext* globalCtx) { s16 unk_25C = this->unk_25C; UNK_PTR sp68 = D_80987830[unk_25C]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 281); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 281); + func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp68)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp68)); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 0, this->unk_26C); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, &D_80116280[0]); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp68)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp68)); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, this->unk_26C); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, &D_80116280[0]); - gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - NULL, NULL, NULL, gfxCtx->polyXlu.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 308); + oGfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, + skelAnime->dListCount, NULL, NULL, NULL, oGfxCtx->polyXlu.p); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_im_inKenjyanomaDemo02.c", 308); } void func_80985E60(DemoIm* this, GlobalContext* globalCtx) { @@ -1188,20 +1188,20 @@ void func_80987658(DemoIm* this, GlobalContext* globalCtx) { s16 unk_25C = this->unk_25C; UNK_PTR sp68 = D_80987830[unk_25C]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_im.c", 904); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_im.c", 904); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp68)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp68)); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 0, 255); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp68)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp68)); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 255); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); SkelAnime_DrawSV(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, func_80987514, func_809875C0, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_im.c", 925); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_im.c", 925); } void DemoIm_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 35b054cc55..97f8be83d3 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -457,21 +457,21 @@ void func_8098F1C0(DemoSa* this, GlobalContext* globalCtx) { s32 pad2; UNK_PTR sp6C = D_809900F4[unk_194]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 296); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 296); + func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp78)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp78)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp6C)); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 0, this->alpha); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, D_80116280); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp78)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp78)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp6C)); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, this->alpha); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, D_80116280); - gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - NULL, NULL, NULL, gfxCtx->polyXlu.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 325); + oGfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, + skelAnime->dListCount, NULL, NULL, NULL, oGfxCtx->polyXlu.p); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 325); } void func_8098F390(DemoSa* this, GlobalContext* globalCtx) { @@ -796,21 +796,21 @@ void func_8098FEB4(DemoSa* this, GlobalContext* globalCtx) { s16 unk_194 = this->unk_194; UNK_PTR sp64 = D_809900F4[unk_194]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(&dispRefs, globalCtx->state.gfxCtx, "../z_demo_sa.c", 602); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa.c", 602); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp70)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp70)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp64)); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 0, 255); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp70)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp70)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp64)); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 255); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); SkelAnime_DrawSV(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, DemoSa_OverrideLimbDraw, NULL, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_demo_sa.c", 626); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa.c", 626); } void DemoSa_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 99ef9cc3dd..65c00ca567 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -161,13 +161,12 @@ void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { } void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_ana.c", 440); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_door_ana.c", 440); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_05001390); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_door_ana.c", 449); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_05001390); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_ana.c", 449); } diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index 28d5813308..aeecac36ac 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -150,20 +150,18 @@ void DoorGerudo_Update(Actor* thisx, GlobalContext* globalCtx) { void DoorGerudo_Draw(Actor* thisx, GlobalContext* globalCtx) { DoorGerudo* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 361); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_door_gerudo.c", 361); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 365), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 365), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000040); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000040); if (this->unk_166 != 0) { Matrix_Scale(0.01f, 0.01f, 0.025f, MTXMODE_APPLY); func_80033F54(globalCtx, this->unk_166, 0); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_door_gerudo.c", 377); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_door_gerudo.c", 377); } diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index b3e33f3295..b3d4ae76be 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -219,29 +219,28 @@ void ElfMsg_Update(Actor* thisx, GlobalContext* globalCtx) { } void ElfMsg_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg.c", 436); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_elf_msg.c", 436); if (R_NAVI_MSG_REGION_ALPHA == 0) { return; } + func_80093D18(globalCtx->state.gfxCtx); if (thisx->params & 0x8000) { - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 100, 100, R_NAVI_MSG_REGION_ALPHA); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 100, 100, R_NAVI_MSG_REGION_ALPHA); } else { - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, R_NAVI_MSG_REGION_ALPHA); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, R_NAVI_MSG_REGION_ALPHA); } - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_elf_msg.c", 448), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_elf_msg.c", 448), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_809AD278); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_809AD278); if (thisx->params & 0x4000) { - gSPDisplayList(gfxCtx->polyXlu.p++, D_809AD4B8); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_809AD4B8); } else { - gSPDisplayList(gfxCtx->polyXlu.p++, D_809AD3B8); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_809AD3B8); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_elf_msg.c", 457); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg.c", 457); } diff --git a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c index 618cf9e19f..33f130f6c0 100644 --- a/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c +++ b/src/overlays/actors/ovl_Elf_Msg2/z_elf_msg2.c @@ -180,19 +180,18 @@ void ElfMsg2_Update(Actor* thisx, GlobalContext* globalCtx) { } void ElfMsg2_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg2.c", 355); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_elf_msg2.c", 355); if (R_NAVI_MSG_REGION_ALPHA == 0) { return; } + func_80093D18(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 100, 100, 255, R_NAVI_MSG_REGION_ALPHA); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_elf_msg2.c", 362), + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 100, 100, 255, R_NAVI_MSG_REGION_ALPHA); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_elf_msg2.c", 362), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_809ADC38); - gSPDisplayList(gfxCtx->polyXlu.p++, D_809ADCF8); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_elf_msg2.c", 367); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_809ADC38); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_809ADCF8); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_elf_msg2.c", 367); } diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index e0b9fb5e3b..0ce750ef04 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -314,17 +314,15 @@ void EnAni_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve void EnAni_Draw(Actor* thisx, GlobalContext* globalCtx) { EnAni* this = THIS; s32 pad; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ani.c", 719); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ani.c", 719); func_800943C8(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809B0F80[this->unk_2AC])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809B0F80[this->unk_2AC])); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ani.c", 736); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ani.c", 736); } diff --git a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index 2927bc6784..05358b8e36 100644 --- a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -135,10 +135,8 @@ void EnBlkobj_Update(Actor* thisx, GlobalContext* globalCtx) { void func_809C2324(GlobalContext* globalCtx, Gfx* dList, s32 alpha) { Gfx* segment; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 322); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 322); if (alpha == 255) { segment = D_809C2590; @@ -146,28 +144,28 @@ void func_809C2324(GlobalContext* globalCtx, Gfx* dList, s32 alpha) { segment = D_809C25A0; } - gSPSegment(gfxCtx->polyXlu.p++, 0x08, segment); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 0, alpha); - gSPDisplayList(gfxCtx->polyXlu.p++, dList); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, segment); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, alpha); + gSPDisplayList(oGfxCtx->polyXlu.p++, dList); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 330); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 330); } void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) { EnBlkobj* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + s32 pad; s32 temp_a3; u32 gameplayFrames; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 349); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 349); + func_80093D84(globalCtx->state.gfxCtx); gameplayFrames = globalCtx->gameplayFrames % 128; - gSPSegment(gfxCtx->polyXlu.p++, 0x0D, + gSPSegment(oGfxCtx->polyXlu.p++, 0x0D, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, gameplayFrames, 0, 32, 32, 1, gameplayFrames, 0, 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 363), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 363), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->unk_164 != 0) { @@ -178,5 +176,5 @@ void EnBlkobj_Draw(Actor* thisx, GlobalContext* globalCtx) { func_809C2324(globalCtx, D_060053D0, temp_a3); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_blkobj.c", 375); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_blkobj.c", 375); } diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index f2d32b7ca1..ea2b01072b 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -291,7 +291,7 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { if (globalCtx) {}; globalCtx->envCtx.unk_8C[1][0] = globalCtx->envCtx.unk_8C[1][1] = globalCtx->envCtx.unk_8C[1][2] = 0xFA; globalCtx->envCtx.unk_8C[0][0] = globalCtx->envCtx.unk_8C[0][1] = globalCtx->envCtx.unk_8C[0][2] = 0xFA; - func_8005AA1C(&globalCtx->cameras[0], 2, 0xB, 8); + func_8005AA1C(&globalCtx->mainCamera, 2, 0xB, 8); thisx->params = BOMB_EXPLOSION; this->timer = 10; thisx->flags |= 0x20; @@ -328,30 +328,28 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx) { void EnBom_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnBom* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (1) {} - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_bom.c", 913); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bom.c", 913); if (thisx->params == BOMB_BODY) { func_80093D18(globalCtx->state.gfxCtx); func_800D1FD4(&globalCtx->mf_11DA0); func_8002EBCC(thisx, globalCtx, 0); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 928), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 928), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_04007A50); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_04007A50); Matrix_RotateRPY(0x4000, 0, 0, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 934), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bom.c", 934), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, (s16)this->flashIntensity, 0, 40, 255); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, (s16)this->flashIntensity, 0, 40, 255); - gSPDisplayList(gfxCtx->polyOpa.p++, D_04007860); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, (s16)this->flashIntensity, 0, 40, 255); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, (s16)this->flashIntensity, 0, 40, 255); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_04007860); func_800628A4(0, &this->explosionCollider); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_bom.c", 951); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bom.c", 951); } diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 85c85a4a0c..617987e671 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -401,7 +401,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Audio_PlayActorSound2(thisx, NA_SE_IT_BOMB_EXPLOSION); globalCtx->envCtx.unk_8C[1][0] = globalCtx->envCtx.unk_8C[1][1] = globalCtx->envCtx.unk_8C[1][2] = 0xFA; globalCtx->envCtx.unk_8C[0][0] = globalCtx->envCtx.unk_8C[0][1] = globalCtx->envCtx.unk_8C[0][2] = 0xFA; - func_8005AA1C(&globalCtx->cameras[0], 2, 0xB, 8); + func_8005AA1C(&globalCtx->mainCamera, 2, 0xB, 8); thisx->params = BOMBFLOWER_EXPLOSION; this->timer = 10; thisx->flags |= 0x20; @@ -453,37 +453,35 @@ Gfx* EnBombf_NewMtxDList(GraphicsContext* gfxCtx, GlobalContext* globalCtx) { void EnBombf_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnBombf* this = THIS; - GraphicsContext* gfxCtx; - Gfx* disRefs[4]; if (1) {} - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(&disRefs, globalCtx->state.gfxCtx, "../z_en_bombf.c", 1034); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1034); if (thisx->params <= BOMBFLOWER_BODY) { func_80093D18(globalCtx->state.gfxCtx); if (thisx->params != BOMBFLOWER_BODY) { - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1041), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1041), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000340); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000530); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000340); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000530); Matrix_Translate(0.0f, 1000.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(this->flowerBombScale, this->flowerBombScale, this->flowerBombScale, MTXMODE_APPLY); } - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 200, 255, 200, 255); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, (s16)this->flashIntensity, 20, 10, 0); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1054), + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 200, 255, 200, 255); + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, (s16)this->flashIntensity, 20, 10, 0); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1054), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(EnBombf_NewMtxDList(globalCtx->state.gfxCtx, globalCtx))); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000408); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000408); } else { func_800628A4(0, &this->explosionCollider); } - Graph_CloseDisps(&disRefs, globalCtx->state.gfxCtx, "../z_en_bombf.c", 1063); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bombf.c", 1063); } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index e1ce985bca..1ec3056e8e 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -242,11 +242,9 @@ void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { EnBoom* this = THIS; Vec3f vec1; Vec3f vec2; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_boom.c", 567); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_boom.c", 567); + Matrix_RotateY(this->actor.posRot.rot.y * 0.0000958738f, MTXMODE_APPLY); Matrix_RotateZ(0.7669904f, MTXMODE_APPLY); Matrix_RotateX(this->actor.posRot.rot.x * 0.0000958738f, MTXMODE_APPLY); @@ -260,9 +258,9 @@ void EnBoom_Draw(Actor* thisx, GlobalContext* globalCtx) { func_80093D18(globalCtx->state.gfxCtx); Matrix_RotateY((this->activeTimer * 12000) * 0.0000958738f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_boom.c", 601), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_boom.c", 601), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_0400C808); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_0400C808); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_boom.c", 604); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_boom.c", 604); } diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 4626c87c5d..d5fb040f9f 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -184,53 +184,45 @@ void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { void EnBx_Draw(Actor* thisx, GlobalContext* globalCtx) { EnBx* this = THIS; + s32 pad; Mtx* mtx = Graph_Alloc(globalCtx->state.gfxCtx, 4 * sizeof(Mtx)); - f32 tmpf1; - f32 tmpf2; + s16 i; - { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - s16 i; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_bx.c", 464); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_bx.c", 464); - func_80093D18(globalCtx->state.gfxCtx); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, mtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[this->actor.params & 0x7F])); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, - Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, - (globalCtx->gameplayFrames * -10) % 128, 32, 32)); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bx.c", 478), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, mtx); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809D2560[this->actor.params & 0x7F])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 16, 1, 0, (globalCtx->gameplayFrames * -10) % 128, + 32, 32)); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_bx.c", 478), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (this->actor.params & 0x80) { - func_809D1D0C(&this->actor, globalCtx); - } - - this->unk_14E -= 0xBB8; - tmpf1 = (Math_Coss(this->unk_14E) * 0.0075f) + 0.015f; - thisx->scale.x = tmpf1; - thisx->scale.z = tmpf1; - - for (i = 3; i >= 0; i--) { - s16 off = (0x2000 * i); - tmpf2 = (Math_Coss(this->unk_14E + off) * 0.0075f) + 0.015f; - this->unk_184[i].x = tmpf2; - this->unk_184[i].z = tmpf2; - this->unk_1B4[i].x = thisx->shape.rot.x; - this->unk_1B4[i].y = thisx->shape.rot.y; - this->unk_1B4[i].z = thisx->shape.rot.z; - } - - for (i = 0; i < 4; i++, mtx++) { - Matrix_Translate(this->unk_154[i].x, this->unk_154[i].y, this->unk_154[i].z, MTXMODE_NEW); - Matrix_RotateRPY(this->unk_1B4[i].x, this->unk_1B4[i].y, this->unk_1B4[i].z, MTXMODE_APPLY); - Matrix_Scale(this->unk_184[i].x, this->unk_184[i].y, this->unk_184[i].z, MTXMODE_APPLY); - Matrix_ToMtx(mtx, "../z_en_bx.c", 507); - } - - gSPDisplayList(gfxCtx->polyOpa.p++, D_060022F0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_bx.c", 511); + if (this->actor.params & 0x80) { + func_809D1D0C(&this->actor, globalCtx); } + + this->unk_14E -= 0xBB8; + thisx->scale.z = thisx->scale.x = (Math_Coss(this->unk_14E) * 0.0075f) + 0.015f; + + for (i = 3; i >= 0; i--) { + s16 off = (0x2000 * i); + this->unk_184[i].z = this->unk_184[i].x = (Math_Coss(this->unk_14E + off) * 0.0075f) + 0.015f; + this->unk_1B4[i].x = thisx->shape.rot.x; + this->unk_1B4[i].y = thisx->shape.rot.y; + this->unk_1B4[i].z = thisx->shape.rot.z; + } + + for (i = 0; i < 4; i++, mtx++) { + Matrix_Translate(this->unk_154[i].x, this->unk_154[i].y, this->unk_154[i].z, MTXMODE_NEW); + Matrix_RotateRPY(this->unk_1B4[i].x, this->unk_1B4[i].y, this->unk_1B4[i].z, MTXMODE_APPLY); + Matrix_Scale(this->unk_184[i].x, this->unk_184[i].y, this->unk_184[i].z, MTXMODE_APPLY); + Matrix_ToMtx(mtx, "../z_en_bx.c", 507); + } + + gSPDisplayList(oGfxCtx->polyOpa.p++, D_060022F0); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_bx.c", 511); } diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 34c41e498d..ddae36cb9b 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -451,18 +451,17 @@ void EnDog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) { EnDog* this = THIS; Color_RGBA8 colors[] = { { 255, 255, 200, 0 }, { 150, 100, 50, 0 } }; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_dog.c", 972); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_dog.c", 972); + func_80093D18(globalCtx->state.gfxCtx); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetEnvColor(gfxCtx->polyOpa.p++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, EnDog_OverrideLimbDraw, EnDog_PostLimbDraw, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_dog.c", 994); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_dog.c", 994); } diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index 3fd63096e0..746f183c60 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -96,12 +96,10 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02 }; EnDyExtra* this = THIS; s32 pad; - GraphicsContext* localGfxCtx = globalCtx->state.gfxCtx; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; Vtx* vertices = SEGMENTED_TO_VIRTUAL(D_0601BFB0); s32 i; u8 unk[3]; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; unk[0] = 0.0f; unk[1] = (s8)(this->unk_158 * 240.0f); @@ -113,19 +111,20 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) { } } - gfxCtx = localGfxCtx; + OPEN_DISPS(gfxCtx, "../z_en_dy_extra.c", 294); - Graph_OpenDisps(dispRefs, localGfxCtx, "../z_en_dy_extra.c", 294); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 2, 0, 0x20, 0x40, 1, globalCtx->state.frames, globalCtx->state.frames * -8, 0x10, 0x10)); - gDPPipeSync(gfxCtx->polyXlu.p++); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dy_extra.c", 307), + gDPPipeSync(oGfxCtx->polyXlu.p++); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_dy_extra.c", 307), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0x80, primColors[this->type].r, primColors[this->type].g, + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0x80, primColors[this->type].r, primColors[this->type].g, primColors[this->type].b, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, envColors[this->type].r, envColors[this->type].g, envColors[this->type].b, 128); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0601C160); - Graph_CloseDisps(dispRefs, localGfxCtx, "../z_en_dy_extra.c", 325); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, envColors[this->type].r, envColors[this->type].g, envColors[this->type].b, + 128); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0601C160); + + CLOSE_DISPS(gfxCtx, "../z_en_dy_extra.c", 325); } diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 9bdd1cddc2..83dd3bddcd 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -364,18 +364,17 @@ UNK_PTR D_80A0B3B8[] = { 0x04042140, 0x04042160, 0x04042180, 0x040421C0, 0x04042 void EnExRuppy_Draw(Actor* thisx, GlobalContext* globalCtx) { EnExRuppy* this = THIS; s32 pad; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (this->isFalling == 0) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 774); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 774); + func_80093D18(globalCtx->state.gfxCtx); func_8002EBCC(thisx, globalCtx, 0); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 780), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 780), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80A0B3B8[this->unk_150])); - gSPDisplayList(gfxCtx->polyOpa.p++, D_04042440); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 784); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80A0B3B8[this->unk_150])); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_04042440); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ex_ruppy.c", 784); } } diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index d577cb8ded..ca087cd740 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -465,58 +465,56 @@ void EnFhgFire_Update(Actor* thisx, GlobalContext* globalCtx) { void EnFhgFire_Draw(Actor* thisx, GlobalContext* globalCtx) { EnFhgFire* this = THIS; s32 pad; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1723); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1723); if (thisx->params == 0x24) { func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, (s8)this->unk_160); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 165, 255, 75, 0); - gDPPipeSync(gfxCtx->polyXlu.p++); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1745), + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, (s8)this->unk_160); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 165, 255, 75, 0); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1745), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, SEGMENTED_TO_VIRTUAL(D_0600FCF8)); + gSPDisplayList(oGfxCtx->polyXlu.p++, SEGMENTED_TO_VIRTUAL(D_0600FCF8)); } else if ((thisx->params == 0x26) || (thisx->params == 0x32)) { osSyncPrintf("yari hikari draw 1\n"); func_800D1FD4(&globalCtx->mf_11DA0); func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, (s8)this->unk_160); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, (s8)this->unk_160); if (this->fireMode > 0) { - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 255, 255, 0); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 255, 255, 0); } else { - gDPSetEnvColor(gfxCtx->polyXlu.p++, 165, 255, 75, 0); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 165, 255, 75, 0); } - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPPipeSync(oGfxCtx->polyXlu.p++); Matrix_RotateZ((thisx->shape.rot.z / 32768.0f) * 3.1416f, 1); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1801), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1801), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06012160); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06012160); } else if ((thisx->params == 0x27) || (thisx->params == 0x28) || (thisx->params == 0x29)) { func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0, 0, 0, (u8)this->unk_188); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 90, 50, 95, (s8)(this->unk_188 * 0.5f)); - gDPPipeSync(gfxCtx->polyXlu.p++); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1833), + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 0, 0, 0, (u8)this->unk_188); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 90, 50, 95, (s8)(this->unk_188 * 0.5f)); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1833), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (s16)this->unk_174, (s16)this->unk_178, 0x40, 0x40, 1, (s16)this->unk_17C, (s16)this->unk_180, 0x40, 0x40)); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0600FAA0); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0600FAA0); } else { osSyncPrintf("FF DRAW 1\n"); Matrix_Translate(0.0f, -100.0f, 0.0f, 1); func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, (s8)this->unk_160); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 255, 30, 0); - gDPPipeSync(gfxCtx->polyXlu.p++); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1892), + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 255, (s8)this->unk_160); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 255, 30, 0); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1892), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_060105E0); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_060105E0); osSyncPrintf("FF DRAW 2\n"); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1900); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fhg_fire.c", 1900); } diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 1aaf001d43..39e93759ea 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -1075,40 +1075,39 @@ static Color_RGBA8 sMergeColor = { 0x00, 0xFF, 0x00, 0x00 }; void EnFloormas_Draw(Actor* thisx, GlobalContext* globalCtx) { EnFloormas* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* gfx[4]; - s32 pad; - Graph_OpenDisps(gfx, globalCtx->state.gfxCtx, "../z_en_floormas.c", 2318); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2318); + func_80093D18(globalCtx->state.gfxCtx); if (this->collider.base.type == COLTYPE_UNK12) { func_80026230(globalCtx, &sMergeColor, this->actionTarget % 0x28, 0x28); } - gfxCtx->polyOpa.p = + oGfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, - EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, &this->actor, gfxCtx->polyOpa.p); + EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, &this->actor, oGfxCtx->polyOpa.p); if (this->collider.base.type == COLTYPE_UNK12) { func_80026608(globalCtx); } - Graph_CloseDisps(gfx, globalCtx->state.gfxCtx, "../z_en_floormas.c", 2340); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2340); } void EnFloormas_DrawHighlighted(Actor* thisx, GlobalContext* globalCtx) { EnFloormas* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* gfx[4]; - Graph_OpenDisps(gfx, globalCtx->state.gfxCtx, "../z_en_floormas.c", 2352); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2352); + func_80093D84(globalCtx->state.gfxCtx); if (this->collider.base.type == COLTYPE_UNK12) { func_80026690(globalCtx, &sMergeColor, this->actionTarget % 0x28, 0x28); } - gfxCtx->polyXlu.p = + oGfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, - EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, &this->actor, gfxCtx->polyXlu.p); + EnFloormas_OverrideLimbDraw, EnFloormas_PostLimbDraw, &this->actor, oGfxCtx->polyXlu.p); if (this->collider.base.type == COLTYPE_UNK12) { func_80026A6C(globalCtx); } - Graph_CloseDisps(gfx, globalCtx->state.gfxCtx, "../z_en_floormas.c", 2374); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_floormas.c", 2374); } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 0dc5b7e350..7eba25741c 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -298,15 +298,14 @@ void EnFu_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec void EnFu_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnFu* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_fu.c", 773); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fu.c", 773); + func_800943C8(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->facialExpression])); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthSegments[this->facialExpression])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->facialExpression])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthSegments[this->facialExpression])); SkelAnime_DrawSV(globalCtx, this->skelanime.skeleton, this->skelanime.limbDrawTbl, this->skelanime.dListCount, EnFu_OverrideLimbDraw, EnFu_PostLimbDraw, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_fu.c", 791); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_fu.c", 791); } diff --git a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c index df8d920c6b..657ddb2f0b 100644 --- a/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c +++ b/src/overlays/actors/ovl_En_Ganon_Organ/z_en_ganon_organ.c @@ -93,28 +93,26 @@ Gfx* func_80A28148(GraphicsContext* gfxCtx, BossGanon* dorf) { } void EnGanonOrgan_Draw(Actor* thisx, GlobalContext* globalCtx) { - BossGanon* dorf; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + BossGanon* dorf = (BossGanon*)thisx->parent; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 205); - dorf = (BossGanon*)thisx->parent; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 205); osSyncPrintf("ORGAN DRAW 1\n"); func_80093D18(globalCtx->state.gfxCtx); if ((thisx->params == 1) && (dorf->organFadeTimer != 0xff)) { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, func_80A280BC(globalCtx->state.gfxCtx, dorf)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, func_80A28148(globalCtx->state.gfxCtx, dorf)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, func_80A280BC(globalCtx->state.gfxCtx, dorf)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, func_80A28148(globalCtx->state.gfxCtx, dorf)); } else { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, EnGanonOrgan_EmptyDList(globalCtx->state.gfxCtx)); } Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 221), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 221), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_80A2CCA8); - gSPDisplayList(gfxCtx->polyOpa.p++, D_80A2EAB0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_80A2CCA8); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_80A2EAB0); osSyncPrintf("ORGAN DRAW 2\n"); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 230); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ganon_organ.c", 230); } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 40b5037545..08c73c387e 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -524,12 +524,10 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { EnGs* this = THIS; s32 tmp; u32 frames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (!(this->unk_19E & 8)) { - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_gs.c", 1046); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_gs.c", 1046); + frames = globalCtx->gameplayFrames; func_80093D18(globalCtx->state.gfxCtx); Matrix_Push(); @@ -543,19 +541,19 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(this->unk_1A0[1].z * 0.0000958738f, MTXMODE_APPLY); } - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gs.c", 1064), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gs.c", 1064), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000950); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000950); if (this->unk_19E & 4) { - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, this->flashColor.r, this->flashColor.g, this->flashColor.b, + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, this->flashColor.r, this->flashColor.g, this->flashColor.b, this->flashColor.a); } else { - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 255, 255, 255, 255); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 255, 255, 255, 255); } - gSPDisplayList(gfxCtx->polyOpa.p++, D_060009D0); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000A60); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_060009D0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000A60); Matrix_Pull(); if (this->unk_19E & 2) { @@ -563,15 +561,16 @@ void EnGs_Draw(Actor* thisx, GlobalContext* globalCtx) { func_800D1FD4(&globalCtx->mf_11DA0); Matrix_Scale(0.05f, -0.05f, 1.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gs.c", 1087), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gs.c", 1087), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPSegment( - gfxCtx->polyXlu.p++, 0x08, + oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, -frames * 0x14, 0x20, 0x80)); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 128, 128, 255, 255, 0, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 0, 0, 0); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0404D4E0); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 128, 128, 255, 255, 0, 255); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 0, 0, 0); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0404D4E0); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_gs.c", 1101); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_gs.c", 1101); } } diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index ca2004c83c..5314a02ede 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -189,9 +189,8 @@ s32 EnGuest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis Actor* thisx) { EnGuest* this = THIS; Vec3s sp3C; - Gfx* dispRefs[5]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_guest.c", 352); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 352); if (limbIndex == 15) { *dList = D_060059B0; @@ -213,24 +212,25 @@ s32 EnGuest_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dLis rot->z += Math_Coss(this->unk_2EC[limbIndex]) * 200.0f; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_guest.c", 388); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 388); return 0; } void EnGuest_Draw(Actor* thisx, GlobalContext* globalCtx) { EnGuest* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 404); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_guest.c", 404); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, func_80A50708(globalCtx->state.gfxCtx, 0xFF, 0xFF, 0xFF, 0xFF)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, func_80A50708(globalCtx->state.gfxCtx, 0xA0, 0x3C, 0xDC, 0xFF)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80A50BA4[this->unk_30E])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, func_80A50708(globalCtx->state.gfxCtx, 0xFF, 0xFF, 0xFF, 0xFF)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, func_80A50708(globalCtx->state.gfxCtx, 0xA0, 0x3C, 0xDC, 0xFF)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80A50BA4[this->unk_30E])); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, EnGuest_OverrideLimbDraw, NULL, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_guest.c", 421); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_guest.c", 421); } diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 63fd4738ba..738ba28273 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -830,28 +830,24 @@ void EnHeishi2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList } void func_80A54C6C(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1772); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1772); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1774), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1774), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_06002C10); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1777); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_06002C10); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1777); } void EnHeishi2_Draw(Actor* thisx, GlobalContext* globalCtx) { - EnHeishi2* this; - GraphicsContext* gfxCtx; - s32 linkObjBankIndex; + EnHeishi2* this = THIS; Mtx* mtx; - Gfx* dispRefs[4]; + s32 linkObjBankIndex; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1792); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1792); func_80093D18(globalCtx->state.gfxCtx); - this = THIS; + SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnHeishi2_OverrideLimbDraw, EnHeishi2_PostLimbDraw, &this->actor); if ((this->initParams == 5) && (gSaveContext.infTable[7] & 0x80)) { @@ -862,11 +858,12 @@ void EnHeishi2_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateZ(DEGTORAD(70.0), MTXMODE_APPLY); mtx = Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1820) - 7; - gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[linkObjBankIndex].segment); - gSPSegment(gfxCtx->polyOpa.p++, 0x0D, mtx); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_0602B060); - gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[linkObjBankIndex].segment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0D, mtx); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_0602B060); + gSPSegment(oGfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[this->actor.objBankIndex].segment); } } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1834); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_heishi2.c", 1834); } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 6e99d389e1..93b8c81df0 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -476,14 +476,13 @@ void EnKz_Draw(Actor* thisx, GlobalContext* globalCtx) { 0x06001C70, }; EnKz* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_kz.c", 1259); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeSegments[this->eyeIdx])); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_kz.c", 1259); + + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeSegments[this->eyeIdx])); func_800943C8(globalCtx->state.gfxCtx); SkelAnime_DrawSV(globalCtx, this->skelanime.skeleton, this->skelanime.limbDrawTbl, this->skelanime.dListCount, EnKz_OverrideLimbDraw, EnKz_PostLimbDraw, &this->actor); - Graph_CloseDisps(&dispRefs, globalCtx->state.gfxCtx, "../z_en_kz.c", 1281); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_kz.c", 1281); } diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 084f1beea4..0de705e354 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -159,36 +159,33 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; FlameParams* flameParams; Gfx* dList; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (1) {} flameParams = &D_80A9E840[this->actor.params & 0xF]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_light.c", 441); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_light.c", 441); func_80093D84(globalCtx->state.gfxCtx); if (this->actor.params >= 0) { gSPSegment( - gfxCtx->polyXlu.p++, 0x08, + oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0, (this->timer * -20) & 511, 32, 128)); dList = D_0404D4E0; - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, flameParams->primColor.r, flameParams->primColor.g, + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, flameParams->primColor.r, flameParams->primColor.g, flameParams->primColor.b, flameParams->primColor.a); - gDPSetEnvColor(gfxCtx->polyXlu.p++, flameParams->envColor.r, flameParams->envColor.g, flameParams->envColor.b, + gDPSetEnvColor(oGfxCtx->polyXlu.p++, flameParams->envColor.r, flameParams->envColor.g, flameParams->envColor.b, 0); } else { - gSPSegment(gfxCtx->polyXlu.p++, 0x08, + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 16, 32, 1, ((this->timer * 2) & 63), (this->timer * -6) & 127 * 1, 16, 32)); dList = D_05000440; - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0xC0, 0xC0, 255, 200, 0, 0); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 0, 0, 0); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0xC0, 0xC0, 255, 200, 0, 0); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 0, 0, 0); } Matrix_RotateY((s16)((func_8005A9F4(ACTIVE_CAM) - this->actor.shape.rot.y) + 0x8000) * (M_PI / 32768.0f), @@ -199,9 +196,9 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { } Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_light.c", 488), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_light.c", 488), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, dList); + gSPDisplayList(oGfxCtx->polyXlu.p++, dList); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_light.c", 491); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_light.c", 491); } diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 7bdf6020e9..e70c062146 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -432,19 +432,20 @@ void EnMa1_Draw(Actor* thisx, GlobalContext* globalCtx) { EnMa1* this = THIS; Camera* camera; f32 someFloat; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma1.c", 1226); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma1.c", 1226); camera = ACTIVE_CAM; someFloat = Math_Vec3f_DistXZ(&this->actor.posRot.pos, &camera->eye); func_800F6268(someFloat, 0x2F); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AA16C4[this->unk_1E6])); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AA16D0[this->unk_1E4])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AA16C4[this->unk_1E6])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AA16D0[this->unk_1E4])); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, EnMa1_OverrideLimbDraw, EnMa1_PostLimbDraw, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma1.c", 1261); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma1.c", 1261); } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 3e76df129c..134eff97c4 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -351,38 +351,37 @@ s32 EnMa2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, void EnMa2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMa2* this = THIS; Vec3f vec = D_80AA28A8; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma2.c", 904); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 904); if (limbIndex == 18) { Matrix_MultVec3f(&vec, &this->actor.posRot2.pos); } if ((limbIndex == 14) && (this->skelAnime.animCurrentSeg == &D_060093BC)) { - gSPDisplayList(gfxCtx->polyOpa.p++, D_06005420); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06005420); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma2.c", 927); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 927); } void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx) { EnMa2* this = THIS; Camera* camera; f32 someFloat; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 955); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma2.c", 955); camera = ACTIVE_CAM; someFloat = Math_Vec3f_DistXZ(&this->actor.posRot.pos, &camera->eye); func_800F6268(someFloat, 0x2F); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AA28B4[this->unk_210])); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AA28C0[this->unk_20E])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AA28B4[this->unk_210])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AA28C0[this->unk_20E])); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, EnMa2_OverrideLimbDraw, EnMa2_PostLimbDraw, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma2.c", 990); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 990); } diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index cbec2f1f46..2b9998f894 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -331,38 +331,37 @@ s32 EnMa3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, void EnMa3_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnMa3* this = THIS; Vec3f vec = D_80AA3898; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma3.c", 927); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 927); if (limbIndex == 18) { Matrix_MultVec3f(&vec, &thisx->posRot2.pos); } if ((limbIndex == 14) && (this->skelAnime.animCurrentSeg == &D_060093BC)) { - gSPDisplayList(gfxCtx->polyOpa.p++, &D_06005420); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_06005420); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma3.c", 950); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 950); } void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) { EnMa3* this = THIS; Camera* camera; f32 someFloat; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 978); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma3.c", 978); camera = globalCtx->cameraPtrs[globalCtx->activeCamera]; someFloat = Math_Vec3f_DistXZ(&this->actor.posRot.pos, &camera->eye); func_800F6268(someFloat, 0x2F); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AA38A4[this->unk_210])); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AA38B0[this->unk_20E])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AA38A4[this->unk_210])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AA38B0[this->unk_20E])); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, EnMa3_OverrideLimbDraw, EnMa3_PostLimbDraw, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ma3.c", 1013); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 1013); } diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 6ce4abeaf6..7c87510274 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -807,18 +807,16 @@ void EnMd_Draw(Actor* thisx, GlobalContext* globalCtx) { 0x06005D30, }; EnMd* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_md.c", 1280); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_md.c", 1280); + if (this->alpha == 255) { - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeIdx])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeIdx])); func_80034BA0(globalCtx, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } else if (this->alpha != 0) { - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeIdx])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeIdx])); func_80034CC4(globalCtx, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_md.c", 1317); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_md.c", 1317); } diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index eeaf336797..26e9118b0d 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -240,14 +240,14 @@ void EnNiwGirl_Draw(Actor* thisx, GlobalContext* globalCtx) { EnNiwGirl* this = THIS; s32 pad; Vec3f sp4C = sConstVec3f; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_niw_girl.c", 573); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_niw_girl.c", 573); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AB99D8[this->unk_272])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AB99D8[this->unk_272])); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, EnNiwGirlOverrideLimbDraw, 0, &this->actor); func_80033C30(&this->actor.posRot.pos, &sp4C, 255, globalCtx); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_niw_girl.c", 592); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_niw_girl.c", 592); } diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index d79c303035..1100e2f41e 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -139,17 +139,16 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { } void EnNutsball_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_nutsball.c", 327); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 327); func_80093D18(globalCtx->state.gfxCtx); Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY); Matrix_RotateZ(thisx->initPosRot.rot.z * 9.58738e-05f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 333), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 333), G_MTX_MODELVIEW | G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, sDLists[thisx->params]); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDLists[thisx->params]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_nutsball.c", 337); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_nutsball.c", 337); } diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 7a2844d55a..ba13ce69f8 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -2358,22 +2358,23 @@ void func_80AF0400(EnRu1* this, GlobalContext* globalCtx) { s16 temp2 = this->unk_260; SkelAnime* skelAnime = &this->skelAnime; s32 addr2 = D_80AF0870[temp2]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad1; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1282); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru1.c", 1282); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr1)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr1)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr2)); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 0, 255); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr1)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr1)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr2)); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 255); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); - gfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - EnRu1_OverrideLimbDraw, EnRu1_PostLimbDraw, &this->actor, gfxCtx->polyOpa.p); + oGfxCtx->polyOpa.p = + SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, + EnRu1_OverrideLimbDraw, EnRu1_PostLimbDraw, &this->actor, oGfxCtx->polyOpa.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru1.c", 1309); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1309); } void func_80AF05D4(EnRu1* this, GlobalContext* globalCtx) { @@ -2383,22 +2384,23 @@ void func_80AF05D4(EnRu1* this, GlobalContext* globalCtx) { s16 temp2 = this->unk_260; SkelAnime* skelAnime = &this->skelAnime; s32 addr2 = D_80AF0870[temp2]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad1; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1324); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru1.c", 1324); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr1)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr1)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr2)); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 0, this->unk_2A8); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, &D_80116280[0]); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr1)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr1)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr2)); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, this->unk_2A8); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, &D_80116280[0]); - gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - EnRu1_OverrideLimbDraw, NULL, &this->actor, gfxCtx->polyXlu.p); + oGfxCtx->polyXlu.p = + SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, + EnRu1_OverrideLimbDraw, NULL, &this->actor, oGfxCtx->polyXlu.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru1.c", 1353); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru1.c", 1353); } void EnRu1_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index a461297bf7..1403bc1983 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -475,21 +475,20 @@ void func_80AF321C(EnRu2* this, GlobalContext* globalCtx) { s16 temp = this->unk_2A4; UNK_PTR addr = D_80AF410C[temp]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 264); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 264); + func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr)); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 0, this->alpha); - gSPSegment(gfxCtx->polyXlu.p++, 0x0C, &D_80116280[0]); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr)); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, this->alpha); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0C, &D_80116280[0]); - gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - NULL, NULL, NULL, gfxCtx->polyXlu.p); + oGfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, + skelAnime->dListCount, NULL, NULL, NULL, oGfxCtx->polyXlu.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 291); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2_inKenjyanomaDemo02.c", 291); } void func_80AF3394(EnRu2* this, GlobalContext* globalCtx) { @@ -801,20 +800,20 @@ void func_80AF3F20(EnRu2* this, GlobalContext* globalCtx) { s16 temp = this->unk_2A4; UNK_PTR addr = D_80AF410C[temp]; SkelAnime* skelAnime = &this->skelAnime; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru2.c", 642); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2.c", 642); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr)); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 0, 255); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(addr)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(addr)); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 255); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, &D_80116280[2]); SkelAnime_DrawSV(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, NULL, NULL, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_ru2.c", 663); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_ru2.c", 663); } void EnRu2_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c index 98255e1c44..48b1f362d9 100644 --- a/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c +++ b/src/overlays/actors/ovl_En_Scene_Change/z_en_scene_change.c @@ -56,18 +56,15 @@ void EnSceneChange_Draw(Actor* thisx, GlobalContext* globalCtx) { Gfx* displayList; s32 pad2[2]; Gfx* displayListHead; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; displayList = Graph_Alloc(globalCtx->state.gfxCtx, 0x3C0); - gfxCtx = globalCtx->state.gfxCtx; - - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_scene_change.c", 290); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_scene_change.c", 290); displayListHead = displayList; - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, displayListHead); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, displayListHead); func_80093D18(globalCtx->state.gfxCtx); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_scene_change.c", 386); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_scene_change.c", 386); } diff --git a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c index f37235e2e7..e83fa7527d 100644 --- a/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c +++ b/src/overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.c @@ -89,13 +89,14 @@ void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx) { } void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx) { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 200); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 200); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 205), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 205), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_06000EB0); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 210); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_06000EB0); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 210); } diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index 6aafc5ff07..15d2f4a632 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -756,37 +756,33 @@ void func_80B132A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { } void func_80B13464(EnSyatekiNiw* this, GlobalContext* globalCtx) { - s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; s16 i; EnSyatekiNiw_1* ptr = &this->unk_348[0]; u8 flag = 0; - { - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(gfxCtx, "../z_en_syateki_niw.c", 1234); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_en_syateki_niw.c", 1234); - func_80093D84(globalCtx->state.gfxCtx); + func_80093D84(globalCtx->state.gfxCtx); - for (i = 0; i < 5; i++, ptr++) { - if (ptr->unk_00 == 1) { - if (flag == 0) { - gSPDisplayList(gfxCtx->polyXlu.p++, D_060023B0); - flag++; - } - - Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); - func_800D1FD4(&globalCtx->mf_11DA0); - Matrix_Scale(ptr->unk_2C, ptr->unk_2C, 1.0f, MTXMODE_APPLY); - Matrix_RotateZ(ptr->unk_30, MTXMODE_APPLY); - Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); - - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(gfxCtx, "../z_en_syateki_niw.c", 1251), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06002428); + for (i = 0; i < 5; i++, ptr++) { + if (ptr->unk_00 == 1) { + if (flag == 0) { + gSPDisplayList(oGfxCtx->polyXlu.p++, D_060023B0); + flag++; } - } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_en_syateki_niw.c", 1257); + Matrix_Translate(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); + func_800D1FD4(&globalCtx->mf_11DA0); + Matrix_Scale(ptr->unk_2C, ptr->unk_2C, 1.0f, MTXMODE_APPLY); + Matrix_RotateZ(ptr->unk_30, MTXMODE_APPLY); + Matrix_Translate(0.0f, -1000.0f, 0.0f, MTXMODE_APPLY); + + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(gfxCtx, "../z_en_syateki_niw.c", 1251), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06002428); + } } + + CLOSE_DISPS(gfxCtx, "../z_en_syateki_niw.c", 1257); } diff --git a/src/overlays/actors/ovl_En_Tana/z_en_tana.c b/src/overlays/actors/ovl_En_Tana/z_en_tana.c index 29a3ea00c0..c10f1f7752 100644 --- a/src/overlays/actors/ovl_En_Tana/z_en_tana.c +++ b/src/overlays/actors/ovl_En_Tana/z_en_tana.c @@ -68,29 +68,27 @@ void EnTana_Update(Actor* thisx, GlobalContext* globalCtx) { void func_80B17FC4(Actor* thisx, GlobalContext* globalCtx) { EnTana* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tana.c", 148); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 148); + func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 152), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 152), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, sDLists1[thisx->params]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tana.c", 157); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDLists1[thisx->params]); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 157); } void func_80B1809C(Actor* thisx, GlobalContext* globalCtx) { EnTana* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tana.c", 163); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 163); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sUnkSegments[thisx->params])); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 169), + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sUnkSegments[thisx->params])); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tana.c", 169), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, sDLists1[thisx->params]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tana.c", 174); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDLists1[thisx->params]); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tana.c", 174); } diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 75b804ebef..89428b04dd 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -101,61 +101,47 @@ void EnTkEff_Draw(EnTk* this, GlobalContext* globalCtx) { }; EnTkEff* eff = this->eff; - GraphicsContext* gfxCtx; - s16 gfxSetup; - s16 i; - s16 alpha; s16 imageIdx; - Gfx* dispRefs[4]; + s16 gfxSetup; + s16 alpha; + s16 i; - /* - * This assignment always occurs before a call to Graph_OpenDisps which - * makes me suspect that they're inside a macro where the function call - * is present only for debug builds. Same for Graph_CloseDisps most likely. - */ - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 114); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 114); gfxSetup = 0; - /* - * Same code is generated without the if, - * but that would make the do...while redundant so there's probably an if. - */ - do { - if (1) { - func_80093D84(globalCtx->state.gfxCtx); - } - } while (0); + func_80093D84(globalCtx->state.gfxCtx); + + if (1) {} for (i = 0; i < ARRAY_COUNT(this->eff); i++) { if (eff->active != 0) { if (gfxSetup == 0) { - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0600BC90); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 100, 60, 20, 0); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0600BC90); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 100, 60, 20, 0); gfxSetup = 1; } alpha = eff->timeLeft * (255.f / eff->timeTotal); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 170, 130, 90, alpha); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 170, 130, 90, alpha); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPPipeSync(oGfxCtx->polyXlu.p++); Matrix_Translate(eff->pos.x, eff->pos.y, eff->pos.z, MTXMODE_NEW); func_800D1FD4(&globalCtx->mf_11DA0); Matrix_Scale(eff->size, eff->size, 1.f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 140), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 140), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); imageIdx = eff->timeLeft * ((f32)ARRAY_COUNT(images) / eff->timeTotal); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(images[imageIdx])); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(images[imageIdx])); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0600BCA0); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0600BCA0); } eff++; } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 154); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tk_eff.c", 154); } s32 EnTkEff_CreateDflt(EnTk* this, Vec3f* pos, u8 duration, f32 size, f32 growth, f32 yAccelMax) { @@ -695,15 +681,11 @@ void EnTk_Update(Actor* thisx, GlobalContext* globalCtx) { } void func_80B1D200(GlobalContext* globalCtx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1188); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tk.c", 1188); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_0600ACE0); - gSPDisplayList(gfxCtx->polyOpa.p++, D_0600ACE0); - - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tk.c", 1190); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1190); } s32 EnTk_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { @@ -748,22 +730,19 @@ void EnTk_Draw(Actor* thisx, GlobalContext* globalCtx) { 0x06004B40, }; EnTk* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; Matrix_Push(); EnTkEff_Draw(this, globalCtx); Matrix_Pull(); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tk.c", 1294); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1294); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeImageIdx])); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sEyesSegments[this->eyeImageIdx])); SkelAnime_DrawSV(globalCtx, this->skelAnim.skeleton, this->skelAnim.limbDrawTbl, this->skelAnim.dListCount, EnTk_OverrideLimbDraw, EnTk_PostLimbDraw, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_tk.c", 1312); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_tk.c", 1312); } diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index b036a525b0..0b3313ad48 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -553,22 +553,18 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { } void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { - char pad[8]; - MtxF mf; - GraphicsContext* gfxCtx; + s32 pad; f32 xzScale; - Gfx* dispRefs[3]; + MtxF mf; if ((this->actor.floorPoly == NULL) || ((this->timer >= 0x51) && (this->actionFunc != EnWallmas_Stun))) { return; } - // clang-format off - gfxCtx = globalCtx->state.gfxCtx; Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1386); - // clang-format on + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1386); func_80094044(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 0, 0, 0, 255); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 0, 0, 0, 255); func_80038A28(this->actor.floorPoly, this->actor.posRot.pos.x, this->actor.groundY, this->actor.posRot.pos.z, &mf); Matrix_Mult(&mf, MTXMODE_NEW); @@ -581,9 +577,10 @@ void EnWallmas_DrawXlu(EnWallmas* this, GlobalContext* globalCtx) { } Matrix_Scale(xzScale, 1.0f, xzScale, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1421), G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, &D_04049210); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1426); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1421), G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyXlu.p++, &D_04049210); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1426); } s32 EnWallMas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, @@ -602,24 +599,21 @@ s32 EnWallMas_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL } void EnWallMas_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - if (limbIndex == 2) { - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1478); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1478); Matrix_Push(); Matrix_Translate(1600.0f, -700.0f, -1700.0f, MTXMODE_APPLY); Matrix_RotateY(DEGREE_60_RAD, MTXMODE_APPLY); Matrix_RotateZ(DEGREE_15_RAD, MTXMODE_APPLY); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1489), G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06008688); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1489), G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06008688); Matrix_Pull(); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1495); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_wallmas.c", 1495); } } diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index 6f2a0e2e23..8792814d5e 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -134,14 +134,14 @@ void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx) { void EnYukabyun_Draw(Actor* thisx, GlobalContext* globalCtx) { EnYukabyun* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 366); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 366); + func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B43F64[this->unk_152])); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 373), + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_80B43F64[this->unk_152])); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 373), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06000970); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 378); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06000970); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_yukabyun.c", 378); } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index a95ac414c4..877a209fdc 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -609,17 +609,16 @@ void func_80B4C400(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* void EnZl1_Draw(Actor* thisx, GlobalContext* globalCtx) { EnZl1* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_girlB.c", 2011); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_girlB.c", 2011); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(this->unk_1F4)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(this->unk_1F8)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(this->unk_1EC)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(this->unk_1F4)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(this->unk_1F8)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(this->unk_1EC)); func_80093D18(globalCtx->state.gfxCtx); SkelAnime_DrawSV(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, func_80B4C340, func_80B4C400, &this->actor); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_girlB.c", 2046); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_girlB.c", 2046); } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index fe41a23239..5b5488beeb 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -1682,21 +1682,23 @@ void func_80B523C8(EnZl2* this, GlobalContext* globalCtx) { SkelAnime* skelAnime = &this->skelAnime; s16 unk_198 = this->unk_198; u32 sp64 = D_80B52834[unk_198]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad1; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1623); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_zl2.c", 1623); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp74)); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp70)); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp64)); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 0, 255); - gSPSegment(gfxCtx->polyOpa.p++, 0x0B, &D_80116280[2]); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp74)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp70)); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp64)); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 0, 255); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0B, &D_80116280[2]); - gfxCtx->polyOpa.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - EnZl2_OverrideLimbDraw, EnZl2_PostLimbDraw, &this->actor, gfxCtx->polyOpa.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_zl2.c", 1648); + oGfxCtx->polyOpa.p = + SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, + EnZl2_OverrideLimbDraw, EnZl2_PostLimbDraw, &this->actor, oGfxCtx->polyOpa.p); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1648); } void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { @@ -1706,21 +1708,23 @@ void func_80B525D4(EnZl2* this, GlobalContext* globalCtx) { s16 unk_198 = this->unk_198; SkelAnime* skelAnime = &this->skelAnime; u32 sp6C = D_80B52834[unk_198]; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[5]; + s32 pad1; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1663); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_zl2.c", 1663); func_80093D84(globalCtx->state.gfxCtx); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp78)); - gSPSegment(gfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp78)); - gSPSegment(gfxCtx->polyXlu.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp6C)); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 0, 0, this->alpha); - gSPSegment(gfxCtx->polyXlu.p++, 0x0B, &D_80116280[0]); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(sp78)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x09, SEGMENTED_TO_VIRTUAL(sp78)); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0A, SEGMENTED_TO_VIRTUAL(sp6C)); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 0, 0, this->alpha); + gSPSegment(oGfxCtx->polyXlu.p++, 0x0B, &D_80116280[0]); - gfxCtx->polyXlu.p = SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, - EnZl2_OverrideLimbDraw, NULL, &this->actor, gfxCtx->polyXlu.p); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_zl2.c", 1692); + oGfxCtx->polyXlu.p = + SkelAnime_DrawSV2(globalCtx, skelAnime->skeleton, skelAnime->limbDrawTbl, skelAnime->dListCount, + EnZl2_OverrideLimbDraw, NULL, &this->actor, oGfxCtx->polyXlu.p); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_zl2.c", 1692); } void EnZl2_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_End_Title/z_end_title.c b/src/overlays/actors/ovl_End_Title/z_end_title.c index 632a5ddaf7..62990363d9 100644 --- a/src/overlays/actors/ovl_End_Title/z_end_title.c +++ b/src/overlays/actors/ovl_End_Title/z_end_title.c @@ -54,114 +54,102 @@ void EndTitle_Draw(Actor* thisx, GlobalContext* globalCtx) { Player* player = PLAYER; mf = &player->mf_9E0; - // Draws the Triforce on Link's left hand - { + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 403); - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_end_title.c", 403); - func_80093D84(globalCtx->state.gfxCtx); - Matrix_Mult(mf, MTXMODE_NEW); - Matrix_Translate(0.0f, 150.0f, 170.0f, MTXMODE_APPLY); - Matrix_Scale(0.13f, 0.13f, 0.13f, MTXMODE_APPLY); - Matrix_RotateX(0.287621408700943f, MTXMODE_APPLY); - Matrix_RotateY(0.0f, MTXMODE_APPLY); - Matrix_RotateZ(0.0f, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_end_title.c", 412), G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyXlu.p++, sTriforceDList); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_end_title.c", 417); - } + // Draw the Triforce on Link's left hand + func_80093D84(globalCtx->state.gfxCtx); + Matrix_Mult(mf, MTXMODE_NEW); + Matrix_Translate(0.0f, 150.0f, 170.0f, MTXMODE_APPLY); + Matrix_Scale(0.13f, 0.13f, 0.13f, MTXMODE_APPLY); + Matrix_RotateX(0.287621408700943f, MTXMODE_APPLY); + Matrix_RotateY(0.0f, MTXMODE_APPLY); + Matrix_RotateZ(0.0f, MTXMODE_APPLY); + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_end_title.c", 412), G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTriforceDList); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 417); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 419); // Draw title cards on the screen - { - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_end_title.c", 419); - - if ((frameCount >= 891) && (this->endAlpha < 200)) { - this->endAlpha += 7; - } - if ((frameCount >= 811) && (this->tlozAlpha < 200)) { - this->tlozAlpha += 15; - } - if ((frameCount >= 851) && (this->ootAlpha < 200)) { - this->ootAlpha += 15; - } - gfxCtx->overlay.p = func_80093F34(gfxCtx->overlay.p); - gDPSetTextureLUT(gfxCtx->overlay.p++, G_TT_NONE); - gDPSetEnvColor(gfxCtx->overlay.p++, 255, 120, 30, 0); - gDPSetRenderMode(gfxCtx->overlay.p++, G_RM_PASS, G_RM_XLU_SURF2); - gSPClearGeometryMode(gfxCtx->overlay.p++, G_TEXTURE_ENABLE | G_CULL_BACK | G_FOG | G_LIGHTING | G_TEXTURE_GEN | - G_TEXTURE_GEN_LINEAR); - gDPSetCombineLERP(gfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, 0, - 0, 0, COMBINED, 0, 0, 0, COMBINED); - gDPSetPrimColor(gfxCtx->overlay.p++, 0x00, 0x80, 0, 0, 0, this->endAlpha); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 80, D_80B670E0); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 11, 0x0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadTile(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, (80 << 2), (24 << 2)); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 11, 0x0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, (80 << 2), (24 << 2)); - gSPTextureRectangle(gfxCtx->overlay.p++, (120 << 2), (90 << 2), (200 << 2), (113 << 2), G_TX_RENDERTILE, 0, 0, - (32 << 5), (32 << 5)); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0x00, 0x80, 0, 0, 0, this->tlozAlpha); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 120, D_80B65EA0); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 0x0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadTile(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, (120 << 2), (24 << 2)); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 0x0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, (120 << 2), (24 << 2)); - gSPTextureRectangle(gfxCtx->overlay.p++, (100 << 2), (160 << 2), (220 << 2), (183 << 2), G_TX_RENDERTILE, 0, 0, - (32 << 5), (32 << 5)); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetPrimColor(gfxCtx->overlay.p++, 0x00, 0x80, 0, 0, 0, this->ootAlpha); - gDPSetTextureImage(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 112, D_80B669E0); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 15, 0x0, G_TX_LOADTILE, 0, - G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); - gDPLoadSync(gfxCtx->overlay.p++); - gDPLoadTile(gfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, (112 << 2), (16 << 2)); - gDPPipeSync(gfxCtx->overlay.p++); - gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 15, 0x0, G_TX_RENDERTILE, 0, - G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); - gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, (112 << 2), (16 << 2)); - gSPTextureRectangle(gfxCtx->overlay.p++, (104 << 2), (177 << 2), (216 << 2), (192 << 2), G_TX_RENDERTILE, 0, 0, - (32 << 5), (32 << 5)); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_end_title.c", 515); + if ((frameCount >= 891) && (this->endAlpha < 200)) { + this->endAlpha += 7; } + if ((frameCount >= 811) && (this->tlozAlpha < 200)) { + this->tlozAlpha += 15; + } + if ((frameCount >= 851) && (this->ootAlpha < 200)) { + this->ootAlpha += 15; + } + + oGfxCtx->overlay.p = func_80093F34(oGfxCtx->overlay.p); + gDPSetTextureLUT(oGfxCtx->overlay.p++, G_TT_NONE); + gDPSetEnvColor(oGfxCtx->overlay.p++, 255, 120, 30, 0); + gDPSetRenderMode(oGfxCtx->overlay.p++, G_RM_PASS, G_RM_XLU_SURF2); + gSPClearGeometryMode(oGfxCtx->overlay.p++, + G_TEXTURE_ENABLE | G_CULL_BACK | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR); + gDPSetCombineLERP(oGfxCtx->overlay.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, 0, 0, + 0, COMBINED, 0, 0, 0, COMBINED); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0x00, 0x80, 0, 0, 0, this->endAlpha); + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 80, D_80B670E0); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 11, 0x0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, + 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadTile(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, (80 << 2), (24 << 2)); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 11, 0x0, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, (80 << 2), (24 << 2)); + gSPTextureRectangle(oGfxCtx->overlay.p++, (120 << 2), (90 << 2), (200 << 2), (113 << 2), G_TX_RENDERTILE, 0, 0, + (32 << 5), (32 << 5)); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0x00, 0x80, 0, 0, 0, this->tlozAlpha); + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 120, D_80B65EA0); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 0x0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, + 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadTile(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, (120 << 2), (24 << 2)); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 16, 0x0, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, (120 << 2), (24 << 2)); + gSPTextureRectangle(oGfxCtx->overlay.p++, (100 << 2), (160 << 2), (220 << 2), (183 << 2), G_TX_RENDERTILE, 0, 0, + (32 << 5), (32 << 5)); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0x00, 0x80, 0, 0, 0, this->ootAlpha); + gDPSetTextureImage(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 112, D_80B669E0); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 15, 0x0, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, + 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); + gDPLoadSync(oGfxCtx->overlay.p++); + gDPLoadTile(oGfxCtx->overlay.p++, G_TX_LOADTILE, 0, 0, (112 << 2), (16 << 2)); + gDPPipeSync(oGfxCtx->overlay.p++); + gDPSetTile(oGfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_8b, 15, 0x0, G_TX_RENDERTILE, 0, + G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0, G_TX_NOMIRROR | G_TX_NOMIRROR, 0, 0); + gDPSetTileSize(oGfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, (112 << 2), (16 << 2)); + gSPTextureRectangle(oGfxCtx->overlay.p++, (104 << 2), (177 << 2), (216 << 2), (192 << 2), G_TX_RENDERTILE, 0, 0, + (32 << 5), (32 << 5)); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 515); } -/* - This function is never executed in normal gameplay because actor params are never set to 1 - Produces the same results as the main draw function, except without the title cards on the - end screen -*/ +/** + * This function is never executed in normal gameplay because actor params are never set to 1 + * Produces the same results as the main draw function, except without the title cards on the end screen + */ void func_80B65DA8(Actor* thisx, GlobalContext* globalCtx) { EndTitle* this = THIS; s32 pad; - s32 frames; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + s32 frames = globalCtx->csCtx.frames; - frames = globalCtx->csCtx.frames; if ((frames >= 1101) && (this->endAlpha < 255)) { this->endAlpha += 3; } - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_end_title.c", 594); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 594); - gfxCtx->overlay.p = func_80093F34(gfxCtx->overlay.p); + oGfxCtx->overlay.p = func_80093F34(oGfxCtx->overlay.p); + gDPSetPrimColor(oGfxCtx->overlay.p++, 0, 0x80, 0, 0, 0, this->endAlpha); + gSPDisplayList(oGfxCtx->overlay.p++, dList_80B69720); - gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0x80, 0, 0, 0, this->endAlpha); - gSPDisplayList(gfxCtx->overlay.p++, dList_80B69720); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_end_title.c", 600); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_end_title.c", 600); } diff --git a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c index 1925630457..2c8f807c80 100644 --- a/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c +++ b/src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.c @@ -83,10 +83,8 @@ void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { ItemBHeart* this = THIS; Actor* actorIt; u8 flag = 0; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_item_b_heart.c", 506); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 506); actorIt = globalCtx->actorCtx.actorList[ACTORTYPE_ITEMACTION].first; @@ -101,17 +99,17 @@ void ItemBHeart_Draw(Actor* thisx, GlobalContext* globalCtx) { if (flag) { func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 551), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 551), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06001290); - gSPDisplayList(gfxCtx->polyXlu.p++, D_06001470); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06001290); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_06001470); } else { func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 557), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 557), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06001290); - gSPDisplayList(gfxCtx->polyOpa.p++, D_06001470); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001290); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_06001470); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_item_b_heart.c", 561); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_item_b_heart.c", 561); } diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index 473ea95db4..256568bb2e 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -226,39 +226,39 @@ void MagicWind_Update(Actor* thisx, GlobalContext* globalCtx) { s32 MagicWind_OverrideLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, Actor* thisx) { MagicWind* this = THIS; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_magic_wind.c", 615); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_magic_wind.c", 615); + if (limbIndex == 1) { - gSPSegment(gfxCtx->polyXlu.p++, 8, + gSPSegment(oGfxCtx->polyXlu.p++, 8, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 9) & 0xFF, 0xFF - ((globalCtx->state.frames * 0xF) & 0xFF), 0x40, 0x40, 1, (globalCtx->state.frames * 0xF) & 0xFF, 0xFF - ((globalCtx->state.frames * 0x1E) & 0xFF), 0x40, 0x40)); } else if (limbIndex == 2) { - gSPSegment(gfxCtx->polyXlu.p++, 9, + gSPSegment(oGfxCtx->polyXlu.p++, 9, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, (globalCtx->state.frames * 3) & 0xFF, 0xFF - ((globalCtx->state.frames * 5) & 0xFF), 0x40, 0x40, 1, (globalCtx->state.frames * 6) & 0xFF, 0xFF - ((globalCtx->state.frames * 0xA) & 0xFF), 0x40, 0x40)); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_magic_wind.c", 646); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_magic_wind.c", 646); + return 1; } void MagicWind_Draw(Actor* thisx, GlobalContext* globalCtx) { - s32 pad; - MagicWind* this = THIS; GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + MagicWind* this = THIS; + + OPEN_DISPS(gfxCtx, "../z_magic_wind.c", 661); - Graph_OpenDisps(dispRefs, gfxCtx, "../z_magic_wind.c", 661); if (this->actionFunc != MagicWind_WaitForTimer) { - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 25); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 25); SkelCurve_Draw(thisx, globalCtx, &this->skelCurve, MagicWind_OverrideLimbDraw, NULL, 1, NULL); } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_magic_wind.c", 673); + + CLOSE_DISPS(gfxCtx, "../z_magic_wind.c", 673); } diff --git a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index 1dd68ea38f..65288d6943 100644 --- a/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -186,12 +186,9 @@ void ObjComb_Update(Actor* thisx, GlobalContext* globalCtx) { void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { ObjComb* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_comb.c", 369); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_obj_comb.c", 369); func_80093D18(globalCtx->state.gfxCtx); Matrix_Translate(this->actor.posRot.pos.x, this->actor.posRot.pos.y + (118.0f * this->actor.scale.y), @@ -202,11 +199,12 @@ void ObjComb_Draw(Actor* thisx, GlobalContext* globalCtx) { Matrix_Translate(0, -(this->actor.scale.y * 118.0f), 0, 1); Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, 1); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_comb.c", 394), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_comb.c", 394), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_050095B0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_050095B0); func_800628A4(0, &this->collider); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_obj_comb.c", 402); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_comb.c", 402); } diff --git a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index 465227206c..9cde524913 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -146,23 +146,23 @@ void ObjDekujr_Update(Actor* thisx, GlobalContext* globalCtx) { void ObjDekujr_Draw(Actor* thisx, GlobalContext* globalCtx) { u32 frameCount; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 370); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 370); + func_80093D18(globalCtx->state.gfxCtx); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 379), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 379), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyOpa.p++, D_060030D0); + gSPDisplayList(oGfxCtx->polyOpa.p++, D_060030D0); frameCount = globalCtx->state.frames; gSPSegment( - gfxCtx->polyXlu.p++, 0x08, + oGfxCtx->polyXlu.p++, 0x08, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frameCount % 128, 0, 32, 32, 1, frameCount % 128, 0, 32, 32)); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 399), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 399), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_060032D8); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 409); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_060032D8); + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_dekujr.c", 409); } diff --git a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index 9a4f7c39bd..ac6411614f 100644 --- a/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -149,13 +149,11 @@ void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx) { Color_RGB8* color; Color_RGB8 defaultColor; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 365); - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 365); func_80093D18(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 369), + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 369), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (globalCtx->sceneNum == SCENE_HIDAN) { @@ -167,8 +165,8 @@ void ObjHsblock_Draw(Actor* thisx, GlobalContext* globalCtx) { color = &defaultColor; } - gDPSetEnvColor(gfxCtx->polyOpa.p++, color->r, color->g, color->b, 255); - gSPDisplayList(gfxCtx->polyOpa.p++, sDLists[thisx->params & 3]); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, color->r, color->g, color->b, 255); + gSPDisplayList(oGfxCtx->polyOpa.p++, sDLists[thisx->params & 3]); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 399); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_obj_hsblock.c", 399); } diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index 32b6c03250..d3f1ccce29 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -149,21 +149,18 @@ void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { void OceffSpot_Draw(Actor* thisx, GlobalContext* globalCtx) { OceffSpot* this = THIS; - u32 scroll; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + u32 scroll = globalCtx->state.frames & 0xFFFF; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_spot.c", 466); - scroll = globalCtx->state.frames & 0xFFFF; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_spot.c", 466); func_80093D84(globalCtx->state.gfxCtx); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_spot.c", 469), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_spot.c", 469), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 32, - 1, 0, scroll * (-8), 32, 32)); - gSPDisplayList(gfxCtx->polyXlu.p++, sCylinderDl); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 32, + 1, 0, scroll * (-8), 32, 32)); + gSPDisplayList(oGfxCtx->polyXlu.p++, sCylinderDl); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_spot.c", 485); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_spot.c", 485); } diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index 43b98c7850..f9b5cd2a66 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -125,61 +125,54 @@ void OceffStorm_Update(Actor* thisx, GlobalContext* globalCtx) { } void OceffStorm_Draw2(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll; + u32 scroll = globalCtx->state.frames & 0xFFF; OceffStorm* this = THIS; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - scroll = globalCtx->state.frames & 0xFFF; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_storm.c", 449); - gDPPipeSync(gfxCtx->polyXlu.p++); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 449); + + gDPPipeSync(oGfxCtx->polyXlu.p++); + if (1) {} - gfxCtx->polyXlu.p = func_80093F34(gfxCtx->polyXlu.p); - gDPSetAlphaDither(gfxCtx->polyXlu.p++, G_AD_NOISE); - gDPSetColorDither(gfxCtx->polyXlu.p++, G_CD_NOISE); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 200, 200, 150, this->primColorAlpha); - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 8, scroll * 4, 64, 64, 1, - scroll * 4, scroll * 4, 64, 64)); - gSPTextureRectangle(gfxCtx->polyXlu.p++, 0, 0, (SCREEN_WIDTH << 2), (SCREEN_HEIGHT << 2), G_TX_RENDERTILE, 0, 0, + + oGfxCtx->polyXlu.p = func_80093F34(oGfxCtx->polyXlu.p); + gDPSetAlphaDither(oGfxCtx->polyXlu.p++, G_AD_NOISE); + gDPSetColorDither(oGfxCtx->polyXlu.p++, G_CD_NOISE); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 200, 200, 150, this->primColorAlpha); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 8, scroll * 4, 64, 64, 1, + scroll * 4, scroll * 4, 64, 64)); + gSPTextureRectangle(oGfxCtx->polyXlu.p++, 0, 0, (SCREEN_WIDTH << 2), (SCREEN_HEIGHT << 2), G_TX_RENDERTILE, 0, 0, 140, (1 << 15) | (31 << 10) | 884); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_storm.c", 477); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 477); } void OceffStorm_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll; - OceffStorm* this; - GraphicsContext* gfxCtx; - Vtx* vtxPtr; - Gfx* dispRefs[4]; + u32 scroll = globalCtx->state.frames & 0xFFF; + OceffStorm* this = THIS; + Vtx* vtxPtr = vertices; - this = THIS; - vtxPtr = vertices; - scroll = globalCtx->state.frames & 0xFFF; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_storm.c", 486); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 486); func_80093D84(globalCtx->state.gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0x80, 0x80, 255, 255, 200, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 150, 150, 0, 128); - gDPSetAlphaDither(gfxCtx->polyXlu.p++, G_AD_NOISE); - gDPSetColorDither(gfxCtx->polyXlu.p++, G_CD_NOISE); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0x80, 0x80, 255, 255, 200, 255); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 150, 150, 0, 128); + gDPSetAlphaDither(oGfxCtx->polyXlu.p++, G_AD_NOISE); + gDPSetColorDither(oGfxCtx->polyXlu.p++, G_CD_NOISE); vtxPtr[0].v.cn[3] = vtxPtr[6].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[25].v.cn[3] = this->vtxAlpha >> 1; vtxPtr[10].v.cn[3] = vtxPtr[22].v.cn[3] = this->vtxAlpha; - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 498), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 498), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, sCylinderTexDl); - gSPDisplayList(gfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 4, (0 - scroll) * 8, 32, - 32, 1, scroll * 8, (0 - scroll) * 12, 32, 32)); - gSPDisplayList(gfxCtx->polyXlu.p++, sCylinderDl); + gSPDisplayList(oGfxCtx->polyXlu.p++, sCylinderTexDl); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 4, (0 - scroll) * 8, 32, + 32, 1, scroll * 8, (0 - scroll) * 12, 32, 32)); + gSPDisplayList(oGfxCtx->polyXlu.p++, sCylinderDl); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_storm.c", 512); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_storm.c", 512); OceffStorm_Draw2(&this->actor, globalCtx); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 61c7bd7d95..26fa5b95de 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -64,23 +64,21 @@ void OceffWipe_Update(Actor* thisx, GlobalContext* globalCtx) { } void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll; + u32 scroll = globalCtx->state.frames & 0xFF; OceffWipe* this = THIS; f32 z; - GraphicsContext* gfxCtx; + s32 pad; u8 alphaTable[3]; s32 i; Vec3f eye; Vtx(*vtxPtr)[2]; Vec3f vec; - Gfx* dispRefs[5]; - - scroll = globalCtx->state.frames & 0xFF; eye = ACTIVE_CAM->eye; func_8005AFB4(&vec, ACTIVE_CAM); - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 346); + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 346); + if (this->counter < 32) { z = Math_Sins(this->counter << 9) * 1400; } else { @@ -110,21 +108,21 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { func_800D1FD4(&globalCtx->mf_11DA0); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 375), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 375), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params) { - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 170, 255, 255, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 0, 150, 255, 128); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 170, 255, 255, 255); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 0, 150, 255, 128); } else { - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 200, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 100, 0, 255, 128); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 200, 255); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 100, 0, 255, 128); } - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 - scroll, scroll * (-2), 32, 32, - 1, 0 - scroll, scroll * (-2), 32, 32)); - gSPDisplayList(gfxCtx->polyXlu.p++, sFrustrumDl); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0 - scroll, scroll * (-2), 32, 32, + 1, 0 - scroll, scroll * (-2), 32, 32)); + gSPDisplayList(oGfxCtx->polyXlu.p++, sFrustrumDl); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 398); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 398); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 7b5d4d52e0..a39642bbe0 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -59,18 +59,14 @@ void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx) { } void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { - u32 scroll; - OceffWipe2* this; + u32 scroll = globalCtx->state.frames & 0xFF; + OceffWipe2* this = THIS; f32 z; - GraphicsContext* gfxCtx; u8 alpha; - u32 pad1; + s32 pad[2]; Vec3f eye; Vtx* vtxPtr; Vec3f vec; - Gfx* dispRefs[5]; - this = THIS; - scroll = globalCtx->state.frames & 0xFF; eye = ACTIVE_CAM->eye; func_8005AFB4(&vec, ACTIVE_CAM); @@ -91,8 +87,7 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[16].v.cn[3] = vtxPtr[18].v.cn[3] = vtxPtr[20].v.cn[3] = alpha; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 390); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 390); func_80093D84(globalCtx->state.gfxCtx); @@ -101,15 +96,15 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { func_800D1FD4(&globalCtx->mf_11DA0); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 400), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 400), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 170, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 255, 100, 0, 128); - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 6, scroll * (-6), 64, 64, - 1, scroll * (-6), 0, 64, 64)); - gSPDisplayList(gfxCtx->polyXlu.p++, sFrustrumDl); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 170, 255); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 255, 100, 0, 128); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 6, scroll * (-6), 64, 64, + 1, scroll * (-6), 0, 64, 64)); + gSPDisplayList(oGfxCtx->polyXlu.p++, sFrustrumDl); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 417); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe2.c", 417); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index c7b4127a96..4757518c9f 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -60,19 +60,14 @@ void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx) { } void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { - - u32 scroll; - OceffWipe3* this; + u32 scroll = globalCtx->state.frames & 0xFFF; + OceffWipe3* this = THIS; f32 z; - GraphicsContext* gfxCtx; u8 alpha; - u32 pad1; + s32 pad[2]; Vec3f eye; Vtx* vtxPtr; Vec3f vec; - Gfx* dispRefs[5]; - this = THIS; - scroll = globalCtx->state.frames & 0xFFF; eye = ACTIVE_CAM->eye; func_8005AFB4(&vec, ACTIVE_CAM); @@ -93,8 +88,7 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[17].v.cn[3] = vtxPtr[19].v.cn[3] = vtxPtr[21].v.cn[3] = alpha; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 343); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 343); func_80093D84(globalCtx->state.gfxCtx); @@ -103,15 +97,15 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { func_800D1FD4(&globalCtx->mf_11DA0); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 353), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 353), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, 255, 255, 170, 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, 100, 200, 0, 128); - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL); - gSPDisplayList(gfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 12, scroll * (-12), 64, - 64, 1, scroll * 8, scroll * (-8), 64, 64)); - gSPDisplayList(gfxCtx->polyXlu.p++, sFrustrumDl); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, 255, 255, 170, 255); + gDPSetEnvColor(oGfxCtx->polyXlu.p++, 100, 200, 0, 128); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 12, scroll * (-12), 64, + 64, 1, scroll * 8, scroll * (-8), 64, 64)); + gSPDisplayList(oGfxCtx->polyXlu.p++, sFrustrumDl); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 370); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe3.c", 370); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 726fb7b706..e45621deea 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -54,19 +54,14 @@ void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx) { } void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { - - u32 scroll; - OceffWipe4* this; + u32 scroll = globalCtx->state.frames & 0xFFF; + OceffWipe4* this = THIS; f32 z; - GraphicsContext* gfxCtx; u8 alpha; - u32 pad1; + s32 pad[2]; Vec3f eye; Vtx* vtxPtr; Vec3f vec; - Gfx* dispRefs[5]; - this = THIS; - scroll = globalCtx->state.frames & 0xFFF; eye = ACTIVE_CAM->eye; func_8005AFB4(&vec, ACTIVE_CAM); @@ -87,8 +82,7 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { vtxPtr[11].v.cn[3] = vtxPtr[13].v.cn[3] = vtxPtr[15].v.cn[3] = vtxPtr[17].v.cn[3] = vtxPtr[19].v.cn[3] = vtxPtr[21].v.cn[3] = alpha; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 314); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 314); func_80093D84(globalCtx->state.gfxCtx); @@ -97,19 +91,19 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { func_800D1FD4(&globalCtx->mf_11DA0); Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 324), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 324), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (this->actor.params == 1) { - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL1); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL1); } else { - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL0); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL0); } - gSPDisplayList(gfxCtx->polyXlu.p++, sTextureDL2); - gSPDisplayList(gfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, - 1, scroll * (-1), scroll, 32, 32)); - gSPDisplayList(gfxCtx->polyXlu.p++, sFrustrumDl); + gSPDisplayList(oGfxCtx->polyXlu.p++, sTextureDL2); + gSPDisplayList(oGfxCtx->polyXlu.p++, Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, scroll * 2, scroll * (-2), 32, 64, + 1, scroll * (-1), scroll, 32, 32)); + gSPDisplayList(oGfxCtx->polyXlu.p++, sFrustrumDl); - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 344); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe4.c", 344); } diff --git a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c index aeb64b782c..f5d105f823 100644 --- a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -44,21 +44,19 @@ void KaleidoScope_Draw(GlobalContext* globalCtx) { Input* input = &globalCtx->state.input[0]; PauseContext* pauseCtx = &globalCtx->pauseCtx; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; - Gfx* dispRefs[4]; - Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3188); + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3188); pauseCtx->inputX = input->rel.in.x; pauseCtx->inputY = input->rel.in.y; - gSPSegment(gfxCtx->polyOpa.p++, 0x02, interfaceCtx->parameterSegment); - gSPSegment(gfxCtx->polyOpa.p++, 0x07, pauseCtx->unk_13C); - gSPSegment(gfxCtx->polyOpa.p++, 0x08, pauseCtx->unk_128); - gSPSegment(gfxCtx->polyOpa.p++, 0x09, pauseCtx->unk_12C); - gSPSegment(gfxCtx->polyOpa.p++, 0x0A, pauseCtx->unk_138); - gSPSegment(gfxCtx->polyOpa.p++, 0x0C, pauseCtx->unk_130); - gSPSegment(gfxCtx->polyOpa.p++, 0x0D, pauseCtx->unk_134); + gSPSegment(oGfxCtx->polyOpa.p++, 0x02, interfaceCtx->parameterSegment); + gSPSegment(oGfxCtx->polyOpa.p++, 0x07, pauseCtx->unk_13C); + gSPSegment(oGfxCtx->polyOpa.p++, 0x08, pauseCtx->unk_128); + gSPSegment(oGfxCtx->polyOpa.p++, 0x09, pauseCtx->unk_12C); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0A, pauseCtx->unk_138); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0C, pauseCtx->unk_130); + gSPSegment(oGfxCtx->polyOpa.p++, 0x0D, pauseCtx->unk_134); if (pauseCtx->flag == 0) { func_80823994(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); @@ -67,7 +65,7 @@ void KaleidoScope_Draw(GlobalContext* globalCtx) { func_80820434(globalCtx, globalCtx->state.gfxCtx); func_800949A8(globalCtx->state.gfxCtx); - gDPSetCombineLERP(gfxCtx->polyOpa.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + gDPSetCombineLERP(oGfxCtx->polyOpa.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); func_80823994(pauseCtx, 0.0f, 0.0f, 64.0f); @@ -82,7 +80,7 @@ void KaleidoScope_Draw(GlobalContext* globalCtx) { func_808161AC(globalCtx); } - Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3254); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 3254); } #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_kaleido_scope/func_8082650C.s") diff --git a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c index cbb4a5c42b..8175c1208b 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c +++ b/src/overlays/effects/ovl_Effect_Ss_Blast/z_eff_ss_blast.c @@ -59,30 +59,27 @@ u32 EffectSsBlast_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void } void EffectSsBlast_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; MtxF mtx; - s32 pad1; + s32 pad; f32 scale; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_blast.c", 170); + OPEN_DISPS(gfxCtx, "../z_eff_ss_blast.c", 170); scale = this->regs[SS_BLAST_RADIUS] * 0.0025f; func_80093D84(globalCtx->state.gfxCtx); - gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_BLAST_PRIM_R], this->regs[SS_BLAST_PRIM_G], + gDPSetEnvColor(oGfxCtx->polyXlu.p++, this->regs[SS_BLAST_PRIM_R], this->regs[SS_BLAST_PRIM_G], this->regs[SS_BLAST_PRIM_B], this->regs[SS_BLAST_PRIM_A]); func_800BFCB8(globalCtx, &mtx, &this->pos); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BLAST_ENV_R], this->regs[SS_BLAST_ENV_G], + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BLAST_ENV_R], this->regs[SS_BLAST_ENV_G], this->regs[SS_BLAST_ENV_B], this->regs[SS_BLAST_ENV_A]); Matrix_Put(&mtx); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_blast.c", 199), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(gfxCtx, "../z_eff_ss_blast.c", 199), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList); - Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_blast.c", 204); + gSPDisplayList(oGfxCtx->polyXlu.p++, this->displayList); + CLOSE_DISPS(gfxCtx, "../z_eff_ss_blast.c", 204); } void EffectSsBlast_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c index 0f8c21c689..84245841f9 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb/z_eff_ss_bomb.c @@ -46,22 +46,19 @@ u32 EffectSsBomb_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* } void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; MtxF sp12C; MtxF spEC; MtxF spAC; MtxF sp6C; Mtx* mtx; - s32 pad2; + s32 pad; f32 scale; s16 color; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; if (1) {} - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb.c", 168); + OPEN_DISPS(gfxCtx, "../z_eff_ss_bomb.c", 168); scale = this->regs[SS_BOMB_SCALE] / 100.0f; @@ -70,23 +67,23 @@ void EffectSsBomb_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { SkinMatrix_MtxFMtxFMult(&sp12C, &globalCtx->mf_11DA0, &sp6C); SkinMatrix_MtxFMtxFMult(&sp6C, &spEC, &spAC); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &spAC); if (mtx != NULL) { - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099F588[this->regs[SS_BOMB_TEX_IDX]])); - gDPPipeSync(gfxCtx->polyXlu.p++); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099F588[this->regs[SS_BOMB_TEX_IDX]])); + gDPPipeSync(oGfxCtx->polyXlu.p++); func_80094C50(gfxCtx); color = this->life * 12.75f; - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, color, color, color, color); - gDPPipeSync(gfxCtx->polyXlu.p++); - gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList); - gDPPipeSync(gfxCtx->polyXlu.p++); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, color, color, color, color); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gSPDisplayList(oGfxCtx->polyXlu.p++, this->displayList); + gDPPipeSync(oGfxCtx->polyXlu.p++); } - Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb.c", 214); + CLOSE_DISPS(gfxCtx, "../z_eff_ss_bomb.c", 214); } void EffectSsBomb_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c index 4e509d7709..a1ce614ec3 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c +++ b/src/overlays/effects/ovl_Effect_Ss_Bomb2/z_eff_ss_bomb2.c @@ -72,19 +72,16 @@ u32 EffectSsBomb2_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void // unused in the original game. looks like EffectSsBomb but with color void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) { - s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; MtxF sp11C; MtxF spDC; MtxF sp9C; MtxF sp5C; Mtx* mtx; - s32 pad2; + s32 pad; f32 scale; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 298); + OPEN_DISPS(gfxCtx, "../z_eff_ss_bomb2.c", 298); scale = this->regs[SS_BOMB2_SCALE] * 0.01f; SkinMatrix_SetTranslate(&sp11C, this->pos.x, this->pos.y, this->pos.z); @@ -95,23 +92,23 @@ void EffectSsBomb2_DrawFade(GlobalContext* globalCtx, u32 index, EffectSs* this) mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp9C); if (mtx != NULL) { - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_80094BC4(gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BOMB2_PRIM_R], this->regs[SS_BOMB2_PRIM_G], + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BOMB2_PRIM_R], this->regs[SS_BOMB2_PRIM_G], this->regs[SS_BOMB2_PRIM_B], this->regs[SS_BOMB2_PRIM_A]); - gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_BOMB2_ENV_R], this->regs[SS_BOMB2_ENV_G], + gDPSetEnvColor(oGfxCtx->polyXlu.p++, this->regs[SS_BOMB2_ENV_R], this->regs[SS_BOMB2_ENV_G], this->regs[SS_BOMB2_ENV_B], 0); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099FEE0[this->regs[SS_BOMB2_TEX_IDX]])); - gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099FEE0[this->regs[SS_BOMB2_TEX_IDX]])); + gSPDisplayList(oGfxCtx->polyXlu.p++, this->displayList); if (1) {} if (1) {} } - Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 345); + CLOSE_DISPS(gfxCtx, "../z_eff_ss_bomb2.c", 345); } void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* this) { - s32 pad1; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; MtxF sp1B4; MtxF sp174; MtxF sp134; @@ -119,18 +116,13 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th MtxF spB4; Mtx* mtx2; Mtx* mtx; - s32 pad; - s32 pad2; - s32 pad3; + s32 pad[3]; f32 scale; f32 temp_f24; f32 mtxScale = 0.925f; s32 i; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 386); + OPEN_DISPS(gfxCtx, "../z_eff_ss_bomb2.c", 386); temp_f24 = this->regs[SS_BOMB2_A]; scale = this->regs[SS_BOMB2_SCALE] * 0.01f; @@ -141,18 +133,18 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp134); if (mtx != NULL) { - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx2 = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp134); if (mtx2 != NULL) { func_80094BC4(gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BOMB2_PRIM_R], this->regs[SS_BOMB2_PRIM_G], + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, this->regs[SS_BOMB2_PRIM_R], this->regs[SS_BOMB2_PRIM_G], this->regs[SS_BOMB2_PRIM_B], this->regs[SS_BOMB2_PRIM_A]); - gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_BOMB2_ENV_R], this->regs[SS_BOMB2_ENV_G], + gDPSetEnvColor(oGfxCtx->polyXlu.p++, this->regs[SS_BOMB2_ENV_R], this->regs[SS_BOMB2_ENV_G], this->regs[SS_BOMB2_ENV_B], 0); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099FF00[this->regs[SS_BOMB2_TEX_IDX]])); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0400BFE8); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0400C040); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_8099FF00[this->regs[SS_BOMB2_TEX_IDX]])); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0400BFE8); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0400C040); Matrix_MtxToMtxF(mtx2, &spB4); Matrix_Put(&spB4); @@ -160,9 +152,9 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th Matrix_Translate(0.0f, 0.0f, temp_f24, MTXMODE_APPLY); Matrix_RotateZ((this->life * 0.02f) + 180.0f, MTXMODE_APPLY); Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_bomb2.c", 448), + gSPMatrix(oGfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_eff_ss_bomb2.c", 448), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(gfxCtx->polyXlu.p++, D_0400C040); + gSPDisplayList(oGfxCtx->polyXlu.p++, D_0400C040); mtxScale -= 0.15f; } } @@ -170,7 +162,7 @@ void EffectSsBomb2_DrawLayered(GlobalContext* globalCtx, u32 index, EffectSs* th if (1) {} if (1) {} } - Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_bomb2.c", 456); + CLOSE_DISPS(gfxCtx, "../z_eff_ss_bomb2.c", 456); } void EffectSsBomb2_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c index b9c7e604c0..8f8cf06dba 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c +++ b/src/overlays/effects/ovl_Effect_Ss_Dust/z_eff_ss_dust.c @@ -80,19 +80,16 @@ u32 EffectSsDust_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* } void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; MtxF sp144; MtxF sp104; MtxF spC4; MtxF sp84; - s32 pad1; + s32 pad; Mtx* mtx; f32 scale; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_eff_ss_dust.c", 321); + OPEN_DISPS(gfxCtx, "../z_eff_ss_dust.c", 321); scale = this->regs[SS_DUST_SCALE] * 0.0025f; @@ -101,37 +98,37 @@ void EffectSsDust_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { SkinMatrix_MtxFMtxFMult(&sp144, &globalCtx->mf_11DA0, &sp84); SkinMatrix_MtxFMtxFMult(&sp84, &sp104, &spC4); - gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(oGfxCtx->polyXlu.p++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &spC4); if (mtx != NULL) { - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gDPPipeSync(gfxCtx->polyXlu.p++); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809A2A50[this->regs[SS_DUST_TEX_IDX]])); - gfxCtx->polyXlu.p = Gfx_CallSetupDL(gfxCtx->polyXlu.p, 0); - gDPPipeSync(gfxCtx->polyXlu.p++); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPPipeSync(oGfxCtx->polyXlu.p++); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809A2A50[this->regs[SS_DUST_TEX_IDX]])); + oGfxCtx->polyXlu.p = Gfx_CallSetupDL(oGfxCtx->polyXlu.p, 0); + gDPPipeSync(oGfxCtx->polyXlu.p++); if (this->regs[SS_DUST_DRAW_FLAGS] & 1) { - gDPSetCombineLERP(gfxCtx->polyXlu.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, 0, - COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED); - gDPSetRenderMode(gfxCtx->polyXlu.p++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); - gSPSetGeometryMode(gfxCtx->polyXlu.p++, G_FOG | G_LIGHTING); + gDPSetCombineLERP(oGfxCtx->polyXlu.p++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, 0, TEXEL0, + 0, COMBINED, 0, SHADE, 0, 0, 0, 0, COMBINED); + gDPSetRenderMode(oGfxCtx->polyXlu.p++, G_RM_FOG_SHADE_A, G_RM_ZB_CLD_SURF2); + gSPSetGeometryMode(oGfxCtx->polyXlu.p++, G_FOG | G_LIGHTING); } else if (this->regs[SS_DUST_DRAW_FLAGS] & 2) { - gDPSetRenderMode(gfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); - gSPClearGeometryMode(gfxCtx->polyXlu.p++, G_FOG | G_LIGHTING); + gDPSetRenderMode(oGfxCtx->polyXlu.p++, G_RM_PASS, G_RM_ZB_CLD_SURF2); + gSPClearGeometryMode(oGfxCtx->polyXlu.p++, G_FOG | G_LIGHTING); } else { - gSPClearGeometryMode(gfxCtx->polyXlu.p++, G_LIGHTING); + gSPClearGeometryMode(oGfxCtx->polyXlu.p++, G_LIGHTING); } - gDPPipeSync(gfxCtx->polyXlu.p++); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_DUST_PRIM_R], this->regs[SS_DUST_PRIM_G], + gDPPipeSync(oGfxCtx->polyXlu.p++); + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, this->regs[SS_DUST_PRIM_R], this->regs[SS_DUST_PRIM_G], this->regs[SS_DUST_PRIM_B], 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_DUST_ENV_R], this->regs[SS_DUST_ENV_G], + gDPSetEnvColor(oGfxCtx->polyXlu.p++, this->regs[SS_DUST_ENV_R], this->regs[SS_DUST_ENV_G], this->regs[SS_DUST_ENV_B], this->regs[SS_DUST_ENV_A]); - gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList); + gSPDisplayList(oGfxCtx->polyXlu.p++, this->displayList); } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_eff_ss_dust.c", 389); + CLOSE_DISPS(gfxCtx, "../z_eff_ss_dust.c", 389); } void EffectSsDust_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c index 03de4adf79..d3173c3c43 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Spk/z_eff_ss_g_spk.c @@ -78,19 +78,16 @@ u32 EffectSsGSpk_Init(GlobalContext* globalCtx, u32 index, EffectSs* this, void* } void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { - s32 pad; + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; MtxF sp11C; MtxF spDC; MtxF sp9C; MtxF sp5C; Mtx* mtx; f32 scale; - s32 pad1; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + s32 pad; - gfxCtx = globalCtx->state.gfxCtx; - Graph_OpenDisps(&dispRefs, gfxCtx, "../z_eff_ss_g_spk.c", 208); + OPEN_DISPS(gfxCtx, "../z_eff_ss_g_spk.c", 208); scale = this->regs[SS_G_SPK_SCALE] * 0.0025f; @@ -102,20 +99,22 @@ void EffectSsGSpk_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp9C); if (mtx != NULL) { - gSPMatrix(gfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPSegment(gfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809A7498[this->regs[SS_G_SPK_TEX_IDX]])); + gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPSegment(oGfxCtx->polyXlu.p++, 0x08, SEGMENTED_TO_VIRTUAL(D_809A7498[this->regs[SS_G_SPK_TEX_IDX]])); func_80094BC4(gfxCtx); - gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, this->regs[SS_G_SPK_PRIM_R], this->regs[SS_G_SPK_PRIM_G], + gDPSetPrimColor(oGfxCtx->polyXlu.p++, 0, 0, this->regs[SS_G_SPK_PRIM_R], this->regs[SS_G_SPK_PRIM_G], this->regs[SS_G_SPK_PRIM_B], 255); - gDPSetEnvColor(gfxCtx->polyXlu.p++, this->regs[SS_G_SPK_ENV_R], this->regs[SS_G_SPK_ENV_G], + gDPSetEnvColor(oGfxCtx->polyXlu.p++, this->regs[SS_G_SPK_ENV_R], this->regs[SS_G_SPK_ENV_G], this->regs[SS_G_SPK_ENV_B], this->regs[SS_G_SPK_ENV_A]); - gSPDisplayList(gfxCtx->polyXlu.p++, this->displayList); + gSPDisplayList(oGfxCtx->polyXlu.p++, this->displayList); } + if (1) {} if (1) {} - Graph_CloseDisps(&dispRefs, gfxCtx, "../z_eff_ss_g_spk.c", 255); + + CLOSE_DISPS(gfxCtx, "../z_eff_ss_g_spk.c", 255); } void EffectSsGSpk_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index d9e8ff2580..fb9fb1b8ca 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -40,7 +40,7 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) { gSaveContext.unk_13C7 = 1; D_8011FB30 = 0; this->state.running = false; - SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext) + SET_NEXT_GAMESTATE(&this->state, Gameplay_Init, GlobalContext); } static SceneSelectEntry sScenes[] = { @@ -503,68 +503,57 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI } void Select_DrawMenu(SelectContext* this) { - s32 arg; + GraphicsContext* gfxCtx = this->state.gfxCtx; GfxPrint* printer; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = this->state.gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_select.c", 930); + OPEN_DISPS(gfxCtx, "../z_select.c", 930); - gSPSegment(gfxCtx->polyOpa.p++, 0x00, NULL); + gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL); func_80095248(gfxCtx, 0, 0, 0); - SET_FULLSCREEN_VIEWPORT(&this->view) + SET_FULLSCREEN_VIEWPORT(&this->view); func_800AAA50(&this->view, 0xF); func_80094140(gfxCtx); printer = alloca(sizeof(GfxPrint)); GfxPrint_Init(printer); - GfxPrint_Open(printer, gfxCtx->polyOpa.p); + GfxPrint_Open(printer, oGfxCtx->polyOpa.p); Select_PrintMenu(this, printer); - arg = gSaveContext.linkAge; - Select_PrintAgeSetting(this, printer, arg); - arg = gSaveContext.cutsceneIndex; - Select_PrintCutsceneSetting(this, printer, arg); - gfxCtx->polyOpa.p = GfxPrint_Close(printer); + Select_PrintAgeSetting(this, printer, ((void)0, gSaveContext.linkAge)); + Select_PrintCutsceneSetting(this, printer, ((void)0, gSaveContext.cutsceneIndex)); + oGfxCtx->polyOpa.p = GfxPrint_Close(printer); GfxPrint_Destroy(printer); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_select.c", 966); + CLOSE_DISPS(gfxCtx, "../z_select.c", 966); } void Select_DrawLoadingScreen(SelectContext* this) { - s32 pad; + GraphicsContext* gfxCtx = this->state.gfxCtx; GfxPrint* printer; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; - gfxCtx = this->state.gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_select.c", 977); + OPEN_DISPS(gfxCtx, "../z_select.c", 977); - gSPSegment(gfxCtx->polyOpa.p++, 0x00, NULL); + gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL); func_80095248(gfxCtx, 0, 0, 0); - SET_FULLSCREEN_VIEWPORT(&this->view) + SET_FULLSCREEN_VIEWPORT(&this->view); func_800AAA50(&this->view, 0xF); func_80094140(gfxCtx); printer = alloca(sizeof(GfxPrint)); GfxPrint_Init(printer); - GfxPrint_Open(printer, gfxCtx->polyOpa.p); + GfxPrint_Open(printer, oGfxCtx->polyOpa.p); Select_PrintLoadingMessage(this, printer); - gfxCtx->polyOpa.p = GfxPrint_Close(printer); + oGfxCtx->polyOpa.p = GfxPrint_Close(printer); GfxPrint_Destroy(printer); - Graph_CloseDisps(dispRefs, gfxCtx, "../z_select.c", 1006); + CLOSE_DISPS(gfxCtx, "../z_select.c", 1006); } void Select_Draw(SelectContext* this) { - s32 pad; - GraphicsContext* gfxCtx; - Gfx* dispRefs[4]; + GraphicsContext* gfxCtx = this->state.gfxCtx; - gfxCtx = this->state.gfxCtx; - Graph_OpenDisps(dispRefs, gfxCtx, "../z_select.c", 1013); + OPEN_DISPS(gfxCtx, "../z_select.c", 1013); - gSPSegment(gfxCtx->polyOpa.p++, 0x00, NULL); + gSPSegment(oGfxCtx->polyOpa.p++, 0x00, NULL); func_80095248(gfxCtx, 0, 0, 0); - SET_FULLSCREEN_VIEWPORT(&this->view) + SET_FULLSCREEN_VIEWPORT(&this->view); func_800AAA50(&this->view, 0xF); if (!this->state.running) { @@ -573,7 +562,7 @@ void Select_Draw(SelectContext* this) { Select_DrawMenu(this); } - Graph_CloseDisps(dispRefs, gfxCtx, "../z_select.c", 1037); + CLOSE_DISPS(gfxCtx, "../z_select.c", 1037); } void Select_Main(SelectContext* this) { diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 1b5b3f6b10..41cc66f636 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -69,15 +69,13 @@ void Title_Draw(TitleContext* this) { u16 y; u16 idx; - char pad1[0x4]; + s32 pad1; Vec3f v3; Vec3f v1; Vec3f v2; - char pad2[0x8]; - GraphicsContext* gfxCtx = this->state.gfxCtx; - Gfx* dispRefs[4]; + s32 pad2[2]; - Graph_OpenDisps(dispRefs, this->state.gfxCtx, "../z_title.c", 395); + OPEN_DISPS(this->state.gfxCtx, "../z_title.c", 395); v3.x = 69; v3.y = 69; @@ -90,61 +88,62 @@ void Title_Draw(TitleContext* this) { v2.z = 1119.0837; func_8002EABC(&v1, &v2, &v3, this->state.gfxCtx); - gSPSetLights1(gfxCtx->polyOpa.p++, sTitleLights); + gSPSetLights1(oGfxCtx->polyOpa.p++, sTitleLights); Title_SetupView(this, 0, 150.0, 300.0); func_80093D18(this->state.gfxCtx); Matrix_Translate(-53.0, -5.0, 0, MTXMODE_NEW); Matrix_Scale(1.0, 1.0, 1.0, MTXMODE_APPLY); Matrix_RotateRPY(0, sTitleRotY, 0, MTXMODE_APPLY); - gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(this->state.gfxCtx, "../z_title.c", 424), G_MTX_LOAD); - gSPDisplayList(gfxCtx->polyOpa.p++, &D_01002720); + gSPMatrix(oGfxCtx->polyOpa.p++, Matrix_NewMtx(this->state.gfxCtx, "../z_title.c", 424), G_MTX_LOAD); + gSPDisplayList(oGfxCtx->polyOpa.p++, &D_01002720); func_800944C4(this->state.gfxCtx); - gDPPipeSync(gfxCtx->polyOpa.p++); - gDPSetCycleType(gfxCtx->polyOpa.p++, G_CYC_2CYCLE); - gDPSetRenderMode(gfxCtx->polyOpa.p++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP); - gDPSetCombineLERP(gfxCtx->polyOpa.p++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, + gDPPipeSync(oGfxCtx->polyOpa.p++); + gDPSetCycleType(oGfxCtx->polyOpa.p++, G_CYC_2CYCLE); + gDPSetRenderMode(oGfxCtx->polyOpa.p++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP); + gDPSetCombineLERP(oGfxCtx->polyOpa.p++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); - gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0, 170, 255, 255, 255); - gDPSetEnvColor(gfxCtx->polyOpa.p++, 0, 0, 255, 128); + gDPSetPrimColor(oGfxCtx->polyOpa.p++, 0, 0, 170, 255, 255, 255); + gDPSetEnvColor(oGfxCtx->polyOpa.p++, 0, 0, 255, 128); - gDPLoadMultiBlock(gfxCtx->polyOpa.p++, &D_01001800, 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, + gDPLoadMultiBlock(oGfxCtx->polyOpa.p++, &D_01001800, 0x100, 1, G_IM_FMT_I, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 2, 11); for (idx = 0, y = 94; idx < 16; idx++, y += 2) { - gDPLoadTextureBlock(gfxCtx->polyOpa.p++, &D_01000000[0x180 * idx], G_IM_FMT_I, G_IM_SIZ_8b, 192, 2, 0, + gDPLoadTextureBlock(oGfxCtx->polyOpa.p++, &D_01000000[0x180 * idx], G_IM_FMT_I, G_IM_SIZ_8b, 192, 2, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gDPSetTileSize(gfxCtx->polyOpa.p++, 1, this->uls, (this->ult & 0x7F) - idx * 4, 0, 0); - gSPTextureRectangle(gfxCtx->polyOpa.p++, 388, y << 2, 1156, (y + 2) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); + gDPSetTileSize(oGfxCtx->polyOpa.p++, 1, this->uls, (this->ult & 0x7F) - idx * 4, 0, 0); + gSPTextureRectangle(oGfxCtx->polyOpa.p++, 388, y << 2, 1156, (y + 2) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024); } func_8007672C(this->state.gfxCtx, 0, 0, 0, (s16)this->coverAlpha, 2); sTitleRotY += 300; - Graph_CloseDisps(dispRefs, this->state.gfxCtx, "../z_title.c", 483); + CLOSE_DISPS(this->state.gfxCtx, "../z_title.c", 483); } void Title_Main(TitleContext* this) { - GraphicsContext* gfxCtx = this->state.gfxCtx; - Gfx* dispRefs[5]; - s32 pad[2]; - Gfx* gfx; + s32 pad; - Graph_OpenDisps(dispRefs, this->state.gfxCtx, "../z_title.c", 494); + OPEN_DISPS(this->state.gfxCtx, "../z_title.c", 494); - gSPSegment(gfxCtx->polyOpa.p++, 0, NULL); - gSPSegment(gfxCtx->polyOpa.p++, 1, this->staticSegment); + gSPSegment(oGfxCtx->polyOpa.p++, 0, NULL); + gSPSegment(oGfxCtx->polyOpa.p++, 1, this->staticSegment); func_80095248(this->state.gfxCtx, 0, 0, 0); Title_Calc(this); Title_Draw(this); + if (D_8012DBC0) { - gfx = gfxCtx->polyOpa.p; + Gfx* gfx = oGfxCtx->polyOpa.p; + s32 pad; + Title_PrintBuildInfo(&gfx); - gfxCtx->polyOpa.p = gfx; + oGfxCtx->polyOpa.p = gfx; } + if (this->exit) { gSaveContext.seqIndex = 0xFF; gSaveContext.nightSeqIndex = 0xFF; @@ -153,7 +152,7 @@ void Title_Main(TitleContext* this) { SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); } - Graph_CloseDisps(dispRefs, this->state.gfxCtx, "../z_title.c", 541); + CLOSE_DISPS(this->state.gfxCtx, "../z_title.c", 541); } void Title_Destroy(TitleContext* this) { diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index b56a217cc5..baff5c1c1f 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -3,5 +3,6 @@ "gDma.*" = "void" LOG = "void" SET_FULLSCREEN_VIEWPORT = "void" +OPEN_DISPS_INNER = "void" ABS = "int" SQ = "int"