2023-11-22 16:29:49 +00:00
Class VisualThinker : Thinker native
2023-09-24 02:48:00 +00:00
{
2024-01-06 23:45:40 +00:00
native Vector3 Pos,
Prev;
2024-01-08 04:30:51 +00:00
native FVector3 Vel;
2024-01-06 23:45:40 +00:00
native Vector2 Scale,
Offset;
2024-01-08 04:30:51 +00:00
native float Roll,
PrevRoll,
Alpha;
2024-01-06 23:45:40 +00:00
native TextureID Texture;
2023-11-18 15:54:23 +00:00
native TranslationID Translation;
2024-01-06 23:45:40 +00:00
native int16 LightLevel;
2024-11-12 19:00:41 +00:00
native uint16 Flags;
native int VisualThinkerFlags;
FlagDef FlipOffsetX : VisualThinkerFlags, 0;
FlagDef FlipOffsetY : VisualThinkerFlags, 1;
FlagDef XFlip : VisualThinkerFlags, 2;
FlagDef YFlip : VisualThinkerFlags, 3;
FlagDef DontInterpolate : VisualThinkerFlags, 4;
FlagDef AddLightLevel : VisualThinkerFlags, 5;
2024-01-06 23:45:40 +00:00
native Color scolor;
2023-09-24 02:48:00 +00:00
2024-01-06 23:45:40 +00:00
native Sector CurSector; // can be null!
2023-09-24 02:48:00 +00:00
native void SetTranslation(Name trans);
native void SetRenderStyle(int mode); // see ERenderStyle
native bool IsFrozen();
2024-10-22 22:22:43 +00:00
native SpriteID sprite;
native uint8 frame;
2024-11-12 19:21:26 +00:00
native protected void UpdateSector(); // needs to be called if the thinker is set to a non-ticking statnum and the position is modified (or if Tick is overriden and doesn't call Super.Tick())
native protected void UpdateSpriteInfo(); // needs to be called every time the texture is updated if the thinker uses SPF_LOCAL_ANIM and is set to a non-ticking statnum (or if Tick is overriden and doesn't call Super.Tick())
2023-11-22 16:29:49 +00:00
static VisualThinker Spawn(Class<VisualThinker> type, TextureID tex, Vector3 pos, Vector3 vel, double alpha = 1.0, int flags = 0,
2024-11-12 19:00:41 +00:00
double roll = 0.0, Vector2 scale = (1,1), Vector2 offset = (0,0), int style = STYLE_Normal, TranslationID trans = 0, int VisualThinkerFlags = 0)
2023-09-24 02:48:00 +00:00
{
if (!Level) return null;
2023-11-22 16:29:49 +00:00
let p = level.SpawnVisualThinker(type);
2023-09-24 02:48:00 +00:00
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);
2023-11-18 17:05:11 +00:00
p.Translation = trans;
2023-09-24 02:48:00 +00:00
p.Flags = flags;
2024-11-12 19:00:41 +00:00
p.VisualThinkerFlags = VisualThinkerFlags;
2024-11-12 19:21:26 +00:00
p.UpdateSector();
p.UpdateSpriteInfo();
2023-09-24 02:48:00 +00:00
}
return p;
}
}