6534: Don't render switch number and delay for tiles where they are unused, ignore switch tiles that don't use number for free slot finder, refactoring r=def- a=Robyt3

Closes #5995.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
This commit is contained in:
bors[bot] 2023-04-26 17:49:25 +00:00 committed by GitHub
commit 6dd38c7da0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 150 deletions

View file

@ -667,7 +667,7 @@ void CMapLayers::OnMapLoad()
Flags = 0;
if(CurOverlay == 1)
{
if(Index != TILE_TELECHECKIN && Index != TILE_TELECHECKINEVIL)
if(IsTeleTileNumberUsed(Index))
Index = ((CTeleTile *)pTiles)[y * pTMap->m_Width + x].m_Number;
else
Index = 0;

View file

@ -456,7 +456,7 @@ void CRenderTools::RenderTeleOverlay(CTeleTile *pTele, int w, int h, float Scale
int c = mx + my * w;
unsigned char Index = pTele[c].m_Number;
if(Index && pTele[c].m_Type != TILE_TELECHECKIN && pTele[c].m_Type != TILE_TELECHECKINEVIL)
if(Index && IsTeleTileNumberUsed(pTele[c].m_Type))
{
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Index);
@ -575,7 +575,7 @@ void CRenderTools::RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float
int c = mx + my * w;
unsigned char Index = pSwitch[c].m_Number;
if(Index)
if(Index && IsSwitchTileNumberUsed(pSwitch[c].m_Type))
{
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Index);
@ -585,7 +585,7 @@ void CRenderTools::RenderSwitchOverlay(CSwitchTile *pSwitch, int w, int h, float
}
unsigned char Delay = pSwitch[c].m_Delay;
if(Delay)
if(Delay && IsSwitchTileDelayUsed(pSwitch[c].m_Type))
{
char aBuf[16];
str_format(aBuf, sizeof(aBuf), "%d", Delay);

View file

@ -634,30 +634,18 @@ int CCollision::IsEvilTeleport(int Index) const
return 0;
}
int CCollision::IsCheckTeleport(int Index) const
bool CCollision::IsCheckTeleport(int Index) const
{
if(Index < 0)
return 0;
if(!m_pTele)
return 0;
if(m_pTele[Index].m_Type == TILE_TELECHECKIN)
return m_pTele[Index].m_Number;
return 0;
if(Index < 0 || !m_pTele)
return false;
return m_pTele[Index].m_Type == TILE_TELECHECKIN;
}
int CCollision::IsCheckEvilTeleport(int Index) const
bool CCollision::IsCheckEvilTeleport(int Index) const
{
if(Index < 0)
return 0;
if(!m_pTele)
return 0;
if(m_pTele[Index].m_Type == TILE_TELECHECKINEVIL)
return m_pTele[Index].m_Number;
return 0;
if(Index < 0 || !m_pTele)
return false;
return m_pTele[Index].m_Type == TILE_TELECHECKINEVIL;
}
int CCollision::IsTeleCheckpoint(int Index) const

View file

@ -84,8 +84,8 @@ public:
int GetFTileFlags(int Index) const;
int IsTeleport(int Index) const;
int IsEvilTeleport(int Index) const;
int IsCheckTeleport(int Index) const;
int IsCheckEvilTeleport(int Index) const;
bool IsCheckTeleport(int Index) const;
bool IsCheckEvilTeleport(int Index) const;
int IsTeleportWeapon(int Index) const;
int IsTeleportHook(int Index) const;
int IsTeleCheckpoint(int Index) const;

View file

@ -220,44 +220,9 @@ public:
bool IsEmpty() const
{
return m_vpLayers.size() == 0; // stupid function, since its bad for Fillselection: TODO add a function for Fillselection that returns whether a specific tile is used in the given layer
return m_vpLayers.empty();
}
/*bool IsUsedInThisLayer(int Layer, int Index) // <--------- this is what i meant but cause i don't know which Indexes belongs to which layers i can't finish yet
{
switch Layer
{
case LAYERTYPE_GAME: // security
return true;
case LAYERTYPE_FRONT:
return true;
case LAYERTYPE_TELE:
{
if (Index ==) // you could add an 2D array into mapitems.h which defines which Indexes belong to which layer(s)
}
case LAYERTYPE_SPEEDUP:
{
if (Index == TILE_BOOST)
return true;
else
return false;
}
case LAYERTYPE_SWITCH:
{
}
case LAYERTYPE_TUNE:
{
if (Index == TILE_TUNE)
return true;
else
return false;
}
default:
return false;
}
}*/
void OnEdited()
{
if(!m_CustomParallaxZoom)

View file

@ -707,27 +707,15 @@ bool CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Stora
unsigned int Size = DataFile.GetDataSize(pTilemapItem->m_Tele);
if(Size >= (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTeleTile))
{
static const int s_aTilesRep[] = {
TILE_TELEIN,
TILE_TELEINEVIL,
TILE_TELEOUT,
TILE_TELECHECK,
TILE_TELECHECKIN,
TILE_TELECHECKINEVIL,
TILE_TELECHECKOUT,
TILE_TELEINWEAPON,
TILE_TELEINHOOK};
CTeleTile *pLayerTeleTiles = ((CLayerTele *)pTiles)->m_pTeleTile;
mem_copy(pLayerTeleTiles, pTeleData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTeleTile));
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
pTiles->m_pTiles[i].m_Index = 0;
for(int TilesRep : s_aTilesRep)
{
if(pLayerTeleTiles[i].m_Type == TilesRep)
pTiles->m_pTiles[i].m_Index = TilesRep;
}
if(IsValidTeleTile(pLayerTeleTiles[i].m_Type))
pTiles->m_pTiles[i].m_Index = pLayerTeleTiles[i].m_Type;
else
pTiles->m_pTiles[i].m_Index = 0;
}
}
DataFile.UnloadData(pTilemapItem->m_Tele);
@ -744,8 +732,8 @@ bool CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Stora
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
if(pLayerSpeedupTiles[i].m_Force > 0)
pTiles->m_pTiles[i].m_Index = TILE_BOOST;
if(IsValidSpeedupTile(pLayerSpeedupTiles[i].m_Type) && pLayerSpeedupTiles[i].m_Force > 0)
pTiles->m_pTiles[i].m_Index = pLayerSpeedupTiles[i].m_Type;
else
pTiles->m_pTiles[i].m_Index = 0;
}
@ -768,29 +756,12 @@ bool CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Stora
unsigned int Size = DataFile.GetDataSize(pTilemapItem->m_Switch);
if(Size >= (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CSwitchTile))
{
const int s_aTilesComp[] = {
TILE_SWITCHTIMEDOPEN,
TILE_SWITCHTIMEDCLOSE,
TILE_SWITCHOPEN,
TILE_SWITCHCLOSE,
TILE_FREEZE,
TILE_DFREEZE,
TILE_DUNFREEZE,
TILE_LFREEZE,
TILE_LUNFREEZE,
TILE_HIT_ENABLE,
TILE_HIT_DISABLE,
TILE_JUMP,
TILE_ADD_TIME,
TILE_SUBTRACT_TIME,
TILE_ALLOW_TELE_GUN,
TILE_ALLOW_BLUE_TELE_GUN};
CSwitchTile *pLayerSwitchTiles = ((CLayerSwitch *)pTiles)->m_pSwitchTile;
mem_copy(pLayerSwitchTiles, pSwitchData, (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CSwitchTile));
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
if(((pLayerSwitchTiles[i].m_Type > (ENTITY_CRAZY_SHOTGUN + ENTITY_OFFSET) && ((CLayerSwitch *)pTiles)->m_pSwitchTile[i].m_Type < (ENTITY_DRAGGER_WEAK + ENTITY_OFFSET)) || ((CLayerSwitch *)pTiles)->m_pSwitchTile[i].m_Type == (ENTITY_LASER_O_FAST + 1 + ENTITY_OFFSET)))
if(((pLayerSwitchTiles[i].m_Type > (ENTITY_CRAZY_SHOTGUN + ENTITY_OFFSET) && pLayerSwitchTiles[i].m_Type < (ENTITY_DRAGGER_WEAK + ENTITY_OFFSET)) || pLayerSwitchTiles[i].m_Type == (ENTITY_LASER_O_FAST + 1 + ENTITY_OFFSET)))
continue;
else if(pLayerSwitchTiles[i].m_Type >= (ENTITY_ARMOR_1 + ENTITY_OFFSET) && pLayerSwitchTiles[i].m_Type <= (ENTITY_DOOR + ENTITY_OFFSET))
{
@ -799,13 +770,10 @@ bool CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Stora
continue;
}
for(int TilesComp : s_aTilesComp)
if(IsValidSwitchTile(pLayerSwitchTiles[i].m_Type))
{
if(pLayerSwitchTiles[i].m_Type == TilesComp)
{
pTiles->m_pTiles[i].m_Index = TilesComp;
pTiles->m_pTiles[i].m_Flags = pLayerSwitchTiles[i].m_Flags;
}
pTiles->m_pTiles[i].m_Index = pLayerSwitchTiles[i].m_Type;
pTiles->m_pTiles[i].m_Flags = pLayerSwitchTiles[i].m_Flags;
}
}
}
@ -822,8 +790,8 @@ bool CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Stora
for(int i = 0; i < pTiles->m_Width * pTiles->m_Height; i++)
{
if(pLayerTuneTiles[i].m_Type == TILE_TUNE)
pTiles->m_pTiles[i].m_Index = TILE_TUNE;
if(IsValidTuneTile(pLayerTuneTiles[i].m_Type))
pTiles->m_pTiles[i].m_Index = pLayerTuneTiles[i].m_Type;
else
pTiles->m_pTiles[i].m_Index = 0;
}

