2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** p_acs.h
|
|
|
|
** ACS script stuff
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2012-03-08 20:48:53 +00:00
|
|
|
** Copyright 1998-2012 Randy Heit
|
2006-02-24 04:48:15 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __P_ACS_H__
|
|
|
|
#define __P_ACS_H__
|
|
|
|
|
|
|
|
#include "dobject.h"
|
2009-02-03 19:11:43 +00:00
|
|
|
#include "dthinker.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "doomtype.h"
|
|
|
|
|
|
|
|
#define LOCAL_SIZE 20
|
|
|
|
#define NUM_MAPVARS 128
|
|
|
|
|
|
|
|
class FFont;
|
2006-06-14 15:56:56 +00:00
|
|
|
class FileReader;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-02-03 19:11:43 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
NUM_WORLDVARS = 256,
|
|
|
|
NUM_GLOBALVARS = 64
|
|
|
|
};
|
|
|
|
|
|
|
|
struct InitIntToZero
|
|
|
|
{
|
|
|
|
void Init(int &v)
|
|
|
|
{
|
|
|
|
v = 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
typedef TMap<SDWORD, SDWORD, THashTraits<SDWORD>, InitIntToZero> FWorldGlobalArray;
|
|
|
|
|
|
|
|
// ACS variables with world scope
|
|
|
|
extern SDWORD ACS_WorldVars[NUM_WORLDVARS];
|
|
|
|
extern FWorldGlobalArray ACS_WorldArrays[NUM_WORLDVARS];
|
|
|
|
|
|
|
|
// ACS variables with global scope
|
|
|
|
extern SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
|
|
|
|
extern FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS];
|
|
|
|
|
2013-05-30 02:22:47 +00:00
|
|
|
#define LIBRARYID_MASK 0xFFF00000
|
|
|
|
#define LIBRARYID_SHIFT 20
|
|
|
|
|
|
|
|
// Global ACS string table
|
|
|
|
#define STRPOOL_LIBRARYID (INT_MAX >> LIBRARYID_SHIFT)
|
|
|
|
#define STRPOOL_LIBRARYID_OR (STRPOOL_LIBRARYID << LIBRARYID_SHIFT)
|
|
|
|
|
|
|
|
class ACSStringPool
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ACSStringPool();
|
2013-06-02 23:58:29 +00:00
|
|
|
int AddString(const char *str, const SDWORD *stack, int stackdepth);
|
|
|
|
int AddString(FString &str, const SDWORD *stack, int stackdepth);
|
2013-05-30 02:22:47 +00:00
|
|
|
const char *GetString(int strnum);
|
|
|
|
void LockString(int strnum);
|
|
|
|
void UnlockString(int strnum);
|
|
|
|
void UnlockAll();
|
|
|
|
void MarkString(int strnum);
|
|
|
|
void LockStringArray(const int *strnum, unsigned int count);
|
|
|
|
void UnlockStringArray(const int *strnum, unsigned int count);
|
|
|
|
void MarkStringArray(const int *strnum, unsigned int count);
|
|
|
|
void MarkStringMap(const FWorldGlobalArray &array);
|
|
|
|
void PurgeStrings();
|
|
|
|
void Clear();
|
|
|
|
void Dump() const;
|
|
|
|
void ReadStrings(PNGHandle *png, DWORD id);
|
|
|
|
void WriteStrings(FILE *file, DWORD id) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
int FindString(const char *str, size_t len, unsigned int h, unsigned int bucketnum);
|
2013-06-02 23:58:29 +00:00
|
|
|
int InsertString(FString &str, unsigned int h, unsigned int bucketnum, const SDWORD *stack, int stackdepth);
|
2013-08-30 03:22:30 +00:00
|
|
|
void FindFirstFreeEntry(unsigned int base);
|
2013-05-30 02:22:47 +00:00
|
|
|
|
|
|
|
enum { NUM_BUCKETS = 251 };
|
|
|
|
enum { FREE_ENTRY = 0xFFFFFFFE }; // Stored in PoolEntry's Next field
|
|
|
|
enum { NO_ENTRY = 0xFFFFFFFF };
|
|
|
|
enum { MIN_GC_SIZE = 100 }; // Don't auto-collect until there are this many strings
|
|
|
|
struct PoolEntry
|
|
|
|
{
|
|
|
|
FString Str;
|
|
|
|
unsigned int Hash;
|
|
|
|
unsigned int Next;
|
|
|
|
unsigned int LockCount;
|
|
|
|
};
|
|
|
|
TArray<PoolEntry> Pool;
|
|
|
|
unsigned int PoolBuckets[NUM_BUCKETS];
|
|
|
|
unsigned int FirstFreeEntry;
|
|
|
|
};
|
|
|
|
extern ACSStringPool GlobalACSStrings;
|
|
|
|
|
2013-06-02 23:58:29 +00:00
|
|
|
void P_CollectACSGlobalStrings(const SDWORD *stack, int stackdepth);
|
2009-02-03 19:11:43 +00:00
|
|
|
void P_ReadACSVars(PNGHandle *);
|
|
|
|
void P_WriteACSVars(FILE*);
|
|
|
|
void P_ClearACSVars(bool);
|
2012-02-18 02:17:33 +00:00
|
|
|
void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte);
|
2009-02-03 19:11:43 +00:00
|
|
|
|
2013-02-02 05:54:15 +00:00
|
|
|
struct ACSProfileInfo
|
|
|
|
{
|
|
|
|
unsigned long long TotalInstr;
|
|
|
|
unsigned int NumRuns;
|
|
|
|
unsigned int MinInstrPerRun;
|
|
|
|
unsigned int MaxInstrPerRun;
|
|
|
|
|
|
|
|
ACSProfileInfo();
|
|
|
|
void AddRun(unsigned int num_instr);
|
2013-02-03 04:30:20 +00:00
|
|
|
void Reset();
|
2013-02-02 05:54:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ProfileCollector
|
|
|
|
{
|
|
|
|
ACSProfileInfo *ProfileData;
|
|
|
|
class FBehavior *Module;
|
|
|
|
int Index;
|
|
|
|
};
|
|
|
|
|
2014-07-27 03:58:47 +00:00
|
|
|
struct ACSLocalArrayInfo
|
|
|
|
{
|
|
|
|
unsigned int Size;
|
|
|
|
int Offset;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ACSLocalArrays
|
|
|
|
{
|
|
|
|
unsigned int Count;
|
|
|
|
ACSLocalArrayInfo *Info;
|
|
|
|
|
|
|
|
ACSLocalArrays()
|
|
|
|
{
|
|
|
|
Count = 0;
|
|
|
|
Info = NULL;
|
|
|
|
}
|
|
|
|
~ACSLocalArrays()
|
|
|
|
{
|
|
|
|
if (Info != NULL)
|
|
|
|
{
|
|
|
|
delete[] Info;
|
|
|
|
Info = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bounds-checking Set and Get for local arrays
|
|
|
|
void Set(int *locals, int arraynum, int arrayentry, int value)
|
|
|
|
{
|
|
|
|
if ((unsigned int)arraynum < Count &&
|
|
|
|
(unsigned int)arrayentry < Info[arraynum].Size)
|
|
|
|
{
|
|
|
|
locals[Info[arraynum].Offset + arrayentry] = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int Get(int *locals, int arraynum, int arrayentry)
|
|
|
|
{
|
|
|
|
if ((unsigned int)arraynum < Count &&
|
|
|
|
(unsigned int)arrayentry < Info[arraynum].Size)
|
|
|
|
{
|
|
|
|
return locals[Info[arraynum].Offset + arrayentry];
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// The in-memory version
|
|
|
|
struct ScriptPtr
|
|
|
|
{
|
2012-02-15 02:18:30 +00:00
|
|
|
int Number;
|
|
|
|
DWORD Address;
|
2006-02-24 04:48:15 +00:00
|
|
|
BYTE Type;
|
|
|
|
BYTE ArgCount;
|
|
|
|
WORD VarCount;
|
|
|
|
WORD Flags;
|
2014-07-27 03:58:47 +00:00
|
|
|
ACSLocalArrays LocalArrays;
|
2013-02-02 05:54:15 +00:00
|
|
|
|
|
|
|
ACSProfileInfo ProfileData;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// The present ZDoom version
|
|
|
|
struct ScriptPtr3
|
|
|
|
{
|
2012-02-15 02:18:30 +00:00
|
|
|
SWORD Number;
|
2006-02-24 04:48:15 +00:00
|
|
|
BYTE Type;
|
|
|
|
BYTE ArgCount;
|
|
|
|
DWORD Address;
|
|
|
|
};
|
|
|
|
|
|
|
|
// The intermediate ZDoom version
|
|
|
|
struct ScriptPtr1
|
|
|
|
{
|
2012-02-26 02:10:32 +00:00
|
|
|
SWORD Number;
|
2006-02-24 04:48:15 +00:00
|
|
|
WORD Type;
|
|
|
|
DWORD Address;
|
|
|
|
DWORD ArgCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
// The old Hexen version
|
|
|
|
struct ScriptPtr2
|
|
|
|
{
|
|
|
|
DWORD Number; // Type is Number / 1000
|
|
|
|
DWORD Address;
|
|
|
|
DWORD ArgCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ScriptFlagsPtr
|
|
|
|
{
|
|
|
|
WORD Number;
|
|
|
|
WORD Flags;
|
|
|
|
};
|
|
|
|
|
2014-07-27 03:58:47 +00:00
|
|
|
struct ScriptFunctionInFile
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
BYTE ArgCount;
|
|
|
|
BYTE LocalCount;
|
|
|
|
BYTE HasReturnValue;
|
|
|
|
BYTE ImportNum;
|
|
|
|
DWORD Address;
|
|
|
|
};
|
|
|
|
|
2014-07-27 03:58:47 +00:00
|
|
|
struct ScriptFunction
|
|
|
|
{
|
|
|
|
BYTE ArgCount;
|
|
|
|
BYTE HasReturnValue;
|
|
|
|
BYTE ImportNum;
|
|
|
|
int LocalCount;
|
|
|
|
DWORD Address;
|
|
|
|
ACSLocalArrays LocalArrays;
|
|
|
|
};
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Script types
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SCRIPT_Closed = 0,
|
|
|
|
SCRIPT_Open = 1,
|
|
|
|
SCRIPT_Respawn = 2,
|
|
|
|
SCRIPT_Death = 3,
|
|
|
|
SCRIPT_Enter = 4,
|
|
|
|
SCRIPT_Pickup = 5,
|
|
|
|
SCRIPT_BlueReturn = 6,
|
|
|
|
SCRIPT_RedReturn = 7,
|
|
|
|
SCRIPT_WhiteReturn = 8,
|
|
|
|
SCRIPT_Lightning = 12,
|
|
|
|
SCRIPT_Unloading = 13,
|
2008-02-13 02:29:49 +00:00
|
|
|
SCRIPT_Disconnect = 14,
|
|
|
|
SCRIPT_Return = 15,
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Script flags
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
SCRIPTF_Net = 0x0001 // Safe to "puke" in multiplayer
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ACSFormat { ACS_Old, ACS_Enhanced, ACS_LittleEnhanced, ACS_Unknown };
|
|
|
|
|
|
|
|
class FBehavior
|
|
|
|
{
|
|
|
|
public:
|
2006-06-14 15:56:56 +00:00
|
|
|
FBehavior (int lumpnum, FileReader * fr=NULL, int len=0);
|
2006-02-24 04:48:15 +00:00
|
|
|
~FBehavior ();
|
|
|
|
|
|
|
|
bool IsGood ();
|
|
|
|
BYTE *FindChunk (DWORD id) const;
|
|
|
|
BYTE *NextChunk (BYTE *chunk) const;
|
|
|
|
const ScriptPtr *FindScript (int number) const;
|
|
|
|
void StartTypedScripts (WORD type, AActor *activator, bool always, int arg1, bool runNow);
|
|
|
|
DWORD PC2Ofs (int *pc) const { return (DWORD)((BYTE *)pc - Data); }
|
|
|
|
int *Ofs2PC (DWORD ofs) const { return (int *)(Data + ofs); }
|
2012-12-20 04:17:18 +00:00
|
|
|
int *Jump2PC (DWORD jumpPoint) const { return Ofs2PC(JumpPoints[jumpPoint]); }
|
2006-02-24 04:48:15 +00:00
|
|
|
ACSFormat GetFormat() const { return Format; }
|
|
|
|
ScriptFunction *GetFunction (int funcnum, FBehavior *&module) const;
|
|
|
|
int GetArrayVal (int arraynum, int index) const;
|
|
|
|
void SetArrayVal (int arraynum, int index, int value);
|
2011-06-13 09:14:02 +00:00
|
|
|
inline bool CopyStringToArray(int arraynum, int index, int maxLength, const char * string);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
int FindFunctionName (const char *funcname) const;
|
|
|
|
int FindMapVarName (const char *varname) const;
|
|
|
|
int FindMapArray (const char *arrayname) const;
|
|
|
|
int GetLibraryID () const { return LibraryID; }
|
|
|
|
int *GetScriptAddress (const ScriptPtr *ptr) const { return (int *)(ptr->Address + Data); }
|
2013-02-02 05:54:15 +00:00
|
|
|
int GetScriptIndex (const ScriptPtr *ptr) const { ptrdiff_t index = ptr - Scripts; return index >= NumScripts ? -1 : (int)index; }
|
|
|
|
ScriptPtr *GetScriptPtr(int index) const { return index >= 0 && index < NumScripts ? &Scripts[index] : NULL; }
|
|
|
|
int GetLumpNum() const { return LumpNum; }
|
|
|
|
const char *GetModuleName() const { return ModuleName; }
|
|
|
|
ACSProfileInfo *GetFunctionProfileData(int index) { return index >= 0 && index < NumFunctions ? &FunctionProfileData[index] : NULL; }
|
|
|
|
ACSProfileInfo *GetFunctionProfileData(ScriptFunction *func) { return GetFunctionProfileData((int)(func - (ScriptFunction *)Functions)); }
|
2013-05-30 02:22:47 +00:00
|
|
|
const char *LookupString (DWORD index) const;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
SDWORD *MapVars[NUM_MAPVARS];
|
|
|
|
|
2006-06-14 15:56:56 +00:00
|
|
|
static FBehavior *StaticLoadModule (int lumpnum, FileReader * fr=NULL, int len=0);
|
2006-05-17 01:38:07 +00:00
|
|
|
static void StaticLoadDefaultModules ();
|
2006-02-24 04:48:15 +00:00
|
|
|
static void StaticUnloadModules ();
|
|
|
|
static bool StaticCheckAllGood ();
|
|
|
|
static FBehavior *StaticGetModule (int lib);
|
|
|
|
static void StaticSerializeModuleStates (FArchive &arc);
|
2013-05-30 02:22:47 +00:00
|
|
|
static void StaticMarkLevelVarStrings();
|
|
|
|
static void StaticLockLevelVarStrings();
|
|
|
|
static void StaticUnlockLevelVarStrings();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static const ScriptPtr *StaticFindScript (int script, FBehavior *&module);
|
|
|
|
static const char *StaticLookupString (DWORD index);
|
|
|
|
static void StaticStartTypedScripts (WORD type, AActor *activator, bool always, int arg1=0, bool runNow=false);
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
static void StaticStopMyScripts (AActor *actor);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
struct ArrayInfo;
|
|
|
|
|
|
|
|
ACSFormat Format;
|
|
|
|
|
|
|
|
int LumpNum;
|
|
|
|
BYTE *Data;
|
|
|
|
int DataSize;
|
|
|
|
BYTE *Chunks;
|
|
|
|
ScriptPtr *Scripts;
|
|
|
|
int NumScripts;
|
2014-07-27 03:58:47 +00:00
|
|
|
ScriptFunction *Functions;
|
2013-02-02 05:54:15 +00:00
|
|
|
ACSProfileInfo *FunctionProfileData;
|
2006-02-24 04:48:15 +00:00
|
|
|
int NumFunctions;
|
|
|
|
ArrayInfo *ArrayStore;
|
|
|
|
int NumArrays;
|
|
|
|
ArrayInfo **Arrays;
|
|
|
|
int NumTotalArrays;
|
|
|
|
DWORD StringTable;
|
|
|
|
SDWORD MapVarStore[NUM_MAPVARS];
|
|
|
|
TArray<FBehavior *> Imports;
|
|
|
|
DWORD LibraryID;
|
|
|
|
char ModuleName[9];
|
2012-12-20 04:17:18 +00:00
|
|
|
TArray<int> JumpPoints;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static TArray<FBehavior *> StaticModules;
|
|
|
|
|
|
|
|
void LoadScriptsDirectory ();
|
|
|
|
|
|
|
|
static int STACK_ARGS SortScripts (const void *a, const void *b);
|
|
|
|
void UnencryptStrings ();
|
2012-03-15 19:08:19 +00:00
|
|
|
void UnescapeStringTable(BYTE *chunkstart, BYTE *datastart, bool haspadding);
|
2006-02-24 04:48:15 +00:00
|
|
|
int FindStringInChunk (DWORD *chunk, const char *varname) const;
|
|
|
|
|
|
|
|
void SerializeVars (FArchive &arc);
|
|
|
|
void SerializeVarSet (FArchive &arc, SDWORD *vars, int max);
|
2013-02-02 05:54:15 +00:00
|
|
|
|
2013-05-30 02:22:47 +00:00
|
|
|
void MarkMapVarStrings() const;
|
|
|
|
void LockMapVarStrings() const;
|
|
|
|
void UnlockMapVarStrings() const;
|
|
|
|
|
2013-02-02 05:54:15 +00:00
|
|
|
friend void ArrangeScriptProfiles(TArray<ProfileCollector> &profiles);
|
|
|
|
friend void ArrangeFunctionProfiles(TArray<ProfileCollector> &profiles);
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLevelScript : public DObject
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (DLevelScript, DObject)
|
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
public:
|
|
|
|
|
|
|
|
// P-codes for ACS scripts
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* 0*/ PCD_NOP,
|
|
|
|
PCD_TERMINATE,
|
|
|
|
PCD_SUSPEND,
|
|
|
|
PCD_PUSHNUMBER,
|
|
|
|
PCD_LSPEC1,
|
|
|
|
PCD_LSPEC2,
|
|
|
|
PCD_LSPEC3,
|
|
|
|
PCD_LSPEC4,
|
|
|
|
PCD_LSPEC5,
|
|
|
|
PCD_LSPEC1DIRECT,
|
|
|
|
/* 10*/ PCD_LSPEC2DIRECT,
|
|
|
|
PCD_LSPEC3DIRECT,
|
|
|
|
PCD_LSPEC4DIRECT,
|
|
|
|
PCD_LSPEC5DIRECT,
|
|
|
|
PCD_ADD,
|
|
|
|
PCD_SUBTRACT,
|
|
|
|
PCD_MULTIPLY,
|
|
|
|
PCD_DIVIDE,
|
|
|
|
PCD_MODULUS,
|
|
|
|
PCD_EQ,
|
|
|
|
/* 20*/ PCD_NE,
|
|
|
|
PCD_LT,
|
|
|
|
PCD_GT,
|
|
|
|
PCD_LE,
|
|
|
|
PCD_GE,
|
|
|
|
PCD_ASSIGNSCRIPTVAR,
|
|
|
|
PCD_ASSIGNMAPVAR,
|
|
|
|
PCD_ASSIGNWORLDVAR,
|
|
|
|
PCD_PUSHSCRIPTVAR,
|
|
|
|
PCD_PUSHMAPVAR,
|
|
|
|
/* 30*/ PCD_PUSHWORLDVAR,
|
|
|
|
PCD_ADDSCRIPTVAR,
|
|
|
|
PCD_ADDMAPVAR,
|
|
|
|
PCD_ADDWORLDVAR,
|
|
|
|
PCD_SUBSCRIPTVAR,
|
|
|
|
PCD_SUBMAPVAR,
|
|
|
|
PCD_SUBWORLDVAR,
|
|
|
|
PCD_MULSCRIPTVAR,
|
|
|
|
PCD_MULMAPVAR,
|
|
|
|
PCD_MULWORLDVAR,
|
|
|
|
/* 40*/ PCD_DIVSCRIPTVAR,
|
|
|
|
PCD_DIVMAPVAR,
|
|
|
|
PCD_DIVWORLDVAR,
|
|
|
|
PCD_MODSCRIPTVAR,
|
|
|
|
PCD_MODMAPVAR,
|
|
|
|
PCD_MODWORLDVAR,
|
|
|
|
PCD_INCSCRIPTVAR,
|
|
|
|
PCD_INCMAPVAR,
|
|
|
|
PCD_INCWORLDVAR,
|
|
|
|
PCD_DECSCRIPTVAR,
|
|
|
|
/* 50*/ PCD_DECMAPVAR,
|
|
|
|
PCD_DECWORLDVAR,
|
|
|
|
PCD_GOTO,
|
|
|
|
PCD_IFGOTO,
|
|
|
|
PCD_DROP,
|
|
|
|
PCD_DELAY,
|
|
|
|
PCD_DELAYDIRECT,
|
|
|
|
PCD_RANDOM,
|
|
|
|
PCD_RANDOMDIRECT,
|
|
|
|
PCD_THINGCOUNT,
|
|
|
|
/* 60*/ PCD_THINGCOUNTDIRECT,
|
|
|
|
PCD_TAGWAIT,
|
|
|
|
PCD_TAGWAITDIRECT,
|
|
|
|
PCD_POLYWAIT,
|
|
|
|
PCD_POLYWAITDIRECT,
|
|
|
|
PCD_CHANGEFLOOR,
|
|
|
|
PCD_CHANGEFLOORDIRECT,
|
|
|
|
PCD_CHANGECEILING,
|
|
|
|
PCD_CHANGECEILINGDIRECT,
|
|
|
|
PCD_RESTART,
|
|
|
|
/* 70*/ PCD_ANDLOGICAL,
|
|
|
|
PCD_ORLOGICAL,
|
|
|
|
PCD_ANDBITWISE,
|
|
|
|
PCD_ORBITWISE,
|
|
|
|
PCD_EORBITWISE,
|
|
|
|
PCD_NEGATELOGICAL,
|
|
|
|
PCD_LSHIFT,
|
|
|
|
PCD_RSHIFT,
|
|
|
|
PCD_UNARYMINUS,
|
|
|
|
PCD_IFNOTGOTO,
|
|
|
|
/* 80*/ PCD_LINESIDE,
|
|
|
|
PCD_SCRIPTWAIT,
|
|
|
|
PCD_SCRIPTWAITDIRECT,
|
|
|
|
PCD_CLEARLINESPECIAL,
|
|
|
|
PCD_CASEGOTO,
|
|
|
|
PCD_BEGINPRINT,
|
|
|
|
PCD_ENDPRINT,
|
|
|
|
PCD_PRINTSTRING,
|
|
|
|
PCD_PRINTNUMBER,
|
|
|
|
PCD_PRINTCHARACTER,
|
|
|
|
/* 90*/ PCD_PLAYERCOUNT,
|
|
|
|
PCD_GAMETYPE,
|
|
|
|
PCD_GAMESKILL,
|
|
|
|
PCD_TIMER,
|
|
|
|
PCD_SECTORSOUND,
|
|
|
|
PCD_AMBIENTSOUND,
|
|
|
|
PCD_SOUNDSEQUENCE,
|
|
|
|
PCD_SETLINETEXTURE,
|
|
|
|
PCD_SETLINEBLOCKING,
|
|
|
|
PCD_SETLINESPECIAL,
|
|
|
|
/*100*/ PCD_THINGSOUND,
|
|
|
|
PCD_ENDPRINTBOLD, // [RH] End of Hexen p-codes
|
|
|
|
PCD_ACTIVATORSOUND,
|
|
|
|
PCD_LOCALAMBIENTSOUND,
|
|
|
|
PCD_SETLINEMONSTERBLOCKING,
|
|
|
|
PCD_PLAYERBLUESKULL, // [BC] Start of new [Skull Tag] pcodes
|
|
|
|
PCD_PLAYERREDSKULL,
|
|
|
|
PCD_PLAYERYELLOWSKULL,
|
|
|
|
PCD_PLAYERMASTERSKULL,
|
|
|
|
PCD_PLAYERBLUECARD,
|
|
|
|
/*110*/ PCD_PLAYERREDCARD,
|
|
|
|
PCD_PLAYERYELLOWCARD,
|
|
|
|
PCD_PLAYERMASTERCARD,
|
|
|
|
PCD_PLAYERBLACKSKULL,
|
|
|
|
PCD_PLAYERSILVERSKULL,
|
|
|
|
PCD_PLAYERGOLDSKULL,
|
|
|
|
PCD_PLAYERBLACKCARD,
|
|
|
|
PCD_PLAYERSILVERCARD,
|
|
|
|
PCD_PLAYERONTEAM,
|
|
|
|
PCD_PLAYERTEAM,
|
|
|
|
/*120*/ PCD_PLAYERHEALTH,
|
|
|
|
PCD_PLAYERARMORPOINTS,
|
|
|
|
PCD_PLAYERFRAGS,
|
|
|
|
PCD_PLAYEREXPERT,
|
|
|
|
PCD_BLUETEAMCOUNT,
|
|
|
|
PCD_REDTEAMCOUNT,
|
|
|
|
PCD_BLUETEAMSCORE,
|
|
|
|
PCD_REDTEAMSCORE,
|
|
|
|
PCD_ISONEFLAGCTF,
|
|
|
|
PCD_LSPEC6, // These are never used. They should probably
|
|
|
|
/*130*/ PCD_LSPEC6DIRECT, // be given names like PCD_DUMMY.
|
|
|
|
PCD_PRINTNAME,
|
|
|
|
PCD_MUSICCHANGE,
|
|
|
|
PCD_TEAM2FRAGPOINTS,
|
|
|
|
PCD_CONSOLECOMMAND,
|
|
|
|
PCD_SINGLEPLAYER, // [RH] End of Skull Tag p-codes
|
|
|
|
PCD_FIXEDMUL,
|
|
|
|
PCD_FIXEDDIV,
|
|
|
|
PCD_SETGRAVITY,
|
|
|
|
PCD_SETGRAVITYDIRECT,
|
|
|
|
/*140*/ PCD_SETAIRCONTROL,
|
|
|
|
PCD_SETAIRCONTROLDIRECT,
|
|
|
|
PCD_CLEARINVENTORY,
|
|
|
|
PCD_GIVEINVENTORY,
|
|
|
|
PCD_GIVEINVENTORYDIRECT,
|
|
|
|
PCD_TAKEINVENTORY,
|
|
|
|
PCD_TAKEINVENTORYDIRECT,
|
|
|
|
PCD_CHECKINVENTORY,
|
|
|
|
PCD_CHECKINVENTORYDIRECT,
|
|
|
|
PCD_SPAWN,
|
|
|
|
/*150*/ PCD_SPAWNDIRECT,
|
|
|
|
PCD_SPAWNSPOT,
|
|
|
|
PCD_SPAWNSPOTDIRECT,
|
|
|
|
PCD_SETMUSIC,
|
|
|
|
PCD_SETMUSICDIRECT,
|
|
|
|
PCD_LOCALSETMUSIC,
|
|
|
|
PCD_LOCALSETMUSICDIRECT,
|
|
|
|
PCD_PRINTFIXED,
|
|
|
|
PCD_PRINTLOCALIZED,
|
|
|
|
PCD_MOREHUDMESSAGE,
|
|
|
|
/*160*/ PCD_OPTHUDMESSAGE,
|
|
|
|
PCD_ENDHUDMESSAGE,
|
|
|
|
PCD_ENDHUDMESSAGEBOLD,
|
|
|
|
PCD_SETSTYLE,
|
|
|
|
PCD_SETSTYLEDIRECT,
|
|
|
|
PCD_SETFONT,
|
|
|
|
PCD_SETFONTDIRECT,
|
|
|
|
PCD_PUSHBYTE,
|
|
|
|
PCD_LSPEC1DIRECTB,
|
|
|
|
PCD_LSPEC2DIRECTB,
|
|
|
|
/*170*/ PCD_LSPEC3DIRECTB,
|
|
|
|
PCD_LSPEC4DIRECTB,
|
|
|
|
PCD_LSPEC5DIRECTB,
|
|
|
|
PCD_DELAYDIRECTB,
|
|
|
|
PCD_RANDOMDIRECTB,
|
|
|
|
PCD_PUSHBYTES,
|
|
|
|
PCD_PUSH2BYTES,
|
|
|
|
PCD_PUSH3BYTES,
|
|
|
|
PCD_PUSH4BYTES,
|
|
|
|
PCD_PUSH5BYTES,
|
|
|
|
/*180*/ PCD_SETTHINGSPECIAL,
|
|
|
|
PCD_ASSIGNGLOBALVAR,
|
|
|
|
PCD_PUSHGLOBALVAR,
|
|
|
|
PCD_ADDGLOBALVAR,
|
|
|
|
PCD_SUBGLOBALVAR,
|
|
|
|
PCD_MULGLOBALVAR,
|
|
|
|
PCD_DIVGLOBALVAR,
|
|
|
|
PCD_MODGLOBALVAR,
|
|
|
|
PCD_INCGLOBALVAR,
|
|
|
|
PCD_DECGLOBALVAR,
|
|
|
|
/*190*/ PCD_FADETO,
|
|
|
|
PCD_FADERANGE,
|
|
|
|
PCD_CANCELFADE,
|
|
|
|
PCD_PLAYMOVIE,
|
|
|
|
PCD_SETFLOORTRIGGER,
|
|
|
|
PCD_SETCEILINGTRIGGER,
|
|
|
|
PCD_GETACTORX,
|
|
|
|
PCD_GETACTORY,
|
|
|
|
PCD_GETACTORZ,
|
|
|
|
PCD_STARTTRANSLATION,
|
|
|
|
/*200*/ PCD_TRANSLATIONRANGE1,
|
|
|
|
PCD_TRANSLATIONRANGE2,
|
|
|
|
PCD_ENDTRANSLATION,
|
|
|
|
PCD_CALL,
|
|
|
|
PCD_CALLDISCARD,
|
|
|
|
PCD_RETURNVOID,
|
|
|
|
PCD_RETURNVAL,
|
|
|
|
PCD_PUSHMAPARRAY,
|
|
|
|
PCD_ASSIGNMAPARRAY,
|
|
|
|
PCD_ADDMAPARRAY,
|
|
|
|
/*210*/ PCD_SUBMAPARRAY,
|
|
|
|
PCD_MULMAPARRAY,
|
|
|
|
PCD_DIVMAPARRAY,
|
|
|
|
PCD_MODMAPARRAY,
|
|
|
|
PCD_INCMAPARRAY,
|
|
|
|
PCD_DECMAPARRAY,
|
|
|
|
PCD_DUP,
|
|
|
|
PCD_SWAP,
|
|
|
|
PCD_WRITETOINI,
|
|
|
|
PCD_GETFROMINI,
|
|
|
|
/*220*/ PCD_SIN,
|
|
|
|
PCD_COS,
|
|
|
|
PCD_VECTORANGLE,
|
|
|
|
PCD_CHECKWEAPON,
|
|
|
|
PCD_SETWEAPON,
|
|
|
|
PCD_TAGSTRING,
|
|
|
|
PCD_PUSHWORLDARRAY,
|
|
|
|
PCD_ASSIGNWORLDARRAY,
|
|
|
|
PCD_ADDWORLDARRAY,
|
|
|
|
PCD_SUBWORLDARRAY,
|
|
|
|
/*230*/ PCD_MULWORLDARRAY,
|
|
|
|
PCD_DIVWORLDARRAY,
|
|
|
|
PCD_MODWORLDARRAY,
|
|
|
|
PCD_INCWORLDARRAY,
|
|
|
|
PCD_DECWORLDARRAY,
|
|
|
|
PCD_PUSHGLOBALARRAY,
|
|
|
|
PCD_ASSIGNGLOBALARRAY,
|
|
|
|
PCD_ADDGLOBALARRAY,
|
|
|
|
PCD_SUBGLOBALARRAY,
|
|
|
|
PCD_MULGLOBALARRAY,
|
|
|
|
/*240*/ PCD_DIVGLOBALARRAY,
|
|
|
|
PCD_MODGLOBALARRAY,
|
|
|
|
PCD_INCGLOBALARRAY,
|
|
|
|
PCD_DECGLOBALARRAY,
|
|
|
|
PCD_SETMARINEWEAPON,
|
|
|
|
PCD_SETACTORPROPERTY,
|
|
|
|
PCD_GETACTORPROPERTY,
|
|
|
|
PCD_PLAYERNUMBER,
|
|
|
|
PCD_ACTIVATORTID,
|
|
|
|
PCD_SETMARINESPRITE,
|
|
|
|
/*250*/ PCD_GETSCREENWIDTH,
|
|
|
|
PCD_GETSCREENHEIGHT,
|
|
|
|
PCD_THING_PROJECTILE2,
|
|
|
|
PCD_STRLEN,
|
|
|
|
PCD_SETHUDSIZE,
|
|
|
|
PCD_GETCVAR,
|
|
|
|
PCD_CASEGOTOSORTED,
|
|
|
|
PCD_SETRESULTVALUE,
|
|
|
|
PCD_GETLINEROWOFFSET,
|
|
|
|
PCD_GETACTORFLOORZ,
|
|
|
|
/*260*/ PCD_GETACTORANGLE,
|
|
|
|
PCD_GETSECTORFLOORZ,
|
|
|
|
PCD_GETSECTORCEILINGZ,
|
|
|
|
PCD_LSPEC5RESULT,
|
|
|
|
PCD_GETSIGILPIECES,
|
|
|
|
PCD_GETLEVELINFO,
|
|
|
|
PCD_CHANGESKY,
|
|
|
|
PCD_PLAYERINGAME,
|
|
|
|
PCD_PLAYERISBOT,
|
|
|
|
PCD_SETCAMERATOTEXTURE,
|
|
|
|
/*270*/ PCD_ENDLOG,
|
|
|
|
PCD_GETAMMOCAPACITY,
|
|
|
|
PCD_SETAMMOCAPACITY,
|
|
|
|
PCD_PRINTMAPCHARARRAY, // [JB] start of new p-codes
|
|
|
|
PCD_PRINTWORLDCHARARRAY,
|
|
|
|
PCD_PRINTGLOBALCHARARRAY, // [JB] end of new p-codes
|
|
|
|
PCD_SETACTORANGLE, // [GRB]
|
2006-06-03 12:30:11 +00:00
|
|
|
PCD_GRABINPUT, // Unused but acc defines them
|
|
|
|
PCD_SETMOUSEPOINTER, // "
|
|
|
|
PCD_MOVEMOUSEPOINTER, // "
|
2006-07-16 20:13:24 +00:00
|
|
|
/*280*/ PCD_SPAWNPROJECTILE,
|
2006-06-18 15:49:00 +00:00
|
|
|
PCD_GETSECTORLIGHTLEVEL,
|
|
|
|
PCD_GETACTORCEILINGZ,
|
|
|
|
PCD_SETACTORPOSITION,
|
|
|
|
PCD_CLEARACTORINVENTORY,
|
|
|
|
PCD_GIVEACTORINVENTORY,
|
|
|
|
PCD_TAKEACTORINVENTORY,
|
|
|
|
PCD_CHECKACTORINVENTORY,
|
2006-07-09 20:15:38 +00:00
|
|
|
PCD_THINGCOUNTNAME,
|
|
|
|
PCD_SPAWNSPOTFACING,
|
2006-07-16 20:13:24 +00:00
|
|
|
/*290*/ PCD_PLAYERCLASS, // [GRB]
|
|
|
|
//[MW] start my p-codes
|
|
|
|
PCD_ANDSCRIPTVAR,
|
|
|
|
PCD_ANDMAPVAR,
|
|
|
|
PCD_ANDWORLDVAR,
|
|
|
|
PCD_ANDGLOBALVAR,
|
|
|
|
PCD_ANDMAPARRAY,
|
|
|
|
PCD_ANDWORLDARRAY,
|
|
|
|
PCD_ANDGLOBALARRAY,
|
|
|
|
PCD_EORSCRIPTVAR,
|
|
|
|
PCD_EORMAPVAR,
|
|
|
|
/*300*/ PCD_EORWORLDVAR,
|
|
|
|
PCD_EORGLOBALVAR,
|
|
|
|
PCD_EORMAPARRAY,
|
|
|
|
PCD_EORWORLDARRAY,
|
|
|
|
PCD_EORGLOBALARRAY,
|
|
|
|
PCD_ORSCRIPTVAR,
|
|
|
|
PCD_ORMAPVAR,
|
|
|
|
PCD_ORWORLDVAR,
|
|
|
|
PCD_ORGLOBALVAR,
|
|
|
|
PCD_ORMAPARRAY,
|
|
|
|
/*310*/ PCD_ORWORLDARRAY,
|
|
|
|
PCD_ORGLOBALARRAY,
|
|
|
|
PCD_LSSCRIPTVAR,
|
|
|
|
PCD_LSMAPVAR,
|
|
|
|
PCD_LSWORLDVAR,
|
|
|
|
PCD_LSGLOBALVAR,
|
|
|
|
PCD_LSMAPARRAY,
|
|
|
|
PCD_LSWORLDARRAY,
|
|
|
|
PCD_LSGLOBALARRAY,
|
|
|
|
PCD_RSSCRIPTVAR,
|
|
|
|
/*320*/ PCD_RSMAPVAR,
|
|
|
|
PCD_RSWORLDVAR,
|
|
|
|
PCD_RSGLOBALVAR,
|
|
|
|
PCD_RSMAPARRAY,
|
|
|
|
PCD_RSWORLDARRAY,
|
|
|
|
PCD_RSGLOBALARRAY,
|
|
|
|
//[MW] end my p-codes
|
2006-07-30 22:56:20 +00:00
|
|
|
PCD_GETPLAYERINFO, // [GRB]
|
2006-08-10 15:28:12 +00:00
|
|
|
PCD_CHANGELEVEL,
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
PCD_SECTORDAMAGE,
|
|
|
|
PCD_REPLACETEXTURES,
|
2006-10-09 15:55:47 +00:00
|
|
|
/*330*/ PCD_NEGATEBINARY,
|
2006-10-22 10:32:41 +00:00
|
|
|
PCD_GETACTORPITCH,
|
|
|
|
PCD_SETACTORPITCH,
|
2007-02-24 12:09:36 +00:00
|
|
|
PCD_PRINTBIND,
|
- Moved the implementation for the Thing_Damage special into another function
so that I can create the ACS function Thing_Damage2. It's exactly the same as
Thing_Damage, except the damage type is specified by name. When I did this,
I noticed that it didn't do anything useful for a TID of 0, so I made it
affect the activator in that case.
- Added a new SetActorState ACS function:
int SetActorState (int tid, str statename, optional bool exact);
If tid is 0, it affects the script activator, otherwise it affects all the
matching actors. Statename is the name of the state you want to put the
actor in. The final parameter, exact, specifies whether or not partial
state name matches are accepted. If you don't specify it or set it to
false, if you try to do something like:
SetActorState (0, "Foo.Bar");
And the actor has a Foo state but no Foo.Bar state, it will enter the Foo
state. If you set exact to true:
SetActorState (0, "Foo.Bar", true);
Then the actor must have a Foo.Bar state, or it will not change state at
all, even if it has a Foo state.
The return value for this function is the number of actors that successfully
changed state. Note that you should refrain from using this function to
enter special states such as Death, or unpredictable results could occur.
SVN r505 (trunk)
2007-03-23 22:26:14 +00:00
|
|
|
PCD_SETACTORSTATE,
|
|
|
|
PCD_THINGDAMAGE2,
|
2007-12-25 08:44:13 +00:00
|
|
|
PCD_USEINVENTORY,
|
|
|
|
PCD_USEACTORINVENTORY,
|
2008-03-01 16:59:17 +00:00
|
|
|
PCD_CHECKACTORCEILINGTEXTURE,
|
|
|
|
PCD_CHECKACTORFLOORTEXTURE,
|
|
|
|
/*340*/ PCD_GETACTORLIGHTLEVEL,
|
2008-03-19 09:53:23 +00:00
|
|
|
PCD_SETMUGSHOTSTATE,
|
2008-03-21 12:25:45 +00:00
|
|
|
PCD_THINGCOUNTSECTOR,
|
|
|
|
PCD_THINGCOUNTNAMESECTOR,
|
2008-04-15 10:04:41 +00:00
|
|
|
PCD_CHECKPLAYERCAMERA, // [TN]
|
2008-05-22 19:35:38 +00:00
|
|
|
PCD_MORPHACTOR, // [MH]
|
|
|
|
PCD_UNMORPHACTOR, // [MH]
|
2008-09-13 02:55:45 +00:00
|
|
|
PCD_GETPLAYERINPUT,
|
2008-12-07 03:55:49 +00:00
|
|
|
PCD_CLASSIFYACTOR,
|
|
|
|
PCD_PRINTBINARY,
|
|
|
|
/*350*/ PCD_PRINTHEX,
|
2009-05-11 21:05:40 +00:00
|
|
|
PCD_CALLFUNC,
|
2011-06-13 09:14:02 +00:00
|
|
|
PCD_SAVESTRING, // [FDARI] create string (temporary)
|
|
|
|
PCD_PRINTMAPCHRANGE, // [FDARI] output range (print part of array)
|
|
|
|
PCD_PRINTWORLDCHRANGE,
|
|
|
|
PCD_PRINTGLOBALCHRANGE,
|
|
|
|
PCD_STRCPYTOMAPCHRANGE, // [FDARI] input range (copy string to all/part of array)
|
|
|
|
PCD_STRCPYTOWORLDCHRANGE,
|
|
|
|
PCD_STRCPYTOGLOBALCHRANGE,
|
2012-07-11 04:00:04 +00:00
|
|
|
PCD_PUSHFUNCTION, // from Eternity
|
|
|
|
/*360*/ PCD_CALLSTACK, // from Eternity
|
|
|
|
PCD_SCRIPTWAITNAMED,
|
2012-09-20 02:14:43 +00:00
|
|
|
PCD_TRANSLATIONRANGE3,
|
2012-12-20 04:17:18 +00:00
|
|
|
PCD_GOTOSTACK,
|
2014-07-27 03:58:47 +00:00
|
|
|
PCD_ASSIGNSCRIPTARRAY,
|
|
|
|
PCD_PUSHSCRIPTARRAY,
|
|
|
|
PCD_ADDSCRIPTARRAY,
|
|
|
|
PCD_SUBSCRIPTARRAY,
|
|
|
|
PCD_MULSCRIPTARRAY,
|
|
|
|
PCD_DIVSCRIPTARRAY,
|
|
|
|
/*370*/ PCD_MODSCRIPTARRAY,
|
|
|
|
PCD_INCSCRIPTARRAY,
|
|
|
|
PCD_DECSCRIPTARRAY,
|
|
|
|
PCD_ANDSCRIPTARRAY,
|
|
|
|
PCD_EORSCRIPTARRAY,
|
|
|
|
PCD_ORSCRIPTARRAY,
|
|
|
|
PCD_LSSCRIPTARRAY,
|
|
|
|
PCD_RSSCRIPTARRAY,
|
|
|
|
PCD_PRINTSCRIPTCHARARRAY,
|
|
|
|
PCD_PRINTSCRIPTCHRANGE,
|
|
|
|
/*380*/ PCD_STRCPYTOSCRIPTCHRANGE,
|
|
|
|
|
|
|
|
/*381*/ PCODE_COMMAND_COUNT
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Some constants used by ACS scripts
|
|
|
|
enum {
|
|
|
|
LINE_FRONT = 0,
|
|
|
|
LINE_BACK = 1
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
SIDE_FRONT = 0,
|
|
|
|
SIDE_BACK = 1
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
TEXTURE_TOP = 0,
|
|
|
|
TEXTURE_MIDDLE = 1,
|
|
|
|
TEXTURE_BOTTOM = 2
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
GAME_SINGLE_PLAYER = 0,
|
|
|
|
GAME_NET_COOPERATIVE = 1,
|
|
|
|
GAME_NET_DEATHMATCH = 2,
|
|
|
|
GAME_TITLE_MAP = 3
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
CLASS_FIGHTER = 0,
|
|
|
|
CLASS_CLERIC = 1,
|
|
|
|
CLASS_MAGE = 2
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
SKILL_VERY_EASY = 0,
|
|
|
|
SKILL_EASY = 1,
|
|
|
|
SKILL_NORMAL = 2,
|
|
|
|
SKILL_HARD = 3,
|
|
|
|
SKILL_VERY_HARD = 4
|
|
|
|
};
|
|
|
|
enum {
|
|
|
|
BLOCK_NOTHING = 0,
|
|
|
|
BLOCK_CREATURES = 1,
|
|
|
|
BLOCK_EVERYTHING = 2,
|
2006-11-10 12:13:37 +00:00
|
|
|
BLOCK_RAILING = 3,
|
|
|
|
BLOCK_PLAYERS = 4
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
enum {
|
|
|
|
LEVELINFO_PAR_TIME,
|
|
|
|
LEVELINFO_CLUSTERNUM,
|
|
|
|
LEVELINFO_LEVELNUM,
|
|
|
|
LEVELINFO_TOTAL_SECRETS,
|
|
|
|
LEVELINFO_FOUND_SECRETS,
|
|
|
|
LEVELINFO_TOTAL_ITEMS,
|
|
|
|
LEVELINFO_FOUND_ITEMS,
|
|
|
|
LEVELINFO_TOTAL_MONSTERS,
|
|
|
|
LEVELINFO_KILLED_MONSTERS,
|
|
|
|
LEVELINFO_SUCK_TIME
|
|
|
|
};
|
2006-07-30 22:56:20 +00:00
|
|
|
enum {
|
|
|
|
PLAYERINFO_TEAM,
|
|
|
|
PLAYERINFO_AIMDIST,
|
|
|
|
PLAYERINFO_COLOR,
|
|
|
|
PLAYERINFO_GENDER,
|
|
|
|
PLAYERINFO_NEVERSWITCH,
|
|
|
|
PLAYERINFO_MOVEBOB,
|
|
|
|
PLAYERINFO_STILLBOB,
|
2012-08-22 22:09:17 +00:00
|
|
|
PLAYERINFO_PLAYERCLASS,
|
|
|
|
PLAYERINFO_FOV,
|
|
|
|
PLAYERINFO_DESIREDFOV,
|
2006-07-30 22:56:20 +00:00
|
|
|
};
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
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,
|
2012-02-26 03:36:05 +00:00
|
|
|
const int *args, int argcount, int flags);
|
2006-02-24 04:48:15 +00:00
|
|
|
~DLevelScript ();
|
|
|
|
|
|
|
|
void Serialize (FArchive &arc);
|
|
|
|
int RunScript ();
|
|
|
|
|
|
|
|
inline void SetState (EScriptState newstate) { state = newstate; }
|
|
|
|
inline EScriptState GetState () { return state; }
|
|
|
|
|
2013-05-30 02:22:47 +00:00
|
|
|
DLevelScript *GetNext() const { return next; }
|
|
|
|
|
|
|
|
void MarkLocalVarStrings() const
|
|
|
|
{
|
|
|
|
GlobalACSStrings.MarkStringArray(localvars, numlocalvars);
|
|
|
|
}
|
|
|
|
void LockLocalVarStrings() const
|
|
|
|
{
|
|
|
|
GlobalACSStrings.LockStringArray(localvars, numlocalvars);
|
|
|
|
}
|
|
|
|
void UnlockLocalVarStrings() const
|
|
|
|
{
|
|
|
|
GlobalACSStrings.UnlockStringArray(localvars, numlocalvars);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
protected:
|
|
|
|
DLevelScript *next, *prev;
|
|
|
|
int script;
|
|
|
|
SDWORD *localvars;
|
|
|
|
int numlocalvars;
|
|
|
|
int *pc;
|
|
|
|
EScriptState state;
|
|
|
|
int statedata;
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<AActor> activator;
|
2006-02-24 04:48:15 +00:00
|
|
|
line_t *activationline;
|
|
|
|
bool backSide;
|
|
|
|
FFont *activefont;
|
|
|
|
int hudwidth, hudheight;
|
- Added cybermind's HUD message clipping patch, with numerous changes. There is a new flag
and two new functions, both of which are intended for use in conjunction with SetHUDSize:
* SetHUDClipRect(x, y, width, height[, wrapwidth]) - Set the clipping rectangle for future
HUD messages. If you do not specify <wrapwidth>, the HUD message will be layed out as
normal, but pixels outside the rectangle will not be drawn. If you specify <wrapwidth>,
then the message will be wrapped to that width. Use SetHUDClipRect(0, 0, 0, 0[, 0]) to
reset everything
back to normal.
* SetHUDWrapWidth(wrapwidth) - Sets the wrapping width for future HUD messages without
altering the clipping rectangle. If you set the wrapping width to 0, messages will wrap
to the full width of the HUD, as normal.
* HUDMSG_NOWRAP - A HUDMessage() flag that disables wrapping for one message. It is
functionally equivalent to SetHUDWrapWidth(0x7FFFFFFF), except that it only affects the
message it's attached to.
SVN r3960 (trunk)
2012-11-10 03:18:52 +00:00
|
|
|
int ClipRectLeft, ClipRectTop, ClipRectWidth, ClipRectHeight;
|
|
|
|
int WrapWidth;
|
2006-02-24 04:48:15 +00:00
|
|
|
FBehavior *activeBehavior;
|
2013-02-02 05:54:15 +00:00
|
|
|
int InModuleScriptNumber;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void Link ();
|
|
|
|
void Unlink ();
|
|
|
|
void PutLast ();
|
|
|
|
void PutFirst ();
|
|
|
|
static int Random (int min, int max);
|
2008-03-21 12:25:45 +00:00
|
|
|
static int ThingCount (int type, int stringid, int tid, int tag);
|
2006-02-24 04:48:15 +00:00
|
|
|
static void ChangeFlat (int tag, int name, bool floorOrCeiling);
|
|
|
|
static int CountPlayers ();
|
|
|
|
static void SetLineTexture (int lineid, int side, int position, int name);
|
2006-09-01 01:08:27 +00:00
|
|
|
static void ReplaceTextures (int fromname, int toname, int flags);
|
2009-06-05 21:44:34 +00:00
|
|
|
static int DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, int angle, bool force);
|
2012-03-18 02:44:46 +00:00
|
|
|
static bool DoCheckActorTexture(int tid, AActor *activator, int string, bool floor);
|
2009-08-12 18:57:31 +00:00
|
|
|
int DoSpawnSpot (int type, int spot, int tid, int angle, bool forced);
|
|
|
|
int DoSpawnSpotFacing (int type, int spot, int tid, bool forced);
|
2008-12-07 03:55:49 +00:00
|
|
|
int DoClassifyActor (int tid);
|
2013-06-02 23:58:29 +00:00
|
|
|
int CallFunction(int argCount, int funcIndex, SDWORD *args, const SDWORD *stack, int stackdepth);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void DoFadeTo (int r, int g, int b, int a, fixed_t time);
|
|
|
|
void DoFadeRange (int r1, int g1, int b1, int a1,
|
|
|
|
int r2, int g2, int b2, int a2, fixed_t time);
|
|
|
|
void DoSetFont (int fontnum);
|
|
|
|
void SetActorProperty (int tid, int property, int value);
|
|
|
|
void DoSetActorProperty (AActor *actor, int property, int value);
|
2013-06-02 23:58:29 +00:00
|
|
|
int GetActorProperty (int tid, int property, const SDWORD *stack, int stackdepth);
|
2009-07-05 05:56:20 +00:00
|
|
|
int CheckActorProperty (int tid, int property, int value);
|
2008-09-13 02:55:45 +00:00
|
|
|
int GetPlayerInput (int playernum, int inputnum);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-05-11 21:05:40 +00:00
|
|
|
int LineFromID(int id);
|
|
|
|
int SideFromID(int id, int side);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
private:
|
|
|
|
DLevelScript ();
|
|
|
|
|
|
|
|
friend class DACSThinker;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DACSThinker : public DThinker
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (DACSThinker, DThinker)
|
2008-03-12 02:56:11 +00:00
|
|
|
HAS_OBJECT_POINTERS
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
DACSThinker ();
|
|
|
|
~DACSThinker ();
|
|
|
|
|
|
|
|
void Serialize (FArchive &arc);
|
|
|
|
void Tick ();
|
|
|
|
|
2012-02-15 02:18:30 +00:00
|
|
|
typedef TMap<int, DLevelScript *> ScriptMap;
|
|
|
|
ScriptMap RunningScripts; // Array of all synchronous scripts
|
2008-03-13 03:14:33 +00:00
|
|
|
static TObjPtr<DACSThinker> ActiveThinker;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void DumpScriptStatus();
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
void StopScriptsFor (AActor *actor);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DLevelScript *LastScript;
|
|
|
|
DLevelScript *Scripts; // List of all running scripts
|
|
|
|
|
|
|
|
friend class DLevelScript;
|
2013-05-30 02:22:47 +00:00
|
|
|
friend class FBehavior;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// The structure used to control scripts between maps
|
2008-09-15 14:11:05 +00:00
|
|
|
struct acsdefered_t
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-09-15 14:11:05 +00:00
|
|
|
struct acsdefered_t *next;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
enum EType
|
|
|
|
{
|
|
|
|
defexecute,
|
|
|
|
defexealways,
|
|
|
|
defsuspend,
|
|
|
|
defterminate
|
|
|
|
} type;
|
|
|
|
int script;
|
2012-02-26 03:36:05 +00:00
|
|
|
int args[3];
|
2006-02-24 04:48:15 +00:00
|
|
|
int playernum;
|
|
|
|
};
|
|
|
|
|
2008-09-15 14:11:05 +00:00
|
|
|
FArchive &operator<< (FArchive &arc, acsdefered_t *&defer);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#endif //__P_ACS_H__
|