mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 08:52:00 +00:00
- Blood: Removed most #defines.
only ThrowError and dassert left... The unused BitWriter class was also removed.
This commit is contained in:
parent
7b6964a08f
commit
2769abcf0f
14 changed files with 84 additions and 111 deletions
|
@ -29,14 +29,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
#ifdef NOONE_EXTENSIONS
|
#ifdef NOONE_EXTENSIONS
|
||||||
#define kGenDudeDefaultSeq 11520
|
enum
|
||||||
#define kGenDudeMaxSlaves 7
|
{
|
||||||
#define kGenDudeTransformStatus -222
|
kGenDudeDefaultSeq = 11520,
|
||||||
#define kGenDudeUpdTimeRate 10
|
kGenDudeMaxSlaves = 7,
|
||||||
#define kGenDudeMaxMeleeDist 2048
|
kGenDudeTransformStatus = -222,
|
||||||
#define kGenDudeMinDispesion 200
|
kGenDudeUpdTimeRate = 10,
|
||||||
#define kGenDudeMaxDispersion 3500
|
kGenDudeMaxMeleeDist = 2048,
|
||||||
#define kGenDudeKlabsAng 56
|
kGenDudeMinDispesion = 200,
|
||||||
|
kGenDudeMaxDispersion = 3500,
|
||||||
|
kGenDudeKlabsAng = 56
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kGenDudeSeqIdleL = 0,
|
kGenDudeSeqIdleL = 0,
|
||||||
|
|
|
@ -135,7 +135,7 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
|
||||||
{
|
{
|
||||||
dassert(nViewEffect >= 0 && nViewEffect < kViewEffectMax);
|
dassert(nViewEffect >= 0 && nViewEffect < kViewEffectMax);
|
||||||
auto pTSprite = &tsprite[nTSprite];
|
auto pTSprite = &tsprite[nTSprite];
|
||||||
if (gDetail < effectDetail[nViewEffect] || nTSprite >= kMaxViewSprites) return NULL;
|
if (gDetail < effectDetail[nViewEffect] || nTSprite >= maxspritesonscreen) return NULL;
|
||||||
switch (nViewEffect)
|
switch (nViewEffect)
|
||||||
{
|
{
|
||||||
case VIEW_EFFECT_18:
|
case VIEW_EFFECT_18:
|
||||||
|
@ -229,7 +229,7 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
|
||||||
{
|
{
|
||||||
nAng = (nAng+1024)&2047;
|
nAng = (nAng+1024)&2047;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 5 && spritesortcnt < kMaxViewSprites; i++)
|
for (int i = 0; i < 5 && spritesortcnt < maxspritesonscreen; i++)
|
||||||
{
|
{
|
||||||
int nSector = pTSprite->sectnum;
|
int nSector = pTSprite->sectnum;
|
||||||
auto pNSprite = viewInsertTSprite<tspritetype>(nSector, 32767, NULL);
|
auto pNSprite = viewInsertTSprite<tspritetype>(nSector, 32767, NULL);
|
||||||
|
@ -444,7 +444,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
|
||||||
{
|
{
|
||||||
// shift before interpolating to increase precision.
|
// shift before interpolating to increase precision.
|
||||||
int myclock = (gFrameClock<<3) + mulscale16(4<<3, smoothratio);
|
int myclock = (gFrameClock<<3) + mulscale16(4<<3, smoothratio);
|
||||||
dassert(spritesortcnt <= kMaxViewSprites);
|
dassert(spritesortcnt <= maxspritesonscreen);
|
||||||
gCameraAng = cA;
|
gCameraAng = cA;
|
||||||
int nViewSprites = spritesortcnt;
|
int nViewSprites = spritesortcnt;
|
||||||
for (int nTSprite = spritesortcnt-1; nTSprite >= 0; nTSprite--)
|
for (int nTSprite = spritesortcnt-1; nTSprite >= 0; nTSprite--)
|
||||||
|
@ -648,7 +648,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t
|
||||||
pTSprite->xrepeat = pTSprite->yrepeat = 0;
|
pTSprite->xrepeat = pTSprite->yrepeat = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (spritesortcnt >= kMaxViewSprites) continue;
|
if (spritesortcnt >= maxspritesonscreen) continue;
|
||||||
if (pTXSprite && pTXSprite->burnTime > 0)
|
if (pTXSprite && pTXSprite->burnTime > 0)
|
||||||
{
|
{
|
||||||
pTSprite->shade = ClipRange(pTSprite->shade-16-QRandom(8), -128, 127);
|
pTSprite->shade = ClipRange(pTSprite->shade-16-QRandom(8), -128, 127);
|
||||||
|
|
|
@ -36,7 +36,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
#define kMaxAmbChannel 64
|
enum {kMaxAmbChannel = 64 };
|
||||||
|
|
||||||
struct AMB_CHANNEL
|
struct AMB_CHANNEL
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,12 +33,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
// I don't think we still need these.
|
// I don't think we still need these.
|
||||||
#define DICT_LOAD 0
|
enum
|
||||||
#define DICT_LOCK 0
|
{
|
||||||
|
DICT_LOAD = 0,
|
||||||
#define kMaxCmdLineDefines 5
|
DICT_LOCK = 0,
|
||||||
#define kMaxDefines 1000
|
|
||||||
#define kMaxParseLevels 5
|
kMaxCmdLineDefines = 5,
|
||||||
|
kMaxDefines = 1000,
|
||||||
|
kMaxParseLevels = 5
|
||||||
|
};
|
||||||
static int nCmdDefines = 0;
|
static int nCmdDefines = 0;
|
||||||
static int nDefines = 0;
|
static int nDefines = 0;
|
||||||
|
|
||||||
|
|
|
@ -38,23 +38,15 @@ BEGIN_BLD_NS
|
||||||
void _SetErrorLoc(const char *pzFile, int nLine);
|
void _SetErrorLoc(const char *pzFile, int nLine);
|
||||||
void __dassert(const char *pzExpr, const char *pzFile, int nLine);
|
void __dassert(const char *pzExpr, const char *pzFile, int nLine);
|
||||||
void QuitGame(void);
|
void QuitGame(void);
|
||||||
void _consoleSysMsg(const char* pMessage, ...);
|
void consoleSysMsg(const char* pMessage, ...);
|
||||||
|
|
||||||
#define ThrowError(...) \
|
#define ThrowError(...) \
|
||||||
{ \
|
{ \
|
||||||
I_Error(__VA_ARGS__); \
|
I_Error(__VA_ARGS__); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// print error to console only
|
|
||||||
#define consoleSysMsg(...) \
|
|
||||||
{ \
|
|
||||||
_consoleSysMsg(__VA_ARGS__); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define dassert(x) assert(x)
|
#define dassert(x) assert(x)
|
||||||
|
|
||||||
#define kMaxViewSprites maxspritesonscreen
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
kMaxSectors = MAXSECTORS,
|
kMaxSectors = MAXSECTORS,
|
||||||
|
@ -426,38 +418,40 @@ kAiStateRecoil = 5,
|
||||||
kAiStateAttack = 6,
|
kAiStateAttack = 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
// sprite attributes
|
enum
|
||||||
#define kHitagAutoAim 0x0008
|
{
|
||||||
#define kHitagRespawn 0x0010
|
// sprite attributes
|
||||||
#define kHitagFree 0x0020
|
kHitagAutoAim = 0x0008,
|
||||||
#define kHitagSmoke 0x0100
|
kHitagRespawn = 0x0010,
|
||||||
|
kHitagFree = 0x0020,
|
||||||
|
kHitagSmoke = 0x0100,
|
||||||
|
|
||||||
// sprite physics attributes
|
// sprite physics attributes
|
||||||
#define kPhysMove 0x0001 // affected by movement physics
|
kPhysMove = 0x0001, // affected by movement physics
|
||||||
#define kPhysGravity 0x0002 // affected by gravity
|
kPhysGravity = 0x0002, // affected by gravity
|
||||||
#define kPhysFalling 0x0004 // currently in z-motion
|
kPhysFalling = 0x0004, // currently in z-motion
|
||||||
|
|
||||||
// sector cstat
|
// sector cstat
|
||||||
#define kSecCParallax 0x01
|
kSecCParallax = 0x01,
|
||||||
#define kSecCSloped 0x02
|
kSecCSloped = 0x02,
|
||||||
#define kSecCSwapXY 0x04
|
kSecCSwapXY = 0x04,
|
||||||
#define kSecCExpand 0x08
|
kSecCExpand = 0x08,
|
||||||
#define kSecCFlipX 0x10
|
kSecCFlipX = 0x10,
|
||||||
#define kSecCFlipY 0x20
|
kSecCFlipY = 0x20,
|
||||||
#define kSecCFlipMask 0x34
|
kSecCFlipMask = 0x34,
|
||||||
#define kSecCRelAlign 0x40
|
kSecCRelAlign = 0x40,
|
||||||
#define kSecCFloorShade 0x8000
|
kSecCFloorShade = 0x8000,
|
||||||
|
|
||||||
#define kAng5 28
|
|
||||||
#define kAng15 85
|
|
||||||
#define kAng30 170
|
|
||||||
#define kAng45 256
|
|
||||||
#define kAng60 341
|
|
||||||
#define kAng90 512
|
|
||||||
#define kAng120 682
|
|
||||||
#define kAng180 1024
|
|
||||||
#define kAng360 2048
|
|
||||||
|
|
||||||
|
kAng5 = 28,
|
||||||
|
kAng15 = 85,
|
||||||
|
kAng30 = 170,
|
||||||
|
kAng45 = 256,
|
||||||
|
kAng60 = 341,
|
||||||
|
kAng90 = 512,
|
||||||
|
kAng120 = 682,
|
||||||
|
kAng180 = 1024,
|
||||||
|
kAng360 = 2048,
|
||||||
|
};
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
|
@ -747,7 +741,7 @@ public:
|
||||||
int readBit()
|
int readBit()
|
||||||
{
|
{
|
||||||
if (nSize <= 0)
|
if (nSize <= 0)
|
||||||
ThrowError("Buffer overflow");
|
ThrowError("Buffer overflow in BitReader");
|
||||||
int bit = ((*pBuffer)>>nBitPos)&1;
|
int bit = ((*pBuffer)>>nBitPos)&1;
|
||||||
if (++nBitPos >= 8)
|
if (++nBitPos >= 8)
|
||||||
{
|
{
|
||||||
|
@ -764,7 +758,7 @@ public:
|
||||||
nSize -= nBitPos>>3;
|
nSize -= nBitPos>>3;
|
||||||
nBitPos &= 7;
|
nBitPos &= 7;
|
||||||
if ((nSize == 0 && nBitPos > 0) || nSize < 0)
|
if ((nSize == 0 && nBitPos > 0) || nSize < 0)
|
||||||
ThrowError("Buffer overflow");
|
ThrowError("Buffer overflow in BitReader");
|
||||||
}
|
}
|
||||||
unsigned int readUnsigned(int nBits)
|
unsigned int readUnsigned(int nBits)
|
||||||
{
|
{
|
||||||
|
@ -784,40 +778,5 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BitWriter {
|
|
||||||
public:
|
|
||||||
int nBitPos;
|
|
||||||
int nSize;
|
|
||||||
char *pBuffer;
|
|
||||||
BitWriter(char *_pBuffer, int _nSize, int _nBitPos) { pBuffer = _pBuffer; nSize = _nSize; nBitPos = _nBitPos; memset(pBuffer, 0, nSize); nSize -= nBitPos>>3; }
|
|
||||||
BitWriter(char *_pBuffer, int _nSize) { pBuffer = _pBuffer; nSize = _nSize; nBitPos = 0; memset(pBuffer, 0, nSize); }
|
|
||||||
void writeBit(int bit)
|
|
||||||
{
|
|
||||||
if (nSize <= 0)
|
|
||||||
ThrowError("Buffer overflow");
|
|
||||||
*pBuffer |= bit<<nBitPos;
|
|
||||||
if (++nBitPos >= 8)
|
|
||||||
{
|
|
||||||
nBitPos = 0;
|
|
||||||
pBuffer++;
|
|
||||||
nSize--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void skipBits(int nBits)
|
|
||||||
{
|
|
||||||
nBitPos += nBits;
|
|
||||||
pBuffer += nBitPos>>3;
|
|
||||||
nSize -= nBitPos>>3;
|
|
||||||
nBitPos &= 7;
|
|
||||||
if ((nSize == 0 && nBitPos > 0) || nSize < 0)
|
|
||||||
ThrowError("Buffer overflow");
|
|
||||||
}
|
|
||||||
void write(int nValue, int nBits)
|
|
||||||
{
|
|
||||||
dassert(nBits <= 32);
|
|
||||||
for (int i = 0; i < nBits; i++)
|
|
||||||
writeBit((nValue>>i)&1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
END_BLD_NS
|
END_BLD_NS
|
||||||
|
|
|
@ -24,10 +24,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
#define kMaxXSprites 16384
|
enum
|
||||||
#define kMaxXWalls 512
|
{
|
||||||
#define kMaxXSectors 512
|
kMaxXSprites = 16384,
|
||||||
|
kMaxXWalls = 512,
|
||||||
|
kMaxXSectors = 512
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// by NoOne: functions to quckly check range of specifical arrays
|
// by NoOne: functions to quckly check range of specifical arrays
|
||||||
|
|
|
@ -56,7 +56,7 @@ void _SetErrorLoc(const char *pzFile, int nLine)
|
||||||
}
|
}
|
||||||
|
|
||||||
// by NoOne: show warning msgs in game instead of throwing errors (in some cases)
|
// by NoOne: show warning msgs in game instead of throwing errors (in some cases)
|
||||||
void _consoleSysMsg(const char* pzFormat, ...) {
|
void consoleSysMsg(const char* pzFormat, ...) {
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, pzFormat);
|
va_start(args, pzFormat);
|
||||||
|
|
|
@ -33,7 +33,7 @@ BEGIN_BLD_NS
|
||||||
extern int gFrameClock;
|
extern int gFrameClock;
|
||||||
extern int gFrameCount;
|
extern int gFrameCount;
|
||||||
|
|
||||||
#define MAXPLAYERNAME 16
|
enum { MAXPLAYERNAME = 16 };
|
||||||
|
|
||||||
extern int32_t gDetail;
|
extern int32_t gDetail;
|
||||||
extern bool gNoClip;
|
extern bool gNoClip;
|
||||||
|
|
|
@ -29,9 +29,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
|
|
||||||
#define kMaxMessages 32
|
enum
|
||||||
#define kMaxEpisodes 7
|
{
|
||||||
#define kMaxLevels 16
|
kMaxMessages = 32,
|
||||||
|
kMaxEpisodes = 7,
|
||||||
|
kMaxLevels = 16
|
||||||
|
};
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
#define kMaxQavClients 64
|
enum { kMaxQavClients = 64 };
|
||||||
static void (*qavClientCallback[kMaxQavClients])(int, void *);
|
static void (*qavClientCallback[kMaxQavClients])(int, void *);
|
||||||
static int nQavClients;
|
static int nQavClients;
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
#define kMaxSeqClients 256
|
enum
|
||||||
#define kMaxSequences 1024
|
{
|
||||||
|
kMaxSeqClients = 256,
|
||||||
|
kMaxSequences = 1024
|
||||||
|
};
|
||||||
|
|
||||||
static ACTIVE activeList[kMaxSequences];
|
static ACTIVE activeList[kMaxSequences];
|
||||||
static int seqActiveCount = 0;
|
static int seqActiveCount = 0;
|
||||||
|
|
|
@ -48,7 +48,7 @@ int soundRates[13] = {
|
||||||
44100,
|
44100,
|
||||||
44100,
|
44100,
|
||||||
};
|
};
|
||||||
#define kChannelMax 32
|
enum { kChannelMax = 32 };
|
||||||
|
|
||||||
|
|
||||||
void ByteSwapSFX(SFX* pSFX)
|
void ByteSwapSFX(SFX* pSFX)
|
||||||
|
|
|
@ -69,7 +69,7 @@ char gInterpolateSprite[(kMaxSprites+7)>>3];
|
||||||
char gInterpolateWall[(kMaxWalls+7)>>3];
|
char gInterpolateWall[(kMaxWalls+7)>>3];
|
||||||
char gInterpolateSector[(kMaxSectors+7)>>3];
|
char gInterpolateSector[(kMaxSectors+7)>>3];
|
||||||
|
|
||||||
#define kMaxInterpolations 16384
|
enum { kMaxInterpolations = 16384 };
|
||||||
|
|
||||||
INTERPOLATE gInterpolation[kMaxInterpolations];
|
INTERPOLATE gInterpolation[kMaxInterpolations];
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
|
|
||||||
#define kQAVEnd 125
|
enum { kQAVEnd = 125 };
|
||||||
|
|
||||||
void FirePitchfork(int, PLAYER *pPlayer);
|
void FirePitchfork(int, PLAYER *pPlayer);
|
||||||
void FireSpray(int, PLAYER *pPlayer);
|
void FireSpray(int, PLAYER *pPlayer);
|
||||||
|
@ -1109,7 +1109,7 @@ void FireRemote(int, PLAYER *pPlayer)
|
||||||
evSend(0, 0, 90+(pPlayer->pSprite->type-kDudePlayer1), kCmdOn);
|
evSend(0, 0, 90+(pPlayer->pSprite->type-kDudePlayer1), kCmdOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define kMaxShotgunBarrels 4
|
enum { kMaxShotgunBarrels = 4 };
|
||||||
|
|
||||||
void FireShotgun(int nTrigger, PLAYER *pPlayer)
|
void FireShotgun(int nTrigger, PLAYER *pPlayer)
|
||||||
{
|
{
|
||||||
|
@ -1193,7 +1193,7 @@ void FireTommy(int nTrigger, PLAYER *pPlayer)
|
||||||
pPlayer->flashEffect = 1;
|
pPlayer->flashEffect = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define kMaxSpread 14
|
enum { kMaxSpread = 14 };
|
||||||
|
|
||||||
void FireSpread(int nTrigger, PLAYER *pPlayer)
|
void FireSpread(int nTrigger, PLAYER *pPlayer)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue