- 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:
Christoph Oelckers 2011-07-05 10:02:38 +00:00
parent 2a3d1a4493
commit 17ed7aaabd
59 changed files with 268 additions and 52 deletions

View file

@ -724,7 +724,6 @@ add_executable( zdoom WIN32
po_man.cpp
r_3dfloors.cpp
r_bsp.cpp
r_data.cpp
r_draw.cpp
r_drawt.cpp
r_interpolate.cpp

View file

@ -70,6 +70,7 @@
#include "d_net.h"
#include "v_text.h"
#include "p_lnspec.h"
#include "v_video.h"
extern FILE *Logfile;
extern bool insave;

View file

@ -58,6 +58,7 @@
#include "d_event.h"
#include "m_argv.h"
#include "p_lnspec.h"
#include "v_video.h"
int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide,
int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net);

View file

@ -48,6 +48,7 @@
#include "gi.h"
#include "g_level.h"
#include "colormatcher.h"
#include "b_bot.h"
FDecalLib DecalLibrary;

View file

@ -61,7 +61,6 @@
#include "b_bot.h"
#include "p_local.h"
#include "g_game.h"
#include "r_data.h"
#include "a_sharedglobal.h"
#include "sbar.h"
#include "stats.h"
@ -72,6 +71,7 @@
#include "doomstat.h"
#include "m_argv.h"
#include "po_man.h"
#include "v_video.h"
#include "menu/menu.h"
#include "intermission/intermission.h"

View file

@ -37,6 +37,7 @@
#include "p_local.h"
#include "farchive.h"
#include "sbar.h"
#include "v_video.h"

View file

@ -38,7 +38,6 @@
#include "g_level.h"
#include "sc_man.h"
#include "s_sound.h"
#include "r_data.h"
#include "r_sky.h"
#include "t_script.h"
#include "cmdlib.h"

View file

@ -61,7 +61,6 @@
#include "p_local.h"
#include "s_sound.h"
#include "gstrings.h"
#include "r_data.h"
#include "r_sky.h"
#include "r_draw.h"
#include "g_game.h"

View file

@ -42,7 +42,6 @@
#include "m_random.h"
#include "doomstat.h"
#include "wi_stuff.h"
#include "r_data.h"
#include "w_wad.h"
#include "am_map.h"
#include "c_dispatch.h"

View file

@ -2,10 +2,10 @@
#include "info.h"
#include "gi.h"
#include "r_data.h"
#include "a_pickups.h"
#include "templates.h"
#include "g_level.h"
#include "d_player.h"
IMPLEMENT_CLASS (AArmor)

View file

@ -1,13 +1,13 @@
#include "a_lightning.h"
#include "p_lnspec.h"
#include "statnums.h"
#include "r_data.h"
#include "m_random.h"
#include "templates.h"
#include "s_sound.h"
#include "p_acs.h"
#include "r_sky.h"
#include "g_level.h"
#include "r_state.h"
static FRandom pr_lightning ("Lightning");

View file

@ -40,7 +40,6 @@
#include "d_player.h"
#include "doomstat.h"
#include "v_font.h"
#include "r_data.h"
#include "p_spec.h"
EXTERN_CVAR(String, secretmessage)

View file

@ -51,6 +51,7 @@
#include "d_net.h"
#include "colormatcher.h"
#include "v_palette.h"
#include "d_player.h"
#include "../version.h"

View file

@ -38,6 +38,7 @@
#include "dobject.h"
#include "dthinker.h"
#include "doomtype.h"
#include "farchive.h"
#define LOCAL_SIZE 20
#define NUM_MAPVARS 128

View file

@ -35,7 +35,6 @@
#include <assert.h>
#include "actor.h"
#include "r_data.h"
#include "r_main.h"
#include "p_conversation.h"
#include "w_wad.h"

View file

