From 4e74a881b6134c504efb2706b4ca222ea77f9dce Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 Jul 2011 18:59:20 +0000 Subject: [PATCH] - update to ZDoom r 3261: Removed unneeded includes of r_local.h. Removed more r_ header dependencies from the rest of the code. took all includes of farchive.h out of headers. This file will have to be included explicitly in each source file that needs it. Changed AlterWeaponSprite so that it doesn't take a full vissprite as parameter. FCoverageBuffer is only used in r_things.cpp, so its declaration does not need to be in a global header that's included everywhere. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1223 b0f79afe-0144-0410-b225-9a4edf0717df --- gzdoom.vcproj | 108 ++++++++------ src/am_map.cpp | 1 + src/b_bot.cpp | 1 + src/b_func.cpp | 1 - src/b_move.cpp | 1 - src/b_think.cpp | 1 - src/c_cmds.cpp | 27 ---- src/c_console.cpp | 2 +- src/c_dispatch.cpp | 1 + src/d_dehacked.cpp | 1 + src/d_netinfo.cpp | 2 + src/d_player.h | 5 +- src/decallib.cpp | 1 + src/dobject.cpp | 1 + src/dsectoreffect.cpp | 1 + src/dthinker.cpp | 1 + src/farchive.cpp | 26 +++- src/farchive.h | 14 ++ src/fragglescript/t_func.cpp | 1 + src/fragglescript/t_script.cpp | 2 +- src/g_doom/a_doommisc.cpp | 1 + src/g_game.cpp | 1 + src/g_heretic/a_hereticmisc.cpp | 1 + src/g_hexen/a_hexenmisc.cpp | 1 + src/g_level.cpp | 1 + src/g_raven/a_minotaur.cpp | 1 + src/g_shared/a_action.cpp | 1 + src/g_shared/a_armor.cpp | 1 + src/g_shared/a_artifacts.cpp | 5 +- src/g_shared/a_artifacts.h | 4 +- src/g_shared/a_camera.cpp | 2 +- src/g_shared/a_decals.cpp | 1 + src/g_shared/a_flashfader.cpp | 1 + src/g_shared/a_lightning.cpp | 2 + src/g_shared/a_morph.cpp | 1 + src/g_shared/a_movingcamera.cpp | 1 + src/g_shared/a_pickups.cpp | 3 +- src/g_shared/a_pickups.h | 4 +- src/g_shared/a_puzzleitems.cpp | 1 + src/g_shared/a_quake.cpp | 1 + src/g_shared/a_skies.cpp | 1 + src/g_shared/a_specialspot.cpp | 1 + src/g_shared/a_weapons.cpp | 1 + src/g_shared/hudmessages.cpp | 1 + src/g_shared/sbar_mugshot.cpp | 2 +- src/g_shared/sbarinfo.cpp | 2 - src/g_shared/shared_sbar.cpp | 1 + src/g_strife/a_strifestuff.cpp | 3 +- src/g_strife/strife_sbar.cpp | 2 +- src/gl/data/gl_data.cpp | 1 - src/gl/data/gl_portaldata.cpp | 1 - src/gl/data/gl_setup.cpp | 1 - src/gl/dynlights/a_dynlight.cpp | 2 +- src/gl/models/gl_models.cpp | 1 + src/gl/renderer/gl_renderer.cpp | 8 +- src/gl/scene/gl_bsp.cpp | 2 +- src/gl/scene/gl_clipper.cpp | 2 +- src/gl/scene/gl_clipper.h | 3 + src/gl/scene/gl_drawinfo.cpp | 5 +- src/gl/scene/gl_flats.cpp | 3 +- src/gl/scene/gl_renderhacks.cpp | 2 +- src/gl/scene/gl_scene.cpp | 4 +- src/gl/scene/gl_sky.cpp | 3 +- src/gl/scene/gl_sprite.cpp | 3 +- src/gl/scene/gl_spritelight.cpp | 1 + src/gl/scene/gl_weapon.cpp | 5 +- src/gl/system/gl_framebuffer.cpp | 8 +- src/gl/system/gl_threads.h | 2 +- src/gl/textures/gl_hirestex.cpp | 2 +- src/gl/textures/gl_hwtexture.cpp | 2 +- src/gl/textures/gl_material.cpp | 5 +- src/gl/utility/gl_clock.cpp | 2 +- src/menu/menu.cpp | 3 +- src/nodebuild.cpp | 2 +- src/nodebuild_extract.cpp | 1 - src/nodebuild_gl.cpp | 1 - src/nodebuild_utility.cpp | 2 +- src/p_acs.cpp | 9 ++ src/p_acs.h | 9 -- src/p_buildmap.cpp | 1 - src/p_ceiling.cpp | 15 ++ src/p_conversation.cpp | 2 +- src/p_doors.cpp | 9 ++ src/p_effect.cpp | 114 +++++++++++++++ src/p_effect.h | 26 +++- src/p_floor.cpp | 23 +++ src/p_lights.cpp | 1 + src/p_local.h | 9 +- src/p_mobj.cpp | 1 + src/p_pillar.cpp | 9 ++ src/p_plats.cpp | 16 +++ src/p_pspr.cpp | 2 + src/p_saveg.cpp | 6 + src/p_sectors.cpp | 13 +- src/p_setup.cpp | 2 +- src/p_spec.cpp | 18 ++- src/p_spec.h | 70 --------- src/p_switch.cpp | 1 + src/p_udmf.cpp | 1 + src/p_user.cpp | 6 + src/po_man.cpp | 13 +- src/po_man.h | 12 +- src/r_bsp.cpp | 1 + src/r_bsp.h | 8 ++ src/r_data/colormaps.cpp | 3 +- src/r_data/r_interpolate.cpp | 1 + src/r_data/r_translate.cpp | 3 +- src/r_data/sprites.h | 3 +- src/r_data/voxels.cpp | 2 +- src/r_defs.h | 77 +--------- src/r_main.cpp | 35 ++++- src/r_main.h | 69 +-------- src/r_plane.cpp | 2 - src/r_state.h | 35 +---- src/r_things.cpp | 238 +++++++++++-------------------- src/r_things.h | 75 +++++----- src/r_utility.h | 72 ++++++++++ src/s_advsound.cpp | 1 + src/s_sndseq.cpp | 1 + src/s_sound.cpp | 1 + src/sdl/i_main.cpp | 2 +- src/statistics.cpp | 1 + src/textures/anim_switches.cpp | 2 + src/textures/animations.cpp | 2 +- src/textures/buildtexture.cpp | 2 +- src/textures/ddstexture.cpp | 1 - src/textures/pcxtexture.cpp | 1 - src/textures/pngtexture.cpp | 1 - src/textures/tgatexture.cpp | 1 - src/textures/warptexture.cpp | 2 +- src/v_palette.cpp | 1 - src/wi_stuff.cpp | 4 +- src/win32/i_main.cpp | 2 +- 133 files changed, 737 insertions(+), 623 deletions(-) create mode 100644 src/r_utility.h diff --git a/gzdoom.vcproj b/gzdoom.vcproj index e094f153..0cb9af1a 100644 --- a/gzdoom.vcproj +++ b/gzdoom.vcproj @@ -1094,6 +1094,10 @@ RelativePath=".\src\actor.h" > + + @@ -2332,10 +2336,6 @@ RelativePath=".\src\r_drawt.cpp" > - - @@ -2360,10 +2360,6 @@ RelativePath=".\src\r_things.cpp" > - - - - @@ -2388,14 +2380,6 @@ RelativePath=".\src\r_draw.h" > - - - - @@ -2429,7 +2413,7 @@ > @@ -7124,32 +7108,8 @@ - - - - - - - - - - - - @@ -7242,6 +7202,62 @@ > + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/am_map.cpp b/src/am_map.cpp index a411fb57..026fec2e 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -39,6 +39,7 @@ #include "r_bsp.h" #include "p_setup.h" #include "c_bind.h" +#include "farchive.h" #include "m_cheat.h" #include "i_system.h" diff --git a/src/b_bot.cpp b/src/b_bot.cpp index eaa71c0e..f5235e1c 100644 --- a/src/b_bot.cpp +++ b/src/b_bot.cpp @@ -12,6 +12,7 @@ #include "cmdlib.h" #include "teaminfo.h" #include "d_net.h" +#include "farchive.h" CVAR (Int, bot_next_color, 11, 0) CVAR (Bool, bot_observer, false, 0) diff --git a/src/b_func.cpp b/src/b_func.cpp index efc3f7f5..d79e5df1 100644 --- a/src/b_func.cpp +++ b/src/b_func.cpp @@ -15,7 +15,6 @@ #include "g_game.h" #include "m_random.h" #include "r_sky.h" -#include "r_main.h" #include "st_stuff.h" #include "stats.h" #include "i_system.h" diff --git a/src/b_move.cpp b/src/b_move.cpp index 332160f1..b456c0c8 100644 --- a/src/b_move.cpp +++ b/src/b_move.cpp @@ -12,7 +12,6 @@ #include "g_game.h" #include "d_ticcmd.h" #include "m_random.h" -#include "r_main.h" #include "i_system.h" #include "p_lnspec.h" #include "gi.h" diff --git a/src/b_think.cpp b/src/b_think.cpp index 742c33a8..cc7f087e 100644 --- a/src/b_think.cpp +++ b/src/b_think.cpp @@ -14,7 +14,6 @@ #include "b_bot.h" #include "g_game.h" #include "m_random.h" -#include "r_main.h" #include "stats.h" #include "a_pickups.h" #include "statnums.h" diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 6dc75dca..993b4677 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -61,7 +61,6 @@ #include "gi.h" #include "r_defs.h" #include "d_player.h" -#include "r_main.h" #include "templates.h" #include "p_local.h" #include "r_sky.h" @@ -663,32 +662,6 @@ CCMD (fov) Net_WriteByte (clamp (atoi (argv[1]), 5, 179)); } -//========================================================================== -// -// CCMD r_visibility -// -// Controls how quickly light ramps across a 1/z range. Set this, and it -// sets all the r_*Visibility variables (except r_SkyVisibilily, which is -// currently unused). -// -//========================================================================== - -CCMD (r_visibility) -{ - if (argv.argc() < 2) - { - Printf ("Visibility is %g\n", R_GetVisibility()); - } - else if (!netgame) - { - R_SetVisibility ((float)atof (argv[1])); - } - else - { - Printf ("Visibility cannot be changed in net games.\n"); - } -} - //========================================================================== // // CCMD warp diff --git a/src/c_console.cpp b/src/c_console.cpp index c8cac63b..039125d5 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -53,7 +53,6 @@ #include "v_video.h" #include "v_text.h" #include "w_wad.h" -#include "r_main.h" #include "sbar.h" #include "s_sound.h" #include "s_sndseq.h" @@ -64,6 +63,7 @@ #include "d_net.h" #include "g_level.h" #include "d_event.h" +#include "d_player.h" #include "gi.h" diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 1a2b3158..83c6ae37 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -53,6 +53,7 @@ #include "v_text.h" #include "d_net.h" #include "d_main.h" +#include "farchive.h" // MACROS ------------------------------------------------------------------ diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 931c656c..16dc5b51 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -71,6 +71,7 @@ #include "i_system.h" #include "doomerrors.h" #include "p_effect.h" +#include "farchive.h" // [SO] Just the way Randy said to do it :) // [RH] Made this CVAR_SERVERINFO diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 45ae686c..a0550016 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -43,6 +43,7 @@ #include "d_netinf.h" #include "d_net.h" #include "d_protocol.h" +#include "d_player.h" #include "c_dispatch.h" #include "v_palette.h" #include "v_video.h" @@ -55,6 +56,7 @@ #include "r_data/r_translate.h" #include "templates.h" #include "cmdlib.h" +#include "farchive.h" static FRandom pr_pickteam ("PickRandomTeam"); diff --git a/src/d_player.h b/src/d_player.h index 74a3b8a2..d3f2feb9 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -413,10 +413,7 @@ public: // Bookkeeping on players - state. extern player_t players[MAXPLAYERS]; -inline FArchive &operator<< (FArchive &arc, player_t *&p) -{ - return arc.SerializePointer (players, (BYTE **)&p, sizeof(*players)); -} +FArchive &operator<< (FArchive &arc, player_t *&p); void P_CheckPlayerSprites(); diff --git a/src/decallib.cpp b/src/decallib.cpp index 2ebc3557..f4af8dc1 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -48,6 +48,7 @@ #include "g_level.h" #include "colormatcher.h" #include "b_bot.h" +#include "farchive.h" FDecalLib DecalLibrary; diff --git a/src/dobject.cpp b/src/dobject.cpp index 0440b769..9f749aea 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -47,6 +47,7 @@ #include "stats.h" #include "a_sharedglobal.h" #include "dsectoreffect.h" +#include "farchive.h" PClass DObject::_StaticType; ClassReg DObject::RegistrationInfo = diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index d678ac37..e474bb84 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -28,6 +28,7 @@ #include "p_3dmidtex.h" #include "r_data/r_interpolate.h" #include "statnums.h" +#include "farchive.h" IMPLEMENT_CLASS (DSectorEffect) diff --git a/src/dthinker.cpp b/src/dthinker.cpp index 3074aca9..a4f4db27 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -38,6 +38,7 @@ #include "statnums.h" #include "i_system.h" #include "doomerrors.h" +#include "farchive.h" static cycle_t ThinkCycles; diff --git a/src/farchive.cpp b/src/farchive.cpp index 6b9ba279..9c128e0f 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -55,7 +55,6 @@ #include "c_dispatch.h" #include "d_player.h" #include "dobject.h" -#include "r_local.h" // These are special tokens found in the data stream of an archive. // Whenever a new object is encountered, it gets created using new and @@ -1539,3 +1538,28 @@ FArchive &operator<< (FArchive &arc, const PClass * &info) } return arc; } + +FArchive &operator<< (FArchive &arc, sector_t *&sec) +{ + return arc.SerializePointer (sectors, (BYTE **)&sec, sizeof(*sectors)); +} + +FArchive &operator<< (FArchive &arc, const sector_t *&sec) +{ + return arc.SerializePointer (sectors, (BYTE **)&sec, sizeof(*sectors)); +} + +FArchive &operator<< (FArchive &arc, line_t *&line) +{ + return arc.SerializePointer (lines, (BYTE **)&line, sizeof(*lines)); +} + +FArchive &operator<< (FArchive &arc, vertex_t *&vert) +{ + return arc.SerializePointer (vertexes, (BYTE **)&vert, sizeof(*vertexes)); +} + +FArchive &operator<< (FArchive &arc, side_t *&side) +{ + return arc.SerializePointer (sides, (BYTE **)&side, sizeof(*sides)); +} diff --git a/src/farchive.h b/src/farchive.h index 7ee05fdc..5062b7ba 100644 --- a/src/farchive.h +++ b/src/farchive.h @@ -36,6 +36,7 @@ #include #include "dobject.h" +#include "r_state.h" class FFile { @@ -318,4 +319,17 @@ inline FArchive &operator<< (FArchive &arc, TArray &self) return arc; } +struct sector_t; +struct line_t; +struct vertex_t; +struct side_t; + +FArchive &operator<< (FArchive &arc, sector_t *&sec); +FArchive &operator<< (FArchive &arc, const sector_t *&sec); +FArchive &operator<< (FArchive &arc, line_t *&line); +FArchive &operator<< (FArchive &arc, vertex_t *&vert); +FArchive &operator<< (FArchive &arc, side_t *&side); + + + #endif //__FARCHIVE_H__ diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index ba4ac70e..2926d6b9 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -66,6 +66,7 @@ #include "v_palette.h" #include "v_font.h" #include "r_data/colormaps.h" +#include "farchive.h" #include "gl/gl_functions.h" diff --git a/src/fragglescript/t_script.cpp b/src/fragglescript/t_script.cpp index d326f676..390c0642 100644 --- a/src/fragglescript/t_script.cpp +++ b/src/fragglescript/t_script.cpp @@ -45,7 +45,6 @@ // // -#include "r_local.h" #include "t_script.h" #include "p_lnspec.h" #include "a_keys.h" @@ -55,6 +54,7 @@ #include "i_system.h" #include "doomerrors.h" #include "doomstat.h" +#include "farchive.h" //========================================================================== // diff --git a/src/g_doom/a_doommisc.cpp b/src/g_doom/a_doommisc.cpp index 898068d6..730fe183 100644 --- a/src/g_doom/a_doommisc.cpp +++ b/src/g_doom/a_doommisc.cpp @@ -13,6 +13,7 @@ #include "a_specialspot.h" #include "templates.h" #include "m_bbox.h" +#include "farchive.h" // Include all the other Doom stuff here to reduce compile time #include "a_arachnotron.cpp" diff --git a/src/g_game.cpp b/src/g_game.cpp index dda2e975..1acab7a1 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -77,6 +77,7 @@ #include "d_event.h" #include "p_acs.h" #include "m_joy.h" +#include "farchive.h" #include "r_data/colormaps.h" #include diff --git a/src/g_heretic/a_hereticmisc.cpp b/src/g_heretic/a_hereticmisc.cpp index 4304b820..972d2dc7 100644 --- a/src/g_heretic/a_hereticmisc.cpp +++ b/src/g_heretic/a_hereticmisc.cpp @@ -14,6 +14,7 @@ #include "templates.h" #include "r_data/r_translate.h" #include "doomstat.h" +#include "farchive.h" // Include all the other Heretic stuff here to reduce compile time #include "a_chicken.cpp" diff --git a/src/g_hexen/a_hexenmisc.cpp b/src/g_hexen/a_hexenmisc.cpp index 387e9fcc..2fdee3ee 100644 --- a/src/g_hexen/a_hexenmisc.cpp +++ b/src/g_hexen/a_hexenmisc.cpp @@ -17,6 +17,7 @@ #include "p_terrain.h" #include "m_bbox.h" #include "ravenshared.h" +#include "farchive.h" // Include all the Hexen stuff here to reduce compile time #include "a_bats.cpp" diff --git a/src/g_level.cpp b/src/g_level.cpp index bfa7ef1d..4a6287be 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -79,6 +79,7 @@ #include "menu/menu.h" #include "a_strifeglobal.h" #include "r_data/colormaps.h" +#include "farchive.h" #include "gi.h" diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index eb544414..e721c0ce 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -11,6 +11,7 @@ #include "thingdef/thingdef.h" #include "g_level.h" #include "doomstat.h" +#include "farchive.h" #define MAULATORTICS (25*35) diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index ddac7a40..1a7c83b8 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -11,6 +11,7 @@ #include "p_enemy.h" #include "statnums.h" #include "templates.h" +#include "farchive.h" #include "r_data/r_translate.h" static FRandom pr_freezedeath ("FreezeDeath"); diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index 62a9e5af..8b6f2895 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -6,6 +6,7 @@ #include "templates.h" #include "g_level.h" #include "d_player.h" +#include "farchive.h" IMPLEMENT_CLASS (AArmor) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 3fab6b55..a97fc0ac 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -19,6 +19,7 @@ #include "g_level.h" #include "doomstat.h" #include "v_palette.h" +#include "farchive.h" #include "r_data/colormaps.h" static FRandom pr_torch ("Torch"); @@ -464,7 +465,7 @@ void APowerInvulnerable::EndEffect () // //=========================================================================== -int APowerInvulnerable::AlterWeaponSprite (vissprite_t *vis) +int APowerInvulnerable::AlterWeaponSprite (visstyle_t *vis) { int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis); if (Owner != NULL) @@ -655,7 +656,7 @@ void APowerInvisibility::EndEffect () // //=========================================================================== -int APowerInvisibility::AlterWeaponSprite (vissprite_t *vis) +int APowerInvisibility::AlterWeaponSprite (visstyle_t *vis) { int changed = Inventory == NULL ? false : Inventory->AlterWeaponSprite(vis); // Blink if the powerup is wearing off diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 13ff0f1d..1d775b02 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -54,7 +54,7 @@ protected: void InitEffect (); void DoEffect (); void EndEffect (); - int AlterWeaponSprite (vissprite_t *vis); + int AlterWeaponSprite (visstyle_t *vis); }; class APowerStrength : public APowerup @@ -76,7 +76,7 @@ protected: void InitEffect (); void DoEffect (); void EndEffect (); - int AlterWeaponSprite (vissprite_t *vis); + int AlterWeaponSprite (visstyle_t *vis); // FRenderStyle OwnersNormalStyle; // fixed_t OwnersNormalAlpha; }; diff --git a/src/g_shared/a_camera.cpp b/src/g_shared/a_camera.cpp index c75ccbe8..24363851 100644 --- a/src/g_shared/a_camera.cpp +++ b/src/g_shared/a_camera.cpp @@ -35,8 +35,8 @@ #include "actor.h" #include "info.h" #include "a_sharedglobal.h" -#include "r_main.h" #include "p_local.h" +#include "farchive.h" /* == SecurityCamera diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 1c15bd91..22f53eef 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -44,6 +44,7 @@ #include "d_net.h" #include "colormatcher.h" #include "v_palette.h" +#include "farchive.h" static fixed_t DecalWidth, DecalLeft, DecalRight; static fixed_t SpreadZ; diff --git a/src/g_shared/a_flashfader.cpp b/src/g_shared/a_flashfader.cpp index 29f0964d..07b11ea5 100644 --- a/src/g_shared/a_flashfader.cpp +++ b/src/g_shared/a_flashfader.cpp @@ -1,6 +1,7 @@ #include "a_sharedglobal.h" #include "g_level.h" #include "d_player.h" +#include "farchive.h" IMPLEMENT_POINTY_CLASS (DFlashFader) DECLARE_POINTER (ForWho) diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index 98049bb3..e7c598d3 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -1,4 +1,5 @@ #include "a_lightning.h" +#include "doomstat.h" #include "p_lnspec.h" #include "statnums.h" #include "m_random.h" @@ -8,6 +9,7 @@ #include "r_sky.h" #include "g_level.h" #include "r_state.h" +#include "farchive.h" static FRandom pr_lightning ("Lightning"); diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 2fa69b03..e8042ac8 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -11,6 +11,7 @@ #include "a_morph.h" #include "doomstat.h" #include "g_level.h" +#include "farchive.h" static FRandom pr_morphmonst ("MorphMonster"); diff --git a/src/g_shared/a_movingcamera.cpp b/src/g_shared/a_movingcamera.cpp index 17f6b626..e3db71ff 100644 --- a/src/g_shared/a_movingcamera.cpp +++ b/src/g_shared/a_movingcamera.cpp @@ -37,6 +37,7 @@ #include "p_local.h" #include "p_lnspec.h" #include "doomstat.h" +#include "farchive.h" /* == InterpolationPoint: node along a camera's path diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index 116c62ec..d37869a6 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -18,6 +18,7 @@ #include "g_level.h" #include "g_game.h" #include "doomstat.h" +#include "farchive.h" static FRandom pr_restore ("RestorePos"); @@ -774,7 +775,7 @@ fixed_t AInventory::GetSpeedFactor () // //=========================================================================== -int AInventory::AlterWeaponSprite (vissprite_t *vis) +int AInventory::AlterWeaponSprite (visstyle_t *vis) { if (Inventory != NULL) { diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index 23cac960..efc7a8c3 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -10,6 +10,7 @@ class player_t; class FConfigFile; class AWeapon; +struct visstyle_t; class FWeaponSlot { @@ -132,7 +133,6 @@ enum IF_PERSISTENTPOWER = 1<<18, // Powerup is kept when travelling between levels }; -struct vissprite_t; class AInventory : public AActor { @@ -192,7 +192,7 @@ public: virtual void AbsorbDamage (int damage, FName damageType, int &newdamage); virtual void ModifyDamage (int damage, FName damageType, int &newdamage, bool passive); virtual fixed_t GetSpeedFactor(); - virtual int AlterWeaponSprite (vissprite_t *vis); + virtual int AlterWeaponSprite (visstyle_t *vis); virtual PalEntry GetBlend (); diff --git a/src/g_shared/a_puzzleitems.cpp b/src/g_shared/a_puzzleitems.cpp index 0cbc7cc3..4bd73ce6 100644 --- a/src/g_shared/a_puzzleitems.cpp +++ b/src/g_shared/a_puzzleitems.cpp @@ -7,6 +7,7 @@ #include "c_console.h" #include "doomstat.h" #include "v_font.h" +#include "farchive.h" IMPLEMENT_CLASS (APuzzleItem) diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 725f1204..c3a227b3 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -8,6 +8,7 @@ #include "s_sound.h" #include "a_sharedglobal.h" #include "statnums.h" +#include "farchive.h" static FRandom pr_quake ("Quake"); diff --git a/src/g_shared/a_skies.cpp b/src/g_shared/a_skies.cpp index bb13eac0..5e894002 100644 --- a/src/g_shared/a_skies.cpp +++ b/src/g_shared/a_skies.cpp @@ -36,6 +36,7 @@ #include "a_sharedglobal.h" #include "p_local.h" #include "p_lnspec.h" +#include "farchive.h" // arg0 = Visibility*4 for this skybox diff --git a/src/g_shared/a_specialspot.cpp b/src/g_shared/a_specialspot.cpp index 44ee6b84..fbfbbf55 100644 --- a/src/g_shared/a_specialspot.cpp +++ b/src/g_shared/a_specialspot.cpp @@ -39,6 +39,7 @@ #include "i_system.h" #include "thingdef/thingdef.h" #include "doomstat.h" +#include "farchive.h" static FRandom pr_spot ("SpecialSpot"); static FRandom pr_spawnmace ("SpawnMace"); diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index ecfa75d0..06875686 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -17,6 +17,7 @@ #include "doomstat.h" #include "g_level.h" #include "d_net.h" +#include "farchive.h" #define BONUSADD 6 diff --git a/src/g_shared/hudmessages.cpp b/src/g_shared/hudmessages.cpp index a27b4191..25c37258 100644 --- a/src/g_shared/hudmessages.cpp +++ b/src/g_shared/hudmessages.cpp @@ -39,6 +39,7 @@ #include "v_video.h" #include "cmdlib.h" #include "doomstat.h" +#include "farchive.h" EXTERN_CVAR (Int, con_scaletext) diff --git a/src/g_shared/sbar_mugshot.cpp b/src/g_shared/sbar_mugshot.cpp index 02b72167..7d481941 100644 --- a/src/g_shared/sbar_mugshot.cpp +++ b/src/g_shared/sbar_mugshot.cpp @@ -34,13 +34,13 @@ */ #include "r_defs.h" -#include "r_main.h" #include "m_random.h" #include "d_player.h" #include "d_event.h" #include "sbar.h" #include "sbarinfo.h" #include "templates.h" +#include "r_utility.h" #define ST_RAMPAGEDELAY (2*TICRATE) #define ST_MUCHPAIN 20 diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index 6583881b..315d4259 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -43,7 +43,6 @@ #include "m_random.h" #include "d_player.h" #include "st_stuff.h" -#include "r_local.h" #include "m_swap.h" #include "a_keys.h" #include "templates.h" @@ -51,7 +50,6 @@ #include "sbarinfo.h" #include "gi.h" #include "r_data/r_translate.h" -#include "r_main.h" #include "a_weaponpiece.h" #include "a_strifeglobal.h" #include "g_level.h" diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 0a8badb8..b66c865a 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -51,6 +51,7 @@ #include "colormatcher.h" #include "v_palette.h" #include "d_player.h" +#include "farchive.h" #include "../version.h" diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index eef693d0..0e528a70 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -18,6 +18,7 @@ #include "templates.h" #include "d_event.h" #include "v_font.h" +#include "farchive.h" // Include all the other Strife stuff here to reduce compile time #include "a_acolyte.cpp" @@ -177,7 +178,7 @@ 117 Blood 118 TeleportFog 119 ItemFog - 120 --- Doomednum is 14, which makes it a teleport destination. Don't know why it's in the mobjinfo table. + 120 teleport destination 121 KlaxonWarningLight 122 CeilingTurret 123 Piston diff --git a/src/g_strife/strife_sbar.cpp b/src/g_strife/strife_sbar.cpp index a7155b67..3db2274f 100644 --- a/src/g_strife/strife_sbar.cpp +++ b/src/g_strife/strife_sbar.cpp @@ -8,7 +8,7 @@ #include "m_random.h" #include "d_player.h" #include "st_stuff.h" -#include "r_local.h" +#include "r_utility.h" #include "m_swap.h" #include "templates.h" #include "a_keys.h" diff --git a/src/gl/data/gl_data.cpp b/src/gl/data/gl_data.cpp index 9aa74498..ecfc3f4f 100644 --- a/src/gl/data/gl_data.cpp +++ b/src/gl/data/gl_data.cpp @@ -42,7 +42,6 @@ #include "doomtype.h" #include "colormatcher.h" -//#include "r_data/r_translate.h" #include "i_system.h" #include "p_local.h" #include "p_lnspec.h" diff --git a/src/gl/data/gl_portaldata.cpp b/src/gl/data/gl_portaldata.cpp index 638dcb4e..9e2daea0 100644 --- a/src/gl/data/gl_portaldata.cpp +++ b/src/gl/data/gl_portaldata.cpp @@ -41,7 +41,6 @@ #include "doomtype.h" #include "colormatcher.h" -//#include "r_data/r_translate.h" #include "i_system.h" #include "p_local.h" #include "p_lnspec.h" diff --git a/src/gl/data/gl_setup.cpp b/src/gl/data/gl_setup.cpp index 1657bf2d..2d83406b 100644 --- a/src/gl/data/gl_setup.cpp +++ b/src/gl/data/gl_setup.cpp @@ -42,7 +42,6 @@ #include "gl/system/gl_system.h" #include "doomtype.h" #include "colormatcher.h" -//#include "r_data/r_translate.h" #include "i_system.h" #include "p_local.h" #include "p_lnspec.h" diff --git a/src/gl/dynlights/a_dynlight.cpp b/src/gl/dynlights/a_dynlight.cpp index 735d5ffb..5ff6d731 100644 --- a/src/gl/dynlights/a_dynlight.cpp +++ b/src/gl/dynlights/a_dynlight.cpp @@ -37,7 +37,7 @@ #include "templates.h" #include "m_random.h" -#include "r_main.h" +//#include "r_main.h" #include "p_local.h" #include "c_dispatch.h" #include "g_level.h" diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index fd438579..6ddd682e 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -47,6 +47,7 @@ #include "doomstat.h" #include "g_level.h" #include "r_state.h" +#include "d_player.h" //#include "resources/voxels.h" //#include "gl/gl_intern.h" diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index e5d6d6f0..a0aa6ba5 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -41,9 +41,9 @@ #include "gl/system/gl_system.h" #include "files.h" #include "m_swap.h" -#include "r_draw.h" +//#include "r_draw.h" #include "v_video.h" -#include "r_main.h" +//#include "r_main.h" #include "r_data/r_translate.h" #include "m_png.h" #include "m_crc32.h" @@ -94,7 +94,7 @@ void FGLRenderer::Initialize() mFBID = 0; SetupLevel(); mShaderManager = new FShaderManager; - mThreadManager = new FGLThreadManager; + //mThreadManager = new FGLThreadManager; } FGLRenderer::~FGLRenderer() @@ -102,7 +102,7 @@ FGLRenderer::~FGLRenderer() gl_CleanModelData(); gl_DeleteAllAttachedLights(); FMaterial::FlushAll(); - if (mThreadManager != NULL) delete mThreadManager; + //if (mThreadManager != NULL) delete mThreadManager; if (mShaderManager != NULL) delete mShaderManager; if (mVBO != NULL) delete mVBO; if (glpart2) delete glpart2; diff --git a/src/gl/scene/gl_bsp.cpp b/src/gl/scene/gl_bsp.cpp index 794ec4dc..64ce317b 100644 --- a/src/gl/scene/gl_bsp.cpp +++ b/src/gl/scene/gl_bsp.cpp @@ -42,7 +42,7 @@ #include "p_local.h" #include "a_sharedglobal.h" #include "r_sky.h" -#include "r_bsp.h" +#include "p_effect.h" #include "po_man.h" #include "gl/renderer/gl_renderer.h" diff --git a/src/gl/scene/gl_clipper.cpp b/src/gl/scene/gl_clipper.cpp index bde49029..7b42f27b 100644 --- a/src/gl/scene/gl_clipper.cpp +++ b/src/gl/scene/gl_clipper.cpp @@ -35,7 +35,7 @@ ** */ -#include "r_main.h" +//#include "r_main.h" #include "gl/scene/gl_clipper.h" diff --git a/src/gl/scene/gl_clipper.h b/src/gl/scene/gl_clipper.h index 7139c9d6..2f413f97 100644 --- a/src/gl/scene/gl_clipper.h +++ b/src/gl/scene/gl_clipper.h @@ -1,7 +1,10 @@ #ifndef __GL_CLIPPER #define __GL_CLIPPER +#include "doomtype.h" #include "tables.h" +#include "xs_Float.h" +#include "r_utility.h" class ClipNode { diff --git a/src/gl/scene/gl_drawinfo.cpp b/src/gl/scene/gl_drawinfo.cpp index e04ac086..87783e0a 100644 --- a/src/gl/scene/gl_drawinfo.cpp +++ b/src/gl/scene/gl_drawinfo.cpp @@ -41,8 +41,9 @@ */ #include "gl/system/gl_system.h" #include "r_sky.h" -#include "r_main.h" -#include "r_defs.h" +#include "r_utility.h" +#include "r_state.h" +#include "doomstat.h" #include "gl/system/gl_cvars.h" #include "gl/data/gl_data.h" diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index 2427d078..fe90438e 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -42,9 +42,10 @@ #include "a_sharedglobal.h" #include "r_defs.h" #include "r_sky.h" -#include "r_main.h" +#include "r_utility.h" #include "g_level.h" #include "doomstat.h" +#include "d_player.h" #include "gl/system/gl_cvars.h" #include "gl/renderer/gl_renderer.h" diff --git a/src/gl/scene/gl_renderhacks.cpp b/src/gl/scene/gl_renderhacks.cpp index c6831282..276ee77e 100644 --- a/src/gl/scene/gl_renderhacks.cpp +++ b/src/gl/scene/gl_renderhacks.cpp @@ -39,7 +39,7 @@ */ #include "a_sharedglobal.h" -#include "r_main.h" +#include "r_utility.h" #include "r_defs.h" #include "r_sky.h" #include "g_level.h" diff --git a/src/gl/scene/gl_scene.cpp b/src/gl/scene/gl_scene.cpp index 7ab94f4d..39169410 100644 --- a/src/gl/scene/gl_scene.cpp +++ b/src/gl/scene/gl_scene.cpp @@ -48,7 +48,7 @@ #include "g_level.h" #include "r_data/r_interpolate.h" #include "r_main.h" -#include "r_things.h" +#include "p_effect.h" #include "sbar.h" #include "po_man.h" #include "gl/gl_functions.h" @@ -1019,7 +1019,7 @@ void FGLRenderer::RenderView (player_t* player) else r_TicFrac = I_GetTimeFrac (&r_FrameTime); gl_frameMS = I_MSTime(); - R_FindParticleSubsectors (); + P_FindParticleSubsectors (); // prepare all camera textures that have been used in the last frame FCanvasTextureInfo::UpdateAll(); diff --git a/src/gl/scene/gl_sky.cpp b/src/gl/scene/gl_sky.cpp index f69695b1..4522861c 100644 --- a/src/gl/scene/gl_sky.cpp +++ b/src/gl/scene/gl_sky.cpp @@ -42,7 +42,8 @@ #include "a_sharedglobal.h" #include "g_level.h" #include "r_sky.h" -#include "r_main.h" +#include "r_state.h" +#include "r_utility.h" #include "doomdata.h" #include "gl/gl_functions.h" diff --git a/src/gl/scene/gl_sprite.cpp b/src/gl/scene/gl_sprite.cpp index 1154c09e..6fd86857 100644 --- a/src/gl/scene/gl_sprite.cpp +++ b/src/gl/scene/gl_sprite.cpp @@ -39,12 +39,13 @@ */ #include "gl/system/gl_system.h" #include "p_local.h" -//#include "r_data/r_translate.h" +#include "p_effect.h" #include "g_level.h" #include "doomstat.h" #include "gl/gl_functions.h" #include "r_defs.h" #include "r_sky.h" +#include "r_main.h" #include "gl/system/gl_framebuffer.h" #include "gl/system/gl_cvars.h" diff --git a/src/gl/scene/gl_spritelight.cpp b/src/gl/scene/gl_spritelight.cpp index 897c8361..21a61974 100644 --- a/src/gl/scene/gl_spritelight.cpp +++ b/src/gl/scene/gl_spritelight.cpp @@ -41,6 +41,7 @@ #include "gl/system/gl_system.h" #include "c_dispatch.h" #include "p_local.h" +#include "p_effect.h" #include "vectors.h" #include "gl/gl_functions.h" #include "g_level.h" diff --git a/src/gl/scene/gl_weapon.cpp b/src/gl/scene/gl_weapon.cpp index b12d8a3d..79231552 100644 --- a/src/gl/scene/gl_weapon.cpp +++ b/src/gl/scene/gl_weapon.cpp @@ -39,9 +39,10 @@ */ #include "gl/system/gl_system.h" #include "sbar.h" -#include "r_main.h" +#include "r_utility.h" #include "v_video.h" #include "doomstat.h" +#include "d_player.h" #include "gl/system/gl_cvars.h" #include "gl/renderer/gl_renderer.h" @@ -253,7 +254,7 @@ void FGLRenderer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep) } PalEntry ThingColor = playermo->fillcolor; - vissprite_t vis; + visstyle_t vis; vis.RenderStyle=playermo->RenderStyle; vis.alpha=playermo->alpha; diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index bc488529..44a05b3b 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -44,12 +44,13 @@ #include "m_swap.h" #include "r_draw.h" #include "v_video.h" -#include "r_main.h" +#include "doomstat.h" #include "m_png.h" #include "m_crc32.h" #include "vectors.h" #include "v_palette.h" #include "templates.h" +#include "farchive.h" #include "gl/system/gl_framebuffer.h" #include "gl/renderer/gl_renderer.h" @@ -413,10 +414,7 @@ void OpenGLFrameBuffer::StateChanged(AActor *actor) void OpenGLFrameBuffer::StartSerialize(FArchive &arc) { gl_DeleteAllAttachedLights(); - if (SaveVersion >= 2058) - { - arc << fogdensity << outsidefogdensity << skyfog; - } + arc << fogdensity << outsidefogdensity << skyfog; } void OpenGLFrameBuffer::EndSerialize(FArchive &arc) diff --git a/src/gl/system/gl_threads.h b/src/gl/system/gl_threads.h index c74695fc..a8734e38 100644 --- a/src/gl/system/gl_threads.h +++ b/src/gl/system/gl_threads.h @@ -1,4 +1,4 @@ -#ifndef __GL_THREADS_H +#if 0 //ndef __GL_THREADS_H #define __GL_THREADS_H #ifdef WIN32 diff --git a/src/gl/textures/gl_hirestex.cpp b/src/gl/textures/gl_hirestex.cpp index 3bcd55f9..6c262078 100644 --- a/src/gl/textures/gl_hirestex.cpp +++ b/src/gl/textures/gl_hirestex.cpp @@ -48,7 +48,7 @@ #include "w_wad.h" #include "m_png.h" -#include "r_draw.h" +//#include "r_draw.h" #include "sbar.h" #include "gi.h" #include "cmdlib.h" diff --git a/src/gl/textures/gl_hwtexture.cpp b/src/gl/textures/gl_hwtexture.cpp index 4d26a1d9..b4b81b76 100644 --- a/src/gl/textures/gl_hwtexture.cpp +++ b/src/gl/textures/gl_hwtexture.cpp @@ -41,7 +41,7 @@ #include "gl/system/gl_system.h" #include "templates.h" -#include "r_draw.h" +//#include "r_draw.h" #include "m_crc32.h" #include "c_cvars.h" #include "c_dispatch.h" diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 4703ffdf..cfb14efe 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -38,16 +38,15 @@ #include "gl/system/gl_system.h" #include "w_wad.h" #include "m_png.h" -#include "r_draw.h" +//#include "r_draw.h" #include "sbar.h" #include "gi.h" #include "cmdlib.h" #include "c_dispatch.h" #include "stats.h" -#include "r_main.h" +#include "r_utility.h" #include "templates.h" #include "sc_man.h" -//#include "r_data/r_translate.h" #include "colormatcher.h" //#include "gl/gl_intern.h" diff --git a/src/gl/utility/gl_clock.cpp b/src/gl/utility/gl_clock.cpp index ec7bea83..7eb43a51 100644 --- a/src/gl/utility/gl_clock.cpp +++ b/src/gl/utility/gl_clock.cpp @@ -10,7 +10,7 @@ #include "g_level.h" #include "c_console.h" #include "c_dispatch.h" -#include "r_main.h" +#include "r_utility.h" #include "v_video.h" #include "gl/utility/gl_clock.h" #include "gl/utility/gl_convert.h" diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 3161b68a..971110b5 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -48,10 +48,11 @@ #include "v_video.h" #include "hu_stuff.h" #include "gi.h" +#include "v_palette.h" #include "i_input.h" #include "gameconfigfile.h" #include "gstrings.h" -#include "r_main.h" +#include "r_utility.h" #include "menu/menu.h" #include "textures/textures.h" diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index 47643e4c..9fa95d9c 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -50,7 +50,7 @@ #include "tarray.h" #include "m_bbox.h" #include "c_console.h" -#include "r_main.h" +#include "r_state.h" const int MaxSegs = 64; const int SplitCost = 8; diff --git a/src/nodebuild_extract.cpp b/src/nodebuild_extract.cpp index b502fa8b..6260ac2f 100644 --- a/src/nodebuild_extract.cpp +++ b/src/nodebuild_extract.cpp @@ -43,7 +43,6 @@ #include "nodebuild.h" #include "templates.h" -#include "r_main.h" #if 0 #define D(x) x diff --git a/src/nodebuild_gl.cpp b/src/nodebuild_gl.cpp index d990d17c..add4f712 100644 --- a/src/nodebuild_gl.cpp +++ b/src/nodebuild_gl.cpp @@ -39,7 +39,6 @@ #include "doomtype.h" #include "nodebuild.h" -#include "r_main.h" static inline void STACK_ARGS Warn (const char *format, ...) { diff --git a/src/nodebuild_utility.cpp b/src/nodebuild_utility.cpp index 35842f76..ac467107 100644 --- a/src/nodebuild_utility.cpp +++ b/src/nodebuild_utility.cpp @@ -47,9 +47,9 @@ #include "nodebuild.h" #include "templates.h" #include "m_bbox.h" -#include "r_main.h" #include "i_system.h" #include "po_man.h" +#include "r_state.h" static const int PO_LINE_START = 1; static const int PO_LINE_EXPLICIT = 5; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 653a309f..cc2a5630 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -72,6 +72,7 @@ #include "p_setup.h" #include "po_man.h" #include "actorptrselect.h" +#include "farchive.h" #include "g_shared/a_pickups.h" @@ -1961,6 +1962,14 @@ IMPLEMENT_POINTY_CLASS (DLevelScript) DECLARE_POINTER(activator) END_POINTERS +inline FArchive &operator<< (FArchive &arc, DLevelScript::EScriptState &state) +{ + BYTE val = (BYTE)state; + arc << val; + state = (DLevelScript::EScriptState)val; + return arc; +} + void DLevelScript::Serialize (FArchive &arc) { DWORD i; diff --git a/src/p_acs.h b/src/p_acs.h index fb53dd41..245d90c4 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -38,7 +38,6 @@ #include "dobject.h" #include "dthinker.h" #include "doomtype.h" -#include "farchive.h" #define LOCAL_SIZE 20 #define NUM_MAPVARS 128 @@ -737,14 +736,6 @@ private: friend class DACSThinker; }; -inline FArchive &operator<< (FArchive &arc, DLevelScript::EScriptState &state) -{ - BYTE val = (BYTE)state; - arc << val; - state = (DLevelScript::EScriptState)val; - return arc; -} - class DACSThinker : public DThinker { DECLARE_CLASS (DACSThinker, DThinker) diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 69287f29..af081976 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -12,7 +12,6 @@ #include "w_wad.h" #include "templates.h" #include "r_sky.h" -#include "r_main.h" #include "r_defs.h" #include "p_setup.h" #include "g_level.h" diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 3cb60bcb..fdac779a 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -29,6 +29,21 @@ #include "doomstat.h" #include "r_state.h" #include "gi.h" +#include "farchive.h" + +//============================================================================ +// +// +// +//============================================================================ + +inline FArchive &operator<< (FArchive &arc, DCeiling::ECeiling &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DCeiling::ECeiling)val; + return arc; +} //============================================================================ // diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 9ed87622..4e4d8fd5 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -35,7 +35,6 @@ #include #include "actor.h" -#include "r_main.h" #include "p_conversation.h" #include "w_wad.h" #include "cmdlib.h" @@ -60,6 +59,7 @@ #include "sbar.h" #include "farchive.h" #include "p_lnspec.h" +#include "r_utility.h" #include "menu/menu.h" // The conversations as they exist inside a SCRIPTxx lump. diff --git a/src/p_doors.cpp b/src/p_doors.cpp index c01abab6..7ccfa54b 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -35,6 +35,7 @@ #include "i_system.h" #include "sc_man.h" #include "cmdlib.h" +#include "farchive.h" //============================================================================ // @@ -44,6 +45,14 @@ IMPLEMENT_CLASS (DDoor) +inline FArchive &operator<< (FArchive &arc, DDoor::EVlDoor &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DDoor::EVlDoor)val; + return arc; +} + DDoor::DDoor () { } diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 12453abb..5e653200 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -36,8 +36,10 @@ #include "doomtype.h" #include "doomstat.h" +#include "i_system.h" #include "c_cvars.h" #include "actor.h" +#include "m_argv.h" #include "p_effect.h" #include "p_local.h" #include "g_level.h" @@ -54,9 +56,17 @@ CVAR (Int, cl_rockettrails, 1, CVAR_ARCHIVE); CVAR (Bool, r_rail_smartspiral, 0, CVAR_ARCHIVE); CVAR (Int, r_rail_spiralsparsity, 1, CVAR_ARCHIVE); CVAR (Int, r_rail_trailsparsity, 1, CVAR_ARCHIVE); +CVAR (Bool, r_particles, true, 0); #define FADEFROMTTL(a) (255/(a)) +// [RH] particle globals +WORD NumParticles; +WORD ActiveParticles; +WORD InactiveParticles; +particle_t *Particles; +TArray ParticlesInSubsec; + static int grey1, grey2, grey3, grey4, red, green, blue, yellow, black, red1, green1, blue1, yellow1, purple, purple1, white, rblue1, rblue2, rblue3, rblue4, orange, yorange, dred, grey5, @@ -95,10 +105,114 @@ static const struct ColorList { {NULL, 0, 0, 0 } }; +inline particle_t *NewParticle (void) +{ + particle_t *result = NULL; + if (InactiveParticles != NO_PARTICLE) + { + result = Particles + InactiveParticles; + InactiveParticles = result->tnext; + result->tnext = ActiveParticles; + ActiveParticles = WORD(result - Particles); + } + return result; +} + +// +// [RH] Particle functions +// +void P_InitParticles (); +void P_DeinitParticles (); + +// [BC] Allow the maximum number of particles to be specified by a cvar (so people +// with lots of nice hardware can have lots of particles!). +CUSTOM_CVAR( Int, r_maxparticles, 4000, CVAR_ARCHIVE ) +{ + if ( self == 0 ) + self = 4000; + else if ( self < 100 ) + self = 100; + + if ( gamestate != GS_STARTUP ) + { + P_DeinitParticles( ); + P_InitParticles( ); + } +} + +void P_InitParticles () +{ + const char *i; + + if ((i = Args->CheckValue ("-numparticles"))) + NumParticles = atoi (i); + // [BC] Use r_maxparticles now. + else + NumParticles = r_maxparticles; + + // This should be good, but eh... + if ( NumParticles < 100 ) + NumParticles = 100; + + P_DeinitParticles(); + Particles = new particle_t[NumParticles]; + P_ClearParticles (); + atterm (P_DeinitParticles); +} + +void P_DeinitParticles() +{ + if (Particles != NULL) + { + delete[] Particles; + Particles = NULL; + } +} + +void P_ClearParticles () +{ + int i; + + memset (Particles, 0, NumParticles * sizeof(particle_t)); + ActiveParticles = NO_PARTICLE; + InactiveParticles = 0; + for (i = 0; i < NumParticles-1; i++) + Particles[i].tnext = i + 1; + Particles[i].tnext = NO_PARTICLE; +} + +// Group particles by subsectors. Because particles are always +// in motion, there is little benefit to caching this information +// from one frame to the next. + +void P_FindParticleSubsectors () +{ + if (ParticlesInSubsec.Size() < (size_t)numsubsectors) + { + ParticlesInSubsec.Reserve (numsubsectors - ParticlesInSubsec.Size()); + } + + clearbufshort (&ParticlesInSubsec[0], numsubsectors, NO_PARTICLE); + + if (!r_particles) + { + return; + } + for (WORD i = ActiveParticles; i != NO_PARTICLE; i = Particles[i].tnext) + { + subsector_t *ssec = R_PointInSubsector (Particles[i].x, Particles[i].y); + int ssnum = int(ssec-subsectors); + Particles[i].subsector = ssec; + Particles[i].snext = ParticlesInSubsec[ssnum]; + ParticlesInSubsec[ssnum] = i; + } +} + void P_InitEffects () { const struct ColorList *color = Colors; + P_InitParticles(); while (color->color) { *(color->color) = ColorMatcher.Pick (color->r, color->g, color->b); diff --git a/src/p_effect.h b/src/p_effect.h index 1ca18e34..5e41929c 100644 --- a/src/p_effect.h +++ b/src/p_effect.h @@ -49,7 +49,31 @@ #define FX_BLACKFOUNTAIN 0x00060000 #define FX_WHITEFOUNTAIN 0x00070000 -struct particle_t; +// [RH] Particle details +struct particle_t +{ + fixed_t x,y,z; + fixed_t velx,vely,velz; + fixed_t accx,accy,accz; + BYTE ttl; + BYTE trans; + BYTE size; + BYTE fade; + int color; + WORD tnext; + WORD snext; + subsector_t * subsector; +}; + +extern particle_t *Particles; +extern TArray ParticlesInSubsec; + +const WORD NO_PARTICLE = 0xffff; + +void P_ClearParticles (); +void P_FindParticleSubsectors (); + + class AActor; particle_t *JitterParticle (int ttl); diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 4d7a6c13..d18a908b 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -29,6 +29,7 @@ #include "doomstat.h" #include "r_state.h" #include "tables.h" +#include "farchive.h" #include "p_3dmidtex.h" #include "r_data/r_interpolate.h" @@ -38,6 +39,20 @@ // //========================================================================== +inline FArchive &operator<< (FArchive &arc, DFloor::EFloor &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DFloor::EFloor)val; + return arc; +} + +//========================================================================== +// +// +// +//========================================================================== + static void StartFloorSound (sector_t *sec) { if (sec->seqType >= 0) @@ -870,6 +885,14 @@ IMPLEMENT_POINTY_CLASS (DElevator) DECLARE_POINTER(m_Interp_Ceiling) END_POINTERS +inline FArchive &operator<< (FArchive &arc, DElevator::EElevator &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DElevator::EElevator)val; + return arc; +} + DElevator::DElevator () { } diff --git a/src/p_lights.cpp b/src/p_lights.cpp index ba5bdf1a..878b1f5c 100644 --- a/src/p_lights.cpp +++ b/src/p_lights.cpp @@ -33,6 +33,7 @@ // State. #include "r_state.h" #include "statnums.h" +#include "farchive.h" static FRandom pr_flicker ("Flicker"); static FRandom pr_lightflash ("LightFlash"); diff --git a/src/p_local.h b/src/p_local.h index 1742f69b..bc357c68 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -23,9 +23,12 @@ #ifndef __P_LOCAL__ #define __P_LOCAL__ -#ifndef __R_LOCAL__ -#include "r_local.h" -#endif +#include "doomtype.h" +#include "doomdef.h" +#include "tables.h" +#include "r_state.h" +#include "r_utility.h" +#include "d_player.h" #include "a_morph.h" diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index adaef861..eb22dc6c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -61,6 +61,7 @@ #include "v_palette.h" #include "p_enemy.h" #include "gstrings.h" +#include "farchive.h" #include "r_data/colormaps.h" // MACROS ------------------------------------------------------------------ diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index 2f2c1551..1f77c7c7 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -37,6 +37,7 @@ #include "p_spec.h" #include "g_level.h" #include "s_sndseq.h" +#include "farchive.h" #include "r_data/r_interpolate.h" IMPLEMENT_POINTY_CLASS (DPillar) @@ -44,6 +45,14 @@ IMPLEMENT_POINTY_CLASS (DPillar) DECLARE_POINTER(m_Interp_Ceiling) END_POINTERS +inline FArchive &operator<< (FArchive &arc, DPillar::EPillar &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DPillar::EPillar)val; + return arc; +} + DPillar::DPillar () { } diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 9e57f4ba..d87c3099 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -30,11 +30,27 @@ #include "doomstat.h" #include "r_state.h" #include "gi.h" +#include "farchive.h" static FRandom pr_doplat ("DoPlat"); IMPLEMENT_CLASS (DPlat) +inline FArchive &operator<< (FArchive &arc, DPlat::EPlatType &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DPlat::EPlatType)val; + return arc; +} +inline FArchive &operator<< (FArchive &arc, DPlat::EPlatState &state) +{ + BYTE val = (BYTE)state; + arc << val; + state = (DPlat::EPlatState)val; + return arc; +} + DPlat::DPlat () { } diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 31eb1ac7..2bd84478 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -27,6 +27,8 @@ #include "templates.h" #include "thingdef/thingdef.h" #include "g_level.h" +#include "farchive.h" + // MACROS ------------------------------------------------------------------ diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index 9b84694a..529a6278 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -49,12 +49,18 @@ #include "po_man.h" #include "p_setup.h" #include "r_data/colormaps.h" +#include "farchive.h" static void CopyPlayer (player_t *dst, player_t *src, const char *name); static void ReadOnePlayer (FArchive &arc, bool skipload); static void ReadMultiplePlayers (FArchive &arc, int numPlayers, int numPlayersNow, bool skipload); static void SpawnExtraPlayers (); +inline FArchive &operator<< (FArchive &arc, FLinkedSector &link) +{ + arc << link.Sector << link.Type; + return arc; +} // // P_ArchivePlayers diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index a54033b0..9f59f2a8 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -25,9 +25,10 @@ #include "c_cvars.h" #include "doomstat.h" #include "g_level.h" -#include "r_main.h" #include "nodebuild.h" #include "po_man.h" +#include "farchive.h" +#include "r_utility.h" #include "r_data/colormaps.h" @@ -831,6 +832,16 @@ bool secplane_t::CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) cons return copy; } +FArchive &operator<< (FArchive &arc, secplane_t &plane) +{ + arc << plane.a << plane.b << plane.c << plane.d; + //if (plane.c != 0) + { // plane.c should always be non-0. Otherwise, the plane + // would be perfectly vertical. + plane.ic = DivScale32 (1, plane.c); + } + return arc; +} //========================================================================== // diff --git a/src/p_setup.cpp b/src/p_setup.cpp index c3c55ea4..56258840 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3958,7 +3958,7 @@ void P_SetupLevel (char *lumpname, int position) R_OldBlend = 0xffffffff; // [RH] Remove all particles - R_ClearParticles (); + P_ClearParticles (); times[17].Clock(); // preload graphics and sounds diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 7cf24b98..d73575be 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -44,7 +44,6 @@ #include "m_bbox.h" #include "w_wad.h" -#include "r_local.h" #include "p_local.h" #include "p_lnspec.h" #include "p_terrain.h" @@ -60,6 +59,7 @@ #include "g_level.h" #include "v_font.h" #include "a_sharedglobal.h" +#include "farchive.h" // State. #include "r_state.h" @@ -85,6 +85,14 @@ IMPLEMENT_POINTY_CLASS (DPusher) DECLARE_POINTER (m_Source) END_POINTERS +inline FArchive &operator<< (FArchive &arc, DScroller::EScrollType &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DScroller::EScrollType)val; + return arc; +} + DScroller::DScroller () { } @@ -109,6 +117,14 @@ DPusher::DPusher () { } +inline FArchive &operator<< (FArchive &arc, DPusher::EPusher &type) +{ + BYTE val = (BYTE)type; + arc << val; + type = (DPusher::EPusher)val; + return arc; +} + void DPusher::Serialize (FArchive &arc) { Super::Serialize (arc); diff --git a/src/p_spec.h b/src/p_spec.h index 2db74fcd..19de4ce8 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -97,14 +97,6 @@ private: // (This is so scrolling floors and objects on them can move at same speed.) enum { CARRYFACTOR = ((fixed_t)(FRACUNIT*.09375)) }; -inline FArchive &operator<< (FArchive &arc, DScroller::EScrollType &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DScroller::EScrollType)val; - return arc; -} - // phares 3/20/98: added new model of Pushers for push/pull effects class DPusher : public DThinker @@ -150,14 +142,6 @@ protected: bool PIT_PushThing (AActor *thing); -inline FArchive &operator<< (FArchive &arc, DPusher::EPusher &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DPusher::EPusher)val; - return arc; -} - // Define values for map objects #define MO_TELEPORTMAN 14 @@ -466,21 +450,6 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, void EV_StopPlat (int tag); void P_ActivateInStasis (int tag); -inline FArchive &operator<< (FArchive &arc, DPlat::EPlatType &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DPlat::EPlatType)val; - return arc; -} -inline FArchive &operator<< (FArchive &arc, DPlat::EPlatState &state) -{ - BYTE val = (BYTE)state; - arc << val; - state = (DPlat::EPlatState)val; - return arc; -} - // // [RH] // P_PILLAR @@ -520,14 +489,6 @@ private: DPillar (); }; -inline FArchive &operator<< (FArchive &arc, DPillar::EPillar &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DPillar::EPillar)val; - return arc; -} - bool EV_DoPillar (DPillar::EPillar type, int tag, fixed_t speed, fixed_t height, fixed_t height2, int crush, bool hexencrush); @@ -588,14 +549,6 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, void P_SpawnDoorCloseIn30 (sector_t *sec); void P_SpawnDoorRaiseIn5Mins (sector_t *sec); -inline FArchive &operator<< (FArchive &arc, DDoor::EVlDoor &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DDoor::EVlDoor)val; - return arc; -} - class DAnimatedDoor : public DMovingCeiling { DECLARE_CLASS (DAnimatedDoor, DMovingCeiling) @@ -717,13 +670,6 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, bool EV_CeilingCrushStop (int tag); void P_ActivateInStasisCeiling (int tag); -inline FArchive &operator<< (FArchive &arc, DCeiling::ECeiling &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DCeiling::ECeiling)val; - return arc; -} // @@ -824,14 +770,6 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, bool EV_FloorCrushStop (int tag); bool EV_DoDonut (int tag, line_t *line, fixed_t pillarspeed, fixed_t slimespeed); -inline FArchive &operator<< (FArchive &arc, DFloor::EFloor &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DFloor::EFloor)val; - return arc; -} - class DElevator : public DMover { DECLARE_CLASS (DElevator, DMover) @@ -873,14 +811,6 @@ private: bool EV_DoElevator (line_t *line, DElevator::EElevator type, fixed_t speed, fixed_t height, int tag); -inline FArchive &operator<< (FArchive &arc, DElevator::EElevator &type) -{ - BYTE val = (BYTE)type; - arc << val; - type = (DElevator::EElevator)val; - return arc; -} - class DWaggleBase : public DMover { DECLARE_CLASS (DWaggleBase, DMover) diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 6e468e41..c1c1ffb4 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -46,6 +46,7 @@ #include "w_wad.h" #include "tarray.h" #include "cmdlib.h" +#include "farchive.h" #include "gi.h" diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 53922ab6..97e53753 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -33,6 +33,7 @@ ** */ +#include "doomstat.h" #include "p_setup.h" #include "p_lnspec.h" #include "templates.h" diff --git a/src/p_user.cpp b/src/p_user.cpp index c8b615d0..bbf4be3a 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -52,6 +52,7 @@ #include "g_level.h" #include "d_net.h" #include "gstrings.h" +#include "farchive.h" static FRandom pr_skullpop ("SkullPop"); @@ -210,6 +211,11 @@ CCMD (playerclasses) bool onground; +FArchive &operator<< (FArchive &arc, player_t *&p) +{ + return arc.SerializePointer (players, (BYTE **)&p, sizeof(*players)); +} + // The player_t constructor. Since LogText is not a POD, we cannot just // memset it all to 0. player_t::player_t() diff --git a/src/po_man.cpp b/src/po_man.cpp index 0afe9538..b2702181 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -14,7 +14,6 @@ #include "doomdef.h" #include "p_local.h" -#include "r_local.h" #include "i_system.h" #include "w_wad.h" #include "m_swap.h" @@ -22,13 +21,13 @@ #include "tables.h" #include "s_sndseq.h" #include "a_sharedglobal.h" -#include "r_main.h" #include "p_lnspec.h" #include "r_data/r_interpolate.h" #include "g_level.h" #include "po_man.h" #include "p_setup.h" #include "vectors.h" +#include "farchive.h" // MACROS ------------------------------------------------------------------ @@ -47,6 +46,16 @@ inline vertex_t *side_t::V2() const } +FArchive &operator<< (FArchive &arc, FPolyObj *&poly) +{ + return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj)); +} + +FArchive &operator<< (FArchive &arc, const FPolyObj *&poly) +{ + return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj)); +} + inline FArchive &operator<< (FArchive &arc, podoortype_t &type) { BYTE val = (BYTE)type; diff --git a/src/po_man.h b/src/po_man.h index 074426d8..5603095d 100644 --- a/src/po_man.h +++ b/src/po_man.h @@ -92,16 +92,6 @@ private: }; extern FPolyObj *polyobjs; // list of all poly-objects on the level -inline FArchive &operator<< (FArchive &arc, FPolyObj *&poly) -{ - return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj)); -} - -inline FArchive &operator<< (FArchive &arc, const FPolyObj *&poly) -{ - return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj)); -} - struct polyblock_t { FPolyObj *polyobj; @@ -111,6 +101,8 @@ struct polyblock_t void PO_LinkToSubsectors(); +FArchive &operator<< (FArchive &arc, FPolyObj *&poly); +FArchive &operator<< (FArchive &arc, const FPolyObj *&poly); #endif \ No newline at end of file diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 4758ae7d..68997791 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -45,6 +45,7 @@ #include "r_3dfloors.h" #include "a_sharedglobal.h" #include "g_level.h" +#include "p_effect.h" // State. #include "doomstat.h" diff --git a/src/r_bsp.h b/src/r_bsp.h index 867bb3fc..da20fb90 100644 --- a/src/r_bsp.h +++ b/src/r_bsp.h @@ -26,6 +26,14 @@ #include "tarray.h" #include +enum +{ + FAKED_Center, + FAKED_BelowFloor, + FAKED_AboveCeiling +}; + + struct drawseg_t { seg_t* curline; diff --git a/src/r_data/colormaps.cpp b/src/r_data/colormaps.cpp index 50cf5ced..7ab9bb17 100644 --- a/src/r_data/colormaps.cpp +++ b/src/r_data/colormaps.cpp @@ -40,7 +40,6 @@ #include "i_system.h" #include "w_wad.h" #include "doomdef.h" -#include "r_local.h" #include "r_sky.h" #include "c_dispatch.h" #include "sc_man.h" @@ -51,6 +50,8 @@ #include "colormatcher.h" #include "colormaps.h" #include "v_video.h" +#include "templates.h" +#include "r_utility.h" static bool R_CheckForFixedLights(const BYTE *colormaps); diff --git a/src/r_data/r_interpolate.cpp b/src/r_data/r_interpolate.cpp index 1e0c0a3b..5655adf2 100644 --- a/src/r_data/r_interpolate.cpp +++ b/src/r_data/r_interpolate.cpp @@ -39,6 +39,7 @@ #include "p_local.h" #include "i_system.h" #include "po_man.h" +#include "farchive.h" //========================================================================== // diff --git a/src/r_data/r_translate.cpp b/src/r_data/r_translate.cpp index 81b84060..06350e0b 100644 --- a/src/r_data/r_translate.cpp +++ b/src/r_data/r_translate.cpp @@ -35,7 +35,6 @@ #include #include "templates.h" -#include "r_main.h" #include "r_data/r_translate.h" #include "v_video.h" #include "g_game.h" @@ -47,6 +46,8 @@ #include "i_system.h" #include "w_wad.h" #include "r_data/colormaps.h" +#include "farchive.h" +#include "d_player.h" #include "gi.h" #include "stats.h" diff --git a/src/r_data/sprites.h b/src/r_data/sprites.h index 475b5ea0..43deab13 100644 --- a/src/r_data/sprites.h +++ b/src/r_data/sprites.h @@ -64,6 +64,7 @@ extern FPlayerSkin * skins; // [RH] extern BYTE OtherGameSkinRemap[256]; extern PalEntry OtherGameSkinPalette[256]; - +void R_InitSprites (); +void R_DeinitSprites (); #endif diff --git a/src/r_data/voxels.cpp b/src/r_data/voxels.cpp index d5a1cca6..bbfe706e 100644 --- a/src/r_data/voxels.cpp +++ b/src/r_data/voxels.cpp @@ -42,7 +42,6 @@ #include "m_argv.h" #include "i_system.h" #include "w_wad.h" -#include "r_local.h" #include "c_console.h" #include "c_cvars.h" #include "c_dispatch.h" @@ -61,6 +60,7 @@ #include "v_palette.h" #include "r_data/r_translate.h" #include "r_data/colormaps.h" +#include "r_data/sprites.h" #include "voxels.h" void VOX_AddVoxel(int sprnum, int frame, FVoxelDef *def); diff --git a/src/r_defs.h b/src/r_defs.h index ffecfea5..477a68b8 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -40,7 +40,6 @@ struct FGLSection; struct seg_t; #include "dthinker.h" -#include "farchive.h" #define MAXWIDTH 2560 #define MAXHEIGHT 1600 @@ -131,6 +130,7 @@ class FScanner; class FBitmap; struct FCopyInfo; class DInterpolation; +class FArchive; enum { @@ -339,16 +339,8 @@ struct secplane_t }; -inline FArchive &operator<< (FArchive &arc, secplane_t &plane) -{ - arc << plane.a << plane.b << plane.c << plane.d; - //if (plane.c != 0) - { // plane.c should always be non-0. Otherwise, the plane - // would be perfectly vertical. - plane.ic = DivScale32 (1, plane.c); - } - return arc; -} +FArchive &operator<< (FArchive &arc, secplane_t &plane); + #include "p_3dfloors.h" struct subsector_t; @@ -1147,72 +1139,13 @@ struct FMiniBSP typedef BYTE lighttable_t; // This could be wider for >8 bit display. -// A vissprite_t is a thing -// that will be drawn during a refresh. -// I.e. a sprite object that is partly visible. -struct vissprite_t +// This encapsulates the fields of vissprite_t that can be altered by AlterWeaponSprite +struct visstyle_t { - short x1, x2; - fixed_t cx; // for line side calculation - fixed_t gx, gy, gz; // origin in world coordinates - angle_t angle; - fixed_t gzb, gzt; // global bottom / top for silhouette clipping - fixed_t startfrac; // horizontal position of x1 - fixed_t xscale, yscale; - fixed_t xiscale; // negative if flipped - fixed_t depth; - fixed_t idepth; // 1/z - fixed_t texturemid; - DWORD FillColor; lighttable_t *colormap; - sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling - sector_t *sector; // [RH] sector this sprite is in - F3DFloor *fakefloor; - F3DFloor *fakeceiling; fixed_t alpha; - fixed_t floorclip; - union - { - FTexture *pic; - struct FVoxel *voxel; - }; - BYTE bIsVoxel:1; // [RH] Use voxel instead of pic - BYTE bSplitSprite:1; // [RH] Sprite was split by a drawseg - BYTE FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on - short renderflags; - DWORD Translation; // [RH] for color translation FRenderStyle RenderStyle; }; -enum -{ - FAKED_Center, - FAKED_BelowFloor, - FAKED_AboveCeiling -}; - - -// [RH] A c-buffer. Used for keeping track of offscreen voxel spans. - -struct FCoverageBuffer -{ - struct Span - { - Span *NextSpan; - short Start, Stop; - }; - - FCoverageBuffer(int size); - ~FCoverageBuffer(); - - void Clear(); - void InsertSpan(int listnum, int start, int stop); - Span *AllocSpan(); - - FMemArena SpanArena; - Span **Spans; // [0..NumLists-1] span lists - Span *FreeSpans; - unsigned int NumLists; -}; #endif diff --git a/src/r_main.cpp b/src/r_main.cpp index cf6b5bbb..aa0b857f 100644 --- a/src/r_main.cpp +++ b/src/r_main.cpp @@ -39,6 +39,7 @@ #include "r_sky.h" #include "st_stuff.h" #include "c_cvars.h" +#include "c_dispatch.h" #include "v_video.h" #include "stats.h" #include "i_video.h" @@ -52,10 +53,11 @@ #include "r_3dfloors.h" #include "v_palette.h" #include "po_man.h" +#include "p_effect.h" #include "st_start.h" #include "v_font.h" #include "r_data/colormaps.h" -//#include "gl/data/gl_data.h" +#include "farchive.h" #include "gl/gl_functions.h" EXTERN_CVAR(Int, vid_renderer) @@ -99,7 +101,6 @@ extern bool DrawFSHUD; // [RH] Defined in d_main.cpp extern short *openings; extern bool r_fakingunderwater; extern "C" int fuzzviewheight; -EXTERN_CVAR (Bool, r_particles) EXTERN_CVAR (Bool, cl_capfps) // PRIVATE DATA DECLARATIONS ----------------------------------------------- @@ -628,6 +629,32 @@ float R_GetVisibility () return CurrentVisibility; } +//========================================================================== +// +// CCMD r_visibility +// +// Controls how quickly light ramps across a 1/z range. Set this, and it +// sets all the r_*Visibility variables (except r_SkyVisibilily, which is +// currently unused). +// +//========================================================================== + +CCMD (r_visibility) +{ + if (argv.argc() < 2) + { + Printf ("Visibility is %g\n", R_GetVisibility()); + } + else if (!netgame) + { + R_SetVisibility ((float)atof (argv[1])); + } + else + { + Printf ("Visibility cannot be changed in net games.\n"); + } +} + //========================================================================== // // R_SetViewSize @@ -833,7 +860,6 @@ void R_Init () R_InitPlanes (); R_InitTranslationTables (); R_InitShadeMaps(); - R_InitParticles (); // [RH] Setup particle engine R_InitColumnDrawers (); colfunc = basecolfunc = R_DrawColumn; @@ -857,7 +883,6 @@ void R_Init () static void R_Shutdown () { - R_DeinitParticles(); R_DeinitTranslationTables(); R_DeinitPlanes(); R_DeinitColormaps (); @@ -1599,7 +1624,7 @@ void R_RenderActorView (AActor *actor, bool dontmaplines) r_fakingunderwater = false; // [RH] Setup particles for this frame - R_FindParticleSubsectors (); + P_FindParticleSubsectors (); WallCycles.Clock(); DWORD savedflags = camera->renderflags; diff --git a/src/r_main.h b/src/r_main.h index 3dff4a79..4230b331 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -23,16 +23,14 @@ #ifndef __R_MAIN_H__ #define __R_MAIN_H__ -// Number of diminishing brightness levels. -// There a 0-31, i.e. 32 LUT in the COLORMAP lump. -#define NUMCOLORMAPS 32 - +#include "r_utility.h" #include "d_player.h" -#include "r_state.h" #include "v_palette.h" #include "r_data/colormaps.h" +typedef BYTE lighttable_t; // This could be wider for >8 bit display. + // // POV related. // @@ -47,11 +45,6 @@ extern fixed_t viewingrangerecip; extern fixed_t FocalLengthX, FocalLengthY; extern float FocalLengthXfloat; extern fixed_t InvZtoScale; -extern int WidescreenRatio; - -extern angle_t LocalViewAngle; // [RH] Added to consoleplayer's angle -extern int LocalViewPitch; // [RH] Used directly instead of consoleplayer's pitch -extern bool LocalKeyboardTurner; // [RH] The local player used the keyboard to turn, so interpolate extern float WallTMapScale; extern float WallTMapScale2; @@ -73,8 +66,6 @@ extern float iyaspectmulfloat; extern FDynamicColormap*basecolormap; // [RH] Colormap for sector currently being drawn -extern int validcount; - extern int linecount; extern int loopcount; @@ -118,10 +109,6 @@ extern float r_TiltVisibility; extern fixed_t r_SpriteVisibility; extern fixed_t r_SkyVisibility; -extern fixed_t r_TicFrac; -extern DWORD r_FrameTime; -extern bool r_NoInterpolate; - extern int extralight, r_actualextralight; extern bool foggy; extern int fixedlightlev; @@ -147,33 +134,6 @@ extern void (*hcolfunc_post2) (int hx, int sx, int yl, int yh); extern void (STACK_ARGS *hcolfunc_post4) (int sx, int yl, int yh); -// -// Utility functions. - -//========================================================================== -// -// R_PointOnSide -// -// Traverse BSP (sub) tree, check point against partition plane. -// Returns side 0 (front/on) or 1 (back). -// -// [RH] inlined, stripped down, and made more precise -// -//========================================================================== - -inline int R_PointOnSide (fixed_t x, fixed_t y, const node_t *node) -{ - return DMulScale32 (y-node->y, node->dx, node->x-x, node->dy) > 0; -} - -extern fixed_t viewx; -extern fixed_t viewy; - -angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); -inline angle_t R_PointToAngle (fixed_t x, fixed_t y) { return R_PointToAngle2 (viewx, viewy, x, y); } -subsector_t *R_PointInSubsector (fixed_t x, fixed_t y); -fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy); - void R_SetFOV (float fov); float R_GetFOV (); void R_InitTextureMapping (); @@ -190,7 +150,6 @@ void R_SetupBuffer (); void R_RenderViewToCanvas (AActor *actor, DCanvas *canvas, int x, int y, int width, int height, bool dontmaplines = false); -void R_ResetViewInterpolation (); // Called by startup code. void R_Init (void); @@ -203,9 +162,6 @@ void R_SetViewSize (int blocks); void R_MultiresInit (void); -extern void R_FreePastViewers (); -extern void R_ClearPastViewer (AActor *actor); - extern int stacked_extralight; extern float stacked_visibility; extern fixed_t stacked_viewx, stacked_viewy, stacked_viewz; @@ -213,24 +169,5 @@ 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.cpp b/src/r_plane.cpp index 4275f553..9e754853 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -68,8 +68,6 @@ static void R_DrawSkyStriped (visplane_t *pl); -EXTERN_CVAR (Bool, r_particles); - planefunction_t floorfunc; planefunction_t ceilingfunc; diff --git a/src/r_state.h b/src/r_state.h index 9c77ffc8..6e4c45f6 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -24,7 +24,8 @@ #define __R_STATE_H__ // Need data structure definitions. -#include "d_player.h" +#include "doomtype.h" +#include "r_defs.h" #include "r_data/sprites.h" // @@ -74,38 +75,6 @@ extern subsector_t * gamesubsectors; extern int numgamesubsectors; -inline FArchive &operator<< (FArchive &arc, sector_t *&sec) -{ - return arc.SerializePointer (sectors, (BYTE **)&sec, sizeof(*sectors)); -} - -inline FArchive &operator<< (FArchive &arc, const sector_t *&sec) -{ - return arc.SerializePointer (sectors, (BYTE **)&sec, sizeof(*sectors)); -} - -inline FArchive &operator<< (FArchive &arc, line_t *&line) -{ - return arc.SerializePointer (lines, (BYTE **)&line, sizeof(*lines)); -} - -inline FArchive &operator<< (FArchive &arc, vertex_t *&vert) -{ - return arc.SerializePointer (vertexes, (BYTE **)&vert, sizeof(*vertexes)); -} - -inline FArchive &operator<< (FArchive &arc, side_t *&side) -{ - return arc.SerializePointer (sides, (BYTE **)&side, sizeof(*sides)); -} - -inline FArchive &operator<< (FArchive &arc, FLinkedSector &link) -{ - arc << link.Sector << link.Type; - return arc; -} - - // // POV data. // diff --git a/src/r_things.cpp b/src/r_things.cpp index 0b7b26cc..89abed2c 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -34,7 +34,6 @@ #include "templates.h" #include "doomdef.h" #include "m_swap.h" -#include "m_argv.h" #include "i_system.h" #include "w_wad.h" #include "r_local.h" @@ -53,6 +52,7 @@ #include "d_net.h" #include "colormatcher.h" #include "d_netinf.h" +#include "p_effect.h" #include "r_bsp.h" #include "r_plane.h" #include "r_segs.h" @@ -62,6 +62,28 @@ #include "r_data/colormaps.h" #include "r_data/voxels.h" +// [RH] A c-buffer. Used for keeping track of offscreen voxel spans. + +struct FCoverageBuffer +{ + struct Span + { + Span *NextSpan; + short Start, Stop; + }; + + FCoverageBuffer(int size); + ~FCoverageBuffer(); + + void Clear(); + void InsertSpan(int listnum, int start, int stop); + Span *AllocSpan(); + + FMemArena SpanArena; + Span **Spans; // [0..NumLists-1] span lists + Span *FreeSpans; + unsigned int NumLists; +}; void R_DeinitSpriteData(); @@ -93,8 +115,6 @@ FDynamicColormap *VisPSpritesBaseColormap[NUMPSPRITES]; static int spriteshade; -TArray ParticlesInSubsec; - // constant arrays // used for psprite clipping and initializing clipping short zeroarray[MAXWIDTH]; @@ -112,14 +132,6 @@ int OffscreenBufferWidth, OffscreenBufferHeight; BYTE *OffscreenColorBuffer; FCoverageBuffer *OffscreenCoverageBuffer; -// [RH] particle globals -WORD NumParticles; -WORD ActiveParticles; -WORD InactiveParticles; -particle_t *Particles; - -CVAR (Bool, r_particles, true, 0); - // // GAME FUNCTIONS // @@ -316,9 +328,9 @@ void R_DrawVisSprite (vissprite_t *vis) fixed_t xiscale; ESPSResult mode; - dc_colormap = vis->colormap; + dc_colormap = vis->Style.colormap; - mode = R_SetPatchStyle (vis->RenderStyle, vis->alpha, vis->Translation, vis->FillColor); + mode = R_SetPatchStyle (vis->Style.RenderStyle, vis->Style.alpha, vis->Translation, vis->FillColor); if (mode != DontDraw) { @@ -390,8 +402,8 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop int flags = 0; // Do setup for blending. - dc_colormap = spr->colormap; - mode = R_SetPatchStyle(spr->RenderStyle, spr->alpha, spr->Translation, spr->FillColor); + dc_colormap = spr->Style.colormap; + mode = R_SetPatchStyle(spr->Style.RenderStyle, spr->Style.alpha, spr->Translation, spr->FillColor); if (mode == DontDraw) { @@ -411,7 +423,7 @@ void R_DrawVisVoxel(vissprite_t *spr, int minslabz, int maxslabz, short *cliptop } // Render the voxel, either directly to the screen or offscreen. - R_DrawVoxel(spr->gx, spr->gy, spr->gz, spr->angle, spr->xscale, spr->yscale, spr->voxel, spr->colormap, cliptop, clipbot, + R_DrawVoxel(spr->gx, spr->gy, spr->gz, spr->angle, spr->xscale, spr->yscale, spr->voxel, spr->Style.colormap, cliptop, clipbot, minslabz, maxslabz, flags); // Blend the voxel, if that's what we need to do. @@ -753,11 +765,11 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor vis->gzt = gzt; // killough 3/27/98 vis->renderflags = thing->renderflags; if(thing->flags5 & MF5_BRIGHT) vis->renderflags |= RF_FULLBRIGHT; // kg3D - vis->RenderStyle = thing->RenderStyle; + vis->Style.RenderStyle = thing->RenderStyle; vis->FillColor = thing->fillcolor; vis->Translation = thing->Translation; // [RH] thing translation table vis->FakeFlatStat = fakeside; - vis->alpha = thing->alpha; + vis->Style.alpha = thing->alpha; vis->fakefloor = fakefloor; vis->fakeceiling = fakeceiling; @@ -775,9 +787,9 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor // The software renderer cannot invert the source without inverting the overlay // too. That means if the source is inverted, we need to do the reverse of what // the invert overlay flag says to do. - INTBOOL invertcolormap = (vis->RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (vis->Style.RenderStyle.Flags & STYLEF_InvertOverlay); - if (vis->RenderStyle.Flags & STYLEF_InvertSource) + if (vis->Style.RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } @@ -785,12 +797,12 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor FDynamicColormap *mybasecolormap = basecolormap; // Sprites that are added to the scene must fade to black. - if (vis->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (vis->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); } - if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) + if (vis->Style.RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -806,7 +818,7 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor // get light level if (fixedcolormap != NULL) { // fixed map - vis->colormap = fixedcolormap; + vis->Style.colormap = fixedcolormap; } else { @@ -816,15 +828,15 @@ void R_ProjectSprite (AActor *thing, int fakeside, F3DFloor *fakefloor, F3DFloor } if (fixedlightlev >= 0) { - vis->colormap = mybasecolormap->Maps + fixedlightlev; + vis->Style.colormap = mybasecolormap->Maps + fixedlightlev; } else if (!foggy && ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT))) { // full bright - vis->colormap = mybasecolormap->Maps; + vis->Style.colormap = mybasecolormap->Maps; } else { // diminished light - vis->colormap = mybasecolormap->Maps + (GETPALOOKUP ( + vis->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP ( (fixed_t)DivScale12 (r_SpriteVisibility, MAX(tz, MINZ)), spriteshade) << COLORMAPSHIFT); } } @@ -1000,22 +1012,22 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ noaccel = false; if (pspnum <= ps_flash) { - vis->alpha = owner->alpha; - vis->RenderStyle = owner->RenderStyle; + vis->Style.alpha = owner->alpha; + vis->Style.RenderStyle = owner->RenderStyle; // The software renderer cannot invert the source without inverting the overlay // too. That means if the source is inverted, we need to do the reverse of what // the invert overlay flag says to do. - INTBOOL invertcolormap = (vis->RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (vis->Style.RenderStyle.Flags & STYLEF_InvertOverlay); - if (vis->RenderStyle.Flags & STYLEF_InvertSource) + if (vis->Style.RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } FDynamicColormap *mybasecolormap = basecolormap; - if (vis->RenderStyle.Flags & STYLEF_FadeToBlack) + if (vis->Style.RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -1030,7 +1042,7 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ if (realfixedcolormap != NULL) { // fixed color - vis->colormap = realfixedcolormap->Colormap; + vis->Style.colormap = realfixedcolormap->Colormap; } else { @@ -1040,35 +1052,35 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ } if (fixedlightlev >= 0) { - vis->colormap = mybasecolormap->Maps + fixedlightlev; + vis->Style.colormap = mybasecolormap->Maps + fixedlightlev; } else if (!foggy && psp->state->GetFullbright()) { // full bright - vis->colormap = mybasecolormap->Maps; // [RH] use basecolormap + vis->Style.colormap = mybasecolormap->Maps; // [RH] use basecolormap } else { // local light - vis->colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT); + vis->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP (0, spriteshade) << COLORMAPSHIFT); } } if (camera->Inventory != NULL) { - lighttable_t *oldcolormap = vis->colormap; - camera->Inventory->AlterWeaponSprite (vis); - if (vis->colormap != oldcolormap) + lighttable_t *oldcolormap = vis->Style.colormap; + camera->Inventory->AlterWeaponSprite (&vis->Style); + if (vis->Style.colormap != oldcolormap) { // The colormap has changed. Is it one we can easily identify? // If not, then don't bother trying to identify it for // hardware accelerated drawing. - if (vis->colormap < SpecialColormaps[0].Colormap || - vis->colormap > SpecialColormaps.Last().Colormap) + if (vis->Style.colormap < SpecialColormaps[0].Colormap || + vis->Style.colormap > SpecialColormaps.Last().Colormap) { noaccel = true; } // Has the basecolormap changed? If so, we can't hardware accelerate it, // since we don't know what it is anymore. - else if (vis->colormap < mybasecolormap->Maps || - vis->colormap >= mybasecolormap->Maps + NUMCOLORMAPS*256) + else if (vis->Style.colormap < mybasecolormap->Maps || + vis->Style.colormap >= mybasecolormap->Maps + NUMCOLORMAPS*256) { noaccel = true; } @@ -1076,8 +1088,8 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ } // If we're drawing with a special colormap, but shaders for them are disabled, do // not accelerate. - if (!r_shadercolormaps && (vis->colormap >= SpecialColormaps[0].Colormap && - vis->colormap <= SpecialColormaps.Last().Colormap)) + if (!r_shadercolormaps && (vis->Style.colormap >= SpecialColormaps[0].Colormap && + vis->Style.colormap <= SpecialColormaps.Last().Colormap)) { noaccel = true; } @@ -1094,15 +1106,15 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_ else { VisPSpritesBaseColormap[pspnum] = basecolormap; - vis->colormap = basecolormap->Maps; - vis->RenderStyle = STYLE_Normal; + vis->Style.colormap = basecolormap->Maps; + vis->Style.RenderStyle = STYLE_Normal; } // Check for hardware-assisted 2D. If it's available, and this sprite is not // fuzzy, don't draw it until after the switch to 2D mode. if (!noaccel && RenderTarget == screen && (DFrameBuffer *)screen->Accel2D) { - FRenderStyle style = vis->RenderStyle; + FRenderStyle style = vis->Style.RenderStyle; style.CheckFuzz(); if (style.BlendOp != STYLEOP_Fuzz) { @@ -1237,18 +1249,18 @@ void R_DrawRemainingPlayerSprites() FColormapStyle colormapstyle; bool usecolormapstyle = false; - if (vis->colormap >= SpecialColormaps[0].Colormap && - vis->colormap < SpecialColormaps[SpecialColormaps.Size()].Colormap) + if (vis->Style.colormap >= SpecialColormaps[0].Colormap && + vis->Style.colormap < SpecialColormaps[SpecialColormaps.Size()].Colormap) { // Yuck! There needs to be a better way to store colormaps in the vissprite... :( - ptrdiff_t specialmap = (vis->colormap - SpecialColormaps[0].Colormap) / sizeof(FSpecialColormap); + ptrdiff_t specialmap = (vis->Style.colormap - SpecialColormaps[0].Colormap) / sizeof(FSpecialColormap); special = &SpecialColormaps[specialmap]; } else if (colormap->Color == PalEntry(255,255,255) && colormap->Desaturate == 0) { overlay = colormap->Fade; - overlay.a = BYTE(((vis->colormap - colormap->Maps) >> 8) * 255 / NUMCOLORMAPS); + overlay.a = BYTE(((vis->Style.colormap - colormap->Maps) >> 8) * 255 / NUMCOLORMAPS); } else { @@ -1256,7 +1268,7 @@ void R_DrawRemainingPlayerSprites() colormapstyle.Color = colormap->Color; colormapstyle.Fade = colormap->Fade; colormapstyle.Desaturate = colormap->Desaturate; - colormapstyle.FadeLevel = ((vis->colormap - colormap->Maps) >> 8) / float(NUMCOLORMAPS); + colormapstyle.FadeLevel = ((vis->Style.colormap - colormap->Maps) >> 8) / float(NUMCOLORMAPS); } screen->DrawTexture(vis->pic, viewwindowx + VisPSpritesX1[i], @@ -1271,8 +1283,8 @@ void R_DrawRemainingPlayerSprites() DTA_ClipTop, viewwindowy, DTA_ClipRight, viewwindowx + viewwidth, DTA_ClipBottom, viewwindowy + viewheight, - DTA_Alpha, vis->alpha, - DTA_RenderStyle, vis->RenderStyle, + DTA_Alpha, vis->Style.alpha, + DTA_RenderStyle, vis->Style.RenderStyle, DTA_FillColor, vis->FillColor, DTA_SpecialColormap, special, DTA_ColorOverlay, overlay.d, @@ -1493,7 +1505,7 @@ void R_DrawSprite (vissprite_t *spr) int r1, r2; short topclip, botclip; short *clip1, *clip2; - lighttable_t *colormap = spr->colormap; + lighttable_t *colormap = spr->Style.colormap; F3DFloor *rover; FDynamicColormap *mybasecolormap; @@ -1557,20 +1569,20 @@ void R_DrawSprite (vissprite_t *spr) // found new values, recalculate if (sec) { - INTBOOL invertcolormap = (spr->RenderStyle.Flags & STYLEF_InvertOverlay); + INTBOOL invertcolormap = (spr->Style.RenderStyle.Flags & STYLEF_InvertOverlay); - if (spr->RenderStyle.Flags & STYLEF_InvertSource) + if (spr->Style.RenderStyle.Flags & STYLEF_InvertSource) { invertcolormap = !invertcolormap; } // Sprites that are added to the scene must fade to black. - if (spr->RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) + if (spr->Style.RenderStyle == LegacyRenderStyles[STYLE_Add] && mybasecolormap->Fade != 0) { mybasecolormap = GetSpecialLights(mybasecolormap->Color, 0, mybasecolormap->Desaturate); } - if (spr->RenderStyle.Flags & STYLEF_FadeToBlack) + if (spr->Style.RenderStyle.Flags & STYLEF_FadeToBlack) { if (invertcolormap) { // Fade to white @@ -1590,16 +1602,16 @@ void R_DrawSprite (vissprite_t *spr) } if (fixedlightlev >= 0) { - spr->colormap = mybasecolormap->Maps + fixedlightlev; + spr->Style.colormap = mybasecolormap->Maps + fixedlightlev; } else if (!foggy && (spr->renderflags & RF_FULLBRIGHT)) { // full bright - spr->colormap = mybasecolormap->Maps; + spr->Style.colormap = mybasecolormap->Maps; } else { // diminished light spriteshade = LIGHT2SHADE(sec->lightlevel + r_actualextralight); - spr->colormap = mybasecolormap->Maps + (GETPALOOKUP ( + spr->Style.colormap = mybasecolormap->Maps + (GETPALOOKUP ( (fixed_t)DivScale12 (r_SpriteVisibility, spr->depth), spriteshade) << COLORMAPSHIFT); } } @@ -1750,7 +1762,7 @@ void R_DrawSprite (vissprite_t *spr) if (topclip >= botclip) { - spr->colormap = colormap; + spr->Style.colormap = colormap; return; } @@ -1864,7 +1876,7 @@ void R_DrawSprite (vissprite_t *spr) } if (i == x2) { - spr->colormap = colormap; + spr->Style.colormap = colormap; return; } } @@ -1872,7 +1884,7 @@ void R_DrawSprite (vissprite_t *spr) int maxvoxely = spr->gzb > hzb ? INT_MAX : (spr->gzt - hzb) / spr->yscale; R_DrawVisVoxel(spr, minvoxely, maxvoxely, cliptop, clipbot); } - spr->colormap = colormap; + spr->Style.colormap = colormap; } // kg3D: @@ -1978,94 +1990,6 @@ void R_DrawMasked (void) } -// -// [RH] Particle functions -// - -// [BC] Allow the maximum number of particles to be specified by a cvar (so people -// with lots of nice hardware can have lots of particles!). -CUSTOM_CVAR( Int, r_maxparticles, 4000, CVAR_ARCHIVE ) -{ - if ( self == 0 ) - self = 4000; - else if ( self < 100 ) - self = 100; - - if ( gamestate != GS_STARTUP ) - { - R_DeinitParticles( ); - R_InitParticles( ); - } -} - -void R_InitParticles () -{ - const char *i; - - if ((i = Args->CheckValue ("-numparticles"))) - NumParticles = atoi (i); - // [BC] Use r_maxparticles now. - else - NumParticles = r_maxparticles; - - // This should be good, but eh... - if ( NumParticles < 100 ) - NumParticles = 100; - - R_DeinitParticles(); - Particles = new particle_t[NumParticles]; - R_ClearParticles (); - atterm (R_DeinitParticles); -} - -void R_DeinitParticles() -{ - if (Particles != NULL) - { - delete[] Particles; - Particles = NULL; - } -} - -void R_ClearParticles () -{ - int i; - - memset (Particles, 0, NumParticles * sizeof(particle_t)); - ActiveParticles = NO_PARTICLE; - InactiveParticles = 0; - for (i = 0; i < NumParticles-1; i++) - Particles[i].tnext = i + 1; - Particles[i].tnext = NO_PARTICLE; -} - -// Group particles by subsectors. Because particles are always -// in motion, there is little benefit to caching this information -// from one frame to the next. - -void R_FindParticleSubsectors () -{ - if (ParticlesInSubsec.Size() < (size_t)numsubsectors) - { - ParticlesInSubsec.Reserve (numsubsectors - ParticlesInSubsec.Size()); - } - - clearbufshort (&ParticlesInSubsec[0], numsubsectors, NO_PARTICLE); - - if (!r_particles) - { - return; - } - for (WORD i = ActiveParticles; i != NO_PARTICLE; i = Particles[i].tnext) - { - subsector_t *ssec = R_PointInSubsector (Particles[i].x, Particles[i].y); - int ssnum = int(ssec-subsectors); - Particles[i].subsector = ssec; - Particles[i].snext = ParticlesInSubsec[ssnum]; - ParticlesInSubsec[ssnum] = i; - } -} - void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, int fakeside) { fixed_t tr_x; @@ -2205,17 +2129,17 @@ void R_ProjectParticle (particle_t *particle, const sector_t *sector, int shade, if (fixedlightlev >= 0) { - vis->colormap = map + fixedlightlev; + vis->Style.colormap = map + fixedlightlev; } else if (fixedcolormap) { - vis->colormap = fixedcolormap; + vis->Style.colormap = fixedcolormap; } else { // Using MulScale15 instead of 16 makes particles slightly more visible // than regular sprites. - vis->colormap = map + (GETPALOOKUP (MulScale15 (tiz, r_SpriteVisibility), + vis->Style.colormap = map + (GETPALOOKUP (MulScale15 (tiz, r_SpriteVisibility), shade) << COLORMAPSHIFT); } } @@ -2249,7 +2173,7 @@ void R_DrawParticle (vissprite_t *vis) int spacing; BYTE *dest; DWORD fg; - BYTE color = vis->colormap[vis->startfrac]; + BYTE color = vis->Style.colormap[vis->startfrac]; int yl = vis->gzb; int ycount = vis->gzt - yl + 1; int x1 = vis->x1; diff --git a/src/r_things.h b/src/r_things.h index da31daf7..b031eea7 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -23,50 +23,47 @@ #ifndef __R_THINGS__ #define __R_THINGS__ -// [RH] Particle details -struct particle_t + +// A vissprite_t is a thing +// that will be drawn during a refresh. +// I.e. a sprite object that is partly visible. + +struct vissprite_t { - fixed_t x,y,z; - fixed_t velx,vely,velz; - fixed_t accx,accy,accz; - BYTE ttl; - BYTE trans; - BYTE size; - BYTE fade; - int color; - WORD tnext; - WORD snext; - subsector_t * subsector; + short x1, x2; + fixed_t cx; // for line side calculation + fixed_t gx, gy, gz; // origin in world coordinates + angle_t angle; + fixed_t gzb, gzt; // global bottom / top for silhouette clipping + fixed_t startfrac; // horizontal position of x1 + fixed_t xscale, yscale; + fixed_t xiscale; // negative if flipped + fixed_t depth; + fixed_t idepth; // 1/z + fixed_t texturemid; + DWORD FillColor; + sector_t *heightsec; // killough 3/27/98: height sector for underwater/fake ceiling + sector_t *sector; // [RH] sector this sprite is in + F3DFloor *fakefloor; + F3DFloor *fakeceiling; + fixed_t floorclip; + union + { + FTexture *pic; + struct FVoxel *voxel; + }; + BYTE bIsVoxel:1; // [RH] Use voxel instead of pic + BYTE bSplitSprite:1; // [RH] Sprite was split by a drawseg + BYTE FakeFlatStat; // [RH] which side of fake/floor ceiling sprite is on + short renderflags; + DWORD Translation; // [RH] for color translation + visstyle_t Style; }; -extern WORD NumParticles; -extern WORD ActiveParticles; -extern WORD InactiveParticles; -extern particle_t *Particles; +struct particle_t; -const WORD NO_PARTICLE = 0xffff; - -inline particle_t *NewParticle (void) -{ - particle_t *result = NULL; - if (InactiveParticles != NO_PARTICLE) - { - result = Particles + InactiveParticles; - InactiveParticles = result->tnext; - result->tnext = ActiveParticles; - ActiveParticles = WORD(result - Particles); - } - return result; -} - -void R_InitParticles (); -void R_DeinitParticles (); -void R_ClearParticles (); void R_DrawParticle (vissprite_t *); void R_ProjectParticle (particle_t *, const sector_t *sector, int shade, int fakeside); -void R_FindParticleSubsectors (); - -extern TArray ParticlesInSubsec; extern int MaxVisSprites; @@ -98,8 +95,6 @@ void R_SortVisSprites (int (STACK_ARGS *compare)(const void *, const void *), si void R_AddSprites (sector_t *sec, int lightlevel, int fakeside); void R_AddPSprites (); void R_DrawSprites (); -void R_InitSprites (); -void R_DeinitSprites (); void R_ClearSprites (); void R_DrawMasked (); void R_DrawRemainingPlayerSprites (); diff --git a/src/r_utility.h b/src/r_utility.h new file mode 100644 index 00000000..e885a9ef --- /dev/null +++ b/src/r_utility.h @@ -0,0 +1,72 @@ +#ifndef __R_UTIL_H +#define __R_UTIL_H + +#include "r_state.h" +// +// Stuff from r_main.h that's needed outside the rendering code. + +// Number of diminishing brightness levels. +// There a 0-31, i.e. 32 LUT in the COLORMAP lump. +#define NUMCOLORMAPS 32 + +extern fixed_t viewx; +extern fixed_t viewy; + +extern bool r_NoInterpolate; +extern int validcount; + +extern angle_t LocalViewAngle; // [RH] Added to consoleplayer's angle +extern int LocalViewPitch; // [RH] Used directly instead of consoleplayer's pitch +extern bool LocalKeyboardTurner; // [RH] The local player used the keyboard to turn, so interpolate +extern int WidescreenRatio; + +extern fixed_t r_TicFrac; +extern DWORD r_FrameTime; + +//========================================================================== +// +// R_PointOnSide +// +// Traverse BSP (sub) tree, check point against partition plane. +// Returns side 0 (front/on) or 1 (back). +// +// [RH] inlined, stripped down, and made more precise +// +//========================================================================== + +inline int R_PointOnSide (fixed_t x, fixed_t y, const node_t *node) +{ + return DMulScale32 (y-node->y, node->dx, node->x-x, node->dy) > 0; +} + +angle_t R_PointToAngle2 (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2); +inline angle_t R_PointToAngle (fixed_t x, fixed_t y) { return R_PointToAngle2 (viewx, viewy, x, y); } +subsector_t *R_PointInSubsector (fixed_t x, fixed_t y); +fixed_t R_PointToDist2 (fixed_t dx, fixed_t dy); +void R_ResetViewInterpolation (); +void R_SetViewSize (int blocks); + +extern void R_FreePastViewers (); +extern void R_ClearPastViewer (AActor *actor); + +// 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 diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 250ebbf9..2dd815f1 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -50,6 +50,7 @@ #include "d_netinf.h" #include "i_system.h" #include "d_player.h" +#include "farchive.h" // MACROS ------------------------------------------------------------------ diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index 2a192468..0df03666 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -27,6 +27,7 @@ #include "templates.h" #include "c_dispatch.h" #include "g_level.h" +#include "farchive.h" // MACROS ------------------------------------------------------------------ diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 052d0495..5c171af0 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -50,6 +50,7 @@ #include "timidity/timidity.h" #include "g_level.h" #include "po_man.h" +#include "farchive.h" // MACROS ------------------------------------------------------------------ diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index dc5b82e0..d80d8a43 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -61,7 +61,7 @@ #include "g_level.h" #include "r_state.h" #include "cmdlib.h" -#include "r_main.h" +#include "r_utility.h" #include "doomstat.h" // MACROS ------------------------------------------------------------------ diff --git a/src/statistics.cpp b/src/statistics.cpp index fe72f766..aa8d9afc 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -70,6 +70,7 @@ #include "r_sky.h" #include "p_lnspec.h" #include "m_crc32.h" +#include "farchive.h" CVAR(Int, savestatistics, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CVAR(String, statfile, "zdoomstat.txt", CVAR_ARCHIVE|CVAR_GLOBALCONFIG) diff --git a/src/textures/anim_switches.cpp b/src/textures/anim_switches.cpp index 014e879f..137d9cbb 100644 --- a/src/textures/anim_switches.cpp +++ b/src/textures/anim_switches.cpp @@ -43,6 +43,8 @@ #include "cmdlib.h" #include "sc_man.h" #include "gi.h" +#include "farchive.h" + static int STACK_ARGS SortSwitchDefs (const void *a, const void *b) { diff --git a/src/textures/animations.cpp b/src/textures/animations.cpp index 65405e5c..c843b127 100644 --- a/src/textures/animations.cpp +++ b/src/textures/animations.cpp @@ -35,7 +35,6 @@ #include "doomtype.h" #include "cmdlib.h" #include "i_system.h" -#include "r_local.h" #include "r_sky.h" #include "m_random.h" #include "d_player.h" @@ -44,6 +43,7 @@ #include "templates.h" #include "w_wad.h" #include "g_level.h" +#include "farchive.h" // MACROS ------------------------------------------------------------------ diff --git a/src/textures/buildtexture.cpp b/src/textures/buildtexture.cpp index 0b3db702..e534ca9c 100644 --- a/src/textures/buildtexture.cpp +++ b/src/textures/buildtexture.cpp @@ -35,12 +35,12 @@ #include "doomtype.h" #include "files.h" -#include "r_local.h" #include "w_wad.h" #include "templates.h" #include "cmdlib.h" #include "st_start.h" #include "textures/textures.h" +#include "r_data/sprites.h" //========================================================================== // diff --git a/src/textures/ddstexture.cpp b/src/textures/ddstexture.cpp index 437fb28d..83df4292 100644 --- a/src/textures/ddstexture.cpp +++ b/src/textures/ddstexture.cpp @@ -50,7 +50,6 @@ #include "doomtype.h" #include "files.h" -#include "r_local.h" #include "w_wad.h" #include "templates.h" #include "bitmap.h" diff --git a/src/textures/pcxtexture.cpp b/src/textures/pcxtexture.cpp index cc2b3a22..3de4174a 100644 --- a/src/textures/pcxtexture.cpp +++ b/src/textures/pcxtexture.cpp @@ -36,7 +36,6 @@ #include "doomtype.h" #include "files.h" -#include "r_local.h" #include "w_wad.h" #include "templates.h" #include "bitmap.h" diff --git a/src/textures/pngtexture.cpp b/src/textures/pngtexture.cpp index 54a0a0cd..7927c0a9 100644 --- a/src/textures/pngtexture.cpp +++ b/src/textures/pngtexture.cpp @@ -35,7 +35,6 @@ #include "doomtype.h" #include "files.h" -#include "r_local.h" #include "w_wad.h" #include "templates.h" #include "m_png.h" diff --git a/src/textures/tgatexture.cpp b/src/textures/tgatexture.cpp index d44cf5e1..37486169 100644 --- a/src/textures/tgatexture.cpp +++ b/src/textures/tgatexture.cpp @@ -35,7 +35,6 @@ #include "doomtype.h" #include "files.h" -#include "r_local.h" #include "w_wad.h" #include "templates.h" #include "bitmap.h" diff --git a/src/textures/warptexture.cpp b/src/textures/warptexture.cpp index 0e6ff925..f047f4dd 100644 --- a/src/textures/warptexture.cpp +++ b/src/textures/warptexture.cpp @@ -35,8 +35,8 @@ #include "doomtype.h" #include "files.h" -#include "r_main.h" #include "templates.h" +#include "r_utility.h" #include "textures/textures.h" diff --git a/src/v_palette.cpp b/src/v_palette.cpp index a745d3c5..80ea75a6 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -47,7 +47,6 @@ #include "templates.h" #include "v_video.h" #include "i_system.h" -#include "r_main.h" // For lighting constants #include "w_wad.h" #include "i_video.h" #include "c_dispatch.h" diff --git a/src/wi_stuff.cpp b/src/wi_stuff.cpp index f0dbc5d8..5e3955cc 100644 --- a/src/wi_stuff.cpp +++ b/src/wi_stuff.cpp @@ -32,7 +32,6 @@ #include "w_wad.h" #include "g_game.h" #include "g_level.h" -#include "r_local.h" #include "s_sound.h" #include "doomstat.h" #include "v_video.h" @@ -45,6 +44,9 @@ #include "sc_man.h" #include "v_text.h" #include "gi.h" +#include "d_player.h" +#include "b_bot.h" +#include "textures/textures.h" #include "r_data/r_translate.h" #include "templates.h" #include "gstrings.h" diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 87c50da9..eeab8226 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -79,7 +79,7 @@ #include "cmdlib.h" #include "g_level.h" #include "doomstat.h" -#include "r_main.h" +#include "r_utility.h" #include "stats.h" #include "st_start.h"