Added GetTerrainDef and Sector variant of GetFloorTerrain.

- GetTerrainDef takes the raw number of the Terrains[] index. Can return null.
- GetFloorTerrain (Sector) gets the defs from the position given (either Sector.Floor or Sector.Ceiling).
This commit is contained in:
Major Cooke 2022-02-21 18:27:03 -06:00 committed by Christoph Oelckers
commit 579c4152d2
5 changed files with 31 additions and 0 deletions

View file

@ -938,6 +938,16 @@ int GetTerrain(const sector_t *sector, int pos)
return sector->terrainnum[pos] >= 0 ? sector->terrainnum[pos] : TerrainTypes[sector->GetTexture(pos)];
}
FTerrainDef *GetFloorTerrain_S(const sector_t* sec, int pos)
{
return &Terrains[GetTerrain(sec, pos)];
}
FTerrainDef *GetTerrainDef(const unsigned int num)
{
return (num >= 0 && num < Terrains.Size()) ? &Terrains[num] : nullptr;
}
//=====================================================================================
//
//