From 15acfce39da3d5bf2d4b108ebf57dcb1807abd45 Mon Sep 17 00:00:00 2001 From: Reonu Date: Sun, 27 Jun 2021 22:04:25 +0100 Subject: [PATCH] Added tree particle fix --- include/config.h | 2 ++ src/game/behaviors/tree_particles.inc.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/config.h b/include/config.h index da37b4df..ce631816 100644 --- a/include/config.h +++ b/include/config.h @@ -77,6 +77,8 @@ #define X_COIN_STAR 100 // Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Breaks treadmills. #define PLATFORM_DISPLACEMENT_2 +// Whether a tree uses snow particles or not is decided via the model IDs instead of the course number +#define TREE_PARTICLE_FIX // Stars don't kick you out of the level // #define NON_STOP_STARS // Uncomment this if you want global star IDs (useful for creating an open world hack ala MVC) diff --git a/src/game/behaviors/tree_particles.inc.c b/src/game/behaviors/tree_particles.inc.c index 6c5587ff..4df2ca49 100644 --- a/src/game/behaviors/tree_particles.inc.c +++ b/src/game/behaviors/tree_particles.inc.c @@ -1,3 +1,4 @@ +#include "config.h" // tree_particles.c.inc void bhv_tree_snow_or_leaf_loop(void) { @@ -33,15 +34,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 TREE_PARTICLE_FIX + struct Object *nearestTree = NULL; +#endif UNUSED s32 unused; s32 isSnow; f32 scale; UNUSED s32 unused2; gMarioObject->oActiveParticleFlags &= ~0x2000; +#ifdef TREE_PARTICLE_FIX + nearestTree = cur_obj_nearest_object_with_behavior(bhvTree); + isSnow = (nearestTree->header.gfx.sharedChild == gLoadedGraphNodes[MODEL_CCM_SNOW_TREE] || nearestTree->header.gfx.sharedChild == gLoadedGraphNodes[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);