From cc0d19592c24df7d25fb18482c738644fc4ec569 Mon Sep 17 00:00:00 2001 From: Fazana <52551480+FazanaJ@users.noreply.github.com> Date: Wed, 8 Sep 2021 20:34:24 +0100 Subject: [PATCH] tweak :telephone: --- src/engine/level_script.c | 4 ++-- src/game/puppylights.c | 8 +++++++- src/game/puppylights.h | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/engine/level_script.c b/src/engine/level_script.c index c1cbae09..98c72769 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -376,7 +376,7 @@ static void level_cmd_free_level_pool(void) { alloc_only_pool_resize(sLevelPool, sLevelPool->usedSpace); sLevelPool = NULL; - for (i = 0; i < 8; i++) { + for (i = 0; i < AREA_COUNT; i++) { if (gAreaData[i].terrainData != NULL) { alloc_surface_pools(); break; @@ -390,7 +390,7 @@ static void level_cmd_begin_area(void) { u8 areaIndex = CMD_GET(u8, 2); void *geoLayoutAddr = CMD_GET(void *, 4); - if (areaIndex < 8) { + if (areaIndex < AREA_COUNT) { struct GraphNodeRoot *screenArea = (struct GraphNodeRoot *) process_geo_layout(sLevelPool, geoLayoutAddr); struct GraphNodeCamera *node = (struct GraphNodeCamera *) screenArea->views[0]; diff --git a/src/game/puppylights.c b/src/game/puppylights.c index e1b587f8..a42b13b5 100644 --- a/src/game/puppylights.c +++ b/src/game/puppylights.c @@ -7,6 +7,10 @@ Puppylights is generally intended to be used with things that don't directly use themselves. Inside the main function, you can pass through a colour to override the default light but it will not be affected by environmental tinting. If you wish for an object to emit a light, simply set the object flag OBJ_FLAG_EMIT_LIGHT and set some values to o->puppylight. + +For easy light modification, you can call set_light_properties, so set all the attributes of any +given loaded puppylight struct. Objects will ignore x, y, z, active and room, as it will set all +of these automatically. It will force the PUPPYLIGHT_DYNAMIC flag, too. **/ #include @@ -173,6 +177,8 @@ void puppylights_iterate(struct PuppyLight *light, Lights1 *src, struct Object * //Index 1 of the first dimension of gMatStack is perspective. Note that if you ever decide to cheat your way into rendering things after the game does :^) if (light->flags & PUPPYLIGHT_DIRECTIONAL) tempLight->l->l.dir[i] = approach_f32_asymptotic((s8)(lightDir[0] * gMatStack[1][0][i] + lightDir[1] * gMatStack[1][1][i] + lightDir[2] * gMatStack[1][2][i]), tempLight->l->l.dir[i], scale); + else + tempLight->l->l.dir[i] = 0x28; } } @@ -273,7 +279,7 @@ void puppylights_object_emit(struct Object *obj) //A bit unorthodox, but anything to avoid having to set up data to pass through in the original function. //Objects will completely ignore X, Y, Z and active though. -void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 offsetX, s32 offsetY, s32 offsetZ, s32 yaw, s32 epicentre, s32 colour, s32 flags, s32 active, s32 room) +void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 offsetX, s32 offsetY, s32 offsetZ, s32 yaw, s32 epicentre, s32 colour, s32 flags, s32 room, s32 active) { light->active = active; light->pos[0][0] = x; diff --git a/src/game/puppylights.h b/src/game/puppylights.h index f4bee05b..cd09dce1 100644 --- a/src/game/puppylights.h +++ b/src/game/puppylights.h @@ -46,7 +46,7 @@ extern void cur_obj_enable_light(void); extern void cur_obj_disable_light(void); extern void obj_enable_light(struct Object *obj); extern void obj_disable_light(struct Object *obj); -extern void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 offsetX, s32 offsetY, s32 offsetZ, s32 yaw, s32 epicentre, s32 colour, s32 flags, s32 active, s32 room); +extern void set_light_properties(struct PuppyLight *light, s32 x, s32 y, s32 z, s32 offsetX, s32 offsetY, s32 offsetZ, s32 yaw, s32 epicentre, s32 colour, s32 flags, s32 room, s32 active); extern void puppylights_allocate(void); #endif