- moved the code from r_data.cpp to some better fitting places and deleted this file and r_data.h because the remaining parts of it were just a random collection of unrelated functions.
SVN r3248 (trunk)
This commit is contained in:
parent
2a3d1a4493
commit
17ed7aaabd
59 changed files with 268 additions and 52 deletions
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "w_wad.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "templates.h"
|
||||
#include "cmdlib.h"
|
||||
#include "st_start.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
#include "files.h"
|
||||
#include "r_local.h"
|
||||
#include "v_palette.h"
|
||||
#include "v_video.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
extern float LastFOV;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@
|
|||
#include "w_wad.h"
|
||||
#include "templates.h"
|
||||
#include "bitmap.h"
|
||||
#include "v_video.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
// Since we want this to compile under Linux too, we need to define this
|
||||
// stuff ourselves instead of including a DirectX header.
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "w_wad.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "w_wad.h"
|
||||
#include "v_palette.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "w_wad.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -35,11 +35,12 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "r_jpeg.h"
|
||||
#include "w_wad.h"
|
||||
#include "v_text.h"
|
||||
#include "bitmap.h"
|
||||
#include "v_video.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include <ctype.h>
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "w_wad.h"
|
||||
#include "i_system.h"
|
||||
#include "gi.h"
|
||||
|
|
@ -47,6 +46,9 @@
|
|||
#include "bitmap.h"
|
||||
#include "colormatcher.h"
|
||||
#include "v_palette.h"
|
||||
#include "v_video.h"
|
||||
#include "m_fixed.h"
|
||||
#include "textures/textures.h"
|
||||
#include "resources/colormaps.h"
|
||||
|
||||
// On the Alpha, accessing the shorts directly if they aren't aligned on a
|
||||
|
|
|
|||
|
|
@ -35,10 +35,18 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "w_wad.h"
|
||||
#include "templates.h"
|
||||
#include "v_palette.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
|
||||
// posts are runs of non masked source pixels
|
||||
struct column_t
|
||||
{
|
||||
BYTE topdelta; // -1 is the last post in a column
|
||||
BYTE length; // length data bytes follows
|
||||
};
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@
|
|||
#include "templates.h"
|
||||
#include "bitmap.h"
|
||||
#include "colormatcher.h"
|
||||
#include "v_video.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#include "m_png.h"
|
||||
#include "bitmap.h"
|
||||
#include "v_palette.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "w_wad.h"
|
||||
#include "v_palette.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -36,12 +36,15 @@
|
|||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "w_wad.h"
|
||||
#include "r_data.h"
|
||||
#include "templates.h"
|
||||
#include "i_system.h"
|
||||
#include "r_translate.h"
|
||||
#include "bitmap.h"
|
||||
#include "colormatcher.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "v_video.h"
|
||||
#include "m_fixed.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
typedef bool (*CheckFunc)(FileReader & file);
|
||||
typedef FTexture * (*CreateFunc)(FileReader & file, int lumpnum);
|
||||
|
|
@ -596,3 +599,37 @@ const BYTE *FDummyTexture::GetPixels ()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Debug stuff
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Prints the spans generated for a texture. Only needed for debugging.
|
||||
CCMD (printspans)
|
||||
{
|
||||
if (argv.argc() != 2)
|
||||
return;
|
||||
|
||||
FTextureID picnum = TexMan.CheckForTexture (argv[1], FTexture::TEX_Any);
|
||||
if (!picnum.Exists())
|
||||
{
|
||||
Printf ("Unknown texture %s\n", argv[1]);
|
||||
return;
|
||||
}
|
||||
FTexture *tex = TexMan[picnum];
|
||||
for (int x = 0; x < tex->GetWidth(); ++x)
|
||||
{
|
||||
const FTexture::Span *spans;
|
||||
Printf ("%4d:", x);
|
||||
tex->GetColumn (x, &spans);
|
||||
while (spans->Length != 0)
|
||||
{
|
||||
Printf (" (%4d,%4d)", spans->TopOffset, spans->TopOffset+spans->Length-1);
|
||||
spans++;
|
||||
}
|
||||
Printf ("\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@
|
|||
*/
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "doomstat.h"
|
||||
#include "w_wad.h"
|
||||
#include "r_data.h"
|
||||
#include "templates.h"
|
||||
#include "i_system.h"
|
||||
#include "r_translate.h"
|
||||
|
|
@ -47,6 +47,10 @@
|
|||
#include "st_start.h"
|
||||
#include "cmdlib.h"
|
||||
#include "g_level.h"
|
||||
#include "m_fixed.h"
|
||||
#include "farchive.h"
|
||||
#include "v_video.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
FTextureManager TexMan;
|
||||
|
||||
|
|
@ -1143,6 +1147,36 @@ int FTextureManager::CountLumpTextures (int lumpnum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// R_PrecacheLevel
|
||||
//
|
||||
// Preloads all relevant graphics for the level.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void FTextureManager::PrecacheLevel (void)
|
||||
{
|
||||
BYTE *hitlist;
|
||||
int cnt = NumTextures();
|
||||
|
||||
if (demoplayback)
|
||||
return;
|
||||
|
||||
hitlist = new BYTE[cnt];
|
||||
memset (hitlist, 0, cnt);
|
||||
|
||||
screen->GetHitlist(hitlist);
|
||||
for (int i = cnt - 1; i >= 0; i--)
|
||||
{
|
||||
screen->PrecacheTexture(ByIndex(i), hitlist[i]);
|
||||
}
|
||||
|
||||
delete[] hitlist;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
|||
|
|
@ -392,6 +392,7 @@ public:
|
|||
void UnloadAll ();
|
||||
|
||||
int NumTextures () const { return (int)Textures.Size(); }
|
||||
void PrecacheLevel (void);
|
||||
|
||||
void WriteTexture (FArchive &arc, int picnum);
|
||||
int ReadTexture (FArchive &arc);
|
||||
|
|
@ -457,6 +458,86 @@ private:
|
|||
TArray<BYTE *> BuildTileFiles;
|
||||
};
|
||||
|
||||
// A texture that doesn't really exist
|
||||
class FDummyTexture : public FTexture
|
||||
{
|
||||
public:
|
||||
FDummyTexture ();
|
||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||
const BYTE *GetPixels ();
|
||||
void Unload ();
|
||||
void SetSize (int width, int height);
|
||||
};
|
||||
|
||||
// A texture that returns a wiggly version of another texture.
|
||||
class FWarpTexture : public FTexture
|
||||
{
|
||||
public:
|
||||
FWarpTexture (FTexture *source);
|
||||
~FWarpTexture ();
|
||||
|
||||
virtual int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate=0, FCopyInfo *inf = NULL);
|
||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||
const BYTE *GetPixels ();
|
||||
void Unload ();
|
||||
bool CheckModified ();
|
||||
|
||||
float GetSpeed() const { return Speed; }
|
||||
int GetSourceLump() { return SourcePic->GetSourceLump(); }
|
||||
void SetSpeed(float fac) { Speed = fac; }
|
||||
FTexture *GetRedirect(bool wantwarped);
|
||||
|
||||
DWORD GenTime;
|
||||
protected:
|
||||
FTexture *SourcePic;
|
||||
BYTE *Pixels;
|
||||
Span **Spans;
|
||||
float Speed;
|
||||
|
||||
virtual void MakeTexture (DWORD time);
|
||||
};
|
||||
|
||||
// [GRB] Eternity-like warping
|
||||
class FWarp2Texture : public FWarpTexture
|
||||
{
|
||||
public:
|
||||
FWarp2Texture (FTexture *source);
|
||||
|
||||
protected:
|
||||
void MakeTexture (DWORD time);
|
||||
};
|
||||
|
||||
// A texture that can be drawn to.
|
||||
class DSimpleCanvas;
|
||||
class AActor;
|
||||
class FArchive;
|
||||
|
||||
class FCanvasTexture : public FTexture
|
||||
{
|
||||
public:
|
||||
FCanvasTexture (const char *name, int width, int height);
|
||||
~FCanvasTexture ();
|
||||
|
||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||
const BYTE *GetPixels ();
|
||||
void Unload ();
|
||||
bool CheckModified ();
|
||||
void RenderView (AActor *viewpoint, int fov);
|
||||
void NeedUpdate() { bNeedsUpdate=true; }
|
||||
|
||||
protected:
|
||||
DSimpleCanvas *Canvas;
|
||||
BYTE *Pixels;
|
||||
Span DummySpans[2];
|
||||
BYTE bNeedsUpdate:1;
|
||||
BYTE bDidUpdate:1;
|
||||
BYTE bFirstUpdate:1;
|
||||
|
||||
void MakeTexture ();
|
||||
|
||||
friend struct FCanvasTextureInfo;
|
||||
};
|
||||
|
||||
extern FTextureManager TexMan;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@
|
|||
#include "templates.h"
|
||||
#include "bitmap.h"
|
||||
#include "colormatcher.h"
|
||||
#include "v_video.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "files.h"
|
||||
#include "r_data.h"
|
||||
#include "r_main.h"
|
||||
#include "templates.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
|
||||
FWarpTexture::FWarpTexture (FTexture *source)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue