- silenced lots of warnings for deliberate type conversions.

The ones in d_net.cpp are not in active code.
This commit is contained in:
Christoph Oelckers 2022-10-12 19:00:29 +02:00
parent 9c097e1763
commit 902f8c9706
29 changed files with 98 additions and 93 deletions

View file

@ -59,7 +59,7 @@ static inline void get_floorspr_points(DCoreActor *spr, int32_t px, int32_t py,
inline int32_t spriteGetZOfSlope(const spritetypebase* tspr, int dax, int day, int heinum)
{
return spriteGetZOfSlopef(tspr, DVector2(dax * inttoworld, day * inttoworld), heinum) * zworldtoint;
return int(spriteGetZOfSlopef(tspr, DVector2(dax * inttoworld, day * inttoworld), heinum) * zworldtoint);
}
@ -414,11 +414,11 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
if (p1.X >= clipMin.X && p1.X <= clipMax.X && p1.Y >= clipMin.Y && p1.Y <= clipMax.Y)
{
double height_, daz_ = actor->spr.pos.Z + actor->GetOffsetAndHeight(height_);
int height = height_ * zworldtoint, daz = daz_ * zworldtoint;
int height = int(height_ * zworldtoint), daz = int(daz_ * zworldtoint);
if (pos->Z > daz-height-flordist && pos->Z < daz+ceildist)
{
int cd = actor->clipdist * worldtoint;
int cd = int(actor->clipdist * worldtoint);
int32_t bsz = cd + walldist;
if (diff.X < 0) bsz = -bsz;
addclipline(p1.X-bsz, p1.Y-bsz, p1.X-bsz, p1.Y+bsz, obj, false);
@ -432,7 +432,7 @@ CollisionBase clipmove_(vec3_t * const pos, int * const sectnum, int32_t xvect,
case CSTAT_SPRITE_ALIGNMENT_WALL:
{
double height_, daz_ = actor->spr.pos.Z + actor->GetOffsetAndHeight(height_);
int height = height_ * zworldtoint, daz = daz_ * zworldtoint;
int height = int(height_ * zworldtoint), daz = int(daz_ * zworldtoint);
if (pos->Z > daz-height-flordist && pos->Z < daz+ceildist)
{

View file

@ -68,7 +68,7 @@ static uint64_t GetClockTimeNS()
{
auto tp = GetTimePoint() - StartupTimeNS;
if (TimeScale == 1.0) return tp;
else return tp / 1000 * TimeScale * 1000;
else return uint64_t(tp / 1000 * TimeScale * 1000);
}
static uint64_t MSToNS(unsigned int ms)

View file

@ -332,7 +332,7 @@ public:
unsigned IndexOf(const T* elem) const
{
return elem - Array;
return unsigned(elem - Array);
}
unsigned int Find(const T& item) const

View file

@ -184,7 +184,7 @@ static void CalcMapBounds()
static void AutomapControl(const DVector2& cangvect)
{
static double nonsharedtimer;
double ms = screen->FrameTime;
double ms = (double)screen->FrameTime;
double interval;
if (nonsharedtimer > 0 || ms < nonsharedtimer)

View file

@ -168,7 +168,7 @@ public:
int native_clipdist()
{
return clipdist * 4;
return int(clipdist * 4);
}
void copy_clipdist(DCoreActor* other)
@ -439,7 +439,7 @@ void SetActor(DCoreActor* actor, const DVector3& newpos);
inline int clipmove(DVector3& pos, sectortype** const sect, const DVector2& mvec,
double const walldist, double const ceildist, double const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
auto vect = vec3_t(int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint));
int sectno = *sect ? sector.IndexOf(*sect) : -1;
result = clipmove_(&vect, &sectno, FloatToFixed<18>(mvec.X), FloatToFixed<18>(mvec.Y), int(walldist * worldtoint), int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, clipmoveboxtracenum);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
@ -450,9 +450,9 @@ inline int clipmove(DVector3& pos, sectortype** const sect, const DVector2& mvec
inline int pushmove(DVector3& pos, sectortype** const sect, double const walldist, double const ceildist, double const flordist,
uint32_t const cliptype, bool clear = true)
{
auto vect = vec3_t(pos.X * worldtoint, pos.Y * worldtoint, pos.Z * zworldtoint);
auto vect = vec3_t(int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint));
int sectno = *sect ? sector.IndexOf(*sect) : -1;
int res = pushmove_(&vect, &sectno, walldist * worldtoint, ceildist * zworldtoint, flordist * zworldtoint, cliptype, clear);
int res = pushmove_(&vect, &sectno, int(walldist * worldtoint), int(ceildist * zworldtoint), int(flordist * zworldtoint), cliptype, clear);
pos = { vect.X * inttoworld, vect.Y * inttoworld, vect.Z * zinttoworld };
*sect = sectno == -1 ? nullptr : &sector[sectno];
return res;

View file

@ -1032,8 +1032,8 @@ void NetUpdate (void)
int mod = maketic - ticdup;
int modp, tic;
int svel = 0;
int fvel = 0;
float svel = 0;
float fvel = 0;
float avel = 0;
float horz = 0;

View file

@ -906,7 +906,7 @@ void parseMultiPsky(FScanner& sc, FScriptPosition& pos)
else if (sc.Compare("yoffset")) sc.GetNumber(sky.pmoffset, true);
else if (sc.Compare("baseline")) sc.GetNumber(sky.baselineofs, true);
else if (sc.Compare("lognumtiles")) sc.GetNumber(sky.lognumtiles, true);
else if (sc.Compare("yscale")) { int intscale; sc.GetNumber(intscale, true); sky.scale = intscale * (1. / 65536.); }
else if (sc.Compare("yscale")) { int intscale; sc.GetNumber(intscale, true); sky.scale = intscale * (1.f / 65536.f); }
else if (sc.Compare({ "tile", "panel" }))
{
if (!sc.CheckString("}"))

View file

@ -171,7 +171,7 @@ int getslopeval(sectortype* sect, const DVector3& pos, double basez)
{
auto wal = sect->firstWall();
double i = (pos.XY() - wal->pos).dot(wal->delta().Rotated90CCW());
return i == 0? 0 : SLOPEVAL_FACTOR * (pos.Z - basez) * wal->Length() / i;
return i == 0? 0 : int(SLOPEVAL_FACTOR * (pos.Z - basez) * wal->Length() / i);
}
//==========================================================================

View file

@ -569,9 +569,9 @@ inline int rintersect(int x1, int y1, int z1, int vx, int vy, int vz, int x3, in
double result = GetRayIntersect(DVector3(x1 * inttoworld, y1 * inttoworld, z1 * zinttoworld), DVector3(vx * inttoworld, vy * inttoworld, vz * zinttoworld),
DVector2(x3 * inttoworld, y3 * inttoworld), DVector2((x4 - x3) * inttoworld, (y4 - y3) * inttoworld), retv);
if (result < 0) return -1;
*intx = retv.X * worldtoint;
*inty = retv.Y * worldtoint;
*intz = retv.Z * zworldtoint;
*intx = int(retv.X * worldtoint);
*inty = int(retv.Y * worldtoint);
*intz = int(retv.Z * zworldtoint);
return FloatToFixed(result);
}

View file

@ -158,8 +158,8 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe
if (isRR() && drink_amt >= 66 && drink_amt <= 87) currInput->svel += drink_amt & 1 ? -currInput->fvel : currInput->fvel;
// add collected input to game's local input accumulation packet.
inputBuffer->fvel = clamp<float>(inputBuffer->fvel + currInput->fvel, -keymove, keymove);
inputBuffer->svel = clamp<float>(inputBuffer->svel + currInput->svel, -keymove, keymove);
inputBuffer->fvel = clamp<float>(inputBuffer->fvel + currInput->fvel, -(float)keymove, (float)keymove);
inputBuffer->svel = clamp<float>(inputBuffer->svel + currInput->svel, -(float)keymove, (float)keymove);
inputBuffer->avel += currInput->avel;
inputBuffer->horz += currInput->horz;
}

View file

@ -370,7 +370,7 @@ struct walltype
{
DVector2 pos;
vec2_t wall_int_pos() const { return vec2_t(pos.X * worldtoint, pos.Y * worldtoint); };
vec2_t wall_int_pos() const { return vec2_t(int(pos.X * worldtoint), int(pos.Y * worldtoint)); };
vec2_t int_delta() const { return point2Wall()->wall_int_pos() - wall_int_pos(); }
void setPosFromMap(int x, int y) { pos = { x * maptoworld, y * maptoworld }; }

View file

@ -1566,7 +1566,7 @@ class GLDefsParser
ExtraUniformCVARData* oldextra = nullptr;
sc.MustGetFloat();
val.Float = oldval.Float = sc.Float;
val.Float = oldval.Float = (float)sc.Float;
if (!Args->CheckParm ("-shaderuniformtest"))
{

View file

@ -163,7 +163,7 @@ void vertex_t::RecalcVertexHeights()
float heights[2];
auto point = wall[masterwall].pos;
PlanesAtPoint(&sector[sect], point.X, point.Y, &heights[0], &heights[1]);
PlanesAtPoint(&sector[sect], (float)point.X, (float)point.Y, &heights[0], &heights[1]);
for(auto height : heights)
{
int k;

View file

@ -42,6 +42,11 @@
#include "hw_sections.h"
#include "tesselator.h"
// this is too noisy in this file.
#ifdef _MSC_VER
#pragma warning(disable:4244)
#endif
SectionGeometry sectionGeometry;
//==========================================================================
@ -158,7 +163,7 @@ public:
// To calculate the inverse Build performs an integer division with significant loss of precision
// that can cause the texture to be shifted by multiple pixels.
// The code below calculates the amount of this deviation so that it can be added back to the formula.
int x = ix2 - ix1, y = iy2 - iy1;
int x = int(ix2 - ix1), y = int(iy2 - iy1);
int len = int(sqrt(double(x) * x + double(y) * y));
if (len != 0)
{

View file

@ -171,7 +171,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setfloorxpan, sector_setfloorxpan)
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(xpan);
self->setfloorxpan(xpan);
sector_setfloorxpan(self, xpan);
return 0;
}
@ -185,7 +185,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setceilingxpan, sector_setceilingxpan
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(xpan);
self->setceilingxpan(xpan);
sector_setceilingxpan(self, xpan);
return 0;
}
@ -199,7 +199,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addfloorxpan, sector_addfloorxpan)
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(xpan);
self->addfloorxpan(xpan);
sector_addfloorxpan(self, xpan);
return 0;
}
@ -213,7 +213,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addceilingxpan, sector_addceilingxpan
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(xpan);
self->addceilingxpan(xpan);
sector_addceilingxpan(self, xpan);
return 0;
}
@ -227,7 +227,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setfloorypan, sector_setfloorypan)
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(ypan);
self->setfloorypan(ypan);
sector_setfloorypan(self, ypan);
return 0;
}
@ -241,7 +241,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, setceilingypan, sector_setceilingypan
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(ypan);
self->setceilingypan(ypan);
sector_setceilingypan(self, ypan);
return 0;
}
@ -255,7 +255,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addfloorypan, sector_addfloorypan)
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(ypan);
self->addfloorypan(ypan);
sector_addfloorypan(self, ypan);
return 0;
}
@ -269,7 +269,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_sectortype, addceilingypan, sector_addceilingypan
{
PARAM_SELF_STRUCT_PROLOGUE(sectortype);
PARAM_FLOAT(ypan);
self->addceilingypan(ypan);
sector_addceilingypan(self, ypan);
return 0;
}
@ -339,7 +339,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, setxpan, wall_setxpan)
{
PARAM_SELF_STRUCT_PROLOGUE(walltype);
PARAM_FLOAT(xpan);
self->setxpan(xpan);
wall_setxpan(self, xpan);
return 0;
}
@ -353,7 +353,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, addxpan, wall_addxpan)
{
PARAM_SELF_STRUCT_PROLOGUE(walltype);
PARAM_FLOAT(xpan);
self->addxpan(xpan);
wall_addxpan(self, xpan);
return 0;
}
@ -367,7 +367,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, setypan, wall_setypan)
{
PARAM_SELF_STRUCT_PROLOGUE(walltype);
PARAM_FLOAT(ypan);
self->setypan(ypan);
wall_setypan(self, ypan);
return 0;
}
@ -381,7 +381,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_walltype, addypan, wall_addypan)
{
PARAM_SELF_STRUCT_PROLOGUE(walltype);
PARAM_FLOAT(ypan);
self->addypan(ypan);
wall_addypan(self, ypan);
return 0;
}

