Compare commits
35
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0da78ae3d1 | ||
|
|
f029a2b7d8 | ||
|
|
32bd5a02ec | ||
|
|
9a100439df | ||
|
|
3b37f85024 | ||
|
|
27a65ef973 | ||
|
|
ffa9b2fa9a | ||
|
|
ab9e0f923e | ||
|
|
8bf3953b4a | ||
|
|
44ef42cf84 | ||
|
|
746035bfea | ||
|
|
70bc9879b3 | ||
|
|
0e6a794a84 | ||
|
|
4eccf40a0a | ||
|
|
e3fd46297a | ||
|
|
4c2e119385 | ||
|
|
229a6a161e | ||
|
|
1b2e4a1acc | ||
|
|
2e6d49fcd6 | ||
|
|
7a8c66781b | ||
|
|
c877226bfe | ||
|
|
ac3c8b1d25 | ||
|
|
feeba45b0d | ||
|
|
06f3d2c91b | ||
|
|
332fadc823 | ||
|
|
39dc1b85e3 | ||
|
|
5b2413444f | ||
|
|
7855b2ed95 | ||
|
|
caebe62ddb | ||
|
|
9de285caac | ||
|
|
9bb4420ad3 | ||
|
|
8dc3d870a1 | ||
|
|
158546bd73 | ||
|
|
b89a3f1017 | ||
|
|
f2e355a5a8 |
No files matched your search
+20
-96
@@ -350,8 +350,6 @@ static void D_Renderview(void)
|
||||
// added comment : there is a wipe eatch change of the gamestate
|
||||
gamestate_t wipegamestate = GS_LEVEL;
|
||||
|
||||
static void D_LimitFps(void);
|
||||
|
||||
static void D_MakeIntermissionBG(void)
|
||||
{
|
||||
if (!lastdraw)
|
||||
@@ -647,10 +645,6 @@ static boolean D_Display(void)
|
||||
|
||||
CON_Drawer(); // Ha, i LIED!
|
||||
|
||||
// be sure to limit our fps *before* drawing
|
||||
// so we can properly "pace" our frames
|
||||
D_LimitFps();
|
||||
|
||||
if (cv_lua_profile.value > 0)
|
||||
{
|
||||
LUA_RenderTimers();
|
||||
@@ -664,78 +658,6 @@ static boolean D_Display(void)
|
||||
return ranwipe;
|
||||
}
|
||||
|
||||
static precise_t sleeptime = 0;
|
||||
|
||||
static boolean D_UseNewFramelimiter(void)
|
||||
{
|
||||
//if (!cv_newframelimiter.value) return false;
|
||||
return (rendermode != render_none && !dedicated && (R_GetFramerateCap() >= 45) && R_UsingFrameInterpolation());
|
||||
}
|
||||
|
||||
static void D_LimitFps(void)
|
||||
{
|
||||
precise_t curtime, start;
|
||||
static precise_t lasttime = 0;
|
||||
|
||||
// timedemo runs uncapped!
|
||||
if (singletics)
|
||||
return;
|
||||
|
||||
if (!D_UseNewFramelimiter())
|
||||
return;
|
||||
|
||||
const UINT32 framecap = R_GetFramerateCap();
|
||||
|
||||
// uncapped obviously does not need to be... capped...
|
||||
if (framecap == 0)
|
||||
return;
|
||||
|
||||
// dont need to sleep if we vsync and our framecap is set to refresh rate or higher
|
||||
if (cv_vidwait.value && (cv_fpscap.value == 0 || framecap > I_GetRefreshRate()))
|
||||
return;
|
||||
|
||||
start = I_GetPreciseTime();
|
||||
|
||||
const UINT64 precision = I_GetPrecisePrecision();
|
||||
|
||||
// frametarget in precise_t ticks (ex. 60fps = ~16,666,666)
|
||||
const precise_t frametarget = precision / framecap;
|
||||
|
||||
lasttime += frametarget;
|
||||
|
||||
// just sync this up if we missed the target
|
||||
if ((INT64)(start - lasttime) >= 0)
|
||||
lasttime = start;
|
||||
|
||||
while (1)
|
||||
{
|
||||
// check the current time against the "time of the old frame"
|
||||
curtime = I_GetPreciseTime();
|
||||
|
||||
// done waiting!
|
||||
// continue as normal
|
||||
if ((INT64)(curtime - lasttime) >= 0)
|
||||
{
|
||||
// time we spent :chaosleep:ing or doing absolutely nothing
|
||||
// for frameskip calculations
|
||||
sleeptime = curtime - start;
|
||||
return;
|
||||
}
|
||||
|
||||
// if we have more than 1ms to wait
|
||||
// sleep for a bit to not trash the cpu lul
|
||||
precise_t remaining = lasttime - curtime;
|
||||
|
||||
if (remaining > (precise_t)(precision / 1000))
|
||||
{
|
||||
// sleep for 90% of the time we gotta wait for the next frame
|
||||
// since we dont wanna oversleep :chaosleep:
|
||||
I_SleepDuration(9 * remaining / 10);
|
||||
}
|
||||
}
|
||||
// the rest we just be waitin until we meet our frametime target
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// D_SRB2Loop
|
||||
// =========================================================================
|
||||
@@ -787,13 +709,13 @@ void D_SRB2Loop(void)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
// capbudget is the minimum precise_t duration of a single loop iteration
|
||||
precise_t capbudget;
|
||||
precise_t elapsed;
|
||||
precise_t enterprecise, finishprecise;
|
||||
|
||||
boolean ranwipe = false;
|
||||
|
||||
sleeptime = 0;
|
||||
|
||||
enterprecise = I_GetPreciseTime();
|
||||
|
||||
I_HandleInterrupt();
|
||||
@@ -801,6 +723,10 @@ void D_SRB2Loop(void)
|
||||
memset(&g_dc, 0, sizeof(g_dc));
|
||||
Z_Frame_Reset();
|
||||
|
||||
// Casting the return value of a function is bad practice (apparently)
|
||||
const UINT32 framecap = R_GetFramerateCap();
|
||||
capbudget = (framecap == 0) ? 0 : (precise_t)((double)precision / (double)framecap + 0.5); // + 0.5 instead of round
|
||||
|
||||
I_UpdateTime(cv_timescale.value);
|
||||
|
||||
if (lastwipetic)
|
||||
@@ -821,9 +747,11 @@ void D_SRB2Loop(void)
|
||||
}
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
if (!realtics && debugload)
|
||||
debugload--;
|
||||
if (!realtics)
|
||||
if (debugload)
|
||||
debugload--;
|
||||
#endif
|
||||
|
||||
interp = !dedicated && R_UsingFrameInterpolation();
|
||||
doDisplay = false;
|
||||
|
||||
@@ -857,7 +785,6 @@ void D_SRB2Loop(void)
|
||||
{
|
||||
P_RunChaseCameras();
|
||||
}
|
||||
|
||||
R_UpdateViewInterpolation();
|
||||
}
|
||||
|
||||
@@ -903,6 +830,7 @@ void D_SRB2Loop(void)
|
||||
M_SaveFrame();
|
||||
if (takescreenshot)
|
||||
M_DoScreenShot();
|
||||
|
||||
#ifndef DEDICATED
|
||||
if (!dedicated && renderisnewtic)
|
||||
{
|
||||
@@ -924,9 +852,9 @@ void D_SRB2Loop(void)
|
||||
// Fully completed frame made.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
|
||||
// Use the time without sleep for frameskip calculations:
|
||||
// Use the time before sleep for frameskip calculations:
|
||||
// post-sleep time is literally being intentionally wasted
|
||||
elapsed = (finishprecise - enterprecise) - sleeptime;
|
||||
elapsed = finishprecise - enterprecise;
|
||||
deltasecs = (double)elapsed / (double)precision;
|
||||
deltatics = deltasecs * (double)NEWTICRATE;
|
||||
|
||||
@@ -954,12 +882,8 @@ void D_SRB2Loop(void)
|
||||
frameskip = 0;
|
||||
}
|
||||
|
||||
// old fps limiter
|
||||
if (!singletics && !D_UseNewFramelimiter())
|
||||
if (!singletics)
|
||||
{
|
||||
const UINT32 framecap = R_GetFramerateCap();
|
||||
const precise_t capbudget = (framecap == 0) ? 0 : (precise_t)((double)precision / (double)framecap + 0.5); // + 0.5 instead of round
|
||||
|
||||
// in the case of "match refresh rate" + vsync, don't sleep at all
|
||||
const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0;
|
||||
|
||||
@@ -967,13 +891,13 @@ void D_SRB2Loop(void)
|
||||
{
|
||||
I_SleepDuration(capbudget - elapsed);
|
||||
}
|
||||
|
||||
// Capture the time once more to get the real delta time.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
elapsed = finishprecise - enterprecise;
|
||||
deltasecs = (double)elapsed / (double)precision;
|
||||
deltatics = deltasecs * (double)NEWTICRATE;
|
||||
}
|
||||
|
||||
// Capture the time once more to get the real delta time.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
elapsed = finishprecise - enterprecise;
|
||||
deltasecs = (double)elapsed / (double)precision;
|
||||
deltatics = deltasecs * (double)NEWTICRATE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+34
-4
@@ -752,9 +752,14 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr
|
||||
|
||||
static void SOCK_Send(void)
|
||||
{
|
||||
ssize_t c = ERRSOCKET;
|
||||
int e = 0; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
size_t i, j;
|
||||
int retrycount = 0;
|
||||
ssize_t c;
|
||||
int e; // save error code so it can't be modified later code and avoid calling WSAGetLastError() more then once
|
||||
|
||||
retry:
|
||||
c = ERRSOCKET;
|
||||
e = 0;
|
||||
|
||||
if (doomcom->remotenode < 0 || !nodeconnected[doomcom->remotenode])
|
||||
return;
|
||||
@@ -808,10 +813,35 @@ static void SOCK_Send(void)
|
||||
|
||||
if (c == ERRSOCKET && e != 0) // 0 means no socket for the address family was found
|
||||
{
|
||||
if (!ALLOWEDERROR(e))
|
||||
I_Error("SOCK_Send, error sending to node %d (%s) #%u, %s", doomcom->remotenode,
|
||||
if (ALLOWEDERROR(e))
|
||||
return;
|
||||
|
||||
//if (!ALLOWEDERROR(e))
|
||||
//I_Error("SOCK_Send, error sending to node %d (%s) #%u, %s", doomcom->remotenode,
|
||||
//SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||
|
||||
// no need to spam this on retries
|
||||
if (retrycount == 0)
|
||||
CONS_Alert(CONS_ERROR, "SOCK_Send, error sending to node %d (%s) #%u, %s\n", doomcom->remotenode,
|
||||
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||
|
||||
// retry sending it
|
||||
if (retrycount <= 3)
|
||||
{
|
||||
CONS_Printf("SOCK_Send: retrying... Attempt %d\n", retrycount+1);
|
||||
retrycount++;
|
||||
// wait quarter of a second or smth
|
||||
I_Sleep(250);
|
||||
goto retry;
|
||||
}
|
||||
|
||||
// no recovery, guess we die
|
||||
I_Error("SOCK_Send, error sending to node %d (%s) #%u, %s", doomcom->remotenode,
|
||||
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||
}
|
||||
|
||||
if (retrycount > 0)
|
||||
CONS_Alert(CONS_NOTICE, "SOCK_Send: successfully reconnected on Attempt %d\n", retrycount);
|
||||
}
|
||||
#undef ALLOWEDERROR
|
||||
|
||||
|
||||
+1
-5
@@ -217,11 +217,7 @@ static int mobj_get(lua_State *L)
|
||||
case mobj_skin: // skin name or nil, not struct
|
||||
if (!mo->skin)
|
||||
return 0;
|
||||
// HUD ONLY!!!!!!!!!!
|
||||
if (hud_running && cv_luaimmersion.value)
|
||||
lua_pushstring(L, K_GetMobjSkin(mo)->name);
|
||||
else
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
lua_pushstring(L, ((skin_t *)mo->skin)->name);
|
||||
break;
|
||||
case mobj_color:
|
||||
lua_pushinteger(L, mo->color);
|
||||
|
||||
+2
-2
@@ -262,9 +262,9 @@ void OglSdlFinishUpdate(SDL_Window *window)
|
||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||
// effects that want to take the old screen can do so after this
|
||||
#ifdef USE_FBO_OGL
|
||||
if (!usefbo && (realwidth != sdlw || realheight != sdlh || WipeInAction)) // not needed if fbo is in use
|
||||
if (!usefbo && (realwidth != sdlw || realheight != sdlh)) // not needed if fbo is in use
|
||||
#else
|
||||
if (realwidth != sdlw || realheight != sdlh || WipeInAction) // this is not needed if the render size matches window size
|
||||
if (realwidth != sdlw || realheight != sdlh) // this is not needed if the render size matches window size
|
||||
#endif
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user