From 7de683f9f52b86d89ef91d08f149bba7c81fd80c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 14 Oct 2016 00:40:20 +0200 Subject: [PATCH] - converted a few more DECORATE files. - started with the AST converter. So far it only deals with direct function calls with simple constants as parameters. - added an error condition for the defaults block to get rid of some asserts. --- .../codegeneration/thingdef_expression.cpp | 9 +- src/scripting/zscript/zcc-parse.lemon | 1 + src/scripting/zscript/zcc_compile.cpp | 91 ++++- src/scripting/zscript/zcc_compile.h | 6 + wadsrc/static/actors/shared/action.txt | 56 --- wadsrc/static/actors/shared/blood.txt | 69 ---- wadsrc/static/actors/shared/botstuff.txt | 19 - wadsrc/static/actors/shared/debris.txt | 331 ---------------- wadsrc/static/actors/shared/morph.txt | 15 - wadsrc/static/actors/shared/sharedmisc.txt | 178 --------- wadsrc/static/decorate.txt | 12 +- wadsrc/static/zscript.txt | 6 + wadsrc/static/zscript/shared/blood.txt | 78 ++++ wadsrc/static/zscript/shared/botstuff.txt | 25 ++ wadsrc/static/zscript/shared/debris.txt | 364 ++++++++++++++++++ wadsrc/static/zscript/shared/ice.txt | 61 +++ wadsrc/static/zscript/shared/morph.txt | 21 + wadsrc/static/zscript/shared/sharedmisc.txt | 220 +++++++++++ 18 files changed, 881 insertions(+), 681 deletions(-) delete mode 100644 wadsrc/static/actors/shared/action.txt delete mode 100644 wadsrc/static/actors/shared/blood.txt delete mode 100644 wadsrc/static/actors/shared/botstuff.txt delete mode 100644 wadsrc/static/actors/shared/debris.txt delete mode 100644 wadsrc/static/actors/shared/morph.txt delete mode 100644 wadsrc/static/actors/shared/sharedmisc.txt create mode 100644 wadsrc/static/zscript/shared/blood.txt create mode 100644 wadsrc/static/zscript/shared/botstuff.txt create mode 100644 wadsrc/static/zscript/shared/debris.txt create mode 100644 wadsrc/static/zscript/shared/ice.txt create mode 100644 wadsrc/static/zscript/shared/morph.txt create mode 100644 wadsrc/static/zscript/shared/sharedmisc.txt diff --git a/src/scripting/codegeneration/thingdef_expression.cpp b/src/scripting/codegeneration/thingdef_expression.cpp index 31acc391e..77b062ed6 100644 --- a/src/scripting/codegeneration/thingdef_expression.cpp +++ b/src/scripting/codegeneration/thingdef_expression.cpp @@ -3622,12 +3622,19 @@ FxFunctionCall::~FxFunctionCall() //========================================================================== // -// +// Note: This currently only deals with the simple cases and needs some changes. // //========================================================================== FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx) { + // This part is mostly a kludge, it really needs to get the class type from Self. + PFunction *afd = dyn_cast(ctx.Class->Symbols.FindSymbol(MethodName, true)); + if (afd != nullptr) + { + return new FxVMFunctionCall(afd, ArgList, ScriptPosition, false); + } + for (size_t i = 0; i < countof(FxFlops); ++i) { if (MethodName == FxFlops[i].Name) diff --git a/src/scripting/zscript/zcc-parse.lemon b/src/scripting/zscript/zcc-parse.lemon index 51a221af7..96b4b66c1 100644 --- a/src/scripting/zscript/zcc-parse.lemon +++ b/src/scripting/zscript/zcc-parse.lemon @@ -565,6 +565,7 @@ default_statement_list(X) ::= default_statement_list(X) default_statement(B). default_statement(X) ::= SEMICOLON. { X = NULL; } +default_statement(X) ::= error SEMICOLON. { X = NULL; } //default_statement(X) ::= assign_statement(A) SEMICOLON. { X = A; /*X-overwrites-A*/ } default_statement(X) ::= property_statement(A). { X = A; /*X-overwrites-A*/ } default_statement(X) ::= flag_statement(A). { X = A; /*X-overwrites-A*/ } diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 5e0e64856..904f938ca 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -45,6 +45,7 @@ #include "zcc_compile.h" #include "v_text.h" #include "p_lnspec.h" +#include "i_system.h" #include "gdtoa.h" #include "codegeneration/thingdef_exp.h" #include "vmbuilder.h" @@ -2028,10 +2029,6 @@ FxExpression *ZCCCompiler::SetupActionFunction(PClassActor *cls, ZCC_TreeNode *a // This is the simple case which doesn't require work on the tree. return new FxVMFunctionCall(afd, nullptr, *af, true); } - else - { - // need to generate a function from the information. - } } else { @@ -2039,8 +2036,10 @@ FxExpression *ZCCCompiler::SetupActionFunction(PClassActor *cls, ZCC_TreeNode *a return nullptr; } } - Error(af, "Complex action functions not supported yet."); - return nullptr; + return ConvertAST(af); + + //Error(af, "Complex action functions not supported yet."); + //return nullptr; /* bool hasfinalret; @@ -2264,3 +2263,83 @@ void ZCCCompiler::CompileStates() } } } + +//========================================================================== +// +// Convert the AST data for the code generator. +// +//========================================================================== + +FxExpression *ZCCCompiler::ConvertAST(ZCC_TreeNode *ast) +{ + // FxReturnStatement will have to be done more intelligently, of course. + return new FxReturnStatement(ConvertNode(ast), *ast); +} + +FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast) +{ + // Note: Do not call 'Simplify' here because that function tends to destroy identifiers due to lack of context in which to resolve them. + // The Fx nodes created here will be better suited for that. + switch (ast->NodeType) + { + case AST_ExprFuncCall: + { + auto fcall = static_cast(ast); + assert(fcall->Function->NodeType == AST_ExprID); // of course this cannot remain. Right now nothing more complex can come along but later this will have to be decomposed into 'self' and the actual function name. + auto fname = static_cast(fcall->Function)->Identifier; + return new FxFunctionCall(nullptr, fname, ConvertNodeList(fcall->Parameters), *ast); + } + + case AST_FuncParm: + { + auto fparm = static_cast(ast); + // ignore the label for now, that's stuff for far later, when a bit more here is working. + return ConvertNode(fparm->Value); + } + + case AST_ExprConstant: + { + auto cnst = static_cast(ast); + if (cnst->Type->IsKindOf(RUNTIME_CLASS(PInt))) + { + return new FxConstant(cnst->IntVal, *ast); + } + else if (cnst->Type->IsKindOf(RUNTIME_CLASS(PFloat))) + { + return new FxConstant(cnst->DoubleVal, *ast); + } + else if (cnst->Type->IsKindOf(RUNTIME_CLASS(PString))) + { + return new FxConstant(*cnst->StringVal, *ast); + } + else if (cnst->Type->IsKindOf(RUNTIME_CLASS(PName))) + { + return new FxConstant(ENamedName(cnst->IntVal), *ast); + } + else + { + // can there be other types? + Error(cnst, "Unknown constant type"); + return new FxConstant(0, *ast); + } + } + + default: + // only for development. I_Error is more convenient here than a normal error. + I_Error("ConvertNode encountered unsupported node of type %d", ast->NodeType); + return nullptr; + } +} + + +FArgumentList *ZCCCompiler::ConvertNodeList(ZCC_TreeNode *head) +{ + FArgumentList *list = new FArgumentList; + auto node = head; + do + { + list->Push(ConvertNode(node)); + node = node->SiblingNext; + } while (node != head); + return list; +} \ No newline at end of file diff --git a/src/scripting/zscript/zcc_compile.h b/src/scripting/zscript/zcc_compile.h index 74d83f529..2ca00459a 100644 --- a/src/scripting/zscript/zcc_compile.h +++ b/src/scripting/zscript/zcc_compile.h @@ -5,6 +5,8 @@ struct Baggage; struct FPropertyInfo; class AActor; class FxExpression; +typedef TDeletingArray FArgumentList; + struct ZCC_StructWork { @@ -136,6 +138,10 @@ private: void Error(ZCC_TreeNode *node, const char *msg, ...); void MessageV(ZCC_TreeNode *node, const char *txtcolor, const char *msg, va_list argptr); + FxExpression *ConvertAST(ZCC_TreeNode *ast); + FxExpression *ConvertNode(ZCC_TreeNode *node); + FArgumentList *ConvertNodeList(ZCC_TreeNode *head); + DObject *Outer; PSymbolTable *GlobalTreeNodes; PSymbolTable *OutputSymbols; diff --git a/wadsrc/static/actors/shared/action.txt b/wadsrc/static/actors/shared/action.txt deleted file mode 100644 index fc0e71313..000000000 --- a/wadsrc/static/actors/shared/action.txt +++ /dev/null @@ -1,56 +0,0 @@ - - -//========================================================================== -// -// Ice chunk -// -//========================================================================== - -ACTOR IceChunk -{ - Radius 3 - Height 4 - Mass 5 - Gravity 0.125 - +DROPOFF - +CANNOTPUSH - +FLOORCLIP - +NOTELEPORT - +NOBLOCKMAP - +MOVEWITHSECTOR - - action native A_IceSetTics (); - - States - { - Spawn: - ICEC A 1 - ICEC ABCD 10 A_IceSetTics - Stop - } -} - -//========================================================================== -// -// A chunk of ice that is also a player -// -//========================================================================== - -ACTOR IceChunkHead : PlayerChunk -{ - Radius 3 - Height 4 - Mass 5 - Gravity 0.125 - DamageType Ice - +DROPOFF - +CANNOTPUSH - States - { - Spawn: - ICEC A 0 - ICEC A 10 A_CheckPlayerDone - wait - } -} - diff --git a/wadsrc/static/actors/shared/blood.txt b/wadsrc/static/actors/shared/blood.txt deleted file mode 100644 index ab33fee75..000000000 --- a/wadsrc/static/actors/shared/blood.txt +++ /dev/null @@ -1,69 +0,0 @@ - -// Blood sprite ------------------------------------------------------------ - -ACTOR Blood -{ - Mass 5 - +NOBLOCKMAP - +NOTELEPORT - +ALLOWPARTICLES - States - { - Spawn: - BLUD CBA 8 - Stop - Spray: - SPRY ABCDEF 3 - SPRY G 2 - Stop - } -} - -// Blood splatter ----------------------------------------------------------- - -ACTOR BloodSplatter -{ - Radius 2 - Height 4 - +NOBLOCKMAP - +MISSILE - +DROPOFF - +NOTELEPORT - +CANNOTPUSH - +ALLOWPARTICLES - Mass 5 - States - { - Spawn: - BLUD CBA 8 - Stop - Death: - BLUD A 6 - Stop - } -} - -// Axe Blood ---------------------------------------------------------------- - -ACTOR AxeBlood -{ - Radius 2 - Height 4 - +NOBLOCKMAP - +NOGRAVITY - +DROPOFF - +NOTELEPORT - +CANNOTPUSH - +ALLOWPARTICLES - Mass 5 - States - { - Spawn: - FAXE FGHIJ 3 - Death: - FAXE K 3 - Stop - } -} - - \ No newline at end of file diff --git a/wadsrc/static/actors/shared/botstuff.txt b/wadsrc/static/actors/shared/botstuff.txt deleted file mode 100644 index 4b1992bde..000000000 --- a/wadsrc/static/actors/shared/botstuff.txt +++ /dev/null @@ -1,19 +0,0 @@ - -ACTOR CajunBodyNode -{ - +NOSECTOR - +NOGRAVITY - +INVISIBLE -} - -ACTOR CajunTrace -{ - Speed 12 - Radius 6 - Height 8 - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOGRAVITY - +NOTELEPORT -} diff --git a/wadsrc/static/actors/shared/debris.txt b/wadsrc/static/actors/shared/debris.txt deleted file mode 100644 index 5d14a48fa..000000000 --- a/wadsrc/static/actors/shared/debris.txt +++ /dev/null @@ -1,331 +0,0 @@ - -// Rocks -------------------------------------------------------------------- - -ACTOR Rock1 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK A 20 - Loop - Death: - ROKK A 10 - Stop - } -} - -ACTOR Rock2 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK B 20 - Loop - Death: - ROKK B 10 - Stop - } -} - - -ACTOR Rock3 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK C 20 - Loop - Death: - ROKK C 10 - Stop - } -} - - -// Dirt -------------------------------------------------------------------- - -ACTOR Dirt1 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK D 20 - Loop - Death: - ROKK D 10 - Stop - } -} - -ACTOR Dirt2 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK E 20 - Loop - Death: - ROKK E 10 - Stop - } -} - -ACTOR Dirt3 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK F 20 - Loop - Death: - ROKK F 10 - Stop - } -} - -ACTOR Dirt4 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK G 20 - Loop - Death: - ROKK G 10 - Stop - } -} - -ACTOR Dirt5 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK H 20 - Loop - Death: - ROKK H 10 - Stop - } -} - -ACTOR Dirt6 -{ - +NOBLOCKMAP - +DROPOFF - +MISSILE - +NOTELEPORT - States - { - Spawn: - ROKK I 20 - Loop - Death: - ROKK I 10 - Stop - } -} - -// Stained glass ------------------------------------------------------------ - -ACTOR GlassShard native -{ - Radius 5 - Mass 5 - Projectile - -ACTIVATEPCROSS - -ACTIVATEIMPACT - BounceType "HexenCompat" - BounceFactor 0.3 -} - -ACTOR SGShard1 : GlassShard -{ - States - { - Spawn: - SGSA ABCDE 4 - Loop - Death: - SGSA E 30 - Stop - } -} - -ACTOR SGShard2 : GlassShard -{ - States - { - Spawn: - SGSA FGHIJ 4 - Loop - Death: - SGSA J 30 - Stop - } -} - -ACTOR SGShard3 : GlassShard -{ - States - { - Spawn: - SGSA KLMNO 4 - Loop - Death: - SGSA O 30 - Stop - } -} - -ACTOR SGShard4 : GlassShard -{ - States - { - Spawn: - SGSA PQRST 4 - Loop - Death: - SGSA T 30 - Stop - } -} - -ACTOR SGShard5 : GlassShard -{ - States - { - Spawn: - SGSA UVWXY 4 - Loop - Death: - SGSA Y 30 - Stop - } -} - -ACTOR SGShard6 : GlassShard -{ - States - { - Spawn: - SGSB A 4 - Loop - Death: - SGSB A 30 - Stop - } -} - -ACTOR SGShard7 : GlassShard -{ - States - { - Spawn: - SGSB B 4 - Loop - Death: - SGSB B 30 - Stop - } -} - -ACTOR SGShard8 : GlassShard -{ - States - { - Spawn: - SGSB C 4 - Loop - Death: - SGSB C 30 - Stop - } -} - -ACTOR SGShard9 : GlassShard -{ - States - { - Spawn: - SGSB D 4 - Loop - Death: - SGSB D 30 - Stop - } -} - -ACTOR SGShard0 : GlassShard -{ - States - { - Spawn: - SGSB E 4 - Loop - Death: - SGSB E 30 - Stop - } -} - -ACTOR GlassJunk -{ - +NOCLIP - +NOBLOCKMAP - RenderStyle Translucent - Alpha 0.4 - Health 3 // Number of different shards - States - { - // Are the first three frames used anywhere? - SHAR A 128 - Goto Death - SHAR B 128 - Goto Death - SHAR C 128 - Goto Death - Spawn: - SHAR D 128 - Goto Death - SHAR E 128 - Goto Death - SHAR F 128 - Goto Death - Death: - "----" A 1 A_FadeOut(0.03) - Wait - } -} diff --git a/wadsrc/static/actors/shared/morph.txt b/wadsrc/static/actors/shared/morph.txt deleted file mode 100644 index f5aac48d2..000000000 --- a/wadsrc/static/actors/shared/morph.txt +++ /dev/null @@ -1,15 +0,0 @@ -ACTOR MorphProjectile native -{ - Damage 1 - Projectile - -ACTIVATEIMPACT - -ACTIVATEPCROSS -} - -ACTOR MorphedMonster native -{ - Monster - -COUNTKILL - +FLOORCLIP -} - diff --git a/wadsrc/static/actors/shared/sharedmisc.txt b/wadsrc/static/actors/shared/sharedmisc.txt deleted file mode 100644 index fe5ac72d8..000000000 --- a/wadsrc/static/actors/shared/sharedmisc.txt +++ /dev/null @@ -1,178 +0,0 @@ - -// Default actor for unregistered doomednums ------------------------------- - -ACTOR Unknown -{ - Radius 32 - Height 56 - +NOGRAVITY - +NOBLOCKMAP - +DONTSPLASH - States - { - Spawn: - UNKN A -1 - Stop - } -} - -// Route node for monster patrols ------------------------------------------- - -ACTOR PatrolPoint -{ - Radius 8 - Height 8 - Mass 10 - +NOGRAVITY - +NOBLOCKMAP - +DONTSPLASH - RenderStyle None -} - -// A special to execute when a monster reaches a matching patrol point ------ - -ACTOR PatrolSpecial -{ - Radius 8 - Height 8 - Mass 10 - +NOGRAVITY - +NOBLOCKMAP - +DONTSPLASH - RenderStyle None -} - -// Map spot ---------------------------------------------------------------- - -ACTOR MapSpot -{ - +NOBLOCKMAP - +NOSECTOR - +NOGRAVITY - +DONTSPLASH - RenderStyle None - CameraHeight 0 -} - -// same with different editor number for Legacy maps ----------------------- - -ACTOR FS_Mapspot : Mapspot -{ -} - -// Map spot with gravity --------------------------------------------------- - -ACTOR MapSpotGravity : MapSpot -{ - -NOBLOCKMAP - -NOSECTOR - -NOGRAVITY -} - -// Point Pushers ----------------------------------------------------------- - -ACTOR PointPusher -{ - +NOBLOCKMAP - +INVISIBLE - +NOCLIP -} - -ACTOR PointPuller -{ - +NOBLOCKMAP - +INVISIBLE - +NOCLIP -} - -// Bloody gibs ------------------------------------------------------------- - -ACTOR RealGibs -{ - +DROPOFF - +CORPSE - +NOTELEPORT - +DONTGIB - States - { - Spawn: - goto GenericCrush - } -} - -// Gibs that can be placed on a map. --------------------------------------- -// -// These need to be a separate class from the above, in case someone uses -// a deh patch to change the gibs, since ZDoom actually creates a gib actor -// for actors that get crushed instead of changing their state as Doom did. - -ACTOR Gibs : RealGibs -{ - ClearFlags -} - -// Needed for loading Build maps ------------------------------------------- - -ACTOR CustomSprite native -{ - +NOBLOCKMAP - +NOGRAVITY - States - { - Spawn: - TNT1 A -1 - Stop - } -} - -// SwitchableDecoration: Activate and Deactivate change state -------------- - -ACTOR SwitchableDecoration native -{ -} - - -ACTOR SwitchingDecoration : SwitchableDecoration native -{ -} - -// Random spawner ---------------------------------------------------------- - -ACTOR RandomSpawner native -{ - +NOBLOCKMAP - +NOSECTOR - +NOGRAVITY - +THRUACTORS -} - -// Fast projectiles -------------------------------------------------------- - -ACTOR FastProjectile native -{ - Projectile - MissileHeight 0 -} - -// Sector flag setter ------------------------------------------------------ - -ACTOR SectorFlagSetter native -{ - +NOBLOCKMAP - +NOGRAVITY - +DONTSPLASH - RenderStyle None -} - -// Marker for sounds ------------------------------------------------------- - -ACTOR SpeakerIcon : Unknown -{ - States - { - Spawn: - SPKR A -1 BRIGHT - Stop - } - Scale 0.125 -} diff --git a/wadsrc/static/decorate.txt b/wadsrc/static/decorate.txt index e921b5508..4fe719c62 100644 --- a/wadsrc/static/decorate.txt +++ b/wadsrc/static/decorate.txt @@ -2,11 +2,11 @@ //#include "actors/shared/inventory.txt" //#include "actors/shared/player.txt" -#include "actors/shared/morph.txt" -#include "actors/shared/botstuff.txt" -#include "actors/shared/sharedmisc.txt" -#include "actors/shared/blood.txt" -#include "actors/shared/debris.txt" +//#include "actors/shared/morph.txt" +//#include "actors/shared/botstuff.txt" +//#include "actors/shared/sharedmisc.txt" +//#include "actors/shared/blood.txt" +//#include "actors/shared/debris.txt" #include "actors/shared/decal.txt" #include "actors/shared/splashes.txt" #include "actors/shared/pickups.txt" @@ -26,7 +26,7 @@ #include "actors/shared/secrettrigger.txt" #include "actors/shared/setcolor.txt" #include "actors/shared/sectoraction.txt" -#include "actors/shared/action.txt" +//#include "actors/shared/action.txt" #include "actors/shared/dog.txt" #include "actors/shared/damagetypes.txt" diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index b0d3ec925..9604812aa 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -3,6 +3,12 @@ zscript/actor.txt zscript/shared/inventory.txt zscript/shared/player.txt +zscript/shared/morph.txt +zscript/shared/botstuff.txt +zscript/shared/sharedmisc.txt +zscript/shared/blood.txt +zscript/shared/ice.txt +zscript/shared/debris.txt zscript/shared/specialspot.txt //zscript/test1.txt diff --git a/wadsrc/static/zscript/shared/blood.txt b/wadsrc/static/zscript/shared/blood.txt new file mode 100644 index 000000000..e5f05de05 --- /dev/null +++ b/wadsrc/static/zscript/shared/blood.txt @@ -0,0 +1,78 @@ + +// Blood sprite ------------------------------------------------------------ + +class Blood : Actor +{ + Default + { + Mass 5; + +NOBLOCKMAP + +NOTELEPORT + +ALLOWPARTICLES + } + States + { + Spawn: + BLUD CBA 8; + Stop; + Spray: + SPRY ABCDEF 3; + SPRY G 2; + Stop; + } +} + +// Blood splatter ----------------------------------------------------------- + +class BloodSplatter : Actor +{ + Default + { + Radius 2; + Height 4; + +NOBLOCKMAP + +MISSILE + +DROPOFF + +NOTELEPORT + +CANNOTPUSH + +ALLOWPARTICLES + Mass 5; + } + States + { + Spawn: + BLUD CBA 8; + Stop; + Death: + BLUD A 6; + Stop; + } +} + +// Axe Blood ---------------------------------------------------------------- + +class AxeBlood : Actor +{ + Default + { + Radius 2; + Height 4; + +NOBLOCKMAP + +NOGRAVITY + +DROPOFF + +NOTELEPORT + +CANNOTPUSH + +ALLOWPARTICLES + Mass 5; + } + States + { + Spawn: + FAXE FGHIJ 3; + Death: + FAXE K 3; + Stop; + } +} + + \ No newline at end of file diff --git a/wadsrc/static/zscript/shared/botstuff.txt b/wadsrc/static/zscript/shared/botstuff.txt new file mode 100644 index 000000000..cf671ea8b --- /dev/null +++ b/wadsrc/static/zscript/shared/botstuff.txt @@ -0,0 +1,25 @@ + +class CajunBodyNode : Actor +{ + Default + { + +NOSECTOR + +NOGRAVITY + +INVISIBLE + } +} + +class CajunTrace : Actor +{ + Default + { + Speed 12; + Radius 6; + Height 8; + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOGRAVITY + +NOTELEPORT + } +} diff --git a/wadsrc/static/zscript/shared/debris.txt b/wadsrc/static/zscript/shared/debris.txt new file mode 100644 index 000000000..24eae25be --- /dev/null +++ b/wadsrc/static/zscript/shared/debris.txt @@ -0,0 +1,364 @@ + +// Rocks -------------------------------------------------------------------- + +class Rock1 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK A 20; + Loop; + Death: + ROKK A 10; + Stop; + } +} + +class Rock2 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK B 20; + Loop; + Death: + ROKK B 10; + Stop; + } +} + + +class Rock3 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK C 20; + Loop; + Death: + ROKK C 10; + Stop; + } +} + + +// Dirt -------------------------------------------------------------------- + +class Dirt1 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK D 20; + Loop; + Death: + ROKK D 10; + Stop; + } +} + +class Dirt2 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK E 20; + Loop; + Death: + ROKK E 10; + Stop; + } +} + +class Dirt3 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK F 20; + Loop; + Death: + ROKK F 10; + Stop; + } +} + +class Dirt4 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK G 20; + Loop; + Death: + ROKK G 10; + Stop; + } +} + +class Dirt5 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK H 20; + Loop; + Death: + ROKK H 10; + Stop; + } +} + +class Dirt6 : Actor +{ + Default + { + +NOBLOCKMAP + +DROPOFF + +MISSILE + +NOTELEPORT + } + States + { + Spawn: + ROKK I 20; + Loop; + Death: + ROKK I 10; + Stop; + } +} + +// Stained glass ------------------------------------------------------------ + +class GlassShard : Actor native +{ + Default + { + Radius 5; + Mass 5; + Projectile; + -ACTIVATEPCROSS + -ACTIVATEIMPACT + BounceType "HexenCompat"; + BounceFactor 0.3; + } +} + +class SGShard1 : GlassShard +{ + States + { + Spawn: + SGSA ABCDE 4; + Loop; + Death: + SGSA E 30; + Stop; + } +} + +class SGShard2 : GlassShard +{ + States + { + Spawn: + SGSA FGHIJ 4; + Loop; + Death: + SGSA J 30; + Stop; + } +} + +class SGShard3 : GlassShard +{ + States + { + Spawn: + SGSA KLMNO 4; + Loop; + Death: + SGSA O 30; + Stop; + } +} + +class SGShard4 : GlassShard +{ + States + { + Spawn: + SGSA PQRST 4; + Loop; + Death: + SGSA T 30; + Stop; + } +} + +class SGShard5 : GlassShard +{ + States + { + Spawn: + SGSA UVWXY 4; + Loop; + Death: + SGSA Y 30; + Stop; + } +} + +class SGShard6 : GlassShard +{ + States + { + Spawn: + SGSB A 4; + Loop; + Death: + SGSB A 30; + Stop; + } +} + +class SGShard7 : GlassShard +{ + States + { + Spawn: + SGSB B 4; + Loop; + Death: + SGSB B 30; + Stop; + } +} + +class SGShard8 : GlassShard +{ + States + { + Spawn: + SGSB C 4; + Loop; + Death: + SGSB C 30; + Stop; + } +} + +class SGShard9 : GlassShard +{ + States + { + Spawn: + SGSB D 4; + Loop; + Death: + SGSB D 30; + Stop; + } +} + +class SGShard0 : GlassShard +{ + States + { + Spawn: + SGSB E 4; + Loop; + Death: + SGSB E 30; + Stop; + } +} + +class GlassJunk : Actor +{ + Default + { + +NOCLIP + +NOBLOCKMAP + RenderStyle "Translucent"; + Alpha 0.4; + Health 3; // Number of different shards + } + States + { + // Are the first three frames used anywhere? + SHAR A 128; + Goto Death; + SHAR B 128; + Goto Death; + SHAR C 128; + Goto Death; + Spawn: + SHAR D 128; + Goto Death; + SHAR E 128; + Goto Death; + SHAR F 128; + Goto Death; + Death: + "----" A 1 A_FadeOut(0.03); + Wait; + } +} diff --git a/wadsrc/static/zscript/shared/ice.txt b/wadsrc/static/zscript/shared/ice.txt new file mode 100644 index 000000000..9668466cb --- /dev/null +++ b/wadsrc/static/zscript/shared/ice.txt @@ -0,0 +1,61 @@ + + +//========================================================================== +// +// Ice chunk +// +//========================================================================== + +class IceChunk : Actor +{ + Default + { + Radius 3; + Height 4; + Mass 5; + Gravity 0.125; + +DROPOFF + +CANNOTPUSH + +FLOORCLIP + +NOTELEPORT + +NOBLOCKMAP + +MOVEWITHSECTOR + } + action native void A_IceSetTics (); + + States + { + Spawn: + ICEC A 1; + ICEC ABCD 10 A_IceSetTics; + Stop; + } +} + +//========================================================================== +// +// A chunk of ice that is also a player +// +//========================================================================== + +class IceChunkHead : PlayerChunk +{ + Default + { + Radius 3; + Height 4; + Mass 5; + Gravity 0.125; + DamageType "Ice"; + +DROPOFF + +CANNOTPUSH + } + States + { + Spawn: + ICEC A 0; + ICEC A 10 A_CheckPlayerDone; + wait; + } +} + diff --git a/wadsrc/static/zscript/shared/morph.txt b/wadsrc/static/zscript/shared/morph.txt new file mode 100644 index 000000000..ff58d897b --- /dev/null +++ b/wadsrc/static/zscript/shared/morph.txt @@ -0,0 +1,21 @@ +class MorphProjectile : Actor native +{ + Default + { + Damage 1; + Projectile; + -ACTIVATEIMPACT + -ACTIVATEPCROSS + } +} + +class MorphedMonster : Actor native +{ + Default + { + Monster; + -COUNTKILL + +FLOORCLIP + } +} + diff --git a/wadsrc/static/zscript/shared/sharedmisc.txt b/wadsrc/static/zscript/shared/sharedmisc.txt new file mode 100644 index 000000000..bebf28549 --- /dev/null +++ b/wadsrc/static/zscript/shared/sharedmisc.txt @@ -0,0 +1,220 @@ + +// Default class for unregistered doomednums ------------------------------- + +class Unknown : Actor +{ + Default + { + Radius 32; + Height 56; + +NOGRAVITY + +NOBLOCKMAP + +DONTSPLASH + } + States + { + Spawn: + UNKN A -1; + Stop; + } +} + +// Route node for monster patrols ------------------------------------------- + +class PatrolPoint : Actor +{ + Default + { + Radius 8; + Height 8; + Mass 10; + +NOGRAVITY + +NOBLOCKMAP + +DONTSPLASH + RenderStyle "None"; + } +} + +// A special to execute when a monster reaches a matching patrol point ------ + +class PatrolSpecial : Actor +{ + Default + { + Radius 8; + Height 8; + Mass 10; + +NOGRAVITY + +NOBLOCKMAP + +DONTSPLASH + RenderStyle "None"; + } +} + +// Map spot ---------------------------------------------------------------- + +class MapSpot : Actor +{ + Default + { + +NOBLOCKMAP + +NOSECTOR + +NOGRAVITY + +DONTSPLASH + RenderStyle "None"; + CameraHeight 0; + } +} + +// same with different editor number for Legacy maps ----------------------- + +class FS_Mapspot : Mapspot +{ +} + +// Map spot with gravity --------------------------------------------------- + +class MapSpotGravity : MapSpot +{ + Default + { + -NOBLOCKMAP + -NOSECTOR + -NOGRAVITY + } +} + +// Point Pushers ----------------------------------------------------------- + +class PointPusher : Actor +{ + Default + { + +NOBLOCKMAP + +INVISIBLE + +NOCLIP + } +} + +class PointPuller : Actor +{ + Default + { + +NOBLOCKMAP + +INVISIBLE + +NOCLIP + } +} + +// Bloody gibs ------------------------------------------------------------- + +class RealGibs : Actor +{ + Default + { + +DROPOFF + +CORPSE + +NOTELEPORT + +DONTGIB + } + States + { + Spawn: + goto GenericCrush; + } +} + +// Gibs that can be placed on a map. --------------------------------------- +// +// These need to be a separate class from the above, in case someone uses +// a deh patch to change the gibs, since ZDoom actually creates a gib class +// for actors that get crushed instead of changing their state as Doom did. + +class Gibs : RealGibs +{ + Default + { + ClearFlags; + } +} + +// Needed for loading Build maps ------------------------------------------- + +class CustomSprite : Actor native +{ + Default + { + +NOBLOCKMAP + +NOGRAVITY + } + States + { + Spawn: + TNT1 A -1; + Stop; + } +} + +// SwitchableDecoration: Activate and Deactivate change state -------------- + +class SwitchableDecoration : Actor native +{ +} + + +class SwitchingDecoration : SwitchableDecoration native +{ +} + +// Random spawner ---------------------------------------------------------- + +class RandomSpawner : Actor native +{ + Default + { + +NOBLOCKMAP + +NOSECTOR + +NOGRAVITY + +THRUACTORS + } +} + +// Fast projectiles -------------------------------------------------------- + +class FastProjectile : Actor native +{ + Default + { + Projectile; + MissileHeight 0; + } +} + +// Sector flag setter ------------------------------------------------------ + +class SectorFlagSetter : Actor native +{ + Default + { + +NOBLOCKMAP + +NOGRAVITY + +DONTSPLASH + RenderStyle "None"; + } +} + +// Marker for sounds : Actor ------------------------------------------------------- + +class SpeakerIcon : Unknown +{ + States + { + Spawn: + SPKR A -1 BRIGHT; + Stop; + } + Default + { + Scale 0.125; + } +}