- 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:
Christoph Oelckers 2015-04-15 20:10:27 +02:00
commit 203f88ce6e
6 changed files with 23 additions and 46 deletions

View file

@ -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!
}