From 753f280e04f55c0aa6eeaa7e066b69d1dd259793 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 25 Oct 2006 16:21:08 +0000 Subject: [PATCH] - Moved the sector type translation for Doom format maps into a simple lump in zdoom.pk3. - Changed Line_SetIdentification so that the fifth arg is a high-byte for the line ID. SVN r361 (trunk) --- docs/rh-log.txt | 5 ++ src/g_level.cpp | 2 - src/g_level.h | 3 +- src/p_setup.cpp | 2 +- src/p_xlat.cpp | 182 +++++++++++++++++++++++++++++++-------------- wadsrc/sectorx.txt | 30 ++++++++ wadsrc/zdoom.lst | 1 + 7 files changed, 163 insertions(+), 62 deletions(-) create mode 100644 wadsrc/sectorx.txt diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f184dd015..ae7a8fbba 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,8 @@ +October 25, 2006 (Changes by Graf Zahl) +- Moved the sector type translation for Doom format maps into a simple lump + in zdoom.pk3. +- Changed Line_SetIdentification so that the fifth arg is a high-byte for the line ID. + October 23, 2006 - Added the A_JumpSet function for what seems to be a fairly common scenario. It is like A_Jump, except it accepts up to 20 jump targets. The jump diff --git a/src/g_level.cpp b/src/g_level.cpp index 3a01ca4e3..71681459e 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -230,7 +230,6 @@ static const char *MapInfoMapLevel[] = "strictmonsteractivation", "laxmonsteractivation", "additive_scrollers", - "cod_level", "interpic", "exitpic", "enterpic", @@ -361,7 +360,6 @@ MapHandlers[] = { MITYPE_CLRFLAG, LEVEL_LAXMONSTERACTIVATION, LEVEL_LAXACTIVATIONMAPINFO }, { MITYPE_SETFLAG, LEVEL_LAXMONSTERACTIVATION, LEVEL_LAXACTIVATIONMAPINFO }, { MITYPE_COMPATFLAG, COMPATF_BOOMSCROLL}, - { MITYPE_SETFLAG, LEVEL_CAVERNS_OF_DARKNESS, 0 }, { MITYPE_LUMPNAME, lioffset(exitpic), 0 }, { MITYPE_LUMPNAME, lioffset(exitpic), 0 }, { MITYPE_LUMPNAME, lioffset(enterpic), 0 }, diff --git a/src/g_level.h b/src/g_level.h index 84889b1d5..782296a18 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -92,8 +92,7 @@ #define LEVEL_LAXMONSTERACTIVATION UCONST64(0x400000000) // Monsters can open doors depending on the door speed #define LEVEL_LAXACTIVATIONMAPINFO UCONST64(0x800000000) // LEVEL_LAXMONSTERACTIVATION is not a default. - -#define LEVEL_CAVERNS_OF_DARKNESS UCONST64(0x2000000000) // to translate the special sector types of CoD. +// some unused bits here! #define LEVEL_KEEPFULLINVENTORY UCONST64(0x4000000000) // doesn't reduce the amount of inventory items to 1 diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 7337e78ed..54dbc148f 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1651,7 +1651,7 @@ void P_AdjustLine (line_t *ld) switch (ld->special) { case Line_SetIdentification: - ld->id = ld->args[0]; + ld->id = ld->args[0] + 256 * ld->args[4]; ld->flags |= ld->args[1]<<16; break; diff --git a/src/p_xlat.cpp b/src/p_xlat.cpp index a938e6dc2..6b601e29e 100644 --- a/src/p_xlat.cpp +++ b/src/p_xlat.cpp @@ -46,6 +46,8 @@ #include "a_sharedglobal.h" #include "gi.h" #include "w_wad.h" +#include "sc_man.h" +#include "cmdlib.h" // define names for the TriggerType field of the general linedefs @@ -414,6 +416,121 @@ void P_TranslateTeleportThings () } } +static short sectortables[2][256]; +static int boommask=0, boomshift=0; +static bool secparsed; + +void P_ReadSectorSpecials() +{ + secparsed=true; + for(int i=0;i<256;i++) + { + sectortables[0][i]=-1; + sectortables[1][i]=i; + } + + int lastlump=0, lump; + + lastlump = 0; + while ((lump = Wads.FindLump ("SECTORX", &lastlump)) != -1) + { + SC_OpenLumpNum (lump, "SECTORX"); + SC_SetCMode(true); + while (SC_GetString()) + { + if (SC_Compare("IFDOOM")) + { + SC_MustGetStringName("{"); + if (gameinfo.gametype != GAME_Doom) + { + do + { + if (!SC_GetString()) + { + SC_ScriptError("Unexpected end of file"); + } + } + while (!SC_Compare("}")); + } + } + else if (SC_Compare("IFHERETIC")) + { + SC_MustGetStringName("{"); + if (gameinfo.gametype != GAME_Heretic) + { + do + { + if (!SC_GetString()) + { + SC_ScriptError("Unexpected end of file"); + } + } + while (!SC_Compare("}")); + } + } + else if (SC_Compare("IFSTRIFE")) + { + SC_MustGetStringName("{"); + if (gameinfo.gametype != GAME_Strife) + { + do + { + if (!SC_GetString()) + { + SC_ScriptError("Unexpected end of file"); + } + } + while (!SC_Compare("}")); + } + } + else if (SC_Compare("}")) + { + // ignore + } + else if (SC_Compare("BOOMMASK")) + { + SC_MustGetNumber(); + boommask = sc_Number; + SC_MustGetStringName(","); + SC_MustGetNumber(); + boomshift = sc_Number; + } + else if (SC_Compare("[")) + { + int start; + int end; + + SC_MustGetNumber(); + start = sc_Number; + SC_MustGetStringName(","); + SC_MustGetNumber(); + end = sc_Number; + SC_MustGetStringName("]"); + SC_MustGetStringName(":"); + SC_MustGetNumber(); + for(int j=start;j<=end;j++) + { + sectortables[!!boommask][j]=sc_Number + j - start; + } + } + else if (IsNum(sc_String)) + { + int start; + + start = atoi(sc_String); + SC_MustGetStringName(":"); + SC_MustGetNumber(); + sectortables[!!boommask][start]=sc_Number; + } + else + { + SC_ScriptError(NULL); + } + } + SC_Close (); + } +} + int P_TranslateSectorSpecial (int special) { int high; @@ -425,63 +542,14 @@ int P_TranslateSectorSpecial (int special) return special & 0x7fff; } - if (special == 9) + if (!secparsed) P_ReadSectorSpecials(); + + if (special>=0 && special<=255) { - return SECRET_MASK; + if (sectortables[0][special]>=0) return sectortables[0][special]; } - - if (gameinfo.gametype == GAME_Doom || gameinfo.gametype == GAME_Strife) - { - // This supports phased lighting with specials 21-24 - high = (special & 0xfe0) << 3; - special &= 0x1f; - if (special < 21) - { - if (gameinfo.gametype == GAME_Strife) - { - if (special == 4 || special == 5 || special == 15 || special == 16 || special == 18) - { - return high | (special + 100); - } - } - else if (level.flags & LEVEL_CAVERNS_OF_DARKNESS) - { - // CoD uses 18 as an instant death sector type and 19 for healing the player - if (special == 18) return high | Damage_InstantDeath; - if (special == 19) return high | Sector_Heal; - } - return high | (special + 64); - } - else if (special < 40) - { - return high | (special - 20); - } - } - else - { - high = (special & 0xfc0) << 3; - special &= 0x3f; - if (special == 5) - { - return high | dDamage_LavaWimpy; - } - else if (special == 16) - { - return high | dDamage_LavaHefty; - } - else if (special == 4) - { - return high | dScroll_EastLavaDamage; - } - else if (special < 20) - { - return high | (special + 64); - } - else if (special < 40) - { - return high | (special + 205); - } - } - - return high | special; + high = (special & boommask) << boomshift; + special &= (~boommask) & 255; + + return sectortables[1][special] | high; } diff --git a/wadsrc/sectorx.txt b/wadsrc/sectorx.txt new file mode 100644 index 000000000..630c85c69 --- /dev/null +++ b/wadsrc/sectorx.txt @@ -0,0 +1,30 @@ +9: 1024 // this is done before masking out the Boom bits. + +ifdoom +{ + boommask 0xfe0, 3 + [1,20] : 65 + [21,40] : 1 +} + +ifheretic +{ + boommask 0xfc0, 3 + + [1,19] : 65 + [20,40] :225 + 5 : 82 + 16 : 83 + 4 : 84 +} + +ifstrife +{ + boommask 0xfe0, 3 + [1,20] : 65 + [21,40] : 1 + [4,5] : 104 + [15,16] : 115 + 18: 118 +} + diff --git a/wadsrc/zdoom.lst b/wadsrc/zdoom.lst index fbbf01ddc..92b2ad2ba 100644 --- a/wadsrc/zdoom.lst +++ b/wadsrc/zdoom.lst @@ -66,6 +66,7 @@ dehsupp.lmp dehsupp.lmp doomx.lmp xlat/doom.x hereticx.lmp xlat/heretic.x strifex.lmp xlat/strife.x +sectorx.txt sectorx.txt animated.lmp animated.lmp spaldoom.lmp spaldoom.lmp