tweak ☎️

This commit is contained in:
Fazana
2021-09-08 20:34:24 +01:00
parent c663ad90ed
commit cc0d19592c
3 changed files with 10 additions and 4 deletions

View File

@@ -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];

View File

@@ -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 <ultra64.h>
@@ -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;

View File

@@ -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