2020-05-01 09:28:49 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1997, 2005 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is part of Shadow Warrior version 1.2
|
|
|
|
|
|
|
|
Shadow Warrior is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
Original Source: 1997 - Frank Maddin and Jim Norwood
|
|
|
|
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2020-05-21 14:25:41 +00:00
|
|
|
#include "ns.h"
|
|
|
|
|
2020-05-01 09:28:49 +00:00
|
|
|
#include "compat.h"
|
|
|
|
|
|
|
|
#include "game.h"
|
|
|
|
#include "interpso.h"
|
2020-05-21 18:42:48 +00:00
|
|
|
#include "names2.h"
|
2020-05-01 09:28:49 +00:00
|
|
|
|
2020-05-21 14:25:41 +00:00
|
|
|
BEGIN_SW_NS
|
|
|
|
|
2020-11-26 17:05:49 +00:00
|
|
|
#define SO_MAXINTERPOLATIONS 1024
|
2020-05-01 09:28:49 +00:00
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
soi_base = 0xffffff,
|
|
|
|
soi_wallx = 0x1000000,
|
|
|
|
soi_wally = 0x2000000,
|
|
|
|
soi_ceil = 0x3000000,
|
|
|
|
soi_floor = 0x4000000,
|
|
|
|
soi_sox = 0x5000000,
|
|
|
|
soi_soy = 0x6000000,
|
|
|
|
soi_soz = 0x7000000,
|
|
|
|
soi_sprx = 0x8000000,
|
|
|
|
soi_spry = 0x9000000,
|
|
|
|
soi_sprz = 0xa000000,
|
|
|
|
};
|
|
|
|
|
2020-05-01 09:28:49 +00:00
|
|
|
static struct so_interp
|
|
|
|
{
|
|
|
|
struct interp_data
|
|
|
|
{
|
2020-11-26 17:14:29 +00:00
|
|
|
int curelement;
|
2020-05-01 09:28:49 +00:00
|
|
|
int32_t oldipos;
|
|
|
|
int32_t bakipos;
|
|
|
|
int32_t lastipos;
|
|
|
|
int32_t lastoldipos;
|
|
|
|
int32_t lastangdiff;
|
|
|
|
int32_t spriteofang;
|
|
|
|
} data[SO_MAXINTERPOLATIONS];
|
|
|
|
|
|
|
|
int32_t numinterpolations;
|
|
|
|
int32_t tic, lasttic;
|
2020-09-09 18:32:24 +00:00
|
|
|
bool hasvator;
|
2020-05-01 09:28:49 +00:00
|
|
|
} so_interpdata[MAX_SECTOR_OBJECTS];
|
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
static int &getvalue(int element)
|
|
|
|
{
|
|
|
|
static int scratch;
|
|
|
|
int index = element & soi_base;
|
|
|
|
int type = element & ~soi_base;
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case soi_wallx:
|
|
|
|
return wall[index].x;
|
|
|
|
case soi_wally:
|
|
|
|
return wall[index].y;
|
|
|
|
case soi_ceil:
|
|
|
|
return sector[index].ceilingz;
|
|
|
|
case soi_floor:
|
|
|
|
return sector[index].floorz;
|
|
|
|
case soi_sox:
|
|
|
|
return SectorObject[index].xmid;
|
|
|
|
case soi_soy:
|
|
|
|
return SectorObject[index].ymid;
|
|
|
|
case soi_soz:
|
|
|
|
return SectorObject[index].zmid;
|
|
|
|
case soi_sprx:
|
|
|
|
return sprite[index].x;
|
|
|
|
case soi_spry:
|
|
|
|
return sprite[index].y;
|
|
|
|
case soi_sprz:
|
|
|
|
return sprite[index].z;
|
|
|
|
default:
|
|
|
|
return scratch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void so_setpointinterpolation(so_interp *interp, int element)
|
2020-05-01 09:28:49 +00:00
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
if (interp->numinterpolations >= SO_MAXINTERPOLATIONS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < interp->numinterpolations; i++)
|
2020-11-26 17:14:29 +00:00
|
|
|
if (interp->data[i].curelement == element)
|
2020-05-01 09:28:49 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
so_interp::interp_data *data = &interp->data[interp->numinterpolations++];
|
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
data->curelement = element;
|
|
|
|
data->oldipos =
|
|
|
|
data->lastipos =
|
|
|
|
data->lastoldipos = getvalue(element);
|
2020-05-01 09:28:49 +00:00
|
|
|
data->spriteofang = -1;
|
|
|
|
}
|
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
static void so_setspriteanginterpolation(so_interp *interp, int32_t spritenum)
|
2020-05-01 09:28:49 +00:00
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
if (interp->numinterpolations >= SO_MAXINTERPOLATIONS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < interp->numinterpolations; i++)
|
2020-11-26 17:14:29 +00:00
|
|
|
if (interp->data[i].curelement == -1)
|
2020-05-01 09:28:49 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
so_interp::interp_data *data = &interp->data[interp->numinterpolations++];
|
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
data->curelement = -1;
|
|
|
|
data->oldipos =
|
|
|
|
data->lastipos =
|
|
|
|
data->lastoldipos = sprite[spritenum].ang;
|
2020-05-01 09:28:49 +00:00
|
|
|
data->lastangdiff = 0;
|
|
|
|
data->spriteofang = spritenum;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Covers points and angles altogether
|
2020-11-26 17:14:29 +00:00
|
|
|
static void so_stopdatainterpolation(so_interp *interp, int element)
|
2020-05-01 09:28:49 +00:00
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < interp->numinterpolations; i++)
|
2020-11-26 17:14:29 +00:00
|
|
|
if (interp->data[i].curelement == element)
|
2020-05-01 09:28:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == interp->numinterpolations)
|
|
|
|
return;
|
|
|
|
|
|
|
|
interp->data[i] = interp->data[--(interp->numinterpolations)];
|
|
|
|
}
|
|
|
|
|
|
|
|
void so_addinterpolation(SECTOR_OBJECTp sop)
|
|
|
|
{
|
|
|
|
SECTORp *sectp;
|
|
|
|
int32_t startwall, endwall;
|
|
|
|
int32_t i;
|
|
|
|
|
|
|
|
so_interp *interp = &so_interpdata[sop - SectorObject];
|
|
|
|
interp->numinterpolations = 0;
|
2020-09-09 17:52:52 +00:00
|
|
|
interp->hasvator = false;
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
for (sectp = sop->sectp; *sectp; sectp++)
|
|
|
|
{
|
|
|
|
startwall = (*sectp)->wallptr;
|
|
|
|
endwall = startwall + (*sectp)->wallnum - 1;
|
|
|
|
|
|
|
|
for (i = startwall; i <= endwall; i++)
|
|
|
|
{
|
|
|
|
int32_t nextwall = wall[i].nextwall;
|
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
so_setpointinterpolation(interp, i|soi_wallx);
|
|
|
|
so_setpointinterpolation(interp, i|soi_wally);
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
if (nextwall >= 0)
|
|
|
|
{
|
2020-11-26 17:14:29 +00:00
|
|
|
so_setpointinterpolation(interp, wall[nextwall].point2|soi_wallx);
|
|
|
|
so_setpointinterpolation(interp, wall[nextwall].point2|soi_wally);
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-15 14:59:43 +00:00
|
|
|
int i;
|
|
|
|
SectIterator it(*sectp - sector);
|
|
|
|
while ((i = it.NextIndex()) >= 0)
|
2020-05-21 18:42:48 +00:00
|
|
|
if (sprite[i].statnum == STAT_VATOR && SP_TAG1(sprite+i) == SECT_VATOR)
|
|
|
|
break;
|
|
|
|
interp->hasvator |= (i >= 0);
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
|
2020-05-21 18:42:48 +00:00
|
|
|
if (!interp->hasvator)
|
|
|
|
for (sectp = sop->sectp; *sectp; sectp++)
|
|
|
|
{
|
2020-11-26 17:14:29 +00:00
|
|
|
so_setpointinterpolation(interp, int(*sectp - sector) | soi_floor);
|
|
|
|
so_setpointinterpolation(interp, int(*sectp - sector) | soi_ceil);
|
2020-05-21 18:42:48 +00:00
|
|
|
}
|
|
|
|
|
2020-05-01 09:28:49 +00:00
|
|
|
// interpolate midpoint, for aiming at a remote controlled SO
|
2020-11-26 17:14:29 +00:00
|
|
|
so_setpointinterpolation(interp, int(sop - SectorObject) | soi_sox);
|
|
|
|
so_setpointinterpolation(interp, int(sop - SectorObject) | soi_soy);
|
|
|
|
so_setpointinterpolation(interp, int(sop - SectorObject) | soi_soz);
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
interp->tic = 0;
|
|
|
|
interp->lasttic = synctics;
|
|
|
|
}
|
|
|
|
|
|
|
|
void so_setspriteinterpolation(SECTOR_OBJECTp sop, spritetype *sp)
|
|
|
|
{
|
|
|
|
so_interp *interp = &so_interpdata[sop - SectorObject];
|
2020-11-26 17:14:29 +00:00
|
|
|
int snum = int(sp - sprite);
|
2020-05-01 09:28:49 +00:00
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
so_setpointinterpolation(interp, snum | soi_sprx);
|
|
|
|
so_setpointinterpolation(interp, snum | soi_spry);
|
2020-05-21 18:42:48 +00:00
|
|
|
if (!interp->hasvator)
|
2020-11-26 17:14:29 +00:00
|
|
|
so_setpointinterpolation(interp, snum | soi_sprz);
|
|
|
|
so_setspriteanginterpolation(interp, int(sp - sprite));
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void so_stopspriteinterpolation(SECTOR_OBJECTp sop, spritetype *sp)
|
|
|
|
{
|
|
|
|
so_interp *interp = &so_interpdata[sop - SectorObject];
|
2020-11-26 17:14:29 +00:00
|
|
|
int snum = int(sp - sprite);
|
2020-05-01 09:28:49 +00:00
|
|
|
|
2020-11-26 17:14:29 +00:00
|
|
|
so_stopdatainterpolation(interp, snum | soi_sprx);
|
|
|
|
so_stopdatainterpolation(interp, snum | soi_spry);
|
2020-05-21 18:42:48 +00:00
|
|
|
if (!interp->hasvator)
|
2020-11-26 17:14:29 +00:00
|
|
|
so_stopdatainterpolation(interp, snum | soi_sprz);
|
|
|
|
so_stopdatainterpolation(interp, -1);
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void so_setinterpolationtics(SECTOR_OBJECTp sop, int16_t locktics)
|
|
|
|
{
|
|
|
|
so_interp *interp = &so_interpdata[sop - SectorObject];
|
|
|
|
|
|
|
|
interp->tic = 0;
|
|
|
|
interp->lasttic = locktics;
|
|
|
|
}
|
|
|
|
|
|
|
|
void so_updateinterpolations(void) // Stick at beginning of domovethings
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
SECTOR_OBJECTp sop;
|
|
|
|
so_interp *interp;
|
|
|
|
so_interp::interp_data *data;
|
2020-09-09 18:32:24 +00:00
|
|
|
bool interpolating = cl_sointerpolation && !CommEnabled; // If changing from menu
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
for (sop = SectorObject, interp = so_interpdata;
|
|
|
|
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
|
|
|
{
|
2020-11-30 22:40:16 +00:00
|
|
|
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
2020-09-10 09:56:13 +00:00
|
|
|
if (SO_EMPTY(sop) || skip)
|
2020-05-01 09:28:49 +00:00
|
|
|
continue;
|
|
|
|
if (interp->tic < interp->lasttic)
|
|
|
|
interp->tic += synctics;
|
|
|
|
for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++)
|
|
|
|
{
|
|
|
|
if (data->spriteofang >= 0)
|
|
|
|
{
|
|
|
|
USERp u = User[data->spriteofang];
|
|
|
|
if (u)
|
|
|
|
u->oangdiff = 0;
|
|
|
|
if (!interpolating)
|
|
|
|
data->lastangdiff = 0;
|
2020-11-26 17:14:29 +00:00
|
|
|
data->oldipos = sprite[data->spriteofang].ang;
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
else
|
2020-11-26 17:14:29 +00:00
|
|
|
data->oldipos = getvalue(data->curelement);
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
if (!interpolating)
|
|
|
|
data->lastipos = data->lastoldipos = data->oldipos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// must call restore for every do interpolations
|
|
|
|
// make sure you don't exit
|
|
|
|
void so_dointerpolations(int32_t smoothratio) // Stick at beginning of drawscreen
|
|
|
|
{
|
|
|
|
int32_t i, delta;
|
|
|
|
SECTOR_OBJECTp sop;
|
|
|
|
so_interp *interp;
|
|
|
|
so_interp::interp_data *data;
|
|
|
|
|
|
|
|
// Set the bakipos values separately, in case a point is shared.
|
|
|
|
// Also set lastipos if there's been an actual change in a point.
|
|
|
|
for (sop = SectorObject, interp = so_interpdata;
|
|
|
|
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
|
|
|
{
|
2020-11-30 22:40:16 +00:00
|
|
|
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
2020-09-10 09:56:13 +00:00
|
|
|
if (SO_EMPTY(sop) || skip)
|
2020-05-01 09:28:49 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
for (i = 0; i < interp->numinterpolations; i++)
|
|
|
|
interp->data[i].bakipos = (interp->data[i].spriteofang >= 0) ?
|
2020-11-26 17:14:29 +00:00
|
|
|
sprite[interp->data[i].spriteofang].ang :
|
|
|
|
getvalue(interp->data[i].curelement);
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
if (interp->tic == 0) // Only if the SO has just moved
|
|
|
|
{
|
|
|
|
for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++)
|
|
|
|
{
|
|
|
|
data->lastipos = data->bakipos;
|
|
|
|
data->lastoldipos = data->oldipos;
|
|
|
|
if (data->spriteofang >= 0)
|
|
|
|
{
|
|
|
|
USERp u = User[data->spriteofang];
|
|
|
|
data->lastangdiff = u ? u->oangdiff : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (sop = SectorObject, interp = so_interpdata;
|
|
|
|
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
|
|
|
{
|
2020-11-30 22:40:16 +00:00
|
|
|
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
2020-09-10 09:56:13 +00:00
|
|
|
if (SO_EMPTY(sop) || skip)
|
2020-05-01 09:28:49 +00:00
|
|
|
continue;
|
|
|
|
|
2020-05-22 11:07:32 +00:00
|
|
|
// Check if interpolation has been explicitly disabled
|
|
|
|
if (interp->lasttic == 0)
|
|
|
|
continue;
|
|
|
|
|
2020-05-02 21:20:48 +00:00
|
|
|
// Unfortunately, interpolating over less samples doesn't work well
|
|
|
|
// in multiplayer. We also skip any sector object not
|
|
|
|
// remotely controlled by some player.
|
2020-05-01 15:10:48 +00:00
|
|
|
if (CommEnabled &&
|
|
|
|
((interp->lasttic != synctics) ||
|
2020-05-02 21:20:48 +00:00
|
|
|
!(sop->controller) ||
|
2020-05-01 15:10:48 +00:00
|
|
|
((Player[screenpeek].sop_control == sop) &&
|
|
|
|
!Player[screenpeek].sop_remote)))
|
2020-05-01 13:35:46 +00:00
|
|
|
continue;
|
|
|
|
|
2020-05-26 18:27:14 +00:00
|
|
|
int32_t ratio = smoothratio * synctics + 65536 * interp->tic;
|
|
|
|
ratio /= interp->lasttic;
|
|
|
|
ratio = (interp->tic == interp->lasttic) ? 65536 : ratio;
|
|
|
|
|
2020-05-01 09:28:49 +00:00
|
|
|
for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++)
|
|
|
|
{
|
2020-05-26 19:09:31 +00:00
|
|
|
// Hack for jittery coolies in level 1's train.
|
|
|
|
// Based in idea on code from draw.cpp:analyzesprites.
|
|
|
|
// TODO: It could be better. In particular, it could be better
|
|
|
|
// to conditionally disable the interpolation from analyzesprites
|
|
|
|
// instead, using TSPRITE info if possible.
|
2020-11-26 17:14:29 +00:00
|
|
|
if (data->curelement >= soi_sprx)
|
2020-05-26 19:09:31 +00:00
|
|
|
{
|
2020-11-26 17:14:29 +00:00
|
|
|
int32_t sprnum = data->curelement & soi_base;
|
2020-05-26 19:09:31 +00:00
|
|
|
USERp u = User[sprnum];
|
|
|
|
if (u && (sprite[sprnum].statnum != STAT_DEFAULT) &&
|
|
|
|
((TEST(u->Flags, SPR_SKIP4) && (sprite[sprnum].statnum <= STAT_SKIP4_INTERP_END)) ||
|
|
|
|
(TEST(u->Flags, SPR_SKIP2) && (sprite[sprnum].statnum <= STAT_SKIP2_INTERP_END))))
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-05-01 09:28:49 +00:00
|
|
|
if (data->spriteofang >= 0)
|
2021-01-04 11:36:54 +00:00
|
|
|
sprite[data->spriteofang].ang = NORM_ANGLE(data->lastoldipos + MulScale(data->lastangdiff, ratio, 16));
|
2020-05-01 09:28:49 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
delta = data->lastipos - data->lastoldipos;
|
2021-01-04 11:36:54 +00:00
|
|
|
getvalue(data->curelement) = data->lastoldipos + MulScale(delta, ratio, 16);
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void so_restoreinterpolations(void) // Stick at end of drawscreen
|
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
SECTOR_OBJECTp sop;
|
|
|
|
so_interp *interp;
|
|
|
|
so_interp::interp_data *data;
|
|
|
|
|
|
|
|
for (sop = SectorObject, interp = so_interpdata;
|
|
|
|
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
|
|
|
{
|
2020-11-30 22:40:16 +00:00
|
|
|
bool skip = !SyncInput() && (sop->track == SO_TURRET);
|
2020-09-10 09:56:13 +00:00
|
|
|
if (SO_EMPTY(sop) || skip)
|
2020-05-01 09:28:49 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++)
|
|
|
|
if (data->spriteofang >= 0)
|
2020-11-26 17:14:29 +00:00
|
|
|
sprite[data->spriteofang].ang = data->bakipos;
|
2020-05-01 09:28:49 +00:00
|
|
|
else
|
2020-11-26 17:14:29 +00:00
|
|
|
getvalue(data->curelement) = data->bakipos;
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int SaveSymDataInfo(MFILE_WRITE fil, void *ptr);
|
|
|
|
|
2020-09-09 18:32:24 +00:00
|
|
|
int so_writeinterpolations(MFILE_WRITE fil)
|
2020-05-01 09:28:49 +00:00
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
SECTOR_OBJECTp sop;
|
2020-05-21 14:25:41 +00:00
|
|
|
so_interp *interp;
|
2020-09-09 18:28:05 +00:00
|
|
|
int saveisshot = 0;
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
for (sop = SectorObject, interp = so_interpdata;
|
|
|
|
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
|
|
|
{
|
2020-05-21 14:25:41 +00:00
|
|
|
so_interp::interp_data *data = interp->data;
|
2020-05-01 09:28:49 +00:00
|
|
|
MWRITE(&interp->numinterpolations,sizeof(interp->numinterpolations),1,fil);
|
2020-05-21 18:42:48 +00:00
|
|
|
MWRITE(&interp->hasvator,sizeof(interp->hasvator),1,fil);
|
2020-05-01 09:28:49 +00:00
|
|
|
for (i = 0; i < interp->numinterpolations; i++, data++)
|
|
|
|
{
|
2020-11-26 17:14:29 +00:00
|
|
|
MWRITE(&data->curelement, sizeof(data->curelement), 1, fil);
|
2020-05-01 09:28:49 +00:00
|
|
|
MWRITE(&data->oldipos,sizeof(data->oldipos),1,fil);
|
|
|
|
MWRITE(&data->spriteofang,sizeof(data->spriteofang),1,fil);
|
|
|
|
}
|
|
|
|
}
|
2020-09-09 18:32:24 +00:00
|
|
|
return saveisshot;
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
|
|
|
|
2020-09-09 18:28:05 +00:00
|
|
|
int LoadSymDataInfo(MFILE_READ fil, void** ptr);
|
2020-05-01 09:28:49 +00:00
|
|
|
|
2020-09-09 18:32:24 +00:00
|
|
|
int so_readinterpolations(MFILE_READ fil)
|
2020-05-01 09:28:49 +00:00
|
|
|
{
|
|
|
|
int32_t i;
|
|
|
|
SECTOR_OBJECTp sop;
|
|
|
|
so_interp *interp;
|
2020-09-09 18:28:05 +00:00
|
|
|
int saveisshot = 0;
|
2020-05-01 09:28:49 +00:00
|
|
|
|
|
|
|
for (sop = SectorObject, interp = so_interpdata;
|
|
|
|
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
|
|
|
|
{
|
|
|
|
so_interp::interp_data *data = interp->data;
|
|
|
|
MREAD(&interp->numinterpolations,sizeof(interp->numinterpolations),1,fil);
|
2020-05-21 18:42:48 +00:00
|
|
|
MREAD(&interp->hasvator,sizeof(interp->hasvator),1,fil);
|
2020-05-01 09:28:49 +00:00
|
|
|
for (i = 0; i < interp->numinterpolations; i++, data++)
|
|
|
|
{
|
2020-11-26 17:14:29 +00:00
|
|
|
MREAD(&data->curelement, sizeof(data->curelement), 1, fil);
|
2020-05-01 09:28:49 +00:00
|
|
|
MREAD(&data->oldipos,sizeof(data->oldipos),1,fil);
|
|
|
|
MREAD(&data->spriteofang,sizeof(data->spriteofang),1,fil);
|
|
|
|
data->lastipos = data->lastoldipos = data->oldipos;
|
|
|
|
data->lastangdiff = 0;
|
|
|
|
}
|
|
|
|
interp->tic = 0;
|
|
|
|
interp->lasttic = synctics;
|
|
|
|
}
|
2020-09-09 18:32:24 +00:00
|
|
|
return saveisshot;
|
2020-05-01 09:28:49 +00:00
|
|
|
}
|
2020-05-21 14:25:41 +00:00
|
|
|
|
|
|
|
END_SW_NS
|