- Add new double DCoreActor::viewzoffset set in spawning code during level loads.

* Interpolated backup copy isn't needed for Duke, but will be for SW.
This commit is contained in:
Mitchell Richters 2022-11-21 14:53:52 +11:00 committed by Christoph Oelckers
parent b0c95f69c5
commit abd6275f17
5 changed files with 16 additions and 3 deletions

View file

@ -44,6 +44,7 @@ public:
DVector3 opos;
DAngle oang;
DVector3 vel;
double oviewzoffset, viewzoffset;
double clipdist;
int time;
@ -113,6 +114,7 @@ public:
void backupz()
{
opos.Z = spr.pos.Z;
oviewzoffset = viewzoffset;
}
void backupvec2()
@ -123,6 +125,7 @@ public:
void backuppos()
{
opos = spr.pos;
oviewzoffset = viewzoffset;
}
void backupang()

View file

@ -627,9 +627,14 @@ void DCoreActor::Serialize(FSerializer& arc)
("spriteext", sprext)
("xvel", vel.X)
("yvel", vel.Y)
("zvel", vel.Z);
("zvel", vel.Z)
("viewzoffset", viewzoffset);
if (arc.isReading()) spsmooth = {};
if (arc.isReading())
{
spsmooth = {};
backuppos();
}
}

View file

@ -619,6 +619,7 @@ DEFINE_FIELD_NAMED(DCoreActor, time, spawnindex)
DEFINE_FIELD(DCoreActor, spritesetindex)
DEFINE_FIELD_NAMED(DCoreActor, spr.angle, angle)
DEFINE_FIELD(DCoreActor, vel)
DEFINE_FIELD(DCoreActor, viewzoffset)
void coreactor_setpos(DCoreActor* self, double x, double y, double z, int relink)
{

View file

@ -512,9 +512,12 @@ void resetpspritevars(int g)
int aimmode[MAXPLAYERS];
STATUSBARTYPE tsbar[MAXPLAYERS];
CreateActor(ps[0].cursector, ps[0].posGet(),
auto newActor = CreateActor(ps[0].cursector, ps[0].posGet(),
TILE_APLAYER, 0, DVector2(0, 0), ps[0].angle.ang, 0., 0., nullptr, 10);
newActor->viewzoffset = -gs.playerheight;
newActor->backupz();
if (ud.recstat != 2) for (i = 0; i < MAXPLAYERS; i++)
{
aimmode[i] = ps[i].aim_mode;

View file

@ -45,6 +45,7 @@ class CoreActor native
native double clipdist;
native double angle;
native Vector3 vel;
native double viewzoffset;
native readonly int16 spritesetindex;
native readonly int spawnindex;