- took care of most of zinttoworld

This commit is contained in:
Christoph Oelckers 2022-09-08 20:12:23 +02:00
parent 82ac3c50e8
commit 1a365997d8
3 changed files with 18 additions and 31 deletions

View file

@ -202,16 +202,6 @@ constexpr int NORM_ANGLE(int ang) { return ((ang) & 2047); }
int StdRandomRange(int range);
inline DVector2 MOVExy(int vel, DAngle ang)
{
return ang.ToVector() * vel * inttoworld;
}
inline int SQ(int val)
{
return val * val;
}
// Distance macro - tx, ty, tmin are holding vars that must be declared in the routine
// that uses this macro
inline void DISTANCE(const DVector2& p1, const DVector2& p2, int& dist, int& tx, int& ty, int& tmin)
@ -889,7 +879,7 @@ struct USER
}
// frequently repeated patterns
void addCounterToChange() { change.Z += Counter * zinttoworld; }
void addCounterToChange() { change.Z += Counter * zmaptoworld; }
//

View file

@ -322,10 +322,8 @@ void MoveSpritesWithSector(sectortype* sect, double z_amt, bool type)
}
}
int DoVatorMove(DSWActor* actor, double *lptr)
double DoVatorMove(DSWActor* actor, double *lptr)
{
int move_amt;
double zval = *lptr;
// if LESS THAN goal
@ -353,7 +351,7 @@ int DoVatorMove(DSWActor* actor, double *lptr)
zval = actor->user.z_tgt;
}
move_amt = int((zval - *lptr) * zworldtoint);
auto move_amt = (zval - *lptr);
*lptr = zval;
return move_amt;
@ -364,7 +362,7 @@ int DoVator(DSWActor* actor)
{
sectortype* sectp = actor->sector();
double zval;
int amt;
double amt;
// actor->user.sz - where the sector z started
// actor->user.z_tgt - current target z
@ -377,14 +375,14 @@ int DoVator(DSWActor* actor)
zval = sectp->ceilingz;
amt = DoVatorMove(actor, &zval);
sectp->setceilingz(zval);
MoveSpritesWithSector(actor->sector(), amt * zinttoworld, true); // ceiling
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
}
else
{
zval = sectp->floorz;
amt = DoVatorMove(actor, &zval);
sectp->setfloorz(zval);
MoveSpritesWithSector(actor->sector(), amt * zinttoworld, false); // floor
MoveSpritesWithSector(actor->sector(), amt, false); // floor
}
// EQUAL this entry has finished
@ -523,21 +521,21 @@ int DoVatorAuto(DSWActor* actor)
{
sectortype* sectp = actor->sector();
double zval;
int amt;
double amt;
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
{
zval = sectp->ceilingz;
amt = DoVatorMove(actor, &zval);
sectp->setceilingz(zval);
MoveSpritesWithSector(actor->sector(), amt * zinttoworld, true); // ceiling
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
}
else
{
zval = sectp->floorz;
amt = DoVatorMove(actor, &zval);
sectp->setfloorz(zval);
MoveSpritesWithSector(actor->sector(), amt * zinttoworld, false); // floor
MoveSpritesWithSector(actor->sector(), amt, false); // floor
}
// EQUAL this entry has finished

View file

@ -8768,7 +8768,7 @@ bool OwnerIsPlayer(DSWActor* actor)
//
//---------------------------------------------------------------------------
int DoMineRangeTest(DSWActor* actor, int range)
int DoMineRangeTest(DSWActor* actor, double range)
{
unsigned stat;
bool ownerisplayer = false;
@ -8782,7 +8782,7 @@ int DoMineRangeTest(DSWActor* actor, int range)
{
double dist = (itActor->spr.pos - actor->spr.pos).Length();
if (dist > range * zinttoworld)
if (dist > range)
continue;
if (actor == itActor)
@ -8869,7 +8869,7 @@ int DoMineStuck(DSWActor* actor)
if (actor->user.Counter2 < MINE_DETONATE_STATE)
{
// if something came into range - detonate
if (DoMineRangeTest(actor, 3000))
if (DoMineRangeTest(actor, 187.5))
{
// move directly to detonate state
actor->user.Counter2 = MINE_DETONATE_STATE;
@ -12328,7 +12328,7 @@ int InitSwordAttack(PLAYER* pp)
{
HitInfo hit{};
double daz = (-MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000)) * zinttoworld;
double daz = -pp->horizon.horiz.asbuildf() * (2000 / 256.) + (RandomRangeF(24000 / 256.) - 12000 / 256.));
DAngle daang = pp->angle.ang;
FAFhitscan(pp->pos, pp->cursector, DVector3(pp->angle.ang.ToVector() * 1024, daz), hit, CLIPMASK_MISSILE);
@ -12505,7 +12505,7 @@ int InitFistAttack(PLAYER* pp)
// all this is to break glass
{
HitInfo hit{};
double daz = (-MulScale(pp->horizon.horiz.asq16(), 2000, 16) + (RandomRange(24000) - 12000)) * zinttoworld;
double daz = -pp->horizon.horiz.asbuildf() * (2000 / 256.) + (RandomRangeF(24000 / 256.) - 12000 / 256.));
auto daang = pp->angle.ang;
FAFhitscan(pp->pos, pp->cursector, DVector3(pp->angle.ang.ToVector() * 1024, daz), hit, CLIPMASK_MISSILE);
@ -18231,19 +18231,18 @@ STATE s_WallBlood4[] =
DSWActor* QueueWallBlood(DSWActor* actor, DAngle bang)
{
short w,nw,dang;
short w,nw;
DSWActor* spawnedActor;
short rndnum;
double daz;
HitInfo hit{};
if (actor->user.Flags & (SPR_UNDERWATER) || SpriteInUnderwaterArea(actor) || SpriteInDiveArea(actor))
return nullptr; // No blood underwater!
daz = RandomRange(128) * 8 - 512;
dang = (bang. + RandomAngle(22.5) - DAngle22_5 / 2;
double daz = RandomRange(128) * 8 - 512;
DAngle dang = bang + RandomAngle(22.5) - DAngle22_5 / 2;
DVector3 vect(bcos(dang) * inttoworld, bsin(dang) * inttoworld, daz * zmaptoworld);
DVector3 vect(dang.ToVector() * 1024, daz);
FAFhitscan(actor->spr.pos.plusZ(-30), actor->sector(), vect, hit, CLIPMASK_MISSILE);