diff --git a/src/actorinlines.h b/src/actorinlines.h new file mode 100644 index 0000000000..d55ca1b55c --- /dev/null +++ b/src/actorinlines.h @@ -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); +} + diff --git a/src/dobject.h b/src/dobject.h index 2adb0b5e4e..f12bfc5014 100644 --- a/src/dobject.h +++ b/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 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 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 void Mark(T *&obj) - { - union - { - T *t; - DObject *o; - }; - o = obj; - Mark(&o); - obj = t; - } - template void Mark(TObjPtr &obj); - - template void MarkArray(T **obj, size_t count) - { - MarkArray((DObject **)(obj), count); - } - template void MarkArray(TArray &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 TObjPtr -{ - union - { - T pp; - DObject *o; - }; -public: - TObjPtr() throw() - { - } - TObjPtr(T q) throw() - : pp(q) - { - } - TObjPtr(const TObjPtr &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 friend inline void GC::Mark(TObjPtr &obj); - template friend FSerializer &Serialize(FSerializer &arc, const char *key, TObjPtr &value, TObjPtr *); - - 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 inline T barrier_cast(TObjPtr &o) -{ - return static_cast(static_cast(o)); -} - -template inline void GC::Mark(TObjPtr &obj) -{ - GC::Mark(&obj.o); -} +#include "dobjgc.h" class DObject { diff --git a/src/dobjgc.h b/src/dobjgc.h new file mode 100644 index 0000000000..cc5f210b3c --- /dev/null +++ b/src/dobjgc.h @@ -0,0 +1,235 @@ +#pragma once +#include +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 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 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 void Mark(T *&obj) + { + union + { + T *t; + DObject *o; + }; + o = obj; + Mark(&o); + obj = t; + } + template void Mark(TObjPtr &obj); + + template void MarkArray(T **obj, size_t count) + { + MarkArray((DObject **)(obj), count); + } + template void MarkArray(TArray &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 TObjPtr +{ + union + { + T pp; + DObject *o; + }; +public: + TObjPtr() throw() + { + } + TObjPtr(T q) throw() + : pp(q) + { + } + TObjPtr(const TObjPtr &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 friend inline void GC::Mark(TObjPtr &obj); + template friend FSerializer &Serialize(FSerializer &arc, const char *key, TObjPtr &value, TObjPtr *); + + 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 inline T barrier_cast(TObjPtr &o) +{ + return static_cast(static_cast(o)); +} + +template inline void GC::Mark(TObjPtr &obj) +{ + GC::Mark(&obj.o); +} diff --git a/src/g_inventory/a_pickups.h b/src/g_inventory/a_pickups.h index eb9731ddcf..cbcb2d9cd1 100644 --- a/src/g_inventory/a_pickups.h +++ b/src/g_inventory/a_pickups.h @@ -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 */ diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 4019064366..98ccdc3e88 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -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; +} diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index c9b2178727..689bdc4ac8 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -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; diff --git a/src/gl/data/gl_vertexbuffer.h b/src/gl/data/gl_vertexbuffer.h index f777118fd4..a7e1cd6660 100644 --- a/src/gl/data/gl_vertexbuffer.h +++ b/src/gl/data/gl_vertexbuffer.h @@ -31,6 +31,7 @@ struct vertex_t; struct secplane_t; struct subsector_t; struct sector_t; +class FMaterial; enum { diff --git a/src/gl/dynlights/a_dynlight.cpp b/src/gl/dynlights/a_dynlight.cpp index d5a07f089c..6e3f6681c9 100644 --- a/src/gl/dynlights/a_dynlight.cpp +++ b/src/gl/dynlights/a_dynlight.cpp @@ -72,6 +72,7 @@ #include "doomstat.h" #include "serializer.h" #include "g_levellocals.h" +#include "actorinlines.h" #include "gl/renderer/gl_renderer.h" diff --git a/src/gl/dynlights/gl_dynlight.h b/src/gl/dynlights/gl_dynlight.h index 15d9ba6103..8d339f3118 100644 --- a/src/gl/dynlights/gl_dynlight.h +++ b/src/gl/dynlights/gl_dynlight.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) diff --git a/src/gl/scene/gl_bsp.cpp b/src/gl/scene/gl_bsp.cpp index 5c14dbfc09..86efce9920 100644 --- a/src/gl/scene/gl_bsp.cpp +++ b/src/gl/scene/gl_bsp.cpp @@ -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" diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 61d146dd15..2e539e7a4d 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -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" diff --git a/src/gl/scene/gl_walls_draw.cpp b/src/gl/scene/gl_walls_draw.cpp index 34a4cc2825..ea75dd39a9 100644 --- a/src/gl/scene/gl_walls_draw.cpp +++ b/src/gl/scene/gl_walls_draw.cpp @@ -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" diff --git a/src/gl/system/gl_load.c b/src/gl/system/gl_load.c index 3e494f95a6..7075d69698 100644 --- a/src/gl/system/gl_load.c +++ b/src/gl/system/gl_load.c @@ -42,8 +42,12 @@ static void* PosixGetProcAddress (const GLubyte* name) #if defined(_WIN32) +#ifdef APIENTRY +#undef APIENTRY +#endif #include + #ifdef _MSC_VER // disable inlining here because it creates an incredible amount of bloat in this file. #pragma inline_depth(0) diff --git a/src/gl/system/gl_swframebuffer.h b/src/gl/system/gl_swframebuffer.h index 387b023b2e..b5631074c4 100644 --- a/src/gl/system/gl_swframebuffer.h +++ b/src/gl/system/gl_swframebuffer.h @@ -7,6 +7,7 @@ #endif #include "SkylineBinPack.h" +#include "textures.h" #include diff --git a/src/gl/textures/gl_hirestex.cpp b/src/gl/textures/gl_hirestex.cpp index 67287ced0e..151ca5660d 100644 --- a/src/gl/textures/gl_hirestex.cpp +++ b/src/gl/textures/gl_hirestex.cpp @@ -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) diff --git a/src/gl/textures/gl_texture.h b/src/gl/textures/gl_texture.h index ebdaa16b85..0cafab7537 100644 --- a/src/gl/textures/gl_texture.h +++ b/src/gl/textures/gl_texture.h @@ -2,6 +2,7 @@ #define __GL_TEXTURE_H__ #include "r_defs.h" +#include "textures.h" class FBrightmapTexture : public FTexture { diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 40214f3620..229835405b 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -32,6 +32,8 @@ #include #include +#include "r_defs.h" + #include "doomtype.h" #include "version.h" @@ -41,6 +43,7 @@ #include #endif + #include #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" diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index 4d52f550b4..cc3f71a17a 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -58,6 +58,7 @@ struct secplane_t; struct FDynamicColormap; struct line_t; struct sector_t; +class AActor; struct F3DFloor { diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index 4cfe01f19f..0a4c5507de 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -42,6 +42,7 @@ #include "p_maputl.h" #include "p_spec.h" #include "g_levellocals.h" +#include "actor.h" //============================================================================ diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index b978fd0d32..4c2c509e8f 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -32,6 +32,7 @@ #include "serializer.h" #include "p_spec.h" #include "g_levellocals.h" +#include "textures.h" //============================================================================ // diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index dde4fce29c..91d99791dd 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -53,6 +53,7 @@ #include "math/cmath.h" #include "g_levellocals.h" #include "virtual.h" +#include "actorinlines.h" #include "gi.h" diff --git a/src/p_map.cpp b/src/p_map.cpp index 73cda449c7..1aa762dbdd 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index c4fe47f31a..e639c440e7 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -39,6 +39,7 @@ #include "p_3dmidtex.h" #include "p_blockmap.h" #include "r_utility.h" +#include "actor.h" // State. #include "r_state.h" diff --git a/src/p_maputl.h b/src/p_maputl.h index 99a9acc331..8ac3ea76af 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -7,6 +7,7 @@ #include "m_bbox.h" extern int validcount; +struct FBlockNode; struct divline_t { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 5606a1102d..5bac8847f2 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -72,6 +72,7 @@ #include "g_levellocals.h" #include "a_morph.h" #include "events.h" +#include "actorinlines.h" // MACROS ------------------------------------------------------------------ diff --git a/src/p_pspr.h b/src/p_pspr.h index 311a241c4f..656cc67a9b 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -31,6 +31,7 @@ #define WEAPONTOP 32. #define WEAPON_FUDGE_Y 0.375 class AInventory; +struct FTranslatedLineTarget; // // Overlay psprites are scaled shapes diff --git a/src/p_pusher.cpp b/src/p_pusher.cpp index af63467106..0b08b4f65b 100644 --- a/src/p_pusher.cpp +++ b/src/p_pusher.cpp @@ -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); diff --git a/src/p_secnodes.cpp b/src/p_secnodes.cpp index b351f0e580..346f5ff8e7 100644 --- a/src/p_secnodes.cpp +++ b/src/p_secnodes.cpp @@ -26,6 +26,7 @@ #include "p_maputl.h" #include "p_blockmap.h" #include "memarena.h" +#include "actor.h" //============================================================================= // phares 3/21/98 diff --git a/src/p_sight.cpp b/src/p_sight.cpp index 68bf2ed3d0..d666bc3e96 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -30,6 +30,7 @@ #include "stats.h" #include "g_levellocals.h" +#include "actorinlines.h" static FRandom pr_botchecksight ("BotCheckSight"); static FRandom pr_checksight ("CheckSight"); diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index c574d189b3..cec49003d2 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -39,6 +39,7 @@ #include "p_maputl.h" #include "p_spec.h" #include "g_levellocals.h" +#include "actor.h" //=========================================================================== // diff --git a/src/p_spec.h b/src/p_spec.h index 8d6e53a23a..48535d0b03 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -31,6 +31,7 @@ class FScanner; struct level_info_t; +struct FDoorAnimation; struct FThinkerCollection { diff --git a/src/p_switch.cpp b/src/p_switch.cpp index ef700b05bf..d23e30ea22 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -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" diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index bacd81da3b..b044b3066c 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -46,6 +46,7 @@ #include "s_sound.h" #include "p_local.h" #include "templates.h" +#include "actor.h" // MACROS ------------------------------------------------------------------ diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 4d5e00e48a..edb3b5364b 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -49,6 +49,7 @@ #include "p_tags.h" #include "p_terrain.h" #include "g_levellocals.h" +#include "info.h" //=========================================================================== // diff --git a/src/po_man.cpp b/src/po_man.cpp index a5e47401fe..5572db1fa0 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -33,6 +33,7 @@ #include "r_utility.h" #include "p_blockmap.h" #include "g_levellocals.h" +#include "actorinlines.h" // MACROS ------------------------------------------------------------------ diff --git a/src/po_man.h b/src/po_man.h index d9e42c7fb4..4bf56a147d 100644 --- a/src/po_man.h +++ b/src/po_man.h @@ -4,6 +4,7 @@ #include "tarray.h" #include "r_defs.h" #include "m_bbox.h" +#include "dthinker.h" class DPolyAction : public DThinker { diff --git a/src/polyrenderer/scene/poly_wall.cpp b/src/polyrenderer/scene/poly_wall.cpp index e64d1f6c6c..2e42bb4883 100644 --- a/src/polyrenderer/scene/poly_wall.cpp +++ b/src/polyrenderer/scene/poly_wall.cpp @@ -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) diff --git a/src/r_data/renderstyle.cpp b/src/r_data/renderstyle.cpp index c44b136a09..49628c881a 100644 --- a/src/r_data/renderstyle.cpp +++ b/src/r_data/renderstyle.cpp @@ -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); +} diff --git a/src/r_data/voxels.cpp b/src/r_data/voxels.cpp index e9b30cd79c..70975c7a46 100644 --- a/src/r_data/voxels.cpp +++ b/src/r_data/voxels.cpp @@ -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); diff --git a/src/r_defs.h b/src/r_defs.h index 30d0597d56..bebe16fd6b 100644 --- a/src/r_defs.h +++ b/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] && diff --git a/src/r_utility.h b/src/r_utility.h index f1c1fc60d4..1487371b4f 100644 --- a/src/r_utility.h +++ b/src/r_utility.h @@ -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 { diff --git a/src/scripting/vm/vmexec.h b/src/scripting/vm/vmexec.h index b588d15d34..c24dfa111c 100644 --- a/src/scripting/vm/vmexec.h +++ b/src/scripting/vm/vmexec.h @@ -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'"); } diff --git a/src/serializer.h b/src/serializer.h index 7527eeb3c3..cea8df36d8 100644 --- a/src/serializer.h +++ b/src/serializer.h @@ -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 FSerializer &Serialize(FSerializer &arc, const char *key, TFlags &flags, TFlags *def) diff --git a/src/swrenderer/drawers/r_draw.h b/src/swrenderer/drawers/r_draw.h index 29b908398b..3d8d58dc5e 100644 --- a/src/swrenderer/drawers/r_draw.h +++ b/src/swrenderer/drawers/r_draw.h @@ -2,6 +2,7 @@ #pragma once #include "r_defs.h" +#include "c_cvars.h" #include struct FSWColormap; diff --git a/src/swrenderer/r_memory.h b/src/swrenderer/r_memory.h index f01d52a4dc..2c7a04874b 100644 --- a/src/swrenderer/r_memory.h +++ b/src/swrenderer/r_memory.h @@ -14,6 +14,7 @@ #pragma once #include +#include namespace swrenderer { diff --git a/src/v_collection.cpp b/src/v_collection.cpp index b7e395e6ae..a9e1772a3a 100644 --- a/src/v_collection.cpp +++ b/src/v_collection.cpp @@ -37,6 +37,7 @@ #include "v_video.h" #include "m_swap.h" #include "w_wad.h" +#include "textures.h" FImageCollection::FImageCollection () { diff --git a/src/v_collection.h b/src/v_collection.h index 9c0e8676b0..9e2800319e 100644 --- a/src/v_collection.h +++ b/src/v_collection.h @@ -37,6 +37,8 @@ #include "doomtype.h" #include "r_defs.h" +class FTexture; + class FImageCollection { public: diff --git a/src/v_draw.cpp b/src/v_draw.cpp index bcfd8f7677..3f3cae3a27 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -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) { diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index e8cedef9dc..1056d52fff 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -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"