Ejemplo n.º 1
0
        private static void CMD_1F(ref Level lvl, ref string desc, byte[] cmd)
        {
            byte areaID = cmd[2];
            byte seg    = cmd[4];
            uint off    = bytesToInt(cmd, 5, 3);

            desc = "Start area " + areaID + "; Load area geo layout from 0x" + seg.ToString("X2") + off.ToString("X6");

            Area newArea = new Area(areaID, bytesToInt(cmd, 4, 4), lvl);

            GeoScripts.resetNodes();
            newArea.AreaModel.GeoDataSegAddress = bytesToInt(cmd, 4, 4);

            // Globals.DEBUG_PARSING_LEVEL_AREA = true;
            // Stopwatch stopWatch = new Stopwatch();
            // stopWatch.Start();
            GeoScripts.parse(ref newArea.AreaModel, ref lvl, seg, off);
            lvl.setAreaBackgroundInfo(ref newArea);
            lvl.Areas.Add(newArea);
            lvl.CurrentAreaID = areaID;
            // stopWatch.Stop();
            // Console.WriteLine("RunTime (GeoScripts.parse): " + stopWatch.Elapsed.Milliseconds + "ms");

            //stopWatch = new Stopwatch();
            // stopWatch.Start();
            newArea.AreaModel.buildBuffers();
            //if(areaID == 1) newArea.AreaModel.dumpModelToOBJ(1.0f/500.0f);
            //stopWatch.Stop();
            //Console.WriteLine("RunTime (newArea.AreaModel.buildBuffers): " + stopWatch.Elapsed.Milliseconds + "ms");
            //Globals.DEBUG_PARSING_LEVEL_AREA = false;
            // newArea.AreaModel.outputTextureAtlasToPng("Area_"+areaID+"_TexAtlus.png");
        }
Ejemplo n.º 2
0
        private static void CMD_1F(ref Level lvl, byte[] cmd)
        {
            byte areaID = cmd[2];
            byte seg    = cmd[4];
            uint off    = bytesToInt(cmd, 5, 3);

            Area newArea = new Area(areaID, bytesToInt(cmd, 4, 4), lvl);

            GeoScripts.resetNodes();
            newArea.AreaModel.GeoDataSegAddress = bytesToInt(cmd, 4, 4);
            GeoScripts.parse(ref newArea.AreaModel, ref lvl, seg, off);
            lvl.Areas.Add(newArea);
            lvl.CurrentAreaID = areaID;
            newArea.AreaModel.buildBuffers();
            // newArea.AreaModel.outputTextureAtlasToPng("Area_"+areaID+"_TexAtlus.png");
        }
Ejemplo n.º 3
0
        private static void CMD_22(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);

            if (modelID == 0x7A)
            {
                Globals.DEBUG_PARSING_DL = true;
            }

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

            //Console.WriteLine("Size of seg 0x"+seg.ToString("X2")+" = " + rom.getSegment(seg).Length);
            Model3D newModel = new Model3D();

            newModel.GeoDataSegAddress = bytesToInt(cmd, 4, 4);
            lvl.AddObjectCombos(modelID, newModel.GeoDataSegAddress);
            if (rom.getSegment(seg, areaID) != null)
            {
                try
                {
                    GeoScripts.resetNodes();
                    GeoScripts.parse(ref newModel, ref lvl, seg, off, areaID);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.WriteLine(e.StackTrace);
                }
            }
            if (lvl.ModelIDs.ContainsKey(modelID))
            {
                lvl.ModelIDs.Remove(modelID);
            }
            newModel.buildBuffers();
            lvl.ModelIDs.Add(modelID, newModel);


            if (modelID == 0x7A)
            {
                Globals.DEBUG_PARSING_DL = false;
            }
        }
Ejemplo n.º 4
0
        private static void CMD_22(ref Level lvl, byte[] cmd, ROM rom)
        {
            byte modelID = cmd[3];
            byte seg     = cmd[4];
            uint off     = bytesToInt(cmd, 5, 3);
            //Console.WriteLine("Size of seg 0x"+seg.ToString("X2")+" = " + rom.getSegment(seg).Length);
            Model3D newModel = new Model3D();

            newModel.GeoDataSegAddress = bytesToInt(cmd, 4, 4);
            lvl.AddObjectCombos(modelID, newModel.GeoDataSegAddress);
            if (rom.getSegment(seg) != null)
            {
                GeoScripts.resetNodes();
                GeoScripts.parse(ref newModel, ref lvl, seg, off);
            }
            if (lvl.ModelIDs.ContainsKey(modelID))
            {
                lvl.ModelIDs.Remove(modelID);
            }
            newModel.buildBuffers();
            lvl.ModelIDs.Add(modelID, newModel);
        }