From 72ad99fe96178dfe482dbb0a8240460e363dc324 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 30 Dec 2018 10:18:35 +0100 Subject: [PATCH] - parse all data from the map to allow complete slope creation. --- src/level/actionspecials.h | 274 +++++++++++++++++++++++++++++++++++++ src/level/doomdata.h | 3 + src/level/level.cpp | 59 ++++++++ src/level/level.h | 19 +++ src/level/level_udmf.cpp | 63 ++++++++- 5 files changed, 417 insertions(+), 1 deletion(-) create mode 100644 src/level/actionspecials.h diff --git a/src/level/actionspecials.h b/src/level/actionspecials.h new file mode 100644 index 0000000..d62f935 --- /dev/null +++ b/src/level/actionspecials.h @@ -0,0 +1,274 @@ +// special name, special number, min script args, max script args, num args on a line +DEFINE_SPECIAL(Polyobj_StartLine, 1, -1, -1, 4) +DEFINE_SPECIAL(Polyobj_RotateLeft, 2, 3, 3, 3) +DEFINE_SPECIAL(Polyobj_RotateRight, 3, 3, 3, 3) +DEFINE_SPECIAL(Polyobj_Move, 4, 4, 4, 4) +DEFINE_SPECIAL(Polyobj_ExplicitLine, 5, -1, -1, 5) +DEFINE_SPECIAL(Polyobj_MoveTimes8, 6, 4, 4, 4) +DEFINE_SPECIAL(Polyobj_DoorSwing, 7, 4, 4, 4) +DEFINE_SPECIAL(Polyobj_DoorSlide, 8, 5, 5, 5) +DEFINE_SPECIAL(Line_Horizon, 9, -1, 0, 0) // [RH] draw one-sided wall at horizon +DEFINE_SPECIAL(Door_Close, 10, 2, 3, 3) +DEFINE_SPECIAL(Door_Open, 11, 2, 3, 3) +DEFINE_SPECIAL(Door_Raise, 12, 3, 4, 4) +DEFINE_SPECIAL(Door_LockedRaise, 13, 4, 5, 5) +DEFINE_SPECIAL(Door_Animated, 14, 4, 4, 4) +DEFINE_SPECIAL(Autosave, 15, 0, 0, 0) // [RH] Save the game *now* +DEFINE_SPECIAL(Transfer_WallLight, 16, -1, -1, 2) +DEFINE_SPECIAL(Thing_Raise, 17, 1, 2, 2) +DEFINE_SPECIAL(StartConversation, 18, 1, 2, 2) +DEFINE_SPECIAL(Thing_Stop, 19, 1, 1, 1) +DEFINE_SPECIAL(Floor_LowerByValue, 20, 3, 4, 4) +DEFINE_SPECIAL(Floor_LowerToLowest, 21, 2, 3, 3) +DEFINE_SPECIAL(Floor_LowerToNearest, 22, 2, 3, 3) +DEFINE_SPECIAL(Floor_RaiseByValue, 23, 3, 5, 5) +DEFINE_SPECIAL(Floor_RaiseToHighest, 24, 2, 5, 5) +DEFINE_SPECIAL(Floor_RaiseToNearest, 25, 2, 4, 4) +DEFINE_SPECIAL(Stairs_BuildDown, 26, 5, 5, 5) +DEFINE_SPECIAL(Stairs_BuildUp, 27, 5, 5, 5) +DEFINE_SPECIAL(Floor_RaiseAndCrush, 28, 3, 4, 4) +DEFINE_SPECIAL(Pillar_Build, 29, 3, 3, 3) +DEFINE_SPECIAL(Pillar_Open, 30, 4, 4, 4) +DEFINE_SPECIAL(Stairs_BuildDownSync, 31, 4, 4, 4) +DEFINE_SPECIAL(Stairs_BuildUpSync, 32, 4, 4, 4) +DEFINE_SPECIAL(ForceField, 33, 0, 0, 0) // [RH] Strife's forcefield special (148) +DEFINE_SPECIAL(ClearForceField, 34, 1, 1, 1) // [RH] Remove Strife's forcefield from tagged sectors +DEFINE_SPECIAL(Floor_RaiseByValueTimes8, 35, 3, 5, 5) +DEFINE_SPECIAL(Floor_LowerByValueTimes8, 36, 3, 4, 4) +DEFINE_SPECIAL(Floor_MoveToValue, 37, 3, 4, 5) +DEFINE_SPECIAL(Ceiling_Waggle, 38, 5, 5, 5) // [RH] Complement of Floor_Waggle +DEFINE_SPECIAL(Teleport_ZombieChanger, 39, 2, 2, 2) // [RH] Needed for Strife +DEFINE_SPECIAL(Ceiling_LowerByValue, 40, 3, 5, 5) +DEFINE_SPECIAL(Ceiling_RaiseByValue, 41, 3, 4, 4) +DEFINE_SPECIAL(Ceiling_CrushAndRaise, 42, 3, 4, 4) +DEFINE_SPECIAL(Ceiling_LowerAndCrush, 43, 3, 4, 4) +DEFINE_SPECIAL(Ceiling_CrushStop, 44, 1, 2, 2) +DEFINE_SPECIAL(Ceiling_CrushRaiseAndStay, 45, 3, 4, 4) +DEFINE_SPECIAL(Floor_CrushStop, 46, 1, 1, 1) +DEFINE_SPECIAL(Ceiling_MoveToValue, 47, 3, 5, 5) +DEFINE_SPECIAL(Sector_Attach3dMidtex, 48, -1, -1, 3) +DEFINE_SPECIAL(GlassBreak, 49, 0, 1, 2) +DEFINE_SPECIAL(ExtraFloor_LightOnly, 50, -1, -1, 2) +DEFINE_SPECIAL(Sector_SetLink, 51, 4, 4, 4) +DEFINE_SPECIAL(Scroll_Wall, 52, 5, 5, 5) +DEFINE_SPECIAL(Line_SetTextureOffset, 53, 5, 5, 5) +DEFINE_SPECIAL(Sector_ChangeFlags, 54, 3, 3, 3) +DEFINE_SPECIAL(Line_SetBlocking, 55, 3, 3, 3) +DEFINE_SPECIAL(Line_SetTextureScale, 56, 5, 5, 5) +DEFINE_SPECIAL(Sector_SetPortal, 57, -1, -1, 5) +DEFINE_SPECIAL(Sector_CopyScroller, 58, -1, -1, 2) +DEFINE_SPECIAL(Polyobj_OR_MoveToSpot, 59, 3, 3, 3) +DEFINE_SPECIAL(Plat_PerpetualRaise, 60, 3, 3, 3) +DEFINE_SPECIAL(Plat_Stop, 61, 1, 2, 2) +DEFINE_SPECIAL(Plat_DownWaitUpStay, 62, 3, 3, 3) +DEFINE_SPECIAL(Plat_DownByValue, 63, 4, 4, 4) +DEFINE_SPECIAL(Plat_UpWaitDownStay, 64, 3, 3, 3) +DEFINE_SPECIAL(Plat_UpByValue, 65, 4, 4, 4) +DEFINE_SPECIAL(Floor_LowerInstant, 66, 3, 4, 4) +DEFINE_SPECIAL(Floor_RaiseInstant, 67, 3, 5, 5) +DEFINE_SPECIAL(Floor_MoveToValueTimes8, 68, 4, 5, 5) +DEFINE_SPECIAL(Ceiling_MoveToValueTimes8, 69, 4, 5, 5) +DEFINE_SPECIAL(Teleport, 70, 1, 3, 3) +DEFINE_SPECIAL(Teleport_NoFog, 71, 1, 4, 4) +DEFINE_SPECIAL(ThrustThing, 72, 2, 4, 4) +DEFINE_SPECIAL(DamageThing, 73, 1, 2, 2) +DEFINE_SPECIAL(Teleport_NewMap, 74, 2, 3, 3) +DEFINE_SPECIAL(Teleport_EndGame, 75, 0, 0, 0) +DEFINE_SPECIAL(TeleportOther, 76, 3, 3, 3) +DEFINE_SPECIAL(TeleportGroup, 77, 5, 5, 5) +DEFINE_SPECIAL(TeleportInSector, 78, 4, 5, 5) +DEFINE_SPECIAL(Thing_SetConversation, 79, 2, 2, 2) +DEFINE_SPECIAL(ACS_Execute, 80, 1, 5, 5) +DEFINE_SPECIAL(ACS_Suspend, 81, 2, 2, 2) +DEFINE_SPECIAL(ACS_Terminate, 82, 2, 2, 2) +DEFINE_SPECIAL(ACS_LockedExecute, 83, 5, 5, 5) +DEFINE_SPECIAL(ACS_ExecuteWithResult, 84, 1, 5, 5) +DEFINE_SPECIAL(ACS_LockedExecuteDoor, 85, 5, 5, 5) +DEFINE_SPECIAL(Polyobj_MoveToSpot, 86, 3, 3, 3) +DEFINE_SPECIAL(Polyobj_Stop, 87, 1, 1, 1) +DEFINE_SPECIAL(Polyobj_MoveTo, 88, 4, 4, 4) +DEFINE_SPECIAL(Polyobj_OR_MoveTo, 89, 4, 4, 4) +DEFINE_SPECIAL(Polyobj_OR_RotateLeft, 90, 3, 3, 3) +DEFINE_SPECIAL(Polyobj_OR_RotateRight, 91, 3, 3, 3) +DEFINE_SPECIAL(Polyobj_OR_Move, 92, 4, 4, 4) +DEFINE_SPECIAL(Polyobj_OR_MoveTimes8, 93, 4, 4, 4) +DEFINE_SPECIAL(Pillar_BuildAndCrush, 94, 4, 5, 5) +DEFINE_SPECIAL(FloorAndCeiling_LowerByValue, 95, 3, 3, 3) +DEFINE_SPECIAL(FloorAndCeiling_RaiseByValue, 96, 3, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerAndCrushDist, 97, 3, 5, 5) +DEFINE_SPECIAL(Sector_SetTranslucent, 98, 3, 4, 4) +DEFINE_SPECIAL(Floor_RaiseAndCrushDoom, 99, 3, 4, 4) +DEFINE_SPECIAL(Scroll_Texture_Left, 100, -1, -1, 2) +DEFINE_SPECIAL(Scroll_Texture_Right, 101, -1, -1, 2) +DEFINE_SPECIAL(Scroll_Texture_Up, 102, -1, -1, 2) +DEFINE_SPECIAL(Scroll_Texture_Down, 103, -1, -1, 2) +DEFINE_SPECIAL(Ceiling_CrushAndRaiseSilentDist, 104, 3, 5, 5) +DEFINE_SPECIAL(Door_WaitRaise, 105, 4, 5, 5) +DEFINE_SPECIAL(Door_WaitClose, 106, 4, 5, 5) +DEFINE_SPECIAL(Line_SetPortalTarget, 107, 2, 2, 2) + +DEFINE_SPECIAL(Light_ForceLightning, 109, 1, 1, 1) +DEFINE_SPECIAL(Light_RaiseByValue, 110, 2, 2, 2) +DEFINE_SPECIAL(Light_LowerByValue, 111, 2, 2, 2) +DEFINE_SPECIAL(Light_ChangeToValue, 112, 2, 2, 2) +DEFINE_SPECIAL(Light_Fade, 113, 3, 3, 3) +DEFINE_SPECIAL(Light_Glow, 114, 4, 4, 4) +DEFINE_SPECIAL(Light_Flicker, 115, 3, 3, 3) +DEFINE_SPECIAL(Light_Strobe, 116, 5, 5, 5) +DEFINE_SPECIAL(Light_Stop, 117, 1, 1, 1) +DEFINE_SPECIAL(Plane_Copy, 118, -1, -1, 5) +DEFINE_SPECIAL(Thing_Damage, 119, 2, 3, 3) +DEFINE_SPECIAL(Radius_Quake, 120, 5, 5, 5) // Earthquake +DEFINE_SPECIAL(Line_SetIdentification, 121, -1, -1, 5) + +DEFINE_SPECIAL(Thing_Move, 125, 2, 3, 3) + +DEFINE_SPECIAL(Thing_SetSpecial, 127, 5, 5, 5) +DEFINE_SPECIAL(ThrustThingZ, 128, 4, 4, 4) +DEFINE_SPECIAL(UsePuzzleItem, 129, 2, 5, 5) +DEFINE_SPECIAL(Thing_Activate, 130, 1, 1, 1) +DEFINE_SPECIAL(Thing_Deactivate, 131, 1, 1, 1) +DEFINE_SPECIAL(Thing_Remove, 132, 1, 1, 1) +DEFINE_SPECIAL(Thing_Destroy, 133, 1, 3, 3) +DEFINE_SPECIAL(Thing_Projectile, 134, 5, 5, 5) +DEFINE_SPECIAL(Thing_Spawn, 135, 3, 4, 4) +DEFINE_SPECIAL(Thing_ProjectileGravity, 136, 5, 5, 5) +DEFINE_SPECIAL(Thing_SpawnNoFog, 137, 3, 4, 4) +DEFINE_SPECIAL(Floor_Waggle, 138, 5, 5, 5) +DEFINE_SPECIAL(Thing_SpawnFacing, 139, 2, 4, 4) +DEFINE_SPECIAL(Sector_ChangeSound, 140, 2, 2, 2) + +DEFINE_SPECIAL(Teleport_NoStop, 154, 2, 3, 3) +// portal specials +DEFINE_SPECIAL(Line_SetPortal, 156, -1, -1, 4) +// GZDoom/Vavoom specials +// Although ZDoom doesn't support them it's better to have them defined so that +// WADs using them somewhere can at least be started without aborting due +// to an error message. +DEFINE_SPECIAL(SetGlobalFogParameter, 157, 2, 2, 2) +DEFINE_SPECIAL(FS_Execute, 158, 1, 4, 4) +DEFINE_SPECIAL(Sector_SetPlaneReflection, 159, 3, 3, 3) +DEFINE_SPECIAL(Sector_Set3DFloor, 160, -1, -1, 5) +DEFINE_SPECIAL(Sector_SetContents, 161, -1, -1, 3) + +// [RH] Begin new specials for ZDoom +DEFINE_SPECIAL(Line_SetHealth, 150, 2, 2, 2) +DEFINE_SPECIAL(Sector_SetHealth, 151, 3, 3, 3) +DEFINE_SPECIAL(Ceiling_CrushAndRaiseDist, 168, 3, 5, 5) +DEFINE_SPECIAL(Generic_Crusher2, 169, 5, 5, 5) +DEFINE_SPECIAL(Sector_SetCeilingScale2, 170, 3, 3, 3) +DEFINE_SPECIAL(Sector_SetFloorScale2, 171, 3, 3, 3) +DEFINE_SPECIAL(Plat_UpNearestWaitDownStay, 172, 3, 3, 3) +DEFINE_SPECIAL(NoiseAlert, 173, 2, 2, 2) +DEFINE_SPECIAL(SendToCommunicator, 174, 4, 4, 4) +DEFINE_SPECIAL(Thing_ProjectileIntercept, 175, 5, 5, 5) +DEFINE_SPECIAL(Thing_ChangeTID, 176, 2, 2, 2) +DEFINE_SPECIAL(Thing_Hate, 177, 2, 3, 3) +DEFINE_SPECIAL(Thing_ProjectileAimed, 178, 4, 5, 5) +DEFINE_SPECIAL(ChangeSkill, 179, 1, 1, 1) +DEFINE_SPECIAL(Thing_SetTranslation, 180, 2, 2, 2) +DEFINE_SPECIAL(Plane_Align, 181, -1, -1, 3) +DEFINE_SPECIAL(Line_Mirror, 182, -1, 0, 0) +DEFINE_SPECIAL(Line_AlignCeiling, 183, 2, 2, 2) +DEFINE_SPECIAL(Line_AlignFloor, 184, 2, 2, 2) +DEFINE_SPECIAL(Sector_SetRotation, 185, 3, 3, 3) +DEFINE_SPECIAL(Sector_SetCeilingPanning, 186, 5, 5, 5) +DEFINE_SPECIAL(Sector_SetFloorPanning, 187, 5, 5, 5) +DEFINE_SPECIAL(Sector_SetCeilingScale, 188, 5, 5, 5) +DEFINE_SPECIAL(Sector_SetFloorScale, 189, 5, 5, 5) +DEFINE_SPECIAL(Static_Init, 190, -1, -1, 4) +DEFINE_SPECIAL(SetPlayerProperty, 191, 3, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerToHighestFloor, 192, 2, 4, 5) +DEFINE_SPECIAL(Ceiling_LowerInstant, 193, 3, 5, 5) +DEFINE_SPECIAL(Ceiling_RaiseInstant, 194, 3, 4, 4) +DEFINE_SPECIAL(Ceiling_CrushRaiseAndStayA, 195, 4, 5, 5) +DEFINE_SPECIAL(Ceiling_CrushAndRaiseA, 196, 4, 5, 5) +DEFINE_SPECIAL(Ceiling_CrushAndRaiseSilentA, 197, 4, 5, 5) +DEFINE_SPECIAL(Ceiling_RaiseByValueTimes8, 198, 3, 4, 4) +DEFINE_SPECIAL(Ceiling_LowerByValueTimes8, 199, 3, 5, 5) +DEFINE_SPECIAL(Generic_Floor, 200, 5, 5, 5) +DEFINE_SPECIAL(Generic_Ceiling, 201, 5, 5, 5) +DEFINE_SPECIAL(Generic_Door, 202, 5, 5, 5) +DEFINE_SPECIAL(Generic_Lift, 203, 5, 5, 5) +DEFINE_SPECIAL(Generic_Stairs, 204, 5, 5, 5) +DEFINE_SPECIAL(Generic_Crusher, 205, 5, 5, 5) +DEFINE_SPECIAL(Plat_DownWaitUpStayLip, 206, 4, 5, 5) +DEFINE_SPECIAL(Plat_PerpetualRaiseLip, 207, 4, 4, 4) +DEFINE_SPECIAL(TranslucentLine, 208, 2, 3, 3) +DEFINE_SPECIAL(Transfer_Heights, 209, -1, -1, 2) +DEFINE_SPECIAL(Transfer_FloorLight, 210, -1, -1, 1) +DEFINE_SPECIAL(Transfer_CeilingLight, 211, -1, -1, 1) +DEFINE_SPECIAL(Sector_SetColor, 212, 4, 5, 5) +DEFINE_SPECIAL(Sector_SetFade, 213, 4, 4, 4) +DEFINE_SPECIAL(Sector_SetDamage, 214, 3, 5, 5) +DEFINE_SPECIAL(Teleport_Line, 215, 2, 3, 3) +DEFINE_SPECIAL(Sector_SetGravity, 216, 3, 3, 3) +DEFINE_SPECIAL(Stairs_BuildUpDoom, 217, 5, 5, 5) +DEFINE_SPECIAL(Sector_SetWind, 218, 4, 4, 4) +DEFINE_SPECIAL(Sector_SetFriction, 219, 2, 2, 2) +DEFINE_SPECIAL(Sector_SetCurrent, 220, 4, 4, 4) +DEFINE_SPECIAL(Scroll_Texture_Both, 221, 5, 5, 5) +DEFINE_SPECIAL(Scroll_Texture_Model, 222, -1, -1, 2) +DEFINE_SPECIAL(Scroll_Floor, 223, 4, 4, 5) +DEFINE_SPECIAL(Scroll_Ceiling, 224, 4, 4, 5) +DEFINE_SPECIAL(Scroll_Texture_Offsets, 225, -1, -1, 1) +DEFINE_SPECIAL(ACS_ExecuteAlways, 226, 1, 5, 5) +DEFINE_SPECIAL(PointPush_SetForce, 227, -1, -1, 4) +DEFINE_SPECIAL(Plat_RaiseAndStayTx0, 228, 2, 3, 3) +DEFINE_SPECIAL(Thing_SetGoal, 229, 3, 4, 4) +DEFINE_SPECIAL(Plat_UpByValueStayTx, 230, 3, 3, 3) +DEFINE_SPECIAL(Plat_ToggleCeiling, 231, 1, 1, 1) +DEFINE_SPECIAL(Light_StrobeDoom, 232, 3, 3, 3) +DEFINE_SPECIAL(Light_MinNeighbor, 233, 1, 1, 1) +DEFINE_SPECIAL(Light_MaxNeighbor, 234, 1, 1, 1) +DEFINE_SPECIAL(Floor_TransferTrigger, 235, 1, 1, 1) +DEFINE_SPECIAL(Floor_TransferNumeric, 236, 1, 1, 1) +DEFINE_SPECIAL(ChangeCamera, 237, 3, 3, 3) +DEFINE_SPECIAL(Floor_RaiseToLowestCeiling, 238, 2, 4, 5) +DEFINE_SPECIAL(Floor_RaiseByValueTxTy, 239, 3, 3, 3) +DEFINE_SPECIAL(Floor_RaiseByTexture, 240, 2, 4, 4) +DEFINE_SPECIAL(Floor_LowerToLowestTxTy, 241, 2, 2, 2) +DEFINE_SPECIAL(Floor_LowerToHighest, 242, 3, 4, 4) +DEFINE_SPECIAL(Exit_Normal, 243, 1, 1, 1) +DEFINE_SPECIAL(Exit_Secret, 244, 1, 1, 1) +DEFINE_SPECIAL(Elevator_RaiseToNearest, 245, 2, 2, 2) +DEFINE_SPECIAL(Elevator_MoveToFloor, 246, 2, 2, 2) +DEFINE_SPECIAL(Elevator_LowerToNearest, 247, 2, 2, 2) +DEFINE_SPECIAL(HealThing, 248, 1, 2, 2) +DEFINE_SPECIAL(Door_CloseWaitOpen, 249, 3, 4, 4) +DEFINE_SPECIAL(Floor_Donut, 250, 3, 3, 3) +DEFINE_SPECIAL(FloorAndCeiling_LowerRaise, 251, 3, 4, 4) +DEFINE_SPECIAL(Ceiling_RaiseToNearest, 252, 2, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerToLowest, 253, 2, 4, 4) +DEFINE_SPECIAL(Ceiling_LowerToFloor, 254, 2, 4, 5) +DEFINE_SPECIAL(Ceiling_CrushRaiseAndStaySilA, 255, 4, 5, 5) + +DEFINE_SPECIAL(Floor_LowerToHighestEE, 256, 2, 3, 3) +DEFINE_SPECIAL(Floor_RaiseToLowest, 257, 1, 3, 3) +DEFINE_SPECIAL(Floor_LowerToLowestCeiling, 258, 2, 3, 3) +DEFINE_SPECIAL(Floor_RaiseToCeiling, 259, 2, 4, 5) +DEFINE_SPECIAL(Floor_ToCeilingInstant, 260, 1, 3, 4) +DEFINE_SPECIAL(Floor_LowerByTexture, 261, 2, 3, 3) +DEFINE_SPECIAL(Ceiling_RaiseToHighest, 262, 2, 3, 3) +DEFINE_SPECIAL(Ceiling_ToHighestInstant, 263, 1, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerToNearest, 264, 2, 4, 4) +DEFINE_SPECIAL(Ceiling_RaiseToLowest, 265, 2, 3, 3) +DEFINE_SPECIAL(Ceiling_RaiseToHighestFloor, 266, 2, 3, 3) +DEFINE_SPECIAL(Ceiling_ToFloorInstant, 267, 1, 3, 4) +DEFINE_SPECIAL(Ceiling_RaiseByTexture, 268, 2, 3, 3) +DEFINE_SPECIAL(Ceiling_LowerByTexture, 269, 2, 4, 4) +DEFINE_SPECIAL(Stairs_BuildDownDoom, 270, 5, 5, 5) +DEFINE_SPECIAL(Stairs_BuildUpDoomSync, 271, 4, 4, 4) +DEFINE_SPECIAL(Stairs_BuildDownDoomSync, 272, 4, 4, 4) +DEFINE_SPECIAL(Stairs_BuildUpDoomCrush, 273, 5, 5, 5) +DEFINE_SPECIAL(Door_AnimatedClose, 274, 4, 4, 4) +DEFINE_SPECIAL(Floor_Stop, 275, 1, 1, 1) +DEFINE_SPECIAL(Ceiling_Stop, 276, 1, 1, 1) +DEFINE_SPECIAL(Sector_SetFloorGlow, 277, 5, 5, 5) +DEFINE_SPECIAL(Sector_SetCeilingGlow, 278, 5, 5, 5) +DEFINE_SPECIAL(Floor_MoveToValueAndCrush, 279, 4, 5, 5) +DEFINE_SPECIAL(Ceiling_MoveToValueAndCrush, 280, 4, 5, 5) +DEFINE_SPECIAL(Line_SetAutomapFlags, 281, 3, 3, 3) +DEFINE_SPECIAL(Line_SetAutomapStyle, 282, 2, 2, 2) + +#undef DEFINE_SPECIAL diff --git a/src/level/doomdata.h b/src/level/doomdata.h index 1386988..97dfd8f 100644 --- a/src/level/doomdata.h +++ b/src/level/doomdata.h @@ -88,6 +88,7 @@ struct IntLineDef uint32_t sidenum[2]; TArray props; + TArray ids; }; struct MapSector @@ -108,6 +109,7 @@ struct IntSector // UDMF. Just storing the UDMF keys and leaving the binary fields // empty is enough MapSector data; + TArray tags; Plane ceilingplane; Plane floorplane; @@ -240,6 +242,7 @@ struct IntThing struct IntVertex { TArray props; + double zfloor = 100000, zceiling = 100000; }; class BBox; diff --git a/src/level/level.cpp b/src/level/level.cpp index a6e0993..7ee1716 100644 --- a/src/level/level.cpp +++ b/src/level/level.cpp @@ -177,6 +177,62 @@ void FProcessor::LoadThings () } } +void FProcessor::SetLineID(IntLineDef *ld) +{ + // For Hexen format we need to extract the line ID from the special because there is no explicit field for it. + int setid = -1; + switch (ld->special) + { + case Line_SetIdentification: + // For native Hexen maps this should mask out args[4], but such maps are not relevant for slopes anyway. + setid = ld->args[0] + 256 * ld->args[4]; + break; + + case TranslucentLine: + setid = ld->args[0]; + break; + + case Teleport_Line: + case Scroll_Texture_Model: + setid = ld->args[0]; + break; + + case Polyobj_StartLine: + setid = ld->args[3]; + break; + + case Polyobj_ExplicitLine: + setid = ld->args[4]; + break; + + case Plane_Align: + // This compatibility option is not relevant for new content. + /*if (!(ib_compatflags & BCOMPATF_NOSLOPEID))*/ setid = ld->args[2]; + break; + + case Static_Init: + if (ld->args[1] == Init_SectorLink) setid = ld->args[0]; + break; + + case Line_SetPortal: + setid = ld->args[1]; // 0 = target id, 1 = this id, 2 = plane anchor + break; + + case Sector_Set3DFloor: + if (ld->args[1] & 8) + { + setid = ld->args[4]; + } + break; + } + + if (setid != -1) + { + ld->ids.Push(setid); + } +} + + void FProcessor::LoadLines () { int NumLines; @@ -203,6 +259,7 @@ void FProcessor::LoadLines () Level.Lines[i].sidenum[1] = LittleShort(Lines[i].sidenum[1]); if (Level.Lines[i].sidenum[0] == NO_MAP_INDEX) Level.Lines[i].sidenum[0] = NO_INDEX; if (Level.Lines[i].sidenum[1] == NO_MAP_INDEX) Level.Lines[i].sidenum[1] = NO_INDEX; + SetLineID(&Level.Lines[i]); } delete[] Lines; } @@ -226,6 +283,8 @@ void FProcessor::LoadLines () Level.Lines[i].special = 0; Level.Lines[i].args[0] = LittleShort(ml[i].special); Level.Lines[i].args[1] = LittleShort(ml[i].tag); + // We do not support slope creation via linedefs in Doom format maps because due to customizable translation + // we can never be sure what number a sloping special is. } delete[] ml; } diff --git a/src/level/level.h b/src/level/level.h index 1ad8340..6402fc6 100644 --- a/src/level/level.h +++ b/src/level/level.h @@ -10,6 +10,24 @@ #include "lightmap/lightmap.h" #include +#define DEFINE_SPECIAL(name, num, min, max, map) name = num, + +typedef enum { +#include "actionspecials.h" +} linespecial_t; +#undef DEFINE_SPECIAL + +typedef enum { + Init_Gravity = 0, + Init_Color = 1, + Init_Damage = 2, + Init_SectorLink = 3, + NUM_STATIC_INITS, + Init_EDSector = 253, + Init_EDLine = 254, + Init_TransferSky = 255 +} staticinit_t; + class ZLibOut { public: @@ -49,6 +67,7 @@ private: void LoadSides(); void LoadSectors(); void GetPolySpots(); + void SetLineID(IntLineDef *ld); MapNodeEx *NodesToEx(const MapNode *nodes, int count); MapSubsectorEx *SubsectorsToEx(const MapSubsector *ssec, int count); diff --git a/src/level/level_udmf.cpp b/src/level/level_udmf.cpp index 306fc04..28d4013 100644 --- a/src/level/level_udmf.cpp +++ b/src/level/level_udmf.cpp @@ -234,6 +234,7 @@ void FProcessor::ParseThing(IntThing *th) void FProcessor::ParseLinedef(IntLineDef *ld) { + const char *tagstring = nullptr; SC_MustGetStringName("{"); ld->v1 = ld->v2 = ld->sidenum[0] = ld->sidenum[1] = NO_INDEX; ld->flags = 0; @@ -277,6 +278,13 @@ void FProcessor::ParseLinedef(IntLineDef *ld) { ld->args[4] = CheckInt(key); } + else if (stricmp(key, "moreids") == 0) + { + // delay parsing of the tag string until parsing of the sector is complete + // This ensures that the ID is always the first tag in the list. + tagstring = value; + break; + } else if (!stricmp(key, "blocking") && !stricmp(value, "true")) { ld->flags |= ML_BLOCKING; @@ -289,6 +297,12 @@ void FProcessor::ParseLinedef(IntLineDef *ld) { ld->flags |= ML_TWOSIDED; } + else if (Extended && !stricmp(key, "id")) + { + int id = CheckInt(key); + ld->ids.Clear(); + if (id != -1) ld->ids.Push(id); + } if (!stricmp(key, "sidefront")) { @@ -305,6 +319,20 @@ void FProcessor::ParseLinedef(IntLineDef *ld) UDMFKey k = {key, value}; ld->props.Push(k); } + if (tagstring != nullptr && *tagstring == '"') + { + // skip the quotation mark + auto workstring = strdup(tagstring + 1); + for (char *token = strtok(workstring, " \""); token; token = strtok(nullptr, " \"")) + { + auto tag = strtoll(token, nullptr, 0); + if (tag != -1 && (int)tag == tag) + { + ld->ids.Push(tag); // don't bother with duplicates, they don't pose a problem. + } + } + free(workstring); + } } //=========================================================================== @@ -371,6 +399,7 @@ void FProcessor::ParseSidedef(IntSideDef *sd) void FProcessor::ParseSector(IntSector *sec) { + const char * tagstring = nullptr; memset(&sec->data, 0, sizeof(sec->data)); sec->data.lightlevel = 160; @@ -408,7 +437,10 @@ void FProcessor::ParseSector(IntSector *sec) } else if (stricmp(key, "id") == 0) { - sec->data.tag = CheckInt(key); + int id = CheckInt(key); + sec->data.tag = (short)id; + sec->tags.Clear(); + if (id != 0) sec->tags.Push(id); } else if (stricmp(key, "ceilingplane_a") == 0) { @@ -450,6 +482,13 @@ void FProcessor::ParseSector(IntSector *sec) floorplane|=8; sec->floorplane.d = CheckFloat(key); } + else if (stricmp(key, "moreids") == 0) + { + // delay parsing of the tag string until parsing of the sector is complete + // This ensures that the ID is always the first tag in the list. + tagstring = value; + break; + } // now store the key in its unprocessed form UDMFKey k = {key, value}; @@ -489,6 +528,20 @@ void FProcessor::ParseSector(IntSector *sec) sec->floorplane.d *= scale; sec->floorplane.d = -sec->floorplane.d; } + if (tagstring != nullptr && *tagstring == '"') + { + // skip the quotation mark + auto workstring = strdup(tagstring + 1); + for (char *token = strtok(workstring, " \""); token; token = strtok(nullptr, " \"")) + { + auto tag = strtoll(token, nullptr, 0); + if (tag != 0 && (int)tag == tag) + { + sec->tags.Push(tag); // don't bother with duplicates, they don't pose a problem. + } + } + free(workstring); + } } //=========================================================================== @@ -514,6 +567,14 @@ void FProcessor::ParseVertex(WideVertex *vt, IntVertex *vtp) { vt->y = CheckFixed(key); } + if (!stricmp(key, "zfloor")) + { + vtp->zfloor = CheckFixed(key); + } + else if (!stricmp(key, "zceiling")) + { + vtp->zceiling = CheckFixed(key); + } // now store the key in its unprocessed form UDMFKey k = {key, value};