mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- some sanitizing of sector tag/line id management:
* make setting the line ID with P_TranslateLineDef explicit because there's one FraggleScript function that needs to work around the changes caused by this. There's also some functions setting only a temporary linedef. These would inevitably cause problems if the underlying data gets changed. * remove FS function 'ChangeTag'. Fortunately this was just some long forgotten test stuff that can be removed without affecting any maps, but the feature would cause some serious problems in a more complex system. With these changes it is guaranteed that after map setup the tag/ids won't change anymore.
This commit is contained in:
parent
5d819036b3
commit
203f88ce6e
6 changed files with 23 additions and 46 deletions
|
@ -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!
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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<FNodeBuilder::FPolyStart> &spots, TArray<FNodeBuilder::FPolyStart> &anchors)
|
||||
{
|
||||
if (map->HasBehavior)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue