- another bunch of type conversion warnings fixed.

the ones in the findplayer functions are not critical in singleplayer.
This commit is contained in:
Christoph Oelckers 2022-10-12 19:00:43 +02:00
parent 902f8c9706
commit 98e2fecd37
17 changed files with 29 additions and 31 deletions

View file

@ -1281,7 +1281,7 @@ public:
return TAngle(f * (90. / 0x40000000));
}
static constexpr TAngle fromBuild(int bang)
static constexpr TAngle fromBuild(double bang)
{
return TAngle(bang * (90. / 512));
}

View file

@ -118,7 +118,7 @@ void StompSeqCallback(int, DBloodActor* actor)
if (nDist2 <= 0)
nDamage = nBaseDamage + nBaseDamage2;
else
nDamage = nBaseDamage + nBaseDamage2 * ((nDist - nDist2) / nDist);
nDamage = nBaseDamage + int(nBaseDamage2 * ((nDist - nDist2) / nDist));
if (actor2->IsPlayerActor())
gPlayer[actor2->spr.type - kDudePlayer1].quakeEffect += nDamage * 4;
actDamageSprite(actor, actor2, kDamageFall, nDamage << 4);
@ -145,7 +145,7 @@ void StompSeqCallback(int, DBloodActor* actor)
if (nDist2 <= 0)
nDamage = nBaseDamage + nBaseDamage2;
else
nDamage = nBaseDamage + nBaseDamage2 * ((nDist - nDist2) / nDist);
nDamage = nBaseDamage + int(nBaseDamage2 * ((nDist - nDist2) / nDist));
if (actor2->IsPlayerActor())
gPlayer[actor2->spr.type - kDudePlayer1].quakeEffect += nDamage * 4;

View file

@ -461,9 +461,9 @@ void GibFX(walltype* pWall, GIBFX* pGFX, double ceilZ, const DVector3& spread, D
}
else
{
pGib->vel.X = Random2F((pVel->X * 17179869184.) / 120);
pGib->vel.Y = Random2F((pVel->Y * 17179869184.) / 120);
pGib->vel.Z = -Random2F((pVel->Z * 17179869184.) / 120);
pGib->vel.X = Random2F(int((pVel->X * 17179869184.) / 120));
pGib->vel.Y = Random2F(int((pVel->Y * 17179869184.) / 120));
pGib->vel.Z = -Random2F(int((pVel->Z * 17179869184.) / 120));
}
}
}

View file

@ -2530,7 +2530,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe
pWall->allocX();
break;
case 2:
pWall->sectorp()->slopewallofs = max<int>(pWall - pWall->sectorp()->firstWall(), 0);
pWall->sectorp()->slopewallofs = max<int>(int(pWall - pWall->sectorp()->firstWall()), 0);
break;
}
}
@ -6857,7 +6857,7 @@ void useSectorLightChanger(DBloodActor* sourceactor, sectortype* pSector)
if (relative)
pXSector->amplitude = ClipRange(pXSector->amplitude + sourceactor->xspr.data2, -127, 127);
else
pXSector->amplitude = sourceactor->xspr.data2;
pXSector->amplitude = (int8_t)sourceactor->xspr.data2;
}
if (valueIsBetween(sourceactor->xspr.data3, -1, 32767))

View file

@ -291,8 +291,8 @@ void DoSectorPanning(void)
int yBits = tileHeight(nTile) >> int((pSector->floorstat & CSTAT_SECTOR_TEXHALF) != 0);
double px = angle.Cos() * (speed << 2) / xBits;
double py = angle.Sin() * (speed << 2) / xBits;
pSector->addfloorxpan(px * (1.f / 256));
pSector->addfloorypan(-py * (1.f / 256));
pSector->addfloorxpan((float)px * (1.f / 256));
pSector->addfloorypan(-(float)py * (1.f / 256));
}
if (pXSector->panCeiling) // Ceiling
{
@ -303,8 +303,8 @@ void DoSectorPanning(void)
int yBits = tileHeight(nTile) >> int((pSector->ceilingstat & CSTAT_SECTOR_TEXHALF) != 0);
double px = angle.Cos() * (speed << 2) / xBits;
double py = angle.Sin() * (speed << 2) / xBits;
pSector->addceilingxpan(px * (1.f / 256));
pSector->addceilingypan(-py * (1.f / 256));
pSector->addceilingxpan((float)px * (1.f / 256));
pSector->addceilingypan(-(float)py * (1.f / 256));
}
}
}

View file

@ -67,7 +67,7 @@ static int ccmd_spawn(CCmdFuncPtr parm)
ang = DAngle::fromDeg(atoi(parm->parms[3])); set |= 4;
[[fallthrough]];
case 3: // cstat
cstat = ESpriteFlags::FromInt(atol(parm->parms[2])); set |= 2;
cstat = ESpriteFlags::FromInt(atoi(parm->parms[2])); set |= 2;
[[fallthrough]];
case 2: // pal
pal = (uint8_t)atol(parm->parms[1]); set |= 1;

View file

