From 3e2cacfaf656dd145bc5d3560fd31aafe73db37a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 May 2021 02:00:06 +0200 Subject: [PATCH] - silenced warnings in Blood. --- source/games/blood/src/_polymost.cpp | 6 ++-- source/games/blood/src/ai.cpp | 2 +- source/games/blood/src/aibeast.cpp | 2 +- source/games/blood/src/barf.cpp | 6 ++-- source/games/blood/src/callback.cpp | 2 +- source/games/blood/src/eventq.cpp | 8 ++--- source/games/blood/src/hudsprites.cpp | 6 ++-- source/games/blood/src/inifile.cpp | 1 - source/games/blood/src/nnexts.cpp | 46 +++++++++++++-------------- source/games/blood/src/sectorfx.cpp | 12 +++---- source/games/blood/src/sfx.cpp | 2 +- source/games/blood/src/triggers.cpp | 4 +-- source/games/blood/src/view.cpp | 2 +- source/games/blood/src/weapon.cpp | 4 +-- 14 files changed, 51 insertions(+), 52 deletions(-) diff --git a/source/games/blood/src/_polymost.cpp b/source/games/blood/src/_polymost.cpp index 64b755d73..05f8967b2 100644 --- a/source/games/blood/src/_polymost.cpp +++ b/source/games/blood/src/_polymost.cpp @@ -148,7 +148,7 @@ RORHACK: for (int i = 0; i < 16; i++) ror_status[i] = testgotpic(4080 + i); fixed_t deliriumPitchI = interpolatedvalue(IntToFixed(deliriumPitchO), IntToFixed(deliriumPitch), gInterpolate); - DrawMirrors(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, gInterpolate, gViewIndex); + DrawMirrors(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, int(gInterpolate), gViewIndex); int bakCstat = gView->pSprite->cstat; if (gViewPos == 0) { @@ -160,7 +160,7 @@ RORHACK: } renderDrawRoomsQ16(cX, cY, cZ, cA.asq16(), cH.asq16() + deliriumPitchI, nSectnum); - viewProcessSprites(pm_tsprite, pm_spritesortcnt, cX, cY, cZ, cA.asbuild(), gInterpolate); + viewProcessSprites(pm_tsprite, pm_spritesortcnt, cX, cY, cZ, cA.asbuild(), int(gInterpolate)); bool do_ror_hack = false; for (int i = 0; i < 16; i++) if (ror_status[i] != testgotpic(4080 + i)) @@ -176,7 +176,7 @@ RORHACK: renderDrawMasks(); pm_spritesortcnt = nSpriteSortCnt; setPortalFlags(0); - processSpritesOnOtherSideOfPortal(cX, cY, gInterpolate); + processSpritesOnOtherSideOfPortal(cX, cY, int(gInterpolate)); renderDrawMasks(); gView->pSprite->cstat = bakCstat; diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index beac0ff94..b204e7959 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -1003,7 +1003,7 @@ int aiDamageSprite(DBloodActor* source, DBloodActor* actor, DAMAGE_TYPE nDmgType GENDUDEEXTRA* pExtra = genDudeExtra(pSprite); if (nDmgType == DAMAGE_TYPE_1) { - if (pXSprite->health > pDudeInfo->fleeHealth) break; + if (pXSprite->health > (unsigned)pDudeInfo->fleeHealth) break; else if (pXSprite->txID <= 0 || getNextIncarnation(pXSprite) == NULL) { removeDudeStuff(pSprite); diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index 857d01cfe..c9aae1c1f 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -292,7 +292,7 @@ static void beastThinkChase(DBloodActor* actor) else pXSector = NULL; int hit = HitScan(pSprite, pSprite->z, dx, dy, 0, CLIPMASK1, 0); - if (pXTarget->health > gPlayerTemplate[0].startHealth/2) + if (pXTarget->health > (unsigned)gPlayerTemplate[0].startHealth/2) { switch (hit) { diff --git a/source/games/blood/src/barf.cpp b/source/games/blood/src/barf.cpp index 47233eede..043cac154 100644 --- a/source/games/blood/src/barf.cpp +++ b/source/games/blood/src/barf.cpp @@ -138,7 +138,7 @@ void AddCmdDefine(char *text, int value) static void SplitPath(const char *pzPath, char *pzDirectory, char *pzFile, char *pzType) { - int const nLength = strlen(pzPath); + int const nLength = (int)strlen(pzPath); const char *pDirectory = pzPath+nLength; const char *pDot = NULL; for (int i = nLength-1; i >= 0; i--) @@ -217,7 +217,7 @@ int RFS::Open(int lumpnum) return 1; } - int fileSize = hFile.GetLength(); + int fileSize = (int)hFile.GetLength(); buffer.Resize(fileSize); _ptr = buffer.Data(); if (_ptr == NULL) { @@ -890,7 +890,7 @@ void ParseScript(int lumpnum) case kTagString: { memcpy(&buffer[nBytes], scriptBuffer, strlen(scriptBuffer) + 1); - nBytes += strlen(scriptBuffer) + 1; + nBytes += (int)strlen(scriptBuffer) + 1; break; } case kTagConstant: diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index b61cc55d7..c1621d09f 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -712,7 +712,7 @@ void callbackCondition(int nSprite) { if (pXSprite->isTriggered) return; TRCONDITION* pCond = &gCondition[pXSprite->sysData1]; - for (int i = 0; i < pCond->length; i++) { + for (unsigned i = 0; i < pCond->length; i++) { EVENT evn; evn.index = pCond->obj[i].index; evn.type = pCond->obj[i].type; evn.cmd = pCond->obj[i].cmd; evn.funcID = kCallbackCondition; useCondition(&sprite[pXSprite->reference], pXSprite, evn); diff --git a/source/games/blood/src/eventq.cpp b/source/games/blood/src/eventq.cpp index 78cd6fc33..77fbf3a0a 100644 --- a/source/games/blood/src/eventq.cpp +++ b/source/games/blood/src/eventq.cpp @@ -200,18 +200,18 @@ static void SortRXBucket(int nCount) vbx++; } RXBUCKET* v2c = pArray + nCount; - int vt = ClipHigh(vbx - first, first - pArray); + int vt = int(min(vbx - first, first - pArray)); for (int i = 0; i < vt; i++) { SortSwap(&vbx[i - vt], &pArray[i]); } - vt = ClipHigh(last - v4, v2c - last - 1); + vt = int(min(last - v4, v2c - last - 1)); for (int i = 0; i < vt; i++) { SortSwap(&v2c[i - vt], &vbx[i]); } - int vvsi = last - v4; - int vvdi = vbx - first; + int vvsi = int(last - v4); + int vvdi = int(vbx - first); if (vvsi >= vvdi) { vc4[v14] = vvsi; diff --git a/source/games/blood/src/hudsprites.cpp b/source/games/blood/src/hudsprites.cpp index bb0f4a311..b35fb8969 100644 --- a/source/games/blood/src/hudsprites.cpp +++ b/source/games/blood/src/hudsprites.cpp @@ -127,14 +127,14 @@ void hudDraw(PLAYER *gView, int nSectnum, double bobx, double boby, double zDelt } #ifdef NOONE_EXTENSIONS - if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette, smoothratio); - else if (gView->pXSprite->health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette, smoothratio); + if (gView->sceneQav < 0) WeaponDraw(gView, nShade, cX, cY, nPalette, int(smoothratio)); + else if (gView->pXSprite->health > 0) playerQavSceneDraw(gView, nShade, cX, cY, nPalette, int(smoothratio)); else { gView->sceneQav = gView->weaponQav = -1; gView->weaponTimer = gView->curWeapon = 0; } #else - WeaponDraw(gView, nShade, cX, cY, nPalette, smoothratio); + WeaponDraw(gView, nShade, cX, cY, nPalette, int(smoothratio)); #endif } if (gViewPos == 0 && gView->pXSprite->burnTime > 60) diff --git a/source/games/blood/src/inifile.cpp b/source/games/blood/src/inifile.cpp index 6f3c37dd6..b90af0da1 100644 --- a/source/games/blood/src/inifile.cpp +++ b/source/games/blood/src/inifile.cpp @@ -171,7 +171,6 @@ void IniFile::Load() auto fp = fileSystem.OpenFileReader(fileName); if (fp.isOpen()) { - int nSize = fp.GetLength(); auto pBuffer = fp.Read(); LoadRes(pBuffer.Data()); } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index c49388ef7..d6f9528b4 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -229,7 +229,7 @@ void nnExtResetGlobals() { if (gTrackingCondsCount > 0) { for (int i = 0; i < gTrackingCondsCount; i++) { TRCONDITION* pCond = &gCondition[i]; - for (int k = 0; k < pCond->length; k++) { + for (unsigned k = 0; k < pCond->length; k++) { pCond->obj[k].index = pCond->obj[k].cmd = 0; pCond->obj[k].type = -1; } @@ -716,7 +716,7 @@ spritetype* randomDropPickupObject(spritetype* pSource, short prevItem) { pSprite2 = actDropObject(pSource, selected); if (pSprite2 != NULL) { - pXSource->dropMsg = pSprite2->type; // store dropped item type in dropMsg + pXSource->dropMsg = uint8_t(pSprite2->type); // store dropped item type in dropMsg pSprite2->x = pSource->x; pSprite2->y = pSource->y; pSprite2->z = pSource->z; @@ -763,7 +763,7 @@ void nnExtProcessSuperSprites() { if (pCond->length > 0 && !pXCond->locked && !pXCond->isTriggered && ++pXCond->busy >= pXCond->busyTime) { pXCond->busy = 0; - for (int k = 0; k < pCond->length; k++) { + for (unsigned k = 0; k < pCond->length; k++) { EVENT evn; evn.index = pCond->obj[k].index; evn.cmd = pCond->obj[k].cmd; @@ -1400,7 +1400,7 @@ void trPlayerCtrlLink(XSPRITE* pXSource, PLAYER* pPlayer, bool checkCondition) { continue; // search for player control sprite and replace it with actual player sprite - for (int k = 0; k < pCond->length; k++) { + for (unsigned k = 0; k < pCond->length; k++) { if (pCond->obj[k].type != OBJ_SPRITE || pCond->obj[k].index != pXSource->reference) continue; pCond->obj[k].index = pPlayer->nSprite; pCond->obj[k].cmd = pPlayer->pXSprite->command; @@ -1638,16 +1638,16 @@ void useObjResizer(XSPRITE* pXSource, short objType, int objIndex) { // for sectors case 6: if (valueIsBetween(pXSource->data1, -1, 32767)) - sector[objIndex].floorxpan_ = ClipRange(pXSource->data1, 0, 255); + sector[objIndex].floorxpan_ = (float)ClipRange(pXSource->data1, 0, 255); if (valueIsBetween(pXSource->data2, -1, 32767)) - sector[objIndex].floorypan_ = ClipRange(pXSource->data2, 0, 255); + sector[objIndex].floorypan_ = (float)ClipRange(pXSource->data2, 0, 255); if (valueIsBetween(pXSource->data3, -1, 32767)) - sector[objIndex].ceilingxpan_ = ClipRange(pXSource->data3, 0, 255); + sector[objIndex].ceilingxpan_ = (float)ClipRange(pXSource->data3, 0, 255); if (valueIsBetween(pXSource->data4, -1, 65535)) - sector[objIndex].ceilingypan_ = ClipRange(pXSource->data4, 0, 255); + sector[objIndex].ceilingypan_ = (float)ClipRange(pXSource->data4, 0, 255); break; // for sprites case 3: @@ -1698,10 +1698,10 @@ void useObjResizer(XSPRITE* pXSource, short objType, int objIndex) { wall[objIndex].yrepeat = ClipRange(pXSource->data2, 0, 255); if (valueIsBetween(pXSource->data3, -1, 32767)) - wall[objIndex].xpan_ = ClipRange(pXSource->data3, 0, 255); + wall[objIndex].xpan_ = (float)ClipRange(pXSource->data3, 0, 255); if (valueIsBetween(pXSource->data4, -1, 65535)) - wall[objIndex].ypan_ = ClipRange(pXSource->data4, 0, 255); + wall[objIndex].ypan_ = (float)ClipRange(pXSource->data4, 0, 255); break; } @@ -2314,7 +2314,7 @@ void useSpriteDamager(XSPRITE* pXSource, spritetype* pSprite) { } if (dmgType >= kDmgFall) { - if (dmg < pXSprite->health << 4) { + if (dmg < (int)pXSprite->health << 4) { if (nnExtIsImmune(pSprite, dmgType, 0)) { Printf(PRINT_HIGH, "Dude type %d is immune to damage type %d!", pSprite->type, dmgType); return; @@ -3201,7 +3201,7 @@ void condUpdateObjectIndex(int objType, int oldIndex, int newIndex) { for (int i = 0; i < gTrackingCondsCount; i++) { TRCONDITION* pCond = &gCondition[i]; - for (int k = 0; k < pCond->length; k++) { + for (unsigned k = 0; k < pCond->length; k++) { if (pCond->obj[k].type != objType || pCond->obj[k].index != oldIndex) continue; pCond->obj[k].index = newIndex; break; @@ -3851,7 +3851,7 @@ bool modernTypeOperateSprite(int nSprite, spritetype* pSprite, XSPRITE* pXSprite else evPost(nSprite, 3, 0, kCmdOff); break; } - pXSprite->dropMsg = pXSprite->data4; + pXSprite->dropMsg = uint8_t(pXSprite->data4); return true; case kModernObjDataAccumulator: switch (event.cmd) { @@ -4352,7 +4352,7 @@ void useSoundGen(spritetype* pSource, XSPRITE* pXSource) { void useIncDecGen(XSPRITE* pXSource, short objType, int objIndex) { char buffer[5]; int data = -65535; short tmp = 0; int dataIndex = 0; - sprintf(buffer, "%d", abs(pXSource->data1)); int len = strlen(buffer); + sprintf(buffer, "%d", abs(pXSource->data1)); int len = int(strlen(buffer)); for (int i = 0; i < len; i++) { dataIndex = (buffer[i] - 52) + 4; @@ -4449,7 +4449,7 @@ void useSectorLigthChanger(XSPRITE* pXSource, XSECTOR* pXSector) { int oldAmplitude = pXSector->amplitude; if (valueIsBetween(pXSource->data2, -128, 128)) - pXSector->amplitude = pXSource->data2; + pXSector->amplitude = uint8_t(pXSource->data2); if (valueIsBetween(pXSource->data3, -1, 32767)) pXSector->freq = ClipHigh(pXSource->data3, 255); @@ -4521,7 +4521,7 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) { // heal dude a bit in case of friendly fire int startHp = (pXSprite->sysData2 > 0) ? ClipRange(pXSprite->sysData2 << 4, 1, 65535) : pDudeInfo->startHealth << 4; - if (pXSprite->health < startHp) actHealDude(pXSprite, receiveHp, startHp); + if (pXSprite->health < (unsigned)startHp) actHealDude(pXSprite, receiveHp, startHp); } else if (xsprite[pBurnSource->extra].health <= 0) { pXSprite->burnTime = 0; } @@ -4581,11 +4581,11 @@ void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite) { // heal dude int startHp = (pXSprite->sysData2 > 0) ? ClipRange(pXSprite->sysData2 << 4, 1, 65535) : pDudeInfo->startHealth << 4; - if (pXSprite->health < startHp) actHealDude(pXSprite, receiveHp, startHp); + if (pXSprite->health < (unsigned)startHp) actHealDude(pXSprite, receiveHp, startHp); // heal mate startHp = (pXMate->sysData2 > 0) ? ClipRange(pXMate->sysData2 << 4, 1, 65535) : getDudeInfo(pMate->type)->startHealth << 4; - if (pXMate->health < startHp) actHealDude(pXMate, receiveHp, startHp); + if (pXMate->health < (unsigned)startHp) actHealDude(pXMate, receiveHp, startHp); if (pXMate->target > -1 && sprite[pXMate->target].extra >= 0) { pTarget = &sprite[pXMate->target]; @@ -4742,10 +4742,10 @@ void usePictureChanger(XSPRITE* pXSource, int objType, int objIndex) { sector[objIndex].ceilingpicnum = pXSource->data2; if (valueIsBetween(pXSource->data3, -1, 32767)) - sector[objIndex].floorpal = pXSource->data3; + sector[objIndex].floorpal = uint8_t(pXSource->data3); if (valueIsBetween(pXSource->data4, -1, 65535)) - sector[objIndex].ceilingpal = pXSource->data4; + sector[objIndex].ceilingpal = uint8_t(pXSource->data4); break; case OBJ_SPRITE: if (valueIsBetween(pXSource->data1, -1, 32767)) @@ -4755,7 +4755,7 @@ void usePictureChanger(XSPRITE* pXSource, int objType, int objIndex) { else if (pXSource->data2 < -1) sprite[objIndex].shade = (pXSource->data2 < -127) ? -127 : pXSource->data2; if (valueIsBetween(pXSource->data3, -1, 32767)) - sprite[objIndex].pal = pXSource->data3; + sprite[objIndex].pal = uint8_t(pXSource->data3); break; case OBJ_WALL: if (valueIsBetween(pXSource->data1, -1, 32767)) @@ -4765,7 +4765,7 @@ void usePictureChanger(XSPRITE* pXSource, int objType, int objIndex) { wall[objIndex].overpicnum = pXSource->data2; if (valueIsBetween(pXSource->data3, -1, 32767)) - wall[objIndex].pal = pXSource->data3; + wall[objIndex].pal = uint8_t(pXSource->data3); break; } } @@ -5163,7 +5163,7 @@ XSPRITE* evrListRedirectors(int objType, int objXIndex, XSPRITE* pXRedir, int* t bool incDecGoalValueIsReached(XSPRITE* pXSprite) { if (pXSprite->data3 != pXSprite->sysData1) return false; - char buffer[5]; sprintf(buffer, "%d", abs(pXSprite->data1)); int len = strlen(buffer); int rx = -1; + char buffer[5]; sprintf(buffer, "%d", abs(pXSprite->data1)); int len = int(strlen(buffer)); int rx = -1; for (int i = bucketHead[pXSprite->txID]; i < bucketHead[pXSprite->txID + 1]; i++) { if (rxBucket[i].type == OBJ_SPRITE && evrIsRedirector(rxBucket[i].index)) continue; for (int a = 0; a < len; a++) { diff --git a/source/games/blood/src/sectorfx.cpp b/source/games/blood/src/sectorfx.cpp index 84eea1e80..4d91c4529 100644 --- a/source/games/blood/src/sectorfx.cpp +++ b/source/games/blood/src/sectorfx.cpp @@ -281,8 +281,8 @@ void DoSectorPanning(void) int px = MulScale(speed << 2, Cos(angle), 30) / xBits; int yBits = tileHeight(nTile) >> int((pSector->floorstat & 8) != 0); int py = MulScale(speed << 2, Sin(angle), 30) / yBits; - pSector->addfloorxpan(px * (1. / 256)); - pSector->addfloorypan(-py * (1. / 256)); + pSector->addfloorxpan(px * (1.f / 256)); + pSector->addfloorypan(-py * (1.f / 256)); } if (pXSector->panCeiling) // Ceiling { @@ -293,8 +293,8 @@ void DoSectorPanning(void) int px = MulScale(speed << 2, Cos(angle), 30) / xBits; int yBits = tileHeight(nTile) >> int((pSector->ceilingstat & 8) != 0); int py = MulScale(speed << 2, Sin(angle), 30) / yBits; - pSector->addceilingxpan(px * (1. / 256)); - pSector->addceilingypan(-py * (1. / 256)); + pSector->addceilingxpan(px * (1.f / 256)); + pSector->addceilingypan(-py * (1.f / 256)); } } } @@ -317,8 +317,8 @@ void DoSectorPanning(void) int px = (psx << 2) / tileWidth(nTile); int py = (psy << 2) / tileHeight(nTile); - wall[nWall].addxpan(px * (1. / 256)); - wall[nWall].addypan(py * (1. / 256)); + wall[nWall].addxpan(px * (1.f / 256)); + wall[nWall].addypan(py * (1.f / 256)); } } } diff --git a/source/games/blood/src/sfx.cpp b/source/games/blood/src/sfx.cpp index f1ac8e609..8acaef21f 100644 --- a/source/games/blood/src/sfx.cpp +++ b/source/games/blood/src/sfx.cpp @@ -114,7 +114,7 @@ void GameInterface::UpdateSounds() if (gMe->pSprite) { - listener.angle = -gMe->pSprite->ang * BAngRadian; // Build uses a period of 2048. + listener.angle = -gMe->pSprite->ang * float(BAngRadian); // Build uses a period of 2048. listener.velocity.Zero(); listener.position = GetSoundPos(&gMe->pSprite->pos); listener.valid = true; diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 5bc3c10b0..06ac6fc6a 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -270,9 +270,9 @@ void LifeLeechOperate(spritetype *pSprite, XSPRITE *pXSprite, EVENT event) int nMissileType = kMissileLifeLeechAltNormal + (pXSprite->data3 ? 1 : 0); int t2; if (!pXSprite->data3) - t2 = 120 / 10.0; + t2 = 120 / 10; else - t2 = (3*120) / 10.0; + t2 = (3*120) / 10; spritetype *pMissile = actFireMissile(pSprite, 0, z1, dx, dy, dz, nMissileType); if (pMissile) { diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index fa3498741..dad1e49c7 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -742,7 +742,7 @@ void viewDrawScreen(bool sceneonly) } else { - renderSetRollAngle(rotscrnang.asbuildf()); + renderSetRollAngle((float)rotscrnang.asbuildf()); render3DViewPolymost(nSectnum, cX, cY, cZ, cA, cH); } bDeliriumOld = bDelirium && gDeliriumBlur; diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index f180a3092..8c94b6dd6 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -194,7 +194,7 @@ static bool CheckAmmo(PLAYER *pPlayer, int ammotype, int count) return 1; if (pPlayer->curWeapon == 12 && pPlayer->weaponAmmo == 11 && pPlayer->weaponState == 11) return 1; - if (pPlayer->curWeapon == 9 && pPlayer->pXSprite->health >= (count<<4)) + if (pPlayer->curWeapon == 9 && pPlayer->pXSprite->health >= unsigned(count<<4)) return 1; return pPlayer->ammoCount[ammotype] >= count; } @@ -1703,7 +1703,7 @@ void AltFireLifeLeech(int , PLAYER *pPlayer) if (gGameOptions.nGameType <= 1) { int nAmmo = pPlayer->ammoCount[8]; - if (nAmmo < 25 && pPlayer->pXSprite->health > ((25-nAmmo)<<4)) + if (nAmmo < 25 && pPlayer->pXSprite->health > unsigned((25-nAmmo)<<4)) { actDamageSprite(pPlayer->nSprite, pPlayer->pSprite, DAMAGE_TYPE_5, ((25-nAmmo)<<4)); nAmmo = 25;