You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Widescreen support.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
1324
src/game/level_update.c.orig
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
1092
src/game/rendering_graph_node.c.orig
Normal file
1092
src/game/rendering_graph_node.c.orig
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user