Widescreen support.

This commit is contained in:
Reonu
2021-05-09 22:34:22 +01:00
parent b7e7c82e93
commit 08223110ff
13 changed files with 3702 additions and 12 deletions

716
enhancements/wide.diff Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,198 @@
diff --git a/include/text_strings.h.in b/include/text_strings.h.in
index 749179b..3b23b41 100644
--- a/include/text_strings.h.in
+++ b/include/text_strings.h.in
@@ -24,6 +24,10 @@
// Ingame Menu
#define TEXT_PAUSE _("PAUSE") // Pause text, Castle Courses
#define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
+#define TEXT_HUD_CURRENT_RATIO_43 _("CURRENT ASPECT RATIO: 4:3. PRESS L TO SWITCH TO 16:9")
+#define TEXT_HUD_CURRENT_RATIO_169 _("CURRENT ASPECT RATIO: 16:9. PRESS L TO SWITCH TO 4:3")
+#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO")
+#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
#if defined(VERSION_JP) || defined(VERSION_SH)
diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
index 8190f88..deb69f5 100644
--- a/src/game/ingame_menu.c
+++ b/src/game/ingame_menu.c
@@ -34,6 +34,11 @@ s16 gDialogY; // D_8032F69C
s16 gCutsceneMsgXOffset;
s16 gCutsceneMsgYOffset;
s8 gRedCoinsCollected;
+u8 textCurrRatio43[] = { TEXT_HUD_CURRENT_RATIO_43 };
+u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 };
+u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
+u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 };
+extern u8 widescreen = 0;
extern u8 gLastCompletedCourseNum;
extern u8 gLastCompletedStarNum;
@@ -2266,6 +2271,14 @@ void render_pause_my_score_coins(void) {
print_generic_string(get_string_width(gTextCourseArr[gInGameLanguage]) + 51, 157, strCourseNum);
#else
print_generic_string(CRS_NUM_X1, 157, strCourseNum);
+ if (widescreen == 0) {
+ print_generic_string(10, 20, textCurrRatio43);
+ }
+ else {
+ print_generic_string(10, 20, textCurrRatio169);
+ print_generic_string(10, 200, textWideInfo);
+ print_generic_string(10, 180, textWideInfo2);
+ }
#endif
actName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + gDialogCourseActNum - 1]);
@@ -2557,10 +2570,25 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
}
}
}
+ if (gPlayer1Controller->buttonPressed & L_TRIG){
+ if (widescreen == 0){
+ widescreen = 1;
+ }
+ else{
+ widescreen = 0;
+ }
+ }
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
-
+ if (widescreen == 0) {
+ print_generic_string(10, 20, textCurrRatio43);
+ }
+ else {
+ print_generic_string(10, 20, textCurrRatio169);
+ print_generic_string(10, 200, textWideInfo);
+ print_generic_string(10, 180, textWideInfo2);
+ }
if (gDialogLineNum < COURSE_STAGES_COUNT) {
courseName = segmented_to_virtual(courseNameTbl[gDialogLineNum]);
render_pause_castle_course_stars(x, y, gCurrSaveFileNum - 1, gDialogLineNum);
@@ -2626,6 +2654,14 @@ s16 render_pause_courses_and_castle(void) {
shade_screen();
render_pause_my_score_coins();
render_pause_red_coins();
+ if (gPlayer1Controller->buttonPressed & L_TRIG){
+ if (widescreen == 0){
+ widescreen = 1;
+ }
+ else{
+ widescreen = 0;
+ }
+ }
if (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) {
render_pause_course_options(99, 93, &gDialogLineNum, 15);
diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c
index 58238e8..aabdb85 100644
--- a/src/game/rendering_graph_node.c
+++ b/src/game/rendering_graph_node.c
@@ -10,6 +10,7 @@
#include "rendering_graph_node.h"
#include "shadow.h"
#include "sm64.h"
+#define WIDESCREEN
/**
* This file contains the code that processes the scene graph for rendering.
@@ -235,6 +236,7 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
/**
* Process a perspective projection node.
*/
+extern u8 widescreen;
static void geo_process_perspective(struct GraphNodePerspective *node) {
if (node->fnNode.func != NULL) {
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
@@ -246,7 +248,13 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
#ifdef VERSION_EU
f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
#else
- f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
+ f32 aspect;
+ if (widescreen == 1){
+ aspect = 1.775f;
+ }
+ else{
+ aspect = 1.33333f;
+ }
#endif
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
diff --git a/src/menu/file_select.c b/src/menu/file_select.c
index c894797..dc759f7 100644
--- a/src/menu/file_select.c
+++ b/src/menu/file_select.c
@@ -2854,10 +2854,12 @@ Gfx *geo_file_select_strings_and_menu_cursor(s32 callContext, UNUSED struct Grap
* Relocates cursor position of the last save if the game goes back to the Mario Screen
* either completing a course choosing "SAVE & QUIT" or having a game over.
*/
+extern u8 widescreen;
s32 lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused) {
#ifdef VERSION_EU
s8 fileNum;
#endif
+ widescreen = 0;
sSelectedButtonID = MENU_BUTTON_NONE;
sCurrentMenuLevel = MENU_LAYER_MAIN;
sTextBaseAlpha = 0;
diff --git a/src/menu/star_select.c b/src/menu/star_select.c
index 025dbf2..d6aaa7e 100644
--- a/src/menu/star_select.c
+++ b/src/menu/star_select.c
@@ -52,7 +52,7 @@ static s8 sSelectableStarIndex = 0;
// Act Selector menu timer that keeps counting until you choose an act.
static s32 sActSelectorMenuTimer = 0;
-
+extern u8 widescreen;
/**
* Act Selector Star Type Loop Action
* Defines a select type for a star in the act selector.
@@ -92,8 +92,15 @@ void bhv_act_selector_star_type_loop(void) {
void render_100_coin_star(u8 stars) {
if (stars & (1 << 6)) {
// If the 100 coin star has been collected, create a new star selector next to the coin score.
- sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
- bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
+ if (widescreen == 1){
+ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+ bhvActSelectorStarType, ((370*4.0f)/3), 24, -300, 0, 0, 0);
+ }
+ else{
+ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+ bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
+ }
+
sStarSelectorModels[6]->oStarSelectorSize = 0.8;
sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
}
@@ -147,11 +154,21 @@ void bhv_act_selector_init(void) {
}
// Render star selector objects
- for (i = 0; i < sVisibleStars; i++) {
- sStarSelectorModels[i] =
- spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
- 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
- sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ if (widescreen == 1) {
+ for (i = 0; i < sVisibleStars; i++) {
+ sStarSelectorModels[i] =
+ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+ (((75 + sVisibleStars * -75 + i * 152)*4.0f)/3), 248, -300, 0, 0, 0);
+ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ }
+ }
+ else {
+ for (i = 0; i < sVisibleStars; i++) {
+ sStarSelectorModels[i] =
+ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+ 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
+ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ }
}
render_100_coin_star(stars);

View File

@@ -0,0 +1,227 @@
diff --git a/include/text_strings.h.in b/include/text_strings.h.in
index 749179b..3b23b41 100644
--- a/include/text_strings.h.in
+++ b/include/text_strings.h.in
@@ -24,6 +24,10 @@
// Ingame Menu
#define TEXT_PAUSE _("PAUSE") // Pause text, Castle Courses
#define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
+#define TEXT_HUD_CURRENT_RATIO_43 _("CURRENT ASPECT RATIO: 4:3. PRESS L TO SWITCH TO 16:9")
+#define TEXT_HUD_CURRENT_RATIO_169 _("CURRENT ASPECT RATIO: 16:9. PRESS L TO SWITCH TO 4:3")
+#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO")
+#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
#if defined(VERSION_JP) || defined(VERSION_SH)
diff --git a/src/game/ingame_menu.c b/src/game/ingame_menu.c
index 9344738..37bc1d1 100644
--- a/src/game/ingame_menu.c
+++ b/src/game/ingame_menu.c
@@ -34,6 +34,11 @@ s16 gDialogY; // D_8032F69C
s16 gCutsceneMsgXOffset;
s16 gCutsceneMsgYOffset;
s8 gRedCoinsCollected;
+u8 textCurrRatio43[] = { TEXT_HUD_CURRENT_RATIO_43 };
+u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 };
+u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
+u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 };
+extern s32 widescreen = 0;
extern u8 gLastCompletedCourseNum;
extern u8 gLastCompletedStarNum;
@@ -1672,6 +1677,7 @@ s8 gDialogCourseActNum = 1;
#define DIAG_VAL2 240 // JP & US
#endif
+
void render_dialog_entries(void) {
#ifdef VERSION_EU
s8 lowerBound;
@@ -1713,7 +1719,7 @@ void render_dialog_entries(void) {
switch (gDialogBoxState) {
case DIALOG_STATE_OPENING:
if (gDialogBoxOpenTimer == DEFAULT_DIALOG_BOX_ANGLE) {
- play_dialog_sound(gDialogID);
+ //play_dialog_sound(gDialogID);
play_sound(SOUND_MENU_MESSAGE_APPEAR, gGlobalSoundSource);
}
@@ -2199,6 +2205,7 @@ void render_pause_my_score_coins(void) {
#else
u8 textCourse[] = { TEXT_COURSE };
u8 textMyScore[] = { TEXT_MY_SCORE };
+
#endif
u8 textStar[] = { TEXT_STAR };
u8 textUnfilledStar[] = { TEXT_UNFILLED_STAR };
@@ -2266,8 +2273,18 @@ void render_pause_my_score_coins(void) {
print_generic_string(get_string_width(gTextCourseArr[gInGameLanguage]) + 51, 157, strCourseNum);
#else
print_generic_string(CRS_NUM_X1, 157, strCourseNum);
+ if (widescreen == 0) {
+ print_generic_string(10, 20, textCurrRatio43);
+ }
+ else {
+ print_generic_string(10, 20, textCurrRatio169);
+ print_generic_string(10, 200, textWideInfo);
+ print_generic_string(10, 180, textWideInfo2);
+ }
+
#endif
+
actName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + gDialogCourseActNum - 1]);
if (starFlags & (1 << (gDialogCourseActNum - 1))) {
@@ -2557,10 +2574,25 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
}
}
}
-
+ if (gPlayer1Controller->buttonPressed & L_TRIG){
+ if (widescreen == 0){
+ widescreen = 1;
+ }
+ else{
+ widescreen = 0;
+ }
+ }
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
+ if (widescreen == 0) {
+ print_generic_string(10, 20, textCurrRatio43);
+ }
+ else {
+ print_generic_string(10, 20, textCurrRatio169);
+ print_generic_string(10, 200, textWideInfo);
+ print_generic_string(10, 180, textWideInfo2);
+ }
if (gDialogLineNum < COURSE_STAGES_COUNT) {
courseName = segmented_to_virtual(courseNameTbl[gDialogLineNum]);
render_pause_castle_course_stars(x, y, gCurrSaveFileNum - 1, gDialogLineNum);
@@ -2626,7 +2658,14 @@ s16 render_pause_courses_and_castle(void) {
shade_screen();
render_pause_my_score_coins();
render_pause_red_coins();
-
+ if (gPlayer1Controller->buttonPressed & L_TRIG){
+ if (widescreen == 0){
+ widescreen = 1;
+ }
+ else{
+ widescreen = 0;
+ }
+ }
if (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) {
render_pause_course_options(99, 93, &gDialogLineNum, 15);
}
diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c
index 58238e8..5262fd3 100644
--- a/src/game/rendering_graph_node.c
+++ b/src/game/rendering_graph_node.c
@@ -10,6 +10,7 @@
#include "rendering_graph_node.h"
#include "shadow.h"
#include "sm64.h"
+#define WIDESCREEN
/**
* This file contains the code that processes the scene graph for rendering.
@@ -235,6 +236,8 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
/**
* Process a perspective projection node.
*/
+
+extern s32 widescreen;
static void geo_process_perspective(struct GraphNodePerspective *node) {
if (node->fnNode.func != NULL) {
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
@@ -246,7 +249,13 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
#ifdef VERSION_EU
f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
#else
- f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
+ f32 aspect;
+ if (widescreen == 1){
+ aspect = 1.775f;
+ }
+ else{
+ aspect = 1.33333f;
+ }
#endif
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near, node->far, 1.0f);
diff --git a/src/menu/file_select.c b/src/menu/file_select.c
index 9437dcc..6ba1845 100644
--- a/src/menu/file_select.c
+++ b/src/menu/file_select.c
@@ -2854,10 +2854,12 @@ Gfx *geo_file_select_strings_and_menu_cursor(s32 callContext, UNUSED struct Grap
* Relocates cursor position of the last save if the game goes back to the Mario Screen
* either completing a course choosing "SAVE & QUIT" or having a game over.
*/
+extern s32 widescreen;
s32 lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused) {
#ifdef VERSION_EU
s8 fileNum;
#endif
+ widescreen = 0;
sSelectedButtonID = MENU_BUTTON_NONE;
sCurrentMenuLevel = MENU_LAYER_MAIN;
sTextBaseAlpha = 0;
diff --git a/src/menu/star_select.c b/src/menu/star_select.c
index 07610fa..9664cc1 100644
--- a/src/menu/star_select.c
+++ b/src/menu/star_select.c
@@ -52,6 +52,7 @@ static s8 sSelectableStarIndex = 0;
// Act Selector menu timer that keeps counting until you choose an act.
static s32 sActSelectorMenuTimer = 0;
+extern s32 widescreen;
/**
* Act Selector Star Type Loop Action
@@ -92,8 +93,14 @@ void bhv_act_selector_star_type_loop(void) {
void render_100_coin_star(u8 stars) {
if (stars & (1 << 6)) {
// If the 100 coin star has been collected, create a new star selector next to the coin score.
- sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
- bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
+ if (widescreen == 1){
+ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+ bhvActSelectorStarType, ((370*4.0f)/3), 24, -300, 0, 0, 0);
+ }
+ else{
+ sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
+ bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
+ }
sStarSelectorModels[6]->oStarSelectorSize = 0.8;
sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
}
@@ -147,11 +154,21 @@ void bhv_act_selector_init(void) {
}
// Render star selector objects
- for (i = 0; i < sVisibleStars; i++) {
- sStarSelectorModels[i] =
- spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
- 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
- sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ if (widescreen == 1) {
+ for (i = 0; i < sVisibleStars; i++) {
+ sStarSelectorModels[i] =
+ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+ (((75 + sVisibleStars * -75 + i * 152)*4.0f)/3), 248, -300, 0, 0, 0);
+ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ }
+ }
+ else {
+ for (i = 0; i < sVisibleStars; i++) {
+ sStarSelectorModels[i] =
+ spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
+ 75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
+ sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
+ }
}
render_100_coin_star(stars);

45
include/config.h.orig Normal file
View File

@@ -0,0 +1,45 @@
#ifndef CONFIG_H
#define CONFIG_H
/**
* @file config.h
* A catch-all file for configuring various bugfixes and other settings
* (maybe eventually) in SM64
*/
// Bug Fixes
// --| US Version Nintendo Bug Fixes
/// Fixes bug where obtaining over 999 coins sets the number of lives to 999 (or -25)
#define BUGFIX_MAX_LIVES (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where the Boss music won't fade out after defeating King Bob-omb
#define BUGFIX_KING_BOB_OMB_FADE_MUSIC (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug in Bob-Omb Battlefield where entering a warp stops the Koopa race music
#define BUGFIX_KOOPA_RACE_MUSIC (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where Piranha Plants do not reset their action state when the
/// player exits their activation radius.
#define BUGFIX_PIRANHA_PLANT_STATE_RESET (0 || VERSION_US || VERSION_EU || VERSION_SH)
/// Fixes bug where sleeping Piranha Plants damage players that bump into them
#define BUGFIX_PIRANHA_PLANT_SLEEP_DAMAGE (0 || VERSION_US || VERSION_SH)
/// Fixes bug where it shows a star when you grab a key in bowser battle stages
#define BUGFIX_STAR_BOWSER_KEY (0 || VERSION_US || VERSION_EU || VERSION_SH)
// Support Rumble Pak
#define ENABLE_RUMBLE (1 || VERSION_SH)
// Screen Size Defines
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
// Border Height Define for NTSC Versions
#ifdef TARGET_N64
#ifndef VERSION_EU
#define BORDER_HEIGHT 0
#else
#define BORDER_HEIGHT 0
#endif
#else
// What's the point of having a border?
#define BORDER_HEIGHT 0
#endif
#endif // CONFIG_H

View File

@@ -24,6 +24,10 @@
// Ingame Menu
#define TEXT_PAUSE _("PAUSE") // Pause text, Castle Courses
#define TEXT_HUD_CONGRATULATIONS _("CONGRATULATIONS") // Course Complete Text, Bowser Courses
#define TEXT_HUD_CURRENT_RATIO_43 _("CURRENT ASPECT RATIO: 4:3. PRESS L TO SWITCH TO 16:9")
#define TEXT_HUD_CURRENT_RATIO_169 _("CURRENT ASPECT RATIO: 16:9. PRESS L TO SWITCH TO 4:3")
#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO")
#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
#if defined(VERSION_JP) || defined(VERSION_SH)

View File

@@ -22,6 +22,7 @@
#include "sm64.h"
#include "text_strings.h"
#include "types.h"
#define wide // DELETE THIS DEFINE IF YOU DON'T WANT WIDESCREEN SUPPORT IN YOUR HACK (why tho)
u16 gDialogColorFadeTimer;
s8 gLastDialogLineNum;
@@ -34,6 +35,11 @@ s16 gDialogY; // D_8032F69C
s16 gCutsceneMsgXOffset;
s16 gCutsceneMsgYOffset;
s8 gRedCoinsCollected;
u8 textCurrRatio43[] = { TEXT_HUD_CURRENT_RATIO_43 };
u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 };
u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 };
u8 widescreen = 0;
extern u8 gLastCompletedCourseNum;
extern u8 gLastCompletedStarNum;
@@ -2266,6 +2272,26 @@ void render_pause_my_score_coins(void) {
print_generic_string(get_string_width(gTextCourseArr[gInGameLanguage]) + 51, 157, strCourseNum);
#else
print_generic_string(CRS_NUM_X1, 157, strCourseNum);
#ifdef wide
if (widescreen == 0) {
if (COURSE_IS_MAIN_COURSE(gCurrCourseNum)) {
print_generic_string(10, 40, textCurrRatio43);
} else {
print_generic_string(10, 20, textCurrRatio43);
}
}
else {
if (COURSE_IS_MAIN_COURSE(gCurrCourseNum)) {
print_generic_string(10, 40, textCurrRatio169);
} else {
print_generic_string(10, 20, textCurrRatio169);
}
print_generic_string(10, 200, textWideInfo);
print_generic_string(10, 180, textWideInfo2);
}
#endif
#endif
actName = segmented_to_virtual(actNameTbl[(gCurrCourseNum - 1) * 6 + gDialogCourseActNum - 1]);
@@ -2557,10 +2583,28 @@ void render_pause_castle_main_strings(s16 x, s16 y) {
}
}
}
#ifdef wide
if (gPlayer1Controller->buttonPressed & L_TRIG){
if (widescreen == 0){
widescreen = 1;
}
else{
widescreen = 0;
}
}
#endif
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
#ifdef wide
if (widescreen == 0) {
print_generic_string(10, 20, textCurrRatio43);
}
else {
print_generic_string(10, 20, textCurrRatio169);
print_generic_string(10, 200, textWideInfo);
print_generic_string(10, 180, textWideInfo2);
}
#endif
if (gDialogLineNum < COURSE_STAGES_COUNT) {
courseName = segmented_to_virtual(courseNameTbl[gDialogLineNum]);
render_pause_castle_course_stars(x, y, gCurrSaveFileNum - 1, gDialogLineNum);
@@ -2626,6 +2670,14 @@ s16 render_pause_courses_and_castle(void) {
shade_screen();
render_pause_my_score_coins();
render_pause_red_coins();
if (gPlayer1Controller->buttonPressed & L_TRIG){
if (widescreen == 0){
widescreen = 1;
}
else{
widescreen = 0;
}
}
if (gMarioStates[0].action & ACT_FLAG_PAUSE_EXIT) {
render_pause_course_options(99, 93, &gDialogLineNum, 15);

View File

@@ -1242,6 +1242,10 @@ s32 lvl_init_or_update(s16 initOrUpdate, UNUSED s32 unused) {
return result;
}
extern u8 widescreen;
void lvl_set_widescreen(void) {
widescreen = 1;
}
s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum) {
#ifdef VERSION_EU

1324
src/game/level_update.c.orig Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -128,5 +128,6 @@ s32 lvl_init_from_save_file(UNUSED s16 arg0, s32 levelNum);
s32 lvl_set_current_level(UNUSED s16 arg0, s32 levelNum);
s32 lvl_play_the_end_screen_sound(UNUSED s16 arg0, UNUSED s32 arg1);
void basic_update(UNUSED s16 *arg);
void lvl_set_widescreen(void);
#endif // LEVEL_UPDATE_H

View File

@@ -10,6 +10,7 @@
#include "rendering_graph_node.h"
#include "shadow.h"
#include "sm64.h"
#define WIDESCREEN
/**
* This file contains the code that processes the scene graph for rendering.
@@ -39,6 +40,7 @@
s16 gMatStackIndex;
Mat4 gMatStack[32];
Mtx *gMatStackFixed[32];
f32 aspect;
/**
* Animation nodes have state in global variables, so this struct captures
@@ -235,6 +237,7 @@ static void geo_process_ortho_projection(struct GraphNodeOrthoProjection *node)
/**
* Process a perspective projection node.
*/
extern u8 widescreen;
static void geo_process_perspective(struct GraphNodePerspective *node) {
if (node->fnNode.func != NULL) {
node->fnNode.func(GEO_CONTEXT_RENDER, &node->fnNode.node, gMatStack[gMatStackIndex]);
@@ -246,7 +249,12 @@ static void geo_process_perspective(struct GraphNodePerspective *node) {
#ifdef VERSION_EU
f32 aspect = ((f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height) * 1.1f;
#else
f32 aspect = (f32) gCurGraphNodeRoot->width / (f32) gCurGraphNodeRoot->height;
if (widescreen == 1){
aspect = 1.775f;
}
else{
aspect = 1.33333f;
}
#endif
guPerspective(mtx, &perspNorm, node->fov, aspect, node->near / WORLD_SCALE, node->far / WORLD_SCALE, 1.0f);
@@ -763,7 +771,7 @@ static s32 obj_is_in_view(struct GraphNodeObject *node, Mat4 matrix) {
// ! @bug The aspect ratio is not accounted for. When the fov value is 45,
// the horizontal effective fov is actually 60 degrees, so you can see objects
// visibly pop in or out at the edge of the screen.
halfFov = (gCurGraphNodeCamFrustum->fov / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
halfFov = ((gCurGraphNodeCamFrustum->fov*aspect) / 2.0f + 1.0f) * 32768.0f / 180.0f + 0.5f;
hScreenEdge = -matrix[3][2] * sins(halfFov) / coss(halfFov);
// -matrix[3][2] is the depth, which gets multiplied by tan(halfFov) to get

File diff suppressed because it is too large Load Diff

View File

@@ -2854,10 +2854,12 @@ Gfx *geo_file_select_strings_and_menu_cursor(s32 callContext, UNUSED struct Grap
* Relocates cursor position of the last save if the game goes back to the Mario Screen
* either completing a course choosing "SAVE & QUIT" or having a game over.
*/
extern u8 widescreen;
s32 lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused) {
#ifdef VERSION_EU
s8 fileNum;
#endif
widescreen = 0;
sSelectedButtonID = MENU_BUTTON_NONE;
sCurrentMenuLevel = MENU_LAYER_MAIN;
sTextBaseAlpha = 0;

View File

@@ -52,7 +52,7 @@ static s8 sSelectableStarIndex = 0;
// Act Selector menu timer that keeps counting until you choose an act.
static s32 sActSelectorMenuTimer = 0;
extern u8 widescreen;
/**
* Act Selector Star Type Loop Action
* Defines a select type for a star in the act selector.
@@ -92,8 +92,15 @@ void bhv_act_selector_star_type_loop(void) {
void render_100_coin_star(u8 stars) {
if (stars & (1 << 6)) {
// If the 100 coin star has been collected, create a new star selector next to the coin score.
sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
if (widescreen == 1){
sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
bhvActSelectorStarType, ((370*4.0f)/3), 24, -300, 0, 0, 0);
}
else{
sStarSelectorModels[6] = spawn_object_abs_with_rot(gCurrentObject, 0, MODEL_STAR,
bhvActSelectorStarType, 370, 24, -300, 0, 0, 0);
}
sStarSelectorModels[6]->oStarSelectorSize = 0.8;
sStarSelectorModels[6]->oStarSelectorType = STAR_SELECTOR_100_COINS;
}
@@ -147,11 +154,21 @@ void bhv_act_selector_init(void) {
}
// Render star selector objects
for (i = 0; i < sVisibleStars; i++) {
sStarSelectorModels[i] =
spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
if (widescreen == 1) {
for (i = 0; i < sVisibleStars; i++) {
sStarSelectorModels[i] =
spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
(((75 + sVisibleStars * -75 + i * 152)*4.0f)/3), 248, -300, 0, 0, 0);
sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
}
}
else {
for (i = 0; i < sVisibleStars; i++) {
sStarSelectorModels[i] =
spawn_object_abs_with_rot(gCurrentObject, 0, selectorModelIDs[i], bhvActSelectorStarType,
75 + sVisibleStars * -75 + i * 152, 248, -300, 0, 0, 0);
sStarSelectorModels[i]->oStarSelectorSize = 1.0f;
}
}
render_100_coin_star(stars);