Пример #1
0
        private LuaScriptBlock GeneareIf(LuaScriptBlock old, int jmp, bool els = true)
        {
            var block = new LuaScriptBlock(old.StartAddress + old.Lines.Count, old.GetDecoder(), old.GetFunc());

            // TODO: take and/or so we can make 10+ condition chains and have 1 OR f**k them all or have 1 critical AND that does the real logic
            block.AddScriptLine(new LuaScriptLine(new LuaInstruction(LuaOpcode.EQ) // TODO: take a random operand here
            {
                A = 0,                                                             // true/false
                B = 1,                                                             // op1 // TODO: take some random values here
                C = 1,                                                             // op2
            }, old.GetDecoder(), old.GetFunc()));

            block.AddScriptLine(new LuaScriptLine(new LuaInstruction(LuaOpcode.JMP)
            {
                sBx = jmp - (old.StartAddress + old.Lines.Count)
            }, old.GetDecoder(), old.GetFunc()));

            block.JumpsNext = block.StartAddress + block.Lines.Count;
            if (!els)
            {
                block.JumpsNext = -1;
            }
            block.JumpsTo = jmp;

            return(block);
        }
Пример #2
0
 public GraphBlock(LuaScriptBlock block, int frmWidth, int frmHeight, int graphX = 0, int graphY = 0)
 {
     this.Block            = block;
     this.BlockInnerString = "";
     this.BlockHeight      = 0;
     this.LastGraphX       = 0;
     this.LastGraphY       = 0;
     this.OffsetLeft       = 0;
     Initialize(frmWidth, frmHeight, graphX, graphY);
 }