diff options
Diffstat (limited to 'include')
39 files changed, 505 insertions, 294 deletions
diff --git a/include/battle.h b/include/battle.h index d4cb53689..12faee537 100755..100644 --- a/include/battle.h +++ b/include/battle.h @@ -21,101 +21,109 @@ #define AI_ACTION_DONE 0x0001 #define AI_ACTION_FLEE 0x0002 -#define AI_ACTION_WATCH 0x0004 -#define AI_ACTION_DO_NOT_ATTACK 0x0008 +#define AI_ACTION_WATCH 0x0004 +#define AI_ACTION_DO_NOT_ATTACK 0x0008 #define AI_ACTION_UNK5 0x0010 #define AI_ACTION_UNK6 0x0020 #define AI_ACTION_UNK7 0x0040 #define AI_ACTION_UNK8 0x0080 -#define STATUS_SLEEP 0x7 -#define STATUS_POISON 0x8 -#define STATUS_BURN 0x10 -#define STATUS_FREEZE 0x20 -#define STATUS_PARALYSIS 0x40 -#define STATUS_TOXIC_POISON 0x80 +#define STATUS_SLEEP 0x7 +#define STATUS_POISON 0x8 +#define STATUS_BURN 0x10 +#define STATUS_FREEZE 0x20 +#define STATUS_PARALYSIS 0x40 +#define STATUS_TOXIC_POISON 0x80 #define STATUS2_CONFUSION 0x00000007 #define STATUS2_UPROAR 0x00000070 +#define STATUS2_BIDE 0x00000300 //two bits 0x100 0x200 #define STATUS2_LOCK_CONFUSE 0x00000C00 #define STATUS2_MULTIPLETURNS 0x00001000 #define STATUS2_WRAPPED 0x0000E000 +#define STATUS2_INFATUATION 0x000F0000 #define STATUS2_FOCUS_ENERGY 0x00100000 #define STATUS2_TRANSFORMED 0x00200000 #define STATUS2_RECHARGE 0x00400000 #define STATUS2_RAGE 0x00800000 #define STATUS2_SUBSTITUTE 0x01000000 +#define STATUS2_DESTINY_BOND 0x02000000 #define STATUS2_ESCAPE_PREVENTION 0x04000000 #define STATUS2_NIGHTMARE 0x08000000 #define STATUS2_CURSED 0x10000000 #define STATUS2_FORESIGHT 0x20000000 +#define STATUS2_DEFENSE_CURL 0x40000000 +#define STATUS2_TORMENT 0x80000000 -#define STATUS3_LEECHSEED_RECEIVER 0x3 //two bits for the bank that gets hp +#define STATUS3_LEECHSEED_BANK 0x3 #define STATUS3_LEECHSEED 0x4 #define STATUS3_ALWAYS_HITS 0x18 //two bits #define STATUS3_PERISH_SONG 0x20 #define STATUS3_ON_AIR 0x40 #define STATUS3_UNDERGROUND 0x80 #define STATUS3_MINIMIZED 0x100 -#define STATUS3_CHARGED_UP 0x200 #define STATUS3_ROOTED 0x400 +#define STATUS3_CHARGED_UP 0x200 +#define STATUS3_YAWN 0x1800 //two bits +#define STATUS3_IMPRISIONED 0x2000 #define STATUS3_GRUDGE 0x4000 #define STATUS3_CANT_SCORE_A_CRIT 0x8000 #define STATUS3_MUDSPORT 0x10000 #define STATUS3_WATERSPORT 0x20000 #define STATUS3_UNDERWATER 0x40000 -#define HITMARKER_x20 0x0000020 -#define HITMARKER_DESTINYBOND 0x0000040 -#define HITMARKER_NO_ANIMATIONS 0x0000080 -#define HITMARKER_IGNORE_SUBSTITUTE 0x0000100 -#define HITMARKER_NO_ATTACKSTRING 0x0000200 -#define HITMARKER_ATTACKSTRING_PRINTED 0x0000400 -#define HITMARKER_NO_PPDEDUCT 0x0000800 -#define HITMARKER_IGNORE_SAFEGUARD 0x0002000 -#define HITMARKER_SYNCHRONISE_EFFECT 0x0004000 -#define HITMARKER_IGNORE_ON_AIR 0x0010000 -#define HITMARKER_IGNORE_UNDERGROUND 0x0020000 -#define HITMARKER_IGNORE_UNDERWATER 0x0040000 -#define HITMARKER_x80000 0x0080000 -#define HITMARKER_x100000 0x0100000 -#define HITMARKER_x400000 0x0400000 -#define HITMARKER_x800000 0x0800000 -#define HITMARKER_GRUDGE 0x1000000 -#define HITMARKER_OBEYS 0x2000000 +#define STATUS3_SEMI_INVULNERABLE ((STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)) + +#define HITMARKER_x20 0x00000020 +#define HITMARKER_DESTINYBOND 0x00000040 +#define HITMARKER_NO_ANIMATIONS 0x00000080 +#define HITMARKER_IGNORE_SUBSTITUTE 0x00000100 +#define HITMARKER_NO_ATTACKSTRING 0x00000200 +#define HITMARKER_ATTACKSTRING_PRINTED 0x00000400 +#define HITMARKER_NO_PPDEDUCT 0x00000800 +#define HITMARKER_PURSUIT_TRAP 0x00001000 +#define HITMARKER_IGNORE_SAFEGUARD 0x00002000 +#define HITMARKER_SYNCHRONISE_EFFECT 0x00004000 +#define HITMARKER_IGNORE_ON_AIR 0x00010000 +#define HITMARKER_IGNORE_UNDERGROUND 0x00020000 +#define HITMARKER_IGNORE_UNDERWATER 0x00040000 +#define HITMARKER_x80000 0x00080000 +#define HITMARKER_x100000 0x00100000 +#define HITMARKER_x400000 0x00400000 +#define HITMARKER_x800000 0x00800000 +#define HITMARKER_GRUDGE 0x01000000 +#define HITMARKER_OBEYS 0x02000000 +#define HITMARKER_x8000000 0x08000000 #define HITMARKER_FAINTED(bank) ((gBitTable[bank] << 0x1C)) #define HITMARKER_UNK(bank) ((0x10000000 << bank)) +#define SIDE_STATUS_REFLECT (1 << 0) +#define SIDE_STATUS_LIGHTSCREEN (1 << 1) +#define SIDE_STATUS_SPIKES (1 << 4) +#define SIDE_STATUS_SAFEGUARD (1 << 5) +#define SIDE_STATUS_FUTUREATTACK (1 << 6) +#define SIDE_STATUS_MIST (1 << 8) +#define SIDE_STATUS_SPIKES_DAMAGED (1 << 9) + #define MAX_TRAINER_ITEMS 4 #define MAX_MON_MOVES 4 #define MAX_BANKS_BATTLE 4 -#define weather_rain 1 -#define weather_downpour 2 -#define weather_permament_rain 4 -#define WEATHER_RAINY ((weather_rain | weather_downpour | weather_permament_rain)) - -#define weather_sandstorm 8 -#define weather_permament_sandstorm 0x10 -#define WEATHER_SANDSTORMY ((weather_sandstorm | weather_permament_sandstorm)) - -#define weather_sun 0x20 -#define weather_permament_sun 0x40 -#define WEATHER_SUNNY ((weather_sun | weather_permament_sun)) - -#define weather_hail 0x80 +#define WEATHER_RAIN_TEMPORARY (1 << 0) +#define WEATHER_RAIN_DOWNPOUR (1 << 1) +#define WEATHER_RAIN_PERMANENT (1 << 2) +#define WEATHER_RAIN_ANY ((WEATHER_RAIN_TEMPORARY | WEATHER_RAIN_DOWNPOUR | WEATHER_RAIN_PERMANENT)) +#define WEATHER_SANDSTORM_TEMPORARY (1 << 3) +#define WEATHER_SANDSTORM_PERMANENT (1 << 4) +#define WEATHER_SANDSTORM_ANY ((WEATHER_SANDSTORM_TEMPORARY | WEATHER_SANDSTORM_PERMANENT)) +#define WEATHER_SUN_TEMPORARY (1 << 5) +#define WEATHER_SUN_PERMANENT (1 << 6) +#define WEATHER_SUN_ANY ((WEATHER_SUN_TEMPORARY | WEATHER_SUN_PERMANENT)) +#define WEATHER_HAIL (1 << 7) // needed to match the hack that is get_item, thanks cam, someone else clean this up later. extern u8 unk_2000000[]; -enum -{ - WEATHER_SUN, - WEATHER_RAIN, - WEATHER_SANDSTORM, - WEATHER_HAIL, -}; - struct Trainer { /*0x00*/ u8 partyFlags; @@ -165,31 +173,28 @@ struct BattleStruct /* 0x2000000 */ /*0x15DDE*/ u8 unk15DDE; /*0x15DDF*/ u8 unk15DDF; /*0x15DE0*/ u8 filler15DE0[0x222]; - /*0x16002*/ u8 AnimTurn; - /*0x16003*/ u8 ScriptingActive; - /*0x16004*/ u8 WrappedMove1[4]; - /*0x16008*/ u8 WrappedMove2[4]; + /*0x16002*/ u8 animTurn; + /*0x16003*/ u8 scriptingActive; + /*0x16004*/ u8 wrappedMove1[4]; + /*0x16008*/ u8 wrappedMove2[4]; /*0x1600C*/ u8 cmd49StateTracker; /*0x1600D*/ u8 unk1600D; /*0x1600E*/ u8 unk1600E; - /*0x1600F*/ u8 atk23StateTracker; - /*0x16010*/ u8 unk16010; - /*0x16011*/ u8 unk16011; - /*0x16012*/ u8 unk16012; - /*0x16013*/ u8 unk16013; + /*0x1600F*/ u8 cmd23StateTracker; + /*0x16010*/ u8 moveTarget[4]; /*0x16014*/ u8 unk16014; /*0x16015*/ u8 unk16015; /*0x16016*/ u8 unk16016; /*0x16017*/ u8 unk16017; /*0x16018*/ u8 expGetterID; /*0x16019*/ u8 unk16019; - /*0x1601A*/ u8 unk1601A; + /*0x1601A*/ u8 atk5A_StateTracker; //also atk5B, statetracker /*0x1601B*/ u8 wildVictorySong; - /*0x1601C*/ u8 DynamicMoveType; + /*0x1601C*/ u8 dynamicMoveType; /*0x1601D*/ u8 unk1601D; /*0x1601E*/ u8 statChanger; - /*0x1601F*/ u8 DmgMultiplier; - /*0x16020*/ u8 WrappedBy[4]; + /*0x1601F*/ u8 dmgMultiplier; + /*0x16020*/ u8 wrappedBy[4]; /*0x16024*/ u8 unk16024; /*0x16025*/ u8 unk16025; /*0x16026*/ u8 unk16026; @@ -240,7 +245,7 @@ struct BattleStruct /* 0x2000000 */ /*0x16053*/ u8 unk16053; /*0x16054*/ u8 unk16054; /*0x16055*/ u8 unk16055; - /*0x16056*/ u8 unk16056; + /*0x16056*/ u8 moneyMultiplier; /*0x16057*/ u8 unk16057; /*0x16058*/ u8 unk16058; /*0x16059*/ u8 unk16059; @@ -250,38 +255,11 @@ struct BattleStruct /* 0x2000000 */ /*0x1605E*/ u8 unk1605E; /*0x1605F*/ u8 sentInPokes; /*0x16060*/ u8 unk16060[4]; - /*0x16064*/ u8 unk16064; - /*0x16065*/ u8 unk16065; - /*0x16066*/ u8 unk16066; - /*0x16067*/ u8 unk16067; - /*0x16068*/ u8 unk16068; - /*0x16069*/ u8 unk16069; - /*0x1606A*/ u8 unk1606A; - /*0x1606B*/ u8 unk1606B; - /*0x1606C*/ u8 unk1606C; - /*0x1606D*/ u8 unk1606D; - /*0x1606E*/ u8 unk1606E; - /*0x1606F*/ u8 unk1606F; - /*0x16070*/ u8 unk16070; - /*0x16071*/ u8 unk16071; - /*0x16072*/ u8 unk16072; - /*0x16073*/ u8 unk16073; - /*0x16074*/ u8 unk16074; - /*0x16075*/ u8 unk16075; - /*0x16076*/ u8 unk16076; - /*0x16077*/ u8 unk16077; + /*0x16064*/ u8 unk16064[4]; + /*0x16068*/ u8 unk16068[4]; + /*0x1606C*/ u8 unk1606C[4][3]; /*0x16078*/ u8 unk16078; - /*0x16079*/ u8 unk16079; - /*0x1607A*/ u8 unk1607A; - /*0x1607B*/ u8 unk1607B; - /*0x1607C*/ u8 unk1607C; - /*0x1607D*/ u8 unk1607D; - /*0x1607E*/ u8 unk1607E; - /*0x1607F*/ u8 unk1607F; - /*0x16080*/ u8 unk16080; - /*0x16081*/ u8 unk16081; - /*0x16082*/ u8 unk16082; - /*0x16083*/ u8 unk16083; + /*0x16079*/ u8 caughtNick[11]; /*0x16084*/ u8 unk16084; /*0x16085*/ u8 unk16085; /*0x16086*/ u8 unk16086; @@ -302,17 +280,17 @@ struct BattleStruct /* 0x2000000 */ /*0x16098*/ u8 unk16098; /*0x16099*/ u8 unk16099; /*0x1609A*/ u8 unk1609a; - /*0x1609B*/ u8 unk1609b; - /*0x1609C*/ u8 unk1609C; + /*0x1609B*/ u8 castformToChangeInto; + /*0x1609C*/ u8 atk6C_statetracker; /*0x1609D*/ u8 unk1609D; /*0x1609E*/ u8 unk1609E; /*0x1609F*/ u8 unk1609F; /*0x160A0*/ u8 unk160a0; - /*0x160A1*/ u8 AnimTargetsHit; + /*0x160A1*/ u8 animTargetsHit; /*0x160A2*/ u8 expGetterBank; /*0x160A3*/ u8 unk160A3; - /*0x160A4*/ u8 AnimArg1; - /*0x160A5*/ u8 AnimArg2; + /*0x160A4*/ u8 animArg1; + /*0x160A5*/ u8 animArg2; /*0x160A6*/ u8 unk160A6; /*0x160A7*/ u8 unk160A7; /*0x160A8*/ u8 unk160A8; @@ -335,12 +313,9 @@ struct BattleStruct /* 0x2000000 */ /*0x160B9*/ u8 unk160B9; /*0x160BA*/ u8 unk160Ba; /*0x160BB*/ u8 unk160Bb; - /*0x160BC*/ u8 unk160BC; - /*0x160BD*/ u8 unk160BD; - /*0x160BE*/ u8 unk160BE; - /*0x160BF*/ u8 unk160BF; + /*0x160BC*/ u16 HP_OnSwitchout[2]; /*0x160C0*/ u8 unk160C0; - /*0x160C1*/ u8 unk160C1; + /*0x160C1*/ u8 hpScale; /*0x160C2*/ u8 unk160C2; /*0x160C3*/ u8 unk160C3; /*0x160C4*/ u8 unk160C4; @@ -349,59 +324,70 @@ struct BattleStruct /* 0x2000000 */ /*0x160C7*/ u8 unk160C7; /*0x160C8*/ u8 unk160C8; /*0x160C9*/ u8 unk160C9; - /*0x160CA*/ u8 SynchroniseEffect; + /*0x160CA*/ u8 synchroniseEffect; /*0x160CB*/ u8 linkPlayerIndex; - /*0x160CC*/ u16 UsedHeldItems[4]; + /*0x160CC*/ u16 usedHeldItems[4]; u8 filler2[0x72E]; /* 0x16A00 */ struct UnkBattleStruct1 unk_2016A00_2; }; struct DisableStruct { - /*0x00*/ u8 filler0[0x3]; - /*0x04*/ u16 DisabledMove; - /*0x06*/ u16 EncoredMove; - /*0x08*/ u8 ProtectUses; - /*0x09*/ u8 StockpileCounter; - /*0x0A*/ u8 SubstituteHP; - u8 fillerB[4]; - u8 unkF_0:4; - u8 unkF_4:4; - u8 filler10[3]; - /*0x13*/ u8 taunt:4; - /*0x13*/ u8 unkC:4; - /*0x14*/ u8 BankPreventingEscape; - /*0x15*/ u8 BankWithSureHit; - /*0x16*/ u8 IsFirstTurn; + /*0x00*/ u32 unk0; + /*0x04*/ u16 disabledMove; + /*0x06*/ u16 encoredMove; + /*0x08*/ u8 protectUses; + /*0x09*/ u8 stockpileCounter; + /*0x0A*/ u8 substituteHP; + /*0x0B*/ u8 disableTimer1 : 4; + /*0x0B*/ u8 disableTimer2 : 4; + /*0x0C*/ u8 encoredMovePos; + /*0x0D*/ u8 unkD; + /*0x0E*/ u8 encoreTimer1 : 4; + /*0x0E*/ u8 encoreTimer2 : 4; + /*0x0F*/ u8 perishSong1 : 4; + /*0x0F*/ u8 perishSong2 : 4; + /*0x10*/ u8 furyCutterCounter; + /*0x11*/ u8 rolloutTimer1 : 4; + /*0x11*/ u8 rolloutTimer2 : 4; + /*0x12*/ u8 chargeTimer1 : 4; + /*0x12*/ u8 chargeTimer2 : 4; + /*0x13*/ u8 tauntTimer1:4; + /*0x13*/ u8 tauntTimer2:4; + /*0x14*/ u8 bankPreventingEscape; + /*0x15*/ u8 bankWithSureHit; + /*0x16*/ u8 isFirstTurn; /*0x17*/ u8 unk17; - /*0x18*/ u8 TruantCounter; - /*0x19*/ u8 RechargeCounter; + /*0x18*/ u8 truantCounter : 1; + /*0x18*/ u8 unk18_a : 3; + /*0x18*/ u8 unk18_b : 4; + /*0x19*/ u8 rechargeCounter; /*0x1A*/ u8 unk1A[2]; }; struct BattleResults { - u8 PlayerFaintCounter; // 0x0 - u8 OpponentFaintCounter; // 0x1 + u8 playerFaintCounter; // 0x0 + u8 opponentFaintCounter; // 0x1 u8 unk2; // 0x2 u8 unk3; // 0x3 u8 unk4; // 0x4 u8 unk5_0:1; // 0x5 u8 unk5_1:1; // 0x5 - u16 Poke1Species; // 0x6 - u8 PokeString1[10]; // 0x8 + u16 poke1Species; // 0x6 + u8 pokeString1[10]; // 0x8 u8 unk12; - u8 BattleTurnCounter; // 0x13 - u8 PokeString2[10]; // 0x14 + u8 battleTurnCounter; // 0x13 + u8 pokeString2[10]; // 0x14 u8 filler1E[2]; - u16 LastOpponentSpecies; // 0x20 - u16 LastUsedMove; // 0x22 - u16 OpponentMove; // 0x24 - u16 OpponentSpecies; // 0x26 - u16 CaughtPoke; // 0x28 - u8 CaughtNick[10]; // 0x2A + u16 lastOpponentSpecies; // 0x20 + u16 lastUsedMove; // 0x22 + u16 opponentMove; // 0x24 + u16 opponentSpecies; // 0x26 + u16 caughtPoke; // 0x28 + u8 caughtNick[10]; // 0x2A u8 filler34[2]; - u8 unk36[10]; + u8 unk36[10]; // usedBalls? }; struct Struct2017800 @@ -454,34 +440,34 @@ struct Struct20238C8 struct ProtectStruct { /*field0*/ - u32 Protected:1; - u32 Endured:1; - u32 OnlyStruggle:1; - u32 HelpingHand:1; - u32 BounceMove:1; - u32 StealMove:1; - u32 Flag0Unknown:1; - u32 PrlzImmobility:1; + u32 protected:1; + u32 endured:1; + u32 onlyStruggle:1; + u32 helpingHand:1; + u32 bounceMove:1; + u32 stealMove:1; + u32 flag0Unknown:1; + u32 prlzImmobility:1; /*field1*/ - u32 ConfusionSelfDmg:1; - u32 NotEffective:1; - u32 ChargingTurn:1; - u32 FleeFlag:2; //for RunAway and Smoke Ball - u32 UsedImprisionedMove:1; - u32 LoveImmobility:1; - u32 UsedDisabledMove:1; + u32 confusionSelfDmg:1; + u32 notEffective:1; + u32 chargingTurn:1; + u32 fleeFlag:2; //for RunAway and Smoke Ball + u32 usedImprisionedMove:1; + u32 loveImmobility:1; + u32 usedDisabledMove:1; /*field2*/ - u32 UsedTauntedMove:1; - u32 Flag2Unknown:1; - u32 FlinchImmobility:1; - u32 NotFirstStrike:1; - u32 Free : 4; + u32 usedTauntedMove:1; + u32 flag2Unknown:1; + u32 flinchImmobility:1; + u32 notFirstStrike:1; + u32 free : 4; /*field3*/ u32 field3 : 8; - u32 PhysicalDmg; - u32 SpecialDmg; - u8 PhysicalBank; - u8 SpecialBank; + u32 physicalDmg; + u32 specialDmg; + u8 physicalBank; + u8 specialBank; u16 fieldE; }; @@ -497,7 +483,7 @@ struct SpecialStatus u8 focusBanded : 1; u8 field1[3]; u32 moveturnLostHP; - u32 moveturnlostHP_physical; + u32 moveturnLostHP_physical; u32 moveturnLostHP_special; u8 moveturnPhysicalBank; u8 moveturnSpecialBank; @@ -507,18 +493,18 @@ struct SpecialStatus struct sideTimer { - u8 reflectTimer; - u8 reflectBank; - u8 lightscreenTimer; - u8 lightscreenBank; - u8 mistTimer; - u8 mistBank; - u8 safeguardTimer; - u8 safeguardBank; - u8 followmeTimer; - u8 followmeTarget; - u8 spikesAmount; - u8 fieldB; + u8 reflectTimer; //0x0 + u8 lightscreenTimer; //0x1 + u8 mistTimer; //0x2 + u8 field3; //0x3 + u8 field4; //0x4 + u8 field5; //0x5 + u8 spikesAmount; //0x6 + u8 safeguardTimer; //0x7 + u8 followmeTimer; //0x8 + u8 followmeTarget; //0x9 + u8 fieldA; //0xA + u8 fieldB; //0xB }; struct WishFutureKnock @@ -528,7 +514,7 @@ struct WishFutureKnock s32 futureSightDmg[MAX_BANKS_BATTLE]; u16 futureSightMove[MAX_BANKS_BATTLE]; u8 wishCounter[MAX_BANKS_BATTLE]; - u8 wishUserBank[MAX_BANKS_BATTLE]; + u8 wishUserID[MAX_BANKS_BATTLE]; u8 weatherDuration; u8 knockedOffPokes[2]; }; @@ -551,10 +537,62 @@ extern u8 ewram[]; #define UNK_2016A00_STRUCT ((struct UnkBattleStruct1 *) (ewram + 0x16A00)) #define AI_STACK ((struct AI_Stack *) (ewram + 0x16C00)) #define AI_ARRAY_160CC ((struct SmallItemStruct *) (ewram + 0x160CC)) +#define B_FUNCTION_STACK ((struct funcStack *) (ewram + 0x17140)) #define ewram17800 ((struct Struct2017800 *) (ewram + 0x17800)) #define ewram17810 ((struct Struct2017810 *) (ewram + 0x17810)) #define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840)) +struct funcStack +{ + void* ptr[8]; + u8 size; +}; + +extern u8 gBattleTextBuff1[]; + +//function declarations of buffer emits +void EmitGetAttributes(u8 buffID, u8 request, u8 c); //0x0 +void dp01_build_cmdbuf_x01_a_b_0(u8 a, u8 b, u8 c); //0x1 +void EmitSetAttributes(u8 a, u8 request, u8 c, u8 bytes, void *data); //0x2 +void EmitSwitchInAnim(u8 a, u8 b, u8 c); //0x5 +void EmitReturnPokeToBall(u8 a, u8 b); //0x6 +void EmitTrainerSlide(u8 a); //0x8 +void EmitFaintAnimation(u8 a); //0xA +void EmitBallThrowAnim(u8 a, u8 shakes); //0xD +//void EmitMoveAnimation(u8 a, u16 move, u8 turn, u16 power, s32 dmg, u8 happiness, void *disable_struct); //0xF +void EmitPrintString(u8 a, u16 stringID); //0x10 +//void EmitPrintStringPlayerOnly(u8 a, u16 stringID); //0x11 +void EmitChoosePokemon(u8 a, u8 b, u8 c, u8 d, u8 *e); //0x16 +//void EmitHealthBarUpdate(u8 a, u16 b); //0x18; Had to declare the second arg as u16 because s16 wont match in atk0b +//void EmitExpBarUpdate(u8 a, u8 b, u16 c); //0x19 +void EmitStatusIconUpdate(u8 a, u32 b, u32 c); //0x1A +void EmitStatusAnimation(u8 a, u8 b, u32 c); //0x1B +void EmitStatusXor(u8 a, u8 b); //0x1C +void EmitHitAnimation(u8 a); //0x29 +void EmitEffectivenessSound(u8 a, u16 sound); //0x2B +void EmitPlaySound(u8 a, u16 sound); //0x2C +void EmitFaintingCry(u8 a); //0x2D +void EmitBattleIntroSlide(u8 a, u8 b); //0x2E +void dp01_build_cmdbuf_x30_TODO(u8 a, u8 *b, u8 c); //0x30 +void dp01_build_cmdbuf_x31_31_31_31(u8 a); //0x31 +void EmitSpriteInvisibility(u8 a, u8 b); //0x33 +void EmitBattleAnimation(u8 a, u8 b, u16 c); //0x34 +void EmitResetActionMoveSelection(u8 a, u8 b); //0x36 +void dp01_build_cmdbuf_x37_a(u8 a, u8 b); //0x37 + +#define REQUEST_ALL_BATTLE 0x0 +#define REQUEST_SPECIES_BATTLE 0x1 +#define REQUEST_HELDITEM_BATTLE 0x2 +#define REQUEST_MOVES_PP_BATTLE 0x3 +#define REQUEST_PPMOVE1_BATTLE 0x9 +#define REQUEST_PPMOVE2_BATTLE 0xA +#define REQUEST_PPMOVE3_BATTLE 0xB +#define REQUEST_PPMOVE4_BATTLE 0xC +#define REQUEST_STATUS_BATTLE 0x28 +#define REQUEST_HP_BATTLE 0x2A + +void MarkBufferBankForExecution(u8 bank); + extern u8 gBattleTextBuff1[]; // asm/battle_1.o @@ -611,7 +649,6 @@ u8 b_first_side(u8, u8, u8); void TurnValuesCleanUp(u8); void SpecialStatusesClear(void); void sub_80138F0(void); -void MarkBufferBankForExecution(); void sub_80155A4(); void CancelMultiTurnMoves(u8); void PrepareStringBattle(); @@ -625,11 +662,11 @@ u8 TurnBasedEffects(); u8 sub_80170DC(); u8 sub_80173A4(); u8 AbilityBattleEffects(u8, u8, u8, u8, u16); -u8 sub_801A02C(); +u8 ItemBattleEffects(); // asm/battle_4.o void AI_CalcDmg(u8, u8); -void TypeCalc(u16, u8, u8); +u8 TypeCalc(u16 move, u8 bank_atk, u8 bank_def); // asm/battle_5.o void nullsub_91(void); diff --git a/include/battle_ai.h b/include/battle_ai.h index 028da2c27..2922da0b3 100644 --- a/include/battle_ai.h +++ b/include/battle_ai.h @@ -23,6 +23,7 @@ enum // battle_ai void BattleAI_SetupAIData(void); +u8 BattleAI_GetAIActionToUse(void); void BattleAI_DoAIProcessing(void); void sub_810745C(void); void AIStackPushVar(u8 *); diff --git a/include/battle_records.h b/include/battle_records.h index f0c1a101b..ac6c3cbdb 100644 --- a/include/battle_records.h +++ b/include/battle_records.h @@ -2,7 +2,8 @@ #define GUARD_BATTLE_RECORDS_H void InitLinkBattleRecords(void); -void PrintLinkBattleWinsLossesDraws(void *); -void PrintLinkBattleRecord(void *, u8); +void UpdateLinkBattleRecords(int id); +void ShowLinkBattleRecords(void); +void ShowBattleTowerRecords(void); #endif // GUARD_BATTLE_RECORDS_H diff --git a/include/contest_painting.h b/include/contest_painting.h index ad1cecfed..48ab95fbc 100644 --- a/include/contest_painting.h +++ b/include/contest_painting.h @@ -49,11 +49,6 @@ struct ContestEntry /*0x16*/ u8 trainer_name[OT_NAME_LENGTH]; }; -struct Unk3000756 -{ - /*0x00*/ u8 var_0; -}; - struct LabelPair { const u8 *prefix; diff --git a/include/decoration.h b/include/decoration.h index 7a6d8ef5a..2e72e305a 100755..100644 --- a/include/decoration.h +++ b/include/decoration.h @@ -289,16 +289,6 @@ extern u8 sub_8134194(u8); // src/decoration_inventory extern bool8 sub_81341D4(void); // src/decoration_inventory extern void sub_8134104(u8); // src/decoration_inventory extern bool8 sub_807D770(void); -extern void sub_80F944C(void); // src/menu_helpers -extern void sub_80F9480(u8 *, u8); // src/menu_helpers -extern void sub_80F94A4(u8, u8 *, u8, s16); // src/menu_helpers -extern void sub_80F94F8(u8 *); // src/menu_helpers -extern void sub_80F9520(u8 *, u8); // src/menu_helpers -extern void DestroyVerticalScrollIndicator(u8); // src/menu_helpers -extern void CreateVerticalScrollIndicators(u8, u8, u8); // src/menu_helpers -extern void LoadScrollIndicatorPalette(void); // src/menu_helpers -extern void DisplayItemMessageOnField(u8, const u8 *, TaskFunc, u16); // src/menu_helpers -extern void BuyMenuFreeMemory(void); // src/menu_helpers extern void sub_8109DAC(u8); // src/trader extern void ReshowPlayerPC(u8); // src/player_pc @@ -310,6 +300,8 @@ void sub_80FE5AC(u8); void sub_80FE604(u8); void sub_80FE728(u8); void sub_80FE758(u8); +void sub_80FE7A8(u8); +void sub_80FE7D4(u8 *, u8); void sub_80FE868(u8); void sub_80FE948(u8); void sub_80FEABC(u8, u8); @@ -317,6 +309,7 @@ void sub_80FEC94(u8); void sub_80FECB8(u8); void sub_80FECE0(u8); void sub_80FEF50(u8); +bool8 sub_80FEFA4(void); void sub_80FF394(u16, u16, u16); void sub_80FF6AC(u8); void sub_80FF960(u8); diff --git a/include/decoration_inventory.h b/include/decoration_inventory.h index afc354237..e59a23008 100644 --- a/include/decoration_inventory.h +++ b/include/decoration_inventory.h @@ -2,9 +2,11 @@ #define GUARD_DECORATION_INVENTORY_H void ClearDecorationInventories(void); +s8 sub_8133F9C(u8); u8 sub_8133FE4(u8); u8 IsThereStorageSpaceForDecoration(u8); u8 sub_8134074(u8); s8 sub_81340A8(u8); +u8 sub_8134194(u8); #endif // GUARD_DECORATION_INVENTORY_H diff --git a/include/event_data.h b/include/event_data.h index 5cac27cc8..98e4a6da3 100644 --- a/include/event_data.h +++ b/include/event_data.h @@ -25,4 +25,20 @@ u8 FlagSet(u16 id); u8 FlagReset(u16 id); bool8 FlagGet(u16 id); +extern u16 gSpecialVar_0x8000; +extern u16 gSpecialVar_0x8001; +extern u16 gSpecialVar_0x8002; +extern u16 gSpecialVar_0x8003; +extern u16 gSpecialVar_0x8004; +extern u16 gSpecialVar_0x8005; +extern u16 gSpecialVar_0x8006; +extern u16 gSpecialVar_0x8007; +extern u16 gSpecialVar_0x8008; +extern u16 gSpecialVar_0x8009; +extern u16 gSpecialVar_0x800A; +extern u16 gSpecialVar_0x800B; +extern u16 gScriptResult; +extern u16 gScriptLastTalked; +extern u16 gScriptFacing; + #endif // GUARD_EVENT_DATA_H diff --git a/include/field_effect.h b/include/field_effect.h index cd84652b1..ea02c4131 100644 --- a/include/field_effect.h +++ b/include/field_effect.h @@ -109,6 +109,8 @@ void SpriteCB_PokeballGlow(struct Sprite *); void SpriteCB_PokecenterMonitor(struct Sprite *); void SpriteCB_HallOfFameMonitor(struct Sprite *); +void sub_80865BC(void); + void PokecenterHealEffect_0(struct Task *); void PokecenterHealEffect_1(struct Task *); void PokecenterHealEffect_2(struct Task *); @@ -128,6 +130,8 @@ void PokeballGlowEffect_5(struct Sprite *); void PokeballGlowEffect_6(struct Sprite *); void PokeballGlowEffect_7(struct Sprite *); +void sub_8086748(void); + bool8 sub_80867AC(struct Task *); bool8 sub_8086854(struct Task *); bool8 sub_8086870(struct Task *); @@ -136,6 +140,8 @@ bool8 sub_808699C(struct Task *); bool8 sub_80869B8(struct Task *); bool8 sub_80869F8(struct Task *); +void sub_8086A2C(u8, u8); + bool8 sub_8086AA0(struct Task *); bool8 sub_8086AC0(struct Task *); bool8 sub_8086B30(struct Task *); @@ -161,6 +167,8 @@ bool8 sub_8087124(struct Task *); bool8 dive_2_unknown(struct Task *); bool8 dive_3_unknown(struct Task *); +void sub_80871B8(u8); + bool8 sub_808722C(struct Task *, struct MapObject *, struct Sprite *); bool8 sub_8087264(struct Task *, struct MapObject *, struct Sprite *); bool8 sub_8087298(struct Task *, struct MapObject *, struct Sprite *); @@ -173,6 +181,8 @@ bool8 sub_80874FC(struct Task *, struct MapObject *, struct Sprite *); bool8 sub_8087548(struct Task *, struct MapObject *, struct Sprite *); bool8 sub_808759C(struct Task *, struct MapObject *, struct Sprite *); +void sub_8087654(u8); + bool8 sub_80876C8(struct Task *, struct MapObject *, struct Sprite *); bool8 sub_80876F8(struct Task *, struct MapObject *, struct Sprite *); bool8 sub_8087774(struct Task *, struct MapObject *, struct Sprite *); @@ -243,4 +253,6 @@ void MultiplyInvertedPaletteRGBComponents(u16, u8, u8, u8); void sub_80878A8(void); void sub_8087BA8(void); +extern u32 gUnknown_0202FF84[8]; + #endif // GUARD_FIELD_EFFECT_H diff --git a/include/field_fadetransition.h b/include/field_fadetransition.h index 764adfc9a..111dc92a6 100644 --- a/include/field_fadetransition.h +++ b/include/field_fadetransition.h @@ -16,7 +16,7 @@ void sub_8080B60(void); void atk17_seteffectuser(void); void sub_8080E28(void); void sub_8080E44(void); -int sub_8080E70(void); +bool32 sub_8080E70(void); void sub_8080E88(void); void sub_8080E88(); void sp13E_warp_to_last_warp(void); diff --git a/include/field_map_obj.h b/include/field_map_obj.h index 6595a51ca..d2a1a9b1f 100644 --- a/include/field_map_obj.h +++ b/include/field_map_obj.h @@ -70,8 +70,6 @@ extern struct CameraSomething gUnknown_03004880; extern u16 gUnknown_03004898; extern u16 gUnknown_0300489C; -extern u32 gUnknown_0202FF84[]; - extern const struct Coords16 gDirectionToVector[]; void FieldObjectCB_BerryTree(struct Sprite *); diff --git a/include/field_special_scene.h b/include/field_special_scene.h index ef3f07120..d674f09df 100644 --- a/include/field_special_scene.h +++ b/include/field_special_scene.h @@ -9,5 +9,6 @@ void Task_Truck3(u8 taskId); void Task_HandleTruckSequence(u8 taskId); void ExecuteTruckSequence(void); void EndTruckSequence(u8); +void sub_80C791C(void); #endif // GUARD_FIELD_SPECIAL_SCENE_H diff --git a/include/field_specials.h b/include/field_specials.h index 710f0a2a0..d61aa3b20 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -8,11 +8,6 @@ struct ElevatorMenu { u8 var3; }; -extern struct ElevatorMenu gUnknown_03000760[20]; -extern struct WarpData gUnknown_020297F0; -extern u8 gBattleOutcome; - -extern u16 gScriptResult; extern u8 gUnknown_02039250; extern u8 gUnknown_02039251; extern u32 gUnknown_02039254; @@ -22,9 +17,6 @@ extern u8 gUnknown_0203925A; extern u8 gUnknown_0203925B; extern u8 gUnknown_0203925C; -extern u16 gSpecialVar_0x8004; -extern u16 gSpecialVar_0x8005; - void ResetCyclingRoadChallengeData(void); bool32 CountSSTidalStep(u16); u8 GetSSTidalLocation(s8 *, s8 *, s16 *, s16 *); diff --git a/include/flags.h b/include/flags.h index 0e408a833..a60de6ea0 100644 --- a/include/flags.h +++ b/include/flags.h @@ -22,6 +22,24 @@ #define BADGE07_GET 0x80D #define BADGE08_GET 0x80E +// cities and towns +#define FLAG_VISITED_LITTLEROOT_TOWN 0x80F +#define FLAG_VISITED_OLDALE_TOWN 0x810 +#define FLAG_VISITED_DEWFORD_TOWN 0x811 +#define FLAG_VISITED_LAVARIDGE_TOWN 0x812 +#define FLAG_VISITED_FALLARBOR_TOWN 0x813 +#define FLAG_VISITED_VERDANTURF_TOWN 0x814 +#define FLAG_VISITED_PACIFIDLOG_TOWN 0x815 +#define FLAG_VISITED_PETALBURG_CITY 0x816 +#define FLAG_VISITED_SLATEPORT_CITY 0x817 +#define FLAG_VISITED_MAUVILLE_CITY 0x818 +#define FLAG_VISITED_RUSTBORO_CITY 0x819 +#define FLAG_VISITED_FORTREE_CITY 0x81A +#define FLAG_VISITED_LILYCOVE_CITY 0x81B +#define FLAG_VISITED_MOSSDEEP_CITY 0x81C +#define FLAG_VISITED_SOOTOPOLIS_CITY 0x81D +#define FLAG_VISITED_EVER_GRANDE_CITY 0x81E + #define SYS_USE_FLASH 0x828 #define SYS_USE_STRENGTH 0x829 #define SYS_WEATHER_CTRL 0x82A @@ -42,6 +60,9 @@ #define SYS_SHOAL_TIDE 0x83A #define SYS_RIBBON_GET 0x83B +#define FLAG_UNLOCK_BATTLE_TOWER 0x848 +#define FLAG_UNLOCK_SOUTHERN_ISLAND 0x849 + #define SYS_PC_LANETTE 0x84B #define SYS_EXDATA_ENABLE 0x84C #define SYS_ENC_UP_ITEM 0x84D @@ -50,6 +71,9 @@ #define SYS_BRAILLE_STRENGTH 0x850 #define SYS_BRAILLE_WAIT 0x851 #define SYS_BRAILLE_FLY 0x852 +#define SYS_HAS_EON_TICKET 0x853 + +#define SYS_POKEMON_LEAGUE_FLY 0x854 #define SYS_TV_LATI 0x85D diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 7589de029..4029132e8 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -166,7 +166,7 @@ struct MapHeader /* 0x0C */ struct MapConnections *connections; /* 0x10 */ u16 music; /* 0x12 */ u16 mapDataId; - /* 0x14 */ u8 name; + /* 0x14 */ u8 regionMapSectionId; /* 0x15 */ u8 cave; /* 0x16 */ u8 weather; /* 0x17 */ u8 mapType; diff --git a/include/global.h b/include/global.h index 4d20ea4fc..f076274cc 100644 --- a/include/global.h +++ b/include/global.h @@ -469,10 +469,20 @@ struct UnkMauvilleOldManStruct2 u8 fillerF[0x2]; }; /*size = 0x2C*/ +struct MauvilleOldManTrader +{ + u8 unk0; + u8 unk1[4]; + u8 unk5[4][11]; + u8 unk31; +}; + typedef union OldMan { struct UnkMauvilleOldManStruct oldMan1; struct UnkMauvilleOldManStruct2 oldMan2; + struct MauvilleOldManTrader trader; + u8 filler[0x40]; } OldMan; struct Unk_SB_Access_Struct1 @@ -526,7 +536,9 @@ struct GabbyAndTyData struct RecordMixing_UnknownStructSub { - u8 data[0x38]; + u32 unk0; + u8 data[0x34]; + //u8 data[0x38]; }; struct RecordMixing_UnknownStruct @@ -536,6 +548,29 @@ struct RecordMixing_UnknownStruct u16 unk74[0x2]; }; +struct LinkBattleRecord +{ + u8 name[8]; + u16 trainerId; + u16 wins; + u16 losses; + u16 draws; +}; + +struct RecordMixingGiftData +{ + u8 unk0; + u8 quantity; + u16 itemId; + u8 filler4[8]; +}; + +struct RecordMixingGift +{ + int checksum; + struct RecordMixingGiftData data; +}; + struct SaveBlock1 /* 0x02025734 */ { /*0x00*/ struct Coords16 pos; @@ -606,7 +641,6 @@ struct SaveBlock1 /* 0x02025734 */ /*0x2D8C*/ u8 unk2D8C[4]; /*0x2D90*/ u8 filler_2D90[0x4]; /*0x2D94*/ OldMan oldMan; - /*0x2DC0*/ u8 unk_2DC0[0x14]; /*0x2DD4*/ struct EasyChatPair easyChatPairs[5]; //Dewford trend [0] and some other stuff /*0x2DFC*/ u8 filler_2DFC[0x8]; /*0x2E04*/ SB_Struct sbStruct; @@ -615,14 +649,14 @@ struct SaveBlock1 /* 0x02025734 */ /*0x30AC*/ u8 filler_30B4[0x2]; /*0x30B6*/ u8 filler_30B6; /*0x30B7*/ u8 filler_30B7[1]; - /*0x30B8*/ u8 linkBattleRecords[5][16]; + /*0x30B8*/ struct LinkBattleRecord linkBattleRecords[5]; /*0x3108*/ u8 filler_3108[8]; /*0x3110*/ u8 giftRibbons[7]; /*0x3117*/ u8 filler_311B[0x2D]; /*0x3144*/ struct Roamer roamer; /*0x3160*/ struct EnigmaBerry enigmaBerry; /*0x3690*/ struct RamScript ramScript; - /*0x3A7C*/ u8 filler_3A7C[0x10]; + /*0x3A7C*/ struct RecordMixingGift recordMixingGift; /*0x3A8C*/ u8 unk3A8C[52]; //pokedex related }; @@ -654,19 +688,20 @@ struct SaveBlock2_Sub /*0x0000, 0x00A8*/ u8 filler_000[0x3D8]; /*0x03D8, 0x0480*/ u16 var_480; /*0x03DA, 0x0482*/ u16 var_482; - /*0x03DC, 0x0484*/ u8 filler_3DC[0xD0]; + /*0x03DC, 0x0484*/ u8 filler_3DC[0x14]; + /*0x03F0, 0x0498*/ u8 ereaderTrainer[0xBC]; /*0x04AC, 0x0554*/ u8 var_4AC; /*0x04AD, 0x0555*/ u8 var_4AD; - /*0x04AE, 0x0556*/ u8 var_4AE; - /*0x04AF, 0x0557*/ u8 var_4AF; + /*0x04AE, 0x0556*/ u8 var_4AE[2]; /*0x04B0, 0x0558*/ u16 var_4B0; /*0x04B2, 0x055A*/ u16 var_4B2; /*0x04B4, 0x055C*/ u16 var_4B4; /*0x04B6, 0x055E*/ u16 var_4B6; - /*0x04B8, 0x0560*/ u8 filler_4B8[0x10]; + /*0x04B8, 0x0560*/ u16 recordWinStreak[2]; + /*0x04BC, 0x0564*/ u8 filler_4BC[0xC]; /*0x04C8, 0x0570*/ u16 var_4C8; /*0x04CA, 0x0572*/ u16 var_4CA; - /*0x04CC, 0x0574*/ u8 filler_4CC[4]; + /*0x04CC, 0x0574*/ u16 winStreak[2]; /*0x04D0, 0x0578*/ u8 var_4D0; /*0x04D1, 0x0579*/ u8 filler_4D1[0x317]; }; diff --git a/include/graphics.h b/include/graphics.h index fb9781147..5632cb831 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2435,6 +2435,10 @@ extern const u8 gMonFrontPic_UnownQuestionMark[]; extern const u8 gMonBackPic_UnownQuestionMark[]; extern const u8 gMonIcon_UnownQuestionMark[]; +extern const u8 gMonIcon_QuestionMark[]; +extern const u8 gMonIcon_Egg[]; +extern const u16 gMonIconPalettes[][16]; + // data/graphics.s extern const u8 gBagMaleTiles[]; extern const u8 gBagFemaleTiles[]; @@ -2549,4 +2553,15 @@ extern const u8 gBerryPalette_Enigma[]; extern const u8 gUnknown_08E96EC8[]; +extern const u8 gMenuTrainerCard_Gfx[]; +extern const u16 gMenuTrainerCard0Star_Pal[]; +extern const u16 gMenuTrainerCard1Star_Pal[]; +extern const u16 gMenuTrainerCard2Star_Pal[]; +extern const u16 gMenuTrainerCard3Star_Pal[]; +extern const u16 gMenuTrainerCard4Star_Pal[]; +extern const u8 gUnknown_08E8CAC0[]; +extern const u8 gUnknown_08E8CFC0[]; +extern const u8 gUnknown_08E8D4C0[]; +extern const u8 gUnknown_08E8D9C0[]; + #endif // GUARD_GRAPHICS_H diff --git a/include/item.h b/include/item.h index 80a460caa..8f6cc883b 100644 --- a/include/item.h +++ b/include/item.h @@ -11,7 +11,7 @@ struct Item u16 price; u8 holdEffect; u8 holdEffectParam; - u8 *description; + const u8 *description; u8 importance; u8 unk19; u8 pocket; @@ -45,12 +45,12 @@ bool8 CheckPCHasItem(u16 itemId, u16 count); bool8 AddPCItem(u16 itemId, u16 count); void RemovePCItem(u8 index, u16 count); void SwapRegisteredBike(void); -struct Item *ItemId_GetItem(u16 itemId); +const struct Item *ItemId_GetItem(u16 itemId); u16 ItemId_GetId(u16 itemId); u16 ItemId_GetPrice(u16 itemId); u8 ItemId_GetHoldEffect(u16 itemId); u8 ItemId_GetHoldEffectParam(u16 itemId); -u8 *ItemId_GetDescription(u16 itemId); +const u8 *ItemId_GetDescription(u16 itemId); bool32 ItemId_CopyDescription(u8 *a, u32 itemId, u32 c); u8 ItemId_GetImportance(u16 itemId); u8 ItemId_GetUnknownValue(u16 itemId); diff --git a/include/item_use.h b/include/item_use.h index 61a3b4f7a..1558f7691 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -3,28 +3,51 @@ extern u16 gScriptItemId; +void ItemUseOutOfBattle_Mail(u8); +void ItemUseOutOfBattle_Bike(u8); void ItemUseOnFieldCB_Bike(u8); +void ItemUseOutOfBattle_Rod(u8); void ItemUseOnFieldCB_Rod(u8); +void ItemUseOutOfBattle_Itemfinder(u8); void ItemUseOnFieldCB_Itemfinder(u8); void RunItemfinderResults(u8); void ExitItemfinder(u8); -bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId); +bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8); void sub_80C9720(u8); void sub_80C9838(u8, s16, s16); u8 GetPlayerDirectionTowardsHiddenItem(s16, s16); void SetPlayerDirectionTowardsItem(u8); void DisplayItemRespondingMessageAndExitItemfinder(u8); void RotatePlayerAndExitItemfinder(u8); +void ItemUseOutOfBattle_PokeblockCase(u8); +void ItemUseOutOfBattle_CoinCase(u8); +void ItemUseOutOfBattle_SSTicket(u8); void sub_80C9D00(u8); +void ItemUseOutOfBattle_WailmerPail(u8); void sub_80C9D74(u8); +void ItemUseOutOfBattle_Medicine(u8); +void ItemUseOutOfBattle_SacredAsh(u8); +void ItemUseOutOfBattle_PPRecovery(u8); +void ItemUseOutOfBattle_PPUp(u8); +void ItemUseOutOfBattle_RareCandy(u8); void ItemUseOutOfBattle_TMHM(u8); void sub_80C9EE4(u8); void sub_80C9F10(u8); void sub_80C9F80(u8); void sub_80C9FC0(u8); +void ItemUseOutOfBattle_Repel(u8); +void ItemUseOutOfBattle_BlackWhiteFlute(u8); void task08_080A1C44(u8); u8 sub_80CA1C8(void); +void ItemUseOutOfBattle_EscapeRope(u8); void ItemUseOutOfBattle_EvolutionStone(u8); +void ItemUseInBattle_PokeBall(u8); +void ItemUseInBattle_StatIncrease(u8); +void ItemUseInBattle_Medicine(u8); +void ItemUseInBattle_PPRecovery(u8); +void ItemUseInBattle_Escape(u8); +void ItemUseOutOfBattle_EnigmaBerry(u8); +void ItemUseInBattle_EnigmaBerry(u8); void ItemUseOutOfBattle_CannotUse(u8); #endif // GUARD_ITEM_USE_H diff --git a/include/libgncmultiboot.h b/include/libgncmultiboot.h index 33c9f6bfa..23ac64d17 100644 --- a/include/libgncmultiboot.h +++ b/include/libgncmultiboot.h @@ -5,6 +5,7 @@ struct GcmbStruct { u16 gcmb_field_0; u8 gcmb_field_2; + u8 filler3[0x2C - 0x3]; }; void GameCubeMultiBoot_Main(struct GcmbStruct *pStruct); diff --git a/include/menu.h b/include/menu.h index 9b48ab79b..e1bb4f1e4 100755..100644 --- a/include/menu.h +++ b/include/menu.h @@ -38,7 +38,7 @@ void MenuFillWindowRectWithBlankTile(u8, u8, u8, u8); void MenuZeroFillScreen(void); void MenuDrawTextWindow(u8, u8, u8, u8); void sub_8071F40(const u8 *); -void sub_8071F60(u8, u8, u8, u8); +void sub_8071F60(u8, u8, u8); u16 unref_sub_8071F98(u8, u8); void unref_sub_8071FBC(u16, u8, u8, u8, u8); void MenuDisplayMessageBox(void); @@ -67,7 +67,7 @@ u8 MenuPrint_PixelCoords(const u8 *, u8, u16, u8); u8 sub_8072A18(const u8 *, u8, u16, u8, u32); u8 unref_sub_8072A5C(u8 *, u8 *, u8, u16, u8, u32); int sub_8072AB0(const u8 *, u8, u16, u8, u8, u32); -void MenuPrint_RightAligned(u8 *, u8, u8); +void MenuPrint_RightAligned(const u8 *, u8, u8); void sub_8072B80(const u8 *, u8, u8, const u8 *); void sub_8072BD8(const u8 *, u8, u8, u16); u8 *sub_8072C14(u8 *, s32, u8, u8); diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 1df5053e7..993d698bd 100755..100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -9,22 +9,31 @@ struct YesNoFuncTable void (*noFunc)(u8); }; +void sub_80F9020(void); +void DisplayItemMessageOnField(u8, const u8 *, TaskFunc, u16); void DoYesNoFuncWithChoice(u8, const struct YesNoFuncTable *); void sub_80F914C(u8, const struct YesNoFuncTable *); -void DisplayItemMessageOnField(u8, const u8 *, TaskFunc, u16); +u8 sub_80F9284(void); +u8 sub_80F92BC(void); +bool8 sub_80F92F4(u16); +bool8 sub_80F931C(u16); bool8 sub_80F9344(void); -u8 sub_80F9344(void); void sub_80F9368(void); void sub_80F9438(void); void sub_80F944C(void); -void CreateVerticalScrollIndicators(u8, u8, u8); // include/decoration.h -void sub_80F979C(u32, u32); // unknown args +void sub_80F9480(u8 *, u8); +void sub_80F94A4(u8, u8 *, s16, s16); +void sub_80F94F8(u8 *); +void sub_80F9520(u8 *, u8); +void CreateVerticalScrollIndicators(u8, u16, u16); +void sub_80F979C(u8, bool8); void DestroyVerticalScrollIndicator(u8); -void BuyMenuFreeMemory(void); -void sub_80F98DC(int); -void sub_80F996C(u8); void LoadScrollIndicatorPalette(void); +void BuyMenuFreeMemory(void); void sub_80F98A4(u8); void StartVerticalScrollIndicators(u8); +void sub_80F98DC(u8); +void PauseVerticalScrollIndicator(u8); +void sub_80F9988(u8, u8); #endif // GUARD_MENU_HELPERS_H diff --git a/include/mystery_event_script.h b/include/mystery_event_script.h index 766303588..ab23a8d00 100644 --- a/include/mystery_event_script.h +++ b/include/mystery_event_script.h @@ -1,8 +1,8 @@ #ifndef GUARD_MYSTERY_EVENT_SCRIPT_H #define GUARD_MYSTERY_EVENT_SCRIPT_H -u32 sub_812613C(u8 *); -void sub_8126160(u32 val); -u16 sub_8126338(void); +u32 RunMysteryEventScript(u8 *); +void SetMysteryEventScriptStatus(u32 val); +u16 GetRecordMixingGift(void); #endif // GUARD_MYSTERY_EVENT_SCRIPT_H diff --git a/include/pokeblock.h b/include/pokeblock.h index 0d8e965e4..f78ed40c3 100755..100644 --- a/include/pokeblock.h +++ b/include/pokeblock.h @@ -1,11 +1,6 @@ #ifndef GUARD_POKEBLOCK_H #define GUARD_POKEBLOCK_H -struct YesNoCBTable { - void (*yesFunc)(void); - void (*noFunc)(void); -}; - enum { PBLOCK_CLR_BLACK, PBLOCK_CLR_RED, @@ -15,12 +10,6 @@ enum { PBLOCK_CLR_YELLOW }; -extern u8 ewram[]; -extern u8 gUnknown_02039244; -extern u8 gUnknown_02039248[4]; -extern u8 gUnknown_0203924C; -extern const u8 *gUnknown_03000758; - void sub_810B96C(void); u8 sub_810BA50(s16, s16, u8); u8 sub_810C9B0(struct Pokeblock *); diff --git a/include/pokemon.h b/include/pokemon.h index c69fb87e0..be6ccfe74 100755..100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -349,6 +349,18 @@ struct BattlePokemon /*0x54*/ u32 otId; }; +enum +{ + STAT_STAGE_HP, // 0 + STAT_STAGE_ATK, // 1 + STAT_STAGE_DEF, // 2 + STAT_STAGE_SPEED, // 3 + STAT_STAGE_SPATK, // 4 + STAT_STAGE_SPDEF, // 5 + STAT_STAGE_ACC, // 6 + STAT_STAGE_EVASION, // 7 +}; + struct BaseStats { /*0x00*/ u8 baseHP; @@ -392,9 +404,14 @@ struct BattleMove u8 secondaryEffectChance; u8 target; u8 priority; - u32 flags; + u8 flags; + u8 pad[3]; }; +#define FLAG_PROTECT_AFFECTED 0x2 +#define FLAG_MAGICCOAT_AFFECTED 0x4 +#define FLAG_SNATCH_AFFECTED 0x8 + struct PokemonStorage { /*0x00*/ u8 currentBox; @@ -464,7 +481,9 @@ struct EvolutionData struct Evolution evolutions[5]; }; +extern u8 gPlayerPartyCount; extern struct Pokemon gPlayerParty[PARTY_SIZE]; +extern u8 gEnemyPartyCount; extern struct Pokemon gEnemyParty[PARTY_SIZE]; extern const u8 *const gItemEffectTable[]; extern const struct BaseStats gBaseStats[]; diff --git a/include/pokemon_menu.h b/include/pokemon_menu.h index d22dbb708..fc43a44c6 100644 --- a/include/pokemon_menu.h +++ b/include/pokemon_menu.h @@ -6,6 +6,7 @@ void sub_808A004(); void sub_808AB90(void); void sub_808AB90(void); // unknown args void sub_808AB90(void); +void sub_808AD58(void); void sub_808B020(void); void sub_808B0C0(u8); void sub_808B508(u8); diff --git a/include/pokenav.h b/include/pokenav.h index 70cc4135f..70cc4135f 100755..100644 --- a/include/pokenav.h +++ b/include/pokenav.h diff --git a/include/record_mixing.h b/include/record_mixing.h index 103f5ad64..ca60b04a7 100644 --- a/include/record_mixing.h +++ b/include/record_mixing.h @@ -14,8 +14,8 @@ void Task_RecordMixing_CopyReceiveBuffer(u8 taskId); void sub_80B99B4(u8 taskId); void Task_RecordMixing_ReceivePacket(u8 taskId); void Task_RecordMixing_SendPacket_SwitchToReceive(u8 taskId); -void *LoadPtrFromTaskData(u16 *ptr); -void StorePtrInTaskData(void *ptr, u16 *data); +void *LoadPtrFromTaskData(u16 *); +void StorePtrInTaskData(void *, u16 *); u8 GetMultiplayerId_(void); u16 *GetPlayerRecvBuffer(u8 player); void sub_80B9A78(void); @@ -23,12 +23,12 @@ void sub_80B9A88(u8 *a); void sub_80B9B1C(u8 *a, size_t size, u8 index); void sub_80B9B70(u8 *a, size_t size, u8 index); u8 sub_80B9BBC(u16 *a); -void sub_80B9BC4(struct RecordMixing_UnknownStruct *, size_t, u8 [][2], u8, u8); +void sub_80B9BC4(u8 *, size_t, u8[][2], u8 d, u8 e); u8 sub_80B9C4C(u8 *a); // ASM -void sub_80B9C6C(struct RecordMixing_UnknownStruct *, u32, u8, void *); -void sub_80B9F3C(void *, u8); +void sub_80B9C6C(u8 *, u32, u8, void *); +void sub_80B9F3C(u16 *, u8); void sub_80BA00C(u8); #endif // GUARD_RECORD_MIXING_H diff --git a/include/region_map.h b/include/region_map.h index 6dfa4dcf0..3d970fa0a 100755..100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -1,13 +1,72 @@ #ifndef GUARD_REGION_MAP_H #define GUARD_REGION_MAP_H -void sub_80FA8EC(u32, u8); -void sub_80FAB10(void); +struct RegionMap +{ + u8 mapSecName[0x14]; + u16 mapSecId; + u8 unk16; + u8 everGrandeCityArea; + u8 (*inputCallback)(void); + struct Sprite *cursorSprite; + struct Sprite *playerIconSprite; + s32 bg2x; + s32 bg2y; + u32 unk2C; // + u32 unk30; // Map rotation parameters + u32 unk34; // Likely a scrapped feature + u32 unk38; // + s32 unk3C; + s32 unk40; + s32 unk44; + s32 unk48; + s32 unk4C; + s32 unk50; + u16 cursorPosX; + u16 cursorPosY; + u16 cursorTileTag; + u16 cursorPaletteTag; + s16 scrollX; + s16 scrollY; + s16 unk60; + s16 unk62; + u16 unk64; + u16 unk66; + u16 unk68; + u16 unk6A; + u16 unk6C; + u16 unk6E; + u16 playerIconTileTag; + u16 playerIconPaletteTag; + u16 unk74; + u16 unk76; + bool8 zoomed; + u8 initStep; + s8 unk7A; + s8 cursorDeltaX; + s8 cursorDeltaY; + bool8 needUpdateVideoRegs; + bool8 blinkPlayerIcon; + bool8 playerIsInCave; + /*0x080*/ u8 filler80[0x100]; + /*0x180*/ u8 cursorSmallImage[0x100]; + /*0x280*/ u8 cursorLargeImage[0x600]; +}; + +void InitRegionMap(struct RegionMap *regionMap, bool8 zoomed); +void sub_80FA904(struct RegionMap *regionMap, bool8 zoomed); +bool8 sub_80FA940(void); +void FreeRegionMapIconResources(void); u8 sub_80FAB60(void); -void sub_80FBB3C(u16, u16); -void sub_80FBCF0(u32, u8); -void sub_80FBFB4(u8 *str, u16 region, u8); -void CopyMapName(); -u8 *CopyLocationName(u8 *dest, u8 location); +void sub_80FAEC4(void); +u8 sub_80FAFC0(void); +void UpdateRegionMapVideoRegs(void); +void sub_80FB2A4(s16, s16); +u16 sub_80FBA04(u16 mapSecId); +void CreateRegionMapCursor(u16, u16); +void CreateRegionMapPlayerIcon(u16, u16); +const u8 *GetMapSectionName(u8 *dest, u16 mapSecId, u16 length); +const u8 *CopyMapName(u8 *dest, u16 b); +const u8 *CopyLocationName(u8 *dest, u16 b); #endif // GUARD_REGION_MAP_H diff --git a/include/rom3.h b/include/rom3.h index a45ec7dc4..1fa55d11a 100644 --- a/include/rom3.h +++ b/include/rom3.h @@ -1,6 +1,8 @@ #ifndef GUARD_ROM3_H #define GUARD_ROM3_H +struct DisableStruct; + void sub_800B858(void); void setup_poochyena_battle(); void sub_800B950(void); @@ -14,26 +16,26 @@ void sub_800C35C(void); void sub_800C47C(u8); void EmitGetAttributes(u8 a, u8 b, u8 c); void dp01_build_cmdbuf_x01_a_b_0(u8 a, u8 b, u8 c); -void EmitSetAttributes(u8 a, u8 b, u8 c, u8 d, u8 *e); void dp01_build_cmdbuf_x04_4_4_4(u8 a); -void sub_800C704(u8, u8, u8); -void dp01_build_cmdbuf_x06_a(u8 a, u8 b); +void EmitSwitchInAnim(u8, u8, u8); +void EmitReturnPokeToBall(u8 a, u8 b); void dp01_build_cmdbuf_x07_7_7_7(u8 a); -void dp01_build_cmdbuf_x08_8_8_8(u8 a); +void EmitTrainerSlide(u8 a); void dp01_build_cmdbuf_x09_9_9_9(u8 a); void EmitFaintAnimation(u8 a); void dp01_build_cmdbuf_x0B_B_B_B(u8 a); void dp01_build_cmdbuf_x0C_C_C_C(u8 a); -void dp01_build_cmdbuf_x0D_a(u8 a, u8 b); -void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, u8 *g); +void EmitBallThrowAnim(u8 a, u8 b); +void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, struct DisableStruct *g); void EmitPrintString(u8 a, u16 b); +void EmitPrintStringPlayerOnly(u8 a, u16 stringID); void dp01_build_cmdbuf_x12_a_bb(u8 a, u8 b, u16 c); void sub_800CBA4(u8 a, u8 b, u8 c, u8 *d); void sub_800CBE0(u8 a, u8 *b); -void dp01_build_cmdbuf_x16_a_b_c_ptr_d_e_f(u8 a, u8 b, u8 c, u8 d, u8 *e); +void EmitChoosePokemon(u8 a, u8 b, u8 c, u8 d, u8 *e); void dp01_build_cmdbuf_x17_17_17_17(u8 a); -void EmitHealthBarUpdate(u8 a, s16 b); -void EmitExpBarUpdate(u8 a, u8 b, s16 c); +void EmitHealthBarUpdate(u8 a, u16 b); +void EmitExpBarUpdate(u8 a, u8 b, u16 c); void EmitStatusIconUpdate(u8 a, u32 b, u32 c); void EmitStatusAnimation(u8 a, u8 b, u32 c); void EmitStatusXor(u8 a, u8 b); @@ -49,7 +51,7 @@ void dp01_build_cmdbuf_x28_28_28_28(u8 a); void EmitHitAnimation(u8 a); void dp01_build_cmdbuf_x2A_2A_2A_2A(u8 a); void EmitEffectivenessSound(u8 a, u16 b); -void sub_800D074(u8 a, u16 b); +void EmitPlaySound(u8 a, u16 b); void EmitFaintingCry(u8 a); void EmitBattleIntroSlide(u8 a, u8 b); void dp01_build_cmdbuf_x2F_2F_2F_2F(u8 a); diff --git a/include/rom4.h b/include/rom4.h index 803a38162..8d5b1bfa2 100644 --- a/include/rom4.h +++ b/include/rom4.h @@ -55,7 +55,7 @@ void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId); void saved_warp2_set(int unused, s8 mapGroup, s8 mapNum, s8 warpId); void saved_warp2_set_2(int unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused); -// sub_8053538 +void sub_8053538(u8); void sub_8053570(void); void sub_8053588(u8); void sub_80535C4(s16 a1, s16 a2); @@ -99,9 +99,9 @@ void sub_8053F0C(void); void sub_8053F84(void); void sub_8053FB0(u16); // is_warp1_light_level_8_or_9 -// sub_8053FF8 -// sub_8054034 -// sub_8054044 +void sub_8053FF8(void); +bool8 sub_8054034(void); +void sub_8054044(void); // sub_8054050 void sub_80540D0(s16 *, u16 *); void sub_8054164(void); @@ -129,8 +129,8 @@ void CB2_NewGame(void); void CB2_WhiteOut(void); void CB2_LoadMap(void); void CB2_LoadMap2(void); -// sub_8054534 -// sub_8054588 +void sub_8054534(void); +void sub_8054588(void); void c2_80567AC(void); void c2_exit_to_overworld_2_switch(void); void c2_exit_to_overworld_2_local(void); diff --git a/include/save.h b/include/save.h index 3feaa1f3d..6c47c6f60 100644 --- a/include/save.h +++ b/include/save.h @@ -74,7 +74,7 @@ bool8 sub_8125DA8(void); u8 sub_8125DDC(void); u8 sub_8125E04(void); u8 sub_8125E2C(void); -u8 sub_8125E6C(void); +bool8 sub_8125E6C(void); u8 sub_8125EC8(u8 a1); bool8 unref_sub_8125F4C(struct UnkSaveSection *a1); u8 unref_sub_8125FA0(void); diff --git a/include/script.h b/include/script.h index e35ec7608..2a738698c 100644 --- a/include/script.h +++ b/include/script.h @@ -25,7 +25,7 @@ void InitScriptContext(struct ScriptContext *ctx, void *cmdTable, void *cmdTable u8 SetupBytecodeScript(struct ScriptContext *ctx, const u8 *ptr); void SetupNativeScript(struct ScriptContext *ctx, void *ptr); void StopScript(struct ScriptContext *ctx); -u8 RunScript(struct ScriptContext *ctx); +u8 RunScriptCommand(struct ScriptContext *ctx); u8 ScriptPush(struct ScriptContext *ctx, const u8 *ptr); const u8 *ScriptPop(struct ScriptContext *ctx); void ScriptJump(struct ScriptContext *ctx, u8 *ptr); @@ -55,7 +55,5 @@ u32 CalculateRamScriptChecksum(void); void ClearRamScript(void); bool8 InitRamScript(u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId); u8 *GetRamScript(u8 objectId, u8 *script); -u16 gScriptResult; -extern u16 gScriptLastTalked; #endif // GUARD_SCRIPT_H diff --git a/include/secret_base.h b/include/secret_base.h index 3ea75ce27..bb747bb02 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -7,6 +7,7 @@ u8 sub_80BBB24(void); void sub_80BBCCC(u8); void sub_80BC038(); u8 sub_80BC050(); +u8 *GetSecretBaseMapName(u8 *); void sub_80BC300(); const u8 sub_80BCCA4(u8); u8 *sub_80BCCE8(void); diff --git a/include/strings.h b/include/strings.h index fe9cfc6ba..fe9cfc6ba 100755..100644 --- a/include/strings.h +++ b/include/strings.h diff --git a/include/text.h b/include/text.h index e9e8eb8c2..99987d2c3 100644 --- a/include/text.h +++ b/include/text.h @@ -66,6 +66,8 @@ #define CHAR_y 0xED #define CHAR_z 0xEE #define CHAR_COLON 0xF0 +#define CHAR_PROMPT_SCROLL 0xFA // waits for button press and scrolls dialog +#define CHAR_PROMPT_CLEAR 0xFB // waits for button press and clears dialog #define EXT_CTRL_CODE_BEGIN 0xFC // extended control code #define PLACEHOLDER_BEGIN 0xFD // string placeholder #define CHAR_NEWLINE 0xFE diff --git a/include/trainer_card.h b/include/trainer_card.h index bd0c808dd..b9d3ca081 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -33,20 +33,6 @@ void sub_8093130(u8, void (*)(void)); void sub_8093390(struct TrainerCard *); u8 sub_80934C4(u8 id); -// gUnknown_083B5EBC:: @ 83B5EBC -bool8 sub_8093864(); -bool8 sub_80938A8(); -bool8 sub_80938CC(); -bool8 sub_8093918(); -bool8 sub_8093938(); -bool8 sub_8093954(); -bool8 sub_8093980(); - -// gUnknown_083B5ED8:: @ 83B5ED8 -bool8 sub_8093AA0(); -bool8 sub_8093AF0(); -bool8 sub_8093C0C(struct TrainerCard *trainerCard); -bool8 sub_8093C38(); -bool8 sub_8093D50(void); +extern struct TrainerCard gTrainerCards[4]; #endif // GUARD_TRAINER_CARD_H diff --git a/include/use_pokeblock.h b/include/use_pokeblock.h index 978476d89..f34857cf1 100755..100644 --- a/include/use_pokeblock.h +++ b/include/use_pokeblock.h @@ -5,9 +5,6 @@ #ifndef POKERUBY_USE_POKEBLOCK_H #define POKERUBY_USE_POKEBLOCK_H -extern void *gUnknown_02030400; -extern s16 gUnknown_02039312; - void sub_8136130(struct Pokeblock *, MainCallback); #endif //POKERUBY_USE_POKEBLOCK_H diff --git a/include/util.h b/include/util.h index 1851c2e82..cd50b75cc 100644 --- a/include/util.h +++ b/include/util.h @@ -9,5 +9,6 @@ extern const u32 gBitTable[]; u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *)); void StoreWordInTwoHalfwords(u16 *, u32); void LoadWordFromTwoHalfwords(u16 *, u32 *); +u16 CalcCRC16(u8 *data, int length); #endif // GUARD_UTIL_H diff --git a/include/vars.h b/include/vars.h index e08f344d4..efbb462a4 100755..100644 --- a/include/vars.h +++ b/include/vars.h @@ -1,6 +1,7 @@ #ifndef GUARD_VARS_H #define GUARD_VARS_H +#define VAR_0x4000 0x4000 #define VAR_0x4001 0x4001 #define VAR_0x4002 0x4002 #define VAR_0x4003 0x4003 |