- Added global constants to DECORATE so that I can define meaningful flag

names for some DECORATE functions. Technically these will be constants 
  of the AActor class but that will make them accessible in all other actor 
  classes.


SVN r397 (trunk)
This commit is contained in:
Christoph Oelckers 2006-11-29 16:20:22 +00:00
parent a537d1a115
commit 63bd2125f3
11 changed files with 62 additions and 18 deletions

View file

@ -1,4 +1,8 @@
November 29, 2006 (Changes by Graf Zahl)
- Added global constants to DECORATE so that I can define meaningful flag
names for some DECORATE functions. Technically these will be constants
of the AActor class but that will make them accessible in all other actor
classes.
- Made the constructor of PSymbolTable inline. Having this a real function
adds 100kb to the EXE, mostly needless exception handling code.

View file

@ -114,7 +114,7 @@ END_DEFAULTS
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
void ProcessActor(void (*process)(FState *, int));
void ProcessWeapon(void (*process)(FState *, int));
void ParseGlobalConst();
void FinishThingdef();
void InitDecorateTranslations();
@ -335,6 +335,11 @@ static void ParseDecorate (void (*process)(FState *, int))
def = DEF_Projectile;
SC_MustGetString ();
}
else if (SC_Compare ("Const"))
{
ParseGlobalConst();
continue;
}
else
{
parent = RUNTIME_CLASS(AActor);

View file

@ -2561,6 +2561,23 @@ static void ActorConstDef (AActor *defaults, Baggage &bag)
}
}
//==========================================================================
//
// ParseGlobalConst
//
// Parses a constant outside an actor definition
// These will be inserted into AActor's symbol table
//
//==========================================================================
void ParseGlobalConst()
{
Baggage bag;
bag.Info = RUNTIME_CLASS(AActor)->ActorInfo;
ActorConstDef(GetDefault<AActor>(), bag);
}
//==========================================================================
//
// ActorActionDef

View file

@ -0,0 +1,13 @@
// Flags for A_CustomMissile
const int CMF_AIMOFFSET = 1;
const int CMF_AIMDIRECTION = 2;
const int CMF_TRACKOWNER = 4;
const int CMF_CHECKTARGETDEAD = 8;
// Flags for A_SpawnItemEx
const int SXF_TRANSFERTRANSLATION=1;
const int SXF_ABSOLUTEPOSITION=2;
const int SXF_ABSOLUTEANGLE=4;
const int SXF_ABSOLUTEMOMENTUM=8;
const int SXF_SETMASTER=16;

View file

@ -1,3 +1,5 @@
#include "actors/constants.txt"
#include "actors/shared/botstuff.txt"
#include "actors/shared/blood.txt"
#include "actors/shared/debris.txt"

View file

@ -80,7 +80,8 @@ ACTOR BeastBall
States
{
Spawn:
FRB1 AABBCC 2 A_SpawnItemEx("Puffy", random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, 0,0,0,0,2, 64)
FRB1 AABBCC 2 A_SpawnItemEx("Puffy", random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625, random2[BeastPuff]()*0.015625,
0,0,0,0,SXF_ABSOLUTEPOSITION, 64)
Loop
Death:
FRB1 DEFGH 4

View file

@ -27,9 +27,9 @@ ACTOR Snake 92
Loop
Missile:
SNKE FF 5 A_FaceTarget
SNKE FFF 4 A_CustomMissile("SnakeProjA", 32, 0, 0, 8)
SNKE FFF 4 A_CustomMissile("SnakeProjA", 32, 0, 0, CMF_CHECKTARGETDEAD)
SNKE FFF 5 A_FaceTarget
SNKE F 4 A_CustomMissile("SnakeProjB", 32, 0, 0, 8)
SNKE F 4 A_CustomMissile("SnakeProjB", 32, 0, 0, CMF_CHECKTARGETDEAD)
Goto See
Pain:
SNKE E 3

View file

@ -87,9 +87,9 @@ ACTOR CentaurLeader : Centaur 115
{
Missile:
CENT E 10 A_FaceTarget
CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, 1)
CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET)
CENT E 10 A_FaceTarget
CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, 1)
CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET)
Goto See
}
}

View file

@ -19,6 +19,7 @@ ACTOR Demon1 31
PainSound "DemonPain"
DeathSound "DemonDeath"
ActiveSound "DemonActive"
const int ChunkFlags = SXF_TRANSFERTRANSLATION|SXF_ABSOLUTEMOMENTUM;
States
{
Spawn:
@ -51,11 +52,11 @@ ACTOR Demon1 31
Stop
XDeath:
DEMN H 6
DEMN I 0 A_SpawnItemEx("Demon1Chunk1", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 90)
DEMN I 0 A_SpawnItemEx("Demon1Chunk2", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEMN I 0 A_SpawnItemEx("Demon1Chunk3", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEMN I 0 A_SpawnItemEx("Demon1Chunk4", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEMN I 6 A_SpawnItemEx("Demon1Chunk5", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEMN I 0 A_SpawnItemEx("Demon1Chunk1", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 90)
DEMN I 0 A_SpawnItemEx("Demon1Chunk2", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
DEMN I 0 A_SpawnItemEx("Demon1Chunk3", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
DEMN I 0 A_SpawnItemEx("Demon1Chunk4", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
DEMN I 6 A_SpawnItemEx("Demon1Chunk5", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
Goto Death+2
Ice:
DEMN Q 5 A_FreezeDeath
@ -245,11 +246,11 @@ ACTOR Demon2 : Demon1 8080
Stop
XDeath:
DEM2 H 6
DEM2 I 0 A_SpawnItemEx("Demon2Chunk1", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 90)
DEM2 I 0 A_SpawnItemEx("Demon2Chunk2", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEM2 I 0 A_SpawnItemEx("Demon2Chunk3", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEM2 I 0 A_SpawnItemEx("Demon2Chunk4", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEM2 I 6 A_SpawnItemEx("Demon2Chunk5", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), 9, 270)
DEM2 I 0 A_SpawnItemEx("Demon2Chunk1", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 90)
DEM2 I 0 A_SpawnItemEx("Demon2Chunk2", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
DEM2 I 0 A_SpawnItemEx("Demon2Chunk3", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
DEM2 I 0 A_SpawnItemEx("Demon2Chunk4", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
DEM2 I 6 A_SpawnItemEx("Demon2Chunk5", 0,0,45, 1+(random[DemonChunks](0,255)*0.015625), 1+(random[DemonChunks](0,255)*0.015625), ChunkFlags, 270)
Goto Death+2
Ice:
DEM2 Q 5 A_FreezeDeath

View file

@ -50,7 +50,7 @@ ACTOR Ettin 10030
ETTB C 4 A_SpawnItemEx("EttinMace", 0,0,8.5,
random[DropMace](-128,127) * 0.03125,
random[DropMace](-128,127) * 0.03125,
10 + random[DropMace](0,255) * 0.015625, 0, 4)
10 + random[DropMace](0,255) * 0.015625, 0, SXF_ABSOLUTEMOMENTUM)
ETTB D 4 A_Scream
ETTB E 4 A_QueueCorpse
ETTB FGHIJK 4

View file

@ -239,7 +239,8 @@ textcolors.txt textcolors.txt
========
# Decorate stuff
decorate.txt decorate/decorate.txt
decorate.txt decorate/decorate.txt
actors/constants.txt decorate/constants.txt
actors/shared/botstuff.txt decorate/shared/botstuff.txt
actors/shared/blood.txt decorate/shared/blood.txt