mirror of https://github.com/sm64pc/sm64pc.git
[WIP] Centered texts, replaced logo and fixed courses pool
This commit is contained in:
parent
7652a630c9
commit
f519a344ea
5
Makefile
5
Makefile
|
@ -186,6 +186,11 @@ else
|
|||
endif
|
||||
endif
|
||||
|
||||
# Moon64 custom flags
|
||||
|
||||
# ifeq ($(TOGGLE_GAME_DEBUG),1)
|
||||
# VERSION_CFLAGS += -DTOGGLE_GAME_DEBUG
|
||||
# endif
|
||||
############################ Universal Dependencies ############################
|
||||
|
||||
# (This is a bit hacky, but a lot of rules implicitly depend
|
||||
|
|
|
@ -12,6 +12,10 @@ const LevelScript level_script_entry[] = {
|
|||
SLEEP(/*frames*/ 2),
|
||||
BLACKOUT(/*active*/ FALSE),
|
||||
SET_REG(/*value*/ 0),
|
||||
EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_intro_n64),
|
||||
#ifdef TOGGLE_GAME_DEBUG
|
||||
EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ level_intro_entry_4),
|
||||
#else
|
||||
EXECUTE(/*seg*/ 0x14, /*script*/ _introSegmentRomStart, /*scriptEnd*/ _introSegmentRomEnd, /*entry*/ script_intro_L1),
|
||||
#endif
|
||||
JUMP(/*target*/ level_script_entry),
|
||||
};
|
||||
|
|
|
@ -10,17 +10,7 @@ extern const GeoLayout intro_geo_0003B8[];
|
|||
extern const GeoLayout intro_geo_000414[];
|
||||
|
||||
// leveldata
|
||||
extern Vtx titletest_test_mesh_vtx_0[133];
|
||||
extern Gfx titletest_test_mesh_tri_0[];
|
||||
extern Vtx titletest_test_mesh_vtx_1[407];
|
||||
extern Gfx titletest_test_mesh_tri_1[];
|
||||
extern Vtx titletest_test_mesh_vtx_2[183];
|
||||
extern Gfx titletest_test_mesh_tri_2[];
|
||||
extern Vtx titletest_test_mesh_vtx_3[568];
|
||||
extern Gfx titletest_test_mesh_tri_3[];
|
||||
|
||||
extern Gfx titletest_test_mesh[];
|
||||
|
||||
extern const Gfx intro_seg7_dl_0700B3A0[];
|
||||
extern const Gfx intro_seg7_dl_0700C6A0[];
|
||||
extern const f32 intro_seg7_table_0700C790[];
|
||||
extern const f32 intro_seg7_table_0700C880[];
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,6 +16,7 @@
|
|||
#include "rendering_graph_node.h"
|
||||
#include "save_file.h"
|
||||
#include "segment2.h"
|
||||
#include "moon/utils/moon-gfx.h"
|
||||
|
||||
/**
|
||||
* @file geo_misc.c
|
||||
|
@ -199,28 +200,8 @@ Gfx *geo_exec_cake_end_screen(s32 callContext, struct GraphNode *node, UNUSED f3
|
|||
displayListHead = displayList;
|
||||
|
||||
generatedNode->fnNode.node.flags = (generatedNode->fnNode.node.flags & 0xFF) | 0x100;
|
||||
|
||||
s32 x = 0;
|
||||
s32 y = 0;
|
||||
u32 w = SCREEN_HEIGHT * 2560 / 1920;
|
||||
u32 h = SCREEN_HEIGHT;
|
||||
u8 *texture = "levels/ending/cake";
|
||||
|
||||
gSPDisplayList(displayListHead++, dl_proj_mtx_fullscreen);
|
||||
|
||||
gSPDisplayList(displayListHead++, dl_hud_img_begin);
|
||||
gDPSetTile(displayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPTileSync(displayListHead++);
|
||||
gDPSetTile(displayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 2, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_NOMIRROR, 3, G_TX_NOLOD);
|
||||
gDPSetTileSize(displayListHead++, G_TX_RENDERTILE, 0, 0, w << G_TEXTURE_IMAGE_FRAC, h << G_TEXTURE_IMAGE_FRAC);
|
||||
gDPPipeSync(displayListHead++);
|
||||
gDPSetTextureImage(displayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, texture);
|
||||
gDPLoadSync(displayListHead++);
|
||||
gDPLoadBlock(displayListHead++, G_TX_LOADTILE, 0, 0, w * h - 1, CALC_DXT(w, G_IM_SIZ_32b_BYTES));
|
||||
gSPTextureRectangle(displayListHead++, x << 2, y << 2, (x + w) << 2, (y + h) << 2, G_TX_RENDERTILE, 0, 0, 4 << 10, 1 << 10);
|
||||
gSPDisplayList(displayListHead++, dl_hud_img_end);
|
||||
|
||||
gSPEndDisplayList(displayListHead);
|
||||
moon_draw_texture(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, texture);
|
||||
}
|
||||
|
||||
return displayList;
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "nx/m_controller.h"
|
||||
#endif
|
||||
|
||||
#include "moon/utils/moon-gfx.h"
|
||||
|
||||
/* @file hud.c
|
||||
* This file implements HUD rendering and power meter animations.
|
||||
* That includes stars, lives, coins, camera status, power meter, timer
|
||||
|
@ -65,15 +67,6 @@ static struct UnusedHUDStruct sUnusedHUDValues = { 0x00, 0x0A, 0x00 };
|
|||
|
||||
static struct CameraHUD sCameraHUD = { CAM_STATUS_NONE };
|
||||
|
||||
void render_hud_rectangle(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b) {
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_FILL);
|
||||
gDPSetFillColor(gDisplayListHead++, GPACK_RGBA5551(r, g, b, 255));
|
||||
gDPFillRectangle(gDisplayListHead++, x1, y1, x2 + 1, y2 + 1);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
|
||||
}
|
||||
/**
|
||||
* Renders a rgba16 16x16 glyph texture from a table list.
|
||||
*/
|
||||
|
@ -103,20 +96,6 @@ void render_hud_small_tex_lut(s32 x, s32 y, u8 *texture) {
|
|||
0, 0, 4 << 10, 1 << 10);
|
||||
}
|
||||
|
||||
void render_hud_texture(s32 x, s32 y, u32 w, u32 h, u8 *texture) {
|
||||
gSPDisplayList(gDisplayListHead++, dl_hud_img_begin);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPTileSync(gDisplayListHead++);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 2, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_NOMIRROR, 3, G_TX_NOLOD);
|
||||
gDPSetTileSize(gDisplayListHead++, G_TX_RENDERTILE, 0, 0, w << G_TEXTURE_IMAGE_FRAC, h << G_TEXTURE_IMAGE_FRAC);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, texture);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, w * h - 1, CALC_DXT(w, G_IM_SIZ_32b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, x << 2, y << 2, (x + w) << 2, (y + h) << 2, G_TX_RENDERTILE, 0, 0, 4 << 10, 1 << 10);
|
||||
gSPDisplayList(gDisplayListHead++, dl_hud_img_end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders power meter health segment texture using a table list.
|
||||
*/
|
||||
|
@ -452,10 +431,10 @@ void render_nx_hud(void){
|
|||
s16 w = x + 12;
|
||||
s16 h = y + 4;
|
||||
|
||||
render_hud_rectangle(x - 1, y - 1, w + 1, h + 1, 57, 57, 57);
|
||||
render_hud_rectangle(w, y, w + 2, y + 4, 57, 57, 57);
|
||||
render_hud_rectangle(x, y, w, h, 194, 194, 194);
|
||||
render_hud_rectangle(x, y, x + (s16)(12 * getBatteryPercentage()), h, 76, 235, 52);
|
||||
moon_draw_rectangle(x - 1, y - 1, w + 1, h + 1, 57, 57, 57);
|
||||
moon_draw_rectangle(w, y, w + 2, y + 4, 57, 57, 57);
|
||||
moon_draw_rectangle(x, y, w, h, 194, 194, 194);
|
||||
moon_draw_rectangle(x, y, x + (s16)(12 * getBatteryPercentage()), h, 76, 235, 52);
|
||||
|
||||
x = GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(20);
|
||||
y = 207;
|
||||
|
|
|
@ -24,6 +24,5 @@ enum CameraHUDLut {
|
|||
// Functions
|
||||
void set_hud_camera_status(s16 status);
|
||||
void render_hud(void);
|
||||
void render_hud_rectangle(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b);
|
||||
|
||||
#endif // HUD_H
|
||||
|
|
|
@ -429,7 +429,43 @@ void print_hud_lut_string(s8 hudLUT, s16 x, s16 y, const u8 *str) {
|
|||
|
||||
|
||||
void print_menu_generic_string(s16 x, s16 y, const u8 *str) {
|
||||
moon_draw_text(x, y, str, 0.7f);
|
||||
UNUSED s8 mark = DIALOG_MARK_NONE; // unused in EU
|
||||
s32 strPos = 0;
|
||||
s32 curX = x;
|
||||
s32 curY = y;
|
||||
void **fontLUT = segmented_to_virtual(menu_font_lut);
|
||||
|
||||
while (str[strPos] != DIALOG_CHAR_TERMINATOR) {
|
||||
switch (str[strPos]) {
|
||||
case DIALOG_CHAR_DAKUTEN:
|
||||
mark = DIALOG_MARK_DAKUTEN;
|
||||
break;
|
||||
case DIALOG_CHAR_PERIOD_OR_HANDAKUTEN:
|
||||
mark = DIALOG_MARK_HANDAKUTEN;
|
||||
break;
|
||||
case DIALOG_CHAR_SPACE:
|
||||
curX += 4;
|
||||
break;
|
||||
default:
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, fontLUT[str[strPos]]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_8b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, curX << 2, curY << 2, (curX + 8) << 2,
|
||||
(curY + 8) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
if (mark != DIALOG_MARK_NONE) {
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 1, fontLUT[mark + 0xEF]);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, 8 * 8 - 1, CALC_DXT(8, G_IM_SIZ_8b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, (curX + 6) << 2, (curY - 7) << 2,
|
||||
(curX + 14) << 2, (curY + 1) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
mark = DIALOG_MARK_NONE;
|
||||
}
|
||||
curX += gDialogCharWidths[str[strPos]];
|
||||
}
|
||||
strPos++;
|
||||
}
|
||||
}
|
||||
|
||||
void print_credits_string(s16 x, s16 y, const u8 *str) {
|
||||
|
@ -2190,15 +2226,9 @@ s16 render_pause_courses_and_castle(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(VERSION_JP) || defined(VERSION_SH)
|
||||
#define TXT_HISCORE_X 112
|
||||
#define TXT_HISCORE_Y 48
|
||||
#define TXT_CONGRATS_X 60
|
||||
#else
|
||||
#define TXT_HISCORE_X 109
|
||||
#define TXT_HISCORE_Y 36
|
||||
#define TXT_CONGRATS_X 70
|
||||
#endif
|
||||
|
||||
#define HUD_PRINT_HISCORE 0
|
||||
#define HUD_PRINT_CONGRATULATIONS 1
|
||||
|
@ -2209,11 +2239,9 @@ void print_hud_course_complete_string(s8 str) {
|
|||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, colorFade, colorFade, colorFade, 255);
|
||||
|
||||
if (str == HUD_PRINT_HISCORE) {
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, TXT_HISCORE_X, TXT_HISCORE_Y, get_key_string("TEXT_HUD_HI_SCORE"));
|
||||
} else { // HUD_PRINT_CONGRATULATIONS
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, TXT_CONGRATS_X, 67, get_key_string("TEXT_HUD_CONGRATULATIONS"));
|
||||
}
|
||||
u8* txt = get_key_string(str == HUD_PRINT_HISCORE ? "TEXT_HUD_HI_SCORE" : "TEXT_HUD_CONGRATULATIONS");
|
||||
float x = moon_get_text_width(txt, 1.0, TRUE) / 2;
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, SCREEN_WIDTH / 2 - x, TXT_HISCORE_Y, txt);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
}
|
||||
|
|
|
@ -1194,8 +1194,10 @@ s32 init_level(void) {
|
|||
if (save_file_exists(gCurrSaveFileNum - 1)) {
|
||||
set_mario_action(gMarioState, ACT_IDLE, 0);
|
||||
} else if (gCLIOpts.SkipIntro == 0 && configSkipIntro == 0) {
|
||||
#ifndef TARGET_GAME_DEBUG
|
||||
set_mario_action(gMarioState, ACT_INTRO_CUTSCENE, 0);
|
||||
val4 = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1242,26 +1244,13 @@ s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused) {
|
|||
}
|
||||
|
||||
s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
|
||||
#ifdef VERSION_EU
|
||||
s16 var = eu_get_language();
|
||||
switch (var) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
load_segment_decompress(0x19, _translation_en_mio0SegmentRomStart,
|
||||
_translation_en_mio0SegmentRomEnd);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
load_segment_decompress(0x19, _translation_fr_mio0SegmentRomStart,
|
||||
_translation_fr_mio0SegmentRomEnd);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
load_segment_decompress(0x19, _translation_de_mio0SegmentRomStart,
|
||||
_translation_de_mio0SegmentRomEnd);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
sWarpDest.type = WARP_TYPE_NOT_WARPING;
|
||||
sDelayedWarpOp = WARP_OP_NONE;
|
||||
#ifndef TARGET_GAME_DEBUG
|
||||
gShouldNotPlayCastleMusic = !save_file_exists(gCurrSaveFileNum - 1) && gCLIOpts.SkipIntro == 0 && configSkipIntro == 0;
|
||||
#else
|
||||
gShouldNotPlayCastleMusic = 0;
|
||||
#endif
|
||||
|
||||
gCurrLevelNum = levelNum;
|
||||
gCurrCourseNum = COURSE_NONE;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "gfx_dimensions.h"
|
||||
#include "gfx_dimensions.h"
|
||||
#include "moon/utils/moon-gfx.h"
|
||||
#include "moon/utils/moon-math.h"
|
||||
|
||||
u8 optmenu_open = 0;
|
||||
|
||||
|
@ -391,7 +392,7 @@ static void optmenu_draw_text(s16 x, s16 y, const u8 *str, u8 col) {
|
|||
print_generic_string(textX, y, str);
|
||||
}
|
||||
|
||||
static void optmenu_draw_scaled_text(s16 x, s16 y, const u8 *str, int col, float scale) {
|
||||
static void optmenu_draw_scaled_text(f32 x, f32 y, const u8 *str, int col, float scale) {
|
||||
gDPSetEnvColor(gDisplayListHead++, 0, 0, 0, 255);
|
||||
moon_draw_text(x + 1, y-1, str, scale);
|
||||
if (col == -1) {
|
||||
|
@ -581,21 +582,42 @@ static inline s16 get_hudstr_centered_x(const s16 sx, const u8 *str) {
|
|||
}
|
||||
}
|
||||
|
||||
float gSwitchValue = 0;
|
||||
float gSwitchNewValue = 0;
|
||||
float gGlobal = 0;
|
||||
|
||||
#define _POSIX_C_SOURCE 199309L
|
||||
#include <sys/time.h>
|
||||
|
||||
//Options menu
|
||||
void optmenu_draw(void) {
|
||||
gGlobal += 1.0f;
|
||||
s16 scroll;
|
||||
s16 scrollpos;
|
||||
|
||||
u8* label = get_key_string(currentMenu->label);
|
||||
float range = 0.5f;
|
||||
float step = 0.1f;
|
||||
|
||||
const s16 labelX = get_hudstr_centered_x(160, label);
|
||||
if(gSwitchValue >= range)
|
||||
gSwitchNewValue -= step;
|
||||
else if (gSwitchValue <= -range)
|
||||
gSwitchNewValue += step;
|
||||
|
||||
gSwitchValue = lerp(gSwitchValue, gSwitchNewValue, 0.01f);
|
||||
|
||||
u8* label = get_key_string(currentMenu->label);
|
||||
float txtW = moon_get_text_width(label, 1.0, TRUE);
|
||||
|
||||
const s16 labelX = SCREEN_WIDTH / 2 - txtW / 2;
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 30, 30, 30, 255);
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, labelX, 22, label);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, labelX, 20, label);
|
||||
optmenu_draw_scaled_text(labelX - 50, SCREEN_HEIGHT - 34, getTranslatedText("<"), -1, 0.6f);
|
||||
optmenu_draw_scaled_text(labelX + 130, SCREEN_HEIGHT - 34, getTranslatedText(">"), -1, 0.6f);
|
||||
|
||||
optmenu_draw_scaled_text(labelX - 50 - gSwitchValue, SCREEN_HEIGHT - 34, getTranslatedText("<"), -1, 0.6f);
|
||||
optmenu_draw_scaled_text(labelX + txtW + 50 + gSwitchValue, SCREEN_HEIGHT - 34, getTranslatedText(">"), -1, 0.6f);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
|
||||
PDrintBox(25, 50, SCREEN_WIDTH - 50, SCREEN_HEIGHT * 0.6, 0x00000080, true);
|
||||
|
|
|
@ -26,7 +26,7 @@ extern const u8 eu_course_strings_de_table[];
|
|||
extern Gfx *n64logo_N64_mesh;
|
||||
|
||||
// from intro_segment7
|
||||
extern Gfx *titletest_test_mesh;
|
||||
extern Gfx *intro_seg7_dl_0700B3A0;
|
||||
extern Gfx *intro_seg7_dl_0700C6A0;
|
||||
extern f32 intro_seg7_table_0700C790[];
|
||||
extern f32 intro_seg7_table_0700C880[];
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "sm64.h"
|
||||
#include "text/text-loader.h"
|
||||
#include <string.h>
|
||||
#include "moon/utils/moon-gfx.h"
|
||||
|
||||
/**
|
||||
* @file file_select.c
|
||||
|
@ -1519,8 +1520,8 @@ void print_save_file_star_count(s8 fileIndex, s16 x, s16 y) {
|
|||
#define SELECT_FILE_X 93
|
||||
#define SCORE_X 52
|
||||
#define COPY_X 117
|
||||
#define ERASE_X 177
|
||||
#define SOUNDMODE_X1 sSoundTextX
|
||||
#define ERASE_X 192
|
||||
#define SOUNDMODE_X1 254
|
||||
#define SAVEFILE_X1 92
|
||||
#define SAVEFILE_X2 209
|
||||
#define MARIOTEXT_X1 92
|
||||
|
@ -1539,10 +1540,15 @@ void print_main_menu_strings(void) {
|
|||
get_key_string("TEXT_MONO"),
|
||||
get_key_string("TEXT_HEADSET")
|
||||
};
|
||||
// Print "SELECT FILE" text
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha);
|
||||
print_hud_lut_string(HUD_LUT_DIFF, SELECT_FILE_X, 35, get_key_string("TEXT_SELECT_FILE"));
|
||||
|
||||
// Print "SELECT FILE" text
|
||||
u8* txt = get_key_string("TEXT_SELECT_FILE");
|
||||
float x = moon_get_text_width(txt, 1.0, TRUE) / 2;
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, SCREEN_WIDTH / 2 - x, 35, txt);
|
||||
|
||||
// Print file star counts
|
||||
print_save_file_star_count(SAVE_FILE_A, SAVEFILE_X1, 78);
|
||||
print_save_file_star_count(SAVE_FILE_B, SAVEFILE_X2, 78);
|
||||
|
@ -1551,12 +1557,25 @@ void print_main_menu_strings(void) {
|
|||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
// Print menu names
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha);
|
||||
print_generic_string(SCORE_X, 39, get_key_string("TEXT_SCORE"));
|
||||
print_generic_string(COPY_X, 39, get_key_string("TEXT_COPY"));
|
||||
print_generic_string(ERASE_X, 39, get_key_string("TEXT_ERASE"));
|
||||
sSoundTextX = get_str_x_pos_from_center(254, textSoundModes[sSoundMode], 10.0f);
|
||||
print_generic_string(SOUNDMODE_X1, 39, textSoundModes[sSoundMode]);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha);
|
||||
//Change Copy X
|
||||
|
||||
txt = get_key_string("TEXT_SCORE");
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2;
|
||||
moon_draw_text(70 - x, 39, txt, 1.0);
|
||||
|
||||
txt = get_key_string("TEXT_COPY");
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2;
|
||||
moon_draw_text(129.5f - x, 39, txt, 1.0);
|
||||
|
||||
txt = get_key_string("TEXT_ERASE");
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2;
|
||||
moon_draw_text(ERASE_X - x, 39, txt, 1.0);
|
||||
|
||||
txt = textSoundModes[sSoundMode];
|
||||
x = moon_get_text_width(txt, 1.0, FALSE) / 2 + 0.5;
|
||||
moon_draw_text(SOUNDMODE_X1 - x, 39, txt, 1.0);
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
|
||||
// Print file names
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_begin);
|
||||
|
@ -1575,9 +1594,16 @@ void print_main_menu_strings(void) {
|
|||
* Defines IDs for the top message of the score menu and displays it if the ID is called in messageID.
|
||||
*/
|
||||
void score_menu_display_message(s8 messageID) {
|
||||
u8* txt;
|
||||
float x;
|
||||
switch (messageID) {
|
||||
case SCORE_MSG_CHECK_FILE:
|
||||
print_hud_lut_string_fade(HUD_LUT_DIFF, CHECK_FILE_X, 35, get_key_string("TEXT_CHECK_FILE"));
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha);
|
||||
txt = get_key_string("TEXT_CHECK_FILE");
|
||||
x = moon_get_text_width(txt, 1.0, TRUE) / 2;
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, SCREEN_WIDTH / 2 - x, 35, txt);
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_end);
|
||||
break;
|
||||
case SCORE_MSG_NOSAVE_DATA:
|
||||
print_generic_string_fade(NOSAVE_DATA_X1, 190, get_key_string("TEXT_NO_SAVED_DATA_EXISTS"));
|
||||
|
@ -1647,12 +1673,19 @@ void print_score_menu_strings(void) {
|
|||
* Defines IDs for the top message of the copy menu and displays it if the ID is called in messageID.
|
||||
*/
|
||||
void copy_menu_display_message(s8 messageID) {
|
||||
u8* txt;
|
||||
float x;
|
||||
switch (messageID) {
|
||||
case COPY_MSG_MAIN_TEXT:
|
||||
if (sAllFilesExist == TRUE) {
|
||||
print_generic_string_fade(NOFILE_COPY_X, 190, get_key_string("TEXT_NO_FILE_TO_COPY_FROM"));
|
||||
} else {
|
||||
print_hud_lut_string_fade(HUD_LUT_DIFF, COPY_FILE_X, 35, get_key_string("TEXT_COPY_FILE"));
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha);
|
||||
txt = get_key_string("TEXT_COPY_FILE");
|
||||
x = moon_get_text_width(txt, 1.0, TRUE) / 2;
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, SCREEN_WIDTH / 2 - x, 35, txt);
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_end);
|
||||
}
|
||||
break;
|
||||
case COPY_MSG_COPY_WHERE:
|
||||
|
@ -1837,10 +1870,16 @@ void print_erase_menu_prompt(s16 x, s16 y) {
|
|||
*/
|
||||
void erase_menu_display_message(s8 messageID) {
|
||||
u8 textMarioAJustErased[] = { get_key_string("TEXT_FILE_MARIO_A_JUST_ERASED") };
|
||||
|
||||
u8* txt;
|
||||
float x;
|
||||
switch (messageID) {
|
||||
case ERASE_MSG_MAIN_TEXT:
|
||||
print_hud_lut_string_fade(HUD_LUT_DIFF, ERASE_FILE_X, 35, get_key_string("TEXT_ERASE_FILE"));
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha);
|
||||
txt = get_key_string("TEXT_ERASE_FILE");
|
||||
x = moon_get_text_width(txt, 1.0, TRUE) / 2;
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, SCREEN_WIDTH / 2 - x, 35, txt);
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_end);
|
||||
break;
|
||||
case ERASE_MSG_PROMPT:
|
||||
print_generic_string_fade(90, 190, get_key_string("TEXT_SURE"));
|
||||
|
@ -1961,8 +2000,11 @@ void print_sound_mode_menu_strings(void) {
|
|||
// Print "SOUND SELECT" text
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, sTextBaseAlpha);
|
||||
u8* txt = get_key_string("TEXT_SOUND_SELECT");
|
||||
float x = moon_get_text_width(txt, 1.0, TRUE) / 2;
|
||||
print_hud_lut_string(HUD_LUT_GLOBAL, SCREEN_WIDTH / 2 - x, 35, txt);
|
||||
|
||||
print_hud_lut_string(HUD_LUT_DIFF, SOUND_HUD_X, 35, get_key_string("TEXT_SOUND_SELECT"));
|
||||
// print_hud_lut_string(HUD_LUT_DIFF, SOUND_HUD_X, 35, get_key_string("TEXT_SOUND_SELECT"));
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "types.h"
|
||||
#include "prevent_bss_reordering.h"
|
||||
#include "engine/math_util.h"
|
||||
#include "moon/utils/moon-math.h"
|
||||
|
||||
#include "gfx_dimensions.h"
|
||||
|
||||
|
@ -79,19 +80,7 @@ s8 gameOverBackgroundTable[] = {
|
|||
s8 gameOverBackgroundFlipOrder[] = { 0x00, 0x01, 0x02, 0x03, 0x07, 0x0B,
|
||||
0x0a, 0x09, 0x08, 0x04, 0x05, 0x06 };
|
||||
|
||||
float Clamp01(float value){
|
||||
if (value < 0.0)
|
||||
return 0.0;
|
||||
else if (value > 1.0)
|
||||
return 1.0;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
// Interpolates between /a/ and /b/ by /t/. /t/ is clamped between 0 and 1.
|
||||
float Lerp(float a, float b, float t) {
|
||||
return a + (b - a) * Clamp01(t);
|
||||
}
|
||||
|
||||
Gfx *geo_n64_screen(s32 sp50, struct GraphNode *sp54, UNUSED void *context) {
|
||||
struct GraphNode *graphNode; // sp4c
|
||||
|
@ -148,10 +137,8 @@ Gfx *geo_n64_screen(s32 sp50, struct GraphNode *sp54, UNUSED void *context) {
|
|||
else if (gTitlePos <= -range)
|
||||
gTitlePingPong = 0;
|
||||
|
||||
printf("%d\n", gTitlePingPong);
|
||||
|
||||
gTitleNewPos += step * (gTitlePingPong ? -1 : 1);
|
||||
gTitlePos = Lerp(gTitlePos, gTitleNewPos, (gGlobalCounter / 1000) * 100);
|
||||
gTitlePos = lerp(gTitlePos, gTitleNewPos, (gGlobalCounter / 1000) * 100);
|
||||
|
||||
gTitleRotationCounter += 2;
|
||||
|
||||
|
@ -201,7 +188,7 @@ Gfx *geo_title_screen(s32 sp50, struct GraphNode *sp54, UNUSED void *context) {
|
|||
}
|
||||
guScale(scaleMat, scaleX, scaleY, scaleZ);
|
||||
gSPMatrix(displayListIter++, scaleMat, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
|
||||
gSPDisplayList(displayListIter++, &titletest_test_mesh);
|
||||
gSPDisplayList(displayListIter++, &intro_seg7_dl_0700B3A0);
|
||||
gSPPopMatrix(displayListIter++, G_MTX_MODELVIEW);
|
||||
gSPEndDisplayList(displayListIter);
|
||||
gTitleZoomCounter++;
|
||||
|
@ -231,7 +218,7 @@ Gfx *geo_fade_transition(s32 sp40, struct GraphNode *sp44, UNUSED void *context)
|
|||
if (0) {
|
||||
}
|
||||
}
|
||||
//gSPDisplayList(displayListIter++, &intro_seg7_dl_0700C6A0);
|
||||
gSPDisplayList(displayListIter++, &intro_seg7_dl_0700C6A0);
|
||||
gSPEndDisplayList(displayListIter);
|
||||
if (gTitleZoomCounter >= 0x13) {
|
||||
gTitleFadeCounter += 0x1a;
|
||||
|
|
|
@ -296,17 +296,13 @@ void print_act_selector_strings(void) {
|
|||
if (sVisibleStars != 0) {
|
||||
selectedActName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + sSelectedActIndex]);
|
||||
actNameX = SCREEN_WIDTH / 2 - moon_get_text_width(selectedActName, 0.8f, 0) / 2;
|
||||
print_menu_generic_string(actNameX, 151, selectedActName);
|
||||
moon_draw_text(actNameX, 147, selectedActName, 0.8f);
|
||||
}
|
||||
|
||||
// Print the numbers above each star.
|
||||
for (i = 1; i <= sVisibleStars; i++) {
|
||||
starNumbers[0] = i;
|
||||
#ifdef VERSION_EU
|
||||
print_menu_generic_string(143 - sVisibleStars * 15 + i * 30 , 38, starNumbers);
|
||||
#else
|
||||
print_menu_generic_string(i * 34 - sVisibleStars * 17 + 139, 38, starNumbers);
|
||||
#endif
|
||||
moon_draw_text(i * 35 - sVisibleStars * 17 + 139, 190, starNumbers, 0.8f);
|
||||
}
|
||||
|
||||
gSPDisplayList(gDisplayListHead++, dl_menu_ia8_text_end);
|
||||
|
|
|
@ -100,7 +100,7 @@ void Moon_LoadLanguage( string path ) {
|
|||
courseId++;
|
||||
}
|
||||
|
||||
language->courses = tmpCourses;
|
||||
language->courses.insert(language->courses.end(), &tmpCourses[0], &tmpCourses[course_name_table_size]);
|
||||
|
||||
for (WValue::ConstMemberIterator option = options.MemberBegin(); option != options.MemberEnd(); ++option) {
|
||||
language->strings.insert(pair<string, u8*>(
|
||||
|
@ -114,7 +114,7 @@ void Moon_LoadLanguage( string path ) {
|
|||
narrow(item->name.GetString()),
|
||||
getTranslatedText(narrow(item->value.GetString()).c_str())
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
languages.push_back(language);
|
||||
languagesAmount = languages.size();
|
||||
|
@ -151,7 +151,7 @@ void Moon_InitLanguages( char *exePath, char *gamedir ) {
|
|||
|
||||
void Moon_SetLanguage(LanguageEntry *new_language) {
|
||||
current = new_language;
|
||||
dialogPool = new_language->dialogs.data();
|
||||
seg2_act_name_table = new_language->acts.data();
|
||||
seg2_course_name_table = new_language->courses;
|
||||
dialogPool = current->dialogs.data();
|
||||
seg2_act_name_table = current->acts.data();
|
||||
seg2_course_name_table = current->courses.data();
|
||||
}
|
|
@ -27,11 +27,11 @@ inline std::string narrow (const std::wstring& str) {
|
|||
|
||||
struct LanguageEntry {
|
||||
std::string name;
|
||||
std::string logo;
|
||||
u8* * courses;
|
||||
std::map<std::string, u8*> strings;
|
||||
std::string logo;
|
||||
std::map<std::string, u8*> strings;
|
||||
std::vector<u8*> acts;
|
||||
std::vector<struct DialogEntry*> dialogs;
|
||||
std::vector<u8*> courses;
|
||||
};
|
||||
|
||||
extern std::vector<LanguageEntry*> languages;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "moon-gfx.h"
|
||||
#include "game/ingame_menu.h"
|
||||
#include "game/game_init.h"
|
||||
#include "game/segment2.h"
|
||||
|
||||
f32 moon_get_text_width(u8* text, float scale, u8 colored) {
|
||||
f32 size = 0;
|
||||
|
@ -17,16 +18,31 @@ f32 moon_get_text_width(u8* text, float scale, u8 colored) {
|
|||
return size;
|
||||
}
|
||||
|
||||
void moon_draw_colored_text(f32 x, f32 y, const u8 *str, float scale) {
|
||||
void **hudLUT2 = segmented_to_virtual(main_hud_lut);
|
||||
u32 xStride = round(12 * scale);
|
||||
s32 strPos = 0;
|
||||
s32 w = round(16 * scale);
|
||||
|
||||
while (str[strPos] != GLOBAR_CHAR_TERMINATOR) {
|
||||
if (str[strPos] == GLOBAL_CHAR_SPACE) {
|
||||
x += round(8 * scale);
|
||||
} else {
|
||||
moon_draw_texture(x, y, w, w, hudLUT2[str[strPos]]);
|
||||
x += xStride;
|
||||
}
|
||||
strPos++;
|
||||
}
|
||||
}
|
||||
|
||||
void moon_draw_text(f32 x, f32 y, const u8 *str, float scale) {
|
||||
UNUSED s8 mark = DIALOG_MARK_NONE; // unused in EU
|
||||
s32 strPos = 0;
|
||||
u8 lineNum = 1;
|
||||
|
||||
y += y / scale;
|
||||
|
||||
|
||||
Mtx *_Matrix = (Mtx *) alloc_display_list(sizeof(Mtx));
|
||||
if (!_Matrix) return;
|
||||
guScale(_Matrix, scale, scale, 1.f);
|
||||
guScale(_Matrix, scale, scale - 0.1f, 1.f);
|
||||
create_dl_translation_matrix(MENU_MTX_PUSH, x, y, 0.0f);
|
||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(_Matrix), G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_NOPUSH);
|
||||
|
||||
|
@ -77,4 +93,28 @@ void moon_draw_text(f32 x, f32 y, const u8 *str, float scale) {
|
|||
|
||||
create_dl_scale_matrix(MENU_MTX_NOPUSH, 1.0f, 1.0f, 1.0f);
|
||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
}
|
||||
|
||||
void moon_draw_texture(s32 x, s32 y, u32 w, u32 h, u8 *texture) {
|
||||
gSPDisplayList(gDisplayListHead++, dl_hud_img_begin);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 0, 0, G_TX_LOADTILE, 0, G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR, G_TX_NOMASK, G_TX_NOLOD);
|
||||
gDPTileSync(gDisplayListHead++);
|
||||
gDPSetTile(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 2, 0, G_TX_RENDERTILE, 0, G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_NOMIRROR, 3, G_TX_NOLOD);
|
||||
gDPSetTileSize(gDisplayListHead++, G_TX_RENDERTILE, 0, 0, w << G_TEXTURE_IMAGE_FRAC, h << G_TEXTURE_IMAGE_FRAC);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_RGBA, G_IM_SIZ_32b, 1, texture);
|
||||
gDPLoadSync(gDisplayListHead++);
|
||||
gDPLoadBlock(gDisplayListHead++, G_TX_LOADTILE, 0, 0, w * h - 1, CALC_DXT(w, G_IM_SIZ_32b_BYTES));
|
||||
gSPTextureRectangle(gDisplayListHead++, x << 2, y << 2, (x + w) << 2, (y + h) << 2, G_TX_RENDERTILE, 0, 0, 4 << 10, 1 << 10);
|
||||
gSPDisplayList(gDisplayListHead++, dl_hud_img_end);
|
||||
}
|
||||
|
||||
void moon_draw_rectangle(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b) {
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_FILL);
|
||||
gDPSetFillColor(gDisplayListHead++, GPACK_RGBA5551(r, g, b, 255));
|
||||
gDPFillRectangle(gDisplayListHead++, x1, y1, x2 + 1, y2 + 1);
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
#include "types.h"
|
||||
f32 moon_get_text_width(u8* text, float scale, u8 colored);
|
||||
void moon_draw_colored_text(f32 x, f32 y, const u8 *str, float scale);
|
||||
void moon_draw_text(f32 x, f32 y, const u8 *str, float scale);
|
||||
void moon_draw_rectangle(s16 x1, s16 y1, s16 x2, s16 y2, u8 r, u8 g, u8 b);
|
||||
void moon_draw_texture(s32 x, s32 y, u32 w, u32 h, u8 *texture);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,32 @@
|
|||
#include <math.h>
|
||||
|
||||
float clamp(float value, float min, float max) {
|
||||
if (value < min)
|
||||
value = min;
|
||||
else if (value > max)
|
||||
value = max;
|
||||
return value;
|
||||
}
|
||||
|
||||
float repeat(float t, float length) {
|
||||
return clamp((float) (t - floor(t / length) * length), 0.0f, length);
|
||||
}
|
||||
|
||||
float ping_pong(float t, float length) {
|
||||
t = repeat(t, length * 2.0);
|
||||
return length - abs(t - length);
|
||||
}
|
||||
|
||||
float clamp_01(float value){
|
||||
if (value < 0.0)
|
||||
return 0.0;
|
||||
else if (value > 1.0)
|
||||
return 1.0;
|
||||
else
|
||||
return value;
|
||||
}
|
||||
|
||||
// Interpolates between /a/ and /b/ by /t/. /t/ is clamped between 0 and 1.
|
||||
float lerp(float a, float b, float t) {
|
||||
return a + (b - a) * clamp_01(t);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef MoonMATH
|
||||
#define MoonMATH
|
||||
|
||||
#include "types.h"
|
||||
|
||||
float ping_pong(float t, float length);
|
||||
float clamp_01(float value);
|
||||
float lerp(float a, float b, float t);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue