From 61bd811dfd9fa472fb9acbded14b7cedd4fd0424 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 2 Sep 2024 17:43:57 +0200 Subject: [PATCH] more stuff i forgor --- src/d_clisrv.c | 15 +------ src/hardware/r_opengl/r_opengl.c | 69 ++++++++++++++++---------------- src/i_time.c | 8 +--- src/lua_blockmaplib.c | 2 +- 4 files changed, 38 insertions(+), 56 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 491d98728..4c4855b71 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -6327,8 +6327,6 @@ boolean TryRunTics(tic_t realtics) if (ticking) { - boolean tickInterp = true; - // run the count * tics while (neededtic > gametic) { @@ -6339,18 +6337,7 @@ boolean TryRunTics(tic_t realtics) if (update_stats) PS_START_TIMING(ps_tictime); - boolean run = (gametic % NEWTICRATERATIO) == 0; - - if (run && tickInterp) - { - // Update old view state BEFORE ticking so resetting - // the old interpolation state from game logic works. - R_UpdateViewInterpolation(); - tickInterp = false; // do not update again in sped-up tics - } - - G_Ticker(run); - + G_Ticker((gametic % NEWTICRATERATIO) == 0); ExtraDataTicker(); gametic++; consistancy[gametic%TICQUEUE] = Consistancy(); diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 426e91649..d1fedcbfa 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -795,7 +795,7 @@ EXPORT boolean HWRAPI(InitShaders) (void) { if (!pglUseProgram) return false; - + gl_fallback_shader.vertex_shader = Z_StrDup(GLSL_FALLBACK_VERTEX_SHADER); gl_fallback_shader.fragment_shader = Z_StrDup(GLSL_FALLBACK_FRAGMENT_SHADER); @@ -1016,6 +1016,39 @@ void SetStates(void) pglScalef(1.0f, 1.0f, -1.0f); pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer) } +// -----------------+ +// DeleteTexture : Deletes a texture from the GPU and frees its data +// -----------------+ +EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo) +{ + FTextureInfo *head = TexCacheHead; + + if (!pTexInfo) + return; + else if (pTexInfo->downloaded) + pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded); + + while (head) + { + if (head->downloaded == pTexInfo->downloaded) + { + if (head->next) + head->next->prev = head->prev; + else // no next -> tail is being deleted -> update TexCacheTail + TexCacheTail = head->prev; + if (head->prev) + head->prev->next = head->next; + else // no prev -> head is being deleted -> update TexCacheHead + TexCacheHead = head->next; + free(head); + break; + } + + head = head->next; + } + + pTexInfo->downloaded = 0; +} #ifdef USE_FBO_OGL static void GLFramebuffer_GenerateAttachments(void) @@ -1139,40 +1172,6 @@ void GLFramebuffer_Disable(void) GLFramebuffer_Delete(); } #endif -// -----------------+ -// DeleteTexture : Deletes a texture from the GPU and frees its data -// -----------------+ -EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo) -{ - FTextureInfo *head = TexCacheHead; - - if (!pTexInfo) - return; - else if (pTexInfo->downloaded) - pglDeleteTextures(1, (GLuint *)&pTexInfo->downloaded); - - while (head) - { - if (head->downloaded == pTexInfo->downloaded) - { - if (head->next) - head->next->prev = head->prev; - else // no next -> tail is being deleted -> update TexCacheTail - TexCacheTail = head->prev; - if (head->prev) - head->prev->next = head->next; - else // no prev -> head is being deleted -> update TexCacheHead - TexCacheHead = head->next; - free(head); - break; - } - - head = head->next; - } - - pTexInfo->downloaded = 0; -} - // -----------------+ // Flush : flush OpenGL textures diff --git a/src/i_time.c b/src/i_time.c index 61a267a96..a1ef580bd 100644 --- a/src/i_time.c +++ b/src/i_time.c @@ -63,10 +63,9 @@ void I_UpdateTime(fixed_t timescale) enterprecise = I_GetPreciseTime(); elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision(); tictimer += elapsedseconds; - - while (tictimer >= (1.0 / ticratescaled)) + while (tictimer > 1.0/ticratescaled) { - entertic ++; + entertic += 1; tictimer -= 1.0/ticratescaled; } realtics = entertic - oldentertics; @@ -81,6 +80,3 @@ void I_UpdateTime(fixed_t timescale) g_time.timefrac = FLOAT_TO_FIXED(fractional); } } - - - diff --git a/src/lua_blockmaplib.c b/src/lua_blockmaplib.c index 945131e66..0b93766b8 100644 --- a/src/lua_blockmaplib.c +++ b/src/lua_blockmaplib.c @@ -256,4 +256,4 @@ int LUA_BlockmapLib(lua_State *L) { lua_register(L, "searchBlockmap", lib_searchBlockmap); return 0; -} +} \ No newline at end of file