From a09bdd0ffbeba6ff8d8f709c5b90d1c30b20c2ef Mon Sep 17 00:00:00 2001 From: Arceveti <73617174+Arceveti@users.noreply.github.com> Date: Wed, 15 Sep 2021 10:35:58 -0700 Subject: [PATCH 1/4] Fix shadow transparency --- include/config.h | 2 ++ src/game/rendering_graph_node.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/config.h b/include/config.h index 3661ec8b..eaae6a13 100644 --- a/include/config.h +++ b/include/config.h @@ -102,6 +102,8 @@ #define MULTILANG (0 || VERSION_EU) // Enables Puppy Camera 2, a rewritten camera that can be freely configured and modified. //#define PUPPYCAM +// Allows Mario's shadow to be transparent on top of transparent surfaces, such as water, lava, and ice +#define FIX_SHADOW_TRANSPARENCY // Automatically calculate the optimal collision distance for an object based on its vertices. #define AUTO_COLLISION_DISTANCE // Makes obj_resolve_object_collisions work consistently diff --git a/src/game/rendering_graph_node.c b/src/game/rendering_graph_node.c index 7d992f1f..a2bc7072 100644 --- a/src/game/rendering_graph_node.c +++ b/src/game/rendering_graph_node.c @@ -721,13 +721,17 @@ static void geo_process_shadow(struct GraphNodeShadow *node) { mtxf_mul(gMatStack[gMatStackIndex], mtxf, *gCurGraphNodeCamera->matrixPtr); mtxf_to_mtx(mtx, gMatStack[gMatStackIndex]); gMatStackFixed[gMatStackIndex] = mtx; +#ifdef FIX_SHADOW_TRANSPARENCY + geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), ((gShadowAboveWaterOrLava || gShadowAboveCustomWater || gMarioOnIceOrCarpet) ? LAYER_TRANSPARENT : LAYER_TRANSPARENT_DECAL)); +#else if (gShadowAboveWaterOrLava == TRUE) { geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), LAYER_ALPHA); - } else if (gMarioOnIceOrCarpet == 1 || gShadowAboveCustomWater == 1) { + } else if (gMarioOnIceOrCarpet == TRUE || gShadowAboveCustomWater == TRUE) { geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), LAYER_TRANSPARENT); } else { geo_append_display_list((void *) VIRTUAL_TO_PHYSICAL(shadowList), LAYER_TRANSPARENT_DECAL); } +#endif gMatStackIndex--; } } From 604b1405a2b0f54a588ee76f3d52184caf2f9385 Mon Sep 17 00:00:00 2001 From: Arceveti <73617174+Arceveti@users.noreply.github.com> Date: Wed, 15 Sep 2021 10:40:21 -0700 Subject: [PATCH 2/4] Make debug level select work without KEEP_MARIO_HEAD --- levels/intro/script.c | 7 ++----- src/menu/title_screen.c | 8 ++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/levels/intro/script.c b/levels/intro/script.c index 4fe236fb..ebf9f557 100644 --- a/levels/intro/script.c +++ b/levels/intro/script.c @@ -52,14 +52,10 @@ const LevelScript level_intro_splash_screen[] = { const LevelScript level_intro_mario_head_regular[] = { INIT_LEVEL(), -#ifndef KEEP_MARIO_HEAD - EXIT_AND_EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_1), -#endif +#ifdef KEEP_MARIO_HEAD BLACKOUT(/*active*/ TRUE), FIXED_LOAD(/*loadAddr*/ _goddardSegmentStart, /*romStart*/ _goddardSegmentRomStart, /*romEnd*/ _goddardSegmentRomEnd), -#ifdef KEEP_MARIO_HEAD LOAD_MARIO_HEAD(/*loadHeadID*/ REGULAR_FACE), -#endif LOAD_RAW(/*seg*/ 0x13, _behaviorSegmentRomStart, _behaviorSegmentRomEnd), LOAD_YAY0_TEXTURE(/*seg*/ 0x0A, _title_screen_bg_yay0SegmentRomStart, _title_screen_bg_yay0SegmentRomEnd), @@ -74,6 +70,7 @@ const LevelScript level_intro_mario_head_regular[] = { SET_MENU_MUSIC(/*seq*/ SEQ_MENU_TITLE_SCREEN), TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_STAR, /*time*/ 20, /*color*/ 0x00, 0x00, 0x00), SLEEP(/*frames*/ 20), +#endif CALL_LOOP(/*arg*/ LVL_INTRO_REGULAR, /*func*/ lvl_intro_update), JUMP_IF(/*op*/ OP_EQ, /*arg*/ 100, script_intro_L1), JUMP_IF(/*op*/ OP_EQ, /*arg*/ 101, script_intro_L2), diff --git a/src/menu/title_screen.c b/src/menu/title_screen.c index e93e0b10..e3192e6b 100644 --- a/src/menu/title_screen.c +++ b/src/menu/title_screen.c @@ -235,12 +235,20 @@ s32 lvl_intro_update(s16 arg, UNUSED s32 unusedArg) { case LVL_INTRO_PLAY_ITS_A_ME_MARIO: retVar = intro_play_its_a_me_mario(); break; +#ifdef KEEP_MARIO_HEAD case LVL_INTRO_REGULAR: retVar = intro_regular(); break; case LVL_INTRO_GAME_OVER: retVar = intro_game_over(); break; +#else + case LVL_INTRO_REGULAR: + // fall through + case LVL_INTRO_GAME_OVER: + retVar = (100 + gDebugLevelSelect); + break; +#endif case LVL_INTRO_LEVEL_SELECT: retVar = intro_level_select(); break; From 48a4d5a40508ffe3a2cecca272a422e221ed055c Mon Sep 17 00:00:00 2001 From: Arceveti <73617174+Arceveti@users.noreply.github.com> Date: Wed, 15 Sep 2021 18:54:56 -0700 Subject: [PATCH 3/4] Make objFlags an s32 --- src/engine/behavior_script.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/engine/behavior_script.c b/src/engine/behavior_script.c index 001da0ba..52b13e2c 100644 --- a/src/engine/behavior_script.c +++ b/src/engine/behavior_script.c @@ -905,9 +905,7 @@ static BhvCommandProc BehaviorCmdTable[] = { // Execute the behavior script of the current object, process the object flags, and other miscellaneous code for updating objects. void cur_obj_update(void) { - UNUSED u32 unused; - - s16 objFlags = gCurrentObject->oFlags; + s32 objFlags = gCurrentObject->oFlags; f32 distanceFromMario; BhvCommandProc bhvCmdProc; s32 bhvProcResult; @@ -953,7 +951,7 @@ void cur_obj_update(void) { } // Execute various code based on object flags. - objFlags = (s16) gCurrentObject->oFlags; + objFlags = gCurrentObject->oFlags; if (objFlags & OBJ_FLAG_SET_FACE_ANGLE_TO_MOVE_ANGLE) { obj_set_face_angle_to_move_angle(gCurrentObject); From f9e2070eb17b49c7a23c48941612179d02e04df8 Mon Sep 17 00:00:00 2001 From: Reonu Date: Thu, 16 Sep 2021 11:19:12 +0300 Subject: [PATCH 4/4] add NO_GETTING_BURIED define --- README.md | 1 + include/config.h | 2 ++ src/game/mario_actions_airborne.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 69cd1a14..f5a45825 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin - Tighter hanging controls (mario will face the direction of the analog stick directly while hanging from a ceiling) * - reonucam3: custom camera by me. This is included as a .patch file in the enhancements folder, you need to apply it if you want this camera. This video shows a rundown of the features: https://youtu.be/TQNkznX9Z3k +- Ability to disable Mario getting suck in snow or sand **Hacker QOL:** - Global, non-level based, star IDs (off by default) * diff --git a/include/config.h b/include/config.h index eaae6a13..31a0bdec 100644 --- a/include/config.h +++ b/include/config.h @@ -82,6 +82,8 @@ #define NO_FALL_DAMAGE // Disables the scream that mario makes when falling off a great height (this is separate from actual fall damage) //#define NO_FALL_DAMAGE_SOUND +// Disables Mario getting stuck in snow and sand when falling +//#define NO_GETTING_BURIED // Number of coins to spawn the "100 coin" star. If you remove the define altogether, then there won't be a 100 coin star at all. #define X_COIN_STAR 100 // Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Doesn't break treadmills anymore! diff --git a/src/game/mario_actions_airborne.c b/src/game/mario_actions_airborne.c index ce6467ef..c037e87a 100644 --- a/src/game/mario_actions_airborne.c +++ b/src/game/mario_actions_airborne.c @@ -123,6 +123,9 @@ s32 should_get_stuck_in_ground(struct MarioState *m) { s32 flags = floor->flags; s32 type = floor->type; +#ifdef NO_GETTING_BURIED + return FALSE; +#else if (floor != NULL && (terrainType == TERRAIN_SNOW || terrainType == TERRAIN_SAND) && type != SURFACE_BURNING && SURFACE_IS_NOT_HARD(type)) { if (!(flags & 0x01) && m->peakHeight - m->pos[1] > 1000.0f && floor->normal.y >= 0.8660254f) { @@ -131,6 +134,7 @@ s32 should_get_stuck_in_ground(struct MarioState *m) { } return FALSE; +#endif } s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction) {