- SW: Attempt at making vehicle movement work nicely while uninterpolated.

This commit is contained in:
Mitchell Richters 2020-09-09 22:45:21 +10:00
parent e24521b189
commit 28a3ef131f
2 changed files with 23 additions and 10 deletions

View file

@ -191,6 +191,11 @@ void so_setinterpolationtics(SECTOR_OBJECTp sop, int16_t locktics)
interp->lasttic = locktics;
}
static inline bool so_nointerpolations(short track)
{
return !cl_syncinput && (track >= SO_TURRET_MGUN && track <= SO_VEHICLE);
}
void so_updateinterpolations(void) // Stick at beginning of domovethings
{
int32_t i;
@ -202,8 +207,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
if (SO_EMPTY(sop) || skip)
if (SO_EMPTY(sop) || so_nointerpolations(sop->track))
continue;
if (interp->tic < interp->lasttic)
interp->tic += synctics;
@ -241,8 +245,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
if (SO_EMPTY(sop) || skip)
if (SO_EMPTY(sop) || so_nointerpolations(sop->track))
continue;
for (i = 0; i < interp->numinterpolations; i++)
@ -268,8 +271,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
if (SO_EMPTY(sop) || skip)
if (SO_EMPTY(sop) || so_nointerpolations(sop->track))
continue;
// Check if interpolation has been explicitly disabled
@ -329,8 +331,7 @@ void so_restoreinterpolations(void) // Stick at end of drawscree
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
bool skip = !cl_syncinput && (sop->track == SO_TURRET);
if (SO_EMPTY(sop) || skip)
if (SO_EMPTY(sop) || so_nointerpolations(sop->track))
continue;
for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++)

View file

@ -1669,6 +1669,11 @@ DoPlayerTurnVehicle(PLAYERp pp, fixed_t q16avel, int z, int floor_dist)
sprite[pp->PlayerSprite].ang = FixedToInt(pp->q16ang);
}
}
if (!cl_syncinput)
{
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->oposx + mulscale16(pp->posx - pp->oposx, smoothratio), pp->oposy + mulscale16(pp->posy - pp->oposy, smoothratio));
}
}
void
@ -3042,7 +3047,10 @@ DoPlayerMoveVehicle(PLAYERp pp)
}
save_sectnum = pp->cursectnum;
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO);
if (cl_syncinput)
{
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), MAXSO, MAXSO);
}
pp->cursectnum = pp->sop->op_main_sector; // for speed
floor_dist = labs(z - pp->sop->floor_loz);
@ -3146,7 +3154,11 @@ DoPlayerMoveVehicle(PLAYERp pp)
}
}
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy);
if (cl_syncinput)
{
OperateSectorObject(pp->sop, FixedToInt(pp->q16ang), pp->posx, pp->posy);
}
pp->cursectnum = save_sectnum; // for speed
if (!cl_syncinput)