- Blood: got rid of ThrowError.

Use I_Error directly.
This commit is contained in:
Christoph Oelckers 2020-10-11 12:22:36 +02:00
parent 2769abcf0f
commit 1579bec714
18 changed files with 60 additions and 65 deletions

View file

@ -2523,7 +2523,7 @@ void actInit(bool bSaveLoad) {
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
spritetype *pSprite = &sprite[nSprite];
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
ThrowError("Non-enemy sprite (%d) in the enemy sprite list.\n", nSprite);
I_Error("Non-enemy sprite (%d) in the enemy sprite list.\n", nSprite);
unk[pSprite->type - kDudeBase] = 1;
}
@ -3502,7 +3502,7 @@ int actDamageSprite(int nSource, spritetype *pSprite, DAMAGE_TYPE damageType, in
if (!IsDudeSprite(pSprite)) {
consoleSysMsg("Bad Dude Failed: initial=%d type=%d %s\n", (int)pSprite->inittype, (int)pSprite->type, (int)(pSprite->flags & kHitagRespawn) ? "RESPAWN" : "NORMAL");
return damage >> 4;
//ThrowError("Bad Dude Failed: initial=%d type=%d %s\n", (int)pSprite->inittype, (int)pSprite->type, (int)(pSprite->flags & 16) ? "RESPAWN" : "NORMAL");
//I_Error("Bad Dude Failed: initial=%d type=%d %s\n", (int)pSprite->inittype, (int)pSprite->type, (int)(pSprite->flags & 16) ? "RESPAWN" : "NORMAL");
}
int nType = pSprite->type - kDudeBase; int nDamageFactor = getDudeInfo(nType+kDudeBase)->at70[damageType];

View file

@ -134,7 +134,7 @@ void ambInit(void)
int nSFX = pXSprite->data3;
auto snd = soundEngine->FindSoundByResID(nSFX);
if (!snd) {
//ThrowError("Missing sound #%d used in ambient sound generator %d\n", nSFX);
//I_Error("Missing sound #%d used in ambient sound generator %d\n", nSFX);
viewSetSystemMessage("Missing sound #%d used in ambient sound generator #%d\n", nSFX, nSprite);
actPostSprite(nSprite, kStatDecoration);
continue;

View file

@ -43,7 +43,7 @@ void CChoke::init(int a1, void(*a2)(PLAYER*))
{
at8 = getQAV(a1);
if (!at8)
ThrowError("Could not load QAV %d\n", a1);
I_Error("Could not load QAV %d\n", a1);
at8->nSprite = -1;
at8->x = at14;
at8->y = at18;

View file

@ -40,11 +40,6 @@ void __dassert(const char *pzExpr, const char *pzFile, int nLine);
void QuitGame(void);
void consoleSysMsg(const char* pMessage, ...);
#define ThrowError(...) \
{ \
I_Error(__VA_ARGS__); \
}
#define dassert(x) assert(x)
enum
@ -741,7 +736,7 @@ public:
int readBit()
{
if (nSize <= 0)
ThrowError("Buffer overflow in BitReader");
I_Error("Buffer overflow in BitReader");
int bit = ((*pBuffer)>>nBitPos)&1;
if (++nBitPos >= 8)
{
@ -758,7 +753,7 @@ public:
nSize -= nBitPos>>3;
nBitPos &= 7;
if ((nSize == 0 && nBitPos > 0) || nSize < 0)
ThrowError("Buffer overflow in BitReader");
I_Error("Buffer overflow in BitReader");
}
unsigned int readUnsigned(int nBits)
{

View file

@ -282,7 +282,7 @@ unsigned short dbInsertXSprite(int nSprite)
nextXSprite[0] = nextXSprite[nXSprite];
if (nXSprite == 0)
{
ThrowError("Out of free XSprites");
I_Error("Out of free XSprites");
}
memset(&xsprite[nXSprite], 0, sizeof(XSPRITE));
memset(&gSpriteHit[nXSprite], 0, sizeof(SPRITEHIT));
@ -306,7 +306,7 @@ unsigned short dbInsertXWall(int nWall)
nextXWall[0] = nextXWall[nXWall];
if (nXWall == 0)
{
ThrowError("Out of free XWalls");
I_Error("Out of free XWalls");
}
memset(&xwall[nXWall], 0, sizeof(XWALL));
xwall[nXWall].reference = nWall;
@ -328,7 +328,7 @@ unsigned short dbInsertXSector(int nSector)
nextXSector[0] = nextXSector[nXSector];
if (nXSector == 0)
{
ThrowError("Out of free XSectors");
I_Error("Out of free XSectors");
}
memset(&xsector[nXSector], 0, sizeof(XSECTOR));
xsector[nXSector].reference = nSector;

View file

@ -223,7 +223,7 @@ void CKillMgr::CountTotalKills(void)
{
spritetype* pSprite = &sprite[nSprite];
if (pSprite->type < kDudeBase || pSprite->type >= kDudeMax)
ThrowError("Non-enemy sprite (%d) in the enemy sprite list.", nSprite);
I_Error("Non-enemy sprite (%d) in the enemy sprite list.", nSprite);
if (pSprite->statnum == kStatDude && pSprite->type != kDudeBat && pSprite->type != kDudeRat && pSprite->type != kDudeInnocent && pSprite->type != kDudeBurningInnocent)
TotalKills++;
}

View file

@ -277,7 +277,7 @@ void evInit(void)
{
int nXSector = sector[i].extra;
if (nXSector >= kMaxXSectors)
ThrowError("Invalid xsector reference in sector %d", i);
I_Error("Invalid xsector reference in sector %d", i);
if (nXSector > 0 && xsector[nXSector].rxID > 0)
{
dassert(nCount < kChannelMax);
@ -290,7 +290,7 @@ void evInit(void)
{
int nXWall = wall[i].extra;
if (nXWall >= kMaxXWalls)
ThrowError("Invalid xwall reference in wall %d", i);
I_Error("Invalid xwall reference in wall %d", i);
if (nXWall > 0 && xwall[nXWall].rxID > 0)
{
dassert(nCount < kChannelMax);
@ -305,7 +305,7 @@ void evInit(void)
{
int nXSprite = sprite[i].extra;
if (nXSprite >= kMaxXSprites)
ThrowError("Invalid xsprite reference in sprite %d", i);
I_Error("Invalid xsprite reference in sprite %d", i);
if (nXSprite > 0 && xsprite[nXSprite].rxID > 0)
{
dassert(nCount < kChannelMax);

View file

@ -90,7 +90,7 @@ void FireInit(void)
InitSeedBuffers();
auto fr = fileSystem.OpenFileReader("rfire.clu");
if (!fr.isOpen())
ThrowError("RFIRE.CLU not found");
I_Error("RFIRE.CLU not found");
gCLU = fr.Read();
for (int i = 0; i < 100; i++)
DoFireFrame();

View file

@ -62,7 +62,7 @@ IniFile *BloodINI;
void levelInitINI(const char *pzIni)
{
if (!fileSystem.FileExists(pzIni))
ThrowError("Initialization: %s does not exist", pzIni);
I_Error("Initialization: %s does not exist", pzIni);
BloodINI = new IniFile(pzIni);
strncpy(BloodIniFile, pzIni, BMAX_PATH);
}
@ -92,7 +92,7 @@ void levelTriggerSecret(int nSecret)
void CheckSectionAbend(const char *pzSection)
{
if (!pzSection || !BloodINI->SectionExists(pzSection))
ThrowError("Section [%s] expected in BLOOD.INI", pzSection);
I_Error("Section [%s] expected in BLOOD.INI", pzSection);
}
void CheckKeyAbend(const char *pzSection, const char *pzKey)
@ -100,7 +100,7 @@ void CheckKeyAbend(const char *pzSection, const char *pzKey)
dassert(pzSection != NULL);
if (!pzKey || !BloodINI->KeyExists(pzSection, pzKey))
ThrowError("Key %s expected in section [%s] of BLOOD.INI", pzKey, pzSection);
I_Error("Key %s expected in section [%s] of BLOOD.INI", pzKey, pzSection);
}

View file

@ -449,12 +449,12 @@ void sub_76FD4(void)
void LoadSave::Save(void)
{
ThrowError("Pure virtual function called");
I_Error("Pure virtual function called");
}
void LoadSave::Load(void)
{
ThrowError("Pure virtual function called");
I_Error("Pure virtual function called");
}
void LoadSave::Read(void *pData, int nSize)
@ -462,7 +462,7 @@ void LoadSave::Read(void *pData, int nSize)
dword_27AA38 += nSize;
dassert(hLFile.isOpen());
if (hLFile.Read(pData, nSize) != nSize)
ThrowError("Error reading save file.");
I_Error("Error reading save file.");
}
void LoadSave::Write(void *pData, int nSize)
@ -471,7 +471,7 @@ void LoadSave::Write(void *pData, int nSize)
dword_27AA3C += nSize;
dassert(hSFile != NULL);
if (hSFile->Write(pData, nSize) != (size_t)nSize)
ThrowError("File error #%d writing save file.", errno);
I_Error("File error #%d writing save file.", errno);
}
bool GameInterface::LoadGame()
@ -574,11 +574,11 @@ void MyLoadSave::Load(void)
int id;
Read(&id, sizeof(id));
if (id != 0x5653424e/*'VSBN'*/)
ThrowError("Old saved game found");
I_Error("Old saved game found");
short version;
Read(&version, sizeof(version));
if (version != BYTEVERSION)
ThrowError("Incompatible version of saved game found!");
I_Error("Incompatible version of saved game found!");
Read(&gGameOptions, sizeof(gGameOptions));
int nNumSprites;

View file

@ -90,7 +90,7 @@ void InitMirrors(void)
}
}
if (j < 0)
ThrowError("wall[%d] has no matching wall link! (data=%d)\n", i, tmp);
I_Error("wall[%d] has no matching wall link! (data=%d)\n", i, tmp);
mirrorcnt++;
}
continue;
@ -119,7 +119,7 @@ void InitMirrors(void)
int nLink2 = sprite[nLink].owner & 0xfff;
int j = sprite[nLink2].sectnum;
if (sector[j].ceilingpicnum != 504)
ThrowError("Lower link sector %d doesn't have mirror picnum\n", j);
I_Error("Lower link sector %d doesn't have mirror picnum\n", j);
mirror[mirrorcnt].TotalKills = 2;
mirror[mirrorcnt].at8 = sprite[nLink2].x-sprite[nLink].x;
mirror[mirrorcnt].atc = sprite[nLink2].y-sprite[nLink].y;

View file

@ -352,7 +352,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
}
if (sysStat)
ThrowError("Sprite status list number %d on sprite #%d is in a range of reserved (%d - %d)!", pSprite->index, pSprite->statnum, kStatModernBase, kStatModernMax);
I_Error("Sprite status list number %d on sprite #%d is in a range of reserved (%d - %d)!", pSprite->index, pSprite->statnum, kStatModernBase, kStatModernMax);
}
switch (pSprite->type) {
@ -393,7 +393,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
for (int nSprite = headspritestat[kStatDude], found = 0; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
XSPRITE* pXSpr = &xsprite[sprite[nSprite].extra];
if (pXSpr->rxID != pXSprite->txID) continue;
else if (found) ThrowError("\nCustom dude (TX ID %d):\nOnly one incarnation allowed per channel!", pXSprite->txID);
else if (found) I_Error("\nCustom dude (TX ID %d):\nOnly one incarnation allowed per channel!", pXSprite->txID);
changespritestat(nSprite, kStatInactive);
nSprite = headspritestat[kStatDude];
found++;
@ -407,22 +407,22 @@ void nnExtInitModernStuff(bool bSaveLoad) {
switch (pXSprite->command) {
case kCmdLink:
if (pXSprite->data1 < 1 || pXSprite->data1 >= kMaxPlayers)
ThrowError("\nPlayer Control (SPRITE #%d):\nPlayer out of a range (data1 = %d)", pSprite->index, pXSprite->data1);
I_Error("\nPlayer Control (SPRITE #%d):\nPlayer out of a range (data1 = %d)", pSprite->index, pXSprite->data1);
//if (numplayers < pXSprite->data1)
//ThrowError("\nPlayer Control (SPRITE #%d):\n There is no player #%d", pSprite->index, pXSprite->data1);
//I_Error("\nPlayer Control (SPRITE #%d):\n There is no player #%d", pSprite->index, pXSprite->data1);
if (pXSprite->rxID && pXSprite->rxID != kChannelLevelStart)
ThrowError("\nPlayer Control (SPRITE #%d) with Link command should have no RX ID!", pSprite->index);
I_Error("\nPlayer Control (SPRITE #%d) with Link command should have no RX ID!", pSprite->index);
if (pXSprite->txID && pXSprite->txID < kChannelUser)
ThrowError("\nPlayer Control (SPRITE #%d):\nTX ID should be in range of %d and %d!", pSprite->index, kChannelUser, kChannelMax);
I_Error("\nPlayer Control (SPRITE #%d):\nTX ID should be in range of %d and %d!", pSprite->index, kChannelUser, kChannelMax);
// only one linker per player allowed
for (int nSprite = headspritestat[kStatModernPlayerLinker]; nSprite >= 0; nSprite = nextspritestat[nSprite]) {
XSPRITE* pXCtrl = &xsprite[sprite[nSprite].extra];
if (pXSprite->data1 == pXCtrl->data1)
ThrowError("\nPlayer Control (SPRITE #%d):\nPlayer %d already linked with different player control sprite #%d!", pSprite->index, pXSprite->data1, nSprite);
I_Error("\nPlayer Control (SPRITE #%d):\nPlayer %d already linked with different player control sprite #%d!", pSprite->index, pXSprite->data1, nSprite);
}
pXSprite->sysData1 = -1;
pSprite->cstat &= ~CSTAT_SPRITE_BLOCK;
@ -494,7 +494,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
default:
gProxySpritesList[gProxySpritesCount++] = pSprite->index;
if (gProxySpritesCount == kMaxSuperXSprites)
ThrowError("Max (%d) *additional* Proximity sprites reached!", kMaxSuperXSprites);
I_Error("Max (%d) *additional* Proximity sprites reached!", kMaxSuperXSprites);
break;
}
}
@ -510,7 +510,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
default:
gSightSpritesList[gSightSpritesCount++] = pSprite->index;
if (gSightSpritesCount == kMaxSuperXSprites)
ThrowError("Max (%d) Sight sprites reached!", kMaxSuperXSprites);
I_Error("Max (%d) Sight sprites reached!", kMaxSuperXSprites);
break;
}
}
@ -526,7 +526,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
default:
gImpactSpritesList[gImpactSpritesCount++] = pSprite->index;
if (gImpactSpritesCount == kMaxSuperXSprites)
ThrowError("Max (%d) *additional* Impact sprites reached!", kMaxSuperXSprites);
I_Error("Max (%d) *additional* Impact sprites reached!", kMaxSuperXSprites);
break;
}
}
@ -569,7 +569,7 @@ void nnExtInitModernStuff(bool bSaveLoad) {
if (pXSprite->busyTime <= 0) continue;
else if (gTrackingCondsCount >= kMaxTrackingConditions)
ThrowError("\nMax (%d) tracking conditions reached!", kMaxTrackingConditions);
I_Error("\nMax (%d) tracking conditions reached!", kMaxTrackingConditions);
int count = 0;
TRCONDITION* pCond = &gCondition[gTrackingCondsCount];
@ -912,7 +912,7 @@ void sfxPlayVectorSound(spritetype* pSprite, int vectorId) {
int getSpriteMassBySize(spritetype* pSprite) {
int mass = 0; int seqId = -1; int clipDist = pSprite->clipdist; Seq* pSeq = NULL;
if (pSprite->extra < 0) {
ThrowError("getSpriteMassBySize: pSprite->extra < 0");
I_Error("getSpriteMassBySize: pSprite->extra < 0");
} else if (IsDudeSprite(pSprite)) {
@ -2408,7 +2408,7 @@ int condSerialize(int objType, int objIndex) {
case OBJ_WALL: return kCondSerialWall + objIndex;
case OBJ_SPRITE: return kCondSerialSprite + objIndex;
}
ThrowError("Unknown object type %d, index %d", objType, objIndex)
I_Error("Unknown object type %d, index %d", objType, objIndex);
return -1;
}
@ -2430,7 +2430,7 @@ void condUnserialize(int serial, int* objType, int* objIndex) {
} else {
ThrowError("%d is not condition serial!", serial);
I_Error("%d is not condition serial!", serial);
}
}
@ -2468,7 +2468,7 @@ bool condCmp(int val, int arg1, int arg2, int comOp) {
if (comOp & 0x2000) return (comOp & CSTAT_SPRITE_BLOCK) ? (val > arg1) : (val >= arg1); // blue sprite
else if (comOp & 0x4000) return (comOp & CSTAT_SPRITE_BLOCK) ? (val < arg1) : (val <= arg1); // green sprite
else if (comOp & CSTAT_SPRITE_BLOCK) {
if (arg1 > arg2) ThrowError("Value of argument #1 (%d) must be less than value of argument #2 (%d)", arg1, arg2);
if (arg1 > arg2) I_Error("Value of argument #1 (%d) must be less than value of argument #2 (%d)", arg1, arg2);
return (val >= arg1 && val <= arg2);
}
else return (val == arg1);
@ -2480,7 +2480,7 @@ bool condCmpne(int arg1, int arg2, int comOp) {
if (comOp & 0x2000) return (comOp & CSTAT_SPRITE_BLOCK) ? (0 > arg1) : (0 >= arg1); // blue sprite
else if (comOp & 0x4000) return (comOp & CSTAT_SPRITE_BLOCK) ? (0 < arg1) : (0 <= arg1); // green sprite
else if (comOp & CSTAT_SPRITE_BLOCK) {
if (arg1 > arg2) ThrowError("Value of argument #1 (%d) must be less than value of argument #2 (%d)", arg1, arg2);
if (arg1 > arg2) I_Error("Value of argument #1 (%d) must be less than value of argument #2 (%d)", arg1, arg2);
return (0 >= arg1 && 0 <= arg2);
}
else return (0 == arg1);
@ -2494,7 +2494,7 @@ bool condCmpb(int val, int arg1, int arg2, int comOp) {
if (comOp & 0x2000) return (comOp & CSTAT_SPRITE_BLOCK) ? (val > 0) : (val >= 0); // blue sprite
else if (comOp & 0x4000) return (comOp & CSTAT_SPRITE_BLOCK) ? (val < arg1) : (val <= arg1); // green sprite
else if (comOp & CSTAT_SPRITE_BLOCK) {
if (arg1 > arg2) ThrowError("Value of argument #1 (%d) must be less than value of argument #2 (%d)", arg1, arg2);
if (arg1 > arg2) I_Error("Value of argument #1 (%d) must be less than value of argument #2 (%d)", arg1, arg2);
return (val >= arg1 && val <= arg2);
}
else return (val == arg1);
@ -2508,7 +2508,7 @@ void condError(XSPRITE* pXCond, const char* pzFormat, ...) {
va_list args;
va_start(args, pzFormat);
vsprintf(buffer2, pzFormat, args);
ThrowError("%s%s", buffer, buffer2);
I_Error("%s%s", buffer, buffer2);
}

View file

@ -444,7 +444,7 @@ int packItemToPowerup(int nPack)
nPowerUp = kPwUpJumpBoots;
break;
default:
ThrowError("Unhandled pack item %d", nPack);
I_Error("Unhandled pack item %d", nPack);
break;
}
return nPowerUp;
@ -481,7 +481,7 @@ char packAddItem(PLAYER *pPlayer, unsigned int nPack)
pPlayer->packItemId = nPack;
}
else
ThrowError("Unhandled pack item %d", nPack);
I_Error("Unhandled pack item %d", nPack);
return 1;
}
@ -534,7 +534,7 @@ void packUseItem(PLAYER *pPlayer, int nPack)
nPowerUp = kPwUpJumpBoots;
break;
default:
ThrowError("Unhandled pack item %d", nPack);
I_Error("Unhandled pack item %d", nPack);
return;
}
}

View file

@ -62,9 +62,9 @@ int seqRegisterClient(void(*pClient)(int, int))
void Seq::Preload(void)
{
if (memcmp(signature, "SEQ\x1a", 4) != 0)
ThrowError("Invalid sequence");
I_Error("Invalid sequence");
if ((version & 0xff00) != 0x300)
ThrowError("Obsolete sequence version");
I_Error("Obsolete sequence version");
for (int i = 0; i < nFrames; i++)
tilePreloadTile(seqGetTile(&frames[i]));
}
@ -72,9 +72,9 @@ void Seq::Preload(void)
void Seq::Precache(HitList &hits)
{
if (memcmp(signature, "SEQ\x1a", 4) != 0)
ThrowError("Invalid sequence");
I_Error("Invalid sequence");
if ((version & 0xff00) != 0x300)
ThrowError("Obsolete sequence version");
I_Error("Obsolete sequence version");
for (int i = 0; i < nFrames; i++)
tilePrecacheTile(seqGetTile(&frames[i]), -1, hits);
}
@ -382,7 +382,7 @@ void seqSpawn(int a1, int a2, int a3, int a4)
auto pSeq = getSequence(a1);
if (!pSeq)
ThrowError("Missing sequence #%d", a1);
I_Error("Missing sequence #%d", a1);
int i = seqActiveCount;
if (pInst->at13)
@ -398,9 +398,9 @@ void seqSpawn(int a1, int a2, int a3, int a4)
dassert(i < seqActiveCount);
}
if (memcmp(pSeq->signature, "SEQ\x1a", 4) != 0)
ThrowError("Invalid sequence %d", a1);
I_Error("Invalid sequence %d", a1);
if ((pSeq->version & 0xff00) != 0x300)
ThrowError("Sequence %d is obsolete version", a1);
I_Error("Sequence %d is obsolete version", a1);
if ((pSeq->version & 0xff) == 0x00)
{
for (int i = 0; i < pSeq->nFrames; i++)
@ -572,13 +572,13 @@ void SeqLoadSave::Load(void)
int nSeq = pInst->at8;
auto pSeq = getSequence(nSeq);
if (!pSeq) {
ThrowError("Missing sequence #%d", nSeq);
I_Error("Missing sequence #%d", nSeq);
continue;
}
if (memcmp(pSeq->signature, "SEQ\x1a", 4) != 0)
ThrowError("Invalid sequence %d", nSeq);
I_Error("Invalid sequence %d", nSeq);
if ((pSeq->version & 0xff00) != 0x300)
ThrowError("Sequence %d is obsolete version", nSeq);
I_Error("Sequence %d is obsolete version", nSeq);
pInst->pSequence = pSeq;
}
}