View file

@ -101,7 +101,7 @@ void CGameMenuItemQAV::Draw(void)
{
int xdim43 = Scale(twod->GetHeight(), 4, 3);
int nCount = (twod->GetWidth() + xdim43 - 1) / xdim43;
int backX = data->x;
double backX = data->x;
for (int i = 0; i < nCount; i++)
{
data->Draw(currentDuration, 10 + kQavOrientationLeft, 0, 0, false, interpfrac);

View file

@ -54,7 +54,7 @@ public:
DBloodActor* actor() { assert(isActor()); return GC::ReadBarrier(ActorP); }
sectortype* sector() { assert(isSector()); return &::sector[index >> 8]; }
walltype* wall() { assert(isWall()); return &::wall[index >> 8]; }
int rawindex() { return index >> 8; }
int rawindex() { return int(index >> 8); }
bool operator==(const EventObject& other) const { return index == other.index; }
bool operator!=(const EventObject& other) const { return index != other.index; }

View file

@ -70,12 +70,12 @@ bool CheckProximity(DBloodActor* actor, const DVector3& pos, sectortype* pSector
bool CheckProximityWall(walltype* pWall, const DVector2& pos, int nDist)
{
int x = pos.X * (1. / maptoworld);
int y = pos.Y * (1. / maptoworld);
int x1 = pWall->pos.X * (1./maptoworld);
int y1 = pWall->pos.Y * (1./maptoworld);
int x2 = pWall->point2Wall()->pos.X * (1./maptoworld);
int y2 = pWall->point2Wall()->pos.Y * (1./maptoworld);
int x = int(pos.X * (1. / maptoworld));
int y = int(pos.Y * (1. / maptoworld));
int x1 = int(pWall->pos.X * (1./maptoworld));
int y1 = int(pWall->pos.Y * (1./maptoworld));
int x2 = int(pWall->point2Wall()->pos.X * (1./maptoworld));
int y2 = int(pWall->point2Wall()->pos.Y * (1./maptoworld));
nDist <<= 4;
if (x1 < x2)
{

View file

@ -1572,7 +1572,7 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, const DVector3& pos,
dmg = int(dmg * (0x4000 / (0x4000 + dv.LengthSquared())));
bool thing = (actor->spr.type >= kThingBase && actor->spr.type < kThingMax);
int size = (tileWidth(actor->spr.picnum) * actor->spr.scale.X * tileHeight(actor->spr.picnum) * actor->spr.scale.Y) * 2048;
double size = (tileWidth(actor->spr.picnum) * actor->spr.scale.X * tileHeight(actor->spr.picnum) * actor->spr.scale.Y) * 2048;
if (actor->xspr.physAttr & kPhysDebrisExplode)
{
if (actor->spriteMass.mass > 0)

View file

@ -93,7 +93,7 @@ void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3
auto actor = (DBloodActor*)source;
// Engine expects velocity in units per second, not units per tic.
if (vel) *vel = FVector3(actor->vel.X * 30, actor->vel.Z * -30, actor->vel.Y * -30);
if (vel) *vel = FVector3(float(actor->vel.X * 30), float(actor->vel.Z * -30), float(actor->vel.Y * -30));
*pos = GetSoundPos(actor->spr.pos);
}
else if (type == SOURCE_Ambient)
@ -120,7 +120,7 @@ void GameInterface::UpdateSounds()
if (pPlayer->actor)
{
listener.angle = -pPlayer->actor->spr.angle.Radians();
listener.angle = float(-pPlayer->actor->spr.angle.Radians());
listener.velocity.Zero();
listener.position = GetSoundPos(pPlayer->actor->spr.pos);
listener.valid = true;

View file

@ -1412,7 +1412,7 @@ bool rat(DDukeActor* actor, bool makesound)
if (ssp(actor, CLIPMASK0))
{
if (makesound && (krand() & 255) == 0) S_PlayActorSound(RATTY, actor);
actor->spr.angle += mapangle((krand() & 31) - 15 + BobVal(actor->temp_data[0] << 8) * 8);
actor->spr.angle += mapangle((krand() & 31) - 15 + int(BobVal(actor->temp_data[0] << 8) * 8));
}
else
{
@ -4141,11 +4141,11 @@ void handle_se20(DDukeActor* actor)
SetActor(ps[p].GetActor(), ps[p].pos.plusZ(gs.playerheight));
}
sc->addfloorxpan(-vec.X * 2);
sc->addfloorypan(-vec.Y * 2);
sc->addfloorxpan(-(float)vec.X * 2);
sc->addfloorypan(-(float)vec.Y * 2);
sc->addceilingxpan(-vec.X * 2);
sc->addceilingypan(-vec.Y * 2);
sc->addceilingxpan(-(float)vec.X * 2);
sc->addceilingypan(-(float)vec.Y * 2);
}
}

View file

@ -847,7 +847,7 @@ static void movetripbomb(DDukeActor *actor)
}
else
{
x = actor->spr.extra;
auto ex = actor->spr.extra;
actor->spr.extra = 1;
auto ang = actor->spr.angle;
j = fi.ifhitbyweapon(actor);
@ -855,7 +855,7 @@ static void movetripbomb(DDukeActor *actor)
{
actor->temp_data[2] = 16;
}
actor->spr.extra = x;
actor->spr.extra = ex;
actor->spr.angle = ang;
}

View file

@ -45,9 +45,9 @@ static short torchtype[64];
struct jaildoor
{
sectortype* sect;
double dist;
double drag;
int speed;
float dist;
float drag;
int16_t direction;
int16_t sound;
int16_t open;
@ -58,9 +58,9 @@ struct minecart
{
sectortype* sect;
sectortype* childsect;
double dist;
double drag;
int speed;
float dist;
float drag;
int16_t direction;
int16_t sound;
int16_t open;

View file

@ -297,12 +297,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
case PLAYER_EXITX:
if (bSet) ps[iPlayer].Exit.X = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].Exit.X / maptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].Exit.X / maptoworld), sActor, sPlayer);
break;
case PLAYER_EXITY:
if (bSet) ps[iPlayer].Exit.Y = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].Exit.Y / maptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].Exit.Y / maptoworld), sActor, sPlayer);
break;
case PLAYER_LOOGIEX:
@ -326,15 +326,15 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_POSX: // oh, my... :( Writing to these has been disabled until I know how to do it without the engine shitting all over itself.
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].pos.X * (1/maptoworld), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].pos.X * (1/maptoworld)), sActor, sPlayer);
break;
case PLAYER_POSY:
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].pos.Y * (1 / maptoworld), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].pos.Y * (1 / maptoworld)), sActor, sPlayer);
break;
case PLAYER_POSZ:
if (!bSet) SetGameVarID(lVar2, ps[iPlayer].pos.Z * (1 / zmaptoworld), sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(ps[iPlayer].pos.Z * (1 / zmaptoworld)), sActor, sPlayer);
break;
case PLAYER_HORIZ:
@ -369,37 +369,37 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
case PLAYER_BOBPOSX:
if (bSet) ps[iPlayer].bobpos.X = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].bobpos.X * (1/maptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].bobpos.X * (1/maptoworld)), sActor, sPlayer);
break;
case PLAYER_BOBPOSY:
if (bSet) ps[iPlayer].bobpos.Y = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].bobpos.Y * (1/maptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].bobpos.Y * (1/maptoworld)), sActor, sPlayer);
break;
case PLAYER_OPOSX:
if (bSet) ps[iPlayer].opos.X = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].opos.X * (1/maptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].opos.X * (1/maptoworld)), sActor, sPlayer);
break;
case PLAYER_OPOSY:
if (bSet) ps[iPlayer].opos.Y = lValue * maptoworld;
else SetGameVarID(lVar2, ps[iPlayer].opos.Y * (1 / maptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].opos.Y * (1 / maptoworld)), sActor, sPlayer);
break;
case PLAYER_OPOSZ:
if (bSet) ps[iPlayer].opos.Z = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].opos.Z * (1 / zmaptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].opos.Z * (1 / zmaptoworld)), sActor, sPlayer);
break;
case PLAYER_PYOFF:
if (bSet) ps[iPlayer].pyoff = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].pyoff / zmaptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].pyoff / zmaptoworld), sActor, sPlayer);
break;
case PLAYER_OPYOFF:
if (bSet) ps[iPlayer].opyoff = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].opyoff / zmaptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].opyoff / zmaptoworld), sActor, sPlayer);
break;
case PLAYER_POSXV:
@ -414,7 +414,7 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
case PLAYER_POSZV:
if (bSet) ps[iPlayer].vel.Z = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].vel.Z / zmaptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].vel.Z / zmaptoworld), sActor, sPlayer);
break;
case PLAYER_LAST_PISSED_TIME:
@ -424,12 +424,12 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
case PLAYER_TRUEFZ:
if (bSet) ps[iPlayer].truefz = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].truefz * (1/zmaptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].truefz * (1/zmaptoworld)), sActor, sPlayer);
break;
case PLAYER_TRUECZ:
if (bSet) ps[iPlayer].truecz = lValue * zmaptoworld;
else SetGameVarID(lVar2, ps[iPlayer].truecz * (1 / zmaptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(ps[iPlayer].truecz * (1 / zmaptoworld)), sActor, sPlayer);
break;
case PLAYER_PLAYER_PAR:
@ -953,10 +953,10 @@ void DoWall(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor, i
switch (lLabelID)
{
case WALL_X:
if (!bSet) SetGameVarID(lVar2, wallp->pos.X / maptoworld, sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(wallp->pos.X / maptoworld), sActor, sPlayer);
break;
case WALL_Y:
if (!bSet) SetGameVarID(lVar2, wallp->pos.Y / maptoworld, sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(wallp->pos.Y / maptoworld), sActor, sPlayer);
break;
case WALL_POINT2:
if (!bSet) SetGameVarID(lVar2, wallp->point2, sActor, sPlayer);
@ -1168,13 +1168,13 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
switch (lLabelID)
{
case ACTOR_X:
if (!bSet) SetGameVarID(lVar2, act->spr.pos.X / maptoworld, sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(act->spr.pos.X / maptoworld), sActor, sPlayer);
break;
case ACTOR_Y:
if (!bSet) SetGameVarID(lVar2, act->spr.pos.Y / maptoworld, sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(act->spr.pos.Y / maptoworld), sActor, sPlayer);
break;
case ACTOR_Z:
if (!bSet) SetGameVarID(lVar2, act->spr.pos.Z / zmaptoworld, sActor, sPlayer);
if (!bSet) SetGameVarID(lVar2, int(act->spr.pos.Z / zmaptoworld), sActor, sPlayer);
break;
case ACTOR_CSTAT:
if (bSet) act->spr.cstat = ESpriteFlags::FromInt(lValue);
@ -1235,7 +1235,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case ACTOR_XVEL:
if (bSet) act->vel.X = lValue * maptoworld;
else SetGameVarID(lVar2, act->vel.X / maptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(act->vel.X / maptoworld), sActor, sPlayer);
break;
case ACTOR_YVEL:
if (bSet) act->spr.yint = lValue;
@ -1243,7 +1243,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case ACTOR_ZVEL:
if (bSet) act->vel.Z = lValue * zmaptoworld;
else SetGameVarID(lVar2, act->vel.Z / zmaptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(act->vel.Z / zmaptoworld), sActor, sPlayer);
break;
case ACTOR_LOTAG:
if (bSet) act->spr.lotag = lValue;
@ -1300,19 +1300,19 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case ACTOR_HTFLOORZ:
if (bSet) act->floorz = lValue * zmaptoworld;
else SetGameVarID(lVar2, act->floorz * (1/zmaptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(act->floorz * (1/zmaptoworld)), sActor, sPlayer);
break;
case ACTOR_HTCEILINGZ:
if (bSet) act->ceilingz = lValue * zmaptoworld;
else SetGameVarID(lVar2, act->ceilingz * (1/zmaptoworld), sActor, sPlayer);
else SetGameVarID(lVar2, int(act->ceilingz * (1/zmaptoworld)), sActor, sPlayer);
break;
case ACTOR_HTLASTVX:
if (bSet) act->ovel.X = lValue * maptoworld;
else SetGameVarID(lVar2, act->ovel.X / maptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(act->ovel.X / maptoworld), sActor, sPlayer);
break;
case ACTOR_HTLASTVY:
if (bSet) act->ovel.Y = lValue * maptoworld;
else SetGameVarID(lVar2, act->ovel.Y / maptoworld, sActor, sPlayer);
else SetGameVarID(lVar2, int(act->ovel.Y / maptoworld), sActor, sPlayer);
break;
case ACTOR_HTG_T0:
if (bSet) act->temp_data[0] = lValue;

View file

@ -25,13 +25,13 @@ class GameVarValue
public:
GameVarValue() = default;
explicit GameVarValue(DDukeActor* actor_) { ActorP = actor_; assert(isActor()); }
explicit GameVarValue(int val) { index = (val << 8) | Value; }
explicit GameVarValue(intptr_t val) { index = (val << 8) | Value; }
bool isActor() const { return (index & 7) == Actor; }
bool isValue() const { return (index & 7) == Value; }
DDukeActor* actor() { assert(isActor()); return GC::ReadBarrier(ActorP); }
int value() { assert(isValue()); return index >> 8; }
int value() { assert(isValue()); return int(index >> 8); }
int safeValue() { return isValue() ? value() : actor() == nullptr ? 0 : -1; } // return -1 for valid actors and 0 for null. This allows most comparisons to work.
DDukeActor* safeActor() { return isActor() ? actor() : nullptr; }

View file

@ -759,7 +759,7 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
input.avel = (float)boatApplyTurn(p, hidInput, kbdLeft, kbdRight, scaleAdjust);
}
loc.fvel = clamp<float>(p->MotoSpeed, -(MAXVELMOTO >> 3), MAXVELMOTO) * (1.f / 40.f);
loc.fvel = clamp<float>((float)p->MotoSpeed, -(MAXVELMOTO >> 3), MAXVELMOTO) * (1.f / 40.f);
input.avel *= BAngToDegree;
loc.avel += input.avel;
}
@ -850,8 +850,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
{
*packet = loc;
auto velvect = DVector2(loc.fvel, loc.svel).Rotated(p->angle.ang) + p->fric;
packet->fvel = velvect.X;
packet->svel = velvect.Y;
packet->fvel = (float)velvect.X;
packet->svel = (float)velvect.Y;
loc = {};
}
}

View file

@ -440,7 +440,7 @@ void StartRegenerate(DExhumedActor* pActor)
if (pos >= Regenerates.Size())
{
// ?? CHECKME
pActor->spr.xint = pActor->spr.scale.X * INV_REPEAT_SCALE;
pActor->spr.xint = int16_t(pActor->spr.scale.X * INV_REPEAT_SCALE);
pActor->spr.inittype = pActor->spr.shade;
pActor->spr.yint = pActor->spr.pal;
}

View file

@ -2110,7 +2110,7 @@ struct ANIM
animactor->user.pos.Z = value;
break;
case ANIM_SUdepth:
sector[animindex].depth_fixed = value;
sector[animindex].depth_fixed = (int)value;
default:
return;
}

View file

@ -208,8 +208,8 @@ void GameInterface::GetInput(ControlInfo* const hidInput, double const scaleAdju
{
*packet = loc;
auto velvect = DVector2(loc.fvel, loc.svel).Rotated(pp->angle.ang);
packet->fvel = velvect.X;
packet->svel = velvect.Y;
packet->fvel = (float)velvect.X;
packet->svel = (float)velvect.Y;
loc = {};
}
}