diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/battle.h | 355 | ||||
-rw-r--r-- | include/decoration.h | 2 | ||||
-rw-r--r-- | include/field_camera.h | 2 | ||||
-rwxr-xr-x | include/field_effect_helpers.h | 1 | ||||
-rw-r--r-- | include/field_special_scene.h | 2 | ||||
-rw-r--r-- | include/field_tasks.h | 6 | ||||
-rw-r--r-- | include/global.h | 11 | ||||
-rw-r--r-- | include/graphics.h | 8 | ||||
-rw-r--r-- | include/item_use.h | 2 | ||||
-rw-r--r-- | include/main.h | 2 | ||||
-rw-r--r-- | include/menu.h | 8 | ||||
-rw-r--r-- | include/menu_helpers.h | 2 | ||||
-rw-r--r-- | include/party_menu.h | 6 | ||||
-rw-r--r-- | include/player_pc.h | 4 | ||||
-rwxr-xr-x | include/pokeblock.h | 28 | ||||
-rw-r--r-- | include/pokeblock_feed.h | 10 | ||||
-rwxr-xr-x | include/pokemon.h | 8 | ||||
-rw-r--r-- | include/pokenav.h | 86 | ||||
-rw-r--r-- | include/rom3.h | 13 | ||||
-rw-r--r-- | include/rom4.h | 3 | ||||
-rw-r--r-- | include/rotating_gate.h | 2 | ||||
-rw-r--r-- | include/secret_base.h | 1 | ||||
-rw-r--r-- | include/task.h | 4 | ||||
-rw-r--r-- | include/text.h | 1 | ||||
-rw-r--r-- | include/use_pokeblock.h | 13 | ||||
-rwxr-xr-x | include/vars.h | 9 |
26 files changed, 407 insertions, 182 deletions
diff --git a/include/battle.h b/include/battle.h index 4e102c145..bd3aa4225 100644 --- a/include/battle.h +++ b/include/battle.h @@ -28,64 +28,83 @@ #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_ROOTED 0x400 #define STATUS3_CHARGED_UP 0x200 -#define STATUS3_ROOTED 0x400 +#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_REFLECT 0x1 +#define SIDE_LIGHTSCREEN 0x2 +#define SIDE_SPIKES 0x10 +#define SIDE_SAFEGUARD 0x20 +#define SIDE_FUTUREATTACK 0x40 +#define SIDE_MIST 0x100 +#define SIDE_SPIKES_DMG_DONE 0x200 + #define MAX_TRAINER_ITEMS 4 #define MAX_MON_MOVES 4 #define MAX_BANKS_BATTLE 4 @@ -165,31 +184,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 +256,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 +266,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 +291,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 +324,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,57 +335,68 @@ 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]; }; @@ -454,34 +451,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 +494,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 +504,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 +525,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]; }; @@ -554,6 +551,58 @@ extern u8 ewram[]; #define ewram17800 ((struct Struct2017800 *) (ewram + 0x17800)) #define ewram17810 ((struct Struct2017810 *) (ewram + 0x17810)) #define ewram17840 (*(struct Struct2017840 *) (ewram + 0x17840)) +#define B_FUNCTION_STACK ((struct funcStack *)(0x02017140)) + +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); // asm/battle_1.o void sub_800D6D4(); @@ -609,7 +658,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(); @@ -623,11 +671,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); @@ -637,6 +685,7 @@ void c3_0802FDF4(u8); void sub_802E3E4(u8, int); void nullsub_8(u8); void sub_802E414(void); +void sub_802E424(void); // asm/battle_7.o void move_anim_start_t4(u8 a, u8 b, u8 c, u8 d); diff --git a/include/decoration.h b/include/decoration.h index 2595d491a..7a6d8ef5a 100644 --- a/include/decoration.h +++ b/include/decoration.h @@ -274,7 +274,7 @@ extern const u8 *const gUnknown_083EC5E4[]; extern const u8 *const gUnknown_083EC624[]; extern u8 gUnknown_020388F7[]; extern const struct MenuAction2 gUnknown_083EC604[]; -extern const struct MenuAction3 gUnknown_083EC634[]; +extern const struct YesNoFuncTable gUnknown_083EC634[]; extern const u8 gUnknown_083EC65A[]; extern const u8 gUnknown_083EC97C[]; extern const u8 gUnknown_083EC984[]; diff --git a/include/field_camera.h b/include/field_camera.h index 9021b579e..4ce207541 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -11,6 +11,8 @@ struct CameraSomething s32 unk14; }; +extern struct Camera gUnknown_0202E844; + void move_tilemap_camera_to_upper_left_corner(void); void sub_8057A58(void); void sub_8057B14(u16 *a, u16 *b); diff --git a/include/field_effect_helpers.h b/include/field_effect_helpers.h index 32438a9ad..a1dd53a2b 100755 --- a/include/field_effect_helpers.h +++ b/include/field_effect_helpers.h @@ -26,5 +26,6 @@ void sub_8126BC4(u8 unk_1B, u8 r6, s16 x, s16 y); void sub_8127ED0(u8, u8); void sub_8127F28(u8, u8, s16); u8 sub_8128124(u8 id); +void ash(s16, s16, u16, u8); #endif // GUARD_FIELD_EFFECT_HELPERS_H diff --git a/include/field_special_scene.h b/include/field_special_scene.h index 5841d6bce..ef3f07120 100644 --- a/include/field_special_scene.h +++ b/include/field_special_scene.h @@ -8,6 +8,6 @@ void Task_Truck2(u8 taskId); void Task_Truck3(u8 taskId); void Task_HandleTruckSequence(u8 taskId); void ExecuteTruckSequence(void); -void EndTruckSequence(void); +void EndTruckSequence(u8); #endif // GUARD_FIELD_SPECIAL_SCENE_H diff --git a/include/field_tasks.h b/include/field_tasks.h index 53e704395..761d69ada 100644 --- a/include/field_tasks.h +++ b/include/field_tasks.h @@ -1,6 +1,12 @@ #ifndef GUARD_FIELD_TASKS_H #define GUARD_FIELD_TASKS_H +struct MetatileOffset { + s8 x; + s8 y; + u16 tileId; +}; + void SetUpFieldTasks(); void ActivatePerStepCallback(u8); void ResetFieldTasksArgs(void); diff --git a/include/global.h b/include/global.h index e90fcdd0f..0f5bcde6d 100644 --- a/include/global.h +++ b/include/global.h @@ -43,6 +43,17 @@ fndec\ #define min(a, b) (a >= b ? a : b) #define max(a, b) (a <= b ? a : b) +// why does GF hate 2d arrays +#define MULTI_DIM_ARR(x, dim, y) ((x) * dim + (y)) + +// dim access enums +enum +{ + B_8 = 1, + B_16 = 2, + B_32 = 4 +}; + enum { VERSION_SAPPHIRE = 1, diff --git a/include/graphics.h b/include/graphics.h index c3fe20996..36b11fd0a 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -2435,4 +2435,12 @@ extern const u8 gMonFrontPic_UnownQuestionMark[]; extern const u8 gMonBackPic_UnownQuestionMark[]; extern const u8 gMonIcon_UnownQuestionMark[]; +// src/pokeblock.c +extern const u8 gMenuPokeblock_Gfx[]; +extern const u8 gMenuPokeblock_Tilemap[]; +extern const u8 gMenuPokeblock_Pal[]; + +extern const u8 gMenuPokeblockDevice_Gfx[]; +extern const u8 gMenuPokeblockDevice_Pal[]; + #endif // GUARD_GRAPHICS_H diff --git a/include/item_use.h b/include/item_use.h index b35389ee8..61a3b4f7a 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -1,6 +1,8 @@ #ifndef GUARD_ITEM_USE_H #define GUARD_ITEM_USE_H +extern u16 gScriptItemId; + void ItemUseOnFieldCB_Bike(u8); void ItemUseOnFieldCB_Rod(u8); void ItemUseOnFieldCB_Itemfinder(u8); diff --git a/include/main.h b/include/main.h index e0cb09370..ff9bb89c7 100644 --- a/include/main.h +++ b/include/main.h @@ -46,8 +46,8 @@ struct Main extern u8 gLinkTransferringData; extern struct Main gMain; extern bool8 gSoftResetDisabled; -extern bool8 gLinkVSyncDisabled; +extern bool8 gLinkVSyncDisabled; extern const u8 gGameVersion; extern const u8 gGameLanguage; diff --git a/include/menu.h b/include/menu.h index 9eeebce60..9b48ab79b 100644 --- a/include/menu.h +++ b/include/menu.h @@ -15,12 +15,6 @@ struct MenuAction2 void (*func)(u8); }; -struct MenuAction3 -{ - void (*func1)(u8); - void (*func2)(u8); -}; - extern const struct MenuAction gMenuYesNoItems[]; extern struct Window gMenuWindow; @@ -65,7 +59,7 @@ void sub_807274C(u8, u8, u8, u8, const struct MenuAction[], u8, u32); s8 sub_80727CC(void); u8 sub_807288C(u8); void PrintMenuItems(u8, u8, u8, const struct MenuAction[]); -void PrintMenuItemsReordered(u8, u8, u8, const struct MenuAction[], u8*); +void PrintMenuItemsReordered(u8, u8, u8, const struct MenuAction[], const u8*); void InitYesNoMenu(u8, u8, u8); void DisplayYesNoMenu(u8, u8, u32); s8 ProcessMenuInputNoWrap_(void); diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 0e39a3732..1df5053e7 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -24,5 +24,7 @@ void BuyMenuFreeMemory(void); void sub_80F98DC(int); void sub_80F996C(u8); void LoadScrollIndicatorPalette(void); +void sub_80F98A4(u8); +void StartVerticalScrollIndicators(u8); #endif // GUARD_MENU_HELPERS_H diff --git a/include/party_menu.h b/include/party_menu.h index 58292081f..9ce476869 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -43,10 +43,14 @@ struct Struct201B000 u8 unk259; u8 filler25A[6]; u8 unk260; - u8 filler261[1]; + u8 unk261; u8 unk262; s16 unk264; s16 unk266; + u8 filler268[10]; + u16 unk272; + u8 filler274[14]; + u16 unk282; }; extern u8 ewram[]; diff --git a/include/player_pc.h b/include/player_pc.h index f2446ebdf..8debeda88 100644 --- a/include/player_pc.h +++ b/include/player_pc.h @@ -1,10 +1,6 @@ #ifndef GUARD_PLAYER_PC_H #define GUARD_PLAYER_PC_H -// general task defines -#define TASK gTasks[taskId] -#define FUNC func - // local task defines #define PAGE_INDEX data[0] #define ITEMS_ABOVE_TOP data[1] diff --git a/include/pokeblock.h b/include/pokeblock.h index b925894db..0d8e965e4 100755 --- a/include/pokeblock.h +++ b/include/pokeblock.h @@ -1,11 +1,35 @@ #ifndef GUARD_POKEBLOCK_H #define GUARD_POKEBLOCK_H +struct YesNoCBTable { + void (*yesFunc)(void); + void (*noFunc)(void); +}; + +enum { + PBLOCK_CLR_BLACK, + PBLOCK_CLR_RED, + PBLOCK_CLR_BLUE, + PBLOCK_CLR_PINK, + PBLOCK_CLR_GREEN, + 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 *); +s16 sub_810CA9C(const struct Pokeblock *, u8); +u8 sub_810C9E8(struct Pokeblock *); void sub_810BA7C(u8); void ClearPokeblocks(void); -void sub_810CA6C(s32); +bool8 sub_810CA6C(u8); +s16 sub_810CAE4(u8, const struct Pokeblock *); u8 sub_810CB68(u8, u8*); -s16 sub_810CAE4(u8, struct Pokeblock *); #endif // GUARD_POKEBLOCK_H diff --git a/include/pokeblock_feed.h b/include/pokeblock_feed.h new file mode 100644 index 000000000..65d0d1dc9 --- /dev/null +++ b/include/pokeblock_feed.h @@ -0,0 +1,10 @@ +// +// Created by Scott Norton on 6/28/17. +// + +#ifndef POKERUBY_POKEBLOCK_FEED_H +#define POKERUBY_POKEBLOCK_FEED_H + +void sub_8147ADC(void); + +#endif //POKERUBY_POKEBLOCK_FEED_H diff --git a/include/pokemon.h b/include/pokemon.h index 2f8a57d38..9dd7ba06c 100755 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -392,9 +392,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; @@ -574,6 +579,7 @@ void sub_8040B8C(void); void SetWildMonHeldItem(void); u8 *sub_8040D08(); bool32 sub_8040D3C(u16 species, u8 *name, u8 language); +s8 sub_8040A54(struct Pokemon *, u8); u16 GetMonEVCount(struct Pokemon *); #endif // GUARD_POKEMON_H diff --git a/include/pokenav.h b/include/pokenav.h index ccea77a57..70cc4135f 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -6,14 +6,96 @@ struct UnkPokenavStruct_Sub { /*0x2*/ u8 filler2[6]; }; +struct UnkPokenavStruct_Sub1 { + /*0x00*/ void (*unk0)(void); + /*0x04*/ MainCallback callback; + /*0x08*/ struct Pokeblock *pokeblock; + /*0x0C*/ struct Pokemon *pokemon; + /*0x10*/ u8 stringBuffer[0x40]; + /*0x50*/ u8 unk50; + /*0x51*/ u8 unk51; + /*0x52*/ u8 unk52; + /*0x53*/ u8 unk53; + /*0x54*/ u8 unk54; + /*0x55*/ u8 unk55; + /*0x56*/ u8 unk56; + /*0x57*/ u8 unk57[5]; + /*0x5c*/ u8 unk5c[5]; + /*0x61*/ u8 unk61[5]; + /*0x66*/ s16 unk66[5]; +}; + +struct UnkPokenavStruct_Sub2 { + /*0x00*/ u8 filler_00[0x26]; + /*0x26*/ u16 unk26; +}; + +struct UnkUsePokeblockSub { + /*0*/ u8 fil0[2]; + /*2*/ u8 partyIdx:5; +}; + struct UnkPokenavStruct { - /*0x0000*/ u8 filler0000[0xCEE8]; + /*0x0000*/ u8 filler0000[0x30c]; + /*0x0000*/ u16 unk030C; + /*0x0000*/ u8 filler030E[0x6a9e]; + /*0x6DAC*/ u8 unk6DAC; + /*0x6DAD*/ u8 filler6DAD[0x8fd]; + /*0x76AA*/ u8 unk76AA; + /*0x76AB*/ u8 filler76AB[0x10bd]; + /*0x8768*/ struct UnkPokenavStruct_Sub2 *unk8768; + /*0x876C*/ u8 filler876C[0x6e]; + /*0x87DA*/ s16 unk87DA; + /*0x87DC*/ s16 unk87DC; + /*0x87DE*/ s16 unk87DE; + /*0x87E0*/ void *unk87E0; + /*0x87E4*/ u8 filler87E4[0x44]; + /*0x8828*/ u8 unk8828; + /*0x8829*/ u8 filler8829[0x113]; + /*0x893C*/ struct UnkUsePokeblockSub unk893c[0x1ab]; + /*0x8fe8*/ u8 fil8fe8[1]; + /*0x8fe9*/ s8 unk8fe9; + /*0x8fea*/ u8 fil8fea[6]; + /*0x8ff0*/ u8 unk8ff0; + /*0x8ff1*/ u8 filler8ff1[0x13]; + /*0x9004*/ u8 unk9004[3][20]; + /*0x9040*/ u8 unk9040[0x304]; + /*0x9344*/ u8 unk9344; + /*0x9345*/ u8 filler9345[0x3ba3]; /*0xCEE8*/ struct UnkPokenavStruct_Sub unkCEE8[78]; /*0xD158*/ u16 unkD158; + /*0xD15A*/ u8 fillerD15A[6]; + /*0xD162*/ u16 unkD160; + /*0xD162*/ u8 unkD162[2]; + /*0xD164*/ struct UnkPokenavStruct_Sub1 unkD164; }; -extern struct UnkPokenavStruct *gUnknown_083DFEC4; +extern struct UnkPokenavStruct *const gUnknown_083DFEC4; +bool8 sub_80F170C(void); +bool8 sub_80F1778(void); +void sub_80F1934(void); +void sub_80F2C80(u8); +void sub_80F2688(void); +bool8 sub_80F26BC(void); +bool8 sub_80F2CBC(u8); +void sub_80F2E18(u8); +void sub_80F33A8(void); +void sub_80F3C94(void); +void sub_80F3D00(void); +void sub_80F4BD0(void); +void sub_80F556C(void *); +void sub_80F567C(void *, void *); +void sub_80F5B38(void); +bool8 sub_80F5B50(void); +void sub_80F5CDC(u8); void sub_80EBA5C(void); +void sub_80F5060(bool8); +void move_anim_execute(void); +bool8 gpu_sync_bg_show(void); +void sub_80F5550(void *, void *); +bool8 sub_80F555C(void); +void sub_80F7224(u8); +void sub_80F5BDC(void); #endif // GUARD_POKENAV_H diff --git a/include/rom3.h b/include/rom3.h index a45ec7dc4..6b1dacd9c 100644 --- a/include/rom3.h +++ b/include/rom3.h @@ -14,23 +14,22 @@ 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 EmitBallThrowAnim(u8 a, u8 b); void EmitMoveAnimation(u8 a, u16 b, u8 c, u16 d, s32 e, u8 f, u8 *g); void EmitPrintString(u8 a, u16 b); 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); @@ -49,7 +48,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 eac4d29a2..803a38162 100644 --- a/include/rom4.h +++ b/include/rom4.h @@ -23,6 +23,7 @@ struct UCoords32 }; extern struct UCoords32 gUnknown_0821664C[]; +extern void (*gFieldCallback)(void); // sub_8052F5C void flag_var_implications_of_teleport_(void); @@ -102,7 +103,7 @@ void sub_8053FB0(u16); // sub_8054034 // sub_8054044 // sub_8054050 -// sub_80540D0 +void sub_80540D0(s16 *, u16 *); void sub_8054164(void); u8 get_map_light_level_by_bank_and_number(s8 mapGroup, s8 mapNum); // get_map_light_level_from_warp diff --git a/include/rotating_gate.h b/include/rotating_gate.h index 6f4f38a9a..50a838953 100644 --- a/include/rotating_gate.h +++ b/include/rotating_gate.h @@ -2,7 +2,7 @@ #define GUARD_ROTATING_GATE_H void RotatingGatePuzzleCameraUpdate(s16, s16); -void sub_80C8080(); +void RotatingGate_InitPuzzleAndGraphics(); u32 CheckForRotatingGatePuzzleCollision(u8, s16, s16); #endif // GUARD_ROTATING_GATE_H diff --git a/include/secret_base.h b/include/secret_base.h index 3ca5ab182..3ea75ce27 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -10,6 +10,7 @@ u8 sub_80BC050(); void sub_80BC300(); const u8 sub_80BCCA4(u8); u8 *sub_80BCCE8(void); +void sub_80BCF1C(u8); void sub_80BD674(void *, u32, u8); #endif // GUARD_SECRET_BASE_H diff --git a/include/task.h b/include/task.h index 6c6efdf4f..a71577ee3 100644 --- a/include/task.h +++ b/include/task.h @@ -1,6 +1,10 @@ #ifndef GUARD_TASK_H #define GUARD_TASK_H +// general task defines +#define TASK gTasks[taskId] +#define FUNC func + typedef void (*TaskFunc)(u8 taskId); struct Task diff --git a/include/text.h b/include/text.h index 6e32de6dd..cf413644b 100644 --- a/include/text.h +++ b/include/text.h @@ -6,6 +6,7 @@ #define CHAR_QUESTION_MARK 0xAC #define CHAR_PERIOD 0xAD #define CHAR_HYPHEN 0xAE +#define CHAR_ELLIPSIS 0xB0 #define CHAR_MALE 0xB5 #define CHAR_FEMALE 0xB6 #define CHAR_COMMA 0xB8 diff --git a/include/use_pokeblock.h b/include/use_pokeblock.h new file mode 100644 index 000000000..978476d89 --- /dev/null +++ b/include/use_pokeblock.h @@ -0,0 +1,13 @@ +// +// Created by Scott Norton on 5/31/17. +// + +#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/vars.h b/include/vars.h index f31ebde84..e08f344d4 100755 --- a/include/vars.h +++ b/include/vars.h @@ -1,7 +1,16 @@ #ifndef GUARD_VARS_H #define GUARD_VARS_H +#define VAR_0x4001 0x4001 +#define VAR_0x4002 0x4002 #define VAR_0x4003 0x4003 +#define VAR_0x4004 0x4004 +#define VAR_0x4005 0x4005 +#define VAR_0x4006 0x4006 +#define VAR_0x4007 0x4007 +#define VAR_0x4008 0x4008 +#define VAR_0x4009 0x4009 +#define VAR_0x400A 0x400A #define VAR_0x401F 0x401F #define VAR_RECYCLE_GOODS 0x4020 #define VAR_REPEL_STEP_COUNT 0x4021 |