mirror of
https://github.com/ZDoom/Raze.git
synced 2025-05-31 09:20:59 +00:00
Change some clocks to support sub-tick precision using a new class, ClockTicks.
Using that higher precision, interpolate at a higher granularity. Further, truncate the target interpolation time to vertical blank boundaries to avoid producing temporal artifacts. Fix issues caused by interpolation calculations being handled differently in multiple places (and fix cases where smoothratios were being thrown away only to be redone without checking all proper conditions). Ensure ClockTicks changes do not break other targets (EKenBuild, VoidSW), but note any interpolation there is not similarly updated. git-svn-id: https://svn.eduke32.com/eduke32@8050 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/build.cpp # source/build/src/sdlayer.cpp
This commit is contained in:
parent
ec7fce9ff2
commit
222e593437
41 changed files with 339 additions and 162 deletions
|
@ -319,7 +319,7 @@ playanm(short anim_num)
|
|||
|
||||
SoundState = 0;
|
||||
//ototalclock = totalclock + 120*2;
|
||||
ototalclock = totalclock;
|
||||
ototalclock = (int32_t) totalclock;
|
||||
|
||||
for (i = 1; i < numframes; i++)
|
||||
{
|
||||
|
|
|
@ -1383,7 +1383,7 @@ void PrintLocationInfo(PLAYERp pp)
|
|||
if (LocationInfo)
|
||||
{
|
||||
|
||||
i = totalclock;
|
||||
i = (int32_t) totalclock;
|
||||
if (i != frameval[framecnt])
|
||||
{
|
||||
sprintf(buffer, "FPS: %d", ((120 * AVERAGEFRAMES) / (i - frameval[framecnt])) + f_c);
|
||||
|
@ -1744,7 +1744,7 @@ void DrawMessageInput(PLAYERp pp)
|
|||
short c;
|
||||
|
||||
// Used to make cursor fade in and out
|
||||
c = 4-(sintable[(totalclock<<4)&2047]>>11);
|
||||
c = 4-(sintable[((int32_t) totalclock<<4)&2047]>>11);
|
||||
|
||||
if (MessageInputMode)
|
||||
{
|
||||
|
@ -1754,12 +1754,12 @@ void DrawMessageInput(PLAYERp pp)
|
|||
if (cur_show)
|
||||
{
|
||||
minigametext(TEXT_XCENTER(w), MESSAGE_LINE, MessageInputString,0,ROTATE_SPRITE_SCREEN_CLIP);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+2)<<16,(MESSAGE_LINE+1)<<16,20000,0,COINCURSOR+((totalclock>>3)%7),c,0,ROTATE_SPRITE_SCREEN_CLIP,0,0,xdim-1,ydim-1);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+2)<<16,(MESSAGE_LINE+1)<<16,20000,0,COINCURSOR+(((int32_t) totalclock>>3)%7),c,0,ROTATE_SPRITE_SCREEN_CLIP,0,0,xdim-1,ydim-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
minigametext(TEXT_XCENTER(w), MESSAGE_LINE, MessageInputString,0,ROTATE_SPRITE_SCREEN_CLIP);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+2)<<16,(MESSAGE_LINE+1)<<16,20000,0,COINCURSOR+((totalclock>>3)%7),c,0,ROTATE_SPRITE_SCREEN_CLIP,0,0,xdim-1,ydim-1);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+2)<<16,(MESSAGE_LINE+1)<<16,20000,0,COINCURSOR+(((int32_t) totalclock>>3)%7),c,0,ROTATE_SPRITE_SCREEN_CLIP,0,0,xdim-1,ydim-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1774,7 +1774,7 @@ void DrawConInput(PLAYERp pp)
|
|||
short c;
|
||||
|
||||
// Used to make cursor fade in and out
|
||||
c = 4-(sintable[(totalclock<<4)&2047]>>11);
|
||||
c = 4-(sintable[((int32_t) totalclock<<4)&2047]>>11);
|
||||
|
||||
if (ConInputMode)
|
||||
{
|
||||
|
@ -2309,7 +2309,7 @@ drawscreen(PLAYERp pp)
|
|||
PreUpdatePanel();
|
||||
|
||||
|
||||
smoothratio = min(max((totalclock - ototalclock) * (65536 / synctics),0),65536);
|
||||
smoothratio = min(max(((int32_t) totalclock - ototalclock) * (65536 / synctics),0),65536);
|
||||
|
||||
if (!ScreenSavePic)
|
||||
{
|
||||
|
|
|
@ -2100,7 +2100,7 @@ MenuLevel(void)
|
|||
SWBOOL MNU_StartNetGame(void);
|
||||
char called;
|
||||
int fin;
|
||||
extern int totalclocklock;
|
||||
extern ClockTicks totalclocklock;
|
||||
short w,h;
|
||||
|
||||
DSPRINTF(ds,"MenuLevel...");
|
||||
|
@ -5602,7 +5602,7 @@ void drawoverheadmap(int cposx, int cposy, int czoom, short cang)
|
|||
if (Player[p].PlayerSprite == j)
|
||||
{
|
||||
if (sprite[Player[p].PlayerSprite].xvel > 16)
|
||||
pspr_ndx[myconnectindex] = ((totalclock>>4)&3);
|
||||
pspr_ndx[myconnectindex] = (((int32_t) totalclock>>4)&3);
|
||||
sprisplayer = TRUE;
|
||||
|
||||
goto SHOWSPRITE;
|
||||
|
|
|
@ -1430,7 +1430,7 @@ static void sw_printmessage256(const char *text)
|
|||
}
|
||||
static void sw_printmessage16(const char *text)
|
||||
{
|
||||
lastpm16time = totalclock;
|
||||
lastpm16time = (int32_t) totalclock;
|
||||
_printmessage16("%s", text);
|
||||
}
|
||||
|
||||
|
@ -2166,7 +2166,7 @@ ExtCheckKeys(void)
|
|||
static int frameval[AVERAGEFRAMES], framecnt = 0;
|
||||
int i;
|
||||
|
||||
i = totalclock;
|
||||
i = (int32_t) totalclock;
|
||||
if (i != frameval[framecnt])
|
||||
{
|
||||
sprintf(tempbuf, "%d", ((120 * AVERAGEFRAMES) / (i - frameval[framecnt])) + f_c);
|
||||
|
|
|
@ -622,7 +622,7 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
//Strafe attack
|
||||
if (fightdist)
|
||||
{
|
||||
j = totalclock+snum*13468;
|
||||
j = (int32_t) totalclock+snum*13468;
|
||||
i = sintable[(j<<6)&2047];
|
||||
i += sintable[((j+4245)<<5)&2047];
|
||||
i += sintable[((j+6745)<<4)&2047];
|
||||
|
@ -843,7 +843,7 @@ void computergetinput(int snum, SW_PACKET *syn)
|
|||
daang = getangle(x2-x1,y2-y1);
|
||||
if ((i&0xc000) == 32768)
|
||||
daang = getangle(wall[wall[i&(MAXWALLS-1)].point2].x-wall[i&(MAXWALLS-1)].x,wall[wall[i&(MAXWALLS-1)].point2].y-wall[i&(MAXWALLS-1)].y);
|
||||
j = totalclock+snum*13468;
|
||||
j = (int32_t) totalclock+snum*13468;
|
||||
i = sintable[(j<<6)&2047];
|
||||
i += sintable[((j+4245)<<5)&2047];
|
||||
i += sintable[((j+6745)<<4)&2047];
|
||||
|
|
|
@ -657,7 +657,7 @@ JS_DrawMirrors(PLAYERp pp, int tx, int ty, int tz, short tpang, int tphoriz)
|
|||
|
||||
MirrorMoveSkip16 = (MirrorMoveSkip16 + 1) & 15;
|
||||
|
||||
camloopcnt += (totalclock - ototalclock);
|
||||
camloopcnt += (int32_t) (totalclock - ototalclock);
|
||||
if (camloopcnt > (60 * 5)) // 5 seconds per player view
|
||||
{
|
||||
camloopcnt = 0;
|
||||
|
|
|
@ -714,12 +714,12 @@ MNU_DoParentalPassword(UserCall call, MenuItem_p item)
|
|||
if (cur_show)
|
||||
{
|
||||
MNU_DrawString(TEXT_XCENTER(w), MESSAGE_LINE, MessageInputString,1,16);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+7)<<16,(MESSAGE_LINE+3)<<16,64<<9,0,COINCURSOR+((totalclock>>3)%7),0,0,MenuDrawFlags,0,0,xdim-1,ydim-1);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+7)<<16,(MESSAGE_LINE+3)<<16,64<<9,0,COINCURSOR+(((int32_t) totalclock>>3)%7),0,0,MenuDrawFlags,0,0,xdim-1,ydim-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MNU_DrawString(TEXT_XCENTER(w), MESSAGE_LINE, MessageInputString,1,16);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+7)<<16,(MESSAGE_LINE+3)<<16,64<<9,0,COINCURSOR+((totalclock>>3)%7),0,0,MenuDrawFlags,0,0,xdim-1,ydim-1);
|
||||
rotatesprite((TEXT_XCENTER(w)+w+7)<<16,(MESSAGE_LINE+3)<<16,64<<9,0,COINCURSOR+(((int32_t) totalclock>>3)%7),0,0,MenuDrawFlags,0,0,xdim-1,ydim-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1695,7 +1695,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (labs(totalclock - limitmove) > 7)
|
||||
if (labs((int32_t) totalclock - limitmove) > 7)
|
||||
{
|
||||
order_input.button0 = order_input_buffered.button0;
|
||||
order_input.button1 = order_input_buffered.button1;
|
||||
|
@ -1705,7 +1705,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
order_input_buffered.button1 = tst_input.button1;
|
||||
order_input_buffered.dir = tst_input.dir;
|
||||
|
||||
limitmove = totalclock;
|
||||
limitmove = (int32_t) totalclock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1847,7 +1847,7 @@ MNU_OrderCustom(UserCall call, MenuItem *item)
|
|||
}
|
||||
|
||||
int m,i;
|
||||
for (m=0, i=(totalclock/104)%numscrollerlines; m<4; m++,i++)
|
||||
for (m=0, i=((int32_t) totalclock/104)%numscrollerlines; m<4; m++,i++)
|
||||
{
|
||||
if (i == numscrollerlines)
|
||||
i=0;
|
||||
|
@ -2998,7 +2998,7 @@ MNU_LoadSaveDraw(UserCall call, MenuItem_p item)
|
|||
char tmp[sizeof(SaveGameDescr[0])*2];
|
||||
|
||||
//cur_show ^= 1;
|
||||
cur_show = (totalclock & 32);
|
||||
cur_show = ((int32_t) totalclock & 32);
|
||||
if (cur_show)
|
||||
{
|
||||
// add a cursor to the end
|
||||
|
@ -4610,7 +4610,7 @@ void MNU_DoMenu(CTLType type, PLAYERp pp)
|
|||
mnu_input.dir = dir_None;
|
||||
|
||||
// should not get input if you are editing a save game slot
|
||||
if (totalclock < limitmove) limitmove = totalclock;
|
||||
if (totalclock < limitmove) limitmove = (int32_t) totalclock;
|
||||
if (!MenuInputMode)
|
||||
{
|
||||
UserInput tst_input;
|
||||
|
@ -4658,7 +4658,7 @@ void MNU_DoMenu(CTLType type, PLAYERp pp)
|
|||
if (!FX_SoundActive(handle2))
|
||||
handle2 = PlaySound(DIGI_STAR,&zero,&zero,&zero,v3df_dontpan);
|
||||
|
||||
limitmove = totalclock;
|
||||
limitmove = (int32_t) totalclock;
|
||||
mnu_input_buffered.dir = dir_None;
|
||||
}
|
||||
}
|
||||
|
@ -4885,9 +4885,9 @@ Fade_Timer(int clicks)
|
|||
// unsigned int now;
|
||||
int now;
|
||||
|
||||
now = totalclock;
|
||||
now = (int32_t) totalclock;
|
||||
|
||||
while (abs(totalclock - now) < clicks) handleevents();
|
||||
while (abs((int32_t) totalclock - now) < clicks) handleevents();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -423,7 +423,7 @@ void
|
|||
PauseAction(void)
|
||||
{
|
||||
ready2send = 0;
|
||||
save_totalclock = totalclock;
|
||||
save_totalclock = (int32_t) totalclock;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -842,7 +842,7 @@ void ErrorCorrectionQuit(void)
|
|||
{
|
||||
for (j = 0; j < MAX_SW_PLAYERS; j++)
|
||||
{
|
||||
oldtotalclock = totalclock;
|
||||
oldtotalclock = (int32_t) totalclock;
|
||||
while (totalclock < oldtotalclock + synctics)
|
||||
{
|
||||
handleevents();
|
||||
|
|
|
@ -100,7 +100,7 @@ static int32_t timert;
|
|||
|
||||
int32_t GetTime(void)
|
||||
{
|
||||
return totalclock;
|
||||
return (int32_t) totalclock;
|
||||
//return timert++;
|
||||
}
|
||||
|
||||
|
|
|
@ -17900,14 +17900,14 @@ InitUzi(PLAYERp pp)
|
|||
|
||||
if (uziclock > totalclock)
|
||||
{
|
||||
uziclock = totalclock;
|
||||
uziclock = (int32_t) totalclock;
|
||||
FireSnd = TRUE;
|
||||
}
|
||||
|
||||
clockdiff = totalclock - uziclock;
|
||||
clockdiff = (int32_t) totalclock - uziclock;
|
||||
if (clockdiff > UZIFIRE_WAIT)
|
||||
{
|
||||
uziclock = totalclock;
|
||||
uziclock = (int32_t) totalclock;
|
||||
FireSnd = TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue