SW: Let's make use of interpso.*. Still need to do a few more things.

This commit is contained in:
NY00123 2020-05-01 14:29:12 +03:00 committed by Christoph Oelckers
parent 2b1e32bf3d
commit 221172311c
7 changed files with 36 additions and 49 deletions

View file

@ -53,6 +53,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "text.h" #include "text.h"
#include "menus.h" #include "menus.h"
#include "interp.h" #include "interp.h"
#include "interpso.h"
#include "sector.h" #include "sector.h"
#include "config.h" #include "config.h"
#include "menu/menu.h" #include "menu/menu.h"
@ -2033,6 +2034,8 @@ drawscreen(PLAYERp pp)
{ {
dointerpolations(smoothratio); // Stick at beginning of drawscreen dointerpolations(smoothratio); // Stick at beginning of drawscreen
short_dointerpolations(smoothratio); // Stick at beginning of drawscreen short_dointerpolations(smoothratio); // Stick at beginning of drawscreen
if (gs.InterpolateSO)
so_dointerpolations(smoothratio); // Stick at beginning of drawscreen
} }
// TENSW: when rendering with prediction, the only thing that counts should // TENSW: when rendering with prediction, the only thing that counts should
@ -2050,7 +2053,7 @@ drawscreen(PLAYERp pp)
tq16ang = camerapp->oq16ang + mulscale16(NORM_Q16ANGLE(camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) - fix16_from_int(1024), smoothratio); tq16ang = camerapp->oq16ang + mulscale16(NORM_Q16ANGLE(camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) - fix16_from_int(1024), smoothratio);
tq16horiz = camerapp->oq16horiz + mulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio); tq16horiz = camerapp->oq16horiz + mulscale16(camerapp->q16horiz - camerapp->oq16horiz, smoothratio);
} }
else if (InterpolateSectObj) else if (gs.InterpolateSO)
{ {
tq16ang = camerapp->oq16ang + mulscale16(((pp->camq16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio); tq16ang = camerapp->oq16ang + mulscale16(((pp->camq16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), smoothratio);
tq16horiz = camerapp->oq16horiz + mulscale16(pp->camq16horiz - camerapp->oq16horiz, smoothratio); tq16horiz = camerapp->oq16horiz + mulscale16(pp->camq16horiz - camerapp->oq16horiz, smoothratio);
@ -2092,7 +2095,7 @@ drawscreen(PLAYERp pp)
if (pp->sop_riding || pp->sop_control) if (pp->sop_riding || pp->sop_control)
{ {
if (pp->sop_control && !InterpolateSectObj) if (pp->sop_control && !gs.InterpolateSO)
{ {
tx = pp->posx; tx = pp->posx;
ty = pp->posy; ty = pp->posy;
@ -2318,6 +2321,8 @@ drawscreen(PLAYERp pp)
restoreinterpolations(); // Stick at end of drawscreen restoreinterpolations(); // Stick at end of drawscreen
short_restoreinterpolations(); // Stick at end of drawscreen short_restoreinterpolations(); // Stick at end of drawscreen
if (gs.InterpolateSO)
so_restoreinterpolations(); // Stick at end of drawscreen
PostDraw(); PostDraw();
DrawScreen = FALSE; DrawScreen = FALSE;

View file

@ -53,6 +53,7 @@ Things required to make savegames work:
#include "panel.h" #include "panel.h"
#include "game.h" #include "game.h"
#include "interp.h" #include "interp.h"
#include "interpso.h"
#include "tags.h" #include "tags.h"
#include "sector.h" #include "sector.h"
#include "sprite.h" #include "sprite.h"
@ -185,7 +186,6 @@ SWBOOL NoDemoStartup = FALSE;
SWBOOL FirstTimeIntoGame; SWBOOL FirstTimeIntoGame;
SWBOOL PedanticMode; SWBOOL PedanticMode;
SWBOOL InterpolateSectObj;
SWBOOL BorderAdjust = FALSE; SWBOOL BorderAdjust = FALSE;
SWBOOL LocationInfo = 0; SWBOOL LocationInfo = 0;
@ -957,7 +957,6 @@ void InitLevelGlobals(void)
memset(BossSpriteNum,-1,sizeof(BossSpriteNum)); memset(BossSpriteNum,-1,sizeof(BossSpriteNum));
PedanticMode = (DemoPlaying || DemoRecording || DemoEdit || DemoMode); PedanticMode = (DemoPlaying || DemoRecording || DemoEdit || DemoMode);
InterpolateSectObj = !CommEnabled && !PedanticMode;
} }
void InitLevelGlobals2(void) void InitLevelGlobals2(void)

View file

@ -189,7 +189,6 @@ int krand1(void);
#include "pragmas.h" #include "pragmas.h"
extern SWBOOL PedanticMode; extern SWBOOL PedanticMode;
extern SWBOOL InterpolateSectObj;
// //
// Map directions/degrees // Map directions/degrees

View file

@ -62,6 +62,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "vis.h" #include "vis.h"
#include "track.h" #include "track.h"
#include "interp.h" #include "interp.h"
#include "interpso.h"
#include "menu/menu.h" #include "menu/menu.h"
#include "gstrings.h" #include "gstrings.h"
#include "z_music.h" #include "z_music.h"
@ -7952,6 +7953,7 @@ domovethings(void)
updateinterpolations(); // Stick at beginning of domovethings updateinterpolations(); // Stick at beginning of domovethings
short_updateinterpolations(); // Stick at beginning of domovethings short_updateinterpolations(); // Stick at beginning of domovethings
so_updateinterpolations(); // Stick at beginning of domovethings
MoveSkipSavePos(); MoveSkipSavePos();
#if 0 #if 0

View file

@ -41,6 +41,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "sounds.h" #include "sounds.h"
#include "interp.h" #include "interp.h"
#include "interpso.h"
#include "sprite.h" #include "sprite.h"
#include "weapon.h" #include "weapon.h"
#include "jsector.h" #include "jsector.h"
@ -692,6 +693,7 @@ KillSprite(int16_t SpriteNum)
sn--; sn--;
ASSERT(sop->sp_num[sn] >= 0); ASSERT(sop->sp_num[sn] >= 0);
so_stopspriteinterpolation(sop, sp);
// replace the one to be deleted with the last ndx // replace the one to be deleted with the last ndx
sop->sp_num[FoundSpriteNdx] = sop->sp_num[sn]; sop->sp_num[FoundSpriteNdx] = sop->sp_num[sn];
// the last ndx is not -1 // the last ndx is not -1

View file

@ -34,7 +34,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ai.h" #include "ai.h"
#include "player.h" #include "player.h"
#include "game.h" #include "game.h"
#include "interp.h" #include "interpso.h"
#include "network.h" #include "network.h"
#include "sprite.h" #include "sprite.h"
#include "track.h" #include "track.h"
@ -849,7 +849,6 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// //
// Make sure every sector object has an outer loop tagged - important // Make sure every sector object has an outer loop tagged - important
// Further setup interpolation
// //
FoundOutsideLoop = FALSE; FoundOutsideLoop = FALSE;
@ -862,21 +861,6 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// move all walls in sectors // move all walls in sectors
for (k = startwall; k <= endwall; k++) for (k = startwall; k <= endwall; k++)
{ {
uint16_t const nextwall = wall[k].nextwall;
// setup interpolation
if (InterpolateSectObj)
{
setinterpolation(&wall[k].x);
setinterpolation(&wall[k].y);
if (nextwall < MAXWALLS)
{
setinterpolation(&wall[wall[nextwall].point2].x);
setinterpolation(&wall[wall[nextwall].point2].y);
}
}
// for morph point - tornado style // for morph point - tornado style
if (wall[k].lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT) if (wall[k].lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT)
sop->morph_wall_point = k; sop->morph_wall_point = k;
@ -886,16 +870,10 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// each wall has this set - for collision detection // each wall has this set - for collision detection
SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK); SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
uint16_t const nextwall = wall[k].nextwall;
if (nextwall < MAXWALLS) if (nextwall < MAXWALLS)
SET(wall[nextwall].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK); SET(wall[nextwall].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
} }
// interpolate floor and ceiling
if (InterpolateSectObj && (k != startwall))
{
setinterpolation(&(*sectp)->ceilingz);
setinterpolation(&(*sectp)->floorz);
}
} }
if (!FoundOutsideLoop) if (!FoundOutsideLoop)
@ -903,13 +881,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
I_Error("Forgot to tag outer loop for Sector Object #%d", (int)(sop - SectorObject)); I_Error("Forgot to tag outer loop for Sector Object #%d", (int)(sop - SectorObject));
} }
// interpolate midpoint, for aiming at a remote controlled SO so_addinterpolation(sop);
if (InterpolateSectObj)
{
setinterpolation(&sop->xmid);
setinterpolation(&sop->ymid);
setinterpolation(&sop->zmid);
}
for (i = 0; i < (int)SIZ(StatList); i++) for (i = 0; i < (int)SIZ(StatList); i++)
{ {
@ -1003,8 +975,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
ASSERT(sn < SIZ(sop->sp_num) - 1); ASSERT(sn < SIZ(sop->sp_num) - 1);
sop->sp_num[sn] = sp_num; sop->sp_num[sn] = sp_num;
if (InterpolateSectObj) so_setspriteinterpolation(sop, sp);
setspriteinterpolation(sp);
if (!TEST(sop->flags, SOBJ_SPRITE_OBJ)) if (!TEST(sop->flags, SOBJ_SPRITE_OBJ))
@ -1665,7 +1636,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
if (TEST(sop->flags, SOBJ_DONT_ROTATE)) if (TEST(sop->flags, SOBJ_DONT_ROTATE))
{ {
if (!InterpolateSectObj) if (!gs.InterpolateSO)
{ {
pp->oposx = pp->posx; pp->oposx = pp->posx;
pp->oposy = pp->posy; pp->oposy = pp->posy;
@ -1715,7 +1686,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang); pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang);
pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + fix16_from_int(pp->RevolveDeltaAng)); pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + fix16_from_int(pp->RevolveDeltaAng));
if (!InterpolateSectObj) if (!gs.InterpolateSO)
{ {
pp->oq16ang = pp->q16ang; pp->oq16ang = pp->q16ang;
pp->oposx = pp->posx; pp->oposx = pp->posx;
@ -1975,7 +1946,7 @@ PlayerPart:
pp->SpriteP->z = pp->loz; pp->SpriteP->z = pp->loz;
} }
} }
if (!InterpolateSectObj) if (!gs.InterpolateSO)
pp->oposz = pp->posz; pp->oposz = pp->posz;
} }
else else
@ -2091,8 +2062,7 @@ void KillSectorObjectSprites(SECTOR_OBJECTp sop)
if (sp->picnum == ST1 && sp->hitag == SPAWN_SPOT) if (sp->picnum == ST1 && sp->hitag == SPAWN_SPOT)
continue; continue;
if (InterpolateSectObj) so_stopspriteinterpolation(sop, sp);
stopspriteinterpolation(sp);
KillSprite(sop->sp_num[i]); KillSprite(sop->sp_num[i]);
} }
@ -2397,6 +2367,8 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics)
short speed; short speed;
short delta_ang; short delta_ang;
so_setinterpolationtics(sop, locktics);
if (sop->track >= SO_OPERATE_TRACK_START) if (sop->track >= SO_OPERATE_TRACK_START)
{ {
if (TEST(sop->flags, SOBJ_UPDATE_ONCE)) if (TEST(sop->flags, SOBJ_UPDATE_ONCE))
@ -2817,7 +2789,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
void void
OperateSectorObject(SECTOR_OBJECTp sop, short newang, int newx, int newy) OperateSectorObjectForTics(SECTOR_OBJECTp sop, short newang, int newx, int newy, short locktics)
{ {
int i; int i;
SECTORp *sectp; SECTORp *sectp;
@ -2828,6 +2800,8 @@ OperateSectorObject(SECTOR_OBJECTp sop, short newang, int newx, int newy)
if (sop->track < SO_OPERATE_TRACK_START) if (sop->track < SO_OPERATE_TRACK_START)
return; return;
so_setinterpolationtics(sop, locktics);
if (sop->bob_amt) if (sop->bob_amt)
{ {
sop->bob_sine_ndx = (totalsynctics << sop->bob_speed) & 2047; sop->bob_sine_ndx = (totalsynctics << sop->bob_speed) & 2047;
@ -2854,9 +2828,16 @@ OperateSectorObject(SECTOR_OBJECTp sop, short newang, int newx, int newy)
RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE); RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE);
} }
void
OperateSectorObject(SECTOR_OBJECTp sop, short newang, int newx, int newy)
{
OperateSectorObjectForTics(sop, newang, newx, newy, synctics);
}
void void
PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy) PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy)
{ {
so_setinterpolationtics(sop, synctics);
RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE); RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE);
} }
@ -3079,7 +3060,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop)
} }
} }
OperateSectorObject(sop, sop->ang, sop->xmid, sop->ymid); OperateSectorObjectForTics(sop, sop->ang, sop->xmid, sop->ymid, 2*synctics);
} }
} }

View file

@ -32,6 +32,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "panel.h" #include "panel.h"
#include "game.h" #include "game.h"
#include "interp.h" #include "interp.h"
#include "interpso.h"
#include "tags.h" #include "tags.h"
#include "common_game.h" #include "common_game.h"
#include "break.h" #include "break.h"
@ -11393,8 +11394,7 @@ AddSpriteToSectorObject(short SpriteNum, SECTOR_OBJECTp sop)
ASSERT(sn < SIZ(sop->sp_num) - 1); ASSERT(sn < SIZ(sop->sp_num) - 1);
sop->sp_num[sn] = SpriteNum; sop->sp_num[sn] = SpriteNum;
if (InterpolateSectObj) so_setspriteinterpolation(sop, sp);
setspriteinterpolation(sp);
SET(u->Flags, SPR_ON_SO_SECTOR|SPR_SO_ATTACHED); SET(u->Flags, SPR_ON_SO_SECTOR|SPR_SO_ATTACHED);
@ -11461,8 +11461,7 @@ SpawnBigGunFlames(int16_t Weapon, int16_t Operator, SECTOR_OBJECTp sop)
ASSERT(sn < SIZ(sop->sp_num) - 1); ASSERT(sn < SIZ(sop->sp_num) - 1);
sop->sp_num[sn] = explosion; sop->sp_num[sn] = explosion;
if (InterpolateSectObj) so_setspriteinterpolation(sop, exp);
setspriteinterpolation(exp);
// Place sprite exactly where shoot point is // Place sprite exactly where shoot point is
//exp->x = eu->ox = sop->xmid - u->sx; //exp->x = eu->ox = sop->xmid - u->sx;