mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- reviewed and sorted out the remaining parts of g_shared
This commit is contained in:
parent
0b4862480e
commit
25d5b788f5
6 changed files with 333 additions and 68 deletions
|
@ -36,6 +36,9 @@
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
|
|
||||||
|
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
|
||||||
|
|
||||||
|
|
||||||
CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
for (auto Level : AllLevels())
|
for (auto Level : AllLevels())
|
||||||
|
@ -45,4 +48,43 @@ CUSTOM_CVAR (Bool, gl_lights, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOIN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CUSTOM_CVAR(Int, sv_corpsequeuesize, 64, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
||||||
|
{
|
||||||
|
if (self > 0)
|
||||||
|
{
|
||||||
|
for (auto Level : AllLevels())
|
||||||
|
{
|
||||||
|
auto &corpsequeue = Level->CorpseQueue;
|
||||||
|
while (corpsequeue.Size() > (unsigned)self)
|
||||||
|
{
|
||||||
|
AActor *corpse = corpsequeue[0];
|
||||||
|
if (corpse) corpse->Destroy();
|
||||||
|
corpsequeue.Delete(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE)
|
||||||
|
{
|
||||||
|
if (self < 0)
|
||||||
|
{
|
||||||
|
self = 0;
|
||||||
|
}
|
||||||
|
else for (auto Level : AllLevels())
|
||||||
|
{
|
||||||
|
while (Level->ImpactDecalCount > self)
|
||||||
|
{
|
||||||
|
DThinker *thinker = Level->FirstThinker(STAT_AUTODECAL);
|
||||||
|
if (thinker != NULL)
|
||||||
|
{
|
||||||
|
thinker->Destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -98,3 +98,30 @@ CCMD(listlights)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CCMD (countdecals)
|
||||||
|
{
|
||||||
|
for (auto Level : AllLevels())
|
||||||
|
{
|
||||||
|
auto iterator = Level->GetThinkerIterator<DImpactDecal>(NAME_None, STAT_AUTODECAL);
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
while (iterator.Next())
|
||||||
|
count++;
|
||||||
|
|
||||||
|
Printf("%s: Counted %d impact decals\n", Level->MapName.GetChars(), count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCMD (spray)
|
||||||
|
{
|
||||||
|
if (who == NULL || argv.argc() < 2)
|
||||||
|
{
|
||||||
|
Printf ("Usage: spray <decal>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Net_WriteByte (DEM_SPRAY);
|
||||||
|
Net_WriteString (argv[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
#include "actorinlines.h"
|
#include "actorinlines.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR(Int, sv_corpsequeuesize)
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// PROC A_NoBlocking
|
// PROC A_NoBlocking
|
||||||
|
@ -88,25 +90,6 @@ void A_Unblock(AActor *self, bool drop)
|
||||||
//
|
//
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
CUSTOM_CVAR(Int, sv_corpsequeuesize, 64, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
|
||||||
{
|
|
||||||
if (self > 0)
|
|
||||||
{
|
|
||||||
for (auto Level : AllLevels())
|
|
||||||
{
|
|
||||||
auto &corpsequeue = Level->CorpseQueue;
|
|
||||||
while (corpsequeue.Size() > (unsigned)self)
|
|
||||||
{
|
|
||||||
AActor *corpse = corpsequeue[0];
|
|
||||||
if (corpse) corpse->Destroy();
|
|
||||||
corpsequeue.Delete(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// throw another corpse on the queue
|
// throw another corpse on the queue
|
||||||
DEFINE_ACTION_FUNCTION(AActor, A_QueueCorpse)
|
DEFINE_ACTION_FUNCTION(AActor, A_QueueCorpse)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,16 @@
|
||||||
#include "g_levellocals.h"
|
#include "g_levellocals.h"
|
||||||
#include "vm.h"
|
#include "vm.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR (Bool, cl_spreaddecals)
|
||||||
|
EXTERN_CVAR (Int, cl_maxdecals)
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct SpreadInfo
|
struct SpreadInfo
|
||||||
{
|
{
|
||||||
double DecalWidth, DecalLeft, DecalRight;
|
double DecalWidth, DecalLeft, DecalRight;
|
||||||
|
@ -54,7 +64,12 @@ struct SpreadInfo
|
||||||
TArray<side_t *> SpreadStack;
|
TArray<side_t *> SpreadStack;
|
||||||
};
|
};
|
||||||
|
|
||||||
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DBaseDecal, false, true)
|
IMPLEMENT_CLASS(DBaseDecal, false, true)
|
||||||
|
|
||||||
|
@ -65,6 +80,12 @@ IMPLEMENT_POINTERS_END
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DImpactDecal, false, false)
|
IMPLEMENT_CLASS(DImpactDecal, false, false)
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::Construct(double z)
|
void DBaseDecal::Construct(double z)
|
||||||
{
|
{
|
||||||
Z = z;
|
Z = z;
|
||||||
|
@ -72,6 +93,12 @@ void DBaseDecal::Construct(double z)
|
||||||
PicNum.SetInvalid();
|
PicNum.SetInvalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::Construct(const AActor *basis)
|
void DBaseDecal::Construct(const AActor *basis)
|
||||||
{
|
{
|
||||||
Z = basis->Z();
|
Z = basis->Z();
|
||||||
|
@ -85,6 +112,12 @@ void DBaseDecal::Construct(const AActor *basis)
|
||||||
RenderStyle = basis->RenderStyle;
|
RenderStyle = basis->RenderStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::Construct(const DBaseDecal *basis)
|
void DBaseDecal::Construct(const DBaseDecal *basis)
|
||||||
{
|
{
|
||||||
LeftDistance = basis->LeftDistance;
|
LeftDistance = basis->LeftDistance;
|
||||||
|
@ -100,12 +133,24 @@ void DBaseDecal::Construct(const DBaseDecal *basis)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::OnDestroy ()
|
void DBaseDecal::OnDestroy ()
|
||||||
{
|
{
|
||||||
Remove ();
|
Remove ();
|
||||||
Super::OnDestroy();
|
Super::OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::Remove ()
|
void DBaseDecal::Remove ()
|
||||||
{
|
{
|
||||||
if (WallPrev == nullptr)
|
if (WallPrev == nullptr)
|
||||||
|
@ -120,6 +165,12 @@ void DBaseDecal::Remove ()
|
||||||
WallNext = nullptr;
|
WallNext = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::Serialize(FSerializer &arc)
|
void DBaseDecal::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
|
@ -139,6 +190,12 @@ void DBaseDecal::Serialize(FSerializer &arc)
|
||||||
("sector", Sector);
|
("sector", Sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::GetXY (side_t *wall, double &ox, double &oy) const
|
void DBaseDecal::GetXY (side_t *wall, double &ox, double &oy) const
|
||||||
{
|
{
|
||||||
line_t *line = wall->linedef;
|
line_t *line = wall->linedef;
|
||||||
|
@ -162,18 +219,35 @@ void DBaseDecal::GetXY (side_t *wall, double &ox, double &oy) const
|
||||||
oy = v1->fY() + LeftDistance * dy;
|
oy = v1->fY() + LeftDistance * dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::SetShade (uint32_t rgb)
|
void DBaseDecal::SetShade (uint32_t rgb)
|
||||||
{
|
{
|
||||||
PalEntry *entry = (PalEntry *)&rgb;
|
PalEntry *entry = (PalEntry *)&rgb;
|
||||||
AlphaColor = rgb | (ColorMatcher.Pick (entry->r, entry->g, entry->b) << 24);
|
AlphaColor = rgb | (ColorMatcher.Pick (entry->r, entry->g, entry->b) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::SetShade (int r, int g, int b)
|
void DBaseDecal::SetShade (int r, int g, int b)
|
||||||
{
|
{
|
||||||
AlphaColor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
|
AlphaColor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
// Returns the texture the decal stuck to.
|
// Returns the texture the decal stuck to.
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *ffloor)
|
FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *ffloor)
|
||||||
{
|
{
|
||||||
Side = wall;
|
Side = wall;
|
||||||
|
@ -265,6 +339,12 @@ FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *
|
||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
double DBaseDecal::GetRealZ (const side_t *wall) const
|
double DBaseDecal::GetRealZ (const side_t *wall) const
|
||||||
{
|
{
|
||||||
const line_t *line = wall->linedef;
|
const line_t *line = wall->linedef;
|
||||||
|
@ -319,6 +399,12 @@ double DBaseDecal::GetRealZ (const side_t *wall) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::CalcFracPos (side_t *wall, double x, double y)
|
void DBaseDecal::CalcFracPos (side_t *wall, double x, double y)
|
||||||
{
|
{
|
||||||
line_t *line = wall->linedef;
|
line_t *line = wall->linedef;
|
||||||
|
@ -352,6 +438,12 @@ void DBaseDecal::CalcFracPos (side_t *wall, double x, double y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void GetWallStuff (side_t *wall, vertex_t *&v1, double &ldx, double &ldy)
|
static void GetWallStuff (side_t *wall, vertex_t *&v1, double &ldx, double &ldy)
|
||||||
{
|
{
|
||||||
line_t *line = wall->linedef;
|
line_t *line = wall->linedef;
|
||||||
|
@ -369,11 +461,23 @@ static void GetWallStuff (side_t *wall, vertex_t *&v1, double &ldx, double &ldy)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static double Length (double dx, double dy)
|
static double Length (double dx, double dy)
|
||||||
{
|
{
|
||||||
return DVector2(dx, dy).Length();
|
return DVector2(dx, dy).Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static side_t *NextWall (const side_t *wall)
|
static side_t *NextWall (const side_t *wall)
|
||||||
{
|
{
|
||||||
line_t *line = wall->linedef;
|
line_t *line = wall->linedef;
|
||||||
|
@ -392,6 +496,12 @@ static side_t *NextWall (const side_t *wall)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::SpreadLeft (double r, vertex_t *v1, side_t *feelwall, F3DFloor *ffloor, SpreadInfo *spread)
|
void DBaseDecal::SpreadLeft (double r, vertex_t *v1, side_t *feelwall, F3DFloor *ffloor, SpreadInfo *spread)
|
||||||
{
|
{
|
||||||
double ldx, ldy;
|
double ldx, ldy;
|
||||||
|
@ -436,6 +546,12 @@ void DBaseDecal::SpreadLeft (double r, vertex_t *v1, side_t *feelwall, F3DFloor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::SpreadRight (double r, side_t *feelwall, double wallsize, F3DFloor *ffloor, SpreadInfo *spread)
|
void DBaseDecal::SpreadRight (double r, side_t *feelwall, double wallsize, F3DFloor *ffloor, SpreadInfo *spread)
|
||||||
{
|
{
|
||||||
vertex_t *v1;
|
vertex_t *v1;
|
||||||
|
@ -476,6 +592,12 @@ void DBaseDecal::SpreadRight (double r, side_t *feelwall, double wallsize, F3DFl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor)
|
void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor)
|
||||||
{
|
{
|
||||||
SpreadInfo spread;
|
SpreadInfo spread;
|
||||||
|
@ -509,6 +631,12 @@ void DBaseDecal::Spread (const FDecalTemplate *tpl, side_t *wall, double x, doub
|
||||||
Length (wall->linedef->Delta().X, wall->linedef->Delta().Y), ffloor, &spread);
|
Length (wall->linedef->Delta().X, wall->linedef->Delta().Y), ffloor, &spread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double iy, double iz, side_t *wall, F3DFloor * ffloor) const
|
DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double iy, double iz, side_t *wall, F3DFloor * ffloor) const
|
||||||
{
|
{
|
||||||
DBaseDecal *decal = Level->CreateThinker<DBaseDecal>(iz);
|
DBaseDecal *decal = Level->CreateThinker<DBaseDecal>(iz);
|
||||||
|
@ -530,24 +658,11 @@ DBaseDecal *DBaseDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double
|
||||||
return decal;
|
return decal;
|
||||||
}
|
}
|
||||||
|
|
||||||
CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE)
|
//----------------------------------------------------------------------------
|
||||||
{
|
//
|
||||||
if (self < 0)
|
//
|
||||||
{
|
//
|
||||||
self = 0;
|
//----------------------------------------------------------------------------
|
||||||
}
|
|
||||||
else for (auto Level : AllLevels())
|
|
||||||
{
|
|
||||||
while (Level->ImpactDecalCount > self)
|
|
||||||
{
|
|
||||||
DThinker *thinker = Level->FirstThinker(STAT_AUTODECAL);
|
|
||||||
if (thinker != NULL)
|
|
||||||
{
|
|
||||||
thinker->Destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DImpactDecal::CheckMax ()
|
void DImpactDecal::CheckMax ()
|
||||||
{
|
{
|
||||||
|
@ -562,6 +677,12 @@ void DImpactDecal::CheckMax ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||||
{
|
{
|
||||||
if (cl_maxdecals > 0)
|
if (cl_maxdecals > 0)
|
||||||
|
@ -576,6 +697,12 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const char *name,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color)
|
||||||
{
|
{
|
||||||
DImpactDecal *decal = NULL;
|
DImpactDecal *decal = NULL;
|
||||||
|
@ -621,6 +748,12 @@ DImpactDecal *DImpactDecal::StaticCreate (FLevelLocals *Level, const FDecalTempl
|
||||||
return decal;
|
return decal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double iy, double iz, side_t *wall, F3DFloor * ffloor) const
|
DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, double iy, double iz, side_t *wall, F3DFloor * ffloor) const
|
||||||
{
|
{
|
||||||
if (wall->Flags & WALLF_NOAUTODECALS)
|
if (wall->Flags & WALLF_NOAUTODECALS)
|
||||||
|
@ -648,31 +781,11 @@ DBaseDecal *DImpactDecal::CloneSelf (const FDecalTemplate *tpl, double ix, doubl
|
||||||
return decal;
|
return decal;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCMD (countdecals)
|
//----------------------------------------------------------------------------
|
||||||
{
|
//
|
||||||
for (auto Level : AllLevels())
|
//
|
||||||
{
|
//
|
||||||
auto iterator = Level->GetThinkerIterator<DImpactDecal>(NAME_None, STAT_AUTODECAL);
|
//----------------------------------------------------------------------------
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
while (iterator.Next())
|
|
||||||
count++;
|
|
||||||
|
|
||||||
Printf("%s: Counted %d impact decals\n", Level->MapName.GetChars(), count);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CCMD (spray)
|
|
||||||
{
|
|
||||||
if (who == NULL || argv.argc() < 2)
|
|
||||||
{
|
|
||||||
Printf ("Usage: spray <decal>\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Net_WriteByte (DEM_SPRAY);
|
|
||||||
Net_WriteString (argv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SprayDecal(AActor *shooter, const char *name, double distance)
|
void SprayDecal(AActor *shooter, const char *name, double distance)
|
||||||
{
|
{
|
||||||
|
@ -692,6 +805,12 @@ void SprayDecal(AActor *shooter, const char *name, double distance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent)
|
DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t *sec, double x, double y, double z, DAngle angle, double tracedist, bool permanent)
|
||||||
{
|
{
|
||||||
if (tpl == NULL || (tpl = tpl->GetDecal()) == NULL)
|
if (tpl == NULL || (tpl = tpl->GetDecal()) == NULL)
|
||||||
|
@ -728,10 +847,14 @@ DBaseDecal *ShootDecal(FLevelLocals *Level, const FDecalTemplate *tpl, sector_t
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(ADecal, SpawnDecal)
|
//----------------------------------------------------------------------------
|
||||||
{
|
//
|
||||||
PARAM_SELF_PROLOGUE(AActor);
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void SpawnDecal(AActor *self)
|
||||||
|
{
|
||||||
const FDecalTemplate *tpl = nullptr;
|
const FDecalTemplate *tpl = nullptr;
|
||||||
|
|
||||||
if (self->args[0] < 0)
|
if (self->args[0] < 0)
|
||||||
|
@ -767,5 +890,11 @@ DEFINE_ACTION_FUNCTION(ADecal, SpawnDecal)
|
||||||
{
|
{
|
||||||
DPrintf (DMSG_ERROR, "Decal actor at (%f,%f) does not have a good template\n", self->X(), self->Y());
|
DPrintf (DMSG_ERROR, "Decal actor at (%f,%f) does not have a good template\n", self->X(), self->Y());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION_NATIVE(ADecal, SpawnDecal, SpawnDecal)
|
||||||
|
{
|
||||||
|
PARAM_SELF_PROLOGUE(AActor);
|
||||||
|
SpawnDecal(self);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,12 @@ IMPLEMENT_POINTERS_START(DFlashFader)
|
||||||
IMPLEMENT_POINTER(ForWho)
|
IMPLEMENT_POINTER(ForWho)
|
||||||
IMPLEMENT_POINTERS_END
|
IMPLEMENT_POINTERS_END
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DFlashFader::Construct (float r1, float g1, float b1, float a1,
|
void DFlashFader::Construct (float r1, float g1, float b1, float a1,
|
||||||
float r2, float g2, float b2, float a2,
|
float r2, float g2, float b2, float a2,
|
||||||
float time, AActor *who, bool terminate)
|
float time, AActor *who, bool terminate)
|
||||||
|
@ -55,6 +61,12 @@ void DFlashFader::Construct (float r1, float g1, float b1, float a1,
|
||||||
Terminate = terminate;
|
Terminate = terminate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DFlashFader::OnDestroy ()
|
void DFlashFader::OnDestroy ()
|
||||||
{
|
{
|
||||||
if (Terminate) Blends[1][3] = 0.f; // Needed in order to cancel out the secondary fade.
|
if (Terminate) Blends[1][3] = 0.f; // Needed in order to cancel out the secondary fade.
|
||||||
|
@ -62,6 +74,12 @@ void DFlashFader::OnDestroy ()
|
||||||
Super::OnDestroy();
|
Super::OnDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DFlashFader::Serialize(FSerializer &arc)
|
void DFlashFader::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
|
@ -71,6 +89,12 @@ void DFlashFader::Serialize(FSerializer &arc)
|
||||||
.Array("blends", Blends[0], 8);
|
.Array("blends", Blends[0], 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DFlashFader::Tick ()
|
void DFlashFader::Tick ()
|
||||||
{
|
{
|
||||||
if (ForWho == NULL || ForWho->player == NULL)
|
if (ForWho == NULL || ForWho->player == NULL)
|
||||||
|
@ -87,6 +111,12 @@ void DFlashFader::Tick ()
|
||||||
SetBlend (1.f - (float)RemainingTics / (float)TotalTics);
|
SetBlend (1.f - (float)RemainingTics / (float)TotalTics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DFlashFader::SetBlend (float time)
|
void DFlashFader::SetBlend (float time)
|
||||||
{
|
{
|
||||||
if (ForWho == NULL || ForWho->player == NULL)
|
if (ForWho == NULL || ForWho->player == NULL)
|
||||||
|
@ -101,6 +131,12 @@ void DFlashFader::SetBlend (float time)
|
||||||
player->BlendA = Blends[0][3]*iT + Blends[1][3]*time;
|
player->BlendA = Blends[0][3]*iT + Blends[1][3]*time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DFlashFader::Cancel ()
|
void DFlashFader::Cancel ()
|
||||||
{
|
{
|
||||||
RemainingTics = 0;
|
RemainingTics = 0;
|
||||||
|
|
|
@ -41,6 +41,12 @@ static FRandom pr_lightning ("Lightning");
|
||||||
|
|
||||||
IMPLEMENT_CLASS(DLightningThinker, false, false)
|
IMPLEMENT_CLASS(DLightningThinker, false, false)
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DLightningThinker::Construct()
|
void DLightningThinker::Construct()
|
||||||
{
|
{
|
||||||
Stopped = false;
|
Stopped = false;
|
||||||
|
@ -55,6 +61,12 @@ DLightningThinker::~DLightningThinker ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DLightningThinker::Serialize(FSerializer &arc)
|
void DLightningThinker::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
|
@ -64,6 +76,12 @@ void DLightningThinker::Serialize(FSerializer &arc)
|
||||||
("levels", LightningLightLevels);
|
("levels", LightningLightLevels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DLightningThinker::Tick ()
|
void DLightningThinker::Tick ()
|
||||||
{
|
{
|
||||||
if (!NextLightningFlash || LightningFlashCount)
|
if (!NextLightningFlash || LightningFlashCount)
|
||||||
|
@ -77,6 +95,12 @@ void DLightningThinker::Tick ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DLightningThinker::LightningFlash ()
|
void DLightningThinker::LightningFlash ()
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -179,6 +203,12 @@ void DLightningThinker::LightningFlash ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void DLightningThinker::ForceLightning (int mode)
|
void DLightningThinker::ForceLightning (int mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
|
@ -196,12 +226,24 @@ void DLightningThinker::ForceLightning (int mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static DLightningThinker *LocateLightning (FLevelLocals *Level)
|
static DLightningThinker *LocateLightning (FLevelLocals *Level)
|
||||||
{
|
{
|
||||||
auto iterator = Level->GetThinkerIterator<DLightningThinker>(NAME_None, STAT_LIGHTNING);
|
auto iterator = Level->GetThinkerIterator<DLightningThinker>(NAME_None, STAT_LIGHTNING);
|
||||||
return iterator.Next ();
|
return iterator.Next ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void FLevelLocals::StartLightning ()
|
void FLevelLocals::StartLightning ()
|
||||||
{
|
{
|
||||||
const bool isOriginalHexen = (gameinfo.gametype == GAME_Hexen)
|
const bool isOriginalHexen = (gameinfo.gametype == GAME_Hexen)
|
||||||
|
@ -237,6 +279,12 @@ void FLevelLocals::StartLightning ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
void FLevelLocals::ForceLightning (int mode)
|
void FLevelLocals::ForceLightning (int mode)
|
||||||
{
|
{
|
||||||
DLightningThinker *lightning = LocateLightning (this);
|
DLightningThinker *lightning = LocateLightning (this);
|
||||||
|
|
Loading…
Reference in a new issue