From 8043823cce7ac6039d23bae8bb3bdb13f798655f Mon Sep 17 00:00:00 2001 From: Arceveti <73617174+Arceveti@users.noreply.github.com> Date: Mon, 12 Dec 2022 14:40:55 -0500 Subject: [PATCH] Merge master/2.0.8 into 2.1.0 (#551) * Imminent fixes for bugs found on master branch (#512) * The vanilla level checks define for Yoshi is inverted, causing him to require 120 stars when it is off and appear at 0 stars when it's on * The downwarp fix results in Mario levitating in midair when grabbing Bowser midair. While downwarps should still be fixed, the change should be reverted immediately until a better fix is made. * Some checks of Mario's floor class were using the wrong defines, which can lead to unexpected behavior in the event anyone wants to reorder surface types. By default the SURFACE_CLASS_SLIPPERY and SURFACE_SLIPPERY defines have the same value, which is why this mistake is hard to notice. * The firsty frames define was implemented poorly, not allowing for vanilla firsty behavior no matter what the values were set to. This has been reverted, while avoiding the UB in the original vanilla code. * Removed the ledge grab changes that fix QSLGs and change the false ledgegrab define since Arceveti wanted to in his PR * Update version to 2.0.4 (#515) * HackerSM64 2.0.5 (#517) * Bugfix: race condition with accessing cleared audio memory pools * Bugfix: skyboxes access tiles out of range when looking straight down (#518) * Vscode fixes (#516) * Revert s32 angles and remove Angle typedef usage (#529) * Fix some surface shadowing (#531) * Delete rtc.h * Remove `wait_for_audio_frames()` Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> Co-authored-by: Arceveti <73617174+Arceveti@users.noreply.github.com> Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com> * Update VERSION.txt (#534) * HackerSM64 2.0.6 (#539) * revert random_u16 to be a u16 (#538) * Added safety gcc math flags (#537) * removed useless compilation flags that could cause performance loss Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> Co-authored-by: thecozies * Update VERSION.txt HackerSM64 2.0.6 * Add GCC opt flag to suppress warnings * v2.0.7 * 2.0.8 (fix more compiler warnings) (#543) * fix Waddress in mario_step.c * fix Winfinite-recursion in unused dynlist_proc function * in fact remove the offending function entirely * fix warnings in RNC decompress functions * update version * fix version in VERSION.txt premature on my part, will update it to 2.0.10 next time Co-authored-by: someone2639 Co-authored-by: arthurtilly <32559225+arthurtilly@users.noreply.github.com> Co-authored-by: axollyon <20480418+axollyon@users.noreply.github.com> Co-authored-by: Gregory Heskett Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com> Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com> Co-authored-by: thecozies Co-authored-by: Reonu Co-authored-by: someone2639 Co-authored-by: someone2639 --- Makefile | 12 ++++++---- VERSION.txt | 2 +- include/config/config_movement.h | 2 +- src/engine/math_util.c | 2 +- src/engine/math_util.h | 2 +- src/game/mario_step.c | 2 +- src/goddard/dynlist_proc.c | 41 -------------------------------- 7 files changed, 13 insertions(+), 50 deletions(-) diff --git a/Makefile b/Makefile index e75cb031..e9969ae0 100644 --- a/Makefile +++ b/Makefile @@ -130,10 +130,14 @@ $(eval $(call validate-option,TEXT_ENGINE,none s2dex_text_engine)) # Default non-gcc opt flags DEFAULT_OPT_FLAGS = -Ofast +# Note: -fno-associative-math is used here to suppress warnings, ideally we would enable this as an optimization but +# this conflicts with -ftrapping-math apparently. +# TODO: Figure out how to allow -fassociative-math to be enabled +SAFETY_OPT_FLAGS = -ftrapping-math -fno-associative-math # Main opt flags GCC_MAIN_OPT_FLAGS = \ - -Ofast \ + $(DEFAULT_OPT_FLAGS) $(SAFETY_OPT_FLAGS) \ --param case-values-threshold=20 \ --param max-completely-peeled-insns=10 \ --param max-unrolled-insns=10 \ @@ -144,7 +148,7 @@ GCC_MAIN_OPT_FLAGS = \ # Surface Collision GCC_COLLISION_OPT_FLAGS = \ - -Ofast \ + $(DEFAULT_OPT_FLAGS) $(SAFETY_OPT_FLAGS) \ --param case-values-threshold=20 \ --param max-completely-peeled-insns=100 \ --param max-unrolled-insns=100 \ @@ -157,7 +161,7 @@ GCC_COLLISION_OPT_FLAGS = \ # Math Util GCC_MATH_UTIL_OPT_FLAGS = \ - -Ofast \ + $(DEFAULT_OPT_FLAGS) $(SAFETY_OPT_FLAGS) \ -fno-unroll-loops \ -fno-peel-loops \ --param case-values-threshold=20 \ @@ -169,7 +173,7 @@ GCC_MATH_UTIL_OPT_FLAGS = \ # Rendering graph node GCC_GRAPH_NODE_OPT_FLAGS = \ - -Ofast \ + $(DEFAULT_OPT_FLAGS) $(SAFETY_OPT_FLAGS) \ --param case-values-threshold=20 \ --param max-completely-peeled-insns=100 \ --param max-unrolled-insns=100 \ diff --git a/VERSION.txt b/VERSION.txt index c2f6de90..923fd4d2 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -v2.0.5 +v2.0.8 diff --git a/include/config/config_movement.h b/include/config/config_movement.h index 8f6c6542..ae4e36cf 100644 --- a/include/config/config_movement.h +++ b/include/config/config_movement.h @@ -116,7 +116,7 @@ /** * Makes Mario unable to ledge grab steep slopes to prevent false ledge grabs. */ -// #define DONT_LEDGE_GRAB_STEEP_SLOPES +#define DONT_LEDGE_GRAB_STEEP_SLOPES /** * Disables BLJs and crushes SimpleFlips's dreams. diff --git a/src/engine/math_util.c b/src/engine/math_util.c index 1d46a79e..86d95269 100644 --- a/src/engine/math_util.c +++ b/src/engine/math_util.c @@ -28,7 +28,7 @@ Vec3s gVec3sOne = { 1, 1, 1 }; static u16 gRandomSeed16; // Generate a pseudorandom integer from 0 to 65535 from the random seed, and update the seed. -u32 random_u16(void) { +u16 random_u16(void) { if (gRandomSeed16 == 22026) { gRandomSeed16 = 0; } diff --git a/src/engine/math_util.h b/src/engine/math_util.h index 016dc87f..b0fab842 100644 --- a/src/engine/math_util.h +++ b/src/engine/math_util.h @@ -475,7 +475,7 @@ ALWAYS_INLINE s32 absi(s32 in) { #define FLT_IS_NONZERO(x) (absf(x) > NEAR_ZERO) -u32 random_u16(void); +u16 random_u16(void); f32 random_float(void); s32 random_sign(void); diff --git a/src/game/mario_step.c b/src/game/mario_step.c index eb9923fd..028d4962 100644 --- a/src/game/mario_step.c +++ b/src/game/mario_step.c @@ -541,7 +541,7 @@ s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepAr } } - if (stepResult == AIR_STEP_GRABBED_LEDGE && grabbedWall != NULL && ledgeFloor != NULL && ledgePos != NULL) { + if (stepResult == AIR_STEP_GRABBED_LEDGE && grabbedWall != NULL && ledgeFloor != NULL) { vec3f_copy(m->pos, ledgePos); set_mario_floor(m, floor, ledgePos[1]); m->faceAngle[0] = 0x0; diff --git a/src/goddard/dynlist_proc.c b/src/goddard/dynlist_proc.c index 611271db..89bf249d 100644 --- a/src/goddard/dynlist_proc.c +++ b/src/goddard/dynlist_proc.c @@ -1889,47 +1889,6 @@ void d_set_att_offset(const struct GdVec3f *off) { } } -/** - * An incorrectly-coded recursive function that was presumably supposed to - * set the offset of an attached object. Now, it will only call itself - * until it encounters a NULL pointer, which will trigger a `fatal_printf()` - * call. - * - * @note Not called - */ -void d_set_att_to_offset(UNUSED u32 a) { - struct GdObj *dynobj; // sp3c - UNUSED u8 filler[24]; - - if (sDynListCurObj == NULL) { - fatal_printf("proc_dynlist(): No current object"); - } - - dynobj = sDynListCurObj; - d_stash_dynobj(); - switch (sDynListCurObj->type) { - case OBJ_TYPE_JOINTS: - set_cur_dynobj(((struct ObjJoint *) dynobj)->attachedToObj); - break; - case OBJ_TYPE_NETS: - set_cur_dynobj(((struct ObjNet *) dynobj)->attachedToObj); - break; - case OBJ_TYPE_PARTICLES: - set_cur_dynobj(((struct ObjParticle *) dynobj)->attachedToObj); - break; - default: - fatal_printf("%s: Object '%s'(%x) does not support this function.", "dSetAttToOffset()", - sDynListCurInfo->name, sDynListCurObj->type); - } - - if (sDynListCurObj == NULL) { - fatal_printf("dSetAttOffset(): Object '%s' isnt attached to anything", - sStashedDynObjInfo->name); - } - d_set_att_to_offset(a); - d_unstash_dynobj(); -} - /** * Store the offset of the attached object into `dst`. *