diff --git a/source/core/automap.cpp b/source/core/automap.cpp index 1b7ba5519..f9ef9e153 100644 --- a/source/core/automap.cpp +++ b/source/core/automap.cpp @@ -185,7 +185,7 @@ static void CalcMapBounds() void AutomapControl() { static int nonsharedtimer; - int ms = screen->FrameTime; + int ms = (int)screen->FrameTime; int interval; int panvert = 0, panhorz = 0; @@ -197,7 +197,7 @@ void AutomapControl() { interval = 0; } - nonsharedtimer = screen->FrameTime; + nonsharedtimer = ms; if (System_WantGuiCapture()) return; diff --git a/source/core/cheats.cpp b/source/core/cheats.cpp index 9b670931c..013a145fc 100644 --- a/source/core/cheats.cpp +++ b/source/core/cheats.cpp @@ -196,7 +196,7 @@ CCMD(give) if (!CheckCheatmode(true, true)) { Net_WriteByte(DEM_GIVE); - Net_WriteByte(found); + Net_WriteByte((uint8_t)found); } } diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index a6fc77df4..68c4a3b76 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1523,7 +1523,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Raze, MusicEnabled, MusicEnabled) DEFINE_ACTION_FUNCTION_NATIVE(_Raze, GetTimeFrac, I_GetTimeFrac) { - ACTION_RETURN_INT(I_GetTimeFrac()); + ACTION_RETURN_FLOAT(I_GetTimeFrac()); } DEFINE_ACTION_FUNCTION(_Raze, PlayerName) diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index f4b0c3de0..6eaec0d76 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -146,7 +146,7 @@ CCMD(sizeup) } else { - hud_scalefactor = hud_scalefactor + 0.04; + hud_scalefactor = hud_scalefactor + 0.04f; } } @@ -162,7 +162,7 @@ CCMD(sizedown) } else { - hud_scalefactor = hud_scalefactor - 0.04; + hud_scalefactor = hud_scalefactor - 0.04f; } } diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index f34cd1249..7015acacb 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -131,7 +131,7 @@ bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnu *pz += MulScale(nz, cameradist, 16); // Caculate clock using GameTicRate so it increases the same rate on all speed computers. - int myclock = PlayClock + MulScale(120 / GameTicRate, smoothratio, 16); + int myclock = PlayClock + MulScale(120 / GameTicRate, int(smoothratio), 16); if (cameraclock == INT_MIN) { // Third person view was just started. @@ -154,7 +154,7 @@ bool calcChaseCamPos(int* px, int* py, int* pz, spritetype* pspr, short *psectnu // //========================================================================== -void PlanesAtPoint(const sectortype* sec, float dax, float day, float* pceilz, float* pflorz) +void PlanesAtPoint(const sectortype* sec, int dax, int day, float* pceilz, float* pflorz) { float ceilz = float(sec->ceilingz); float florz = float(sec->floorz); @@ -164,13 +164,13 @@ void PlanesAtPoint(const sectortype* sec, float dax, float day, float* pceilz, f auto wal = &wall[sec->wallptr]; auto wal2 = &wall[wal->point2]; - float dx = wal2->x - wal->x; - float dy = wal2->y - wal->y; + float dx = float(wal2->x - wal->x); + float dy = float(wal2->y - wal->y); int i = (int)sqrt(dx * dx + dy * dy) << 5; // length of sector's first wall. if (i != 0) { - float const j = (dx * (day - wal->y) - dy * (dax - wal->x)) * (1.f / 8.f); + float const j = (dx * (float(day - wal->y)) - dy * (float(dax - wal->x))) * (1.f / 8.f); if (sec->ceilingstat & CSTAT_SECTOR_SLOPE) ceilz += (sec->ceilingheinum * j) / i; if (sec->floorstat & CSTAT_SECTOR_SLOPE) florz += (sec->floorheinum * j) / i; } diff --git a/source/core/gamefuncs.h b/source/core/gamefuncs.h index 20a5d7ad7..26265ae26 100644 --- a/source/core/gamefuncs.h +++ b/source/core/gamefuncs.h @@ -9,7 +9,7 @@ extern int cameradist, cameraclock; 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); -void PlanesAtPoint(const sectortype* sec, float dax, float day, float* ceilz, float* florz); +void PlanesAtPoint(const sectortype* sec, int dax, int day, float* ceilz, float* florz); void setWallSectors(); 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); diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 8560220a2..236e50082 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -61,7 +61,7 @@ binangle getincanglebam(binangle a, binangle na) if(cura > INT32_MAX) cura -= UINT32_MAX; } - return bamang(newa-cura); + return bamang(uint32_t(newa-cura)); } //--------------------------------------------------------------------------- @@ -133,7 +133,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn if (buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe) currInput->svel -= xs_CRoundToInt((hidInput->mousemovex * mousevelscale) + (scaleAdjust * hidInput->dyaw * keymove * cntrlvelscale)); else - currInput->avel += hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw * hidspeed * turnscale); + currInput->avel += float(hidInput->mouseturnx + (scaleAdjust * hidInput->dyaw * hidspeed * turnscale)); if (!(inputBuffer->actions & SB_AIMMODE)) currInput->horz -= hidInput->mouseturny; @@ -147,7 +147,7 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn currInput->avel = -currInput->avel; // process remaining controller input. - currInput->horz -= scaleAdjust * hidInput->dpitch * hidspeed; + currInput->horz -= float(scaleAdjust * hidInput->dpitch * hidspeed); currInput->svel += xs_CRoundToInt(scaleAdjust * hidInput->dx * keymove * cntrlvelscale); currInput->fvel += xs_CRoundToInt(scaleAdjust * hidInput->dz * keymove * cntrlvelscale); @@ -177,12 +177,12 @@ void processMovement(InputPacket* currInput, InputPacket* inputBuffer, ControlIn if (buttonMap.ButtonDown(gamefunc_Turn_Left) || (buttonMap.ButtonDown(gamefunc_Strafe_Left) && !allowstrafe)) { updateTurnHeldAmt(scaleAdjust); - currInput->avel -= scaleAdjust * (isTurboTurnTime() ? turnamount : preambleturn); + currInput->avel -= float(scaleAdjust * (isTurboTurnTime() ? turnamount : preambleturn)); } else if (buttonMap.ButtonDown(gamefunc_Turn_Right) || (buttonMap.ButtonDown(gamefunc_Strafe_Right) && !allowstrafe)) { updateTurnHeldAmt(scaleAdjust); - currInput->avel += scaleAdjust * (isTurboTurnTime() ? turnamount : preambleturn); + currInput->avel += float(scaleAdjust * (isTurboTurnTime() ? turnamount : preambleturn)); } else { diff --git a/source/core/initfs.cpp b/source/core/initfs.cpp index 4a59514c0..f5796dc6a 100644 --- a/source/core/initfs.cpp +++ b/source/core/initfs.cpp @@ -263,7 +263,7 @@ static void DeleteStuff(FileSystem &fileSystem, const TArray& deletelum str.Truncate(ndx); } - for (uint32_t i = 0; i < fileSystem.GetNumEntries(); i++) + for (int i = 0; i < fileSystem.GetNumEntries(); i++) { int cf = fileSystem.GetFileContainer(i); auto fname = fileSystem.GetFileFullName(i, false); @@ -343,8 +343,8 @@ void InitFileSystem(TArray& groups) D_AddConfigFiles(Files, "Global.Autoload", "*.grp", GameConfig); - long len; - int lastpos = 0; + size_t len; + size_t lastpos = 0; while (lastpos < LumpFilter.Len() && (len = strcspn(LumpFilter.GetChars() + lastpos, ".")) > 0) { diff --git a/source/core/mapinfo.cpp b/source/core/mapinfo.cpp index 3231c990a..d327d5587 100644 --- a/source/core/mapinfo.cpp +++ b/source/core/mapinfo.cpp @@ -168,7 +168,7 @@ MapRecord* FindNextSecretMap(MapRecord* thismap) bool SetMusicForMap(const char* mapname, const char* music, bool namehack) { static const char* specials[] = { "intro", "briefing", "loading" }; - for (int i = 0; i < 3; i++) + for (unsigned i = 0; i < 3; i++) { if (!stricmp(mapname, specials[i])) { diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index ee6bf0d99..88449a459 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -208,7 +208,7 @@ static void SetWallPalV5() static void ValidateSprite(spritetype& spr) { - int index = &spr - sprite; + int index = int(&spr - sprite); bool bugged = false; if ((unsigned)spr.statnum >= MAXSTATUS) { diff --git a/source/core/rts.cpp b/source/core/rts.cpp index ac892f2e0..1754d990f 100644 --- a/source/core/rts.cpp +++ b/source/core/rts.cpp @@ -95,7 +95,7 @@ bool RTS_IsInitialized() { FileLump *li = (FileLump*)(RTSFile.Data() + LittleLong(wi->infotableofs)); LumpInfo.Resize(numlumps); - for(unsigned i = 0; i < numlumps; i++, li++) + for(int i = 0; i < numlumps; i++, li++) { LumpInfo[i] = { LittleLong(li->position), LittleLong(li->size), -1 }; if (unsigned(LumpInfo[i].position + LumpInfo[i].size) >= RTSFile.Size()) diff --git a/source/core/screenjob.cpp b/source/core/screenjob.cpp index 5126798b1..f8e905dec 100644 --- a/source/core/screenjob.cpp +++ b/source/core/screenjob.cpp @@ -94,7 +94,7 @@ void Job_Init() static VMFunction* LookupFunction(const char* qname, bool validate = true) { - int p = strcspn(qname, "."); + size_t p = strcspn(qname, "."); if (p == 0) I_Error("Call to undefined function %s", qname); FString clsname(qname, p); FString funcname = qname + p + 1; diff --git a/source/core/searchpaths.cpp b/source/core/searchpaths.cpp index 99c974399..194606caa 100644 --- a/source/core/searchpaths.cpp +++ b/source/core/searchpaths.cpp @@ -665,7 +665,7 @@ void GetCRC(FileEntry *entry, TArray &CRCCache) do { b = f.Read(buffer.Data(), buffer.Size()); - if (b > 0) crcval = AddCRC32(crcval, buffer.Data(), b); + if (b > 0) crcval = AddCRC32(crcval, buffer.Data(), unsigned(b)); } while (b == buffer.Size()); entry->CRCValue = crcval; diff --git a/source/core/statusbar2.cpp b/source/core/statusbar2.cpp index cce7f8f90..2844b354d 100644 --- a/source/core/statusbar2.cpp +++ b/source/core/statusbar2.cpp @@ -140,7 +140,7 @@ void DBaseStatusBar::PrintLevelStats(FLevelStats &stats) { double y; double scale = stats.fontscale * hud_statscale; - if (stats.spacing <= 0) stats.spacing = stats.font->GetHeight() * stats.fontscale; + if (stats.spacing <= 0) stats.spacing = xs_CRoundToInt(stats.font->GetHeight() * stats.fontscale); double spacing = stats.spacing * hud_statscale; if (stats.screenbottomspace < 0) { @@ -226,7 +226,7 @@ void DBaseStatusBar::PrintAutomapInfo(FLevelStats& stats, bool forcetextfont) forcetextfont |= am_textfont; double y; double scale = stats.fontscale * (forcetextfont ? *hud_statscale : 1); // the tiny default font used by all games here cannot be scaled for readability purposes. - if (stats.spacing <= 0) stats.spacing = stats.font->GetHeight() * stats.fontscale; + if (stats.spacing <= 0) stats.spacing = xs_CRoundToInt(stats.font->GetHeight() * stats.fontscale); double spacing = stats.spacing * (forcetextfont ? *hud_statscale : 1); if (am_nameontop) { diff --git a/source/libsmackerdec/src/SmackerDecoder.cpp b/source/libsmackerdec/src/SmackerDecoder.cpp index 7b00caed8..c981d35a6 100644 --- a/source/libsmackerdec/src/SmackerDecoder.cpp +++ b/source/libsmackerdec/src/SmackerDecoder.cpp @@ -69,7 +69,7 @@ SmackerHandle Smacker_Open(const char* fileName) classInstances.push_back(newDecoder); // get a handle ID - newHandle.instanceIndex = classInstances.size() - 1; + newHandle.instanceIndex = int(classInstances.size()) - 1; // loaded ok, make handle valid newHandle.isValid = true; @@ -1116,7 +1116,7 @@ void SmackerDecoder::GotoFrame(uint32_t frameNum) currentFrame = 0; nextPos = firstFrameFilePos; - for (int i = 0; i < frameNum + 1; i++) + for (unsigned i = 0; i < frameNum + 1; i++) GetNextFrame(); }