From b8fdb2101ac23625315c86d90a0183fdaa89e14c Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 11 Sep 2024 23:52:18 +1000 Subject: [PATCH] Identify all text functions --- src/game/activemenu.c | 81 +- src/game/bg.c | 4 +- src/game/bondgun.c | 52 +- src/game/bondview.c | 127 +-- src/game/camdraw.c | 6 +- src/game/chraction.c | 8 +- src/game/credits.c | 16 +- src/game/filemgr.c | 40 +- src/game/healthbar.c | 6 +- src/game/hudmsg.c | 97 +- src/game/lv.c | 26 +- src/game/mainmenu.c | 26 +- src/game/menu.c | 164 ++-- src/game/menugfx.c | 30 +- src/game/menuitem.c | 250 ++--- src/game/menutick.c | 6 +- src/game/mplayer/ingame.c | 12 +- src/game/mplayer/mplayer.c | 46 +- src/game/mplayer/scenarios/hackthatmac.inc | 12 +- .../mplayer/scenarios/holdthebriefcase.inc | 12 +- src/game/mplayer/scenarios/kingofthehill.inc | 12 +- src/game/mplayer/scenarios/popacap.inc | 12 +- src/game/mplayer/setup.c | 30 +- src/game/player.c | 20 +- src/game/propobj.c | 4 +- src/game/radar.c | 82 +- src/game/savebuffer.c | 2 +- src/game/sight.c | 98 +- src/game/stars.c | 4 +- src/game/text.c | 906 +++++++++--------- src/game/title.c | 88 +- src/game/training.c | 31 +- src/game/trainingmenus.c | 132 +-- src/include/bss.h | 2 +- src/include/data.h | 6 +- src/include/game/text.h | 40 +- src/include/gbiex.h | 8 +- 37 files changed, 1213 insertions(+), 1285 deletions(-) diff --git a/src/game/activemenu.c b/src/game/activemenu.c index b2584caed..d51c80ce5 100644 --- a/src/game/activemenu.c +++ b/src/game/activemenu.c @@ -187,9 +187,9 @@ MenuItemHandlerResult am_pick_target_menu_list(s32 operation, struct menuitem *i x = renderdata->x + 10; y = renderdata->y + 1; - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, g_MpAllChrConfigPtrs[chrindex]->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, g_MpAllChrConfigPtrs[chrindex]->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_end(gdl); return (s32)gdl; } case MENUOP_GETOPTIONHEIGHT: @@ -834,7 +834,7 @@ void am_calculate_slot_position(s16 column, s16 row, s16 *x, s16 *y) *y = (*y * 7) / 10; } - *x += vi_get_view_left() / g_ScaleX + vi_get_view_width() / (g_ScaleX * 2); + *x += vi_get_view_left() / g_UiScaleX + vi_get_view_width() / (g_UiScaleX * 2); *y += vi_get_view_top() + vi_get_view_height() / 2; if (playercount >= 2) { @@ -890,7 +890,7 @@ void am_calculate_slot_position(s16 column, s16 row, s16 *x, s16 *y) *y = (*y * 3) / 5; } - *x += vi_get_view_left() / g_ScaleX + vi_get_view_width() / (g_ScaleX * 2); + *x += vi_get_view_left() / g_UiScaleX + vi_get_view_width() / (g_UiScaleX * 2); *y += vi_get_view_top() + vi_get_view_height() / 2; if ((playercount == 2 && (options_get_screen_split() == SCREENSPLIT_VERTICAL || IS4MB())) @@ -938,7 +938,7 @@ void am_calculate_slot_position(s16 column, s16 row, s16 *x, s16 *y) *y = (*y * 3) / 5; } - *x += vi_get_view_left() / g_ScaleX + vi_get_view_width() / (g_ScaleX * 2); + *x += vi_get_view_left() / g_UiScaleX + vi_get_view_width() / (g_UiScaleX * 2); *y += vi_get_view_top() + vi_get_view_height() / 2; if ((playercount == 2 && options_get_screen_split() == SCREENSPLIT_VERTICAL) || playercount >= 3) { @@ -962,7 +962,7 @@ Gfx *am_render_text(Gfx *gdl, char *text, u32 colour, s16 left, s16 top) x = left - (textwidth / 2); y = top - 4; - gdl = text_render_projected(gdl, &x, &y, text, g_AmFont1, g_AmFont2, colour, SCREEN_320, SCREEN_240, 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_AmFont1, g_AmFont2, colour, SCREEN_320, SCREEN_240, 0, 0); return gdl; } @@ -1018,8 +1018,8 @@ Gfx *am_render_aibot_info(Gfx *gdl, s32 buddynum) text_measure(&textheight, &textwidth, aibotname, g_AmFont1, g_AmFont2, 0); - x = vi_get_view_left() / g_ScaleX - + (s32)(vi_get_view_width() / g_ScaleX * 0.5f) + x = vi_get_view_left() / g_UiScaleX + + (s32)(vi_get_view_width() / g_UiScaleX * 0.5f) - (s32)(textwidth * 0.5f) + offset; @@ -1031,34 +1031,30 @@ Gfx *am_render_aibot_info(Gfx *gdl, s32 buddynum) #if VERSION >= VERSION_NTSC_1_0 if (wide) { - x = vi_get_view_left() / g_ScaleX + 32; + x = vi_get_view_left() / g_UiScaleX + 32; } #endif -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1, + gdl = text_render_vx(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1, 0x000000ff, SCREEN_320, SCREEN_240, 0, 0); y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f); -#else - gdl = text_render(gdl, &x, &y, aibotname, g_AmFont1, g_AmFont2, -1, - 0x000000ff, SCREEN_320, SCREEN_240, 0, 0); - y += (PLAYERCOUNT() >= 2) ? 0 : (s32)(textheight * 1.1f); +#if VERSION != VERSION_JPN_FINAL text_measure(&textheight, &textwidth, weaponname, g_AmFont1, g_AmFont2, 0); - x = vi_get_view_left() / g_ScaleX - + (s32)(vi_get_view_width() / g_ScaleX * 0.5f) + x = vi_get_view_left() / g_UiScaleX + + (s32)(vi_get_view_width() / g_UiScaleX * 0.5f) - (s32)(textwidth * 0.5f) + offset; #if VERSION >= VERSION_NTSC_1_0 if (wide) { - x = vi_get_view_left() / g_ScaleX + 32; + x = vi_get_view_left() / g_UiScaleX + 32; } #endif - gdl = text_render(gdl, &x, &y, weaponname, g_AmFont1, g_AmFont2, -1, + gdl = text_render_v1(gdl, &x, &y, weaponname, g_AmFont1, g_AmFont2, -1, 0x000000ff, SCREEN_320, SCREEN_240, 0, 0); #endif @@ -1068,8 +1064,8 @@ Gfx *am_render_aibot_info(Gfx *gdl, s32 buddynum) text_measure(&textheight, &textwidth, title, g_AmFont1, g_AmFont2, 0); - x = vi_get_view_left() / g_ScaleX - + (s32)(vi_get_view_width() / g_ScaleX * 0.5f) + x = vi_get_view_left() / g_UiScaleX + + (s32)(vi_get_view_width() / g_UiScaleX * 0.5f) - (s32)(textwidth * 0.5f) + offset; @@ -1081,17 +1077,12 @@ Gfx *am_render_aibot_info(Gfx *gdl, s32 buddynum) #if VERSION >= VERSION_NTSC_1_0 if (wide) { - x = vi_get_view_left() / g_ScaleX + 32; + x = vi_get_view_left() / g_UiScaleX + 32; } #endif -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, title, g_AmFont1, g_AmFont2, -1, + gdl = text_render_vx(gdl, &x, &y, title, g_AmFont1, g_AmFont2, -1, 0x000000ff, SCREEN_320, SCREEN_240, 0, 0); -#else - gdl = text_render(gdl, &x, &y, title, g_AmFont1, g_AmFont2, -1, - 0x000000ff, SCREEN_320, SCREEN_240, 0, 0); -#endif } return gdl; @@ -1168,7 +1159,7 @@ Gfx *am_render_slot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flags) colour = 0x0000006f; } - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); gDPFillRectangleScaled(gdl++, x - g_AmMenus[g_AmIndex].slotwidth / 2 + 1, @@ -1176,7 +1167,7 @@ Gfx *am_render_slot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flags) x + g_AmMenus[g_AmIndex].slotwidth / 2, y + paddingbottom); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Render borders colour = obcol; @@ -1195,7 +1186,7 @@ Gfx *am_render_slot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flags) colour = 0x4f4f4f7f; } - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); // Top border gDPFillRectangleScaled(gdl++, @@ -1225,7 +1216,7 @@ Gfx *am_render_slot(Gfx *gdl, char *text, s16 x, s16 y, s32 mode, s32 flags) x + g_AmMenus[g_AmIndex].slotwidth / 2 + 1, y + paddingbottom); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Render text colour = defcol; @@ -1265,9 +1256,9 @@ Gfx *am_render(Gfx *gdl) s16 tmp2; #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + g_UiScaleX = g_ViRes == VIRES_HI ? 2 : 1; #endif g_AmIndex = g_Vars.currentplayernum; @@ -1275,7 +1266,7 @@ Gfx *am_render(Gfx *gdl) if (g_Vars.currentplayer->activemenumode != AMMODE_CLOSED) { // Draw diamond - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if (g_Vars.normmplayerisrunning && g_AmMenus[g_AmIndex].screenindex >= 2) { @@ -1502,7 +1493,7 @@ Gfx *am_render(Gfx *gdl) colour = 0x4f4f4f7f; } - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); halfwidth = g_AmMenus[g_AmIndex].slotwidth / 2; @@ -1558,10 +1549,10 @@ Gfx *am_render(Gfx *gdl) g_AmMenus[g_AmIndex].selx + halfwidth + 1, g_AmMenus[g_AmIndex].sely + below); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); } #if VERSION != VERSION_JPN_FINAL @@ -1604,10 +1595,10 @@ Gfx *am_render(Gfx *gdl) } if (PLAYERCOUNT() == 1 && options_get_effective_screen_size() != SCREENSIZE_FULL) { - part1left = vi_get_view_left() / g_ScaleX + 32; + part1left = vi_get_view_left() / g_UiScaleX + 32; } else { - part1left = (s32) ((vi_get_view_width() / g_ScaleX) * 0.5f) - + (s32) (vi_get_view_left() / g_ScaleX) + part1left = (s32) ((vi_get_view_width() / g_UiScaleX) * 0.5f) + + (s32) (vi_get_view_left() / g_UiScaleX) - (s32) (barwidth * 0.5f) + xoffset; } @@ -1616,8 +1607,8 @@ Gfx *am_render(Gfx *gdl) xoffset = (g_Vars.currentplayernum & 1) == 0 ? 8 : -8; } - part1left = (s32) ((vi_get_view_width() / g_ScaleX) * 0.5f) - + (s32) (vi_get_view_left() / g_ScaleX) + part1left = (s32) ((vi_get_view_width() / g_UiScaleX) * 0.5f) + + (s32) (vi_get_view_left() / g_UiScaleX) - (s32) (barwidth * 0.5f) + xoffset; #endif @@ -1698,7 +1689,7 @@ Gfx *am_render(Gfx *gdl) } #endif - g_ScaleX = 1; + g_UiScaleX = 1; return gdl; } diff --git a/src/game/bg.c b/src/game/bg.c index aaedb1110..3e0463ab4 100644 --- a/src/game/bg.c +++ b/src/game/bg.c @@ -1081,14 +1081,14 @@ Gfx *bg_render_scene(Gfx *gdl) || stagenum == STAGE_INFILTRATION || stagenum == STAGE_ESCAPE || stagenum == STAGE_ATTACKSHIP)) { - gdl = text0f153628(gdl); + gdl = text_begin(gdl); gSPMatrix(gdl++, osVirtualToPhysical(cam_get_orthogonal_mtxl()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gdl = player_load_matrix(gdl); gdl = env_stop_fog(gdl); gdl = stars_render(gdl); - gdl = text0f153780(gdl); + gdl = text_end(gdl); gdl = vi0000ab78(gdl); } diff --git a/src/game/bondgun.c b/src/game/bondgun.c index dca320706..f4fbae503 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -9577,8 +9577,8 @@ Gfx *bgun_draw_hud_string(Gfx *gdl, char *text, s32 x, bool halign, s32 y, s32 v y1 = y2 - textheight; } - gdl = text0f153858(gdl, &x1, &y1, &x2, &y2); - gdl = text_render(gdl, &x1, &y1, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x1, &y1, &x2, &y2); + gdl = text_render_v1(gdl, &x1, &y1, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); return gdl; } @@ -9754,7 +9754,7 @@ Gfx *bgun_draw_hud_gauge(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, struct abmag if (partitiony > gaugetop) { // Render empty partition - gdl = text_set_prim_colour(gdl, emptycolour); + gdl = text_begin_boxmode(gdl, emptycolour); if (flip) { gDPFillRectangleScaled(gdl++, x1, y2 - partitiony + y1, x2, gaugeheight + y1); @@ -9762,11 +9762,11 @@ Gfx *bgun_draw_hud_gauge(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, struct abmag gDPFillRectangleScaled(gdl++, x1, gaugetop, x2, partitiony); } - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } // Render filled partition - gdl = text_set_prim_colour(gdl, filledcolour); + gdl = text_begin_boxmode(gdl, filledcolour); if (flip) { gDPFillRectangleScaled(gdl++, x1, y2 - tmp + y1, x2, y2 - partitiony + y1); @@ -9778,7 +9778,7 @@ Gfx *bgun_draw_hud_gauge(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, struct abmag s32 unittop; s32 unitbottom; - gdl = text_set_prim_colour(gdl, emptycolour); + gdl = text_begin_boxmode(gdl, emptycolour); unittop = gaugetop; unitbottom = -1; @@ -9918,7 +9918,7 @@ Gfx *bgun_draw_hud_gauge(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, struct abmag } } - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); @@ -9974,12 +9974,12 @@ Gfx *bgun_draw_hud(Gfx *gdl) } #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + g_UiScaleX = g_ViRes == VIRES_HI ? 2 : 1; #endif - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if (playercount >= 2) { barwidth = 5; @@ -10016,7 +10016,7 @@ Gfx *bgun_draw_hud(Gfx *gdl) } #endif - xpos = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX - barwidth - 24; + xpos = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX - barwidth - 24; if (playercount == 2 && (options_get_screen_split() == SCREENSPLIT_VERTICAL || IS4MB()) && playernum == 0) { xpos += 15; @@ -10049,11 +10049,11 @@ Gfx *bgun_draw_hud(Gfx *gdl) fncolour = ((ctrl->fnfader * 2) - 256) << 16 | 0xff000040; } - gdl = text_set_prim_colour(gdl, fncolour); + gdl = text_begin_boxmode(gdl, fncolour); gDPFillRectangleScaled(gdl++, xpos - 13, bottom - 11, xpos - 2, bottom); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Draw weapon name and function name if (options_get_show_gun_function(g_Vars.currentplayerstats->mpindex)) { @@ -10106,14 +10106,14 @@ Gfx *bgun_draw_hud(Gfx *gdl) if (0xffffff00); } - gdl = text_set_prim_colour(gdl, 0); + gdl = text_begin_boxmode(gdl, 0); gDPFillRectangleScaled(gdl++, x - 1, y - 1, xpos - 11, bottom); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); text_set_wave_blend(g_20SecIntervalFrac * 50.0f, 0, 50); text_set_wave_colours(0xffffffff, 0xffffffff); - gdl = text_render_projected(gdl, &x, &y, str, g_CharsHandelGothicXs, g_FontHandelGothicXs, colour, textwidth, 1000, 0, 0); + gdl = text_render_v2(gdl, &x, &y, str, g_CharsHandelGothicXs, g_FontHandelGothicXs, colour, textwidth, 1000, 0, 0); text_reset_blends(); } @@ -10173,16 +10173,16 @@ Gfx *bgun_draw_hud(Gfx *gdl) colour = (colour & 0xffffff00) | alpha; } - gdl = text_set_prim_colour(gdl, 0); + gdl = text_begin_boxmode(gdl, 0); gDPFillRectangleScaled(gdl++, x - 1, y - 1, xpos - 11, bottom + 3); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); text_set_wave_blend(g_20SecIntervalFrac * 50.0f, 0, 50); text_set_wave_colours(0xffffffff, 0xffffffff); - gdl = text_render_projected(gdl, &x, &y, str, + gdl = text_render_v2(gdl, &x, &y, str, g_CharsHandelGothicXs, g_FontHandelGothicXs, colour, textwidth, 1000, 0, 0); @@ -10201,8 +10201,8 @@ Gfx *bgun_draw_hud(Gfx *gdl) } if (ammoindex == -1) { - gdl = text0f153780(gdl); - g_ScaleX = 1; + gdl = text_end(gdl); + g_UiScaleX = 1; return gdl; } } @@ -10218,7 +10218,7 @@ Gfx *bgun_draw_hud(Gfx *gdl) if (lefthand->inuse && weapon->ammos[ammoindex] != NULL && lefthand->gset.weaponnum != WEAPON_REMOTEMINE) { - xpos = vi_get_view_left() / g_ScaleX + 24; + xpos = vi_get_view_left() / g_UiScaleX + 24; if (playercount == 2 && (options_get_screen_split() == SCREENSPLIT_VERTICAL || IS4MB()) && playernum == 1) { xpos -= 14; @@ -10245,13 +10245,13 @@ Gfx *bgun_draw_hud(Gfx *gdl) ammotype = player->gunctrl.ammotypes[ammoindex]; #if VERSION >= VERSION_NTSC_1_0 - xpos = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX - barwidth - 24; + xpos = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX - barwidth - 24; #else // NTSC Beta omits the brackets here. This would normally cause the // ammo info to be misaligned for players on the right side of the // screen and when using hi-res, but I'm not sure if hi-res can even be // active when using multiple players... - xpos = vi_get_view_left() + vi_get_view_width() / g_ScaleX - barwidth - 24; + xpos = vi_get_view_left() + vi_get_view_width() / g_UiScaleX - barwidth - 24; #endif if (playercount == 2 && (options_get_screen_split() == SCREENSPLIT_VERTICAL || IS4MB()) && playernum == 0) { @@ -10313,9 +10313,9 @@ Gfx *bgun_draw_hud(Gfx *gdl) } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); - g_ScaleX = 1; + g_UiScaleX = 1; return gdl; } diff --git a/src/game/bondview.c b/src/game/bondview.c index 2d211345b..574858942 100644 --- a/src/game/bondview.c +++ b/src/game/bondview.c @@ -919,11 +919,11 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) #endif if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { - gdl = text_set_prim_colour(gdl, 0x00ff0028); + gdl = text_begin_boxmode(gdl, 0x00ff0028); } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { - gdl = text_set_prim_colour(gdl, 0x2244ffa0); + gdl = text_begin_boxmode(gdl, 0x2244ffa0); } else { - gdl = text_set_prim_colour(gdl, 0xff3300a0); + gdl = text_begin_boxmode(gdl, 0xff3300a0); } #if VERSION >= VERSION_NTSC_1_0 @@ -980,15 +980,10 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) y = savedy; x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif // "H/M" sprintf(text, "%s %s%4.2f", lang_get(L_MISC_074), "", g_Vars.currentplayer->eyespy->height * 0.01f); @@ -998,14 +993,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) y = savedy; x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif // "Y/D" sprintf(text, "%s %d", lang_get(L_MISC_075), (s32)g_Vars.currentplayer->eyespy->theta); @@ -1015,14 +1005,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) y = savedy; x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif // "P/D" sprintf(text, "%s %d", lang_get(L_MISC_076), (s32)g_Vars.currentplayer->eyespy->verta); @@ -1032,14 +1017,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) y = savedy; x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextbright, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif // "CI 2023" sprintf(text, "%s", lang_get(L_MISC_077)); @@ -1054,14 +1034,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) #endif x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { sprintf(text, "%s", lang_get(L_MISC_078)); // "YKK: 95935" @@ -1083,14 +1058,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY) { // "CAMSPY" @@ -1109,14 +1079,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) #endif x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif } else if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_DRUGSPY) { // "DRUGSPY" sprintf(text, " %s", lang_get(L_MISC_468)); @@ -1134,14 +1099,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) #endif x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif } else { // "BOMBSPY" sprintf(text, " %s", lang_get(L_MISC_469)); @@ -1159,14 +1119,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) #endif x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif } // Model number @@ -1191,14 +1146,9 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) #endif x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif // Gyrostat/dartammo text if (g_Vars.currentplayer->eyespy->mode == EYESPYMODE_CAMSPY @@ -1222,16 +1172,11 @@ Gfx *bview_draw_eyespy_metrics(Gfx *gdl) if (1); x2 = x + textwidth; \ y2 = y + textheight; \ - gdl = text0f153858(gdl, &x, &y, &x2, &y2); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, - colourtextdull, colourglow, vi_get_width(), vi_get_height(), 0, 0); -#endif - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); { s8 contpadnum = options_get_contpad_num1(g_Vars.currentplayerstats->mpindex); @@ -2366,12 +2311,12 @@ Gfx *bview_draw_horizon_scanner(Gfx *gdl) lenstop = viewtop + (viewheight / 2) - (lensheight / 2); // Black out areas above and below lens - gdl = text_set_prim_colour(gdl, 0x000000ff); + gdl = text_begin_boxmode(gdl, 0x000000ff); gDPFillRectangle(gdl++, viewleft, viewtop, viewleft + viewwidth, lenstop); gDPFillRectangle(gdl++, viewleft, lenstop + lensheight, viewleft + viewwidth, viewtop + viewheight); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Prepare text buffers sprintf(directiontext, "%s %s:%03d", arrows, &directions[(turnangle + 22) / 45], turnangle); @@ -2387,7 +2332,7 @@ Gfx *bview_draw_horizon_scanner(Gfx *gdl) sprintf(zoomtext, "%s %s%s%4.2fX", arrows, "", "", fovy); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Arrows left of product name if (vsplit) { @@ -2397,7 +2342,7 @@ Gfx *bview_draw_horizon_scanner(Gfx *gdl) } y = lenstop - 7; - gdl = text_render_projected(gdl, &x, &y, arrows, + gdl = text_render_v2(gdl, &x, &y, arrows, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffff7f, vi_get_width(), vi_get_height(), 0, 0); // Product name @@ -2410,17 +2355,17 @@ Gfx *bview_draw_horizon_scanner(Gfx *gdl) strcat(nametext, " SCANNER\n"); - gdl = text_render_projected(gdl, &x, &y, nametext, + gdl = text_render_v2(gdl, &x, &y, nametext, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffff7f, vi_get_width(), vi_get_height(), 0, 0); #else - gdl = text_render_projected(gdl, &x, &y, " JMBC WIDE BAND SCANNER\n", + gdl = text_render_v2(gdl, &x, &y, " JMBC WIDE BAND SCANNER\n", g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffff7f, vi_get_width(), vi_get_height(), 0, 0); #endif // Hertz x = viewleft + 75 * scale; y = lenstop + lensheight + 1; - gdl = text_render_projected(gdl, &x, &y, hertztext, + gdl = text_render_v2(gdl, &x, &y, hertztext, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffff7f, vi_get_width(), vi_get_height(), 0, 0); // Zoom level @@ -2432,7 +2377,7 @@ Gfx *bview_draw_horizon_scanner(Gfx *gdl) y = lenstop + lensheight + 1; } - gdl = text_render_projected(gdl, &x, &y, zoomtext, + gdl = text_render_v2(gdl, &x, &y, zoomtext, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffff7f, vi_get_width(), vi_get_height(), 0, 0); // Direction @@ -2444,9 +2389,9 @@ Gfx *bview_draw_horizon_scanner(Gfx *gdl) y = lenstop + lensheight + 1; } - gdl = text_render_projected(gdl, &x, &y, directiontext, + gdl = text_render_v2(gdl, &x, &y, directiontext, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffff7f, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); gDPPipeSync(gdl++); diff --git a/src/game/camdraw.c b/src/game/camdraw.c index f25dda71a..9a5e76aa7 100644 --- a/src/game/camdraw.c +++ b/src/game/camdraw.c @@ -1815,10 +1815,10 @@ Gfx *phead_draw_texture(Gfx *gdl, struct textureconfig *tconfig, f32 pos[2], f32 gDPSetCombineMode(gdl++, G_CC_DECALRGBA, G_CC_DECALRGBA); gSPTextureRectangle(gdl++, - x * g_ScaleX, y, - pxwidth * g_ScaleX, pxheight, + x * g_UiScaleX, y, + pxwidth * g_UiScaleX, pxheight, G_TX_RENDERTILE, 16, sp28, - (s32)(1024.0f / width) / g_ScaleX, + (s32)(1024.0f / width) / g_UiScaleX, (s32)(1024.0f / height)); return gdl; diff --git a/src/game/chraction.c b/src/game/chraction.c index d25090833..7e0e6072c 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -16044,7 +16044,7 @@ Gfx *chrs_render_chr_stats(Gfx *gdl, RoomNum *rooms) s32 i; s32 numchrs = chrs_get_num_slots(); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); for (i = 0; i < numchrs; i++) { struct chrdata *chr = &g_ChrSlots[i]; @@ -16079,15 +16079,15 @@ Gfx *chrs_render_chr_stats(Gfx *gdl, RoomNum *rooms) x2 = x + textwidth; y2 = y + textheight; - gdl = text0f153858(gdl, &x, &y, &x2, &y2); - gdl = text_render(gdl, &x, &y, fullbuffer, + gdl = text_draw_black_box(gdl, &x, &y, &x2, &y2); + gdl = text_render_v1(gdl, &x, &y, fullbuffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xff8800aa, 0x00000088, vi_get_width(), vi_get_height(), 0, 0); } } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } diff --git a/src/game/credits.c b/src/game/credits.c index 55d19476f..49a8df54b 100644 --- a/src/game/credits.c +++ b/src/game/credits.c @@ -569,11 +569,11 @@ Gfx *credits_fill_framebuffer(Gfx *gdl, u32 colour) { gSPDisplayList(gdl++, &var800613a0); - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); gDPFillRectangle(gdl++, 0, 0, vi_get_width(), vi_get_height()); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } @@ -1010,7 +1010,7 @@ Gfx *credits_draw_background_text(Gfx *gdl, s32 x, s32 y, char *text, struct fon f32 value = (i * 0.3f * (spread + 0.5f)) + 1.0f; u32 stack[2]; - gdl = text0f1552d4(gdl, x + sinf(f24) * mult, y + cosf(f24) * mult, f26, value, text, chars, font, colour3, 0, 1); + gdl = text_render_credits(gdl, x + sinf(f24) * mult, y + cosf(f24) * mult, f26, value, text, chars, font, colour3, 0, 1); } } @@ -1059,7 +1059,7 @@ Gfx *credits_draw_foreground_text(Gfx *gdl, s32 x, s32 y, char *text, struct fon colour = 0xffffff00 | (u32) (255.0f * opacityfrac); - gdl = text0f1552d4(gdl, x, y, widthscale, heightscale, text, chars, font, colour, hdir, vdir); + gdl = text_render_credits(gdl, x, y, widthscale, heightscale, text, chars, font, colour, hdir, vdir); return gdl; } @@ -1511,7 +1511,7 @@ Gfx *credits_draw_slide(Gfx *gdl) #endif } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Draw text repetitions for (i = 0; i < g_CreditsData->numthisslide * 2; i++) { @@ -1664,7 +1664,7 @@ Gfx *credits_draw_slide(Gfx *gdl) } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } @@ -1764,13 +1764,13 @@ Gfx *credits_draw(Gfx *gdl) static u32 scrolltimer240 = 0; - text0f1531dc(false); + text_set_hires(false); #if VERSION >= VERSION_JPN_FINAL var800800f0jf = 0; #endif - g_ScaleX = 1; + g_UiScaleX = 1; gdl = vi_prepare_zbuf(gdl); gdl = vi0000b1d0(gdl); diff --git a/src/game/filemgr.c b/src/game/filemgr.c index 50b9692c1..f30c9b821 100644 --- a/src/game/filemgr.c +++ b/src/game/filemgr.c @@ -1948,11 +1948,11 @@ Gfx *filemgr_render_perfect_head_thumbnail(Gfx *gdl, struct menuitemrenderdata * gDPTileSync(gdl++); gSPTextureRectangle(gdl++, - ((renderdata->x + 4) << 2) * g_ScaleX, + ((renderdata->x + 4) << 2) * g_UiScaleX, (renderdata->y + 2) << 2, - ((renderdata->x + 20) << 2) * g_ScaleX, + ((renderdata->x + 20) << 2) * g_UiScaleX, (renderdata->y + 18) << 2, - G_TX_RENDERTILE, 0, 512, 1024 / g_ScaleX, -1024); + G_TX_RENDERTILE, 0, 512, 1024 / g_UiScaleX, -1024); gDPLoadSync(gdl++); gDPTileSync(gdl++); @@ -2059,17 +2059,17 @@ MenuItemHandlerResult filemgr_file_to_copy_or_delete_list_menu_handler(s32 opera x = renderdata->x + 2; y = renderdata->y + 2; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if (file) { filemgr_get_select_name(text, file, g_Menus[g_MpPlayerNum].fm.filetypeplusone - 1); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, vi_get_width(), vi_get_height(), 0, 1); y = renderdata->y + 12; x = renderdata->x + 2; } - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return (uintptr_t) gdl; @@ -2251,7 +2251,7 @@ MenuItemHandlerResult pak_game_note_list_menu_handler(s32 operation, struct menu sprintf(generalbuffer, "%d:\n", data->list.unk04 + 1); x = renderdata->x + 4; y = renderdata->y + 1; - gdl = text_render_projected(gdl, &x, &y, generalbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, generalbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 1); // Prepare buffers for remaining text @@ -2273,13 +2273,13 @@ MenuItemHandlerResult pak_game_note_list_menu_handler(s32 operation, struct menu // Render note name x = renderdata->x + 20; y = renderdata->y + 1; - gdl = text_render_projected(gdl, &x, &y, generalbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, generalbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 1); // Render ext character (for when a game has multiple notes) x = renderdata->x + (VERSION == VERSION_JPN_FINAL ? 220 : 190); y = renderdata->y + 1; - gdl = text_render_projected(gdl, &x, &y, extbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, extbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 1); // Render number of pages @@ -2287,7 +2287,7 @@ MenuItemHandlerResult pak_game_note_list_menu_handler(s32 operation, struct menu x = renderdata->x + renderdata->width - textwidth - 6; y = renderdata->y + 1; - gdl = text_render_projected(gdl, &x, &y, pagesbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, pagesbuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 1); return (uintptr_t) gdl; @@ -2656,23 +2656,23 @@ MenuItemHandlerResult filemgr_choose_agent_list_menu_handler(s32 operation, stru TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); gSPTextureRectangle(gdl++, - ((renderdata->x + 4) << 2) * g_ScaleX, + ((renderdata->x + 4) << 2) * g_UiScaleX, (renderdata->y + 2) << 2, - ((renderdata->x + 60) << 2) * g_ScaleX, + ((renderdata->x + 60) << 2) * g_UiScaleX, (renderdata->y + 38) << 2, - G_TX_RENDERTILE, 0, 1152, 1024 / g_ScaleX, -1024); + G_TX_RENDERTILE, 0, 1152, 1024 / g_UiScaleX, -1024); x = renderdata->x + 62; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 3 : 4); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if (data->list.unk04 == g_FileLists[0]->numfiles) { // "New Agent..." - gdl = text_render_projected(gdl, &x, &y, lang_get(L_OPTIONS_403), + gdl = text_render_v2(gdl, &x, &y, lang_get(L_OPTIONS_403), g_CharsHandelGothicMd, g_FontHandelGothicMd, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); } else if (file) { // Render file name - gdl = text_render_projected(gdl, &x, &y, name, + gdl = text_render_v2(gdl, &x, &y, name, g_CharsHandelGothicMd, g_FontHandelGothicMd, renderdata->colour, vi_get_width(), vi_get_height(), 0, 1); // Prepare and render stage name @@ -2689,7 +2689,7 @@ MenuItemHandlerResult filemgr_choose_agent_list_menu_handler(s32 operation, stru } strcat(buffer, "\n"); - gdl = text_render_projected(gdl, &x, &y, buffer, + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); // Prepare and render mission time @@ -2715,17 +2715,17 @@ MenuItemHandlerResult filemgr_choose_agent_list_menu_handler(s32 operation, stru text_measure(&textheight, &textwidth, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); #endif - gdl = text_render_projected(gdl, &x, &y, buffer, + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); // Render seconds part of mission time (uses a smaller font) y += (VERSION == VERSION_JPN_FINAL) ? 3 : 1; x++; sprintf(buffer, ".%02d", seconds); - gdl = text_render_projected(gdl, &x, &y, buffer, + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); return (uintptr_t) gdl; case MENUOP_GETOPTIONHEIGHT: data->list.value = 40; diff --git a/src/game/healthbar.c b/src/game/healthbar.c index 804508155..77efa97fc 100644 --- a/src/game/healthbar.c +++ b/src/game/healthbar.c @@ -530,9 +530,9 @@ Gfx *healthbar_draw(Gfx *gdl, struct chrdata *chr, s32 offyarg, f32 heightfracar traumacolours++; } - gdl = text0f153628(gdl); - gdl = text0f153a34(gdl, underleft, undertop, underright, underbottom, undercol); - gdl = text0f153780(gdl); + gdl = text_begin(gdl); + gdl = text_draw_box(gdl, underleft, undertop, underright, underbottom, undercol); + gdl = text_end(gdl); gDPSetRenderMode(gdl++, G_RM_AA_XLU_SURF, G_RM_AA_XLU_SURF2); gDPSetCombineMode(gdl++, G_CC_SHADE, G_CC_SHADE); diff --git a/src/game/hudmsg.c b/src/game/hudmsg.c index 368307510..37d68cb87 100644 --- a/src/game/hudmsg.c +++ b/src/game/hudmsg.c @@ -129,7 +129,7 @@ Gfx *hudmsg_render_mission_timer(Gfx *gdl, u32 alpha) textcolour = alpha; - viewleft = vi_get_view_left() / g_ScaleX; + viewleft = vi_get_view_left() / g_UiScaleX; viewtop = vi_get_view_top(); viewheight = vi_get_view_height(); playercount = PLAYERCOUNT(); @@ -190,7 +190,7 @@ Gfx *hudmsg_render_mission_timer(Gfx *gdl, u32 alpha) x = viewleft + g_HudPaddingX + 3; y = timery; - gdl = text_render(gdl, &x, &y, buffer, g_CharsNumeric, g_FontNumeric, textcolour, 0x000000a0, vi_get_width(), vi_get_height_hack(), 0, 0); + gdl = text_render_v1(gdl, &x, &y, buffer, g_CharsNumeric, g_FontNumeric, textcolour, 0x000000a0, vi_get_width(), vi_get_height_hack(), 0, 0); return gdl; } @@ -219,8 +219,8 @@ Gfx *hudmsg_render_zoom_range(Gfx *gdl, u32 alpha) colour = (alpha * 0xa0 / 255) | 0x00ff0000; viewtop = vi_get_view_top(); - viewleft = vi_get_view_left() / g_ScaleX; - viewhalfwidth = (vi_get_view_width() / g_ScaleX) >> 1; + viewleft = vi_get_view_left() / g_UiScaleX; + viewhalfwidth = (vi_get_view_width() / g_UiScaleX) >> 1; viewheight = vi_get_view_height(); texty = viewheight + viewtop - 1; maxzoom = 1.0f; @@ -272,8 +272,8 @@ Gfx *hudmsg_render_zoom_range(Gfx *gdl, u32 alpha) x2 = x + textwidth; y2 = y + textheight; - gdl = text0f1538e4(gdl, &x, &y, &x2, &y2); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_uibox(gdl, &x, &y, &x2, &y2); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); // Divider sprintf(text, "/"); @@ -284,8 +284,8 @@ Gfx *hudmsg_render_zoom_range(Gfx *gdl, u32 alpha) x2 = x + textwidth; y2 = y + textheight; - gdl = text0f1538e4(gdl, &x, &y, &x2, &y2); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_uibox(gdl, &x, &y, &x2, &y2); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); // Right side - max zoom level sprintf(text, "%s%s%4.2fX", "", "", maxzoom); @@ -296,8 +296,8 @@ Gfx *hudmsg_render_zoom_range(Gfx *gdl, u32 alpha) x2 = x + textwidth; y2 = y + textheight; - gdl = text0f1538e4(gdl, &x, &y, &x2, &y2); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_uibox(gdl, &x, &y, &x2, &y2); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, colour, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); return gdl; } @@ -336,10 +336,10 @@ Gfx *hudmsg_render_box(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, f32 bgopacity, f32 width = (x1 + x2) * 0.5f; f32 height = (y1 + y2) * 0.5f; - gdl = text0f153a34(gdl, - (s32)((width - f22) + 1.0f) * g_ScaleX, + gdl = text_draw_box(gdl, + (s32)((width - f22) + 1.0f) * g_UiScaleX, (height - f20) + 1.0f, - (s32)(width + f22) * g_ScaleX, + (s32)(width + f22) * g_UiScaleX, height + f20, 128.0f * textopacity); } @@ -350,7 +350,7 @@ Gfx *hudmsg_render_box(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, f32 bgopacity, s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1) { #if VERSION >= VERSION_PAL_FINAL - s32 viewwidth = vi_get_view_width() / g_ScaleX; + s32 viewwidth = vi_get_view_width() / g_UiScaleX; s32 result = 0; *arg0 = 24; @@ -379,7 +379,7 @@ s32 hudmsg0f0ddb1c(s32 *arg0, s32 arg1) #endif } #else - s32 viewwidth = g_Vars.currentplayer->viewwidth / g_ScaleX; + s32 viewwidth = g_Vars.currentplayer->viewwidth / g_UiScaleX; s32 result = 0; *arg0 = 24; @@ -829,9 +829,9 @@ void hudmsg_calculate_position(struct hudmessage *msg) { s32 x; s32 y; - s32 viewleft = g_Vars.players[msg->playernum]->viewleft / g_ScaleX; + s32 viewleft = g_Vars.players[msg->playernum]->viewleft / g_UiScaleX; s32 viewtop = g_Vars.players[msg->playernum]->viewtop; - s32 viewwidth = g_Vars.players[msg->playernum]->viewwidth / g_ScaleX; + s32 viewwidth = g_Vars.players[msg->playernum]->viewwidth / g_UiScaleX; s32 viewheight = g_Vars.players[msg->playernum]->viewheight; s32 v0; @@ -992,9 +992,9 @@ void hudmsg_create_from_args(char *text, s32 type, s32 conf00, s32 conf01, s32 c } #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + g_UiScaleX = g_ViRes == VIRES_HI ? 2 : 1; #endif // Find an unused index for the new message @@ -1092,7 +1092,7 @@ void hudmsg_create_from_args(char *text, s32 type, s32 conf00, s32 conf01, s32 c } } - g_ScaleX = 1; + g_UiScaleX = 1; } } @@ -1120,9 +1120,9 @@ void hudmsgs_tick(void) g_HudmsgsActive = false; #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = (g_ViRes == VIRES_HI) ? 2 : 1; + g_UiScaleX = (g_ViRes == VIRES_HI) ? 2 : 1; #endif #if VERSION >= VERSION_NTSC_1_0 @@ -1325,7 +1325,7 @@ void hudmsgs_tick(void) } } - g_ScaleX = 1; + g_UiScaleX = 1; } void hudmsgs_set_on(u32 reason) @@ -1365,12 +1365,12 @@ Gfx *hudmsgs_render(Gfx *gdl) s32 spdc = true; #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + g_UiScaleX = g_ViRes == VIRES_HI ? 2 : 1; #endif - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if ((g_Vars.coopplayernum >= 0 || g_Vars.antiplayernum >= 0) && g_InCutscene @@ -1430,12 +1430,12 @@ Gfx *hudmsgs_render(Gfx *gdl) if (msg->type == HUDMSGTYPE_CUTSCENESUBTITLE) { #if VERSION >= VERSION_NTSC_1_0 gDPSetScissor(gdl++, 0, - (x - 4) * g_ScaleX, 0, - (x + msg->width + 3) * g_ScaleX, vi_get_buf_height()); + (x - 4) * g_UiScaleX, 0, + (x + msg->width + 3) * g_UiScaleX, vi_get_buf_height()); #else gDPSetScissor(gdl++, 0, - (x - 4) * g_ScaleX, y - 4, - (x + msg->width + 3) * g_ScaleX, y + msg->height + 3); + (x - 4) * g_UiScaleX, y - 4, + (x + msg->width + 3) * g_UiScaleX, y + msg->height + 3); #endif } @@ -1481,15 +1481,10 @@ Gfx *hudmsgs_render(Gfx *gdl) gdl = hudmsg_render_box(gdl, x - 3, y - 3, x + msg->width + 2, y + msg->height + 2, 1.0f, bordercolour, spc0); #endif - gdl = text_render_projected(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, vi_get_width(), vi_get_height(), 0, 0); } else { - gdl = text0f153a34(gdl, x, y, x + msg->width, y + msg->height, 0); - -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); -#endif + gdl = text_draw_box(gdl, x, y, x + msg->width, y + msg->height, 0); + gdl = text_render_vx(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); } if (msg->alignv == 6) { @@ -1514,15 +1509,10 @@ Gfx *hudmsgs_render(Gfx *gdl) gdl = hudmsg_render_box(gdl, x - 3, y - 3, x + msg->width + 2, y + msg->height + 2, 1.0f, bordercolour, 1.0f); #endif - gdl = text_render_projected(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, vi_get_width(), vi_get_height(), 0, 0); } else { - gdl = text0f153a34(gdl, x, y, x + msg->width, y + msg->height, 0); - -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); -#endif + gdl = text_draw_box(gdl, x, y, x + msg->width, y + msg->height, 0); + gdl = text_render_vx(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); } if (msg->alignv == 6) { timerthing = 0; @@ -1563,15 +1553,10 @@ Gfx *hudmsgs_render(Gfx *gdl) gdl = hudmsg_render_box(gdl, x - 3, y - 3, x + msg->width + 2, y + msg->height + 2, 1.0f, bordercolour, 1.0f - spa8); #endif - gdl = text_render_projected(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, vi_get_width(), vi_get_height(), 0, 0); } else { - gdl = text0f153a34(gdl, x, y, x + msg->width, y + msg->height, 0); - -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); -#endif + gdl = text_draw_box(gdl, x, y, x + msg->width, y + msg->height, 0); + gdl = text_render_vx(gdl, &x, &y, msg->text, msg->font1, msg->font2, textcolour, glowcolour, vi_get_width(), vi_get_height(), 0, 0); } if (msg->alignv == 6) { @@ -1607,9 +1592,9 @@ Gfx *hudmsgs_render(Gfx *gdl) gdl = countdown_timer_render(gdl); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); - g_ScaleX = 1; + g_UiScaleX = 1; return gdl; } diff --git a/src/game/lv.c b/src/game/lv.c index c895407df..3fbf8c355 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -561,7 +561,7 @@ Gfx *lv_render_fade(Gfx *gdl) vi_get_view_left() + vi_get_view_width() + 1, vi_get_view_top() + vi_get_view_height() - inset + 2); - return text0f153838(gdl); + return text_end_boxmode(gdl); } bool lv_is_fade_active(void) @@ -702,24 +702,24 @@ Gfx *lv_render_man_pos_if_enabled(Gfx *gdl) y = vi_get_view_top() + 17; y2 = y + 10; - gdl = text0f153628(gdl); - gdl = text0f153a34(gdl, 0, y - 1, vi_get_width(), y2 + 1, 0x00000064); + gdl = text_begin(gdl); + gdl = text_draw_box(gdl, 0, y - 1, vi_get_width(), y2 + 1, 0x00000064); - gdl = text_render_projected(gdl, &x, &y, bufroom, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, bufroom, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); x = vi_get_view_left() + 87; - gdl = text_render_projected(gdl, &x, &y, bufx, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, bufx, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); x = vi_get_view_left() + 141; - gdl = text_render_projected(gdl, &x, &y, bufy, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, bufy, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); x = vi_get_view_left() + 195; - gdl = text_render_projected(gdl, &x, &y, bufz, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, bufz, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); x = vi_get_view_left() + 249; - gdl = text_render_projected(gdl, &x, &y, bufdir, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, bufdir, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return gdl; @@ -1375,7 +1375,7 @@ Gfx *lv_render(Gfx *gdl) vi_get_view_left() + vi_get_view_width(), vi_get_view_top() + vi_get_view_height()); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } } #endif @@ -1582,12 +1582,12 @@ Gfx *lv_render(Gfx *gdl) } if (alpha) { - gdl = text0f153628(gdl); - gdl = text0f153a34(gdl, + gdl = text_begin(gdl); + gdl = text_draw_box(gdl, vi_get_view_left(), vi_get_view_top(), vi_get_view_left() + vi_get_view_width(), vi_get_view_top() + vi_get_view_height(), 0xffffff00 | alpha); - gdl = text0f153780(gdl); + gdl = text_end(gdl); } } } diff --git a/src/game/mainmenu.c b/src/game/mainmenu.c index 8c4d65a81..c54f2e43c 100644 --- a/src/game/mainmenu.c +++ b/src/game/mainmenu.c @@ -1993,9 +1993,9 @@ MenuItemHandlerResult menuhandler_mission_list(s32 operation, struct menuitem *i #endif gSPTextureRectangle(gdl++, - ((renderdata->x + 4) << 2) * g_ScaleX, (renderdata->y + 3) << 2, - ((renderdata->x + 60) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0, 0x0480, 1024 / g_ScaleX, -1024); + ((renderdata->x + 4) << 2) * g_UiScaleX, (renderdata->y + 3) << 2, + ((renderdata->x + 60) << 2) * g_UiScaleX, (renderdata->y + 39) << 2, + G_TX_RENDERTILE, 0, 0x0480, 1024 / g_UiScaleX, -1024); if (g_MissionConfig.isanti) { // No stars @@ -2027,9 +2027,9 @@ MenuItemHandlerResult menuhandler_mission_list(s32 operation, struct menuitem *i } gSPTextureRectangle(gdl++, - ((renderdata->x + relx) << 2) * g_ScaleX, (renderdata->y + 25) << 2, - ((renderdata->x + relx + 14) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0x0010, 0x01c0, 1024 / g_ScaleX, -1024); + ((renderdata->x + relx) << 2) * g_UiScaleX, (renderdata->y + 25) << 2, + ((renderdata->x + relx + 14) << 2) * g_UiScaleX, (renderdata->y + 39) << 2, + G_TX_RENDERTILE, 0x0010, 0x01c0, 1024 / g_UiScaleX, -1024); } } else { tex_select(&gdl, &g_TexGeneralConfigs[34], 2, 0, 2, true, NULL); @@ -2066,31 +2066,31 @@ MenuItemHandlerResult menuhandler_mission_list(s32 operation, struct menuitem *i } gSPTextureRectangle(gdl++, - ((renderdata->x + relx) << 2) * g_ScaleX, (renderdata->y + 25) << 2, - ((renderdata->x + relx + 14) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0x0010, 0x01c0, 1024 / g_ScaleX, -1024); + ((renderdata->x + relx) << 2) * g_UiScaleX, (renderdata->y + 25) << 2, + ((renderdata->x + relx + 14) << 2) * g_UiScaleX, (renderdata->y + 39) << 2, + G_TX_RENDERTILE, 0x0010, 0x01c0, 1024 / g_UiScaleX, -1024); } } x = renderdata->x + 62; y = renderdata->y + 3; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Draw first part of name strcpy(text, lang_get(g_SoloStages[stageindex].name1)); strcat(text, "\n"); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); // Draw last part of name strcpy(text, lang_get(g_SoloStages[stageindex].name2)); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); return (s32) gdl; case MENUOP_GETOPTIONHEIGHT: diff --git a/src/game/menu.c b/src/game/menu.c index 407fdc16c..d52fca1e3 100644 --- a/src/game/menu.c +++ b/src/game/menu.c @@ -335,45 +335,45 @@ Gfx *menu_render_banner(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, bool big, s32 bannerbottom = y + textheight + waitheight + 7; // Black fill - gdl = text_set_prim_colour(gdl, 0x0000007f); + gdl = text_begin_boxmode(gdl, 0x0000007f); gDPFillRectangleScaled(gdl++, x1, y1, x2, y2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Dark blue fill - gdl = text_set_prim_colour(gdl, 0x00007f7f); + gdl = text_begin_boxmode(gdl, 0x00007f7f); gDPFillRectangleScaled(gdl++, x1, bannertop, x2, bannerbottom); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Top and bottom borders (light blue) - gdl = text_set_prim_colour(gdl, 0x7f7fff7f); + gdl = text_begin_boxmode(gdl, 0x7f7fff7f); gDPFillRectangleScaled(gdl++, x1, bannerbottom + 2, x2, bannerbottom + 4); gDPFillRectangleScaled(gdl++, x1, bannertop - 4, x2, bannertop - 2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Render the selected message's shadow x = midx - textwidth / 2 + 2; y += 2; - gdl = text_render_projected(gdl, &x, &y, lang_get(msgs[msgnum]), + gdl = text_render_v2(gdl, &x, &y, lang_get(msgs[msgnum]), chars, font, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); // Render "Please Wait..." shadow x = midx - waitwidth / 2 + 2; y += 3; - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPMENU_495), + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPMENU_495), chars, font, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); // Render the selected message proper x = midx - textwidth / 2; y = texttop; - gdl = text_render_projected(gdl, &x, &y, lang_get(msgs[msgnum]), + gdl = text_render_v2(gdl, &x, &y, lang_get(msgs[msgnum]), chars, font, 0xbfbfffff, vi_get_width(), vi_get_width(), 0, 0); // Render "Please Wait..." proper x = midx - waitwidth / 2; y += 3; - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPMENU_495), + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPMENU_495), chars, font, 0xbfbfffff, vi_get_width(), vi_get_width(), 0, 0); #if VERSION >= VERSION_NTSC_1_0 && VERSION < VERSION_JPN_FINAL @@ -381,12 +381,12 @@ Gfx *menu_render_banner(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, bool big, s32 // Render "TM" y = texttop - 1; x = textwidth / 2 + midx - 7; - gdl = text_render_projected(gdl, &x, &y, "TM", + gdl = text_render_v2(gdl, &x, &y, "TM", g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xbfbfffff, vi_get_width(), vi_get_width(), 0, 0); } #endif - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } @@ -2078,11 +2078,11 @@ Gfx *menu_render_model(Gfx *gdl, struct menumodel *menumodel, s32 modeltype) if (modeltype == MENUMODELTYPE_HUDPIECE) { if (IS8MB()) { - screenpos[0] = menumodel->curposx * g_ScaleX; + screenpos[0] = menumodel->curposx * g_UiScaleX; screenpos[1] = menumodel->curposy; } } else { - screenpos[0] = posx * g_ScaleX + vi_get_view_left() + vi_get_view_width() * 0.5f; + screenpos[0] = posx * g_UiScaleX + vi_get_view_left() + vi_get_view_width() * 0.5f; screenpos[1] = posy + vi_get_view_top() + vi_get_view_height() * 0.5f; } @@ -2192,8 +2192,8 @@ Gfx *menu_render_model(Gfx *gdl, struct menumodel *menumodel, s32 modeltype) gdl = func0f0d49c8(gdl); - vi_set_view_position(g_MenuScissorX1 * g_ScaleX, g_MenuScissorY1); - vi_set_fov_aspect_and_size(g_Vars.currentplayer->fovy, aspect, (g_MenuScissorX2 - g_MenuScissorX1) * g_ScaleX, g_MenuScissorY2 - g_MenuScissorY1); + vi_set_view_position(g_MenuScissorX1 * g_UiScaleX, g_MenuScissorY1); + vi_set_fov_aspect_and_size(g_Vars.currentplayer->fovy, aspect, (g_MenuScissorX2 - g_MenuScissorX1) * g_UiScaleX, g_MenuScissorY2 - g_MenuScissorY1); gdl = vi0000af00(gdl, var800a2048[g_MpPlayerNum]); gdl = vi0000aca4(gdl, znear, zfar); @@ -2304,7 +2304,7 @@ Gfx *menu_render_model(Gfx *gdl, struct menumodel *menumodel, s32 modeltype) cam0f0b4d04(&pos, screenpos); - g_MenuProjectFromX = ((s32)screenpos[0] - vi_get_width() / 2) / g_ScaleX; + g_MenuProjectFromX = ((s32)screenpos[0] - vi_get_width() / 2) / g_UiScaleX; g_MenuProjectFromY = (s32)screenpos[1] - vi_get_height() / 2; } } @@ -2383,8 +2383,8 @@ Gfx *menu_apply_scissor(Gfx *gdl) gDPPipeSync(gdl++); #if VERSION >= VERSION_NTSC_1_0 - g_ScissorX1 = g_MenuScissorX1 * g_ScaleX; - g_ScissorX2 = g_MenuScissorX2 * g_ScaleX; + g_ScissorX1 = g_MenuScissorX1 * g_UiScaleX; + g_ScissorX2 = g_MenuScissorX2 * g_UiScaleX; g_ScissorY1 = g_MenuScissorY1; g_ScissorY2 = g_MenuScissorY2; @@ -2431,8 +2431,8 @@ Gfx *menu_apply_scissor(Gfx *gdl) gDPSetScissor(gdl++, G_SC_NON_INTERLACE, g_ScissorX1, g_ScissorY1, g_ScissorX2, g_ScissorY2); #else gDPSetScissor(gdl++, G_SC_NON_INTERLACE, - g_MenuScissorX1 * g_ScaleX, g_MenuScissorY1, - g_MenuScissorX2 * g_ScaleX, g_MenuScissorY2); + g_MenuScissorX1 * g_UiScaleX, g_MenuScissorY1, + g_MenuScissorX2 * g_UiScaleX, g_MenuScissorY2); #endif return gdl; @@ -2487,9 +2487,9 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool colour1 = MIXCOLOUR(dialog, item_focused_outer); - text0f156030(colour1); + text_set_shadow_colour(colour1); - var8007fb9c = false; + g_TextHoloRayEnabled = false; if (g_Menus[g_MpPlayerNum].curdialog == dialog && (dialog->definition->flags & MENUDIALOGFLAG_0002) @@ -2558,14 +2558,14 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool // Each surface is rendered a second time with the colours swapped. // The order is top, right, bottom, left. if (g_MenuData.root != MENUROOT_MPSETUP && (g_MenuData.root != MENUROOT_MPPAUSE || g_Vars.normmplayerisrunning)) { - var800a4634 = menugfx_draw_plane(var800a4634, bgx1, bgy1, bgx2, bgy1, colour4, colour5, MENUPLANE_00); - var800a4634 = menugfx_draw_plane(var800a4634, bgx2, bgy1, bgx2, bgy2, colour5, colour4, MENUPLANE_00); - var800a4634 = menugfx_draw_plane(var800a4634, bgx2, bgy2, bgx1, bgy2, colour4, colour5, MENUPLANE_00); - var800a4634 = menugfx_draw_plane(var800a4634, bgx1, bgy2, bgx1, bgy1, colour5, colour4, MENUPLANE_00); - var800a4634 = menugfx_draw_plane(var800a4634, bgx1, bgy1, bgx2, bgy1, colour5, colour4, MENUPLANE_01); - var800a4634 = menugfx_draw_plane(var800a4634, bgx2, bgy1, bgx2, bgy2, colour4, colour5, MENUPLANE_01); - var800a4634 = menugfx_draw_plane(var800a4634, bgx2, bgy2, bgx1, bgy2, colour5, colour4, MENUPLANE_01); - var800a4634 = menugfx_draw_plane(var800a4634, bgx1, bgy2, bgx1, bgy1, colour4, colour5, MENUPLANE_01); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx1, bgy1, bgx2, bgy1, colour4, colour5, MENUPLANE_00); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx2, bgy1, bgx2, bgy2, colour5, colour4, MENUPLANE_00); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx2, bgy2, bgx1, bgy2, colour4, colour5, MENUPLANE_00); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx1, bgy2, bgx1, bgy1, colour5, colour4, MENUPLANE_00); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx1, bgy1, bgx2, bgy1, colour5, colour4, MENUPLANE_01); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx2, bgy1, bgx2, bgy2, colour4, colour5, MENUPLANE_01); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx2, bgy2, bgx1, bgy2, colour5, colour4, MENUPLANE_01); + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, bgx1, bgy2, bgx1, bgy1, colour4, colour5, MENUPLANE_01); } // Render the title bar @@ -2583,7 +2583,7 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool x = dialogleft + 2; y = dialogtop + 2; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); context.unk18 = false; @@ -2607,13 +2607,13 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool x = dialogleft + 3; y = dialogtop + 3; - gdl = text_render_projected(gdl, &x, &y, title, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour1 & 0xff, dialogwidth, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, title, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour1 & 0xff, dialogwidth, vi_get_height(), 0, 0); // Title proper x = dialogleft + 2; y = dialogtop + 2; - gdl = text_render_projected(gdl, &x, &y, title, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour1, dialogwidth, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, title, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour1, dialogwidth, vi_get_height(), 0, 0); // In MP dialogs, render the player number in the top right if (g_MenuData.root == MENUROOT_MPSETUP @@ -2623,11 +2623,11 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool x = dialogright - 9; y = dialogtop + 2; - gdl = text_render_projected(gdl, &x, &y, sp154[g_MpPlayerNum], g_CharsHandelGothicSm, g_FontHandelGothicSm, colour1, dialogwidth, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, sp154[g_MpPlayerNum], g_CharsHandelGothicSm, g_FontHandelGothicSm, colour1, dialogwidth, vi_get_height(), 0, 0); } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); } // Configure things for the redraw effect @@ -2639,7 +2639,7 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool text_set_diagonal_blend(dialog->x, dialog->y, dialog->redrawtimer, DIAGMODE_FADEIN); } - var8007fb9c = true; + g_TextHoloRayEnabled = true; } } else if (dialog->state == MENUDIALOGSTATE_POPULATED) { text_set_menu_blend(dialog->statefrac); @@ -2679,9 +2679,9 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool { struct menulayer *layer; - s32 viewleft = vi_get_view_left() / g_ScaleX; + s32 viewleft = vi_get_view_left() / g_UiScaleX; s32 viewtop = vi_get_view_top(); - s32 viewright = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX; + s32 viewright = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX; s32 viewbottom = vi_get_view_top() + vi_get_view_height(); g_MenuScissorX1 = dialogleft + 2; @@ -2844,9 +2844,9 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool colour2 = MIXCOLOUR(dialog, item_focused_outer); colour = colour_blend(colour2, colour2 & 0xffffff00, 127); - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); gDPFillRectangleScaled(gdl++, x1, y1, x2, y2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } if (focused) { @@ -2859,10 +2859,10 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool #if VERSION >= VERSION_NTSC_1_0 if (!(dialog->transitionfrac >= 0.0f && dialog->type2 == 0) && !(dialog->transitionfrac < 0.0f && dialog->type == 0)) { - text0f156024(1); + text_set_shadow_enabled(true); } #else - text0f156024(1); + text_set_shadow_enabled(true); #endif } @@ -2907,7 +2907,7 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool } if (focused) { - text0f156024(0); + text_set_shadow_enabled(false); } } @@ -2919,7 +2919,7 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool // Render overlays, such as dropdown menus if (!lightweight) { - gdl = text_set_prim_colour(gdl, 0x00000000); + gdl = text_begin_boxmode(gdl, 0x00000000); curx = dialogleft; @@ -2951,7 +2951,7 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool curx += menu->cols[colindex].width; } - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } gDPSetScissor(gdl++, G_SC_NON_INTERLACE, vi_get_view_left(), vi_get_view_top(), @@ -2991,7 +2991,7 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool text_reset_blends(); text_set_rotation90(true); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Left/previous title previndex = layer->cursibling - 1; @@ -3012,7 +3012,7 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool x -= 3; } - gdl = text_render_projected(gdl, &y, &x, title, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffffff, dialogwidth, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &y, &x, title, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0xffffffff, dialogwidth, vi_get_height(), 0, 0); // Right/next title nextindex = layer->cursibling + 1; @@ -3037,8 +3037,8 @@ Gfx *dialog_render(Gfx *gdl, struct menudialog *dialog, struct menu *menu, bool x += 3; } - gdl = text_render_projected(gdl, &y, &x, title, g_CharsHandelGothicXs, g_FontHandelGothicXs, -1, dialogwidth, vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_render_v2(gdl, &y, &x, title, g_CharsHandelGothicXs, g_FontHandelGothicXs, -1, dialogwidth, vi_get_height(), 0, 0); + gdl = text_end(gdl); text_set_rotation90(false); } @@ -3165,9 +3165,9 @@ void menu_find_available_size(s32 *leftptr, s32 *topptr, s32 *rightptr, s32 *bot void menu_find_available_size(s32 *leftptr, s32 *topptr, s32 *rightptr, s32 *bottomptr) #endif { - s32 left = vi_get_view_left() / g_ScaleX + 20; + s32 left = vi_get_view_left() / g_UiScaleX + 20; s32 top = vi_get_view_top() + 4; - s32 right = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX - 20; + s32 right = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX - 20; s32 bottom = vi_get_view_top() + vi_get_view_height() - 4; s32 playernum; u32 stack1; @@ -3288,9 +3288,9 @@ void menu_find_available_size(s32 *leftptr, s32 *topptr, s32 *rightptr, s32 *bot case MENUROOT_MPENDSCREEN: case MENUROOT_PICKTARGET: case MENUROOT_4MBFILEMGR: - *leftptr = g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewleft / g_ScaleX; + *leftptr = g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewleft / g_UiScaleX; *topptr = g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewtop; - *rightptr = (g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewleft + g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewwidth) / g_ScaleX; + *rightptr = (g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewleft + g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewwidth) / g_UiScaleX; *bottomptr = g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewtop + g_Vars.players[g_Menus[g_MpPlayerNum].playernum]->viewheight; if (PLAYERCOUNT() > 2) { @@ -3364,7 +3364,7 @@ void dialog_calculate_position(struct menudialog *dialog) } if (hdir > 0) { - dialog->dstx = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX + 4; + dialog->dstx = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX + 4; } if (vdir < 0) { @@ -3602,7 +3602,7 @@ Gfx *menu_render_dialogs(Gfx *gdl) if (g_MenuData.root == MENUROOT_MPPAUSE || g_MenuData.root == MENUROOT_PICKTARGET || g_MenuData.root == MENUROOT_MPENDSCREEN) { - g_MenuProjectFromX = g_Menus[g_MpPlayerNum].curdialog->x + g_Menus[g_MpPlayerNum].curdialog->width / 2 - vi_get_width() / (g_ScaleX * 2); + g_MenuProjectFromX = g_Menus[g_MpPlayerNum].curdialog->x + g_Menus[g_MpPlayerNum].curdialog->width / 2 - vi_get_width() / (g_UiScaleX * 2); g_MenuProjectFromY = g_Menus[g_MpPlayerNum].curdialog->y + g_Menus[g_MpPlayerNum].curdialog->height / 2 - vi_get_height() / 2; gdl = menu_render_dialog(gdl, g_Menus[g_MpPlayerNum].curdialog, &g_Menus[g_MpPlayerNum], 0); @@ -3670,9 +3670,9 @@ Gfx *menu_render_dialogs(Gfx *gdl) gdl = menu_render_banner(gdl, xmin, ymin, xmax, ymax, false, g_Menus[g_MpPlayerNum].bannernum); #endif } else { - s32 xmin = vi_get_view_left() / g_ScaleX; + s32 xmin = vi_get_view_left() / g_UiScaleX; s32 ymin = vi_get_view_top(); - s32 xmax = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX; + s32 xmax = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX; s32 ymax = vi_get_view_top() + vi_get_view_height(); #if VERSION >= VERSION_NTSC_1_0 @@ -5059,18 +5059,18 @@ Gfx *menu_render_background_layer1(Gfx *gdl, u8 bg, f32 frac) { u32 colour = 255 * frac; gSPDisplayList(gdl++, var800613a0); - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); gDPFillRectangle(gdl++, 0, 0, vi_get_width(), vi_get_height()); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } break; case MENUBG_SUCCESS: { // Fill with black gSPDisplayList(gdl++, var800613a0); - gdl = text_set_prim_colour(gdl, 0x000000ff); + gdl = text_begin_boxmode(gdl, 0x000000ff); gDPFillRectangle(gdl++, 0, 0, vi_get_width(), vi_get_height()); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Render the success BG gdl = menugfx_render_bg_success(gdl); @@ -5081,9 +5081,9 @@ Gfx *menu_render_background_layer1(Gfx *gdl, u8 bg, f32 frac) if (alpha) { gSPDisplayList(gdl++, var800613a0); - gdl = text_set_prim_colour(gdl, alpha); + gdl = text_begin_boxmode(gdl, alpha); gDPFillRectangle(gdl++, 0, 0, vi_get_width(), vi_get_height()); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } } } @@ -5094,9 +5094,9 @@ Gfx *menu_render_background_layer1(Gfx *gdl, u8 bg, f32 frac) u32 stack; u32 channel = (1.0f - frac) * 255; gSPDisplayList(gdl++, var800613a0); - gdl = text_set_prim_colour(gdl, channel << 24 | channel << 16 | channel << 8 | 0xff); + gdl = text_begin_boxmode(gdl, channel << 24 | channel << 16 | channel << 8 | 0xff); gDPFillRectangle(gdl++, 0, 0, vi_get_width(), vi_get_height()); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Render the failure BG gdl = menugfx_render_bg_failure(gdl); @@ -5120,9 +5120,9 @@ Gfx *menu_render_background_layer1(Gfx *gdl, u8 bg, f32 frac) gSPDisplayList(gdl++, var800613a0); alpha = (1.0f - frac) * 255; - gdl = text_set_prim_colour(gdl, 0xff000000 | alpha); + gdl = text_begin_boxmode(gdl, 0xff000000 | alpha); gDPFillRectangle(gdl++, 0, 0, vi_get_width(), vi_get_height()); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } } break; @@ -5162,9 +5162,9 @@ Gfx *menu_render(Gfx *gdl) g_MpPlayerNum = 0; #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + g_UiScaleX = g_ViRes == VIRES_HI ? 2 : 1; #endif gdl = func0f0d479c(gdl); @@ -5286,7 +5286,7 @@ Gfx *menu_render(Gfx *gdl) if (g_MenuData.count > 0) { // Render dialogs - gdl = text0f153ab0(gdl); + gdl = text_enable_holo_ray(gdl); if (g_MenuData.root == MENUROOT_MPPAUSE || g_MenuData.root == MENUROOT_MPENDSCREEN) { g_MpPlayerNum = g_Vars.currentplayerstats->mpindex; @@ -5305,15 +5305,15 @@ Gfx *menu_render(Gfx *gdl) gSPMatrix(gdl++, osVirtualToPhysical(cam_get_perspective_mtxl()), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPDisplayList(gdl++, var800613a0); - text0f153b40(); + text_disable_holo_ray(); // Render corner texts in combat simulator if (g_MenuData.root == MENUROOT_MPSETUP || g_MenuData.root == MENUROOT_4MBMAINMENU) { s32 i; s32 j; - s32 viewleft = vi_get_view_left() / g_ScaleX + 20; + s32 viewleft = vi_get_view_left() / g_UiScaleX + 20; s32 viewtop = vi_get_view_top() + 4; - s32 viewright = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX - 20; + s32 viewright = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX - 20; s32 viewbottom = vi_get_view_top() + vi_get_view_height() - 4; s32 textheight; s32 textwidth; @@ -5325,7 +5325,7 @@ Gfx *menu_render(Gfx *gdl) s32 y; s32 colour; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); for (i = 0; i < MAX_PLAYERS; i++) { // Figure out what text will be displayed. The text calculated @@ -5413,7 +5413,7 @@ Gfx *menu_render(Gfx *gdl) x = viewleft + 2; } - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, g_MenuData.playerjoinalpha[i] | 0x5070ff00, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, g_MenuData.playerjoinalpha[i] | 0x5070ff00, vi_get_width(), vi_get_height(), 0, 0); if (g_Vars.mpsetupmenu == MPSETUPMENU_GENERAL && g_Vars.waitingtojoin[i]) { // "Ready!" @@ -5431,12 +5431,12 @@ Gfx *menu_render(Gfx *gdl) colour = colour_blend(0x00ffff00, 0xffffff00, weight) | g_MenuData.playerjoinalpha[i]; } - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, vi_get_width(), vi_get_height(), 0, 0); } } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); } gSPSetGeometryMode(gdl++, G_ZBUFFER); @@ -5445,9 +5445,9 @@ Gfx *menu_render(Gfx *gdl) // Render banner messages, such as "Please Wait...", // "Checking Controller Pak" and some unused game boy camera texts. if (g_MenuData.bannernum != -1) { - s32 x1 = vi_get_view_left() / g_ScaleX; + s32 x1 = vi_get_view_left() / g_UiScaleX; s32 y1 = vi_get_view_top(); - s32 x2 = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX; + s32 x2 = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX; s32 y2 = vi_get_view_top() + vi_get_view_height(); #if VERSION >= VERSION_NTSC_1_0 @@ -5494,7 +5494,7 @@ Gfx *menu_render(Gfx *gdl) gdl = func0f0d49c8(gdl); - g_ScaleX = 1; + g_UiScaleX = 1; return gdl; } diff --git a/src/game/menugfx.c b/src/game/menugfx.c index 6b81307c5..904809758 100644 --- a/src/game/menugfx.c +++ b/src/game/menugfx.c @@ -63,9 +63,9 @@ void menugfx_create_blur(void) static u32 cccc = 1; #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = (g_ViRes == VIRES_HI) ? 2 : 1; + g_UiScaleX = (g_ViRes == VIRES_HI) ? 2 : 1; #endif if (cccc == 1) { @@ -82,7 +82,7 @@ void menugfx_create_blur(void) #if PAL s32 samplestartindex = (((s32) ((f32) dstx * 2 * 4 * 2 * scale) + (s32) (dsty * fbwidthinbytes * 8)) & 0xfffffffe); #else - s32 samplestartindex = PXTOBYTES(dstx * SAMPLE_WIDTH) * g_ScaleX + dsty * fbwidthinbytes * SAMPLE_HEIGHT; + s32 samplestartindex = PXTOBYTES(dstx * SAMPLE_WIDTH) * g_UiScaleX + dsty * fbwidthinbytes * SAMPLE_HEIGHT; #endif r = g = b = 0; @@ -92,7 +92,7 @@ void menugfx_create_blur(void) #if PAL s32 index = (samplestartindex + (s32) (PXTOBYTES((f32) srcx) * scale) + srcy * fbwidthinbytes) & 0xfffffffe; #else - s32 index = samplestartindex + PXTOBYTES(srcx) * g_ScaleX + srcy * fbwidthinbytes; + s32 index = samplestartindex + PXTOBYTES(srcx) * g_UiScaleX + srcy * fbwidthinbytes; #endif colour = fb[index] << 8 | fb[index + 1]; @@ -112,7 +112,7 @@ void menugfx_create_blur(void) } } - g_ScaleX = 1; + g_UiScaleX = 1; } Gfx *menugfx_render_bg_blur(Gfx *gdl, u32 colour, s16 arg2, s16 arg3) @@ -245,11 +245,11 @@ Gfx *menugfx_render_dialog_background(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 rightcolour; // Render the dialog's background fill - gdl = text_set_prim_colour(gdl, colour1); + gdl = text_begin_boxmode(gdl, colour1); gDPFillRectangleScaled(gdl++, x1, y1, x2, y2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); if (dialog->transitionfrac < 0.0f) { leftcolour = g_MenuColours[dialog->type].dialog_border1; @@ -443,8 +443,8 @@ Gfx *menugfx_draw_dropdown_background(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2) vertices[4].colour = 8; vertices[5].colour = 8; - colour1 = text0f1543ac((x1 + x2) / 2, (y2 + y1) / 2, 0xffffffff) & 0xff; - colour2 = (text0f1543ac((x1 + x2) / 2, (y2 + y1) / 2, 0xffffff7f) & 0xff) | 0x00006f00; + colour1 = text_get_colour_at_pos((x1 + x2) / 2, (y2 + y1) / 2, 0xffffffff) & 0xff; + colour2 = (text_get_colour_at_pos((x1 + x2) / 2, (y2 + y1) / 2, 0xffffff7f) & 0xff) | 0x00006f00; colours[0].word = colour1 | 0x00006f00; colours[1].word = colour2; @@ -522,8 +522,8 @@ Gfx *menugfx_draw_list_group_header(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, s3 alpha1 = alpha; alpha2 = alpha; #else - alpha1 = text0f1543ac((x1 + x2) / 2, (y1 + y2) / 2, 0xffffffff) & 0xff; - alpha2 = text0f1543ac((x1 + x2) / 2, (y1 + y2) / 2, 0xffffff7f) & 0xff; + alpha1 = text_get_colour_at_pos((x1 + x2) / 2, (y1 + y2) / 2, 0xffffffff) & 0xff; + alpha2 = text_get_colour_at_pos((x1 + x2) / 2, (y1 + y2) / 2, 0xffffff7f) & 0xff; #endif colours[0].word = 0x00006f00 | alpha1; @@ -1368,19 +1368,19 @@ Gfx *menugfx_draw_dialog_chevron(Gfx *gdl, s32 x, s32 y, s32 size, s32 direction Gfx *menugfx_draw_checkbox(Gfx *gdl, s32 x, s32 y, s32 size, bool fill, u32 bordercolour, u32 fillcolour) { if (fill) { - gdl = text_set_prim_colour(gdl, fillcolour); + gdl = text_begin_boxmode(gdl, fillcolour); gDPFillRectangleScaled(gdl++, x, y, x + size, y + size); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } - gdl = text_set_prim_colour(gdl, bordercolour); + gdl = text_begin_boxmode(gdl, bordercolour); gDPFillRectangleScaled(gdl++, x, y, x + size + 1, y + 1); gDPFillRectangleScaled(gdl++, x, y + size, x + size + 1, y + size + 1); gDPFillRectangleScaled(gdl++, x, y + 1, x + 1, y + size); gDPFillRectangleScaled(gdl++, x + size, y + 1, x + size + 1, y + size); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } diff --git a/src/game/menuitem.c b/src/game/menuitem.c index e2b547e51..1793a15e4 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -168,13 +168,13 @@ Gfx *menuitem_list_render_header(Gfx *gdl, s16 x1, s16 y1, s16 width, s16 arg4, colour = (colour_blend(colour, 0, 0x2c) & 0xffffff00) | (colour & 0xff); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); #if VERSION >= VERSION_NTSC_1_0 gdl = menugfx_draw_list_group_header(gdl, x1, y1, x1 + width, y1 + height, x1 + arg4, colour & 0xff); #else gdl = menugfx_draw_list_group_header(gdl, x1, y1, x1 + width, y1 + height, x1 + arg4); #endif - gdl = text0f153628(gdl); + gdl = text_begin(gdl); x = x1 + 3; y = y1 + 2; @@ -187,7 +187,7 @@ Gfx *menuitem_list_render_header(Gfx *gdl, s16 x1, s16 y1, s16 width, s16 arg4, text_set_wave_colours(g_MenuWave2Colours[dialog->type].listgroup_headerfg, g_MenuWave1Colours[dialog->type].listgroup_headerfg); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, width, height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, width, height, 0, 0); return gdl; } @@ -245,8 +245,8 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) } #if VERSION >= VERSION_NTSC_1_0 - g_ScissorX1 = context->x * g_ScaleX; - g_ScissorX2 = (context->x + width) * g_ScaleX; + g_ScissorX1 = context->x * g_UiScaleX; + g_ScissorX2 = (context->x + width) * g_UiScaleX; g_ScissorY1 = context->y; g_ScissorY2 = context->y + context->height; @@ -293,8 +293,8 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) gDPSetScissor(gdl++, G_SC_NON_INTERLACE, g_ScissorX1, g_ScissorY1, g_ScissorX2, g_ScissorY2); #else gDPSetScissor(gdl++, G_SC_NON_INTERLACE, - context->x * g_ScaleX, context->y, - (context->x + width) * g_ScaleX, context->y + context->height); + context->x * g_UiScaleX, context->y, + (context->x + width) * g_UiScaleX, context->y + context->height); #endif halfheight = context->height / 2; @@ -333,7 +333,7 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) firstonscreenoptionindex = menuitem0f0e5d2c(itemdata->curoffsety - halfheight, context->item); y = context->y + tmp; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); optionindex = firstonscreenoptionindex; @@ -464,11 +464,11 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) // If not transitioning the dialog type if ((!(context->dialog->transitionfrac >= 0.0f) || context->dialog->type2 != 0) && (!(context->dialog->transitionfrac < 0.0f) || context->dialog->type != 0)) { - text0f156024(1); + text_set_shadow_enabled(true); spb4 = true; } #else - text0f156024(1); + text_set_shadow_enabled(true); spb4 = true; #endif } @@ -513,19 +513,19 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) } // This logic doesn't look right... - if (sp94left / g_ScaleX > vi_get_width()) { - sp94left = vi_get_width() / g_ScaleX; + if (sp94left / g_UiScaleX > vi_get_width()) { + sp94left = vi_get_width() / g_UiScaleX; } - if (sp8cright / g_ScaleX > vi_get_width()) { - sp8cright = vi_get_width() / g_ScaleX; + if (sp8cright / g_UiScaleX > vi_get_width()) { + sp8cright = vi_get_width() / g_UiScaleX; } gDPPipeSync(gdl++); #if VERSION >= VERSION_NTSC_1_0 - g_ScissorX1 = sp94left * g_ScaleX; - g_ScissorX2 = sp8cright * g_ScaleX; + g_ScissorX1 = sp94left * g_UiScaleX; + g_ScissorX2 = sp8cright * g_UiScaleX; g_ScissorY1 = sp90top; g_ScissorY2 = sp88bottom; @@ -571,7 +571,7 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) gDPSetScissor(gdl++, G_SC_NON_INTERLACE, g_ScissorX1, g_ScissorY1, g_ScissorX2, g_ScissorY2); #else - gDPSetScissor(gdl++, G_SC_NON_INTERLACE, sp94left * g_ScaleX, sp90top, sp8cright * g_ScaleX, sp88bottom); + gDPSetScissor(gdl++, G_SC_NON_INTERLACE, sp94left * g_UiScaleX, sp90top, sp8cright * g_UiScaleX, sp88bottom); #endif spb8.type19.gdl = gdl; @@ -606,7 +606,7 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) height = 0; } - gdl = text_render_projected(gdl, &x, &y, text2, chars, font, colour, context->width - left + context->x, height, sp128, 0); + gdl = text_render_v2(gdl, &x, &y, text2, chars, font, colour, context->width - left + context->x, height, sp128, 0); // Consider a checkbox spb8.list.value = optionindex; @@ -620,7 +620,7 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) } if (spb4) { - text0f156024(0); + text_set_shadow_enabled(false); } } @@ -650,10 +650,10 @@ Gfx *menuitem_list_render(Gfx *gdl, struct menurendercontext *context) y = context->y + context->height / 2; // "< Empty >" - gdl = text_render_projected(gdl, &x, &y, lang_get(L_OPTIONS_313), chars, font, colour, context->width - left + context->x, vi_get_height(), sp128, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(L_OPTIONS_313), chars, font, colour, context->width - left + context->x, vi_get_height(), sp128, 0); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } @@ -883,11 +883,11 @@ Gfx *menuitem_dropdown_render(Gfx *gdl, struct menurendercontext *context) text_set_wave_colours(g_MenuWave2Colours[context->dialog->type].item_disabled, g_MenuWave1Colours[context->dialog->type].item_disabled); } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); x = context->x + 10; y = context->y + 2; - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); if (context->dialog->unk6e) { x = context->x + 80; @@ -914,10 +914,10 @@ Gfx *menuitem_dropdown_render(Gfx *gdl, struct menurendercontext *context) text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = context->x + context->width - textwidth - 10; - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } @@ -1113,7 +1113,7 @@ Gfx *menuitem_keyboard_render(Gfx *gdl, struct menurendercontext *context) g_MenuWave1Colours[context->dialog->type].item_unfocused); // Draw input field background - gdl = text_set_prim_colour(gdl, 0x0000ff7f); + gdl = text_begin_boxmode(gdl, 0x0000ff7f); if (context->item->param3 == 0) { // Half width @@ -1128,14 +1128,14 @@ Gfx *menuitem_keyboard_render(Gfx *gdl, struct menurendercontext *context) } // Render text value - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); x = context->x + 4; y = context->y + 2; - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, data->string, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, context->width, context->height, 0, 0); - gdl = text0f153780(gdl); + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, data->string, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffffffff, context->width, context->height, 0, 0); + gdl = text_end(gdl); // Render cursor alpha = menu_get_sin_osc_frac(40) * 255; @@ -1151,11 +1151,11 @@ Gfx *menuitem_keyboard_render(Gfx *gdl, struct menurendercontext *context) cursorcolour = colour_blend(colour_blend(0x0000ffff, 0x000000ff, 127), cursorcolour, alpha); - gdl = text_set_prim_colour(gdl, cursorcolour); + gdl = text_begin_boxmode(gdl, cursorcolour); gDPFillRectangleScaled(gdl++, x + 1, context->y + 2, x + 3, context->y + 9); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Render horizontal grid lines for (row = 0; row < 6; row++) { @@ -1175,7 +1175,7 @@ Gfx *menuitem_keyboard_render(Gfx *gdl, struct menurendercontext *context) context->x + col * 12 + 5, context->y + rowspan * 11 + 14, 0x00ffff7f, 0x00ffff7f); } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); x = context->x + 10; y = context->y + 2; @@ -1276,7 +1276,7 @@ Gfx *menuitem_keyboard_render(Gfx *gdl, struct menurendercontext *context) g_MenuWave1Colours[context->dialog->type].item_disabled); } - gdl = text_render_projected(gdl, &x, &y, lang_get(labels[index]), g_CharsHandelGothicXs, g_FontHandelGothicXs, textcolour, context->width, context->height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(labels[index]), g_CharsHandelGothicXs, g_FontHandelGothicXs, textcolour, context->width, context->height, 0, 0); if (index == 3 && menuitem_keyboard_is_string_empty_or_spaces(data->string)) { text_set_wave_colours( @@ -1295,12 +1295,12 @@ Gfx *menuitem_keyboard_render(Gfx *gdl, struct menurendercontext *context) text_measure(&textheight, &textwidth, label, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = (12 - textwidth) / 2 + x; - gdl = text_render_projected(gdl, &x, &y, label, g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, label, g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0); } } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); // Highlight border of focused button { @@ -1651,20 +1651,20 @@ Gfx *menuitem_objectives_render_one(Gfx *gdl, struct menudialog *dialog, s32 ind buffer[0] = '\0'; // Render objective number - gdl = text0f153628(gdl); + gdl = text_begin(gdl); sprintf(buffer, "%d: ", position); text_measure(&textheight, &textwidth, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = objx - textwidth + 25; - gdl = text_render_projected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); x = objx + 25; if (narrow) { text_wrap(85, sp120, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs); - gdl = text_render_projected(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, sp12c, width, height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicXs, g_FontHandelGothicXs, sp12c, width, height, 0, 0); } else { sprintf(buffer, "%s", sp120); - gdl = text_render_projected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, sp12c, width, height, 0, 0); } if (withstatus) { @@ -1701,19 +1701,19 @@ Gfx *menuitem_objectives_render_one(Gfx *gdl, struct menudialog *dialog, s32 ind y = objy + spbc + 9; #endif - gdl = text_render_projected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8, width, height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8, width, height, 0, 0); #if VERSION != VERSION_JPN_FINAL x = objx + width - textwidth - 10; y = objy + spbc + 9; - gdl = text_render_projected(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8 & 0xffffff7f, width, height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, spcc, g_CharsHandelGothicXs, g_FontHandelGothicXs, spc8 & 0xffffff7f, width, height, 0, 0); #endif x = objx + width - textwidth - 13; y = objy + 9; - gdl = text0f153780(gdl); + gdl = text_end(gdl); spb4 = objx + 22; spb0 = objy - 2; @@ -1766,7 +1766,7 @@ Gfx *menuitem_objectives_render_one(Gfx *gdl, struct menudialog *dialog, s32 ind sp6c = objx + textwidth + 25; sp58 = (objx * 3 + objx + 66) / 4 - 1; - gdl = text0f153780(gdl); + gdl = text_end(gdl); gdl = menugfx0f0e2498(gdl); gdl = menugfx_draw_projected_line(gdl, objx, sp7c, sp80, sp7c + 1, sp12c & 0xffffff00, (sp12c & 0xffffff00) | 0x3f); @@ -1867,7 +1867,7 @@ Gfx *menuitem_label_render(Gfx *gdl, struct menurendercontext *context) s32 x; s32 y; struct menudfc *menudfc; - u8 savedvalue = var8007fb9c; + u8 savedvalue = g_TextHoloRayEnabled; struct fontchar *font1 = g_CharsHandelGothicSm; struct font *font2 = g_FontHandelGothicSm; @@ -1964,7 +1964,7 @@ Gfx *menuitem_label_render(Gfx *gdl, struct menurendercontext *context) text_backup_diagonal_blend_settings(); text_set_diagonal_blend(x, y, menudfc->unk04 * 300, 0); - var8007fb9c = true; + g_TextHoloRayEnabled = true; } colour2 = colour1; @@ -1985,8 +1985,8 @@ Gfx *menuitem_label_render(Gfx *gdl, struct menurendercontext *context) colour1 = data.label.colour1; } - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, text, + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, text, font1, font2, colour1, context->width, context->height, 0, 0); if ((context->item->flags & MENUITEMFLAG_LABEL_HASRIGHTTEXT) == 0) { @@ -2013,19 +2013,19 @@ Gfx *menuitem_label_render(Gfx *gdl, struct menurendercontext *context) x += 6; } - gdl = text_render_projected(gdl, &x, &y, text, + gdl = text_render_v2(gdl, &x, &y, text, font1, font2, colour2, context->width, context->height, 0, 0); } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); if (menudfc) { if (context->width + 200 < menudfc->unk04 * 300 && context->dialog->redrawtimer < 0) { func0f0f13ec(context->item); } - var8007fb9c = savedvalue; + g_TextHoloRayEnabled = savedvalue; text_restore_diagonal_blend_settings(); } @@ -2087,23 +2087,23 @@ Gfx *menuitem_meter_render(Gfx *gdl, struct menurendercontext *context) x2 = x1 + a; x3 = x2 + 6; - gdl = text_set_prim_colour(gdl, colour1); + gdl = text_begin_boxmode(gdl, colour1); gDPFillRectangleScaled(gdl++, x1, context->y, x2, context->y + 5); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, colour2); + gdl = text_begin_boxmode(gdl, colour2); gDPFillRectangleScaled(gdl++, x2, context->y, x3, context->y + 5); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); text = menu_resolve_param2_text(context->item); if (text) { - gdl = text0f153628(gdl); + gdl = text_begin(gdl); x = context->x; y = context->y - 1; - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, colour2 & 0xffffff7f, context->width, context->height, 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return gdl; @@ -2206,8 +2206,8 @@ Gfx *menuitem_selectable_render(Gfx *gdl, struct menurendercontext *context) y += 6; } - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, text, font1, font2, + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, text, font1, font2, leftcolour, context->width, context->height, 0, 0); if ((context->item->flags & (MENUITEMFLAG_LABEL_HASRIGHTTEXT | MENUITEMFLAG_BIGFONT)) == 0) { @@ -2223,12 +2223,12 @@ Gfx *menuitem_selectable_render(Gfx *gdl, struct menurendercontext *context) text_measure(&textheight, &textwidth, text, font1, font2, 0); x = context->x + context->width - textwidth - 10; - gdl = text_render_projected(gdl, &x, &y, text, font1, font2, + gdl = text_render_v2(gdl, &x, &y, text, font1, font2, rightcolour, context->width, context->height, 0, 0); } } - return text0f153780(gdl); + return text_end(gdl); } bool menuitem_selectable_tick(struct menuitem *item, struct menuinputs *inputs, u32 tickflags) @@ -2344,8 +2344,8 @@ Gfx *menuitem_slider_render(Gfx *gdl, struct menurendercontext *context) text_set_wave_colours(g_MenuWave2Colours[context->dialog->type].item_unfocused, g_MenuWave1Colours[context->dialog->type].item_unfocused); } - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, label, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, label, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); if ((context->item->flags & MENUITEMFLAG_SLIDER_HIDEVALUE) == 0) { strcpy(buffer, ""); @@ -2372,10 +2372,10 @@ Gfx *menuitem_slider_render(Gfx *gdl, struct menurendercontext *context) text_set_wave_colours(g_MenuWave2Colours[context->dialog->type].item_unfocused, g_MenuWave1Colours[context->dialog->type].item_unfocused); colour = (colour & 0xffffff00) | ((colour & 0xff) >> 1); - gdl = text_render_projected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width, context->height, 0, 0); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } @@ -2660,7 +2660,7 @@ Gfx *menuitem_checkbox_render(Gfx *gdl, struct menurendercontext *context) g_MenuWave1Colours[context->dialog->type].item_unfocused); } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if (context->focused) { // Mismatch: The addiu and lui at ec8fc and ec900 are swapped. The addiu @@ -2714,10 +2714,10 @@ Gfx *menuitem_checkbox_render(Gfx *gdl, struct menurendercontext *context) x = context->x + 10; y = context->y + 2; - gdl = text_render_projected(gdl, &x, &y, text, font1, font2, + gdl = text_render_v2(gdl, &x, &y, text, font1, font2, maincolour, context->width, context->height, 0, 0); - return text0f153780(gdl); + return text_end(gdl); } bool menuitem_checkbox_tick(struct menuitem *item, struct menuinputs *inputs, u32 tickflags) @@ -2864,28 +2864,28 @@ Gfx *menuitem_scrollable_render(Gfx *gdl, struct menurendercontext *context) g_MenuWave2Colours[context->dialog->type].item_unfocused, g_MenuWave1Colours[context->dialog->type].item_unfocused); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Heading text shadow x = context->x + 3; y = context->y + 3; - gdl = text_render_projected(gdl, &x, &y, headingtext, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, headingtext, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0x000000ff, context->width - 4, context->height - 4, -data->scrolloffset, 0); // Heading text (red) x = context->x + 2; y = context->y + 2; - gdl = text_render_projected(gdl, &x, &y, headingtext, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, headingtext, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff4444ff, context->width - 4, context->height - 4, -data->scrolloffset, 0); // Body text x = menu_is_scrollable_unscrollable(context->item) ? context->x + 5 : context->x + 12; y = context->y + 2; - gdl = text_render_projected(gdl, &x, &y, bodytext, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, bodytext, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, context->width - 4, context->height - 1, -data->scrolloffset, 0); - return text0f153780(gdl); + return text_end(gdl); } bool menuitem_scrollable_tick(struct menuitem *item, struct menudialog *dialog, struct menuinputs *inputs, u32 tickflags, union menuitemdata *data) @@ -3090,8 +3090,8 @@ Gfx *menuitem_marquee_render(Gfx *gdl, struct menurendercontext *context) } #if VERSION >= VERSION_NTSC_1_0 - g_ScissorX1 = context->x * g_ScaleX; - g_ScissorX2 = (context->x + context->width) * g_ScaleX; + g_ScissorX1 = context->x * g_UiScaleX; + g_ScissorX2 = (context->x + context->width) * g_UiScaleX; g_ScissorY1 = context->y; g_ScissorY2 = context->y + context->height - 1; @@ -3138,8 +3138,8 @@ Gfx *menuitem_marquee_render(Gfx *gdl, struct menurendercontext *context) gDPSetScissor(gdl++, G_SC_NON_INTERLACE, g_ScissorX1, g_ScissorY1, g_ScissorX2, g_ScissorY2); #else gDPSetScissor(gdl++, G_SC_NON_INTERLACE, - context->x * g_ScaleX, context->y, - (context->x + context->width) * g_ScaleX, context->y + context->height - 1); + context->x * g_UiScaleX, context->y, + (context->x + context->width) * g_UiScaleX, context->y + context->height - 1); #endif text_backup_and_reset_blends(); @@ -3154,10 +3154,10 @@ Gfx *menuitem_marquee_render(Gfx *gdl, struct menurendercontext *context) text_set_horizontal_blend(context->x, context->x, 14); } - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, &text[i], font1, font2, colour, + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, &text[i], font1, font2, colour, context->width + context->x - x, context->height, 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); gdl = menu_apply_scissor(gdl); text_restore_blends(); @@ -3263,7 +3263,7 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) numrows = mp_get_player_rankings(rankings); } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Gap from last item to bottom of dialog + header height #if VERSION >= VERSION_JPN_FINAL @@ -3298,7 +3298,7 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) text_measure(&textheight, &textwidth, lang_get(L_MPMENU_277), g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); x = (context->x - textwidth) + 91; y = context->y + 1; - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPMENU_277), g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPMENU_277), g_CharsHandelGothicXs, g_FontHandelGothicXs, textcolour, context->width, context->height, 0, 0); } @@ -3306,9 +3306,9 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) text_measure(&textheight, &textwidth, lang_get(L_MPMENU_278), g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); x = (context->x - textwidth) + 120; y = context->y + 1; - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPMENU_278), g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPMENU_278), g_CharsHandelGothicXs, g_FontHandelGothicXs, textcolour, context->width, context->height, 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); dialog = context->dialog; @@ -3351,8 +3351,8 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) gDPPipeSync(gdl++); #if VERSION >= VERSION_NTSC_1_0 - g_ScissorX1 = context->x * g_ScaleX; - g_ScissorX2 = (context->x + context->width) * g_ScaleX; + g_ScissorX1 = context->x * g_UiScaleX; + g_ScissorX2 = (context->x + context->width) * g_UiScaleX; g_ScissorY1 = context->y + (VERSION == VERSION_JPN_FINAL ? 14 : 10); g_ScissorY2 = context->y + context->height - 1; @@ -3399,13 +3399,13 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) gDPSetScissor(gdl++, G_SC_NON_INTERLACE, g_ScissorX1, g_ScissorY1, g_ScissorX2, g_ScissorY2); #else gDPSetScissor(gdl++, G_SC_NON_INTERLACE, - context->x * g_ScaleX, + context->x * g_UiScaleX, context->y + 10, - (context->x + context->width) * g_ScaleX, + (context->x + context->width) * g_UiScaleX, context->y + context->height - 1); #endif - gdl = text0f153628(gdl); + gdl = text_begin(gdl); for (i = 0; i < numrows; i++) { struct ranking *ranking = &rankings[i]; @@ -3429,10 +3429,10 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) #endif if (team) { - gdl = text_render_projected(gdl, &x, &y, g_BossFile.teamnames[ranking->teamnum], + gdl = text_render_v2(gdl, &x, &y, g_BossFile.teamnames[ranking->teamnum], g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0); } else { - gdl = text_render_projected(gdl, &x, &y, ranking->mpchr->name, + gdl = text_render_v2(gdl, &x, &y, ranking->mpchr->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0); } @@ -3447,7 +3447,7 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) #else y = context->y + i * 10 - data->scrolloffset + 14; #endif - gdl = text_render_projected(gdl, &x, &y, valuebuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, valuebuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0); } @@ -3461,11 +3461,11 @@ Gfx *menuitem_ranking_render(Gfx *gdl, struct menurendercontext *context) #else y = context->y + i * 10 - data->scrolloffset + 14; #endif - gdl = text_render_projected(gdl, &x, &y, valuebuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, valuebuffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, textcolour, context->width, context->height, 0, 0); } - return text0f153780(gdl); + return text_end(gdl); } bool menuitem_ranking_tick(struct menuinputs *inputs, u32 tickflags, union menuitemdata *data) @@ -3528,7 +3528,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) mpchr = MPCHR(playernum); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Write selected player's name weight = menu_get_sin_osc_frac(40) * 255; @@ -3546,7 +3546,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) x = context->x + 2; y = context->y + 1; - gdl = text_render_projected(gdl, &x, &y, mpchr->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, mpchr->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, selectioncolour, context->width, context->height, 0, 0); // "Suicides" heading @@ -3571,7 +3571,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) #endif y = context->y + 1; - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPMENU_281), g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPMENU_281), g_CharsHandelGothicXs, g_FontHandelGothicXs, maincolour, context->width, context->height, 0, 0); // Num suicides @@ -3591,7 +3591,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) y++; #endif - gdl = text_render_projected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xffff00ff, context->width, context->height, 0, 0); // Move ypos past top row @@ -3619,7 +3619,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) text_measure(&textheight, &textwidth, lang_get(L_MPMENU_282), g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); x = context->x - textwidth + 120; y = context->y + ypos; - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPMENU_282), g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPMENU_282), g_CharsHandelGothicXs, g_FontHandelGothicXs, maincolour, context->width, context->height, 0, 0); // "Kills" heading @@ -3632,7 +3632,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) #endif y = context->y + ypos; - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPMENU_283), g_CharsHandelGothicXs, g_FontHandelGothicXs, + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPMENU_283), g_CharsHandelGothicXs, g_FontHandelGothicXs, maincolour, context->width, context->height, 0, 0); // Move ypos past heading row @@ -3661,8 +3661,8 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) gDPPipeSync(gdl++); #if VERSION >= VERSION_NTSC_1_0 - g_ScissorX1 = context->x * g_ScaleX; - g_ScissorX2 = (context->x + context->width) * g_ScaleX; + g_ScissorX1 = context->x * g_UiScaleX; + g_ScissorX2 = (context->x + context->width) * g_UiScaleX; g_ScissorY1 = context->y + ypos; g_ScissorY2 = context->y + context->height; @@ -3709,9 +3709,9 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) gDPSetScissor(gdl++, G_SC_NON_INTERLACE, g_ScissorX1, g_ScissorY1, g_ScissorX2, g_ScissorY2); #else gDPSetScissor(gdl++, G_SC_NON_INTERLACE, - context->x * g_ScaleX, + context->x * g_UiScaleX, context->y + ypos, - (context->x + context->width) * g_ScaleX, + (context->x + context->width) * g_UiScaleX, context->y + context->height); #endif @@ -3725,7 +3725,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) // Name x = context->x + 29; y = context->y + ypos; - gdl = text_render_projected(gdl, &x, &y, loopmpchr->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, loopmpchr->name, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0x00ffffff, context->width, context->height, 0, 0); // Num deaths @@ -3733,7 +3733,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) text_measure(&textheight, &textwidth, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = context->x - textwidth + 120; y = context->y + ypos; - gdl = text_render_projected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff4040ff, context->width, context->height, 0, 0); // Num kills @@ -3747,7 +3747,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) #endif y = context->y + ypos; - gdl = text_render_projected(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, + gdl = text_render_v2(gdl, &x, &y, buffer, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0x00ff00ff, context->width, context->height, 0, 0); #if VERSION == VERSION_JPN_FINAL @@ -3760,7 +3760,7 @@ Gfx *menuitem_player_stats_render(Gfx *gdl, struct menurendercontext *context) } } - return text0f153780(gdl); + return text_end(gdl); } bool menuitem_player_stats_tick(struct menuitem *item, struct menudialog *dialog, struct menuinputs *inputs, u32 tickflags, union menuitemdata *data) @@ -3820,12 +3820,12 @@ Gfx *menuitem_controller_render_line(Gfx *gdl, s32 speed, s32 x1, s32 y1, s32 x2 speed = speed + (x1 % 4); gSPTextureRectangle(gdl++, - x1 * 4 * g_ScaleX, y1 * 4, - x2 * 4 * g_ScaleX, y2 * 4, + x1 * 4 * g_UiScaleX, y1 * 4, + x2 * 4 * g_UiScaleX, y2 * 4, G_TX_RENDERTILE, speed * 32, (y1 % 4) * 32, - 1024 / g_ScaleX, 1024); + 1024 / g_UiScaleX, 1024); return gdl; } @@ -3853,9 +3853,9 @@ Gfx *menuitem_controller_render_texture(Gfx *gdl, s32 x, s32 y, s32 texturenum, gDPSetColor(gdl++, G_SETENVCOLOR, 0xffffff00 | alpha); gSPTextureRectangle(gdl++, - (x << 2) * g_ScaleX, y << 2, - ((x + 32) << 2) * g_ScaleX, (y + 32) << 2, - 0, 16, 1008, 1024 / g_ScaleX, 0xfc00); + (x << 2) * g_UiScaleX, y << 2, + ((x + 32) << 2) * g_UiScaleX, (y + 32) << 2, + 0, 16, 1008, 1024 / g_UiScaleX, 0xfc00); return gdl; } @@ -4085,7 +4085,7 @@ Gfx *menuitem_controller_render_text(Gfx *gdl, s32 curmode, struct menurendercon s32 i; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); for (i = 0; i < ARRAYCOUNT(labels); i++) { #if VERSION == VERSION_JPN_FINAL @@ -4103,7 +4103,7 @@ Gfx *menuitem_controller_render_text(Gfx *gdl, s32 curmode, struct menurendercon #if VERSION < VERSION_NTSC_1_0 ry = i * 7 + context->y + pady; #endif - gdl = text_render_projected(gdl, &rx, &ry, lang_get(labels[i]), + gdl = text_render_v2(gdl, &rx, &ry, lang_get(labels[i]), g_CharsHandelGothicXs, g_FontHandelGothicXs, labelcolour, vi_get_width(), vi_get_height(), 0, 0); } @@ -4138,11 +4138,11 @@ Gfx *menuitem_controller_render_text(Gfx *gdl, s32 curmode, struct menurendercon colour |= 0xffffff00; } - gdl = text_render_projected(gdl, &rx, &ry, lang_get(textnum), + gdl = text_render_v2(gdl, &rx, &ry, lang_get(textnum), g_CharsHandelGothicXs, g_FontHandelGothicXs, colour, vi_get_width(), vi_get_height(), 0, 0); } - return text0f153780(gdl); + return text_end(gdl); } Gfx *menuitem_controller_render_pad(Gfx *gdl, struct menurendercontext *context, s32 padx, s32 pady, s32 curmode, u32 alpha, u32 colour1, u32 colour2, s8 prevmode) @@ -4233,7 +4233,7 @@ Gfx *menuitem_controller_render(Gfx *gdl, struct menurendercontext *context) textalpha = data->textfadetimer; contalpha = data->contfadetimer; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if (dialog->transitionfrac < 0) { colour = g_MenuColours[dialog->type].item_unfocused; @@ -4264,9 +4264,9 @@ Gfx *menuitem_controller_render(Gfx *gdl, struct menurendercontext *context) x = context->x + 2; y = context->y + 2; - gdl = text_render_projected(gdl, &x, &y, text, + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); textcolour = colour_blend(colour, colour & 0xffffff00, textalpha); colour = colour_blend(colour, colour & 0xffffff00, contalpha); @@ -4290,10 +4290,10 @@ Gfx *menuitem_controller_render(Gfx *gdl, struct menurendercontext *context) y += 34; #endif - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, lang_get(L_MPWEAPONS_216), // "Hold weapon button for ..." + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, lang_get(L_MPWEAPONS_216), // "Hold weapon button for ..." g_CharsHandelGothicSm, g_FontHandelGothicSm, colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); } text_restore_blends(); diff --git a/src/game/menutick.c b/src/game/menutick.c index f22e82fe4..4899d8040 100644 --- a/src/game/menutick.c +++ b/src/game/menutick.c @@ -64,9 +64,9 @@ void menu_tick(void) s32 anyopen = false; #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else - g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + g_UiScaleX = g_ViRes == VIRES_HI ? 2 : 1; #endif menu_tick_timers(); @@ -750,6 +750,6 @@ void menu_tick(void) } } - g_ScaleX = 1; + g_UiScaleX = 1; g_MenuData.unk5d5_06 = sp344 ? true : false; } diff --git a/src/game/mplayer/ingame.c b/src/game/mplayer/ingame.c index c8c380a31..6c6a49e28 100644 --- a/src/game/mplayer/ingame.c +++ b/src/game/mplayer/ingame.c @@ -680,18 +680,18 @@ MenuItemHandlerResult mp_awards_menu_handler(s32 operation, struct menuitem *ite #if VERSION == VERSION_JPN_FINAL gSPTextureRectangle(gdl++, - (x << 2) * g_ScaleX, + (x << 2) * g_UiScaleX, (renderdata->y - 6) << 2, - ((x + 11) << 2) * g_ScaleX, + ((x + 11) << 2) * g_UiScaleX, (renderdata->y + 5) << 2, - G_TX_RENDERTILE, 0x0010, 0x0150, 1024 / g_ScaleX, -1024); + G_TX_RENDERTILE, 0x0010, 0x0150, 1024 / g_UiScaleX, -1024); #else gSPTextureRectangle(gdl++, - (x << 2) * g_ScaleX, + (x << 2) * g_UiScaleX, (renderdata->y - 2) << 2, - ((x + 11) << 2) * g_ScaleX, + ((x + 11) << 2) * g_UiScaleX, (renderdata->y + 9) << 2, - G_TX_RENDERTILE, 0x0010, 0x0150, 1024 / g_ScaleX, -1024); + G_TX_RENDERTILE, 0x0010, 0x0150, 1024 / g_UiScaleX, -1024); #endif x -= 14; diff --git a/src/game/mplayer/mplayer.c b/src/game/mplayer/mplayer.c index 4e1dabc1f..fc68e028c 100644 --- a/src/game/mplayer/mplayer.c +++ b/src/game/mplayer/mplayer.c @@ -1194,8 +1194,8 @@ void mp_set_paused(u8 mode) * Render "Paused" in the middle of the viewport if paused, * or "Press START" if player has finished their death animation. * - * @bug: When calling text_render(), vi_get_width() is used twice but it should be - * vi_get_view_width() and vi_get_view_height(). These arguments to text_render() set + * @bug: When calling text_render_v1(), vi_get_width() is used twice but it should be + * vi_get_view_width() and vi_get_view_height(). These arguments to text_render_v1() set * the crop box for the text, but the text doesn't extend past the box anyway * so it has no effect. */ @@ -1209,21 +1209,21 @@ Gfx *mp_render_modal_text(Gfx *gdl) s32 stack1; #if VERSION >= VERSION_JPN_FINAL - g_ScaleX = g_ViRes == VIRES_HI ? 2 : 1; + g_UiScaleX = g_ViRes == VIRES_HI ? 2 : 1; #endif if (g_MpSetup.paused == MPPAUSEMODE_PAUSED) { s32 red = (s32) ((1.0f - g_20SecIntervalFrac) * 20.0f * 255.0f) % 255; s32 stack2; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); strcpy(text, lang_get(L_MPWEAPONS_040)); // "Paused" x = vi_get_view_left() + vi_get_view_width() / 2; #if VERSION >= VERSION_JPN_FINAL - x = x / g_ScaleX; + x = x / g_UiScaleX; #endif #if VERSION >= VERSION_NTSC_1_0 @@ -1237,9 +1237,7 @@ Gfx *mp_render_modal_text(Gfx *gdl) y = vi_get_view_top() + vi_get_view_height() / 2; } -#if VERSION >= VERSION_JPN_FINAL - text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); -#elif PAL +#if VERSION >= VERSION_PAL_BETA // Use smaller fonts text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); #else @@ -1247,15 +1245,13 @@ Gfx *mp_render_modal_text(Gfx *gdl) #endif x -= textwidth / 2; -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, (red << 24) | 0x00ff00ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); -#elif PAL - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, (red << 24) | 0x00ff00ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); +#if VERSION >= VERSION_PAL_BETA + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, (red << 24) | 0x00ff00ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); #else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, (red << 24) | 0x00ff00ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, (red << 24) | 0x00ff00ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); #endif - gdl = text0f153780(gdl); + gdl = text_end(gdl); } else if (!g_MainIsEndscreen && g_MpSetup.paused == MPPAUSEMODE_UNPAUSED && g_Vars.currentplayer->isdead @@ -1265,14 +1261,14 @@ Gfx *mp_render_modal_text(Gfx *gdl) && !(g_Vars.antiplayernum >= 0 && ((g_Vars.currentplayer != g_Vars.anti || g_InCutscene))) && g_NumReasonsToEndMpMatch == 0) { // Render "Press START" text - gdl = text0f153628(gdl); + gdl = text_begin(gdl); strcpy(text, lang_get(L_MPWEAPONS_039)); x = vi_get_view_left() + vi_get_view_width() / 2; #if VERSION >= VERSION_JPN_FINAL - x = x / g_ScaleX; + x = x / g_UiScaleX; #endif y = vi_get_view_top() + vi_get_view_height() / 2; @@ -1280,11 +1276,7 @@ Gfx *mp_render_modal_text(Gfx *gdl) text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x -= textwidth / 2; -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff0000ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff0000ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); -#endif + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff0000ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); if (g_Vars.currentplayer->deadtimer > 0) { // Render countdown timer @@ -1292,7 +1284,7 @@ Gfx *mp_render_modal_text(Gfx *gdl) s32 countdownx = vi_get_view_left() + vi_get_view_width() / 2; #if VERSION >= VERSION_JPN_FINAL - countdownx = countdownx / g_ScaleX; + countdownx = countdownx / g_UiScaleX; #endif sprintf(text, "%d\n", (g_Vars.currentplayer->deadtimer + TICKS(60) - 1) / TICKS(60)); @@ -1300,20 +1292,16 @@ Gfx *mp_render_modal_text(Gfx *gdl) x = countdownx - textwidth / 2; y = countdowny; -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff0000ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff0000ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); -#endif + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0xff0000ff, 0x000000ff, vi_get_width(), vi_get_width(), 0, 0); } - gdl = text0f153780(gdl); + gdl = text_end(gdl); g_Menus[g_Vars.currentplayerstats->mpindex].openinhibit = 10; } #if VERSION >= VERSION_JPN_FINAL - g_ScaleX = 1; + g_UiScaleX = 1; #endif return gdl; diff --git a/src/game/mplayer/scenarios/hackthatmac.inc b/src/game/mplayer/scenarios/hackthatmac.inc index b9daac492..84aead486 100644 --- a/src/game/mplayer/scenarios/hackthatmac.inc +++ b/src/game/mplayer/scenarios/hackthatmac.inc @@ -592,13 +592,13 @@ Gfx *htm_render_hud(Gfx *gdl) barright = t6 + a1 / 2; s1 = barleft + (s32) (a1 * (dltime / TICKS(4800.0f))); - gdl = text0f153628(gdl); - gdl = text_set_prim_colour(gdl, 0x60000060); + gdl = text_begin(gdl); + gdl = text_begin_boxmode(gdl, 0x60000060); gDPFillRectangle(gdl++, barleft, viewtop + 8, barright, viewtop + 16); - gdl = text0f153838(gdl); - gdl = text_set_prim_colour(gdl, 0xc00000d0); + gdl = text_end_boxmode(gdl); + gdl = text_begin_boxmode(gdl, 0xc00000d0); v1 = barleft + 1; a0 = barleft; @@ -609,8 +609,8 @@ Gfx *htm_render_hud(Gfx *gdl) a0 += 2; } - gdl = text0f153838(gdl); - gdl = text0f153780(gdl); + gdl = text_end_boxmode(gdl); + gdl = text_end(gdl); } return gdl; diff --git a/src/game/mplayer/scenarios/holdthebriefcase.inc b/src/game/mplayer/scenarios/holdthebriefcase.inc index 996cec1b5..7c82ec89b 100644 --- a/src/game/mplayer/scenarios/holdthebriefcase.inc +++ b/src/game/mplayer/scenarios/holdthebriefcase.inc @@ -416,7 +416,7 @@ Gfx *htb_render_hud(Gfx *gdl) sprintf(text, "%d:%02d", mins, secs); #endif - gdl = text0f153628(gdl); + gdl = text_begin(gdl); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); x -= textwidth / 2; @@ -424,14 +424,14 @@ Gfx *htb_render_hud(Gfx *gdl) textheight += y; #if VERSION >= VERSION_NTSC_1_0 - gdl = text0f153990(gdl, x, y, textwidth, textheight); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0xa0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_textbox(gdl, x, y, textwidth, textheight); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0xa0, vi_get_width(), vi_get_height(), 0, 0); #else - gdl = text0f153858(gdl, &x, &y, &textwidth, &textheight); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x88, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textwidth, &textheight); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x88, vi_get_width(), vi_get_height(), 0, 0); #endif - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return gdl; diff --git a/src/game/mplayer/scenarios/kingofthehill.inc b/src/game/mplayer/scenarios/kingofthehill.inc index 9262dd44a..d60402195 100644 --- a/src/game/mplayer/scenarios/kingofthehill.inc +++ b/src/game/mplayer/scenarios/kingofthehill.inc @@ -582,7 +582,7 @@ Gfx *koh_render_hud(Gfx *gdl) sprintf(text, "%02d", secs); } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); x -= textwidth / 2; @@ -590,13 +590,13 @@ Gfx *koh_render_hud(Gfx *gdl) textheight += y; #if VERSION >= VERSION_NTSC_1_0 - gdl = text0f153990(gdl, x, y, textwidth, textheight); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0xa0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_textbox(gdl, x, y, textwidth, textheight); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0xa0, vi_get_width(), vi_get_height(), 0, 0); #else - gdl = text0f153858(gdl, &x, &y, &textwidth, &textheight); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x88, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textwidth, &textheight); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x88, vi_get_width(), vi_get_height(), 0, 0); #endif - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return gdl; diff --git a/src/game/mplayer/scenarios/popacap.inc b/src/game/mplayer/scenarios/popacap.inc index 1f1c86bef..859dcee82 100644 --- a/src/game/mplayer/scenarios/popacap.inc +++ b/src/game/mplayer/scenarios/popacap.inc @@ -311,7 +311,7 @@ Gfx *pac_render_hud(Gfx *gdl) secs = (time240 + (TICKS(240) - 1)) / TICKS(240); sprintf(text, "%d:%02d", mins, secs); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); x -= textwidth / 2; @@ -319,13 +319,13 @@ Gfx *pac_render_hud(Gfx *gdl) textheight += y; #if VERSION >= VERSION_NTSC_1_0 - gdl = text0f153990(gdl, x, y, textwidth, textheight); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0xa0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_textbox(gdl, x, y, textwidth, textheight); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0xa0, vi_get_width(), vi_get_height(), 0, 0); #else - gdl = text0f153858(gdl, &x, &y, &textwidth, &textheight); - gdl = text_render(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x88, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textwidth, &textheight); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x88, vi_get_width(), vi_get_height(), 0, 0); #endif - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return gdl; diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index 5c7c45412..160f72f28 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -711,15 +711,15 @@ MenuItemHandlerResult mp_challenges_list_handler(s32 operation, struct menuitem x = renderdata->x + 10; y = renderdata->y + 1; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); name = challenge_get_name2(g_MpPlayerNum, challengeindex); - gdl = text_render_projected(gdl, &x, &y, name, + gdl = text_render_v2(gdl, &x, &y, name, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); gDPPipeSync(gdl++); gDPSetTexturePersp(gdl++, G_TP_NONE); @@ -754,12 +754,12 @@ MenuItemHandlerResult mp_challenges_list_handler(s32 operation, struct menuitem TEXEL0, 0, ENVIRONMENT, 0); gSPTextureRectangle(gdl++, - ((renderdata->x + loopx) << 2) * g_ScaleX, + ((renderdata->x + loopx) << 2) * g_UiScaleX, (renderdata->y + size) << 2, - ((renderdata->x + size + loopx) << 2) * g_ScaleX, + ((renderdata->x + size + loopx) << 2) * g_UiScaleX, (renderdata->y + size * 2) << 2, G_TX_RENDERTILE, - 0, 0x0160, 0x0400 / g_ScaleX, 0xfc00); + 0, 0x0160, 0x0400 / g_UiScaleX, 0xfc00); loopx += 13; } @@ -994,9 +994,9 @@ MenuItemHandlerResult mp_medal_menu_handler(s32 operation, struct menuitem *item TEXEL0, 0, ENVIRONMENT, 0); gSPTextureRectangle(gdl++, - ((renderdata->x + 9) << 2) * g_ScaleX, renderdata->y << 2, - ((renderdata->x + 20) << 2) * g_ScaleX, (renderdata->y + 11) << 2, - G_TX_RENDERTILE, 0, 0x0160, 1024 / g_ScaleX, -1024); + ((renderdata->x + 9) << 2) * g_UiScaleX, renderdata->y << 2, + ((renderdata->x + 20) << 2) * g_UiScaleX, (renderdata->y + 11) << 2, + G_TX_RENDERTILE, 0, 0x0160, 1024 / g_UiScaleX, -1024); return (s32) gdl; } @@ -4526,9 +4526,9 @@ MenuItemHandlerResult mp_challenges_list_menu_handler(s32 operation, struct menu x = renderdata->x + 10; y = renderdata->y + 1; - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, challenge_get_name_by_slot(data->type19.unk04), g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, challenge_get_name_by_slot(data->type19.unk04), g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_end(gdl); gDPPipeSync(gdl++); gDPSetTexturePersp(gdl++, G_TP_NONE); @@ -4563,9 +4563,9 @@ MenuItemHandlerResult mp_challenges_list_menu_handler(s32 operation, struct menu TEXEL0, 0, ENVIRONMENT, 0); gSPTextureRectangle(gdl++, - ((renderdata->x + marginleft) << 2) * g_ScaleX, (renderdata->y + 11) << 2, - ((renderdata->x + marginleft + 11) << 2) * g_ScaleX, (renderdata->y + 22) << 2, - G_TX_RENDERTILE, 0, 0x0160, 1024 / g_ScaleX, -1024); + ((renderdata->x + marginleft) << 2) * g_UiScaleX, (renderdata->y + 11) << 2, + ((renderdata->x + marginleft + 11) << 2) * g_UiScaleX, (renderdata->y + 22) << 2, + G_TX_RENDERTILE, 0, 0x0160, 1024 / g_UiScaleX, -1024); marginleft += 13; } diff --git a/src/game/player.c b/src/game/player.c index b69a7bfe1..4e71139d6 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -3117,7 +3117,7 @@ void player_configure_vi(void) f32 ratio = player_get_aspect_ratio(); g_ViRes = VIRES_LO; - text0f1531dc(false); + text_set_hires(false); #if VERSION >= VERSION_JPN_FINAL var800800f0jf = 0; @@ -3149,12 +3149,12 @@ void player_tick(bool arg0) } #if PAL - text0f1531dc(false); + text_set_hires(false); #else if (g_ViRes == VIRES_HI) { - text0f1531dc(true); + text_set_hires(true); } else { - text0f1531dc(false); + text_set_hires(false); } #endif @@ -4526,9 +4526,9 @@ Gfx *player_render_hud(Gfx *gdl) s32 c = vi_get_view_left() + vi_get_view_width(); s32 d = vi_get_view_top() + vi_get_view_height(); - gdl = text0f153628(gdl); - gdl = text0f153a34(gdl, a, b, c, d, 0x000000a0); - gdl = text0f153780(gdl); + gdl = text_begin(gdl); + gdl = text_draw_box(gdl, a, b, c, d, 0x000000a0); + gdl = text_end(gdl); } if (g_Vars.currentplayer->cameramode != CAMERAMODE_EYESPY @@ -4776,9 +4776,9 @@ Gfx *player_render_hud(Gfx *gdl) s32 c = vi_get_view_left() + vi_get_view_width(); s32 d = vi_get_view_top() + vi_get_view_height(); - gdl = text0f153628(gdl); - gdl = text0f153a34(gdl, a, b, c, d, 0x000000a0); - gdl = text0f153780(gdl); + gdl = text_begin(gdl); + gdl = text_draw_box(gdl, a, b, c, d, 0x000000a0); + gdl = text_end(gdl); } gdl = hudmsgs_render(gdl); diff --git a/src/game/propobj.c b/src/game/propobj.c index 2f6974f0d..29a54cc69 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -20931,7 +20931,7 @@ Gfx *countdown_timer_render(Gfx *gdl) secs = (s32)floorf(value60 * (1.0f / 60.0f)) - mins * 60; ms = (s32)floorf(value60 * 1.6666666269302f) - mins * 6000 - secs * 100; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); gdl = bgun_draw_hud_integer(gdl, (mins % 100) / 10, viewright - 18, HUDHALIGN_MIDDLE, y, HUDVALIGN_MIDDLE, 0x00ff00a0); gdl = bgun_draw_hud_integer(gdl, mins % 10, viewright - 14, HUDHALIGN_MIDDLE, y, HUDVALIGN_MIDDLE, 0x00ff00a0); gdl = bgun_draw_hud_string(gdl, fmt, viewright - 8, HUDHALIGN_MIDDLE, y, HUDVALIGN_MIDDLE, 0x00ff00a0); @@ -20940,7 +20940,7 @@ Gfx *countdown_timer_render(Gfx *gdl) gdl = bgun_draw_hud_string(gdl, fmt, viewright + 8, HUDHALIGN_MIDDLE, y, HUDVALIGN_MIDDLE, 0x00ff00a0); gdl = bgun_draw_hud_integer(gdl, (ms % 100) / 10, viewright + 14, HUDHALIGN_MIDDLE, y, HUDVALIGN_MIDDLE, 0x00ff00a0); gdl = bgun_draw_hud_integer(gdl, ms % 10, viewright + 18, HUDHALIGN_MIDDLE, y, HUDVALIGN_MIDDLE, 0x00ff00a0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return gdl; diff --git a/src/game/radar.c b/src/game/radar.c index 56bd407ba..464c44066 100644 --- a/src/game/radar.c +++ b/src/game/radar.c @@ -70,14 +70,14 @@ Gfx *radar_render_background(Gfx *gdl, struct textureconfig *tconfig, s32 arg2, gDPSetPrimColorViaWord(gdl++, 0, 0, 0x00000000); gDPFillRectangle(gdl++, - arg2 * g_ScaleX, + arg2 * g_UiScaleX, arg3, - (arg2 + tconfig->width) * g_ScaleX, + (arg2 + tconfig->width) * g_UiScaleX, arg3 + tconfig->width); - spb0[0] = arg2 * g_ScaleX; + spb0[0] = arg2 * g_UiScaleX; spb0[1] = arg3; - spa8[0] = arg4 * g_ScaleX; + spa8[0] = arg4 * g_UiScaleX; spa8[1] = arg4; tex_select(&gdl, tconfig, 2, 0, 0, 1, NULL); @@ -147,94 +147,94 @@ Gfx *radar_draw_dot(Gfx *gdl, struct prop *prop, struct coord *dist, u32 colour1 if (swapcolours) { if (prop == g_Vars.currentplayer->prop) { // Box - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 2, y + 2, x + 1, y + 3); gDPFillRectangleScaled(gdl++, x - 3, y - 1, x + 2, y + 2); gDPFillRectangleScaled(gdl++, x - 2, y - 2, x + 1, y - 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 1, y + 1, x + 0, y + 2); gDPFillRectangleScaled(gdl++, x - 2, y + 0, x + 1, y + 1); gDPFillRectangleScaled(gdl++, x - 1, y - 1, x + 0, y + 0); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } else if (g_RadarYIndicatorsEnabled && dist->y > 250) { // Up triangle - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 3, y - 1, x + 2, y + 2); gDPFillRectangleScaled(gdl++, x - 2, y - 2, x + 1, y - 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 2, y + 0, x + 1, y + 1); gDPFillRectangleScaled(gdl++, x - 1, y - 1, x + 0, y + 0); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } else if (g_RadarYIndicatorsEnabled && dist->y < -250) { // Down triangle - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 3, y - 2, x + 2, y + 1); gDPFillRectangleScaled(gdl++, x - 2, y + 1, x + 1, y + 2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 2, y - 1, x + 1, y + 0); gDPFillRectangleScaled(gdl++, x - 1, y + 0, x + 0, y + 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } else { // Dot - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 2, y - 2, x + 2, y + 2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 1, y - 1, x + 1, y + 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } } else { if (prop == g_Vars.currentplayer->prop) { // Box - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 2, y + 2, x + 1, y + 3); gDPFillRectangleScaled(gdl++, x - 3, y - 1, x + 2, y + 2); gDPFillRectangleScaled(gdl++, x - 2, y - 2, x + 1, y - 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 1, y + 1, x + 0, y + 2); gDPFillRectangleScaled(gdl++, x - 2, y + 0, x + 1, y + 1); gDPFillRectangleScaled(gdl++, x - 1, y - 1, x + 0, y + 0); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } else if (g_RadarYIndicatorsEnabled && dist->y > 250) { // Up triangle - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 3, y - 1, x + 2, y + 2); gDPFillRectangleScaled(gdl++, x - 2, y - 2, x + 1, y - 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 2, y + 0, x + 1, y + 1); gDPFillRectangleScaled(gdl++, x - 1, y - 1, x + 0, y + 0); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } else if (g_RadarYIndicatorsEnabled && dist->y < -250) { // Down triangle - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 3, y - 2, x + 2, y + 1); gDPFillRectangleScaled(gdl++, x - 2, y + 1, x + 1, y + 2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 2, y - 1, x + 1, y + 0); gDPFillRectangleScaled(gdl++, x - 1, y + 0, x + 0, y + 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } else { // Dot - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour2); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour2); gDPFillRectangleScaled(gdl++, x - 2, y - 2, x + 2, y + 2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, (0xff >> shiftamount) + colour1); + gdl = text_begin_boxmode(gdl, (0xff >> shiftamount) + colour1); gDPFillRectangleScaled(gdl++, x - 1, y - 1, x + 1, y + 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); } } @@ -275,16 +275,16 @@ Gfx *radar_render(Gfx *gdl) } #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else if (g_ViRes == VIRES_HI) { - g_ScaleX = 2; + g_UiScaleX = 2; } else { - g_ScaleX = 1; + g_UiScaleX = 1; } #endif - g_RadarX = (vi_get_view_left() + vi_get_view_width()) / g_ScaleX - 41; + g_RadarX = (vi_get_view_left() + vi_get_view_width()) / g_UiScaleX - 41; if (playercount == 2) { if (IS4MB() || options_get_screen_split() == SCREENSPLIT_VERTICAL) { @@ -414,7 +414,7 @@ Gfx *radar_render(Gfx *gdl) gdl = radar_draw_dot(gdl, g_Vars.currentplayer->prop, &pos, colour, 0, 0); } - g_ScaleX = 1; + g_UiScaleX = 1; return gdl; } diff --git a/src/game/savebuffer.c b/src/game/savebuffer.c index eda776feb..f3f04ed65 100644 --- a/src/game/savebuffer.c +++ b/src/game/savebuffer.c @@ -41,7 +41,7 @@ void func0f0d4690(Mtxf *mtx) mtx4_set_translation(&pos, mtx); mtx00015e4c(-1, mtx); - if (g_ScaleX == 2) { + if (g_UiScaleX == 2) { mtx00015df0(2, mtx); } } diff --git a/src/game/sight.c b/src/game/sight.c index 0961709d4..fbb2c95c4 100644 --- a/src/game/sight.c +++ b/src/game/sight.c @@ -343,9 +343,9 @@ s32 sight_calculate_box_bound(s32 targetx, s32 viewleft, s32 timeelapsed, s32 ti */ Gfx *sight_draw_target_box(Gfx *gdl, struct trackedprop *trackedprop, s32 textid, s32 time) { - s32 viewleft = vi_get_view_left() / g_ScaleX; + s32 viewleft = vi_get_view_left() / g_UiScaleX; s32 viewtop = vi_get_view_top(); - s32 viewwidth = vi_get_view_width() / g_ScaleX; + s32 viewwidth = vi_get_view_width() / g_UiScaleX; s32 viewheight = vi_get_view_height(); s32 viewright = viewleft + viewwidth - 1; s32 viewbottom = viewtop + viewheight - 1; @@ -360,15 +360,15 @@ Gfx *sight_draw_target_box(Gfx *gdl, struct trackedprop *trackedprop, s32 textid time = TICKS(512); } - boxleft = sight_calculate_box_bound(trackedprop->x1 / g_ScaleX, viewleft, time, TICKS(80)); + boxleft = sight_calculate_box_bound(trackedprop->x1 / g_UiScaleX, viewleft, time, TICKS(80)); boxtop = sight_calculate_box_bound(trackedprop->y1, viewtop, time, TICKS(80)); - boxright = sight_calculate_box_bound(trackedprop->x2 / g_ScaleX, viewright, time, TICKS(80)); + boxright = sight_calculate_box_bound(trackedprop->x2 / g_UiScaleX, viewright, time, TICKS(80)); boxbottom = sight_calculate_box_bound(trackedprop->y2, viewbottom, time, TICKS(80)); if (trackedprop->prop) { colour = sight_is_prop_friendly(trackedprop->prop) ? 0x000ff60 : 0xff000060; - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); // Left if (boxleft >= viewleft && boxleft <= viewright && boxtop <= viewbottom && boxbottom >= viewtop) { @@ -402,7 +402,7 @@ Gfx *sight_draw_target_box(Gfx *gdl, struct trackedprop *trackedprop, s32 textid (boxright < viewright ? boxright : viewright), boxbottom); } - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); if (textid != 0 && textonscreen) { s32 x = boxright + 3; @@ -414,14 +414,10 @@ Gfx *sight_draw_target_box(Gfx *gdl, struct trackedprop *trackedprop, s32 textid // textid 1 writes '0' label[0] = textid + 0x2f; - gdl = text_render(gdl, &x, &y, label, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v1(gdl, &x, &y, label, g_CharsNumeric, g_FontNumeric, 0x00ff00a0, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); } else { char *text = lang_get(textid); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); -#endif + gdl = text_render_vx(gdl, &x, &y, text, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); } } } @@ -431,14 +427,14 @@ Gfx *sight_draw_target_box(Gfx *gdl, struct trackedprop *trackedprop, s32 textid Gfx *sight_draw_aimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 colour) { - s32 viewleft = vi_get_view_left() / g_ScaleX; + s32 viewleft = vi_get_view_left() / g_UiScaleX; s32 viewtop = vi_get_view_top(); - s32 viewwidth = vi_get_view_width() / g_ScaleX; + s32 viewwidth = vi_get_view_width() / g_UiScaleX; s32 viewheight = vi_get_view_height(); s32 viewright = viewleft + viewwidth - 1; s32 viewbottom = viewtop + viewheight - 1; - gdl = text_set_prim_colour(gdl, 0x00ff0028); + gdl = text_begin_boxmode(gdl, 0x00ff0028); // Draw the lines that span most of the viewport if (PLAYERCOUNT() == 1) { @@ -453,8 +449,8 @@ Gfx *sight_draw_aimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 col gDPHudRectangle(gdl++, x, y + radius - 2, x, viewbottom); } - gdl = text0f153838(gdl); - gdl = text_set_prim_colour(gdl, colour); + gdl = text_end_boxmode(gdl); + gdl = text_begin_boxmode(gdl, colour); // Draw the box gDPHudRectangle(gdl++, x - radius, y - radius, x - radius, y + radius); @@ -472,7 +468,7 @@ Gfx *sight_draw_aimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, u32 col gDPHudRectangle(gdl++, x - radius, y + radius, x - cornergap, y + radius); gDPHudRectangle(gdl++, x + cornergap, y + radius, x + radius, y + radius); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } @@ -584,16 +580,16 @@ Gfx *sight_draw_delayed_aimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, boxx = xpos; boxy = ypos; - gdl = text_set_prim_colour(gdl, 0x00ff0028); + gdl = text_begin_boxmode(gdl, 0x00ff0028); // Fill a 3x3 box at the live crosshair gDPHudRectangle(gdl++, x - 1, y - 1, x + 1, y - 1); gDPHudRectangle(gdl++, x - 1, y + 0, x + 1, y + 0); gDPHudRectangle(gdl++, x - 1, y + 1, x + 1, y + 1); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); // Draw the box gDPHudRectangle(gdl++, boxx - radius, boxy - radius, boxx - radius, boxy + radius); @@ -611,7 +607,7 @@ Gfx *sight_draw_delayed_aimer(Gfx *gdl, s32 x, s32 y, s32 radius, s32 cornergap, gDPHudRectangle(gdl++, boxx - radius, boxy + radius, boxx - cornergap, boxy + radius); gDPHudRectangle(gdl++, boxx + cornergap, boxy + radius, boxx + radius, boxy + radius); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } @@ -621,7 +617,7 @@ Gfx *sight_draw_default(Gfx *gdl, bool sighton) s32 radius; s32 cornergap; u32 colour; - s32 x = (s32) g_Vars.currentplayer->crosspos[0] / g_ScaleX; + s32 x = (s32) g_Vars.currentplayer->crosspos[0] / g_UiScaleX; s32 y = g_Vars.currentplayer->crosspos[1]; struct trackedprop *trackedprop; s32 i; @@ -629,7 +625,7 @@ Gfx *sight_draw_default(Gfx *gdl, bool sighton) static s32 sight = 0; static s32 identifytimer = 0; - gdl = text0f153628(gdl); + gdl = text_begin(gdl); if (1); @@ -693,15 +689,9 @@ Gfx *sight_draw_default(Gfx *gdl, bool sighton) if (identifytimer & 0x80) { // "Identify" -#if VERSION == VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &textx, &texty, lang_get(L_MISC_439), + gdl = text_render_vx(gdl, &textx, &texty, lang_get(L_MISC_439), g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, vi_get_width(), vi_get_height(), 0, 0); -#else - gdl = text_render(gdl, &textx, &texty, lang_get(L_MISC_439), - g_CharsHandelGothicXs, g_FontHandelGothicXs, 0x00ff00a0, 0x000000a0, - vi_get_width(), vi_get_height(), 0, 0); -#endif } gdl = sight_draw_aimer(gdl, x, y, radius, cornergap, colour); @@ -807,7 +797,7 @@ Gfx *sight_draw_default(Gfx *gdl, bool sighton) break; } - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } @@ -851,7 +841,7 @@ Gfx *sight_draw_classic(Gfx *gdl, bool sighton) spc4[0] = x; spc4[1] = y; - spbc[0] = (tconfig->width >> 1) * (f32)g_ScaleX; + spbc[0] = (tconfig->width >> 1) * (f32)g_UiScaleX; spbc[1] = tconfig->height >> 1; tex_select(&gdl, tconfig, 2, 0, 0, 1, NULL); @@ -965,15 +955,15 @@ Gfx *sight_draw_skedar_triangle(Gfx *gdl, s32 x, s32 y, s32 dir, u32 colour) Gfx *sight_draw_skedar(Gfx *gdl, bool sighton) { - s32 viewleft = vi_get_view_left() / g_ScaleX; + s32 viewleft = vi_get_view_left() / g_UiScaleX; s32 viewtop = vi_get_view_top(); - s32 viewwidth = vi_get_view_width() / g_ScaleX; + s32 viewwidth = vi_get_view_width() / g_UiScaleX; s32 viewheight = vi_get_view_height(); s32 viewright = viewleft + viewwidth - 1; s32 viewbottom = viewtop + viewheight - 1; s32 paddingy = viewheight / 4; s32 paddingx = viewwidth / 4; - s32 x = (s32) (g_Vars.currentplayer->crosspos[0] / g_ScaleX); + s32 x = (s32) (g_Vars.currentplayer->crosspos[0] / g_UiScaleX); s32 trix1; s32 trix2; s32 y = g_Vars.currentplayer->crosspos[1]; @@ -1149,9 +1139,9 @@ Gfx *sight_draw_skedar(Gfx *gdl, bool sighton) Gfx *sight_draw_zoom(Gfx *gdl, bool sighton) { - s32 viewleft = vi_get_view_left() / g_ScaleX; + s32 viewleft = vi_get_view_left() / g_UiScaleX; s32 viewtop = vi_get_view_top(); - s32 viewhalfwidth = (vi_get_view_width() / g_ScaleX) >> 1; + s32 viewhalfwidth = (vi_get_view_width() / g_UiScaleX) >> 1; s32 viewhalfheight = vi_get_view_height() >> 1; s32 viewright = viewleft + viewhalfwidth * 2 - 1; s32 viewbottom = viewtop + viewhalfheight * 2 - 1; @@ -1198,8 +1188,8 @@ Gfx *sight_draw_zoom(Gfx *gdl, bool sighton) } if (showzoomrange) { - gdl = text0f153628(gdl); - gdl = text_set_prim_colour(gdl, 0x00ff0028); + gdl = text_begin(gdl); + gdl = text_begin_boxmode(gdl, 0x00ff0028); if (frac < 0.2f) { cornerwidth *= 0.2f; @@ -1276,8 +1266,8 @@ Gfx *sight_draw_zoom(Gfx *gdl, bool sighton) gDPHudRectangle(gdl++, BOXRIGHT - cornerwidth, BOXBOTTOM, BOXRIGHT, BOXBOTTOM); gDPHudRectangle(gdl++, BOXRIGHT, BOXBOTTOM - cornerheight, BOXRIGHT, BOXBOTTOM); - gdl = text0f153838(gdl); - gdl = text0f153780(gdl); + gdl = text_end_boxmode(gdl); + gdl = text_end(gdl); } gdl = sight_draw_default(gdl, sighton); @@ -1287,13 +1277,13 @@ Gfx *sight_draw_zoom(Gfx *gdl, bool sighton) Gfx *sight_draw_maian(Gfx *gdl, bool sighton) { - s32 viewleft = vi_get_view_left() / g_ScaleX; + s32 viewleft = vi_get_view_left() / g_UiScaleX; s32 viewtop = vi_get_view_top(); - s32 viewwidth = vi_get_view_width() / g_ScaleX; + s32 viewwidth = vi_get_view_width() / g_UiScaleX; s32 viewheight = vi_get_view_height(); s32 viewright = viewleft + viewwidth - 1; s32 viewbottom = viewtop + viewheight - 1; - s32 x = (s32)g_Vars.currentplayer->crosspos[0] / g_ScaleX; + s32 x = (s32)g_Vars.currentplayer->crosspos[0] / g_UiScaleX; s32 y = g_Vars.currentplayer->crosspos[1]; Vtx *vertices; Col *colours; @@ -1369,7 +1359,7 @@ Gfx *sight_draw_maian(Gfx *gdl, bool sighton) gSPTri4(gdl++, 0, 4, 5, 5, 3, 6, 7, 6, 1, 4, 7, 2); gdl = func0f0d49c8(gdl); - gdl = text_set_prim_colour(gdl, 0x00ff0028); + gdl = text_begin_boxmode(gdl, 0x00ff0028); // Draw border over inner points gDPHudRectangle(gdl++, x - 4, y - 4, x - 4, y + 4); // left @@ -1377,14 +1367,14 @@ Gfx *sight_draw_maian(Gfx *gdl, bool sighton) gDPHudRectangle(gdl++, x - 4, y - 4, x + 4, y - 4); // top gDPHudRectangle(gdl++, x - 4, y + 4, x + 4, y + 4); // bottom - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } Gfx *sight_draw_target(Gfx *gdl) { - s32 x = (s32)g_Vars.currentplayer->crosspos[0] / g_ScaleX; + s32 x = (s32)g_Vars.currentplayer->crosspos[0] / g_UiScaleX; s32 y = g_Vars.currentplayer->crosspos[1]; static u32 var80070f9c = 0x00ff00ff; @@ -1393,7 +1383,7 @@ Gfx *sight_draw_target(Gfx *gdl) main_override_variable("sout", &var80070f9c); main_override_variable("sin", &var80070fa0); - gdl = text_set_prim_colour(gdl, 0x00ff0028); + gdl = text_begin_boxmode(gdl, 0x00ff0028); gDPHudRectangle(gdl++, x + 2, y + 0, x + 6, y + 0); gDPHudRectangle(gdl++, x + 2, y + 0, x + 4, y + 0); @@ -1404,7 +1394,7 @@ Gfx *sight_draw_target(Gfx *gdl) gDPHudRectangle(gdl++, x + 0, y - 6, x + 0, y - 2); gDPHudRectangle(gdl++, x + 0, y - 4, x + 0, y - 2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } @@ -1434,12 +1424,12 @@ Gfx *sight_draw(Gfx *gdl, bool sighton, s32 sight) } #if PAL - g_ScaleX = 1; + g_UiScaleX = 1; #else if (g_ViRes == VIRES_HI) { - g_ScaleX = 2; + g_UiScaleX = 2; } else { - g_ScaleX = 1; + g_UiScaleX = 1; } #endif @@ -1485,7 +1475,7 @@ Gfx *sight_draw(Gfx *gdl, bool sighton, s32 sight) } } - g_ScaleX = 1; + g_UiScaleX = 1; return gdl; } diff --git a/src/game/stars.c b/src/game/stars.c index f6df78227..ea1474c9e 100644 --- a/src/game/stars.c +++ b/src/game/stars.c @@ -262,7 +262,7 @@ Gfx *stars_render(Gfx *gdl) sp148.f[1] = g_Vars.currentplayer->cam_look.f[1]; sp148.f[2] = g_Vars.currentplayer->cam_look.f[2]; - gdl = text_set_prim_colour(gdl, 0xffffffff); + gdl = text_begin_boxmode(gdl, 0xffffffff); gDPSetRenderMode(gdl++, G_RM_CLD_SURF, G_RM_CLD_SURF2); @@ -330,7 +330,7 @@ Gfx *stars_render(Gfx *gdl) } } - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } diff --git a/src/game/text.c b/src/game/text.c index b372ca41f..5076d987c 100644 --- a/src/game/text.c +++ b/src/game/text.c @@ -57,8 +57,8 @@ s32 g_JpnKerning[13 * 13]; #endif struct blendsettings g_Blend; -Gfx *var800a4634; -Gfx *var800a4638; +Gfx *g_TextHoloRayGdl; +Gfx *g_TextHoloRayGdlEnd; #if VERSION == VERSION_JPN_FINAL struct fontchar g_TmpJpnChar; #endif @@ -66,29 +66,29 @@ u32 var800a463c; #if VERSION == VERSION_JPN_FINAL s32 var800800f0jf = 0; -s32 g_ScaleX = 1; +s32 g_UiScaleX = 1; bool var80080104jf = false; -s32 var8007fac4 = 0; +s32 g_TextCharOverlap = 0; bool g_TextRotated90 = false; s32 g_WrapIndentCount = 0; -s32 var8007fad0 = 1; +s32 g_TextScaleX = 1; s32 var80080108jf = 1; #else -s32 g_ScaleX = 1; -s32 var8007fac4 = 0; +s32 g_UiScaleX = 1; +s32 g_TextCharOverlap = 0; bool g_TextRotated90 = false; s32 g_WrapIndentCount = 0; -s32 var8007fad0 = 1; +s32 g_TextScaleX = 1; #endif -s32 var8007fad4 = -1; -u32 var8007fad8 = 0x00000000; +s32 g_TextParaOverlap = -1; // higher value reduces margin between paragraphs +bool g_TextUseAverageSampling = false; s32 var8007fadc = 0; s32 var8007fae0 = 0; -u32 var8007fae4 = 0x00000000; -u32 var8007fae8 = 0x00000000; -u32 var8007faec = 0x00000000; -u32 var8007faf0 = 0x00000000; +u32 var8007fae4 = 0; +u32 var8007fae8 = 0; +u32 var8007faec = 0; +u32 var8007faf0 = 0; struct font *g_FontTahoma2 = NULL; struct fontchar *g_FontTahoma1 = NULL; @@ -103,12 +103,12 @@ struct fontchar *g_CharsHandelGothicMd = NULL; struct font *g_FontHandelGothicLg = NULL; struct fontchar *g_CharsHandelGothicLg = NULL; -u32 var8007fb24 = 0x00000000; -u32 var8007fb28 = 0x00000000; -u32 var8007fb2c = 0x00000000; -u32 var8007fb30 = 0x00000000; -u32 var8007fb34 = 0x00000000; -u32 var8007fb38 = 0x00000000; +u32 var8007fb24 = 0; +u32 var8007fb28 = 0; +u32 var8007fb2c = 0; +u32 var8007fb30 = 0; +u32 var8007fb34 = 0; +u32 var8007fb38 = 0; u16 var8007fb3c[] = { 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, 0xff00, @@ -129,28 +129,28 @@ u16 var800801d8jf[] = { }; #endif -bool var8007fb9c = false; -s32 var8007fba0 = 0; -s32 var8007fba4 = -1; -u32 var8007fba8 = 0x00000000; -u32 var8007fbac = 0x00000001; -u32 var8007fbb0 = 0x00000064; -u32 var8007fbb4 = 0x0000002c; -u32 var8007fbb8 = 0x00000080; -u32 var8007fbbc = 0x0000003c; -u32 var8007fbc0 = 0x44444400; -u32 var8007fbc4 = 0xffffff00; +bool g_TextHoloRayEnabled = false; +s32 g_TextBlendDistance = 0; +s32 g_TextLastBlendY = -1; +s32 var8007fba8 = 0; +u32 g_TextLAlpha = 1; +u32 g_TextLFade = 100; +u32 g_TextLLimbo = 44; +u32 g_TextSubleTY = 128; +u32 g_TextSubtleTX = 60; +u32 g_TextColourX = 0x44444400; +u32 g_TextColourY = 0xffffff00; -Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32 arg5, s32 arg6, s32 arg7); +Gfx *text_render_char_v1_part2(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32 arg5, s32 arg6, s32 arg7); void text_init(void) { // empty } -void text0f1531a8(s32 arg0) +void text_set_default_kerning(s32 kerning) { - var8007fac4 = -arg0; + g_TextCharOverlap = -kerning; } void text_set_rotation90(bool rotated) @@ -163,17 +163,17 @@ void text_set_wrap_indent(s32 count) g_WrapIndentCount = count; } -void text0f1531d0(s32 arg0) +void text_set_paragraph_overlap(s32 margin) { - var8007fad4 = arg0; + g_TextParaOverlap = margin; } -void text0f1531dc(bool arg0) +void text_set_hires(bool hires) { - if (arg0) { - var8007fad0 = 2; + if (hires) { + g_TextScaleX = 2; } else { - var8007fad0 = 1; + g_TextScaleX = 1; } #if VERSION == VERSION_JPN_FINAL @@ -296,11 +296,11 @@ void text_reset(void) var8007fb30 = 0; var8007fb38 = 0; - var8007fac4 = 0; + g_TextCharOverlap = 0; g_TextRotated90 = false; g_WrapIndentCount = 0; - var8007fad4 = -1; - var8007fad8 = 0; + g_TextParaOverlap = -1; + g_TextUseAverageSampling = 0; var8007fadc = 0; var8007fae0 = 0; var8007fae4 = 0; @@ -323,7 +323,7 @@ void text_reset(void) if (IS4MB()) { s32 i; - for (i = 0; i < 169; i++) { + for (i = 0; i < ARRAYCOUNT(g_JpnKerning); i++) { g_JpnKerning[i] = 0; } @@ -371,7 +371,7 @@ void text_reset(void) } } -Gfx *text0f153628(Gfx *gdl) +Gfx *text_begin(Gfx *gdl) { gDPPipeSync(gdl++); gDPSetCycleType(gdl++, G_CYC_1CYCLE); @@ -386,7 +386,7 @@ Gfx *text0f153628(Gfx *gdl) gDPSetTextureConvert(gdl++, G_TC_FILT); gDPSetTextureLUT(gdl++, G_TT_NONE); - if (var8007fad8) { + if (g_TextUseAverageSampling) { gDPSetTextureFilter(gdl++, G_TF_AVERAGE); } #if VERSION == VERSION_JPN_FINAL @@ -401,7 +401,7 @@ Gfx *text0f153628(Gfx *gdl) return gdl; } -Gfx *text0f153780(Gfx *gdl) +Gfx *text_end(Gfx *gdl) { gDPPipeSync(gdl++); gDPSetColorDither(gdl++, G_CD_BAYER); @@ -411,7 +411,7 @@ Gfx *text0f153780(Gfx *gdl) return gdl; } -Gfx *text_set_prim_colour(Gfx *gdl, u32 colour) +Gfx *text_begin_boxmode(Gfx *gdl, u32 colour) { gDPPipeSync(gdl++); gDPSetRenderMode(gdl++, G_RM_XLU_SURF, G_RM_XLU_SURF2); @@ -422,103 +422,104 @@ Gfx *text_set_prim_colour(Gfx *gdl, u32 colour) return gdl; } -Gfx *text0f153838(Gfx *gdl) +Gfx *text_end_boxmode(Gfx *gdl) { gDPSetCombineMode(gdl++, G_CC_CUSTOM_02, G_CC_CUSTOM_02); return gdl; } -Gfx *text0f153858(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2) +Gfx *text_draw_black_box(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2) { - gdl = text_set_prim_colour(gdl, 0x00000000); + gdl = text_begin_boxmode(gdl, 0x00000000); gDPFillRectangle(gdl++, *x1, *y1, *x2, *y2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } -Gfx *text0f1538e4(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2) +Gfx *text_draw_black_uibox(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2) { - gdl = text_set_prim_colour(gdl, 0x00000000); + gdl = text_begin_boxmode(gdl, 0x00000000); gDPFillRectangleScaled(gdl++, *x1, *y1, *x2, *y2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } #if VERSION >= VERSION_NTSC_1_0 -Gfx *text0f153990(Gfx *gdl, s32 left, s32 top, s32 width, s32 height) +Gfx *text_draw_black_textbox(Gfx *gdl, s32 left, s32 top, s32 width, s32 height) { - gdl = text_set_prim_colour(gdl, 0x00000000); + gdl = text_begin_boxmode(gdl, 0x00000000); #if VERSION >= VERSION_JPN_FINAL - gDPFillRectangle(gdl++, left - 1, top - 1, width * var8007fad0 + left + 1, top + height * var80080108jf + 1); + gDPFillRectangle(gdl++, left - 1, top - 1, width * g_TextScaleX + left + 1, top + height * var80080108jf + 1); #else - gDPFillRectangle(gdl++, left - 1, top - 1, width * var8007fad0 + left + 1, top + height + 1); + gDPFillRectangle(gdl++, left - 1, top - 1, width * g_TextScaleX + left + 1, top + height + 1); #endif - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } #endif -Gfx *text0f153a34(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour) +Gfx *text_draw_box(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour) { - gdl = text_set_prim_colour(gdl, colour); + gdl = text_begin_boxmode(gdl, colour); gDPFillRectangle(gdl++, x1, y1, x2, y2); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); return gdl; } -Gfx *text0f153ab0(Gfx *gdl) +Gfx *text_enable_holo_ray(Gfx *gdl) { Gfx *allocation; - var8007fb9c = true; + g_TextHoloRayEnabled = true; allocation = gfx_allocate(sizeof(Gfx) * 530); - var800a4634 = allocation; - var800a4638 = allocation + 530; + g_TextHoloRayGdl = allocation; + g_TextHoloRayGdlEnd = allocation + 530; - gSPDisplayList(gdl++, var800a4634); + gSPDisplayList(gdl++, g_TextHoloRayGdl); gdl = func0f0d4c80(gdl); - var800a4634 = func0f0d4a3c(var800a4634, 0); - var8007fba4 = -1; + g_TextHoloRayGdl = func0f0d4a3c(g_TextHoloRayGdl, 0); + + g_TextLastBlendY = -1; return gdl; } -void text0f153b40(void) +void text_disable_holo_ray(void) { - var8007fb9c = false; + g_TextHoloRayEnabled = false; - gSPEndDisplayList(var800a4634++); + gSPEndDisplayList(g_TextHoloRayGdl++); } -void text0f153b6c(s32 arg0) +void text_calculate_blend_distance(s32 y) { - if (arg0 != var8007fba4) { - f32 tmp = g_Blend.diagtimer * g_Blend.diagtimer - (f32)((arg0 - g_Blend.diagrefy) * (arg0 - g_Blend.diagrefy)); + if (y != g_TextLastBlendY) { + f32 sqdist = g_Blend.diagtimer * g_Blend.diagtimer - (f32)((y - g_Blend.diagrefy) * (y - g_Blend.diagrefy)); - if (tmp > 0.0f) { - var8007fba0 = sqrtf(tmp) + g_Blend.diagrefx; + if (sqdist > 0.0f) { + g_TextBlendDistance = g_Blend.diagrefx + sqrtf(sqdist); } else { - var8007fba0 = 0; + g_TextBlendDistance = 0; } - var8007fba4 = arg0; + g_TextLastBlendY = y; } } @@ -638,9 +639,9 @@ u32 text_apply_projection_colour(s32 x, s32 y, u32 colour) f12 = 3000.0f; } - f14 = var8007fbac; - f18 = var8007fbb0; - f16 = var8007fbb4; + f14 = g_TextLAlpha; + f18 = g_TextLFade; + f16 = g_TextLLimbo; if (g_Blend.diagmode == 0) { if (g_Blend.diagtimer < f12) { @@ -677,7 +678,7 @@ u32 text_apply_projection_colour(s32 x, s32 y, u32 colour) return result; } -u32 text0f1543ac(s32 x, s32 y, u32 colourarg) +u32 text_get_colour_at_pos(s32 x, s32 y, u32 colourarg) { f32 f14; f32 f18; @@ -742,9 +743,9 @@ u32 text0f1543ac(s32 x, s32 y, u32 colourarg) f12 = 3000.0f; } - f14 = var8007fbac; - f18 = var8007fbb0; - f16 = var8007fbb4; + f14 = g_TextLAlpha; + f18 = g_TextLFade; + f16 = g_TextLLimbo; if (g_Blend.diagmode == 0) { if (g_Blend.diagtimer < f12) { @@ -829,10 +830,10 @@ u32 text0f1543ac(s32 x, s32 y, u32 colourarg) } if (f0 < 0.0f) { - s32 weight = var8007fbbc * (0 - f0); + s32 weight = g_TextSubtleTX * (0 - f0); colour = colour_blend(g_Blend.wavecolour1 | (colour & 0xff), colour, weight); } else { - s32 weight = var8007fbb8 * f0; + s32 weight = g_TextSubleTY * f0; colour = colour_blend(g_Blend.wavecolour2 | (colour & 0xff), colour, weight); } } @@ -840,9 +841,9 @@ u32 text0f1543ac(s32 x, s32 y, u32 colourarg) return colour; } -Gfx *text0f154ecc(Gfx *gdl, u32 arg1, u32 arg2) +Gfx *text_configure_colours_v2(Gfx *gdl, s32 x, s32 y) { - u32 colour = text0f1543ac(arg1, arg2, g_Blend.colour04); + u32 colour = text_get_colour_at_pos(x, y, g_Blend.colour04); if (colour != g_Blend.colour44) { gDPSetPrimColorViaWord(gdl++, 0, 0, colour); @@ -854,7 +855,7 @@ Gfx *text0f154ecc(Gfx *gdl, u32 arg1, u32 arg2) } #if VERSION >= VERSION_PAL_BETA -void text_map_code_unit_to_char2(u8 *c) +void text_map_codeunit_to_char(u8 *c) { switch (*c) { case 0xc0: @@ -933,124 +934,124 @@ void text_map_code_unit_to_char2(u8 *c) #endif #if VERSION >= VERSION_JPN_FINAL -s32 func0f154784jf(u16 arg0) +char text_codepoint_to_sbchar(u16 codepoint) { - u8 result = 0; - u16 u16val = arg0; - u8 u8val = arg0; + char c = '\0'; + u16 codepoint16 = codepoint; + u8 codepoint8 = codepoint; - if (arg0 >= 0x10 && arg0 < 0x1a) { - result = u16val; - result += 0x20; + if (codepoint >= 0x10 && codepoint < 0x1a) { // 0-9 + c = codepoint16; + c += 0x20; } - if (arg0 >= 0x1a && arg0 < 0x34) { - result = u16val; - result += 0x27; + if (codepoint >= 0x1a && codepoint < 0x34) { // A-Z + c = codepoint16; + c += 0x27; } - if (arg0 >= 0x95 && arg0 < 0xaf) { - result = u16val; - result -= 0x34; + if (codepoint >= 0x95 && codepoint < 0xaf) { // a-z + c = codepoint16; + c -= 0x34; } - if (arg0 == 0x3fe || arg0 == 0x3ff) { - result = 0x2d; + if (codepoint == 0x3fe || codepoint == 0x3ff) { + c = '-'; } - if (arg0 < 0xff) { - switch (u8val) { - case 0x00: result = 0x20; break; - case 0x01: result = 0x2c; break; - case 0x02: result = 0x24; break; - case 0x03: result = 0x28; break; - case 0x04: result = 0x29; break; - case 0x05: result = 0x2e; break; - case 0x06: result = 0x25; break; - case 0x07: result = 0x5b; break; - case 0x08: result = 0x5d; break; - case 0x09: result = 0x22; break; - case 0x0a: result = 0x3c; break; - case 0x0b: result = 0x3e; break; - case 0x0c: result = 0x26; break; - case 0x0d: result = 0x7e; break; - case 0x0e: result = 0x2e; break; - case 0x0f: result = 0x20; break; - case 0x34: result = 0x21; break; - case 0x35: result = 0x22; break; - case 0x36: result = 0x23; break; - case 0x37: result = 0x22; break; - case 0x38: result = 0x2a; break; - case 0x39: result = 0x2b; break; - case 0x3a: result = 0x2c; break; - case 0x3b: result = 0x2d; break; - case 0x3c: result = 0x2e; break; - case 0x3d: result = 0x2f; break; - case 0x3e: result = 0x3a; break; - case 0x3f: result = 0x3d; break; - case 0x40: result = 0x3f; break; - case 0x41: result = 0x40; break; + if (codepoint < 0xff) { + switch (codepoint8) { + case 0x00: c = ' '; break; + case 0x01: c = ','; break; + case 0x02: c = '$'; break; + case 0x03: c = '('; break; + case 0x04: c = ')'; break; + case 0x05: c = '.'; break; + case 0x06: c = '%'; break; + case 0x07: c = '['; break; + case 0x08: c = ']'; break; + case 0x09: c = '"'; break; + case 0x0a: c = '<'; break; + case 0x0b: c = '>'; break; + case 0x0c: c = '&'; break; + case 0x0d: c = '~'; break; + case 0x0e: c = '.'; break; + case 0x0f: c = ' '; break; + case 0x34: c = '!'; break; + case 0x35: c = '"'; break; + case 0x36: c = '#'; break; + case 0x37: c = '"'; break; + case 0x38: c = '*'; break; + case 0x39: c = '+'; break; + case 0x3a: c = ','; break; + case 0x3b: c = '-'; break; + case 0x3c: c = '.'; break; + case 0x3d: c = '/'; break; + case 0x3e: c = ':'; break; + case 0x3f: c = '='; break; + case 0x40: c = '?'; break; + case 0x41: c = '@'; break; } } - return result; + return c; } #endif #if VERSION >= VERSION_JPN_FINAL -u16 func0f154968jf(u8 value) +u16 text_sbchar_to_codepoint(u8 c) { - u16 result = 0; + u16 codepoint = 0; - if (value >= 0x30 && value < 0x3a) { - result = value - 0x20; + if (c >= '0' && c <= '9') { + codepoint = c - 0x20; } - if (value >= 0x41 && value < 0x5b) { - result = value - 0x27; + if (c >= 'A' && c <= 'Z') { + codepoint = c - 0x27; } - if (value >= 0x61 && value < 0x7b) { - result = value + 0x34; + if (c >= 'a' && c <= 'z') { + codepoint = c + 0x34; } - switch (value) { - case 0x20: result = 0x00; break; - case 0x2c: result = 0x01; break; - case 0x24: result = 0x02; break; - case 0x28: result = 0x03; break; - case 0x29: result = 0x04; break; - case 0x2e: result = 0x05; break; - case 0x25: result = 0x06; break; - case 0x5b: result = 0x07; break; - case 0x5d: result = 0x08; break; - case 0x22: result = 0x09; break; - case 0x3c: result = 0x0a; break; - case 0x3e: result = 0x0b; break; - case 0x26: result = 0x0c; break; - case 0x7e: result = 0x0d; break; - case 0x21: result = 0x34; break; - case 0x23: result = 0x36; break; - case 0x2a: result = 0x38; break; - case 0x2b: result = 0x39; break; - case 0x2d: result = 0x3b; break; - case 0x2f: result = 0x3d; break; - case 0x3a: result = 0x3e; break; - case 0x3d: result = 0x3f; break; - case 0x3f: result = 0x40; break; - case 0x40: result = 0x41; break; + switch (c) { + case ' ': codepoint = 0x00; break; + case ',': codepoint = 0x01; break; + case '$': codepoint = 0x02; break; + case '(': codepoint = 0x03; break; + case ')': codepoint = 0x04; break; + case '.': codepoint = 0x05; break; + case '%': codepoint = 0x06; break; + case '[': codepoint = 0x07; break; + case ']': codepoint = 0x08; break; + case '"': codepoint = 0x09; break; + case '<': codepoint = 0x0a; break; + case '>': codepoint = 0x0b; break; + case '&': codepoint = 0x0c; break; + case '~': codepoint = 0x0d; break; + case '!': codepoint = 0x34; break; + case '#': codepoint = 0x36; break; + case '*': codepoint = 0x38; break; + case '+': codepoint = 0x39; break; + case '-': codepoint = 0x3b; break; + case '/': codepoint = 0x3d; break; + case ':': codepoint = 0x3e; break; + case '=': codepoint = 0x3f; break; + case '?': codepoint = 0x40; break; + case '@': codepoint = 0x41; break; } - return result; + return codepoint; } #endif -void text_map_code_unit_to_char(char **text, struct fontchar **arg1, struct fontchar **arg2, struct fontchar *chars, u8 *prevchar); +void text_parse_char(char **text, struct fontchar **thischarptr, struct fontchar **prevcharptr, struct fontchar *chars, u8 *prevchar); #if VERSION == VERSION_JPN_FINAL #if MATCHING GLOBAL_ASM( -glabel text_map_code_unit_to_char +glabel text_parse_char /* f154b00: 27bdffd0 */ addiu $sp,$sp,-48 /* f154b04: afbf001c */ sw $ra,0x1c($sp) /* f154b08: afb00018 */ sw $s0,0x18($sp) @@ -1081,7 +1082,7 @@ glabel text_map_code_unit_to_char /* f154b68: a0650003 */ sb $a1,0x3($v1) /* f154b6c: a0650004 */ sb $a1,0x4($v1) /* f154b70: a4600006 */ sh $zero,0x6($v1) -/* f154b74: 0fc5525a */ jal func0f154968jf +/* f154b74: 0fc5525a */ jal text_sbchar_to_codepoint /* f154b78: ac600008 */ sw $zero,0x8($v1) /* f154b7c: 8fab0034 */ lw $t3,0x34($sp) /* f154b80: 3c03800a */ lui $v1,%hi(g_TmpJpnChar) @@ -1151,7 +1152,7 @@ glabel text_map_code_unit_to_char /* f154c74: 93a80029 */ lbu $t0,0x29($sp) /* f154c78: 11c00006 */ beqz $t6,.JF0f154c94 /* f154c7c: 8fb00024 */ lw $s0,0x24($sp) -/* f154c80: 0fc551e1 */ jal func0f154784jf +/* f154c80: 0fc551e1 */ jal text_codepoint_to_sbchar /* f154c84: 3204ffff */ andi $a0,$s0,0xffff /* f154c88: 3c03800a */ lui $v1,%hi(g_TmpJpnChar) /* f154c8c: 24635008 */ addiu $v1,$v1,%lo(g_TmpJpnChar) @@ -1198,13 +1199,13 @@ u32 ope = 0; const char var7f1b8068jf[] = "ope"; #else -void text_map_code_unit_to_char(char **text, struct fontchar **arg1, struct fontchar **arg2, struct fontchar *chars, u8 *prevchar) +void text_parse_char(char **text, struct fontchar **thischarptr, struct fontchar **prevcharptr, struct fontchar *chars, u8 *prevchar) { u16 c; u8 c1; u8 c2; - u16 sp2a; - u8 sp29; + u16 codepoint; + u8 sbchar; static u32 ope = 0; @@ -1219,74 +1220,73 @@ void text_map_code_unit_to_char(char **text, struct fontchar **arg1, struct font g_TmpJpnChar.kerningindex = 0; g_TmpJpnChar.pixeldata = NULL; - g_TmpJpnChar.index = 0x80 + func0f154968jf(c); + g_TmpJpnChar.index = 0x80 + text_sbchar_to_codepoint(c); - *arg1 = &g_TmpJpnChar; - *arg2 = &g_TmpJpnChar; + *thischarptr = &g_TmpJpnChar; + *prevcharptr = &g_TmpJpnChar; } else { - *arg1 = &chars[c - 0x21]; - *arg2 = &chars[*prevchar - 0x21]; + *thischarptr = &chars[c - 0x21]; + *prevcharptr = &chars[*prevchar - 0x21]; } *prevchar = **text; *text += 1; - return; - } + } else { + g_TmpJpnChar.index = 0; + g_TmpJpnChar.baseline = 0; + g_TmpJpnChar.height = 11; + g_TmpJpnChar.width = 11; + g_TmpJpnChar.kerningindex = 0; + g_TmpJpnChar.pixeldata = NULL; - g_TmpJpnChar.index = 0; - g_TmpJpnChar.baseline = 0; - g_TmpJpnChar.height = 11; - g_TmpJpnChar.width = 11; - g_TmpJpnChar.kerningindex = 0; - g_TmpJpnChar.pixeldata = NULL; + c1 = **text; + *text = *text + 1; + c2 = **text; + *text = *text + 1; - c1 = **text; - *text = *text + 1; - c2 = **text; - *text = *text + 1; + codepoint = ((c1 & 0x7f) << 7) | (c2 & 0x7f); + sbchar = '\0'; - sp2a = ((c1 & 0x7f) << 7) | (c2 & 0x7f); - sp29 = 0; + main_override_variable("ope", &ope); - main_override_variable("ope", &ope); - - if (ope) { - sp29 = func0f154784jf(sp2a); - } - - if (sp29 == 0 || chars == NULL) { - if ((sp2a & 0x1fff) >= 0x400) { - sp2a = 2; + if (ope) { + sbchar = text_codepoint_to_sbchar(codepoint); } - g_TmpJpnChar.index = sp2a + 0x80; + if (sbchar == '\0' || chars == NULL) { + if ((codepoint & 0x1fff) >= 0x400) { + codepoint = 2; + } - *arg1 = &g_TmpJpnChar; - *arg2 = &g_TmpJpnChar; - } else { - *arg1 = &chars[sp29 - 0x21]; - *arg2 = &g_TmpJpnChar; + g_TmpJpnChar.index = codepoint + 0x80; + + *thischarptr = &g_TmpJpnChar; + *prevcharptr = &g_TmpJpnChar; + } else { + *thischarptr = &chars[sbchar - 0x21]; + *prevcharptr = &g_TmpJpnChar; + } } } #endif #elif VERSION >= VERSION_PAL_BETA -void text_map_code_unit_to_char(char **text, struct fontchar **arg1, struct fontchar **arg2, struct fontchar *chars, u8 *prevchar) +void text_parse_char(char **text, struct fontchar **thischarptr, struct fontchar **prevcharptr, struct fontchar *chars, u8 *prevchar) { u8 c; u8 index; if (g_Jpn) { if (**text < 0x80) { - *arg1 = &chars[**text - 0x21]; - *arg2 = &chars[*prevchar - 0x21]; + *thischarptr = &chars[**text - 0x21]; + *prevcharptr = &chars[*prevchar - 0x21]; *prevchar = **text; *text += 1; return; } - *arg1 = &chars[*prevchar - 0x21]; - *arg2 = &chars[*prevchar - 0x21]; + *thischarptr = &chars[*prevchar - 0x21]; + *prevcharptr = &chars[*prevchar - 0x21]; return; } @@ -1338,27 +1338,27 @@ void text_map_code_unit_to_char(char **text, struct fontchar **arg1, struct font case 0xaa: index = 0x86; break; } } else { - text_map_code_unit_to_char2(&c); + text_map_codeunit_to_char(&c); } if (index > 0) { - *arg1 = &chars[index]; + *thischarptr = &chars[index]; } else { if (c < 0x21) { - c = 0x21; + c = '!'; } if (c > 0x7e) { - c = 0x21; + c = '!'; } - *arg1 = &chars[c - 0x21]; + *thischarptr = &chars[c - 0x21]; } - *arg2 = &chars[*prevchar - 0x21]; + *prevcharptr = &chars[*prevchar - 0x21]; if (index > 0) { - text_map_code_unit_to_char2(&c); + text_map_codeunit_to_char(&c); } *prevchar = c; @@ -1366,7 +1366,7 @@ void text_map_code_unit_to_char(char **text, struct fontchar **arg1, struct font } #endif -Gfx *text0f154f38(Gfx *gdl, s32 *arg1, struct fontchar *curchar, struct fontchar *prevchar, +Gfx *text_render_credits_char(Gfx *gdl, s32 *arg1, struct fontchar *curchar, struct fontchar *prevchar, struct font *font, f32 widthscale, f32 heightscale, f32 x, f32 y) { s32 tmp1; @@ -1382,7 +1382,7 @@ Gfx *text0f154f38(Gfx *gdl, s32 *arg1, struct fontchar *curchar, struct fontchar Vtx *vertices; Col *colours; - tmp2 = font->kerning[prevchar->kerningindex * 13 + curchar->kerningindex] + var8007fac4; + tmp2 = font->kerning[prevchar->kerningindex * 13 + curchar->kerningindex] + g_TextCharOverlap; *arg1 = *arg1 - tmp2 + 1; #if VERSION >= VERSION_JPN_FINAL @@ -1469,7 +1469,7 @@ Gfx *text0f154f38(Gfx *gdl, s32 *arg1, struct fontchar *curchar, struct fontchar return gdl; } -Gfx *text0f1552d4(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, +Gfx *text_render_credits(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, char *text, struct fontchar *chars, struct font *font, u32 colour, s32 hdir, s32 vdir) { s32 totalheight; @@ -1527,12 +1527,12 @@ Gfx *text0f1552d4(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, if (text != NULL) { while (*text != '\0') { if (*text == ' ') { - relx = relx + var8007fad0 * 5; + relx = relx + g_TextScaleX * 5; prevchar = 'H'; text += 1; } else if (*text == '\n') { - if (var8007fad4 >= 0 && relx == 0) { - totalheight += var8007fad4; + if (g_TextParaOverlap >= 0 && relx == 0) { + totalheight += g_TextParaOverlap; relx = 0; } else { relx = 0; @@ -1549,8 +1549,8 @@ Gfx *text0f1552d4(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, struct fontchar *sp84; struct fontchar *sp80; - text_map_code_unit_to_char(&text, &sp84, &sp80, chars, &prevchar); - gdl = text0f154f38(gdl, &relx, sp84, sp80, font, widthscale, heightscale, fx, fy); + text_parse_char(&text, &sp84, &sp80, chars, &prevchar); + gdl = text_render_credits_char(gdl, &relx, sp84, sp80, font, widthscale, heightscale, fx, fy); } } } @@ -1560,20 +1560,20 @@ Gfx *text0f1552d4(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, if (*text == ' ') { prevchar = 'H'; text += 1; - relx = relx + var8007fad0 * 5; + relx = relx + g_TextScaleX * 5; } else if (*text == '\n') { prevchar = 'H'; text += 1; - if (var8007fad4 >= 0 && relx == 0) { - totalheight += var8007fad4; + if (g_TextParaOverlap >= 0 && relx == 0) { + totalheight += g_TextParaOverlap; relx = 0; } else { totalheight += lineheight; relx = 0; } } else if (*text < 0x80) { - gdl = text0f154f38(gdl, &relx, &chars[*text - 0x21], &chars[prevchar - 0x21], font, + gdl = text_render_credits_char(gdl, &relx, &chars[*text - 0x21], &chars[prevchar - 0x21], font, widthscale, heightscale, fx, fy); prevchar = *text; text += 1; @@ -1604,13 +1604,13 @@ Gfx *text0f1552d4(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, return gdl; } -Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fontchar *prevchar, - struct font *font, s32 savedx, s32 savedy, s32 width, s32 height, s32 arg10) +Gfx *text_render_char_v2(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fontchar *prevchar, + struct font *font, s32 savedx, s32 savedy, s32 width, s32 height, s32 shadowoffset) { #if VERSION >= VERSION_JPN_FINAL s32 tmp; s32 sp90; - s32 xscale = var8007fad0; + s32 xscale = g_TextScaleX; s32 yscale = var80080108jf; savedy -= 2; @@ -1619,8 +1619,8 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon xscale = 1; } - sp90 = *y + arg10; - tmp = var8007fac4 + font->kerning[prevchar->kerningindex * 13 + curchar->kerningindex]; + sp90 = *y + shadowoffset; + tmp = g_TextCharOverlap + font->kerning[prevchar->kerningindex * 13 + curchar->kerningindex]; *x -= (tmp - 1) * xscale; width *= xscale; height *= yscale; @@ -1660,7 +1660,7 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon gDPPipeSync(gdl++); if (g_Blend.types) { - gdl = text0f154ecc(gdl, *x / g_ScaleX, *y + arg10); + gdl = text_configure_colours_v2(gdl, *x / g_UiScaleX, *y + shadowoffset); } if (1); @@ -1670,7 +1670,7 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon if (curchar->baseline * yscale + sp90 + curchar->height * yscale <= savedy + height) { if (g_TextRotated90) { gSPTextureRectangleFlip(gdl++, - (sp90 - curchar->baseline - curchar->height * var8007fad0) * 4 + var8007fae0, + (sp90 - curchar->baseline - curchar->height * g_TextScaleX) * 4 + var8007fae0, *x * 4 + var8007fadc, (sp90 - curchar->baseline) * 4 + var8007fae0, (*x + curchar->width * var80080108jf) * 4 + var8007fadc, @@ -1678,38 +1678,38 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon var8007fae8 + 32, ((curchar->height - 1) << 5) + var8007fae4 + 32, 1024 / var80080108jf, - 65536 - 1024 / var8007fad0); + 65536 - 1024 / g_TextScaleX); } else { gSPTextureRectangle(gdl++, *x * 4 + var8007fadc, (sp90 + curchar->baseline * var80080108jf) * 4 + var8007fae0, - (*x + curchar->width * var8007fad0) * 4 + var8007fadc, + (*x + curchar->width * g_TextScaleX) * 4 + var8007fadc, (sp90 + curchar->baseline * var80080108jf + curchar->height * var80080108jf) * 4 + var8007fae0 - (var80080108jf - 1) * 4, G_TX_RENDERTILE, var8007fae4 + 32, var8007fae8 + 32, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024 / var80080108jf); - if (var8007fb9c) { - text0f153b6c(*y + arg10); + if (g_TextHoloRayEnabled) { + text_calculate_blend_distance(*y + shadowoffset); - if (var8007fba0 >= *x / g_ScaleX && *x / g_ScaleX + curchar->width * var8007fad0 >= var8007fba0) { - var800a4634 = menugfx_draw_plane(var800a4634, - var8007fba0, + if (g_TextBlendDistance >= *x / g_UiScaleX && *x / g_UiScaleX + curchar->width * g_TextScaleX >= g_TextBlendDistance) { + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, + g_TextBlendDistance, curchar->baseline * var80080108jf + sp90, - var8007fba0, + g_TextBlendDistance, curchar->baseline * var80080108jf + sp90 + curchar->height * var80080108jf, g_Blend.colour04, g_Blend.colour04, MENUPLANE_00); } - if (var8007fba0 - 3 >= *x / g_ScaleX && *x / g_ScaleX + curchar->width * var8007fad0 >= var8007fba0 - 3) { - var800a4634 = menugfx_draw_plane(var800a4634, - var8007fba0, + if (g_TextBlendDistance - 3 >= *x / g_UiScaleX && *x / g_UiScaleX + curchar->width * g_TextScaleX >= g_TextBlendDistance - 3) { + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, + g_TextBlendDistance, curchar->baseline * var80080108jf + sp90, - var8007fba0, + g_TextBlendDistance, curchar->baseline * var80080108jf + sp90 + curchar->height * var80080108jf, g_Blend.colour04, g_Blend.colour04, @@ -1721,12 +1721,12 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon gSPTextureRectangle(gdl++, *x * 4 + var8007fadc, (sp90 + curchar->baseline * var80080108jf) * 4 + var8007fae0, - (*x + curchar->width * var8007fad0) * 4 + var8007fadc, + (*x + curchar->width * g_TextScaleX) * 4 + var8007fadc, (savedy + height) * 4 + var8007fae0, G_TX_RENDERTILE, var8007fae4 + 32, var8007fae8 + 32, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024 / var80080108jf); } } else { @@ -1734,12 +1734,12 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon gSPTextureRectangle(gdl++, *x * 4 + var8007fadc, savedy * 4 + var8007fae0, - (*x + curchar->width * var8007fad0) * 4 + var8007fadc, + (*x + curchar->width * g_TextScaleX) * 4 + var8007fadc, (curchar->baseline * var80080108jf + sp90 + curchar->height * var80080108jf) * 4 + var8007fae0, G_TX_RENDERTILE, var8007fae4 + 32, ((savedy - sp90 - curchar->baseline * var80080108jf) << 5) + var8007fae8 + 32, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024 / var80080108jf); } } @@ -1749,7 +1749,7 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon #else s32 tmp; s32 sp90; - s32 xscale = var8007fad0; + s32 xscale = g_TextScaleX; #if VERSION >= VERSION_PAL_BETA savedy -= 2; @@ -1759,8 +1759,8 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon xscale = 1; } - sp90 = *y + arg10; - tmp = var8007fac4 + font->kerning[prevchar->kerningindex * 13 + curchar->kerningindex]; + sp90 = *y + shadowoffset; + tmp = g_TextCharOverlap + font->kerning[prevchar->kerningindex * 13 + curchar->kerningindex]; *x -= (tmp - 1) * xscale; width *= xscale; @@ -1775,7 +1775,7 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon gDPPipeSync(gdl++); if (g_Blend.types) { - gdl = text0f154ecc(gdl, *x / g_ScaleX, *y + arg10); + gdl = text_configure_colours_v2(gdl, *x / g_UiScaleX, *y + shadowoffset); } if (1); @@ -1785,7 +1785,7 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon if (curchar->baseline + sp90 + curchar->height <= savedy + height) { if (g_TextRotated90) { gSPTextureRectangleFlip(gdl++, - (sp90 - curchar->baseline - curchar->height * var8007fad0) * 4 + var8007fae0, + (sp90 - curchar->baseline - curchar->height * g_TextScaleX) * 4 + var8007fae0, *x * 4 + var8007fadc, (sp90 - curchar->baseline) * 4 + var8007fae0, (*x + curchar->width) * 4 + var8007fadc, @@ -1793,38 +1793,38 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon var8007fae8 + 32, ((curchar->height - 1) << 5) + var8007fae4 + 32, 1024, - 65536 - 1024 / var8007fad0); + 65536 - 1024 / g_TextScaleX); } else { gSPTextureRectangle(gdl++, *x * 4 + var8007fadc, (sp90 + curchar->baseline) * 4 + var8007fae0, - (*x + curchar->width * var8007fad0) * 4 + var8007fadc, + (*x + curchar->width * g_TextScaleX) * 4 + var8007fadc, (sp90 + curchar->baseline + curchar->height) * 4 + var8007fae0, G_TX_RENDERTILE, var8007fae4 + 32, var8007fae8 + 32, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024); - if (var8007fb9c) { - text0f153b6c(*y + arg10); + if (g_TextHoloRayEnabled) { + text_calculate_blend_distance(*y + shadowoffset); - if (var8007fba0 >= *x / g_ScaleX && *x / g_ScaleX + curchar->width * var8007fad0 >= var8007fba0) { - var800a4634 = menugfx_draw_plane(var800a4634, - var8007fba0, + if (g_TextBlendDistance >= *x / g_UiScaleX && *x / g_UiScaleX + curchar->width * g_TextScaleX >= g_TextBlendDistance) { + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, + g_TextBlendDistance, curchar->baseline + sp90, - var8007fba0, + g_TextBlendDistance, curchar->baseline + sp90 + curchar->height, g_Blend.colour04, g_Blend.colour04, MENUPLANE_00); } - if (var8007fba0 - 3 >= *x / g_ScaleX && *x / g_ScaleX + curchar->width * var8007fad0 >= var8007fba0 - 3) { - var800a4634 = menugfx_draw_plane(var800a4634, - var8007fba0, + if (g_TextBlendDistance - 3 >= *x / g_UiScaleX && *x / g_UiScaleX + curchar->width * g_TextScaleX >= g_TextBlendDistance - 3) { + g_TextHoloRayGdl = menugfx_draw_plane(g_TextHoloRayGdl, + g_TextBlendDistance, curchar->baseline + sp90, - var8007fba0, + g_TextBlendDistance, curchar->baseline + sp90 + curchar->height, g_Blend.colour04, g_Blend.colour04, @@ -1836,12 +1836,12 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon gSPTextureRectangle(gdl++, *x * 4 + var8007fadc, (sp90 + curchar->baseline) * 4 + var8007fae0, - (*x + curchar->width * var8007fad0) * 4 + var8007fadc, + (*x + curchar->width * g_TextScaleX) * 4 + var8007fadc, (savedy + height) * 4 + var8007fae0, G_TX_RENDERTILE, var8007fae4 + 32, var8007fae8 + 32, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024); } } else { @@ -1849,12 +1849,12 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon gSPTextureRectangle(gdl++, *x * 4 + var8007fadc, savedy * 4 + var8007fae0, - (*x + curchar->width * var8007fad0) * 4 + var8007fadc, + (*x + curchar->width * g_TextScaleX) * 4 + var8007fadc, (curchar->baseline + sp90 + curchar->height) * 4 + var8007fae0, G_TX_RENDERTILE, var8007fae4 + 32, ((savedy - sp90 - curchar->baseline) << 5) + var8007fae8 + 32, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024); } } @@ -1868,29 +1868,41 @@ Gfx *text0f15568c(Gfx *gdl, s32 *x, s32 *y, struct fontchar *curchar, struct fon return gdl; } -u32 var8007fbd8 = 0; +bool g_TextShadowEnabled = false; -void text0f156024(s32 arg0) +void text_set_shadow_enabled(bool enabled) { - var8007fbd8 = arg0; + g_TextShadowEnabled = enabled; } -void text0f156030(u32 colour) +void text_set_shadow_colour(u32 colour) { var800a463c = colour; } -Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *chars, struct font *font, - s32 colour, s32 width, s32 height, s32 arg9, s32 lineheight) +/** + * The v2 renderer has full support for all of PD's text rendering features. + * - Text can be rotated 90 degrees. + * - Shadows can be enabled/disabled and colour chosen using the above functions. + * - The hologram refresh line can be enabled and disabled using their functions. + * - In versions prior to JPN, shadows are drawn using the v1 renderer which + * means they don't use the special effects. In JPN they are drawn using a + * recursive call to v2 so they have all the special effects. + * - JPN draws the shadows 4 times, each offset in each direction. + * - Blend settings are supported, such as the fading out hologram effect and + * the wavy pattern in gun and function names during gameplay. + */ +Gfx *text_render_v2(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *chars, struct font *font, + u32 textcolour, s32 width, s32 height, s32 shadowoffset, s32 lineheight) { s32 savedx; s32 savedy; u8 prevchar; - s32 spb0; - u32 colour2; - u32 tmpcolour; - s32 newx; - s32 newy; + s32 scalex; + u32 textcolourforshadow; + u32 shadowcolour; + s32 shadowx; + s32 shadowy; #if VERSION >= VERSION_JPN_FINAL s32 savedmode; s32 savedtypes; @@ -1899,32 +1911,32 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar static u32 sbrd = 0x00000000; - spb0 = var8007fad0; + scalex = g_TextScaleX; if (g_TextRotated90) { - *y *= g_ScaleX; - spb0 = 1; + *y *= g_UiScaleX; + scalex = 1; } else { - *x *= g_ScaleX; + *x *= g_UiScaleX; } - if (var8007fbd8) { + if (g_TextShadowEnabled) { + alpha = (1.0f - menu_get_sin_osc_frac(40.0f)) * 100.0f + 150.0f; + shadowx = *x / g_UiScaleX; + shadowy = *y; + shadowcolour = var800a463c; #if VERSION >= VERSION_JPN_FINAL - menu_get_sin_osc_frac(40); - newx = *x / g_ScaleX; - newy = *y; - tmpcolour = var800a463c; savedmode = g_Blend.diagmode; savedtypes = g_Blend.types; if (!g_TextRotated90) { - newy--; + shadowy--; } main_override_variable("sbrd", &sbrd); - if (sbrd != 0) { - tmpcolour = sbrd; + if (sbrd) { + shadowcolour = sbrd; } g_Blend.types &= ~BLENDTYPE_WAVE; @@ -1935,42 +1947,38 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar g_Blend.diagmode = DIAGMODE_FADEOUT; } - var8007fbd8 = 0; + g_TextShadowEnabled = false; - newx = *x / g_ScaleX + 1; - newy = *y - 1; - gdl = text_render_projected(gdl, &newx, &newy, text, chars, font, tmpcolour, width, height, arg9, lineheight); + shadowx = *x / g_UiScaleX + 1; + shadowy = *y - 1; + gdl = text_render_v2(gdl, &shadowx, &shadowy, text, chars, font, shadowcolour, width, height, shadowoffset, lineheight); - newx = *x / g_ScaleX + 1; - newy = *y + 1; - gdl = text_render_projected(gdl, &newx, &newy, text, chars, font, tmpcolour, width, height, arg9, lineheight); + shadowx = *x / g_UiScaleX + 1; + shadowy = *y + 1; + gdl = text_render_v2(gdl, &shadowx, &shadowy, text, chars, font, shadowcolour, width, height, shadowoffset, lineheight); - newx = *x / g_ScaleX - 1; - newy = *y - 1; - gdl = text_render_projected(gdl, &newx, &newy, text, chars, font, tmpcolour, width, height, arg9, lineheight); + shadowx = *x / g_UiScaleX - 1; + shadowy = *y - 1; + gdl = text_render_v2(gdl, &shadowx, &shadowy, text, chars, font, shadowcolour, width, height, shadowoffset, lineheight); - newx = *x / g_ScaleX - 1; - newy = *y + 1; - gdl = text_render_projected(gdl, &newx, &newy, text, chars, font, tmpcolour, width, height, arg9, lineheight); + shadowx = *x / g_UiScaleX - 1; + shadowy = *y + 1; + gdl = text_render_v2(gdl, &shadowx, &shadowy, text, chars, font, shadowcolour, width, height, shadowoffset, lineheight); - var8007fbd8 = 1; + g_TextShadowEnabled = true; g_Blend.types = savedtypes; g_Blend.diagmode = savedmode; #else - alpha = (1.0f - menu_get_sin_osc_frac(40.0f)) * 100.0f + 150.0f; - newx = *x / g_ScaleX; - newy = *y; - tmpcolour = var800a463c; - colour2 = (colour & 0xffffff00) | (u32) alpha; + textcolourforshadow = (textcolour & 0xffffff00) | (u32) alpha; main_override_variable("sbrd", &sbrd); if (sbrd) { - tmpcolour = sbrd; + shadowcolour = sbrd; } - gdl = text_render(gdl, &newx, &newy, text, chars, font, colour2, tmpcolour, width, height, arg9, lineheight); + gdl = text_render_v1(gdl, &shadowx, &shadowy, text, chars, font, textcolourforshadow, shadowcolour, width, height, shadowoffset, lineheight); #endif } @@ -1980,13 +1988,13 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar } #endif - main_override_variable("lalpha", &var8007fbac); - main_override_variable("subtlety", &var8007fbb8); - main_override_variable("subtletx", &var8007fbbc); - main_override_variable("coly", &var8007fbc4); - main_override_variable("colx", &var8007fbc0); - main_override_variable("lfade", &var8007fbb0); - main_override_variable("llimbo", &var8007fbb4); + main_override_variable("lalpha", &g_TextLAlpha); + main_override_variable("subtlety", &g_TextSubleTY); + main_override_variable("subtletx", &g_TextSubtleTX); + main_override_variable("coly", &g_TextColourY); + main_override_variable("colx", &g_TextColourX); + main_override_variable("lfade", &g_TextLFade); + main_override_variable("llimbo", &g_TextLLimbo); savedx = *x; savedy = *y; @@ -2022,22 +2030,22 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar gDPLoadTLUTCmd(gdl++, 6, 15); gDPSetTile(gdl++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 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(gdl++, G_TX_RENDERTILE, 0, 0, 0x007c, 0x007c); - gDPSetPrimColorViaWord(gdl++, 0, 0, colour); + gDPSetPrimColorViaWord(gdl++, 0, 0, textcolour); gDPPipeSync(gdl++); - g_Blend.colour04 = colour; - g_Blend.colour44 = colour; + g_Blend.colour04 = textcolour; + g_Blend.colour44 = textcolour; #if VERSION >= VERSION_PAL_BETA if (text != NULL) { while (*text != '\0') { if (*text == ' ') { - *x += spb0 * 5; + *x += scalex * 5; prevchar = 'H'; text++; } else if (*text == '\n') { - if (var8007fad4 >= 0 && savedx == *x) { - *y += var8007fad4; + if (g_TextParaOverlap >= 0 && savedx == *x) { + *y += g_TextParaOverlap; } else { *y += lineheight; } @@ -2046,12 +2054,12 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar prevchar = 'H'; text++; } else { - struct fontchar *sp78; - struct fontchar *sp74; + struct fontchar *thischardata; + struct fontchar *prevchardata; - text_map_code_unit_to_char(&text, &sp78, &sp74, chars, &prevchar); + text_parse_char(&text, &thischardata, &prevchardata, chars, &prevchar); - gdl = text0f15568c(gdl, x, y, sp78, sp74, font, savedx, savedy, width, height, arg9); + gdl = text_render_char_v2(gdl, x, y, thischardata, prevchardata, font, savedx, savedy, width, height, shadowoffset); } } } @@ -2060,21 +2068,21 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar while (*text != '\0') { if (*text == ' ') { prevchar = 'H'; - *x += spb0 * 5; + *x += scalex * 5; text++; } else if (*text == '\n') { prevchar = 'H'; text++; - if (var8007fad4 >= 0 && savedx == *x) { - *y += var8007fad4; + if (g_TextParaOverlap >= 0 && savedx == *x) { + *y += g_TextParaOverlap; } else { *y += lineheight; } *x = savedx; } else if (*text < 0x80) { - gdl = text0f15568c(gdl, x, y, &chars[*text - 0x21], &chars[prevchar - 0x21], font, savedx, savedy, width, height, arg9); + gdl = text_render_char_v2(gdl, x, y, &chars[*text - 0x21], &chars[prevchar - 0x21], font, savedx, savedy, width, height, shadowoffset); prevchar = *text; text++; } else { @@ -2093,7 +2101,7 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar tmpchar.index = codepoint + 0x80; tmpchar.pixeldata = (void *)lang_get_jpn_char_pixels(codepoint); - gdl = text0f15568c(gdl, x, y, &tmpchar, &tmpchar, font, savedx, savedy, width, height, arg9); + gdl = text_render_char_v2(gdl, x, y, &tmpchar, &tmpchar, font, savedx, savedy, width, height, shadowoffset); text += 2; } @@ -2102,17 +2110,17 @@ Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar #endif if (g_TextRotated90) { - *y = *y / g_ScaleX; + *y = *y / g_UiScaleX; } else { - *x = *x / g_ScaleX; + *x = *x / g_UiScaleX; } return gdl; } -Gfx *text0f1566cc(Gfx *gdl, u32 arg1, u32 arg2) +Gfx *text_configure_colours_v1(Gfx *gdl, s32 x, s32 y) { - u32 colour = text0f1543ac(arg1, arg2, g_Blend.colour04); + u32 colour = text_get_colour_at_pos(x, y, g_Blend.colour04); if (colour != g_Blend.colour44) { gDPSetColor(gdl++, G_SETENVCOLOR, colour); @@ -2120,7 +2128,7 @@ Gfx *text0f1566cc(Gfx *gdl, u32 arg1, u32 arg2) g_Blend.colour44 = colour; - colour = (g_Blend.colour08 & 0xffffff00) | (text0f1543ac(arg1, arg2, g_Blend.colour08) & 0xff); + colour = (g_Blend.colour08 & 0xffffff00) | (text_get_colour_at_pos(x, y, g_Blend.colour08) & 0xff); if (colour != g_Blend.colour48) { gDPSetPrimColorViaWord(gdl++, 0, 0, colour); @@ -2131,73 +2139,73 @@ Gfx *text0f1566cc(Gfx *gdl, u32 arg1, u32 arg2) return gdl; } -Gfx *text_render_char(Gfx *gdl, s32 *x, s32 *y, struct fontchar *char1, struct fontchar *char2, - struct font *font, s32 arg6, s32 arg7, s32 arg8, s32 arg9, s32 arg10) +Gfx *text_render_char_v1(Gfx *gdl, s32 *x, s32 *y, struct fontchar *thischardata, struct fontchar *prevchardata, + struct font *font, s32 left, s32 top, s32 width, s32 height, s32 shadowoffset) { s32 tmp; s32 sp38; - sp38 = *y + arg10; + sp38 = *y + shadowoffset; - tmp = font->kerning[char2->kerningindex * 13 + char1->kerningindex] + var8007fac4; - *x -= (tmp - 1) * var8007fad0; + tmp = font->kerning[prevchardata->kerningindex * 13 + thischardata->kerningindex] + g_TextCharOverlap; + *x -= (tmp - 1) * g_TextScaleX; if (*x > 0 && *x <= vi_get_width() - && sp38 + char1->baseline <= vi_get_height() - && *x <= arg6 + arg8 - && char1->baseline + sp38 <= arg7 + arg9 - && *x >= arg6 - && sp38 + char1->baseline + char1->height >= arg7) { + && sp38 + thischardata->baseline <= vi_get_height() + && *x <= left + width + && thischardata->baseline + sp38 <= top + height + && *x >= left + && sp38 + thischardata->baseline + thischardata->height >= top) { #if VERSION >= VERSION_JPN_FINAL - if (char1->pixeldata == NULL) { - char1->pixeldata = (void *)lang_get_jpn_char_pixels(char1->index - 0x80); + if (thischardata->pixeldata == NULL) { + thischardata->pixeldata = (void *)lang_get_jpn_char_pixels(thischardata->index - 0x80); } #else if (g_Blend.types) { - gdl = text0f1566cc(gdl, *x / g_ScaleX, *y + arg10); + gdl = text_configure_colours_v1(gdl, *x / g_UiScaleX, *y + shadowoffset); } #endif - gDPSetTextureImage(gdl++, G_IM_FMT_CI, G_IM_SIZ_16b, 1, char1->pixeldata); + gDPSetTextureImage(gdl++, G_IM_FMT_CI, G_IM_SIZ_16b, 1, thischardata->pixeldata); gDPLoadSync(gdl++); - gDPLoadBlock(gdl++, G_TX_LOADTILE, 0, 0, ((char1->height * 8 + 17) >> 1) - 1, 2048); + gDPLoadBlock(gdl++, G_TX_LOADTILE, 0, 0, ((thischardata->height * 8 + 17) >> 1) - 1, 2048); gDPPipeSync(gdl++); - gdl = text0f156a24(gdl, *x - var8007fad0, sp38 - 1, char1, arg6, arg7 - 1, arg8, arg9); + gdl = text_render_char_v1_part2(gdl, *x - g_TextScaleX, sp38 - 1, thischardata, left, top - 1, width, height); } - *x += char1->width * var8007fad0; + *x += thischardata->width * g_TextScaleX; return gdl; } -Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32 arg5, s32 arg6, s32 arg7) +Gfx *text_render_char_v1_part2(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32 arg5, s32 arg6, s32 arg7) { if (arg4 + arg6 >= char1->width + x + 2) { if (y + char1->baseline >= arg5) { if (arg5 + arg7 >= y + char1->baseline + char1->height + 2) { if (g_TextRotated90) { gSPTextureRectangleFlip(gdl++, - ((y - char1->baseline) - ((char1->height + 2) * var8007fad0)) * 4, + ((y - char1->baseline) - ((char1->height + 2) * g_TextScaleX)) * 4, x * 4, (y - char1->baseline) * 4, (x + char1->width + 2) * 4, G_TX_RENDERTILE, 0, (char1->height + 1) << 5, - 1024 / var8007fad0, + 1024 / g_TextScaleX, -1024); } else { gSPTextureRectangle(gdl++, x * 4, (y + char1->baseline) * 4, - (x + char1->width * var8007fad0 + 2) * 4, + (x + char1->width * g_TextScaleX + 2) * 4, (y + char1->baseline + char1->height + 2) * 4, G_TX_RENDERTILE, 0, 0, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024); } } else { @@ -2205,12 +2213,12 @@ Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32 gSPTextureRectangle(gdl++, x * 4, (y + char1->baseline) * 4, - (x + char1->width * var8007fad0 + 2) * 4, + (x + char1->width * g_TextScaleX + 2) * 4, (arg5 + arg7) * 4, G_TX_RENDERTILE, 0, 0, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024); } } @@ -2219,12 +2227,12 @@ Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32 gSPTextureRectangle(gdl++, x * 4, arg5 * 4, - (x + char1->width * var8007fad0 + 2) * 4, + (x + char1->width * g_TextScaleX + 2) * 4, (y + char1->baseline + char1->height + 2) * 4, G_TX_RENDERTILE, 0, (arg5 - char1->baseline - y) << 5, - 1024 / var8007fad0, + 1024 / g_TextScaleX, 1024); } } @@ -2233,9 +2241,17 @@ Gfx *text0f156a24(Gfx *gdl, s32 x, s32 y, struct fontchar *char1, s32 arg4, s32 return gdl; } -Gfx *text_render(Gfx *gdl, s32 *x, s32 *y, char *text, - struct fontchar *chars, struct font *font, u32 arg6, u32 colour, - s32 width, s32 height, u32 arg10, s32 lineheight) +/** + * The v1 renderer is likely very similar, if not the same as GE's. + * + * It has support for shadows and implements them using the environment colour. + * + * It does not support the hologram refresh effect, oscillating focus colour + * or blend effects. + */ +Gfx *text_render_v1(Gfx *gdl, s32 *x, s32 *y, char *text, + struct fontchar *chars, struct font *font, u32 textcolour, u32 glowcolour, + s32 width, s32 height, s32 shadowoffset, s32 lineheight) { s32 savedx; s32 savedy; @@ -2245,7 +2261,7 @@ Gfx *text_render(Gfx *gdl, s32 *x, s32 *y, char *text, s32 prevchar; #endif - *x *= g_ScaleX; + *x *= g_UiScaleX; savedx = *x; savedy = *y; @@ -2290,19 +2306,19 @@ Gfx *text_render(Gfx *gdl, s32 *x, s32 *y, char *text, gDPSetCombineLERP(gdl++, ENVIRONMENT, PRIMITIVE, TEXEL1_ALPHA, PRIMITIVE, 0, 0, 0, TEXEL0, 0, 0, 0, COMBINED, COMBINED, 0, ENVIRONMENT, 0); - gDPSetPrimColorViaWord(gdl++, 0, 0, colour); - gDPSetEnvColorViaWord(gdl++, arg6); + gDPSetPrimColorViaWord(gdl++, 0, 0, glowcolour); + gDPSetEnvColorViaWord(gdl++, textcolour); gDPPipeSync(gdl++); - g_Blend.colour08 = colour; - g_Blend.colour48 = colour; - g_Blend.colour04 = arg6; - g_Blend.colour44 = arg6; + g_Blend.colour08 = glowcolour; + g_Blend.colour48 = glowcolour; + g_Blend.colour04 = textcolour; + g_Blend.colour44 = textcolour; #if VERSION >= VERSION_PAL_BETA while (*text != '\0') { if (*text == ' ') { - *x += var8007fad0 * 5; + *x += g_TextScaleX * 5; prevchar = 'H'; text++; } else if (*text == '\n') { @@ -2311,19 +2327,19 @@ Gfx *text_render(Gfx *gdl, s32 *x, s32 *y, char *text, prevchar = 'H'; text++; } else { - struct fontchar *sp78; - struct fontchar *sp74; + struct fontchar *thischardata; + struct fontchar *prevchardata; - text_map_code_unit_to_char(&text, &sp78, &sp74, chars, &prevchar); + text_parse_char(&text, &thischardata, &prevchardata, chars, &prevchar); - gdl = text_render_char(gdl, x, y, sp78, sp74, - font, savedx, savedy, width * var8007fad0, height, arg10); + gdl = text_render_char_v1(gdl, x, y, thischardata, prevchardata, + font, savedx, savedy, width * g_TextScaleX, height, shadowoffset); } } #else while (*text != '\0') { if (*text == ' ') { - *x += var8007fad0 * 5; + *x += g_TextScaleX * 5; prevchar = 'H'; text++; } else if (*text == '\n') { @@ -2332,27 +2348,27 @@ Gfx *text_render(Gfx *gdl, s32 *x, s32 *y, char *text, prevchar = 'H'; text++; } else if (*text < 0x80) { - gdl = text_render_char(gdl, x, y, &chars[*text - 0x21], &chars[prevchar - 0x21], - font, savedx, savedy, width * var8007fad0, height, arg10); + gdl = text_render_char_v1(gdl, x, y, &chars[*text - 0x21], &chars[prevchar - 0x21], + font, savedx, savedy, width * g_TextScaleX, height, shadowoffset); prevchar = *text; text++; } else { u16 codepoint = ((*text & 0x7f) << 7) | (text[1] & 0x7f); - struct fontchar sp74 = {0, 0, 12, 11}; + struct fontchar chardata = {0, 0, 12, 11}; if (codepoint & 0x2000) { - sp74.width = 15; - sp74.height = 16; + chardata.width = 15; + chardata.height = 16; } if ((codepoint & 0x1fff) >= 0x3c8) { codepoint = 2; } - sp74.index = codepoint + 0x80; - sp74.pixeldata = (void *)lang_get_jpn_char_pixels(codepoint); + chardata.index = codepoint + 0x80; + chardata.pixeldata = (void *)lang_get_jpn_char_pixels(codepoint); - gdl = text_render_char(gdl, x, y, &sp74, &sp74, font, savedx, savedy, width * var8007fad0, height, arg10); + gdl = text_render_char_v1(gdl, x, y, &chardata, &chardata, font, savedx, savedy, width * g_TextScaleX, height, shadowoffset); text += 2; } @@ -2365,15 +2381,29 @@ Gfx *text_render(Gfx *gdl, s32 *x, s32 *y, char *text, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - *x = *x / g_ScaleX; + *x = *x / g_UiScaleX; return gdl; } #if VERSION == VERSION_JPN_FINAL -Gfx *func0f1574d0jf(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1, struct font *font2, s32 colour, u32 colour2, s32 width, s32 height, s32 arg9, u32 arg10) +/** + * In all versions prior to JPN, there are two functions to render text: + * text_render_v1 and text_render_v2. + * + * For the Japanese version, Rare wanted to switch many of the calls from + * text_render_v1 to text_render_v2. They introduced this helper function which + * has the same arguments as text_render_v1 but wraps text_render_v2. This means + * they only had to replace the function name in all the places where they + * wanted to switch to the other function rather than change the arguments too. + * + * In decomp, to avoid ifdefs everywhere where it was changed, we call + * text_render_vx. In versions prior to JPN this is redefined to text_render_v1 + * in text.h. In JPN it's Rare's wrapper function. + */ +Gfx *text_render_vx(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1, struct font *font2, u32 textcolour, u32 shadowcolour, s32 width, s32 height, s32 shadowoffset, s32 lineheight) { - return text_render_projected(gdl, x, y, text, font1, font2, colour, width, height, arg9, arg10); + return text_render_v2(gdl, x, y, text, font1, font2, textcolour, width, height, shadowoffset, lineheight); } #endif @@ -2409,8 +2439,8 @@ glabel text_measure /* f157358: 10c00059 */ beqz $a2,.L0f1574c0 /* f15735c: 00000000 */ nop /* f157360: 90c40000 */ lbu $a0,0x0($a2) -/* f157364: 3c148008 */ lui $s4,%hi(var8007fac4) -/* f157368: 2694fac4 */ addiu $s4,$s4,%lo(var8007fac4) +/* f157364: 3c148008 */ lui $s4,%hi(g_TextCharOverlap) +/* f157368: 2694fac4 */ addiu $s4,$s4,%lo(g_TextCharOverlap) /* f15736c: 10800054 */ beqz $a0,.L0f1574c0 /* f157370: 00804025 */ or $t0,$a0,$zero /* f157374: 2413000d */ addiu $s3,$zero,0xd @@ -2505,14 +2535,14 @@ glabel text_measure /* f1574b8: 1480ffb3 */ bnez $a0,.L0f157388 /* f1574bc: 00804025 */ or $t0,$a0,$zero .L0f1574c0: -/* f1574c0: 3c0e8008 */ lui $t6,%hi(g_ScaleX) -/* f1574c4: 8dcefac0 */ lw $t6,%lo(g_ScaleX)($t6) +/* f1574c0: 3c0e8008 */ lui $t6,%hi(g_UiScaleX) +/* f1574c4: 8dcefac0 */ lw $t6,%lo(g_UiScaleX)($t6) /* f1574c8: 24010001 */ addiu $at,$zero,0x1 -/* f1574cc: 3c0f8008 */ lui $t7,%hi(var8007fad0) +/* f1574cc: 3c0f8008 */ lui $t7,%hi(g_TextScaleX) /* f1574d0: 55c10008 */ bnel $t6,$at,.L0f1574f4 /* f1574d4: 8cae0000 */ lw $t6,0x0($a1) /* f1574d8: 8cb90000 */ lw $t9,0x0($a1) -/* f1574dc: 8deffad0 */ lw $t7,%lo(var8007fad0)($t7) +/* f1574dc: 8deffad0 */ lw $t7,%lo(g_TextScaleX)($t7) /* f1574e0: 032f0019 */ multu $t9,$t7 /* f1574e4: 0000c012 */ mflo $t8 /* f1574e8: acb80000 */ sw $t8,0x0($a1) @@ -2542,8 +2572,8 @@ void text_measure(s32 *textheight, s32 *textwidth, char *text, struct fontchar * #if VERSION == VERSION_JPN_FINAL s32 overlap = 0; struct fontchar *tmp2 = font1; - struct fontchar *sp54; - struct fontchar *sp50; + struct fontchar *thischardata; + struct fontchar *prevchardata; #endif s32 tmp; @@ -2595,50 +2625,50 @@ void text_measure(s32 *textheight, s32 *textwidth, char *text, struct fontchar * text++; } else { #if VERSION >= VERSION_JPN_FINAL - text_map_code_unit_to_char(&text, &sp54, &sp50, font1, &prevchar); + text_parse_char(&text, &thischardata, &prevchardata, font1, &prevchar); overlap = 0; - if (sp54->index == 0xbe) { + if (thischardata->index == 0xbe) { overlap = 4; } - if (sp54->index == 0x84) { + if (thischardata->index == 0x84) { overlap = 7; } if (font2) { - tmp = font2->kerning[sp50->kerningindex * 13 + sp54->kerningindex] + var8007fac4 - 1; + tmp = font2->kerning[prevchardata->kerningindex * 13 + thischardata->kerningindex] + g_TextCharOverlap - 1; } else { tmp = 0; } - *textwidth = *textwidth + sp54->width - tmp; + *textwidth = *textwidth + thischardata->width - tmp; #elif VERSION >= VERSION_PAL_BETA - struct fontchar *sp50; - struct fontchar *sp4c; + struct fontchar *thischardata; + struct fontchar *prevchardata; - text_map_code_unit_to_char(&text, &sp50, &sp4c, font1, &prevchar); + text_parse_char(&text, &thischardata, &prevchardata, font1, &prevchar); - tmp = font2->kerning[sp4c->kerningindex * 13 + sp50->kerningindex] + var8007fac4 - 1; - *textwidth = *textwidth + sp50->width - tmp; + tmp = font2->kerning[prevchardata->kerningindex * 13 + thischardata->kerningindex] + g_TextCharOverlap - 1; + *textwidth = *textwidth + thischardata->width - tmp; #else if (*text < 0x80) { // Normal single-byte character thischar = *text; - tmp = font2->kerning[font1[prevchar - 0x21].kerningindex * 13 + font1[thischar - 0x21].kerningindex] + var8007fac4 - 1; + tmp = font2->kerning[font1[prevchar - 0x21].kerningindex * 13 + font1[thischar - 0x21].kerningindex] + g_TextCharOverlap - 1; *textwidth = font1[thischar - 0x21].width + *textwidth - tmp; prevchar = *text; text++; } else if (*text < 0xc0) { // Multi-byte character - tmp = font2->kerning[0] + var8007fac4 - 1; + tmp = font2->kerning[0] + g_TextCharOverlap - 1; *textwidth = *textwidth - tmp + 11; text += 2; } else { // Multi-byte character - tmp = font2->kerning[0] + var8007fac4 - 1; + tmp = font2->kerning[0] + g_TextCharOverlap - 1; *textwidth = *textwidth - tmp + 15; text += 2; } @@ -2648,8 +2678,8 @@ void text_measure(s32 *textheight, s32 *textwidth, char *text, struct fontchar * } // @bug? Shouldn't this go at the very end of the function? - if (g_ScaleX == 1) { - *textwidth *= var8007fad0; + if (g_UiScaleX == 1) { + *textwidth *= g_TextScaleX; } #if VERSION >= VERSION_JPN_FINAL @@ -2663,7 +2693,7 @@ void text_measure(s32 *textheight, s32 *textwidth, char *text, struct fontchar * #endif #if VERSION == VERSION_JPN_FINAL -bool func0f157768jf(s32 arg0, s32 arg1) +bool text_stub(s32 arg0, s32 arg1) { return false; } @@ -2716,7 +2746,7 @@ glabel text_wrap /* f157810: 24170001 */ li $s7,0x1 /* f157814: 3051ffff */ andi $s1,$v0,0xffff /* f157818: 3044ffff */ andi $a0,$v0,0xffff -/* f15781c: 0fc551e1 */ jal func0f154784jf +/* f15781c: 0fc551e1 */ jal text_codepoint_to_sbchar /* f157820: afa70094 */ sw $a3,0x94($sp) /* f157824: 8fa70094 */ lw $a3,0x94($sp) /* f157828: 16000002 */ bnez $s0,.JF0f157834 @@ -2817,7 +2847,7 @@ glabel text_wrap /* f157960: 000e79c0 */ sll $t7,$t6,0x7 /* f157964: 01f82025 */ or $a0,$t7,$t8 /* f157968: 3099ffff */ andi $t9,$a0,0xffff -/* f15796c: 0fc551e1 */ jal func0f154784jf +/* f15796c: 0fc551e1 */ jal text_codepoint_to_sbchar /* f157970: 03202025 */ move $a0,$t9 /* f157974: 14400002 */ bnez $v0,.JF0f157980 /* f157978: 8fa70094 */ lw $a3,0x94($sp) @@ -3043,7 +3073,7 @@ void text_wrap(s32 wrapwidth, char *src, char *dst, struct fontchar *chars, stru c2 = src[1]; multibyte = true; codepoint = ((c1 & 0x7f) << 7) | (c2 & 0x7f); - c = func0f154784jf(codepoint); + c = text_codepoint_to_sbchar(codepoint); if (c2 == '\0') { multibyte = false; @@ -3102,7 +3132,7 @@ void text_wrap(s32 wrapwidth, char *src, char *dst, struct fontchar *chars, stru u8 c2 = curword[wordlen - 1]; u16 codepoint = ((c1 & 0x7f) << 7) | (c2 & 0x7f); - if (func0f154784jf(codepoint) == '\0') { + if (text_codepoint_to_sbchar(codepoint) == '\0') { isvalidchar = false; } } diff --git a/src/game/title.c b/src/game/title.c index b546314bb..ddf17595a 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -237,7 +237,7 @@ Gfx *title0f0165f0(Gfx *gdl, s32 xcentre, s32 ycentre, s32 xscale, s32 yscale, c x = xcentre - xscale * textwidth / 2; y = ycentre - yscale * textheight / 2; - gdl = text_render_projected(gdl, &x, &y, text, font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); return gdl; } @@ -333,7 +333,7 @@ Gfx *title_render_legal(Gfx *gdl) #if VERSION == VERSION_JPN_FINAL gdl = func0f0d479c(gdl); #endif - gdl = text0f153628(gdl); + gdl = text_begin(gdl); elem = g_LegalElements; end = &g_LegalElements[ARRAYCOUNT(g_LegalElements)]; @@ -383,15 +383,15 @@ Gfx *title_render_legal(Gfx *gdl) } if (elem->type == LEGALELEMENTTYPE_LINE) { - gdl = text0f153780(gdl); + gdl = text_end(gdl); #if VERSION == VERSION_JPN_FINAL - gdl = text0f153a34(gdl, elem->x, elem->y - 1, vi_get_width(), elem->y + 1, 0x7f7fff7f); + gdl = text_draw_box(gdl, elem->x, elem->y - 1, vi_get_width(), elem->y + 1, 0x7f7fff7f); #else - gdl = text0f153a34(gdl, elem->x, elem->y, vi_get_width(), elem->y + 2, 0x7f7fff7f); + gdl = text_draw_box(gdl, elem->x, elem->y, vi_get_width(), elem->y + 2, 0x7f7fff7f); #endif - gdl = text0f153628(gdl); + gdl = text_begin(gdl); } else if (elem->type == LEGALELEMENTTYPE_DOLBYLOGO) { - gdl = text0f153780(gdl); + gdl = text_end(gdl); gDPPipeSync(gdl++); gDPSetTexturePersp(gdl++, G_TP_NONE); @@ -412,9 +412,9 @@ Gfx *title_render_legal(Gfx *gdl) (elem->y + 24) << 2, G_TX_RENDERTILE, 0, 0x0300, 0x0400, -0x0400); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); } else if (elem->type == LEGALELEMENTTYPE_RARELOGO) { - gdl = text0f153780(gdl); + gdl = text_end(gdl); gDPPipeSync(gdl++); gDPSetTexturePersp(gdl++, G_TP_NONE); @@ -435,7 +435,7 @@ Gfx *title_render_legal(Gfx *gdl) (elem->y + 42) << 2, G_TX_RENDERTILE, 0, 0x0540, 0x0400, -0x0400); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); } else { #if VERSION == VERSION_JPN_FINAL u32 stack; @@ -445,23 +445,23 @@ Gfx *title_render_legal(Gfx *gdl) if (elem->type == LEGALELEMENTTYPE_WHITETEXTLG || elem->type == LEGALELEMENTTYPE_WHITETEXTSM) { y -= 3; - var8007fad0 = 2; + g_TextScaleX = 2; var80080108jf = 2; if (elem->x == -1) { x += 24; } - gdl = text_render_projected(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); - var8007fad0 = 1; + g_TextScaleX = 1; var80080108jf = 1; } else { - gdl = text_render_projected(gdl, &x, &y, lang_get(elem->textid), font1, font2, (colour & 0xffffff00) | ((colour & 0xff) * 2 / 3), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(elem->textid), font1, font2, (colour & 0xffffff00) | ((colour & 0xff) * 2 / 3), vi_get_width(), vi_get_height(), 0, 0); x = elem->x == -1 ? prevx : elem->x; y = elem->y; - gdl = text_render_projected(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); prevx = x; } @@ -470,28 +470,28 @@ Gfx *title_render_legal(Gfx *gdl) // Render a darker copy of the text one pixel above x = elem->x == -1 ? prevx : elem->x; y = elem->y - 1; - gdl = text_render_projected(gdl, &x, &y, lang_get(elem->textid), font1, font2, (colour & 0xffffff00) | ((colour & 0xff) * 2 / 3), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(elem->textid), font1, font2, (colour & 0xffffff00) | ((colour & 0xff) * 2 / 3), vi_get_width(), vi_get_height(), 0, 0); // Render the text properly x = elem->x == -1 ? prevx : elem->x; y = elem->y; - gdl = text_render_projected(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); prevx = x; #elif VERSION >= VERSION_PAL_BETA x = elem->x == -1 ? prevx : elem->x; y = elem->y; - gdl = text_render_projected(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); prevx = x; #else x = elem->x; y = elem->y; - gdl = text_render_projected(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, lang_get(elem->textid), font1, font2, colour, vi_get_width(), vi_get_height(), 0, 0); #endif } } - gdl = text0f153780(gdl); + gdl = text_end(gdl); } return gdl; @@ -1702,7 +1702,7 @@ Gfx *title_render_typewriter_text(Gfx *gdl, s32 *x, s32 *y, u16 textnum, s32 tim *colourcomponent = tmp = (60 - remaining) * 255 / 60; buffer[0] = text[i]; - gdl = text_render_projected(gdl, x, y, buffer, g_CharsHandelGothicLg, g_FontHandelGothicLg, + gdl = text_render_v2(gdl, x, y, buffer, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0x7f7fffff | (tmp << 8) | (tmp << 16), vi_get_width(), vi_get_height(), 0, 0); } @@ -1716,7 +1716,7 @@ Gfx *title_render_rare_presents(Gfx *gdl) s32 colourcomponent = 255; gdl = title_clear(gdl); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); x = vi_get_view_left() + 50; y = vi_get_view_top() + vi_get_view_height() - 80; @@ -1735,7 +1735,7 @@ Gfx *title_render_rare_presents(Gfx *gdl) gdl = title_render_typewriter_text(gdl, &x, &y, L_OPTIONS_007, g_TitleTimer - 35, &colourcomponent); // "rare presents" } - gdl = text0f153780(gdl); + gdl = text_end(gdl); if (g_TitleTypewriterFinishing) { if (g_TitleAudioHandle == NULL) { @@ -1751,7 +1751,7 @@ Gfx *title_render_rare_presents(Gfx *gdl) if (((s32)(g_20SecIntervalFrac * 80.0f) % 2) == 0) { u32 colour = (colourcomponent << 8) | 0x7f7fffff | (colourcomponent << 16); - gdl = text0f153a34(gdl, x + 2, y, x + 12, y + 20, colour); + gdl = text_draw_box(gdl, x + 2, y, x + 12, y + 20, colour); } gdl = bview_draw_intro_text(gdl); @@ -1760,7 +1760,7 @@ Gfx *title_render_rare_presents(Gfx *gdl) f32 alpha = ((g_TitleTimer - TICKS(222.0f)) / TICKS(78.0f)); u32 stack; - gdl = text0f153a34(gdl, vi_get_view_left(), vi_get_view_top(), + gdl = text_draw_box(gdl, vi_get_view_left(), vi_get_view_top(), vi_get_view_left() + vi_get_view_width(), vi_get_view_top() + vi_get_view_height(), 255.0f * alpha); @@ -2277,12 +2277,12 @@ Gfx *title_render_no_controller(Gfx *gdl) joy_get_connected_controllers(); gdl = title_clear(gdl); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); #if VERSION >= VERSION_JPN_FINAL y = g_TitleViewHeight / 2 - 50; - var8007fad0 = 2; + g_TextScaleX = 2; var80080108jf = 2; // Line 1 @@ -2290,7 +2290,7 @@ Gfx *title_render_no_controller(Gfx *gdl) text_measure(&textheight, &textwidth, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0); x = 288 - textwidth; - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); y += 18; // Line 2 @@ -2298,7 +2298,7 @@ Gfx *title_render_no_controller(Gfx *gdl) text_measure(&textheight, &textwidth, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0); x = 288 - textwidth; - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); y += 28; // Line 3 @@ -2306,7 +2306,7 @@ Gfx *title_render_no_controller(Gfx *gdl) text_measure(&textheight, &textwidth, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0); x = 288 - textwidth; - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); y += 18; // Line 4 @@ -2314,10 +2314,10 @@ Gfx *title_render_no_controller(Gfx *gdl) text_measure(&textheight, &textwidth, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0); x = 288 - textwidth; - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, vi_get_width(), vi_get_height(), 0, 0); y += 18; - var8007fad0 = 1; + g_TextScaleX = 1; var80080108jf = 1; #else // Line 1 @@ -2329,10 +2329,10 @@ Gfx *title_render_no_controller(Gfx *gdl) if (g_Jpn) { width = vi_get_width(); - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, 0x008000ff, width, vi_get_height(), 0, 0); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, 0x008000ff, width, vi_get_height(), 0, 0); } else { width = vi_get_width(); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); } // Line 2 @@ -2344,14 +2344,14 @@ Gfx *title_render_no_controller(Gfx *gdl) if (g_Jpn) { width = vi_get_width(); - gdl = text_render(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, 0x008000ff, width, vi_get_height(), 0, 0); + gdl = text_render_v1(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, 0x008000ff, width, vi_get_height(), 0, 0); } else { width = vi_get_width(); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); } #endif - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } @@ -2401,39 +2401,39 @@ Gfx *title_render_no_expansion(Gfx *gdl) joy_get_connected_controllers(); gdl = title_clear(gdl); - gdl = text0f153628(gdl); + gdl = text_begin(gdl); x = 50; y = g_TitleViewHeight / 2 - 36; - var8007fad0 = 2; + g_TextScaleX = 2; var80080108jf = 2; text = lang_get(L_MPWEAPONS_281); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0); x = 288 - textwidth; width = vi_get_width(); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); y += 18; text = lang_get(L_MPWEAPONS_282); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0); x = 288 - textwidth; width = vi_get_width(); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); y += 18; text = lang_get(L_MPWEAPONS_284); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0); x = 288 - textwidth; width = vi_get_width(); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, vi_get_height(), 0, 0); y += 18; - var8007fad0 = 1; + g_TextScaleX = 1; var80080108jf = 1; - gdl = text0f153780(gdl); + gdl = text_end(gdl); return gdl; } diff --git a/src/game/training.c b/src/game/training.c index 61cea91e9..385711fae 100644 --- a/src/game/training.c +++ b/src/game/training.c @@ -3668,13 +3668,13 @@ Gfx *fr_render_hud_element(Gfx *gdl, s32 x, s32 y, char *string1, char *string2, x2 = x - (textwidth >> 1); y2 = y; - gdl = text0f153858(gdl, &x2, &y2, &textwidth, &textheight); + gdl = text_draw_black_box(gdl, &x2, &y2, &textwidth, &textheight); -#if VERSION >= VERSION_JPN_FINAL - gdl = func0f1574d0jf(gdl, &x2, &y2, string1, + gdl = text_render_vx(gdl, &x2, &y2, string1, g_CharsHandelGothicMd, g_FontHandelGothicMd, fullcolour, halfalpha, vi_get_width(), vi_get_height(), 0, 0); if (string2) { +#if VERSION >= VERSION_JPN_FINAL s32 textheight2; s32 textwidth2; s32 textheight3; @@ -3689,9 +3689,9 @@ Gfx *fr_render_hud_element(Gfx *gdl, s32 x, s32 y, char *string1, char *string2, y2 = y; y2 += 17; - gdl = text0f153858(gdl, &x2, &y2, &textwidth, &textheight); + gdl = text_draw_black_box(gdl, &x2, &y2, &textwidth, &textheight); - gdl = func0f1574d0jf(gdl, &x2, &y2, string2, + gdl = text_render_vx(gdl, &x2, &y2, string2, g_CharsHandelGothicSm, g_FontHandelGothicSm, fullcolour, halfalpha, vi_get_width(), vi_get_height(), 0, 0); y2 = y; @@ -3699,24 +3699,19 @@ Gfx *fr_render_hud_element(Gfx *gdl, s32 x, s32 y, char *string1, char *string2, y2++; x2 -= 4; - gdl = func0f1574d0jf(gdl, &x2, &y2, string3, + gdl = text_render_vx(gdl, &x2, &y2, string3, g_CharsHandelGothicSm, g_FontHandelGothicSm, fullcolour, halfalpha, vi_get_width(), vi_get_height(), 0, 0); - } #else - gdl = text_render(gdl, &x2, &y2, string1, - g_CharsHandelGothicMd, g_FontHandelGothicMd, fullcolour, halfalpha, vi_get_width(), vi_get_height(), 0, 0); - - if (string2) { text_measure(&textheight, &textwidth, string2, g_CharsHandelGothicXs, g_FontHandelGothicXs, 0); x2 = x - (textwidth >> 1); y2 = y + 17; - gdl = text0f153858(gdl, &x2, &y2, &textwidth, &textheight); + gdl = text_draw_black_box(gdl, &x2, &y2, &textwidth, &textheight); - gdl = text_render(gdl, &x2, &y2, string2, + gdl = text_render_vx(gdl, &x2, &y2, string2, g_CharsHandelGothicXs, g_FontHandelGothicXs, fullcolour, halfalpha, vi_get_width(), vi_get_height(), 0, 0); - } #endif + } return gdl; } @@ -3746,7 +3741,7 @@ Gfx *fr_render_hud(Gfx *gdl) alpha = (f32)(g_FrData.menucountdown * 160) / TICKS(60.0f); } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Time red = fr_format_time(string1); @@ -3790,7 +3785,7 @@ Gfx *fr_render_hud(Gfx *gdl) string1, string2, string3, 0x00ff00a0, alpha); } - return text0f153780(gdl); + return text_end(gdl); } #else Gfx *fr_render_hud(Gfx *gdl) @@ -3816,7 +3811,7 @@ Gfx *fr_render_hud(Gfx *gdl) alpha = (f32)(g_FrData.menucountdown * 160) / TICKS(60.0f); } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Time red = fr_format_time(string1); @@ -3858,6 +3853,6 @@ Gfx *fr_render_hud(Gfx *gdl) string1, string2, 0x00ff00a0, alpha); } - return text0f153780(gdl); + return text_end(gdl); } #endif diff --git a/src/game/trainingmenus.c b/src/game/trainingmenus.c index 196469b31..9906e4e95 100644 --- a/src/game/trainingmenus.c +++ b/src/game/trainingmenus.c @@ -154,9 +154,9 @@ MenuItemHandlerResult fr_weapon_list_menu_handler(s32 operation, struct menuitem y++; #endif - gdl = text0f153628(gdl); - gdl = text_render_projected(gdl, &x, &y, bgun_get_name(weaponnum2), g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_begin(gdl); + gdl = text_render_v2(gdl, &x, &y, bgun_get_name(weaponnum2), g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_end(gdl); // Prepare the star texture for the difficulties gDPPipeSync(gdl++); @@ -201,9 +201,9 @@ MenuItemHandlerResult fr_weapon_list_menu_handler(s32 operation, struct menuitem TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); gSPTextureRectangle(gdl++, - (((renderdata->x + i * 13) + 125) << 2) * g_ScaleX, (renderdata->y) << 2, - (((renderdata->x + i * 13) + 136) << 2) * g_ScaleX, (renderdata->y + 11) << 2, - G_TX_RENDERTILE, 0, 0x0160, 1024 / g_ScaleX, -1024); + (((renderdata->x + i * 13) + 125) << 2) * g_UiScaleX, (renderdata->y) << 2, + (((renderdata->x + i * 13) + 136) << 2) * g_UiScaleX, (renderdata->y + 11) << 2, + G_TX_RENDERTILE, 0, 0x0160, 1024 / g_UiScaleX, -1024); } return (s32)gdl; @@ -645,33 +645,33 @@ MenuItemHandlerResult fr_scoring_menu_handler(s32 operation, struct menuitem *it // Top left quarter of target gSPTextureRectangle(gdl++, - ((renderdata->x + 10) << 2) * g_ScaleX, (renderdata->y + 5) << 2, - ((renderdata->x + 42) << 2) * g_ScaleX, (renderdata->y + 37) << 2, - G_TX_RENDERTILE, 16, 1024, 1024 / g_ScaleX, -1024); + ((renderdata->x + 10) << 2) * g_UiScaleX, (renderdata->y + 5) << 2, + ((renderdata->x + 42) << 2) * g_UiScaleX, (renderdata->y + 37) << 2, + G_TX_RENDERTILE, 16, 1024, 1024 / g_UiScaleX, -1024); // Top right quarter of target gSPTextureRectangle(gdl++, - ((renderdata->x + 41) << 2) * g_ScaleX, (renderdata->y + 5) << 2, - ((renderdata->x + 73) << 2) * g_ScaleX, (renderdata->y + 37) << 2, - G_TX_RENDERTILE, 16, 1024, -1024 / g_ScaleX, -1024); + ((renderdata->x + 41) << 2) * g_UiScaleX, (renderdata->y + 5) << 2, + ((renderdata->x + 73) << 2) * g_UiScaleX, (renderdata->y + 37) << 2, + G_TX_RENDERTILE, 16, 1024, -1024 / g_UiScaleX, -1024); // Bottom left quarter of target gSPTextureRectangle(gdl++, - ((renderdata->x + 10) << 2) * g_ScaleX, (renderdata->y + 36) << 2, - ((renderdata->x + 42) << 2) * g_ScaleX, (renderdata->y + 68) << 2, - G_TX_RENDERTILE, 16, 1024, 1024 / g_ScaleX, 1024); + ((renderdata->x + 10) << 2) * g_UiScaleX, (renderdata->y + 36) << 2, + ((renderdata->x + 42) << 2) * g_UiScaleX, (renderdata->y + 68) << 2, + G_TX_RENDERTILE, 16, 1024, 1024 / g_UiScaleX, 1024); // Bottom right quarter of target gSPTextureRectangle(gdl++, - ((renderdata->x + 41) << 2) * g_ScaleX, (renderdata->y + 36) << 2, - ((renderdata->x + 73) << 2) * g_ScaleX, (renderdata->y + 68) << 2, - G_TX_RENDERTILE, 16, 1024, -1024 / g_ScaleX, 1024); + ((renderdata->x + 41) << 2) * g_UiScaleX, (renderdata->y + 36) << 2, + ((renderdata->x + 73) << 2) * g_UiScaleX, (renderdata->y + 68) << 2, + G_TX_RENDERTILE, 16, 1024, -1024 / g_UiScaleX, 1024); #if VERSION >= VERSION_NTSC_1_0 - gdl = text_set_prim_colour(gdl, ((failed ? 0xff000055 : 0x00ff0055) & 0xffffff00) | (((failed ? 0xff000055 : 0x00ff0055) & 0xff) * (renderdata->colour & 0xff) >> 8)); + gdl = text_begin_boxmode(gdl, ((failed ? 0xff000055 : 0x00ff0055) & 0xffffff00) | (((failed ? 0xff000055 : 0x00ff0055) & 0xff) * (renderdata->colour & 0xff) >> 8)); colour = ((failed ? 0xff6969aa : renderdata->colour) & 0xffffff00) | ((((failed ? 0xff6969aa : renderdata->colour) & 0xff) * (renderdata->colour & 0xff)) >> 8); #else - gdl = text_set_prim_colour(gdl, failed ? 0xff000055 : 0x00ff0055); + gdl = text_begin_boxmode(gdl, failed ? 0xff000055 : 0x00ff0055); #endif // NTSC beta uses a static alpha channel, while newer versions take the @@ -691,90 +691,90 @@ MenuItemHandlerResult fr_scoring_menu_handler(s32 operation, struct menuitem *it sprintf(text, "%d\n", frdata->numhitsbullseye); x = renderdata->x + 93; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 15 : 14); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // "Bull's-eye" sprintf(text, lang_get(L_MPMENU_461)); x = renderdata->x + 122; y = renderdata->y + 14; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Bull's-eye score sprintf(text, "%d\n", frdata->numhitsbullseye * 10); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 15 : 14); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Zone 1 count sprintf(text, "%d\n", frdata->numhitsring1); x = renderdata->x + 93; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 27 : 25); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // "Zone 1" sprintf(text, lang_get(L_MPMENU_462)); x = renderdata->x + 122; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 26 : 25); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Zone 1 score sprintf(text, "%d\n", frdata->numhitsring1 * 5); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 27 : 25); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Zone 2 count sprintf(text, "%d\n", frdata->numhitsring2); x = renderdata->x + 93; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 39 : 36); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // "Zone 2" sprintf(text, lang_get(L_MPMENU_463)); x = renderdata->x + 122; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 38 : 36); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Zone 2 score sprintf(text, "%d\n", frdata->numhitsring2 * 2); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 39 : 36); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Zone 3 count sprintf(text, "%d\n", frdata->numhitsring3); x = renderdata->x + 93; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 51 : 47); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // "Zone 3" // Note: developers forgot to remove last argument when copy/pasting sprintf(text, lang_get(L_MPMENU_464), frdata->numhitsring3); x = renderdata->x + 122; y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 50 : 47); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Zone 3 score sprintf(text, "%d\n", frdata->numhitsring3); text_measure(&textheight, &textwidth, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, 0); x = renderdata->x - textheight + (VERSION == VERSION_JPN_FINAL ? 192 : 182); y = renderdata->y + (VERSION == VERSION_JPN_FINAL ? 51 : 47); - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // "Hit total" sprintf(text, lang_get(L_MPMENU_465)); @@ -786,8 +786,8 @@ MenuItemHandlerResult fr_scoring_menu_handler(s32 operation, struct menuitem *it y += 3; #endif - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // Hit total count sprintf(text, "%d\n", frdata->numhitsring3 + frdata->numhitsbullseye + frdata->numhitsring1 + frdata->numhitsring2); @@ -800,45 +800,45 @@ MenuItemHandlerResult fr_scoring_menu_handler(s32 operation, struct menuitem *it y += 3; #endif - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // "Scoring" sprintf(text, lang_get(L_MPMENU_466)); x = renderdata->x + 83; y = renderdata->y + 1; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, COLOUR(), vi_get_width(), vi_get_height(), 0, 0); // "10" sprintf(text, lang_get(L_MPMENU_467)); x = renderdata->x + 38; y = renderdata->y + 35; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); // "5" sprintf(text, lang_get(L_MPMENU_468)); x = renderdata->x + 32; y = renderdata->y + 26; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); // "2" sprintf(text, lang_get(L_MPMENU_469)); x = renderdata->x + 24; y = renderdata->y + 16; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); // "1" sprintf(text, lang_get(L_MPMENU_470)); x = renderdata->x + 14; y = renderdata->y + 4; - gdl = text0f153858(gdl, &x, &y, &textheight, &textwidth); - gdl = text_render_projected(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); + gdl = text_draw_black_box(gdl, &x, &y, &textheight, &textwidth); + gdl = text_render_v2(gdl, &x, &y, text, g_CharsNumeric, g_FontNumeric, COLOURWHITE(), vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153838(gdl); + gdl = text_end_boxmode(gdl); // Render lines between the score table and the target texture @@ -2565,9 +2565,9 @@ MenuItemHandlerResult ci_hangar_title_menu_handler(s32 operation, struct menuite #endif gSPTextureRectangle(gdl++, - ((renderdata->x + 6) << 2) * g_ScaleX, (renderdata->y + 3) << 2, - ((renderdata->x + 60) << 2) * g_ScaleX, (renderdata->y + 39) << 2, - G_TX_RENDERTILE, 0, 0x0480, 1024 / g_ScaleX, -1024); + ((renderdata->x + 6) << 2) * g_UiScaleX, (renderdata->y + 3) << 2, + ((renderdata->x + 60) << 2) * g_UiScaleX, (renderdata->y + 39) << 2, + G_TX_RENDERTILE, 0, 0x0480, 1024 / g_UiScaleX, -1024); leftmargin = -1; } else { @@ -2575,7 +2575,7 @@ MenuItemHandlerResult ci_hangar_title_menu_handler(s32 operation, struct menuite leftmargin = item->param2 / 2; } - gdl = text0f153628(gdl); + gdl = text_begin(gdl); // Render title text = bio_menu_text_name(NULL); @@ -2588,7 +2588,7 @@ MenuItemHandlerResult ci_hangar_title_menu_handler(s32 operation, struct menuite } textheight = renderdata->y + 8; - gdl = text_render_projected(gdl, &textwidth, &textheight, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &textwidth, &textheight, text, g_CharsHandelGothicMd, g_FontHandelGothicMd, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); // Render subheading text = ci_menu_text_hangar_bio_subheading(NULL); @@ -2601,9 +2601,9 @@ MenuItemHandlerResult ci_hangar_title_menu_handler(s32 operation, struct menuite } textheight = renderdata->y + 25; - gdl = text_render_projected(gdl, &textwidth, &textheight, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); + gdl = text_render_v2(gdl, &textwidth, &textheight, text, g_CharsHandelGothicSm, g_FontHandelGothicSm, renderdata->colour, vi_get_width(), vi_get_height(), 0, 0); - gdl = text0f153780(gdl); + gdl = text_end(gdl); return (s32)gdl; } diff --git a/src/include/bss.h b/src/include/bss.h index 1bad6e15d..4ef05d57d 100644 --- a/src/include/bss.h +++ b/src/include/bss.h @@ -211,7 +211,7 @@ extern struct wallhit *g_FreeWallhits; extern struct wallhit *g_ActiveWallhits; extern s32 g_MaxShards; extern struct shard *g_Shards; -extern Gfx *var800a4634; +extern Gfx *g_TextHoloRayGdl; extern struct room *g_Rooms; extern u8 *g_MpRoomVisibility; extern struct bgroom *g_BgRooms; diff --git a/src/include/data.h b/src/include/data.h index 4e7418c79..2e5339e6c 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -410,9 +410,9 @@ extern struct weatherdata *g_WeatherData; extern s32 g_NextShardNum; extern bool g_ShardsActive; extern s32 var800800f0jf; -extern s32 g_ScaleX; +extern s32 g_UiScaleX; extern s32 var80080108jf; -extern s32 var8007fad0; +extern s32 g_TextScaleX; extern struct font *g_FontNumeric; extern struct fontchar *g_CharsNumeric; extern struct font *g_FontHandelGothicXs; @@ -423,7 +423,7 @@ extern struct font *g_FontHandelGothicMd; extern struct fontchar *g_CharsHandelGothicMd; extern struct font *g_FontHandelGothicLg; extern struct fontchar *g_CharsHandelGothicLg; -extern bool var8007fb9c; +extern bool g_TextHoloRayEnabled; extern s32 g_StageIndex; extern s16 var8007fc0c; extern struct drawslot *g_BgSpecialDrawSlot; diff --git a/src/include/game/text.h b/src/include/game/text.h index 1c6814bc7..dd09a9389 100644 --- a/src/include/game/text.h +++ b/src/include/game/text.h @@ -10,18 +10,18 @@ void text_init(void); void text_set_rotation90(bool rotated); -void text0f1531dc(bool arg0); +void text_set_hires(bool hires); void text_reset(void); -Gfx *text0f153628(Gfx *gdl); -Gfx *text0f153780(Gfx *gdl); -Gfx *text_set_prim_colour(Gfx *gdl, u32 colour); -Gfx *text0f153838(Gfx *gdl); -Gfx *text0f153858(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2); -Gfx *text0f1538e4(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2); -Gfx *text0f153990(Gfx *gdl, s32 left, s32 top, s32 width, s32 height); -Gfx *text0f153a34(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour); -Gfx *text0f153ab0(Gfx *gdl); -void text0f153b40(void); +Gfx *text_begin(Gfx *gdl); +Gfx *text_end(Gfx *gdl); +Gfx *text_begin_boxmode(Gfx *gdl, u32 colour); +Gfx *text_end_boxmode(Gfx *gdl); +Gfx *text_draw_black_box(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2); +Gfx *text_draw_black_uibox(Gfx *gdl, s32 *x1, s32 *y1, s32 *x2, s32 *y2); +Gfx *text_draw_black_textbox(Gfx *gdl, s32 left, s32 top, s32 width, s32 height); +Gfx *text_draw_box(Gfx *gdl, s32 x1, s32 y1, s32 x2, s32 y2, u32 colour); +Gfx *text_enable_holo_ray(Gfx *gdl); +void text_disable_holo_ray(void); void text_set_diagonal_blend(s32 x, s32 y, f32 redrawtimer, u8 populated); void text_backup_diagonal_blend_settings(void); void text_restore_diagonal_blend_settings(void); @@ -34,15 +34,19 @@ void text_set_wave_colours(u32 colour1, u32 colour2); void text_reset_blends(void); bool text_has_diagonal_blend(void); u32 text_apply_projection_colour(s32 x, s32 y, u32 colour); -u32 text0f1543ac(s32 x, s32 y, u32 colour); -Gfx *text0f1552d4(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, char *text, struct fontchar *chars, struct font *font, u32 colour, s32 hdir, s32 vdir); -void text0f156024(s32 arg0); -void text0f156030(u32 colour); -Gfx *text_render_projected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *chars, struct font *font, s32 colour, s32 width, s32 height, s32 arg9, s32 lineheight); -Gfx *text_render(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1, struct font *font2, u32 arg6, u32 colour, s32 width, s32 height, u32 arg10, s32 arg11); +u32 text_get_colour_at_pos(s32 x, s32 y, u32 colour); +Gfx *text_render_credits(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, char *text, struct fontchar *chars, struct font *font, u32 colour, s32 hdir, s32 vdir); +void text_set_shadow_enabled(bool enabled); +void text_set_shadow_colour(u32 colour); +Gfx *text_render_v2(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *chars, struct font *font, u32 textcolour, s32 width, s32 height, s32 shadowoffset, s32 lineheight); +Gfx *text_render_v1(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1, struct font *font2, u32 textcolour, u32 shadowcolour, s32 width, s32 height, s32 shadowoffset, s32 lineheight); void text_measure(s32 *textheight, s32 *textwidth, char *text, struct fontchar *font1, struct font *font2, s32 lineheight); void text_wrap(s32 width, char *in, char *out, struct fontchar *font1, struct font *font2); -Gfx *func0f1574d0jf(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1, struct font *font2, s32 colour, u32 colour2, s32 width, s32 height, s32 arg9, u32 arg10); +#if VERSION == VERSION_JPN_FINAL +Gfx *text_render_vx(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar *font1, struct font *font2, u32 textcolour, u32 shadowcolour, s32 width, s32 height, s32 shadowoffset, s32 lineheight); +#else +#define text_render_vx text_render_v1 +#endif #endif diff --git a/src/include/gbiex.h b/src/include/gbiex.h index 4c311964c..eea34eb41 100644 --- a/src/include/gbiex.h +++ b/src/include/gbiex.h @@ -92,13 +92,13 @@ /** * gDPFillRectangleScaled - a wrapper around gDPFillRectangle which applies - * g_ScaleX to the X coordinates. + * g_UiScaleX to the X coordinates. * - * g_ScaleX is normally 1, but 2 when using hi-res. + * g_UiScaleX is normally 1, but 2 when using hi-res. */ -#define gDPFillRectangleScaled(pkt, x1, y1, x2, y2) gDPFillRectangle(pkt, (x1) * g_ScaleX, y1, (x2) * g_ScaleX, y2) +#define gDPFillRectangleScaled(pkt, x1, y1, x2, y2) gDPFillRectangle(pkt, (x1) * g_UiScaleX, y1, (x2) * g_UiScaleX, y2) -#define gDPHudRectangle(pkt, x1, y1, x2, y2) gDPFillRectangle(pkt, (x1) * g_ScaleX, y1, ((x2 + 1)) * g_ScaleX, (y2) + 1) +#define gDPHudRectangle(pkt, x1, y1, x2, y2) gDPFillRectangle(pkt, (x1) * g_UiScaleX, y1, ((x2 + 1)) * g_UiScaleX, (y2) + 1) /** * Custom combiner modes.