- fixed more warnings in 'core'.

This commit is contained in:
Christoph Oelckers 2021-05-12 01:50:41 +02:00
parent b6dd834420
commit 1168341d5a
15 changed files with 29 additions and 29 deletions

View file

@ -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;

View file

@ -196,7 +196,7 @@ CCMD(give)
if (!CheckCheatmode(true, true))
{
Net_WriteByte(DEM_GIVE);
Net_WriteByte(found);
Net_WriteByte((uint8_t)found);
}
}

View file

@ -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)

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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
{

View file

@ -263,7 +263,7 @@ static void DeleteStuff(FileSystem &fileSystem, const TArray<FString>& 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<GrpEntry>& 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)
{

View file

@ -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]))
{

View file

@ -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)
{

View file

@ -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())

View file

@ -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;

View file

@ -665,7 +665,7 @@ void GetCRC(FileEntry *entry, TArray<FileEntry> &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;

View file

@ -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)
{

View file

@ -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();
}