Added tree particle fix

This commit is contained in:
Reonu
2021-06-27 22:04:25 +01:00
parent 42a0129e81
commit 15acfce39d
2 changed files with 11 additions and 0 deletions

View File

@@ -77,6 +77,8 @@
#define X_COIN_STAR 100 #define X_COIN_STAR 100
// Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Breaks treadmills. // Platform displacement 2 also known as momentum patch. Makes Mario keep the momemtum from moving platforms. Breaks treadmills.
#define PLATFORM_DISPLACEMENT_2 #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 // Stars don't kick you out of the level
// #define NON_STOP_STARS // #define NON_STOP_STARS
// Uncomment this if you want global star IDs (useful for creating an open world hack ala MVC) // Uncomment this if you want global star IDs (useful for creating an open world hack ala MVC)

View File

@@ -1,3 +1,4 @@
#include "config.h"
// tree_particles.c.inc // tree_particles.c.inc
void bhv_tree_snow_or_leaf_loop(void) { 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) { void bhv_snow_leaf_particle_spawn_init(void) {
struct Object *obj; // Either snow or leaf struct Object *obj; // Either snow or leaf
#ifdef TREE_PARTICLE_FIX
struct Object *nearestTree = NULL;
#endif
UNUSED s32 unused; UNUSED s32 unused;
s32 isSnow; s32 isSnow;
f32 scale; f32 scale;
UNUSED s32 unused2; UNUSED s32 unused2;
gMarioObject->oActiveParticleFlags &= ~0x2000; 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) if (gCurrLevelNum == LEVEL_CCM || gCurrLevelNum == LEVEL_SL)
isSnow = 1; isSnow = 1;
else else
isSnow = 0; isSnow = 0;
#endif
if (isSnow) { if (isSnow) {
if (random_float() < 0.5) { if (random_float() < 0.5) {
obj = spawn_object(o, MODEL_WHITE_PARTICLE_DL, bhvTreeSnow); obj = spawn_object(o, MODEL_WHITE_PARTICLE_DL, bhvTreeSnow);