mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-20 16:10:52 +00:00
- floatified opos.
This commit is contained in:
parent
5df4caa82f
commit
7745701d4b
7 changed files with 71 additions and 31 deletions
|
@ -41,7 +41,7 @@ public:
|
|||
spriteext_t sprext;
|
||||
spritesmooth_t spsmooth;
|
||||
|
||||
vec3_t opos;
|
||||
DVector3 opos;
|
||||
int time;
|
||||
int16_t oang;
|
||||
int16_t spritesetindex;
|
||||
|
@ -129,27 +129,62 @@ public:
|
|||
return { spr.pos.X, -spr.pos.Y, -spr.pos.Z };
|
||||
}
|
||||
|
||||
double interpolatedx(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvaluef(opos.X, spr.pos.X, smoothratio, scale);
|
||||
}
|
||||
|
||||
double interpolatedy(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvaluef(opos.Y, spr.pos.Y, smoothratio, scale);
|
||||
}
|
||||
|
||||
double interpolatedz(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(opos.Z, spr.pos.Z, smoothratio, scale);
|
||||
}
|
||||
|
||||
DVector2 interpolatedvec2(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale)
|
||||
};
|
||||
}
|
||||
|
||||
DVector3 interpolatedvec3(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return
|
||||
{
|
||||
interpolatedx(smoothratio, scale),
|
||||
interpolatedy(smoothratio, scale),
|
||||
interpolatedz(smoothratio, scale)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
int32_t __interpolatedx(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(opos.X, spr.int_pos().X, smoothratio, scale);
|
||||
return interpolatedx(smoothratio, scale) * worldtoint;
|
||||
}
|
||||
|
||||
int32_t __interpolatedy(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(opos.Y, spr.int_pos().Y, smoothratio, scale);
|
||||
return interpolatedy(smoothratio, scale) * worldtoint;
|
||||
}
|
||||
|
||||
int32_t __interpolatedz(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return interpolatedvalue(opos.Z, spr.int_pos().Z, smoothratio, scale);
|
||||
return interpolatedz(smoothratio, scale) * zworldtoint;
|
||||
}
|
||||
|
||||
vec2_t __interpolatedvec2(double const smoothratio, int const scale = 16)
|
||||
{
|
||||
return
|
||||
{
|
||||
__interpolatedx(smoothratio, scale),
|
||||
__interpolatedy(smoothratio, scale)
|
||||
(int)(interpolatedx(smoothratio, scale) * worldtoint),
|
||||
(int)(interpolatedy(smoothratio, scale) * worldtoint)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -157,9 +192,9 @@ public:
|
|||
{
|
||||
return
|
||||
{
|
||||
__interpolatedx(smoothratio, scale),
|
||||
__interpolatedy(smoothratio, scale),
|
||||
__interpolatedz(smoothratio, scale)
|
||||
(int)(interpolatedx(smoothratio, scale)* worldtoint),
|
||||
(int)(interpolatedy(smoothratio, scale)* worldtoint),
|
||||
(int)(interpolatedz(smoothratio, scale)* zworldtoint)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -171,27 +206,28 @@ public:
|
|||
|
||||
void backupx()
|
||||
{
|
||||
opos.X = spr.int_pos().X;
|
||||
opos.X = spr.pos.X;
|
||||
}
|
||||
|
||||
void backupy()
|
||||
{
|
||||
opos.Y = spr.int_pos().Y;
|
||||
opos.Y = spr.pos.Y;
|
||||
}
|
||||
|
||||
void backupz()
|
||||
{
|
||||
opos.Z = spr.int_pos().Z;
|
||||
opos.Z = spr.pos.Z;
|
||||
}
|
||||
|
||||
void backupvec2()
|
||||
{
|
||||
opos.vec2 = spr.int_pos().vec2;
|
||||
backupx();
|
||||
backupy();
|
||||
}
|
||||
|
||||
void backuppos()
|
||||
{
|
||||
opos = spr.int_pos();
|
||||
opos = spr.pos;
|
||||
}
|
||||
|
||||
void backupang()
|
||||
|
|
|
@ -785,7 +785,7 @@ void movecrane(DDukeActor *actor, int crane)
|
|||
{
|
||||
SetActor(Owner, actor->int_pos());
|
||||
|
||||
Owner->opos = actor->int_pos();
|
||||
Owner->opos = actor->spr.pos;
|
||||
|
||||
actor->spr.zvel = 0;
|
||||
}
|
||||
|
|
|
@ -1585,7 +1585,7 @@ static void weaponcommon_d(DDukeActor* proj)
|
|||
|
||||
if (spawned)
|
||||
{
|
||||
spawned->opos = proj->opos + offset;
|
||||
spawned->opos = proj->opos + DVector3(offset.X * inttoworld, offset.Y * inttoworld, offset.Z * zinttoworld);
|
||||
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
||||
spawned->spr.pal = proj->spr.pal;
|
||||
}
|
||||
|
@ -1837,7 +1837,7 @@ void movetransports_d(void)
|
|||
ps[p].opos.Z = ps[p].pos.Z;
|
||||
|
||||
auto pa = ps[p].GetActor();
|
||||
pa->opos = ps[p].pos;
|
||||
pa->opos = DVector3(ps[p].pos.X * inttoworld, ps[p].pos.Y * inttoworld, ps[p].pos.Z * zinttoworld);
|
||||
|
||||
ChangeActorSect(act2, Owner->sector());
|
||||
ps[p].setCursector(Owner->sector());
|
||||
|
@ -3553,7 +3553,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
|
||||
if (actor->temp_data[1] == 0 || a == 0)
|
||||
{
|
||||
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->int_pos().X) || (actor->opos.Y != actor->int_pos().Y))
|
||||
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->spr.pos.X) || (actor->opos.Y != actor->spr.pos.Y))
|
||||
{
|
||||
actor->backupvec2();
|
||||
SetActor(actor, actor->int_pos());
|
||||
|
@ -3662,7 +3662,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
|
|||
{
|
||||
if (!*(moveptr + 1))
|
||||
{
|
||||
if (actor->opos.Z != actor->int_pos().Z || (ud.multimode < 2 && ud.player_skill < 2))
|
||||
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
|
||||
{
|
||||
if ((actor->temp_data[0] & 1) || ps[playernum].actorsqu == actor) return;
|
||||
else daxvel <<= 1;
|
||||
|
|
|
@ -3592,7 +3592,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
|
|||
|
||||
if (actor->temp_data[1] == 0 || a == 0)
|
||||
{
|
||||
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->int_pos().X) || (actor->opos.Y != actor->int_pos().Y))
|
||||
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->spr.pos.X) || (actor->opos.Y != actor->spr.pos.Y))
|
||||
{
|
||||
actor->backupvec2();
|
||||
SetActor(actor, actor->int_pos());
|
||||
|
@ -3707,7 +3707,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
|
|||
{
|
||||
if (!*(moveptr + 1))
|
||||
{
|
||||
if (actor->opos.Z != actor->int_pos().Z || (ud.multimode < 2 && ud.player_skill < 2))
|
||||
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
|
||||
{
|
||||
if ((actor->temp_data[0] & 1) || ps[pnum].actorsqu == actor) return;
|
||||
else daxvel <<= 1;
|
||||
|
|
|
@ -6402,7 +6402,7 @@ void MoveSkipSavePos(void)
|
|||
{
|
||||
if (!actor->hasU()) continue;
|
||||
actor->backuppos();
|
||||
actor->user.oz = actor->opos.Z;
|
||||
actor->user.oz = actor->opos.Z * zworldtoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6419,7 +6419,7 @@ void MoveSkipSavePos(void)
|
|||
{
|
||||
if (!actor->hasU()) continue;
|
||||
actor->backuppos();
|
||||
actor->user.oz = actor->opos.Z;
|
||||
actor->user.oz = actor->opos.Z * zworldtoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -850,7 +850,7 @@ void SpawnUser(DSWActor* actor, short id, STATE* state)
|
|||
actor->user.motion_blur_dist = 256;
|
||||
|
||||
actor->backuppos();
|
||||
actor->user.oz = actor->opos.Z;
|
||||
actor->user.oz = actor->opos.Z * zworldtoint;
|
||||
|
||||
actor->user.active_range = MIN_ACTIVE_RANGE;
|
||||
|
||||
|
@ -2059,7 +2059,8 @@ void SpriteSetup(void)
|
|||
}
|
||||
|
||||
// set orig z
|
||||
actor->user.oz = actor->opos.Z = sectp->int_floorz();
|
||||
actor->opos.Z = sectp->floorz;
|
||||
actor->user.oz = actor->opos.Z * zworldtoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2079,7 +2080,8 @@ void SpriteSetup(void)
|
|||
}
|
||||
|
||||
// set orig z
|
||||
actor->user.oz = actor->opos.Z = sectp->int_ceilingz();
|
||||
actor->opos.Z = sectp->ceilingz;
|
||||
actor->user.oz = actor->opos.Z * zworldtoint;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2261,7 +2263,8 @@ void SpriteSetup(void)
|
|||
}
|
||||
|
||||
// set orig z
|
||||
actor->user.oz = actor->opos.Z = actor->user.zclip;
|
||||
actor->user.oz = actor->user.zclip;
|
||||
actor->opos.Z = actor->user.oz * zinttoworld;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2279,7 +2282,8 @@ void SpriteSetup(void)
|
|||
}
|
||||
|
||||
// set orig z
|
||||
actor->user.oz = actor->opos.Z = actor->user.zclip;
|
||||
actor->user.oz = actor->user.zclip;
|
||||
actor->opos.Z = actor->user.oz * zinttoworld;
|
||||
}
|
||||
|
||||
change_actor_stat(actor, STAT_SPIKE);
|
||||
|
@ -6329,7 +6333,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in
|
|||
void MissileWarpUpdatePos(DSWActor* actor, sectortype* sect)
|
||||
{
|
||||
actor->backuppos();
|
||||
actor->user.oz = actor->opos.Z;
|
||||
actor->user.oz = actor->opos.Z * zworldtoint;
|
||||
ChangeActorSect(actor, sect);
|
||||
MissileZrange(actor);
|
||||
}
|
||||
|
@ -6337,7 +6341,7 @@ void MissileWarpUpdatePos(DSWActor* actor, sectortype* sect)
|
|||
void ActorWarpUpdatePos(DSWActor* actor, sectortype* sect)
|
||||
{
|
||||
actor->backuppos();
|
||||
actor->user.oz = actor->opos.Z;
|
||||
actor->user.oz = actor->opos.Z * zworldtoint;
|
||||
ChangeActorSect(actor, sect);
|
||||
DoActorZrange(actor);
|
||||
}
|
||||
|
|
|
@ -832,7 +832,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop)
|
|||
itActor->user.RotNum = 0;
|
||||
|
||||
itActor->backuppos();
|
||||
itActor->user.oz = itActor->opos.Z;
|
||||
itActor->user.oz = itActor->opos.Z * zworldtoint;
|
||||
|
||||
switch (itActor->spr.statnum)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue