2016-03-01 15:47:10 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
|
|
|
// Simple basic typedefs, isolated here to make it easier
|
|
|
|
// separating modules.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __DOOMTYPE__
|
|
|
|
#define __DOOMTYPE__
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
// VC++ does not define PATH_MAX, but the Windows headers do define MAX_PATH.
|
|
|
|
// However, we want to avoid including the Windows headers in most of the
|
|
|
|
// source files, so we can't use it. So define PATH_MAX to be what MAX_PATH
|
|
|
|
// currently is:
|
|
|
|
#define PATH_MAX 260
|
|
|
|
|
|
|
|
// Disable warning about using unsized arrays in structs. It supports it just
|
|
|
|
// fine, and so do Clang and GCC, but the latter two don't warn about it.
|
|
|
|
#pragma warning(disable:4200)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <limits.h>
|
2017-02-08 18:10:11 +00:00
|
|
|
#include <tuple>
|
|
|
|
#include <algorithm>
|
2016-03-01 15:47:10 +00:00
|
|
|
#include "tarray.h"
|
|
|
|
#include "name.h"
|
|
|
|
#include "zstring.h"
|
2020-04-11 10:19:28 +00:00
|
|
|
#include "cmdlib.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
class PClassActor;
|
|
|
|
typedef TMap<int, PClassActor *> FClassMap;
|
|
|
|
|
2020-04-11 10:19:28 +00:00
|
|
|
#include "basics.h"
|
2020-04-11 10:27:07 +00:00
|
|
|
#include "printf.h"
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// Bounding box coordinate storage.
|
2019-08-20 18:38:29 +00:00
|
|
|
#include "palentry.h"
|
2018-03-21 23:29:01 +00:00
|
|
|
|
2018-03-25 18:26:16 +00:00
|
|
|
enum class ETextureType : uint8_t
|
|
|
|
{
|
|
|
|
Any,
|
|
|
|
Wall,
|
|
|
|
Flat,
|
|
|
|
Sprite,
|
|
|
|
WallPatch,
|
|
|
|
Build, // no longer used but needs to remain for ZScript
|
|
|
|
SkinSprite,
|
|
|
|
Decal,
|
|
|
|
MiscPatch,
|
|
|
|
FontChar,
|
|
|
|
Override, // For patches between TX_START/TX_END
|
|
|
|
Autopage, // Automap background - used to enable the use of FAutomapTexture
|
|
|
|
SkinGraphic,
|
|
|
|
Null,
|
|
|
|
FirstDefined,
|
2018-04-05 21:08:09 +00:00
|
|
|
SWCanvas,
|
2018-03-25 18:26:16 +00:00
|
|
|
};
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
class FTextureID
|
|
|
|
{
|
|
|
|
friend class FTextureManager;
|
|
|
|
friend void R_InitSpriteDefs();
|
|
|
|
|
|
|
|
public:
|
2018-08-25 21:51:07 +00:00
|
|
|
FTextureID() = default;
|
2016-03-01 15:47:10 +00:00
|
|
|
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!
|
2020-04-11 16:53:56 +00:00
|
|
|
void SetIndex(int index) { texnum = index; } // Use this only if you absolutely need the index!
|
2016-03-01 15:47:10 +00:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
};
|
|
|
|
|
2017-01-15 22:21:38 +00:00
|
|
|
// This is for the script interface which needs to do casts from int to texture.
|
|
|
|
class FSetTextureID : public FTextureID
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FSetTextureID(int v) : FTextureID(v) {}
|
|
|
|
};
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2019-01-06 08:00:52 +00:00
|
|
|
enum class ELightMode : int8_t
|
|
|
|
{
|
|
|
|
NotSet = -1,
|
|
|
|
LinearStandard = 0,
|
|
|
|
DoomBright = 1,
|
|
|
|
Doom = 2,
|
|
|
|
DoomDark = 3,
|
|
|
|
DoomLegacy = 4,
|
|
|
|
ZDoomSoftware = 8,
|
|
|
|
DoomSoftware = 16
|
|
|
|
};
|
2016-03-01 15:47:10 +00:00
|
|
|
|
2016-03-10 21:36:28 +00:00
|
|
|
// always use our own definition for consistency.
|
|
|
|
#ifdef M_PI
|
|
|
|
#undef M_PI
|
2016-03-01 15:47:10 +00:00
|
|
|
#endif
|
|
|
|
|
2016-03-10 21:36:28 +00:00
|
|
|
const double M_PI = 3.14159265358979323846; // matches value in gcc v2 math.h
|
|
|
|
|
2018-04-28 22:09:44 +00:00
|
|
|
inline float DEG2RAD(float deg)
|
|
|
|
{
|
|
|
|
return deg * float(M_PI / 180.0);
|
|
|
|
}
|
|
|
|
|
2019-06-10 10:01:01 +00:00
|
|
|
inline double DEG2RAD(double deg)
|
|
|
|
{
|
|
|
|
return deg * (M_PI / 180.0);
|
|
|
|
}
|
|
|
|
|
2018-04-28 22:09:44 +00:00
|
|
|
inline float RAD2DEG(float deg)
|
|
|
|
{
|
|
|
|
return deg * float(180. / M_PI);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-03-01 15:47:10 +00:00
|
|
|
// Auto-registration sections for GCC.
|
|
|
|
// Apparently, you cannot do string concatenation inside section attributes.
|
|
|
|
#ifdef __MACH__
|
|
|
|
#define SECTION_AREG "__DATA,areg"
|
|
|
|
#define SECTION_CREG "__DATA,creg"
|
2016-11-22 20:16:13 +00:00
|
|
|
#define SECTION_FREG "__DATA,freg"
|
2016-03-01 15:47:10 +00:00
|
|
|
#define SECTION_GREG "__DATA,greg"
|
|
|
|
#define SECTION_MREG "__DATA,mreg"
|
|
|
|
#define SECTION_YREG "__DATA,yreg"
|
|
|
|
#else
|
|
|
|
#define SECTION_AREG "areg"
|
|
|
|
#define SECTION_CREG "creg"
|
2016-11-22 20:16:13 +00:00
|
|
|
#define SECTION_FREG "freg"
|
2016-03-01 15:47:10 +00:00
|
|
|
#define SECTION_GREG "greg"
|
|
|
|
#define SECTION_MREG "mreg"
|
|
|
|
#define SECTION_YREG "yreg"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|