Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Jisk/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
117 results
Select Git revision
Show changes
Commits on Source (71)
...@@ -156,7 +156,7 @@ ifdef DEBUGMODE ...@@ -156,7 +156,7 @@ ifdef DEBUGMODE
ifdef GCC48 ifdef GCC48
opts+=-Og opts+=-Og
else else
opts+=O0 opts+=-O0
endif endif
endif endif
......
...@@ -55,6 +55,7 @@ tables.c ...@@ -55,6 +55,7 @@ tables.c
r_bsp.c r_bsp.c
r_data.c r_data.c
r_draw.c r_draw.c
r_fps.c
r_main.c r_main.c
r_plane.c r_plane.c
r_segs.c r_segs.c
......
...@@ -88,6 +88,12 @@ tic_t I_GetTime(void) ...@@ -88,6 +88,12 @@ tic_t I_GetTime(void)
return (since_start*TICRATE)/1000000; return (since_start*TICRATE)/1000000;
} }
fixed_t I_GetTimeFrac(void)
{
//stub
return 0;
}
void I_Sleep(void){} void I_Sleep(void){}
void I_GetEvent(void){} void I_GetEvent(void){}
......
...@@ -579,7 +579,7 @@ void B_RespawnBot(INT32 playernum) ...@@ -579,7 +579,7 @@ void B_RespawnBot(INT32 playernum)
player->powers[pw_nocontrol] = sonic->player->powers[pw_nocontrol]; player->powers[pw_nocontrol] = sonic->player->powers[pw_nocontrol];
player->pflags |= PF_AUTOBRAKE|(sonic->player->pflags & PF_DIRECTIONCHAR); player->pflags |= PF_AUTOBRAKE|(sonic->player->pflags & PF_DIRECTIONCHAR);
P_TeleportMove(tails, x, y, z); P_SetOrigin(tails, x, y, z);
if (player->charability == CA_FLY) if (player->charability == CA_FLY)
{ {
P_SetPlayerMobjState(tails, S_PLAY_FLY); P_SetPlayerMobjState(tails, S_PLAY_FLY);
......
...@@ -2076,9 +2076,10 @@ void CV_AddValue(consvar_t *var, INT32 increment) ...@@ -2076,9 +2076,10 @@ void CV_AddValue(consvar_t *var, INT32 increment)
{ {
increment = 0; increment = 0;
currentindice = max; currentindice = max;
break; // The value we definitely want, stop here.
} }
else if (var->PossibleValue[max].value == var->value) else if (var->PossibleValue[max].value == var->value)
currentindice = max; currentindice = max; // The value we maybe want.
} }
if (increment) if (increment)
......
...@@ -5206,8 +5206,10 @@ static void SV_Maketic(void) ...@@ -5206,8 +5206,10 @@ static void SV_Maketic(void)
maketic++; maketic++;
} }
void TryRunTics(tic_t realtics) boolean TryRunTics(tic_t realtics)
{ {
boolean ticking;
// the machine has lagged but it is not so bad // the machine has lagged but it is not so bad
if (realtics > TICRATE/7) // FIXME: consistency failure!! if (realtics > TICRATE/7) // FIXME: consistency failure!!
{ {
...@@ -5231,7 +5233,7 @@ void TryRunTics(tic_t realtics) ...@@ -5231,7 +5233,7 @@ void TryRunTics(tic_t realtics)
if (demoplayback) if (demoplayback)
{ {
neededtic = gametic + (realtics * cv_playbackspeed.value); neededtic = gametic + realtics;
// start a game after a demo // start a game after a demo
maketic += realtics; maketic += realtics;
firstticstosend = maketic; firstticstosend = maketic;
...@@ -5251,10 +5253,14 @@ void TryRunTics(tic_t realtics) ...@@ -5251,10 +5253,14 @@ void TryRunTics(tic_t realtics)
} }
#endif #endif
ticking = neededtic > gametic;
if (player_joining) if (player_joining)
return; {
return false;
}
if (neededtic > gametic) if (ticking)
{ {
if (advancedemo) if (advancedemo)
{ {
...@@ -5290,6 +5296,8 @@ void TryRunTics(tic_t realtics) ...@@ -5290,6 +5296,8 @@ void TryRunTics(tic_t realtics)
break; break;
} }
} }
return ticking;
} }
/* /*
......
...@@ -430,7 +430,7 @@ boolean Playing(void); ...@@ -430,7 +430,7 @@ boolean Playing(void);
void D_QuitNetGame(void); void D_QuitNetGame(void);
//? How many ticks to run? //? How many ticks to run?
void TryRunTics(tic_t realtic); boolean TryRunTics(tic_t realtic);
// extra data for lmps // extra data for lmps
// these functions scare me. they contain magic. // these functions scare me. they contain magic.
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include "deh_tables.h" // Dehacked list test #include "deh_tables.h" // Dehacked list test
#include "m_cond.h" // condition initialization #include "m_cond.h" // condition initialization
#include "fastcmp.h" #include "fastcmp.h"
#include "r_fps.h" // Frame interpolation/uncapped
#include "keys.h" #include "keys.h"
#include "filesrch.h" // refreshdirmenu #include "filesrch.h" // refreshdirmenu
#include "g_input.h" // tutorial mode control scheming #include "g_input.h" // tutorial mode control scheming
...@@ -296,17 +297,17 @@ gamestate_t wipegamestate = GS_LEVEL; ...@@ -296,17 +297,17 @@ gamestate_t wipegamestate = GS_LEVEL;
INT16 wipetypepre = -1; INT16 wipetypepre = -1;
INT16 wipetypepost = -1; INT16 wipetypepost = -1;
static void D_Display(void) static boolean D_Display(void)
{ {
boolean forcerefresh = false; boolean forcerefresh = false;
static boolean wipe = false; static boolean wipe = false;
INT32 wipedefindex = 0; INT32 wipedefindex = 0;
if (dedicated) if (dedicated)
return; return false;
if (nodrawers) if (nodrawers)
return; // for comparative timing/profiling return false; // for comparative timing/profiling
// Lactozilla: Switching renderers works by checking // Lactozilla: Switching renderers works by checking
// if the game has to do it right when the frame // if the game has to do it right when the frame
...@@ -476,6 +477,7 @@ static void D_Display(void) ...@@ -476,6 +477,7 @@ static void D_Display(void)
if (!automapactive && !dedicated && cv_renderview.value) if (!automapactive && !dedicated && cv_renderview.value)
{ {
R_ApplyLevelInterpolators(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
PS_START_TIMING(ps_rendercalltime); PS_START_TIMING(ps_rendercalltime);
if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD)
{ {
...@@ -524,6 +526,7 @@ static void D_Display(void) ...@@ -524,6 +526,7 @@ static void D_Display(void)
V_DoPostProcessor(1, postimgtype2, postimgparam2); V_DoPostProcessor(1, postimgtype2, postimgparam2);
} }
PS_STOP_TIMING(ps_rendercalltime); PS_STOP_TIMING(ps_rendercalltime);
R_RestoreLevelInterpolators();
} }
if (lastdraw) if (lastdraw)
...@@ -678,10 +681,10 @@ static void D_Display(void) ...@@ -678,10 +681,10 @@ static void D_Display(void)
M_DrawPerfStats(); M_DrawPerfStats();
} }
PS_START_TIMING(ps_swaptime); return true; // Do I_FinishUpdate in the main loop
I_FinishUpdate(); // page flip or blit buffer
PS_STOP_TIMING(ps_swaptime);
} }
return false;
} }
// ========================================================================= // =========================================================================
...@@ -695,6 +698,13 @@ void D_SRB2Loop(void) ...@@ -695,6 +698,13 @@ void D_SRB2Loop(void)
tic_t oldentertics = 0, entertic = 0, realtics = 0, rendertimeout = INFTICS; tic_t oldentertics = 0, entertic = 0, realtics = 0, rendertimeout = INFTICS;
static lumpnum_t gstartuplumpnum; static lumpnum_t gstartuplumpnum;
boolean ticked = false;
boolean interp = false;
boolean doDisplay = false;
boolean screenUpdate = false;
double frameEnd = 0.0;
if (dedicated) if (dedicated)
server = true; server = true;
...@@ -756,7 +766,11 @@ void D_SRB2Loop(void) ...@@ -756,7 +766,11 @@ void D_SRB2Loop(void)
realtics = entertic - oldentertics; realtics = entertic - oldentertics;
oldentertics = entertic; oldentertics = entertic;
refreshdirmenu = 0; // not sure where to put this, here as good as any? if (demoplayback && gamestate == GS_LEVEL)
{
// Nicer place to put this.
realtics = realtics * cv_playbackspeed.value;
}
#ifdef DEBUGFILE #ifdef DEBUGFILE
if (!realtics) if (!realtics)
...@@ -764,53 +778,105 @@ void D_SRB2Loop(void) ...@@ -764,53 +778,105 @@ void D_SRB2Loop(void)
debugload--; debugload--;
#endif #endif
if (!realtics && !singletics) interp = R_UsingFrameInterpolation() && !dedicated;
{ doDisplay = screenUpdate = false;
I_Sleep(); ticked = false;
continue;
}
#ifdef HW3SOUND #ifdef HW3SOUND
HW3S_BeginFrameUpdate(); HW3S_BeginFrameUpdate();
#endif #endif
// don't skip more than 10 frames at a time refreshdirmenu = 0; // not sure where to put this, here as good as any?
// (fadein / fadeout cause massive frame skip!)
if (realtics > 8)
realtics = 1;
// process tics (but maybe not if realtic == 0)
TryRunTics(realtics);
if (lastdraw || singletics || gametic > rendergametic) if (realtics > 0 || singletics)
{ {
rendergametic = gametic; // don't skip more than 10 frames at a time
rendertimeout = entertic+TICRATE/17; // (fadein / fadeout cause massive frame skip!)
if (realtics > 8)
realtics = 1;
// process tics (but maybe not if realtic == 0)
ticked = TryRunTics(realtics);
// Update display, next frame, with current state. if (lastdraw || singletics || gametic > rendergametic)
D_Display(); {
rendergametic = gametic;
rendertimeout = entertic+TICRATE/17;
doDisplay = true;
}
else if (rendertimeout < entertic) // in case the server hang or netsplit
{
// Lagless camera! Yay!
if (gamestate == GS_LEVEL && netgame)
{
// Evaluate the chase cam once for every local realtic
// This might actually be better suited inside G_Ticker or TryRunTics
for (tic_t chasecamtics = 0; chasecamtics < realtics; chasecamtics++)
{
if (splitscreen && camera2.chase)
P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false);
if (camera.chase)
P_MoveChaseCamera(&players[displayplayer], &camera, false);
}
R_UpdateViewInterpolation();
}
if (moviemode) doDisplay = true;
M_SaveFrame(); }
if (takescreenshot) // Only take screenshots after drawing.
M_DoScreenShot();
} }
else if (rendertimeout < entertic) // in case the server hang or netsplit
if (interp)
{ {
// Lagless camera! Yay! static float tictime = 0.0f;
if (gamestate == GS_LEVEL && netgame) static float prevtime = 0.0f;
float entertime = I_GetTimeFrac();
fixed_t entertimefrac = FRACUNIT;
if (ticked)
{ {
if (splitscreen && camera2.chase) tictime = entertime;
P_MoveChaseCamera(&players[secondarydisplayplayer], &camera2, false);
if (camera.chase)
P_MoveChaseCamera(&players[displayplayer], &camera, false);
} }
D_Display();
if (moviemode) if (!(paused || P_AutoPause()))
M_SaveFrame(); {
if (takescreenshot) // Only take screenshots after drawing. #if 0
M_DoScreenShot(); CONS_Printf("prevtime = %f\n", prevtime);
CONS_Printf("entertime = %f\n", entertime);
CONS_Printf("tictime = %f\n", tictime);
CONS_Printf("entertime - prevtime = %f\n", entertime - prevtime);
CONS_Printf("entertime - tictime = %f\n", entertime - tictime);
CONS_Printf("========\n");
#endif
if (entertime - prevtime >= 1.0f)
{
// Lagged for more frames than a gametic...
// No need for interpolation.
entertimefrac = FRACUNIT;
}
else
{
entertimefrac = min(FRACUNIT, FLOAT_TO_FIXED(entertime - tictime));
}
// renderdeltatics is a bit awkard to evaluate, since the system time interface is whole tic-based
renderdeltatics = FloatToFixed(entertime - prevtime);
rendertimefrac = entertimefrac;
}
prevtime = entertime;
}
else
{
renderdeltatics = realtics * FRACUNIT;
rendertimefrac = FRACUNIT;
}
if (interp || doDisplay)
{
screenUpdate = D_Display();
} }
// consoleplayer -> displayplayer (hear sounds from viewpoint) // consoleplayer -> displayplayer (hear sounds from viewpoint)
...@@ -822,6 +888,33 @@ void D_SRB2Loop(void) ...@@ -822,6 +888,33 @@ void D_SRB2Loop(void)
#endif #endif
LUA_Step(); LUA_Step();
// Fully completed frame made.
frameEnd = I_GetFrameTime();
if (!singletics && !dedicated)
{
I_FrameCapSleep(frameEnd);
}
else if (dedicated)
{
// Preserve the pre-interp sleeping behavior for dedicated mode
I_Sleep();
}
// I_FinishUpdate is now here instead of D_Display,
// because it synchronizes it more closely with the frame counter.
if (screenUpdate == true)
{
PS_START_TIMING(ps_swaptime);
I_FinishUpdate(); // page flip or blit buffer
PS_STOP_TIMING(ps_swaptime);
}
// Only take screenshots after drawing.
if (moviemode)
M_SaveFrame();
if (takescreenshot)
M_DoScreenShot();
} }
} }
...@@ -1583,6 +1676,8 @@ void D_SRB2Main(void) ...@@ -1583,6 +1676,8 @@ void D_SRB2Main(void)
// as having been modified for the first game. // as having been modified for the first game.
M_PushSpecialParameters(); // push all "+" parameter at the command buffer M_PushSpecialParameters(); // push all "+" parameter at the command buffer
COM_BufExecute(); // ensure the command buffer gets executed before the map starts (+skin)
if (M_CheckParm("-gametype") && M_IsNextParm()) if (M_CheckParm("-gametype") && M_IsNextParm())
{ {
// from Command_Map_f // from Command_Map_f
......
...@@ -191,7 +191,7 @@ static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, ...@@ -191,7 +191,7 @@ static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"},
static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}}; static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}};
static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}}; static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}};
static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}};
static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, //{2, "Teleport"}, static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, //{2, "Teleport"},
{3, "None"}, {0, NULL}}; {3, "None"}, {0, NULL}};
......
...@@ -382,6 +382,8 @@ typedef struct player_s ...@@ -382,6 +382,8 @@ typedef struct player_s
// fun thing for player sprite // fun thing for player sprite
angle_t drawangle; angle_t drawangle;
angle_t old_drawangle;
angle_t old_drawangle2;
// player's ring count // player's ring count
INT16 rings; INT16 rings;
......
...@@ -392,8 +392,6 @@ unset_bit_array (bitarray_t * const array, const int value) ...@@ -392,8 +392,6 @@ unset_bit_array (bitarray_t * const array, const int value)
array[value >> 3] &= ~(1<<(value & 7)); array[value >> 3] &= ~(1<<(value & 7));
} }
#ifdef HAVE_SDL
typedef UINT64 precise_t; typedef UINT64 precise_t;
#endif
#endif //__DOOMTYPE__ #endif //__DOOMTYPE__
...@@ -16,7 +16,7 @@ tic_t I_GetTime(void) ...@@ -16,7 +16,7 @@ tic_t I_GetTime(void)
return 0; return 0;
} }
int I_GetTimeMicros(void) fixed_t I_GetTimeFrac(void)
{ {
return 0; return 0;
} }
......
...@@ -62,8 +62,6 @@ static tic_t stoptimer; ...@@ -62,8 +62,6 @@ static tic_t stoptimer;
static boolean keypressed = false; static boolean keypressed = false;
// (no longer) De-Demo'd Title Screen // (no longer) De-Demo'd Title Screen
static tic_t xscrolltimer;
static tic_t yscrolltimer;
static INT32 menuanimtimer; // Title screen: background animation timing static INT32 menuanimtimer; // Title screen: background animation timing
mobj_t *titlemapcameraref = NULL; mobj_t *titlemapcameraref = NULL;
...@@ -517,9 +515,9 @@ void F_StartIntro(void) ...@@ -517,9 +515,9 @@ void F_StartIntro(void)
} }
// //
// F_IntroDrawScene // F_IntroDrawer
// //
static void F_IntroDrawScene(void) void F_IntroDrawer(void)
{ {
boolean highres = true; boolean highres = true;
INT32 cx = 8, cy = 128; INT32 cx = 8, cy = 128;
...@@ -625,24 +623,22 @@ static void F_IntroDrawScene(void) ...@@ -625,24 +623,22 @@ static void F_IntroDrawScene(void)
if (intro_curtime > 1 && intro_curtime < (INT32)introscenetime[intro_scenenum]) if (intro_curtime > 1 && intro_curtime < (INT32)introscenetime[intro_scenenum])
{ {
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
if (intro_curtime < TICRATE-5) // Make the text shine! if (intro_curtime < TICRATE-5) // Make the text shine!
{
sprintf(stjrintro, "STJRI%03u", intro_curtime-1); sprintf(stjrintro, "STJRI%03u", intro_curtime-1);
}
else if (intro_curtime >= TICRATE-6 && intro_curtime < 2*TICRATE-20) // Pause on black screen for just a second else if (intro_curtime >= TICRATE-6 && intro_curtime < 2*TICRATE-20) // Pause on black screen for just a second
{
return; return;
}
else if (intro_curtime == 2*TICRATE-19) else if (intro_curtime == 2*TICRATE-19)
{ {
// Fade in the text // Fade in the text
// The text fade out is automatically handled when switching to a new intro scene // The text fade out is automatically handled when switching to a new intro scene
strncpy(stjrintro, "STJRI029", 9); strncpy(stjrintro, "STJRI029", 9);
S_ChangeMusicInternal("_stjr", false);
background = W_CachePatchName(stjrintro, PU_PATCH_LOWPRIORITY); background = W_CachePatchName(stjrintro, PU_PATCH_LOWPRIORITY);
wipestyleflags = WSF_FADEIN;
F_WipeStartScreen();
F_TryColormapFade(31);
V_DrawSmallScaledPatch(bgxoffs, 84, 0, background); V_DrawSmallScaledPatch(bgxoffs, 84, 0, background);
F_WipeEndScreen();
F_RunWipe(0,true);
} }
if (!WipeInAction) // Draw the patch if not in a wipe if (!WipeInAction) // Draw the patch if not in a wipe
...@@ -841,17 +837,27 @@ static void F_IntroDrawScene(void) ...@@ -841,17 +837,27 @@ static void F_IntroDrawScene(void)
V_DrawRightAlignedString(BASEVIDWIDTH-4, BASEVIDHEIGHT-12, V_ALLOWLOWERCASE|(trans<<V_ALPHASHIFT), "\x86""Press ""\x82""ENTER""\x86"" to skip..."); V_DrawRightAlignedString(BASEVIDWIDTH-4, BASEVIDHEIGHT-12, V_ALLOWLOWERCASE|(trans<<V_ALPHASHIFT), "\x86""Press ""\x82""ENTER""\x86"" to skip...");
} }
if (animtimer)
animtimer--;
V_DrawString(cx, cy, V_ALLOWLOWERCASE, cutscene_disptext); V_DrawString(cx, cy, V_ALLOWLOWERCASE, cutscene_disptext);
} }
// //
// F_IntroDrawer // F_IntroTicker
// //
void F_IntroDrawer(void) void F_IntroTicker(void)
{ {
// advance animation
finalecount++;
timetonext--;
F_WriteText();
// check for skipping
if (keypressed)
keypressed = false;
wipestyleflags = WSF_CROSSFADE;
if (timetonext <= 0) if (timetonext <= 0)
{ {
if (intro_scenenum == 0) if (intro_scenenum == 0)
...@@ -861,6 +867,9 @@ void F_IntroDrawer(void) ...@@ -861,6 +867,9 @@ void F_IntroDrawer(void)
wipestyleflags = WSF_FADEOUT; wipestyleflags = WSF_FADEOUT;
F_WipeStartScreen(); F_WipeStartScreen();
F_TryColormapFade(31); F_TryColormapFade(31);
F_IntroDrawer();
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
...@@ -874,6 +883,9 @@ void F_IntroDrawer(void) ...@@ -874,6 +883,9 @@ void F_IntroDrawer(void)
wipestyleflags = (WSF_FADEOUT|WSF_TOWHITE); wipestyleflags = (WSF_FADEOUT|WSF_TOWHITE);
F_WipeStartScreen(); F_WipeStartScreen();
F_TryColormapFade(0); F_TryColormapFade(0);
F_IntroDrawer();
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
...@@ -885,6 +897,9 @@ void F_IntroDrawer(void) ...@@ -885,6 +897,9 @@ void F_IntroDrawer(void)
wipestyleflags = WSF_FADEOUT; wipestyleflags = WSF_FADEOUT;
F_WipeStartScreen(); F_WipeStartScreen();
F_TryColormapFade(31); F_TryColormapFade(31);
F_IntroDrawer();
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
...@@ -920,12 +935,12 @@ void F_IntroDrawer(void) ...@@ -920,12 +935,12 @@ void F_IntroDrawer(void)
wipegamestate = GS_INTRO; wipegamestate = GS_INTRO;
return; return;
} }
F_NewCutscene(introtext[++intro_scenenum]); F_NewCutscene(introtext[++intro_scenenum]);
timetonext = introscenetime[intro_scenenum]; timetonext = introscenetime[intro_scenenum];
F_WipeStartScreen(); F_WipeStartScreen();
wipegamestate = -1; wipegamestate = -1;
wipestyleflags = WSF_CROSSFADE;
animtimer = stoptimer = 0; animtimer = stoptimer = 0;
} }
...@@ -933,78 +948,36 @@ void F_IntroDrawer(void) ...@@ -933,78 +948,36 @@ void F_IntroDrawer(void)
if (rendermode != render_none) if (rendermode != render_none)
{ {
if (intro_scenenum == 5 && intro_curtime == 5*TICRATE) if (intro_scenenum == 0 && intro_curtime == 2*TICRATE-19)
{ {
patch_t *radar = W_CachePatchName("RADAR", PU_PATCH_LOWPRIORITY); S_ChangeMusicInternal("_stjr", false);
wipestyleflags = WSF_FADEIN;
F_WipeStartScreen(); F_WipeStartScreen();
F_WipeColorFill(31); F_TryColormapFade(31);
V_DrawSmallScaledPatch(0, 0, 0, radar);
W_UnlockCachedPatch(radar);
V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_IntroDrawer();
F_RunWipe(99,true);
}
else if (intro_scenenum == 7 && intro_curtime == 6*TICRATE) // Force a wipe here
{
patch_t *grass = W_CachePatchName("SGRASS2", PU_PATCH_LOWPRIORITY);
F_WipeStartScreen();
F_WipeColorFill(31);
V_DrawSmallScaledPatch(0, 0, 0, grass);
W_UnlockCachedPatch(grass);
V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
/*else if (intro_scenenum == 11 && intro_curtime == 7*TICRATE) else if ((intro_scenenum == 5 && intro_curtime == 5*TICRATE)
|| (intro_scenenum == 7 && intro_curtime == 6*TICRATE)
//|| (intro_scenenum == 11 && intro_curtime == 7*TICRATE)
|| (intro_scenenum == 15 && intro_curtime == 7*TICRATE))
{ {
patch_t *confront = W_CachePatchName("CONFRONT", PU_PATCH_LOWPRIORITY);
F_WipeStartScreen(); F_WipeStartScreen();
F_WipeColorFill(31); F_WipeColorFill(31);
V_DrawSmallScaledPatch(0, 0, 0, confront);
W_UnlockCachedPatch(confront);
V_DrawString(8, 128, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_IntroDrawer();
F_RunWipe(99,true);
}*/
if (intro_scenenum == 15 && intro_curtime == 7*TICRATE)
{
patch_t *sdo = W_CachePatchName("SONICDO2", PU_PATCH_LOWPRIORITY);
F_WipeStartScreen();
F_WipeColorFill(31);
V_DrawSmallScaledPatch(0, 0, 0, sdo);
W_UnlockCachedPatch(sdo);
V_DrawString(224, 8, V_ALLOWLOWERCASE, cutscene_disptext);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
} }
F_IntroDrawScene(); if (animtimer)
} animtimer--;
//
// F_IntroTicker
//
void F_IntroTicker(void)
{
// advance animation
finalecount++;
timetonext--;
F_WriteText();
// check for skipping
if (keypressed)
keypressed = false;
} }
// //
...@@ -2320,6 +2293,7 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname) ...@@ -2320,6 +2293,7 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
INT32 pw, ph; // scaled by dupz INT32 pw, ph; // scaled by dupz
patch_t *pat; patch_t *pat;
INT32 i, j; INT32 i, j;
fixed_t fracmenuanimtimer, xscrolltimer, yscrolltimer;
if (rendermode == render_none) if (rendermode == render_none)
return; return;
...@@ -2346,12 +2320,13 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname) ...@@ -2346,12 +2320,13 @@ void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
tilex = max(FixedCeil(FixedDiv(vid.width, pw)) >> FRACBITS, 1)+2; // one tile on both sides of center tilex = max(FixedCeil(FixedDiv(vid.width, pw)) >> FRACBITS, 1)+2; // one tile on both sides of center
tiley = max(FixedCeil(FixedDiv(vid.height, ph)) >> FRACBITS, 1)+2; tiley = max(FixedCeil(FixedDiv(vid.height, ph)) >> FRACBITS, 1)+2;
xscrolltimer = ((menuanimtimer*scrollxspeed)/16 + patwidth*xneg) % (patwidth); fracmenuanimtimer = (menuanimtimer * FRACUNIT) - (FRACUNIT - rendertimefrac);
yscrolltimer = ((menuanimtimer*scrollyspeed)/16 + patheight*yneg) % (patheight); xscrolltimer = ((fracmenuanimtimer*scrollxspeed)/16 + patwidth*xneg*FRACUNIT) % (patwidth * FRACUNIT);
yscrolltimer = ((fracmenuanimtimer*scrollyspeed)/16 + patheight*yneg*FRACUNIT) % (patheight * FRACUNIT);
// coordinate offsets // coordinate offsets
xscrolled = xscrolltimer * dupz; xscrolled = FixedInt(xscrolltimer * dupz);
yscrolled = yscrolltimer * dupz; yscrolled = FixedInt(yscrolltimer * dupz);
for (x = (xispos) ? -pw*(tilex-1)+pw : 0, i = 0; for (x = (xispos) ? -pw*(tilex-1)+pw : 0, i = 0;
i < tilex; i < tilex;
......
...@@ -1008,7 +1008,7 @@ void G_ReadMetalTic(mobj_t *metal) ...@@ -1008,7 +1008,7 @@ void G_ReadMetalTic(mobj_t *metal)
oldmetal.x = READFIXED(metal_p); oldmetal.x = READFIXED(metal_p);
oldmetal.y = READFIXED(metal_p); oldmetal.y = READFIXED(metal_p);
oldmetal.z = READFIXED(metal_p); oldmetal.z = READFIXED(metal_p);
P_TeleportMove(metal, oldmetal.x, oldmetal.y, oldmetal.z); P_MoveOrigin(metal, oldmetal.x, oldmetal.y, oldmetal.z);
oldmetal.x = metal->x; oldmetal.x = metal->x;
oldmetal.y = metal->y; oldmetal.y = metal->y;
oldmetal.z = metal->z; oldmetal.z = metal->z;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include "b_bot.h" #include "b_bot.h"
#include "m_cond.h" // condition sets #include "m_cond.h" // condition sets
#include "lua_script.h" #include "lua_script.h"
#include "r_fps.h" // frame interpolation/uncapped
#include "lua_hud.h" #include "lua_hud.h"
...@@ -2362,6 +2363,12 @@ void G_Ticker(boolean run) ...@@ -2362,6 +2363,12 @@ void G_Ticker(boolean run)
F_TextPromptTicker(); F_TextPromptTicker();
AM_Ticker(); AM_Ticker();
HU_Ticker(); HU_Ticker();
if (run)
{
R_UpdateViewInterpolation();
}
break; break;
case GS_INTERMISSION: case GS_INTERMISSION:
...@@ -2414,7 +2421,15 @@ void G_Ticker(boolean run) ...@@ -2414,7 +2421,15 @@ void G_Ticker(boolean run)
break; break;
case GS_TITLESCREEN: case GS_TITLESCREEN:
if (titlemapinaction) P_Ticker(run); // then intentionally fall through if (titlemapinaction)
{
P_Ticker(run);
if (run)
{
R_UpdateViewInterpolation();
}
// then intentionally fall through
}
/* FALLTHRU */ /* FALLTHRU */
case GS_WAITINGPLAYERS: case GS_WAITINGPLAYERS:
F_MenuPresTicker(run); F_MenuPresTicker(run);
......
...@@ -51,7 +51,7 @@ EXPORT void HWRAPI(ClearMipMapCache) (void); ...@@ -51,7 +51,7 @@ EXPORT void HWRAPI(ClearMipMapCache) (void);
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value); EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
//Hurdler: added for new development //Hurdler: added for new development
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface); EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model); EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
EXPORT void HWRAPI(SetTransform) (FTransform *ptransform); EXPORT void HWRAPI(SetTransform) (FTransform *ptransform);
EXPORT INT32 HWRAPI(GetTextureUsed) (void); EXPORT INT32 HWRAPI(GetTextureUsed) (void);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "../v_video.h" #include "../v_video.h"
#include "../p_local.h" #include "../p_local.h"
#include "../p_setup.h" #include "../p_setup.h"
#include "../r_fps.h"
#include "../r_local.h" #include "../r_local.h"
#include "../r_patch.h" #include "../r_patch.h"
#include "../r_picformats.h" #include "../r_picformats.h"
...@@ -38,6 +39,7 @@ ...@@ -38,6 +39,7 @@
#include "../m_cheat.h" #include "../m_cheat.h"
#include "../f_finale.h" #include "../f_finale.h"
#include "../r_things.h" // R_GetShadowZ #include "../r_things.h" // R_GetShadowZ
#include "../d_main.h"
#include "../p_slopes.h" #include "../p_slopes.h"
#include "hw_md2.h" #include "hw_md2.h"
...@@ -2995,6 +2997,7 @@ static void HWR_Subsector(size_t num) ...@@ -2995,6 +2997,7 @@ static void HWR_Subsector(size_t num)
INT32 light = 0; INT32 light = 0;
extracolormap_t *floorcolormap; extracolormap_t *floorcolormap;
extracolormap_t *ceilingcolormap; extracolormap_t *ceilingcolormap;
ffloor_t *rover;
#ifdef PARANOIA //no risk while developing, enough debugging nights! #ifdef PARANOIA //no risk while developing, enough debugging nights!
if (num >= addsubsector) if (num >= addsubsector)
...@@ -3052,7 +3055,22 @@ static void HWR_Subsector(size_t num) ...@@ -3052,7 +3055,22 @@ static void HWR_Subsector(size_t num)
if (gl_frontsector->ffloors) if (gl_frontsector->ffloors)
{ {
if (gl_frontsector->moved) boolean anyMoved = gl_frontsector->moved;
if (anyMoved == false)
{
for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
{
sector_t *controlSec = &sectors[rover->secnum];
if (controlSec->moved == true)
{
anyMoved = true;
break;
}
}
}
if (anyMoved == true)
{ {
gl_frontsector->numlights = sub->sector->numlights = 0; gl_frontsector->numlights = sub->sector->numlights = 0;
R_Prep3DFloors(gl_frontsector); R_Prep3DFloors(gl_frontsector);
...@@ -3131,7 +3149,6 @@ static void HWR_Subsector(size_t num) ...@@ -3131,7 +3149,6 @@ static void HWR_Subsector(size_t num)
if (gl_frontsector->ffloors) if (gl_frontsector->ffloors)
{ {
/// \todo fix light, xoffs, yoffs, extracolormap ? /// \todo fix light, xoffs, yoffs, extracolormap ?
ffloor_t * rover;
for (rover = gl_frontsector->ffloors; for (rover = gl_frontsector->ffloors;
rover; rover = rover->next) rover; rover = rover->next)
{ {
...@@ -3642,11 +3659,23 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) ...@@ -3642,11 +3659,23 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
fixed_t slopez; fixed_t slopez;
pslope_t *groundslope; pslope_t *groundslope;
// uncapped/interpolation
interpmobjstate_t interp = {0};
if (R_UsingFrameInterpolation() && !paused)
{
R_InterpolateMobjState(thing, rendertimefrac, &interp);
}
else
{
R_InterpolateMobjState(thing, FRACUNIT, &interp);
}
groundz = R_GetShadowZ(thing, &groundslope); groundz = R_GetShadowZ(thing, &groundslope);
//if (abs(groundz - gl_viewz) / tz > 4) return; // Prevent stretchy shadows and possible crashes //if (abs(groundz - gl_viewz) / tz > 4) return; // Prevent stretchy shadows and possible crashes
floordiff = abs((flip < 0 ? thing->height : 0) + thing->z - groundz); floordiff = abs((flip < 0 ? thing->height : 0) + interp.z - groundz);
alpha = floordiff / (4*FRACUNIT) + 75; alpha = floordiff / (4*FRACUNIT) + 75;
if (alpha >= 255) return; if (alpha >= 255) return;
...@@ -3660,8 +3689,8 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale) ...@@ -3660,8 +3689,8 @@ static void HWR_DrawDropShadow(mobj_t *thing, fixed_t scale)
scalemul = FixedMul(scalemul, (thing->radius*2) / gpatch->height); scalemul = FixedMul(scalemul, (thing->radius*2) / gpatch->height);
fscale = FIXED_TO_FLOAT(scalemul); fscale = FIXED_TO_FLOAT(scalemul);
fx = FIXED_TO_FLOAT(thing->x); fx = FIXED_TO_FLOAT(interp.x);
fy = FIXED_TO_FLOAT(thing->y); fy = FIXED_TO_FLOAT(interp.y);
// 3--2 // 3--2
// | /| // | /|
...@@ -5023,7 +5052,6 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5023,7 +5052,6 @@ static void HWR_ProjectSprite(mobj_t *thing)
INT32 heightsec, phs; INT32 heightsec, phs;
const boolean splat = R_ThingIsFloorSprite(thing); const boolean splat = R_ThingIsFloorSprite(thing);
const boolean papersprite = (R_ThingIsPaperSprite(thing) && !splat); const boolean papersprite = (R_ThingIsPaperSprite(thing) && !splat);
angle_t mobjangle = (thing->player ? thing->player->drawangle : thing->angle);
float z1, z2; float z1, z2;
fixed_t spr_width, spr_height; fixed_t spr_width, spr_height;
...@@ -5033,6 +5061,9 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5033,6 +5061,9 @@ static void HWR_ProjectSprite(mobj_t *thing)
INT32 rollangle = 0; INT32 rollangle = 0;
#endif #endif
// uncapped/interpolation
interpmobjstate_t interp = {0};
if (!thing) if (!thing)
return; return;
...@@ -5054,13 +5085,23 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5054,13 +5085,23 @@ static void HWR_ProjectSprite(mobj_t *thing)
dispoffset = thing->info->dispoffset; dispoffset = thing->info->dispoffset;
if (R_UsingFrameInterpolation() && !paused)
{
R_InterpolateMobjState(thing, rendertimefrac, &interp);
}
else
{
R_InterpolateMobjState(thing, FRACUNIT, &interp);
}
this_scale = FIXED_TO_FLOAT(thing->scale); this_scale = FIXED_TO_FLOAT(thing->scale);
spritexscale = FIXED_TO_FLOAT(thing->spritexscale); spritexscale = FIXED_TO_FLOAT(thing->spritexscale);
spriteyscale = FIXED_TO_FLOAT(thing->spriteyscale); spriteyscale = FIXED_TO_FLOAT(thing->spriteyscale);
// transform the origin point // transform the origin point
tr_x = FIXED_TO_FLOAT(thing->x) - gl_viewx; tr_x = FIXED_TO_FLOAT(interp.x) - gl_viewx;
tr_y = FIXED_TO_FLOAT(thing->y) - gl_viewy; tr_y = FIXED_TO_FLOAT(interp.y) - gl_viewy;
// rotation around vertical axis // rotation around vertical axis
tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin); tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin);
...@@ -5083,8 +5124,8 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5083,8 +5124,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
} }
// The above can stay as it works for cutting sprites that are too close // The above can stay as it works for cutting sprites that are too close
tr_x = FIXED_TO_FLOAT(thing->x); tr_x = FIXED_TO_FLOAT(interp.x);
tr_y = FIXED_TO_FLOAT(thing->y); tr_y = FIXED_TO_FLOAT(interp.y);
// decide which patch to use for sprite relative to player // decide which patch to use for sprite relative to player
#ifdef RANGECHECK #ifdef RANGECHECK
...@@ -5132,7 +5173,7 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5132,7 +5173,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
I_Error("sprframes NULL for sprite %d\n", thing->sprite); I_Error("sprframes NULL for sprite %d\n", thing->sprite);
#endif #endif
ang = R_PointToAngle (thing->x, thing->y) - mobjangle; ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
if (mirrored) if (mirrored)
ang = InvAngle(ang); ang = InvAngle(ang);
...@@ -5216,8 +5257,8 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5216,8 +5257,8 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (papersprite) if (papersprite)
{ {
rightsin = FIXED_TO_FLOAT(FINESINE((mobjangle)>>ANGLETOFINESHIFT)); rightsin = FIXED_TO_FLOAT(FINESINE(interp.angle >> ANGLETOFINESHIFT));
rightcos = FIXED_TO_FLOAT(FINECOSINE((mobjangle)>>ANGLETOFINESHIFT)); rightcos = FIXED_TO_FLOAT(FINECOSINE(interp.angle >> ANGLETOFINESHIFT));
} }
else else
{ {
...@@ -5278,12 +5319,12 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5278,12 +5319,12 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (vflip) if (vflip)
{ {
gz = FIXED_TO_FLOAT(thing->z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale); gz = FIXED_TO_FLOAT(interp.z + thing->height) - (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale); gzt = gz + (FIXED_TO_FLOAT(spr_height) * this_yscale);
} }
else else
{ {
gzt = FIXED_TO_FLOAT(thing->z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale); gzt = FIXED_TO_FLOAT(interp.z) + (FIXED_TO_FLOAT(spr_topoffset) * this_yscale);
gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale); gz = gzt - (FIXED_TO_FLOAT(spr_height) * this_yscale);
} }
...@@ -5302,24 +5343,35 @@ static void HWR_ProjectSprite(mobj_t *thing) ...@@ -5302,24 +5343,35 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (heightsec != -1 && phs != -1) // only clip things which are in special sectors if (heightsec != -1 && phs != -1) // only clip things which are in special sectors
{ {
if (gl_viewz < FIXED_TO_FLOAT(sectors[phs].floorheight) ? if (gl_viewz < FIXED_TO_FLOAT(sectors[phs].floorheight) ?
FIXED_TO_FLOAT(thing->z) >= FIXED_TO_FLOAT(sectors[heightsec].floorheight) : FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].floorheight) :
gzt < FIXED_TO_FLOAT(sectors[heightsec].floorheight)) gzt < FIXED_TO_FLOAT(sectors[heightsec].floorheight))
return; return;
if (gl_viewz > FIXED_TO_FLOAT(sectors[phs].ceilingheight) ? if (gl_viewz > FIXED_TO_FLOAT(sectors[phs].ceilingheight) ?
gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gl_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) : gzt < FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) && gl_viewz >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight) :
FIXED_TO_FLOAT(thing->z) >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight)) FIXED_TO_FLOAT(interp.z) >= FIXED_TO_FLOAT(sectors[heightsec].ceilingheight))
return; return;
} }
if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer) if ((thing->flags2 & MF2_LINKDRAW) && thing->tracer)
{ {
interpmobjstate_t tracer_interp = {};
if (! R_ThingVisible(thing->tracer)) if (! R_ThingVisible(thing->tracer))
return; return;
if (R_UsingFrameInterpolation() && !paused)
{
R_InterpolateMobjState(thing->tracer, rendertimefrac, &tracer_interp);
}
else
{
R_InterpolateMobjState(thing->tracer, FRACUNIT, &tracer_interp);
}
// calculate tz for tracer, same way it is calculated for this sprite // calculate tz for tracer, same way it is calculated for this sprite
// transform the origin point // transform the origin point
tr_x = FIXED_TO_FLOAT(thing->tracer->x) - gl_viewx; tr_x = FIXED_TO_FLOAT(tracer_interp.x) - gl_viewx;
tr_y = FIXED_TO_FLOAT(thing->tracer->y) - gl_viewy; tr_y = FIXED_TO_FLOAT(tracer_interp.y) - gl_viewy;
// rotation around vertical axis // rotation around vertical axis
tracertz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin); tracertz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin);
...@@ -5438,6 +5490,9 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) ...@@ -5438,6 +5490,9 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
unsigned rot = 0; unsigned rot = 0;
UINT8 flip; UINT8 flip;
if (!thing)
return;
// Visibility check by the blend mode. // Visibility check by the blend mode.
if (thing->frame & FF_TRANSMASK) if (thing->frame & FF_TRANSMASK)
{ {
...@@ -5445,9 +5500,22 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) ...@@ -5445,9 +5500,22 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
return; return;
} }
// uncapped/interpolation
interpmobjstate_t interp = {0};
// do interpolation
if (R_UsingFrameInterpolation() && !paused)
{
R_InterpolatePrecipMobjState(thing, rendertimefrac, &interp);
}
else
{
R_InterpolatePrecipMobjState(thing, FRACUNIT, &interp);
}
// transform the origin point // transform the origin point
tr_x = FIXED_TO_FLOAT(thing->x) - gl_viewx; tr_x = FIXED_TO_FLOAT(interp.x) - gl_viewx;
tr_y = FIXED_TO_FLOAT(thing->y) - gl_viewy; tr_y = FIXED_TO_FLOAT(interp.y) - gl_viewy;
// rotation around vertical axis // rotation around vertical axis
tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin); tz = (tr_x * gl_viewcos) + (tr_y * gl_viewsin);
...@@ -5456,8 +5524,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) ...@@ -5456,8 +5524,8 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
if (tz < ZCLIP_PLANE) if (tz < ZCLIP_PLANE)
return; return;
tr_x = FIXED_TO_FLOAT(thing->x); tr_x = FIXED_TO_FLOAT(interp.x);
tr_y = FIXED_TO_FLOAT(thing->y); tr_y = FIXED_TO_FLOAT(interp.y);
// decide which patch to use for sprite relative to player // decide which patch to use for sprite relative to player
if ((unsigned)thing->sprite >= numsprites) if ((unsigned)thing->sprite >= numsprites)
...@@ -5519,7 +5587,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) ...@@ -5519,7 +5587,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->colormap = NULL; vis->colormap = NULL;
// set top/bottom coords // set top/bottom coords
vis->gzt = FIXED_TO_FLOAT(thing->z + spritecachedinfo[lumpoff].topoffset); vis->gzt = FIXED_TO_FLOAT(interp.z + spritecachedinfo[lumpoff].topoffset);
vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height); vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height);
vis->precip = true; vis->precip = true;
...@@ -6655,6 +6723,7 @@ void HWR_DoPostProcessor(player_t *player) ...@@ -6655,6 +6723,7 @@ void HWR_DoPostProcessor(player_t *player)
// 10 by 10 grid. 2 coordinates (xy) // 10 by 10 grid. 2 coordinates (xy)
float v[SCREENVERTS][SCREENVERTS][2]; float v[SCREENVERTS][SCREENVERTS][2];
static double disStart = 0; static double disStart = 0;
UINT8 x, y; UINT8 x, y;
INT32 WAVELENGTH; INT32 WAVELENGTH;
INT32 AMPLITUDE; INT32 AMPLITUDE;
...@@ -6663,15 +6732,15 @@ void HWR_DoPostProcessor(player_t *player) ...@@ -6663,15 +6732,15 @@ void HWR_DoPostProcessor(player_t *player)
// Modifies the wave. // Modifies the wave.
if (*type == postimg_water) if (*type == postimg_water)
{ {
WAVELENGTH = 20; // Lower is longer WAVELENGTH = 5;
AMPLITUDE = 20; // Lower is bigger AMPLITUDE = 20;
FREQUENCY = 16; // Lower is faster FREQUENCY = 8;
} }
else else
{ {
WAVELENGTH = 10; // Lower is longer WAVELENGTH = 10;
AMPLITUDE = 30; // Lower is bigger AMPLITUDE = 60;
FREQUENCY = 4; // Lower is faster FREQUENCY = 4;
} }
for (x = 0; x < SCREENVERTS; x++) for (x = 0; x < SCREENVERTS; x++)
...@@ -6685,7 +6754,7 @@ void HWR_DoPostProcessor(player_t *player) ...@@ -6685,7 +6754,7 @@ void HWR_DoPostProcessor(player_t *player)
} }
HWD.pfnPostImgRedraw(v); HWD.pfnPostImgRedraw(v);
if (!(paused || P_AutoPause())) if (!(paused || P_AutoPause()))
disStart += 1; disStart += FIXED_TO_FLOAT(renderdeltatics);
// Capture the screen again for screen waving on the intermission // Capture the screen again for screen waving on the intermission
if(gamestate != GS_INTERMISSION) if(gamestate != GS_INTERMISSION)
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "hw_md2.h" #include "hw_md2.h"
#include "../d_main.h" #include "../d_main.h"
#include "../r_bsp.h" #include "../r_bsp.h"
#include "../r_fps.h"
#include "../r_main.h" #include "../r_main.h"
#include "../m_misc.h" #include "../m_misc.h"
#include "../w_wad.h" #include "../w_wad.h"
...@@ -1330,8 +1331,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1330,8 +1331,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
{ {
patch_t *gpatch, *blendgpatch; patch_t *gpatch, *blendgpatch;
GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL; GLPatch_t *hwrPatch = NULL, *hwrBlendPatch = NULL;
INT32 durs = spr->mobj->state->tics; float durs = (float)spr->mobj->state->tics;
INT32 tics = spr->mobj->tics; float tics = (float)spr->mobj->tics;
const boolean papersprite = (R_ThingIsPaperSprite(spr->mobj) && !R_ThingIsFloorSprite(spr->mobj)); const boolean papersprite = (R_ThingIsPaperSprite(spr->mobj) && !R_ThingIsFloorSprite(spr->mobj));
const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj)); const UINT8 flip = (UINT8)(!(spr->mobj->eflags & MFE_VERTICALFLIP) != !R_ThingVerticallyFlipped(spr->mobj));
const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj)); const UINT8 hflip = (UINT8)(!(spr->mobj->mirrored) != !R_ThingHorizontallyFlipped(spr->mobj));
...@@ -1341,6 +1342,16 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1341,6 +1342,16 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
angle_t ang; angle_t ang;
INT32 mod; INT32 mod;
float finalscale; float finalscale;
interpmobjstate_t interp;
if (R_UsingFrameInterpolation() && !paused)
{
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
}
else
{
R_InterpolateMobjState(spr->mobj, FRACUNIT, &interp);
}
// Apparently people don't like jump frames like that, so back it goes // Apparently people don't like jump frames like that, so back it goes
//if (tics > durs) //if (tics > durs)
...@@ -1484,8 +1495,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1484,8 +1495,8 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
if (spr->mobj->frame & FF_ANIMATE) if (spr->mobj->frame & FF_ANIMATE)
{ {
// set duration and tics to be the correct values for FF_ANIMATE states // set duration and tics to be the correct values for FF_ANIMATE states
durs = spr->mobj->state->var2; durs = (float)spr->mobj->state->var2;
tics = spr->mobj->anim_duration; tics = (float)spr->mobj->anim_duration;
} }
frame = (spr->mobj->frame & FF_FRAMEMASK); frame = (spr->mobj->frame & FF_FRAMEMASK);
...@@ -1509,7 +1520,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1509,7 +1520,11 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
} }
#ifdef USE_MODEL_NEXTFRAME #ifdef USE_MODEL_NEXTFRAME
#define INTERPOLERATION_LIMIT TICRATE/4 // Interpolate the model interpolation. (lol)
tics -= FixedToFloat(rendertimefrac);
#define INTERPOLERATION_LIMIT (TICRATE * 0.25f)
if (cv_glmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT) if (cv_glmodelinterpolation.value && tics <= durs && tics <= INTERPOLERATION_LIMIT)
{ {
if (durs > INTERPOLERATION_LIMIT) if (durs > INTERPOLERATION_LIMIT)
...@@ -1558,13 +1573,13 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1558,13 +1573,13 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
#endif #endif
//Hurdler: it seems there is still a small problem with mobj angle //Hurdler: it seems there is still a small problem with mobj angle
p.x = FIXED_TO_FLOAT(spr->mobj->x); p.x = FIXED_TO_FLOAT(interp.x);
p.y = FIXED_TO_FLOAT(spr->mobj->y)+md2->offset; p.y = FIXED_TO_FLOAT(interp.y)+md2->offset;
if (flip) if (flip)
p.z = FIXED_TO_FLOAT(spr->mobj->z + spr->mobj->height); p.z = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
else else
p.z = FIXED_TO_FLOAT(spr->mobj->z); p.z = FIXED_TO_FLOAT(interp.z);
if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY) if (spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
sprdef = &((skin_t *)spr->mobj->skin)->sprites[spr->mobj->sprite2]; sprdef = &((skin_t *)spr->mobj->skin)->sprites[spr->mobj->sprite2];
...@@ -1575,16 +1590,13 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1575,16 +1590,13 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
if (sprframe->rotate || papersprite) if (sprframe->rotate || papersprite)
{ {
fixed_t anglef = AngleFixed(spr->mobj->angle); fixed_t anglef = AngleFixed(interp.angle);
if (spr->mobj->player)
anglef = AngleFixed(spr->mobj->player->drawangle);
p.angley = FIXED_TO_FLOAT(anglef); p.angley = FIXED_TO_FLOAT(anglef);
} }
else else
{ {
const fixed_t anglef = AngleFixed((R_PointToAngle(spr->mobj->x, spr->mobj->y))-ANGLE_180); const fixed_t anglef = AngleFixed((R_PointToAngle(interp.x, interp.y))-ANGLE_180);
p.angley = FIXED_TO_FLOAT(anglef); p.angley = FIXED_TO_FLOAT(anglef);
} }
...@@ -1606,7 +1618,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr) ...@@ -1606,7 +1618,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
p.rotaxis = (UINT8)(sprinfo->pivot[(spr->mobj->frame & FF_FRAMEMASK)].rotaxis); p.rotaxis = (UINT8)(sprinfo->pivot[(spr->mobj->frame & FF_FRAMEMASK)].rotaxis);
// for NiGHTS specifically but should work everywhere else // for NiGHTS specifically but should work everywhere else
ang = R_PointToAngle (spr->mobj->x, spr->mobj->y) - (spr->mobj->player ? spr->mobj->player->drawangle : spr->mobj->angle); ang = R_PointToAngle (interp.x, interp.y) - interp.angle;
if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right
p.rollflip = 1; p.rollflip = 1;
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
......
...@@ -2672,7 +2672,7 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model) ...@@ -2672,7 +2672,7 @@ EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
#define BUFFER_OFFSET(i) ((void*)(i)) #define BUFFER_OFFSET(i) ((void*)(i))
static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface) static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
{ {
static GLRGBAFloat poly = {0,0,0,0}; static GLRGBAFloat poly = {0,0,0,0};
static GLRGBAFloat tint = {0,0,0,0}; static GLRGBAFloat tint = {0,0,0,0};
...@@ -2701,11 +2701,11 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32 ...@@ -2701,11 +2701,11 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
scaley = scale; scaley = scale;
scalez = scale; scalez = scale;
if (duration != 0 && duration != -1 && tics != -1) // don't interpolate if instantaneous or infinite in length if (duration > 0.0 && tics >= 0.0) // don't interpolate if instantaneous or infinite in length
{ {
UINT32 newtime = (duration - tics); // + 1; float newtime = (duration - tics); // + 1;
pol = (newtime)/(float)duration; pol = newtime / duration;
if (pol > 1.0f) if (pol > 1.0f)
pol = 1.0f; pol = 1.0f;
...@@ -2977,7 +2977,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32 ...@@ -2977,7 +2977,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, INT32 duration, INT32
// -----------------+ // -----------------+
// HWRAPI DrawModel : Draw a model // HWRAPI DrawModel : Draw a model
// -----------------+ // -----------------+
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, INT32 duration, INT32 tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface) EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float scale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
{ {
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, scale, flipped, hflipped, Surface); DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, scale, flipped, hflipped, Surface);
} }
......
...@@ -170,6 +170,8 @@ static INT32 cechoflags = 0; ...@@ -170,6 +170,8 @@ static INT32 cechoflags = 0;
// HEADS UP INIT // HEADS UP INIT
//====================================================================== //======================================================================
static tic_t resynch_ticker = 0;
#ifndef NONET #ifndef NONET
// just after // just after
static void Command_Say_f(void); static void Command_Say_f(void);
...@@ -382,12 +384,12 @@ static INT16 addy = 0; // use this to make the messages scroll smoothly when one ...@@ -382,12 +384,12 @@ static INT16 addy = 0; // use this to make the messages scroll smoothly when one
static void HU_removeChatText_Mini(void) static void HU_removeChatText_Mini(void)
{ {
// MPC: Don't create new arrays, just iterate through an existing one // MPC: Don't create new arrays, just iterate through an existing one
size_t i; size_t i;
for(i=0;i<chat_nummsg_min-1;i++) { for(i=0;i<chat_nummsg_min-1;i++) {
strcpy(chat_mini[i], chat_mini[i+1]); strcpy(chat_mini[i], chat_mini[i+1]);
chat_timers[i] = chat_timers[i+1]; chat_timers[i] = chat_timers[i+1];
} }
chat_nummsg_min--; // lost 1 msg. chat_nummsg_min--; // lost 1 msg.
// use addy and make shit slide smoothly af. // use addy and make shit slide smoothly af.
...@@ -400,10 +402,10 @@ static void HU_removeChatText_Log(void) ...@@ -400,10 +402,10 @@ static void HU_removeChatText_Log(void)
{ {
// MPC: Don't create new arrays, just iterate through an existing one // MPC: Don't create new arrays, just iterate through an existing one
size_t i; size_t i;
for(i=0;i<chat_nummsg_log-1;i++) { for(i=0;i<chat_nummsg_log-1;i++) {
strcpy(chat_log[i], chat_log[i+1]); strcpy(chat_log[i], chat_log[i+1]);
} }
chat_nummsg_log--; // lost 1 msg. chat_nummsg_log--; // lost 1 msg.
} }
#endif #endif
...@@ -874,6 +876,39 @@ void HU_Ticker(void) ...@@ -874,6 +876,39 @@ void HU_Ticker(void)
hu_showscores = !chat_on; hu_showscores = !chat_on;
else else
hu_showscores = false; hu_showscores = false;
if (chat_on)
{
// count down the scroll timer.
if (chat_scrolltime > 0)
chat_scrolltime--;
}
if (netgame)
{
size_t i = 0;
// handle spam while we're at it:
for(; (i<MAXPLAYERS); i++)
{
if (stop_spamming[i] > 0)
stop_spamming[i]--;
}
// handle chat timers
for (i=0; (i<chat_nummsg_min); i++)
{
if (chat_timers[i] > 0)
chat_timers[i]--;
else
HU_removeChatText_Mini();
}
}
if (cechotimer > 0) --cechotimer;
if (hu_redownloadinggamestate)
resynch_ticker++;
} }
#ifndef NONET #ifndef NONET
...@@ -1854,8 +1889,6 @@ static void HU_DrawCEcho(void) ...@@ -1854,8 +1889,6 @@ static void HU_DrawCEcho(void)
echoptr = line; echoptr = line;
echoptr++; echoptr++;
} }
--cechotimer;
} }
static void HU_drawGametype(void) static void HU_drawGametype(void)
...@@ -1917,9 +1950,6 @@ void HU_Drawer(void) ...@@ -1917,9 +1950,6 @@ void HU_Drawer(void)
// draw chat string plus cursor // draw chat string plus cursor
if (chat_on) if (chat_on)
{ {
// count down the scroll timer.
if (chat_scrolltime > 0)
chat_scrolltime--;
if (!OLDCHAT) if (!OLDCHAT)
HU_DrawChat(); HU_DrawChat();
else else
...@@ -1929,30 +1959,10 @@ void HU_Drawer(void) ...@@ -1929,30 +1959,10 @@ void HU_Drawer(void)
{ {
typelines = 1; typelines = 1;
chat_scrolltime = 0; chat_scrolltime = 0;
if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden) if (!OLDCHAT && cv_consolechat.value < 2 && netgame) // Don't display minimized chat if you set the mode to Window (Hidden)
HU_drawMiniChat(); // draw messages in a cool fashion. HU_drawMiniChat(); // draw messages in a cool fashion.
} }
if (netgame) // would handle that in hu_drawminichat, but it's actually kinda awkward when you're typing a lot of messages. (only handle that in netgames duh)
{
size_t i = 0;
// handle spam while we're at it:
for(; (i<MAXPLAYERS); i++)
{
if (stop_spamming[i] > 0)
stop_spamming[i]--;
}
// handle chat timers
for (i=0; (i<chat_nummsg_min); i++)
{
if (chat_timers[i] > 0)
chat_timers[i]--;
else
HU_removeChatText_Mini();
}
}
#endif #endif
if (cechotimer) if (cechotimer)
...@@ -1992,12 +2002,9 @@ void HU_Drawer(void) ...@@ -1992,12 +2002,9 @@ void HU_Drawer(void)
// draw desynch text // draw desynch text
if (hu_redownloadinggamestate) if (hu_redownloadinggamestate)
{ {
static UINT32 resynch_ticker = 0;
char resynch_text[14]; char resynch_text[14];
UINT32 i; UINT32 i;
// Animate the dots
resynch_ticker++;
strcpy(resynch_text, "Resynching"); strcpy(resynch_text, "Resynching");
for (i = 0; i < (resynch_ticker / 16) % 4; i++) for (i = 0; i < (resynch_ticker / 16) % 4; i++)
strcat(resynch_text, "."); strcat(resynch_text, ".");
......