+1








f3e61a31aa
* buffers: refresh 15 and revert to base decomp * behavior script * color helper functions * extended bounds * egeo_layout * fixed model ids * camera conf improved * message panel ucode small * graph node * level script * mathutil updates * mathutil updates (allow unused funcs) * behaviors a - beta_fish * Add librtc and fix some data declarations * Move GRUCODE define to proper location in makefile * Refresh 15 * extra * Make ROM name smaller and change messages printed on build a bit * Fix console (lol) * Update UNF to latest master * Make ucode load from .o's (and also fix Super3D) * Fix crash with rumble + custom mario model * graph node and mathutil * removed behaviors * Ldtob documentation * _Putfld labeling * area * behavior actions * camera * debug updates * bubbles * envfx snow * farcall helpers * game init * geo misc * hud * only check if VC on render init * ingame menu * revert goddard to base decomp * insn disasm * interaction documentation * level geo * level update defines * macro special objects formatting changes * main.h documentation * map parser documentation & formatting * airborne documentation * mario actions automatic documentation * mario actions cutscene documentation * mario actions moving documentation and options * mario actions object documentation and options * mario stationary documentation * mario submerged documentation * mario misc documentation * mario step: ledge grab fixes and documentation * mario documentation * memory.h documentation * moving textures * object behaviors * object collision * fix flamethrower bug * object helpers * object list processor documentation * paintings * platform displacement * print / printf * puppycam absf * puppyprint updates and formatting changes * rendering graph node performance optimizations * rumble opt and doc * hqvm back to ultrasm64 * save file documentation and unlock defines * s2d engine * reset various files to ultrasm64 * file select * intro geo documentation * screen transition documentation * segment2.h * shadow overhaul * skybox refactor * sound init: clean up define usage + documentation * spawn object optimizations and documentation * spawn sound cleanup * sram to ultrasm64 * star select cleanup * title screen cleanup * dialogs / text * rename stomp smoke * stomp smoke -> small water splash * updated README * compilation flags * optimized file positions + support function/data sections * surface collision performance improvements * surface load optimizations * camera conf documentation * Allow easier command for opening puppyprint debug * Rearranged framebuffers & fixed puppyprint console printing * Fix shadow scaling and shifting * Fix SILHOUETTE, OBJECTS_REJ, and ucode loading, also clean up render phase system a bit. * Fixed build with BETTER_HANGING off * Clean up OBJECTS_REJ ifdefs * Fix duplicate comment & graph render layers/flags bitmask * Fixed build with BETTER_HANGING off * Fix Fast64 importing by reverting sSegmentTable change * Readded missing functions that caused build errors with Mario head enabled * Fixed clang compilation issues * Add INTER mode for geo_update_layer_transparency * Fix build warnings * bugfix: miscalculation in obj_turn_toward_object * Some puppytech fixes * Further Puppycamera fixes * Fix BUGFIX_DIALOG_TIME_STOP Fixes #136 * Fix sliding platform bparams * Add LEGACY_SHADOW_IDS define for Fast64 compatibility * Apply suggested changes * Better find_in_bounds_yaw_wdw_bob_thi ifdef * Fix build warnings for unused functions * Fixed stale reference bug from obj_mark_for_deletion change * Fixed incorrect digit for 100s #145 * Change groundpound-fix define and functionality to just disable bonking * Fixed puppyroll #134 * Adjust height value for terrain angle to kick in * fixed hi score flashing * Remove menudata backup (#131) Not considered important enough to keep * Fix fread() build warning * Add COURSE_NUM_TO_INDEX to save_file_get_star_flags check in bhv_unagi_init * Fix approach_s16 return value * Use boolean defines for oCapDoScaleVertically * Make the door lock a part of the key door model to eliminate z-fighting, also reduce z fighting on numbered doors with AUTO_LOD enabled. * Move flames to LAYER_TRANSPARENT_INTER * Resolved some compiler warnings and added FALL_THROUGH define (#168) * Address some more compiler warnings with different define toggles * Remove unnecessary fallthrough attribute * fixed geo_process_billboard floating point exception * Allow water to face any direction * Initialize focOffset so that BBH doesn't crash * Removed superfluous RDP commands when switching microcodes which would override scissor * Set OBJ_FLAG_DONT_CALC_COLL_DIST on bhvUkikiCage * Fix rumble build * Fixed UNLOCK_FPS strobing * Update src/game/object_helpers.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Update src/game/object_helpers.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Fix LEGACY_SHADOW_IDS id conflict * Use the vanilla default value for rotating fire bars if bparam2 is 0 * START_LEVEL safeguard * Fix some drawing distance issues caused by AUTO_COLLISION_DISTANCE * Fix rumble build * Fixed spline poll code using the wrong values for keyframes * Update readme with better credits Better credits for individual contributors * add arthur * added falco and moose * add fazana * le funny typo * added S2DEX engine to credits * silhouette + axo + ratio * remove specific callouts + add auto col distance * Update data/behavior_data.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Update data/behavior_data.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Update data/behavior_data.c Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> * Revert formatting changes to match vanilla decomp * Re-implement Y buffer for find_ceil * Re-implement POWER_STARS_HEAL for normal Power Stars * Start level comment & exit course comment/collapse * utilize reonucam technique for FAST_VERTICAL_CAMERA_MOVEMENT * Fix "MAX_REFERENCED_WALLS" typo * Allow stop_and_set_height_to_floor to work at any height if Mario is teleporting (#213) * Revert stop_and_set_height_to_floor to vanilla Fixes #208 * Fixed sAudioEnabled so that it disables audio CPU processing as well * Fixed puppyprint debug RDP us calculations * Renamed sAudioEnabled to gAudioEnabled * Replaced mtxf_to_mtx_asm with an equivalent implementation that supports WORLD_SCALE * Moved extended bounds and world scale configuration to a new config_world.h file * Default all objects to non-rej (#227) Fixes #221 (Default all objects to non-rej) * Fix #221 * Fix VISUAL_DEBUG breaking/crashing when OBJECTS_REJ is disabled (#211) * Fix VISUAL_DEBUG breaking/crashing when OBJECTS_REJ is disabled * Change vtl decrement in visual_surface_display from 6 to 3 Fixes #207 * Make area in SL igloo wider to prevent a softlock (#233) Fixes #210 * Fix coin formation coins being deleted if they spawn in the middle of a floor, also fix TTM slide coin position (#232) Fixes #201 * Make UNLOCK_ALL apply to more things * Fix wrong ifdef/ifndef in bhv_invisible_objects_under_bridge_init * Change chain chomp load/unload distances depending on number of segments (#237) Fixes #192 * added WATER_PLUNGE_UPWARP define * Add reonucam patch (#239) * added reonucam patch Fixes #218 * Fix how shadows handle water/transparency/height (#228) * Fix how shadows handle water/transparency/height * Change shadow check for flying carpets from a level specific check to a oPlatformOnTrackType check Fixes #179 * added reonucam credit * delete unnecesary patches * Apply suggested changes * murdered more patches * UNLOCK_ALL unlocks the cap boxes * UNLOCK_ALL unlocks cap boxes (slightly more epic edition) * revert ceil buffer * Renamed HD_INTRO_TEXTURES define, separated intro floombas * prevent double definition of floombas * actually prevent floomba redefinition * Develop/refactor default defines (#242) * Changed default config options * Added build dir to includePaths for pngs * disable NO_SLEEP by default * Disable puppyprint by default Sorry fazana 😔 * fix typos * add comment about BETTER_REVERB console perf * disable blue coin switch retry by default * Update config_audio.h Co-authored-by: Reonu <danileon95@gmail.com> Co-authored-by: Mr-Wiseguy <68165316+Mr-Wiseguy@users.noreply.github.com> * revert air step line to vanilla to fix bitfs scaling platform issue (#247) Fixes #200 * Fix stuttering on thin slopes (#248) * Fix stuttering on thin slopes * Revert vec3f_find_ceil calls to vanilla * Rename vec3f_find_ceil to find_mario_ceil * Update src/engine/surface_collision.h Fixes #249 * Swap static and dynamic surface checks back to vanilla order (#253) * Swap static and dynamic surface checks back to vanilla order * re-enable DISABLE_ALL config Fixes #251 #252 * Fixed save and quitting while in widescreen (#257) * Fixed save and quitting while in widescreen * use define for the level * all my homies hate ifdefs * skip wall offsets < 0 (#255) Fixes #255 * #264: Document non-stop stars' issues (#267) * #264: Document non-stop stars' issues * Update include/config/config_game.h * nonstop vanilla comment * derive margin_radius from radius after capping at 200 (#266) Fixes #259 * Config cleanup/refactor (#269) * Moved puppyprint define to graphics / rearranged some debug defines for ease of access * Moved compatibility safeguards to config_safeguards.h * spacing and comment formatting * #272 Move GFX_POOL_SIZE to config_graphics.h * disable EASIER_DIALOG_TRIGGER by default * prevent redefining warnings * small ifdef typo * changed ifndef to undefs Fixes #262 Fixes #272 * Improved movement config documentation related to turning around (#271) Fixes #270 * rename CUSTOM_DEBUG, add comments (#275) * Update README.md (#277) * v2.0.0 Co-authored-by: CrashOveride95 <crashoveride953@gmail.com> Co-authored-by: Arceveti <73617174+Arceveti@users.noreply.github.com> Co-authored-by: n64 <n64> Co-authored-by: Fazana <52551480+FazanaJ@users.noreply.github.com> Co-authored-by: Mr-Wiseguy <mrwiseguyromhacking@gmail.com> Co-authored-by: aglab2 <aglab3@gmail.com> Co-authored-by: gheskett <gheskett@gmail.com> Co-authored-by: Reonu <danileon95@gmail.com> Co-authored-by: Axollyon <20480418+Axollyon@users.noreply.github.com> Co-authored-by: Mr-Wiseguy <68165316+Mr-Wiseguy@users.noreply.github.com>
473 lines
12 KiB
C
473 lines
12 KiB
C
#include <ultra64.h>
|
|
|
|
#include "config.h"
|
|
#include "game_init.h"
|
|
#include "memory.h"
|
|
#include "print.h"
|
|
#include "segment2.h"
|
|
|
|
/**
|
|
* This file handles printing and formatting the colorful text that
|
|
* appears when printing things such as "PRESS START".
|
|
*/
|
|
|
|
struct TextLabel {
|
|
u32 x;
|
|
u32 y;
|
|
s16 length;
|
|
char buffer[50];
|
|
};
|
|
|
|
/**
|
|
* Stores the text to be rendered on screen
|
|
* and how they are to be rendered.
|
|
*/
|
|
struct TextLabel *sTextLabels[52];
|
|
s16 sTextLabelsCount = 0;
|
|
|
|
/**
|
|
* Returns n to the exponent power, only for non-negative powers.
|
|
*/
|
|
s32 int_pow(s32 n, s32 exponent) {
|
|
s32 result = 1;
|
|
s32 i;
|
|
|
|
for (i = 0; i < exponent; i++) {
|
|
result = n * result;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Formats an integer n for print by fitting it to width, prefixing with a negative,
|
|
* and converting the base.
|
|
*/
|
|
void format_integer(s32 n, s32 base, char *dest, s32 *totalLength, u8 width, s8 zeroPad) {
|
|
u32 powBase;
|
|
s32 numDigits = 0;
|
|
s32 i;
|
|
s32 len = 0;
|
|
s8 digit;
|
|
s8 negative = FALSE;
|
|
char pad;
|
|
|
|
if (zeroPad) {
|
|
pad = '0';
|
|
} else {
|
|
pad = -1;
|
|
}
|
|
|
|
if (n != 0) {
|
|
// Formats a negative number for negative prefix.
|
|
if (n < 0) {
|
|
n = -n;
|
|
negative = TRUE;
|
|
}
|
|
|
|
// Increments the number of digits until length is long enough.
|
|
while (TRUE) {
|
|
powBase = int_pow(base, numDigits);
|
|
|
|
if (powBase > (u32) n) {
|
|
break;
|
|
}
|
|
|
|
numDigits++;
|
|
}
|
|
|
|
// Add leading pad to fit width.
|
|
if (width > numDigits) {
|
|
for (len = 0; len < width - numDigits; len++) dest[len] = pad;
|
|
|
|
// Needs 1 length to print negative prefix.
|
|
if (negative == TRUE) {
|
|
len--;
|
|
}
|
|
}
|
|
|
|
// Use 'M' prefix to indicate negative numbers.
|
|
if (negative == TRUE) {
|
|
dest[len] = 'M';
|
|
len++;
|
|
}
|
|
|
|
// Transfer the digits into the proper base.
|
|
for (i = numDigits - 1; i >= 0; i--) {
|
|
powBase = int_pow(base, i);
|
|
digit = n / powBase;
|
|
|
|
// FIXME: Why doesn't [] match?
|
|
if (digit < 10) {
|
|
*(dest + len + numDigits - 1 - i) = digit + '0';
|
|
} else {
|
|
*(dest + len + numDigits - 1 - i) = digit + '7';
|
|
}
|
|
|
|
n -= digit * powBase;
|
|
}
|
|
} else { // n is zero.
|
|
numDigits = 1;
|
|
if (width > numDigits) {
|
|
for (len = 0; len < width - numDigits; len++) dest[len] = pad;
|
|
}
|
|
dest[len] = '0';
|
|
}
|
|
|
|
*totalLength += numDigits + len;
|
|
}
|
|
|
|
/**
|
|
* Determines the width of the number for printing, writing to 'width'.
|
|
* Additionally, this determines if a number should be zero-padded,
|
|
* writing to 'zeroPad'.
|
|
*/
|
|
void parse_width_field(const char *str, s32 *srcIndex, u8 *width, s8 *zeroPad) {
|
|
s8 digits[12]; // unknown length
|
|
s8 digitsLen = 0;
|
|
s16 i;
|
|
|
|
// If first character is 0, then the string should be zero padded.
|
|
if (str[*srcIndex] == '0') {
|
|
*zeroPad = TRUE;
|
|
}
|
|
|
|
// Read width digits up until the 'd' or 'x' format specifier.
|
|
while (str[*srcIndex] != 'b'
|
|
&& str[*srcIndex] != 'o'
|
|
&& str[*srcIndex] != 'd'
|
|
&& str[*srcIndex] != 'x') {
|
|
digits[digitsLen] = str[*srcIndex] - '0';
|
|
|
|
if (digits[digitsLen] < 0 || digits[digitsLen] >= 10) { // not a valid digit
|
|
*width = 0;
|
|
return;
|
|
}
|
|
|
|
digitsLen++;
|
|
(*srcIndex)++;
|
|
}
|
|
|
|
// No digits
|
|
if (digitsLen == 0) {
|
|
return;
|
|
}
|
|
|
|
// Sum the digits to calculate the total width.
|
|
for (i = 0; i < digitsLen - 1; i++) {
|
|
*width = *width + digits[i] * ((digitsLen - i - 1) * 10);
|
|
}
|
|
|
|
*width = *width + digits[digitsLen - 1];
|
|
}
|
|
|
|
/**
|
|
* Takes a number, finds the intended base, formats the number, and prints it
|
|
* at the given X & Y coordinates.
|
|
*
|
|
* Warning: this fails on too large numbers, because format_integer has bugs
|
|
* related to overflow. For romhacks, prefer sprintf + print_text.
|
|
*/
|
|
void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n) {
|
|
char c = 0;
|
|
s8 zeroPad = FALSE;
|
|
u8 width = 0;
|
|
s32 base = 0;
|
|
s32 len = 0;
|
|
s32 srcIndex = 0;
|
|
|
|
// Don't continue if there is no memory to do so.
|
|
if ((sTextLabels[sTextLabelsCount] = mem_pool_alloc(gEffectsMemoryPool,
|
|
sizeof(struct TextLabel))) == NULL) {
|
|
return;
|
|
}
|
|
|
|
sTextLabels[sTextLabelsCount]->x = x;
|
|
sTextLabels[sTextLabelsCount]->y = y;
|
|
|
|
c = str[srcIndex];
|
|
|
|
while (c != 0) {
|
|
if (c == '%') {
|
|
srcIndex++;
|
|
|
|
parse_width_field(str, &srcIndex, &width, &zeroPad);
|
|
|
|
if (str[srcIndex] != 'b'
|
|
&& str[srcIndex] != 'o'
|
|
&& str[srcIndex] != 'd'
|
|
&& str[srcIndex] != 'x') {
|
|
break;
|
|
}
|
|
if (str[srcIndex] == 'b') base = 2;
|
|
if (str[srcIndex] == 'o') base = 8;
|
|
if (str[srcIndex] == 'd') base = 10;
|
|
if (str[srcIndex] == 'x') base = 16;
|
|
|
|
srcIndex++;
|
|
|
|
format_integer(n, base, sTextLabels[sTextLabelsCount]->buffer + len, &len, width, zeroPad);
|
|
} else { // straight copy
|
|
sTextLabels[sTextLabelsCount]->buffer[len] = c;
|
|
len++;
|
|
srcIndex++;
|
|
}
|
|
c = str[srcIndex];
|
|
}
|
|
|
|
sTextLabels[sTextLabelsCount]->length = len;
|
|
sTextLabelsCount++;
|
|
}
|
|
|
|
/**
|
|
* Prints text in the colorful lettering at given X, Y coordinates.
|
|
*/
|
|
void print_text(s32 x, s32 y, const char *str) {
|
|
char c = 0;
|
|
s32 length = 0;
|
|
s32 srcIndex = 0;
|
|
|
|
// Don't continue if there is no memory to do so.
|
|
if ((sTextLabels[sTextLabelsCount] = mem_pool_alloc(gEffectsMemoryPool,
|
|
sizeof(struct TextLabel))) == NULL) {
|
|
return;
|
|
}
|
|
|
|
sTextLabels[sTextLabelsCount]->x = x;
|
|
sTextLabels[sTextLabelsCount]->y = y;
|
|
|
|
c = str[srcIndex];
|
|
|
|
// Set the array with the text to print while finding length.
|
|
while (c != 0) {
|
|
sTextLabels[sTextLabelsCount]->buffer[length] = c;
|
|
length++;
|
|
srcIndex++;
|
|
c = str[srcIndex];
|
|
}
|
|
|
|
sTextLabels[sTextLabelsCount]->length = length;
|
|
sTextLabelsCount++;
|
|
}
|
|
|
|
/**
|
|
* Prints text in the colorful lettering centered at given X, Y coordinates.
|
|
*/
|
|
void print_text_centered(s32 x, s32 y, const char *str) {
|
|
char c = 0;
|
|
s32 length = 0;
|
|
s32 srcIndex = 0;
|
|
|
|
// Don't continue if there is no memory to do so.
|
|
if ((sTextLabels[sTextLabelsCount] = mem_pool_alloc(gEffectsMemoryPool,
|
|
sizeof(struct TextLabel))) == NULL) {
|
|
return;
|
|
}
|
|
|
|
c = str[srcIndex];
|
|
|
|
// Set the array with the text to print while finding length.
|
|
while (c != 0) {
|
|
sTextLabels[sTextLabelsCount]->buffer[length] = c;
|
|
length++;
|
|
srcIndex++;
|
|
c = str[srcIndex];
|
|
}
|
|
|
|
sTextLabels[sTextLabelsCount]->length = length;
|
|
sTextLabels[sTextLabelsCount]->x = x - length * 6; // * 12 / 2;
|
|
sTextLabels[sTextLabelsCount]->y = y;
|
|
sTextLabelsCount++;
|
|
}
|
|
|
|
/**
|
|
* Converts a char into the proper colorful glyph for the char.
|
|
*/
|
|
s32 char_to_glyph_index(char c) {
|
|
if (c >= 'A' && c <= 'Z') {
|
|
return c - 55;
|
|
}
|
|
|
|
if (c >= 'a' && c <= 'z') {
|
|
return c - 87;
|
|
}
|
|
|
|
if (c >= '0' && c <= '9') {
|
|
return c - 48;
|
|
}
|
|
|
|
if (c == ' ') {
|
|
return GLYPH_SPACE;
|
|
}
|
|
|
|
if (c == '!') {
|
|
return GLYPH_EXCLAMATION_PNT; // !, JP only
|
|
}
|
|
|
|
if (c == '#') {
|
|
return GLYPH_TWO_EXCLAMATION; // !!, JP only
|
|
}
|
|
|
|
if (c == '?') {
|
|
return GLYPH_QUESTION_MARK; // ?, JP only
|
|
}
|
|
|
|
if (c == '&') {
|
|
return GLYPH_AMPERSAND; // &, JP only
|
|
}
|
|
|
|
if (c == '/') {
|
|
return GLYPH_PERCENT; // %, JP only
|
|
}
|
|
|
|
if (c == '-') {
|
|
return GLYPH_MINUS; // minus
|
|
}
|
|
|
|
if (c == '*') {
|
|
return GLYPH_MULTIPLY; // x
|
|
}
|
|
|
|
if (c == '$') {
|
|
return GLYPH_COIN; // coin
|
|
}
|
|
|
|
if (c == '@') {
|
|
return GLYPH_RED_COIN; // red coin
|
|
}
|
|
|
|
if (c == '+') {
|
|
return GLYPH_SILVER_COIN; // silver coin
|
|
}
|
|
|
|
if (c == ',') {
|
|
return GLYPH_MARIO_HEAD; // Imagine I drew Mario's head
|
|
}
|
|
|
|
if (c == '^') {
|
|
return GLYPH_STAR; // star
|
|
}
|
|
|
|
if (c == '.') {
|
|
return GLYPH_PERIOD; // large shaded dot, JP only
|
|
}
|
|
|
|
if (c == '|') {
|
|
return GLYPH_BETA_KEY; // beta key, JP only. Reused for Ü in EU.
|
|
}
|
|
|
|
return GLYPH_SPACE;
|
|
}
|
|
|
|
/**
|
|
* Adds an individual glyph to be rendered.
|
|
*/
|
|
void add_glyph_texture(s8 glyphIndex) {
|
|
const Texture *const *glyphs = segmented_to_virtual(main_hud_lut);
|
|
|
|
gDPPipeSync(gDisplayListHead++);
|
|
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 1, glyphs[glyphIndex]);
|
|
gSPDisplayList(gDisplayListHead++, dl_hud_img_load_tex_block);
|
|
}
|
|
|
|
#ifndef WIDESCREEN
|
|
/**
|
|
* Clips textrect into the boundaries defined.
|
|
*/
|
|
void clip_to_bounds(s32 *x, s32 *y) {
|
|
if (*x < TEXRECT_MIN_X) {
|
|
*x = TEXRECT_MIN_X;
|
|
}
|
|
|
|
if (*x > TEXRECT_MAX_X) {
|
|
*x = TEXRECT_MAX_X;
|
|
}
|
|
|
|
if (*y < TEXRECT_MIN_Y) {
|
|
*y = TEXRECT_MIN_Y;
|
|
}
|
|
|
|
if (*y > TEXRECT_MAX_Y) {
|
|
*y = TEXRECT_MAX_Y;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
/**
|
|
* Renders the glyph that's set at the given position.
|
|
*/
|
|
void render_textrect(s32 x, s32 y, s32 pos) {
|
|
s32 rectBaseX = x + pos * 12;
|
|
s32 rectBaseY = 224 - y;
|
|
s32 rectX;
|
|
s32 rectY;
|
|
|
|
#ifndef WIDESCREEN
|
|
// For widescreen we must allow drawing outside the usual area
|
|
clip_to_bounds(&rectBaseX, &rectBaseY);
|
|
#endif
|
|
rectX = rectBaseX;
|
|
rectY = rectBaseY;
|
|
gSPTextureRectangle(gDisplayListHead++, rectX << 2, rectY << 2, (rectX + 15) << 2,
|
|
(rectY + 15) << 2, G_TX_RENDERTILE, 0, 0, 4 << 10, 1 << 10);
|
|
}
|
|
|
|
/**
|
|
* Renders the text in sTextLabels on screen at the proper locations by iterating
|
|
* a for loop.
|
|
*/
|
|
void render_text_labels(void) {
|
|
s32 i;
|
|
s32 j;
|
|
s8 glyphIndex;
|
|
Mtx *mtx;
|
|
|
|
if (sTextLabelsCount == 0) {
|
|
return;
|
|
}
|
|
|
|
mtx = alloc_display_list(sizeof(*mtx));
|
|
|
|
if (mtx == NULL) {
|
|
sTextLabelsCount = 0;
|
|
return;
|
|
}
|
|
|
|
guOrtho(mtx, 0.0f, SCREEN_WIDTH, 0.0f, SCREEN_HEIGHT, -10.0f, 10.0f, 1.0f);
|
|
gSPPerspNormalize((Gfx *) (gDisplayListHead++), 0xFFFF);
|
|
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
|
gSPDisplayList(gDisplayListHead++, dl_hud_img_begin);
|
|
|
|
for (i = 0; i < sTextLabelsCount; i++) {
|
|
for (j = 0; j < sTextLabels[i]->length; j++) {
|
|
glyphIndex = char_to_glyph_index(sTextLabels[i]->buffer[j]);
|
|
|
|
if (glyphIndex != GLYPH_SPACE) {
|
|
#ifdef VERSION_EU
|
|
// Beta Key was removed by EU, so glyph slot reused.
|
|
// This produces a colorful Ü.
|
|
if (glyphIndex == GLYPH_BETA_KEY) {
|
|
add_glyph_texture(GLYPH_U);
|
|
render_textrect(sTextLabels[i]->x, sTextLabels[i]->y, j);
|
|
|
|
add_glyph_texture(GLYPH_UMLAUT);
|
|
render_textrect(sTextLabels[i]->x, sTextLabels[i]->y + 3, j);
|
|
} else {
|
|
add_glyph_texture(glyphIndex);
|
|
render_textrect(sTextLabels[i]->x, sTextLabels[i]->y, j);
|
|
}
|
|
#else
|
|
add_glyph_texture(glyphIndex);
|
|
render_textrect(sTextLabels[i]->x, sTextLabels[i]->y, j);
|
|
#endif
|
|
}
|
|
}
|
|
|
|
mem_pool_free(gEffectsMemoryPool, sTextLabels[i]);
|
|
}
|
|
|
|
gSPDisplayList(gDisplayListHead++, dl_hud_img_end);
|
|
|
|
sTextLabelsCount = 0;
|
|
}
|