From 97223af5923dd96fd2c1e37a8f7bc4f6b8a2210f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 Oct 2022 00:17:17 +0200 Subject: [PATCH] - silenced a few conversion truncation warnings. --- source/core/gamefuncs.cpp | 2 +- source/core/interpolate.cpp | 2 +- source/core/rendering/hw_sections.cpp | 4 ++-- source/games/exhumed/src/move.cpp | 2 +- source/games/exhumed/src/object.cpp | 2 +- source/games/sw/src/coolg.cpp | 3 ++- source/games/sw/src/hornet.cpp | 3 ++- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 6391ef819..76004b6ef 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -567,7 +567,7 @@ sectortype* nextsectorneighborzptr(sectortype* sectp, int startz_, int flags) { double startz = startz_ * zinttoworld; double factor = (flags & Find_Up)? -1 : 1; - int bestz = INT_MAX; + double bestz = INT_MAX; sectortype* bestsec = (flags & Find_Safe)? sectp : nullptr; const auto planez = (flags & Find_Ceiling)? §ortype::ceilingz : §ortype::floorz; diff --git a/source/core/interpolate.cpp b/source/core/interpolate.cpp index 2fff15417..3e3068038 100644 --- a/source/core/interpolate.cpp +++ b/source/core/interpolate.cpp @@ -62,7 +62,7 @@ double Get(int index, DCoreActor* actor, int type) void Set(int index, DCoreActor* actor, int type, double val) { - int old; + double old; switch(type) { case Interp_Sect_Floorz: sector[index].setfloorz(val); break; diff --git a/source/core/rendering/hw_sections.cpp b/source/core/rendering/hw_sections.cpp index a7e0168e9..efb9826f0 100644 --- a/source/core/rendering/hw_sections.cpp +++ b/source/core/rendering/hw_sections.cpp @@ -89,7 +89,7 @@ static int sgn(double v) return (v > 0)? 1: (v < 0)? -1 : 0; } -static int dist(const DVector2& a, const DVector2& b) +static double dist(const DVector2& a, const DVector2& b) { // We only need to know if it's 1 or higher, so this is enough. return fabs(a.X - b.X) + fabs(a.Y - b.Y); @@ -162,7 +162,7 @@ int GetWindingOrder(TArray& poly, cmp comp1 = cmpLess, cmp comp2 = cmp } } - int64_t a[2], b[2], c[2]; + double a[2], b[2], c[2]; int m1 = (m + n - 1) % n; int m2 = (m + 1) % n; diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index a3e348dac..e35cc527a 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -1205,7 +1205,7 @@ int GetWallNormal(walltype* pWall) DVector3 WheresMyMouth(int nPlayer, sectortype **sectnum) { auto pActor = PlayerList[nPlayer].pActor; - int height = GetActorHeight(pActor) >> 1; + double height = GetActorHeight(pActor) * 0.5; *sectnum = pActor->sector(); auto pos = pActor->spr.pos.plusZ(-height * zinttoworld); diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 90aa25258..c4a60a704 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -637,7 +637,7 @@ void MoveSectorSprites(sectortype* pSector, double z) ExhumedSectIterator it(pSector); while (auto pActor = it.Next()) { - int actz = pActor->spr.pos.Z; + double actz = pActor->spr.pos.Z; if ((pActor->spr.statnum != 200 && actz >= minz && actz <= maxz) || pActor->spr.statnum >= 900) { pActor->spr.pos.Z = newz; diff --git a/source/games/sw/src/coolg.cpp b/source/games/sw/src/coolg.cpp index c51f78c10..70b8fd380 100644 --- a/source/games/sw/src/coolg.cpp +++ b/source/games/sw/src/coolg.cpp @@ -701,7 +701,8 @@ int InitCoolgCircle(DSWActor* actor) int DoCoolgCircle(DSWActor* actor) { - int nx,ny,bound; + double bound; + int nx,ny; actor->set_int_ang(NORM_ANGLE(actor->int_ang() + actor->user.Counter2)); diff --git a/source/games/sw/src/hornet.cpp b/source/games/sw/src/hornet.cpp index 0436ed669..9d914f524 100644 --- a/source/games/sw/src/hornet.cpp +++ b/source/games/sw/src/hornet.cpp @@ -434,7 +434,8 @@ int InitHornetCircle(DSWActor* actor) int DoHornetCircle(DSWActor* actor) { - int nx,ny,bound; + int nx,ny; + double bound; actor->set_int_ang(NORM_ANGLE(actor->int_ang() + actor->user.Counter2));