- more warning fixes in 'core'.

This commit is contained in:
Christoph Oelckers 2021-05-12 01:55:06 +02:00
parent 1168341d5a
commit 783b94f922
9 changed files with 34 additions and 23 deletions

View file

@ -145,6 +145,12 @@ public:
return true; return true;
} }
bool GetFloat(float& var, bool evaluate = false)
{
if (!GetFloat(evaluate)) return false;
var = float(Float);
return true;
}
void MustGetFloat(bool evaluate = false); void MustGetFloat(bool evaluate = false);
bool CheckFloat(bool evaluate = false); bool CheckFloat(bool evaluate = false);

View file

@ -116,10 +116,10 @@ void FNotifyBuffer::DrawNative()
FFont* font = isBlood() ? SmallFont2 : SmallFont; FFont* font = isBlood() ? SmallFont2 : SmallFont;
int line = isBlood() ? Top : (g_gameType & GAMEFLAG_SW) ? 40 : font->GetDisplacement(); double line = isBlood() ? Top : (g_gameType & GAMEFLAG_SW) ? 40 : font->GetDisplacement();
bool canskip = isBlood(); bool canskip = isBlood();
double scale = 1 / (NotifyFontScale * con_notifyscale); double scale = 1 / (NotifyFontScale * con_notifyscale);
int lineadv = font->GetHeight() / NotifyFontScale; double lineadv = font->GetHeight() / NotifyFontScale;
for (unsigned i = topline; i < Text.Size(); ++i) for (unsigned i = topline; i < Text.Size(); ++i)
{ {

View file

@ -135,7 +135,7 @@ static void parseTexturePaletteBlock(FScanner& sc, int tile)
int pal = -1, xsiz = 0, ysiz = 0; int pal = -1, xsiz = 0, ysiz = 0;
FString fn; FString fn;
double alphacut = -1.0, xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0; float alphacut = -1.0, xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0;
if (!sc.GetNumber(pal, true)) return; if (!sc.GetNumber(pal, true)) return;
@ -178,7 +178,7 @@ static void parseTextureSpecialBlock(FScanner& sc, int tile, int pal)
FScriptPosition pos = sc; FScriptPosition pos = sc;
FString fn; FString fn;
double xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0; float xscale = 1.0, yscale = 1.0, specpower = 1.0, specfactor = 1.0;
if (sc.StartBraces(&blockend)) return; if (sc.StartBraces(&blockend)) return;
while (!sc.FoundEndBrace(blockend)) while (!sc.FoundEndBrace(blockend))
@ -837,7 +837,7 @@ void parseMapinfo(FScanner& sc, FScriptPosition& pos)
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
{ {
char smallbuf[3] = { sc.String[2 * i], sc.String[2 * i + 1], 0 }; char smallbuf[3] = { sc.String[2 * i], sc.String[2 * i + 1], 0 };
mhk.md4[i] = strtol(smallbuf, nullptr, 16); mhk.md4[i] = (uint8_t)strtol(smallbuf, nullptr, 16);
} }
} }
} }
@ -1775,7 +1775,7 @@ static bool parseModelFrameBlock(FScanner& sc, FixedBitArray<1024>& usedframes)
bool ok = true; bool ok = true;
int pal = -1; int pal = -1;
int starttile = -1, endtile = -1; int starttile = -1, endtile = -1;
double smoothduration = 0.1f; float smoothduration = 0.1f;
if (sc.StartBraces(&blockend)) return false; if (sc.StartBraces(&blockend)) return false;
while (!sc.FoundEndBrace(blockend)) while (!sc.FoundEndBrace(blockend))
@ -1858,7 +1858,7 @@ static bool parseModelSkinBlock(FScanner& sc, int pal)
FString filename; FString filename;
int surface = 0; int surface = 0;
double param = 1.0, specpower = 1.0, specfactor = 1.0; float param = 1.0, specpower = 1.0, specfactor = 1.0;
int flags = 0; int flags = 0;
if (sc.StartBraces(&blockend)) return false; if (sc.StartBraces(&blockend)) return false;
@ -1890,7 +1890,7 @@ static bool parseModelSkinBlock(FScanner& sc, int pal)
return false; return false;
} }
if (pal == DETAILPAL) param = 1. / param; if (pal == DETAILPAL) param = 1.f / param;
int res = md_defineskin(mdglobal.lastmodelid, filename, pal, max(0, mdglobal.modelskin), surface, param, specpower, specfactor, flags); int res = md_defineskin(mdglobal.lastmodelid, filename, pal, max(0, mdglobal.modelskin), surface, param, specpower, specfactor, flags);
if (res < 0) if (res < 0)
{ {

View file

@ -10,6 +10,10 @@ void loaddefinitionsfile(const char* fn, bool cumulative = false);
bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio); bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnum, binangle ang, fixedhoriz horiz, double const smoothratio);
void PlanesAtPoint(const sectortype* sec, int dax, int day, float* ceilz, float* florz); void PlanesAtPoint(const sectortype* sec, int dax, int day, float* ceilz, float* florz);
inline void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz) // this is just for warning evasion.
{
PlanesAtPoint(sec, int(dax), int(day), ceilz, florz);
}
void setWallSectors(); void setWallSectors();
void GetWallSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool render = false); void GetWallSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool render = false);
void GetFlatSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool render = false); void GetFlatSpritePosition(const spritetype* spr, vec2_t pos, vec2_t* out, bool render = false);

