3 new qol fixes

This commit is contained in:
AloXado320 2021-06-30 19:56:48 -05:00
parent 6e73642542
commit 0da86d5afb
6 changed files with 47 additions and 0 deletions

View file

@ -105,5 +105,11 @@
#define QOL_FIX_MENU_SCROLLING (0 || QOL_FIXES)
/// Fixes missing surface wind in obj_check_floor_death
#define QOL_FIX_OBJ_FLOOR_WIND_DEATH (0 || QOL_FIXES)
/// Fixes hardcoded snow tree leaf particles
#define QOL_FIX_HARDCODED_TREE_PARTICLES (0 || QOL_FIXES)
/// Fixes red coin star marker floor position if more than 2000 units
#define QOL_FIX_RED_COIN_STAR_MARKER_POSITION (0 || QOL_FIXES)
/// Fixes monty mole hide in hole check
#define QOL_FIX_HIDE_IN_HOLE_NULL_CHECK (0 || QOL_FIXES)
#endif // QOL_DEFINES_H

View file

@ -266,10 +266,18 @@ static void monty_mole_act_jump_into_hole(void) {
* Become intangible and enter the select hole action.
*/
static void monty_mole_hide_in_hole(void) {
#if QOL_FIX_HIDE_IN_HOLE_NULL_CHECK
if (o->oMontyMoleCurrentHole != NULL) {
o->oMontyMoleCurrentHole->oMontyMoleHoleCooldown = 30;
}
#else
o->oMontyMoleCurrentHole->oMontyMoleHoleCooldown = 30;
#endif
o->oAction = MONTY_MOLE_ACT_SELECT_HOLE;
o->oVelY = 0.0f;
#if !QOL_FIX_HIDE_IN_HOLE_NULL_CHECK
//! Even though the object becomes intangible here, it is still possible
// for a bob-omb to interact with it later in the frame (since bob-ombs
// come after monty moles in processing order).
@ -277,6 +285,7 @@ static void monty_mole_hide_in_hole(void) {
// action. If no hole is available (e.g. because mario is too far away),
// the game will crash because of the line above that accesses
// oMontyMoleCurrentHole.
#endif
cur_obj_become_intangible();
}

View file

@ -144,8 +144,12 @@ void bhv_hidden_red_coin_star_init(void) {
s16 sp36;
struct Object *sp30;
#if !QOL_FIX_RED_COIN_STAR_MARKER_POSITION
if (gCurrCourseNum != COURSE_JRB)
spawn_object(o, MODEL_TRANSPARENT_STAR, bhvRedCoinStarMarker);
#else
spawn_object(o, MODEL_TRANSPARENT_STAR, bhvRedCoinStarMarker);
#endif
sp36 = count_objects_with_behavior(bhvRedCoin);
if (sp36 == 0) {
@ -159,6 +163,13 @@ void bhv_hidden_red_coin_star_init(void) {
}
void bhv_hidden_red_coin_star_loop(void) {
#if QOL_FIX_RED_COIN_STAR_MARKER_POSITION
struct Object *starMarker = cur_obj_nearest_object_with_behavior(bhvRedCoinStarMarker);
if (starMarker != NULL && ((o->oPosY - starMarker->oPosY) > 2000.0f)) {
obj_mark_for_deletion(starMarker);
}
#endif
gRedCoinsCollected = o->oHiddenStarTriggerCounter;
switch (o->oAction) {
case 0:

View file

@ -33,15 +33,23 @@ void bhv_tree_snow_or_leaf_loop(void) {
void bhv_snow_leaf_particle_spawn_init(void) {
struct Object *obj; // Either snow or leaf
#ifdef QOL_FIX_HARDCODED_TREE_PARTICLES
struct Object *nearestTree = NULL;
#endif
UNUSED s32 unused;
s32 isSnow;
f32 scale;
UNUSED s32 unused2;
gMarioObject->oActiveParticleFlags &= ~0x2000;
#if QOL_FIX_HARDCODED_TREE_PARTICLES
nearestTree = cur_obj_nearest_object_with_behavior(bhvTree);
isSnow = (obj_has_model(nearestTree, MODEL_CCM_SNOW_TREE) || obj_has_model(nearestTree, MODEL_SL_SNOW_TREE));
#else
if (gCurrLevelNum == LEVEL_CCM || gCurrLevelNum == LEVEL_SL)
isSnow = 1;
else
isSnow = 0;
#endif
if (isSnow) {
if (random_float() < 0.5) {
obj = spawn_object(o, MODEL_WHITE_PARTICLE_DL, bhvTreeSnow);

View file

@ -2907,3 +2907,12 @@ void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 o
o->oPosY = objectPosY;
}
#endif
// Extra functions
void obj_set_model(struct Object *obj, s32 modelID) {
obj->header.gfx.sharedChild = gLoadedGraphNodes[modelID];
}
s32 obj_has_model(struct Object *obj, u16 modelID) {
return (obj->header.gfx.sharedChild == gLoadedGraphNodes[modelID]);
}

View file

@ -298,4 +298,8 @@ void cur_obj_spawn_loot_blue_coin(void);
void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 offsetY);
#endif
// Extra functions
void obj_set_model(struct Object *obj, s32 modelID);
s32 obj_has_model(struct Object *obj, u16 modelID);
#endif // OBJECT_HELPERS_H