View file

@ -259,11 +259,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
for(int x = 0; x < r.w; x++)
{
pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x] = ((CLayerTele *)this)->m_pTeleTile[(r.y + y) * m_Width + (r.x + x)];
if(pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type == TILE_TELEIN || pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type == TILE_TELEOUT || pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type == TILE_TELEINEVIL
// || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECKINEVIL
|| pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type == TILE_TELECHECK || pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type == TILE_TELECHECKOUT
// || pGrabbed->m_pTeleTile[y*pGrabbed->m_Width+x].m_Type == TILE_TELECHECKIN
|| pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type == TILE_TELEINWEAPON || pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type == TILE_TELEINHOOK)
if(IsValidTeleTile(pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type) && IsTeleTileNumberUsed(pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Type))
{
m_pEditor->m_TeleNumber = pGrabbed->m_pTeleTile[y * pGrabbed->m_Width + x].m_Number;
}
@ -297,7 +293,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
for(int x = 0; x < r.w; x++)
{
pGrabbed->m_pSpeedupTile[y * pGrabbed->m_Width + x] = ((CLayerSpeedup *)this)->m_pSpeedupTile[(r.y + y) * m_Width + (r.x + x)];
if(pGrabbed->m_pSpeedupTile[y * pGrabbed->m_Width + x].m_Type == TILE_BOOST)
if(IsValidSpeedupTile(pGrabbed->m_pSpeedupTile[y * pGrabbed->m_Width + x].m_Type))
{
m_pEditor->m_SpeedupAngle = pGrabbed->m_pSpeedupTile[y * pGrabbed->m_Width + x].m_Angle;
m_pEditor->m_SpeedupForce = pGrabbed->m_pSpeedupTile[y * pGrabbed->m_Width + x].m_Force;
@ -335,21 +331,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
for(int x = 0; x < r.w; x++)
{
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x] = ((CLayerSwitch *)this)->m_pSwitchTile[(r.y + y) * m_Width + (r.x + x)];
if(pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == ENTITY_DOOR + ENTITY_OFFSET ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_HIT_ENABLE ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_HIT_DISABLE ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_SWITCHOPEN ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_SWITCHCLOSE ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_SWITCHTIMEDOPEN ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_SWITCHTIMEDCLOSE ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == ENTITY_LASER_LONG + ENTITY_OFFSET ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == ENTITY_LASER_MEDIUM + ENTITY_OFFSET ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == ENTITY_LASER_SHORT + ENTITY_OFFSET ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_JUMP ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_ADD_TIME ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_SUBTRACT_TIME ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_ALLOW_TELE_GUN ||
pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type == TILE_ALLOW_BLUE_TELE_GUN)
if(IsValidSwitchTile(pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Type))
{
m_pEditor->m_SwitchNum = pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Number;
m_pEditor->m_SwitchDelay = pGrabbed->m_pSwitchTile[y * pGrabbed->m_Width + x].m_Delay;
@ -386,7 +368,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
for(int x = 0; x < r.w; x++)
{
pGrabbed->m_pTuneTile[y * pGrabbed->m_Width + x] = ((CLayerTune *)this)->m_pTuneTile[(r.y + y) * m_Width + (r.x + x)];
if(pGrabbed->m_pTuneTile[y * pGrabbed->m_Width + x].m_Type == TILE_TUNE)
if(IsValidTuneTile(pGrabbed->m_pTuneTile[y * pGrabbed->m_Width + x].m_Type))
{
m_pEditor->m_TuningNum = pGrabbed->m_pTuneTile[y * pGrabbed->m_Width + x].m_Number;
}
@ -1120,7 +1102,6 @@ void CLayerTiles::ModifyEnvelopeIndex(INDEX_MODIFY_FUNC Func)
CLayerTele::CLayerTele(int w, int h) :
CLayerTiles(w, h)
{
//m_Type = LAYERTYPE_TELE;
str_copy(m_aName, "Tele", sizeof(m_aName));
m_Tele = 1;
@ -1198,12 +1179,20 @@ void CLayerTele::BrushDraw(CLayer *pBrush, float wx, float wy)
if((m_pEditor->m_AllowPlaceUnusedTiles || IsValidTeleTile(pTeleLayer->m_pTiles[y * pTeleLayer->m_Width + x].m_Index)) && pTeleLayer->m_pTiles[y * pTeleLayer->m_Width + x].m_Index != TILE_AIR)
{
if(m_pEditor->m_TeleNumber != pTeleLayer->m_TeleNum)
if(!IsTeleTileNumberUsed(pTeleLayer->m_pTiles[y * pTeleLayer->m_Width + x].m_Index))
{
// Tele tile number is unused. Set a known value which is not 0,
// as tiles with number 0 would be ignored by previous versions.
m_pTeleTile[fy * m_Width + fx].m_Number = 255;
}
else if(m_pEditor->m_TeleNumber != pTeleLayer->m_TeleNum)
{
m_pTeleTile[fy * m_Width + fx].m_Number = m_pEditor->m_TeleNumber;
}
else if(pTeleLayer->m_pTeleTile[y * pTeleLayer->m_Width + x].m_Number)
{
m_pTeleTile[fy * m_Width + fx].m_Number = pTeleLayer->m_pTeleTile[y * pTeleLayer->m_Width + x].m_Number;
}
else
{
if(!m_pEditor->m_TeleNumber)
@ -1336,11 +1325,7 @@ bool CLayerTele::ContainsElementWithId(int Id)
{
for(int x = 0; x < m_Width; ++x)
{
if(m_pTeleTile[y * m_Width + x].m_Type == TILE_TELECHECKIN)
continue;
if(m_pTeleTile[y * m_Width + x].m_Type == TILE_TELECHECKINEVIL)
continue;
if(m_pTeleTile[y * m_Width + x].m_Number == Id)
if(IsTeleTileNumberUsed(m_pTeleTile[y * m_Width + x].m_Type) && m_pTeleTile[y * m_Width + x].m_Number == Id)
{
return true;
}
@ -1353,7 +1338,6 @@ bool CLayerTele::ContainsElementWithId(int Id)
CLayerSpeedup::CLayerSpeedup(int w, int h) :
CLayerTiles(w, h)
{
//m_Type = LAYERTYPE_SPEEDUP;
str_copy(m_aName, "Speedup", sizeof(m_aName));
m_Speedup = 1;
@ -1591,7 +1575,6 @@ void CLayerSpeedup::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
CLayerFront::CLayerFront(int w, int h) :
CLayerTiles(w, h)
{
//m_Type = LAYERTYPE_FRONT;
str_copy(m_aName, "Front", sizeof(m_aName));
m_Front = 1;
}
@ -1638,7 +1621,6 @@ void CLayerFront::Resize(int NewW, int NewH)
CLayerSwitch::CLayerSwitch(int w, int h) :
CLayerTiles(w, h)
{
//m_Type = LAYERTYPE_SWITCH;
str_copy(m_aName, "Switch", sizeof(m_aName));
m_Switch = 1;
@ -1739,6 +1721,19 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
m_pSwitchTile[fy * m_Width + fx].m_Flags = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Flags;
m_pTiles[fy * m_Width + fx].m_Index = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index;
m_pTiles[fy * m_Width + fx].m_Flags = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Flags;
if(!IsSwitchTileFlagsUsed(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index))
{
m_pSwitchTile[fy * m_Width + fx].m_Flags = 0;
}
if(!IsSwitchTileNumberUsed(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index))
{
m_pSwitchTile[fy * m_Width + fx].m_Number = 0;
}
if(!IsSwitchTileDelayUsed(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index))
{
m_pSwitchTile[fy * m_Width + fx].m_Delay = 0;
}
}
else
{
@ -1748,16 +1743,6 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
m_pSwitchTile[fy * m_Width + fx].m_Delay = 0;
m_pTiles[fy * m_Width + fx].m_Index = 0;
}
if(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index == TILE_FREEZE)
{
m_pSwitchTile[fy * m_Width + fx].m_Flags = 0;
}
else if(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index == TILE_DFREEZE || pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index == TILE_DUNFREEZE)
{
m_pSwitchTile[fy * m_Width + fx].m_Flags = 0;
m_pSwitchTile[fy * m_Width + fx].m_Delay = 0;
}
}
FlagModified(sx, sy, pSwitchLayer->m_Width, pSwitchLayer->m_Height);
}
@ -1880,7 +1865,7 @@ bool CLayerSwitch::ContainsElementWithId(int Id)
{
for(int x = 0; x < m_Width; ++x)
{
if(m_pSwitchTile[y * m_Width + x].m_Number == Id)
if(IsSwitchTileNumberUsed(m_pSwitchTile[y * m_Width + x].m_Type) && m_pSwitchTile[y * m_Width + x].m_Number == Id)
{
return true;
}
@ -1895,7 +1880,6 @@ bool CLayerSwitch::ContainsElementWithId(int Id)
CLayerTune::CLayerTune(int w, int h) :
CLayerTiles(w, h)
{
//m_Type = LAYERTYPE_TUNE;
str_copy(m_aName, "Tune", sizeof(m_aName));
m_Tune = 1;

View file

@ -57,6 +57,12 @@ bool IsValidTeleTile(int Index)
Index == TILE_TELECHECKINEVIL);
}
bool IsTeleTileNumberUsed(int Index)
{
return Index != TILE_TELECHECKIN &&
Index != TILE_TELECHECKINEVIL;
}
bool IsValidSpeedupTile(int Index)
{
return Index == TILE_BOOST;
@ -81,6 +87,28 @@ bool IsValidSwitchTile(int Index)
(IsValidEntity(Index) && Index >= ENTITY_OFFSET + ENTITY_ARMOR_1));
}
bool IsSwitchTileFlagsUsed(int Index)
{
return Index != TILE_FREEZE &&
Index != TILE_DFREEZE &&
Index != TILE_DUNFREEZE;
}
bool IsSwitchTileNumberUsed(int Index)
{
return Index != TILE_JUMP &&
Index != TILE_HIT_ENABLE &&
Index != TILE_HIT_DISABLE &&
Index != TILE_ALLOW_TELE_GUN &&
Index != TILE_ALLOW_BLUE_TELE_GUN;
}
bool IsSwitchTileDelayUsed(int Index)
{
return Index != TILE_DFREEZE &&
Index != TILE_DUNFREEZE;
}
bool IsValidTuneTile(int Index)
{
return Index == TILE_TUNE;

View file

@ -489,8 +489,12 @@ public:
bool IsValidGameTile(int Index);
bool IsValidFrontTile(int Index);
bool IsValidTeleTile(int Index);
bool IsTeleTileNumberUsed(int Index); // Assumes that Index is a valid tele tile index
bool IsValidSpeedupTile(int Index);
bool IsValidSwitchTile(int Index);
bool IsSwitchTileFlagsUsed(int Index); // Assumes that Index is a valid switch tile index
bool IsSwitchTileNumberUsed(int Index); // Assumes that Index is a valid switch tile index
bool IsSwitchTileDelayUsed(int Index); // Assumes that Index is a valid switch tile index
bool IsValidTuneTile(int Index);
bool IsValidEntity(int Index);
bool IsRotatableTile(int Index);