- some minor rework of tag access interface after I realized that some stuff (e.g. Strife's scrolling sector special) need the primary tag to treated specially.

This commit is contained in:
Christoph Oelckers 2015-04-14 18:48:19 +02:00
parent 238046655c
commit 2faf836aa1
10 changed files with 23 additions and 15 deletions

View file

@ -551,7 +551,8 @@ void SetCompatibilityParams()
{
if ((unsigned)CompatParams[i + 1] < (unsigned)numsectors)
{
sectors[CompatParams[i + 1]].SetTag(CompatParams[i + 2]);
sectors[CompatParams[i + 1]].ClearTags();
sectors[CompatParams[i + 1]].SetMainTag(CompatParams[i + 2]);
}
i += 3;
break;

View file

@ -1158,7 +1158,7 @@ void FParser::SF_ObjSector(void)
}
t_return.type = svt_int;
t_return.value.i = mo ? mo->Sector->GetTag() : 0; // nullptr check
t_return.value.i = mo ? mo->Sector->GetMainTag() : 0; // nullptr check
}
//==========================================================================
@ -4388,7 +4388,8 @@ void FParser::SF_ChangeTag()
{
for (int secnum = -1; (secnum = P_FindSectorFromTag (t_argv[0].value.i, secnum)) >= 0; )
{
sectors[secnum].SetTag(t_argv[1].value.i);
sectors[secnum].ClearTags();
sectors[secnum].SetMainTag(t_argv[1].value.i);
}
sector_t::HashTags();
}

View file

@ -636,7 +636,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
}
else if ((sec->special & 0xFF) == Scroll_StrifeCurrent)
{
int anglespeed = sec->GetTag() - 100;
int anglespeed = sec->GetMainTag() - 100;
fixed_t speed = (anglespeed % 10) << (FRACBITS - 4);
angle_t finean = (anglespeed / 10) << (32-3);
finean >>= ANGLETOFINESHIFT;

View file

@ -3437,7 +3437,7 @@ void AActor::Tick ()
}
else if (scrolltype == Scroll_StrifeCurrent)
{ // Strife scroll special
int anglespeed = sec->GetTag() - 100;
int anglespeed = sec->GetMainTag() - 100;
fixed_t carryspeed = DivScale32 (anglespeed % 10, 16*CARRYFACTOR);
angle_t fineangle = (anglespeed / 10) << (32-3);
fineangle >>= ANGLETOFINESHIFT;

View file

@ -830,16 +830,21 @@ bool sector_t::HasTag(int checktag) const
return tag == checktag;
}
void sector_t::SetTag(int tagnum, bool discardall)
void sector_t::SetMainTag(int tagnum)
{
tag = tagnum;
}
int sector_t::GetTag() const
int sector_t::GetMainTag() const
{
return tag;
}
void sector_t::ClearTags()
{
tag = 0;
}
void sector_t::HashTags()
{
int i;

View file

@ -1514,7 +1514,7 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
else // [RH] Translate to new sector special
ss->special = P_TranslateSectorSpecial (LittleShort(ms->special));
ss->secretsector = !!(ss->special&SECRET_MASK);
ss->SetTag(LittleShort(ms->tag));
ss->SetMainTag(LittleShort(ms->tag));
ss->thinglist = NULL;
ss->touching_thinglist = NULL; // phares 3/14/98
ss->seqType = defSeqType;
@ -3131,9 +3131,9 @@ static void P_GroupLines (bool buildmap)
{
if (sector->linecount == 0)
{
Printf ("Sector %i (tag %i) has no lines\n", i, sector->GetTag());
Printf ("Sector %i (tag %i) has no lines\n", i, sector->GetMainTag());
// 0 the sector's tag so that no specials can use it
sector->SetTag(0);
sector->ClearTags();
}
else
{

View file

@ -1316,7 +1316,7 @@ public:
continue;
case NAME_Id:
sec->SetTag((short)CheckInt(key), false);
sec->SetMainTag((short)CheckInt(key));
continue;
default:

View file

@ -262,7 +262,7 @@ static int WriteSECTORS (FILE *file)
uppercopy (ms.ceilingpic, GetTextureName (sectors[i].GetTexture(sector_t::ceiling)));
ms.lightlevel = LittleShort((short)sectors[i].lightlevel);
ms.special = LittleShort(sectors[i].special);
ms.tag = LittleShort(sectors[i].GetTag());
ms.tag = LittleShort(sectors[i].GetMainTag());
fwrite (&ms, sizeof(ms), 1, file);
}
return numsectors * sizeof(ms);

View file

@ -304,7 +304,7 @@ void P_TranslateTeleportThings ()
while ( (dest = iterator.Next()) )
{
if (dest->Sector->GetTag() == 0)
if (dest->Sector->GetMainTag() == 0)
{
dest->tid = 1;
dest->AddToHash ();

View file

@ -634,8 +634,9 @@ struct sector_t
}
bool HasTag(int checktag) const;
void SetTag(int tagnum, bool discardall = true);
int GetTag() const;
void SetMainTag(int tagnum);
int GetMainTag() const;
void ClearTags();
static void HashTags();
bool PlaneMoving(int pos);