2006-04-15 15:00:29 +00:00
|
|
|
#ifndef __THINGDEF_H
|
|
|
|
#define __THINGDEF_H
|
|
|
|
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "doomtype.h"
|
2008-10-19 21:43:36 +00:00
|
|
|
#include "info.h"
|
2008-10-25 17:38:00 +00:00
|
|
|
#include "s_sound.h"
|
|
|
|
#include "sc_man.h"
|
2008-10-19 21:43:36 +00:00
|
|
|
|
2008-09-15 14:11:05 +00:00
|
|
|
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
class FScanner;
|
|
|
|
|
2008-09-21 18:02:38 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A flag descriptor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
struct FFlagDef
|
|
|
|
{
|
|
|
|
int flagbit;
|
|
|
|
const char *name;
|
|
|
|
int structoffset;
|
|
|
|
};
|
|
|
|
|
|
|
|
FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2);
|
|
|
|
void HandleDeprecatedFlags(AActor *defaults, FActorInfo *info, bool set, int index);
|
|
|
|
|
|
|
|
|
2008-09-22 18:55:29 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// State parser
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-10-25 17:38:00 +00:00
|
|
|
class FxExpression;
|
2008-09-22 18:55:29 +00:00
|
|
|
|
|
|
|
struct FStateLabels;
|
|
|
|
|
|
|
|
enum EStateDefineFlags
|
|
|
|
{
|
|
|
|
SDF_NEXT = 0,
|
|
|
|
SDF_STATE = 1,
|
|
|
|
SDF_STOP = 2,
|
|
|
|
SDF_WAIT = 3,
|
|
|
|
SDF_LABEL = 4,
|
|
|
|
SDF_INDEX = 5,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FStateDefine
|
|
|
|
{
|
|
|
|
FName Label;
|
|
|
|
TArray<FStateDefine> Children;
|
|
|
|
FState *State;
|
|
|
|
BYTE DefineFlags;
|
|
|
|
};
|
|
|
|
|
|
|
|
class FStateDefinitions
|
|
|
|
{
|
|
|
|
TArray<FStateDefine> StateLabels;
|
2008-12-07 12:11:59 +00:00
|
|
|
FState *laststate;
|
|
|
|
intptr_t lastlabel;
|
|
|
|
TArray<FState> StateArray;
|
2008-09-22 18:55:29 +00:00
|
|
|
|
|
|
|
static FStateDefine *FindStateLabelInList(TArray<FStateDefine> &list, FName name, bool create);
|
|
|
|
static FStateLabels *CreateStateLabelList(TArray<FStateDefine> &statelist);
|
|
|
|
static void MakeStateList(const FStateLabels *list, TArray<FStateDefine> &dest);
|
|
|
|
static void RetargetStatePointers (intptr_t count, const char *target, TArray<FStateDefine> & statelist);
|
|
|
|
FStateDefine *FindStateAddress(const char *name);
|
|
|
|
FState *FindState(const char *name);
|
|
|
|
|
|
|
|
FState *ResolveGotoLabel (AActor *actor, const PClass *mytype, char *name);
|
|
|
|
static void FixStatePointers (FActorInfo *actor, TArray<FStateDefine> & list);
|
|
|
|
void ResolveGotoLabels (FActorInfo *actor, AActor *defaults, TArray<FStateDefine> & list);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-12-07 12:11:59 +00:00
|
|
|
FStateDefinitions()
|
2008-09-22 18:55:29 +00:00
|
|
|
{
|
2008-12-07 12:11:59 +00:00
|
|
|
laststate = NULL;
|
|
|
|
lastlabel = -1;
|
2008-09-22 18:55:29 +00:00
|
|
|
}
|
|
|
|
|
2008-12-07 12:11:59 +00:00
|
|
|
void SetStateLabel (const char * statename, FState * state, BYTE defflags = SDF_STATE);
|
|
|
|
void AddStateLabel (const char * statename);
|
2008-09-22 18:55:29 +00:00
|
|
|
void InstallStates(FActorInfo *info, AActor *defaults);
|
2008-12-07 12:11:59 +00:00
|
|
|
int FinishStates (FActorInfo *actor, AActor *defaults);
|
2008-09-22 18:55:29 +00:00
|
|
|
|
|
|
|
void MakeStateDefines(const PClass *cls);
|
|
|
|
void AddStateDefines(const FStateLabels *list);
|
|
|
|
void RetargetStates (intptr_t count, const char *target);
|
|
|
|
|
2008-12-07 12:11:59 +00:00
|
|
|
bool SetGotoLabel(const char *string);
|
|
|
|
bool SetStop();
|
|
|
|
bool SetWait();
|
|
|
|
bool SetLoop();
|
|
|
|
bool AddStates(FState *state, const char *framechars);
|
|
|
|
int GetStateCount() const { return StateArray.Size(); }
|
|
|
|
|
2008-09-22 18:55:29 +00:00
|
|
|
};
|
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
struct FStateExpression
|
|
|
|
{
|
|
|
|
FxExpression *expr;
|
|
|
|
const PClass *owner;
|
|
|
|
bool constant;
|
|
|
|
bool cloned;
|
|
|
|
};
|
|
|
|
|
|
|
|
class FStateExpressions
|
|
|
|
{
|
|
|
|
TArray<FStateExpression> expressions;
|
|
|
|
|
|
|
|
public:
|
|
|
|
~FStateExpressions();
|
|
|
|
int Add(FxExpression *x, const PClass *o, bool c);
|
|
|
|
int Reserve(int num, const PClass *cls);
|
|
|
|
void Set(int num, FxExpression *x);
|
|
|
|
void Copy(int dest, int src, int cnt);
|
|
|
|
int ResolveAll();
|
|
|
|
FxExpression *Get(int no);
|
|
|
|
int Size() { return expressions.Size(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
extern FStateExpressions StateParams;
|
|
|
|
|
|
|
|
|
2007-05-28 22:18:51 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Extra info maintained while defining an actor.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2008-09-21 18:02:38 +00:00
|
|
|
struct FDropItem;
|
2007-05-28 22:18:51 +00:00
|
|
|
|
|
|
|
struct Baggage
|
|
|
|
{
|
2008-10-05 08:50:47 +00:00
|
|
|
#ifdef _DEBUG
|
|
|
|
FString ClassName; // This is here so that during debugging the class name can be seen
|
|
|
|
#endif
|
2007-05-28 22:18:51 +00:00
|
|
|
FActorInfo *Info;
|
|
|
|
bool DropItemSet;
|
|
|
|
bool StateSet;
|
|
|
|
int CurrentState;
|
2008-09-21 18:02:38 +00:00
|
|
|
int Lumpnum;
|
2008-09-22 18:55:29 +00:00
|
|
|
FStateDefinitions statedef;
|
2007-05-28 22:18:51 +00:00
|
|
|
|
|
|
|
FDropItem *DropItemList;
|
2008-12-07 12:11:59 +00:00
|
|
|
|
|
|
|
FScriptPosition ScriptPosition;
|
2007-05-28 22:18:51 +00:00
|
|
|
};
|
|
|
|
|
2008-09-22 18:55:29 +00:00
|
|
|
inline void ResetBaggage (Baggage *bag, const PClass *stateclass)
|
2007-05-28 22:18:51 +00:00
|
|
|
{
|
|
|
|
bag->DropItemList = NULL;
|
|
|
|
bag->DropItemSet = false;
|
|
|
|
bag->CurrentState = 0;
|
|
|
|
bag->StateSet = false;
|
2008-09-22 18:55:29 +00:00
|
|
|
bag->statedef.MakeStateDefines(stateclass);
|
2007-05-28 22:18:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Action function lookup
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
struct AFuncDesc
|
|
|
|
{
|
|
|
|
const char *Name;
|
|
|
|
actionf_p Function;
|
|
|
|
};
|
|
|
|
|
|
|
|
AFuncDesc * FindFunction(const char * string);
|
|
|
|
|
|
|
|
|
2008-08-12 14:30:07 +00:00
|
|
|
|
2008-12-07 12:11:59 +00:00
|
|
|
void ParseStates(FScanner &sc, FActorInfo *actor, AActor *defaults, Baggage &bag);
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2008-10-19 21:43:36 +00:00
|
|
|
PSymbolActionFunction *FindGlobalActionFunction(const char *name);
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2007-05-28 22:18:51 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Property parser
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-12-07 12:11:59 +00:00
|
|
|
FActorInfo *CreateNewActor(FName typeName, FName parentName, bool native);
|
|
|
|
void SetReplacement(FActorInfo *info, FName replaceName);
|
2007-05-28 22:18:51 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
void HandleActorFlag(FScanner &sc, Baggage &bag, const char *part1, const char *part2, int mod);
|
|
|
|
void FinishActor(const FScriptPosition &sc, FActorInfo *info, Baggage &bag);
|
|
|
|
FxExpression *ParseParameter(FScanner &sc, PClass *cls, char type, bool constant);
|
2007-05-28 22:18:51 +00:00
|
|
|
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2008-10-19 21:43:36 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
DEPF_UNUSED,
|
|
|
|
DEPF_FIREDAMAGE,
|
|
|
|
DEPF_ICEDAMAGE,
|
|
|
|
DEPF_LOWGRAVITY,
|
|
|
|
DEPF_LONGMELEERANGE,
|
|
|
|
DEPF_SHORTMISSILERANGE,
|
|
|
|
DEPF_PICKUPFLASH,
|
|
|
|
DEPF_QUARTERGRAVITY,
|
|
|
|
DEPF_FIRERESIST,
|
|
|
|
};
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2006-07-29 10:47:14 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ACMETA_BASE = 0x83000,
|
|
|
|
ACMETA_DropItems, // Int (index into DropItemList)
|
|
|
|
ACMETA_ExplosionDamage,
|
|
|
|
ACMETA_ExplosionRadius,
|
|
|
|
ACMETA_DontHurtShooter,
|
2007-05-28 22:18:51 +00:00
|
|
|
ACMETA_MeleeSound,
|
|
|
|
ACMETA_MeleeDamage,
|
|
|
|
ACMETA_MissileName,
|
|
|
|
ACMETA_MissileHeight,
|
2006-07-29 10:47:14 +00:00
|
|
|
};
|
|
|
|
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2007-05-28 14:46:49 +00:00
|
|
|
// Types of old style decorations
|
|
|
|
enum EDefinitionType
|
|
|
|
{
|
|
|
|
DEF_Decoration,
|
|
|
|
DEF_BreakableDecoration,
|
|
|
|
DEF_Pickup,
|
|
|
|
DEF_Projectile,
|
|
|
|
};
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#pragma data_seg(".areg$u")
|
2008-09-21 18:02:38 +00:00
|
|
|
#pragma data_seg(".greg$u")
|
2008-10-19 21:43:36 +00:00
|
|
|
#pragma data_seg(".mreg$u")
|
2008-08-10 20:48:55 +00:00
|
|
|
#pragma data_seg()
|
|
|
|
|
|
|
|
#define MSVC_ASEG __declspec(allocate(".areg$u"))
|
|
|
|
#define GCC_ASEG
|
2008-09-21 18:02:38 +00:00
|
|
|
#define MSVC_PSEG __declspec(allocate(".greg$u"))
|
|
|
|
#define GCC_PSEG
|
2008-10-19 21:43:36 +00:00
|
|
|
#define MSVC_MSEG __declspec(allocate(".mreg$u"))
|
|
|
|
#define GCC_MSEG
|
2008-08-10 20:48:55 +00:00
|
|
|
#else
|
|
|
|
#define MSVC_ASEG
|
|
|
|
#define GCC_ASEG __attribute__((section(AREG_SECTION)))
|
2008-09-21 18:02:38 +00:00
|
|
|
#define MSVC_PSEG
|
|
|
|
#define GCC_PSEG __attribute__((section(GREG_SECTION)))
|
2008-10-19 21:43:36 +00:00
|
|
|
#define MSVC_MSEG
|
|
|
|
#define GCC_MSEG __attribute__((section(MREG_SECTION)))
|
2008-08-10 20:48:55 +00:00
|
|
|
#endif
|
|
|
|
|
2008-08-10 22:48:37 +00:00
|
|
|
|
2008-09-21 18:02:38 +00:00
|
|
|
union FPropParam
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
float f;
|
|
|
|
const char *s;
|
|
|
|
};
|
|
|
|
|
2008-12-07 12:11:59 +00:00
|
|
|
typedef void (*PropHandler)(AActor *defaults, FActorInfo *info, Baggage &bag, FPropParam *params);
|
2008-09-21 18:02:38 +00:00
|
|
|
|
|
|
|
enum ECategory
|
|
|
|
{
|
|
|
|
CAT_PROPERTY, // Inheritable property
|
|
|
|
CAT_INFO // non-inheritable info (spawn ID, Doomednum, game filter, conversation ID)
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FPropertyInfo
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
const char *params;
|
|
|
|
const PClass *cls;
|
|
|
|
PropHandler Handler;
|
|
|
|
int category;
|
|
|
|
};
|
|
|
|
|
2008-10-19 21:43:36 +00:00
|
|
|
struct FVariableInfo
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
intptr_t address;
|
|
|
|
const PClass *owner;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-09-21 18:02:38 +00:00
|
|
|
FPropertyInfo *FindProperty(const char * string);
|
2008-10-19 21:43:36 +00:00
|
|
|
FVariableInfo *FindVariable(const char * string, const PClass *cls);
|
2008-09-21 18:02:38 +00:00
|
|
|
int MatchString (const char *in, const char **strings);
|
|
|
|
|
|
|
|
|
|
|
|
#define DEFINE_PROPERTY_BASE(name, paramlist, clas, cat) \
|
2008-12-07 12:11:59 +00:00
|
|
|
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params); \
|
2008-09-23 07:46:23 +00:00
|
|
|
static FPropertyInfo Prop_##name##_##paramlist##_##clas = \
|
2008-09-21 18:02:38 +00:00
|
|
|
{ #name, #paramlist, RUNTIME_CLASS(A##clas), (PropHandler)Handler_##name##_##paramlist##_##clas, cat }; \
|
2008-09-23 07:46:23 +00:00
|
|
|
MSVC_PSEG FPropertyInfo *infoptr_##name##_##paramlist##_##clas GCC_PSEG = &Prop_##name##_##paramlist##_##clas; \
|
2008-12-07 12:11:59 +00:00
|
|
|
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params)
|
2008-09-21 18:02:38 +00:00
|
|
|
|
|
|
|
#define DEFINE_PREFIXED_PROPERTY_BASE(prefix, name, paramlist, clas, cat) \
|
2008-12-07 12:11:59 +00:00
|
|
|
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params); \
|
2008-09-23 07:46:23 +00:00
|
|
|
static FPropertyInfo Prop_##name##_##paramlist##_##clas = \
|
2008-09-21 18:02:38 +00:00
|
|
|
{ #prefix"."#name, #paramlist, RUNTIME_CLASS(A##clas), (PropHandler)Handler_##name##_##paramlist##_##clas, cat }; \
|
2008-09-23 07:46:23 +00:00
|
|
|
MSVC_PSEG FPropertyInfo *infoptr_##name##_##paramlist##_##clas GCC_PSEG = &Prop_##name##_##paramlist##_##clas; \
|
2008-12-07 12:11:59 +00:00
|
|
|
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params)
|
2008-09-21 18:02:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define DEFINE_PROPERTY(name, paramlist, clas) DEFINE_PROPERTY_BASE(name, paramlist, clas, CAT_PROPERTY)
|
|
|
|
#define DEFINE_INFO_PROPERTY(name, paramlist, clas) DEFINE_PROPERTY_BASE(name, paramlist, clas, CAT_INFO)
|
|
|
|
|
|
|
|
#define DEFINE_CLASS_PROPERTY(name, paramlist, clas) DEFINE_PREFIXED_PROPERTY_BASE(clas, name, paramlist, clas, CAT_PROPERTY)
|
|
|
|
#define DEFINE_CLASS_PROPERTY_PREFIX(prefix, name, paramlist, clas) DEFINE_PREFIXED_PROPERTY_BASE(prefix, name, paramlist, clas, CAT_PROPERTY)
|
|
|
|
|
|
|
|
#define PROP_PARM_COUNT (params[0].i)
|
|
|
|
|
|
|
|
#define PROP_STRING_PARM(var, no) \
|
|
|
|
const char *var = params[(no)+1].s;
|
|
|
|
|
|
|
|
#define PROP_INT_PARM(var, no) \
|
|
|
|
int var = params[(no)+1].i;
|
|
|
|
|
|
|
|
#define PROP_FLOAT_PARM(var, no) \
|
|
|
|
float var = params[(no)+1].f;
|
|
|
|
|
|
|
|
#define PROP_FIXED_PARM(var, no) \
|
|
|
|
fixed_t var = fixed_t(params[(no)+1].f * FRACUNIT);
|
|
|
|
|
|
|
|
#define PROP_COLOR_PARM(var, no) \
|
|
|
|
int var = params[(no)+1].i== 0? params[(no)+2].i : V_GetColor(NULL, params[(no)+2].s);
|
|
|
|
|
2008-10-19 21:43:36 +00:00
|
|
|
|
|
|
|
#define DEFINE_GLOBAL_VARIABLE(name) \
|
|
|
|
static FVariableInfo GlobalDef__##name = { #name, intptr_t(&name), NULL }; \
|
2008-10-21 13:17:55 +00:00
|
|
|
MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name;
|
2008-10-19 21:43:36 +00:00
|
|
|
|
|
|
|
#define DEFINE_MEMBER_VARIABLE(name, cls) \
|
|
|
|
static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, name), RUNTIME_CLASS(cls) }; \
|
2008-10-21 13:17:55 +00:00
|
|
|
MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name;
|
2008-10-19 21:43:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-14 08:52:55 +00:00
|
|
|
struct StateCallData
|
|
|
|
{
|
2008-09-21 18:02:38 +00:00
|
|
|
FState *State;
|
|
|
|
AActor *Item;
|
2008-08-14 08:52:55 +00:00
|
|
|
bool Result;
|
|
|
|
};
|
|
|
|
|
2008-08-10 22:48:37 +00:00
|
|
|
// Macros to handle action functions. These are here so that I don't have to
|
|
|
|
// change every single use in case the parameters change.
|
2009-01-06 00:03:18 +00:00
|
|
|
#define DECLARE_ACTION(name) void AF_##name(AActor *self, AActor *stateowner, FState *, int, StateCallData *);
|
2008-08-10 20:48:55 +00:00
|
|
|
|
2008-08-12 14:30:07 +00:00
|
|
|
// This distinction is here so that CALL_ACTION produces errors when trying to
|
|
|
|
// access a function that requires parameters.
|
2008-08-10 20:48:55 +00:00
|
|
|
#define DEFINE_ACTION_FUNCTION(cls, name) \
|
2009-01-06 00:03:18 +00:00
|
|
|
void AF_##name (AActor *self, AActor *stateowner, FState *, int, StateCallData *); \
|
2008-10-19 21:43:36 +00:00
|
|
|
static AFuncDesc info_##cls##_##name = { #name, AF_##name }; \
|
2008-08-10 20:48:55 +00:00
|
|
|
MSVC_ASEG AFuncDesc *infoptr_##cls##_##name GCC_ASEG = &info_##cls##_##name; \
|
2009-01-06 00:03:18 +00:00
|
|
|
void AF_##name (AActor *self, AActor *stateowner, FState *, int, StateCallData *statecall)
|
2008-08-12 14:30:07 +00:00
|
|
|
|
|
|
|
#define DEFINE_ACTION_FUNCTION_PARAMS(cls, name) \
|
2009-01-06 00:03:18 +00:00
|
|
|
void AFP_##name (AActor *self, AActor *stateowner, FState *CallingState, int ParameterIndex, StateCallData *statecall); \
|
2008-10-19 21:43:36 +00:00
|
|
|
static AFuncDesc info_##cls##_##name = { #name, AFP_##name }; \
|
2008-08-12 14:30:07 +00:00
|
|
|
MSVC_ASEG AFuncDesc *infoptr_##cls##_##name GCC_ASEG = &info_##cls##_##name; \
|
2009-01-06 00:03:18 +00:00
|
|
|
void AFP_##name (AActor *self, AActor *stateowner, FState *CallingState, int ParameterIndex, StateCallData *statecall)
|
2008-08-10 22:48:37 +00:00
|
|
|
|
2009-01-06 00:03:18 +00:00
|
|
|
#define DECLARE_PARAMINFO AActor *self, AActor *stateowner, FState *CallingState, int ParameterIndex, StateCallData *statecall
|
|
|
|
#define PUSH_PARAMINFO self, stateowner, CallingState, ParameterIndex, statecall
|
2008-08-12 14:30:07 +00:00
|
|
|
|
2009-01-06 00:03:18 +00:00
|
|
|
#define CALL_ACTION(name,self) AF_##name(self, self, NULL, 0, NULL)
|
2008-08-12 14:30:07 +00:00
|
|
|
|
2008-10-25 17:38:00 +00:00
|
|
|
|
|
|
|
int EvalExpressionI (DWORD x, AActor *self);
|
|
|
|
int EvalExpressionCol (DWORD x, AActor *self);
|
|
|
|
FSoundID EvalExpressionSnd (DWORD x, AActor *self);
|
|
|
|
double EvalExpressionF (DWORD x, AActor *self);
|
|
|
|
fixed_t EvalExpressionFix (DWORD x, AActor *self);
|
|
|
|
FState *EvalExpressionState (DWORD x, AActor *self);
|
|
|
|
const PClass *EvalExpressionClass (DWORD x, AActor *self);
|
|
|
|
FName EvalExpressionName (DWORD x, AActor *self);
|
|
|
|
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_START(count)
|
|
|
|
|
|
|
|
#define ACTION_PARAM_INT(var, i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
int var = EvalExpressionI(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_BOOL(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
bool var = !!EvalExpressionI(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_FIXED(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
fixed_t var = EvalExpressionFix(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_FLOAT(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
float var = EvalExpressionF(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_CLASS(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
const PClass *var = EvalExpressionClass(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_STATE(var,i) \
|
2009-01-06 00:03:18 +00:00
|
|
|
FState *var = EvalExpressionState(ParameterIndex+i, stateowner);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_COLOR(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
PalEntry var = EvalExpressionCol(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_SOUND(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
FSoundID var = EvalExpressionSnd(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_STRING(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
const char *var = EvalExpressionName(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_NAME(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
FName var = EvalExpressionName(ParameterIndex+i, self);
|
2008-08-13 22:54:24 +00:00
|
|
|
#define ACTION_PARAM_ANGLE(var,i) \
|
2008-10-25 17:38:00 +00:00
|
|
|
angle_t var = angle_t(EvalExpressionF(ParameterIndex+i, self)*ANGLE_90/90.f);
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2008-08-14 08:52:55 +00:00
|
|
|
#define ACTION_SET_RESULT(v) if (statecall != NULL) statecall->Result = v;
|
|
|
|
|
|
|
|
// Checks to see what called the current action function
|
|
|
|
#define ACTION_CALL_FROM_ACTOR() (CallingState == self->state)
|
|
|
|
#define ACTION_CALL_FROM_WEAPON() (self->player && CallingState != self->state && statecall == NULL)
|
|
|
|
#define ACTION_CALL_FROM_INVENTORY() (statecall != NULL)
|
- Fixed compilation with mingw again.
- Added multiple-choice sound sequences. These overcome one of the major
deficiences of the Hexen-inherited SNDSEQ system while still being Hexen
compatible: Custom door sounds can now use different opening and closing
sequences, for both normal and blazing speeds.
- Added a serializer for TArray.
- Added a countof macro to doomtype.h. See the1's blog to find out why
it's implemented the way it is.
<http://blogs.msdn.com/the1/articles/210011.aspx>
- Added a new method to FRandom for getting random numbers larger than 255,
which lets me:
- Fixed: SNDSEQ delayrand commands could delay for no more than 255 tics.
- Fixed: If you're going to have sector_t.SoundTarget, then they need to
be included in the pointer cleanup scans.
- Ported back newer name code from 2.1.
- Fixed: Using -warp with only one parameter in Doom and Heretic to
select a map on episode 1 no longer worked.
- New: Loading a multiplayer save now restores the players based on
their names rather than on their connection order. Using connection
order was sensible when -net was the only way to start a network game,
but with -host/-join, it's not so nice. Also, if there aren't enough
players in the save, then the extra players will be spawned normally,
so you can continue a saved game with more players than you started it
with.
- Added some new SNDSEQ commands to make it possible to define Heretic's
ambient sounds in SNDSEQ: volumerel, volumerand, slot, randomsequence,
delayonce, and restart. With these, it is basically possible to obsolete
all of the $ambient SNDINFO commands.
- Fixed: Sound sequences would only execute one command each time they were
ticked.
- Fixed: No bounds checking was done on the volume sound sequences played at.
- Fixed: The tic parameter to playloop was useless and caused it to
act like a redundant playrepeat. I have removed all the logic that
caused playloop to play repeating sounds, and now it acts like an
infinite sequence of play/delay commands until the sequence is
stopped.
- Fixed: Sound sequences were ticked every frame, not every tic, so all
the delay commands were timed incorrectly and varied depending on your
framerate. Since this is useful for restarting looping sounds that got
cut off, I have not changed this. Instead, the delay commands now
record the tic when execution should resume, not the number of tics
left to delay.
SVN r57 (trunk)
2006-04-21 01:22:55 +00:00
|
|
|
#endif
|