public void update(int time, vec2 pos, float rot, vec4 color, float fade, vec2 size) { if (!isPhantomFrame) { if (starttime == -1) { starttime = time; } endtime = time; } vec2 scale = size / sdata.scalemod; fade *= color.w; vec3 col = color.xyz; addCmd <RotCommand, float>(rot, 0f, rotcmds, new RotCommand(time, time, rot, rot), RotCommand.requiresUpdate); rud <vec2> del = MoveCommand.requiresUpdate; if ((settings & INTERPOLATE_MOVE) > 0) { del = rud_true <vec2>; } addCmd <MoveCommand, vec2>(pos, v2(-1f), movecmds, new MoveCommand(time, time, pos, pos), del); addCmd <FadeCommand, float>(fade, 1f, fadecmds, new FadeCommand(time, time, fade, fade), FadeCommand.requiresUpdate); rud <vec3> rr = ColorCommand.requiresUpdate; if ((settings & SESDSC) > 0 || colorcmds.Count == 0 /*1 Feb 2021, if sprite is always white, there will be no colorcmd but a fadecmd * (because it won't appear if there's no cmd) but for some reason this sometimes * resulted in the sprite not showing (very visible in pixelscreen), so making sure * there's a colorcmd now...*/) { rr = rud_true <vec3>; } addCmd <ColorCommand, vec3>(col, v3(1f), colorcmds, new ColorCommand(time, time, col, col), rr); if (scale.x == scale.y) { goto squarescale; } addCmd <VScaleCommand, vec2>(scale, v2(1f), vscalecmds, new VScaleCommand(time, time, scale, scale), VScaleCommand.requiresUpdate); return; squarescale: addCmd <ScaleCommand, float>(scale.x, 1f, scalecmds, new ScaleCommand(time, time, scale.x, scale.x), ScaleCommand.requiresUpdate); }
public void update(int time, vec2 pos, float rot, vec4 color, float fade, vec2 size) { if (!isPhantomFrame) { if (starttime == -1) { starttime = time; } endtime = time; } vec2 scale = size / sdata.scalemod; fade *= color.w; vec3 col = color.xyz; addCmd <RotCommand, float>(rot, 0f, rotcmds, new RotCommand(time, time, rot, rot), RotCommand.requiresUpdate); rud <vec2> del = MoveCommand.requiresUpdate; if ((settings & INTERPOLATE_MOVE) > 0) { del = rud_true <vec2>; } addCmd <MoveCommand, vec2>(pos, v2(-1f), movecmds, new MoveCommand(time, time, pos, pos), del); addCmd <FadeCommand, float>(fade, 1f, fadecmds, new FadeCommand(time, time, fade, fade), FadeCommand.requiresUpdate); rud <vec3> rr = ColorCommand.requiresUpdate; if ((settings & SESDSC) > 0) { rr = rud_true <vec3>; } addCmd <ColorCommand, vec3>(col, v3(1f), colorcmds, new ColorCommand(time, time, col, col), rr); if (scale.x == scale.y) { goto squarescale; } addCmd <VScaleCommand, vec2>(scale, v2(1f), vscalecmds, new VScaleCommand(time, time, scale, scale), VScaleCommand.requiresUpdate); return; squarescale: addCmd <ScaleCommand, float>(scale.x, 1f, scalecmds, new ScaleCommand(time, time, scale.x, scale.x), ScaleCommand.requiresUpdate); }
private void addCmd <T, V>(V actualvalue, V defaultvalue, LinkedList <T> list, T cmd, rud <V> reqUpdateDelegate) where T : ICommand { V lastvalue = getLastNonPhantom <V, T>(list, defaultvalue); if (isPhantomFrame || reqUpdateDelegate(lastvalue, actualvalue)) { list.AddLast(cmd); allcmds.AddLast(cmd); } }