diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-07-06 18:06:24 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-06 18:06:24 -0600 |
| commit | ffbb9d54380dd51e9d4d6e6b0c7d8d6f46b49b85 (patch) | |
| tree | 119d7fc1a20238ea476bf38ec281b445e168a8de /src/menu_items.c | |
| parent | a0b202cca4fc4a8aa7f5c24ef4f579018e1f34c6 (diff) | |
[Enhancement] Implement Digital Speedometer (#431)
* Fix crash
* Poorly document camera
* Fix harder cpu items
* Fix item
* Prevent Rare Infinite Loop
* Impl Digital Speedometer
* Update PortMenu.cpp
---------
Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Diffstat (limited to 'src/menu_items.c')
| -rw-r--r-- | src/menu_items.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/menu_items.c b/src/menu_items.c index 17a53d7df..f1039c5f3 100644 --- a/src/menu_items.c +++ b/src/menu_items.c @@ -2285,6 +2285,55 @@ void print_text2(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 FrameInterpolation_ShouldInterpolateFrame(true); } +void print_text2_wide(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 scaleY, s32 arg6) { + MenuTexture* glyphTexture; + s32 characterWidth; + s32 glyphIndex; + + if (text == NULL) { + // @port if invalid text is loaded it will skip rendering it. + return; + } + + // @port Skip Interpolation, if interpolated later remove this tag + FrameInterpolation_ShouldInterpolateFrame(false); + + gSPDisplayList(gDisplayListHead++, D_020077A8); + if (*text != 0) { + do { + glyphIndex = char_to_glyph_index(text); + if (glyphIndex >= 0) { + glyphTexture = (MenuTexture*) segmented_to_virtual_dupe((const void*) gGlyphTextureLUT[glyphIndex]); + load_menu_img(glyphTexture); + gDisplayListHead = + print_letter_wide_right(gDisplayListHead, glyphTexture, column - (gGlyphDisplayWidth[glyphIndex] / 2), row, + arg6, scaleX, scaleY); + if ((glyphIndex >= 0xD5) && (glyphIndex < 0xE0)) { + characterWidth = 0x20; + } else { + characterWidth = 0xC; + } + column = column + (s32) ((characterWidth + tracking) * scaleX); + } else if ((glyphIndex != -2) && (glyphIndex == -1)) { + column = column + (s32) ((tracking + 7) * scaleX); + } else { + gSPDisplayList(gDisplayListHead++, D_020077D8); + return; + } + if (glyphIndex >= 0x30) { + text += 2; + } else { + text += 1; + } + } while (*text != 0); + } + + gSPDisplayList(gDisplayListHead++, D_020077D8); + + // @port Resume Interpolation, if interpolated later remove this tag + FrameInterpolation_ShouldInterpolateFrame(true); +} + void func_800939C8(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 scaleY) { print_text2(column, row, text, tracking, scaleX, scaleY, 1); } @@ -2293,6 +2342,10 @@ void text_draw(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 sc print_text2(column, row, text, tracking, scaleX, scaleY, 2); } +void text_draw_wide(s32 column, s32 row, char* text, s32 tracking, f32 scaleX, f32 scaleY) { + print_text2_wide(column, row, text, tracking, scaleX, scaleY, 2); +} + void func_80093A30(s32 arg0) { func_8009E2A8(D_800F0B1C[arg0]); } |
