Rename a heap of light and brightness symbols

This commit is contained in:
Ryan Dwyer
2023-04-13 20:13:13 +10:00
parent 2d0c0583de
commit 89152f7b40
36 changed files with 1093 additions and 1003 deletions
+49 -8
View File
@@ -2347,16 +2347,57 @@
mkshort(0x0101), \
u1,
#define set_lights_state(pad, operation, u1, u2, u3) \
/**
* Modifies the lighting of a room.
*
* The room is specified by the <roomorpad> argument. If less than 10000 then it
* is interpreted as a room number. If it is 10000 or more then 10000 is
* subtracted from it, it's interpreted as a pad number and the room that the
* pad can be found in is used.
*
* <operation> is a LIGHTOP constant.
* Unless noted otherwise, the <to> and <from> arguments are percentages of the
* usual brightness. Less than 100 is darker and more than 100 is brighter.
*
* LIGHTOP_NONE:
* Stops any of the below ongoing effects (setrandom, transition or sineloop).
*
* LIGHTOP_SET:
* Set the room's brightness to <to>, without any transition.
*
* LIGHTOP_SETRANDOM:
* Set the room's brightness randomly.
* <duration60> is the interval between rolls of the dice.
* <to> is the probability (range 0-100) of it using normal brightness on any
* given interval. Otherwise the <from> brightness is used.
* For example, with to=80, from=50 and duration60=120, then every 2 seconds
* there will be an 80% chance of changing to normal brightness and a 20% chance
* of changing to 50% brightness.
*
* LIGHTOP_TRANSITION:
* Transition from <from> to <to> over <duration60> ticks.
* Due to a bug, the timer starts at 75% completion.
*
* LIGHTOP_SINELOOP:
* Repeatedly adjust lighting between <from> and <to> in a sine pattern,
* taking <duration60> ticks to complete a loop cycle.
*
* LIGHTOP_TURNON:
* Turn the room's lights on (eg. using a light switch).
*
* LIGHTOP_TURNOFF:
* Turn the room's lights off (eg. using a light switch).
*/
#define set_lights_state(roomorpad, operation, to, from, duration60) \
mkshort(0x0102), \
mkshort(pad), \
mkshort(roomorpad), \
operation, \
u1, \
u2, \
u3, \
0x00, \
0x00, \
0x00,
to, \
from, \
duration60, \
0, \
0, \
0,
/**
* Checks if the current chr's proppreset is blocking line of sight from the chr
+24 -23
View File
@@ -1439,13 +1439,14 @@
#define LANGUAGE_PAL_IT 3
#define LANGUAGE_PAL_ES 4
#define LIGHTOP_1 1
#define LIGHTOP_2 2
#define LIGHTOP_3 3
#define LIGHTOP_4 4
#define LIGHTOP_5 5
#define LIGHTOP_TURNON 6
#define LIGHTOP_TURNOFF 7
#define LIGHTOP_NONE 0
#define LIGHTOP_SET 1
#define LIGHTOP_SETRANDOM 2
#define LIGHTOP_TRANSITION 3
#define LIGHTOP_SINELOOP 4
#define LIGHTOP_HIGHLIGHT 5
#define LIGHTOP_TURNON 6
#define LIGHTOP_TURNOFF 7
#define LOADTYPE_NONE 0
#define LOADTYPE_BG 1
@@ -3475,22 +3476,22 @@
#define ROOMBLOCKTYPE_LEAF 0
#define ROOMBLOCKTYPE_PARENT 1
#define ROOMFLAG_DISABLEDBYSCRIPT 0x0001
#define ROOMFLAG_HASDYNTEX 0x0002 // Has dynamic textures such as water
#define ROOMFLAG_ONSCREEN 0x0004
#define ROOMFLAG_STANDBY 0x0008 // Neighbour of an onscreen room - usually loaded as well
#define ROOMFLAG_0010 0x0010
#define ROOMFLAG_LOADCANDIDATE 0x0020 // Room is a good candidate for loading on this tick
#define ROOMFLAG_0040 0x0040
#define ROOMFLAG_RENDERALWAYS 0x0080
#define ROOMFLAG_DIRTY 0x0100
#define ROOMFLAG_0200 0x0200
#define ROOMFLAG_0400 0x0400
#define ROOMFLAG_0800 0x0800
#define ROOMFLAG_1000 0x1000
#define ROOMFLAG_LIGHTSOFF 0x2000
#define ROOMFLAG_PLAYAMBIENTTRACK 0x4000
#define ROOMFLAG_OUTDOORS 0x8000
#define ROOMFLAG_DISABLEDBYSCRIPT 0x0001
#define ROOMFLAG_HASDYNTEX 0x0002 // Has dynamic textures such as water
#define ROOMFLAG_ONSCREEN 0x0004
#define ROOMFLAG_STANDBY 0x0008 // Neighbour of an onscreen room - usually loaded as well
#define ROOMFLAG_0010 0x0010
#define ROOMFLAG_LOADCANDIDATE 0x0020 // Room is a good candidate for loading on this tick
#define ROOMFLAG_BRIGHTNESS_CALCED 0x0040
#define ROOMFLAG_RENDERALWAYS 0x0080
#define ROOMFLAG_LIGHTS_DIRTY 0x0100
#define ROOMFLAG_BRIGHTNESS_DIRTY_PERM 0x0200
#define ROOMFLAG_BRIGHTNESS_DIRTY_TEMP 0x0400
#define ROOMFLAG_BBOXHACK 0x0800
#define ROOMFLAG_NEEDRESHADE 0x1000
#define ROOMFLAG_LIGHTSOFF 0x2000
#define ROOMFLAG_PLAYAMBIENTTRACK 0x4000
#define ROOMFLAG_OUTDOORS 0x8000
#define RUMBLESTATE_1 1
#define RUMBLESTATE_ENABLED_STOPPED 2
+1 -1
View File
@@ -6,7 +6,7 @@
void roomUnpauseProps(u32 roomnum, bool tintedglassonly);
void roomSetOnscreen(s32 room, s32 draworder, struct screenbox *arg2);
void func0f158108(s32 roomnum, u8 *arg1, u8 *arg2);
void bgGetRoomBrightnessRange(s32 roomnum, u8 *min, u8 *max);
struct var800a4640_00 *func0f158140(s32 roomnum);
Gfx *bg0f158184(Gfx *gdl, struct xraydata *xraydata);
Gfx *func0f158400(Gfx *gdl, struct xraydata *xraydata, s16 vertices1[3], s16 vertices2[3], s16 vertices3[3], u32 colour1, u32 colour2, u32 colour3);
+15 -15
View File
@@ -6,18 +6,18 @@
u32 func0f000920(s32 portalnum1, s32 portalnum2);
struct light *roomGetLight(s32 roomnum, s32 lightnum);
u8 func0f0009c0(s32 roomnum);
u8 func0f000a10(s32 roomnum);
u8 func0f000b24(s32 roomnum);
u8 roomGetBrightness(s32 room);
s32 func0f000c54(s32 roomnum);
f32 roomGetUnk5c(s32 roomnum);
f32 func0f000dbc(s32 roomnum);
u8 roomGetFinalBrightness(s32 roomnum);
u8 roomGetFinalBrightnessForPlayer(s32 roomnum);
u8 roomGetSettledRegionalBrightnessForPlayer(s32 roomnum);
u8 roomGetSettledLocalBrightness(s32 room);
s32 roomGetFlashBrightness(s32 roomnum);
f32 roomGetLightOpCurFrac(s32 roomnum);
f32 roomGetSettledLocalBrightnessFrac(s32 roomnum);
bool lightGetBboxCentre(s32 roomnum, u32 lightnum, struct coord *pos);
bool lightIsHealthy(s32 roomnum, s32 lightnum);
bool lightIsVulnerable(s32 roomnum, s32 lightnum);
bool lightIsOn(s32 roomnum, s32 lightnum);
void roomSetUnk52(s32 roomnum, s32 value);
void roomSetFlashBrightness(s32 roomnum, s32 value);
void roomSetDefaults(struct room *room);
Gfx *lightsSetForRoom(Gfx *gdl, s16 roomnum);
Gfx *lightsSetDefault(Gfx *gdl);
@@ -33,16 +33,16 @@ void func0f00259c(s32 roomnum);
void func0f002844(s32 roomnum, f32 arg1, s32 arg2, s32 portalnum);
void func0f002a98(void);
void roomSetLightsOn(s32 roomnum, s32 enable);
void roomSetLighting(s32 roomnum, s32 operation, u8 arg2, u8 arg3, u8 arg4);
void roomSetLightOp(s32 roomnum, s32 operation, u8 br_to, u8 br_from, u8 duration60);
bool lightTickBroken(s32 roomnum, s32 lightnum);
void lightingTick(void);
void func0f003444(void);
void func0f0035c0(void);
void func0f00372c(void);
void func0f0037ac(void);
void lightsConfigureForPerfectDarknessCutscene(void);
void lightsConfigureForPerfectDarknessGameplay(void);
void lightsTickPerfectDarkness(void);
void roomsTickLighting(void);
void lightsTick(void);
void roomAdjustLighting(s32 roomnum, s32 start, s32 limit);
void func0f004558(s32 roomnum, s32 increment, s32 limit);
void roomFlashLighting(s32 roomnum, s32 start, s32 limit);
void roomFlashLocalLighting(s32 roomnum, s32 increment, s32 limit);
void roomHighlight(s32 roomnum);
void func0f004c6c(void);
void func0f00505c(void);
+1 -1
View File
@@ -82,7 +82,7 @@ struct modelnode *modelFindBboxNode(struct model *model);
struct modelrodata_bbox *modelFindBboxRodata(struct model *model);
struct modelnode *objFindBboxNode(struct defaultobj *obj);
struct modelrodata_bbox *objFindBboxRodata(struct defaultobj *obj);
s32 func0f068b14(s16 *rooms, s32 arg1);
s32 objGetAverageBrightnessInRooms(s16 *rooms, s32 arg1);
s32 door0f068c04(struct prop *prop, s32 *arg1, s32 *arg2);
s32 func0f068fc8(struct prop *prop, bool arg1);
void propCalculateShadeColour(struct prop *prop, u8 *nextcol, u16 floorcol);
+52 -23
View File
@@ -3610,28 +3610,57 @@ struct room {
/*0x3c*/ f32 radius; // from volume centre to the corner in 3D
/*0x40*/ s32 numvtxbatches;
/*0x44*/ struct vtxbatch *vtxbatches;
/*0x48*/ u8 unk48;
/*0x49*/ u8 unk49;
/*0x4a*/ u8 unk4a;
/*0x4b*/ u8 unk4b;
/*0x4c*/ u8 unk4c;
/**
* br values are a brightness value (0-255).
*/
// The min and max values are the brightness levels when the room has all
// its lights shot out, or all lights healthy. They come from the BG file.
// The br_light_each value is calculated from these based on the number of
// lights in the room.
/*0x48*/ u8 br_light_min;
/*0x49*/ u8 br_light_max;
/*0x4a*/ u8 br_light_each;
// The brightness level of the room, assuming no flashes are taking place,
// and factoring in settled brightness from neighbouring rooms.
/*0x4b*/ u8 br_settled_regional;
// Generally the same as br_light_min, but is sometimes fudged a bit.
/*0x4c*/ u8 br_base;
// Unused
/*0x4d*/ u8 unk4d;
// Lightops control what a room is doing with its lighting. They can be used
// to simply set a brightness multiplier, or transition to another
// brightness level over several frames, or repeat a brightness sine pattern.
// The lightop calculates lightop_cur_frac, which is a multiplier.
/*0x4e*/ u8 lightop : 4;
// Unused
/*0x4e*/ u8 unk4e_04 : 4;
/*0x50*/ s16 brightness;
/*0x52*/ s16 unk52;
/*0x54*/ s16 unk54;
// The brightness level of the room, assuming no flashes are taking place,
// and ignoring the brightness of neighbouring rooms.
/*0x50*/ s16 br_settled_local;
// The current brightness of any temporary flash of light,
// such as gunfire or lightning.
/*0x52*/ s16 br_flash;
/*0x54*/ s16 lightop_timer240;
/*0x56*/ u16 unk56;
/*0x58*/ struct colour *colours;
/*0x5c*/ f32 unk5c;
/*0x60*/ f32 unk60;
/*0x64*/ f32 unk64;
/*0x68*/ f32 unk68;
/*0x5c*/ f32 lightop_cur_frac;
/*0x60*/ f32 lightop_to_frac;
/*0x64*/ f32 lightop_from_frac;
/*0x68*/ f32 lightop_duration240;
/*0x6c*/ f32 unk6c;
/*0x70*/ f32 unk70;
/*0x74*/ f32 unk74;
/*0x78*/ f32 unk78;
/*0x7c*/ f32 unk7c;
/*0x74*/ f32 highlightfrac_r;
/*0x78*/ f32 highlightfrac_g;
/*0x7c*/ f32 highlightfrac_b;
/*0x80*/ s32 gfxdatalen; // when inflated
/*0x84*/ struct wallhit *opawallhits; // opaque
/*0x88*/ struct wallhit *xluwallhits; // translucent
@@ -5358,8 +5387,8 @@ struct shieldhit {
struct bgroom {
u32 unk00;
struct coord pos;
u8 unk10;
u8 unk11;
u8 br_light_min;
u8 br_light_max;
};
struct damagetype {
@@ -5478,16 +5507,16 @@ struct vec3s16 {
struct light {
/*0x00*/ u16 roomnum;
/*0x02*/ u16 colour; // 4/4/4/4
/*0x04*/ u8 unk04;
/*0x05*/ u8 unk05_00 : 1;
/*0x04*/ u8 brightness;
/*0x05*/ u8 sparkable : 1;
/*0x05*/ u8 healthy : 1;
/*0x05*/ u8 on : 1;
/*0x05*/ u8 sparking : 1;
/*0x05*/ u8 vulnerable : 1;
/*0x06*/ u8 unk06;
/*0x07*/ s8 unk07;
/*0x08*/ s8 unk08;
/*0x09*/ s8 unk09;
/*0x06*/ u8 brightnessmult;
/*0x07*/ s8 dirx;
/*0x08*/ s8 diry;
/*0x09*/ s8 dirz;
/*0x0a*/ struct vec3s16 bbox[4];
};