mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 06:12:19 +00:00
- moved the declarations for the lighting thinkers to p_light.cpp.
Aside from the init function they are not needed anywhere else and that could also be placed into this file.
This commit is contained in:
parent
c12a85ee85
commit
76c18820cb
3 changed files with 190 additions and 170 deletions
185
src/p_lights.cpp
185
src/p_lights.cpp
|
@ -42,6 +42,131 @@ static FRandom pr_lightflash ("LightFlash");
|
|||
static FRandom pr_strobeflash ("StrobeFlash");
|
||||
static FRandom pr_fireflicker ("FireFlicker");
|
||||
|
||||
|
||||
class DFireFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DFireFlicker, DLighting)
|
||||
public:
|
||||
DFireFlicker(sector_t *sector);
|
||||
DFireFlicker(sector_t *sector, int upper, int lower);
|
||||
void Serialize(FArchive &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
private:
|
||||
DFireFlicker();
|
||||
};
|
||||
|
||||
class DFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DFlicker, DLighting)
|
||||
public:
|
||||
DFlicker(sector_t *sector, int upper, int lower);
|
||||
void Serialize(FArchive &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
private:
|
||||
DFlicker();
|
||||
};
|
||||
|
||||
class DLightFlash : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DLightFlash, DLighting)
|
||||
public:
|
||||
DLightFlash(sector_t *sector);
|
||||
DLightFlash(sector_t *sector, int min, int max);
|
||||
void Serialize(FArchive &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
int m_MaxTime;
|
||||
int m_MinTime;
|
||||
private:
|
||||
DLightFlash();
|
||||
};
|
||||
|
||||
class DStrobe : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DStrobe, DLighting)
|
||||
public:
|
||||
DStrobe(sector_t *sector, int utics, int ltics, bool inSync);
|
||||
DStrobe(sector_t *sector, int upper, int lower, int utics, int ltics);
|
||||
void Serialize(FArchive &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_DarkTime;
|
||||
int m_BrightTime;
|
||||
private:
|
||||
DStrobe();
|
||||
};
|
||||
|
||||
class DGlow : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DGlow, DLighting)
|
||||
public:
|
||||
DGlow(sector_t *sector);
|
||||
void Serialize(FArchive &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_Direction;
|
||||
private:
|
||||
DGlow();
|
||||
};
|
||||
|
||||
// [RH] Glow from Light_Glow and Light_Fade specials
|
||||
class DGlow2 : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DGlow2, DLighting)
|
||||
public:
|
||||
DGlow2(sector_t *sector, int start, int end, int tics, bool oneshot);
|
||||
void Serialize(FArchive &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Start;
|
||||
int m_End;
|
||||
int m_MaxTics;
|
||||
int m_Tics;
|
||||
bool m_OneShot;
|
||||
private:
|
||||
DGlow2();
|
||||
};
|
||||
|
||||
// [RH] Phased light thinker
|
||||
class DPhased : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DPhased, DLighting)
|
||||
public:
|
||||
DPhased(sector_t *sector);
|
||||
DPhased(sector_t *sector, int baselevel, int phase);
|
||||
void Serialize(FArchive &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
BYTE m_BaseLevel;
|
||||
BYTE m_Phase;
|
||||
private:
|
||||
DPhased();
|
||||
DPhased(sector_t *sector, int baselevel);
|
||||
int PhaseHelper(sector_t *sector, int index, int light, sector_t *prev);
|
||||
};
|
||||
|
||||
#define GLOWSPEED 8
|
||||
#define STROBEBRIGHT 5
|
||||
#define FASTDARK 15
|
||||
#define SLOWDARK TICRATE
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -845,3 +970,63 @@ void EV_StopLightEffect (int tag)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void P_SpawnLights(sector_t *sector)
|
||||
{
|
||||
switch (sector->special)
|
||||
{
|
||||
case Light_Phased:
|
||||
new DPhased(sector, 48, 63 - (sector->lightlevel & 63));
|
||||
break;
|
||||
|
||||
// [RH] Hexen-like phased lighting
|
||||
case LightSequenceStart:
|
||||
new DPhased(sector);
|
||||
break;
|
||||
|
||||
case dLight_Flicker:
|
||||
new DLightFlash(sector);
|
||||
break;
|
||||
|
||||
case dLight_StrobeFast:
|
||||
new DStrobe(sector, STROBEBRIGHT, FASTDARK, false);
|
||||
break;
|
||||
|
||||
case dLight_StrobeSlow:
|
||||
new DStrobe(sector, STROBEBRIGHT, SLOWDARK, false);
|
||||
break;
|
||||
|
||||
case dLight_Strobe_Hurt:
|
||||
new DStrobe(sector, STROBEBRIGHT, FASTDARK, false);
|
||||
break;
|
||||
|
||||
case dLight_Glow:
|
||||
new DGlow(sector);
|
||||
break;
|
||||
|
||||
case dLight_StrobeSlowSync:
|
||||
new DStrobe(sector, STROBEBRIGHT, SLOWDARK, true);
|
||||
break;
|
||||
|
||||
case dLight_StrobeFastSync:
|
||||
new DStrobe(sector, STROBEBRIGHT, FASTDARK, true);
|
||||
break;
|
||||
|
||||
case dLight_FireFlicker:
|
||||
new DFireFlicker(sector);
|
||||
break;
|
||||
|
||||
case dScroll_EastLavaDamage:
|
||||
new DStrobe(sector, STROBEBRIGHT, FASTDARK, false);
|
||||
break;
|
||||
|
||||
case sLight_Strobe_Hurt:
|
||||
new DStrobe(sector, STROBEBRIGHT, FASTDARK, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1039,6 +1039,7 @@ static void P_SetupSectorDamage(sector_t *sector, int damage, int interval, int
|
|||
// Sets up everything derived from 'sector->special' for one sector
|
||||
// ('fromload' is necessary to allow conversion upon savegame load.)
|
||||
//
|
||||
void P_SpawnLights(sector_t *sector);
|
||||
|
||||
void P_InitSectorSpecial(sector_t *sector, int special)
|
||||
{
|
||||
|
@ -1072,31 +1073,10 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
|
||||
// [RH] Normal DOOM special or BOOM specialized?
|
||||
bool keepspecial = false;
|
||||
P_SpawnLights(sector);
|
||||
switch (sector->special)
|
||||
{
|
||||
case Light_Phased:
|
||||
new DPhased (sector, 48, 63 - (sector->lightlevel & 63));
|
||||
break;
|
||||
|
||||
// [RH] Hexen-like phased lighting
|
||||
case LightSequenceStart:
|
||||
new DPhased (sector);
|
||||
break;
|
||||
|
||||
case dLight_Flicker:
|
||||
new DLightFlash (sector);
|
||||
break;
|
||||
|
||||
case dLight_StrobeFast:
|
||||
new DStrobe (sector, STROBEBRIGHT, FASTDARK, false);
|
||||
break;
|
||||
|
||||
case dLight_StrobeSlow:
|
||||
new DStrobe (sector, STROBEBRIGHT, SLOWDARK, false);
|
||||
break;
|
||||
|
||||
case dLight_Strobe_Hurt:
|
||||
new DStrobe (sector, STROBEBRIGHT, FASTDARK, false);
|
||||
P_SetupSectorDamage(sector, 20, 32, 5, NAME_Slime, 0);
|
||||
break;
|
||||
|
||||
|
@ -1108,10 +1088,6 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
P_SetupSectorDamage(sector, 5, 32, 0, NAME_Slime, 0);
|
||||
break;
|
||||
|
||||
case dLight_Glow:
|
||||
new DGlow (sector);
|
||||
break;
|
||||
|
||||
case dSector_DoorCloseIn30:
|
||||
new DDoor(sector, DDoor::doorWaitClose, 2, 0, 0, 30 * TICRATE);
|
||||
break;
|
||||
|
@ -1120,14 +1096,6 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
P_SetupSectorDamage(sector, 20, 32, 256, NAME_None, SECF_ENDGODMODE|SECF_ENDLEVEL);
|
||||
break;
|
||||
|
||||
case dLight_StrobeSlowSync:
|
||||
new DStrobe (sector, STROBEBRIGHT, SLOWDARK, true);
|
||||
break;
|
||||
|
||||
case dLight_StrobeFastSync:
|
||||
new DStrobe (sector, STROBEBRIGHT, FASTDARK, true);
|
||||
break;
|
||||
|
||||
case dSector_DoorRaiseIn5Mins:
|
||||
new DDoor (sector, DDoor::doorWaitRaise, 2, TICRATE*30/7, 0, 5*60*TICRATE);
|
||||
break;
|
||||
|
@ -1142,10 +1110,6 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
P_SetupSectorDamage(sector, 20, 32, 5, NAME_Slime, 0);
|
||||
break;
|
||||
|
||||
case dLight_FireFlicker:
|
||||
new DFireFlicker (sector);
|
||||
break;
|
||||
|
||||
case dDamage_LavaWimpy:
|
||||
P_SetupSectorDamage(sector, 5, 32, 256, NAME_Fire, SECF_DMGTERRAINFX);
|
||||
break;
|
||||
|
@ -1156,7 +1120,6 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
|
||||
case dScroll_EastLavaDamage:
|
||||
P_SetupSectorDamage(sector, 5, 32, 256, NAME_Fire, SECF_DMGTERRAINFX);
|
||||
new DStrobe(sector, STROBEBRIGHT, FASTDARK, false);
|
||||
P_CreateScroller(EScroll::sc_floor, -4., 0, -1, int(sector - sectors), 0);
|
||||
keepspecial = true;
|
||||
break;
|
||||
|
@ -1167,7 +1130,6 @@ void P_InitSectorSpecial(sector_t *sector, int special)
|
|||
|
||||
case sLight_Strobe_Hurt:
|
||||
P_SetupSectorDamage(sector, 5, 32, 0, NAME_Slime, 0);
|
||||
new DStrobe (sector, STROBEBRIGHT, FASTDARK, false);
|
||||
break;
|
||||
|
||||
case sDamage_Hellslime:
|
||||
|
|
133
src/p_spec.h
133
src/p_spec.h
|
@ -119,142 +119,15 @@ inline sector_t *getNextSector (line_t *line, const sector_t *sec)
|
|||
|
||||
#include "p_tags.h"
|
||||
|
||||
//
|
||||
// P_LIGHTS
|
||||
//
|
||||
|
||||
class DLighting : public DSectorEffect
|
||||
{
|
||||
DECLARE_CLASS (DLighting, DSectorEffect)
|
||||
DECLARE_CLASS(DLighting, DSectorEffect)
|
||||
public:
|
||||
DLighting (sector_t *sector);
|
||||
DLighting(sector_t *sector);
|
||||
protected:
|
||||
DLighting ();
|
||||
DLighting();
|
||||
};
|
||||
|
||||
class DFireFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS (DFireFlicker, DLighting)
|
||||
public:
|
||||
DFireFlicker (sector_t *sector);
|
||||
DFireFlicker (sector_t *sector, int upper, int lower);
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
private:
|
||||
DFireFlicker ();
|
||||
};
|
||||
|
||||
class DFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS (DFlicker, DLighting)
|
||||
public:
|
||||
DFlicker (sector_t *sector, int upper, int lower);
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
private:
|
||||
DFlicker ();
|
||||
};
|
||||
|
||||
class DLightFlash : public DLighting
|
||||
{
|
||||
DECLARE_CLASS (DLightFlash, DLighting)
|
||||
public:
|
||||
DLightFlash (sector_t *sector);
|
||||
DLightFlash (sector_t *sector, int min, int max);
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
int m_MaxTime;
|
||||
int m_MinTime;
|
||||
private:
|
||||
DLightFlash ();
|
||||
};
|
||||
|
||||
class DStrobe : public DLighting
|
||||
{
|
||||
DECLARE_CLASS (DStrobe, DLighting)
|
||||
public:
|
||||
DStrobe (sector_t *sector, int utics, int ltics, bool inSync);
|
||||
DStrobe (sector_t *sector, int upper, int lower, int utics, int ltics);
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_DarkTime;
|
||||
int m_BrightTime;
|
||||
private:
|
||||
DStrobe ();
|
||||
};
|
||||
|
||||
class DGlow : public DLighting
|
||||
{
|
||||
DECLARE_CLASS (DGlow, DLighting)
|
||||
public:
|
||||
DGlow (sector_t *sector);
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
protected:
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_Direction;
|
||||
private:
|
||||
DGlow ();
|
||||
};
|
||||
|
||||
// [RH] Glow from Light_Glow and Light_Fade specials
|
||||
class DGlow2 : public DLighting
|
||||
{
|
||||
DECLARE_CLASS (DGlow2, DLighting)
|
||||
public:
|
||||
DGlow2 (sector_t *sector, int start, int end, int tics, bool oneshot);
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
protected:
|
||||
int m_Start;
|
||||
int m_End;
|
||||
int m_MaxTics;
|
||||
int m_Tics;
|
||||
bool m_OneShot;
|
||||
private:
|
||||
DGlow2 ();
|
||||
};
|
||||
|
||||
// [RH] Phased light thinker
|
||||
class DPhased : public DLighting
|
||||
{
|
||||
DECLARE_CLASS (DPhased, DLighting)
|
||||
public:
|
||||
DPhased (sector_t *sector);
|
||||
DPhased (sector_t *sector, int baselevel, int phase);
|
||||
void Serialize (FArchive &arc);
|
||||
void Tick ();
|
||||
protected:
|
||||
BYTE m_BaseLevel;
|
||||
BYTE m_Phase;
|
||||
private:
|
||||
DPhased ();
|
||||
DPhased (sector_t *sector, int baselevel);
|
||||
int PhaseHelper (sector_t *sector, int index, int light, sector_t *prev);
|
||||
};
|
||||
|
||||
#define GLOWSPEED 8
|
||||
#define STROBEBRIGHT 5
|
||||
#define FASTDARK 15
|
||||
#define SLOWDARK TICRATE
|
||||
|
||||
void EV_StartLightFlickering (int tag, int upper, int lower);
|
||||
void EV_StartLightStrobing (int tag, int upper, int lower, int utics, int ltics);
|
||||
void EV_StartLightStrobing (int tag, int utics, int ltics);
|
||||
|
|
Loading…
Reference in a new issue