@ -749,7 +749,7 @@ static void shootrpg(DDukeActor *actor, int p, DVector3 pos, DAngle ang, int atw
if (isWorldTour()) // Twentieth Anniversary World Tour
{
float siz = actor->spr.scale.Y * 0.8;
double siz = actor->spr.scale.Y * 0.8;
spawnofs *= siz;
aoffs *= siz;
}
@ -2820,7 +2820,7 @@ void processinput_d(int snum)
if (p->GetActor()->spr.scale.X < 0.625 && p->jetpack_on == 0)
{
p->ofistsign = p->fistsign;
p->fistsign += p->GetActor()->vel.X * 16;
p->fistsign += int(p->GetActor()->vel.X * 16);
}
if (p->transporter_hold > 0)

View file

@ -2721,7 +2721,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
spawned->spr.pos.Z += 8;
}
int hd = hits(p->GetActor());
double hd = hits(p->GetActor());
if (hd < 32)
{
spawned->spr.angle += DAngle180;
@ -3498,7 +3498,7 @@ void processinput_r(int snum)
if (p->GetActor()->spr.scale.X < 0.125 && p->jetpack_on == 0)
{
p->ofistsign = p->fistsign;
p->fistsign += p->GetActor()->vel.X * 16;
p->fistsign += int(p->GetActor()->vel.X * 16);
}
if (p->transporter_hold > 0)

View file

@ -361,7 +361,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
spawned->spr.pos.Z += 8;
}
int hd = hits(p->GetActor());
double hd = hits(p->GetActor());
if (hd < 32)
{
spawned->spr.angle += DAngle180;

View file

@ -238,7 +238,7 @@ void displayrooms(int snum, double interpfrac, bool sceneonly)
setgamepalette(BASEPAL);
float fov = r_fov;
float fov = (float)r_fov;
auto sect = p->cursector;
DDukeActor* viewer;

View file

@ -222,7 +222,6 @@ bool isanearoperator(int lotag)
int findplayer(const DDukeActor* actor, double* d)
{
int j, closest_player;
int x;
const auto s = actor->spr.pos;
if (ud.multimode < 2)
@ -236,7 +235,7 @@ int findplayer(const DDukeActor* actor, double* d)
for (j = connecthead; j >= 0; j = connectpoint2[j])
{
x = (ps[j].opos - s).plusZ(28).Sum();
double x = (ps[j].opos - s).plusZ(28).Sum();
if (x < closest && ps[j].GetActor()->spr.extra > 0)
{
closest_player = j;
@ -257,7 +256,6 @@ int findplayer(const DDukeActor* actor, double* d)
int findotherplayer(int p, double* d)
{
int j, closest_player;
int x;
double closest = 0x7fffffff;
closest_player = p;
@ -265,7 +263,7 @@ int findotherplayer(int p, double* d)
for (j = connecthead; j >= 0; j = connectpoint2[j])
if (p != j && ps[j].GetActor()->spr.extra > 0)
{
x = (ps[j].opos - ps[p].pos).Sum();
double x = (ps[j].opos - ps[p].pos).Sum();
if (x < closest)
{

View file

@ -371,7 +371,7 @@ void DukeSoundEngine::CalcPosVel(int type, const void* source, const float pt[3]
}
if ((chanflags & CHANF_LISTENERZ) && type != SOURCE_None)
{
pos->Y = campos.Z / 256.f;
pos->Y = (float)campos.Z / 256.f;
}
}
}

View file

@ -1010,7 +1010,7 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
void lotsofglass(DDukeActor *actor, walltype* wal, int n)
{
int j, z;
int j;
sectortype* sect = nullptr;
if (wal == nullptr)
@ -1041,7 +1041,7 @@ void lotsofglass(DDukeActor *actor, walltype* wal, int n)
updatesector(DVector3(pos, sect->floorz), &sect);
if (sect)
{
z = sect->floorz - krandf(abs(sect->ceilingz - sect->floorz));
double z = sect->floorz - krandf(abs(sect->ceilingz - sect->floorz));
if (fabs(z) > 32)
z = actor->spr.pos.Z - 32 + krandf(64);
DAngle angl = actor->spr.angle - DAngle180;

View file

@ -723,7 +723,7 @@ void AddFlow(walltype* pWall, int nSpeed, int b)
int nPic = pWall->picnum;
sFlowInfo[nFlow].angcos = 0;
sFlowInfo[nFlow].angsin = b == 2 ? 1 : -1;
sFlowInfo[nFlow].angsin = b == 2 ? 1.f : -1.f;
sFlowInfo[nFlow].pWall = pWall;
sFlowInfo[nFlow].type = b;

View file

@ -637,11 +637,11 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage)
if ((pPlayerActor->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) && (!(pPlayerActor->spr.cstat & CSTAT_SPRITE_INVISIBLE)))
{
int v9 = abs(pPlayerActor->spr.pos.X - pActor->spr.pos.X);
double v9 = abs(pPlayerActor->spr.pos.X - pActor->spr.pos.X);
if (v9 < nDistance)
{
int v10 = abs(pPlayerActor->spr.pos.Y - pActor->spr.pos.Y);
double v10 = abs(pPlayerActor->spr.pos.Y - pActor->spr.pos.Y);
if (v10 < nDistance && cansee(pPlayerActor->spr.pos.plusZ(-30), pPlayerActor->sector(), pActor->spr.pos.plusZ(-GetActorHeight(pActor)), pSector))
{

View file

@ -1166,7 +1166,7 @@ sectdone:
PlayerList[nPlayer].ototalvel = PlayerList[nPlayer].totalvel;
PlayerList[nPlayer].totalvel = playerPos.Length() * 16;
PlayerList[nPlayer].totalvel = int(playerPos.Length() * worldtoint);
auto pViewSect = pPlayerActor->sector();

View file

@ -700,7 +700,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
KillActor(BoundActor);
// set radius for explosion checking - based on bounding box
child->user.Radius = ((vhigh.X - vlow.X) + (vhigh.Y - vlow.Y)) * (0.75 * 0.25) * worldtoint; // trying to get it a good size
child->user.Radius = int(((vhigh.X - vlow.X) + (vhigh.Y - vlow.Y)) * (0.75 * 0.25) * worldtoint); // trying to get it a good size
// search for center sprite if it exists