
An extension to Spawn, perhaps? (I suggest this but perhaps someone can imagine a fully sensible way of implementation.)
Moderator: GZDoom Developers
Code: Select all
function bool SpawnSpotSpecial(str actorClass, int spotTID, int actorTID, int angle, int special, int arg0, int arg1, int arg2, int arg3, int arg4)
{
int tempTID = UniqueTID(0);
SpawnSpot(actorClass, spotTID, tempTID, angle);
if(ThingCount(0, tempTID) > 0)
{
SetThingSpecial(tempTID, special, arg0, arg1, arg2, arg3, arg4);
Thing_ChangeTID(tempTID, actorTID);
return true;
}
else
return false;
}
Code: Select all
function bool SpawnSpotSpecial(str actorClass, int spotTID, int actorTID, int angle, int special, int arg0, int arg1, int arg2, int arg3, int arg4)
{
int tempTID = UniqueTID(0);
// Don't spawn anything if tempTID is somehow 0.
if(tempTID && SpawnSpot(actorClass, spotTID, tempTID, angle))
{
SetThingSpecial(tempTID, special, arg0, arg1, arg2, arg3, arg4);
Thing_ChangeTID(tempTID, actorTID);
return true;
}
// ACC requires a return in the main branch.
// Also, seeing as we will only reach this if spawnspot fails, there is no real need for 'else'.
return false;
}
Code: Select all
function int SpawnSpotSpecial(str actorClass, int spotTID, int actorTID, int angle, int special, int arg0, int arg1, int arg2, int arg3, int arg4)
{
int tempTID = UniqueTID(0);
int spawnCount = SpawnSpot(actorClass, spotTID, tempTID, angle);
if(spawnCount > 0)
{
SetThingSpecial(tempTID, special, arg0, arg1, arg2, arg3, arg4);
Thing_ChangeTID(tempTID, actorTID);
}
return spawnCount;
}