View file

@ -62,7 +62,7 @@ void trigInit()
auto fr = fileSystem.OpenFileReader("cosine.dat");
auto len = fr.Read(costable, 2048);
if (len != 2048)
ThrowError("Cosine table incorrect size");
I_Error("Cosine table incorrect size");
#if B_BIG_ENDIAN == 1
for (int i = 0; i < 512; i++)
{

View file

@ -1667,7 +1667,7 @@ void InitPath(unsigned int nSector, XSECTOR *pXSector)
}
if (nSprite < 0) {
//ThrowError("Unable to find path marker with id #%d", nId);
//I_Error("Unable to find path marker with id #%d", nId);
viewSetSystemMessage("Unable to find path marker with id #%d for path sector #%d", nId, nSector);
return;

View file

@ -141,7 +141,7 @@ void viewClearInterpolations(void)
void viewAddInterpolation(void *data, INTERPOLATE_TYPE type)
{
if (nInterpolations == kMaxInterpolations)
ThrowError("Too many interpolations");
I_Error("Too many interpolations");
INTERPOLATE *pInterpolate = &gInterpolation[nInterpolations++];
pInterpolate->pointer = data;
pInterpolate->type = type;

View file

@ -218,7 +218,7 @@ void WeaponInit(void)
{
weaponQAV[i] = getQAV(i);
if (!weaponQAV[i])
ThrowError("Could not load QAV %d\n", i);
I_Error("Could not load QAV %d\n", i);
weaponQAV[i]->nSprite = -1;
}
}