Commit 95485ac5 authored by NY00123's avatar NY00123 Committed by Evan Ramos
Browse files

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

parent b7dbf622
......@@ -52,6 +52,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "text.h"
#include "menus.h"
#include "interp.h"
#include "interpso.h"
#include "sector.h"
#include "config.h"
......@@ -2333,6 +2334,8 @@ drawscreen(PLAYERp pp)
{
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
......@@ -2350,7 +2353,7 @@ drawscreen(PLAYERp pp)
tq16ang = camerapp->oq16ang + mulscale16(((camerapp->q16ang + fix16_from_int(1024) - camerapp->oq16ang) & 0x7FFFFFF) - fix16_from_int(1024), 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);
tq16horiz = camerapp->oq16horiz + mulscale16(pp->camq16horiz - camerapp->oq16horiz, smoothratio);
......@@ -2392,7 +2395,7 @@ drawscreen(PLAYERp pp)
if (pp->sop_riding || pp->sop_control)
{
if (pp->sop_control && !InterpolateSectObj)
if (pp->sop_control && !gs.InterpolateSO)
{
tx = pp->posx;
ty = pp->posy;
......@@ -2614,6 +2617,8 @@ drawscreen(PLAYERp pp)
restoreinterpolations(); // Stick at end of drawscreen
short_restoreinterpolations(); // Stick at end of drawscreen
if (gs.InterpolateSO)
so_restoreinterpolations(); // Stick at end of drawscreen
PostDraw();
DrawScreen = FALSE;
......
......@@ -52,6 +52,7 @@ Things required to make savegames work:
#include "panel.h"
#include "game.h"
#include "interp.h"
#include "interpso.h"
#include "tags.h"
#include "sector.h"
#include "sprite.h"
......@@ -171,7 +172,6 @@ SWBOOL FirstTimeIntoGame;
extern uint8_t RedBookSong[40];
SWBOOL PedanticMode;
SWBOOL InterpolateSectObj;
SWBOOL BorderAdjust = TRUE;
SWBOOL LocationInfo = 0;
......@@ -1307,7 +1307,6 @@ void InitLevelGlobals(void)
memset(BossSpriteNum,-1,sizeof(BossSpriteNum));
PedanticMode = (DemoPlaying || DemoRecording || DemoEdit || DemoMode);
InterpolateSectObj = !CommEnabled && !PedanticMode;
}
void InitLevelGlobals2(void)
......
......@@ -115,7 +115,6 @@ int krand1(void);
#include "pragmas.h"
extern SWBOOL PedanticMode;
extern SWBOOL InterpolateSectObj;
//
// Map directions/degrees
......
......@@ -63,6 +63,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "vis.h"
#include "track.h"
#include "interp.h"
#include "interpso.h"
#define SO_DRIVE_SOUND 2
......@@ -8017,6 +8018,7 @@ domovethings(void)
updateinterpolations(); // Stick at beginning of domovethings
short_updateinterpolations(); // Stick at beginning of domovethings
so_updateinterpolations(); // Stick at beginning of domovethings
MoveSkipSavePos();
#if 0
......
......@@ -40,6 +40,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "sounds.h"
#include "interp.h"
#include "interpso.h"
#include "sprite.h"
#include "weapon.h"
#include "jsector.h"
......@@ -647,6 +648,7 @@ KillSprite(int16_t SpriteNum)
sn--;
ASSERT(sop->sp_num[sn] >= 0);
so_stopspriteinterpolation(sop, sp);
// replace the one to be deleted with the last ndx
sop->sp_num[FoundSpriteNdx] = sop->sp_num[sn];
// the last ndx is not -1
......
......@@ -33,7 +33,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "ai.h"
#include "player.h"
#include "game.h"
#include "interp.h"
#include "interpso.h"
#include "network.h"
#include "sprite.h"
#include "track.h"
......@@ -842,7 +842,6 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
//
// Make sure every sector object has an outer loop tagged - important
// Further setup interpolation
//
FoundOutsideLoop = FALSE;
......@@ -855,21 +854,6 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// move all walls in sectors
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
if (wall[k].lotag == TAG_WALL_ALIGN_SLOPE_TO_POINT)
sop->morph_wall_point = k;
......@@ -879,16 +863,10 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// each wall has this set - for collision detection
SET(wall[k].extra, WALLFX_SECTOR_OBJECT|WALLFX_DONT_STICK);
uint16_t const nextwall = wall[k].nextwall;
if (nextwall < MAXWALLS)
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)
......@@ -898,13 +876,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
exit(1);
}
// interpolate midpoint, for aiming at a remote controlled SO
if (InterpolateSectObj)
{
setinterpolation(&sop->xmid);
setinterpolation(&sop->ymid);
setinterpolation(&sop->zmid);
}
so_addinterpolation(sop);
for (i = 0; i < (int)SIZ(StatList); i++)
{
......@@ -998,8 +970,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
ASSERT(sn < SIZ(sop->sp_num) - 1);
sop->sp_num[sn] = sp_num;
if (InterpolateSectObj)
setspriteinterpolation(sp);
so_setspriteinterpolation(sop, sp);
if (!TEST(sop->flags, SOBJ_SPRITE_OBJ))
......@@ -1660,7 +1631,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
if (TEST(sop->flags, SOBJ_DONT_ROTATE))
{
if (!InterpolateSectObj)
if (!gs.InterpolateSO)
{
pp->oposx = pp->posx;
pp->oposy = pp->posy;
......@@ -1710,7 +1681,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
pp->camq16ang = NORM_Q16ANGLE(pp->camq16ang);
pp->q16ang = NORM_Q16ANGLE(pp->RevolveQ16Ang + fix16_from_int(pp->RevolveDeltaAng));
if (!InterpolateSectObj)
if (!gs.InterpolateSO)
{
pp->oq16ang = pp->q16ang;
pp->oposx = pp->posx;
......@@ -1970,7 +1941,7 @@ PlayerPart:
pp->SpriteP->z = pp->loz;
}
}
if (!InterpolateSectObj)
if (!gs.InterpolateSO)
pp->oposz = pp->posz;
}
else
......@@ -2087,8 +2058,7 @@ void KillSectorObjectSprites(SECTOR_OBJECTp sop)
if (sp->picnum == ST1 && sp->hitag == SPAWN_SPOT)
continue;
if (InterpolateSectObj)
stopspriteinterpolation(sp);
so_stopspriteinterpolation(sop, sp);
KillSprite(sop->sp_num[i]);
}
......@@ -2393,6 +2363,8 @@ MoveSectorObjects(SECTOR_OBJECTp sop, short locktics)
short speed;
short delta_ang;
so_setinterpolationtics(sop, locktics);
if (sop->track >= SO_OPERATE_TRACK_START)
{
if (TEST(sop->flags, SOBJ_UPDATE_ONCE))
......@@ -2813,7 +2785,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
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;
SECTORp *sectp;
......@@ -2824,6 +2796,8 @@ OperateSectorObject(SECTOR_OBJECTp sop, short newang, int newx, int newy)
if (sop->track < SO_OPERATE_TRACK_START)
return;
so_setinterpolationtics(sop, locktics);
if (sop->bob_amt)
{
sop->bob_sine_ndx = (totalsynctics << sop->bob_speed) & 2047;
......@@ -2850,9 +2824,16 @@ OperateSectorObject(SECTOR_OBJECTp sop, short newang, int newx, int newy)
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
PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy)
{
so_setinterpolationtics(sop, synctics);
RefreshPoints(sop, newx - sop->xmid, newy - sop->ymid, FALSE);
}
......@@ -3075,7 +3056,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop)
}
}
OperateSectorObject(sop, sop->ang, sop->xmid, sop->ymid);
OperateSectorObjectForTics(sop, sop->ang, sop->xmid, sop->ymid, 2*synctics);
}
}
......
......@@ -31,6 +31,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "panel.h"
#include "game.h"
#include "interp.h"
#include "interpso.h"
#include "tags.h"
#include "common_game.h"
#include "break.h"
......@@ -11384,8 +11385,7 @@ AddSpriteToSectorObject(short SpriteNum, SECTOR_OBJECTp sop)
 
ASSERT(sn < SIZ(sop->sp_num) - 1);
sop->sp_num[sn] = SpriteNum;
if (InterpolateSectObj)
setspriteinterpolation(sp);
so_setspriteinterpolation(sop, sp);
 
SET(u->Flags, SPR_ON_SO_SECTOR|SPR_SO_ATTACHED);
 
......@@ -11452,8 +11452,7 @@ SpawnBigGunFlames(int16_t Weapon, int16_t Operator, SECTOR_OBJECTp sop)
 
ASSERT(sn < SIZ(sop->sp_num) - 1);
sop->sp_num[sn] = explosion;
if (InterpolateSectObj)
setspriteinterpolation(exp);
so_setspriteinterpolation(sop, exp);
 
// Place sprite exactly where shoot point is
//exp->x = eu->ox = sop->xmid - u->sx;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment