I thought about learning the WorldThingSpawned way but got the impression it would reduce the portability of this code. I'll give it a try and see what's it's like
Alternatively is it possible to declare the spriteIDs within the child actor and then set their values from the master after they've been spawned? Sort of the opposite of what I was doing...
Edit: Shortly after I posted I thought of a way that required little changing and makes it even simpler to manage. I added state labels to the master actors that define the top and bottom angle sprites. Then in the child actor did this:
Code: Select all
spriteID SidAngle ;
spriteID TopAngle ;
spriteID BotAngle ;
override void PostBeginPlay()
{
Super.PostBeginPlay() ;
master.SetStateLabel( "Spawn" );
self.SidAngle = master.sprite ;
master.SetStateLabel( "TopAngle" );
self.TopAngle = master.sprite ;
master.SetStateLabel( "BotAngle" );
self.BotAngle = master.sprite ;
master.SetStateLabel( "Spawn" );
}
Now all one has to do is make a definition like this:
Code: Select all
class HorizBaron : BaronOfHell Replaces BaronOfHell
{
States
{
TopAngle:
TANG # 1 ;
BotAngle:
BANG # 1 ;
}
override void BeginPlay()
{
Super.BeginPlay() ;
A_SpawnItemEx( "HorizSprites", flags: SXF_SETMASTER | SXF_ABSOLUTEANGLE
| SXF_TRANSFERPITCH | SXF_TRANSFERSPRITEFRAME | SXF_TRANSFERTRANSLATION
| SXF_TRANSFERSCALE | SXF_TRANSFERSTENCILCOL | SXF_TRANSFERALPHA
| SXF_TRANSFERRENDERSTYLE );
}
}
And voila! Support for top and bottom angles in sprites
Thanks Kodi for the suggestions. Btw, I used to find that "let" function confusing but it's starting to make more sense now
Edit2: Have put it in the script library:
Here