@ -3,9 +3,13 @@
#include <tarray.h>
#include "s_sound.h"
#include "textures/textures.h"
struct FStrifeDialogueReply;
class FTexture;
struct FBrokenLines;
struct PClass;
struct FStrifeDialogueItemCheck
{

View file

@ -21,7 +21,6 @@
//
//-----------------------------------------------------------------------------
#include "r_data.h"
#include "p_spec.h"
#include "c_cvars.h"
#include "doomstat.h"

View file

@ -3936,7 +3936,7 @@ void P_SetupLevel (char *lumpname, int position)
// preload graphics and sounds
if (precache)
{
R_PrecacheLevel ();
TexMan.PrecacheLevel ();
S_PrecacheLevel ();
}
times[17].Unclock();

View file

@ -34,7 +34,6 @@
#include "doomtype.h"
#include "p_local.h"
#include "r_data.h"
#include "cmdlib.h"
#include "p_lnspec.h"

View file

@ -27,6 +27,7 @@
#include "dsectoreffect.h"
#include "doomdata.h"
#include "r_state.h"
class FScanner;
struct level_info_t;

View file

@ -33,7 +33,6 @@
**
*/
#include "r_data.h"
#include "p_setup.h"
#include "p_lnspec.h"
#include "templates.h"
@ -43,6 +42,7 @@
#include "g_level.h"
#include "v_palette.h"
#include "p_udmf.h"
#include "r_state.h"
#include "resources/colormaps.h"
//===========================================================================

View file

@ -32,7 +32,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "r_data.h"
#include "p_setup.h"
#include "p_lnspec.h"
#include "templates.h"
@ -40,6 +39,8 @@
#include "p_conversation.h"
#include "p_udmf.h"
#include "doomerrors.h"
#include "cmdlib.h"
#include "actor.h"
#define Zd 1
#define St 2

View file

@ -36,7 +36,6 @@
#include "g_level.h"
#include "p_lnspec.h"
#include "doomdata.h"
#include "r_data.h"
#include "m_swap.h"
#include "p_spec.h"
#include "p_local.h"

View file

@ -1031,15 +1031,6 @@ struct FMiniBSP
// 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
};
//
// OTHER TYPES
//

View file

@ -2043,6 +2043,18 @@ void R_DrawBorder (int x1, int y1, int x2, int y2)
}
}
//==========================================================================
//
// R_GetColumn
//
//==========================================================================
const BYTE *R_GetColumn (FTexture *tex, int col)
{
return tex->GetColumn (col, NULL);
}
/*
==================
=

View file

@ -23,7 +23,7 @@
#ifndef __R_DRAW__
#define __R_DRAW__
#include "r_data.h"
#include "r_defs.h"
extern "C" int ylookup[MAXHEIGHT];

View file

@ -33,7 +33,6 @@
**
*/
#include "r_data.h"
#include "p_3dmidtex.h"
#include "stats.h"
#include "r_interpolate.h"

View file

@ -1,6 +1,7 @@
#ifndef R_INTERPOLATE_H
#define R_INTERPOLATE_H
#include "dobject.h"
//==========================================================================
//
//

View file

@ -30,7 +30,6 @@
#include "doomdef.h"
// Include the refresh/render data structs.
#include "r_data.h"
//
// Separate header file for each module.

View file

@ -52,6 +52,8 @@
#include "r_3dfloors.h"
#include "v_palette.h"
#include "po_man.h"
#include "st_start.h"
#include "v_font.h"
#include "resources/colormaps.h"
// MACROS ------------------------------------------------------------------
@ -810,7 +812,12 @@ void R_Init ()
{
atterm (R_Shutdown);
R_InitData ();
StartScreen->Progress();
V_InitFonts();
StartScreen->Progress();
R_InitColormaps ();
StartScreen->Progress();
R_InitPointToAngle ();
R_InitTables ();
// viewwidth / viewheight are set by the defaults
@ -845,7 +852,22 @@ static void R_Shutdown ()
R_DeinitParticles();
R_DeinitTranslationTables();
R_DeinitPlanes();
R_DeinitData();
R_DeinitColormaps ();
FCanvasTextureInfo::EmptyList();
// Free openings
if (openings != NULL)
{
M_Free (openings);
openings = NULL;
}
// Free drawsegs
if (drawsegs != NULL)
{
M_Free (drawsegs);
drawsegs = NULL;
}
}
//==========================================================================

View file

@ -28,9 +28,9 @@
#define NUMCOLORMAPS 32
#include "d_player.h"
#include "r_data.h"
#include "r_state.h"
#include "v_palette.h"
#include "resources/colormaps.h"
//
@ -214,4 +214,24 @@ extern angle_t stacked_angle;
extern void R_CopyStackedViewParameters();
// This list keeps track of the cameras that draw into canvas textures.
struct FCanvasTextureInfo
{
FCanvasTextureInfo *Next;
TObjPtr<AActor> Viewpoint;
FCanvasTexture *Texture;
FTextureID PicNum;
int FOV;
static void Add (AActor *viewpoint, FTextureID picnum, int fov);
static void UpdateAll ();
static void EmptyList ();
static void Serialize (FArchive &arc);
static void Mark();
private:
static FCanvasTextureInfo *List;
};
#endif // __R_MAIN_H__

View file

