ZDoom / gzdoom

GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
http://zdoom.org
GNU General Public License v3.0
2.46k stars 539 forks source link

[BUG] Actors can't use skin sprites. #2716

Open inkoalawetrust opened 1 week ago

inkoalawetrust commented 1 week ago

GZDoom version

g4.12pre-480-g14a57b8de-m

Which game are you running with GZDoom?

Doom 2

What Operating System are you using?

None

Please describe your specific OS version

No response

Relevant hardware info

No response

Have you checked that no other similar issue already exists?

A clear and concise description of what the bug is.

The sprites of player skins cannot be applied to actors.

For example, if you make a morph class that when morphed into, spawns an fake actor that takes the See: state sprites of the unmorphed player using State.GetSpriteTexture(). It will take the PLAY sprite and paste it to the fake actor.

But if you also make GetSpriteTexture() take that states' sprite while accounting for the players' skin. It will properly return the skin graphic name (i.e in the example skin I've attached, the sprite name is TRCH). But trying to then apply that sprite name to the fake actors' curstate.sprite field with GetSpriteIndex() will NOT work, it just makes the fake actor invisible, nor will directly using the spritename in GetSpriteIndex like GetSpriteIndex("TRCH") work. Nor will changing the fake actor to just have TRCH A as its' default sprite work. And if you say, try to make a custom Imp that uses TRCH in his' Spawn: state, the sprite will be invalid and turn the Imp into an unknown actor placeholder.

Steps to reproduce the behaviour.

Explain how to reproduce

  1. Download the attached ZIP file below.
  2. Load both Skin Grab Bag.wad and SkinExample.zip
  3. Open up GZDoom.
  4. Type "morphme SkinSnatcherPlayer"
  5. One of two things will happen, if you kept your skin as the default. The morph should just spawn an actor with the DoomPlayers' See: sprite, and the snatched sprite in the console should be returned as "PLAY". If you changed your skin to "CMBTurret", the fake actor will have successfully snatched "TRCH" and say so in the console, and apply it to itself. But the sprite will be invisible. SkinBug.zip

Your configuration

No response

Provide a Log

No response

prof-hastig commented 1 week ago

If you look at the setup code you will see that skins are treated as a completely separate kind of resource entity, so it is not surprising they cannot be used as regular sprites.

Just imagine what would happen otherwise if your skin was named BOSS, for example...