mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-13 06:13:18 +00:00
Clean up arguments for the lighting effect functions
This commit is contained in:
parent
fe708db398
commit
18c2cfcace
3 changed files with 42 additions and 64 deletions
|
@ -63,34 +63,27 @@ void T_FireFlicker(fireflicker_t *flick)
|
||||||
|
|
||||||
/** Spawns an adjustable fire flicker effect in a sector.
|
/** Spawns an adjustable fire flicker effect in a sector.
|
||||||
*
|
*
|
||||||
* \param minsector Sector whose light level is used as the darkest.
|
* \param sector Target sector for the effect.
|
||||||
* \param maxsector Sector whose light level is used as the brightest,
|
* \param lighta One of the two light levels to move between.
|
||||||
* and also the target sector for the effect.
|
* \param lightb The other light level.
|
||||||
* \param length Four times the number of tics between flickers.
|
* \param length Four times the number of tics between flickers.
|
||||||
* \sa T_FireFlicker
|
* \sa T_FireFlicker
|
||||||
*/
|
*/
|
||||||
fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxsector, INT32 length)
|
fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length)
|
||||||
{
|
{
|
||||||
fireflicker_t *flick;
|
fireflicker_t *flick;
|
||||||
|
|
||||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
P_RemoveLighting(sector); // out with the old, in with the new
|
||||||
flick = Z_Calloc(sizeof (*flick), PU_LEVSPEC, NULL);
|
flick = Z_Calloc(sizeof (*flick), PU_LEVSPEC, NULL);
|
||||||
|
|
||||||
P_AddThinker(THINK_MAIN, &flick->thinker);
|
P_AddThinker(THINK_MAIN, &flick->thinker);
|
||||||
|
|
||||||
flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
||||||
flick->sector = maxsector;
|
flick->sector = sector;
|
||||||
flick->maxlight = maxsector->lightlevel;
|
flick->maxlight = max(lighta, lightb);
|
||||||
flick->minlight = minsector->lightlevel;
|
flick->minlight = min(lighta, lightb);
|
||||||
if (flick->minlight > flick->maxlight)
|
|
||||||
{
|
|
||||||
// You mixed them up, you dummy.
|
|
||||||
INT32 oops = flick->minlight;
|
|
||||||
flick->minlight = flick->maxlight;
|
|
||||||
flick->maxlight = oops;
|
|
||||||
}
|
|
||||||
flick->count = flick->resetcount = length/4;
|
flick->count = flick->resetcount = length/4;
|
||||||
maxsector->lightingdata = flick;
|
sector->lightingdata = flick;
|
||||||
|
|
||||||
// input bounds checking and stuff
|
// input bounds checking and stuff
|
||||||
if (!flick->resetcount)
|
if (!flick->resetcount)
|
||||||
|
@ -194,9 +187,9 @@ void T_StrobeFlash(strobe_t *flash)
|
||||||
|
|
||||||
/** Spawns an adjustable strobe light effect in a sector.
|
/** Spawns an adjustable strobe light effect in a sector.
|
||||||
*
|
*
|
||||||
* \param minsector Sector whose light level is used as the darkest.
|
* \param sector Target sector for the effect.
|
||||||
* \param maxsector Sector whose light level is used as the brightest,
|
* \param lighta One of the two light levels to move between.
|
||||||
* and also the target sector for the effect.
|
* \param lightb The other light level.
|
||||||
* \param darktime Time in tics for the light to be dark.
|
* \param darktime Time in tics for the light to be dark.
|
||||||
* \param brighttime Time in tics for the light to be bright.
|
* \param brighttime Time in tics for the light to be bright.
|
||||||
* \param inSync If true, the effect will be kept in sync
|
* \param inSync If true, the effect will be kept in sync
|
||||||
|
@ -207,29 +200,21 @@ void T_StrobeFlash(strobe_t *flash)
|
||||||
* the strobe flash is random.
|
* the strobe flash is random.
|
||||||
* \sa T_StrobeFlash
|
* \sa T_StrobeFlash
|
||||||
*/
|
*/
|
||||||
strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector, INT32 darktime, INT32 brighttime, boolean inSync)
|
strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *sector, INT16 lighta, INT16 lightb, INT32 darktime, INT32 brighttime, boolean inSync)
|
||||||
{
|
{
|
||||||
strobe_t *flash;
|
strobe_t *flash;
|
||||||
|
|
||||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
P_RemoveLighting(sector); // out with the old, in with the new
|
||||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||||
|
|
||||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||||
|
|
||||||
flash->sector = maxsector;
|
flash->sector = sector;
|
||||||
flash->darktime = darktime;
|
flash->darktime = darktime;
|
||||||
flash->brighttime = brighttime;
|
flash->brighttime = brighttime;
|
||||||
flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
|
flash->thinker.function.acp1 = (actionf_p1)T_StrobeFlash;
|
||||||
flash->maxlight = maxsector->lightlevel;
|
flash->maxlight = max(lighta, lightb);
|
||||||
flash->minlight = minsector->lightlevel;
|
flash->minlight = min(lighta, lightb);
|
||||||
|
|
||||||
if (flash->minlight > flash->maxlight)
|
|
||||||
{
|
|
||||||
// You mixed them up, you dummy.
|
|
||||||
INT32 oops = flash->minlight;
|
|
||||||
flash->minlight = flash->maxlight;
|
|
||||||
flash->maxlight = oops;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flash->minlight == flash->maxlight)
|
if (flash->minlight == flash->maxlight)
|
||||||
flash->minlight = 0;
|
flash->minlight = 0;
|
||||||
|
@ -239,7 +224,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector,
|
||||||
else
|
else
|
||||||
flash->count = 1;
|
flash->count = 1;
|
||||||
|
|
||||||
maxsector->lightingdata = flash;
|
sector->lightingdata = flash;
|
||||||
return flash;
|
return flash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,31 +261,24 @@ void T_Glow(glow_t *g)
|
||||||
|
|
||||||
/** Spawns an adjustable glowing light effect in a sector.
|
/** Spawns an adjustable glowing light effect in a sector.
|
||||||
*
|
*
|
||||||
* \param minsector Sector whose light level is used as the darkest.
|
* \param sector Target sector for the effect.
|
||||||
* \param maxsector Sector whose light level is used as the brightest,
|
* \param lighta One of the two light levels to move between.
|
||||||
* and also the target sector for the effect.
|
* \param lightb The other light level.
|
||||||
* \param length The speed of the effect.
|
* \param length The speed of the effect.
|
||||||
* \sa T_Glow
|
* \sa T_Glow
|
||||||
*/
|
*/
|
||||||
glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, INT32 length)
|
glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length)
|
||||||
{
|
{
|
||||||
glow_t *g;
|
glow_t *g;
|
||||||
|
|
||||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
P_RemoveLighting(sector); // out with the old, in with the new
|
||||||
g = Z_Calloc(sizeof (*g), PU_LEVSPEC, NULL);
|
g = Z_Calloc(sizeof (*g), PU_LEVSPEC, NULL);
|
||||||
|
|
||||||
P_AddThinker(THINK_MAIN, &g->thinker);
|
P_AddThinker(THINK_MAIN, &g->thinker);
|
||||||
|
|
||||||
g->sector = maxsector;
|
g->sector = sector;
|
||||||
g->minlight = minsector->lightlevel;
|
g->minlight = min(lighta, lightb);
|
||||||
g->maxlight = maxsector->lightlevel;
|
g->maxlight = max(lighta, lightb);
|
||||||
if (g->minlight > g->maxlight)
|
|
||||||
{
|
|
||||||
// You mixed them up, you dummy.
|
|
||||||
INT32 oops = g->minlight;
|
|
||||||
g->minlight = g->maxlight;
|
|
||||||
g->maxlight = oops;
|
|
||||||
}
|
|
||||||
g->thinker.function.acp1 = (actionf_p1)T_Glow;
|
g->thinker.function.acp1 = (actionf_p1)T_Glow;
|
||||||
g->direction = 1;
|
g->direction = 1;
|
||||||
g->speed = length/4;
|
g->speed = length/4;
|
||||||
|
@ -317,7 +295,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector,
|
||||||
g->speed = (g->maxlight - g->minlight)/2;
|
g->speed = (g->maxlight - g->minlight)/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxsector->lightingdata = g;
|
sector->lightingdata = g;
|
||||||
|
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
24
src/p_spec.c
24
src/p_spec.c
|
@ -2520,7 +2520,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
INT16 reallightlevel = sectors[secnum].lightlevel;
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
||||||
|
|
||||||
flick = P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum],
|
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.
|
// Make sure the starting light level is in range.
|
||||||
|
@ -2535,7 +2535,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
{
|
{
|
||||||
// Use front sector for min, target sector for max,
|
// Use front sector for min, target sector for max,
|
||||||
// the same way linetype 61 does it.
|
// the same way linetype 61 does it.
|
||||||
P_SpawnAdjustableFireFlicker(line->frontsector, §ors[secnum],
|
P_SpawnAdjustableFireFlicker(§ors[secnum], line->frontsector->lightlevel, sectors[secnum].lightlevel,
|
||||||
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2554,7 +2554,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
INT16 reallightlevel = sectors[secnum].lightlevel;
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
||||||
|
|
||||||
glow = P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum],
|
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.
|
// Make sure the starting light level is in range.
|
||||||
|
@ -2569,7 +2569,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
{
|
{
|
||||||
// Use front sector for min, target sector for max,
|
// Use front sector for min, target sector for max,
|
||||||
// the same way linetype 602 does it.
|
// the same way linetype 602 does it.
|
||||||
P_SpawnAdjustableGlowingLight(line->frontsector, §ors[secnum],
|
P_SpawnAdjustableGlowingLight(§ors[secnum], line->frontsector->lightlevel, sectors[secnum].lightlevel,
|
||||||
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
P_AproxDistance(line->dx, line->dy)>>FRACBITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2588,7 +2588,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
INT16 reallightlevel = sectors[secnum].lightlevel;
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
||||||
|
|
||||||
flash = P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum],
|
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.
|
// Make sure the starting light level is in range.
|
||||||
|
@ -2603,7 +2603,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
{
|
{
|
||||||
// Use front sector for min, target sector for max,
|
// Use front sector for min, target sector for max,
|
||||||
// the same way linetype 602 does it.
|
// the same way linetype 602 does it.
|
||||||
P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum],
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2622,7 +2622,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
INT16 reallightlevel = sectors[secnum].lightlevel;
|
INT16 reallightlevel = sectors[secnum].lightlevel;
|
||||||
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
sectors[secnum].lightlevel = line->backsector->lightlevel;
|
||||||
|
|
||||||
flash = P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum],
|
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.
|
// Make sure the starting light level is in range.
|
||||||
|
@ -2637,7 +2637,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||||
{
|
{
|
||||||
// Use front sector for min, target sector for max,
|
// Use front sector for min, target sector for max,
|
||||||
// the same way linetype 602 does it.
|
// the same way linetype 602 does it.
|
||||||
P_SpawnAdjustableStrobeFlash(line->frontsector, §ors[secnum],
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6960,28 +6960,28 @@ void P_SpawnSpecials(boolean fromnetsave)
|
||||||
case 602: // Adjustable pulsating light
|
case 602: // Adjustable pulsating light
|
||||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||||
TAG_ITER_SECTORS(tag, s)
|
TAG_ITER_SECTORS(tag, s)
|
||||||
P_SpawnAdjustableGlowingLight(§ors[sec], §ors[s],
|
P_SpawnAdjustableGlowingLight(§ors[s], sectors[sec].lightlevel, sectors[s].lightlevel,
|
||||||
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
|
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 603: // Adjustable flickering light
|
case 603: // Adjustable flickering light
|
||||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||||
TAG_ITER_SECTORS(tag, s)
|
TAG_ITER_SECTORS(tag, s)
|
||||||
P_SpawnAdjustableFireFlicker(§ors[sec], §ors[s],
|
P_SpawnAdjustableFireFlicker(§ors[s], sectors[sec].lightlevel, sectors[s].lightlevel,
|
||||||
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
|
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 604: // Adjustable Blinking Light (unsynchronized)
|
case 604: // Adjustable Blinking Light (unsynchronized)
|
||||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||||
TAG_ITER_SECTORS(tag, s)
|
TAG_ITER_SECTORS(tag, s)
|
||||||
P_SpawnAdjustableStrobeFlash(§ors[sec], §ors[s],
|
P_SpawnAdjustableStrobeFlash(§ors[s], sectors[sec].lightlevel, sectors[s].lightlevel,
|
||||||
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, false);
|
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 605: // Adjustable Blinking Light (synchronized)
|
case 605: // Adjustable Blinking Light (synchronized)
|
||||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||||
TAG_ITER_SECTORS(tag, s)
|
TAG_ITER_SECTORS(tag, s)
|
||||||
P_SpawnAdjustableStrobeFlash(§ors[sec], §ors[s],
|
P_SpawnAdjustableStrobeFlash(§ors[s], sectors[sec].lightlevel, sectors[s].lightlevel,
|
||||||
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, true);
|
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -284,15 +284,15 @@ typedef struct
|
||||||
void P_RemoveLighting(sector_t *sector);
|
void P_RemoveLighting(sector_t *sector);
|
||||||
|
|
||||||
void T_FireFlicker(fireflicker_t *flick);
|
void T_FireFlicker(fireflicker_t *flick);
|
||||||
fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxsector, INT32 length);
|
fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length);
|
||||||
void T_LightningFlash(lightflash_t *flash);
|
void T_LightningFlash(lightflash_t *flash);
|
||||||
void T_StrobeFlash(strobe_t *flash);
|
void T_StrobeFlash(strobe_t *flash);
|
||||||
|
|
||||||
void P_SpawnLightningFlash(sector_t *sector);
|
void P_SpawnLightningFlash(sector_t *sector);
|
||||||
strobe_t * P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector, INT32 darktime, INT32 brighttime, boolean inSync);
|
strobe_t * P_SpawnAdjustableStrobeFlash(sector_t *sector, INT16 lighta, INT16 lightb, INT32 darktime, INT32 brighttime, boolean inSync);
|
||||||
|
|
||||||
void T_Glow(glow_t *g);
|
void T_Glow(glow_t *g);
|
||||||
glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector, INT32 length);
|
glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 lightb, INT32 length);
|
||||||
|
|
||||||
void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean ticbased);
|
void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean ticbased);
|
||||||
void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force);
|
void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force);
|
||||||
|
|
Loading…
Reference in a new issue