From 355219d614c99bcdb586acb37b6b7b8b716839ce Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 15 Jun 2022 22:15:36 +0200 Subject: [PATCH] - fixed several scale related floating point conversion warnings. --- src/doomdata.h | 2 +- src/gamedata/d_dehacked.cpp | 2 +- src/intermission/intermission.cpp | 2 +- src/maploader/udmf.cpp | 6 +++--- src/playsim/p_acs.cpp | 4 ++-- src/r_data/sprites.cpp | 6 +++--- src/r_data/sprites.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/doomdata.h b/src/doomdata.h index 48ce4054995..12a2869219d 100644 --- a/src/doomdata.h +++ b/src/doomdata.h @@ -373,7 +373,7 @@ struct FMapThing double Gravity; double Alpha; uint32_t fillcolor; - DVector2 Scale; + FVector2 Scale; double Health; int score; int16_t pitch; diff --git a/src/gamedata/d_dehacked.cpp b/src/gamedata/d_dehacked.cpp index f0784fbe2bf..fee844f0d18 100644 --- a/src/gamedata/d_dehacked.cpp +++ b/src/gamedata/d_dehacked.cpp @@ -1193,7 +1193,7 @@ static int PatchThing (int thingy) } else if (stricmp (Line1, "Scale") == 0) { - info->Scale.Y = info->Scale.X = clamp(atof (Line2), 1./65536, 256.); + info->Scale.Y = info->Scale.X = clamp((float)atof (Line2), 1.f/65536, 256.f); } else if (stricmp (Line1, "Decal") == 0) { diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 30dc71231f1..621f213667f 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -670,7 +670,7 @@ void DIntermissionScreenCast::Drawer () // draw the current frame in the middle of the screen if (caststate != NULL) { - DVector2 castscale = DVector2(mDefaults->Scale.X, mDefaults->Scale.Y); + FVector2 castscale = mDefaults->Scale; int castsprite = caststate->sprite; diff --git a/src/maploader/udmf.cpp b/src/maploader/udmf.cpp index ce32e119713..c063606f215 100644 --- a/src/maploader/udmf.cpp +++ b/src/maploader/udmf.cpp @@ -737,15 +737,15 @@ class UDMFParser : public UDMFParserBase break; case NAME_ScaleX: - th->Scale.X = CheckFloat(key); + th->Scale.X = (float)CheckFloat(key); break; case NAME_ScaleY: - th->Scale.Y = CheckFloat(key); + th->Scale.Y = (float)CheckFloat(key); break; case NAME_Scale: - th->Scale.X = th->Scale.Y = CheckFloat(key); + th->Scale.X = th->Scale.Y = (float)CheckFloat(key); break; case NAME_FriendlySeeBlocks: diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index 684f5312e5a..efe687c4b6b 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -4245,11 +4245,11 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) break; case APROP_ScaleX: - actor->Scale.X = ACSToDouble(value); + actor->Scale.X = (float)ACSToDouble(value); break; case APROP_ScaleY: - actor->Scale.Y = ACSToDouble(value); + actor->Scale.Y = (float)ACSToDouble(value); break; case APROP_Mass: diff --git a/src/r_data/sprites.cpp b/src/r_data/sprites.cpp index f09bbe46815..28ebff2e2b9 100644 --- a/src/r_data/sprites.cpp +++ b/src/r_data/sprites.cpp @@ -651,7 +651,7 @@ void R_InitSkins (void) } else if (0 == stricmp (key, "scale")) { - Skins[i].Scale.X = clamp(atof (sc.String), 1./65536, 256.); + Skins[i].Scale.X = clamp((float)atof (sc.String), 1.f/65536, 256.f); Skins[i].Scale.Y = Skins[i].Scale.X; } else if (0 == stricmp (key, "game")) @@ -1000,7 +1000,7 @@ void R_InitSprites () auto type = GetDefaultByType(PlayerClasses[0].Type); Skins[i].range0start = type->IntVar(NAME_ColorRangeStart); Skins[i].range0end = type->IntVar(NAME_ColorRangeEnd); - Skins[i].Scale = DVector2(type->Scale.X, type->Scale.Y); + Skins[i].Scale = type->Scale; } R_InitSpriteDefs (); @@ -1019,7 +1019,7 @@ void R_InitSprites () Skins[i].Face = face == NAME_None? "STF" : face.GetChars(); Skins[i].range0start = basetype->IntVar(NAME_ColorRangeStart); Skins[i].range0end = basetype->IntVar(NAME_ColorRangeEnd); - Skins[i].Scale = DVector2(basetype->Scale.X, basetype->Scale.Y); + Skins[i].Scale = basetype->Scale; Skins[i].sprite = basetype->SpawnState->sprite; Skins[i].namespc = ns_global; diff --git a/src/r_data/sprites.h b/src/r_data/sprites.h index 37c60898665..cb394e943eb 100644 --- a/src/r_data/sprites.h +++ b/src/r_data/sprites.h @@ -55,7 +55,7 @@ class FPlayerSkin uint8_t range0start = 0; uint8_t range0end = 0; bool othergame = 0; // [GRB] - DVector2 Scale = { 1, 1 }; + FVector2 Scale = { 1, 1 }; int sprite = 0; int crouchsprite = 0; int namespc = 0; // namespace for this skin