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
|
||||
#ifdef NOONE_EXTENSIONS
|
||||
#define kGenDudeDefaultSeq 11520
|
||||
#define kGenDudeMaxSlaves 7
|
||||
#define kGenDudeTransformStatus -222
|
||||
#define kGenDudeUpdTimeRate 10
|
||||
#define kGenDudeMaxMeleeDist 2048
|
||||
#define kGenDudeMinDispesion 200
|
||||
#define kGenDudeMaxDispersion 3500
|
||||
#define kGenDudeKlabsAng 56
|
||||
enum
|
||||
{
|
||||
kGenDudeDefaultSeq = 11520,
|
||||
kGenDudeMaxSlaves = 7,
|
||||
kGenDudeTransformStatus = -222,
|
||||
kGenDudeUpdTimeRate = 10,
|
||||
kGenDudeMaxMeleeDist = 2048,
|
||||
kGenDudeMinDispesion = 200,
|
||||
kGenDudeMaxDispersion = 3500,
|
||||
kGenDudeKlabsAng = 56
|
||||
};
|
||||
|
||||
enum {
|
||||
kGenDudeSeqIdleL = 0,
|
||||
|
|
|
@ -135,7 +135,7 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
|
|||
{
|
||||
dassert(nViewEffect >= 0 && nViewEffect < kViewEffectMax);
|
||||
auto pTSprite = &tsprite[nTSprite];
|
||||
if (gDetail < effectDetail[nViewEffect] || nTSprite >= kMaxViewSprites) return NULL;
|
||||
if (gDetail < effectDetail[nViewEffect] || nTSprite >= maxspritesonscreen) return NULL;
|
||||
switch (nViewEffect)
|
||||
{
|
||||
case VIEW_EFFECT_18:
|
||||
|
@ -229,7 +229,7 @@ static tspritetype *viewAddEffect(int nTSprite, VIEW_EFFECT nViewEffect)
|
|||
{
|
||||
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;
|
||||
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.
|
||||
int myclock = (gFrameClock<<3) + mulscale16(4<<3, smoothratio);
|
||||
dassert(spritesortcnt <= kMaxViewSprites);
|
||||
dassert(spritesortcnt <= maxspritesonscreen);
|
||||
gCameraAng = cA;
|
||||
int nViewSprites = spritesortcnt;
|
||||
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;
|
||||
}
|
||||
}
|
||||
if (spritesortcnt >= kMaxViewSprites) continue;
|
||||
if (spritesortcnt >= maxspritesonscreen) continue;
|
||||
if (pTXSprite && pTXSprite->burnTime > 0)
|
||||
{
|
||||
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
|
||||
|
||||
#define kMaxAmbChannel 64
|
||||
enum {kMaxAmbChannel = 64 };
|
||||
|
||||
struct AMB_CHANNEL
|
||||
{
|
||||
|
|
|
@ -33,12 +33,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_BLD_NS
|
||||
|
||||
// I don't think we still need these.
|
||||
#define DICT_LOAD 0
|
||||
#define DICT_LOCK 0
|
||||
enum
|
||||
{
|
||||
DICT_LOAD = 0,
|
||||
DICT_LOCK = 0,
|
||||
|
||||
#define kMaxCmdLineDefines 5
|
||||
#define kMaxDefines 1000
|
||||
#define kMaxParseLevels 5
|
||||
kMaxCmdLineDefines = 5,
|
||||
kMaxDefines = 1000,
|
||||
kMaxParseLevels = 5
|
||||
};
|
||||
static int nCmdDefines = 0;
|
||||
static int nDefines = 0;
|
||||
|
||||
|
|
|
@ -38,23 +38,15 @@ BEGIN_BLD_NS
|
|||
void _SetErrorLoc(const char *pzFile, int nLine);
|
||||
void __dassert(const char *pzExpr, const char *pzFile, int nLine);
|
||||
void QuitGame(void);
|
||||
void _consoleSysMsg(const char* pMessage, ...);
|
||||
void consoleSysMsg(const char* pMessage, ...);
|
||||
|
||||
#define ThrowError(...) \
|
||||
{ \
|
||||
I_Error(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
// print error to console only
|
||||
#define consoleSysMsg(...) \
|
||||
{ \
|
||||
_consoleSysMsg(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
#define dassert(x) assert(x)
|
||||
|
||||
#define kMaxViewSprites maxspritesonscreen
|
||||
|
||||
enum
|
||||
{
|
||||
kMaxSectors = MAXSECTORS,
|
||||
|
@ -426,38 +418,40 @@ kAiStateRecoil = 5,
|
|||
kAiStateAttack = 6,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
// sprite attributes
|
||||
#define kHitagAutoAim 0x0008
|
||||
#define kHitagRespawn 0x0010
|
||||
#define kHitagFree 0x0020
|
||||
#define kHitagSmoke 0x0100
|
||||
kHitagAutoAim = 0x0008,
|
||||
kHitagRespawn = 0x0010,
|
||||
kHitagFree = 0x0020,
|
||||
kHitagSmoke = 0x0100,
|
||||
|
||||
// sprite physics attributes
|
||||
#define kPhysMove 0x0001 // affected by movement physics
|
||||
#define kPhysGravity 0x0002 // affected by gravity
|
||||
#define kPhysFalling 0x0004 // currently in z-motion
|
||||
kPhysMove = 0x0001, // affected by movement physics
|
||||
kPhysGravity = 0x0002, // affected by gravity
|
||||
kPhysFalling = 0x0004, // currently in z-motion
|
||||
|
||||
// sector cstat
|
||||
#define kSecCParallax 0x01
|
||||
#define kSecCSloped 0x02
|
||||
#define kSecCSwapXY 0x04
|
||||
#define kSecCExpand 0x08
|
||||
#define kSecCFlipX 0x10
|
||||
#define kSecCFlipY 0x20
|
||||
#define kSecCFlipMask 0x34
|
||||
#define kSecCRelAlign 0x40
|
||||
#define 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
|
||||
kSecCParallax = 0x01,
|
||||
kSecCSloped = 0x02,
|
||||
kSecCSwapXY = 0x04,
|
||||
kSecCExpand = 0x08,
|
||||
kSecCFlipX = 0x10,
|
||||
kSecCFlipY = 0x20,
|
||||
kSecCFlipMask = 0x34,
|
||||
kSecCRelAlign = 0x40,
|
||||
kSecCFloorShade = 0x8000,
|
||||
|
||||
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()
|
||||
{
|
||||
if (nSize <= 0)
|
||||
ThrowError("Buffer overflow");
|
||||
ThrowError("Buffer overflow in BitReader");
|
||||
int bit = ((*pBuffer)>>nBitPos)&1;
|
||||
if (++nBitPos >= 8)
|
||||
{
|
||||
|
@ -764,7 +758,7 @@ public:
|
|||
nSize -= nBitPos>>3;
|
||||
nBitPos &= 7;
|
||||
if ((nSize == 0 && nBitPos > 0) || nSize < 0)
|
||||
ThrowError("Buffer overflow");
|
||||
ThrowError("Buffer overflow in BitReader");
|
||||
}
|
||||
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
|
||||
|
|
|
@ -24,10 +24,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
#define kMaxXSprites 16384
|
||||
#define kMaxXWalls 512
|
||||
#define kMaxXSectors 512
|
||||
|
||||
enum
|
||||
{
|
||||
kMaxXSprites = 16384,
|
||||
kMaxXWalls = 512,
|
||||
kMaxXSectors = 512
|
||||
};
|
||||
|
||||
|
||||
// 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)
|
||||
void _consoleSysMsg(const char* pzFormat, ...) {
|
||||
void consoleSysMsg(const char* pzFormat, ...) {
|
||||
|
||||
va_list args;
|
||||
va_start(args, pzFormat);
|
||||
|
|
|
@ -33,7 +33,7 @@ BEGIN_BLD_NS
|
|||
extern int gFrameClock;
|
||||
extern int gFrameCount;
|
||||
|
||||
#define MAXPLAYERNAME 16
|
||||
enum { MAXPLAYERNAME = 16 };
|
||||
|
||||
extern int32_t gDetail;
|
||||
extern bool gNoClip;
|
||||
|
|
|
@ -29,9 +29,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
BEGIN_BLD_NS
|
||||
|
||||
|
||||
#define kMaxMessages 32
|
||||
#define kMaxEpisodes 7
|
||||
#define kMaxLevels 16
|
||||
enum
|
||||
{
|
||||
kMaxMessages = 32,
|
||||
kMaxEpisodes = 7,
|
||||
kMaxLevels = 16
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
#define kMaxQavClients 64
|
||||
enum { kMaxQavClients = 64 };
|
||||
static void (*qavClientCallback[kMaxQavClients])(int, void *);
|
||||
static int nQavClients;
|
||||
|
||||
|
|
|
@ -41,8 +41,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
#define kMaxSeqClients 256
|
||||
#define kMaxSequences 1024
|
||||
enum
|
||||
{
|
||||
kMaxSeqClients = 256,
|
||||
kMaxSequences = 1024
|
||||
};
|
||||
|
||||
static ACTIVE activeList[kMaxSequences];
|
||||
static int seqActiveCount = 0;
|
||||
|
|
|
@ -48,7 +48,7 @@ int soundRates[13] = {
|
|||
44100,
|
||||
44100,
|
||||
};
|
||||
#define kChannelMax 32
|
||||
enum { kChannelMax = 32 };
|
||||
|
||||
|
||||
void ByteSwapSFX(SFX* pSFX)
|
||||
|
|
|
@ -69,7 +69,7 @@ char gInterpolateSprite[(kMaxSprites+7)>>3];
|
|||
char gInterpolateWall[(kMaxWalls+7)>>3];
|
||||
char gInterpolateSector[(kMaxSectors+7)>>3];
|
||||
|
||||
#define kMaxInterpolations 16384
|
||||
enum { kMaxInterpolations = 16384 };
|
||||
|
||||
INTERPOLATE gInterpolation[kMaxInterpolations];
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
#define kQAVEnd 125
|
||||
enum { kQAVEnd = 125 };
|
||||
|
||||
void FirePitchfork(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);
|
||||
}
|
||||
|
||||
#define kMaxShotgunBarrels 4
|
||||
enum { kMaxShotgunBarrels = 4 };
|
||||
|
||||
void FireShotgun(int nTrigger, PLAYER *pPlayer)
|
||||
{
|
||||
|
@ -1193,7 +1193,7 @@ void FireTommy(int nTrigger, PLAYER *pPlayer)
|
|||
pPlayer->flashEffect = 1;
|
||||
}
|
||||
|
||||
#define kMaxSpread 14
|
||||
enum { kMaxSpread = 14 };
|
||||
|
||||
void FireSpread(int nTrigger, PLAYER *pPlayer)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue