Skip to content

Commit

Permalink
Pause texture animations when the game is paused, except for hardware…
Browse files Browse the repository at this point in the history
… warp
  • Loading branch information
IgeNiaI committed Mar 15, 2023
1 parent d366e99 commit 385f407
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gl/scene/gl_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "r_utility.h"
#include "a_hexenglobal.h"
#include "p_local.h"
#include "cl_demo.h"
#include "gl/gl_functions.h"

#include "gl/system/gl_interface.h"
Expand Down Expand Up @@ -895,9 +896,12 @@ sector_t * FGLRenderer::RenderViewpoint (AActor * camera, GL_IRECT * bounds, flo
SetViewArea (camera);
mAngles.Pitch = clamp<float>((float)((double)(int)(viewpitch))/ANGLE_1, -90, 90);

// Scroll the sky
mSky1Pos = (float)fmod(gl_frameMS * level.skyspeed1, 1024.f) * 90.f/256.f;
mSky2Pos = (float)fmod(gl_frameMS * level.skyspeed2, 1024.f) * 90.f/256.f;
if (!paused && !CLIENTDEMO_IsPaused())
{
// Scroll the sky
mSky1Pos = (float)fmod(gl_frameMS * level.skyspeed1, 1024.f) * 90.f/256.f;
mSky2Pos = (float)fmod(gl_frameMS * level.skyspeed2, 1024.f) * 90.f/256.f;
}



Expand Down
4 changes: 4 additions & 0 deletions src/gl/textures/gl_material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "templates.h"
#include "sc_man.h"
#include "colormatcher.h"
#include "cl_demo.h"

//#include "gl/gl_intern.h"

Expand Down Expand Up @@ -194,6 +195,9 @@ void FGLTexture::Clean(bool all)

BYTE *FGLTexture::WarpBuffer(BYTE *buffer, int Width, int Height, int warp)
{
if (paused || CLIENTDEMO_IsPaused())
return buffer;

if (Width > 256 || Height > 256) return buffer;

DWORD *in = (DWORD*)buffer;
Expand Down
4 changes: 4 additions & 0 deletions src/r_sky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "r_utility.h"
#include "v_text.h"
#include "gi.h"
#include "cl_demo.h"

//
// sky mapping
Expand Down Expand Up @@ -146,6 +147,9 @@ void R_InitSkyMap ()

void R_UpdateSky (DWORD mstime)
{
if (paused || CLIENTDEMO_IsPaused())
return;

// Scroll the sky
double ms = (double)mstime * FRACUNIT;
sky1pos = ms * level.skyspeed1;
Expand Down
4 changes: 4 additions & 0 deletions src/textures/animations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "w_wad.h"
#include "g_level.h"
#include "farchive.h"
#include "cl_demo.h"

// MACROS ------------------------------------------------------------------

Expand Down Expand Up @@ -871,6 +872,9 @@ void FTextureManager::SetTranslation (FTextureID fromtexnum, FTextureID totexnum

void FTextureManager::UpdateAnimations (DWORD mstime)
{
if (paused || CLIENTDEMO_IsPaused())
return;

for (unsigned int j = 0; j < mAnimations.Size(); ++j)
{
FAnimDef *anim = mAnimations[j];
Expand Down
7 changes: 7 additions & 0 deletions src/textures/warptexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "templates.h"
#include "r_utility.h"
#include "textures/textures.h"
#include "cl_demo.h"


FWarpTexture::FWarpTexture (FTexture *source)
Expand Down Expand Up @@ -121,6 +122,9 @@ const BYTE *FWarpTexture::GetColumn (unsigned int column, const Span **spans_out

void FWarpTexture::MakeTexture (DWORD time)
{
if (paused || CLIENTDEMO_IsPaused())
return;

const BYTE *otherpix = SourcePic->GetPixels ();

if (Pixels == NULL)
Expand Down Expand Up @@ -178,6 +182,9 @@ FWarp2Texture::FWarp2Texture (FTexture *source)

void FWarp2Texture::MakeTexture (DWORD time)
{
if (paused || CLIENTDEMO_IsPaused())
return;

const BYTE *otherpix = SourcePic->GetPixels ();

if (Pixels == NULL)
Expand Down

0 comments on commit 385f407

Please sign in to comment.