mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- simplified PicForName
This commit is contained in:
parent
6d9a8bfaa5
commit
bbfb811e1e
1 changed files with 28 additions and 45 deletions
|
@ -7,56 +7,39 @@ BEGIN_DUKE_NS
|
|||
|
||||
void resetswitch(int tag);
|
||||
|
||||
static TMap<FName, int> classnameToTile;
|
||||
// Workaround so that the script code can be written in its final form. This must go away later.
|
||||
int PicForName(int intname)
|
||||
{
|
||||
int picnum = -1;
|
||||
// this is still a hack so it can spawn actors which haven't been scriptified yet. This will go away later.
|
||||
if (FName(ENamedName(intname)) == FName("DukeToiletWater"))
|
||||
if (classnameToTile.CountUsed() == 0)
|
||||
{
|
||||
picnum = TileFiles.tileForName("TOILETWATER");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("DukeBurning"))
|
||||
static std::pair<const char*, const char*> classes[] = {
|
||||
{ "DukeToiletWater", "TOILETWATER" },
|
||||
{ "DukeBurning", "BURNIMG"},
|
||||
{"DukeBloodPool","BLOODPOOL"},
|
||||
{"DukeExplosion2","EXPLOSION2"},
|
||||
{"DukeExplosion2Bot","EXPLOSION2BOT"},
|
||||
{"DukeTransporterStar", "TRANSPORTERSTAR"},
|
||||
{"RedneckRabbit","RABBIT"},
|
||||
{"RedneckFeather","FEATHER"},
|
||||
{"DukeBatteryAmmo", "BATTERYAMMO"},
|
||||
{"RedneckDynamite", "DYNAMITE"},
|
||||
{"DukeSixpak", "SIXPAK"},
|
||||
{"DukeAtomicHealth", "ATOMICHEALTH"},
|
||||
{"DukeShrinkerExplosion", "SHRINKEREXPLOSION" },
|
||||
{"DukeWaterBubble", "WATERBUBBLE"},
|
||||
{"DukeLavaPool", "LAVAPOOL"},
|
||||
{"RedneckCircleStuck", "CIRCLESTUCK"}
|
||||
};
|
||||
|
||||
for (auto& p : classes)
|
||||
{
|
||||
picnum = TileFiles.tileForName("BURNIMG");
|
||||
classnameToTile.Insert(FName(p.first), TileFiles.tileForName(p.second));
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("DukeBloodPool"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("BLOODPOOL");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("DukeExplosion2"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("EXPLOSION2");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("DukeTransporterStar"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("TRANSPORTERSTAR");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("RedneckRabbit"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("RABBIT");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("RedneckFeather"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("FEATHER");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("DukeBatteryAmmo"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("BATTERYAMMO");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("RedneckDynamite"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("DYNAMITE");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("DukeSixpak"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("SIXPAK");
|
||||
}
|
||||
else if (FName(ENamedName(intname)) == FName("DukeAtomicHealth"))
|
||||
{
|
||||
picnum = TileFiles.tileForName("ATOMICHEALTH");
|
||||
}
|
||||
return picnum;
|
||||
auto p = classnameToTile.CheckKey(FName(ENamedName(intname)));
|
||||
if (p) return *p;
|
||||
return -1;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue