diff --git a/LibPkmGC/include/LibPkmGC/Base/Pokemon.h b/LibPkmGC/include/LibPkmGC/Base/Pokemon.h index c617081..f9ce86e 100644 --- a/LibPkmGC/include/LibPkmGC/Base/Pokemon.h +++ b/LibPkmGC/include/LibPkmGC/Base/Pokemon.h @@ -21,6 +21,7 @@ #include #include +#include #include #include diff --git a/LibPkmGC/include/LibPkmGC/Core/ItemInfo.h b/LibPkmGC/include/LibPkmGC/Core/ItemInfo.h index 4c40bf4..f3daa2d 100644 --- a/LibPkmGC/include/LibPkmGC/Core/ItemInfo.h +++ b/LibPkmGC/include/LibPkmGC/Core/ItemInfo.h @@ -20,6 +20,7 @@ #define _LIBPKMGC_ITEM_INFO_H #include +#include namespace LibPkmGC { @@ -453,6 +454,7 @@ enum ItemCategoryIndex { }; LIBPKMGC_DECL ItemCategoryIndex getItemCategory(ItemIndex index, bool isXD = false); +LIBPKMGC_DECL PokemonMoveIndex getMoveForTM(ItemIndex index); } diff --git a/LibPkmGC/include/LibPkmGC/Core/Localization.h b/LibPkmGC/include/LibPkmGC/Core/Localization.h index 97e6d3b..7799de3 100644 --- a/LibPkmGC/include/LibPkmGC/Core/Localization.h +++ b/LibPkmGC/include/LibPkmGC/Core/Localization.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/LibPkmGC/include/LibPkmGC/Core/MoveInfo.h b/LibPkmGC/include/LibPkmGC/Core/MoveInfo.h new file mode 100644 index 0000000..be8f1c3 --- /dev/null +++ b/LibPkmGC/include/LibPkmGC/Core/MoveInfo.h @@ -0,0 +1,402 @@ +/* +* Copyright (C) TuxSH 2015 +* This file is part of LibPkmGC. +* +* LibPkmGC is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* LibPkmGC is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with LibPkmGC. If not, see . +*/ + +#ifndef _LIBPKMGC_MOVE_INFO_H +#define _LIBPKMGC_MOVE_INFO_H + +#include + +namespace LibPkmGC { + +enum PokemonMoveIndex { + NoMove = 0, + Pound = 1, + KarateChop = 2, + DoubleSlap = 3, + CometPunch = 4, + MegaPunch = 5, + PayDay = 6, + FirePunch = 7, + IcePunch = 8, + ThunderPunch = 9, + Scratch = 10, + ViceGrip = 11, + Guillotine = 12, + RazorWind = 13, + SwordsDance = 14, + Cut = 15, + Gust = 16, + WingAttack = 17, + Whirlwind = 18, + Fly = 19, + Bind = 20, + Slam = 21, + VineWhip = 22, + Stomp = 23, + DoubleKick = 24, + MegaKick = 25, + JumpKick = 26, + RollingKick = 27, + SandAttack = 28, + Headbutt = 29, + HornAttack = 30, + FuryAttack = 31, + HornDrill = 32, + Tackle = 33, + BodySlam = 34, + Wrap = 35, + TakeDown = 36, + Thrash = 37, + DoubleEdge = 38, + TailWhip = 39, + PoisonSting = 40, + Twineedle = 41, + PinMissile = 42, + Leer = 43, + Bite = 44, + Growl = 45, + Roar = 46, + Sing = 47, + Supersonic = 48, + SonicBoom = 49, + Disable = 50, + Acid = 51, + Ember = 52, + Flamethrower = 53, + Mist = 54, + WaterGun = 55, + HydroPump = 56, + Surf = 57, + IceBeam = 58, + Blizzard = 59, + Psybeam = 60, + BubbleBeam = 61, + AuroraBeam = 62, + HyperBeam = 63, + Peck = 64, + DrillPeck = 65, + Submission = 66, + LowKick = 67, + Counter = 68, + SeismicToss = 69, + Strength = 70, + Absorb = 71, + MegaDrain = 72, + LeechSeed = 73, + Growth = 74, + RazorLeaf = 75, + SolarBeam = 76, + PoisonPowder = 77, + StunSpore = 78, + SleepPowder = 79, + PetalDance = 80, + StringShot = 81, + DragonRage = 82, + FireSpin = 83, + ThunderShock = 84, + Thunderbolt = 85, + ThunderWave = 86, + Thunder = 87, + RockThrow = 88, + Earthquake = 89, + Fissure = 90, + Dig = 91, + Toxic = 92, + Confusion = 93, + Psychic = 94, + Hypnosis = 95, + Meditate = 96, + Agility = 97, + QuickAttack = 98, + Rage = 99, + Teleport = 100, + NightShade = 101, + Mimic = 102, + Screech = 103, + DoubleTeam = 104, + Recover = 105, + Harden = 106, + Minimize = 107, + Smokescreen = 108, + ConfuseRay = 109, + Withdraw = 110, + DefenseCurl = 111, + Barrier = 112, + LightScreen = 113, + Haze = 114, + Reflect = 115, + FocusEnergy = 116, + Bide = 117, + Metronome = 118, + MirrorMove = 119, + SelfDestruct = 120, + EggBomb = 121, + Lick = 122, + Smog = 123, + Sludge = 124, + BoneClub = 125, + FireBlast = 126, + Waterfall = 127, + Clamp = 128, + Swift = 129, + SkullBash = 130, + SpikeCannon = 131, + Constrict = 132, + Amnesia = 133, + Kinesis = 134, + SoftBoiled = 135, + HighJumpKick = 136, + Glare = 137, + DreamEater = 138, + PoisonGas = 139, + Barrage = 140, + LeechLife = 141, + LovelyKiss = 142, + SkyAttack = 143, + Transform = 144, + Bubble = 145, + DizzyPunch = 146, + Spore = 147, + Flash = 148, + Psywave = 149, + Splash = 150, + AcidArmor = 151, + Crabhammer = 152, + Explosion = 153, + FurySwipes = 154, + Bonemerang = 155, + Rest = 156, + RockSlide = 157, + HyperFang = 158, + Sharpen = 159, + Conversion = 160, + TriAttack = 161, + SuperFang = 162, + Slash = 163, + Substitute = 164, + Struggle = 165, + Sketch = 166, + TripleKick = 167, + Thief = 168, + SpiderWeb = 169, + MindReader = 170, + Nightmare = 171, + FlameWheel = 172, + Snore = 173, + Curse = 174, + Flail = 175, + Conversion2 = 176, + Aeroblast = 177, + CottonSpore = 178, + Reversal = 179, + Spite = 180, + PowderSnow = 181, + Protect = 182, + MachPunch = 183, + ScaryFace = 184, + FeintAttack = 185, + SweetKiss = 186, + BellyDrum = 187, + SludgeBomb = 188, + MudSlap = 189, + Octazooka = 190, + Spikes = 191, + ZapCannon = 192, + Foresight = 193, + DestinyBond = 194, + PerishSong = 195, + IcyWind = 196, + Detect = 197, + BoneRush = 198, + LockOn = 199, + Outrage = 200, + Sandstorm = 201, + GigaDrain = 202, + Endure = 203, + Charm = 204, + Rollout = 205, + FalseSwipe = 206, + Swagger = 207, + MilkDrink = 208, + Spark = 209, + FuryCutter = 210, + SteelWing = 211, + MeanLook = 212, + Attract = 213, + SleepTalk = 214, + HealBell = 215, + Return = 216, + Present = 217, + Frustration = 218, + Safeguard = 219, + PainSplit = 220, + SacredFire = 221, + Magnitude = 222, + DynamicPunch = 223, + Megahorn = 224, + DragonBreath = 225, + BatonPass = 226, + Encore = 227, + Pursuit = 228, + RapidSpin = 229, + SweetScent = 230, + IronTail = 231, + MetalClaw = 232, + VitalThrow = 233, + MorningSun = 234, + Synthesis = 235, + Moonlight = 236, + HiddenPower = 237, + CrossChop = 238, + Twister = 239, + RainDance = 240, + SunnyDay = 241, + Crunch = 242, + MirrorCoat = 243, + PsychUp = 244, + ExtremeSpeed = 245, + AncientPower = 246, + ShadowBall = 247, + FutureSight = 248, + RockSmash = 249, + Whirlpool = 250, + BeatUp = 251, + FakeOut = 252, + Uproar = 253, + Stockpile = 254, + SpitUp = 255, + Swallow = 256, + HeatWave = 257, + Hail = 258, + Torment = 259, + Flatter = 260, + WillOWisp = 261, + Memento = 262, + Facade = 263, + FocusPunch = 264, + SmellingSalts = 265, + FollowMe = 266, + NaturePower = 267, + Charge = 268, + Taunt = 269, + HelpingHand = 270, + Trick = 271, + RolePlay = 272, + Wish = 273, + Assist = 274, + Ingrain = 275, + Superpower = 276, + MagicCoat = 277, + Recycle = 278, + Revenge = 279, + BrickBreak = 280, + Yawn = 281, + KnockOff = 282, + Endeavor = 283, + Eruption = 284, + SkillSwap = 285, + Imprison = 286, + Refresh = 287, + Grudge = 288, + Snatch = 289, + SecretPower = 290, + Dive = 291, + ArmThrust = 292, + Camouflage = 293, + TailGlow = 294, + LusterPurge = 295, + MistBall = 296, + FeatherDance = 297, + TeeterDance = 298, + BlazeKick = 299, + MudSport = 300, + IceBall = 301, + NeedleArm = 302, + SlackOff = 303, + HyperVoice = 304, + PoisonFang = 305, + CrushClaw = 306, + BlastBurn = 307, + HydroCannon = 308, + MeteorMash = 309, + Astonish = 310, + WeatherBall = 311, + Aromatherapy = 312, + FakeTears = 313, + AirCutter = 314, + Overheat = 315, + OdorSleuth = 316, + RockTomb = 317, + SilverWind = 318, + MetalSound = 319, + GrassWhistle = 320, + Tickle = 321, + CosmicPower = 322, + WaterSpout = 323, + SignalBeam = 324, + ShadowPunch = 325, + Extrasensory = 326, + SkyUppercut = 327, + SandTomb = 328, + SheerCold = 329, + MuddyWater = 330, + BulletSeed = 331, + AerialAce = 332, + IcicleSpear = 333, + IronDefense = 334, + Block = 335, + Howl = 336, + DragonClaw = 337, + FrenzyPlant = 338, + BulkUp = 339, + Bounce = 340, + MudShot = 341, + PoisonTail = 342, + Covet = 343, + VoltTackle = 344, + MagicalLeaf = 345, + WaterSport = 346, + CalmMind = 347, + LeafBlade = 348, + DragonDance = 349, + RockBlast = 350, + ShockWave = 351, + WaterPulse = 352, + DoomDesire = 353, + PsychoBoost = 354 +}; + + +LIBPKMGC_DECL u8 getBaseMoveMaxPPs(PokemonMoveIndex move); + +struct LIBPKMGC_DECL PokemonMove { + PokemonMoveIndex move; + u8 currentPPs; + u8 nbPPUpsUsed; + + void load(u8* data); + + void save(u8* data); + + u8 calculateMaxPP(void) const; + +}; + +} + +#endif \ No newline at end of file diff --git a/LibPkmGC/include/LibPkmGC/Core/PokemonInfo.h b/LibPkmGC/include/LibPkmGC/Core/PokemonInfo.h index e0d6388..6c78830 100644 --- a/LibPkmGC/include/LibPkmGC/Core/PokemonInfo.h +++ b/LibPkmGC/include/LibPkmGC/Core/PokemonInfo.h @@ -1,45 +1,26 @@ +/* +* Copyright (C) TuxSH 2015 +* This file is part of LibPkmGC. +* +* LibPkmGC is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* LibPkmGC is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with LibPkmGC. If not, see . +*/ + #ifndef _LIBPKMGC_POKEMON_INFO_H #define _LIBPKMGC_POKEMON_INFO_H #include namespace LibPkmGC{ -enum GameIndex { - NoGame = 0, - FireRed = 1, - LeafGreen = 2, - - Sapphire = 8, - Ruby = 9, - Emerald = 10, - - Colosseum_XD = 11 -}; -enum RegionIndex { - NoRegion = 0, NTSC_J = 1, NTSC_U = 2, PAL = 3 -}; -enum LanguageIndex { - NoLanguage = 0, Japanese = 1, English = 2, German = 3, French = 4, Italian = 5, Spanish = 6 -}; - -struct LIBPKMGC_DECL VersionInfo { - /* The following enum values come from Col/XD */ - - GameIndex game; - RegionIndex currentRegion; - RegionIndex originalRegion; - - LanguageIndex language; - - void load(u8* data); - void load(u8 lg, u8 gm); // GBA - void save(u8* data); - void save(u8& lg, u8& gm); // GBA - - bool isIncomplete(void) const; - -}; - -const VersionInfo emptyVersionInfo = { NoGame, NoRegion, NoRegion, NoLanguage }; enum ContestAchievementLevel { NoContestWon = 0, @@ -496,366 +477,6 @@ enum PokemonNatureIndex{ Quirky = 24 }; - - -enum PokemonMoveIndex{ - NoMove = 0, - Pound = 1, - KarateChop = 2, - DoubleSlap = 3, - CometPunch = 4, - MegaPunch = 5, - PayDay = 6, - FirePunch = 7, - IcePunch = 8, - ThunderPunch = 9, - Scratch = 10, - ViceGrip = 11, - Guillotine = 12, - RazorWind = 13, - SwordsDance = 14, - Cut = 15, - Gust = 16, - WingAttack = 17, - Whirlwind = 18, - Fly = 19, - Bind = 20, - Slam = 21, - VineWhip = 22, - Stomp = 23, - DoubleKick = 24, - MegaKick = 25, - JumpKick = 26, - RollingKick = 27, - SandAttack = 28, - Headbutt = 29, - HornAttack = 30, - FuryAttack = 31, - HornDrill = 32, - Tackle = 33, - BodySlam = 34, - Wrap = 35, - TakeDown = 36, - Thrash = 37, - DoubleEdge = 38, - TailWhip = 39, - PoisonSting = 40, - Twineedle = 41, - PinMissile = 42, - Leer = 43, - Bite = 44, - Growl = 45, - Roar = 46, - Sing = 47, - Supersonic = 48, - SonicBoom = 49, - Disable = 50, - Acid = 51, - Ember = 52, - Flamethrower = 53, - Mist = 54, - WaterGun = 55, - HydroPump = 56, - Surf = 57, - IceBeam = 58, - Blizzard = 59, - Psybeam = 60, - BubbleBeam = 61, - AuroraBeam = 62, - HyperBeam = 63, - Peck = 64, - DrillPeck = 65, - Submission = 66, - LowKick = 67, - Counter = 68, - SeismicToss = 69, - Strength = 70, - Absorb = 71, - MegaDrain = 72, - LeechSeed = 73, - Growth = 74, - RazorLeaf = 75, - SolarBeam = 76, - PoisonPowder = 77, - StunSpore = 78, - SleepPowder = 79, - PetalDance = 80, - StringShot = 81, - DragonRage = 82, - FireSpin = 83, - ThunderShock = 84, - Thunderbolt = 85, - ThunderWave = 86, - Thunder = 87, - RockThrow = 88, - Earthquake = 89, - Fissure = 90, - Dig = 91, - Toxic = 92, - Confusion = 93, - Psychic = 94, - Hypnosis = 95, - Meditate = 96, - Agility = 97, - QuickAttack = 98, - Rage = 99, - Teleport = 100, - NightShade = 101, - Mimic = 102, - Screech = 103, - DoubleTeam = 104, - Recover = 105, - Harden = 106, - Minimize = 107, - Smokescreen = 108, - ConfuseRay = 109, - Withdraw = 110, - DefenseCurl = 111, - Barrier = 112, - LightScreen = 113, - Haze = 114, - Reflect = 115, - FocusEnergy = 116, - Bide = 117, - Metronome = 118, - MirrorMove = 119, - SelfDestruct = 120, - EggBomb = 121, - Lick = 122, - Smog = 123, - Sludge = 124, - BoneClub = 125, - FireBlast = 126, - Waterfall = 127, - Clamp = 128, - Swift = 129, - SkullBash = 130, - SpikeCannon = 131, - Constrict = 132, - Amnesia = 133, - Kinesis = 134, - SoftBoiled = 135, - HighJumpKick = 136, - Glare = 137, - DreamEater = 138, - PoisonGas = 139, - Barrage = 140, - LeechLife = 141, - LovelyKiss = 142, - SkyAttack = 143, - Transform = 144, - Bubble = 145, - DizzyPunch = 146, - Spore = 147, - Flash = 148, - Psywave = 149, - Splash = 150, - AcidArmor = 151, - Crabhammer = 152, - Explosion = 153, - FurySwipes = 154, - Bonemerang = 155, - Rest = 156, - RockSlide = 157, - HyperFang = 158, - Sharpen = 159, - Conversion = 160, - TriAttack = 161, - SuperFang = 162, - Slash = 163, - Substitute = 164, - Struggle = 165, - Sketch = 166, - TripleKick = 167, - Thief = 168, - SpiderWeb = 169, - MindReader = 170, - Nightmare = 171, - FlameWheel = 172, - Snore = 173, - Curse = 174, - Flail = 175, - Conversion2 = 176, - Aeroblast = 177, - CottonSpore = 178, - Reversal = 179, - Spite = 180, - PowderSnow = 181, - Protect = 182, - MachPunch = 183, - ScaryFace = 184, - FeintAttack = 185, - SweetKiss = 186, - BellyDrum = 187, - SludgeBomb = 188, - MudSlap = 189, - Octazooka = 190, - Spikes = 191, - ZapCannon = 192, - Foresight = 193, - DestinyBond = 194, - PerishSong = 195, - IcyWind = 196, - Detect = 197, - BoneRush = 198, - LockOn = 199, - Outrage = 200, - Sandstorm = 201, - GigaDrain = 202, - Endure = 203, - Charm = 204, - Rollout = 205, - FalseSwipe = 206, - Swagger = 207, - MilkDrink = 208, - Spark = 209, - FuryCutter = 210, - SteelWing = 211, - MeanLook = 212, - Attract = 213, - SleepTalk = 214, - HealBell = 215, - Return = 216, - Present = 217, - Frustration = 218, - Safeguard = 219, - PainSplit = 220, - SacredFire = 221, - Magnitude = 222, - DynamicPunch = 223, - Megahorn = 224, - DragonBreath = 225, - BatonPass = 226, - Encore = 227, - Pursuit = 228, - RapidSpin = 229, - SweetScent = 230, - IronTail = 231, - MetalClaw = 232, - VitalThrow = 233, - MorningSun = 234, - Synthesis = 235, - Moonlight = 236, - HiddenPower = 237, - CrossChop = 238, - Twister = 239, - RainDance = 240, - SunnyDay = 241, - Crunch = 242, - MirrorCoat = 243, - PsychUp = 244, - ExtremeSpeed = 245, - AncientPower = 246, - ShadowBall = 247, - FutureSight = 248, - RockSmash = 249, - Whirlpool = 250, - BeatUp = 251, - FakeOut = 252, - Uproar = 253, - Stockpile = 254, - SpitUp = 255, - Swallow = 256, - HeatWave = 257, - Hail = 258, - Torment = 259, - Flatter = 260, - WillOWisp = 261, - Memento = 262, - Facade = 263, - FocusPunch = 264, - SmellingSalts = 265, - FollowMe = 266, - NaturePower = 267, - Charge = 268, - Taunt = 269, - HelpingHand = 270, - Trick = 271, - RolePlay = 272, - Wish = 273, - Assist = 274, - Ingrain = 275, - Superpower = 276, - MagicCoat = 277, - Recycle = 278, - Revenge = 279, - BrickBreak = 280, - Yawn = 281, - KnockOff = 282, - Endeavor = 283, - Eruption = 284, - SkillSwap = 285, - Imprison = 286, - Refresh = 287, - Grudge = 288, - Snatch = 289, - SecretPower = 290, - Dive = 291, - ArmThrust = 292, - Camouflage = 293, - TailGlow = 294, - LusterPurge = 295, - MistBall = 296, - FeatherDance = 297, - TeeterDance = 298, - BlazeKick = 299, - MudSport = 300, - IceBall = 301, - NeedleArm = 302, - SlackOff = 303, - HyperVoice = 304, - PoisonFang = 305, - CrushClaw = 306, - BlastBurn = 307, - HydroCannon = 308, - MeteorMash = 309, - Astonish = 310, - WeatherBall = 311, - Aromatherapy = 312, - FakeTears = 313, - AirCutter = 314, - Overheat = 315, - OdorSleuth = 316, - RockTomb = 317, - SilverWind = 318, - MetalSound = 319, - GrassWhistle = 320, - Tickle = 321, - CosmicPower = 322, - WaterSpout = 323, - SignalBeam = 324, - ShadowPunch = 325, - Extrasensory = 326, - SkyUppercut = 327, - SandTomb = 328, - SheerCold = 329, - MuddyWater = 330, - BulletSeed = 331, - AerialAce = 332, - IcicleSpear = 333, - IronDefense = 334, - Block = 335, - Howl = 336, - DragonClaw = 337, - FrenzyPlant = 338, - BulkUp = 339, - Bounce = 340, - MudShot = 341, - PoisonTail = 342, - Covet = 343, - VoltTackle = 344, - MagicalLeaf = 345, - WaterSport = 346, - CalmMind = 347, - LeafBlade = 348, - DragonDance = 349, - RockBlast = 350, - ShockWave = 351, - WaterPulse = 352, - DoomDesire = 353, - PsychoBoost = 354 -}; - enum PokemonSpeciesExpGrowthType { MediumFast = 0, Erratic = 1, @@ -981,24 +602,10 @@ struct LIBPKMGC_DECL PokemonSpeciesData { LIBPKMGC_DECL const u32* getSpeciesExpTable(PokemonSpeciesIndex index); LIBPKMGC_DECL PokemonSpeciesData getSpeciesData(PokemonSpeciesIndex index); LIBPKMGC_DECL PokemonNatureAffinity getNatureStatAffinity(PokemonNatureIndex nature, size_t stat); -LIBPKMGC_DECL u8 getBaseMoveMaxPPs(PokemonMoveIndex move); LIBPKMGC_DECL u16 getPokedexIndexOf(PokemonSpeciesIndex speciesIndex); LIBPKMGC_DECL PokemonSpeciesIndex getSpeciesIndexOf(u16 pokedexIndex); -struct LIBPKMGC_DECL PokemonMove { - PokemonMoveIndex move; - u8 currentPPs; - u8 nbPPUpsUsed; - - void load(u8* data); - - void save(u8* data); - - u8 calculateMaxPP(void) const; - -}; - struct LIBPKMGC_DECL PokemonMarkings { bool circle, square, triangle, heart; void load(u8 m); diff --git a/LibPkmGC/include/LibPkmGC/Core/VersionInfo.h b/LibPkmGC/include/LibPkmGC/Core/VersionInfo.h new file mode 100644 index 0000000..d227714 --- /dev/null +++ b/LibPkmGC/include/LibPkmGC/Core/VersionInfo.h @@ -0,0 +1,66 @@ +/* +* Copyright (C) TuxSH 2015 +* This file is part of LibPkmGC. +* +* LibPkmGC is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* LibPkmGC is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with LibPkmGC. If not, see . +*/ + +#ifndef _LIBPKMGC_VERSION_INFO_H +#define _LIBPKMGC_VERSION_INFO_H + +#include + +namespace LibPkmGC { + +enum GameIndex { + NoGame = 0, + FireRed = 1, + LeafGreen = 2, + + Sapphire = 8, + Ruby = 9, + Emerald = 10, + + Colosseum_XD = 11 +}; +enum RegionIndex { + NoRegion = 0, NTSC_J = 1, NTSC_U = 2, PAL = 3 +}; +enum LanguageIndex { + NoLanguage = 0, Japanese = 1, English = 2, German = 3, French = 4, Italian = 5, Spanish = 6 +}; + +struct LIBPKMGC_DECL VersionInfo { + /* The following enum values come from Col/XD */ + + GameIndex game; + RegionIndex currentRegion; + RegionIndex originalRegion; + + LanguageIndex language; + + void load(u8* data); + void load(u8 lg, u8 gm); // GBA + void save(u8* data); + void save(u8& lg, u8& gm); // GBA + + bool isIncomplete(void) const; + +}; + +const VersionInfo emptyVersionInfo = { NoGame, NoRegion, NoRegion, NoLanguage }; + +} + +#endif \ No newline at end of file diff --git a/LibPkmGC/include/LibPkmGC/GC/Common/GameConfigData.h b/LibPkmGC/include/LibPkmGC/GC/Common/GameConfigData.h index 14f08cc..bea24f7 100644 --- a/LibPkmGC/include/LibPkmGC/GC/Common/GameConfigData.h +++ b/LibPkmGC/include/LibPkmGC/GC/Common/GameConfigData.h @@ -20,7 +20,7 @@ #define _LIBPKMGC_GC_GAME_CONFIG_DATA_H #include -#include +#include namespace LibPkmGC { diff --git a/LibPkmGC/src/LibPkmGC/Core/ItemInfo.cpp b/LibPkmGC/src/LibPkmGC/Core/ItemInfo.cpp index b62fc2a..4921c34 100644 --- a/LibPkmGC/src/LibPkmGC/Core/ItemInfo.cpp +++ b/LibPkmGC/src/LibPkmGC/Core/ItemInfo.cpp @@ -61,4 +61,63 @@ ItemCategoryIndex getItemCategory(ItemIndex index, bool isXD) { return NoItemCategory; } + +const PokemonMoveIndex TMMoves[50] = { + FocusPunch, + DragonClaw, + WaterPulse, + CalmMind, + Roar, + Toxic, + Hail, + BulkUp, + BulletSeed, + HiddenPower, + SunnyDay, + Taunt, + IceBeam, + Blizzard, + HyperBeam, + LightScreen, + Protect, + RainDance, + GigaDrain, + Safeguard, + Frustration, + SolarBeam, + IronTail, + Thunderbolt, + Thunder, + Earthquake, + Return, + Dig, + Psychic, + ShadowBall, + BrickBreak, + DoubleTeam, + Reflect, + ShockWave, + Flamethrower, + SludgeBomb, + Sandstorm, + FireBlast, + RockTomb, + AerialAce, + Torment, + Facade, + SecretPower, + Rest, + Attract, + Thief, + SteelWing, + SkillSwap, + Snatch, + Overheat +}; + +PokemonMoveIndex getMoveForTM(ItemIndex index) { + if (index < TM01 || index > TM50) return NoMove; + else return TMMoves[index - TM01]; +} + } \ No newline at end of file diff --git a/LibPkmGC/src/LibPkmGC/Core/MoveInfo.cpp b/LibPkmGC/src/LibPkmGC/Core/MoveInfo.cpp new file mode 100644 index 0000000..f48fdf5 --- /dev/null +++ b/LibPkmGC/src/LibPkmGC/Core/MoveInfo.cpp @@ -0,0 +1,405 @@ +/* +* Copyright (C) TuxSH 2015 +* This file is part of LibPkmGC. +* +* LibPkmGC is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* LibPkmGC is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with LibPkmGC. If not, see . +*/ + +#include +#include + +namespace LibPkmGC { + +void PokemonMove::load(u8 * data) { + LD_FIELD_E_MAX(u16, move, 0, PokemonMoveIndex, PsychoBoost); + LD_FIELD(u8, currentPPs, 2); + LD_FIELD_MAX(u8, nbPPUpsUsed, 3, 3); +} + +void PokemonMove::save(u8 * data) { + SV_FIELD_E_MAX(u16, move, 0, PokemonMoveIndex, PsychoBoost); + SV_FIELD(u8, currentPPs, 2); + SV_FIELD_MAX(u8, nbPPUpsUsed, 3, 3); +} + +u8 PokemonMove::calculateMaxPP(void) const { + u32 baseMaxPP = (move > PsychoBoost) ? 0 : (u32)getBaseMoveMaxPPs(move); + return (u8)(baseMaxPP*(100 + (u32)nbPPUpsUsed * 20) / 100); +} + +const u8 baseMoveMaxPPs[355] = { + 0, + 35, + 25, + 10, + 15, + 20, + 20, + 15, + 15, + 15, + 35, + 30, + 5, + 10, + 30, + 30, + 35, + 35, + 20, + 15, + 20, + 20, + 10, + 20, + 30, + 5, + 25, + 15, + 15, + 15, + 25, + 20, + 5, + 35, + 15, + 20, + 20, + 20, + 15, + 30, + 35, + 20, + 20, + 30, + 25, + 40, + 20, + 15, + 20, + 20, + 20, + 30, + 25, + 15, + 30, + 25, + 5, + 15, + 10, + 5, + 20, + 20, + 20, + 5, + 35, + 20, + 25, + 20, + 20, + 20, + 15, + 20, + 10, + 10, + 40, + 25, + 10, + 35, + 30, + 15, + 20, + 40, + 10, + 15, + 30, + 15, + 20, + 10, + 15, + 10, + 5, + 10, + 10, + 25, + 10, + 20, + 40, + 30, + 30, + 20, + 20, + 15, + 10, + 40, + 15, + 20, + 30, + 20, + 20, + 10, + 40, + 40, + 30, + 30, + 30, + 20, + 30, + 10, + 10, + 20, + 5, + 10, + 30, + 20, + 20, + 20, + 5, + 15, + 10, + 20, + 15, + 15, + 35, + 20, + 15, + 10, + 20, + 30, + 15, + 40, + 20, + 15, + 10, + 5, + 10, + 30, + 10, + 15, + 20, + 15, + 40, + 40, + 10, + 5, + 15, + 10, + 10, + 10, + 15, + 30, + 30, + 10, + 10, + 20, + 10, + 1, + 1, + 10, + 10, + 10, + 5, + 15, + 25, + 15, + 10, + 15, + 30, + 5, + 40, + 15, + 10, + 25, + 10, + 30, + 10, + 20, + 10, + 10, + 10, + 10, + 10, + 20, + 5, + 40, + 5, + 5, + 15, + 5, + 10, + 5, + 15, + 10, + 5, + 10, + 20, + 20, + 40, + 15, + 10, + 20, + 20, + 25, + 5, + 15, + 10, + 5, + 20, + 15, + 20, + 25, + 20, + 5, + 30, + 5, + 10, + 20, + 40, + 5, + 20, + 40, + 20, + 15, + 35, + 10, + 5, + 5, + 5, + 15, + 5, + 20, + 5, + 5, + 15, + 20, + 10, + 5, + 5, + 15, + 15, + 15, + 15, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 10, + 15, + 15, + 15, + 10, + 20, + 20, + 10, + 20, + 20, + 20, + 20, + 20, + 10, + 10, + 10, + 20, + 20, + 5, + 15, + 10, + 10, + 15, + 10, + 20, + 5, + 5, + 10, + 10, + 20, + 5, + 10, + 20, + 10, + 20, + 20, + 20, + 5, + 5, + 15, + 20, + 10, + 15, + 20, + 15, + 10, + 10, + 15, + 10, + 5, + 5, + 10, + 15, + 10, + 5, + 20, + 25, + 5, + 40, + 10, + 5, + 40, + 15, + 20, + 20, + 5, + 15, + 20, + 30, + 15, + 15, + 5, + 10, + 30, + 20, + 30, + 15, + 5, + 40, + 15, + 5, + 20, + 5, + 15, + 25, + 40, + 15, + 20, + 15, + 20, + 15, + 20, + 10, + 20, + 20, + 5, + 5 +}; + +u8 getBaseMoveMaxPPs(PokemonMoveIndex move) { + if (move > PsychoBoost) return 0; + return baseMoveMaxPPs[(size_t)move]; +} + + +} \ No newline at end of file diff --git a/LibPkmGC/src/LibPkmGC/Core/PokemonInfo.cpp b/LibPkmGC/src/LibPkmGC/Core/PokemonInfo.cpp index f2afb83..b6e590c 100644 --- a/LibPkmGC/src/LibPkmGC/Core/PokemonInfo.cpp +++ b/LibPkmGC/src/LibPkmGC/Core/PokemonInfo.cpp @@ -1,71 +1,26 @@ +/* +* Copyright (C) TuxSH 2015 +* This file is part of LibPkmGC. +* +* LibPkmGC is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* LibPkmGC is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with LibPkmGC. If not, see . +*/ + #include #include namespace LibPkmGC{ -void VersionInfo::load(u8 * data) { - LD_FIELD_E_MAX(u8, game, 0, GameIndex, Colosseum_XD); - LD_FIELD_E_MAX(u8, currentRegion, 1, RegionIndex, PAL); - LD_FIELD_E_MAX(u8, originalRegion, 2, RegionIndex, PAL); - LD_FIELD_E_MAX(u8, language, 3, LanguageIndex, Spanish); -} - -void VersionInfo::load(u8 lg, u8 gm) { - const LanguageIndex L[] = { NoLanguage, Japanese, English, French, Italian, German, NoLanguage, Spanish }; - GameIndex G[16] = { NoGame, Sapphire, Ruby, Emerald, FireRed, LeafGreen }; G[15] = Colosseum_XD; - - game = G[(gm > 15) ? 0 : gm]; - language = L[(lg > 7) ? 0 : lg]; - - switch (language){ - case Japanese: originalRegion = NTSC_J; break; - case English: originalRegion = NTSC_U; break; - case NoLanguage: originalRegion = NoRegion; break; - default: originalRegion = PAL; break; - } - currentRegion = originalRegion; - -} - -void VersionInfo::save(u8& lg, u8& gm) { - const u8 L[] = { 0, 1, 2, 5, 3, 4, 7 }; - u8 G[12] = { 0, 4, 5, 0,0,0,0,0, 1, 2, 3 }; G[11] = 15; - - game = (game > Colosseum_XD) ? NoGame : game; - language = (language > Spanish) ? NoLanguage : language; - - gm = G[game]; - lg = L[language]; -} - -void VersionInfo::save(u8 * data) { - SV_FIELD_E_MAX(u8, game, 0, GameIndex, Colosseum_XD); - SV_FIELD_E_MAX(u8, currentRegion, 1, RegionIndex, PAL); - SV_FIELD_E_MAX(u8, originalRegion, 2, RegionIndex, PAL); - SV_FIELD_E_MAX(u8, language, 3, LanguageIndex, Spanish); -} - -bool VersionInfo::isIncomplete(void) const { - return (game == NoGame) || (currentRegion == NoRegion) || (originalRegion == NoRegion) || (language == NoLanguage); -} - -void PokemonMove::load(u8 * data) { - LD_FIELD_E_MAX(u16, move, 0, PokemonMoveIndex, PsychoBoost); - LD_FIELD(u8, currentPPs, 2); - LD_FIELD_MAX(u8, nbPPUpsUsed, 3, 3); -} - -void PokemonMove::save(u8 * data) { - SV_FIELD_E_MAX(u16, move, 0, PokemonMoveIndex, PsychoBoost); - SV_FIELD(u8, currentPPs, 2); - SV_FIELD_MAX(u8, nbPPUpsUsed, 3, 3); -} - -u8 PokemonMove::calculateMaxPP(void) const { - u32 baseMaxPP = (move > PsychoBoost) ? 0 : (u32)getBaseMoveMaxPPs(move); - return (u8)(baseMaxPP*(100 + (u32)nbPPUpsUsed * 20) / 100); -} - void PokemonMarkings::load(u8 m) { circle = (m & 1) != 0; square = (m & 2) != 0; @@ -526,365 +481,6 @@ PokemonSpeciesIndex getSpeciesIndexOf(u16 pokedexIndex) { return speciesIndexFromPkdxIndexTable[(size_t)pokedexIndex]; } - -const u8 baseMoveMaxPPs[355] = { - 0, - 35, - 25, - 10, - 15, - 20, - 20, - 15, - 15, - 15, - 35, - 30, - 5, - 10, - 30, - 30, - 35, - 35, - 20, - 15, - 20, - 20, - 10, - 20, - 30, - 5, - 25, - 15, - 15, - 15, - 25, - 20, - 5, - 35, - 15, - 20, - 20, - 20, - 15, - 30, - 35, - 20, - 20, - 30, - 25, - 40, - 20, - 15, - 20, - 20, - 20, - 30, - 25, - 15, - 30, - 25, - 5, - 15, - 10, - 5, - 20, - 20, - 20, - 5, - 35, - 20, - 25, - 20, - 20, - 20, - 15, - 20, - 10, - 10, - 40, - 25, - 10, - 35, - 30, - 15, - 20, - 40, - 10, - 15, - 30, - 15, - 20, - 10, - 15, - 10, - 5, - 10, - 10, - 25, - 10, - 20, - 40, - 30, - 30, - 20, - 20, - 15, - 10, - 40, - 15, - 20, - 30, - 20, - 20, - 10, - 40, - 40, - 30, - 30, - 30, - 20, - 30, - 10, - 10, - 20, - 5, - 10, - 30, - 20, - 20, - 20, - 5, - 15, - 10, - 20, - 15, - 15, - 35, - 20, - 15, - 10, - 20, - 30, - 15, - 40, - 20, - 15, - 10, - 5, - 10, - 30, - 10, - 15, - 20, - 15, - 40, - 40, - 10, - 5, - 15, - 10, - 10, - 10, - 15, - 30, - 30, - 10, - 10, - 20, - 10, - 1, - 1, - 10, - 10, - 10, - 5, - 15, - 25, - 15, - 10, - 15, - 30, - 5, - 40, - 15, - 10, - 25, - 10, - 30, - 10, - 20, - 10, - 10, - 10, - 10, - 10, - 20, - 5, - 40, - 5, - 5, - 15, - 5, - 10, - 5, - 15, - 10, - 5, - 10, - 20, - 20, - 40, - 15, - 10, - 20, - 20, - 25, - 5, - 15, - 10, - 5, - 20, - 15, - 20, - 25, - 20, - 5, - 30, - 5, - 10, - 20, - 40, - 5, - 20, - 40, - 20, - 15, - 35, - 10, - 5, - 5, - 5, - 15, - 5, - 20, - 5, - 5, - 15, - 20, - 10, - 5, - 5, - 15, - 15, - 15, - 15, - 10, - 10, - 10, - 10, - 10, - 10, - 10, - 10, - 15, - 15, - 15, - 10, - 20, - 20, - 10, - 20, - 20, - 20, - 20, - 20, - 10, - 10, - 10, - 20, - 20, - 5, - 15, - 10, - 10, - 15, - 10, - 20, - 5, - 5, - 10, - 10, - 20, - 5, - 10, - 20, - 10, - 20, - 20, - 20, - 5, - 5, - 15, - 20, - 10, - 15, - 20, - 15, - 10, - 10, - 15, - 10, - 5, - 5, - 10, - 15, - 10, - 5, - 20, - 25, - 5, - 40, - 10, - 5, - 40, - 15, - 20, - 20, - 5, - 15, - 20, - 30, - 15, - 15, - 5, - 10, - 30, - 20, - 30, - 15, - 5, - 40, - 15, - 5, - 20, - 5, - 15, - 25, - 40, - 15, - 20, - 15, - 20, - 15, - 20, - 10, - 20, - 20, - 5, - 5 -}; - const u32 expTables[6][101] = { { 0, @@ -5681,9 +5277,4 @@ PokemonNatureAffinity getNatureStatAffinity(PokemonNatureIndex nature, size_t st return natureStatAffinities[(size_t)nature][(size_t)stat - 1]; } -u8 getBaseMoveMaxPPs(PokemonMoveIndex move) { - if (move > PsychoBoost) return 0; - return baseMoveMaxPPs[(size_t)move]; -} - } \ No newline at end of file diff --git a/LibPkmGC/src/LibPkmGC/Core/VersionInfo.cpp b/LibPkmGC/src/LibPkmGC/Core/VersionInfo.cpp new file mode 100644 index 0000000..3e8e84e --- /dev/null +++ b/LibPkmGC/src/LibPkmGC/Core/VersionInfo.cpp @@ -0,0 +1,70 @@ +/* +* Copyright (C) TuxSH 2015 +* This file is part of LibPkmGC. +* +* LibPkmGC is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* LibPkmGC is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with LibPkmGC. If not, see . +*/ + +#include +#include + +namespace LibPkmGC { + +void VersionInfo::load(u8 * data) { + LD_FIELD_E_MAX(u8, game, 0, GameIndex, Colosseum_XD); + LD_FIELD_E_MAX(u8, currentRegion, 1, RegionIndex, PAL); + LD_FIELD_E_MAX(u8, originalRegion, 2, RegionIndex, PAL); + LD_FIELD_E_MAX(u8, language, 3, LanguageIndex, Spanish); +} + +void VersionInfo::load(u8 lg, u8 gm) { + const LanguageIndex L[] = { NoLanguage, Japanese, English, French, Italian, German, NoLanguage, Spanish }; + GameIndex G[16] = { NoGame, Sapphire, Ruby, Emerald, FireRed, LeafGreen }; G[15] = Colosseum_XD; + + game = G[(gm > 15) ? 0 : gm]; + language = L[(lg > 7) ? 0 : lg]; + + switch (language) { + case Japanese: originalRegion = NTSC_J; break; + case English: originalRegion = NTSC_U; break; + case NoLanguage: originalRegion = NoRegion; break; + default: originalRegion = PAL; break; + } + currentRegion = originalRegion; + +} + +void VersionInfo::save(u8& lg, u8& gm) { + const u8 L[] = { 0, 1, 2, 5, 3, 4, 7 }; + u8 G[12] = { 0, 4, 5, 0,0,0,0,0, 1, 2, 3 }; G[11] = 15; + + game = (game > Colosseum_XD) ? NoGame : game; + language = (language > Spanish) ? NoLanguage : language; + + gm = G[game]; + lg = L[language]; +} + +void VersionInfo::save(u8 * data) { + SV_FIELD_E_MAX(u8, game, 0, GameIndex, Colosseum_XD); + SV_FIELD_E_MAX(u8, currentRegion, 1, RegionIndex, PAL); + SV_FIELD_E_MAX(u8, originalRegion, 2, RegionIndex, PAL); + SV_FIELD_E_MAX(u8, language, 3, LanguageIndex, Spanish); +} + +bool VersionInfo::isIncomplete(void) const { + return (game == NoGame) || (currentRegion == NoRegion) || (originalRegion == NoRegion) || (language == NoLanguage); +} + +} diff --git a/PkmGCSaveEditor/src/Core/ItemComboBox.cpp b/PkmGCSaveEditor/src/Core/ItemComboBox.cpp index 7e46e1c..338de9b 100644 --- a/PkmGCSaveEditor/src/Core/ItemComboBox.cpp +++ b/PkmGCSaveEditor/src/Core/ItemComboBox.cpp @@ -49,11 +49,16 @@ void ItemComboBox::resetItemList(void){ fl &= ~1; // since (1 << (getItemCategory() )) == 1 ... for (int i = 1; i <= (int)BattleCD60; ++i) { // 593 - unsigned int ctgFlg = (1U << (int)getItemCategory((ItemIndex)i, _isXD)); + ItemIndex index = (ItemIndex)i; + unsigned int ctgFlg = (1U << (int)getItemCategory(index, _isXD)); if ((fl & ctgFlg) != 0) { - this->addItem(getItemName(lg, (ItemIndex)i, _isXD)); + const char* name = getItemName(lg, index, _isXD); + this->addItem((index >= TM01 && index <= TM50) + ? QString("%1 (%2)").arg(name).arg(getPokemonMoveName(lg, getMoveForTM(index))) + : name + ); _reverseIndices[i] = j; - _indices[j++] = (ItemIndex)i; + _indices[j++] = index; } else { _reverseIndices[i] = -1; diff --git a/PkmGCSaveEditor/src/Core/ItemPocketEditor.cpp b/PkmGCSaveEditor/src/Core/ItemPocketEditor.cpp index d151e73..d39df47 100644 --- a/PkmGCSaveEditor/src/Core/ItemPocketEditor.cpp +++ b/PkmGCSaveEditor/src/Core/ItemPocketEditor.cpp @@ -73,7 +73,12 @@ void ItemPocketEditor::setItemAt(int i) { QTableWidgetItem *qty = new QTableWidgetItem(QString::number(items[i].quantity)); qty->setTextAlignment((int)Qt::AlignRight | (int)Qt::AlignVCenter); - tbl->setItem(i, 0, new QTableWidgetItem(getItemName(lg, items[i].index, isXD))); + + const char* name = getItemName(lg, items[i].index, isXD); + if(items[i].index >= TM01 && items[i].index <= TM50) + tbl->setItem(i, 0, new QTableWidgetItem(QString("%1 (%2)").arg(name).arg(getPokemonMoveName(lg, getMoveForTM(items[i].index))))); + else + tbl->setItem(i, 0, new QTableWidgetItem(getItemName(lg, items[i].index, isXD))); tbl->setItem(i, 1, qty); } diff --git a/PkmGCSaveEditor/src/Core/VersionInfoLayout.h b/PkmGCSaveEditor/src/Core/VersionInfoLayout.h index fb69d59..510ee10 100644 --- a/PkmGCSaveEditor/src/Core/VersionInfoLayout.h +++ b/PkmGCSaveEditor/src/Core/VersionInfoLayout.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include