mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
- untangled r_defs.h from actor.h
Both files can now be included independently without causing problems. This also required moving some inline functions into separate files and splitting off the GC definitions from dobject.h to ensure that r_defs does not need to pull in any part of the object hierarchy.
This commit is contained in:
parent
ea0a9b537b
commit
bd7476fb8d
49 changed files with 441 additions and 350 deletions
55
src/actorinlines.h
Normal file
55
src/actorinlines.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#pragma once
|
||||
|
||||
#include "actor.h"
|
||||
#include "r_defs.h"
|
||||
// These depend on both actor.h and r_defs.h so they cannot be in either file without creating a cross dependency.
|
||||
|
||||
inline DVector3 AActor::PosRelative(int portalgroup) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, portalgroup);
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(const AActor *other) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, other->Sector->PortalGroup);
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(sector_t *sec) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, sec->PortalGroup);
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(line_t *line) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, line->frontsector->PortalGroup);
|
||||
}
|
||||
|
||||
inline DVector3 PosRelative(const DVector3 &pos, line_t *line, sector_t *refsec = NULL)
|
||||
{
|
||||
return pos + Displacements.getOffset(refsec->PortalGroup, line->frontsector->PortalGroup);
|
||||
}
|
||||
|
||||
|
||||
inline void AActor::ClearInterpolation()
|
||||
{
|
||||
Prev = Pos();
|
||||
PrevAngles = Angles;
|
||||
if (Sector) PrevPortalGroup = Sector->PortalGroup;
|
||||
else PrevPortalGroup = 0;
|
||||
}
|
||||
|
||||
inline double secplane_t::ZatPoint(const AActor *ac) const
|
||||
{
|
||||
return (D + normal.X*ac->X() + normal.Y*ac->Y()) * negiC;
|
||||
}
|
||||
|
||||
inline double sector_t::HighestCeilingAt(AActor *a, sector_t **resultsec)
|
||||
{
|
||||
return HighestCeilingAt(a->Pos(), resultsec);
|
||||
}
|
||||
|
||||
inline double sector_t::LowestFloorAt(AActor *a, sector_t **resultsec)
|
||||
{
|
||||
return LowestFloorAt(a->Pos(), resultsec);
|
||||
}
|
||||
|
231
src/dobject.h
231
src/dobject.h
|
@ -185,236 +185,7 @@ protected: \
|
|||
#define _X_VMEXPORT_true(cls) nullptr
|
||||
#define _X_VMEXPORT_false(cls) nullptr
|
||||
|
||||
enum EObjectFlags
|
||||
{
|
||||
// GC flags
|
||||
OF_White0 = 1 << 0, // Object is white (type 0)
|
||||
OF_White1 = 1 << 1, // Object is white (type 1)
|
||||
OF_Black = 1 << 2, // Object is black
|
||||
OF_Fixed = 1 << 3, // Object is fixed (should not be collected)
|
||||
OF_Rooted = 1 << 4, // Object is soft-rooted
|
||||
OF_EuthanizeMe = 1 << 5, // Object wants to die
|
||||
OF_Cleanup = 1 << 6, // Object is now being deleted by the collector
|
||||
OF_YesReallyDelete = 1 << 7, // Object is being deleted outside the collector, and this is okay, so don't print a warning
|
||||
|
||||
OF_WhiteBits = OF_White0 | OF_White1,
|
||||
OF_MarkBits = OF_WhiteBits | OF_Black,
|
||||
|
||||
// Other flags
|
||||
OF_JustSpawned = 1 << 8, // Thinker was spawned this tic
|
||||
OF_SerialSuccess = 1 << 9, // For debugging Serialize() calls
|
||||
OF_Sentinel = 1 << 10, // Object is serving as the sentinel in a ring list
|
||||
OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk)
|
||||
OF_Spawned = 1 << 12, // Thinker was spawned at all (some thinkers get deleted before spawning)
|
||||
OF_Released = 1 << 13, // Object was released from the GC system and should not be processed by GC function
|
||||
OF_Abstract = 1 << 14, // Marks a class that cannot be created with new() function at all
|
||||
OF_UI = 1 << 15, // Marks a class that defaults to VARF_UI for it's fields/methods
|
||||
OF_Play = 1 << 16, // Marks a class that defaults to VARF_Play for it's fields/methods
|
||||
};
|
||||
|
||||
template<class T> class TObjPtr;
|
||||
|
||||
namespace GC
|
||||
{
|
||||
enum EGCState
|
||||
{
|
||||
GCS_Pause,
|
||||
GCS_Propagate,
|
||||
GCS_Sweep,
|
||||
GCS_Finalize
|
||||
};
|
||||
|
||||
// Number of bytes currently allocated through M_Malloc/M_Realloc.
|
||||
extern size_t AllocBytes;
|
||||
|
||||
// Amount of memory to allocate before triggering a collection.
|
||||
extern size_t Threshold;
|
||||
|
||||
// List of gray objects.
|
||||
extern DObject *Gray;
|
||||
|
||||
// List of every object.
|
||||
extern DObject *Root;
|
||||
|
||||
// Current white value for potentially-live objects.
|
||||
extern uint32_t CurrentWhite;
|
||||
|
||||
// Current collector state.
|
||||
extern EGCState State;
|
||||
|
||||
// Position of GC sweep in the list of objects.
|
||||
extern DObject **SweepPos;
|
||||
|
||||
// Size of GC pause.
|
||||
extern int Pause;
|
||||
|
||||
// Size of GC steps.
|
||||
extern int StepMul;
|
||||
|
||||
// Is this the final collection just before exit?
|
||||
extern bool FinalGC;
|
||||
|
||||
// Current white value for known-dead objects.
|
||||
static inline uint32_t OtherWhite()
|
||||
{
|
||||
return CurrentWhite ^ OF_WhiteBits;
|
||||
}
|
||||
|
||||
// Frees all objects, whether they're dead or not.
|
||||
void FreeAll();
|
||||
|
||||
// Does one collection step.
|
||||
void Step();
|
||||
|
||||
// Does a complete collection.
|
||||
void FullGC();
|
||||
|
||||
// Handles the grunt work for a write barrier.
|
||||
void Barrier(DObject *pointing, DObject *pointed);
|
||||
|
||||
// Handles a write barrier.
|
||||
static inline void WriteBarrier(DObject *pointing, DObject *pointed);
|
||||
|
||||
// Handles a write barrier for a pointer that isn't inside an object.
|
||||
static inline void WriteBarrier(DObject *pointed);
|
||||
|
||||
// Handles a read barrier.
|
||||
template<class T> inline T *ReadBarrier(T *&obj)
|
||||
{
|
||||
if (obj == NULL || !(obj->ObjectFlags & OF_EuthanizeMe))
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
return obj = NULL;
|
||||
}
|
||||
|
||||
// Check if it's time to collect, and do a collection step if it is.
|
||||
static inline void CheckGC()
|
||||
{
|
||||
if (AllocBytes >= Threshold)
|
||||
Step();
|
||||
}
|
||||
|
||||
// Forces a collection to start now.
|
||||
static inline void StartCollection()
|
||||
{
|
||||
Threshold = AllocBytes;
|
||||
}
|
||||
|
||||
// Marks a white object gray. If the object wants to die, the pointer
|
||||
// is NULLed instead.
|
||||
void Mark(DObject **obj);
|
||||
|
||||
// Marks an array of objects.
|
||||
void MarkArray(DObject **objs, size_t count);
|
||||
|
||||
// For cleanup
|
||||
void DelSoftRootHead();
|
||||
|
||||
// Soft-roots an object.
|
||||
void AddSoftRoot(DObject *obj);
|
||||
|
||||
// Unroots an object.
|
||||
void DelSoftRoot(DObject *obj);
|
||||
|
||||
template<class T> void Mark(T *&obj)
|
||||
{
|
||||
union
|
||||
{
|
||||
T *t;
|
||||
DObject *o;
|
||||
};
|
||||
o = obj;
|
||||
Mark(&o);
|
||||
obj = t;
|
||||
}
|
||||
template<class T> void Mark(TObjPtr<T> &obj);
|
||||
|
||||
template<class T> void MarkArray(T **obj, size_t count)
|
||||
{
|
||||
MarkArray((DObject **)(obj), count);
|
||||
}
|
||||
template<class T> void MarkArray(TArray<T> &arr)
|
||||
{
|
||||
MarkArray(&arr[0], arr.Size());
|
||||
}
|
||||
}
|
||||
|
||||
// A template class to help with handling read barriers. It does not
|
||||
// handle write barriers, because those can be handled more efficiently
|
||||
// with knowledge of the object that holds the pointer.
|
||||
template<class T>
|
||||
class TObjPtr
|
||||
{
|
||||
union
|
||||
{
|
||||
T pp;
|
||||
DObject *o;
|
||||
};
|
||||
public:
|
||||
TObjPtr() throw()
|
||||
{
|
||||
}
|
||||
TObjPtr(T q) throw()
|
||||
: pp(q)
|
||||
{
|
||||
}
|
||||
TObjPtr(const TObjPtr<T> &q) throw()
|
||||
: pp(q.pp)
|
||||
{
|
||||
}
|
||||
T operator=(T q) throw()
|
||||
{
|
||||
return pp = q;
|
||||
// The caller must now perform a write barrier.
|
||||
}
|
||||
operator T() throw()
|
||||
{
|
||||
return GC::ReadBarrier(pp);
|
||||
}
|
||||
T &operator*()
|
||||
{
|
||||
T q = GC::ReadBarrier(pp);
|
||||
assert(q != NULL);
|
||||
return *q;
|
||||
}
|
||||
T *operator&() throw()
|
||||
{
|
||||
// Does not perform a read barrier. The only real use for this is with
|
||||
// the DECLARE_POINTER macro, where a read barrier would be a very bad
|
||||
// thing.
|
||||
return &pp;
|
||||
}
|
||||
T operator->() throw()
|
||||
{
|
||||
return GC::ReadBarrier(pp);
|
||||
}
|
||||
bool operator!=(T u) throw()
|
||||
{
|
||||
return GC::ReadBarrier(o) != u;
|
||||
}
|
||||
bool operator==(T u) throw()
|
||||
{
|
||||
return GC::ReadBarrier(o) == u;
|
||||
}
|
||||
|
||||
template<class U> friend inline void GC::Mark(TObjPtr<U> &obj);
|
||||
template<class U> friend FSerializer &Serialize(FSerializer &arc, const char *key, TObjPtr<U> &value, TObjPtr<U> *);
|
||||
|
||||
friend class DObject;
|
||||
};
|
||||
|
||||
// Use barrier_cast instead of static_cast when you need to cast
|
||||
// the contents of a TObjPtr to a related type.
|
||||
template<class T,class U> inline T barrier_cast(TObjPtr<U> &o)
|
||||
{
|
||||
return static_cast<T>(static_cast<U>(o));
|
||||
}
|
||||
|
||||
template<class T> inline void GC::Mark(TObjPtr<T> &obj)
|
||||
{
|
||||
GC::Mark(&obj.o);
|
||||
}
|
||||
#include "dobjgc.h"
|
||||
|
||||
class DObject
|
||||
{
|
||||
|
|
235
src/dobjgc.h
Normal file
235
src/dobjgc.h
Normal file
|
@ -0,0 +1,235 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
class DObject;
|
||||
class FSerializer;
|
||||
|
||||
enum EObjectFlags
|
||||
{
|
||||
// GC flags
|
||||
OF_White0 = 1 << 0, // Object is white (type 0)
|
||||
OF_White1 = 1 << 1, // Object is white (type 1)
|
||||
OF_Black = 1 << 2, // Object is black
|
||||
OF_Fixed = 1 << 3, // Object is fixed (should not be collected)
|
||||
OF_Rooted = 1 << 4, // Object is soft-rooted
|
||||
OF_EuthanizeMe = 1 << 5, // Object wants to die
|
||||
OF_Cleanup = 1 << 6, // Object is now being deleted by the collector
|
||||
OF_YesReallyDelete = 1 << 7, // Object is being deleted outside the collector, and this is okay, so don't print a warning
|
||||
|
||||
OF_WhiteBits = OF_White0 | OF_White1,
|
||||
OF_MarkBits = OF_WhiteBits | OF_Black,
|
||||
|
||||
// Other flags
|
||||
OF_JustSpawned = 1 << 8, // Thinker was spawned this tic
|
||||
OF_SerialSuccess = 1 << 9, // For debugging Serialize() calls
|
||||
OF_Sentinel = 1 << 10, // Object is serving as the sentinel in a ring list
|
||||
OF_Transient = 1 << 11, // Object should not be archived (references to it will be nulled on disk)
|
||||
OF_Spawned = 1 << 12, // Thinker was spawned at all (some thinkers get deleted before spawning)
|
||||
OF_Released = 1 << 13, // Object was released from the GC system and should not be processed by GC function
|
||||
OF_Abstract = 1 << 14, // Marks a class that cannot be created with new() function at all
|
||||
OF_UI = 1 << 15, // Marks a class that defaults to VARF_UI for it's fields/methods
|
||||
OF_Play = 1 << 16, // Marks a class that defaults to VARF_Play for it's fields/methods
|
||||
};
|
||||
|
||||
template<class T> class TObjPtr;
|
||||
|
||||
namespace GC
|
||||
{
|
||||
enum EGCState
|
||||
{
|
||||
GCS_Pause,
|
||||
GCS_Propagate,
|
||||
GCS_Sweep,
|
||||
GCS_Finalize
|
||||
};
|
||||
|
||||
// Number of bytes currently allocated through M_Malloc/M_Realloc.
|
||||
extern size_t AllocBytes;
|
||||
|
||||
// Amount of memory to allocate before triggering a collection.
|
||||
extern size_t Threshold;
|
||||
|
||||
// List of gray objects.
|
||||
extern DObject *Gray;
|
||||
|
||||
// List of every object.
|
||||
extern DObject *Root;
|
||||
|
||||
// Current white value for potentially-live objects.
|
||||
extern uint32_t CurrentWhite;
|
||||
|
||||
// Current collector state.
|
||||
extern EGCState State;
|
||||
|
||||
// Position of GC sweep in the list of objects.
|
||||
extern DObject **SweepPos;
|
||||
|
||||
// Size of GC pause.
|
||||
extern int Pause;
|
||||
|
||||
// Size of GC steps.
|
||||
extern int StepMul;
|
||||
|
||||
// Is this the final collection just before exit?
|
||||
extern bool FinalGC;
|
||||
|
||||
// Current white value for known-dead objects.
|
||||
static inline uint32_t OtherWhite()
|
||||
{
|
||||
return CurrentWhite ^ OF_WhiteBits;
|
||||
}
|
||||
|
||||
// Frees all objects, whether they're dead or not.
|
||||
void FreeAll();
|
||||
|
||||
// Does one collection step.
|
||||
void Step();
|
||||
|
||||
// Does a complete collection.
|
||||
void FullGC();
|
||||
|
||||
// Handles the grunt work for a write barrier.
|
||||
void Barrier(DObject *pointing, DObject *pointed);
|
||||
|
||||
// Handles a write barrier.
|
||||
static inline void WriteBarrier(DObject *pointing, DObject *pointed);
|
||||
|
||||
// Handles a write barrier for a pointer that isn't inside an object.
|
||||
static inline void WriteBarrier(DObject *pointed);
|
||||
|
||||
// Handles a read barrier.
|
||||
template<class T> inline T *ReadBarrier(T *&obj)
|
||||
{
|
||||
if (obj == NULL || !(obj->ObjectFlags & OF_EuthanizeMe))
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
return obj = NULL;
|
||||
}
|
||||
|
||||
// Check if it's time to collect, and do a collection step if it is.
|
||||
static inline void CheckGC()
|
||||
{
|
||||
if (AllocBytes >= Threshold)
|
||||
Step();
|
||||
}
|
||||
|
||||
// Forces a collection to start now.
|
||||
static inline void StartCollection()
|
||||
{
|
||||
Threshold = AllocBytes;
|
||||
}
|
||||
|
||||
// Marks a white object gray. If the object wants to die, the pointer
|
||||
// is NULLed instead.
|
||||
void Mark(DObject **obj);
|
||||
|
||||
// Marks an array of objects.
|
||||
void MarkArray(DObject **objs, size_t count);
|
||||
|
||||
// For cleanup
|
||||
void DelSoftRootHead();
|
||||
|
||||
// Soft-roots an object.
|
||||
void AddSoftRoot(DObject *obj);
|
||||
|
||||
// Unroots an object.
|
||||
void DelSoftRoot(DObject *obj);
|
||||
|
||||
template<class T> void Mark(T *&obj)
|
||||
{
|
||||
union
|
||||
{
|
||||
T *t;
|
||||
DObject *o;
|
||||
};
|
||||
o = obj;
|
||||
Mark(&o);
|
||||
obj = t;
|
||||
}
|
||||
template<class T> void Mark(TObjPtr<T> &obj);
|
||||
|
||||
template<class T> void MarkArray(T **obj, size_t count)
|
||||
{
|
||||
MarkArray((DObject **)(obj), count);
|
||||
}
|
||||
template<class T> void MarkArray(TArray<T> &arr)
|
||||
{
|
||||
MarkArray(&arr[0], arr.Size());
|
||||
}
|
||||
}
|
||||
|
||||
// A template class to help with handling read barriers. It does not
|
||||
// handle write barriers, because those can be handled more efficiently
|
||||
// with knowledge of the object that holds the pointer.
|
||||
template<class T>
|
||||
class TObjPtr
|
||||
{
|
||||
union
|
||||
{
|
||||
T pp;
|
||||
DObject *o;
|
||||
};
|
||||
public:
|
||||
TObjPtr() throw()
|
||||
{
|
||||
}
|
||||
TObjPtr(T q) throw()
|
||||
: pp(q)
|
||||
{
|
||||
}
|
||||
TObjPtr(const TObjPtr<T> &q) throw()
|
||||
: pp(q.pp)
|
||||
{
|
||||
}
|
||||
T operator=(T q) throw()
|
||||
{
|
||||
return pp = q;
|
||||
// The caller must now perform a write barrier.
|
||||
}
|
||||
operator T() throw()
|
||||
{
|
||||
return GC::ReadBarrier(pp);
|
||||
}
|
||||
T &operator*()
|
||||
{
|
||||
T q = GC::ReadBarrier(pp);
|
||||
assert(q != NULL);
|
||||
return *q;
|
||||
}
|
||||
T *operator&() throw()
|
||||
{
|
||||
// Does not perform a read barrier. The only real use for this is with
|
||||
// the DECLARE_POINTER macro, where a read barrier would be a very bad
|
||||
// thing.
|
||||
return &pp;
|
||||
}
|
||||
T operator->() throw()
|
||||
{
|
||||
return GC::ReadBarrier(pp);
|
||||
}
|
||||
bool operator!=(T u) throw()
|
||||
{
|
||||
return GC::ReadBarrier(o) != u;
|
||||
}
|
||||
bool operator==(T u) throw()
|
||||
{
|
||||
return GC::ReadBarrier(o) == u;
|
||||
}
|
||||
|
||||
template<class U> friend inline void GC::Mark(TObjPtr<U> &obj);
|
||||
template<class U> friend FSerializer &Serialize(FSerializer &arc, const char *key, TObjPtr<U> &value, TObjPtr<U> *);
|
||||
|
||||
friend class DObject;
|
||||
};
|
||||
|
||||
// Use barrier_cast instead of static_cast when you need to cast
|
||||
// the contents of a TObjPtr to a related type.
|
||||
template<class T,class U> inline T barrier_cast(TObjPtr<U> &o)
|
||||
{
|
||||
return static_cast<T>(static_cast<U>(o));
|
||||
}
|
||||
|
||||
template<class T> inline void GC::Mark(TObjPtr<T> &obj)
|
||||
{
|
||||
GC::Mark(&obj.o);
|
||||
}
|
|
@ -9,7 +9,16 @@
|
|||
|
||||
class player_t;
|
||||
class FConfigFile;
|
||||
struct visstyle_t;
|
||||
|
||||
// This encapsulates the fields of vissprite_t that can be altered by AlterWeaponSprite
|
||||
struct visstyle_t
|
||||
{
|
||||
bool Invert;
|
||||
float Alpha;
|
||||
ERenderStyle RenderStyle;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Class definitions */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "g_level.h"
|
||||
#include "r_defs.h"
|
||||
#include "portal.h"
|
||||
|
||||
struct FLevelLocals
|
||||
{
|
||||
|
@ -136,3 +137,56 @@ inline int sector_t::GetOppositePortalGroup(int plane)
|
|||
{
|
||||
return level.sectorPortals[Portals[plane]].mDestination->PortalGroup;
|
||||
}
|
||||
|
||||
inline bool sector_t::PortalBlocksView(int plane)
|
||||
{
|
||||
if (GetPortalType(plane) != PORTS_LINKEDPORTAL) return false;
|
||||
return !!(planes[plane].Flags & (PLANEF_NORENDER | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
}
|
||||
|
||||
inline bool sector_t::PortalBlocksSight(int plane)
|
||||
{
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
inline bool sector_t::PortalBlocksMovement(int plane)
|
||||
{
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
inline bool sector_t::PortalBlocksSound(int plane)
|
||||
{
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_BLOCKSOUND | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
inline bool sector_t::PortalIsLinked(int plane)
|
||||
{
|
||||
return (GetPortalType(plane) == PORTS_LINKEDPORTAL);
|
||||
}
|
||||
|
||||
inline FLinePortal *line_t::getPortal() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? (FLinePortal*)NULL : &linePortals[portalindex];
|
||||
}
|
||||
|
||||
// returns true if the portal is crossable by actors
|
||||
inline bool line_t::isLinePortal() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? false : !!(linePortals[portalindex].mFlags & PORTF_PASSABLE);
|
||||
}
|
||||
|
||||
// returns true if the portal needs to be handled by the renderer
|
||||
inline bool line_t::isVisualPortal() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? false : !!(linePortals[portalindex].mFlags & PORTF_VISIBLE);
|
||||
}
|
||||
|
||||
inline line_t *line_t::getPortalDestination() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? (line_t*)NULL : linePortals[portalindex].mDestination;
|
||||
}
|
||||
|
||||
inline int line_t::getPortalAlignment() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? 0 : linePortals[portalindex].mAlign;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "dobject.h"
|
||||
#include "v_collection.h"
|
||||
#include "v_text.h"
|
||||
#include "r_data/renderstyle.h"
|
||||
|
||||
class player_t;
|
||||
struct FRemapTable;
|
||||
|
|
|
@ -31,6 +31,7 @@ struct vertex_t;
|
|||
struct secplane_t;
|
||||
struct subsector_t;
|
||||
struct sector_t;
|
||||
class FMaterial;
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "doomstat.h"
|
||||
#include "serializer.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "c_cvars.h"
|
||||
#include "gl/utility/gl_geometric.h"
|
||||
#include "gl/utility/gl_cycler.h"
|
||||
#include "actor.h"
|
||||
|
||||
|
||||
EXTERN_CVAR(Bool, gl_lights)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "p_effect.h"
|
||||
#include "po_man.h"
|
||||
#include "doomdata.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/data/gl_data.h"
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "portal.h"
|
||||
#include "templates.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
#include "gl/system/gl_cvars.h"
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "p_lnspec.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actor.h"
|
||||
#include "actorinlines.h"
|
||||
#include "gl/gl_functions.h"
|
||||
|
||||
#include "gl/system/gl_interface.h"
|
||||
|
|
|
@ -42,8 +42,12 @@ static void* PosixGetProcAddress (const GLubyte* name)
|
|||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#ifdef APIENTRY
|
||||
#undef APIENTRY
|
||||
#endif
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// disable inlining here because it creates an incredible amount of bloat in this file.
|
||||
#pragma inline_depth(0)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#endif
|
||||
|
||||
#include "SkylineBinPack.h"
|
||||
#include "textures.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "doomstat.h"
|
||||
#include "d_main.h"
|
||||
#include "zstring.h"
|
||||
#include "textures.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#define _access(a,b) access(a,b)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __GL_TEXTURE_H__
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "textures.h"
|
||||
|
||||
class FBrightmapTexture : public FTexture
|
||||
{
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "r_defs.h"
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "version.h"
|
||||
|
||||
|
@ -41,6 +43,7 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "doomdef.h"
|
||||
|
@ -57,7 +60,6 @@
|
|||
#include "i_system.h"
|
||||
#include "i_video.h"
|
||||
#include "v_video.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
#include "hu_stuff.h"
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ struct secplane_t;
|
|||
struct FDynamicColormap;
|
||||
struct line_t;
|
||||
struct sector_t;
|
||||
class AActor;
|
||||
|
||||
struct F3DFloor
|
||||
{
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "p_maputl.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actor.h"
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "serializer.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "textures.h"
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "math/cmath.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "virtual.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "g_level.h"
|
||||
#include "r_sky.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
CVAR(Bool, cl_bloodsplats, true, CVAR_ARCHIVE)
|
||||
CVAR(Int, sv_smartaim, 0, CVAR_ARCHIVE | CVAR_SERVERINFO)
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "p_3dmidtex.h"
|
||||
#include "p_blockmap.h"
|
||||
#include "r_utility.h"
|
||||
#include "actor.h"
|
||||
|
||||
// State.
|
||||
#include "r_state.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "m_bbox.h"
|
||||
|
||||
extern int validcount;
|
||||
struct FBlockNode;
|
||||
|
||||
struct divline_t
|
||||
{
|
||||
|
|
|
@ -72,6 +72,7 @@
|
|||
#include "g_levellocals.h"
|
||||
#include "a_morph.h"
|
||||
#include "events.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define WEAPONTOP 32.
|
||||
#define WEAPON_FUDGE_Y 0.375
|
||||
class AInventory;
|
||||
struct FTranslatedLineTarget;
|
||||
|
||||
//
|
||||
// Overlay psprites are scaled shapes
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "p_local.h"
|
||||
#include "d_player.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
CVAR(Bool, var_pushers, true, CVAR_SERVERINFO);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "p_maputl.h"
|
||||
#include "p_blockmap.h"
|
||||
#include "memarena.h"
|
||||
#include "actor.h"
|
||||
|
||||
//=============================================================================
|
||||
// phares 3/21/98
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "stats.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
static FRandom pr_botchecksight ("BotCheckSight");
|
||||
static FRandom pr_checksight ("CheckSight");
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "p_maputl.h"
|
||||
#include "p_spec.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actor.h"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
class FScanner;
|
||||
struct level_info_t;
|
||||
struct FDoorAnimation;
|
||||
|
||||
struct FThinkerCollection
|
||||
{
|
||||
|
|
|
@ -49,6 +49,9 @@
|
|||
#include "serializer.h"
|
||||
#include "p_maputl.h"
|
||||
#include "p_spec.h"
|
||||
#include "textures.h"
|
||||
#include "actor.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
#include "gi.h"
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "s_sound.h"
|
||||
#include "p_local.h"
|
||||
#include "templates.h"
|
||||
#include "actor.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "p_tags.h"
|
||||
#include "p_terrain.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "info.h"
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "p_blockmap.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "actorinlines.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "tarray.h"
|
||||
#include "r_defs.h"
|
||||
#include "m_bbox.h"
|
||||
#include "dthinker.h"
|
||||
|
||||
class DPolyAction : public DThinker
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "polyrenderer/poly_renderer.h"
|
||||
#include "r_sky.h"
|
||||
#include "swrenderer/scene/r_light.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
EXTERN_CVAR(Bool, r_drawmirrors)
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "templates.h"
|
||||
#include "renderstyle.h"
|
||||
#include "c_cvars.h"
|
||||
#include "serializer.h"
|
||||
|
||||
CVAR (Bool, r_drawtrans, true, 0)
|
||||
CVAR (Int, r_drawfuzz, 1, CVAR_ARCHIVE)
|
||||
|
@ -191,3 +192,8 @@ void FRenderStyle::CheckFuzz()
|
|||
BlendOp = STYLEOP_Fuzz;
|
||||
}
|
||||
}
|
||||
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, FRenderStyle &style, FRenderStyle *def)
|
||||
{
|
||||
return arc.Array(key, &style.BlendOp, def ? &def->BlendOp : nullptr, 4);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
#include "r_data/colormaps.h"
|
||||
#include "r_data/sprites.h"
|
||||
#include "voxels.h"
|
||||
#include "info.h"
|
||||
|
||||
void VOX_AddVoxel(int sprnum, int frame, FVoxelDef *def);
|
||||
|
||||
|
|
132
src/r_defs.h
132
src/r_defs.h
|
@ -25,8 +25,8 @@
|
|||
|
||||
#include "doomdef.h"
|
||||
#include "templates.h"
|
||||
#include "memarena.h"
|
||||
#include "m_bbox.h"
|
||||
#include "dobjgc.h"
|
||||
|
||||
// Some more or less basic data types
|
||||
// we depend on.
|
||||
|
@ -35,13 +35,15 @@
|
|||
// We rely on the thinker data struct
|
||||
// to handle sound origins in sectors.
|
||||
// SECTORS do store MObjs anyway.
|
||||
#include "actor.h"
|
||||
struct FLightNode;
|
||||
struct FGLSection;
|
||||
class FSerializer;
|
||||
struct FPortal;
|
||||
struct FSectorPortal;
|
||||
struct FLinePortal;
|
||||
struct seg_t;
|
||||
|
||||
#include "dthinker.h"
|
||||
struct sector_t;
|
||||
class AActor;
|
||||
|
||||
#define MAXWIDTH 5760
|
||||
#define MAXHEIGHT 3600
|
||||
|
@ -351,11 +353,6 @@ public:
|
|||
return (D + normal.X*v->fX() + normal.Y*v->fY()) * negiC;
|
||||
}
|
||||
|
||||
double ZatPoint(const AActor *ac) const
|
||||
{
|
||||
return (D + normal.X*ac->X() + normal.Y*ac->Y()) * negiC;
|
||||
}
|
||||
|
||||
// Returns the value of z at vertex v if d is equal to dist
|
||||
double ZatPointDist(const vertex_t *v, double dist)
|
||||
{
|
||||
|
@ -434,6 +431,7 @@ public:
|
|||
}
|
||||
|
||||
bool CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) const;
|
||||
inline double secplane_t::ZatPoint(const AActor *ac) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -875,31 +873,11 @@ public:
|
|||
Flags &= ~SECF_SPECIALFLAGS;
|
||||
}
|
||||
|
||||
bool PortalBlocksView(int plane)
|
||||
{
|
||||
if (GetPortalType(plane) != PORTS_LINKEDPORTAL) return false;
|
||||
return !!(planes[plane].Flags & (PLANEF_NORENDER | PLANEF_DISABLED | PLANEF_OBSTRUCTED));
|
||||
}
|
||||
|
||||
bool PortalBlocksSight(int plane)
|
||||
{
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NORENDER | PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
bool PortalBlocksMovement(int plane)
|
||||
{
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_NOPASS | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
bool PortalBlocksSound(int plane)
|
||||
{
|
||||
return PLANEF_LINKED != (planes[plane].Flags & (PLANEF_BLOCKSOUND | PLANEF_DISABLED | PLANEF_OBSTRUCTED | PLANEF_LINKED));
|
||||
}
|
||||
|
||||
bool PortalIsLinked(int plane)
|
||||
{
|
||||
return (GetPortalType(plane) == PORTS_LINKEDPORTAL);
|
||||
}
|
||||
inline bool PortalBlocksView(int plane);
|
||||
inline bool PortalBlocksSight(int plane);
|
||||
inline bool PortalBlocksMovement(int plane);
|
||||
inline bool PortalBlocksSound(int plane);
|
||||
inline bool PortalIsLinked(int plane);
|
||||
|
||||
void ClearPortal(int plane)
|
||||
{
|
||||
|
@ -936,16 +914,8 @@ public:
|
|||
double HighestCeilingAt(const DVector2 &a, sector_t **resultsec = NULL);
|
||||
double LowestFloorAt(const DVector2 &a, sector_t **resultsec = NULL);
|
||||
|
||||
|
||||
double HighestCeilingAt(AActor *a, sector_t **resultsec = NULL)
|
||||
{
|
||||
return HighestCeilingAt(a->Pos(), resultsec);
|
||||
}
|
||||
|
||||
double LowestFloorAt(AActor *a, sector_t **resultsec = NULL)
|
||||
{
|
||||
return LowestFloorAt(a->Pos(), resultsec);
|
||||
}
|
||||
inline double HighestCeilingAt(AActor *a, sector_t **resultsec = NULL);
|
||||
inline double LowestFloorAt(AActor *a, sector_t **resultsec = NULL);
|
||||
|
||||
bool isClosed() const
|
||||
{
|
||||
|
@ -1283,32 +1253,11 @@ struct line_t
|
|||
|
||||
FSectorPortal *GetTransferredPortal();
|
||||
|
||||
FLinePortal *getPortal() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? (FLinePortal*)NULL : &linePortals[portalindex];
|
||||
}
|
||||
|
||||
// returns true if the portal is crossable by actors
|
||||
bool isLinePortal() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? false : !!(linePortals[portalindex].mFlags & PORTF_PASSABLE);
|
||||
}
|
||||
|
||||
// returns true if the portal needs to be handled by the renderer
|
||||
bool isVisualPortal() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? false : !!(linePortals[portalindex].mFlags & PORTF_VISIBLE);
|
||||
}
|
||||
|
||||
line_t *getPortalDestination() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? (line_t*)NULL : linePortals[portalindex].mDestination;
|
||||
}
|
||||
|
||||
int getPortalAlignment() const
|
||||
{
|
||||
return portalindex >= linePortals.Size() ? 0 : linePortals[portalindex].mAlign;
|
||||
}
|
||||
inline FLinePortal *getPortal() const;
|
||||
inline bool isLinePortal() const;
|
||||
inline bool isVisualPortal() const;
|
||||
inline line_t *getPortalDestination() const;
|
||||
inline int getPortalAlignment() const;
|
||||
|
||||
int Index() const;
|
||||
};
|
||||
|
@ -1476,15 +1425,6 @@ struct FMiniBSP
|
|||
|
||||
typedef uint8_t lighttable_t; // This could be wider for >8 bit display.
|
||||
|
||||
// This encapsulates the fields of vissprite_t that can be altered by AlterWeaponSprite
|
||||
struct visstyle_t
|
||||
{
|
||||
bool Invert;
|
||||
float Alpha;
|
||||
ERenderStyle RenderStyle;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//
|
||||
// The playsim can use different nodes than the renderer so this is
|
||||
|
@ -1503,40 +1443,6 @@ inline sector_t *P_PointInSector(double X, double Y)
|
|||
return P_PointInSubsector(X, Y)->sector;
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(int portalgroup) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, portalgroup);
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(const AActor *other) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, other->Sector->PortalGroup);
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(sector_t *sec) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, sec->PortalGroup);
|
||||
}
|
||||
|
||||
inline DVector3 AActor::PosRelative(line_t *line) const
|
||||
{
|
||||
return Pos() + Displacements.getOffset(Sector->PortalGroup, line->frontsector->PortalGroup);
|
||||
}
|
||||
|
||||
inline DVector3 PosRelative(const DVector3 &pos, line_t *line, sector_t *refsec = NULL)
|
||||
{
|
||||
return pos + Displacements.getOffset(refsec->PortalGroup, line->frontsector->PortalGroup);
|
||||
}
|
||||
|
||||
|
||||
inline void AActor::ClearInterpolation()
|
||||
{
|
||||
Prev = Pos();
|
||||
PrevAngles = Angles;
|
||||
if (Sector) PrevPortalGroup = Sector->PortalGroup;
|
||||
else PrevPortalGroup = 0;
|
||||
}
|
||||
|
||||
inline bool FBoundingBox::inRange(const line_t *ld) const
|
||||
{
|
||||
return Left() < ld->bbox[BOXRIGHT] &&
|
||||
|
|
|
@ -109,6 +109,7 @@ void R_SetWindow (int windowSize, int fullWidth, int fullHeight, int stHeight, b
|
|||
extern void R_FreePastViewers ();
|
||||
extern void R_ClearPastViewer (AActor *actor);
|
||||
|
||||
class FCanvasTexture;
|
||||
// This list keeps track of the cameras that draw into canvas textures.
|
||||
struct FCanvasTextureInfo
|
||||
{
|
||||
|
|
|
@ -820,7 +820,7 @@ begin:
|
|||
ThrowAbortException(X_OTHER, "Cannot instantiate abstract class %s", cls->TypeName.GetChars());
|
||||
}
|
||||
// Creating actors here must be outright prohibited,
|
||||
if (cls->IsDescendantOf(RUNTIME_CLASS(AActor)))
|
||||
if (cls->IsDescendantOf(NAME_Actor))
|
||||
{
|
||||
ThrowAbortException(X_OTHER, "Cannot create actors with 'new'");
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "tarray.h"
|
||||
#include "r_defs.h"
|
||||
#include "resourcefiles/file_zip.h"
|
||||
#include "tflags.h"
|
||||
|
||||
extern bool save_full;
|
||||
|
||||
|
@ -14,6 +15,15 @@ struct usercmd_t;
|
|||
|
||||
struct FWriter;
|
||||
struct FReader;
|
||||
class PClass;
|
||||
class PClassActor;
|
||||
struct FStrifeDialogueNode;
|
||||
class FFont;
|
||||
struct FState;
|
||||
struct FDoorAnimation;
|
||||
class FSoundID;
|
||||
struct FPolyObj;
|
||||
union FRenderStyle;
|
||||
|
||||
inline bool nullcmp(const void *buffer, size_t length)
|
||||
{
|
||||
|
@ -279,10 +289,7 @@ inline FSerializer &Serialize(FSerializer &arc, const char *key, PalEntry &pe, P
|
|||
return Serialize(arc, key, pe.d, def? &def->d : nullptr);
|
||||
}
|
||||
|
||||
inline FSerializer &Serialize(FSerializer &arc, const char *key, FRenderStyle &style, FRenderStyle *def)
|
||||
{
|
||||
return arc.Array(key, &style.BlendOp, def ? &def->BlendOp : nullptr, 4);
|
||||
}
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, FRenderStyle &style, FRenderStyle *def);
|
||||
|
||||
template<class T, class TT>
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, TFlags<T, TT> &flags, TFlags<T, TT> *def)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "c_cvars.h"
|
||||
#include <memory>
|
||||
|
||||
struct FSWColormap;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "v_video.h"
|
||||
#include "m_swap.h"
|
||||
#include "w_wad.h"
|
||||
#include "textures.h"
|
||||
|
||||
FImageCollection::FImageCollection ()
|
||||
{
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include "doomtype.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
class FTexture;
|
||||
|
||||
class FImageCollection
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "colormatcher.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "g_levellocals.h"
|
||||
#include "textures.h"
|
||||
|
||||
CUSTOM_CVAR(Int, uiscale, 2, CVAR_ARCHIVE | CVAR_NOINITCALL)
|
||||
{
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "doomstat.h"
|
||||
#include "v_palette.h"
|
||||
#include "w_wad.h"
|
||||
#include "textures.h"
|
||||
#include "r_data/colormaps.h"
|
||||
#include "SkylineBinPack.h"
|
||||
#include "swrenderer/scene/r_light.h"
|
||||
|
|
Loading…
Reference in a new issue