diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3efcb87eb..64826e799 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 48cb2f103..6dc75dca9 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -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; diff --git a/src/d_net.cpp b/src/d_net.cpp index 33a66c1b1..a00400dea 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -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); diff --git a/src/decallib.cpp b/src/decallib.cpp index 6bbf0f74d..3f8c5debb 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -48,6 +48,7 @@ #include "gi.h" #include "g_level.h" #include "colormatcher.h" +#include "b_bot.h" FDecalLib DecalLibrary; diff --git a/src/dobjgc.cpp b/src/dobjgc.cpp index 642097073..05d7f3e55 100644 --- a/src/dobjgc.cpp +++ b/src/dobjgc.cpp @@ -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" diff --git a/src/fragglescript/t_fspic.cpp b/src/fragglescript/t_fspic.cpp index 8c6a8db3b..d5e6e5aec 100644 --- a/src/fragglescript/t_fspic.cpp +++ b/src/fragglescript/t_fspic.cpp @@ -37,6 +37,7 @@ #include "p_local.h" #include "farchive.h" #include "sbar.h" +#include "v_video.h" diff --git a/src/fragglescript/t_load.cpp b/src/fragglescript/t_load.cpp index c374de710..2d1e49fa5 100644 --- a/src/fragglescript/t_load.cpp +++ b/src/fragglescript/t_load.cpp @@ -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" diff --git a/src/g_game.cpp b/src/g_game.cpp index 12c7af440..6feb318f5 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -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" diff --git a/src/g_level.cpp b/src/g_level.cpp index 20611fc35..5167908af 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -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" diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index 1475f86d2..62a9e5af7 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -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) diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index 8193b71b0..98049bb3f 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -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"); diff --git a/src/g_shared/a_secrettrigger.cpp b/src/g_shared/a_secrettrigger.cpp index 79f3bcd30..4484340db 100644 --- a/src/g_shared/a_secrettrigger.cpp +++ b/src/g_shared/a_secrettrigger.cpp @@ -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) diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index b1dff41b9..0a0817a3f 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -51,6 +51,7 @@ #include "d_net.h" #include "colormatcher.h" #include "v_palette.h" +#include "d_player.h" #include "../version.h" diff --git a/src/p_acs.h b/src/p_acs.h index d1c49c8f0..fb53dd414 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -38,6 +38,7 @@ #include "dobject.h" #include "dthinker.h" #include "doomtype.h" +#include "farchive.h" #define LOCAL_SIZE 20 #define NUM_MAPVARS 128 diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 64708aa98..9ed876226 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -35,7 +35,6 @@ #include #include "actor.h" -#include "r_data.h" #include "r_main.h" #include "p_conversation.h" #include "w_wad.h" diff --git a/src/p_conversation.h b/src/p_conversation.h index d4fa60009..14ec89e53 100644 --- a/src/p_conversation.h +++ b/src/p_conversation.h @@ -3,9 +3,13 @@ #include +#include "s_sound.h" +#include "textures/textures.h" + struct FStrifeDialogueReply; class FTexture; struct FBrokenLines; +struct PClass; struct FStrifeDialogueItemCheck { diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index cff232928..c2cdc5a28 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -21,7 +21,6 @@ // //----------------------------------------------------------------------------- -#include "r_data.h" #include "p_spec.h" #include "c_cvars.h" #include "doomstat.h" diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 149b7a519..385467199 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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(); diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index 7cf6c5fbe..5ac7cf704 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -34,7 +34,6 @@ #include "doomtype.h" #include "p_local.h" -#include "r_data.h" #include "cmdlib.h" #include "p_lnspec.h" diff --git a/src/p_spec.h b/src/p_spec.h index 8656e4247..2db74fcd9 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -27,6 +27,7 @@ #include "dsectoreffect.h" #include "doomdata.h" +#include "r_state.h" class FScanner; struct level_info_t; diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index e856265da..1ad67850e 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -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" //=========================================================================== diff --git a/src/p_usdf.cpp b/src/p_usdf.cpp index b831b4140..d25cc8605 100644 --- a/src/p_usdf.cpp +++ b/src/p_usdf.cpp @@ -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 diff --git a/src/p_xlat.cpp b/src/p_xlat.cpp index 9e87d13ba..e61dcd52f 100644 --- a/src/p_xlat.cpp +++ b/src/p_xlat.cpp @@ -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" diff --git a/src/r_defs.h b/src/r_defs.h index 6d17b222c..8f59f3b1b 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -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 // diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 918a7bcdb..3103772e7 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -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); +} + + /* ================== = diff --git a/src/r_draw.h b/src/r_draw.h index 0f678776d..8ff62d341 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -23,7 +23,7 @@ #ifndef __R_DRAW__ #define __R_DRAW__ -#include "r_data.h" +#include "r_defs.h" extern "C" int ylookup[MAXHEIGHT]; diff --git a/src/r_interpolate.cpp b/src/r_interpolate.cpp index f145347a5..9bdaeb213 100644 --- a/src/r_interpolate.cpp +++ b/src/r_interpolate.cpp @@ -33,7 +33,6 @@ ** */ -#include "r_data.h" #include "p_3dmidtex.h" #include "stats.h" #include "r_interpolate.h" diff --git a/src/r_interpolate.h b/src/r_interpolate.h index 9334827e8..bbd2438d8 100644 --- a/src/r_interpolate.h +++ b/src/r_interpolate.h @@ -1,6 +1,7 @@ #ifndef R_INTERPOLATE_H #define R_INTERPOLATE_H +#include "dobject.h" //========================================================================== // // diff --git a/src/r_local.h b/src/r_local.h index c666b1de4..08ba83802 100644 --- a/src/r_local.h +++ b/src/r_local.h @@ -30,7 +30,6 @@ #include "doomdef.h" // Include the refresh/render data structs. -#include "r_data.h" // // Separate header file for each module. diff --git a/src/r_main.cpp b/src/r_main.cpp index 6e0927bb8..dda822fa2 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -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; + } } //========================================================================== diff --git a/src/r_main.h b/src/r_main.h index e52f901df..2259b0db9 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -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 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__ diff --git a/src/r_plane.h b/src/r_plane.h index f0eb22f02..6bcb36a19 100644 --- a/src/r_plane.h +++ b/src/r_plane.h @@ -24,7 +24,6 @@ #define __R_PLANE_H__ #include -#include "r_data.h" class ASkyViewpoint; diff --git a/src/r_polymost.cpp b/src/r_polymost.cpp index 6832bddbe..3d4ea5232 100644 --- a/src/r_polymost.cpp +++ b/src/r_polymost.cpp @@ -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) diff --git a/src/r_sky.cpp b/src/r_sky.cpp index e9c319de1..8ff2d6c62 100644 --- a/src/r_sky.cpp +++ b/src/r_sky.cpp @@ -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" diff --git a/src/r_state.h b/src/r_state.h index 80c11641d..4736e2327 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -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__ diff --git a/src/resources/colormaps.cpp b/src/resources/colormaps.cpp index 7b36e387d..c0ce25c25 100644 --- a/src/resources/colormaps.cpp +++ b/src/resources/colormaps.cpp @@ -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); diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 5f3a3e2e6..250ebbf96 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -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 ------------------------------------------------------------------ diff --git a/src/textures/automaptexture.cpp b/src/textures/automaptexture.cpp index 9a2b29df1..1bfec41c3 100644 --- a/src/textures/automaptexture.cpp +++ b/src/textures/automaptexture.cpp @@ -37,8 +37,8 @@ #include "doomtype.h" #include "files.h" -#include "r_data.h" #include "w_wad.h" +#include "textures/textures.h" //========================================================================== // diff --git a/src/textures/buildtexture.cpp b/src/textures/buildtexture.cpp index 836cc2daa..0b3db702a 100644 --- a/src/textures/buildtexture.cpp +++ b/src/textures/buildtexture.cpp @@ -40,6 +40,7 @@ #include "templates.h" #include "cmdlib.h" #include "st_start.h" +#include "textures/textures.h" //========================================================================== // diff --git a/src/textures/canvastexture.cpp b/src/textures/canvastexture.cpp index 278145b04..c62a8ef02 100644 --- a/src/textures/canvastexture.cpp +++ b/src/textures/canvastexture.cpp @@ -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; diff --git a/src/textures/ddstexture.cpp b/src/textures/ddstexture.cpp index f26180f02..437fb28d5 100644 --- a/src/textures/ddstexture.cpp +++ b/src/textures/ddstexture.cpp @@ -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. diff --git a/src/textures/emptytexture.cpp b/src/textures/emptytexture.cpp index 205c6940d..d0637c9a5 100644 --- a/src/textures/emptytexture.cpp +++ b/src/textures/emptytexture.cpp @@ -36,8 +36,8 @@ #include "doomtype.h" #include "files.h" -#include "r_data.h" #include "w_wad.h" +#include "textures/textures.h" //========================================================================== // diff --git a/src/textures/flattexture.cpp b/src/textures/flattexture.cpp index 400d3a02f..4e6a499fc 100644 --- a/src/textures/flattexture.cpp +++ b/src/textures/flattexture.cpp @@ -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" //========================================================================== // diff --git a/src/textures/imgztexture.cpp b/src/textures/imgztexture.cpp index 1d79e2595..36f954b95 100644 --- a/src/textures/imgztexture.cpp +++ b/src/textures/imgztexture.cpp @@ -35,8 +35,8 @@ #include "doomtype.h" #include "files.h" -#include "r_data.h" #include "w_wad.h" +#include "textures/textures.h" //========================================================================== diff --git a/src/textures/jpegtexture.cpp b/src/textures/jpegtexture.cpp index 7a45e6001..f8e732d45 100644 --- a/src/textures/jpegtexture.cpp +++ b/src/textures/jpegtexture.cpp @@ -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" //========================================================================== // diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 725490127..d75dc6b0e 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -36,7 +36,6 @@ #include #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 diff --git a/src/textures/patchtexture.cpp b/src/textures/patchtexture.cpp index 12ef31bcb..eb9487bc2 100644 --- a/src/textures/patchtexture.cpp +++ b/src/textures/patchtexture.cpp @@ -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 +}; //========================================================================== diff --git a/src/textures/pcxtexture.cpp b/src/textures/pcxtexture.cpp index a3b72c488..cc2b3a226 100644 --- a/src/textures/pcxtexture.cpp +++ b/src/textures/pcxtexture.cpp @@ -41,6 +41,8 @@ #include "templates.h" #include "bitmap.h" #include "colormatcher.h" +#include "v_video.h" +#include "textures/textures.h" //========================================================================== // diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index 4e30802c4..54a0a0cd9 100644 --- a/src/textures/pngtexture.cpp +++ b/src/textures/pngtexture.cpp @@ -41,6 +41,7 @@ #include "m_png.h" #include "bitmap.h" #include "v_palette.h" +#include "textures/textures.h" //========================================================================== // diff --git a/src/textures/rawpagetexture.cpp b/src/textures/rawpagetexture.cpp index 47fcd70ff..ac237d0bd 100644 --- a/src/textures/rawpagetexture.cpp +++ b/src/textures/rawpagetexture.cpp @@ -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" //========================================================================== diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 433e9f03b..fa2c564dd 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -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 diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index eb1a967f8..daf47e221 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -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; +} + + + //========================================================================== // diff --git a/src/textures/textures.h b/src/textures/textures.h index f49b17419..1c40ea642 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -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 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 diff --git a/src/textures/tgatexture.cpp b/src/textures/tgatexture.cpp index 3e30a13d1..d44cf5e1b 100644 --- a/src/textures/tgatexture.cpp +++ b/src/textures/tgatexture.cpp @@ -40,6 +40,8 @@ #include "templates.h" #include "bitmap.h" #include "colormatcher.h" +#include "v_video.h" +#include "textures/textures.h" //========================================================================== diff --git a/src/textures/warptexture.cpp b/src/textures/warptexture.cpp index 360d1d38a..0e6ff925c 100644 --- a/src/textures/warptexture.cpp +++ b/src/textures/warptexture.cpp @@ -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) diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 925c2a6c3..487a5fdda 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -68,6 +68,7 @@ #include "a_morph.h" #include "colormatcher.h" #include "teaminfo.h" +#include "v_video.h" #include "resources/colormaps.h" diff --git a/src/v_font.cpp b/src/v_font.cpp index eb26f0c6c..410e6515a 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -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" diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index aa5945011..7d3dde74a 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -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 ------------------------------------------------------------------ diff --git a/zdoom.vcproj b/zdoom.vcproj index 0885a5604..faa520ba8 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -2323,10 +2323,6 @@ RelativePath=".\src\r_bsp.cpp" > - -