by Xaser » Tue Dec 06, 2016 8:25 pm
Stumbled across some undefined behavior while tinkering with
this idea. If you directly actor's sprite property in a function (via passing a sprite name to GetSpriteIndex) to any sprite that isn't used somewhere on an actor state, GetSpriteIndex returns junk. This results in "invalid sprite number" console spam in the software renderer and a crash in GL.
A rather silly test:
Summon "GoodSprite" and you'll see a Doom Imp ball. Summon "BadSprite" and you'll see "R_ProjectSprite: invalid sprite number 4294967295" spammed to the console (or a good ol' crash). The only difference between the two actors are the parameters to GetSpriteIndex -- "BAL1" on the former and "BALX" (a custom sprite included in the pk3, used nowhere else) on the latter.
Possibly a [Don't do that], but let's find out.
Stumbled across some undefined behavior while tinkering with [url=http://forum.zdoom.org/viewtopic.php?p=959979#p959979]this idea[/url]. If you directly actor's sprite property in a function (via passing a sprite name to GetSpriteIndex) to any sprite that isn't used somewhere on an actor state, GetSpriteIndex returns junk. This results in "invalid sprite number" console spam in the software renderer and a crash in GL.
A rather silly test:
[attachment=0]setSpriteError.pk3[/attachment]
Summon "GoodSprite" and you'll see a Doom Imp ball. Summon "BadSprite" and you'll see "R_ProjectSprite: invalid sprite number 4294967295" spammed to the console (or a good ol' crash). The only difference between the two actors are the parameters to GetSpriteIndex -- "BAL1" on the former and "BALX" (a custom sprite included in the pk3, used nowhere else) on the latter.
Possibly a [Don't do that], but let's find out. :P