Beispiel #1
0
        private static void CMD_21(ref Level lvl, ref string desc, byte[] cmd, byte?areaID)
        {
            ROM  rom     = ROM.Instance;
            byte modelID = cmd[3];
            byte seg     = cmd[4];
            uint off     = bytesToInt(cmd, 5, 3);

            desc = "Define Model ID 0x" + modelID.ToString("X2") + "; Load Fast3D from 0x" + seg.ToString("X2") + off.ToString("X6");

            Model3D newModel = new Model3D();

            newModel.GeoDataSegAddress = bytesToInt(cmd, 4, 4);
            lvl.AddObjectCombos(modelID, newModel.GeoDataSegAddress);

            if (rom.getSegment(seg, areaID) != null)
            {
                Fast3DScripts.parse(ref newModel, ref lvl, seg, off, areaID);
            }

            if (lvl.ModelIDs.ContainsKey(modelID))
            {
                lvl.ModelIDs.Remove(modelID);
            }
            newModel.buildBuffers();
            lvl.ModelIDs.Add(modelID, newModel);
        }
Beispiel #2
0
        private static void CMD_15(ref Model3D mdl, ref Level lvl, byte[] cmd)
        {
            // if (bytesToInt(cmd, 4, 4) != 0x07006D70) return;
            byte drawLayer = cmd[1];
            byte seg       = cmd[4];
            uint off       = bytesToInt(cmd, 5, 3);

            mdl.builder.Offset = getTotalOffset();
            // Don't bother processing duplicate display lists.
            if (!mdl.hasGeoDisplayList(off))
            {
                Globals.DEBUG_PDL = bytesToInt(cmd, 4, 4);
                Fast3DScripts.parse(ref mdl, ref lvl, seg, off);
            }
        }
Beispiel #3
0
        private static void CMD_21(ref Level lvl, byte[] cmd, ROM rom)
        {
            byte modelID = cmd[3];
            byte seg     = cmd[4];
            uint off     = bytesToInt(cmd, 5, 3);

            Model3D newModel = new Model3D();

            newModel.GeoDataSegAddress = bytesToInt(cmd, 4, 4);
            lvl.AddObjectCombos(modelID, newModel.GeoDataSegAddress);

            if (rom.getSegment(seg) != null)
            {
                Fast3DScripts.parse(ref newModel, ref lvl, seg, off);
            }

            if (lvl.ModelIDs.ContainsKey(modelID))
            {
                lvl.ModelIDs.Remove(modelID);
            }
            newModel.buildBuffers();
            lvl.ModelIDs.Add(modelID, newModel);
        }
Beispiel #4
0
        private static void CMD_13(ref Model3D mdl, ref Level lvl, byte[] cmd)
        {
            byte  drawLayer  = cmd[1];
            short x          = (short)bytesToInt(cmd, 2, 2);
            short y          = (short)bytesToInt(cmd, 4, 2);
            short z          = (short)bytesToInt(cmd, 6, 2);
            uint  seg_offset = bytesToInt(cmd, 8, 4);
            byte  seg        = (byte)(seg_offset >> 24);
            uint  off        = seg_offset & 0xFFFFFF;

            mdl.builder.Offset = new Vector3(x, y, z) + getTotalOffset();
            // Don't bother processing duplicate display lists.
            if (seg_offset != 0)
            {
                if (!mdl.hasGeoDisplayList(off))
                {
                    Fast3DScripts.parse(ref mdl, ref lvl, seg, off);
                }
            }
            else
            {
                nodeCurrent.offset += new Vector3(x, y, z);
            }
        }