From 8d2e6ab45da6390deb22a3d9c2885360db63aaa5 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Sat, 19 Jul 2025 14:05:02 -0400 Subject: [PATCH] Improve lighting documentation (#680) * Improve lighting documentation * More renames in LevelObjectEntry_RgbaLight * Fix wrong-styled function name * Suggested changes to comments * Rename functions * Fix renaming variable * Add light mask enum * Missed function to rename * Update score --- README.md | 42 ++-- include/level_object_entries.h | 10 +- include/structs.h | 2 +- src/game.c | 4 +- src/lights.c | 334 ++++++++++++++------------- src/lights.h | 58 ++--- src/object_functions.c | 2 +- src/objects.c | 22 +- ver/symbols/symbol_addrs.jpn.v79.txt | 34 +-- ver/symbols/symbol_addrs.pal.v77.txt | 34 +-- ver/symbols/symbol_addrs.pal.v80.txt | 34 +-- ver/symbols/symbol_addrs.us.v77.txt | 34 +-- ver/symbols/symbol_addrs.us.v80.txt | 34 +-- 13 files changed, 336 insertions(+), 308 deletions(-) diff --git a/README.md b/README.md index d0702119..6b372172 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,11 @@ This repo contains a work-in-progress decompilation of Diddy Kong Racing for the All versions are supported, and the US 1.0 version (SHA1 = 0cb115d8716dbbc2922fda38e533b9fe63bb9670) of the game is the default if not specified. -As of July 16, 2025, this is our current score: +As of July 19, 2025, this is our current score:     Decomp progress: 96.77% -    Documentation progress: 62.57% +    Documentation progress: 63.41% --- @@ -117,30 +117,30 @@ s32 is_drumstick_unlocked(void) { ``` -As of July 16, 2025, this is our current score: +As of July 19, 2025, this is our current score: ``` - ====================================================================== + ======================================================================= ADVENTURE ONE (ASM -> C Decompilation) - --------------- 96.77% Complete (97.77% NON_MATCHING) ---------------- + ---------------- 96.77% Complete (97.77% NON_MATCHING) ---------------- # Decompiled functions: 1941 # GLOBAL_ASM remaining: 11 - # NON_MATCHING functions: 5 - # NON_EQUIVALENT WIP functions: 6 - ---------------------------- Game Status ----------------------------- - Balloons: 46/47, Keys: 4/4, Trophies: 4/5 + # NON_MATCHING functions: 5 + # NON_EQUIVALENT WIP functions: 6 + ----------------------------- Game Status ----------------------------- + Balloons: 46/47, Keys: 4/4, Trophies: 4/5 T.T. Amulets: 4/4, Wizpig Amulets: 4/4 - ---------------------------------------------------------------------- - We are collecting silver coins in Star City. (7/8 silver coins) - ====================================================================== - ADVENTURE TWO (Cleanup & Documentation) - -------------------------- 62.57% Complete --------------------------- - # Documented functions: 1232 - # Undocumented remaining: 420 - ---------------------------- Game Status ----------------------------- - Balloons: 30/47, Keys: 3/4, Trophies: 2/5 + ----------------------------------------------------------------------- + We are collecting silver coins in Star City. (7/8 silver coins) + ======================================================================= + ADVENTURE TWO (Cleanup & Documentation) + --------------------------- 63.41% Complete --------------------------- + # Documented functions: 1239 + # Undocumented remaining: 413 + ----------------------------- Game Status ----------------------------- + Balloons: 30/47, Keys: 3/4, Trophies: 2/5 T.T. Amulets: 3/4, Wizpig Amulets: 3/4 - ---------------------------------------------------------------------- - We are participating in the Trophy Race of Sherbet Island. (Round Two) - ====================================================================== + ----------------------------------------------------------------------- + We are participating in the Trophy Race of Sherbet Island. (Round Four) + ======================================================================= ``` diff --git a/include/level_object_entries.h b/include/level_object_entries.h index 4426b187..92ea34ee 100644 --- a/include/level_object_entries.h +++ b/include/level_object_entries.h @@ -266,11 +266,11 @@ typedef struct LevelObjectEntry_RgbaLight { /* 0x00 */ LevelObjectEntryCommon common; /* 0x08 */ u8 unk8; /* 0x09 */ u8 unk9; - /* 0x0A */ u8 unkA; - /* 0x0B */ u8 unkB; - /* 0x0C */ u8 unkC; - /* 0x0D */ u8 unkD; - /* 0x0E */ s16 unkE; + /* 0x0A */ u8 colourR; + /* 0x0B */ u8 colourG; + /* 0x0C */ u8 colourB; + /* 0x0D */ u8 intensity; + /* 0x0E */ s16 radius; /* 0x10 */ s16 unk10; /* 0x12 */ s16 unk12; /* 0x14 */ s16 unk14; diff --git a/include/structs.h b/include/structs.h index f55465df..4d3d1b68 100644 --- a/include/structs.h +++ b/include/structs.h @@ -815,7 +815,7 @@ typedef struct ObjectHeader { /* 0x3A */ u8 unk3A; /* 0x3B */ u8 unk3B; /* 0x3C */ u8 unk3C; - /* 0x3D */ u8 unk3D; + /* 0x3D */ u8 shadeIntensityy; /* 0x3E */ s16 shadeAngleY; /* 0x40 */ s16 shadeAngleZ; /* 0x42 */ s16 unk42; diff --git a/src/game.c b/src/game.c index 88e88630..7ca98c1a 100644 --- a/src/game.c +++ b/src/game.c @@ -489,7 +489,7 @@ void level_load(s32 levelId, s32 numberOfPlayers, s32 entranceId, Vehicle vehicl } music_voicelimit_set(gCurrentLevelHeader->voiceLimit); music_volume_reset(); - setup_lights(32); + lights_init(32); var_s0 = VEHICLE_CAR; if (vehicleId >= VEHICLE_CAR && vehicleId < NUMBER_OF_PLAYER_VEHICLES) { var_s0 = gCurrentLevelHeader->unk4F[vehicleId]; @@ -685,7 +685,7 @@ void level_free(void) { music_stop(); music_jingle_stop(); music_channel_reset_all(); - free_lights(); + lights_free(); free_track(); audspat_reset(); sound_volume_change(VOLUME_NORMAL); diff --git a/src/lights.c b/src/lights.c index 8fc3e449..e3b46af7 100644 --- a/src/lights.c +++ b/src/lights.c @@ -11,10 +11,10 @@ /************ .data ************/ ObjectLight **gActiveLights = NULL; -ObjectLight *D_800DC954 = NULL; +ObjectLight *gActiveLightAttrs = NULL; s32 gMaxLights = 0; s32 gNumActiveLights = 0; -unk800DC960 *D_800DC960 = NULL; +ObjectLightShadeProperties *gShadeBuffer = NULL; Vec3f *gLightDirs = NULL; s32 numLights = 0; // Currently unknown, might be a different type. @@ -33,12 +33,12 @@ f32 gLightDiffZ; * Free all lights from RAM. * Official Name: freeLights */ -void free_lights(void) { +void lights_free(void) { if (gActiveLights != NULL) { mempool_free(gActiveLights); gActiveLights = NULL; - D_800DC954 = NULL; - D_800DC960 = NULL; + gActiveLightAttrs = NULL; + gShadeBuffer = NULL; gLightDirs = NULL; } gNumActiveLights = 0; @@ -46,30 +46,34 @@ void free_lights(void) { } /** + * Allocates RAM for all buffers containing light source properties. * Official Name: setupLights */ -void setup_lights(s32 count) { +void lights_init(s32 count) { s32 i; u8 *buffer; s32 temp; - free_lights(); + lights_free(); gMaxLights = count; buffer = (u8 *) mempool_alloc_safe( - gMaxLights * (sizeof(s32 *) + sizeof(ObjectLight) + sizeof(unk800DC960) + sizeof(Vec3f)), COLOUR_TAG_MAGENTA); + gMaxLights * (sizeof(s32 *) + sizeof(ObjectLight) + sizeof(ObjectLightShadeProperties) + sizeof(Vec3f)), COLOUR_TAG_MAGENTA); temp = gMaxLights; gActiveLights = (ObjectLight **) buffer; buffer += temp * sizeof(ObjectLight *); - D_800DC954 = (ObjectLight *) buffer; - D_800DC960 = (unk800DC960 *) ((u32) D_800DC954 + temp * sizeof(ObjectLight)); - gLightDirs = (Vec3f *) ((u32) D_800DC960 + temp * sizeof(unk800DC960)); + gActiveLightAttrs = (ObjectLight *) buffer; + gShadeBuffer = (ObjectLightShadeProperties *) ((u32) gActiveLightAttrs + temp * sizeof(ObjectLight)); + gLightDirs = (Vec3f *) ((u32) gShadeBuffer + temp * sizeof(ObjectLightShadeProperties)); for (i = 0; i < gMaxLights; i++) { - gActiveLights[i] = &D_800DC954[i]; + gActiveLights[i] = &gActiveLightAttrs[i]; } } -ObjectLight *func_80031CAC(Object *obj, LevelObjectEntry_RgbaLight *lightEntry) { +/** + * Adds a light source from a level object entry. + */ +ObjectLight *light_add_from_level_object_entry(Object *obj, LevelObjectEntry_RgbaLight *lightEntry) { s32 i; ObjectLight *light; LevelHeader *levelHeader; @@ -96,18 +100,18 @@ ObjectLight *func_80031CAC(Object *obj, LevelObjectEntry_RgbaLight *lightEntry) light->pos.y = lightEntry->common.y; light->pos.z = lightEntry->common.z; } - light->colourR = lightEntry->unkA << 16; - light->unk2C = 0; - light->unk3C = 0; - light->colourG = lightEntry->unkB << 16; - light->unk30 = 0; - light->unk3E = 0; - light->colourB = lightEntry->unkC << 16; - light->unk34 = 0; - light->unk40 = 0; - light->intensity = lightEntry->unkD << 16; - light->unk38 = 0; - light->unk42 = 0; + light->colourR = lightEntry->colourR << 16; + light->targetColourChangeRateR = 0; + light->targetColourDiffR = 0; + light->colourG = lightEntry->colourG << 16; + light->targetColourChangeRateG = 0; + light->targetColourDiffG = 0; + light->colourB = lightEntry->colourB << 16; + light->targetColourChangeRateB = 0; + light->targetColourDiffB = 0; + light->intensity = lightEntry->intensity << 16; + light->targetIntensityChangeRate = 0; + light->targetIntensityDiff = 0; light->unk44 = NULL; if (lightEntry->unk1C < 7) { levelHeader = level_header(); @@ -123,7 +127,7 @@ ObjectLight *func_80031CAC(Object *obj, LevelObjectEntry_RgbaLight *lightEntry) // clang-format on } } - light->radius = lightEntry->unkE; + light->radius = lightEntry->radius; light->unk60 = lightEntry->unk10; light->unk64 = lightEntry->unk12; light->radiusSquare = light->radius * light->radius; @@ -136,7 +140,7 @@ ObjectLight *func_80031CAC(Object *obj, LevelObjectEntry_RgbaLight *lightEntry) light->unk7A = (lightEntry->unk1A) ? 0xFFFF : 0; light->unk7A = 0; light->unk5 = 1; - func_80032424(light, 0); + light_update(light, 0); } return light; } @@ -144,7 +148,7 @@ ObjectLight *func_80031CAC(Object *obj, LevelObjectEntry_RgbaLight *lightEntry) /** * Official Name: addObjectLight */ -ObjectLight *add_object_light(Object *obj, ObjectHeader24 *arg1) { +ObjectLight *light_add_from_object_header(Object *obj, ObjectHeader24 *arg1) { s32 i; ObjectLight *light; @@ -164,17 +168,17 @@ ObjectLight *add_object_light(Object *obj, ObjectHeader24 *arg1) { light->pos.y = light->homeY; light->pos.z = light->homeZ; light->colourR = arg1->unk2 << 16; - light->unk2C = 0; - light->unk3C = 0; + light->targetColourChangeRateR = 0; + light->targetColourDiffR = 0; light->colourG = arg1->unk3 << 16; - light->unk30 = 0; - light->unk3E = 0; + light->targetColourChangeRateG = 0; + light->targetColourDiffG = 0; light->colourB = arg1->unk4 << 16; - light->unk34 = 0; - light->unk40 = 0; + light->targetColourChangeRateB = 0; + light->targetColourDiffB = 0; light->intensity = arg1->unk5 << 16; - light->unk38 = 0; - light->unk42 = 0; + light->targetIntensityChangeRate = 0; + light->targetIntensityDiff = 0; if (arg1->unk6 != 0xFFFF) { light->unk44_asset = (MiscAssetObjectHeader24 *) get_misc_asset(arg1->unk6); light->unk48 = light->unk44_asset->unk0; @@ -200,7 +204,7 @@ ObjectLight *add_object_light(Object *obj, ObjectHeader24 *arg1) { light->unk76 = 0; light->unk7A = 0; light->unk5 = 1; - func_80032424(light, 0); + light_update(light, 0); } return light; } @@ -209,7 +213,7 @@ ObjectLight *add_object_light(Object *obj, ObjectHeader24 *arg1) { * Disable this objects light data. * Official Name: turnLightOff? */ -UNUSED void disable_object_light(ObjectLight *light) { +UNUSED void light_disable(ObjectLight *light) { light->enabled = FALSE; } @@ -217,14 +221,14 @@ UNUSED void disable_object_light(ObjectLight *light) { * Enable this objects light data. * Official Name: turnLightOn? */ -UNUSED void enable_object_light(ObjectLight *light) { +UNUSED void light_enable(ObjectLight *light) { light->enabled = TRUE; } /** * Toggle this objects light data on or off. */ -UNUSED void toggle_object_light(ObjectLight *light) { +UNUSED void light_toggle(ObjectLight *light) { if (light->enabled == TRUE) { light->enabled = FALSE; } else { @@ -232,39 +236,49 @@ UNUSED void toggle_object_light(ObjectLight *light) { } } -UNUSED void func_80032248(ObjectLight *light, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6) { - if (arg2 > 0) { - light->unk3C = arg2; - light->unk2C = ((arg1 << 0x10) - light->colourR) / arg2; +/** + * Initialises a gradual change of colour for a light source. + */ +UNUSED void light_setup_colour_change(ObjectLight *light, s32 targetR, s32 diffR, s32 targetG, s32 diffG, s32 targetB, s32 diffB) { + if (diffR > 0) { + light->targetColourDiffR = diffR; + light->targetColourChangeRateR = ((targetR << 0x10) - light->colourR) / diffR; } - if (arg4 > 0) { - light->unk3E = arg4; - light->unk30 = ((arg3 << 0x10) - light->colourG) / arg4; + if (diffG > 0) { + light->targetColourDiffG = diffG; + light->targetColourChangeRateG = ((targetG << 0x10) - light->colourG) / diffG; } - if (arg6 > 0) { - light->unk34 = ((arg5 << 0x10) - light->colourB) / arg6; - light->unk40 = arg6; + if (diffB > 0) { + light->targetColourChangeRateB = ((targetB << 0x10) - light->colourB) / diffB; + light->targetColourDiffB = diffB; } } -UNUSED void func_80032344(ObjectLight *light, s32 arg1, s32 arg2) { - if (arg2 > 0) { - light->unk42 = arg2; - light->unk38 = ((arg1 << 0x10) - light->intensity) / arg2; +/** + * Initialises a gradual change of intensity for a light source. + */ +UNUSED void light_setup_intensity_change(ObjectLight *light, s32 target, s32 diff) { + if (diff > 0) { + light->targetIntensityDiff = diff; + light->targetIntensityChangeRate = ((target << 0x10) - light->intensity) / diff; } } /** * Loops through all active lights and updates their properties. + * Official Name: lightUpdateLights */ -void lightUpdateLights(s32 updateRate) { +void light_update_all(s32 updateRate) { s32 i; for (i = 0; i < gNumActiveLights; i++) { - func_80032424(gActiveLights[i], updateRate); + light_update(gActiveLights[i], updateRate); } } -void func_80032424(ObjectLight *light, s32 updateRate) { +/** + * Updates an active light's properties. + */ +void light_update(ObjectLight *light, s32 updateRate) { Vec3s rotation; SubMiscAssetObjectHeader24 *var_a3; s32 temp_v0; @@ -301,44 +315,44 @@ void func_80032424(ObjectLight *light, s32 updateRate) { light->colourB = ((var_a3->unk2 - temp_v1->unk2) * light->unk4C * temp_v0) + (temp_v1->unk2 << 0x10); light->intensity = ((var_a3->unk3 - temp_v1->unk3) * light->unk4C * temp_v0) + (temp_v1->unk3 << 0x10); } else { - if (light->unk3C != 0) { - temp_v0 = light->unk3C; - if (updateRate < light->unk3C) { - light->colourR += light->unk2C * updateRate; - light->unk3C -= updateRate; + if (light->targetColourDiffR != 0) { + temp_v0 = light->targetColourDiffR; + if (updateRate < light->targetColourDiffR) { + light->colourR += light->targetColourChangeRateR * updateRate; + light->targetColourDiffR -= updateRate; } else { - light->unk3C = 0; - light->colourR += light->unk2C * temp_v0; + light->targetColourDiffR = 0; + light->colourR += light->targetColourChangeRateR * temp_v0; } } - if (light->unk3E != 0) { - temp_v0 = light->unk3E; - if (updateRate < light->unk3E) { - light->colourG += light->unk30 * updateRate; - light->unk3E -= updateRate; + if (light->targetColourDiffG != 0) { + temp_v0 = light->targetColourDiffG; + if (updateRate < light->targetColourDiffG) { + light->colourG += light->targetColourChangeRateG * updateRate; + light->targetColourDiffG -= updateRate; } else { - light->unk3E = 0; - light->colourG += light->unk30 * temp_v0; + light->targetColourDiffG = 0; + light->colourG += light->targetColourChangeRateG * temp_v0; } } - if (light->unk40 != 0) { - temp_v0 = light->unk40; - if (updateRate < light->unk40) { - light->colourB += light->unk34 * updateRate; - light->unk40 -= updateRate; + if (light->targetColourDiffB != 0) { + temp_v0 = light->targetColourDiffB; + if (updateRate < light->targetColourDiffB) { + light->colourB += light->targetColourChangeRateB * updateRate; + light->targetColourDiffB -= updateRate; } else { - light->unk40 = 0; - light->colourB += light->unk34 * temp_v0; + light->targetColourDiffB = 0; + light->colourB += light->targetColourChangeRateB * temp_v0; } } - if (light->unk42 != 0) { - temp_v0 = light->unk42; - if (updateRate < light->unk42) { - light->intensity += light->unk38 * updateRate; - light->unk42 -= updateRate; + if (light->targetIntensityDiff != 0) { + temp_v0 = light->targetIntensityDiff; + if (updateRate < light->targetIntensityDiff) { + light->intensity += light->targetIntensityChangeRate * updateRate; + light->targetIntensityDiff -= updateRate; } else { - light->unk42 = 0; - light->intensity += light->unk38 * temp_v0; + light->targetIntensityDiff = 0; + light->intensity += light->targetIntensityChangeRate * temp_v0; } } } @@ -369,21 +383,21 @@ void func_80032424(ObjectLight *light, s32 updateRate) { light->unk5 = 1; } if (light->unk5) { - light->unk50 = light->pos.x - light->radius; - light->unk56 = light->pos.x + light->radius; + light->minX = light->pos.x - light->radius; + light->maxX = light->pos.x + light->radius; if (light->unk0 == 1) { - light->unk52 = light->pos.y - light->radius; - light->unk58 = light->pos.y + light->radius; + light->minY = light->pos.y - light->radius; + light->maxY = light->pos.y + light->radius; } else { - light->unk52 = light->pos.y - light->unk60; - light->unk58 = light->pos.y + light->unk60; + light->minY = light->pos.y - light->unk60; + light->maxY = light->pos.y + light->unk60; } if (light->unk0 == 0) { - light->unk54 = light->pos.z - light->unk64; - light->unk5A = light->pos.z + light->unk64; + light->minZ = light->pos.z - light->unk64; + light->maxZ = light->pos.z + light->unk64; } else { - light->unk54 = light->pos.z - light->radius; - light->unk5A = light->pos.z + light->radius; + light->minZ = light->pos.z - light->radius; + light->maxZ = light->pos.z + light->radius; } if (light->unk1 == 2) { light->direction.z = -1.0f; @@ -405,7 +419,7 @@ void func_80032424(ObjectLight *light, s32 updateRate) { /** * Official Name: killLight? */ -void func_80032BAC(ObjectLight *light) { +void light_remove(ObjectLight *light) { ObjectLight *entry = NULL; s32 i; for (i = 0; (i < gNumActiveLights) && (entry == NULL); i++) { @@ -426,36 +440,39 @@ void func_80032BAC(ObjectLight *light) { * Return the number of active lights. * Official Name: lightGetLights? */ -s32 get_light_count(void) { +s32 light_count(void) { return gNumActiveLights; } -void func_80032C7C(Object *object) { +/** + * Updates the shading on an object based on nearby high-intensity light sources. + */ +void light_update_shading(Object *object) { ObjectLight *light; s16 primIndex, secIndex; f32 intensity; s16 objX; s16 objY; s16 objZ; - u8 sp64; + u8 objTypeMask; s32 i; - if (object->header->unk3D == 0) { + if (object->header->shadeIntensityy == 0) { switch (object->header->modelType) { case OBJECT_MODEL_TYPE_3D_MODEL: - sp64 = 2; + objTypeMask = LIGHT_MASK_UNK2; break; case OBJECT_MODEL_TYPE_SPRITE_BILLBOARD: - sp64 = 4; + objTypeMask = LIGHT_MASK_UNK4; break; case OBJECT_MODEL_TYPE_VEHICLE_PART: - sp64 = 4; + objTypeMask = LIGHT_MASK_UNK4; break; case OBJECT_MODEL_TYPE_UNKNOWN3: - sp64 = 4; + objTypeMask = LIGHT_MASK_UNK4; break; default: - sp64 = 0; + objTypeMask = LIGHT_MASK_NONE; break; } @@ -467,15 +484,15 @@ void func_80032C7C(Object *object) { for (i = 0; i < gNumActiveLights; i++) { light = gActiveLights[i]; - if ((light->unk2 & sp64) && (light->enabled == TRUE) && (objX >= light->unk50) && (light->unk56 >= objX) && - (objY >= light->unk52) && (light->unk58 >= objY) && (objZ >= light->unk54) && (light->unk5A >= objZ)) { + if ((light->unk2 & objTypeMask) && (light->enabled == TRUE) && (objX >= light->minX) && (light->maxX >= objX) && + (objY >= light->minY) && (light->maxY >= objY) && (objZ >= light->minZ) && (light->maxZ >= objZ)) { if (light->unk0 == 0) { if (light->intensity >= 0x10000) { - D_800DC960[numLights].lightObj = light; - D_800DC960[numLights].colourR = light->colourR >> 0x10; - D_800DC960[numLights].colourG = light->colourG >> 0x10; - D_800DC960[numLights].colourB = light->colourB >> 0x10; - D_800DC960[numLights].intensity = light->intensity >> 0x10; + gShadeBuffer[numLights].lightObj = light; + gShadeBuffer[numLights].colourR = light->colourR >> 0x10; + gShadeBuffer[numLights].colourG = light->colourG >> 0x10; + gShadeBuffer[numLights].colourB = light->colourB >> 0x10; + gShadeBuffer[numLights].intensity = light->intensity >> 0x10; numLights++; } } else { @@ -511,11 +528,11 @@ void func_80032C7C(Object *object) { gLightDirs[numLights].y = gLightDiffY; gLightDirs[numLights].z = gLightDiffZ; } - D_800DC960[numLights].lightObj = light; - D_800DC960[numLights].colourR = light->colourR >> 0x10; - D_800DC960[numLights].colourG = light->colourG >> 0x10; - D_800DC960[numLights].colourB = light->colourB >> 0x10; - D_800DC960[numLights].intensity = (u8) intensity; + gShadeBuffer[numLights].lightObj = light; + gShadeBuffer[numLights].colourR = light->colourR >> 0x10; + gShadeBuffer[numLights].colourG = light->colourG >> 0x10; + gShadeBuffer[numLights].colourB = light->colourB >> 0x10; + gShadeBuffer[numLights].intensity = (u8) intensity; numLights++; } } @@ -530,16 +547,16 @@ void func_80032C7C(Object *object) { object->shading->lightIntensity = 0; object->shading->secondaryLightIntensity = 0; } else if (numLights == 1) { - object->shading->lightR = D_800DC960[0].colourR; - object->shading->lightG = D_800DC960[0].colourG; - object->shading->lightB = D_800DC960[0].colourB; - object->shading->lightIntensity = D_800DC960[0].intensity; + object->shading->lightR = gShadeBuffer[0].colourR; + object->shading->lightG = gShadeBuffer[0].colourG; + object->shading->lightB = gShadeBuffer[0].colourB; + object->shading->lightIntensity = gShadeBuffer[0].intensity; object->shading->secondaryLightIntensity = 0; object->shading->lightDirX = gLightDirs[0].x * 8192.0f; object->shading->lightDirY = gLightDirs[0].y * 8192.0f; object->shading->lightDirZ = gLightDirs[0].z * 8192.0f; } else { - if (D_800DC960[1].intensity < D_800DC960[0].intensity) { + if (gShadeBuffer[1].intensity < gShadeBuffer[0].intensity) { primIndex = 0; secIndex = 1; } else { @@ -547,8 +564,8 @@ void func_80032C7C(Object *object) { secIndex = 0; } for (i = 2; i < numLights; i++) { - if (D_800DC960[secIndex].intensity < D_800DC960[i].intensity) { - if (D_800DC960[primIndex].intensity < D_800DC960[i].intensity) { + if (gShadeBuffer[secIndex].intensity < gShadeBuffer[i].intensity) { + if (gShadeBuffer[primIndex].intensity < gShadeBuffer[i].intensity) { secIndex = primIndex; primIndex = i; } else { @@ -556,31 +573,32 @@ void func_80032C7C(Object *object) { } } } - object->shading->lightR = D_800DC960[primIndex].colourR; - object->shading->lightG = D_800DC960[primIndex].colourG; - object->shading->lightB = D_800DC960[primIndex].colourB; - object->shading->lightIntensity = D_800DC960[primIndex].intensity; + object->shading->lightR = gShadeBuffer[primIndex].colourR; + object->shading->lightG = gShadeBuffer[primIndex].colourG; + object->shading->lightB = gShadeBuffer[primIndex].colourB; + object->shading->lightIntensity = gShadeBuffer[primIndex].intensity; object->shading->lightDirX = gLightDirs[primIndex].x * 8192.0f; object->shading->lightDirY = gLightDirs[primIndex].y * 8192.0f; object->shading->lightDirZ = gLightDirs[primIndex].z * 8192.0f; - object->shading->secondaryLightR = D_800DC960[secIndex].colourR; - object->shading->secondaryLightG = D_800DC960[secIndex].colourG; - object->shading->secondaryLightB = D_800DC960[secIndex].colourB; - object->shading->secondaryLightIntensity = D_800DC960[secIndex].intensity; + object->shading->secondaryLightR = gShadeBuffer[secIndex].colourR; + object->shading->secondaryLightG = gShadeBuffer[secIndex].colourG; + object->shading->secondaryLightB = gShadeBuffer[secIndex].colourB; + object->shading->secondaryLightIntensity = gShadeBuffer[secIndex].intensity; object->shading->secondaryLightDirX = gLightDirs[secIndex].x * 8192.0f; object->shading->secondaryLightDirY = gLightDirs[secIndex].y * 8192.0f; object->shading->secondaryLightDirZ = gLightDirs[secIndex].z * 8192.0f; } } else { + // Ambient light shading if (numLights > 0) { if (numLights >= 2) { - func_800337E4(); + light_update_ambience(); } - object->shading->lightR = D_800DC960[0].colourR; - object->shading->lightG = D_800DC960[0].colourG; - object->shading->lightB = D_800DC960[0].colourB; - object->shading->lightIntensity = D_800DC960[0].intensity; + object->shading->lightR = gShadeBuffer[0].colourR; + object->shading->lightG = gShadeBuffer[0].colourG; + object->shading->lightB = gShadeBuffer[0].colourB; + object->shading->lightIntensity = gShadeBuffer[0].intensity; } else { object->shading->lightR = 255; object->shading->lightG = 255; @@ -591,32 +609,36 @@ void func_80032C7C(Object *object) { } } -void func_800337E4(void) { - s32 temp_lo; +/** + * In the case of ambient lighting for object shading, mix ambient light sources based on + * their intensity into the first entry in the shading buffer. + */ +void light_update_ambience(void) { + s32 intensityRatio; s32 i; for (i = 1; i < numLights; i++) { - if (D_800DC960[i].intensity >= 2) { - if (D_800DC960[0].intensity >= D_800DC960[i].intensity) { - temp_lo = (D_800DC960[i].intensity << 16) / D_800DC960[0].intensity; - D_800DC960[0].colourR += (D_800DC960[i].colourR * temp_lo) >> 16; - D_800DC960[0].colourG += (D_800DC960[i].colourG * temp_lo) >> 16; - D_800DC960[0].colourB += (D_800DC960[i].colourB * temp_lo) >> 16; + if (gShadeBuffer[i].intensity >= 2) { + if (gShadeBuffer[0].intensity >= gShadeBuffer[i].intensity) { + intensityRatio = (gShadeBuffer[i].intensity << 16) / gShadeBuffer[0].intensity; + gShadeBuffer[0].colourR += (gShadeBuffer[i].colourR * intensityRatio) >> 16; + gShadeBuffer[0].colourG += (gShadeBuffer[i].colourG * intensityRatio) >> 16; + gShadeBuffer[0].colourB += (gShadeBuffer[i].colourB * intensityRatio) >> 16; } else { - temp_lo = (D_800DC960[0].intensity << 16) / D_800DC960[i].intensity; - D_800DC960[0].colourR = ((D_800DC960[0].colourR * temp_lo) >> 16) + D_800DC960[i].colourR; - D_800DC960[0].colourG = ((D_800DC960[0].colourG * temp_lo) >> 16) + D_800DC960[i].colourG; - D_800DC960[0].colourB = ((D_800DC960[0].colourB * temp_lo) >> 16) + D_800DC960[i].colourB; - D_800DC960[0].intensity = D_800DC960[i].intensity; + intensityRatio = (gShadeBuffer[0].intensity << 16) / gShadeBuffer[i].intensity; + gShadeBuffer[0].colourR = ((gShadeBuffer[0].colourR * intensityRatio) >> 16) + gShadeBuffer[i].colourR; + gShadeBuffer[0].colourG = ((gShadeBuffer[0].colourG * intensityRatio) >> 16) + gShadeBuffer[i].colourG; + gShadeBuffer[0].colourB = ((gShadeBuffer[0].colourB * intensityRatio) >> 16) + gShadeBuffer[i].colourB; + gShadeBuffer[0].intensity = gShadeBuffer[i].intensity; } - if (D_800DC960[0].colourR >= 256) { - D_800DC960[0].colourR = 255; + if (gShadeBuffer[0].colourR >= 256) { + gShadeBuffer[0].colourR = 255; } - if (D_800DC960[0].colourG >= 256) { - D_800DC960[0].colourG = 255; + if (gShadeBuffer[0].colourG >= 256) { + gShadeBuffer[0].colourG = 255; } - if (D_800DC960[0].colourB >= 256) { - D_800DC960[0].colourB = 255; + if (gShadeBuffer[0].colourB >= 256) { + gShadeBuffer[0].colourB = 255; } } } diff --git a/src/lights.h b/src/lights.h index b0c2b35d..dfe4c343 100644 --- a/src/lights.h +++ b/src/lights.h @@ -13,6 +13,12 @@ enum LightType { LIGHT_UNK5, }; +enum LightMask { + LIGHT_MASK_NONE = 0, + LIGHT_MASK_UNK2 = 1 << 1, + LIGHT_MASK_UNK4 = 1 << 2, +}; + typedef struct SubMiscAssetObjectHeader24 { u8 unk0; u8 unk1; @@ -44,14 +50,14 @@ typedef struct ObjectLight { s32 colourG; s32 colourB; s32 intensity; - s32 unk2C; - s32 unk30; - s32 unk34; - s32 unk38; - u16 unk3C; - u16 unk3E; - u16 unk40; - u16 unk42; + s32 targetColourChangeRateR; + s32 targetColourChangeRateG; + s32 targetColourChangeRateB; + s32 targetIntensityChangeRate; + u16 targetColourDiffR; + u16 targetColourDiffG; + u16 targetColourDiffB; + u16 targetIntensityDiff; union { SubMiscAssetObjectHeader24 *unk44; MiscAssetObjectHeader24 *unk44_asset; @@ -60,12 +66,12 @@ typedef struct ObjectLight { u16 unk4A; u16 unk4C; u16 unk4E; - s16 unk50; - s16 unk52; - s16 unk54; - s16 unk56; - s16 unk58; - s16 unk5A; + s16 minX; + s16 minY; + s16 minZ; + s16 maxX; + s16 maxY; + s16 maxZ; f32 radius; f32 unk60; f32 unk64; @@ -81,27 +87,27 @@ typedef struct ObjectLight { } ObjectLight; /* Size: 0x14 bytes */ -typedef struct unk800DC960 { +typedef struct ObjectLightShadeProperties { ObjectLight* lightObj; s32 colourR; s32 colourG; s32 colourB; s32 intensity; -} unk800DC960; +} ObjectLightShadeProperties; -void free_lights(void); -void lightUpdateLights(s32 updateRate); -void func_80032BAC(ObjectLight *light); -s32 get_light_count(void); +void lights_free(void); +void light_update_all(s32 updateRate); +void light_remove(ObjectLight *light); +s32 light_count(void); f32 light_distance_calc(ObjectLight *light); f32 light_direction_calc(ObjectLight *light); -ObjectLight *func_80031CAC(Object *obj, LevelObjectEntry_RgbaLight *lightEntry); -ObjectLight *add_object_light(Object *obj, ObjectHeader24 *arg1); -void func_80032424(ObjectLight *light, s32 updateRate); +ObjectLight *light_add_from_level_object_entry(Object *obj, LevelObjectEntry_RgbaLight *lightEntry); +ObjectLight *light_add_from_object_header(Object *obj, ObjectHeader24 *arg1); +void light_update(ObjectLight *light, s32 updateRate); //Non Matching -void setup_lights(s32 count); -void func_80032C7C(Object *object); -void func_800337E4(void); +void lights_init(s32 count); +void light_update_shading(Object *object); +void light_update_ambience(void); #endif diff --git a/src/object_functions.c b/src/object_functions.c index 34f45292..5622968d 100644 --- a/src/object_functions.c +++ b/src/object_functions.c @@ -5539,7 +5539,7 @@ void obj_loop_texscroll(Object *obj, s32 updateRate) { /* Official name: rgbalightInit */ void obj_init_rgbalight(Object *obj, LevelObjectEntry_RgbaLight *entry, UNUSED s32 arg2) { - obj->light = func_80031CAC(obj, entry); + obj->light = light_add_from_level_object_entry(obj, entry); } /** diff --git a/src/objects.c b/src/objects.c index d7b8c067..fae5dd8f 100644 --- a/src/objects.c +++ b/src/objects.c @@ -2268,7 +2268,7 @@ void objFreeAssets(Object *obj, s32 count, s32 objType) { void light_setup_light_sources(Object *obj) { s32 i; for (i = 0; i < obj->header->numLightSources; i++) { - obj->lightData[i] = add_object_light(obj, &obj->header->unk24[i]); + obj->lightData[i] = light_add_from_object_header(obj, &obj->header->unk24[i]); } } @@ -2286,11 +2286,11 @@ s32 init_object_shading(Object *obj, ShadeProperties *shadeData) { if (obj->modelInstances[i] != NULL && obj->modelInstances[i]->objModel->normals != NULL) { set_shading_properties(obj->shading, obj->header->shadeAmbient, obj->header->shadeDiffuse, 0, obj->header->shadeAngleY, obj->header->shadeAngleZ); - if (obj->header->unk3D != 0) { + if (obj->header->shadeIntensityy != 0) { obj->shading->lightR = obj->header->unk3A; obj->shading->lightG = obj->header->unk3B; obj->shading->lightB = obj->header->unk3C; - obj->shading->lightIntensity = obj->header->unk3D; + obj->shading->lightIntensity = obj->header->shadeIntensityy; obj->shading->lightDirX = -(obj->shading->shadowDirX >> 1); obj->shading->lightDirY = -(obj->shading->shadowDirY >> 1); obj->shading->lightDirZ = -(obj->shading->shadowDirZ >> 1); @@ -2596,7 +2596,7 @@ void obj_destroy(Object *obj, s32 arg1) { } if (obj->lightData != NULL) { for (i = 0; i < obj->header->numLightSources; i++) { - func_80032BAC(obj->lightData[i]); + light_remove(obj->lightData[i]); } } switch (obj->behaviorId) { @@ -2653,7 +2653,7 @@ void obj_destroy(Object *obj, s32 arg1) { i = BHV_RACER; break; case BHV_LIGHT_RGBA: - func_80032BAC(obj->light); + light_remove(obj->light); i = BHV_RACER; break; @@ -2899,12 +2899,12 @@ void obj_update(s32 updateRate) { } // Update lights - lightUpdateLights(updateRate); - if (get_light_count() > 0) { + light_update_all(updateRate); + if (light_count() > 0) { for (i = gObjectListStart; i < gObjectCount; i++) { obj = gObjPtrList[i]; if (!(obj->trans.flags & OBJ_FLAGS_PARTICLE) && (obj->shading != NULL)) { - func_80032C7C(obj); + light_update_shading(obj); } } } @@ -7840,11 +7840,11 @@ UNUSED void add_shading_properties(Object *obj, f32 ambientChange, f32 diffuseCh set_shading_properties(obj->shading, obj->shading->ambient, obj->shading->diffuse, (obj->shading->unk22 + angleX), (obj->shading->unk24 + angleY), (obj->shading->unk26 + angleZ)); - if (obj->header->unk3D != 0) { + if (obj->header->shadeIntensityy != 0) { obj->shading->lightR = obj->header->unk3A; obj->shading->lightG = obj->header->unk3B; obj->shading->lightB = obj->header->unk3C; - obj->shading->lightIntensity = obj->header->unk3D; + obj->shading->lightIntensity = obj->header->shadeIntensityy; obj->shading->lightDirX = -(obj->shading->shadowDirX >> 1); obj->shading->lightDirY = -(obj->shading->shadowDirY >> 1); obj->shading->lightDirZ = -(obj->shading->shadowDirZ >> 1); @@ -7967,7 +7967,7 @@ void calc_dynamic_lighting_for_object_1(Object *object, ObjectModel *model, s16 objRot.z_rotation = -object->trans.rotation.z_rotation; vec3f_rotate_ypr(&objRot, &direction); - if (object->header->unk3D != 0 && arg2) { + if (object->header->shadeIntensityy != 0 && arg2) { mtxf_transform_dir(get_projection_matrix_f32(), &direction, &direction); } diff --git a/ver/symbols/symbol_addrs.jpn.v79.txt b/ver/symbols/symbol_addrs.jpn.v79.txt index 24699279..16ee1d7c 100644 --- a/ver/symbols/symbol_addrs.jpn.v79.txt +++ b/ver/symbols/symbol_addrs.jpn.v79.txt @@ -479,21 +479,21 @@ compute_grid_overlap_mask = 0x800314DC; resolve_collisions = 0x80031600; // lights.c .text -free_lights = 0x80031B60; -setup_lights = 0x80031BB8; -func_80031CAC = 0x80031CAC; -add_object_light = 0x80031F88; -disable_object_light = 0x80032210; -enable_object_light = 0x80032218; -toggle_object_light = 0x80032224; -func_80032248 = 0x80032248; -func_80032344 = 0x80032344; -lightUpdateLights = 0x80032398; -func_80032424 = 0x80032424; -func_80032BAC = 0x80032BAC; -get_light_count = 0x80032C6C; -func_80032C7C = 0x80032C7C; -func_800337E4 = 0x800337E4; +lights_free = 0x80031B60; +lights_init = 0x80031BB8; +light_add_from_level_object_entry = 0x80031CAC; +light_add_from_object_header = 0x80031F88; +light_disable = 0x80032210; +light_enable = 0x80032218; +light_toggle = 0x80032224; +light_setup_colour_change = 0x80032248; +light_setup_intensity_change = 0x80032344; +light_update_all = 0x80032398; +light_update = 0x80032424; +light_remove = 0x80032BAC; +light_count = 0x80032C6C; +light_update_shading = 0x80032C7C; +light_update_ambience = 0x800337E4; light_distance_calc = 0x80033A14; light_direction_calc = 0x80033C08; @@ -2253,10 +2253,10 @@ D_800DC92C = 0x800DE2CC; // lights.c .data gActiveLights = 0x800DE2F0; -D_800DC954 = 0x800DE2F4; +gActiveLightAttrs = 0x800DE2F4; gMaxLights = 0x800DE2F8; gNumActiveLights = 0x800DE2FC; -D_800DC960 = 0x800DE300; +gShadeBuffer = 0x800DE300; gLightDirs = 0x800DE304; D_800DC968 = 0x800DE308; diff --git a/ver/symbols/symbol_addrs.pal.v77.txt b/ver/symbols/symbol_addrs.pal.v77.txt index df2f81d6..bce3a1bd 100644 --- a/ver/symbols/symbol_addrs.pal.v77.txt +++ b/ver/symbols/symbol_addrs.pal.v77.txt @@ -479,21 +479,21 @@ compute_grid_overlap_mask = 0x800314DC; resolve_collisions = 0x80031600; // lights.c .text -free_lights = 0x80031B60; -setup_lights = 0x80031BB8; -func_80031CAC = 0x80031CAC; -add_object_light = 0x80031F88; -disable_object_light = 0x80032210; -enable_object_light = 0x80032218; -toggle_object_light = 0x80032224; -func_80032248 = 0x80032248; -func_80032344 = 0x80032344; -lightUpdateLights = 0x80032398; -func_80032424 = 0x80032424; -func_80032BAC = 0x80032BAC; -get_light_count = 0x80032C6C; -func_80032C7C = 0x80032C7C; -func_800337E4 = 0x800337E4; +lights_free = 0x80031B60; +lights_init = 0x80031BB8; +light_add_from_level_object_entry = 0x80031CAC; +light_add_from_object_header = 0x80031F88; +light_disable = 0x80032210; +light_enable = 0x80032218; +light_toggle = 0x80032224; +light_setup_colour_change = 0x80032248; +light_setup_intensity_change = 0x80032344; +light_update_all = 0x80032398; +light_update = 0x80032424; +light_remove = 0x80032BAC; +light_count = 0x80032C6C; +light_update_shading = 0x80032C7C; +light_update_ambience = 0x800337E4; light_distance_calc = 0x80033A14; light_direction_calc = 0x80033C08; @@ -2149,10 +2149,10 @@ gVoidData = 0x800DC9B4; D_800DC928 = 0x800DC9B8; D_800DC92C = 0x800DC9BC; gActiveLights = 0x800DC9E0; -D_800DC954 = 0x800DC9E4; +gActiveLightAttrs = 0x800DC9E4; gMaxLights = 0x800DC9E8; gNumActiveLights = 0x800DC9EC; -D_800DC960 = 0x800DC9F0; +gShadeBuffer = 0x800DC9F0; gLightDirs = 0x800DC9F4; D_800DC968 = 0x800DC9F8; gTajTransformTransitionEnd = 0x800DCA00; diff --git a/ver/symbols/symbol_addrs.pal.v80.txt b/ver/symbols/symbol_addrs.pal.v80.txt index 576b2477..dcd2c1ba 100644 --- a/ver/symbols/symbol_addrs.pal.v80.txt +++ b/ver/symbols/symbol_addrs.pal.v80.txt @@ -471,21 +471,21 @@ compute_scene_camera_transform_matrix = 0x80031058; generate_collision_candidates = 0x80031170; compute_grid_overlap_mask = 0x8003151C; resolve_collisions = 0x80031640; -free_lights = 0x80031BA0; -setup_lights = 0x80031BF8; -func_80031CAC = 0x80031CEC; -add_object_light = 0x80031FC8; -disable_object_light = 0x80032250; -enable_object_light = 0x80032258; -toggle_object_light = 0x80032264; -func_80032248 = 0x80032288; -func_80032344 = 0x80032384; -lightUpdateLights = 0x800323D8; -func_80032424 = 0x80032464; -func_80032BAC = 0x80032BEC; -get_light_count = 0x80032CAC; -func_80032C7C = 0x80032CBC; -func_800337E4 = 0x80033824; +lights_free = 0x80031BA0; +lights_init = 0x80031BF8; +light_add_from_level_object_entry = 0x80031CEC; +light_add_from_object_header = 0x80031FC8; +light_disable = 0x80032250; +light_enable = 0x80032258; +light_toggle = 0x80032264; +light_setup_colour_change = 0x80032288; +light_setup_intensity_change = 0x80032384; +light_update_all = 0x800323D8; +light_update = 0x80032464; +light_remove = 0x80032BEC; +light_count = 0x80032CAC; +light_update_shading = 0x80032CBC; +light_update_ambience = 0x80033824; light_distance_calc = 0x80033A54; light_direction_calc = 0x80033C48; obj_init_scenery = 0x80033D00; @@ -2076,10 +2076,10 @@ gVoidData = 0x800DCF24; D_800DC928 = 0x800DCF28; D_800DC92C = 0x800DCF2C; gActiveLights = 0x800DCF50; -D_800DC954 = 0x800DCF54; +gActiveLightAttrs = 0x800DCF54; gMaxLights = 0x800DCF58; gNumActiveLights = 0x800DCF5C; -D_800DC960 = 0x800DCF60; +gShadeBuffer = 0x800DCF60; gLightDirs = 0x800DCF64; D_800DC968 = 0x800DCF68; gTajTransformTransitionEnd = 0x800DCF70; diff --git a/ver/symbols/symbol_addrs.us.v77.txt b/ver/symbols/symbol_addrs.us.v77.txt index 0b544330..4db0664d 100644 --- a/ver/symbols/symbol_addrs.us.v77.txt +++ b/ver/symbols/symbol_addrs.us.v77.txt @@ -479,21 +479,21 @@ compute_grid_overlap_mask = 0x800314DC; resolve_collisions = 0x80031600; // lights.c .text -free_lights = 0x80031B60; -setup_lights = 0x80031BB8; -func_80031CAC = 0x80031CAC; -add_object_light = 0x80031F88; -disable_object_light = 0x80032210; -enable_object_light = 0x80032218; -toggle_object_light = 0x80032224; -func_80032248 = 0x80032248; -func_80032344 = 0x80032344; -lightUpdateLights = 0x80032398; -func_80032424 = 0x80032424; -func_80032BAC = 0x80032BAC; -get_light_count = 0x80032C6C; -func_80032C7C = 0x80032C7C; -func_800337E4 = 0x800337E4; +lights_free = 0x80031B60; +lights_init = 0x80031BB8; +light_add_from_level_object_entry = 0x80031CAC; +light_add_from_object_header = 0x80031F88; +light_disable = 0x80032210; +light_enable = 0x80032218; +light_toggle = 0x80032224; +light_setup_colour_change = 0x80032248; +light_setup_intensity_change = 0x80032344; +light_update_all = 0x80032398; +light_update = 0x80032424; +light_remove = 0x80032BAC; +light_count = 0x80032C6C; +light_update_shading = 0x80032C7C; +light_update_ambience = 0x800337E4; light_distance_calc = 0x80033A14; light_direction_calc = 0x80033C08; @@ -2248,10 +2248,10 @@ D_800DC92C = 0x800DC92C; // lights.c .data gActiveLights = 0x800DC950; -D_800DC954 = 0x800DC954; +gActiveLightAttrs = 0x800DC954; gMaxLights = 0x800DC958; gNumActiveLights = 0x800DC95C; -D_800DC960 = 0x800DC960; +gShadeBuffer = 0x800DC960; gLightDirs = 0x800DC964; D_800DC968 = 0x800DC968; diff --git a/ver/symbols/symbol_addrs.us.v80.txt b/ver/symbols/symbol_addrs.us.v80.txt index a91bdb68..fdca3ca4 100644 --- a/ver/symbols/symbol_addrs.us.v80.txt +++ b/ver/symbols/symbol_addrs.us.v80.txt @@ -471,21 +471,21 @@ compute_scene_camera_transform_matrix = 0x80031058; generate_collision_candidates = 0x80031170; compute_grid_overlap_mask = 0x8003151C; resolve_collisions = 0x80031640; -free_lights = 0x80031BA0; -setup_lights = 0x80031BF8; -func_80031CAC = 0x80031CEC; -add_object_light = 0x80031FC8; -disable_object_light = 0x80032250; -enable_object_light = 0x80032258; -toggle_object_light = 0x80032264; -func_80032248 = 0x80032288; -func_80032344 = 0x80032384; -lightUpdateLights = 0x800323D8; -func_80032424 = 0x80032464; -func_80032BAC = 0x80032BEC; -get_light_count = 0x80032CAC; -func_80032C7C = 0x80032CBC; -func_800337E4 = 0x80033824; +lights_free = 0x80031BA0; +lights_init = 0x80031BF8; +light_add_from_level_object_entry = 0x80031CEC; +light_add_from_object_header = 0x80031FC8; +light_disable = 0x80032250; +light_enable = 0x80032258; +light_toggle = 0x80032264; +light_setup_colour_change = 0x80032288; +light_setup_intensity_change = 0x80032384; +light_update_all = 0x800323D8; +light_update = 0x80032464; +light_remove = 0x80032BEC; +light_count = 0x80032CAC; +light_update_shading = 0x80032CBC; +light_update_ambience = 0x80033824; light_distance_calc = 0x80033A54; light_direction_calc = 0x80033C48; obj_init_scenery = 0x80033D00; @@ -2073,10 +2073,10 @@ gVoidData = 0x800DCE94; D_800DC928 = 0x800DCE98; D_800DC92C = 0x800DCE9C; gActiveLights = 0x800DCEC0; -D_800DC954 = 0x800DCEC4; +gActiveLightAttrs = 0x800DCEC4; gMaxLights = 0x800DCEC8; gNumActiveLights = 0x800DCECC; -D_800DC960 = 0x800DCED0; +gShadeBuffer = 0x800DCED0; gLightDirs = 0x800DCED4; D_800DC968 = 0x800DCED8; gTajTransformTransitionEnd = 0x800DCEE0;