diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 0251b8fba..a0609377e 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -67,6 +67,7 @@ #include "v_font.h" #include "r_data/colormaps.h" #include "farchive.h" +#include "p_setup.h" static FRandom pr_script("FScript"); @@ -2226,9 +2227,6 @@ void FParser::SF_RunCommand(void) // //========================================================================== -// any linedef type -extern void P_TranslateLineDef (line_t *ld, maplinedef_t *mld); - void FParser::SF_LineTrigger() { if (CheckArgs(1)) @@ -2237,7 +2235,7 @@ void FParser::SF_LineTrigger() maplinedef_t mld; mld.special=intvalue(t_argv[0]); mld.tag=t_argc > 1 ? intvalue(t_argv[1]) : 0; - P_TranslateLineDef(&line, &mld); + P_TranslateLineDef(&line, &mld, false); P_ExecuteSpecial(line.special, NULL, Script->trigger, false, line.args[0],line.args[1],line.args[2],line.args[3],line.args[4]); } @@ -4382,15 +4380,12 @@ void FParser::SF_SetLineTrigger() FLineIdIterator itr(id); while ((i = itr.Next()) >= 0) { - if (t_argc == 2) tag = lines[i].GetMainId(); maplinedef_t mld; mld.special = spec; mld.tag = tag; mld.flags = 0; int f = lines[i].flags; - P_TranslateLineDef(&lines[i], &mld); - lines[i].ClearIds(); - lines[i].SetMainId(tag); + P_TranslateLineDef(&lines[i], &mld, false); lines[i].flags = (lines[i].flags & (ML_MONSTERSCANACTIVATE | ML_REPEAT_SPECIAL | ML_SPAC_MASK | ML_FIRSTSIDEONLY)) | (f & ~(ML_MONSTERSCANACTIVATE | ML_REPEAT_SPECIAL | ML_SPAC_MASK | ML_FIRSTSIDEONLY)); @@ -4401,26 +4396,13 @@ void FParser::SF_SetLineTrigger() //========================================================================== // -// new for GZDoom: Changes a sector's tag -// (I only need this because MAP02 in RTC-3057 has some issues with the GL -// renderer that I can't fix without the scripts. But loading a FS on top on -// ACS still works so I can hack around it with this.) +// // //========================================================================== void FParser::SF_ChangeTag() { - if (CheckArgs(2)) - { - FSectorTagIterator it(t_argv[0].value.i); - int secnum; - while ((secnum = it.Next()) >= 0) - { - sectors[secnum].ClearTags(); - sectors[secnum].SetMainTag(t_argv[1].value.i); - } - sector_t::HashTags(); - } + // Development garbage! } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 9c47e1fdc..4a1527514 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -96,7 +96,6 @@ CVAR (Bool, gennodes, false, CVAR_SERVERINFO|CVAR_GLOBALCONFIG); CVAR (Bool, genglnodes, false, CVAR_SERVERINFO); CVAR (Bool, showloadtimes, false, 0); -static void P_InitTagLists (); static void P_Shutdown (); bool P_IsBuildMap(MapData *map); @@ -2146,11 +2145,10 @@ void P_LoadLineDefs (MapData * map) // [RH] Translate old linedef special and flags to be // compatible with the new format. - P_TranslateLineDef (ld, mld); + P_TranslateLineDef (ld, mld, true); ld->v1 = &vertexes[LittleShort(mld->v1)]; ld->v2 = &vertexes[LittleShort(mld->v2)]; - //ld->id = -1; ID has been assigned in P_TranslateLineDef P_SetSideNum (&ld->sidedef[0], LittleShort(mld->sidenum[0])); P_SetSideNum (&ld->sidedef[1], LittleShort(mld->sidenum[1])); @@ -3209,7 +3207,9 @@ static void P_GroupLines (bool buildmap) // [RH] Moved this here times[4].Clock(); - P_InitTagLists(); // killough 1/30/98: Create xref tables for tags + // killough 1/30/98: Create xref tables for tags + sector_t::HashTags(); + line_t::HashIds(); times[4].Unclock(); times[5].Clock(); @@ -3306,13 +3306,6 @@ void P_LoadBehavior (MapData * map) } } -// Hash the sector tags across the sectors and linedefs. -static void P_InitTagLists () -{ - sector_t::HashTags(); - line_t::HashIds(); -} - void P_GetPolySpots (MapData * map, TArray &spots, TArray &anchors) { if (map->HasBehavior) diff --git a/src/p_setup.h b/src/p_setup.h index ee26f4c57..20caa5d76 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -115,7 +115,7 @@ struct line_t; struct maplinedef_t; void P_LoadTranslator(const char *lumpname); -void P_TranslateLineDef (line_t *ld, maplinedef_t *mld); +void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, bool setlineid); int P_TranslateSectorSpecial (int); int GetUDMFInt(int type, int index, const char *key); diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index cdbb8dc4c..09cee8441 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -754,7 +754,7 @@ public: mld.flags = 0; mld.special = th->special; mld.tag = th->args[0]; - P_TranslateLineDef(&ld, &mld); + P_TranslateLineDef(&ld, &mld, true); th->special = ld.special; memcpy(th->args, ld.args, sizeof (ld.args)); } @@ -1068,7 +1068,7 @@ public: memset(&mld, 0, sizeof(mld)); mld.special = ld->special; mld.tag = ld->GetMainId(); - P_TranslateLineDef(ld, &mld); + P_TranslateLineDef(ld, &mld, false); ld->flags = saved | (ld->flags&(ML_MONSTERSCANACTIVATE|ML_REPEAT_SPECIAL|ML_FIRSTSIDEONLY)); } if (passuse && (ld->activation & SPAC_Use)) diff --git a/src/p_xlat.cpp b/src/p_xlat.cpp index ef1e92849..4b1373817 100644 --- a/src/p_xlat.cpp +++ b/src/p_xlat.cpp @@ -60,7 +60,7 @@ typedef enum PushMany, } triggertype_e; -void P_TranslateLineDef (line_t *ld, maplinedef_t *mld) +void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, bool setid) { unsigned short special = (unsigned short) LittleShort(mld->special); short tag = LittleShort(mld->tag); @@ -100,12 +100,14 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld) } flags = newflags; - // For purposes of maintaining BOOM compatibility, each - // line also needs to have its ID set to the same as its tag. - // An external conversion program would need to do this more - // intelligently. - ld->ClearIds(); - ld->SetMainId(tag); + if (setid) + { + // For purposes of maintaining BOOM compatibility, each + // line also needs to have its ID set to the same as its tag. + // An external conversion program would need to do this more + // intelligently. + ld->SetMainId(tag); + } // 0 specials are never translated. if (special == 0) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index cb59f8a1f..b63ba567f 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -70,6 +70,7 @@ #include "m_bbox.h" #include "r_data/r_translate.h" #include "p_trace.h" +#include "p_setup.h" #include "gstrings.h" @@ -4506,7 +4507,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Weave) //=========================================================================== -void P_TranslateLineDef (line_t *ld, maplinedef_t *mld); DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LineEffect) { ACTION_PARAM_START(2); @@ -4520,7 +4520,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LineEffect) if ((oldjunk.special = special)) // Linedef type { oldjunk.tag = tag; // Sector tag for linedef - P_TranslateLineDef(&junk, &oldjunk); // Turn into native type + P_TranslateLineDef(&junk, &oldjunk, false); // Turn into native type res = !!P_ExecuteSpecial(junk.special, NULL, self, false, junk.args[0], junk.args[1], junk.args[2], junk.args[3], junk.args[4]); if (res && !(junk.flags & ML_REPEAT_SPECIAL)) // If only once,