View file

@ -415,7 +415,7 @@ static void BuildEpisodeMenu()
} }
ld->mSelectedItem = gDefaultVolume + ld->mItems.Size(); // account for pre-added items ld->mSelectedItem = gDefaultVolume + ld->mItems.Size(); // account for pre-added items
int y = ld->mYpos; double y = ld->mYpos;
// Volume definitions should be sorted by intended menu order. // Volume definitions should be sorted by intended menu order.
for (auto &vol : volumes) for (auto &vol : volumes)
@ -471,7 +471,7 @@ static void BuildEpisodeMenu()
} }
if (isBlood()) gDefaultSkill = 2; if (isBlood()) gDefaultSkill = 2;
ld->mSelectedItem = gDefaultSkill + ld->mItems.Size(); // account for pre-added items ld->mSelectedItem = gDefaultSkill + ld->mItems.Size(); // account for pre-added items
int y = ld->mYpos; double y = ld->mYpos;
for (int i = 0; i < MAXSKILLS; i++) for (int i = 0; i < MAXSKILLS; i++)
{ {

View file

@ -419,7 +419,7 @@ public:
{ {
if (soundtrack > 0) if (soundtrack > 0)
{ {
Mus_Play(nullptr, fileSystem.GetFileFullName(soundtrack, false), false); Mus_Play(fileSystem.GetFileFullName(soundtrack, false), false);
} }
animtex.SetSize(AnimTexture::YUV, width, height); animtex.SetSize(AnimTexture::YUV, width, height);
} }
@ -519,7 +519,6 @@ class SmkPlayer : public MoviePlayer
AnimTextures animtex; AnimTextures animtex;
TArray<uint8_t> pFrame; TArray<uint8_t> pFrame;
TArray<uint8_t> audioBuffer; TArray<uint8_t> audioBuffer;
int nFrameRate;
int nFrames; int nFrames;
bool fullscreenScale; bool fullscreenScale;
uint64_t nFrameNs; uint64_t nFrameNs;
@ -571,8 +570,8 @@ public:
flags = flags_; flags = flags_;
Smacker_GetFrameSize(hSMK, nWidth, nHeight); Smacker_GetFrameSize(hSMK, nWidth, nHeight);
pFrame.Resize(nWidth * nHeight + std::max(nWidth, nHeight)); pFrame.Resize(nWidth * nHeight + std::max(nWidth, nHeight));
nFrameRate = Smacker_GetFrameRate(hSMK); float frameRate = Smacker_GetFrameRate(hSMK);
nFrameNs = 1'000'000'000 / nFrameRate; nFrameNs = uint64_t(1'000'000'000 / frameRate);
nFrames = Smacker_GetNumFrames(hSMK); nFrames = Smacker_GetNumFrames(hSMK);
Smacker_GetPalette(hSMK, palette); Smacker_GetPalette(hSMK, palette);
@ -617,7 +616,7 @@ public:
bool Frame(uint64_t clock) override bool Frame(uint64_t clock) override
{ {
int frame = clock / nFrameNs; int frame = int(clock / nFrameNs);
twod->ClearScreen(); twod->ClearScreen();
if (frame > nFrame) if (frame > nFrame)
@ -698,7 +697,7 @@ MoviePlayer* OpenMovie(const char* filename, TArray<int>& ans, const int* framet
if (!fr.isOpen()) fr = fileSystem.OpenFileReader(filename); if (!fr.isOpen()) fr = fileSystem.OpenFileReader(filename);
if (!fr.isOpen()) if (!fr.isOpen())
{ {
int nLen = strlen(filename); size_t nLen = strlen(filename);
// Strip the drive letter and retry. // Strip the drive letter and retry.
if (nLen >= 3 && isalpha(filename[0]) && filename[1] == ':' && filename[2] == '/') if (nLen >= 3 && isalpha(filename[0]) && filename[1] == ':' && filename[2] == '/')
{ {

View file

@ -252,7 +252,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
{ {
nTimerRate = fr.ReadUInt32(); nTimerRate = fr.ReadUInt32();
nTimerDiv = fr.ReadUInt16(); nTimerDiv = fr.ReadUInt16();
nFrameDuration = ((double)nTimerRate * nTimerDiv) * 1000; nFrameDuration = ((uint64_t)nTimerRate * nTimerDiv) * 1000;
break; break;
} }
@ -346,7 +346,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
case OPCODE_AUDIO_FRAME: case OPCODE_AUDIO_FRAME:
{ {
int nStart = fr.Tell(); int nStart = (int)fr.Tell();
uint16_t seqIndex = fr.ReadUInt16(); uint16_t seqIndex = fr.ReadUInt16();
uint16_t streamMask = fr.ReadUInt16(); uint16_t streamMask = fr.ReadUInt16();
uint16_t nSamples = fr.ReadUInt16(); // number of samples this chunk uint16_t nSamples = fr.ReadUInt16(); // number of samples this chunk
@ -380,7 +380,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
ch ^= audio.nChannels - 1; ch ^= audio.nChannels - 1;
} }
int nEnd = fr.Tell(); int nEnd = (int)fr.Tell();
int nRead = nEnd - nStart; int nRead = nEnd - nStart;
assert(opcodeSize == nRead); assert(opcodeSize == nRead);
break; break;
@ -449,14 +449,14 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
} }
} }
int nRead = fr.Read(decodeMap.pData, opcodeSize); int nRead = (int)fr.Read(decodeMap.pData, opcodeSize);
assert(nRead == opcodeSize); assert(nRead == opcodeSize);
break; break;
} }
case OPCODE_VIDEO_DATA: case OPCODE_VIDEO_DATA:
{ {
int nStart = fr.Tell(); int nStart = (int)fr.Tell();
// need to skip 14 bytes // need to skip 14 bytes
fr.Seek(14, FileReader::SeekCur); fr.Seek(14, FileReader::SeekCur);
@ -536,7 +536,7 @@ bool InterplayDecoder::RunFrame(uint64_t clock)
} }
} }
int nEnd = fr.Tell(); int nEnd = (int)fr.Tell();
int nSkipBytes = opcodeSize - (nEnd - nStart); // we can end up with 1 byte left we need to skip int nSkipBytes = opcodeSize - (nEnd - nStart); // we can end up with 1 byte left we need to skip
assert(nSkipBytes <= 1); assert(nSkipBytes <= 1);

View file

@ -15,6 +15,8 @@
#include "hw_renderstate.h" #include "hw_renderstate.h"
#include "hw_cvars.h" #include "hw_cvars.h"
#pragma warning(disable:4244) // this gets a bit annoying in the renderer...
struct HWHorizonInfo; struct HWHorizonInfo;
struct HWSkyInfo; struct HWSkyInfo;
class FMaterial; class FMaterial;

View file

@ -65,7 +65,7 @@ void VLC_InitTable(VLCtable &table, uint32_t maxLength, uint32_t size, int *leng
uint32_t VLC_GetSize(VLCtable &table) uint32_t VLC_GetSize(VLCtable &table)
{ {
return table.size(); return uint32_t(table.size());
} }
} // close namespace SmackerCommon } // close namespace SmackerCommon