- Duke: Changed some downscaled and upscaled Q16.16 variables missed when doing 46810ec490.

This commit is contained in:
Mitchell Richters 2020-09-25 17:08:44 +10:00
parent 0746b98886
commit e7de0da36c
5 changed files with 29 additions and 27 deletions

View file

@ -2504,7 +2504,7 @@ static void greenslime(int i)
s->z = ps[p].posz + ps[p].pyoff - t[2] + (8 << 8);
s->z += (100 - ps[p].gethoriz()) << 4;
s->z += (IntToFixed(100) - ps[p].getq16horiz()) >> 12;
if (t[2] > 512)
t[2] -= 128;

View file

@ -166,7 +166,7 @@ void shoot_d(int i, int atwith)
}
else
{
zvel = 98 * (100 - ps[p].gethorizsum());
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.));
sx += sintable[(sa + 860) & 0x7FF] / 448;
sy += sintable[(sa + 348) & 0x7FF] / 448;
sz += (3 << 8);
@ -224,7 +224,7 @@ void shoot_d(int i, int atwith)
}
else
{
zvel = (int)(100 - ps[p].gethorizsum()) * 81;
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / 65536.));
if (sprite[ps[p].i].xvel != 0)
vel = (int)((((512 - (1024
- abs(abs(getangle(sx - ps[p].oposx, sy - ps[p].oposy) - sa) - 1024)))
@ -292,7 +292,7 @@ void shoot_d(int i, int atwith)
{
if (p >= 0)
{
zvel = (100 - ps[p].gethorizsum()) << 5;
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
sz += (6 << 8);
sa += 15;
}
@ -464,14 +464,14 @@ void shoot_d(int i, int atwith)
if (j == -1)
{
// no target
zvel = (100 - ps[p].gethorizsum()) << 5;
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
}
zvel += (zRange / 2) - (krand() & (zRange - 1));
}
else if (j == -1 || atwith != SHOTSPARK1)
{
sa += 16 - (krand() & 31);
zvel = (100 - ps[p].gethorizsum()) << 5;
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
zvel += 128 - (krand() & 255);
}
@ -681,7 +681,7 @@ void shoot_d(int i, int atwith)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
}
else
zvel = (100 - ps[p].gethorizsum()) * 98;
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.));
}
else
{
@ -769,7 +769,7 @@ void shoot_d(int i, int atwith)
if (sprite[j].picnum != RECON)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
}
else zvel = (100 - ps[p].gethorizsum()) * 81;
else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / 65536.));
if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, i);
@ -914,7 +914,7 @@ void shoot_d(int i, int atwith)
case HANDHOLDINGLASER:
if (p >= 0)
zvel = (100 - ps[p].gethorizsum()) * 32;
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
else zvel = 0;
hitscan(sx, sy, sz - ps[p].pyoff, sect,
@ -1015,7 +1015,7 @@ void shoot_d(int i, int atwith)
else
{
sa += 16 - (krand() & 31);
zvel = (100 - ps[p].gethorizsum()) << 5;
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
zvel += 128 - (krand() & 255);
}
@ -1090,7 +1090,7 @@ void shoot_d(int i, int atwith)
zvel = ((sprite[j].z - sz - dal - (4 << 8)) * 768) / (ldist(&sprite[ps[p].i], &sprite[j]));
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
}
else zvel = (100 - ps[p].gethorizsum()) * 98;
else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.));
}
else if (s->statnum != 3)
{
@ -1940,7 +1940,7 @@ int operateTripbomb(int snum)
hitscan(p->posx, p->posy, p->posz,
p->cursectnum, sintable[(p->getang() + 512) & 2047],
sintable[p->getang() & 2047], (100 - p->gethorizsum()) * 32,
sintable[p->getang() & 2047], (IntToFixed(100) - p->getq16horizsum()) >> 11,
&sect, &hw, &hitsp, &sx, &sy, &sz, CLIPMASK1);
if (sect < 0 || hitsp >= 0)
@ -2122,12 +2122,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH))
{
k = 15;
i = ((p->gethorizsum() - 100) * 20);
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
else
{
k = 140;
i = -512 - ((p->gethorizsum() - 100) * 20);
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
j = EGS(p->cursectnum,

View file

@ -154,7 +154,7 @@ void shoot_r(int i, int atwith)
{
if (p >= 0)
{
zvel = (100 - ps[p].gethorizsum()) << 5;
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
sz += (6 << 8);
sa += 15;
}
@ -333,7 +333,7 @@ void shoot_r(int i, int atwith)
if (j == -1)
{
sa += 16 - (krand() & 31);
zvel = (100 - ps[p].gethorizsum()) << 5;
zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
zvel += 128 - (krand() & 255);
}
}
@ -343,7 +343,7 @@ void shoot_r(int i, int atwith)
sa += 64 - (krand() & 127);
else
sa += 16 - (krand() & 31);
if (j == -1) zvel = (100 - ps[p].gethorizsum()) << 5;
if (j == -1) zvel = (IntToFixed(100) - ps[p].getq16horizsum()) >> 11;
zvel += 128 - (krand() & 255);
}
sz -= (2 << 8);
@ -602,7 +602,7 @@ void shoot_r(int i, int atwith)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
}
else
zvel = (100 - ps[p].gethorizsum()) * 98;
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.));
}
else
{
@ -693,7 +693,7 @@ void shoot_r(int i, int atwith)
{
sx += sintable[(s->ang + 512 + 160) & 2047] >> 7;
sy += sintable[(s->ang + 160) & 2047] >> 7;
zvel = (100 - ps[p].gethorizsum()) * 98;
zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (98. / 65536.));
}
}
else
@ -804,7 +804,7 @@ void shoot_r(int i, int atwith)
if (sprite[j].picnum != RECON)
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
}
else zvel = (100 - ps[p].gethorizsum()) * 81;
else zvel = xs_CRoundToInt((IntToFixed(100) - ps[p].getq16horizsum()) * (81. / 65536.));
if (atwith == RPG)
S_PlayActorSound(RPG_SHOOT, i);
else if (isRRRA())
@ -2843,12 +2843,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{
k = 15;
i = ((p->gethorizsum() - 100) * 20);
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
else
{
k = 140;
i = -512 - ((p->gethorizsum() - 100) * 20);
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
j = EGS(p->cursectnum,
@ -3253,12 +3253,12 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH) && !p->OnMotorcycle)
{
k = 15;
i = ((p->gethorizsum() - 100) * 20);
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
else
{
k = 32;
i = -512 - ((p->gethorizsum() - 100) * 20);
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
j = EGS(p->cursectnum,

View file

@ -333,12 +333,12 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
if (p->on_ground && (actions & SB_CROUCH))
{
k = 15;
i = ((p->gethorizsum() - 100) * 20);
i = xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
else
{
k = 140;
i = -512 - ((p->gethorizsum() - 100) * 20);
i = -512 - xs_CRoundToInt((p->getq16horizsum() - IntToFixed(100)) * (20. / 65536.));
}
j = EGS(p->cursectnum,

View file

@ -232,7 +232,9 @@ struct player_struct
int gethoriz() { return FixedToInt(q16horiz); }
int gethorizof() { return FixedToInt(q16horizoff); }
int gethorizsum() { return FixedToInt(q16horiz + q16horizoff); }
int getq16horiz() { return q16horiz; }
int getq16horizof() { return q16horizoff; }
int getq16horizsum() { return q16horiz + q16horizoff; }
};