mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-02 06:23:03 +00:00
No more unnecessary light level twiddling
This commit is contained in:
parent
18c2cfcace
commit
9180b86e9e
2 changed files with 13 additions and 64 deletions
|
@ -96,6 +96,9 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *sector, INT16 lighta, INT1
|
||||||
flick->maxlight++;
|
flick->maxlight++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the starting light level is in range.
|
||||||
|
sector->lightlevel = max((INT16)flick->minlight, min((INT16)flick->maxlight, sector->lightlevel));
|
||||||
|
|
||||||
return flick;
|
return flick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +227,9 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *sector, INT16 lighta, INT16 lig
|
||||||
else
|
else
|
||||||
flash->count = 1;
|
flash->count = 1;
|
||||||
|
|
||||||
|
// Make sure the starting light level is in range.
|
||||||
|
sector->lightlevel = max((INT16)flash->minlight, min((INT16)flash->maxlight, sector->lightlevel));
|
||||||
|
|
||||||
sector->lightingdata = flash;
|
sector->lightingdata = flash;
|
||||||
return flash;
|
return flash;
|
||||||
}
|
}
|
||||||
|
@ -295,6 +301,9 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 ligh
|
||||||
g->speed = (g->maxlight - g->minlight)/2;
|
g->speed = (g->maxlight - g->minlight)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the starting light level is in range.
|
||||||
|
sector->lightlevel = max((INT16)g->minlight, min((INT16)g->maxlight, sector->lightlevel));
|
||||||
|
|
||||||
sector->lightingdata = g;
|
sector->lightingdata = g;
|
||||||
|
|
||||||
return g;
|
return g;
|
||||||
|
|
68
src/p_spec.c
68
src/p_spec.c
|
@ -2513,23 +2513,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||||
{
|
{
|
||||||
// Use front sector for min light level, back sector for max.
|
// Use front sector for min light level, back sector for max.
|
||||||
// This is tricky because P_SpawnAdjustableFireFlicker expects
|
P_SpawnAdjustableFireFlicker(§ors[secnum], line->frontsector->lightlevel, line->backsector->lightlevel,
|
||||||
// the maxsector (second argument) to also be the target
|
|
||||||
// sector, so we have to do some light level twiddling.
|
|
||||||
fireflicker_t *flick;
|
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
|
||||||
|
|
||||||
flick = P_SpawnAdjustableFireFlicker(§ors[secnum], line->frontsector->lightlevel, sectors[secnum].lightlevel,
|
|
||||||
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
||||||
|
|
||||||
// Make sure the starting light level is in range.
|
|
||||||
if (reallightlevel < flick->minlight)
|
|
||||||
reallightlevel = (INT16)flick->minlight;
|
|
||||||
else if (reallightlevel > flick->maxlight)
|
|
||||||
reallightlevel = (INT16)flick->maxlight;
|
|
||||||
|
|
||||||
sectors[secnum].lightlevel = reallightlevel;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2547,23 +2532,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||||
{
|
{
|
||||||
// Use front sector for min light level, back sector for max.
|
// Use front sector for min light level, back sector for max.
|
||||||
// This is tricky because P_SpawnAdjustableGlowingLight expects
|
P_SpawnAdjustableGlowingLight(§ors[secnum], line->frontsector->lightlevel, line->backsector->lightlevel,
|
||||||
// the maxsector (second argument) to also be the target
|
|
||||||
// sector, so we have to do some light level twiddling.
|
|
||||||
glow_t *glow;
|
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
|
||||||
|
|
||||||
glow = P_SpawnAdjustableGlowingLight(§ors[secnum], line->frontsector->lightlevel, sectors[secnum].lightlevel,
|
|
||||||
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
||||||
|
|
||||||
// Make sure the starting light level is in range.
|
|
||||||
if (reallightlevel < glow->minlight)
|
|
||||||
reallightlevel = (INT16)glow->minlight;
|
|
||||||
else if (reallightlevel > glow->maxlight)
|
|
||||||
reallightlevel = (INT16)glow->maxlight;
|
|
||||||
|
|
||||||
sectors[secnum].lightlevel = reallightlevel;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2581,23 +2551,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||||
{
|
{
|
||||||
// Use front sector for min light level, back sector for max.
|
// Use front sector for min light level, back sector for max.
|
||||||
// This is tricky because P_SpawnAdjustableGlowingLight expects
|
P_SpawnAdjustableStrobeFlash(§ors[secnum], line->frontsector->lightlevel, line->backsector->lightlevel,
|
||||||
// the maxsector (second argument) to also be the target
|
|
||||||
// sector, so we have to do some light level twiddling.
|
|
||||||
strobe_t *flash;
|
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
|
||||||
|
|
||||||
flash = P_SpawnAdjustableStrobeFlash(§ors[secnum], line->frontsector->lightlevel, sectors[secnum].lightlevel,
|
|
||||||
abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, false);
|
abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, false);
|
||||||
|
|
||||||
// Make sure the starting light level is in range.
|
|
||||||
if (reallightlevel < flash->minlight)
|
|
||||||
reallightlevel = (INT16)flash->minlight;
|
|
||||||
else if (reallightlevel > flash->maxlight)
|
|
||||||
reallightlevel = (INT16)flash->maxlight;
|
|
||||||
|
|
||||||
sectors[secnum].lightlevel = reallightlevel;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2615,23 +2570,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||||
{
|
{
|
||||||
// Use front sector for min light level, back sector for max.
|
// Use front sector for min light level, back sector for max.
|
||||||
// This is tricky because P_SpawnAdjustableGlowingLight expects
|
P_SpawnAdjustableStrobeFlash(§ors[secnum], line->frontsector->lightlevel, line->backsector->lightlevel,
|
||||||
// the maxsector (second argument) to also be the target
|
|
||||||
// sector, so we have to do some light level twiddling.
|
|
||||||
strobe_t *flash;
|
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
|
||||||
|
|
||||||
flash = P_SpawnAdjustableStrobeFlash(§ors[secnum], line->frontsector->lightlevel, sectors[secnum].lightlevel,
|
|
||||||
abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, true);
|
abs(line->dx)>>FRACBITS, abs(line->dy)>>FRACBITS, true);
|
||||||
|
|
||||||
// Make sure the starting light level is in range.
|
|
||||||
if (reallightlevel < flash->minlight)
|
|
||||||
reallightlevel = (INT16)flash->minlight;
|
|
||||||
else if (reallightlevel > flash->maxlight)
|
|
||||||
reallightlevel = (INT16)flash->maxlight;
|
|
||||||
|
|
||||||
sectors[secnum].lightlevel = reallightlevel;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue