gzdoom/wadsrc/static/zscript/zsprite.zs
Major Cooke b6b1b25035 Added ZSprites.
- Effectively similar to Actors, but without the excess.
- Can be created with either the `level` function or the static `Spawn` function in ZSprite.
- STAT_SPRITE belongs to ZSprites only; ZSprites cannot be moved out of, nor can anything else be moved in to, this statnum.

Misc:

- Fixed (Sprite)Offset taking roll into account.

Crediting phantombeta, RicardoLuis0 and RaveYard for assistance.
2023-11-17 08:06:11 -05:00

41 lines
1,021 B
Text

Class ZSprite : Thinker native
{
native Vector3 Pos, Vel, Prev;
native Vector2 Scale, Offset;
native double Roll, Alpha;
native TextureID Texture;
native uint Translation;
native uint16 Flags;
native int16 LightLevel;
native bool bXFlip, bYFlip,
bDontInterpolate,
bAddLightLevel;
native Sector CurSector; // can be null!
native void SetTranslation(Name trans);
native void SetRenderStyle(int mode); // see ERenderStyle
native bool IsFrozen();
static ZSprite Spawn(Class<ZSprite> type, TextureID tex, Vector3 pos, Vector3 vel, double alpha = 1.0, int flags = 0,
double roll = 0.0, Vector2 scale = (1,1), Vector2 offset = (0,0), int style = STYLE_Normal, int trans = 0)
{
if (!Level) return null;
let p = level.SpawnZSprite(type);
if (p)
{
p.Texture = tex;
p.Pos = pos;
p.Vel = vel;
p.Alpha = alpha;
p.Roll = roll;
p.Scale = scale;
p.Offset = offset;
p.SetRenderStyle(style);
p.Translation = trans;
p.Flags = flags;
}
return p;
}
}