mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
- moved the remaining thinker code to g_shared
This commit is contained in:
parent
4984bc8c5f
commit
aa340145ac
21 changed files with 801 additions and 739 deletions
|
@ -949,26 +949,19 @@ set (PCH_SOURCES
|
|||
p_3dmidtex.cpp
|
||||
p_acs.cpp
|
||||
p_actionfunctions.cpp
|
||||
p_ceiling.cpp
|
||||
p_conversation.cpp
|
||||
p_destructible.cpp
|
||||
p_effect.cpp
|
||||
p_enemy.cpp
|
||||
p_floor.cpp
|
||||
p_interaction.cpp
|
||||
p_lights.cpp
|
||||
p_linkedsectors.cpp
|
||||
p_lnspec.cpp
|
||||
p_map.cpp
|
||||
p_maputl.cpp
|
||||
p_mobj.cpp
|
||||
p_openmap.cpp
|
||||
p_pillar.cpp
|
||||
p_plats.cpp
|
||||
p_pspr.cpp
|
||||
p_pusher.cpp
|
||||
p_saveg.cpp
|
||||
p_scroll.cpp
|
||||
p_secnodes.cpp
|
||||
p_sectors.cpp
|
||||
p_setup.cpp
|
||||
|
@ -1030,6 +1023,14 @@ set (PCH_SOURCES
|
|||
g_shared/a_morph.cpp
|
||||
g_shared/a_quake.cpp
|
||||
g_shared/a_specialspot.cpp
|
||||
g_shared/a_ceiling.cpp
|
||||
g_shared/a_floor.cpp
|
||||
g_shared/a_lights.cpp
|
||||
g_shared/a_lighttransfer.cpp
|
||||
g_shared/a_pillar.cpp
|
||||
g_shared/a_plats.cpp
|
||||
g_shared/a_pusher.cpp
|
||||
g_shared/a_scroll.cpp
|
||||
g_statusbar/hudmessages.cpp
|
||||
g_statusbar/shared_hud.cpp
|
||||
g_statusbar/sbarinfo.cpp
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "actorinlines.h"
|
||||
#include "scriptutil.h"
|
||||
#include "vm.h"
|
||||
#include "a_lights.h"
|
||||
|
||||
static FRandom pr_script("FScript");
|
||||
|
||||
|
|
81
src/g_shared/a_ceiling.h
Normal file
81
src/g_shared/a_ceiling.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
#pragma once
|
||||
|
||||
//
|
||||
// P_CEILING
|
||||
//
|
||||
|
||||
// [RH] Changed these
|
||||
class DCeiling : public DMovingCeiling
|
||||
{
|
||||
DECLARE_CLASS (DCeiling, DMovingCeiling)
|
||||
public:
|
||||
enum ECeiling
|
||||
{
|
||||
ceilLowerByValue,
|
||||
ceilRaiseByValue,
|
||||
ceilMoveToValue,
|
||||
ceilLowerToHighestFloor,
|
||||
ceilLowerInstant,
|
||||
ceilRaiseInstant,
|
||||
ceilCrushAndRaise,
|
||||
ceilLowerAndCrush,
|
||||
ceil_placeholder,
|
||||
ceilCrushRaiseAndStay,
|
||||
ceilRaiseToNearest,
|
||||
ceilLowerToLowest,
|
||||
ceilLowerToFloor,
|
||||
|
||||
// The following are only used by Generic_Ceiling
|
||||
ceilRaiseToHighest,
|
||||
ceilLowerToHighest,
|
||||
ceilRaiseToLowest,
|
||||
ceilLowerToNearest,
|
||||
ceilRaiseToHighestFloor,
|
||||
ceilRaiseToFloor,
|
||||
ceilRaiseByTexture,
|
||||
ceilLowerByTexture,
|
||||
|
||||
genCeilingChg0,
|
||||
genCeilingChgT,
|
||||
genCeilingChg
|
||||
};
|
||||
|
||||
enum class ECrushMode
|
||||
{
|
||||
crushDoom = 0,
|
||||
crushHexen = 1,
|
||||
crushSlowdown = 2
|
||||
};
|
||||
|
||||
|
||||
void Construct(sector_t *sec);
|
||||
void Construct(sector_t *sec, double speed1, double speed2, int silent);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
ECeiling m_Type;
|
||||
double m_BottomHeight;
|
||||
double m_TopHeight;
|
||||
double m_Speed;
|
||||
double m_Speed1; // [RH] dnspeed of crushers
|
||||
double m_Speed2; // [RH] upspeed of crushers
|
||||
int m_Crush;
|
||||
ECrushMode m_CrushMode;
|
||||
int m_Silent;
|
||||
int m_Direction; // 1 = up, 0 = waiting, -1 = down
|
||||
|
||||
// [RH] Need these for BOOM-ish transferring ceilings
|
||||
FTextureID m_Texture;
|
||||
secspecial_t m_NewSpecial{};
|
||||
|
||||
// ID
|
||||
int m_Tag;
|
||||
int m_OldDirection;
|
||||
|
||||
void PlayCeilingSound ();
|
||||
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
173
src/g_shared/a_floor.h
Normal file
173
src/g_shared/a_floor.h
Normal file
|
@ -0,0 +1,173 @@
|
|||
#pragma once
|
||||
|
||||
//
|
||||
// P_FLOOR
|
||||
//
|
||||
|
||||
class DFloor : public DMovingFloor
|
||||
{
|
||||
DECLARE_CLASS (DFloor, DMovingFloor)
|
||||
public:
|
||||
enum EFloor
|
||||
{
|
||||
floorLowerToLowest,
|
||||
floorLowerToNearest,
|
||||
floorLowerToHighest,
|
||||
floorLowerByValue,
|
||||
floorRaiseByValue,
|
||||
floorRaiseToHighest,
|
||||
floorRaiseToNearest,
|
||||
floorRaiseAndCrush,
|
||||
floorRaiseAndCrushDoom,
|
||||
floorCrushStop,
|
||||
floorLowerInstant,
|
||||
floorRaiseInstant,
|
||||
floorMoveToValue,
|
||||
floorRaiseToLowestCeiling,
|
||||
floorRaiseByTexture,
|
||||
|
||||
floorLowerAndChange,
|
||||
floorRaiseAndChange,
|
||||
|
||||
floorRaiseToLowest,
|
||||
floorRaiseToCeiling,
|
||||
floorLowerToLowestCeiling,
|
||||
floorLowerByTexture,
|
||||
floorLowerToCeiling,
|
||||
|
||||
donutRaise,
|
||||
|
||||
buildStair,
|
||||
waitStair,
|
||||
resetStair,
|
||||
|
||||
// Not to be used as parameters to EV_DoFloor()
|
||||
genFloorChg0,
|
||||
genFloorChgT,
|
||||
genFloorChg
|
||||
};
|
||||
|
||||
// [RH] Changed to use Hexen-ish specials
|
||||
enum EStair
|
||||
{
|
||||
buildUp,
|
||||
buildDown
|
||||
};
|
||||
|
||||
enum EStairType
|
||||
{
|
||||
stairUseSpecials = 1,
|
||||
stairSync = 2,
|
||||
stairCrush = 4,
|
||||
};
|
||||
|
||||
void Construct(sector_t *sec);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
//protected:
|
||||
EFloor m_Type;
|
||||
int m_Crush;
|
||||
bool m_Hexencrush;
|
||||
bool m_Instant;
|
||||
int m_Direction;
|
||||
secspecial_t m_NewSpecial{};
|
||||
FTextureID m_Texture;
|
||||
double m_FloorDestDist;
|
||||
double m_Speed;
|
||||
|
||||
// [RH] New parameters used to reset and delay stairs
|
||||
double m_OrgDist;
|
||||
int m_ResetCount;
|
||||
int m_Delay;
|
||||
int m_PauseTime;
|
||||
int m_StepTime;
|
||||
int m_PerStepTime;
|
||||
|
||||
void StartFloorSound ();
|
||||
void SetFloorChangeType (sector_t *sec, int change);
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
||||
class DElevator : public DMover
|
||||
{
|
||||
DECLARE_CLASS (DElevator, DMover)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
enum EElevator
|
||||
{
|
||||
elevateUp,
|
||||
elevateDown,
|
||||
elevateCurrent,
|
||||
// [RH] For FloorAndCeiling_Raise/Lower
|
||||
elevateRaise,
|
||||
elevateLower
|
||||
};
|
||||
|
||||
void Construct(sector_t *sec);
|
||||
|
||||
void OnDestroy() override;
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
EElevator m_Type;
|
||||
int m_Direction;
|
||||
double m_FloorDestDist;
|
||||
double m_CeilingDestDist;
|
||||
double m_Speed;
|
||||
TObjPtr<DInterpolation*> m_Interp_Ceiling;
|
||||
TObjPtr<DInterpolation*> m_Interp_Floor;
|
||||
|
||||
void StartFloorSound ();
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
||||
|
||||
class DWaggleBase : public DMover
|
||||
{
|
||||
DECLARE_CLASS (DWaggleBase, DMover)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
void Construct(sector_t *sec);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
|
||||
protected:
|
||||
double m_OriginalDist;
|
||||
double m_Accumulator;
|
||||
double m_AccDelta;
|
||||
double m_TargetScale;
|
||||
double m_Scale;
|
||||
double m_ScaleDelta;
|
||||
int m_Ticker;
|
||||
int m_State;
|
||||
|
||||
friend struct FLevelLocals;
|
||||
void DoWaggle (bool ceiling);
|
||||
};
|
||||
|
||||
class DFloorWaggle : public DWaggleBase
|
||||
{
|
||||
DECLARE_CLASS (DFloorWaggle, DWaggleBase)
|
||||
public:
|
||||
void Construct(sector_t *sec);
|
||||
void Tick ();
|
||||
};
|
||||
|
||||
class DCeilingWaggle : public DWaggleBase
|
||||
{
|
||||
DECLARE_CLASS (DCeilingWaggle, DWaggleBase)
|
||||
public:
|
||||
void Construct(sector_t *sec);
|
||||
void Tick ();
|
||||
};
|
||||
|
||||
//jff 3/15/98 pure texture/type change for better generalized support
|
||||
enum EChange
|
||||
{
|
||||
trigChangeOnly,
|
||||
numChangeOnly,
|
||||
};
|
||||
|
115
src/g_shared/a_lights.h
Normal file
115
src/g_shared/a_lights.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
#pragma once
|
||||
|
||||
class DLighting : public DSectorEffect
|
||||
{
|
||||
DECLARE_CLASS(DLighting, DSectorEffect)
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_LIGHT;
|
||||
};
|
||||
|
||||
class DFireFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DFireFlicker, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector);
|
||||
void Construct(sector_t *sector, int upper, int lower);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
};
|
||||
|
||||
class DFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DFlicker, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int upper, int lower);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
};
|
||||
|
||||
class DLightFlash : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DLightFlash, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector);
|
||||
void Construct(sector_t *sector, int min, int max);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
int m_MaxTime;
|
||||
int m_MinTime;
|
||||
};
|
||||
|
||||
class DStrobe : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DStrobe, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int utics, int ltics, bool inSync);
|
||||
void Construct(sector_t *sector, int upper, int lower, int utics, int ltics);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_DarkTime;
|
||||
int m_BrightTime;
|
||||
};
|
||||
|
||||
class DGlow : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DGlow, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_Direction;
|
||||
};
|
||||
|
||||
// [RH] Glow from Light_Glow and Light_Fade specials
|
||||
class DGlow2 : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DGlow2, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int start, int end, int tics, bool oneshot);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Start;
|
||||
int m_End;
|
||||
int m_MaxTics;
|
||||
int m_Tics;
|
||||
bool m_OneShot;
|
||||
};
|
||||
|
||||
// [RH] Phased light thinker
|
||||
class DPhased : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DPhased, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int baselevel = 0, int phase = 0);
|
||||
// These are for internal use only but the Create template needs access to them.
|
||||
void Construct();
|
||||
void Propagate();
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
uint8_t m_BaseLevel;
|
||||
uint8_t m_Phase;
|
||||
private:
|
||||
int PhaseHelper(sector_t *sector, int index, int light, sector_t *prev);
|
||||
};
|
184
src/g_shared/a_lighttransfer.cpp
Normal file
184
src/g_shared/a_lighttransfer.cpp
Normal file
|
@ -0,0 +1,184 @@
|
|||
/*
|
||||
** a_lighttransfer.cpp
|
||||
**
|
||||
**---------------------------------------------------------------------------
|
||||
** Copyright 1998-2016 Randy Heit
|
||||
** Copyright 2003-2018 Christoph Oelckers
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions
|
||||
** are met:
|
||||
**
|
||||
** 1. Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** 2. Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** 3. The name of the author may not be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**---------------------------------------------------------------------------
|
||||
**
|
||||
*/
|
||||
|
||||
#include "p_spec.h"
|
||||
#include "a_lighttransfer.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
//
|
||||
// SPECIAL SPAWNING
|
||||
//
|
||||
|
||||
IMPLEMENT_CLASS(DLightTransfer, false, false)
|
||||
|
||||
void DLightTransfer::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc("lastlight", LastLight)
|
||||
("source", Source)
|
||||
("targettag", TargetTag)
|
||||
("copyfloor", CopyFloor);
|
||||
}
|
||||
|
||||
void DLightTransfer::Construct(sector_t *srcSec, int target, bool copyFloor)
|
||||
{
|
||||
int secnum;
|
||||
|
||||
Source = srcSec;
|
||||
TargetTag = target;
|
||||
CopyFloor = copyFloor;
|
||||
DoTransfer (LastLight = srcSec->lightlevel, target, copyFloor);
|
||||
|
||||
if (copyFloor)
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
void DLightTransfer::Tick ()
|
||||
{
|
||||
int light = Source->lightlevel;
|
||||
|
||||
if (light != LastLight)
|
||||
{
|
||||
LastLight = light;
|
||||
DoTransfer (light, TargetTag, CopyFloor);
|
||||
}
|
||||
}
|
||||
|
||||
void DLightTransfer::DoTransfer (int llevel, int target, bool floor)
|
||||
{
|
||||
int secnum;
|
||||
|
||||
if (floor)
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].SetPlaneLight(sector_t::floor, llevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].SetPlaneLight(sector_t::ceiling, llevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_CLASS(DWallLightTransfer, false, false)
|
||||
|
||||
void DWallLightTransfer::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc("lastlight", LastLight)
|
||||
("source", Source)
|
||||
("targetid", TargetID)
|
||||
("flags", Flags);
|
||||
}
|
||||
|
||||
void DWallLightTransfer::Construct(sector_t *srcSec, int target, uint8_t flags)
|
||||
{
|
||||
int linenum;
|
||||
int wallflags;
|
||||
|
||||
Source = srcSec;
|
||||
TargetID = target;
|
||||
Flags = flags;
|
||||
DoTransfer (LastLight = srcSec->GetLightLevel(), target, Flags);
|
||||
|
||||
if (!(flags & WLF_NOFAKECONTRAST))
|
||||
{
|
||||
wallflags = WALLF_ABSLIGHTING;
|
||||
}
|
||||
else
|
||||
{
|
||||
wallflags = WALLF_ABSLIGHTING | WALLF_NOFAKECONTRAST;
|
||||
}
|
||||
|
||||
auto itr = Level->GetLineIdIterator(target);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
if (flags & WLF_SIDE1 && Level->lines[linenum].sidedef[0] != NULL)
|
||||
{
|
||||
Level->lines[linenum].sidedef[0]->Flags |= wallflags;
|
||||
}
|
||||
|
||||
if (flags & WLF_SIDE2 && Level->lines[linenum].sidedef[1] != NULL)
|
||||
{
|
||||
Level->lines[linenum].sidedef[1]->Flags |= wallflags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DWallLightTransfer::Tick ()
|
||||
{
|
||||
short light = sector_t::ClampLight(Source->lightlevel);
|
||||
|
||||
if (light != LastLight)
|
||||
{
|
||||
LastLight = light;
|
||||
DoTransfer (light, TargetID, Flags);
|
||||
}
|
||||
}
|
||||
|
||||
void DWallLightTransfer::DoTransfer (short lightlevel, int target, uint8_t flags)
|
||||
{
|
||||
int linenum;
|
||||
|
||||
auto itr = Level->GetLineIdIterator(target);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
line_t *line = &Level->lines[linenum];
|
||||
|
||||
if (flags & WLF_SIDE1 && line->sidedef[0] != NULL)
|
||||
{
|
||||
line->sidedef[0]->SetLight(lightlevel);
|
||||
}
|
||||
|
||||
if (flags & WLF_SIDE2 && line->sidedef[1] != NULL)
|
||||
{
|
||||
line->sidedef[1]->SetLight(lightlevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
46
src/g_shared/a_lighttransfer.h
Normal file
46
src/g_shared/a_lighttransfer.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
class DLightTransfer : public DThinker
|
||||
{
|
||||
DECLARE_CLASS (DLightTransfer, DThinker)
|
||||
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_LIGHTTRANSFER;
|
||||
void Construct(sector_t *srcSec, int target, bool copyFloor);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
void DoTransfer (int level, int target, bool floor);
|
||||
|
||||
sector_t *Source;
|
||||
int TargetTag;
|
||||
bool CopyFloor;
|
||||
short LastLight;
|
||||
};
|
||||
|
||||
class DWallLightTransfer : public DThinker
|
||||
{
|
||||
enum
|
||||
{
|
||||
WLF_SIDE1=1,
|
||||
WLF_SIDE2=2,
|
||||
WLF_NOFAKECONTRAST=4
|
||||
};
|
||||
|
||||
DECLARE_CLASS (DWallLightTransfer, DThinker)
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_LIGHTTRANSFER;
|
||||
void Construct(sector_t *srcSec, int target, uint8_t flags);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
void DoTransfer (short level, int target, uint8_t flags);
|
||||
|
||||
sector_t *Source;
|
||||
int TargetID;
|
||||
short LastLight;
|
||||
uint8_t Flags;
|
||||
};
|
||||
|
37
src/g_shared/a_pillar.h
Normal file
37
src/g_shared/a_pillar.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#pragma once
|
||||
|
||||
//
|
||||
// [RH]
|
||||
// P_PILLAR
|
||||
//
|
||||
|
||||
class DPillar : public DMover
|
||||
{
|
||||
DECLARE_CLASS (DPillar, DMover)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
enum EPillar
|
||||
{
|
||||
pillarBuild,
|
||||
pillarOpen
|
||||
|
||||
};
|
||||
|
||||
void Construct (sector_t *sector, EPillar type, double speed, double height, double height2, int crush, bool hexencrush);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
void OnDestroy() override;
|
||||
|
||||
protected:
|
||||
EPillar m_Type;
|
||||
double m_FloorSpeed;
|
||||
double m_CeilingSpeed;
|
||||
double m_FloorTarget;
|
||||
double m_CeilingTarget;
|
||||
int m_Crush;
|
||||
bool m_Hexencrush;
|
||||
TObjPtr<DInterpolation*> m_Interp_Ceiling;
|
||||
TObjPtr<DInterpolation*> m_Interp_Floor;
|
||||
};
|
||||
|
60
src/g_shared/a_plats.h
Normal file
60
src/g_shared/a_plats.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
#pragma once
|
||||
|
||||
//
|
||||
// P_PLATS
|
||||
//
|
||||
class DPlat : public DMovingFloor
|
||||
{
|
||||
DECLARE_CLASS (DPlat, DMovingFloor)
|
||||
public:
|
||||
enum EPlatState
|
||||
{
|
||||
up,
|
||||
down,
|
||||
waiting,
|
||||
in_stasis
|
||||
};
|
||||
|
||||
enum EPlatType
|
||||
{
|
||||
platPerpetualRaise,
|
||||
platDownWaitUpStay,
|
||||
platDownWaitUpStayStone,
|
||||
platUpWaitDownStay,
|
||||
platUpNearestWaitDownStay,
|
||||
platDownByValue,
|
||||
platUpByValue,
|
||||
platUpByValueStay,
|
||||
platRaiseAndStay,
|
||||
platToggle,
|
||||
platDownToNearestFloor,
|
||||
platDownToLowestCeiling,
|
||||
platRaiseAndStayLockout,
|
||||
};
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
bool IsLift() const { return m_Type == platDownWaitUpStay || m_Type == platDownWaitUpStayStone; }
|
||||
void Construct(sector_t *sector);
|
||||
|
||||
protected:
|
||||
|
||||
double m_Speed;
|
||||
double m_Low;
|
||||
double m_High;
|
||||
int m_Wait;
|
||||
int m_Count;
|
||||
EPlatState m_Status;
|
||||
EPlatState m_OldStatus;
|
||||
int m_Crush;
|
||||
int m_Tag;
|
||||
EPlatType m_Type;
|
||||
|
||||
void PlayPlatSound (const char *sound);
|
||||
void Reactivate ();
|
||||
void Stop ();
|
||||
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
46
src/g_shared/a_pusher.h
Normal file
46
src/g_shared/a_pusher.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
// phares 3/20/98: added new model of Pushers for push/pull effects
|
||||
|
||||
class DPusher : public DThinker
|
||||
{
|
||||
DECLARE_CLASS (DPusher, DThinker)
|
||||
HAS_OBJECT_POINTERS
|
||||
|
||||
enum
|
||||
{
|
||||
PUSH_FACTOR = 128
|
||||
};
|
||||
|
||||
public:
|
||||
enum EPusher
|
||||
{
|
||||
p_push,
|
||||
p_pull,
|
||||
p_wind,
|
||||
p_current
|
||||
};
|
||||
|
||||
void Construct(EPusher type, line_t *l, int magnitude, int angle, AActor *source, int affectee);
|
||||
void Serialize(FSerializer &arc);
|
||||
int CheckForSectorMatch (EPusher type, int tag);
|
||||
void ChangeValues (int magnitude, int angle)
|
||||
{
|
||||
DAngle ang = angle * (360. / 256.);
|
||||
m_PushVec = ang.ToVector(magnitude);
|
||||
m_Magnitude = magnitude;
|
||||
}
|
||||
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
EPusher m_Type;
|
||||
TObjPtr<AActor*> m_Source;// Point source if point pusher
|
||||
DVector2 m_PushVec;
|
||||
double m_Magnitude; // Vector strength for point pusher
|
||||
double m_Radius; // Effective radius for point pusher
|
||||
int m_Affectee; // Number of affected sector
|
||||
|
||||
friend bool PIT_PushThing (AActor *thing);
|
||||
};
|
||||
|
42
src/g_shared/a_scroll.h
Normal file
42
src/g_shared/a_scroll.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// killough 3/7/98: Add generalized scroll effects
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class DScroller : public DThinker
|
||||
{
|
||||
DECLARE_CLASS (DScroller, DThinker)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_SCROLLER;
|
||||
|
||||
void Construct(EScroll type, double dx, double dy, sector_t *control, sector_t *sec, side_t *side, int accel, EScrollPos scrollpos = EScrollPos::scw_all);
|
||||
void Construct(double dx, double dy, const line_t *l, sector_t *control, int accel, EScrollPos scrollpos = EScrollPos::scw_all);
|
||||
void OnDestroy() override;
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
bool AffectsWall (side_t * wall) const { return m_Side == wall; }
|
||||
side_t *GetWall () const { return m_Side; }
|
||||
sector_t *GetSector() const { return m_Sector; }
|
||||
void SetRate (double dx, double dy) { m_dx = dx; m_dy = dy; }
|
||||
bool IsType (EScroll type) const { return type == m_Type; }
|
||||
EScrollPos GetScrollParts() const { return m_Parts; }
|
||||
|
||||
protected:
|
||||
EScroll m_Type; // Type of scroll effect
|
||||
double m_dx, m_dy; // (dx,dy) scroll speeds
|
||||
sector_t *m_Sector; // Affected sector
|
||||
side_t *m_Side; // ... or side
|
||||
sector_t *m_Controller; // Control sector (nullptr if none) used to control scrolling
|
||||
double m_LastHeight; // Last known height of control sector
|
||||
double m_vdx, m_vdy; // Accumulated velocity if accelerative
|
||||
int m_Accel; // Whether it's accelerative
|
||||
EScrollPos m_Parts; // Which parts of a sidedef are being scrolled?
|
||||
TObjPtr<DInterpolation*> m_Interpolations[3];
|
||||
};
|
||||
|
145
src/p_spec.cpp
145
src/p_spec.cpp
|
@ -683,151 +683,6 @@ void P_UpdateSpecials (FLevelLocals *Level)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// SPECIAL SPAWNING
|
||||
//
|
||||
|
||||
IMPLEMENT_CLASS(DLightTransfer, false, false)
|
||||
|
||||
void DLightTransfer::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc("lastlight", LastLight)
|
||||
("source", Source)
|
||||
("targettag", TargetTag)
|
||||
("copyfloor", CopyFloor);
|
||||
}
|
||||
|
||||
void DLightTransfer::Construct(sector_t *srcSec, int target, bool copyFloor)
|
||||
{
|
||||
int secnum;
|
||||
|
||||
Source = srcSec;
|
||||
TargetTag = target;
|
||||
CopyFloor = copyFloor;
|
||||
DoTransfer (LastLight = srcSec->lightlevel, target, copyFloor);
|
||||
|
||||
if (copyFloor)
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].ChangeFlags(sector_t::floor, 0, PLANEF_ABSLIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].ChangeFlags(sector_t::ceiling, 0, PLANEF_ABSLIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
void DLightTransfer::Tick ()
|
||||
{
|
||||
int light = Source->lightlevel;
|
||||
|
||||
if (light != LastLight)
|
||||
{
|
||||
LastLight = light;
|
||||
DoTransfer (light, TargetTag, CopyFloor);
|
||||
}
|
||||
}
|
||||
|
||||
void DLightTransfer::DoTransfer (int llevel, int target, bool floor)
|
||||
{
|
||||
int secnum;
|
||||
|
||||
if (floor)
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].SetPlaneLight(sector_t::floor, llevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto itr = Level->GetSectorTagIterator(target);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
Level->sectors[secnum].SetPlaneLight(sector_t::ceiling, llevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IMPLEMENT_CLASS(DWallLightTransfer, false, false)
|
||||
|
||||
void DWallLightTransfer::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc("lastlight", LastLight)
|
||||
("source", Source)
|
||||
("targetid", TargetID)
|
||||
("flags", Flags);
|
||||
}
|
||||
|
||||
void DWallLightTransfer::Construct(sector_t *srcSec, int target, uint8_t flags)
|
||||
{
|
||||
int linenum;
|
||||
int wallflags;
|
||||
|
||||
Source = srcSec;
|
||||
TargetID = target;
|
||||
Flags = flags;
|
||||
DoTransfer (LastLight = srcSec->GetLightLevel(), target, Flags);
|
||||
|
||||
if (!(flags & WLF_NOFAKECONTRAST))
|
||||
{
|
||||
wallflags = WALLF_ABSLIGHTING;
|
||||
}
|
||||
else
|
||||
{
|
||||
wallflags = WALLF_ABSLIGHTING | WALLF_NOFAKECONTRAST;
|
||||
}
|
||||
|
||||
auto itr = Level->GetLineIdIterator(target);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
if (flags & WLF_SIDE1 && Level->lines[linenum].sidedef[0] != NULL)
|
||||
{
|
||||
Level->lines[linenum].sidedef[0]->Flags |= wallflags;
|
||||
}
|
||||
|
||||
if (flags & WLF_SIDE2 && Level->lines[linenum].sidedef[1] != NULL)
|
||||
{
|
||||
Level->lines[linenum].sidedef[1]->Flags |= wallflags;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DWallLightTransfer::Tick ()
|
||||
{
|
||||
short light = sector_t::ClampLight(Source->lightlevel);
|
||||
|
||||
if (light != LastLight)
|
||||
{
|
||||
LastLight = light;
|
||||
DoTransfer (light, TargetID, Flags);
|
||||
}
|
||||
}
|
||||
|
||||
void DWallLightTransfer::DoTransfer (short lightlevel, int target, uint8_t flags)
|
||||
{
|
||||
int linenum;
|
||||
|
||||
auto itr = Level->GetLineIdIterator(target);
|
||||
while ((linenum = itr.Next()) >= 0)
|
||||
{
|
||||
line_t *line = &Level->lines[linenum];
|
||||
|
||||
if (flags & WLF_SIDE1 && line->sidedef[0] != NULL)
|
||||
{
|
||||
line->sidedef[0]->SetLight(lightlevel);
|
||||
}
|
||||
|
||||
if (flags & WLF_SIDE2 && line->sidedef[1] != NULL)
|
||||
{
|
||||
line->sidedef[1]->SetLight(lightlevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FRICTION EFFECTS
|
||||
|
|
354
src/p_spec.h
354
src/p_spec.h
|
@ -115,13 +115,6 @@ inline sector_t *getNextSector (line_t *line, const sector_t *sec)
|
|||
|
||||
#include "p_tags.h"
|
||||
|
||||
class DLighting : public DSectorEffect
|
||||
{
|
||||
DECLARE_CLASS(DLighting, DSectorEffect)
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_LIGHT;
|
||||
};
|
||||
|
||||
//
|
||||
// P_SWITCH
|
||||
//
|
||||
|
@ -131,350 +124,11 @@ public:
|
|||
bool P_ChangeSwitchTexture (side_t *side, int useAgain, uint8_t special, bool *quest=NULL);
|
||||
bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno, const DVector3 *optpos = NULL);
|
||||
|
||||
//
|
||||
// P_PLATS
|
||||
//
|
||||
class DPlat : public DMovingFloor
|
||||
{
|
||||
DECLARE_CLASS (DPlat, DMovingFloor)
|
||||
public:
|
||||
enum EPlatState
|
||||
{
|
||||
up,
|
||||
down,
|
||||
waiting,
|
||||
in_stasis
|
||||
};
|
||||
|
||||
enum EPlatType
|
||||
{
|
||||
platPerpetualRaise,
|
||||
platDownWaitUpStay,
|
||||
platDownWaitUpStayStone,
|
||||
platUpWaitDownStay,
|
||||
platUpNearestWaitDownStay,
|
||||
platDownByValue,
|
||||
platUpByValue,
|
||||
platUpByValueStay,
|
||||
platRaiseAndStay,
|
||||
platToggle,
|
||||
platDownToNearestFloor,
|
||||
platDownToLowestCeiling,
|
||||
platRaiseAndStayLockout,
|
||||
};
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
bool IsLift() const { return m_Type == platDownWaitUpStay || m_Type == platDownWaitUpStayStone; }
|
||||
void Construct(sector_t *sector);
|
||||
|
||||
protected:
|
||||
|
||||
double m_Speed;
|
||||
double m_Low;
|
||||
double m_High;
|
||||
int m_Wait;
|
||||
int m_Count;
|
||||
EPlatState m_Status;
|
||||
EPlatState m_OldStatus;
|
||||
int m_Crush;
|
||||
int m_Tag;
|
||||
EPlatType m_Type;
|
||||
|
||||
void PlayPlatSound (const char *sound);
|
||||
void Reactivate ();
|
||||
void Stop ();
|
||||
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
||||
//
|
||||
// [RH]
|
||||
// P_PILLAR
|
||||
//
|
||||
|
||||
class DPillar : public DMover
|
||||
{
|
||||
DECLARE_CLASS (DPillar, DMover)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
enum EPillar
|
||||
{
|
||||
pillarBuild,
|
||||
pillarOpen
|
||||
|
||||
};
|
||||
|
||||
void Construct (sector_t *sector, EPillar type, double speed, double height, double height2, int crush, bool hexencrush);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
void OnDestroy() override;
|
||||
|
||||
protected:
|
||||
EPillar m_Type;
|
||||
double m_FloorSpeed;
|
||||
double m_CeilingSpeed;
|
||||
double m_FloorTarget;
|
||||
double m_CeilingTarget;
|
||||
int m_Crush;
|
||||
bool m_Hexencrush;
|
||||
TObjPtr<DInterpolation*> m_Interp_Ceiling;
|
||||
TObjPtr<DInterpolation*> m_Interp_Floor;
|
||||
};
|
||||
|
||||
#include "a_plats.h"
|
||||
#include "a_pillar.h"
|
||||
#include "a_doors.h"
|
||||
//
|
||||
// P_CEILING
|
||||
//
|
||||
|
||||
// [RH] Changed these
|
||||
class DCeiling : public DMovingCeiling
|
||||
{
|
||||
DECLARE_CLASS (DCeiling, DMovingCeiling)
|
||||
public:
|
||||
enum ECeiling
|
||||
{
|
||||
ceilLowerByValue,
|
||||
ceilRaiseByValue,
|
||||
ceilMoveToValue,
|
||||
ceilLowerToHighestFloor,
|
||||
ceilLowerInstant,
|
||||
ceilRaiseInstant,
|
||||
ceilCrushAndRaise,
|
||||
ceilLowerAndCrush,
|
||||
ceil_placeholder,
|
||||
ceilCrushRaiseAndStay,
|
||||
ceilRaiseToNearest,
|
||||
ceilLowerToLowest,
|
||||
ceilLowerToFloor,
|
||||
|
||||
// The following are only used by Generic_Ceiling
|
||||
ceilRaiseToHighest,
|
||||
ceilLowerToHighest,
|
||||
ceilRaiseToLowest,
|
||||
ceilLowerToNearest,
|
||||
ceilRaiseToHighestFloor,
|
||||
ceilRaiseToFloor,
|
||||
ceilRaiseByTexture,
|
||||
ceilLowerByTexture,
|
||||
|
||||
genCeilingChg0,
|
||||
genCeilingChgT,
|
||||
genCeilingChg
|
||||
};
|
||||
|
||||
enum class ECrushMode
|
||||
{
|
||||
crushDoom = 0,
|
||||
crushHexen = 1,
|
||||
crushSlowdown = 2
|
||||
};
|
||||
|
||||
|
||||
void Construct(sector_t *sec);
|
||||
void Construct(sector_t *sec, double speed1, double speed2, int silent);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
ECeiling m_Type;
|
||||
double m_BottomHeight;
|
||||
double m_TopHeight;
|
||||
double m_Speed;
|
||||
double m_Speed1; // [RH] dnspeed of crushers
|
||||
double m_Speed2; // [RH] upspeed of crushers
|
||||
int m_Crush;
|
||||
ECrushMode m_CrushMode;
|
||||
int m_Silent;
|
||||
int m_Direction; // 1 = up, 0 = waiting, -1 = down
|
||||
|
||||
// [RH] Need these for BOOM-ish transferring ceilings
|
||||
FTextureID m_Texture;
|
||||
secspecial_t m_NewSpecial{};
|
||||
|
||||
// ID
|
||||
int m_Tag;
|
||||
int m_OldDirection;
|
||||
|
||||
void PlayCeilingSound ();
|
||||
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
||||
//
|
||||
// P_FLOOR
|
||||
//
|
||||
|
||||
class DFloor : public DMovingFloor
|
||||
{
|
||||
DECLARE_CLASS (DFloor, DMovingFloor)
|
||||
public:
|
||||
enum EFloor
|
||||
{
|
||||
floorLowerToLowest,
|
||||
floorLowerToNearest,
|
||||
floorLowerToHighest,
|
||||
floorLowerByValue,
|
||||
floorRaiseByValue,
|
||||
floorRaiseToHighest,
|
||||
floorRaiseToNearest,
|
||||
floorRaiseAndCrush,
|
||||
floorRaiseAndCrushDoom,
|
||||
floorCrushStop,
|
||||
floorLowerInstant,
|
||||
floorRaiseInstant,
|
||||
floorMoveToValue,
|
||||
floorRaiseToLowestCeiling,
|
||||
floorRaiseByTexture,
|
||||
|
||||
floorLowerAndChange,
|
||||
floorRaiseAndChange,
|
||||
|
||||
floorRaiseToLowest,
|
||||
floorRaiseToCeiling,
|
||||
floorLowerToLowestCeiling,
|
||||
floorLowerByTexture,
|
||||
floorLowerToCeiling,
|
||||
|
||||
donutRaise,
|
||||
|
||||
buildStair,
|
||||
waitStair,
|
||||
resetStair,
|
||||
|
||||
// Not to be used as parameters to EV_DoFloor()
|
||||
genFloorChg0,
|
||||
genFloorChgT,
|
||||
genFloorChg
|
||||
};
|
||||
|
||||
// [RH] Changed to use Hexen-ish specials
|
||||
enum EStair
|
||||
{
|
||||
buildUp,
|
||||
buildDown
|
||||
};
|
||||
|
||||
enum EStairType
|
||||
{
|
||||
stairUseSpecials = 1,
|
||||
stairSync = 2,
|
||||
stairCrush = 4,
|
||||
};
|
||||
|
||||
void Construct(sector_t *sec);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
//protected:
|
||||
EFloor m_Type;
|
||||
int m_Crush;
|
||||
bool m_Hexencrush;
|
||||
bool m_Instant;
|
||||
int m_Direction;
|
||||
secspecial_t m_NewSpecial{};
|
||||
FTextureID m_Texture;
|
||||
double m_FloorDestDist;
|
||||
double m_Speed;
|
||||
|
||||
// [RH] New parameters used to reset and delay stairs
|
||||
double m_OrgDist;
|
||||
int m_ResetCount;
|
||||
int m_Delay;
|
||||
int m_PauseTime;
|
||||
int m_StepTime;
|
||||
int m_PerStepTime;
|
||||
|
||||
void StartFloorSound ();
|
||||
void SetFloorChangeType (sector_t *sec, int change);
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
||||
class DElevator : public DMover
|
||||
{
|
||||
DECLARE_CLASS (DElevator, DMover)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
enum EElevator
|
||||
{
|
||||
elevateUp,
|
||||
elevateDown,
|
||||
elevateCurrent,
|
||||
// [RH] For FloorAndCeiling_Raise/Lower
|
||||
elevateRaise,
|
||||
elevateLower
|
||||
};
|
||||
|
||||
void Construct(sector_t *sec);
|
||||
|
||||
void OnDestroy() override;
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
EElevator m_Type;
|
||||
int m_Direction;
|
||||
double m_FloorDestDist;
|
||||
double m_CeilingDestDist;
|
||||
double m_Speed;
|
||||
TObjPtr<DInterpolation*> m_Interp_Ceiling;
|
||||
TObjPtr<DInterpolation*> m_Interp_Floor;
|
||||
|
||||
void StartFloorSound ();
|
||||
friend struct FLevelLocals;
|
||||
};
|
||||
|
||||
|
||||
class DWaggleBase : public DMover
|
||||
{
|
||||
DECLARE_CLASS (DWaggleBase, DMover)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
void Construct(sector_t *sec);
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
|
||||
protected:
|
||||
double m_OriginalDist;
|
||||
double m_Accumulator;
|
||||
double m_AccDelta;
|
||||
double m_TargetScale;
|
||||
double m_Scale;
|
||||
double m_ScaleDelta;
|
||||
int m_Ticker;
|
||||
int m_State;
|
||||
|
||||
friend struct FLevelLocals;
|
||||
void DoWaggle (bool ceiling);
|
||||
};
|
||||
|
||||
class DFloorWaggle : public DWaggleBase
|
||||
{
|
||||
DECLARE_CLASS (DFloorWaggle, DWaggleBase)
|
||||
public:
|
||||
void Construct(sector_t *sec);
|
||||
void Tick ();
|
||||
};
|
||||
|
||||
class DCeilingWaggle : public DWaggleBase
|
||||
{
|
||||
DECLARE_CLASS (DCeilingWaggle, DWaggleBase)
|
||||
public:
|
||||
void Construct(sector_t *sec);
|
||||
void Tick ();
|
||||
};
|
||||
|
||||
//jff 3/15/98 pure texture/type change for better generalized support
|
||||
enum EChange
|
||||
{
|
||||
trigChangeOnly,
|
||||
numChangeOnly,
|
||||
};
|
||||
|
||||
#include "a_ceiling.h"
|
||||
#include "a_floor.h"
|
||||
//
|
||||
// P_TELEPT
|
||||
//
|
||||
|
|
|
@ -2,240 +2,7 @@
|
|||
|
||||
#include "p_spec.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
class DLightTransfer : public DThinker
|
||||
{
|
||||
DECLARE_CLASS (DLightTransfer, DThinker)
|
||||
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_LIGHTTRANSFER;
|
||||
void Construct(sector_t *srcSec, int target, bool copyFloor);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
void DoTransfer (int level, int target, bool floor);
|
||||
|
||||
sector_t *Source;
|
||||
int TargetTag;
|
||||
bool CopyFloor;
|
||||
short LastLight;
|
||||
};
|
||||
|
||||
class DWallLightTransfer : public DThinker
|
||||
{
|
||||
enum
|
||||
{
|
||||
WLF_SIDE1=1,
|
||||
WLF_SIDE2=2,
|
||||
WLF_NOFAKECONTRAST=4
|
||||
};
|
||||
|
||||
DECLARE_CLASS (DWallLightTransfer, DThinker)
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_LIGHTTRANSFER;
|
||||
void Construct(sector_t *srcSec, int target, uint8_t flags);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
void DoTransfer (short level, int target, uint8_t flags);
|
||||
|
||||
sector_t *Source;
|
||||
int TargetID;
|
||||
short LastLight;
|
||||
uint8_t Flags;
|
||||
};
|
||||
|
||||
|
||||
class DFireFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DFireFlicker, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector);
|
||||
void Construct(sector_t *sector, int upper, int lower);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
};
|
||||
|
||||
class DFlicker : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DFlicker, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int upper, int lower);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
};
|
||||
|
||||
class DLightFlash : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DLightFlash, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector);
|
||||
void Construct(sector_t *sector, int min, int max);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MaxLight;
|
||||
int m_MinLight;
|
||||
int m_MaxTime;
|
||||
int m_MinTime;
|
||||
};
|
||||
|
||||
class DStrobe : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DStrobe, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int utics, int ltics, bool inSync);
|
||||
void Construct(sector_t *sector, int upper, int lower, int utics, int ltics);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Count;
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_DarkTime;
|
||||
int m_BrightTime;
|
||||
};
|
||||
|
||||
class DGlow : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DGlow, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_MinLight;
|
||||
int m_MaxLight;
|
||||
int m_Direction;
|
||||
};
|
||||
|
||||
// [RH] Glow from Light_Glow and Light_Fade specials
|
||||
class DGlow2 : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DGlow2, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int start, int end, int tics, bool oneshot);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
int m_Start;
|
||||
int m_End;
|
||||
int m_MaxTics;
|
||||
int m_Tics;
|
||||
bool m_OneShot;
|
||||
};
|
||||
|
||||
// [RH] Phased light thinker
|
||||
class DPhased : public DLighting
|
||||
{
|
||||
DECLARE_CLASS(DPhased, DLighting)
|
||||
public:
|
||||
void Construct(sector_t *sector, int baselevel = 0, int phase = 0);
|
||||
// These are for internal use only but the Create template needs access to them.
|
||||
void Construct();
|
||||
void Propagate();
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
protected:
|
||||
uint8_t m_BaseLevel;
|
||||
uint8_t m_Phase;
|
||||
private:
|
||||
int PhaseHelper(sector_t *sector, int index, int light, sector_t *prev);
|
||||
};
|
||||
|
||||
// phares 3/20/98: added new model of Pushers for push/pull effects
|
||||
|
||||
class DPusher : public DThinker
|
||||
{
|
||||
DECLARE_CLASS (DPusher, DThinker)
|
||||
HAS_OBJECT_POINTERS
|
||||
|
||||
enum
|
||||
{
|
||||
PUSH_FACTOR = 128
|
||||
};
|
||||
|
||||
public:
|
||||
enum EPusher
|
||||
{
|
||||
p_push,
|
||||
p_pull,
|
||||
p_wind,
|
||||
p_current
|
||||
};
|
||||
|
||||
void Construct(EPusher type, line_t *l, int magnitude, int angle, AActor *source, int affectee);
|
||||
void Serialize(FSerializer &arc);
|
||||
int CheckForSectorMatch (EPusher type, int tag);
|
||||
void ChangeValues (int magnitude, int angle)
|
||||
{
|
||||
DAngle ang = angle * (360. / 256.);
|
||||
m_PushVec = ang.ToVector(magnitude);
|
||||
m_Magnitude = magnitude;
|
||||
}
|
||||
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
EPusher m_Type;
|
||||
TObjPtr<AActor*> m_Source;// Point source if point pusher
|
||||
DVector2 m_PushVec;
|
||||
double m_Magnitude; // Vector strength for point pusher
|
||||
double m_Radius; // Effective radius for point pusher
|
||||
int m_Affectee; // Number of affected sector
|
||||
|
||||
friend bool PIT_PushThing (AActor *thing);
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// killough 3/7/98: Add generalized scroll effects
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class DScroller : public DThinker
|
||||
{
|
||||
DECLARE_CLASS (DScroller, DThinker)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
static const int DEFAULT_STAT = STAT_SCROLLER;
|
||||
|
||||
void Construct(EScroll type, double dx, double dy, sector_t *control, sector_t *sec, side_t *side, int accel, EScrollPos scrollpos = EScrollPos::scw_all);
|
||||
void Construct(double dx, double dy, const line_t *l, sector_t *control, int accel, EScrollPos scrollpos = EScrollPos::scw_all);
|
||||
void OnDestroy() override;
|
||||
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
bool AffectsWall (side_t * wall) const { return m_Side == wall; }
|
||||
side_t *GetWall () const { return m_Side; }
|
||||
sector_t *GetSector() const { return m_Sector; }
|
||||
void SetRate (double dx, double dy) { m_dx = dx; m_dy = dy; }
|
||||
bool IsType (EScroll type) const { return type == m_Type; }
|
||||
EScrollPos GetScrollParts() const { return m_Parts; }
|
||||
|
||||
protected:
|
||||
EScroll m_Type; // Type of scroll effect
|
||||
double m_dx, m_dy; // (dx,dy) scroll speeds
|
||||
sector_t *m_Sector; // Affected sector
|
||||
side_t *m_Side; // ... or side
|
||||
sector_t *m_Controller; // Control sector (nullptr if none) used to control scrolling
|
||||
double m_LastHeight; // Last known height of control sector
|
||||
double m_vdx, m_vdy; // Accumulated velocity if accelerative
|
||||
int m_Accel; // Whether it's accelerative
|
||||
EScrollPos m_Parts; // Which parts of a sidedef are being scrolled?
|
||||
TObjPtr<DInterpolation*> m_Interpolations[3];
|
||||
};
|
||||
|
||||
#include "a_lighttransfer.h"
|
||||
#include "a_lights.h"
|
||||
#include "a_pusher.h"
|
||||
#include "a_scroll.h"
|
||||
|
|
Loading…
Reference in a new issue