private void LoadChrAnimationTable() { if (Format.HasChrAnimationTable) { this.ChrAnimationTableMissing = !HasChrAnimationIndicator(); ChrAnimationData = ChrAnimation.DeserializeChrAnimation(this, null); // If the ROM does not have a CHR animation table, or we some how magically end up missing chr animation data for a level, default animation tables will be created foreach (LevelIndex level in new LevelIndex[] { LevelIndex.None, LevelIndex.Brinstar, LevelIndex.Norfair, LevelIndex.Tourian, LevelIndex.Kraid, LevelIndex.Ridley }) { ChrAnimationLevelData levelData; if (ChrAnimationTableMissing || !ChrAnimationData.TryGetValue(level, out levelData)) { ChrAnimationData[level] = CreateDefaultAnimationsForLevel(level); } } } }
//-1E:B600 (0x7B610) = CHR animation table //-B600: Slot 0 bank index //-B700: Slot 1 bank index //-B800: Slot 2 bank index //-B900: Slot 3 bank index //-BA00: Lower 7 bits: frame delay / High bit: if set, last frame ////public const int TableOffset_Bank0 = 0x7B610; ////public const int TableOffset_Bank1 = 0x7B710; ////public const int TableOffset_Bank2 = 0x7B810; ////public const int TableOffset_Bank3 = 0x7B910; ////public const int TableOffset_FrameData = 0x7BA10; public static ChrAnimationRomData DeserializeChrAnimation(MetroidRom r, Project p) { ChrAnimationRomData result = new ChrAnimationRomData(); var titleStart = r.ChrUsage.GetBgFirstPage(LevelIndex.None); var brinStart = r.ChrUsage.GetBgFirstPage(LevelIndex.Brinstar); var norStart = r.ChrUsage.GetBgFirstPage(LevelIndex.Norfair); var tourStart = r.ChrUsage.GetBgFirstPage(LevelIndex.Tourian); var kraidStart = r.ChrUsage.GetBgFirstPage(LevelIndex.Kraid); var ridStart = r.ChrUsage.GetBgFirstPage(LevelIndex.Ridley); result.Add(LevelIndex.None, LoadAnimationsForLevel(r, LevelIndex.None, brinStart)); result.Add(LevelIndex.Brinstar, LoadAnimationsForLevel(r, LevelIndex.Brinstar, norStart)); result.Add(LevelIndex.Norfair, LoadAnimationsForLevel(r, LevelIndex.Norfair, tourStart)); result.Add(LevelIndex.Tourian, LoadAnimationsForLevel(r, LevelIndex.Tourian, kraidStart)); result.Add(LevelIndex.Kraid, LoadAnimationsForLevel(r, LevelIndex.Kraid, ridStart)); result.Add(LevelIndex.Ridley, LoadAnimationsForLevel(r, LevelIndex.Ridley, 0xFF)); return(result); }