mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-19 07:01:09 +00:00
- added tileGetTextureID and tested it with Blood's mirror/portal setup code.
This commit is contained in:
parent
bfef616981
commit
f4bda94dad
2 changed files with 20 additions and 4 deletions
|
@ -304,6 +304,7 @@ struct BuildTiles
|
|||
TArray<FString> addedArt;
|
||||
TArray<FString> maptilesadded;
|
||||
TMap<FName, int> nametoindex;
|
||||
TMap<int, int> textotile;
|
||||
bool locked; // if this is true, no more tile modifications are allowed.
|
||||
|
||||
void addName(const char* name, int index)
|
||||
|
@ -314,6 +315,14 @@ struct BuildTiles
|
|||
void lock()
|
||||
{
|
||||
locked = true;
|
||||
// Now we can set up the reverse map.
|
||||
for (unsigned i = 0; i < MAXTILES; i++)
|
||||
{
|
||||
if (tiledata[i].texture != Placeholder)
|
||||
{
|
||||
textotile.Insert(tiledata[i].texture->GetID().GetIndex(), i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int tileForName(const char* name)
|
||||
|
@ -468,6 +477,12 @@ inline FGameTexture* tileGetTexture(int tile, bool animate = false)
|
|||
return TileFiles.tiledata[tile].texture;
|
||||
}
|
||||
|
||||
inline FTextureID tileGetTextureID(int tile)
|
||||
{
|
||||
if (tile < 0 || tile >= MAXTILES) return FNullTextureID();
|
||||
return TileFiles.tiledata[tile].texture->GetID();
|
||||
}
|
||||
|
||||
void tileUpdateAnimations();
|
||||
|
||||
struct TileImport
|
||||
|
|
|
@ -43,6 +43,7 @@ MIRROR mirror[16]; // only needed by Polymost.
|
|||
|
||||
void InitMirrors(void)
|
||||
{
|
||||
auto mirrortile = tileGetTextureID(504);
|
||||
mirrorcnt = 0;
|
||||
portalClear();
|
||||
|
||||
|
@ -51,7 +52,7 @@ void InitMirrors(void)
|
|||
auto pWalli = &wall[i];
|
||||
if (mirrorcnt == 16)
|
||||
break;
|
||||
if (pWalli->overpicnum == 504)
|
||||
if (pWalli->overtexture() == mirrortile)
|
||||
{
|
||||
if (pWalli->extra > 0 && pWalli->type == kWallStack)
|
||||
{
|
||||
|
@ -88,7 +89,7 @@ void InitMirrors(void)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (pWalli->wallpicnum == 504)
|
||||
if (pWalli->walltexture() == mirrortile)
|
||||
{
|
||||
mirror[mirrorcnt].link = i;
|
||||
mirror[mirrorcnt].mynum = i;
|
||||
|
@ -105,7 +106,7 @@ void InitMirrors(void)
|
|||
break;
|
||||
|
||||
auto secti = §or[i];
|
||||
if (secti->floorpicnum == 504)
|
||||
if (secti->floortexture() == mirrortile)
|
||||
{
|
||||
auto link = barrier_cast<DBloodActor*>(secti->upperLink);
|
||||
if (link == nullptr)
|
||||
|
@ -116,7 +117,7 @@ void InitMirrors(void)
|
|||
|
||||
auto sectj = link2->sector();
|
||||
int j = sectindex(sectj);
|
||||
if (sectj->ceilingpicnum != 504)
|
||||
if (sectj->ceilingtexture() != mirrortile)
|
||||
I_Error("Lower link sector %d doesn't have mirror picnum\n", j);
|
||||
mirror[mirrorcnt].type = 2;
|
||||
mirror[mirrorcnt].diff = link2->spr.pos - link->spr.pos;
|
||||
|
|
Loading…
Reference in a new issue