public static void ApplyEffect(string id, Environment env, ref DialogChar c, int time, int row, int col) { switch (id) { case ScriptInterpreter.FUNC_RBW: ApplyRbw(env, ref c, time, row, col); break; case ScriptInterpreter.FUNC_CLR1: ApplyClr(env, ref c, time, row, col, 0); break; case ScriptInterpreter.FUNC_CLR2: ApplyClr(env, ref c, time, row, col, 1); break; case ScriptInterpreter.FUNC_CLR3: ApplyClr(env, ref c, time, row, col, 2); break; case ScriptInterpreter.FUNC_WVY: ApplyWvy(env, ref c, time, row, col); break; case ScriptInterpreter.FUNC_SHK: ApplyShk(env, ref c, time, row, col); break; } }
public static void ApplyClr(Environment env, ref DialogChar c, int time, int row, int col, int paletteIndex) { if (paletteIndex < 0) { return; } var pal = env.GetCurrentPalette(); if (pal != null && pal.Colors != null && paletteIndex < pal.Colors.Length) { c.color = pal.Colors[paletteIndex]; } }
public static void ApplyShk(Environment env, ref DialogChar c, int time, int row, int col) { c.offsetY += (float)( 3d * Math.Sin((time * 0.1d) - (col * 0.5d)) * Math.Cos((time * 0.3d) - (col * 0.2d)) * Math.Sin((time * 2.0d) - (col * 1.0d)) ); c.offsetX += (float)( 3d * Math.Cos((time * 0.1d) - (col * 1.0d)) * Math.Sin((time * 3.0d) - (col * 0.7d)) * Math.Cos((time * 0.2d) - (col * 0.3d)) ); }
public static void ApplyClr3(Environment env, ref DialogChar c, int time, int row, int col) { ApplyClr(env, ref c, time, row, col, 2); }
public static void ApplyWvy(Environment env, ref DialogChar c, int time, int row, int col) { c.offsetY += (float)(Math.Sin((time / 250d) - (col / 2d)) * 4); }
public static void ApplyRbw(Environment env, ref DialogChar c, int time, int row, int col) { var h = (float)Math.Abs(Math.Sin((time / 600d) - (col / 8d))); c.color = ColorUtil.HslToRGB(h, 1.0f, 0.5f); }