public void IfKeyPressedGoto(CommandParams param) { string key = param.GetString(); string label = param.GetString(); if (IsKeyPressed(key)) { GoToLabel(label); } }
public void IfKeyPressedCall(CommandParams param) { string key = param.GetString(); string label = param.GetString(); if (IsKeyPressed(key)) { CallSubroutineAtLabel(label); } }
public void PutObject(CommandParams param) { AssertTargetPosition(); GameObject o = new GameObject(new Tile()); o.Id = param.GetString(); o.Animation.Clear(); Map.PutObject(o, TargetObject); }
public void FindObjectById(CommandParams param) { PositionedObject po = Map.FindObjectById(param.GetString()); if (po == null) { throw new PTMException("Object not found with id: " + param); } TargetObject = po.Position; }
public void SetVariable(CommandParams param) { string name = param.GetStringDirect().Trim(); string value = param.GetString().Trim(); if (!name.StartsWith("$")) { throw new PTMException("Invalid variable name"); } Vars.Set(name, value); }
public void LoadMap(CommandParams param) { try { Map = MapFile.LoadFromRawBytes(param.GetString()); Window.Graphics.Tileset = Map.Tileset; Window.Graphics.Palette = Map.Palette; if (MapRenderer != null) { MapRenderer.Map = Map; } } catch (DirectoryNotFoundException dnfex) { throw new PTMException("Map file not found: " + dnfex.Message); } catch (FileNotFoundException fnfex) { throw new PTMException("Map file not found: " + fnfex.FileName); } }
public void InitWindow(CommandParams param) { if (param.Count != 5) { throw new PTMException("Invalid parameter count"); } try { string title = param.GetString(); int width = param.GetNumber(); int height = param.GetNumber(); int cols = param.GetNumber(); int rows = param.GetNumber(); Window = new GameWindow(this, "", cols, rows); Window.Size = new Size(width, height); Window.Text = title; } catch (Exception ex) { throw new PTMException("Invalid parameter(s)"); } }
public void GoToLabel(CommandParams param) { ProgramPtr = TryGetLabelLineNumber(param.GetString()); }
public void CallLabel(CommandParams param) { CallStack.Push(ProgramPtr); ProgramPtr = TryGetLabelLineNumber(param.GetString()); }
public void LoadVariableToStack(CommandParams param) { ExprStack.Push(Vars.GetAsString(param.GetString())); }
public void StoreStackToVariable(CommandParams param) { Vars.Set(param.GetString(), ExprStack.PopString()); }
public void PrintToDebugger(CommandParams param) { Debugger.Println(param.GetString()); }