You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Puppylight crash fix
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "profiler.h"
|
||||
#include "spawn_object.h"
|
||||
#include "puppyprint.h"
|
||||
#include "puppylights.h"
|
||||
|
||||
|
||||
/**
|
||||
@@ -386,6 +387,8 @@ s32 unload_deactivated_objects_in_list(struct ObjectNode *objList) {
|
||||
obj = obj->next;
|
||||
|
||||
if ((gCurrentObject->activeFlags & ACTIVE_FLAG_ACTIVE) != ACTIVE_FLAG_ACTIVE) {
|
||||
if (gCurrentObject->oLightID != 0xFFFF)
|
||||
obj_disable_light(gCurrentObject);
|
||||
// Prevent object from respawning after exiting and re-entering the
|
||||
// area
|
||||
if (!(gCurrentObject->oFlags & OBJ_FLAG_PERSISTENT_RESPAWN)) {
|
||||
|
||||
@@ -187,6 +187,7 @@ void puppylights_iterate(struct PuppyLight *light, Lights1 *src, struct Object *
|
||||
void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour)
|
||||
{
|
||||
s32 i;
|
||||
s32 numlights = 0;
|
||||
|
||||
if (gCurrLevelNum < 4)
|
||||
return;
|
||||
@@ -222,7 +223,10 @@ void puppylights_run(Lights1 *src, struct Object *obj, s32 flags, u32 baseColour
|
||||
for (i = 0; i < gNumLights; i++)
|
||||
{
|
||||
if (gPuppyLights[i]->rgba[3] > 0 && gPuppyLights[i]->active == TRUE && gPuppyLights[i]->area == gCurrAreaIndex && (gPuppyLights[i]->room == -1 || gPuppyLights[i]->room == gMarioCurrentRoom))
|
||||
{
|
||||
puppylights_iterate(gPuppyLights[i], src, obj);
|
||||
numlights++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +252,7 @@ void puppylights_object_emit(struct Object *obj)
|
||||
{
|
||||
if (ABS(gNumLights - gDynLightStart) < MAX_LIGHTS_DYNAMIC)
|
||||
goto deallocate;
|
||||
for (i = gDynLightStart; i < MAX_LIGHTS; i++)
|
||||
for (i = gDynLightStart; i < MIN(gDynLightStart+MAX_LIGHTS_DYNAMIC, MAX_LIGHTS); i++)
|
||||
{
|
||||
if (gPuppyLights[i]->active == TRUE)
|
||||
continue;
|
||||
@@ -272,7 +276,10 @@ void puppylights_object_emit(struct Object *obj)
|
||||
{
|
||||
deallocate:
|
||||
if (obj->oLightID != 0xFFFF)
|
||||
{
|
||||
gPuppyLights[obj->oLightID]->active = FALSE;
|
||||
gPuppyLights[obj->oLightID]->flags = 0;
|
||||
}
|
||||
obj->oLightID = 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user