From ee69e7bf03b977ad19baa4557f7240076bc75f9a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 19 Mar 2008 12:48:02 +0000 Subject: [PATCH] - Removed thingdef_specials.h and thingdef_specials.gperf and replaced line special definition with something that automatically gets updated if new specials are added. SVN r814 (trunk) --- docs/rh-log.txt | 3 + src/actionspecials.h | 223 +++++++++++++++++++++ src/g_level.cpp | 17 +- src/p_lnspec.cpp | 61 ++++++ src/p_lnspec.h | 283 +-------------------------- src/thingdef/thingdef.h | 4 - src/thingdef/thingdef_exp.cpp | 5 +- src/thingdef/thingdef_specials.gperf | 180 ----------------- src/thingdef/thingdef_states.cpp | 57 +----- thingdef_specials.gperf | 180 ----------------- zdoom.vcproj | 8 +- 11 files changed, 321 insertions(+), 700 deletions(-) create mode 100644 src/actionspecials.h delete mode 100644 src/thingdef/thingdef_specials.gperf delete mode 100644 thingdef_specials.gperf diff --git a/docs/rh-log.txt b/docs/rh-log.txt index e1a3574c9..a3bb078a4 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ March 19, 2008 (Changes by Graf Zahl) +- Removed thingdef_specials.h and thingdef_specials.gperf and replaced + line special definition with something that automatically gets updated + if new specials are added. - Added copyright/license headers to a few files. - Fixed: ACS SetMugShotState needs to check the StatusBar pointer for the proper object type. diff --git a/src/actionspecials.h b/src/actionspecials.h new file mode 100644 index 000000000..a2bd0e0bb --- /dev/null +++ b/src/actionspecials.h @@ -0,0 +1,223 @@ +DEFINE_SPECIAL(Polyobj_StartLine, 1, -1, -1) +DEFINE_SPECIAL(Polyobj_RotateLeft, 2, 3, 3) +DEFINE_SPECIAL(Polyobj_RotateRight, 3, 3, 3) +DEFINE_SPECIAL(Polyobj_Move, 4, 4, 4) +DEFINE_SPECIAL(Polyobj_ExplicitLine, 5, -1, -1) +DEFINE_SPECIAL(Polyobj_MoveTimes8, 6, 4, 4) +DEFINE_SPECIAL(Polyobj_DoorSwing, 7, 4, 4) +DEFINE_SPECIAL(Polyobj_DoorSlide, 8, 5, 5) +DEFINE_SPECIAL(Line_Horizon, 9, -1, 0) // [RH] draw one-sided wall at horizon +DEFINE_SPECIAL(Door_Close, 10, 2, 2) +DEFINE_SPECIAL(Door_Open, 11, 2, 3) +DEFINE_SPECIAL(Door_Raise, 12, 3, 4) +DEFINE_SPECIAL(Door_LockedRaise, 13, 4, 5) +DEFINE_SPECIAL(Door_Animated, 14, 3, 3) +DEFINE_SPECIAL(Autosave, 15, 0, 0) // [RH] Save the game *now* +DEFINE_SPECIAL(Transfer_WallLight, 16, -1, -1) +DEFINE_SPECIAL(Thing_Raise, 17, 1, 1) +DEFINE_SPECIAL(StartConversation, 18, 1, 2) +DEFINE_SPECIAL(Thing_Stop, 19, 1, 1) +DEFINE_SPECIAL(Floor_LowerByValue, 20, 3, 3) +DEFINE_SPECIAL(Floor_LowerToLowest, 21, 2, 2) +DEFINE_SPECIAL(Floor_LowerToNearest, 22, 3, 3) +DEFINE_SPECIAL(Floor_RaiseByValue, 23, 3, 3) +DEFINE_SPECIAL(Floor_RaiseToHighest, 24, 2, 2) +DEFINE_SPECIAL(Floor_RaiseToNearest, 25, 2, 2) +DEFINE_SPECIAL(Stairs_BuildDown, 26, 5, 5) +DEFINE_SPECIAL(Stairs_BuildUp, 27, 5, 5) +DEFINE_SPECIAL(Floor_RaiseAndCrush, 28, 3, 3) +DEFINE_SPECIAL(Pillar_Build, 29, 3, 3) +DEFINE_SPECIAL(Pillar_Open, 30, 4, 4) +DEFINE_SPECIAL(Stairs_BuildDownSync, 31, 4, 4) +DEFINE_SPECIAL(Stairs_BuildUpSync, 32, 4, 4) +DEFINE_SPECIAL(ForceField, 33, 0, 0) // [RH] Strife's forcefield special (148) +DEFINE_SPECIAL(ClearForceField, 34, 1, 1) // [RH] Remove Strife's forcefield from tagged sectors +DEFINE_SPECIAL(Floor_RaiseByValueTimes8, 35, 3, 3) +DEFINE_SPECIAL(Floor_LowerByValueTimes8, 36, 3, 3) +DEFINE_SPECIAL(Floor_MoveToValue, 37, 3, 4) +DEFINE_SPECIAL(Ceiling_Waggle, 38, 5, 5) // [RH] Complement of Floor_Waggle +DEFINE_SPECIAL(Teleport_ZombieChanger, 39, 2, 2) // [RH] Needed for Strife +DEFINE_SPECIAL(Ceiling_LowerByValue, 40, 3, 3) +DEFINE_SPECIAL(Ceiling_RaiseByValue, 41, 3, 3) +DEFINE_SPECIAL(Ceiling_CrushAndRaise, 42, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerAndCrush, 43, 3, 3) +DEFINE_SPECIAL(Ceiling_CrushStop, 44, 1, 1) +DEFINE_SPECIAL(Ceiling_CrushRaiseAndStay, 45, 3, 3) +DEFINE_SPECIAL(Floor_CrushStop, 46, 1, 1) +DEFINE_SPECIAL(Ceiling_MoveToValue, 47, 3, 4) +DEFINE_SPECIAL(Sector_Attach3dMidtex, 48, -1, -1) +DEFINE_SPECIAL(GlassBreak, 49, 0, 1) +DEFINE_SPECIAL(ExtraFloor_LightOnly, 50, -1, -1) + +DEFINE_SPECIAL(Plat_PerpetualRaise, 60, 3, 3) +DEFINE_SPECIAL(Plat_Stop, 61, 1, 1) +DEFINE_SPECIAL(Plat_DownWaitUpStay, 62, 3, 3) +DEFINE_SPECIAL(Plat_DownByValue, 63, 4, 4) +DEFINE_SPECIAL(Plat_UpWaitDownStay, 64, 3, 3) +DEFINE_SPECIAL(Plat_UpByValue, 65, 4, 4) +DEFINE_SPECIAL(Floor_LowerInstant, 66, 3, 3) +DEFINE_SPECIAL(Floor_RaiseInstant, 67, 3, 3) +DEFINE_SPECIAL(Floor_MoveToValueTimes8, 68, 4, 4) +DEFINE_SPECIAL(Ceiling_MoveToValueTimes8, 69, 4, 4) +DEFINE_SPECIAL(Teleport, 70, 1, 3) +DEFINE_SPECIAL(Teleport_NoFog, 71, 1, 3) +DEFINE_SPECIAL(ThrustThing, 72, 2, 4) +DEFINE_SPECIAL(DamageThing, 73, 1, 1) +DEFINE_SPECIAL(Teleport_NewMap, 74, 2, 3) +DEFINE_SPECIAL(Teleport_EndGame, 75, 0, 0) +DEFINE_SPECIAL(TeleportOther, 76, 3, 3) +DEFINE_SPECIAL(TeleportGroup, 77, 5, 5) +DEFINE_SPECIAL(TeleportInSector, 78, 4, 5) + +DEFINE_SPECIAL(ACS_Execute, 80, 2, 5) +DEFINE_SPECIAL(ACS_Suspend, 81, 2, 2) +DEFINE_SPECIAL(ACS_Terminate, 82, 2, 2) +DEFINE_SPECIAL(ACS_LockedExecute, 83, 5, 5) +DEFINE_SPECIAL(ACS_ExecuteWithResult, 84, 1, 4) +DEFINE_SPECIAL(ACS_LockedExecuteDoor, 85, 5, 5) + +DEFINE_SPECIAL(Polyobj_OR_RotateLeft, 90, 3, 3) +DEFINE_SPECIAL(Polyobj_OR_RotateRight, 91, 3, 3) +DEFINE_SPECIAL(Polyobj_OR_Move, 92, 4, 4) +DEFINE_SPECIAL(Polyobj_OR_MoveTimes8, 93, 4, 4) +DEFINE_SPECIAL(Pillar_BuildAndCrush, 94, 4, 4) +DEFINE_SPECIAL(FloorAndCeiling_LowerByValue, 95, 3, 3) +DEFINE_SPECIAL(FloorAndCeiling_RaiseByValue, 96, 3, 3) + +DEFINE_SPECIAL(Scroll_Texture_Left, 100, -1, -1) +DEFINE_SPECIAL(Scroll_Texture_Right, 101, -1, -1) +DEFINE_SPECIAL(Scroll_Texture_Up, 102, -1, -1) +DEFINE_SPECIAL(Scroll_Texture_Down, 103, -1, -1) + +DEFINE_SPECIAL(Light_ForceLightning, 109, 1, 1) +DEFINE_SPECIAL(Light_RaiseByValue, 110, 2, 2) +DEFINE_SPECIAL(Light_LowerByValue, 111, 2, 2) +DEFINE_SPECIAL(Light_ChangeToValue, 112, 2, 2) +DEFINE_SPECIAL(Light_Fade, 113, 3, 3) +DEFINE_SPECIAL(Light_Glow, 114, 4, 4) +DEFINE_SPECIAL(Light_Flicker, 115, 3, 3) +DEFINE_SPECIAL(Light_Strobe, 116, 5, 5) +DEFINE_SPECIAL(Light_Stop, 117, 1, 1) + +DEFINE_SPECIAL(Thing_Damage, 119, 2, 3) +DEFINE_SPECIAL(Radius_Quake, 120, 5, 5) // Earthquake +DEFINE_SPECIAL(Line_SetIdentification, 121, -1, -1) + +#if 0 // Skull Tag specials that might be added later +Thing_SetGravity, 122, -1, -1) +Thing_ReverseGravity, 123, -1, -1) +Thing_RevertGravity, 124, -1, -1) +#endif +DEFINE_SPECIAL(Thing_Move, 125, 2, 3) +#if 0 // Skull Tag special I doubt I will add +Thing_SetSprite, 126, -1, -1) +#endif +DEFINE_SPECIAL(Thing_SetSpecial, 127, 5, 5) +DEFINE_SPECIAL(ThrustThingZ, 128, 4, 4) +DEFINE_SPECIAL(UsePuzzleItem, 129, 1, 1) +DEFINE_SPECIAL(Thing_Activate, 130, 1, 1) +DEFINE_SPECIAL(Thing_Deactivate, 131, 1, 1) +DEFINE_SPECIAL(Thing_Remove, 132, 1, 1) +DEFINE_SPECIAL(Thing_Destroy, 133, 1, 2) +DEFINE_SPECIAL(Thing_Projectile, 134, 5, 5) +DEFINE_SPECIAL(Thing_Spawn, 135, 3, 4) +DEFINE_SPECIAL(Thing_ProjectileGravity, 136, 5, 5) +DEFINE_SPECIAL(Thing_SpawnNoFog, 137, 3, 4) +DEFINE_SPECIAL(Floor_Waggle, 138, 5, 5) +DEFINE_SPECIAL(Thing_SpawnFacing, 139, 2, 4) +DEFINE_SPECIAL(Sector_ChangeSound, 140, 2, 2) + +// GZDoom/Vavoom specials (put here so that they don't get accidentally redefined) +DEFINE_SPECIAL(Sector_SetPlaneReflection, 159, 3, 3) +DEFINE_SPECIAL(Sector_Set3DFloor, 160, -1, -1) +DEFINE_SPECIAL(Sector_SetContents, 161, -1, -1) + +// [RH] Begin new specials for ZDoom +DEFINE_SPECIAL(Sector_SetCeilingScale2, 170, 3, 3) +DEFINE_SPECIAL(Sector_SetFloorScale2, 171, 3, 3) +DEFINE_SPECIAL(Plat_UpNearestWaitDownStay, 172, 3, 3) +DEFINE_SPECIAL(NoiseAlert, 173, 2, 2) +DEFINE_SPECIAL(SendToCommunicator, 174, 4, 4) +DEFINE_SPECIAL(Thing_ProjectileIntercept, 175, 5, 5) +DEFINE_SPECIAL(Thing_ChangeTID, 176, 2, 2) +DEFINE_SPECIAL(Thing_Hate, 177, 2, 3) +DEFINE_SPECIAL(Thing_ProjectileAimed, 178, 4, 5) +DEFINE_SPECIAL(ChangeSkill, 179, 1, 1) +DEFINE_SPECIAL(Thing_SetTranslation, 180, 2, 2) +DEFINE_SPECIAL(Plane_Align, 181, -1, -1) +DEFINE_SPECIAL(Line_Mirror, 182, -1, 0) +DEFINE_SPECIAL(Line_AlignCeiling, 183, 2, 2) +DEFINE_SPECIAL(Line_AlignFloor, 184, 2, 2) +DEFINE_SPECIAL(Sector_SetRotation, 185, 3, 3) +DEFINE_SPECIAL(Sector_SetCeilingPanning, 186, 5, 5) +DEFINE_SPECIAL(Sector_SetFloorPanning, 187, 5, 5) +DEFINE_SPECIAL(Sector_SetCeilingScale, 188, 5, 5) +DEFINE_SPECIAL(Sector_SetFloorScale, 189, 5, 5) +DEFINE_SPECIAL(Static_Init, 190, -1, -1) +DEFINE_SPECIAL(SetPlayerProperty, 191, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerToHighestFloor, 192, 2, 2) +DEFINE_SPECIAL(Ceiling_LowerInstant, 193, 3, 3) +DEFINE_SPECIAL(Ceiling_RaiseInstant, 194, 3, 3) +DEFINE_SPECIAL(Ceiling_CrushRaiseAndStayA, 195, 4, 4) +DEFINE_SPECIAL(Ceiling_CrushAndRaiseA, 196, 4, 4) +DEFINE_SPECIAL(Ceiling_CrushAndRaiseSilentA, 197, 4, 4) +DEFINE_SPECIAL(Ceiling_RaiseByValueTimes8, 198, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerByValueTimes8, 199, 3, 3) +DEFINE_SPECIAL(Generic_Floor, 200, 5, 5) +DEFINE_SPECIAL(Generic_Ceiling, 201, 5, 5) +DEFINE_SPECIAL(Generic_Door, 202, 5, 5) +DEFINE_SPECIAL(Generic_Lift, 203, 5, 5) +DEFINE_SPECIAL(Generic_Stairs, 204, 5, 5) +DEFINE_SPECIAL(Generic_Crusher, 205, 5, 5) +DEFINE_SPECIAL(Plat_DownWaitUpStayLip, 206, 4, 5) +DEFINE_SPECIAL(Plat_PerpetualRaiseLip, 207, 4, 4) +DEFINE_SPECIAL(TranslucentLine, 208, 2, 3) +DEFINE_SPECIAL(Transfer_Heights, 209, -1, -1) +DEFINE_SPECIAL(Transfer_FloorLight, 210, -1, -1) +DEFINE_SPECIAL(Transfer_CeilingLight, 211, -1, -1) +DEFINE_SPECIAL(Sector_SetColor, 212, 4, 5) +DEFINE_SPECIAL(Sector_SetFade, 213, 4, 4) +DEFINE_SPECIAL(Sector_SetDamage, 214, 3, 3) +DEFINE_SPECIAL(Teleport_Line, 215, 2, 2) +DEFINE_SPECIAL(Sector_SetGravity, 216, 3, 3) +DEFINE_SPECIAL(Stairs_BuildUpDoom, 217, 5, 5) +DEFINE_SPECIAL(Sector_SetWind, 218, 4, 4) +DEFINE_SPECIAL(Sector_SetFriction, 219, 2, 2) +DEFINE_SPECIAL(Sector_SetCurrent, 220, 4, 4) +DEFINE_SPECIAL(Scroll_Texture_Both, 221, 5, 5) +DEFINE_SPECIAL(Scroll_Texture_Model, 222, -1, -1) +DEFINE_SPECIAL(Scroll_Floor, 223, 4, 4) +DEFINE_SPECIAL(Scroll_Ceiling, 224, 4, 4) +DEFINE_SPECIAL(Scroll_Texture_Offsets, 225, -1, -1) +DEFINE_SPECIAL(ACS_ExecuteAlways, 226, 2, 5) +DEFINE_SPECIAL(PointPush_SetForce, 227, -1, -1) +DEFINE_SPECIAL(Plat_RaiseAndStayTx0, 228, 2, 2) +DEFINE_SPECIAL(Thing_SetGoal, 229, 3, 4) +DEFINE_SPECIAL(Plat_UpByValueStayTx, 230, 3, 3) +DEFINE_SPECIAL(Plat_ToggleCeiling, 231, 1, 1) +DEFINE_SPECIAL(Light_StrobeDoom, 232, 3, 3) +DEFINE_SPECIAL(Light_MinNeighbor, 233, 1, 1) +DEFINE_SPECIAL(Light_MaxNeighbor, 234, 1, 1) +DEFINE_SPECIAL(Floor_TransferTrigger, 235, 1, 1) +DEFINE_SPECIAL(Floor_TransferNumeric, 236, 1, 1) +DEFINE_SPECIAL(ChangeCamera, 237, 3, 3) +DEFINE_SPECIAL(Floor_RaiseToLowestCeiling, 238, 2, 2) +DEFINE_SPECIAL(Floor_RaiseByValueTxTy, 239, 3, 3) +DEFINE_SPECIAL(Floor_RaiseByTexture, 240, 2, 2) +DEFINE_SPECIAL(Floor_LowerToLowestTxTy, 241, 2, 2) +DEFINE_SPECIAL(Floor_LowerToHighest, 242, 3, 3) +DEFINE_SPECIAL(Exit_Normal, 243, 1, 1) +DEFINE_SPECIAL(Exit_Secret, 244, 1, 1) +DEFINE_SPECIAL(Elevator_RaiseToNearest, 245, 2, 2) +DEFINE_SPECIAL(Elevator_MoveToFloor, 246, 2, 2) +DEFINE_SPECIAL(Elevator_LowerToNearest, 247, 2, 2) +DEFINE_SPECIAL(HealThing, 248, 1, 2) +DEFINE_SPECIAL(Door_CloseWaitOpen, 249, 3, 4) +DEFINE_SPECIAL(Floor_Donut, 250, 3, 3) +DEFINE_SPECIAL(FloorAndCeiling_LowerRaise, 251, 3, 3) +DEFINE_SPECIAL(Ceiling_RaiseToNearest, 252, 2, 2) +DEFINE_SPECIAL(Ceiling_LowerToLowest, 253, 2, 2) +DEFINE_SPECIAL(Ceiling_LowerToFloor, 254, 2, 2) +DEFINE_SPECIAL(Ceiling_CrushRaiseAndStaySilA, 255, 4, 4) + +#undef DEFINE_SPECIAL diff --git a/src/g_level.cpp b/src/g_level.cpp index a6a6a8b04..37e4f54de 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -74,6 +74,7 @@ #include "vectors.h" #include "sbarinfo.h" #include "r_translate.h" +#include "p_lnspec.h" #include "gi.h" @@ -1098,10 +1099,9 @@ static void ParseMapInfoLower (FScanner &sc, case MITYPE_SPECIALACTION: { - int FindLineSpecial(const char *str); - FSpecialAction **so = (FSpecialAction**)(info + handler->data1); FSpecialAction *sa = new FSpecialAction; + int min_arg, max_arg; sa->Next = *so; *so = sa; sc.SetCMode(true); @@ -1109,14 +1109,23 @@ static void ParseMapInfoLower (FScanner &sc, sa->Type = FName(sc.String); sc.CheckString(","); sc.MustGetString(); - strlwr(sc.String); - sa->Action = FindLineSpecial(sc.String); + sa->Action = P_FindLineSpecial(sc.String, &min_arg, &max_arg); + if (sa->Action == 0 || min_arg < 0) + { + sc.ScriptError("Unknown specialaction '%s'"); + } int j = 0; while (j < 5 && sc.CheckString(",")) { sc.MustGetNumber(); sa->Args[j++] = sc.Number; } + /* + if (jmax) + { + // Should be an error but can't for compatibility. + } + */ sc.SetCMode(false); } break; diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index 318ef3306..c43e00b78 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -3040,3 +3040,64 @@ lnSpecFunc LineSpecials[256] = LS_Ceiling_LowerToFloor, LS_Ceiling_CrushRaiseAndStaySilA }; + +struct FLineSpecial +{ + const char *name; + BYTE number; + BYTE min_args; + SBYTE max_args; +}; + +#define DEFINE_SPECIAL(name, num, min, max) {#name, num, min, max}, +static FLineSpecial LineSpecialNames[]={ +#include "actionspecials.h" +}; + +//========================================================================== +// +// P_FindLineSpecial +// +// Finds a line special and also returns the min and max argument count. +// +//========================================================================== +static int STACK_ARGS lscmp (const void * a, const void * b) +{ + return stricmp( ((FLineSpecial*)a)->name, ((FLineSpecial*)b)->name); +} + + +int P_FindLineSpecial (const char *string, int *min_args, int *max_args) +{ + static bool sorted=false; + + if (!sorted) + { + qsort(LineSpecialNames, countof(LineSpecialNames), sizeof(FLineSpecial), lscmp); + sorted = true; + } + + int min = 0, max = countof(LineSpecialNames) - 1; + + while (min <= max) + { + int mid = (min + max) / 2; + int lexval = stricmp (string, LineSpecialNames[mid].name); + if (lexval == 0) + { + if (min_args != NULL) *min_args = LineSpecialNames[mid].min_args; + if (max_args != NULL) *max_args = LineSpecialNames[mid].max_args; + return LineSpecialNames[mid].number; + } + else if (lexval > 0) + { + min = mid + 1; + } + else + { + max = mid - 1; + } + } + return 0; +} + diff --git a/src/p_lnspec.h b/src/p_lnspec.h index 0f0d3f234..75f1a169b 100644 --- a/src/p_lnspec.h +++ b/src/p_lnspec.h @@ -37,285 +37,10 @@ #include "doomtype.h" +#define DEFINE_SPECIAL(name, num, min, max) name = num, + typedef enum { - Polyobj_StartLine = 1, - Polyobj_RotateLeft = 2, - Polyobj_RotateRight = 3, - Polyobj_Move = 4, - Polyobj_ExplicitLine = 5, - Polyobj_MoveTimes8 = 6, - Polyobj_DoorSwing = 7, - Polyobj_DoorSlide = 8, - - Line_Horizon = 9, // [RH] draw one-sided wall at horizon - - Door_Close = 10, - Door_Open = 11, - Door_Raise = 12, - Door_LockedRaise = 13, - Door_Animated = 14, - - Autosave = 15, // [RH] Save the game *now* - Transfer_WallLight = 16, - Thing_Raise = 17, - StartConversation = 18, - Thing_Stop = 19, - - Floor_LowerByValue = 20, - Floor_LowerToLowest = 21, - Floor_LowerToNearest = 22, - Floor_RaiseByValue = 23, - Floor_RaiseToHighest = 24, - Floor_RaiseToNearest = 25, - - Stairs_BuildDown = 26, - Stairs_BuildUp = 27, - - Floor_RaiseAndCrush = 28, - - Pillar_Build = 29, - Pillar_Open = 30, - - Stairs_BuildDownSync = 31, - Stairs_BuildUpSync = 32, - - ForceField = 33, // [RH] Strife's forcefield special (148) - ClearForceField = 34, // [RH] Remove Strife's forcefield from tagged sectors - - Floor_RaiseByValueTimes8 = 35, - Floor_LowerByValueTimes8 = 36, - Floor_MoveToValue = 37, - - Ceiling_Waggle = 38, // [RH] Complement of Floor_Waggle - Teleport_ZombieChanger = 39, // [RH] Needed for Strife - - Ceiling_LowerByValue = 40, - Ceiling_RaiseByValue = 41, - Ceiling_CrushAndRaise = 42, - Ceiling_LowerAndCrush = 43, - Ceiling_CrushStop = 44, - Ceiling_CrushRaiseAndStay = 45, - - Floor_CrushStop = 46, - Ceiling_MoveToValue = 47, - Sector_Attach3dMidtex = 48, - - GlassBreak = 49, - ExtraFloor_LightOnly = 50, - - Plat_PerpetualRaise = 60, - Plat_Stop = 61, - Plat_DownWaitUpStay = 62, - Plat_DownByValue = 63, - Plat_UpWaitDownStay = 64, - Plat_UpByValue = 65, - - Floor_LowerInstant = 66, - Floor_RaiseInstant = 67, - Floor_MoveToValueTimes8 = 68, - - Ceiling_MoveToValueTimes8 = 69, - - Teleport = 70, - Teleport_NoFog = 71, - - ThrustThing = 72, - DamageThing = 73, - - Teleport_NewMap = 74, - Teleport_EndGame = 75, - TeleportOther = 76, - TeleportGroup = 77, - TeleportInSector = 78, - - ACS_Execute = 80, - ACS_Suspend = 81, - ACS_Terminate = 82, - ACS_LockedExecute = 83, - ACS_ExecuteWithResult = 84, - ACS_LockedExecuteDoor = 85, - - Polyobj_OR_RotateLeft = 90, - Polyobj_OR_RotateRight = 91, - Polyobj_OR_Move = 92, - Polyobj_OR_MoveTimes8 = 93, - - Pillar_BuildAndCrush = 94, - - FloorAndCeiling_LowerByValue = 95, - FloorAndCeiling_RaiseByValue = 96, - - Scroll_Texture_Left = 100, - Scroll_Texture_Right = 101, - Scroll_Texture_Up = 102, - Scroll_Texture_Down = 103, - - Light_ForceLightning = 109, - Light_RaiseByValue = 110, - Light_LowerByValue = 111, - Light_ChangeToValue = 112, - Light_Fade = 113, - Light_Glow = 114, - Light_Flicker = 115, - Light_Strobe = 116, - Light_Stop = 117, - - Thing_Damage = 119, - - Radius_Quake = 120, // Earthquake - - Line_SetIdentification = 121, -#if 0 // Skull Tag specials that might be added later - Thing_SetGravity = 122, - Thing_ReverseGravity = 123, - Thing_RevertGravity = 124, -#endif - Thing_Move = 125, -#if 0 // Skull Tag special I doubt I will add - Thing_SetSprite = 126, -#endif - Thing_SetSpecial = 127, - ThrustThingZ = 128, - - UsePuzzleItem = 129, - - Thing_Activate = 130, - Thing_Deactivate = 131, - Thing_Remove = 132, - Thing_Destroy = 133, - Thing_Projectile = 134, - Thing_Spawn = 135, - Thing_ProjectileGravity = 136, - Thing_SpawnNoFog = 137, - - Floor_Waggle = 138, - - Thing_SpawnFacing = 139, - - Sector_ChangeSound = 140, - - // GZDoom/Vavoom specials (put here so that they don't get accidentally redefined) - Sector_SetPlaneReflection = 159, - Sector_Set3DFloor = 160, - Sector_SetContents = 161, - -// [RH] Begin new specials for ZDoom - Sector_SetCeilingScale2 = 170, - Sector_SetFloorScale2 = 171, - - Plat_UpNearestWaitDownStay = 172, - NoiseAlert = 173, - SendToCommunicator = 174, - Thing_ProjectileIntercept = 175, - Thing_ChangeTID = 176, - Thing_Hate = 177, - Thing_ProjectileAimed = 178, - ChangeSkill = 179, - Thing_SetTranslation = 180, - Plane_Align = 181, - - Line_Mirror = 182, - Line_AlignCeiling = 183, - Line_AlignFloor = 184, - - Sector_SetRotation = 185, - Sector_SetCeilingOffset = 186, - Sector_SetFloorOffset = 187, - Sector_SetCeilingScale = 188, - Sector_SetFloorScale = 189, - - Static_Init = 190, - - SetPlayerProperty = 191, - - Ceiling_LowerToHighestFloor = 192, - Ceiling_LowerInstant = 193, - Ceiling_RaiseInstant = 194, - Ceiling_CrushRaiseAndStayA = 195, - Ceiling_CrushAndRaiseA = 196, - Ceiling_CrushAndRaiseSilentA = 197, - Ceiling_RaiseByValueTimes8 = 198, - Ceiling_LowerByValueTimes8 = 199, - - Generic_Floor = 200, - Generic_Ceiling = 201, - Generic_Door = 202, - Generic_Lift = 203, - Generic_Stairs = 204, - Generic_Crusher = 205, - - Plat_DownWaitUpStayLip = 206, - Plat_PerpetualRaiseLip = 207, - - TranslucentLine = 208, - Transfer_Heights = 209, - Transfer_FloorLight = 210, - Transfer_CeilingLight = 211, - - Sector_SetColor = 212, - Sector_SetFade = 213, - Sector_SetDamage = 214, - - Teleport_Line = 215, - - Sector_SetGravity = 216, - - Stairs_BuildUpDoom = 217, - - Sector_SetWind = 218, - Sector_SetFriction = 219, - Sector_SetCurrent = 220, - - Scroll_Texture_Both = 221, - Scroll_Texture_Model = 222, - Scroll_Floor = 223, - Scroll_Ceiling = 224, - Scroll_Texture_Offsets = 225, - - ACS_ExecuteAlways = 226, - - PointPush_SetForce = 227, - - Plat_RaiseAndStayTx0 = 228, - - Thing_SetGoal = 229, - - Plat_UpByValueStayTx = 230, - Plat_ToggleCeiling = 231, - - Light_StrobeDoom = 232, - Light_MinNeighbor = 233, - Light_MaxNeighbor = 234, - - Floor_TransferTrigger = 235, - Floor_TransferNumeric = 236, - - ChangeCamera = 237, - - Floor_RaiseToLowestCeiling = 238, - Floor_RaiseByValueTxTy = 239, - Floor_RaiseByTexture = 240, - Floor_LowerToLowestTxTy = 241, - Floor_LowerToHighest = 242, - - Exit_Normal = 243, - Exit_Secret = 244, - - Elevator_RaiseToNearest = 245, - Elevator_MoveToFloor = 246, - Elevator_LowerToNearest = 247, - - HealThing = 248, - Door_CloseWaitOpen = 249, - - Floor_Donut = 250, - - FloorAndCeiling_LowerRaise = 251, - - Ceiling_RaiseToNearest = 252, - Ceiling_LowerToLowest = 253, - Ceiling_LowerToFloor = 254, - Ceiling_CrushRaiseAndStaySilA = 255 +#include "actionspecials.h" } linespecial_t; typedef enum { @@ -445,4 +170,6 @@ typedef int (*lnSpecFunc)(struct line_s *line, extern lnSpecFunc LineSpecials[256]; +int P_FindLineSpecial (const char *string, int *min_args=NULL, int *max_args=NULL); + #endif //__P_LNSPEC_H__ diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 0d78c1483..0da8d7e4f 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -146,10 +146,6 @@ enum }; -// The contents of string must be lowercase (for now, anyway) -int FindLineSpecialEx (const char *string, int *minargs, int *maxargs); - - // Types of old style decorations enum EDefinitionType { diff --git a/src/thingdef/thingdef_exp.cpp b/src/thingdef/thingdef_exp.cpp index 62b6f0337..261962c3a 100644 --- a/src/thingdef/thingdef_exp.cpp +++ b/src/thingdef/thingdef_exp.cpp @@ -806,9 +806,8 @@ static ExpData *ParseExpressionA (FScanner &sc, const PClass *cls) int specnum, min_args, max_args; // Check if this is an action special - strlwr (sc.String); - specnum = FindLineSpecialEx (sc.String, &min_args, &max_args); - if (specnum != 0) + specnum = P_FindLineSpecial (sc.String, &min_args, &max_args); + if (specnum != 0 && min_args >= 0) { int i; diff --git a/src/thingdef/thingdef_specials.gperf b/src/thingdef/thingdef_specials.gperf deleted file mode 100644 index 637c244a9..000000000 --- a/src/thingdef/thingdef_specials.gperf +++ /dev/null @@ -1,180 +0,0 @@ -/* - * This file contains a list of all the ACS specials and their parameter counts. - * It is meant to serve as input for gperf, the GNU perfect hash function generator. - * On Win32 systems, you can obtain gperf from the GnuWin32 project at - * , or you can compile it from source - * using MinGW and MSYS. - * - * gperf -tE -LANSI-C -Hspecialhash -Nis_special -C --null-strings thingdef_specials.gperf > thingdef_specials.h - */ -struct ACSspecials { const char *name; unsigned char Special; unsigned char MinArgs; unsigned char MaxArgs; }; -%% -acs_execute,80,1,5 -acs_suspend,81,2 -acs_terminate,82,2 -acs_lockedexecute,83,5 -ceiling_crushandraise,42,3 -ceiling_crushstop,44,1 -ceiling_lowerandcrush,43,3 -ceiling_lowerbyvalue,40,3 -ceiling_raisebyvalue,41,3 -ceiling_crushraiseandstay,45,3 -ceiling_movetovaluetimes8,69,4 -door_close,10,2 -door_open,11,2 -door_raise,12,3 -door_lockedraise,13,4 -floor_lowerbyvalue,20,3 -floor_lowerbyvaluetimes8,36,3 -floor_lowerinstant,66,3 -floor_movetovaluetimes8,68,4 -floor_lowertolowest,21,2 -floor_lowertonearest,22,2 -floor_raiseandcrush,28,3 -floor_raisebyvalue,23,3 -floor_raisebyvaluetimes8,35,3 -floor_raiseinstant,67,3 -floor_raisetohighest,24,2 -floor_raisetonearest,25,2 -floorandceiling_lowerbyvalue,95,3 -floorandceiling_raisebyvalue,96,3 -floor_crushstop,46,1 -light_forcelightning,109,1 -light_raisebyvalue,110,2 -light_lowerbyvalue,111,2 -light_changetovalue,112,2 -light_fade,113,3 -light_glow,114,4 -light_flicker,115,3 -light_strobe,116,5 -light_stop,117,1 -pillar_build,29,3 -pillar_buildandcrush,94,4 -pillar_open,30,4 -plat_downwaitupstay,62,3 -plat_downbyvalue,63,4 -plat_upwaitdownstay,64,3 -plat_upbyvalue,65,4 -plat_perpetualraise,60,3 -plat_stop,61,1 -polyobj_movetimes8,6,4 -polyobj_move,4,4 -polyobj_rotateleft,2,3 -polyobj_rotateright,3,3 -polyobj_doorswing,7,4 -polyobj_doorslide,8,5 -polyobj_or_movetimes8,93,4 -polyobj_or_move,92,4 -polyobj_or_rotateleft,90,3 -polyobj_or_rotateright,91,3 -radius_quake,120,5 -sector_changesound,140,2 -stairs_builddown,26,5 -stairs_buildup,27,5 -stairs_builddownsync,31,4 -stairs_buildupsync,32,4 -teleport,70,1 -teleport_nofog,71,1,2 -teleport_newmap,74,2 -teleport_endgame,75,0 -thrustthing,72,2,4 -damagething,73,1 -thing_activate,130,1 -thing_deactivate,131,1 -thing_destroy,133,1,2 -thing_projectile,134,5 -thing_projectilegravity,136,5 -thing_remove,132,1 -thing_spawn,135,3,4 -thing_spawnnofog,137,3,4 -floor_waggle,138,5 -ceiling_waggle,38,5 -teleportother,76,3 -teleportgroup,77,5 -teleportinsector,78,4,5 -thing_damage,119,2,3 -thing_move,125,2 -thing_setspecial,127,5 -thrustthingz,128,4 -thing_spawnfacing,139,2,4 -thing_projectileintercept,175,5 -thing_changetid,176,2 -thing_hate,177,2,3 -thing_projectileaimed,178,4,5 -changeskill,179,1 -thing_settranslation,180,2 -line_mirror,182,0 -line_alignceiling,183,2 -line_alignfloor,184,2 -sector_setrotation,185,3 -sector_setceilingpanning,186,5 -sector_setfloorpanning,187,5 -sector_setceilingscale,188,5 -sector_setfloorscale,189,5 -setplayerproperty,191,3 -ceiling_lowertohighestfloor,192,2 -ceiling_lowerinstant,193,3 -ceiling_raiseinstant,194,3 -ceiling_crushraiseandstaya,195,4 -ceiling_crushandraisea,196,4 -ceiling_crushandraisesilenta,197,4 -ceiling_raisebyvaluetimes8,198,3 -ceiling_lowerbyvaluetimes8,199,3 -generic_floor,200,5 -generic_ceiling,201,5 -generic_door,202,5 -generic_lift,203,5 -generic_stairs,204,5 -generic_crusher,205,5 -plat_downwaitupstaylip,206,4 -plat_perpetualraiselip,207,4 -translucentline,208,2,3 -sector_setcolor,212,4,5 -sector_setfade,213,4 -sector_setdamage,214,3 -teleport_line,215,2 -sector_setgravity,216,3 -stairs_buildupdoom,217,5 -sector_setwind,218,4 -sector_setcurrent,220,4 -scroll_texture_both,221,5 -scroll_floor,223,4 -scroll_ceiling,224,4 -acs_executealways,226,1,5 -plat_raiseandstaytx0,228,2 -thing_setgoal,229,3 -plat_upbyvaluestaytx,230,3 -plat_toggleceiling,231,1 -light_strobedoom,232,3 -light_minneighbor,233,1 -light_maxneighbor,234,1 -floor_transfertrigger,235,1 -floor_transfernumeric,236,1 -changecamera,237,3 -floor_raisetolowestceiling,238,2 -floor_raisebyvaluetxty,239,3 -floor_raisebytexture,240,2 -floor_lowertolowesttxty,241,2 -floor_lowertohighest,242,3 -exit_normal,243,1 -exit_secret,244,1 -elevator_raisetonearest,245,2 -elevator_movetofloor,246,2 -elevator_lowertonearest,247,2 -healthing,248,1,2 -door_closewaitopen,249,3 -floor_donut,250,3 -floorandceiling_lowerraise,251,3 -ceiling_raisetonearest,252,2 -ceiling_lowertolowest,253,2 -ceiling_lowertofloor,254,2 -ceiling_crushraiseandstaysila,255,4 -door_animated,14,3 -clearforcefield,34,1 -teleport_zombiechanger,39,2 -acs_executewithresult,84,1,4 -plat_upnearestwaitdownstay,172,3 -noisealert,173,2 -thing_raise,17,1 -startconversation,18,1,2 -acs_lockedexecutedoor,85,5 diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 56127a938..b32da9102 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -66,9 +66,6 @@ TArray JumpParameters; -#include "thingdef_specials.h" - - #define FROM_THINGDEF // Prototype the code pointers #define WEAPON(x) void A_##x(AActor*); @@ -393,43 +390,6 @@ int PrepareStateParameters(FState * state, int numparams) return paramindex; } -//========================================================================== -// -// Returns the index of the given line special -// -//========================================================================== -int FindLineSpecial(const char * string) -{ - const ACSspecials *spec; - - spec = is_special(string, (unsigned int)strlen(string)); - if (spec) return spec->Special; - return 0; -} - -//========================================================================== -// -// FindLineSpecialEx -// -// Like FindLineSpecial, but also returns the min and max argument count. -// -//========================================================================== - -int FindLineSpecialEx (const char *string, int *min_args, int *max_args) -{ - const ACSspecials *spec; - - spec = is_special(string, (unsigned int)strlen(string)); - if (spec != NULL) - { - *min_args = spec->MinArgs; - *max_args = MAX(spec->MinArgs, spec->MaxArgs); - return spec->Special; - } - *min_args = *max_args = 0; - return 0; -} - //========================================================================== // // DoActionSpecials @@ -439,14 +399,17 @@ int FindLineSpecialEx (const char *string, int *min_args, int *max_args) bool DoActionSpecials(FScanner &sc, FState & state, bool multistate, int * statecount, Baggage &bag) { int i; - const ACSspecials *spec; + int min_args, max_args; + FString specname = sc.String; - if ((spec = is_special (sc.String, sc.StringLen)) != NULL) + int special = P_FindLineSpecial(sc.String, &min_args, &max_args); + + if (special > 0 && min_args >= 0) { int paramindex=PrepareStateParameters(&state, 6); - StateParameters[paramindex]=spec->Special; + StateParameters[paramindex]=special; // Make this consistent with all other parameter parsing if (sc.CheckToken('(')) @@ -461,13 +424,13 @@ bool DoActionSpecials(FScanner &sc, FState & state, bool multistate, int * state } else i=0; - if (i < spec->MinArgs) + if (i < min_args) { - sc.ScriptError ("Too few arguments to %s", spec->name); + sc.ScriptError ("Too few arguments to %s", specname.GetChars()); } - if (i > MAX (spec->MinArgs, spec->MaxArgs)) + if (i > max_args) { - sc.ScriptError ("Too many arguments to %s", spec->name); + sc.ScriptError ("Too many arguments to %s", specname.GetChars()); } state.Action = A_CallSpecial; return true; diff --git a/thingdef_specials.gperf b/thingdef_specials.gperf deleted file mode 100644 index 637c244a9..000000000 --- a/thingdef_specials.gperf +++ /dev/null @@ -1,180 +0,0 @@ -/* - * This file contains a list of all the ACS specials and their parameter counts. - * It is meant to serve as input for gperf, the GNU perfect hash function generator. - * On Win32 systems, you can obtain gperf from the GnuWin32 project at - * , or you can compile it from source - * using MinGW and MSYS. - * - * gperf -tE -LANSI-C -Hspecialhash -Nis_special -C --null-strings thingdef_specials.gperf > thingdef_specials.h - */ -struct ACSspecials { const char *name; unsigned char Special; unsigned char MinArgs; unsigned char MaxArgs; }; -%% -acs_execute,80,1,5 -acs_suspend,81,2 -acs_terminate,82,2 -acs_lockedexecute,83,5 -ceiling_crushandraise,42,3 -ceiling_crushstop,44,1 -ceiling_lowerandcrush,43,3 -ceiling_lowerbyvalue,40,3 -ceiling_raisebyvalue,41,3 -ceiling_crushraiseandstay,45,3 -ceiling_movetovaluetimes8,69,4 -door_close,10,2 -door_open,11,2 -door_raise,12,3 -door_lockedraise,13,4 -floor_lowerbyvalue,20,3 -floor_lowerbyvaluetimes8,36,3 -floor_lowerinstant,66,3 -floor_movetovaluetimes8,68,4 -floor_lowertolowest,21,2 -floor_lowertonearest,22,2 -floor_raiseandcrush,28,3 -floor_raisebyvalue,23,3 -floor_raisebyvaluetimes8,35,3 -floor_raiseinstant,67,3 -floor_raisetohighest,24,2 -floor_raisetonearest,25,2 -floorandceiling_lowerbyvalue,95,3 -floorandceiling_raisebyvalue,96,3 -floor_crushstop,46,1 -light_forcelightning,109,1 -light_raisebyvalue,110,2 -light_lowerbyvalue,111,2 -light_changetovalue,112,2 -light_fade,113,3 -light_glow,114,4 -light_flicker,115,3 -light_strobe,116,5 -light_stop,117,1 -pillar_build,29,3 -pillar_buildandcrush,94,4 -pillar_open,30,4 -plat_downwaitupstay,62,3 -plat_downbyvalue,63,4 -plat_upwaitdownstay,64,3 -plat_upbyvalue,65,4 -plat_perpetualraise,60,3 -plat_stop,61,1 -polyobj_movetimes8,6,4 -polyobj_move,4,4 -polyobj_rotateleft,2,3 -polyobj_rotateright,3,3 -polyobj_doorswing,7,4 -polyobj_doorslide,8,5 -polyobj_or_movetimes8,93,4 -polyobj_or_move,92,4 -polyobj_or_rotateleft,90,3 -polyobj_or_rotateright,91,3 -radius_quake,120,5 -sector_changesound,140,2 -stairs_builddown,26,5 -stairs_buildup,27,5 -stairs_builddownsync,31,4 -stairs_buildupsync,32,4 -teleport,70,1 -teleport_nofog,71,1,2 -teleport_newmap,74,2 -teleport_endgame,75,0 -thrustthing,72,2,4 -damagething,73,1 -thing_activate,130,1 -thing_deactivate,131,1 -thing_destroy,133,1,2 -thing_projectile,134,5 -thing_projectilegravity,136,5 -thing_remove,132,1 -thing_spawn,135,3,4 -thing_spawnnofog,137,3,4 -floor_waggle,138,5 -ceiling_waggle,38,5 -teleportother,76,3 -teleportgroup,77,5 -teleportinsector,78,4,5 -thing_damage,119,2,3 -thing_move,125,2 -thing_setspecial,127,5 -thrustthingz,128,4 -thing_spawnfacing,139,2,4 -thing_projectileintercept,175,5 -thing_changetid,176,2 -thing_hate,177,2,3 -thing_projectileaimed,178,4,5 -changeskill,179,1 -thing_settranslation,180,2 -line_mirror,182,0 -line_alignceiling,183,2 -line_alignfloor,184,2 -sector_setrotation,185,3 -sector_setceilingpanning,186,5 -sector_setfloorpanning,187,5 -sector_setceilingscale,188,5 -sector_setfloorscale,189,5 -setplayerproperty,191,3 -ceiling_lowertohighestfloor,192,2 -ceiling_lowerinstant,193,3 -ceiling_raiseinstant,194,3 -ceiling_crushraiseandstaya,195,4 -ceiling_crushandraisea,196,4 -ceiling_crushandraisesilenta,197,4 -ceiling_raisebyvaluetimes8,198,3 -ceiling_lowerbyvaluetimes8,199,3 -generic_floor,200,5 -generic_ceiling,201,5 -generic_door,202,5 -generic_lift,203,5 -generic_stairs,204,5 -generic_crusher,205,5 -plat_downwaitupstaylip,206,4 -plat_perpetualraiselip,207,4 -translucentline,208,2,3 -sector_setcolor,212,4,5 -sector_setfade,213,4 -sector_setdamage,214,3 -teleport_line,215,2 -sector_setgravity,216,3 -stairs_buildupdoom,217,5 -sector_setwind,218,4 -sector_setcurrent,220,4 -scroll_texture_both,221,5 -scroll_floor,223,4 -scroll_ceiling,224,4 -acs_executealways,226,1,5 -plat_raiseandstaytx0,228,2 -thing_setgoal,229,3 -plat_upbyvaluestaytx,230,3 -plat_toggleceiling,231,1 -light_strobedoom,232,3 -light_minneighbor,233,1 -light_maxneighbor,234,1 -floor_transfertrigger,235,1 -floor_transfernumeric,236,1 -changecamera,237,3 -floor_raisetolowestceiling,238,2 -floor_raisebyvaluetxty,239,3 -floor_raisebytexture,240,2 -floor_lowertolowesttxty,241,2 -floor_lowertohighest,242,3 -exit_normal,243,1 -exit_secret,244,1 -elevator_raisetonearest,245,2 -elevator_movetofloor,246,2 -elevator_lowertonearest,247,2 -healthing,248,1,2 -door_closewaitopen,249,3 -floor_donut,250,3 -floorandceiling_lowerraise,251,3 -ceiling_raisetonearest,252,2 -ceiling_lowertolowest,253,2 -ceiling_lowertofloor,254,2 -ceiling_crushraiseandstaysila,255,4 -door_animated,14,3 -clearforcefield,34,1 -teleport_zombiechanger,39,2 -acs_executewithresult,84,1,4 -plat_upnearestwaitdownstay,172,3 -noisealert,173,2 -thing_raise,17,1 -startconversation,18,1,2 -acs_lockedexecutedoor,85,5 diff --git a/zdoom.vcproj b/zdoom.vcproj index 512a05da9..41fd54311 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -2509,10 +2509,6 @@ RelativePath=".\src\thingdef\thingdef_properties.cpp" > - - @@ -2523,6 +2519,10 @@ Name="A Header Files" Filter="h" > + +