diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9b557628c..b40fda7c6 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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. diff --git a/src/decorations.cpp b/src/decorations.cpp index cb13927bd..272009479 100644 --- a/src/decorations.cpp +++ b/src/decorations.cpp @@ -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); diff --git a/src/thingdef.cpp b/src/thingdef.cpp index 186f7393a..04277e310 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -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(), bag); +} + //========================================================================== // // ActorActionDef diff --git a/wadsrc/decorate/constants.txt b/wadsrc/decorate/constants.txt new file mode 100644 index 000000000..5c9926726 --- /dev/null +++ b/wadsrc/decorate/constants.txt @@ -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; + diff --git a/wadsrc/decorate/decorate.txt b/wadsrc/decorate/decorate.txt index ec872fd64..b4dee8302 100644 --- a/wadsrc/decorate/decorate.txt +++ b/wadsrc/decorate/decorate.txt @@ -1,3 +1,5 @@ +#include "actors/constants.txt" + #include "actors/shared/botstuff.txt" #include "actors/shared/blood.txt" #include "actors/shared/debris.txt" diff --git a/wadsrc/decorate/heretic/beast.txt b/wadsrc/decorate/heretic/beast.txt index 62fd338fa..c89e6a02c 100644 --- a/wadsrc/decorate/heretic/beast.txt +++ b/wadsrc/decorate/heretic/beast.txt @@ -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 diff --git a/wadsrc/decorate/heretic/snake.txt b/wadsrc/decorate/heretic/snake.txt index 0fb995096..0184da170 100644 --- a/wadsrc/decorate/heretic/snake.txt +++ b/wadsrc/decorate/heretic/snake.txt @@ -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 diff --git a/wadsrc/decorate/hexen/centaur.txt b/wadsrc/decorate/hexen/centaur.txt index 82cc73db8..2ffc045e4 100644 --- a/wadsrc/decorate/hexen/centaur.txt +++ b/wadsrc/decorate/hexen/centaur.txt @@ -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 } } diff --git a/wadsrc/decorate/hexen/demons.txt b/wadsrc/decorate/hexen/demons.txt index 92c7551e9..5928e5209 100644 --- a/wadsrc/decorate/hexen/demons.txt +++ b/wadsrc/decorate/hexen/demons.txt @@ -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 diff --git a/wadsrc/decorate/hexen/ettin.txt b/wadsrc/decorate/hexen/ettin.txt index ceaf69a7a..e0038d7a2 100644 --- a/wadsrc/decorate/hexen/ettin.txt +++ b/wadsrc/decorate/hexen/ettin.txt @@ -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 diff --git a/wadsrc/zdoom.lst b/wadsrc/zdoom.lst index 71bfb04c2..6474d57ae 100644 --- a/wadsrc/zdoom.lst +++ b/wadsrc/zdoom.lst @@ -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