From f14a06a8bdcbef346965e7653a03eebc4fefd41e Mon Sep 17 00:00:00 2001 From: Kurt Date: Sat, 24 Oct 2015 09:52:02 -0700 Subject: [PATCH] Fix initialization for non-saves When initializing with a zero-byte array (ie, starting the program and just having blank data), the box/party have specific offsets. Also got rid of the silly default switch cases which can just be achieved earlier. --- Misc/SAV6.cs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Misc/SAV6.cs b/Misc/SAV6.cs index 952d82272..e8f4ad8ef 100644 --- a/Misc/SAV6.cs +++ b/Misc/SAV6.cs @@ -120,19 +120,11 @@ public void getSAVOffsets() EonTicket = 0x319B8; LastViewedBox = PCLayout + 0x43F; } - else - { - Box = TrainerCard = Party = BattleBox = GTS = Daycare = - Fused = SUBE = Puff = Item = Trainer1 = Trainer2 = SecretBase = EonTicket = LastViewedBox = BoxWallpapers = - PCLayout = PCBackgrounds = PCFlags = WondercardFlags = WondercardData = BerryField = OPower = SuperTrain = MaisonStats = PSSStats = Vivillon = - EventConst = EventAsh = EventFlag = PokeDex = PokeDexLanguageFlags = Spinda = EncounterCount = HoF = PSS = JPEG = 0; - Items = new Inventory(Item, -1); - } DaycareSlot = new[] { Daycare, Daycare + 0x1F0 }; } public class Inventory { - public int HeldItem, KeyItem, Medicine, TMHM, Berry; + public int HeldItem, KeyItem, Medicine, TMHM, Berry = 0; public Inventory(int Offset, int Game) { switch (Game) @@ -151,18 +143,16 @@ public Inventory(int Offset, int Game) Medicine = Offset + 0x970; Berry = Offset + 0xA70; break; - default: - HeldItem = KeyItem = TMHM = Medicine = Berry = 0; - break; } } } - public Inventory Items; - public int Box, Party, BattleBox, GTS, Daycare, EonTicket, + public Inventory Items = new Inventory(0, -1); + public int BattleBox, GTS, Daycare, EonTicket, Fused, SUBE, Puff, Item, Trainer1, Trainer2, SuperTrain, PSSStats, MaisonStats, Vivillon, SecretBase, BoxWallpapers, LastViewedBox, PCLayout, PCBackgrounds, PCFlags, WondercardFlags, WondercardData, BerryField, OPower, EventConst, EventFlag, EventAsh, - PokeDex, PokeDexLanguageFlags, Spinda, EncounterCount, HoF, PSS, JPEG; + PokeDex, PokeDexLanguageFlags, Spinda, EncounterCount, HoF, PSS, JPEG = 0; public int TrainerCard = 0x14000; + public int Box = 0x33000, Party = 0x14200; public int[] DaycareSlot; public int DaycareIndex = 0;