From cb2bc7967a1db8465a00fb67478cd48958c94420 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 May 2021 17:57:36 +0200 Subject: [PATCH] - fixed the remaining warnings. --- source/core/console/c_notifybuffer.cpp | 4 +-- source/core/rendering/scene/hw_portal.cpp | 2 +- source/core/textures/buildtiles.cpp | 4 +-- source/core/textures/hightile.cpp | 2 +- source/games/duke/src/actors.cpp | 2 +- source/games/duke/src/game_misc.cpp | 2 +- source/games/duke/src/gamedef.cpp | 2 +- source/games/duke/src/gameexec.cpp | 18 +++++++------- source/games/duke/src/input.cpp | 30 +++++++++++------------ source/games/duke/src/player.cpp | 2 +- source/games/duke/src/render.cpp | 14 +++++------ source/games/duke/src/sectors.cpp | 8 +++--- source/glbackend/glbackend.cpp | 4 +-- 13 files changed, 47 insertions(+), 47 deletions(-) diff --git a/source/core/console/c_notifybuffer.cpp b/source/core/console/c_notifybuffer.cpp index ffbd945c0..20b877155 100644 --- a/source/core/console/c_notifybuffer.cpp +++ b/source/core/console/c_notifybuffer.cpp @@ -192,8 +192,8 @@ void FNotifyBuffer::Draw() double nfscale = (generic_ui? 0.7 : NotifyFontScale); double scale = 1 / ( * con_notifyscale); - int line = Top + font->GetDisplacement() / nfscale; - int lineadv = font->GetHeight () / nfscale; + double line = Top + font->GetDisplacement() / nfscale; + double lineadv = font->GetHeight () / nfscale; for (unsigned i = 0; i < Text.Size(); ++ i) { diff --git a/source/core/rendering/scene/hw_portal.cpp b/source/core/rendering/scene/hw_portal.cpp index 1ce9e32df..30f522958 100644 --- a/source/core/rendering/scene/hw_portal.cpp +++ b/source/core/rendering/scene/hw_portal.cpp @@ -481,7 +481,7 @@ int HWLinePortal::ClipSeg(walltype *seg, const DVector3 &viewpos) int HWLinePortal::ClipSector(sectortype *sub) { // this seg is completely behind the mirror - for (unsigned int i = 0; iwallnum; i++) + for (int i = 0; iwallnum; i++) { if (PointOnLineSide(WallStart(&wall[sub->wallptr]), line) == 0) return PClip_Inside; } diff --git a/source/core/textures/buildtiles.cpp b/source/core/textures/buildtiles.cpp index 5cd2b27c0..de2d75278 100644 --- a/source/core/textures/buildtiles.cpp +++ b/source/core/textures/buildtiles.cpp @@ -274,7 +274,7 @@ void BuildTiles::MakeCanvas(int tilenum, int width, int height) { auto canvas = ValidateCustomTile(tilenum, ReplacementType::Canvas); canvas->SetSize(width*4, height*4); - canvas->SetDisplaySize(width, height); + canvas->SetDisplaySize((float)width, (float)height); canvas->GetTexture()->SetSize(width * 4, height * 4); static_cast(canvas->GetTexture())->aspectRatio = (float)width / height; } @@ -291,7 +291,7 @@ void BuildTiles::MakeCanvas(int tilenum, int width, int height) int BuildTiles::LoadArtFile(const char *fn, const char *mapname, int firsttile) { - auto old = FindFile(fn); + unsigned old = FindFile(fn); if (old >= ArtFiles.Size()) // Do not process if already loaded. { FileReader fr = fileSystem.OpenFileReader(fn); diff --git a/source/core/textures/hightile.cpp b/source/core/textures/hightile.cpp index 36f8e6315..87d8eaf7c 100644 --- a/source/core/textures/hightile.cpp +++ b/source/core/textures/hightile.cpp @@ -440,7 +440,7 @@ bool PreBindTexture(FRenderState* state, FGameTexture*& tex, EUpscaleFlags& flag flags |= (((pick.tintFlags & TINTF_BLENDMASK) >> 6) + 1) & TextureManipulation::BlendMask; } } - addcol.W = flags; + addcol.W = (float)flags; if ((pick.translation & 0x80000000) && hw_shadeinterpolate) addcol.W += 16384; // hijack a free bit in here. state->SetTextureColors(&modcol.X, &addcol.X, &blendcol.X); } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 3ad7d14dd..dc498fbfd 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -4461,7 +4461,7 @@ void handle_se27(DDukeActor* actor) { if (cansee(s->x, s->y, s->z, s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum)) { - if (x < (unsigned)sh) + if (x < sh) { ud.cameraactor = actor; t[0] = 999; diff --git a/source/games/duke/src/game_misc.cpp b/source/games/duke/src/game_misc.cpp index 89e32c0af..0ec3b38e3 100644 --- a/source/games/duke/src/game_misc.cpp +++ b/source/games/duke/src/game_misc.cpp @@ -232,7 +232,7 @@ void drawoverlays(double smoothratio) // loogies courtesy of being snotted on if (pp->loogcnt > 0 && !isRR()) { - V_AddBlend(0, 63, 0, (pp->loogcnt >> 1), blend); + V_AddBlend(0, 63, 0, float(pp->loogcnt >> 1), blend); } if (blend[3]) { diff --git a/source/games/duke/src/gamedef.cpp b/source/games/duke/src/gamedef.cpp index 9b86ae0db..89ccc2dda 100644 --- a/source/games/duke/src/gamedef.cpp +++ b/source/games/duke/src/gamedef.cpp @@ -300,7 +300,7 @@ int ConCompiler::getkeyword(const char* text) while (min <= max) { - int mid = (min + max) >> 1; + auto mid = (min + max) >> 1; const int comp = strcmp(text, cmdList[mid].cmd); if (comp == 0) diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index 1a9b7d754..08884d189 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -633,7 +633,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, case PLAYER_ONE_EIGHTY_COUNT: if (bSet) ps[iPlayer].angle.spin = lValue; - else SetGameVarID(lVar2, ps[iPlayer].angle.spin, sActor, sPlayer); + else SetGameVarID(lVar2, int(ps[iPlayer].angle.spin), sActor, sPlayer); break; case PLAYER_CHEAT_PHASE: @@ -987,11 +987,11 @@ void DoWall(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, s else SetGameVarID(lVar2, wall[iWall].yrepeat, sActor, sPlayer); break; case WALL_XPANNING: - if (bSet) wall[iWall].xpan_ = lValue; + if (bSet) wall[iWall].xpan_ = (float)(lValue & 255); else SetGameVarID(lVar2, wall[iWall].xpan(), sActor, sPlayer); break; case WALL_YPANNING: - if (bSet) wall[iWall].ypan_ = lValue; + if (bSet) wall[iWall].ypan_ = (float)(lValue & 255); else SetGameVarID(lVar2, wall[iWall].ypan(), sActor, sPlayer); break; case WALL_LOTAG: @@ -1077,11 +1077,11 @@ void DoSector(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, else SetGameVarID(lVar2, sector[iSector].ceilingpal, sActor, sPlayer); break; case SECTOR_CEILINGXPANNING: - if (bSet) sector[iSector].ceilingxpan_ = lValue; + if (bSet) sector[iSector].ceilingxpan_ = (float)(lValue & 255); else SetGameVarID(lVar2, sector[iSector].ceilingxpan(), sActor, sPlayer); break; case SECTOR_CEILINGYPANNING: - if (bSet) sector[iSector].ceilingypan_ = lValue; + if (bSet) sector[iSector].ceilingypan_ = (float)(lValue & 255); else SetGameVarID(lVar2, sector[iSector].ceilingypan(), sActor, sPlayer); break; case SECTOR_FLOORPICNUM: @@ -1101,11 +1101,11 @@ void DoSector(char bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, else SetGameVarID(lVar2, sector[iSector].floorpal, sActor, sPlayer); break; case SECTOR_FLOORXPANNING: - if (bSet) sector[iSector].floorxpan_ = lValue; + if (bSet) sector[iSector].floorxpan_ = (float)(lValue & 255); else SetGameVarID(lVar2, sector[iSector].floorxpan(), sActor, sPlayer); break; case SECTOR_FLOORYPANNING: - if (bSet) sector[iSector].floorypan_ = lValue; + if (bSet) sector[iSector].floorypan_ = (float)(lValue & 255); else SetGameVarID(lVar2, sector[iSector].floorypan(), sActor, sPlayer); break; case SECTOR_VISIBILITY: @@ -1698,7 +1698,7 @@ int ParseState::parse(void) ps[connecthead].max_actors_killed++; //revive the egg g_ac->temp_data[5] = 0; } - g_sp->pal = g_ac->tempang; + g_sp->pal = (uint8_t)g_ac->tempang; } g_ac->tempang = 0; break; @@ -2194,7 +2194,7 @@ int ParseState::parse(void) break; case concmd_clipdist: insptr++; - g_sp->clipdist = (short) *insptr; + g_sp->clipdist = (uint8_t) *insptr; insptr++; break; case concmd_cstat: diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 913312268..bebcabaec 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -369,7 +369,7 @@ void hud_input(int plnum) { int j = gs.max_player_health - p->GetActor()->s->extra; - if ((unsigned int)p->firstaid_amount > j) + if (p->firstaid_amount > j) { p->firstaid_amount -= j; p->GetActor()->s->extra = gs.max_player_health; @@ -568,13 +568,13 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool if (kbdLeft || hidInput->mouseturnx < 0 || hidInput->dyaw < 0) { - p->TiltStatus -= factor; + p->TiltStatus -= (float)factor; if (p->TiltStatus < -10) p->TiltStatus = -10; } else if (kbdRight || hidInput->mouseturnx > 0 || hidInput->dyaw > 0) { - p->TiltStatus += factor; + p->TiltStatus += (float)factor; if (p->TiltStatus > 10) p->TiltStatus = 10; } @@ -589,7 +589,7 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0) { updateTurnHeldAmt(factor); - p->TiltStatus -= factor; + p->TiltStatus -= (float)factor; if (p->TiltStatus < -10) p->TiltStatus = -10; @@ -607,7 +607,7 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0) { updateTurnHeldAmt(factor); - p->TiltStatus += factor; + p->TiltStatus += (float)factor; if (p->TiltStatus > 10) p->TiltStatus = 10; @@ -627,9 +627,9 @@ static double motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool resetTurnHeldAmt(); if (p->TiltStatus > 0) - p->TiltStatus -= factor; + p->TiltStatus -= (float)factor; else if (p->TiltStatus < 0) - p->TiltStatus += factor; + p->TiltStatus += (float)factor; } } @@ -663,7 +663,7 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool if (!p->NotOnWater) { - p->TiltStatus -= factor; + p->TiltStatus -= (float)factor; if (p->TiltStatus < -10) p->TiltStatus = -10; } @@ -684,7 +684,7 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool if (!p->NotOnWater) { - p->TiltStatus += factor; + p->TiltStatus += (float)factor; if (p->TiltStatus > 10) p->TiltStatus = 10; } @@ -704,9 +704,9 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool resetTurnHeldAmt(); if (p->TiltStatus > 0) - p->TiltStatus -= factor; + p->TiltStatus -= (float)factor; else if (p->TiltStatus < 0) - p->TiltStatus += factor; + p->TiltStatus += (float)factor; } } else if (!p->NotOnWater) @@ -714,9 +714,9 @@ static double boatApplyTurn(player_struct *p, ControlInfo* const hidInput, bool resetTurnHeldAmt(); if (p->TiltStatus > 0) - p->TiltStatus -= factor; + p->TiltStatus -= (float)factor; else if (p->TiltStatus < 0) - p->TiltStatus += factor; + p->TiltStatus += (float)factor; } if (fabs(p->TiltStatus) < factor) @@ -747,12 +747,12 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I if (p->OnMotorcycle) { - input.avel = motoApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust); + input.avel = (float)motoApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust); if (p->moto_underwater) p->MotoSpeed = 0; } else { - input.avel = boatApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust); + input.avel = (float)boatApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust); } loc.fvel = clamp(xs_CRoundToInt(p->MotoSpeed), -(MAXVELMOTO >> 3), MAXVELMOTO); diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index bcbc0b057..ae7768fb1 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -521,7 +521,7 @@ void footprints(int snum) default: fprint = spawn(actor, TILE_FOOTPRINTS4); break; } fprint->s->pal = p->footprintpal; - fprint->s->shade = p->footprintshade; + fprint->s->shade = (int8_t)p->footprintshade; } } } diff --git a/source/games/duke/src/render.cpp b/source/games/duke/src/render.cpp index 71561d80f..b3f170c86 100644 --- a/source/games/duke/src/render.cpp +++ b/source/games/duke/src/render.cpp @@ -73,7 +73,7 @@ void renderView(spritetype* playersprite, int sectnum, int x, int y, int z, bina if (!testnewrenderer) { // do screen rotation. - renderSetRollAngle(rotscrnang.asbuildf()); + renderSetRollAngle((float)rotscrnang.asbuildf()); se40code(x, y, z, a, h, smoothratio); renderMirror(x, y, z, a, h, smoothratio); @@ -108,7 +108,7 @@ void GameInterface::UpdateCameras(double smoothratio) if (camsprite->GetOwner() && dist(p->GetActor(), camsprite) < VIEWSCREEN_ACTIVE_DISTANCE) { auto tex = tileGetTexture(sp->picnum); - TileFiles.MakeCanvas(TILE_VIEWSCR, tex->GetDisplayWidth(), tex->GetDisplayHeight()); + TileFiles.MakeCanvas(TILE_VIEWSCR, (int)tex->GetDisplayWidth(), (int)tex->GetDisplayHeight()); auto canvas = renderSetTarget(TILE_VIEWSCR); if (!canvas) return; @@ -122,7 +122,7 @@ void GameInterface::UpdateCameras(double smoothratio) { // Note: no ROR or camera here - Polymost has no means to detect these things before rendering the scene itself. renderDrawRoomsQ16(camera->x, camera->y, camera->z, ang.asq16(), IntToFixed(camera->shade), camera->sectnum); // why 'shade'...? - fi.animatesprites(pm_tsprite, pm_spritesortcnt, camera->x, camera->y, ang.asbuild(), smoothratio); + fi.animatesprites(pm_tsprite, pm_spritesortcnt, camera->x, camera->y, ang.asbuild(), (int)smoothratio); renderDrawMasks(); } else @@ -299,7 +299,7 @@ void displayrooms(int snum, double smoothratio) cang = buildang(interpolatedangle(ud.cameraactor->tempang, s->ang, smoothratio)); auto bh = buildhoriz(s->yvel); - renderView(s, s->sectnum, s->x, s->y, s->z - (4 << 8), cang, bh, buildang(0), smoothratio); + renderView(s, s->sectnum, s->x, s->y, s->z - (4 << 8), cang, bh, buildang(0), (int)smoothratio); } else { @@ -410,12 +410,12 @@ void displayrooms(int snum, double smoothratio) if (isRR() && sector[sect].lotag == 848 && !testnewrenderer) { - renderSetRollAngle(rotscrnang.asbuildf()); - geometryEffect(cposx, cposy, cposz, cang, choriz, sect, smoothratio); + renderSetRollAngle((float)rotscrnang.asbuildf()); + geometryEffect(cposx, cposy, cposz, cang, choriz, sect, (int)smoothratio); } else { - renderView(viewer, sect, cposx, cposy, cposz, cang, choriz, rotscrnang, smoothratio); + renderView(viewer, sect, cposx, cposy, cposz, cang, choriz, rotscrnang, (int)smoothratio); } } //GLInterface.SetMapFog(false); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 8cc7d4919..8aeb1f6ba 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1090,10 +1090,10 @@ void operateactivators(int low, int plnum) { p[5] = !p[5]; - sector[p[0]].floorshade = sector[p[0]].ceilingshade = p[3]; + sector[p[0]].floorshade = sector[p[0]].ceilingshade = (int8_t)p[3]; wal = &wall[sector[p[0]].wallptr]; for (j = sector[p[0]].wallnum; j > 0; j--, wal++) - wal->shade = p[3]; + wal->shade = (int8_t)p[3]; } } @@ -1267,8 +1267,8 @@ void moveclouds(double smoothratio) cloudclock = myclock + 6; // cloudx/y were an array, but all entries were always having the same value so a single pair is enough. - cloudx += ps[screenpeek].angle.ang.fcos() * 0.5f; - cloudy += ps[screenpeek].angle.ang.fsin() * 0.5f; + cloudx += (float)ps[screenpeek].angle.ang.fcos() * 0.5f; + cloudy += (float)ps[screenpeek].angle.ang.fsin() * 0.5f; for (int i = 0; i < numclouds; i++) { if (!testnewrenderer) diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 258bad5d6..1f832801d 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -84,8 +84,8 @@ void GLInstance::Draw(EDrawType type, size_t start, size_t count) { assert (BufferLock > 0); applyMapFog(); - renderState.vindex = start; - renderState.vcount = count; + renderState.vindex = (int)start; + renderState.vcount = (int)count; renderState.primtype = type; rendercommands.Push(renderState); clearMapFog();