Example #1
0
        private static Vector3 getTotalOffset()
        {
            Vector3       newOffset = Vector3.Zero;
            GeoScriptNode n         = nodeCurrent;

            while (n.parent != null)
            {
                newOffset += n.offset;
                n          = n.parent;
            }
            return(newOffset);
        }
Example #2
0
        private static void CMD_04()
        {
            GeoScriptNode newNode = new GeoScriptNode();

            newNode.ID     = nodeCurrent.ID + 1;
            newNode.parent = nodeCurrent;
            if (nodeCurrent.callSwitch)
            {
                newNode.switchPos   = 0;
                newNode.switchCount = nodeCurrent.switchCount;
                newNode.switchFunc  = nodeCurrent.switchFunc;
                newNode.isSwitch    = true;
            }
            nodeCurrent = newNode;
        }
Example #3
0
        public static void parse(ref Model3D mdl, ref Level lvl, byte seg, uint off)
        {
            if (seg == 0)
            {
                return;
            }
            ROM rom = ROM.Instance;

            byte[] data = rom.getSegment(seg);
            bool   end  = false;

            while (!end)
            {
                byte   cmdLen = getCmdLength(data[off]);
                byte[] cmd    = rom.getSubArray(data, off, cmdLen);
                //rom.printArray(cmd, cmdLen);
                if (cmd[0] != 0x05 && nodeCurrent.isSwitch && nodeCurrent.switchPos != 1)
                {
                    if (nodeCurrent.switchFunc == 0x8029DB48)
                    {
                        //rom.printArray(cmd, cmdLen);
                        //Console.WriteLine(nodeCurrent.switchPos);
                    }
                    nodeCurrent.switchPos++;
                    off += cmdLen;
                    continue;
                }

                switch (cmd[0])
                {
                case 0x00:
                case 0x01:
                    end = true;
                    break;

                case 0x02:
                    CMD_02(ref mdl, ref lvl, cmd);
                    break;

                case 0x03:
                    end = true;
                    break;

                case 0x04:
                    CMD_04();
                    break;

                case 0x05:
                    if (nodeCurrent != rootNode)
                    {
                        nodeCurrent = nodeCurrent.parent;
                    }
                    break;

                case 0x0E:
                    //rom.printArray(cmd, cmdLen);
                    CMD_0E(ref mdl, ref lvl, cmd);
                    break;

                case 0x10:
                    //CMD_10(ref mdl, ref lvl, cmd);
                    break;

                case 0x11:
                    //rom.printArray(cmd, cmdLen);
                    CMD_11(ref mdl, ref lvl, cmd);
                    break;

                case 0x13:
                    //rom.printArray(cmd, cmdLen);
                    CMD_13(ref mdl, ref lvl, cmd);
                    break;

                case 0x15:
                    CMD_15(ref mdl, ref lvl, cmd);
                    // rom.printArray(cmd, cmdLen);
                    break;

                case 0x1D:
                    CMD_1D(ref mdl, cmd);
                    break;
                }
                off += cmdLen;
                if (nodeCurrent.isSwitch)
                {
                    nodeCurrent.switchPos++;
                }
            }
        }
Example #4
0
 public static void resetNodes()
 {
     rootNode    = new GeoScriptNode();
     nodeCurrent = rootNode;
 }