summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2017-09-25 00:09:13 +0200
committerDizzyEggg <jajkodizzy@wp.pl>2017-09-25 00:09:13 +0200
commit52a951276f8d4b79195a0d4889503e4a7f096024 (patch)
treead14e94be9fbe8fc4c77ecee3cef37d74cc176b5 /include
parent898d0b20ad524e2837079a50f33f6fae0e72b685 (diff)
battle 4, up to x69
Diffstat (limited to 'include')
-rw-r--r--include/battle.h67
-rw-r--r--include/battle_controllers.h16
-rw-r--r--include/battle_message.h144
-rw-r--r--include/pokemon.h1
-rw-r--r--include/recorded_battle.h6
-rw-r--r--include/reshow_battle_screen.h6
-rw-r--r--include/text.h4
7 files changed, 239 insertions, 5 deletions
diff --git a/include/battle.h b/include/battle.h
index e71a23e28..d45944274 100644
--- a/include/battle.h
+++ b/include/battle.h
@@ -200,6 +200,7 @@
#define REQUEST_HP_BATTLE 0x2A
// array entries for battle communication
+#define CURSOR_POSITION 0x1
#define MOVE_EFFECT_BYTE 0x3
#define MULTISTRING_CHOOSER 0x5
#define MSG_DISPLAY 0x7
@@ -236,6 +237,46 @@
#define CMP_COMMON_BITS 0x4
#define CMP_NO_COMMON_BITS 0x5
+struct TrainerMonNoItemDefaultMoves
+{
+ u16 species;
+ u8 lvl;
+ u16 evsValue;
+};
+
+struct TrainerMonItemDefaultMoves
+{
+ u16 species;
+ u8 lvl;
+ u16 evsValue;
+ u16 heldItem;
+};
+
+struct TrainerMonNoItemCustomMoves
+{
+ u16 species;
+ u8 lvl;
+ u16 evsValue;
+ u16 moves[4];
+};
+
+struct TrainerMonItemCustomMoves
+{
+ u16 species;
+ u8 lvl;
+ u16 evsValue;
+ u16 heldItem;
+ u16 moves[4];
+};
+
+union TrainerMonPtr
+{
+ struct TrainerMonNoItemDefaultMoves* NoItemDefaultMoves;
+ struct TrainerMonNoItemCustomMoves* NoItemCustomMoves;
+ struct TrainerMonItemDefaultMoves* ItemDefaultMoves;
+ struct TrainerMonItemCustomMoves* ItemCustomMoves;
+};
+
struct Trainer
{
/*0x00*/ u8 partyFlags;
@@ -247,9 +288,12 @@ struct Trainer
/*0x18*/ bool8 doubleBattle;
/*0x1C*/ u32 aiFlags;
/*0x20*/ u8 partySize;
- /*0x24*/ void *party;
+ /*0x24*/ union TrainerMonPtr party;
};
+#define PARTY_FLAG_CUSTOM_MOVES 0x1
+#define PARTY_FLAG_HAS_ITEM 0x2
+
extern const struct Trainer gTrainers[];
#define TRAINER_ENCOUNTER_MUSIC(trainer)((gTrainers[trainer].encounterMusic_gender & 0x7F))
@@ -289,7 +333,8 @@ struct DisableStruct
/*0x16*/ u8 isFirstTurn;
/*0x17*/ u8 unk17;
/*0x18*/ u8 truantCounter : 1;
- /*0x18*/ u8 unk18_a : 3;
+ /*0x18*/ u8 truantUnknownBit : 1;
+ /*0x18*/ u8 unk18_a_2 : 2;
/*0x18*/ u8 unk18_b : 4;
/*0x19*/ u8 rechargeCounter;
/*0x1A*/ u8 unk1A[2];
@@ -464,7 +509,7 @@ struct BattleResults
{
u8 playerFaintCounter; // 0x0
u8 opponentFaintCounter; // 0x1
- u8 unk2; // 0x2
+ u8 playerSwitchesCounter; // 0x2
u8 unk3; // 0x3
u8 unk4; // 0x4
u8 unk5_0:1; // 0x5
@@ -664,6 +709,13 @@ extern struct BattleStruct* gBattleStruct;
varName = (u16*)(((void*)(*memes1) + (u32)(memes2))); \
}
+#define GET_HP_SWITCHOUT_PTR_VIA_MEME_ACCESS(bank, varName) \
+{ \
+ void** memes1 = (void**)(&gBattleStruct); \
+ void* memes2 = (void*)((u32)(bank * 2 + offsetof(struct BattleStruct, hpOnSwitchout))); \
+ varName = (u16*)(((void*)(*memes1) + (u32)(memes2))); \
+}
+
#define GET_MOVE_TYPE(move, typeArg) \
{ \
if (gBattleStruct->dynamicMoveType) \
@@ -815,6 +867,9 @@ struct BattleScripting
u8 statChanger;
u8 field_1B;
u8 atk23_state;
+ u8 field_1D;
+ u8 field_1E;
+ u8 learnMoveState;
};
extern struct BattleScripting gBattleScripting;
@@ -829,6 +884,9 @@ u8 GetBattleBank(u8 caseId);
void UndoEffectsAfterFainting(void);
bool8 HasMoveFailed(u8 bank);
void SwitchInClearStructs(void);
+void sub_803BDA0(u8 bank);
+void sub_803FA70(u8 bank);
+void BattleMainCB2(void);
// battle_3
void BattleScriptPush(const u8* bsPtr);
@@ -860,9 +918,12 @@ void AI_CalcDmg(u8 bankAtk, u8 bankDef);
u8 TypeCalc(u16 move, u8 bankAtk, u8 bankDef);
u8 AI_TypeCalc(u16 move, u16 species, u8 ability);
u8 BankGetTurnOrder(u8 bank);
+void BattleDestroyCursorAt(u8 cursorPosition);
+void BattleCreateCursorAt(u8 cursorPosition);
// battle_5
void AdjustFriendshipOnBattleFaint(u8 bank);
+void sub_80571DC(u8 bank, u8 arg1);
// battle 7
void BattleMusicStop(void);
diff --git a/include/battle_controllers.h b/include/battle_controllers.h
index 443ca5be1..b24aa9cc5 100644
--- a/include/battle_controllers.h
+++ b/include/battle_controllers.h
@@ -1,13 +1,21 @@
#ifndef GUARD_BATTLE_CONTROLLERS_H
#define GUARD_BATTLE_CONTROLLERS_H
+struct HpAndStatus
+{
+ u16 hp;
+ u32 status;
+};
+
// rom3.s, emitters
void EmitSetAttributes(u8 bufferId, u8 request, u8 c, u8 bytes, void *data);
void EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct* disableStructPtr, u8 multihit);
void EmitHealthBarUpdate(u8 bufferId, u16 hpValue);
void EmitEffectivenessSound(u8 bufferId, u16 songId);
+void EmitPlaySound(u8 bufferId, u16 songId, u8 arg2);
void EmitPrintStringPlayerOnly(u8 bufferId, u16 stringId);
void EmitFaintAnimation(u8 bufferId);
+void Emit_x2A(u8 bufferId);
void EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints);
void EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument);
void EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible);
@@ -15,6 +23,14 @@ void EmitReturnPokeToBall(u8 bufferId, u8 arg1);
void EmitGetAttributes(u8 bufferId, u8 arg1, u8 arg2);
void EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit);
void EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, const u8* arg4);
+void EmitLinkStandbyMsg(u8 bufferId, u8 arg1, u8 arg2);
+void EmitTrainerSlide(u8 bufferId);
+void EmitFaintingCry(u8 bufferId);
+void Emit_x37(u8 bufferId, u8 arg1);
+void EmitHitAnimation(u8 bufferId);
+void EmitCmd48(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2);
+void EmitCmd49(u8 bufferId);
+void EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status);
void MarkBufferBankForExecution(u8 bank);
diff --git a/include/battle_message.h b/include/battle_message.h
index ca310ae6f..ad1ce3455 100644
--- a/include/battle_message.h
+++ b/include/battle_message.h
@@ -1,6 +1,147 @@
#ifndef GUARD_BATTLE_MESSAGE_H
#define GUARD_BATTLE_MESSAGE_H
+// for 0xFD
+
+#define B_TXT_BUFF1 00
+#define B_TXT_BUFF2 01
+#define B_TXT_COPY_VAR_1 02
+#define B_TXT_COPY_VAR_2 03
+#define B_TXT_COPY_VAR_3 04
+#define B_TXT_PLAYER_MON1_NAME 05
+#define B_TXT_OPPONENT_MON1_NAME 06
+#define B_TXT_PLAYER_MON2_NAME 07
+#define B_TXT_OPPONENT_MON2_NAME 08
+#define B_TXT_LINK_PLAYER_MON1_NAME 09
+#define B_TXT_LINK_OPPONENT_MON1_NAME 0A
+#define B_TXT_LINK_PLAYER_MON2_NAME 0B
+#define B_TXT_LINK_OPPONENT_MON2_NAME 0C
+#define B_TXT_ATK_NAME_WITH_PREFIX_MON1 0D
+#define B_TXT_ATK_NAME 0E
+#define B_TXT_ATK_NAME_WITH_PREFIX 0F
+#define B_TXT_DEF_NAME_WITH_PREFIX 10
+#define B_TXT_EFF_NAME_WITH_PREFIX 11 // EFF = short for gEffectBank
+#define B_TXT_SCR_ACTIVE_NAME_WITH_PREFIX 12
+#define B_TXT_ACTIVE_NAME_WITH_PREFIX 13
+#define B_TXT_CURRENT_MOVE 14
+#define B_TXT_LAST_MOVE 15
+#define B_TXT_LAST_ITEM 16
+#define B_TXT_LAST_ABILITY 17
+#define B_TXT_ATK_ABILITY 18
+#define B_TXT_DEF_ABILITY 19
+#define B_TXT_SCR_ACTIVE_ABILITY 1A
+#define B_TXT_EFF_ABILITY 1B
+#define B_TXT_TRAINER1_CLASS 1C
+#define B_TXT_TRAINER1_NAME 1D
+#define B_TXT_1E 1E // trainer name for a link player
+#define B_TXT_1F 1F // trainer name for a link player
+#define B_TXT_20 20 // trainer name for a link player
+#define B_TXT_21 21 // trainer name for a link player
+#define B_TXT_22 22 // trainer name for a link player
+#define B_TXT_PLAYER_NAME 23
+#define B_TXT_TRAINER1_LOSE_TEXT 24
+#define B_TXT_TRAINER1_WIN_TEXT 25
+#define B_TXT_26 26
+#define B_TXT_PC_CREATOR_NAME 27
+#define B_TXT_ATK_PREFIX1 28
+#define B_TXT_DEF_PREFIX1 29
+#define B_TXT_ATK_PREFIX2 2A
+#define B_TXT_DEF_PREFIX2 2B
+#define B_TXT_ATK_PREFIX3 2C
+#define B_TXT_DEF_PREFIX3 2D
+#define B_TXT_TRAINER2_CLASS 2E
+#define B_TXT_TRAINER2_NAME 2F
+#define B_TXT_TRAINER2_LOSE_TEXT 30
+#define B_TXT_TRAINER2_WIN_TEXT 31
+#define B_TXT_PARTNER_CLASS 32
+#define B_TXT_PARTNER_NAME 33
+#define B_TXT_BUFF3 34
+
+// for B_TXT_BUFF1, B_TXT_BUFF2 and B_TXT_BUFF3
+
+#define B_BUFF_STRING 0
+#define B_BUFF_NUMBER 1
+#define B_BUFF_MOVE 2
+#define B_BUFF_TYPE 3
+#define B_BUFF_MON_NICK_WITH_PREFIX 4
+#define B_BUFF_STAT 5
+#define B_BUFF_SPECIES 6
+#define B_BUFF_MON_NICK 7
+#define B_BUFF_NEGATIVE_FLAVOUR 8
+#define B_BUFF_ABILITY 9
+#define B_BUFF_ITEM 10
+
+#define B_BUFF_PLACEHOLDER_BEGIN 0xFD
+#define B_BUFF_EOS 0xFF
+
+#define PREPARE_BYTE_NUMBER_BUFFER(textVar, maxDigits, number) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_NUMBER; \
+ textVar[2] = 1; \
+ textVar[3] = maxDigits; \
+ textVar[4] = (number); \
+ textVar[5] = B_BUFF_EOS; \
+}
+
+#define PREPARE_WORD_NUMBER_BUFFER(textVar, maxDigits, number) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_NUMBER; \
+ textVar[2] = 4; \
+ textVar[3] = maxDigits; \
+ textVar[4] = (number); \
+ textVar[5] = (number & 0x0000FF00) >> 8; \
+ textVar[6] = (number & 0x00FF0000) >> 16; \
+ textVar[7] = (number & 0xFF000000) >> 24; \
+ textVar[8] = B_BUFF_EOS; \
+}
+
+#define PREPARE_STRING_BUFFER(textVar, stringId) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_STRING; \
+ textVar[2] = stringId; \
+ textVar[3] = (stringId & 0xFF00) >> 8; \
+ textVar[4] = B_BUFF_EOS; \
+}
+
+#define PREPARE_MOVE_BUFFER(textVar, move) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_MOVE; \
+ textVar[2] = move; \
+ textVar[3] = (move & 0xFF00) >> 8; \
+ textVar[4] = B_BUFF_EOS; \
+}
+
+#define PREPARE_SPECIES_BUFFER(textVar, species) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_SPECIES; \
+ textVar[2] = species; \
+ textVar[3] = (species & 0xFF00) >> 8; \
+ textVar[4] = B_BUFF_EOS; \
+}
+
+#define PREPARE_MON_NICK_WITH_PREFIX_BUFFER(textVar, bank, partyId) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_MON_NICK_WITH_PREFIX; \
+ textVar[2] = bank; \
+ textVar[3] = partyId; \
+ textVar[4] = B_BUFF_EOS; \
+}
+
+#define PREPARE_MON_NICK_BUFFER(textVar, bank, partyId) \
+{ \
+ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \
+ textVar[1] = B_BUFF_MON_NICK; \
+ textVar[2] = bank; \
+ textVar[3] = partyId; \
+ textVar[4] = B_BUFF_EOS; \
+}
+
struct StringInfoBattle
{
u16 currentMove;
@@ -18,7 +159,8 @@ struct StringInfoBattle
void BufferStringBattle(u16 stringID);
u32 StrCpyDecodeToDisplayedStringBattle(const u8* src);
-u32 StrCpyDecodeBattle(const u8* src, u8* dst);
+u32 BattleStringExpandPlaceholders(const u8* src, u8* dst);
+void sub_814F9EC(const u8* text, u8 arg1);
extern u8 gBattleTextBuff1[];
extern u8 gBattleTextBuff2[];
diff --git a/include/pokemon.h b/include/pokemon.h
index f629799e5..518d28e58 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -626,6 +626,7 @@ bool8 IsTradedMon(struct Pokemon *mon);
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
s32 sub_806D864(u16 a1);
bool16 sub_806D82C(u8 id);
+u16 MonTryLearningNewMove(struct Pokemon* mon, bool8);
#include "sprite.h"
diff --git a/include/recorded_battle.h b/include/recorded_battle.h
new file mode 100644
index 000000000..d19a2b713
--- /dev/null
+++ b/include/recorded_battle.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_RECORDED_BATTLE_H
+#define GUARD_RECORDED_BATTLE_H
+
+void RecordedBattle_SetBankAction(u8 bank, u8 action);
+
+#endif // GUARD_RECORDED_BATTLE_H
diff --git a/include/reshow_battle_screen.h b/include/reshow_battle_screen.h
new file mode 100644
index 000000000..62773b48b
--- /dev/null
+++ b/include/reshow_battle_screen.h
@@ -0,0 +1,6 @@
+#ifndef GUARD_RESHOW_BATTLE_SCREEN_H
+#define GUARD_RESHOW_BATTLE_SCREEN_H
+
+void ReshowBattleScreenAfterMenu(void);
+
+#endif // GUARD_RESHOW_BATTLE_SCREEN_H
diff --git a/include/text.h b/include/text.h
index dba409f37..f0c85b978 100644
--- a/include/text.h
+++ b/include/text.h
@@ -71,7 +71,9 @@
#define EXT_CTRL_CODE_BEGIN 0xFC // extended control code
#define PLACEHOLDER_BEGIN 0xFD // string placeholder
#define CHAR_NEWLINE 0xFE
-#define EOS 0xFF // end of string
+#define EOS 0xFF // end of string
+
+// battle placeholders are located in battle_message.h
#define EXT_CTRL_CODE_JPN 0x15
#define EXT_CTRL_CODE_ENG 0x16