Merge branch 'encore-directional-lighting' into 'master'
Add encore variants of LightContrast, LightAngle and SpriteBacklight to level header Closes #593 See merge request KartKrew/Kart!1388
This commit is contained in:
parent
b9c3a7e852
commit
089fd65f37
4 changed files with 57 additions and 20 deletions
|
|
@ -1036,6 +1036,20 @@ void readgametype(MYFILE *f, char *gtname)
|
|||
CONS_Printf("Added gametype %s\n", Gametype_Names[newgtidx]);
|
||||
}
|
||||
|
||||
static mapheader_lighting_t *usemaplighting(INT32 mapnum, const char *word)
|
||||
{
|
||||
if (fastncmp(word, "ENCORE", 6))
|
||||
{
|
||||
mapheaderinfo[mapnum]->use_encore_lighting = true;
|
||||
|
||||
return &mapheaderinfo[mapnum]->lighting_encore;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &mapheaderinfo[mapnum]->lighting;
|
||||
}
|
||||
}
|
||||
|
||||
void readlevelheader(MYFILE *f, INT32 num)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
|
|
@ -1361,23 +1375,25 @@ void readlevelheader(MYFILE *f, INT32 num)
|
|||
mapheaderinfo[num-1]->default_waypoint_radius = get_number(word2);
|
||||
else if (fastcmp(word, "LIGHTCONTRAST"))
|
||||
{
|
||||
mapheaderinfo[num-1]->light_contrast = (UINT8)i;
|
||||
usemaplighting(num, word)->light_contrast = (UINT8)i;
|
||||
}
|
||||
else if (fastcmp(word, "SPRITEBACKLIGHT"))
|
||||
else if (fastcmp(word, "SPRITEBACKLIGHT") || fastcmp(word, "ENCORESPRITEBACKLIGHT"))
|
||||
{
|
||||
mapheaderinfo[num]->sprite_backlight = (SINT8)i;
|
||||
usemaplighting(num, word)->sprite_backlight = (SINT8)i;
|
||||
}
|
||||
else if (fastcmp(word, "LIGHTANGLE"))
|
||||
else if (fastcmp(word, "LIGHTANGLE") || fastcmp(word, "ENCORELIGHTANGLE"))
|
||||
{
|
||||
mapheader_lighting_t *lighting = usemaplighting(num, word);
|
||||
|
||||
if (fastcmp(word2, "EVEN"))
|
||||
{
|
||||
mapheaderinfo[num-1]->use_light_angle = false;
|
||||
mapheaderinfo[num-1]->light_angle = 0;
|
||||
lighting->use_light_angle = false;
|
||||
lighting->light_angle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mapheaderinfo[num-1]->use_light_angle = true;
|
||||
mapheaderinfo[num-1]->light_angle = FixedAngle(FloatToFixed(atof(word2)));
|
||||
lighting->use_light_angle = true;
|
||||
lighting->light_angle = FixedAngle(FloatToFixed(atof(word2)));
|
||||
}
|
||||
}
|
||||
// Individual triggers for level flags, for ease of use (and 2.0 compatibility)
|
||||
|
|
|
|||
|
|
@ -334,6 +334,14 @@ typedef struct
|
|||
char value[256]; // 255 usable characters. If this seriously isn't enough then wtf.
|
||||
} customoption_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 light_contrast; ///< Range of wall lighting. 0 is no lighting.
|
||||
SINT8 sprite_backlight; ///< Subtract from wall lighting for sprites only.
|
||||
boolean use_light_angle; ///< When false, wall lighting is evenly distributed. When true, wall lighting is directional.
|
||||
angle_t light_angle; ///< Angle of directional wall lighting.
|
||||
} mapheader_lighting_t;
|
||||
|
||||
/** Map header information.
|
||||
*/
|
||||
typedef struct
|
||||
|
|
@ -398,10 +406,9 @@ typedef struct
|
|||
fixed_t mobj_scale; ///< Replacement for TOL_ERZ3
|
||||
fixed_t default_waypoint_radius; ///< 0 is a special value for DEFAULT_WAYPOINT_RADIUS, but scaled with mobjscale
|
||||
|
||||
UINT8 light_contrast; ///< Range of wall lighting. 0 is no lighting.
|
||||
boolean use_light_angle; ///< When false, wall lighting is evenly distributed. When true, wall lighting is directional.
|
||||
angle_t light_angle; ///< Angle of directional wall lighting.
|
||||
SINT8 sprite_backlight; ///< Subtract from wall lighting for sprites only.
|
||||
mapheader_lighting_t lighting; ///< Wall and sprite lighting
|
||||
mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode
|
||||
boolean use_encore_lighting; ///< Whether to use separate Encore lighting
|
||||
|
||||
// Music stuff.
|
||||
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
|
||||
|
|
|
|||
|
|
@ -361,6 +361,14 @@ void P_DeleteFlickies(INT16 i)
|
|||
|
||||
#define NUMLAPS_DEFAULT 3
|
||||
|
||||
static void P_ClearMapHeaderLighting(mapheader_lighting_t *lighting)
|
||||
{
|
||||
lighting->light_contrast = 16;
|
||||
lighting->sprite_backlight = 0;
|
||||
lighting->use_light_angle = false;
|
||||
lighting->light_angle = 0;
|
||||
}
|
||||
|
||||
/** Clears the data from a single map header.
|
||||
*
|
||||
* \param i Map number to clear header for.
|
||||
|
|
@ -423,10 +431,9 @@ static void P_ClearSingleMapHeaderInfo(INT16 i)
|
|||
mapheaderinfo[num]->menuflags = 0;
|
||||
mapheaderinfo[num]->mobj_scale = FRACUNIT;
|
||||
mapheaderinfo[num]->default_waypoint_radius = 0;
|
||||
mapheaderinfo[num]->light_contrast = 16;
|
||||
mapheaderinfo[num]->sprite_backlight = 0;
|
||||
mapheaderinfo[num]->use_light_angle = false;
|
||||
mapheaderinfo[num]->light_angle = 0;
|
||||
P_ClearMapHeaderLighting(&mapheaderinfo[num]->lighting);
|
||||
P_ClearMapHeaderLighting(&mapheaderinfo[num]->lighting_encore);
|
||||
mapheaderinfo[num]->use_encore_lighting = false;
|
||||
#if 1 // equivalent to "FlickyList = DEMO"
|
||||
P_SetDemoFlickies(num);
|
||||
#else // equivalent to "FlickyList = NONE"
|
||||
|
|
|
|||
15
src/p_spec.c
15
src/p_spec.c
|
|
@ -6429,6 +6429,13 @@ static void P_RunLevelLoadExecutors(void)
|
|||
*/
|
||||
void P_InitSpecials(void)
|
||||
{
|
||||
mapheader_lighting_t *lighting = &mapheaderinfo[gamemap-1]->lighting;
|
||||
|
||||
if (encoremode && mapheaderinfo[gamemap-1]->use_encore_lighting)
|
||||
{
|
||||
lighting = &mapheaderinfo[gamemap-1]->lighting_encore;
|
||||
}
|
||||
|
||||
// Set the map object scale
|
||||
mapobjectscale = mapheaderinfo[gamemap-1]->mobj_scale;
|
||||
|
||||
|
|
@ -6436,10 +6443,10 @@ void P_InitSpecials(void)
|
|||
gravity = mapheaderinfo[gamemap-1]->gravity;
|
||||
|
||||
// Set map lighting settings.
|
||||
maplighting.contrast = mapheaderinfo[gamemap-1]->light_contrast;
|
||||
maplighting.backlight = mapheaderinfo[gamemap-1]->sprite_backlight;
|
||||
maplighting.directional = mapheaderinfo[gamemap-1]->use_light_angle;
|
||||
maplighting.angle = mapheaderinfo[gamemap-1]->light_angle;
|
||||
maplighting.contrast = lighting->light_contrast;
|
||||
maplighting.backlight = lighting->sprite_backlight;
|
||||
maplighting.directional = lighting->use_light_angle;
|
||||
maplighting.angle = lighting->light_angle;
|
||||
|
||||
// Defaults in case levels don't have them set.
|
||||
sstimer = mapheaderinfo[gamemap-1]->sstimer*TICRATE + 6;
|
||||
|
|
|
|||
Loading…
Reference in a new issue