diff --git a/src/b_bot.h b/src/b_bot.h index fd3ad3c94..27433b533 100644 --- a/src/b_bot.h +++ b/src/b_bot.h @@ -10,7 +10,7 @@ #include "c_cvars.h" #include "info.h" #include "doomdef.h" -#include "d_ticcmd.h" +#include "d_protocol.h" #include "r_defs.h" #include "a_pickups.h" #include "stats.h" diff --git a/src/b_move.cpp b/src/b_move.cpp index 2a3d40bcb..0354be8bf 100644 --- a/src/b_move.cpp +++ b/src/b_move.cpp @@ -10,7 +10,7 @@ #include "p_local.h" #include "b_bot.h" #include "g_game.h" -#include "d_ticcmd.h" +#include "d_protocol.h" #include "m_random.h" #include "i_system.h" #include "p_lnspec.h" diff --git a/src/c_bind.cpp b/src/c_bind.cpp index 8d27c38bd..65cdc1757 100644 --- a/src/c_bind.cpp +++ b/src/c_bind.cpp @@ -45,6 +45,7 @@ #include "d_event.h" #include "w_wad.h" #include "templates.h" +#include "dobject.h" #include #include diff --git a/src/d_net.h b/src/d_net.h index def8dee06..282f73e15 100644 --- a/src/d_net.h +++ b/src/d_net.h @@ -25,7 +25,7 @@ #include "doomtype.h" #include "doomdef.h" -#include "d_ticcmd.h" +#include "d_protocol.h" // diff --git a/src/d_netinf.h b/src/d_netinf.h index 4f0f6e403..c5c82f65b 100644 --- a/src/d_netinf.h +++ b/src/d_netinf.h @@ -36,8 +36,6 @@ #include "c_cvars.h" -EXTERN_CVAR (Float, autoaim) - int D_GenderToInt (const char *gender); extern const char *GenderNames[3]; diff --git a/src/d_player.h b/src/d_player.h index 66a2ce547..4a718778b 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -26,7 +26,7 @@ // Finally, for odd reasons, the player input // is buffered within the player data struct, // as commands per game tick. -#include "d_ticcmd.h" +#include "d_protocol.h" #include "doomstat.h" #include "a_weapons.h" diff --git a/src/d_protocol.cpp b/src/d_protocol.cpp index 36ec2cab2..06caca46c 100644 --- a/src/d_protocol.cpp +++ b/src/d_protocol.cpp @@ -33,7 +33,7 @@ */ #include "i_system.h" -#include "d_ticcmd.h" +#include "d_protocol.h" #include "d_net.h" #include "doomdef.h" #include "doomstat.h" diff --git a/src/d_protocol.h b/src/d_protocol.h index 7de26a179..5ac1258b3 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -229,7 +229,15 @@ int UnpackUserCmd (usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream); int PackUserCmd (const usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream); int WriteUserCmdMessage (usercmd_t *ucmd, const usercmd_t *basis, uint8_t **stream); -struct ticcmd_t; +// The data sampled per tick (single player) +// and transmitted to other peers (multiplayer). +// Mainly movements/button commands per game tick, +// plus a checksum for internal state consistency. +struct ticcmd_t +{ + usercmd_t ucmd; + int16_t consistancy; // checks for net game +}; int SkipTicCmd (uint8_t **stream, int count); void ReadTicCmd (uint8_t **stream, int player, int tic); diff --git a/src/d_ticcmd.h b/src/d_ticcmd.h deleted file mode 100644 index 66a629e08..000000000 --- a/src/d_ticcmd.h +++ /dev/null @@ -1,38 +0,0 @@ -// Emacs style mode select -*- C++ -*- -//----------------------------------------------------------------------------- -// -// $Id:$ -// -// Copyright (C) 1993-1996 by id Software, Inc. -// -// This source is available for distribution and/or modification -// only under the terms of the DOOM Source Code License as -// published by id Software. All rights reserved. -// -// The source is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License -// for more details. -// -// DESCRIPTION: -// System specific interface stuff. -// -//----------------------------------------------------------------------------- - - -#ifndef __D_TICCMD_H__ -#define __D_TICCMD_H__ - -#include "d_protocol.h" - -// The data sampled per tick (single player) -// and transmitted to other peers (multiplayer). -// Mainly movements/button commands per game tick, -// plus a checksum for internal state consistency. -struct ticcmd_t -{ - usercmd_t ucmd; - int16_t consistancy; // checks for net game -}; - -#endif // __D_TICCMD_H__ diff --git a/src/decallib.h b/src/decallib.h index 7c3369c4d..75df4ae42 100644 --- a/src/decallib.h +++ b/src/decallib.h @@ -38,7 +38,6 @@ #include "doomtype.h" #include "r_data/renderstyle.h" -#include "textures/textures.h" class FScanner; class FDecalTemplate; diff --git a/src/dobjgc.cpp b/src/dobjgc.cpp index 56e8c82d4..35a30c136 100644 --- a/src/dobjgc.cpp +++ b/src/dobjgc.cpp @@ -65,7 +65,6 @@ #include "sbar.h" #include "stats.h" #include "c_dispatch.h" -#include "p_acs.h" #include "s_sndseq.h" #include "r_data/r_interpolate.h" #include "doomstat.h" @@ -80,6 +79,8 @@ #include "g_levellocals.h" #include "events.h" +void MarkACSThinker(); + // MACROS ------------------------------------------------------------------ /* @@ -331,7 +332,7 @@ static void MarkRoot() Mark(DIntermissionController::CurrentIntermission); DThinker::MarkRoots(); FCanvasTextureInfo::Mark(); - Mark(DACSThinker::ActiveThinker); + MarkACSThinker(); Mark(E_FirstEventHandler); Mark(E_LastEventHandler); for (auto &s : level.sectorPortals) diff --git a/src/dobjtype.h b/src/dobjtype.h index 6b24610f8..c3ced5a63 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -8,6 +8,13 @@ typedef std::pair FTypeAndOffset; class PStruct; +// This is intentionally not in vm.h so that this file remains free of DObject pollution. +class VMException : public DObject +{ + DECLARE_CLASS(VMException, DObject); +}; + + #include "vm.h" // Variable/parameter/field flags ------------------------------------------- diff --git a/src/dscript.h b/src/dscript.h deleted file mode 100644 index 725f9b77b..000000000 --- a/src/dscript.h +++ /dev/null @@ -1,26 +0,0 @@ -enum -{ - EX_Return = 0x00, - EX_EndFuncParms = 0x01, - EX_ByteConst = 0x02, - EX_WordConst = 0x03, - EX_DWordConst = 0x04, - EX_FixedConst = 0x05, // To become FloatConst whenever I move to floats - EX_StringConst = 0x06, - - EX_Extended1 = 0xF1, - EX_Extended2 = 0xF2, - EX_Extended3 = 0xF3, - EX_Extended4 = 0xF4, - EX_Extended5 = 0xF5, - EX_Extended6 = 0xF6, - EX_Extended7 = 0xF7, - EX_Extended8 = 0xF8, - EX_Extended9 = 0xF9, - EX_ExtendedA = 0xFA, - EX_ExtendedB = 0xFB, - EX_ExtendedC = 0xFC, - EX_ExtendedD = 0xFD, - EX_ExtendedE = 0xFE, - EX_ExtendedF = 0xFF -}; \ No newline at end of file diff --git a/src/g_level.h b/src/g_level.h index ccb00b0ee..db2fd6cc1 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -35,16 +35,12 @@ #define __G_LEVEL_H__ #include "doomtype.h" -#include "doomdef.h" #include "sc_man.h" -#include "s_sound.h" -#include "p_acs.h" -#include "textures/textures.h" #include "resourcefiles/file_zip.h" struct level_info_t; struct cluster_info_t; -class FScanner; +class FSerializer; #if defined(_MSC_VER) #pragma section(".yreg$u",read) @@ -55,6 +51,24 @@ class FScanner; #define GCC_YSEG __attribute__((section(SECTION_YREG))) __attribute__((used)) #endif +// The structure used to control scripts between maps +struct acsdefered_t +{ + enum EType + { + defexecute, + defexealways, + defsuspend, + defterminate + } type; + int script; + int args[3]; + int playernum; +}; + +FSerializer &Serialize(FSerializer &arc, const char *key, acsdefered_t &defer, acsdefered_t *def); + + struct FIntermissionDescriptor; struct FIntermissionAction; @@ -339,7 +353,7 @@ struct level_info_t TArray specialactions; - TArray PrecacheSounds; + TArray PrecacheSounds; TArray PrecacheTextures; TArray PrecacheClasses; diff --git a/src/g_pch.h b/src/g_pch.h index e5653796b..cad5a8409 100644 --- a/src/g_pch.h +++ b/src/g_pch.h @@ -21,3 +21,10 @@ #include #include #include +#include +#include + +// These two headers get included nearly everywhere so it doesn't matter if changing them forces a few more recompiles. +// The overall savings from PCHing them are more significant. +#include "tarray.h" +#include "zstring.h" \ No newline at end of file diff --git a/src/gi.cpp b/src/gi.cpp index ad5c5a0ee..d30902045 100644 --- a/src/gi.cpp +++ b/src/gi.cpp @@ -125,6 +125,21 @@ const char* GameInfoBorders[] = } \ while (sc.CheckToken(',')); \ } +#define GAMEINFOKEY_SOUNDARRAY(key, variable, length, clear) \ + else if(nextKey.CompareNoCase(variable) == 0) \ + { \ + if (clear) gameinfo.key.Clear(); \ + do \ + { \ + sc.MustGetToken(TK_StringConst); \ + if(length > 0 && strlen(sc.String) > length) \ + { \ + sc.ScriptError("Value for '%s' can not be longer than %d characters.", #key, length); \ + } \ + gameinfo.key[gameinfo.key.Reserve(1)] = FSoundID(sc.String); \ + } \ + while (sc.CheckToken(',')); \ + } #define GAMEINFOKEY_STRING(key, variable) \ else if(nextKey.CompareNoCase(variable) == 0) \ @@ -323,7 +338,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_STRINGARRAY(infoPages, "infoPage", 8, true) GAMEINFOKEY_STRINGARRAY(PrecachedClasses, "precacheclasses", 0, false) GAMEINFOKEY_STRINGARRAY(PrecachedTextures, "precachetextures", 0, false) - GAMEINFOKEY_STRINGARRAY(PrecachedSounds, "precachesounds", 0, false) + GAMEINFOKEY_SOUNDARRAY(PrecachedSounds, "precachesounds", 0, false) GAMEINFOKEY_STRINGARRAY(EventHandlers, "addeventhandlers", 0, true) GAMEINFOKEY_STRINGARRAY(EventHandlers, "eventhandlers", 0, false) GAMEINFOKEY_STRING(PauseSign, "pausesign") diff --git a/src/gi.h b/src/gi.h index f20ae0d99..759637dea 100644 --- a/src/gi.h +++ b/src/gi.h @@ -36,7 +36,6 @@ #include "basictypes.h" #include "zstring.h" -#include "s_sound.h" // Flags are not user configurable and only depend on the standard IWADs #define GI_MAPxx 0x00000001 @@ -123,7 +122,7 @@ struct gameinfo_t TArray PrecachedClasses; TArray PrecachedTextures; - TArray PrecachedSounds; + TArray PrecachedSounds; TArray EventHandlers; FString titleMusic; diff --git a/src/gl/renderer/gl_renderbuffers.cpp b/src/gl/renderer/gl_renderbuffers.cpp index fad79767c..a3635ca0b 100644 --- a/src/gl/renderer/gl_renderbuffers.cpp +++ b/src/gl/renderer/gl_renderbuffers.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_ambientshader.cpp b/src/gl/shaders/gl_ambientshader.cpp index effde2496..02090cf61 100644 --- a/src/gl/shaders/gl_ambientshader.cpp +++ b/src/gl/shaders/gl_ambientshader.cpp @@ -21,7 +21,6 @@ // #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_bloomshader.cpp b/src/gl/shaders/gl_bloomshader.cpp index 44253ae79..bc7b80b01 100644 --- a/src/gl/shaders/gl_bloomshader.cpp +++ b/src/gl/shaders/gl_bloomshader.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_blurshader.cpp b/src/gl/shaders/gl_blurshader.cpp index cd4532cc4..56b637f6d 100644 --- a/src/gl/shaders/gl_blurshader.cpp +++ b/src/gl/shaders/gl_blurshader.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_colormapshader.cpp b/src/gl/shaders/gl_colormapshader.cpp index 06c72160a..e29b27013 100644 --- a/src/gl/shaders/gl_colormapshader.cpp +++ b/src/gl/shaders/gl_colormapshader.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_lensshader.cpp b/src/gl/shaders/gl_lensshader.cpp index 9d242aa87..c5ec679f3 100644 --- a/src/gl/shaders/gl_lensshader.cpp +++ b/src/gl/shaders/gl_lensshader.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_present3dRowshader.cpp b/src/gl/shaders/gl_present3dRowshader.cpp index d8369a3b6..94dd7dc79 100644 --- a/src/gl/shaders/gl_present3dRowshader.cpp +++ b/src/gl/shaders/gl_present3dRowshader.cpp @@ -28,7 +28,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_presentshader.cpp b/src/gl/shaders/gl_presentshader.cpp index 15acc74fb..5fe040db9 100644 --- a/src/gl/shaders/gl_presentshader.cpp +++ b/src/gl/shaders/gl_presentshader.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_shaderprogram.cpp b/src/gl/shaders/gl_shaderprogram.cpp index 7a4690874..5327eeac0 100644 --- a/src/gl/shaders/gl_shaderprogram.cpp +++ b/src/gl/shaders/gl_shaderprogram.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/shaders/gl_tonemapshader.cpp b/src/gl/shaders/gl_tonemapshader.cpp index 3db6db8ba..5045618be 100644 --- a/src/gl/shaders/gl_tonemapshader.cpp +++ b/src/gl/shaders/gl_tonemapshader.cpp @@ -26,7 +26,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "gl/gl_functions.h" diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index c940e8b0d..e6f2833f8 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -27,7 +27,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "doomstat.h" diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index 33c93c187..635f73fac 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -39,7 +39,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "doomstat.h" diff --git a/src/gl/system/gl_swwipe.cpp b/src/gl/system/gl_swwipe.cpp index 03577773f..86fa11525 100644 --- a/src/gl/system/gl_swwipe.cpp +++ b/src/gl/system/gl_swwipe.cpp @@ -35,7 +35,6 @@ // HEADER FILES ------------------------------------------------------------ #include "gl/system/gl_system.h" -#include "files.h" #include "m_swap.h" #include "v_video.h" #include "doomstat.h" diff --git a/src/gl/system/gl_wipe.cpp b/src/gl/system/gl_wipe.cpp index 88b9ef015..db03f99c1 100644 --- a/src/gl/system/gl_wipe.cpp +++ b/src/gl/system/gl_wipe.cpp @@ -25,7 +25,6 @@ */ #include "gl/system/gl_system.h" -#include "files.h" #include "f_wipe.h" #include "m_random.h" #include "w_wad.h" diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index ace2c0c61..d395d0ad2 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -50,6 +50,7 @@ #include "g_levellocals.h" #include "virtual.h" #include "events.h" +#include "p_acs.h" // [RH] Actually handle the cheat. The cheat code in st_stuff.c now just // writes some bytes to the network data stream, and the network code diff --git a/src/m_png.h b/src/m_png.h index 2390059c1..70c45b710 100644 --- a/src/m_png.h +++ b/src/m_png.h @@ -36,8 +36,9 @@ #include #include "doomtype.h" #include "v_video.h" -#include "files.h" +class FileReader; +class FileWriter; // PNG Writing -------------------------------------------------------------- // Start writing an 8-bit palettized PNG file. diff --git a/src/md5.cpp b/src/md5.cpp index ae3cb53c0..aa4b506da 100644 --- a/src/md5.cpp +++ b/src/md5.cpp @@ -20,6 +20,7 @@ #include "doomtype.h" #include "md5.h" #include "templates.h" +#include "files.h" #ifdef __BIG_ENDIAN__ void byteSwap(uint32_t *buf, unsigned words) diff --git a/src/md5.h b/src/md5.h index 1f2765378..a645919db 100644 --- a/src/md5.h +++ b/src/md5.h @@ -18,7 +18,7 @@ #ifndef MD5_H #define MD5_H -#include "files.h" +class FileReader; struct MD5Context { diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index 2c0dbff64..4d52f550b 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -37,11 +37,7 @@ typedef enum } ffloortype_e; // This is for the purpose of Sector_SetContents: -#ifdef _MSC_VER -enum : unsigned int // MSVC is apparently the only compiler that supports this syntax -#else -enum -#endif +enum : unsigned int { VC_EMPTY = 0, // Here's the original values of the color shifts in Vavoom, and in ARGB: VC_WATER = 0x80825032, // 130, 80, 50, 128 -> 80.82.50.32 (was 0x101080) @@ -60,7 +56,8 @@ enum struct secplane_t; struct FDynamicColormap; - +struct line_t; +struct sector_t; struct F3DFloor { @@ -115,7 +112,7 @@ struct lightlist_t -class player_s; +class player_t; void P_PlayerOnSpecial3DFloor(player_t* player); bool P_CheckFor3DFloorHit(AActor * mo, double z); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 29230616f..c50e787d2 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -659,6 +659,134 @@ struct CallReturn unsigned int EntryInstrCount; }; + +class DLevelScript : public DObject +{ + DECLARE_CLASS(DLevelScript, DObject) + HAS_OBJECT_POINTERS +public: + + + enum EScriptState + { + SCRIPT_Running, + SCRIPT_Suspended, + SCRIPT_Delayed, + SCRIPT_TagWait, + SCRIPT_PolyWait, + SCRIPT_ScriptWaitPre, + SCRIPT_ScriptWait, + SCRIPT_PleaseRemove, + SCRIPT_DivideBy0, + SCRIPT_ModulusBy0, + }; + + DLevelScript(AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module, + const int *args, int argcount, int flags); + ~DLevelScript(); + + void Serialize(FSerializer &arc); + int RunScript(); + + inline void SetState(EScriptState newstate) { state = newstate; } + inline EScriptState GetState() { return state; } + + DLevelScript *GetNext() const { return next; } + + void MarkLocalVarStrings() const + { + GlobalACSStrings.MarkStringArray(&Localvars[0], Localvars.Size()); + } + void LockLocalVarStrings() const + { + GlobalACSStrings.LockStringArray(&Localvars[0], Localvars.Size()); + } + void UnlockLocalVarStrings() const + { + GlobalACSStrings.UnlockStringArray(&Localvars[0], Localvars.Size()); + } + +protected: + DLevelScript *next, *prev; + int script; + TArray Localvars; + int *pc; + EScriptState state; + int statedata; + TObjPtr activator; + line_t *activationline; + bool backSide; + FFont *activefont; + int hudwidth, hudheight; + int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight; + int WrapWidth; + bool HandleAspect; + FBehavior *activeBehavior; + int InModuleScriptNumber; + + void Link(); + void Unlink(); + void PutLast(); + void PutFirst(); + static int Random(int min, int max); + static int ThingCount(int type, int stringid, int tid, int tag); + static void ChangeFlat(int tag, int name, bool floorOrCeiling); + static int CountPlayers(); + static void SetLineTexture(int lineid, int side, int position, int name); + static int DoSpawn(int type, const DVector3 &pos, int tid, DAngle angle, bool force); + static int DoSpawn(int type, int x, int y, int z, int tid, int angle, bool force); + static bool DoCheckActorTexture(int tid, AActor *activator, int string, bool floor); + int DoSpawnSpot(int type, int spot, int tid, int angle, bool forced); + int DoSpawnSpotFacing(int type, int spot, int tid, bool forced); + int DoClassifyActor(int tid); + int CallFunction(int argCount, int funcIndex, int32_t *args); + + void DoFadeTo(int r, int g, int b, int a, int time); + void DoFadeRange(int r1, int g1, int b1, int a1, + int r2, int g2, int b2, int a2, int time); + void DoSetFont(int fontnum); + void SetActorProperty(int tid, int property, int value); + void DoSetActorProperty(AActor *actor, int property, int value); + int GetActorProperty(int tid, int property); + int CheckActorProperty(int tid, int property, int value); + int GetPlayerInput(int playernum, int inputnum); + + int LineFromID(int id); + int SideFromID(int id, int side); + +private: + DLevelScript(); + + friend class DACSThinker; +}; + +class DACSThinker : public DThinker +{ + DECLARE_CLASS(DACSThinker, DThinker) + HAS_OBJECT_POINTERS +public: + DACSThinker(); + ~DACSThinker(); + + void Serialize(FSerializer &arc); + void Tick(); + + typedef TMap ScriptMap; + ScriptMap RunningScripts; // Array of all synchronous scripts + static TObjPtr ActiveThinker; + + void DumpScriptStatus(); + void StopScriptsFor(AActor *actor); + +private: + DLevelScript *LastScript; + DLevelScript *Scripts; // List of all running scripts + + friend class DLevelScript; + friend class FBehavior; +}; + + static DLevelScript *P_GetScriptGoing (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module, const int *args, int argcount, int flags); @@ -10863,6 +10991,11 @@ CCMD(acsprofile) ShowProfileData(FuncProfiles, limit, sorter, true); } +void MarkACSThinker() +{ + GC::Mark(DACSThinker::ActiveThinker); +} + ADD_STAT(ACS) { return FStringf("ACS time: %f ms", ACSTime.TimeMS()); diff --git a/src/p_acs.h b/src/p_acs.h index 4943ef401..178a6ecce 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -35,8 +35,6 @@ #ifndef __P_ACS_H__ #define __P_ACS_H__ -#include "dobject.h" -#include "dthinker.h" #include "doomtype.h" #define LOCAL_SIZE 20 @@ -385,147 +383,4 @@ private: friend void ArrangeFunctionProfiles(TArray &profiles); }; -class DLevelScript : public DObject -{ - DECLARE_CLASS (DLevelScript, DObject) - HAS_OBJECT_POINTERS -public: - - - enum EScriptState - { - SCRIPT_Running, - SCRIPT_Suspended, - SCRIPT_Delayed, - SCRIPT_TagWait, - SCRIPT_PolyWait, - SCRIPT_ScriptWaitPre, - SCRIPT_ScriptWait, - SCRIPT_PleaseRemove, - SCRIPT_DivideBy0, - SCRIPT_ModulusBy0, - }; - - DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr *code, FBehavior *module, - const int *args, int argcount, int flags); - ~DLevelScript (); - - void Serialize(FSerializer &arc); - int RunScript (); - - inline void SetState (EScriptState newstate) { state = newstate; } - inline EScriptState GetState () { return state; } - - DLevelScript *GetNext() const { return next; } - - void MarkLocalVarStrings() const - { - GlobalACSStrings.MarkStringArray(&Localvars[0], Localvars.Size()); - } - void LockLocalVarStrings() const - { - GlobalACSStrings.LockStringArray(&Localvars[0], Localvars.Size()); - } - void UnlockLocalVarStrings() const - { - GlobalACSStrings.UnlockStringArray(&Localvars[0], Localvars.Size()); - } - -protected: - DLevelScript *next, *prev; - int script; - TArray Localvars; - int *pc; - EScriptState state; - int statedata; - TObjPtr activator; - line_t *activationline; - bool backSide; - FFont *activefont; - int hudwidth, hudheight; - int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight; - int WrapWidth; - bool HandleAspect; - FBehavior *activeBehavior; - int InModuleScriptNumber; - - void Link (); - void Unlink (); - void PutLast (); - void PutFirst (); - static int Random (int min, int max); - static int ThingCount (int type, int stringid, int tid, int tag); - static void ChangeFlat (int tag, int name, bool floorOrCeiling); - static int CountPlayers (); - static void SetLineTexture (int lineid, int side, int position, int name); - static int DoSpawn (int type, const DVector3 &pos, int tid, DAngle angle, bool force); - static int DoSpawn(int type, int x, int y, int z, int tid, int angle, bool force); - static bool DoCheckActorTexture(int tid, AActor *activator, int string, bool floor); - int DoSpawnSpot (int type, int spot, int tid, int angle, bool forced); - int DoSpawnSpotFacing (int type, int spot, int tid, bool forced); - int DoClassifyActor (int tid); - int CallFunction(int argCount, int funcIndex, int32_t *args); - - void DoFadeTo (int r, int g, int b, int a, int time); - void DoFadeRange (int r1, int g1, int b1, int a1, - int r2, int g2, int b2, int a2, int time); - void DoSetFont (int fontnum); - void SetActorProperty (int tid, int property, int value); - void DoSetActorProperty (AActor *actor, int property, int value); - int GetActorProperty (int tid, int property); - int CheckActorProperty (int tid, int property, int value); - int GetPlayerInput (int playernum, int inputnum); - - int LineFromID(int id); - int SideFromID(int id, int side); - -private: - DLevelScript (); - - friend class DACSThinker; -}; - -class DACSThinker : public DThinker -{ - DECLARE_CLASS (DACSThinker, DThinker) - HAS_OBJECT_POINTERS -public: - DACSThinker (); - ~DACSThinker (); - - void Serialize(FSerializer &arc); - void Tick (); - - typedef TMap ScriptMap; - ScriptMap RunningScripts; // Array of all synchronous scripts - static TObjPtr ActiveThinker; - - void DumpScriptStatus(); - void StopScriptsFor (AActor *actor); - -private: - DLevelScript *LastScript; - DLevelScript *Scripts; // List of all running scripts - - friend class DLevelScript; - friend class FBehavior; -}; - -// The structure used to control scripts between maps -struct acsdefered_t -{ - enum EType - { - defexecute, - defexealways, - defsuspend, - defterminate - } type; - int script; - int args[3]; - int playernum; -}; - -FSerializer &Serialize(FSerializer &arc, const char *key, acsdefered_t &defer, acsdefered_t *def); - #endif //__P_ACS_H__ diff --git a/src/polyrenderer/drawers/poly_buffer.h b/src/polyrenderer/drawers/poly_buffer.h index 4454f72fd..a135722fd 100644 --- a/src/polyrenderer/drawers/poly_buffer.h +++ b/src/polyrenderer/drawers/poly_buffer.h @@ -22,6 +22,8 @@ #pragma once +#include + struct TriVertex; class PolySubsectorGBuffer diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index f36caca24..a9cb70809 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -38,7 +38,7 @@ #include #include -#include "d_ticcmd.h" +#include "d_protocol.h" #include "doomdef.h" #include "doomerrors.h" #include "doomstat.h" diff --git a/src/r_data/renderstyle.h b/src/r_data/renderstyle.h index 364cf579e..ebc1bd53f 100644 --- a/src/r_data/renderstyle.h +++ b/src/r_data/renderstyle.h @@ -1,6 +1,4 @@ -#ifndef __R_BLEND_H -#define __R_BLEND_H - +#pragma once /* ** r_blend.h ** Constants and types for specifying texture blending. @@ -162,4 +160,3 @@ inline FRenderStyle &FRenderStyle::operator= (ERenderStyle legacy) return *this; } -#endif diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 22f81a529..8e5ac7349 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -491,14 +491,14 @@ void S_PrecacheLevel () actor->MarkPrecacheSounds(); } } - for (auto i : gameinfo.PrecachedSounds) + for (auto snd : gameinfo.PrecachedSounds) { - level.info->PrecacheSounds[i].MarkUsed(); + FSoundID(snd).MarkUsed(); } // Precache all extra sounds requested by this map. - for (i = 0; i < level.info->PrecacheSounds.Size(); ++i) + for (auto snd : level.info->PrecacheSounds) { - level.info->PrecacheSounds[i].MarkUsed(); + FSoundID(snd).MarkUsed(); } // Don't unload sounds that are playing right now. for (FSoundChan *chan = Channels; chan != NULL; chan = chan->NextChan) diff --git a/src/scripting/backend/scopebarrier.h b/src/scripting/backend/scopebarrier.h index da0bc6d1d..fdcfedfba 100644 --- a/src/scripting/backend/scopebarrier.h +++ b/src/scripting/backend/scopebarrier.h @@ -2,6 +2,9 @@ #include "zstring.h" +class PClass; +class VMFunction; + // // [ZZ] this really should be in codegen.h, but vmexec needs to access it struct FScopeBarrier diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index a09134d58..c90cc17e8 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -50,7 +50,6 @@ #include "zstring.h" #include "d_event.h" #include "g_levellocals.h" -#include "vm.h" #include "p_checkposition.h" #include "r_sky.h" #include "v_font.h" diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index 3a4ffb02c..8a26a7d3f 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -844,11 +844,6 @@ struct VMRegisters VMValue *param; }; -struct VMException : public DObject -{ - DECLARE_CLASS(VMException, DObject); -}; - union FVoidObj { DObject *o; diff --git a/src/tarray.h b/src/tarray.h index fe0d8c1e2..d6962816c 100644 --- a/src/tarray.h +++ b/src/tarray.h @@ -1,3 +1,4 @@ +#pragma once /* ** tarray.h ** Templated, automatically resizing array @@ -32,8 +33,6 @@ ** */ -#ifndef __TARRAY_H__ -#define __TARRAY_H__ #include #include @@ -1250,4 +1249,3 @@ protected: hash_t Position; }; -#endif //__TARRAY_H__ diff --git a/src/v_palette.cpp b/src/v_palette.cpp index f816c9728..1c13446a8 100644 --- a/src/v_palette.cpp +++ b/src/v_palette.cpp @@ -32,6 +32,8 @@ ** */ +#include "g_level.h" + #include #include #include @@ -50,7 +52,6 @@ #include "w_wad.h" #include "i_video.h" #include "c_dispatch.h" -#include "g_level.h" #include "st_stuff.h" #include "gi.h" #include "x86.h" diff --git a/src/zstring.h b/src/zstring.h index e486a0e8b..4de4a2ba0 100644 --- a/src/zstring.h +++ b/src/zstring.h @@ -1,3 +1,4 @@ +#pragma once /* ** zstring.h ** @@ -31,8 +32,6 @@ ** */ -#ifndef ZSTRING_H -#define ZSTRING_H #include #include @@ -450,4 +449,3 @@ template<> struct THashTraits int Compare(const FString &left, const FString &right) { return left.Compare(right); } }; -#endif