mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 09:21:36 +00:00
- floatified DoVatorMove and got rid of int_oz.
This commit is contained in:
parent
af7e63137f
commit
30e6db9e3b
2 changed files with 26 additions and 28 deletions
|
@ -930,7 +930,6 @@ struct USER
|
||||||
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
|
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
|
||||||
}
|
}
|
||||||
|
|
||||||
int int_oz() const { return oz * zworldtoint; }
|
|
||||||
int int_loz() const { return loz * zworldtoint; }
|
int int_loz() const { return loz * zworldtoint; }
|
||||||
int int_hiz() const { return hiz * zworldtoint; }
|
int int_hiz() const { return hiz * zworldtoint; }
|
||||||
int int_z_tgt() const { return z_tgt * zworldtoint; }
|
int int_z_tgt() const { return z_tgt * zworldtoint; }
|
||||||
|
|
|
@ -322,39 +322,38 @@ void MoveSpritesWithSector(sectortype* sect, int z_amt, bool type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DoVatorMove(DSWActor* actor, int *lptr)
|
int DoVatorMove(DSWActor* actor, double *lptr)
|
||||||
{
|
{
|
||||||
int zval;
|
|
||||||
int move_amt;
|
int move_amt;
|
||||||
|
|
||||||
zval = *lptr;
|
double zval = *lptr;
|
||||||
|
|
||||||
// if LESS THAN goal
|
// if LESS THAN goal
|
||||||
if (zval < actor->user.int_z_tgt())
|
if (zval < actor->user.z_tgt)
|
||||||
{
|
{
|
||||||
// move it DOWN
|
// move it DOWN
|
||||||
zval += (synctics * actor->user.jump_speed);
|
zval += (synctics * actor->user.jump_speed) * zinttoworld;
|
||||||
|
|
||||||
actor->user.jump_speed += actor->user.vel_rate * synctics;
|
actor->user.jump_speed += actor->user.vel_rate * synctics;
|
||||||
|
|
||||||
// if the other way make it equal
|
// if the other way make it equal
|
||||||
if (zval > actor->user.int_z_tgt())
|
if (zval > actor->user.z_tgt)
|
||||||
zval = actor->user.int_z_tgt();
|
zval = actor->user.z_tgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if GREATER THAN goal
|
// if GREATER THAN goal
|
||||||
if (zval > actor->user.int_z_tgt())
|
if (zval > actor->user.z_tgt)
|
||||||
{
|
{
|
||||||
// move it UP
|
// move it UP
|
||||||
zval -= (synctics * actor->user.jump_speed);
|
zval -= (synctics * actor->user.jump_speed) * zinttoworld;
|
||||||
|
|
||||||
actor->user.jump_speed += actor->user.vel_rate * synctics;
|
actor->user.jump_speed += actor->user.vel_rate * synctics;
|
||||||
|
|
||||||
if (zval < actor->user.int_z_tgt())
|
if (zval < actor->user.z_tgt)
|
||||||
zval = actor->user.int_z_tgt();
|
zval = actor->user.z_tgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
move_amt = zval - *lptr;
|
move_amt = int((zval - *lptr) * zworldtoint);
|
||||||
*lptr = zval;
|
*lptr = zval;
|
||||||
|
|
||||||
return move_amt;
|
return move_amt;
|
||||||
|
@ -364,7 +363,7 @@ int DoVatorMove(DSWActor* actor, int *lptr)
|
||||||
int DoVator(DSWActor* actor)
|
int DoVator(DSWActor* actor)
|
||||||
{
|
{
|
||||||
sectortype* sectp = actor->sector();
|
sectortype* sectp = actor->sector();
|
||||||
int zval;
|
double zval;
|
||||||
int amt;
|
int amt;
|
||||||
|
|
||||||
// actor->user.sz - where the sector z started
|
// actor->user.sz - where the sector z started
|
||||||
|
@ -375,21 +374,21 @@ int DoVator(DSWActor* actor)
|
||||||
|
|
||||||
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
|
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
|
||||||
{
|
{
|
||||||
zval = sectp->int_ceilingz();
|
zval = sectp->ceilingz;
|
||||||
amt = DoVatorMove(actor, &zval);
|
amt = DoVatorMove(actor, &zval);
|
||||||
sectp->set_int_ceilingz(zval);
|
sectp->setceilingz(zval);
|
||||||
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
|
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zval = sectp->int_floorz();
|
zval = sectp->floorz;
|
||||||
amt = DoVatorMove(actor, &zval);
|
amt = DoVatorMove(actor, &zval);
|
||||||
sectp->set_int_floorz(zval);
|
sectp->setfloorz(zval);
|
||||||
MoveSpritesWithSector(actor->sector(), amt, false); // floor
|
MoveSpritesWithSector(actor->sector(), amt, false); // floor
|
||||||
}
|
}
|
||||||
|
|
||||||
// EQUAL this entry has finished
|
// EQUAL this entry has finished
|
||||||
if (zval == actor->user.int_z_tgt())
|
if (zval == actor->user.z_tgt)
|
||||||
{
|
{
|
||||||
// in the ON position
|
// in the ON position
|
||||||
if (actor->user.z_tgt == actor->spr.pos.Z)
|
if (actor->user.z_tgt == actor->spr.pos.Z)
|
||||||
|
@ -438,7 +437,7 @@ int DoVator(DSWActor* actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup to go back to the original z
|
// setup to go back to the original z
|
||||||
if (zval != actor->user.int_oz())
|
if (zval != actor->user.oz)
|
||||||
{
|
{
|
||||||
if (actor->user.WaitTics)
|
if (actor->user.WaitTics)
|
||||||
actor->user.Tics = actor->user.WaitTics;
|
actor->user.Tics = actor->user.WaitTics;
|
||||||
|
@ -523,32 +522,32 @@ int DoVator(DSWActor* actor)
|
||||||
int DoVatorAuto(DSWActor* actor)
|
int DoVatorAuto(DSWActor* actor)
|
||||||
{
|
{
|
||||||
sectortype* sectp = actor->sector();
|
sectortype* sectp = actor->sector();
|
||||||
int zval;
|
double zval;
|
||||||
int amt;
|
int amt;
|
||||||
|
|
||||||
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
|
if (actor->spr.cstat & (CSTAT_SPRITE_YFLIP))
|
||||||
{
|
{
|
||||||
zval = sectp->int_ceilingz();
|
zval = sectp->ceilingz;
|
||||||
amt = DoVatorMove(actor, &zval);
|
amt = DoVatorMove(actor, &zval);
|
||||||
sectp->set_int_ceilingz(zval);
|
sectp->setceilingz(zval);
|
||||||
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
|
MoveSpritesWithSector(actor->sector(), amt, true); // ceiling
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zval = sectp->int_floorz();
|
zval = sectp->floorz;
|
||||||
amt = DoVatorMove(actor, &zval);
|
amt = DoVatorMove(actor, &zval);
|
||||||
sectp->set_int_floorz(zval);
|
sectp->setfloorz(zval);
|
||||||
MoveSpritesWithSector(actor->sector(), amt, false); // floor
|
MoveSpritesWithSector(actor->sector(), amt, false); // floor
|
||||||
}
|
}
|
||||||
|
|
||||||
// EQUAL this entry has finished
|
// EQUAL this entry has finished
|
||||||
if (zval == actor->user.int_z_tgt())
|
if (zval == actor->user.z_tgt)
|
||||||
{
|
{
|
||||||
// in the UP position
|
// in the UP position
|
||||||
if (actor->user.z_tgt == actor->spr.pos.Z)
|
if (actor->user.z_tgt == actor->spr.pos.Z)
|
||||||
{
|
{
|
||||||
// change target
|
// change target
|
||||||
actor->user.z_tgt = actor->user.int_upos().Z * zinttoworld;
|
actor->user.z_tgt = actor->user.pos.Z;
|
||||||
actor->user.vel_rate = -actor->user.vel_rate;
|
actor->user.vel_rate = -actor->user.vel_rate;
|
||||||
actor->user.Tics = actor->user.WaitTics;
|
actor->user.Tics = actor->user.WaitTics;
|
||||||
|
|
||||||
|
@ -557,7 +556,7 @@ int DoVatorAuto(DSWActor* actor)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// in the DOWN position
|
// in the DOWN position
|
||||||
if (actor->user.int_z_tgt() == actor->user.int_upos().Z)
|
if (actor->user.z_tgt == actor->user.pos.Z)
|
||||||
{
|
{
|
||||||
// change target
|
// change target
|
||||||
actor->user.jump_speed = actor->user.vel_tgt;
|
actor->user.jump_speed = actor->user.vel_tgt;
|
||||||
|
|
Loading…
Reference in a new issue