Rename a heap of light and brightness symbols

This commit is contained in:
Ryan Dwyer committed 2023-04-13 20:13:13 +10:00
1 parent 2d0c0583de
commit 89152f7b40
36 files changed
+1093 -1003

No files matched your search

+6 -6
View File
@@ -182,7 +182,7 @@ void roomSetOnscreen(s32 roomnum, s32 draworder, struct screenbox *box)
g_Rooms[roomnum].flags |= ROOMFLAG_ONSCREEN;
#endif
if (g_Rooms[roomnum].flags & ROOMFLAG_0800) {
if (g_Rooms[roomnum].flags & ROOMFLAG_BBOXHACK) {
box->xmin = var800a4640.unk2d0.box.xmin;
box->ymin = var800a4640.unk2d0.box.ymin;
box->xmax = var800a4640.unk2d0.box.xmax;
@@ -249,10 +249,10 @@ void roomSetOnscreen(s32 roomnum, s32 draworder, struct screenbox *box)
}
}
void func0f158108(s32 roomnum, u8 *arg1, u8 *arg2)
void bgGetRoomBrightnessRange(s32 roomnum, u8 *min, u8 *max)
{
*arg1 = g_BgRooms[roomnum].unk10;
*arg2 = g_BgRooms[roomnum].unk11;
*min = g_BgRooms[roomnum].br_light_min;
*max = g_BgRooms[roomnum].br_light_max;
}
struct var800a4640_00 *func0f158140(s32 roomnum)
@@ -4513,8 +4513,8 @@ void bgLoadRoom(s32 roomnum)
// Create vertex batches - these are used for hit detection
bgFindRoomVtxBatches(roomnum);
g_Rooms[roomnum].flags |= ROOMFLAG_DIRTY;
g_Rooms[roomnum].flags |= ROOMFLAG_0200;
g_Rooms[roomnum].flags |= ROOMFLAG_LIGHTS_DIRTY;
g_Rooms[roomnum].flags |= ROOMFLAG_BRIGHTNESS_DIRTY_PERM;
g_Rooms[roomnum].colours = NULL;
+4 -4
View File
@@ -1945,7 +1945,7 @@ Gfx *bviewDrawNvLens(Gfx *gdl)
s32 viewtop = viGetViewTop();
s32 viewleft = viGetViewLeft();
s32 viewbottom = viewtop + viewheight;
s32 roomvalue;
s32 brightness;
s32 y;
var8007f840++;
@@ -1962,10 +1962,10 @@ Gfx *bviewDrawNvLens(Gfx *gdl)
var8009caed = 0x50;
var8009caee = 0xc0;
roomvalue = func0f0009c0(g_Vars.currentplayer->prop->rooms[0]);
brightness = roomGetFinalBrightness(g_Vars.currentplayer->prop->rooms[0]);
if (roomvalue > 128) {
sky0f127334(roomvalue, roomvalue, roomvalue);
if (brightness > 128) {
sky0f127334(brightness, brightness, brightness);
}
if (g_Menus[g_Vars.currentplayerstats->mpindex].curdialog == NULL) {
+1 -1
View File
@@ -13305,7 +13305,7 @@ void chraTick(struct chrdata *chr)
// Consider setting darkroomlist
if (chr->prop
&& chr->aidarkroomlist >= 0
&& roomGetBrightness(chr->prop->rooms[0]) < 25
&& roomGetSettledLocalBrightness(chr->prop->rooms[0]) < 25
&& ailistFindById(chr->aidarkroomlist) != chr->ailist) {
chr->darkroomthing = true;
}
+2 -1
View File
@@ -5832,7 +5832,8 @@ bool aiSetLights(void)
roomSetLightsOn(roomnum, true);
break;
default:
roomSetLighting(roomnum, cmd[4], cmd[5], cmd[6], TICKS(cmd[7]));
roomSetLightOp(roomnum, cmd[4], cmd[5], cmd[6], TICKS(cmd[7]));
break;
}
}
+266 -250
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -333,7 +333,7 @@ bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exproom
for (i = 0; exprooms[i] != -1 && i < 7; i++) {
expprop->rooms[i] = exprooms[i];
roomAdjustLighting(exprooms[i], g_ExplosionTypes[type].rangeh, 255);
roomFlashLighting(exprooms[i], g_ExplosionTypes[type].rangeh, 255);
}
expprop->rooms[i] = -1;
@@ -706,7 +706,7 @@ void explosionInflictDamage(struct prop *expprop)
// Flicker room lighting
for (i = 0; expprop->rooms[i] != -1; i++) {
if (random() % 2048 <= 240) {
roomAdjustLighting(expprop->rooms[i], type->rangeh, 255);
roomFlashLighting(expprop->rooms[i], type->rangeh, 255);
}
}
+10 -10
View File
@@ -172,11 +172,11 @@ void artifactsCalculateGlaresForRoom(s32 roomnum)
s1[i * 3 + 1] = 0;
s1[i * 3 + 2] = 0;
tmp = roomlights[i].unk07 * roomlights[i].unk07 + roomlights[i].unk08 * roomlights[i].unk08 + roomlights[i].unk09 * roomlights[i].unk09;
tmp = roomlights[i].dirx * roomlights[i].dirx + roomlights[i].diry * roomlights[i].diry + roomlights[i].dirz * roomlights[i].dirz;
f16 = spc4.f[0] * spc4.f[0] + spc4.f[1] * spc4.f[1] + spc4.f[2] * spc4.f[2];
if (tmp > 0.0001f && f16 > 0.0001f) {
sp190 = -((roomlights[i].unk07 * spc4.f[0] + roomlights[i].unk08 * spc4.f[1] + roomlights[i].unk09 * spc4.f[2]) / sqrtf(tmp * f16));
sp190 = -((roomlights[i].dirx * spc4.f[0] + roomlights[i].diry * spc4.f[1] + roomlights[i].dirz * spc4.f[2]) / sqrtf(tmp * f16));
if (sp190 > 0.4f) {
sp190 = 0.4f;
@@ -385,7 +385,7 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
struct artifact *artifacts;
u16 min;
u16 max;
f32 f30;
f32 lightop_cur_frac;
s32 t2;
struct light *light;
u8 *s3;
@@ -413,7 +413,7 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
f32 f26;
artifacts = schedGetFrontArtifacts();
f30 = roomGetUnk5c(roomnum);
lightop_cur_frac = roomGetLightOpCurFrac(roomnum);
if (g_Rooms[roomnum].gfxdata == NULL || g_Rooms[roomnum].loaded240 == 0) {
return gdl;
@@ -500,7 +500,7 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
}
if (USINGDEVICE(DEVICE_NIGHTVISION)) {
s3[2] *= (s32) (f30 * 7.0f);
s3[2] *= (s32) (lightop_cur_frac * 7.0f);
}
f0 = s3[2] * (1.0f / 255.0f);
@@ -519,18 +519,18 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
brightness *= 27500.0f / (-lightscreenpos.z < 1.0f ? 1.0f : -lightscreenpos.z);
if (light->unk06 != 0) {
brightness *= light->unk06 * (1.0f / 32.0f);
if (light->brightnessmult != 0) {
brightness *= light->brightnessmult * (1.0f / 32.0f);
}
brightness *= s3[1] * (1.0f / 255.0f);
if (USINGDEVICE(DEVICE_NIGHTVISION)) {
brightness *= 14.0f * f30;
brightness *= 14.0f * lightop_cur_frac;
}
brightness += add;
brightness *= 2.0f * func0f000dbc(roomnum);
brightness *= 2.0f * roomGetSettledLocalBrightnessFrac(roomnum);
if (brightness > 750.0f) {
brightness = 750.0f;
@@ -554,7 +554,7 @@ Gfx *artifactsRenderGlaresForRoom(Gfx *gdl, s32 roomnum)
alpha *= (s3[0] / 8.0f);
if (USINGDEVICE(DEVICE_NIGHTVISION)) {
alpha *= f30 * 7.0f;
alpha *= lightop_cur_frac * 7.0f;
}
if (alpha > 255.0f) {
@@ -338,7 +338,7 @@ void ctcInitProps(void)
for (i = 0; i < 4; i++) {
if (g_ScenarioData.ctc.playercountsperteam[i] && g_ScenarioData.ctc.baserooms[i] != -1) {
roomSetLighting(g_ScenarioData.ctc.baserooms[i], 5, 0, 0, 0);
roomSetLightOp(g_ScenarioData.ctc.baserooms[i], LIGHTOP_HIGHLIGHT, 0, 0, 0);
}
}
}
+5 -3
View File
@@ -196,6 +196,7 @@ void kohInitProps(void)
}
padUnpack(pad_id, PADFIELD_POS | PADFIELD_ROOM, &pad);
g_ScenarioData.koh.hillrooms[0] = pad.room;
g_ScenarioData.koh.hillrooms[1] = -1;
g_ScenarioData.koh.hillpos.x = pad.pos.x;
@@ -203,7 +204,8 @@ void kohInitProps(void)
g_ScenarioData.koh.hillpos.z = pad.pos.z;
g_ScenarioData.koh.hillpos.y = cdFindFloorYColourTypeAtPos(&g_ScenarioData.koh.hillpos, &g_ScenarioData.koh.hillrooms[0], 0, 0);
g_ScenarioData.koh.movehill = false;
roomSetLighting(g_ScenarioData.koh.hillrooms[0], LIGHTOP_5, 0, 0, 0);
roomSetLightOp(g_ScenarioData.koh.hillrooms[0], LIGHTOP_HIGHLIGHT, 0, 0, 0);
}
/**
@@ -265,7 +267,7 @@ void kohTick(void)
&& g_ScenarioData.koh.colourfracb >= .95f) {
// The old hill is now "natural enough" to set it back to full
// natural colour and actually choose a new hill.
roomSetLighting(g_ScenarioData.koh.hillrooms[0], 0, 0, 0, 0);
roomSetLightOp(g_ScenarioData.koh.hillrooms[0], LIGHTOP_NONE, 0, 0, 0);
// Choose the new hill. Note that hillcount refers to the number of
// hill options, which is always >= 2.
@@ -294,7 +296,7 @@ void kohTick(void)
g_ScenarioData.koh.hillpos.y = cdFindFloorYColourTypeAtPos(&g_ScenarioData.koh.hillpos, g_ScenarioData.koh.hillrooms, NULL, NULL);
roomSetLighting(g_ScenarioData.koh.hillrooms[0], 5, 0, 0, 0);
roomSetLightOp(g_ScenarioData.koh.hillrooms[0], LIGHTOP_HIGHLIGHT, 0, 0, 0);
g_ScenarioData.koh.occupiedteam = -1;
g_ScenarioData.koh.elapsed240 = 0;
+1 -1
View File
@@ -461,7 +461,7 @@ void nbombInflictDamage(struct nbomb *nbomb)
if (index < 52) {
roomnums[index] = i;
index++;
roomAdjustLighting(i, -38, -180);
roomFlashLighting(i, -38, -180);
}
}
}
+30 -30
View File
@@ -1353,21 +1353,21 @@ struct modelrodata_bbox *objFindBboxRodata(struct defaultobj *obj)
return modelFindBboxRodata(obj->model);
}
s32 func0f068b14(s16 *rooms, s32 arg1)
s32 objGetAverageBrightnessInRooms(s16 *rooms, s32 brightnesstype)
{
s32 total = 0;
s32 brightness = 0;
s32 i;
for (i = 0; rooms[i] != -1; i++) {
if (arg1 == 0) {
total += func0f000b24(rooms[i]);
} else if (arg1 == 1) {
total += func0f000c54(rooms[i]);
if (brightnesstype == 0) {
brightness += roomGetSettledRegionalBrightnessForPlayer(rooms[i]);
} else if (brightnesstype == 1) {
brightness += roomGetFlashBrightness(rooms[i]);
}
}
if (i) {
s32 average = total / i;
s32 average = brightness / i;
if (average > 255) {
average = 255;
@@ -1384,12 +1384,12 @@ s32 door0f068c04(struct prop *prop, s32 *arg1, s32 *arg2)
struct doorobj *door = prop->door;
struct doorobj *sibling;
s32 i;
s32 s1;
s32 s3 = 0;
s32 s4 = 0;
s32 br_settled_average;
s32 total_br_settled = 0;
s32 total_br_flash = 0;
s32 s2 = 0;
s32 s5 = 0;
s32 v1;
s32 br_flash_average;
s32 result;
struct prop *loopprop;
struct pad pad;
@@ -1411,11 +1411,11 @@ s32 door0f068c04(struct prop *prop, s32 *arg1, s32 *arg2)
padUnpack(sibling->base.pad, PADFIELD_POS | PADFIELD_LOOK | PADFIELD_UP | PADFIELD_NORMAL | PADFIELD_ROOM, &pad);
if (door->base.flags3 & OBJFLAG3_04000000) {
s3 += func0f000b24(pad.room);
s4 += func0f000c54(pad.room);
total_br_settled += roomGetSettledRegionalBrightnessForPlayer(pad.room);
total_br_flash += roomGetFlashBrightness(pad.room);
s5++;
s2 = s3 + s4;
s2 = total_br_settled + total_br_flash;
if (s2 > 255) {
s2 = 255;
@@ -1454,8 +1454,8 @@ s32 door0f068c04(struct prop *prop, s32 *arg1, s32 *arg2)
// @bug? Duplicate sum1 < 0.0f check in the first part.
// Perhaps one of them should be sum2 < 0.0f.
if ((sum1 < 0.0f && sum1 < 0.0f) || (sum1 > 0.0f && sum2 > 0.0f)) {
s32 value1 = func0f000c54(loopprop->rooms[i]);
s32 value2 = func0f000b24(loopprop->rooms[i]);
s32 value1 = roomGetFlashBrightness(loopprop->rooms[i]);
s32 value2 = roomGetSettledRegionalBrightnessForPlayer(loopprop->rooms[i]);
s32 sum = value2 + value1;
if (sum > 255) {
@@ -1463,8 +1463,8 @@ s32 door0f068c04(struct prop *prop, s32 *arg1, s32 *arg2)
}
s5++;
s3 += value2;
s4 += value1;
total_br_settled += value2;
total_br_flash += value1;
s2 += sum;
}
}
@@ -1480,23 +1480,23 @@ s32 door0f068c04(struct prop *prop, s32 *arg1, s32 *arg2)
}
if (s5 == 0) {
s1 = func0f068b14(prop->rooms, 0);
v1 = func0f068b14(prop->rooms, 1);
br_settled_average = objGetAverageBrightnessInRooms(prop->rooms, 0);
br_flash_average = objGetAverageBrightnessInRooms(prop->rooms, 1);
} else {
s1 = s3 / s5;
v1 = s4 / s5;
br_settled_average = total_br_settled / s5;
br_flash_average = total_br_flash / s5;
}
if (arg1 != NULL) {
*arg1 = s1;
*arg1 = br_settled_average;
}
if (arg2 != NULL) {
*arg2 = v1;
*arg2 = br_flash_average;
}
if (s1 + v1 < 255) {
result = s1 + v1;
if (br_settled_average + br_flash_average < 255) {
result = br_settled_average + br_flash_average;
} else {
result = 255;
}
@@ -1547,8 +1547,8 @@ s32 func0f068fc8(struct prop *prop, bool arg1)
}
}
} else {
actual = func0f068b14(prop->rooms, 0);
extra = func0f068b14(prop->rooms, 1);
actual = objGetAverageBrightnessInRooms(prop->rooms, 0);
extra = objGetAverageBrightnessInRooms(prop->rooms, 1);
}
if (arg1 == 0) {
@@ -18799,7 +18799,7 @@ void weaponSetGunfireVisible(struct prop *prop, bool visible, s16 room)
}
if (flash && room != -1) {
roomAdjustLighting(room, 48, 128);
roomFlashLighting(room, 48, 128);
}
}
@@ -19993,7 +19993,7 @@ void doorCreateSparks(struct doorobj *door)
-1, 0, 0, 0, &sp7c, -1, door->base.prop->rooms, -1, -1, -1, -1);
for (i = 0; door->base.prop->rooms[i] != -1; i++) {
roomAdjustLighting(door->base.prop->rooms[i], 128, 200);
roomFlashLighting(door->base.prop->rooms[i], 128, 200);
}
}
+1 -1
View File
@@ -207,7 +207,7 @@ Gfx *smokeRenderPart(struct smoke *smoke, struct smokepart *part, Gfx *gdl, stru
colours[0].a = alpha * alphamult;
} else {
if (smoke->type != SMOKETYPE_PINBALL) {
frac = func0f000a10(smoke->prop->rooms[0]) * (1.0f / 255.0f);
frac = roomGetFinalBrightnessForPlayer(smoke->prop->rooms[0]) * (1.0f / 255.0f);
if (frac > 1) {
frac = 1;
+4 -4
View File
@@ -277,21 +277,21 @@ void sparksCreate(s32 room, struct prop *prop, struct coord *pos, struct coord *
switch (typenum) {
case SPARKTYPE_DEFAULT:
roomAdjustLighting(group->room, 24, 32);
roomFlashLighting(group->room, 24, 32);
break;
case SPARKTYPE_ENVIRONMENTAL1:
if (g_Vars.stagenum != STAGE_CRASHSITE) {
roomAdjustLighting(group->room, 32, 128);
roomFlashLighting(group->room, 32, 128);
}
break;
case SPARKTYPE_ENVIRONMENTAL2:
if (g_Vars.stagenum != STAGE_CRASHSITE) {
roomAdjustLighting(group->room, 64, 128);
roomFlashLighting(group->room, 64, 128);
}
break;
case SPARKTYPE_ENVIRONMENTAL3:
if (g_Vars.stagenum != STAGE_CRASHSITE) {
roomAdjustLighting(group->room, 200, 255);
roomFlashLighting(group->room, 200, 255);
}
break;
}
+4 -4
View File
@@ -414,10 +414,10 @@ void frInitLighting(void)
s32 roomnum;
for (roomnum = 7; roomnum < 10; roomnum++) {
roomSetLighting(roomnum, LIGHTOP_3, 50, 100, TICKS(32));
roomSetLightOp(roomnum, LIGHTOP_TRANSITION, 50, 100, TICKS(32));
}
roomSetLighting(ROOM_DISH_FIRINGRANGE, LIGHTOP_3, 25, 100, TICKS(32));
roomSetLightOp(ROOM_DISH_FIRINGRANGE, LIGHTOP_TRANSITION, 25, 100, TICKS(32));
g_FrData.donelighting = true;
@@ -433,10 +433,10 @@ void frRestoreLighting(void)
s32 roomnum;
for (roomnum = 7; roomnum < 10; roomnum++) {
roomSetLighting(roomnum, LIGHTOP_3, 100, 50, TICKS(8));
roomSetLightOp(roomnum, LIGHTOP_TRANSITION, 100, 50, TICKS(8));
}
roomSetLighting(ROOM_DISH_FIRINGRANGE, LIGHTOP_3, 100, 25, TICKS(8));
roomSetLightOp(ROOM_DISH_FIRINGRANGE, LIGHTOP_TRANSITION, 100, 25, TICKS(8));
g_FrData.donelighting = false;
+15 -15
View File
@@ -1078,7 +1078,7 @@ void wallhitCreateWith20Args(struct coord *relpos, struct coord *arg1, struct co
u8 b;
u8 a;
brightnessfrac = func0f000a10(room2) * (1.0f / 255.0f);
brightnessfrac = roomGetFinalBrightnessForPlayer(room2) * (1.0f / 255.0f);
range = maxalpha - (u32)minalpha;
@@ -1427,9 +1427,9 @@ void wallhitsRecolour(void)
s32 j;
u32 stack;
struct wallhit *wallhit;
f32 sp0c;
f32 sp08;
f32 sp04;
f32 r;
f32 g;
f32 b;
for (i = 0, wallhit = g_Wallhits; i < g_WallhitsMax; i++) {
if (wallhit->roomnum > 0) {
@@ -1443,30 +1443,30 @@ void wallhitsRecolour(void)
}
for (j = 0; prop->rooms[j] != -1; j++) {
if (g_Rooms[prop->rooms[j]].flags & ROOMFLAG_1000) {
if (g_Rooms[prop->rooms[j]].flags & ROOMFLAG_NEEDRESHADE) {
room = prop->rooms[j];
sp0c = g_Rooms[room].unk74;
sp08 = g_Rooms[room].unk78;
sp04 = g_Rooms[room].unk7c;
r = g_Rooms[room].highlightfrac_r;
g = g_Rooms[room].highlightfrac_g;
b = g_Rooms[room].highlightfrac_b;
break;
}
}
} else {
if (g_Rooms[wallhit->roomnum].flags & ROOMFLAG_1000) {
if (g_Rooms[wallhit->roomnum].flags & ROOMFLAG_NEEDRESHADE) {
room = wallhit->roomnum;
sp0c = g_Rooms[room].unk74;
sp08 = g_Rooms[room].unk78;
sp04 = g_Rooms[room].unk7c;
r = g_Rooms[room].highlightfrac_r;
g = g_Rooms[room].highlightfrac_g;
b = g_Rooms[room].highlightfrac_b;
}
}
if (room > 0) {
for (j = 0; j < 4; j++) {
wallhit->finalcolours[j].r = wallhit->basecolours[j].r * sp0c;
wallhit->finalcolours[j].g = wallhit->basecolours[j].g * sp08;
wallhit->finalcolours[j].b = wallhit->basecolours[j].b * sp04;
wallhit->finalcolours[j].r = wallhit->basecolours[j].r * r;
wallhit->finalcolours[j].g = wallhit->basecolours[j].g * g;
wallhit->finalcolours[j].b = wallhit->basecolours[j].b * b;
}
}
}
+2 -2
View File
@@ -1291,7 +1291,7 @@ glabel var7f1b5780
/* f133540: 02002025 */ or $a0,$s0,$zero
/* f133544: 14400003 */ bnez $v0,.L0f133554
/* f133548: 02002025 */ or $a0,$s0,$zero
/* f13354c: 0fc00400 */ jal roomSetUnk52
/* f13354c: 0fc00400 */ jal roomSetFlashBrightness
/* f133550: 02202825 */ or $a1,$s1,$zero
.L0f133554:
/* f133554: 8e6d02bc */ lw $t5,0x2bc($s3)
@@ -2712,7 +2712,7 @@ Gfx *weatherRenderRain(Gfx *gdl, struct weatherdata *weather, s32 arg2)
// 3534
for (s0 = 1; s0 < g_Vars.roomcount; s0++) {
if (!weatherIsRoomWeatherProof(s0)) {
roomSetUnk52(s0, s1);
roomSetFlashBrightness(s0, s1);
}
}
}