@ -24,7 +24,6 @@
#define __R_PLANE_H__
#include <stddef.h>
#include "r_data.h"
class ASkyViewpoint;

View file

@ -81,6 +81,7 @@ Low priority:
#include "r_bsp.h"
#include "v_palette.h"
#include "v_font.h"
#include "v_video.h"
#include "resources/colormaps.h"
EXTERN_CVAR (Int, r_polymost)

View file

@ -28,7 +28,6 @@
// Needed for FRACUNIT.
#include "m_fixed.h"
#include "r_data.h"
#include "c_cvars.h"
#include "g_level.h"
#include "r_sky.h"

View file

@ -25,7 +25,6 @@
// Need data structure definitions.
#include "d_player.h"
#include "r_data.h"
//
// Refresh internal data structures,
@ -130,4 +129,6 @@ extern sector_t* viewsector; // [RH] keep track of sector viewing from
extern angle_t xtoviewangle[MAXWIDTH+1];
extern int FieldOfView;
int R_FindSkin (const char *name, int pclass); // [RH] Find a skin
#endif // __R_STATE_H__

View file

@ -43,7 +43,6 @@
#include "r_local.h"
#include "r_sky.h"
#include "c_dispatch.h"
#include "r_data.h"
#include "sc_man.h"
#include "v_text.h"
#include "st_start.h"
@ -53,6 +52,7 @@
#include "v_palette.h"
#include "colormatcher.h"
#include "colormaps.h"
#include "v_video.h"
static bool R_CheckForFixedLights(const BYTE *colormaps);

View file

@ -46,10 +46,10 @@
#include "gi.h"
#include "doomstat.h"
#include "i_sound.h"
#include "r_data.h"
#include "m_random.h"
#include "d_netinf.h"
#include "i_system.h"
#include "d_player.h"
// MACROS ------------------------------------------------------------------

View file

@ -37,8 +37,8 @@
#include "doomtype.h"
#include "files.h"
#include "r_data.h"
#include "w_wad.h"
#include "textures/textures.h"
//==========================================================================
//

View file

@ -40,6 +40,7 @@
#include "templates.h"
#include "cmdlib.h"
#include "st_start.h"
#include "textures/textures.h"
//==========================================================================
//

View file

@ -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;

View file

@ -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.

View file

@ -36,8 +36,8 @@
#include "doomtype.h"
#include "files.h"
#include "r_data.h"
#include "w_wad.h"
#include "textures/textures.h"
//==========================================================================
//

View file

@ -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"
//==========================================================================
//

View file

@ -35,8 +35,8 @@
#include "doomtype.h"
#include "files.h"
#include "r_data.h"
#include "w_wad.h"
#include "textures/textures.h"
//==========================================================================

View file

@ -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"
//==========================================================================
//

View file

@ -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

View file

@ -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
};
//==========================================================================

View file

@ -41,6 +41,8 @@
#include "templates.h"
#include "bitmap.h"
#include "colormatcher.h"
#include "v_video.h"
#include "textures/textures.h"
//==========================================================================
//

View file

@ -41,6 +41,7 @@
#include "m_png.h"
#include "bitmap.h"
#include "v_palette.h"
#include "textures/textures.h"
//==========================================================================
//

View file

@ -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"
//==========================================================================

View file

@ -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

View file

@ -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;
}
//==========================================================================
//

View file

@ -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

View file

@ -40,6 +40,8 @@
#include "templates.h"
#include "bitmap.h"
#include "colormatcher.h"
#include "v_video.h"
#include "textures/textures.h"
//==========================================================================

View file

@ -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)

View file

@ -68,6 +68,7 @@
#include "a_morph.h"
#include "colormatcher.h"
#include "teaminfo.h"
#include "v_video.h"
#include "resources/colormaps.h"

View file

@ -85,7 +85,6 @@ The FON2 header is followed by variable length data:
#include "v_font.h"
#include "v_video.h"
#include "w_wad.h"
#include "r_data.h"
#include "i_system.h"
#include "gi.h"
#include "cmdlib.h"

View file

@ -83,8 +83,8 @@
#include "doomstat.h"
#include "v_palette.h"
#include "stats.h"
#include "r_data.h"
#include "textures/bitmap.h"
#include "textures/textures.h"
// MACROS ------------------------------------------------------------------

View file

@ -2323,10 +2323,6 @@
RelativePath=".\src\r_bsp.cpp"
>
</File>
<File
RelativePath=".\src\r_data.cpp"
>
</File>
<File
RelativePath=".\src\r_draw.cpp"
>