diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 041bab805d..d8784959e6 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ January 27, 2008 (Changes by Graf Zahl) +- Added a PrecacheTexture virtual function to DFrameBuffer because it's the + renderer which should decide how to precache a texture. - Added SnowKate709's APROP_MaxHealth submission. - Fixed: FTexture::GetScaledWidth/Height always rounded down which could result in imprecisions (e.g. when scaling from 128 to 96.) diff --git a/src/r_data.cpp b/src/r_data.cpp index 74add59762..75a6820582 100644 --- a/src/r_data.cpp +++ b/src/r_data.cpp @@ -485,18 +485,7 @@ void R_PrecacheLevel (void) for (i = TexMan.NumTextures() - 1; i >= 0; i--) { - FTexture *tex = TexMan[i]; - if (tex != NULL) - { - if (hitlist[i]) - { - tex->GetPixels (); - } - else - { - tex->Unload (); - } - } + screen->PrecacheTexture(TexMan[i], !!hitlist[i]); } delete[] hitlist; diff --git a/src/r_defs.h b/src/r_defs.h index a2f09710f7..7902032f7b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -844,8 +844,6 @@ private: TArray Translation; WORD HashFirst[HASH_SIZE]; int DefaultTexture; - - friend void R_InitData (); }; extern FTextureManager TexMan; diff --git a/src/v_video.cpp b/src/v_video.cpp index ebb3282ebd..34d7e03b42 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1316,6 +1316,27 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int } } +//=========================================================================== +// +// Texture precaching +// +//=========================================================================== + +void DFrameBuffer::PrecacheTexture(FTexture *tex, bool cache) +{ + if (tex != NULL) + { + if (cache) + { + tex->GetPixels (); + } + else + { + tex->Unload (); + } + } +} + //=========================================================================== // // Render the view diff --git a/src/v_video.h b/src/v_video.h index efa0cf7587..c1445c85c2 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -49,6 +49,8 @@ extern int CleanWidth, CleanHeight, CleanXfac, CleanYfac; extern int DisplayWidth, DisplayHeight, DisplayBits; +bool V_DoModeSetup (int width, int height, int bits); + class FTexture; // TagItem definitions for DrawTexture. As far as I know, tag lists @@ -375,6 +377,9 @@ public: const BYTE *patch, int pix_width, int pix_height, int step_x, int step_y, PalEntry * palette); + // Precaches or unloads a texture + virtual void PrecacheTexture(FTexture *tex, bool cache); + // Screen wiping virtual bool WipeStartScreen(int type); virtual void WipeEndScreen();