コード例 #1
0
ファイル: SceneUtils.cs プロジェクト: az64/mm-rando
 public static void GetMaps()
 {
     for (int i = 0; i < RomData.SceneList.Count; i++)
     {
         int f = RomData.SceneList[i].File;
         RomUtils.CheckCompressed(f);
         int j = 0;
         while (true)
         {
             byte cmd = RomData.MMFileList[f].Data[j];
             if (cmd == 0x04)
             {
                 byte mapcount = RomData.MMFileList[f].Data[j + 1];
                 int  mapsaddr = (int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, j + 4) & 0xFFFFFF;
                 for (int k = 0; k < mapcount; k++)
                 {
                     Map m = new Map();
                     m.File = RomUtils.AddrToFile((int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, mapsaddr));
                     RomData.SceneList[i].Maps.Add(m);
                     mapsaddr += 8;
                 }
                 break;
             }
             if (cmd == 0x14)
             {
                 break;
             }
             j += 8;
         }
     }
 }
コード例 #2
0
ファイル: SceneUtils.cs プロジェクト: az64/mm-rando
        public static void ReadSceneTable()
        {
            RomData.SceneList = new List <Scene>();
            int f           = RomUtils.GetFileIndexForWriting(SCENE_TABLE);
            int _SceneTable = SCENE_TABLE - RomData.MMFileList[f].Addr;
            int i           = 0;

            while (true)
            {
                Scene s     = new Scene();
                uint  saddr = ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, _SceneTable + i);
                if (saddr > 0x4000000)
                {
                    break;
                }
                if (saddr != 0)
                {
                    s.File   = RomUtils.AddrToFile((int)saddr);
                    s.Number = i >> 4;
                    RomData.SceneList.Add(s);
                }
                i += 16;
            }
        }
コード例 #3
0
 public static void GetMaps()
 {
     foreach (var scene in RomData.SceneList)
     {
         int f = scene.File;
         RomUtils.CheckCompressed(f);
         int j = 0;
         while (true)
         {
             byte cmd = RomData.MMFileList[f].Data[j];
             if (cmd == 0x04)
             {
                 byte mapcount = RomData.MMFileList[f].Data[j + 1];
                 int  mapsaddr = (int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, j + 4) & 0xFFFFFF;
                 for (int k = 0; k < mapcount; k++)
                 {
                     Map m = new Map();
                     m.File = RomUtils.AddrToFile((int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, mapsaddr));
                     scene.Maps.Add(m);
                     mapsaddr += 8;
                 }
                 break;
             }
             if (cmd == 0x14)
             {
                 break;
             }
             j += 8;
         }
         CheckHeaderForExits(f, 0, scene);
         if (scene.Number == 108) // avoid modifying unused setup in East Clock Town. doesn't seem to actually affect anything in-game, but best not to touch it.
         {
             scene.Setups.RemoveAt(2);
         }
     }
 }