mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Make light levels in thinkers INT16
This commit is contained in:
parent
9180b86e9e
commit
44faed6285
3 changed files with 36 additions and 36 deletions
|
@ -54,9 +54,9 @@ void T_FireFlicker(fireflicker_t *flick)
|
||||||
amount = (INT16)((UINT8)(P_RandomByte() & 3) * 16);
|
amount = (INT16)((UINT8)(P_RandomByte() & 3) * 16);
|
||||||
|
|
||||||
if (flick->sector->lightlevel - amount < flick->minlight)
|
if (flick->sector->lightlevel - amount < flick->minlight)
|
||||||
flick->sector->lightlevel = (INT16)flick->minlight;
|
flick->sector->lightlevel = flick->minlight;
|
||||||
else
|
else
|
||||||
flick->sector->lightlevel = (INT16)((INT16)flick->maxlight - amount);
|
flick->sector->lightlevel = flick->maxlight - amount;
|
||||||
|
|
||||||
flick->count = flick->resetcount;
|
flick->count = flick->resetcount;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *sector, INT16 lighta, INT1
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the starting light level is in range.
|
// Make sure the starting light level is in range.
|
||||||
sector->lightlevel = max((INT16)flick->minlight, min((INT16)flick->maxlight, sector->lightlevel));
|
sector->lightlevel = max(flick->minlight, min(flick->maxlight, sector->lightlevel));
|
||||||
|
|
||||||
return flick;
|
return flick;
|
||||||
}
|
}
|
||||||
|
@ -178,12 +178,12 @@ void T_StrobeFlash(strobe_t *flash)
|
||||||
|
|
||||||
if (flash->sector->lightlevel == flash->minlight)
|
if (flash->sector->lightlevel == flash->minlight)
|
||||||
{
|
{
|
||||||
flash->sector->lightlevel = (INT16)flash->maxlight;
|
flash->sector->lightlevel = flash->maxlight;
|
||||||
flash->count = flash->brighttime;
|
flash->count = flash->brighttime;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
flash->sector->lightlevel = (INT16)flash->minlight;
|
flash->sector->lightlevel = flash->minlight;
|
||||||
flash->count = flash->darktime;
|
flash->count = flash->darktime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *sector, INT16 lighta, INT16 lig
|
||||||
flash->count = 1;
|
flash->count = 1;
|
||||||
|
|
||||||
// Make sure the starting light level is in range.
|
// Make sure the starting light level is in range.
|
||||||
sector->lightlevel = max((INT16)flash->minlight, min((INT16)flash->maxlight, sector->lightlevel));
|
sector->lightlevel = max(flash->minlight, min(flash->maxlight, sector->lightlevel));
|
||||||
|
|
||||||
sector->lightingdata = flash;
|
sector->lightingdata = flash;
|
||||||
return flash;
|
return flash;
|
||||||
|
@ -245,20 +245,20 @@ void T_Glow(glow_t *g)
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
// DOWN
|
// DOWN
|
||||||
g->sector->lightlevel = (INT16)(g->sector->lightlevel - (INT16)g->speed);
|
g->sector->lightlevel -= g->speed;
|
||||||
if (g->sector->lightlevel <= g->minlight)
|
if (g->sector->lightlevel <= g->minlight)
|
||||||
{
|
{
|
||||||
g->sector->lightlevel = (INT16)(g->sector->lightlevel + (INT16)g->speed);
|
g->sector->lightlevel += g->speed;
|
||||||
g->direction = 1;
|
g->direction = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
// UP
|
// UP
|
||||||
g->sector->lightlevel = (INT16)(g->sector->lightlevel + (INT16)g->speed);
|
g->sector->lightlevel += g->speed;
|
||||||
if (g->sector->lightlevel >= g->maxlight)
|
if (g->sector->lightlevel >= g->maxlight)
|
||||||
{
|
{
|
||||||
g->sector->lightlevel = (INT16)(g->sector->lightlevel - (INT16)g->speed);
|
g->sector->lightlevel -= g->speed;
|
||||||
g->direction = -1;
|
g->direction = -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -287,7 +287,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 ligh
|
||||||
g->maxlight = max(lighta, lightb);
|
g->maxlight = max(lighta, lightb);
|
||||||
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 = (INT16)(length/4);
|
||||||
if (g->speed > (g->maxlight - g->minlight)/2) // don't make it ridiculous speed
|
if (g->speed > (g->maxlight - g->minlight)/2) // don't make it ridiculous speed
|
||||||
g->speed = (g->maxlight - g->minlight)/2;
|
g->speed = (g->maxlight - g->minlight)/2;
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *sector, INT16 lighta, INT16 ligh
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the starting light level is in range.
|
// Make sure the starting light level is in range.
|
||||||
sector->lightlevel = max((INT16)g->minlight, min((INT16)g->maxlight, sector->lightlevel));
|
sector->lightlevel = max(g->minlight, min(g->maxlight, sector->lightlevel));
|
||||||
|
|
||||||
sector->lightingdata = g;
|
sector->lightingdata = g;
|
||||||
|
|
||||||
|
|
|
@ -2083,8 +2083,8 @@ static void SaveStrobeThinker(const thinker_t *th, const UINT8 type)
|
||||||
WRITEUINT8(save_p, type);
|
WRITEUINT8(save_p, type);
|
||||||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||||
WRITEINT32(save_p, ht->count);
|
WRITEINT32(save_p, ht->count);
|
||||||
WRITEINT32(save_p, ht->minlight);
|
WRITEINT16(save_p, ht->minlight);
|
||||||
WRITEINT32(save_p, ht->maxlight);
|
WRITEINT16(save_p, ht->maxlight);
|
||||||
WRITEINT32(save_p, ht->darktime);
|
WRITEINT32(save_p, ht->darktime);
|
||||||
WRITEINT32(save_p, ht->brighttime);
|
WRITEINT32(save_p, ht->brighttime);
|
||||||
}
|
}
|
||||||
|
@ -2094,10 +2094,10 @@ static void SaveGlowThinker(const thinker_t *th, const UINT8 type)
|
||||||
const glow_t *ht = (const void *)th;
|
const glow_t *ht = (const void *)th;
|
||||||
WRITEUINT8(save_p, type);
|
WRITEUINT8(save_p, type);
|
||||||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||||
WRITEINT32(save_p, ht->minlight);
|
WRITEINT16(save_p, ht->minlight);
|
||||||
WRITEINT32(save_p, ht->maxlight);
|
WRITEINT16(save_p, ht->maxlight);
|
||||||
WRITEINT32(save_p, ht->direction);
|
WRITEINT16(save_p, ht->direction);
|
||||||
WRITEINT32(save_p, ht->speed);
|
WRITEINT16(save_p, ht->speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type)
|
static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type)
|
||||||
|
@ -2107,8 +2107,8 @@ static inline void SaveFireflickerThinker(const thinker_t *th, const UINT8 type)
|
||||||
WRITEUINT32(save_p, SaveSector(ht->sector));
|
WRITEUINT32(save_p, SaveSector(ht->sector));
|
||||||
WRITEINT32(save_p, ht->count);
|
WRITEINT32(save_p, ht->count);
|
||||||
WRITEINT32(save_p, ht->resetcount);
|
WRITEINT32(save_p, ht->resetcount);
|
||||||
WRITEINT32(save_p, ht->maxlight);
|
WRITEINT16(save_p, ht->maxlight);
|
||||||
WRITEINT32(save_p, ht->minlight);
|
WRITEINT16(save_p, ht->minlight);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SaveElevatorThinker(const thinker_t *th, const UINT8 type)
|
static void SaveElevatorThinker(const thinker_t *th, const UINT8 type)
|
||||||
|
@ -3212,8 +3212,8 @@ static thinker_t* LoadStrobeThinker(actionf_p1 thinker)
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function.acp1 = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save_p));
|
ht->sector = LoadSector(READUINT32(save_p));
|
||||||
ht->count = READINT32(save_p);
|
ht->count = READINT32(save_p);
|
||||||
ht->minlight = READINT32(save_p);
|
ht->minlight = READINT16(save_p);
|
||||||
ht->maxlight = READINT32(save_p);
|
ht->maxlight = READINT16(save_p);
|
||||||
ht->darktime = READINT32(save_p);
|
ht->darktime = READINT32(save_p);
|
||||||
ht->brighttime = READINT32(save_p);
|
ht->brighttime = READINT32(save_p);
|
||||||
if (ht->sector)
|
if (ht->sector)
|
||||||
|
@ -3226,10 +3226,10 @@ static thinker_t* LoadGlowThinker(actionf_p1 thinker)
|
||||||
glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
glow_t *ht = Z_Malloc(sizeof (*ht), PU_LEVSPEC, NULL);
|
||||||
ht->thinker.function.acp1 = thinker;
|
ht->thinker.function.acp1 = thinker;
|
||||||
ht->sector = LoadSector(READUINT32(save_p));
|
ht->sector = LoadSector(READUINT32(save_p));
|
||||||
ht->minlight = READINT32(save_p);
|
ht->minlight = READINT16(save_p);
|
||||||
ht->maxlight = READINT32(save_p);
|
ht->maxlight = READINT16(save_p);
|
||||||
ht->direction = READINT32(save_p);
|
ht->direction = READINT16(save_p);
|
||||||
ht->speed = READINT32(save_p);
|
ht->speed = READINT16(save_p);
|
||||||
if (ht->sector)
|
if (ht->sector)
|
||||||
ht->sector->lightingdata = ht;
|
ht->sector->lightingdata = ht;
|
||||||
return &ht->thinker;
|
return &ht->thinker;
|
||||||
|
@ -3242,8 +3242,8 @@ static thinker_t* LoadFireflickerThinker(actionf_p1 thinker)
|
||||||
ht->sector = LoadSector(READUINT32(save_p));
|
ht->sector = LoadSector(READUINT32(save_p));
|
||||||
ht->count = READINT32(save_p);
|
ht->count = READINT32(save_p);
|
||||||
ht->resetcount = READINT32(save_p);
|
ht->resetcount = READINT32(save_p);
|
||||||
ht->maxlight = READINT32(save_p);
|
ht->maxlight = READINT16(save_p);
|
||||||
ht->minlight = READINT32(save_p);
|
ht->minlight = READINT16(save_p);
|
||||||
if (ht->sector)
|
if (ht->sector)
|
||||||
ht->sector->lightingdata = ht;
|
ht->sector->lightingdata = ht;
|
||||||
return &ht->thinker;
|
return &ht->thinker;
|
||||||
|
|
16
src/p_spec.h
16
src/p_spec.h
|
@ -216,8 +216,8 @@ typedef struct
|
||||||
sector_t *sector; ///< The sector where action is taking place.
|
sector_t *sector; ///< The sector where action is taking place.
|
||||||
INT32 count;
|
INT32 count;
|
||||||
INT32 resetcount;
|
INT32 resetcount;
|
||||||
INT32 maxlight; ///< The brightest light level to use.
|
INT16 maxlight; ///< The brightest light level to use.
|
||||||
INT32 minlight; ///< The darkest light level to use.
|
INT16 minlight; ///< The darkest light level to use.
|
||||||
} fireflicker_t;
|
} fireflicker_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -245,8 +245,8 @@ typedef struct
|
||||||
thinker_t thinker; ///< The thinker in use for the effect.
|
thinker_t thinker; ///< The thinker in use for the effect.
|
||||||
sector_t *sector; ///< The sector where the action is taking place.
|
sector_t *sector; ///< The sector where the action is taking place.
|
||||||
INT32 count;
|
INT32 count;
|
||||||
INT32 minlight; ///< The minimum light level to use.
|
INT16 minlight; ///< The minimum light level to use.
|
||||||
INT32 maxlight; ///< The maximum light level to use.
|
INT16 maxlight; ///< The maximum light level to use.
|
||||||
INT32 darktime; ///< How INT32 to use minlight.
|
INT32 darktime; ///< How INT32 to use minlight.
|
||||||
INT32 brighttime; ///< How INT32 to use maxlight.
|
INT32 brighttime; ///< How INT32 to use maxlight.
|
||||||
} strobe_t;
|
} strobe_t;
|
||||||
|
@ -255,10 +255,10 @@ typedef struct
|
||||||
{
|
{
|
||||||
thinker_t thinker;
|
thinker_t thinker;
|
||||||
sector_t *sector;
|
sector_t *sector;
|
||||||
INT32 minlight;
|
INT16 minlight;
|
||||||
INT32 maxlight;
|
INT16 maxlight;
|
||||||
INT32 direction;
|
INT16 direction;
|
||||||
INT32 speed;
|
INT16 speed;
|
||||||
} glow_t;
|
} glow_t;
|
||||||
|
|
||||||
/** Thinker struct for fading lights.
|
/** Thinker struct for fading lights.
|
||||||
|
|
Loading…
Reference in a new issue