- rewrote p_local.h so that it doesn't pull in the entire bunch of headers.

This was to resolve some circular dependencies with the portal code.
The most notable changees:

 * FTextureID was moved from textures.h to doomtype.h because it is frequently needed in files that don't want to do anything with actual textures.
 * split off the parts from p_maputl into a separate header.
 * consolidated all blockmap related data into p_blockmap.h
 * split off the polyobject parts into po_man.h
This commit is contained in:
Christoph Oelckers 2016-02-15 02:14:34 +01:00
parent 405db83393
commit 6adb069506
72 changed files with 503 additions and 314 deletions

2
.gitignore vendored
View file

@ -41,3 +41,5 @@
/lzma/x64/
/zlib/x64/
/build_vc2015
/build_vc2015-32
/build_vc2015-64

View file

@ -43,6 +43,7 @@
struct subsector_t;
class PClassAmmo;
struct FBlockNode;
//
// NOTES: AActor
@ -530,21 +531,6 @@ enum EThingSpecialActivationType
THINGSPEC_Switch = 1<<10, // The thing is alternatively activated and deactivated when triggered
};
// [RH] Like msecnode_t, but for the blockmap
struct FBlockNode
{
AActor *Me; // actor this node references
int BlockIndex; // index into blocklinks for the block this node is in
FBlockNode **PrevActor; // previous actor in this block
FBlockNode *NextActor; // next actor in this block
FBlockNode **PrevBlock; // previous block this actor is in
FBlockNode *NextBlock; // next block this actor is in
static FBlockNode *Create (AActor *who, int x, int y);
void Release ();
static FBlockNode *FreeBlocks;
};
class FDecalBase;
class AInventory;
@ -569,16 +555,6 @@ struct line_t;
struct secplane_t;
struct FStrifeDialogueNode;
struct fixedvec3
{
fixed_t x, y, z;
};
struct fixedvec2
{
fixed_t x, y;
};
class DDropItem : public DObject
{
DECLARE_CLASS(DDropItem, DObject)
@ -1407,6 +1383,7 @@ inline fixedvec3 PosRelative(const fixedvec3 &pos, line_t *line, sector_t *refse
}
void PrintMiscActorInfo(AActor * query);
AActor *P_LinePickActor(AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask);
#define S_FREETARGMOBJ 1

View file

@ -42,6 +42,8 @@
#include "r_renderer.h"
#include "r_sky.h"
#include "sbar.h"
#include "d_player.h"
#include "p_blockmap.h"
#include "m_cheat.h"
#include "i_system.h"
@ -58,6 +60,7 @@
// State.
#include "doomstat.h"
#include "r_state.h"
#include "r_utility.h"
// Data.
#include "gstrings.h"

View file

@ -13,6 +13,7 @@
#include "teaminfo.h"
#include "d_net.h"
#include "farchive.h"
#include "d_player.h"
IMPLEMENT_POINTY_CLASS(DBot)
DECLARE_POINTER(dest)

View file

@ -11,6 +11,7 @@
#include "doomdef.h"
#include "doomstat.h"
#include "p_local.h"
#include "p_maputl.h"
#include "b_bot.h"
#include "g_game.h"
#include "m_random.h"
@ -20,6 +21,8 @@
#include "i_system.h"
#include "s_sound.h"
#include "d_event.h"
#include "d_player.h"
#include "p_spec.h"
static FRandom pr_botdofire ("BotDoFire");

View file

@ -59,6 +59,7 @@ Everything that is changed is marked (maybe commented) with "Added by MC"
#include "i_system.h"
#include "d_net.h"
#include "d_netinf.h"
#include "d_player.h"
static FRandom pr_botspawn ("BotSpawn");

View file

@ -18,6 +18,8 @@
#include "a_keys.h"
#include "d_event.h"
#include "p_enemy.h"
#include "d_player.h"
#include "p_spec.h"
static FRandom pr_botopendoor ("BotOpenDoor");
static FRandom pr_bottrywalk ("BotTryWalk");

View file

@ -19,6 +19,7 @@
#include "statnums.h"
#include "d_net.h"
#include "d_event.h"
#include "d_player.h"
static FRandom pr_botmove ("BotMove");

View file

@ -81,6 +81,17 @@ union QWORD_UNION
typedef SDWORD fixed_t;
typedef DWORD dsfixed_t; // fixedpt used by span drawer
struct fixedvec3
{
fixed_t x, y, z;
};
struct fixedvec2
{
fixed_t x, y;
};
#define FIXED_MAX (signed)(0x7fffffff)
#define FIXED_MIN (signed)(0x80000000)

View file

@ -69,6 +69,8 @@
#include "v_text.h"
#include "p_lnspec.h"
#include "v_video.h"
#include "r_utility.h"
#include "r_data/r_interpolate.h"
extern FILE *Logfile;
extern bool insave;

View file

@ -60,6 +60,7 @@
#include "v_video.h"
#include "p_spec.h"
#include "hardware.h"
#include "r_utility.h"
#include "intermission/intermission.h"
EXTERN_CVAR (Int, disableautosave)

View file

@ -73,6 +73,8 @@
#include "po_man.h"
#include "autosegs.h"
#include "v_video.h"
#include "textures.h"
#include "r_utility.h"
#include "menu/menu.h"
#include "intermission/intermission.h"

View file

@ -197,6 +197,41 @@ struct PalEntry
#endif
};
class FArchive;
class PClassInventory;
class FTextureID
{
friend class FTextureManager;
friend FArchive &operator<< (FArchive &arc, FTextureID &tex);
friend FTextureID GetHUDIcon(PClassInventory *cls);
friend void R_InitSpriteDefs();
public:
FTextureID() throw() {}
bool isNull() const { return texnum == 0; }
bool isValid() const { return texnum > 0; }
bool Exists() const { return texnum >= 0; }
void SetInvalid() { texnum = -1; }
void SetNull() { texnum = 0; }
bool operator ==(const FTextureID &other) const { return texnum == other.texnum; }
bool operator !=(const FTextureID &other) const { return texnum != other.texnum; }
FTextureID operator +(int offset) throw();
int GetIndex() const { return texnum; } // Use this only if you absolutely need the index!
// The switch list needs these to sort the switches by texture index
int operator -(FTextureID other) const { return texnum - other.texnum; }
bool operator < (FTextureID other) const { return texnum < other.texnum; }
bool operator > (FTextureID other) const { return texnum > other.texnum; }
protected:
FTextureID(int num) { texnum = num; }
private:
int texnum;
};
// Screenshot buffer image data types
enum ESSType
{

View file

@ -29,6 +29,7 @@
#include "r_data/r_interpolate.h"
#include "statnums.h"
#include "farchive.h"
#include "doomstat.h"
IMPLEMENT_CLASS (DSectorEffect)

View file

@ -39,6 +39,7 @@
#include "i_system.h"
#include "doomerrors.h"
#include "farchive.h"
#include "d_player.h"
static cycle_t ThinkCycles;

View file

@ -47,6 +47,7 @@
#include "sc_man.h"
#include "g_level.h"
#include "r_renderer.h"
#include "d_player.h"
//==========================================================================
//

View file

@ -1,6 +1,7 @@
#include "actor.h"
#include "info.h"
#include "p_local.h"
#include "p_spec.h"
#include "a_sharedglobal.h"
#include "m_random.h"
#include "gi.h"
@ -15,6 +16,9 @@
#include "m_bbox.h"
#include "farchive.h"
#include "portal.h"
#include "d_player.h"
#include "p_maputl.h"
#include "g_shared/a_pickups.h"
// Include all the other Doom stuff here to reduce compile time
#include "a_arachnotron.cpp"

View file

@ -80,6 +80,9 @@
#include "m_joy.h"
#include "farchive.h"
#include "r_renderer.h"
#include "r_utility.h"
#include "a_morph.h"
#include "p_spec.h"
#include "r_data/colormaps.h"
#include <zlib.h>

View file

@ -15,6 +15,8 @@
#include "r_data/r_translate.h"
#include "doomstat.h"
#include "farchive.h"
#include "d_player.h"
#include "a_morph.h"
// Include all the other Heretic stuff here to reduce compile time
#include "a_chicken.cpp"

View file

@ -20,6 +20,10 @@
#include "farchive.h"
#include "v_palette.h"
#include "g_game.h"
#include "p_blockmap.h"
#include "r_utility.h"
#include "p_maputl.h"
#include "p_spec.h"
// Include all the Hexen stuff here to reduce compile time
#include "a_bats.cpp"

View file

@ -83,6 +83,8 @@
#include "r_data/colormaps.h"
#include "farchive.h"
#include "r_renderer.h"
#include "r_utility.h"
#include "p_spec.h"
#include "gi.h"

View file

@ -3,11 +3,14 @@
#include "a_artifacts.h"
#include "gstrings.h"
#include "p_local.h"
#include "p_spec.h"
#include "gi.h"
#include "s_sound.h"
#include "m_random.h"
#include "doomstat.h"
#include "g_game.h"
#include "d_player.h"
#include "a_morph.h"
static FRandom pr_tele ("TeleportSelf");

View file

@ -12,6 +12,8 @@
#include "g_level.h"
#include "doomstat.h"
#include "farchive.h"
#include "a_pickups.h"
#include "d_player.h"
#define MAULATORTICS (25*35)

View file

@ -20,6 +20,8 @@
#include "doomstat.h"
#include "v_palette.h"
#include "farchive.h"
#include "r_utility.h"
#include "r_data/colormaps.h"
static FRandom pr_torch ("Torch");

View file

@ -4,6 +4,7 @@
#include "g_level.h"
#include "r_sky.h"
#include "p_lnspec.h"
#include "b_bot.h"
IMPLEMENT_CLASS(AFastProjectile)

View file

@ -13,6 +13,7 @@
#include "g_level.h"
#include "farchive.h"
#include "p_enemy.h"
#include "d_player.h"
static FRandom pr_morphmonst ("MorphMonster");

View file

@ -19,6 +19,8 @@
#include "g_game.h"
#include "doomstat.h"
#include "farchive.h"
#include "d_player.h"
#include "p_spec.h"
static FRandom pr_restore ("RestorePos");

View file

@ -9,6 +9,8 @@
#include "a_sharedglobal.h"
#include "statnums.h"
#include "farchive.h"
#include "d_player.h"
#include "r_utility.h"
static FRandom pr_quake ("Quake");

View file

@ -16,6 +16,8 @@
#include "a_action.h"
#include "thingdef/thingdef.h"
#include "v_text.h"
#include "doomstat.h"
#include "doomdata.h"
#define MAX_RANDOMSPAWNERS_RECURSION 32 // Should be largely more than enough, honestly.
static FRandom pr_randomspawn("RandomSpawn");

View file

@ -40,6 +40,7 @@
#include "thingdef/thingdef.h"
#include "doomstat.h"
#include "farchive.h"
#include "a_pickups.h"
static FRandom pr_spot ("SpecialSpot");
static FRandom pr_spawnmace ("SpawnMace");

View file

@ -50,6 +50,8 @@
#include "doomstat.h"
#include "g_level.h"
#include "d_net.h"
#include "d_player.h"
#include "r_utility.h"
#include <time.h>

View file

@ -35,6 +35,7 @@
*/
#include "doomstat.h"
#include "info.h"
#include "m_fixed.h"
#include "c_dispatch.h"
@ -51,6 +52,8 @@
#include "cmdlib.h"
#include "g_level.h"
#include "stats.h"
#include "thingdef.h"
#include "d_player.h"
extern void LoadActors ();
extern void InitBotStuff();

View file

@ -26,6 +26,7 @@
#include "m_bbox.h"
#include "p_local.h"
#include "p_maputl.h"
//==========================================================================
//

View file

@ -46,6 +46,8 @@
#include "d_dehacked.h"
#include "gi.h"
#include "farchive.h"
#include "r_utility.h"
#include "a_morph.h"
// [RH] Actually handle the cheat. The cheat code in st_stuff.c now just
// writes some bytes to the network data stream, and the network code

View file

@ -38,10 +38,14 @@
#include "templates.h"
#include "p_local.h"
#include "p_lnspec.h"
#include "p_maputl.h"
#include "w_wad.h"
#include "sc_man.h"
#include "g_level.h"
#include "p_terrain.h"
#include "d_player.h"
#include "r_utility.h"
#include "p_spec.h"
#include "r_data/colormaps.h"
//==========================================================================

View file

@ -38,6 +38,8 @@
#include "templates.h"
#include "p_local.h"
#include "p_terrain.h"
#include "p_maputl.h"
#include "p_spec.h"
//============================================================================

View file

@ -40,6 +40,7 @@
#include "templates.h"
#include "doomdef.h"
#include "p_local.h"
#include "d_player.h"
#include "p_spec.h"
#include "g_level.h"
#include "s_sound.h"
@ -79,6 +80,8 @@
#include "p_terrain.h"
#include "version.h"
#include "p_effect.h"
#include "r_utility.h"
#include "a_morph.h"
#include "g_shared/a_pickups.h"

33
src/p_blockmap.h Normal file
View file

@ -0,0 +1,33 @@
#ifndef __P_BLOCKMAP_H
#define __P_BLOCKMAP_H
#include "doomtype.h"
class AActor;
// [RH] Like msecnode_t, but for the blockmap
struct FBlockNode
{
AActor *Me; // actor this node references
int BlockIndex; // index into blocklinks for the block this node is in
FBlockNode **PrevActor; // previous actor in this block
FBlockNode *NextActor; // next actor in this block
FBlockNode **PrevBlock; // previous block this actor is in
FBlockNode *NextBlock; // next block this actor is in
static FBlockNode *Create (AActor *who, int x, int y);
void Release ();
static FBlockNode *FreeBlocks;
};
extern int* blockmaplump; // offsets in blockmap are from here
extern int* blockmap;
extern int bmapwidth;
extern int bmapheight; // in mapblocks
extern fixed_t bmaporgx;
extern fixed_t bmaporgy; // origin of block map
extern FBlockNode** blocklinks; // for thing chains
#endif

View file

@ -36,6 +36,8 @@
#include "sc_man.h"
#include "cmdlib.h"
#include "farchive.h"
#include "d_player.h"
#include "p_spec.h"
//============================================================================
//

View file

@ -51,6 +51,8 @@
#include "gi.h"
#include "v_palette.h"
#include "colormatcher.h"
#include "d_player.h"
#include "r_utility.h"
CVAR (Int, cl_rockettrails, 1, CVAR_ARCHIVE);
CVAR (Bool, r_rail_smartspiral, 0, CVAR_ARCHIVE);

View file

@ -31,6 +31,8 @@
#include "i_system.h"
#include "doomdef.h"
#include "p_local.h"
#include "p_maputl.h"
#include "d_player.h"
#include "m_bbox.h"
#include "p_lnspec.h"
#include "s_sound.h"
@ -44,8 +46,11 @@
#include "thingdef/thingdef.h"
#include "d_dehacked.h"
#include "g_level.h"
#include "r_utility.h"
#include "p_blockmap.h"
#include "r_data/r_translate.h"
#include "teaminfo.h"
#include "p_spec.h"
#include "gi.h"

View file

@ -65,6 +65,8 @@
#include "version.h"
#include "md5.h"
#include "m_misc.h"
#include "r_utility.h"
#include "cmdlib.h"
void P_GetPolySpots (MapData * lump, TArray<FNodeBuilder::FPolyStart> &spots, TArray<FNodeBuilder::FPolyStart> &anchors);

View file

@ -58,6 +58,7 @@
#include "g_level.h"
#include "d_net.h"
#include "d_netinf.h"
#include "a_morph.h"
static FRandom pr_obituary ("Obituary");
static FRandom pr_botrespawn ("BotRespawn");

View file

@ -27,8 +27,10 @@
#include "doomdef.h"
#include "p_local.h"
#include "p_spec.h"
#include "p_lnspec.h"
#include "doomstat.h"
// State.
#include "r_state.h"

View file

@ -58,8 +58,12 @@
#include "d_event.h"
#include "gstrings.h"
#include "portal.h"
#include "po_man.h"
#include "d_player.h"
#include "r_utility.h"
#include "r_data/colormaps.h"
#include "fragglescript/t_fs.h"
#include "p_spec.h"
// Remaps EE sector change types to Generic_Floor values. According to the Eternity Wiki:
/*

View file

@ -24,13 +24,19 @@
#define __P_LOCAL__
#include "doomtype.h"
#include "doomdef.h"
#include "tables.h"
#include "r_state.h"
#include "r_utility.h"
#include "d_player.h"
#include "a_morph.h"
class player_t;
class AActor;
struct FPlayerStart;
class PClassActor;
struct fixedvec3;
class APlayerPawn;
struct line_t;
struct sector_t;
struct msecnode_t;
struct secplane_t;
#include <stdlib.h>
@ -119,7 +125,7 @@ void P_PredictionLerpReset();
#define SPF_TEMPPLAYER 1 // spawning a short-lived dummy player
#define SPF_WEAPONFULLYUP 2 // spawn with weapon already raised
APlayerPawn *P_SpawnPlayer (struct FPlayerStart *mthing, int playernum, int flags=0);
APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags=0);
void P_ThrustMobj (AActor *mo, angle_t angle, fixed_t move);
int P_FaceMobj (AActor *source, AActor *target, angle_t *delta);
@ -221,200 +227,6 @@ enum WARPF
//
// P_MAPUTL
//
struct divline_t
{
fixed_t x;
fixed_t y;
fixed_t dx;
fixed_t dy;
};
struct intercept_t
{
fixed_t frac; // along trace line
bool isaline;
bool done;
union {
AActor *thing;
line_t *line;
} d;
};
typedef bool (*traverser_t) (intercept_t *in);
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
//==========================================================================
//
// P_PointOnLineSide
//
// Returns 0 (front/on) or 1 (back)
// [RH] inlined, stripped down, and made more precise
//
//==========================================================================
inline int P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line)
{
extern int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line);
return i_compatflags2 & COMPATF2_POINTONLINE
? P_VanillaPointOnLineSide(x, y, line)
: DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
}
inline int P_PointOnLineSidePrecise (fixed_t x, fixed_t y, const line_t *line)
{
return DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
}
//==========================================================================
//
// P_PointOnDivlineSide
//
// Same as P_PointOnLineSide except it uses divlines
// [RH] inlined, stripped down, and made more precise
//
//==========================================================================
inline int P_PointOnDivlineSide (fixed_t x, fixed_t y, const divline_t *line)
{
extern int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const divline_t* line);
return (i_compatflags2 & COMPATF2_POINTONLINE)
? P_VanillaPointOnDivlineSide(x, y, line)
: (DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0);
}
inline int P_PointOnDivlineSidePrecise (fixed_t x, fixed_t y, const divline_t *line)
{
return DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0;
}
//==========================================================================
//
// P_MakeDivline
//
//==========================================================================
inline void P_MakeDivline (const line_t *li, divline_t *dl)
{
dl->x = li->v1->x;
dl->y = li->v1->y;
dl->dx = li->dx;
dl->dy = li->dy;
}
fixed_t P_InterceptVector (const divline_t *v2, const divline_t *v1);
struct FLineOpening
{
fixed_t top;
fixed_t bottom;
fixed_t range;
fixed_t lowfloor;
sector_t *bottomsec;
sector_t *topsec;
FTextureID ceilingpic;
FTextureID floorpic;
int floorterrain;
bool touchmidtex;
bool abovemidtex;
};
void P_LineOpening (FLineOpening &open, AActor *thing, const line_t *linedef, fixed_t x, fixed_t y, fixed_t refx=FIXED_MIN, fixed_t refy=0, int flags=0);
class FBoundingBox;
struct polyblock_t;
class FBlockLinesIterator
{
int minx, maxx;
int miny, maxy;
int curx, cury;
polyblock_t *polyLink;
int polyIndex;
int *list;
void StartBlock(int x, int y);
public:
FBlockLinesIterator(int minx, int miny, int maxx, int maxy, bool keepvalidcount = false);
FBlockLinesIterator(const FBoundingBox &box);
line_t *Next();
void Reset() { StartBlock(minx, miny); }
};
class FBlockThingsIterator
{
int minx, maxx;
int miny, maxy;
int curx, cury;
FBlockNode *block;
int Buckets[32];
struct HashEntry
{
AActor *Actor;
int Next;
};
HashEntry FixedHash[10];
int NumFixedHash;
TArray<HashEntry> DynHash;
HashEntry *GetHashEntry(int i) { return i < (int)countof(FixedHash) ? &FixedHash[i] : &DynHash[i - countof(FixedHash)]; }
void StartBlock(int x, int y);
void SwitchBlock(int x, int y);
void ClearHash();
// The following is only for use in the path traverser
// and therefore declared private.
FBlockThingsIterator();
friend class FPathTraverse;
public:
FBlockThingsIterator(int minx, int miny, int maxx, int maxy);
FBlockThingsIterator(const FBoundingBox &box);
AActor *Next(bool centeronly = false);
void Reset() { StartBlock(minx, miny); }
};
class FPathTraverse
{
static TArray<intercept_t> intercepts;
divline_t trace;
unsigned int intercept_index;
unsigned int intercept_count;
unsigned int count;
void AddLineIntercepts(int bx, int by);
void AddThingIntercepts(int bx, int by, FBlockThingsIterator &it, bool compatible);
public:
intercept_t *Next();
FPathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags);
~FPathTraverse();
const divline_t &Trace() const { return trace; }
};
#define PT_ADDLINES 1
#define PT_ADDTHINGS 2
#define PT_COMPATIBLE 4
#define PT_DELTA 8 // x2,y2 is passed as a delta, not as an endpoint
AActor *P_BlockmapSearch (AActor *mo, int distance, AActor *(*check)(AActor*, int, void *), void *params = NULL);
AActor *P_RoughMonsterSearch (AActor *mo, int distance, bool onlyseekable=false);
@ -451,6 +263,8 @@ struct FCheckPosition
// ripping damage once per tic instead of once per move.
bool DoRipping;
TMap<AActor*, bool> LastRipped;
//FPortalGroupTable Groups;
int PushTime;
FCheckPosition(bool rip=false)
@ -539,7 +353,6 @@ enum // P_LineAttack flags
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, PClassActor *pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, int flags = 0, AActor **victim = NULL, int *actualdamage = NULL);
AActor *P_LinePickActor (AActor *t1, angle_t angle, fixed_t distance, int pitch, ActorFlags actorMask, DWORD wallMask);
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version
@ -587,31 +400,10 @@ bool Check_Sides(AActor *, int, int); // phares
// [RH]
const secplane_t * P_CheckSlopeWalk (AActor *actor, fixed_t &xmove, fixed_t &ymove);
//----------------------------------------------------------------------------------
//
// Added so that in the source there's a clear distinction between
// game engine and renderer specific calls.
// (For ZDoom itself this doesn't make any difference here but for GZDoom it does.)
//
//----------------------------------------------------------------------------------
subsector_t *P_PointInSubsector (fixed_t x, fixed_t y);
inline sector_t *P_PointInSector(fixed_t x, fixed_t y)
{
return P_PointInSubsector(x,y)->sector;
}
//
// P_SETUP
//
extern BYTE* rejectmatrix; // for fast sight rejection
extern int* blockmaplump; // offsets in blockmap are from here
extern int* blockmap;
extern int bmapwidth;
extern int bmapheight; // in mapblocks
extern fixed_t bmaporgx;
extern fixed_t bmaporgy; // origin of block map
extern FBlockNode** blocklinks; // for thing chains
@ -639,46 +431,9 @@ enum EDmgFlags
};
// ===== PO_MAN =====
typedef enum
{
PODOOR_NONE,
PODOOR_SLIDE,
PODOOR_SWING,
} podoortype_t;
bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle, int direction, bool overRide);
bool EV_MovePoly (line_t *line, int polyNum, int speed, angle_t angle, fixed_t dist, bool overRide);
bool EV_MovePolyTo (line_t *line, int polyNum, int speed, fixed_t x, fixed_t y, bool overRide);
bool EV_OpenPolyDoor (line_t *line, int polyNum, int speed, angle_t angle, int delay, int distance, podoortype_t type);
bool EV_StopPoly (int polyNum);
// [RH] Data structure for P_SpawnMapThing() to keep track
// of polyobject-related things.
struct polyspawns_t
{
polyspawns_t *next;
fixed_t x;
fixed_t y;
short angle;
short type;
};
extern int po_NumPolyobjs;
extern polyspawns_t *polyspawns; // [RH] list of polyobject things to spawn
void PO_Init ();
bool PO_Busy (int polyobj);
FPolyObj *PO_GetPolyobj(int polyNum);
//
// P_SPEC
//
#include "p_spec.h"
bool P_AlignFlat (int linenum, int side, int fc);
#endif // __P_LOCAL__

View file

@ -34,10 +34,14 @@
#include "doomdef.h"
#include "p_local.h"
#include "p_spec.h"
#include "d_player.h"
#include "p_maputl.h"
#include "p_lnspec.h"
#include "p_effect.h"
#include "p_terrain.h"
#include "p_trace.h"
#include "r_utility.h"
#include "s_sound.h"
#include "decallib.h"

View file

@ -32,9 +32,13 @@
#include "m_bbox.h"
#include "doomdef.h"
#include "doomdata.h"
#include "doomstat.h"
#include "p_local.h"
#include "p_maputl.h"
#include "p_3dmidtex.h"
#include "p_blockmap.h"
#include "r_utility.h"
// State.
#include "r_state.h"

208
src/p_maputl.h Normal file
View file

@ -0,0 +1,208 @@
#ifndef __P_MAPUTL_H
#define __P_MAPUTL_H
#include "r_defs.h"
#include "doomstat.h"
extern int validcount;
struct divline_t
{
fixed_t x;
fixed_t y;
fixed_t dx;
fixed_t dy;
};
struct intercept_t
{
fixed_t frac; // along trace line
bool isaline;
bool done;
union {
AActor *thing;
line_t *line;
} d;
};
//==========================================================================
//
// P_PointOnLineSide
//
// Returns 0 (front/on) or 1 (back)
// [RH] inlined, stripped down, and made more precise
//
//==========================================================================
inline int P_PointOnLineSide (fixed_t x, fixed_t y, const line_t *line)
{
extern int P_VanillaPointOnLineSide(fixed_t x, fixed_t y, const line_t* line);
return i_compatflags2 & COMPATF2_POINTONLINE
? P_VanillaPointOnLineSide(x, y, line)
: DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
}
inline int P_PointOnLineSidePrecise (fixed_t x, fixed_t y, const line_t *line)
{
return DMulScale32 (y-line->v1->y, line->dx, line->v1->x-x, line->dy) > 0;
}
//==========================================================================
//
// P_PointOnDivlineSide
//
// Same as P_PointOnLineSide except it uses divlines
// [RH] inlined, stripped down, and made more precise
//
//==========================================================================
inline int P_PointOnDivlineSide (fixed_t x, fixed_t y, const divline_t *line)
{
extern int P_VanillaPointOnDivlineSide(fixed_t x, fixed_t y, const divline_t* line);
return (i_compatflags2 & COMPATF2_POINTONLINE)
? P_VanillaPointOnDivlineSide(x, y, line)
: (DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0);
}
inline int P_PointOnDivlineSidePrecise (fixed_t x, fixed_t y, const divline_t *line)
{
return DMulScale32 (y-line->y, line->dx, line->x-x, line->dy) > 0;
}
//==========================================================================
//
// P_MakeDivline
//
//==========================================================================
inline void P_MakeDivline (const line_t *li, divline_t *dl)
{
dl->x = li->v1->x;
dl->y = li->v1->y;
dl->dx = li->dx;
dl->dy = li->dy;
}
struct FLineOpening
{
fixed_t top;
fixed_t bottom;
fixed_t range;
fixed_t lowfloor;
sector_t *bottomsec;
sector_t *topsec;
FTextureID ceilingpic;
FTextureID floorpic;
int floorterrain;
bool touchmidtex;
bool abovemidtex;
};
void P_LineOpening (FLineOpening &open, AActor *thing, const line_t *linedef, fixed_t x, fixed_t y, fixed_t refx=FIXED_MIN, fixed_t refy=0, int flags=0);
class FBoundingBox;
struct polyblock_t;
class FBlockLinesIterator
{
int minx, maxx;
int miny, maxy;
int curx, cury;
polyblock_t *polyLink;
int polyIndex;
int *list;
void StartBlock(int x, int y);
public:
FBlockLinesIterator(int minx, int miny, int maxx, int maxy, bool keepvalidcount = false);
FBlockLinesIterator(const FBoundingBox &box);
line_t *Next();
void Reset() { StartBlock(minx, miny); }
};
class FBlockThingsIterator
{
int minx, maxx;
int miny, maxy;
int curx, cury;
FBlockNode *block;
int Buckets[32];
struct HashEntry
{
AActor *Actor;
int Next;
};
HashEntry FixedHash[10];
int NumFixedHash;
TArray<HashEntry> DynHash;
HashEntry *GetHashEntry(int i) { return i < (int)countof(FixedHash) ? &FixedHash[i] : &DynHash[i - countof(FixedHash)]; }
void StartBlock(int x, int y);
void SwitchBlock(int x, int y);
void ClearHash();
// The following is only for use in the path traverser
// and therefore declared private.
FBlockThingsIterator();
friend class FPathTraverse;
public:
FBlockThingsIterator(int minx, int miny, int maxx, int maxy);
FBlockThingsIterator(const FBoundingBox &box);
AActor *Next(bool centeronly = false);
void Reset() { StartBlock(minx, miny); }
};
class FPathTraverse
{
static TArray<intercept_t> intercepts;
divline_t trace;
unsigned int intercept_index;
unsigned int intercept_count;
unsigned int count;
void AddLineIntercepts(int bx, int by);
void AddThingIntercepts(int bx, int by, FBlockThingsIterator &it, bool compatible);
public:
intercept_t *Next();
FPathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags);
~FPathTraverse();
const divline_t &Trace() const { return trace; }
};
//
// P_MAPUTL
//
typedef bool(*traverser_t) (intercept_t *in);
fixed_t P_AproxDistance (fixed_t dx, fixed_t dy);
fixed_t P_InterceptVector (const divline_t *v2, const divline_t *v1);
#define PT_ADDLINES 1
#define PT_ADDTHINGS 2
#define PT_COMPATIBLE 4
#define PT_DELTA 8 // x2,y2 is passed as a delta, not as an endpoint
#endif

View file

@ -29,6 +29,7 @@
#include "m_random.h"
#include "doomdef.h"
#include "p_local.h"
#include "p_maputl.h"
#include "p_lnspec.h"
#include "p_effect.h"
#include "p_terrain.h"
@ -66,6 +67,8 @@
#include "farchive.h"
#include "r_data/colormaps.h"
#include "r_renderer.h"
#include "po_man.h"
#include "p_spec.h"
// MACROS ------------------------------------------------------------------

View file

@ -34,8 +34,10 @@
#include "i_system.h"
#include "p_local.h"
#include "p_spec.h"
// State.
#include "d_player.h"
#include "dobject.h"
#include "doomstat.h"
#include "r_state.h"

View file

@ -29,6 +29,7 @@
#endif
#include "templates.h"
#include "d_player.h"
#include "m_argv.h"
#include "m_swap.h"
#include "m_bbox.h"
@ -69,6 +70,9 @@
#include "r_renderer.h"
#include "r_data/colormaps.h"
#include "portal.h"
#include "p_blockmap.h"
#include "r_utility.h"
#include "p_spec.h"
#ifndef NO_EDATA
#include "edata.h"
#endif

View file

@ -14,11 +14,16 @@
#include "doomdef.h"
#include "i_system.h"
#include "p_local.h"
#include "p_maputl.h"
#include "p_blockmap.h"
#include "m_random.h"
#include "m_bbox.h"
#include "p_lnspec.h"
#include "g_level.h"
#include "po_man.h"
#include "r_utility.h"
#include "b_bot.h"
#include "p_spec.h"
// State.
#include "r_state.h"

View file

@ -36,6 +36,8 @@
#include "p_local.h"
#include "cmdlib.h"
#include "p_lnspec.h"
#include "p_maputl.h"
#include "p_spec.h"
//===========================================================================
//

View file

@ -46,6 +46,8 @@
#include "w_wad.h"
#include "p_local.h"
#include "p_spec.h"
#include "p_blockmap.h"
#include "p_lnspec.h"
#include "p_terrain.h"
#include "p_acs.h"
@ -64,7 +66,10 @@
#include "a_keys.h"
#include "c_dispatch.h"
#include "r_sky.h"
#include "d_player.h"
#include "portal.h"
#include "p_maputl.h"
#include "p_blockmap.h"
#ifndef NO_EDATA
#include "edata.h"
#endif

View file

@ -47,6 +47,8 @@
#include "tarray.h"
#include "cmdlib.h"
#include "farchive.h"
#include "p_maputl.h"
#include "p_spec.h"
#include "gi.h"

View file

@ -34,6 +34,10 @@
#include "m_random.h"
#include "i_system.h"
#include "doomstat.h"
#include "d_player.h"
#include "p_maputl.h"
#include "r_utility.h"
#include "p_spec.h"
#define FUDGEFACTOR 10

View file

@ -47,6 +47,9 @@
#include "g_level.h"
#include "v_text.h"
#include "i_system.h"
#include "d_player.h"
#include "r_utility.h"
#include "p_spec.h"
// Set of spawnable things for the Thing_Spawn and Thing_Projectile specials.
FClassMap SpawnableThings;

View file

@ -31,7 +31,10 @@
#include "sbar.h"
#include "r_data/r_interpolate.h"
#include "i_sound.h"
#include "d_player.h"
#include "g_level.h"
#include "r_utility.h"
#include "p_spec.h"
extern gamestate_t wipegamestate;

View file

@ -37,6 +37,9 @@
#include "i_system.h"
#include "r_sky.h"
#include "doomstat.h"
#include "p_maputl.h"
#include "r_defs.h"
#include "p_spec.h"
struct FTraceInfo
{

View file

@ -54,6 +54,11 @@
#include "gstrings.h"
#include "farchive.h"
#include "r_renderer.h"
#include "d_player.h"
#include "r_utility.h"
#include "p_blockmap.h"
#include "a_morph.h"
#include "p_spec.h"
static FRandom pr_skullpop ("SkullPop");

View file

@ -5,6 +5,8 @@
#include "r_defs.h"
#include "m_swap.h"
#include "doomstat.h"
#include "d_player.h"
#include "p_spec.h"
static int WriteTHINGS (FILE *file);
static int WriteLINEDEFS (FILE *file);

View file

@ -29,6 +29,9 @@
#include "p_setup.h"
#include "vectors.h"
#include "farchive.h"
#include "p_blockmap.h"
#include "p_maputl.h"
#include "r_utility.h"
// MACROS ------------------------------------------------------------------

View file

@ -107,4 +107,40 @@ FArchive &operator<< (FArchive &arc, FPolyObj *&poly);
FArchive &operator<< (FArchive &arc, const FPolyObj *&poly);
// ===== PO_MAN =====
typedef enum
{
PODOOR_NONE,
PODOOR_SLIDE,
PODOOR_SWING,
} podoortype_t;
bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle, int direction, bool overRide);
bool EV_MovePoly (line_t *line, int polyNum, int speed, angle_t angle, fixed_t dist, bool overRide);
bool EV_MovePolyTo (line_t *line, int polyNum, int speed, fixed_t x, fixed_t y, bool overRide);
bool EV_OpenPolyDoor (line_t *line, int polyNum, int speed, angle_t angle, int delay, int distance, podoortype_t type);
bool EV_StopPoly (int polyNum);
// [RH] Data structure for P_SpawnMapThing() to keep track
// of polyobject-related things.
struct polyspawns_t
{
polyspawns_t *next;
fixed_t x;
fixed_t y;
short angle;
short type;
};
extern int po_NumPolyobjs;
extern polyspawns_t *polyspawns; // [RH] list of polyobject things to spawn
void PO_Init ();
bool PO_Busy (int polyobj);
FPolyObj *PO_GetPolyobj(int polyNum);
#endif

View file

@ -11,6 +11,8 @@
#include "a_sharedglobal.h"
#include "i_system.h"
#include "c_dispatch.h"
#include "p_maputl.h"
#include "p_spec.h"
// simulation recurions maximum
CVAR(Int, sv_portal_recursions, 4, CVAR_ARCHIVE|CVAR_SERVERINFO)

View file

@ -1153,4 +1153,17 @@ struct visstyle_t
};
//----------------------------------------------------------------------------------
//
// The playsim can use different nodes than the renderer so this is
// not the same as R_PointInSubsector
//
//----------------------------------------------------------------------------------
subsector_t *P_PointInSubsector(fixed_t x, fixed_t y);
inline sector_t *P_PointInSector(fixed_t x, fixed_t y)
{
return P_PointInSubsector(x, y)->sector;
}
#endif

View file

@ -63,6 +63,7 @@
#include "r_data/colormaps.h"
#include "r_data/voxels.h"
#include "p_local.h"
#include "p_maputl.h"
// [RH] A c-buffer. Used for keeping track of offscreen voxel spans.

View file

@ -55,6 +55,8 @@
#include "r_renderer.h"
#include "r_data/colormaps.h"
#include "farchive.h"
#include "r_utility.h"
#include "d_player.h"
// EXTERNAL DATA DECLARATIONS ----------------------------------------------

View file

@ -28,6 +28,7 @@
#include "c_dispatch.h"
#include "g_level.h"
#include "farchive.h"
#include "d_player.h"
// MACROS ------------------------------------------------------------------

View file

@ -51,6 +51,7 @@
#include "g_level.h"
#include "po_man.h"
#include "farchive.h"
#include "d_player.h"
// MACROS ------------------------------------------------------------------

View file

@ -14,36 +14,6 @@ class FArchive;
class FTextureManager;
class FTerrainTypeArray;
class FTextureID
{
friend class FTextureManager;
friend FArchive &operator<< (FArchive &arc, FTextureID &tex);
friend FTextureID GetHUDIcon(PClassInventory *cls);
friend void R_InitSpriteDefs ();
public:
FTextureID() throw() {}
bool isNull() const { return texnum == 0; }
bool isValid() const { return texnum > 0; }
bool Exists() const { return texnum >= 0; }
void SetInvalid() { texnum = -1; }
void SetNull() { texnum = 0; }
bool operator ==(const FTextureID &other) const { return texnum == other.texnum; }
bool operator !=(const FTextureID &other) const { return texnum != other.texnum; }
FTextureID operator +(int offset) throw();
int GetIndex() const { return texnum; } // Use this only if you absolutely need the index!
// The switch list needs these to sort the switches by texture index
int operator -(FTextureID other) const { return texnum - other.texnum; }
bool operator < (FTextureID other) const { return texnum < other.texnum; }
bool operator > (FTextureID other) const { return texnum > other.texnum; }
protected:
FTextureID(int num) { texnum = num; }
private:
int texnum;
};
class FNullTextureID : public FTextureID
{
public:

View file

@ -73,6 +73,9 @@
#include "p_trace.h"
#include "p_setup.h"
#include "gstrings.h"
#include "d_player.h"
#include "p_maputl.h"
#include "p_spec.h"
AActor *SingleActorFromTID(int tid, AActor *defactor);