- moved the tag manager into FLevelLocals
This commit is contained in:
parent
7e9340f3b7
commit
97495e1857
10 changed files with 51 additions and 78 deletions
|
|
@ -296,33 +296,6 @@ PClassActor *T_ClassType(const svalue_t &arg)
|
|||
return PClass::FindActor(stringvalue(arg));
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Finds a sector from a tag. This has been extended to allow looking for
|
||||
// sectors directly by passing a negative value
|
||||
//
|
||||
//==========================================================================
|
||||
class FSSectorTagIterator : public FSectorTagIterator
|
||||
{
|
||||
public:
|
||||
FSSectorTagIterator(int tag)
|
||||
: FSectorTagIterator(tag)
|
||||
{
|
||||
if (tag < 0)
|
||||
{
|
||||
searchtag = INT_MIN;
|
||||
start = tag == -32768? 0 : -tag < (int)level.sectors.Size()? -tag : -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
inline int T_FindFirstSectorFromTag(int tagnum)
|
||||
{
|
||||
FSSectorTagIterator it(tagnum);
|
||||
return it.Next();
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Get an ammo type
|
||||
|
|
@ -1518,7 +1491,7 @@ void FParser::SF_StartSectorSound(void)
|
|||
tagnum = intvalue(t_argv[0]);
|
||||
|
||||
int i=-1;
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
sector = &Level->sectors[i];
|
||||
|
|
@ -1555,7 +1528,7 @@ void FParser::SF_FloorHeight(void)
|
|||
|
||||
// set all sectors with tag
|
||||
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
auto &sec = Level->sectors[i];
|
||||
|
|
@ -1574,7 +1547,7 @@ void FParser::SF_FloorHeight(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
secnum = T_FindFirstSectorFromTag(tagnum);
|
||||
secnum = Level->FindFirstSectorFromTag(tagnum);
|
||||
if(secnum < 0)
|
||||
{
|
||||
script_error("sector not found with tagnum %i\n", tagnum);
|
||||
|
|
@ -1610,7 +1583,7 @@ void FParser::SF_MoveFloor(void)
|
|||
|
||||
// move all sectors with tag
|
||||
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
{
|
||||
P_CreateFloor(&Level->sectors[secnum], DFloor::floorMoveToValue, NULL, platspeed, destheight, crush, 0, false, false);
|
||||
|
|
@ -1645,7 +1618,7 @@ void FParser::SF_CeilingHeight(void)
|
|||
dest = floatvalue(t_argv[1]);
|
||||
|
||||
// set all sectors with tag
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
auto &sec = Level->sectors[i];
|
||||
|
|
@ -1664,7 +1637,7 @@ void FParser::SF_CeilingHeight(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
secnum = T_FindFirstSectorFromTag(tagnum);
|
||||
secnum = Level->FindFirstSectorFromTag(tagnum);
|
||||
if(secnum < 0)
|
||||
{
|
||||
script_error("sector not found with tagnum %i\n", tagnum);
|
||||
|
|
@ -1702,7 +1675,7 @@ void FParser::SF_MoveCeiling(void)
|
|||
silent=t_argc>4 ? intvalue(t_argv[4]):1;
|
||||
|
||||
// move all sectors with tag
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((secnum = itr.Next()) >= 0)
|
||||
{
|
||||
P_CreateCeiling(&Level->sectors[secnum], DCeiling::ceilMoveToValue, NULL, tagnum, platspeed, platspeed, destheight, crush, silent | 4, 0, DCeiling::ECrushMode::crushDoom);
|
||||
|
|
@ -1727,7 +1700,7 @@ void FParser::SF_LightLevel(void)
|
|||
tagnum = intvalue(t_argv[0]);
|
||||
|
||||
// argv is sector tag
|
||||
secnum = T_FindFirstSectorFromTag(tagnum);
|
||||
secnum = Level->FindFirstSectorFromTag(tagnum);
|
||||
|
||||
if(secnum < 0)
|
||||
{
|
||||
|
|
@ -1741,7 +1714,7 @@ void FParser::SF_LightLevel(void)
|
|||
int i = -1;
|
||||
|
||||
// set all sectors with tag
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
Level->sectors[i].SetLightLevel(intvalue(t_argv[1]));
|
||||
|
|
@ -1882,7 +1855,7 @@ void FParser::SF_FloorTexture(void)
|
|||
tagnum = intvalue(t_argv[0]);
|
||||
|
||||
// argv is sector tag
|
||||
secnum = T_FindFirstSectorFromTag(tagnum);
|
||||
secnum = Level->FindFirstSectorFromTag(tagnum);
|
||||
|
||||
if(secnum < 0)
|
||||
{ script_error("sector not found with tagnum %i\n", tagnum); return;}
|
||||
|
|
@ -1895,7 +1868,7 @@ void FParser::SF_FloorTexture(void)
|
|||
FTextureID picnum = TexMan.GetTextureID(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
|
||||
|
||||
// set all sectors with tag
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
Level->sectors[i].SetTexture(sector_t::floor, picnum);
|
||||
|
|
@ -1934,7 +1907,7 @@ void FParser::SF_SectorColormap(void)
|
|||
tagnum = intvalue(t_argv[0]);
|
||||
|
||||
// argv is sector tag
|
||||
secnum = T_FindFirstSectorFromTag(tagnum);
|
||||
secnum = Level->FindFirstSectorFromTag(tagnum);
|
||||
|
||||
if(secnum < 0)
|
||||
{ script_error("sector not found with tagnum %i\n", tagnum); return;}
|
||||
|
|
@ -1945,7 +1918,7 @@ void FParser::SF_SectorColormap(void)
|
|||
{
|
||||
uint32_t cm = R_ColormapNumForName(t_argv[1].value.s);
|
||||
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
sectors[i].midmap=cm;
|
||||
|
|
@ -1972,7 +1945,7 @@ void FParser::SF_CeilingTexture(void)
|
|||
tagnum = intvalue(t_argv[0]);
|
||||
|
||||
// argv is sector tag
|
||||
secnum = T_FindFirstSectorFromTag(tagnum);
|
||||
secnum = Level->FindFirstSectorFromTag(tagnum);
|
||||
|
||||
if(secnum < 0)
|
||||
{ script_error("sector not found with tagnum %i\n", tagnum); return;}
|
||||
|
|
@ -1985,7 +1958,7 @@ void FParser::SF_CeilingTexture(void)
|
|||
FTextureID picnum = TexMan.GetTextureID(t_argv[1].string, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
|
||||
|
||||
// set all sectors with tag
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
Level->sectors[i].SetTexture(sector_t::ceiling, picnum);
|
||||
|
|
@ -3700,7 +3673,7 @@ void FParser::SF_SetColor(void)
|
|||
{
|
||||
tagnum = intvalue(t_argv[0]);
|
||||
|
||||
secnum = T_FindFirstSectorFromTag(tagnum);
|
||||
secnum = Level->FindFirstSectorFromTag(tagnum);
|
||||
|
||||
if(secnum < 0)
|
||||
{
|
||||
|
|
@ -3721,7 +3694,7 @@ void FParser::SF_SetColor(void)
|
|||
else return;
|
||||
|
||||
// set all sectors with tag
|
||||
FSSectorTagIterator itr(tagnum);
|
||||
auto itr = Level->GetSectorTagIterator(tagnum);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
Level->sectors[i].SetColor(color, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue