From 7dc95a0103af08c95c9093b6efa6c77af77a2538 Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Sun, 13 Sep 2020 04:22:50 -0300 Subject: Undo PokeCodec's PRs This commit undoes most of PokeCodec's PRs after the debate in chat. Some harmless or completely superseded PRs have been left alone, as there is not much benefit in attempting to undo them. Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136, #1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179, #1180, #1181, #1182 and #1183. --- include/AgbRfu_LinkManager.h | 4 +- include/battle.h | 22 ++++----- include/battle_main.h | 3 +- include/battle_message.h | 2 +- include/battle_util.h | 13 ------ include/constants/battle.h | 2 +- include/constants/battle_pyramid.h | 10 +++++ include/constants/rgb.h | 4 -- include/gba/m4a_internal.h | 92 +++++++++++++++++++------------------- include/global.h | 2 +- include/list_menu.h | 4 +- include/pokemon.h | 12 ++--- include/pokenav.h | 2 +- 13 files changed, 84 insertions(+), 88 deletions(-) (limited to 'include') diff --git a/include/AgbRfu_LinkManager.h b/include/AgbRfu_LinkManager.h index 4e1a879c2..d4ef13183 100644 --- a/include/AgbRfu_LinkManager.h +++ b/include/AgbRfu_LinkManager.h @@ -176,8 +176,8 @@ typedef struct linkManagerTag /* 0x024 */ VBL_TIMER nameAcceptTimer; /* 0x030 */ VBL_TIMER linkRecoveryTimer; /* 0x03c */ INIT_PARAM *init_param; - /* 0x040 */ void (*LMAN_callback)(u8 msg, u8 paramCount); - /* 0x044 */ void (*MSC_callback)(u16 REQ_commandID); + /* 0x040 */ void (*LMAN_callback)(u8, u8); + /* 0x044 */ void (*MSC_callback)(u16); } LINK_MANAGER; extern struct linkManagerTag lman; diff --git a/include/battle.h b/include/battle.h index 5a04c1eec..6dddfd197 100644 --- a/include/battle.h +++ b/include/battle.h @@ -124,22 +124,22 @@ struct ProtectStruct u32 flinchImmobility:1; u32 notFirstStrike:1; u32 palaceUnableToUseMove:1; - s32 physicalDmg; - s32 specialDmg; + u32 physicalDmg; + u32 specialDmg; u8 physicalBattlerId; u8 specialBattlerId; }; struct SpecialStatus { - u32 statLowered:1; - u32 lightningRodRedirected:1; - u32 restoredBattlerSprite: 1; - u32 intimidatedMon:1; - u32 traced:1; - u32 ppNotAffectedByPressure:1; - u32 flag40:1; - u32 focusBanded:1; + u8 statLowered:1; + u8 lightningRodRedirected:1; + u8 restoredBattlerSprite: 1; + u8 intimidatedMon:1; + u8 traced:1; + u8 ppNotAffectedByPressure:1; + u8 flag40:1; + u8 focusBanded:1; s32 dmg; s32 physicalDmg; s32 specialDmg; @@ -254,7 +254,7 @@ struct BattleResults u16 playerMon2Species; // 0x26 u16 caughtMonSpecies; // 0x28 u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A - u8 filler35; // 0x35 + u8 filler35[1]; // 0x35 u8 catchAttempts[11]; // 0x36 }; diff --git a/include/battle_main.h b/include/battle_main.h index 0176f7f24..890e47f39 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -73,6 +73,8 @@ void nullsub_20(void); void BeginBattleIntro(void); void SwitchInClearSetData(void); void FaintClearSetData(void); +void sub_803B3AC(void); // unused +void sub_803B598(void); // unused void BattleTurnPassed(void); u8 IsRunningFromBattleImpossible(void); void SwitchPartyOrder(u8 battlerId); @@ -81,7 +83,6 @@ u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves); void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); bool8 TryRunFromBattle(u8 battlerId); -void SpecialStatusesClear(void); extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE]; diff --git a/include/battle_message.h b/include/battle_message.h index af090a06c..011a1cb0c 100644 --- a/include/battle_message.h +++ b/include/battle_message.h @@ -145,7 +145,7 @@ { \ textVar[0] = B_BUFF_PLACEHOLDER_BEGIN; \ textVar[1] = B_BUFF_STRING; \ - textVar[2] = (stringId & 0xFF); \ + textVar[2] = stringId; \ textVar[3] = (stringId & 0xFF00) >> 8; \ textVar[4] = B_BUFF_EOS; \ } diff --git a/include/battle_util.h b/include/battle_util.h index 81443f463..157ba8eb6 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -41,19 +41,6 @@ #define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK))) #define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK))) -void HandleAction_UseMove(void); -void HandleAction_Switch(void); -void HandleAction_UseItem(void); -void HandleAction_Run(void); -void HandleAction_WatchesCarefully(void); -void HandleAction_SafariZoneBallThrow(void); -void HandleAction_ThrowPokeblock(void); -void HandleAction_GoNear(void); -void HandleAction_SafariZoneRun(void); -void HandleAction_WallyBallThrow(void); -void HandleAction_TryFinish(void); -void HandleAction_NothingIsFainted(void); -void HandleAction_ActionFinished(void); u8 GetBattlerForBattleScript(u8 caseId); void PressurePPLose(u8 target, u8 attacker, u16 move); void PressurePPLoseOnUsingPerishSong(u8 attacker); diff --git a/include/constants/battle.h b/include/constants/battle.h index fa8f422c4..8b860e384 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -186,7 +186,7 @@ #define HITMARKER_x4000000 (1 << 26) #define HITMARKER_CHARGING (1 << 27) #define HITMARKER_FAINTED(battler) (gBitTable[battler] << 28) -#define HITMARKER_FAINTED2(battler) ((1 << 28) << battler) +#define HITMARKER_FAINTED2(battler) (1 << (28 + battler)) // Per-side statuses that affect an entire party #define SIDE_STATUS_REFLECT (1 << 0) diff --git a/include/constants/battle_pyramid.h b/include/constants/battle_pyramid.h index 378197a4d..004df7155 100644 --- a/include/constants/battle_pyramid.h +++ b/include/constants/battle_pyramid.h @@ -7,6 +7,16 @@ #define FLOOR_WALKABLE_METATILE 0x28D #define FLOOR_EXIT_METATILE 0x28E +#define HINT_EXIT_DIRECTION 0 +#define HINT_REMAINING_ITEMS 1 +#define HINT_REMAINING_TRAINERS 2 +#define HINT_EXIT_SHORT_REMAINING_TRAINERS 3 +#define HINT_EXIT_SHORT_REMAINING_ITEMS 4 +#define HINT_EXIT_MEDIUM_REMAINING_TRAINERS 5 +#define HINT_EXIT_MEDIUM_REMAINING_ITEMS 6 +#define HINT_EXIT_FAR_REMAINING_TRAINERS 7 +#define HINT_EXIT_FAR_REMAINING_ITEMS 8 + #define OBJ_TRAINERS 0 #define OBJ_ITEMS 1 diff --git a/include/constants/rgb.h b/include/constants/rgb.h index 1896250d2..80d951f4b 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -1,10 +1,6 @@ #ifndef GUARD_RGB_H #define GUARD_RGB_H -#define GET_R(color) ((color) & 0x1F) -#define GET_G(color) (((color) >> 5) & 0x1F) -#define GET_B(color) (((color) >> 10) & 0x1F) - #define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) #define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r)) #define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F)) diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h index bdff1b865..e2836c6f6 100644 --- a/include/gba/m4a_internal.h +++ b/include/gba/m4a_internal.h @@ -140,13 +140,55 @@ struct SoundChannel struct WaveData *wav; u32 cp; struct MusicPlayerTrack *track; - void *pp; - void *np; - void *d4; + u32 pp; + u32 np; + u32 d4; u16 xpi; u16 xpc; }; +#define MAX_DIRECTSOUND_CHANNELS 12 + +#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer + +struct SoundInfo +{ + // This field is normally equal to ID_NUMBER but it is set to other + // values during sensitive operations for locking purposes. + // This field should be volatile but isn't. This could potentially cause + // race conditions. + u32 ident; + + vu8 pcmDmaCounter; + + // Direct Sound + u8 reverb; + u8 maxChans; + u8 masterVolume; + u8 freq; + + u8 mode; + u8 c15; + u8 pcmDmaPeriod; // number of V-blanks per PCM DMA + u8 maxLines; + u8 gap[3]; + s32 pcmSamplesPerVBlank; + s32 pcmFreq; + s32 divFreq; + struct CgbChannel *cgbChans; + u32 func; + u32 intp; + void (*CgbSound)(void); + void (*CgbOscOff)(u8); + u32 (*MidiKeyToCgbFreq)(u8, u8, u8); + u32 MPlayJumpTable; + u32 plynote; + u32 ExtVolPit; + u8 gap2[16]; + struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS]; + s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2]; +}; + struct SongHeader { u8 trackCount; @@ -270,7 +312,7 @@ struct MusicPlayerInfo struct MusicPlayerTrack *tracks; struct ToneData *tone; u32 ident; - void (*func)(); + u32 func; u32 intp; }; @@ -292,47 +334,7 @@ struct Song extern const struct MusicPlayer gMPlayTable[]; extern const struct Song gSongTable[]; -#define MAX_DIRECTSOUND_CHANNELS 12 - -#define PCM_DMA_BUF_SIZE 1584 // size of Direct Sound buffer - -struct SoundInfo -{ - // This field is normally equal to ID_NUMBER but it is set to other - // values during sensitive operations for locking purposes. - // This field should be volatile but isn't. This could potentially cause - // race conditions. - u32 ident; - - vu8 pcmDmaCounter; - - // Direct Sound - u8 reverb; - u8 maxChans; - u8 masterVolume; - u8 freq; - u8 mode; - u8 c15; - u8 pcmDmaPeriod; // number of V-blanks per PCM DMA - u8 maxLines; - u8 gap[3]; - s32 pcmSamplesPerVBlank; - s32 pcmFreq; - s32 divFreq; - struct CgbChannel *cgbChans; - void (*func)(); - u32 intp; - void (*CgbSound)(); - void (*CgbOscOff)(u8); - u32 (*MidiKeyToCgbFreq)(u8, u8, u8); - void (**MPlayJumpTable)(); - void (*plynote)(u8, struct MusicPlayerInfo *, struct MusicPlayerTrack *); - void (*ExtVolPit)(struct MusicPlayerInfo *, struct MusicPlayerTrack *); - u32 gap2[4]; - struct SoundChannel chans[MAX_DIRECTSOUND_CHANNELS]; - s8 pcmBuffer[PCM_DMA_BUF_SIZE * 2]; -}; extern u8 gMPlayMemAccArea[]; @@ -446,7 +448,7 @@ void ply_tune(struct MusicPlayerInfo *, struct MusicPlayerTrack *); void ply_port(struct MusicPlayerInfo *, struct MusicPlayerTrack *); void ply_xcmd(struct MusicPlayerInfo *, struct MusicPlayerTrack *); void ply_endtie(struct MusicPlayerInfo *, struct MusicPlayerTrack *); -void ply_note(u8, struct MusicPlayerInfo *, struct MusicPlayerTrack *); +void ply_note(struct MusicPlayerInfo *, struct MusicPlayerTrack *); // extended sound command handler functions void ply_xxx(struct MusicPlayerInfo *, struct MusicPlayerTrack *); diff --git a/include/global.h b/include/global.h index 8c5167041..08988eac7 100644 --- a/include/global.h +++ b/include/global.h @@ -99,7 +99,7 @@ #define T2_READ_PTR(ptr) (void*) T2_READ_32(ptr) // Macros for checking the joypad -#define TEST_BUTTON(field, button) ((field) & (button)) +#define TEST_BUTTON(field, button) ({(field) & (button);}) #define JOY_NEW(button) TEST_BUTTON(gMain.newKeys, button) #define JOY_HELD(button) TEST_BUTTON(gMain.heldKeys, button) #define JOY_HELD_RAW(button) TEST_BUTTON(gMain.heldKeysRaw, button) diff --git a/include/list_menu.h b/include/list_menu.h index 4697ba5aa..0a54a069a 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -24,7 +24,7 @@ struct ListMenu; struct ListMenuItem { const u8 *name; - u32 id; + s32 id; }; struct ListMenuTemplate @@ -98,7 +98,7 @@ struct CursorStruct extern struct ScrollArrowsTemplate gTempScrollArrowTemplate; extern struct ListMenuTemplate gMultiuseListMenuTemplate; -u32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow); s32 ListMenu_ProcessInput(u8 listTaskId); diff --git a/include/pokemon.h b/include/pokemon.h index 81c17f545..d75ec94f3 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -123,12 +123,12 @@ struct Pokemon struct Unknown_806F160_Struct { - u32 field_0_0:4; - u32 field_0_1:4; - u32 field_1:8; - u16 magic:8; - u32 size:4; - u16 field_3_1:4; + u8 field_0_0:4; + u8 field_0_1:4; + u8 field_1; + u8 magic; + u8 field_3_0:4; + u8 field_3_1:4; void *bytes; u8 **byteArrays; struct SpriteTemplate *templates; diff --git a/include/pokenav.h b/include/pokenav.h index ed4e5a906..ac916f3ba 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -313,7 +313,7 @@ bool32 WaitForHelpBar(void); void sub_81C78A0(void); bool32 MainMenuLoopedTaskIsBusy(void); void sub_81C7FDC(void); -void sub_81C79BC(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u16 *palette); +void sub_81C79BC(const u16 *a0, const u16 *a1, u32 a2, u32 a3, u32 a4, u16 *a5); void sub_81C7B40(void); struct Sprite *PauseSpinningPokenavSprite(void); void ResumeSpinningPokenavSprite(void); -- cgit v1.2.3 From 832be348989967b15ae813180b22640d7da732ab Mon Sep 17 00:00:00 2001 From: tustin2121 Date: Sun, 20 Sep 2020 01:50:54 -0400 Subject: More documenting trainer hill - Renamed members and added comments in the TrHillDisplay struct. - Formatted the trainer hill data to better match the metatile layout its representing. - Documented the function which uses this data. --- include/trainer_hill.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/trainer_hill.h b/include/trainer_hill.h index 3f0644248..94d29a7ca 100644 --- a/include/trainer_hill.h +++ b/include/trainer_hill.h @@ -8,10 +8,10 @@ struct TrainerHillTrainer u8 name[HILL_TRAINER_NAME_LENGTH]; u8 facilityClass; u32 unused; - u16 speechBefore[6]; - u16 speechWin[6]; - u16 speechLose[6]; - u16 speechAfter[6]; + u16 speechBefore[EASY_CHAT_BATTLE_WORDS_COUNT]; + u16 speechWin[EASY_CHAT_BATTLE_WORDS_COUNT]; + u16 speechLose[EASY_CHAT_BATTLE_WORDS_COUNT]; + u16 speechAfter[EASY_CHAT_BATTLE_WORDS_COUNT]; struct BattleTowerPokemon mons[PARTY_SIZE]; }; @@ -23,11 +23,19 @@ struct TrHillRoomTrainers struct TrHillDisplay { - u8 data[0x100]; - u16 unk3A0[16]; - u8 coords[2]; // x first 4 bits, y last 4 bits - u8 direction; // array of 4 bits for each trainer - u8 range; // array of 4 bits for each trainer + // Metatile data. Add 0x200 to the values in this array to get metatiles. + // This data then overwrites the metatiles in the map starting at (0,5) + u8 metatileData[0x100]; + // Collision data. One bit for each tile in column-major order, + // so every array entry is one row. 1 = impassable, 0 = passable + u16 collisionData[16]; + // Trainer coordinates, starting at (0,6). Format is 0bYYYYXXXX. + u8 coords[2]; + // Trainer facing directions. Same as (DIR_* - 1). + // Effectively an array of nibbles, one for each trainer. + u8 direction; + // Trainer sight ranges. Effectively an array of nibbles, one for each trainer. + u8 range; }; struct TrHillFloor -- cgit v1.2.3 From 66bd1e6d3f8ddc96b9a8be7d73ff084031072292 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 25 Sep 2020 11:18:52 -0400 Subject: Use constants for item digits --- include/constants/items.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/constants/items.h b/include/constants/items.h index 9496a4c61..95c6aacfe 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -497,6 +497,10 @@ #define MAX_PC_ITEM_CAPACITY 999 #define MAX_BERRY_CAPACITY 999 +#define BAG_ITEM_CAPACITY_DIGITS 2 +#define BERRY_CAPACITY_DIGITS 3 +#define MAX_ITEM_DIGITS BERRY_CAPACITY_DIGITS + // Secondary IDs for rods #define OLD_ROD 0 #define GOOD_ROD 1 -- cgit v1.2.3 From 52598983250fd8ad7b66ff2b9d77046859f169c8 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 1 Oct 2020 17:20:38 -0400 Subject: Replace POKEMON_SLOTS_NUMBER --- include/data.h | 1 - include/global.h | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/data.h b/include/data.h index 49b98663a..260c18152 100644 --- a/include/data.h +++ b/include/data.h @@ -2,7 +2,6 @@ #define GUARD_DATA_H #include "constants/moves.h" -#include "constants/species.h" #define SPECIES_SHINY_TAG 500 diff --git a/include/global.h b/include/global.h index 8c5167041..f5781bcb4 100644 --- a/include/global.h +++ b/include/global.h @@ -8,6 +8,7 @@ #include "constants/global.h" #include "constants/flags.h" #include "constants/vars.h" +#include "constants/species.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); @@ -65,8 +66,6 @@ // Converts a Q24.8 fixed-point format number to a regular integer #define Q_24_8_TO_INT(n) ((int)((n) >> 8)) -#define POKEMON_SLOTS_NUMBER 412 - #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) >= (b) ? (a) : (b)) @@ -115,7 +114,7 @@ #define ROUND_BITS_TO_BYTES(numBits)(((numBits) / 8) + (((numBits) % 8) ? 1 : 0)) -#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(POKEMON_SLOTS_NUMBER)) +#define DEX_FLAGS_NO (ROUND_BITS_TO_BYTES(NUM_SPECIES)) #define NUM_FLAG_BYTES (ROUND_BITS_TO_BYTES(FLAGS_COUNT)) struct Coords8 -- cgit v1.2.3 From 65a4e067378b53225536d060d10fa306b6f045c2 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 5 Oct 2020 18:48:51 -0400 Subject: Add ITEM6_HEAL constants, change move flags to shifts --- include/battle.h | 2 +- include/constants/item_effects.h | 5 +++++ include/constants/pokemon.h | 44 ++++++++++++++++++++-------------------- 3 files changed, 28 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/battle.h b/include/battle.h index 5a04c1eec..e4b773089 100644 --- a/include/battle.h +++ b/include/battle.h @@ -493,7 +493,7 @@ struct BattleScripting u8 field_20; u8 reshowMainState; u8 reshowHelperState; - u8 field_23; + u8 levelUpHP; u8 windowsType; // 0 - normal, 1 - battle arena u8 multiplayerId; u8 specialTrainerBattleType; diff --git a/include/constants/item_effects.h b/include/constants/item_effects.h index 49fcedc61..6e61c4d7f 100644 --- a/include/constants/item_effects.h +++ b/include/constants/item_effects.h @@ -51,6 +51,11 @@ // fields 6 and onwards are item-specific arguments +// Special HP recovery amounts for ITEM4_HEAL_HP +#define ITEM6_HEAL_FULL ((u8) -1) +#define ITEM6_HEAL_HALF ((u8) -2) +#define ITEM6_HEAL_LVL_UP ((u8) -3) + // Used for GetItemEffectType. #define ITEM_EFFECT_X_ITEM 0 #define ITEM_EFFECT_RAISE_LEVEL 1 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 52eabe71b..4cf0bd4f0 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -239,12 +239,12 @@ #define UNOWN_FORM_COUNT 28 // Battle move flags -#define FLAG_MAKES_CONTACT 0x1 -#define FLAG_PROTECT_AFFECTED 0x2 -#define FLAG_MAGICCOAT_AFFECTED 0x4 -#define FLAG_SNATCH_AFFECTED 0x8 -#define FLAG_MIRROR_MOVE_AFFECTED 0x10 -#define FLAG_KINGSROCK_AFFECTED 0x20 +#define FLAG_MAKES_CONTACT (1 << 0) +#define FLAG_PROTECT_AFFECTED (1 << 1) +#define FLAG_MAGICCOAT_AFFECTED (1 << 2) +#define FLAG_SNATCH_AFFECTED (1 << 3) +#define FLAG_MIRROR_MOVE_AFFECTED (1 << 4) +#define FLAG_KINGSROCK_AFFECTED (1 << 5) // Growth rates #define GROWTH_MEDIUM_FAST 0 @@ -268,22 +268,22 @@ #define F_SUMMARY_SCREEN_FLIP_SPRITE 0x80 -// Evolution type flags -#define EVO_FRIENDSHIP 0x0001 // Pokémon levels up with friendship ≥ 220 -#define EVO_FRIENDSHIP_DAY 0x0002 // Pokémon levels up during the day with friendship ≥ 220 -#define EVO_FRIENDSHIP_NIGHT 0x0003 // Pokémon levels up at night with friendship ≥ 220 -#define EVO_LEVEL 0x0004 // Pokémon reaches the specified level -#define EVO_TRADE 0x0005 // Pokémon is traded -#define EVO_TRADE_ITEM 0x0006 // Pokémon is traded while it's holding the specified item -#define EVO_ITEM 0x0007 // specified item is used on Pokémon -#define EVO_LEVEL_ATK_GT_DEF 0x0008 // Pokémon reaches the specified level with attack > defense -#define EVO_LEVEL_ATK_EQ_DEF 0x0009 // Pokémon reaches the specified level with attack = defense -#define EVO_LEVEL_ATK_LT_DEF 0x000a // Pokémon reaches the specified level with attack < defense -#define EVO_LEVEL_SILCOON 0x000b // Pokémon reaches the specified level with a Silcoon personality value -#define EVO_LEVEL_CASCOON 0x000c // Pokémon reaches the specified level with a Cascoon personality value -#define EVO_LEVEL_NINJASK 0x000d // Pokémon reaches the specified level (special value for Ninjask) -#define EVO_LEVEL_SHEDINJA 0x000e // Pokémon reaches the specified level (special value for Shedinja) -#define EVO_BEAUTY 0x000f // Pokémon levels up with beauty ≥ specified value +// Evolution types +#define EVO_FRIENDSHIP 1 // Pokémon levels up with friendship ≥ 220 +#define EVO_FRIENDSHIP_DAY 2 // Pokémon levels up during the day with friendship ≥ 220 +#define EVO_FRIENDSHIP_NIGHT 3 // Pokémon levels up at night with friendship ≥ 220 +#define EVO_LEVEL 4 // Pokémon reaches the specified level +#define EVO_TRADE 5 // Pokémon is traded +#define EVO_TRADE_ITEM 6 // Pokémon is traded while it's holding the specified item +#define EVO_ITEM 7 // specified item is used on Pokémon +#define EVO_LEVEL_ATK_GT_DEF 8 // Pokémon reaches the specified level with attack > defense +#define EVO_LEVEL_ATK_EQ_DEF 9 // Pokémon reaches the specified level with attack = defense +#define EVO_LEVEL_ATK_LT_DEF 10 // Pokémon reaches the specified level with attack < defense +#define EVO_LEVEL_SILCOON 11 // Pokémon reaches the specified level with a Silcoon personality value +#define EVO_LEVEL_CASCOON 12 // Pokémon reaches the specified level with a Cascoon personality value +#define EVO_LEVEL_NINJASK 13 // Pokémon reaches the specified level (special value for Ninjask) +#define EVO_LEVEL_SHEDINJA 14 // Pokémon reaches the specified level (special value for Shedinja) +#define EVO_BEAUTY 15 // Pokémon levels up with beauty ≥ specified value #define EVOS_PER_MON 5 -- cgit v1.2.3 From 2b2be90a5266e294342e1759dddfe8af4d6f39f2 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 10 Oct 2020 16:17:34 -0600 Subject: start pokenav documentation --- include/menu_specialized.h | 12 +-- include/mon_markings.h | 4 +- include/pokenav.h | 198 +++++++++++++++++++++++++++------------------ 3 files changed, 126 insertions(+), 88 deletions(-) (limited to 'include') diff --git a/include/menu_specialized.h b/include/menu_specialized.h index 242e1c6b2..987fca9fc 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -23,7 +23,7 @@ struct UnknownSubStruct_81D1ED4 struct ConditionGraph { - /*0x000*/ u8 unk0[4][FLAVOR_COUNT]; + /*0x000*/ u8 stat[4][FLAVOR_COUNT]; /*0x014*/ struct UnknownSubStruct_81D1ED4 unk14[4][FLAVOR_COUNT]; /*0x064*/ struct UnknownSubStruct_81D1ED4 unk64[10][FLAVOR_COUNT]; /*0x12C*/ struct UnknownSubStruct_81D1ED4 unk12C[FLAVOR_COUNT]; @@ -32,7 +32,7 @@ struct ConditionGraph /*0x350*/ u16 unk350; /*0x352*/ u16 unk352; /*0x354*/ u8 unk354; - /*0x355*/ u8 unk355; + /*0x355*/ u8 state; }; bool8 sub_81D1C44(u8 count); @@ -41,12 +41,12 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page); void sub_81D1E90(struct PlayerPCItemPageStruct *page); void sub_81D1EC0(void); void sub_81D1D04(u8 a0); -void sub_81D1ED4(struct ConditionGraph *graph); +void InitConditionGraphData(struct ConditionGraph *graph); void sub_81D2108(struct ConditionGraph *graph); -void sub_81D21DC(u8 bg); -void sub_81D20AC(struct ConditionGraph *graph); +void SetConditionGraphIOWindows(u8 bg); +void InitConditionGraphState(struct ConditionGraph *graph); void sub_81D2230(struct ConditionGraph *graph); -bool8 sub_81D20BC(struct ConditionGraph *graph); +bool8 SetupConditionGraphScanlineParams(struct ConditionGraph *graph); bool32 TransitionConditionGraph(struct ConditionGraph *graph); void sub_81D2754(u8 *arg0, struct UnknownSubStruct_81D1ED4 *arg1); void sub_81D1F84(struct ConditionGraph *graph, struct UnknownSubStruct_81D1ED4 *arg1, struct UnknownSubStruct_81D1ED4 *arg2); diff --git a/include/mon_markings.h b/include/mon_markings.h index 241b31e01..3cb04ad48 100644 --- a/include/mon_markings.h +++ b/include/mon_markings.h @@ -29,8 +29,8 @@ bool8 sub_811F960(void); void sub_811FA90(void); void sub_811FAA4(u8 markings, s16 x, s16 y); void sub_811FAF8(void); -bool8 sub_811FBA4(void); -struct Sprite *sub_811FF94(u16 tileTag, u16 paletteTag, const u16 *palette); +bool8 MonMarkingsMenuHandleInput(void); +struct Sprite *CreateMonMarkingsSpriteWithPal(u16 tileTag, u16 paletteTag, const u16 *palette); struct Sprite *sub_811FFB4(u16 tileTag, u16 paletteTag, const u16 *palette); void sub_8120084(u8 markings, void *dest); diff --git a/include/pokenav.h b/include/pokenav.h index ed4e5a906..34692236d 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -27,17 +27,17 @@ struct PokenavListTemplate struct PokenavMonList *monList; struct PokenavMatchCallEntries *matchCallEntries; } list; - u16 unk4; + u16 count; u16 unk6; u8 unk8; - u8 unk9; - u8 unkA; - u8 unkB; - u8 unkC; - u8 unkD; - u8 unkE; + u8 item_X; + u8 windowWidth; + u8 listTop; + u8 maxShowed; + u8 fillValue; + u8 fontId; union { - void (*unk10_1)(struct PokenavMonList *, u8 *a1); + void (*printMonFunc)(struct PokenavMonList *item, u8 *dest); void (*unk10_2)(struct PokenavMatchCallEntries *, u8 *a1); } listFunc; void (*unk14)(u16 a0, u32 a1, u32 a2); @@ -45,9 +45,9 @@ struct PokenavListTemplate struct PokenavSub18 { - u16 unk0; - u16 unk2; - struct PokenavMonList unk4[TOTAL_BOXES_COUNT * IN_BOX_COUNT + PARTY_SIZE]; + u16 listCount; + u16 currIndex; + struct PokenavMonList monData[TOTAL_BOXES_COUNT * IN_BOX_COUNT + PARTY_SIZE]; }; // Return values of LoopedTask functions. @@ -65,6 +65,31 @@ enum POKENAV_MODE_FORCE_CALL_EXIT, // Pokenav tutorial after calling Mr. Stone }; +// TODO - refine these names +enum Substructures +{ + POKENAV_SUBSTRUCT_MAIN_MENU, + POKENAV_SUBSTRUCT_MAIN_MENU_HANDLER, + POKENAV_SUBSTRUCT_MENU_ICONS, + POKENAV_SUBSTRUCT_REGION_MAP_STATE, + POKENAV_SUBSTRUCT_REGION_MAP_ZOOM, + POKENAV_SUBSTRUCT_MATCH_CALL_MAIN, + POKENAV_SUBSTRUCT_MATCH_CALL_OPEN, + POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULTS, + POKENAV_SUBSTRUCT_CONDITION_SEARCH_RESULT_LIST, + POKENAV_SUBSTRUCT_RIBBONS_MON_LIST, + POKENAV_SUBSTRUCT_RIBBONS_MON_MENU, + POKENAV_SUBSTRUCT_CONDITION_GRAPH, + POKENAV_SUBSTRUCT_MON_MARK_MENU, + POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_LIST, + POKENAV_SUBSTRUCT_RIBBONS_SUMMARY_MENU, + POKENAV_SUBSTRUCT_15, //unused + POKENAV_SUBSTRUCT_REGION_MAP, + POKENAV_SUBSTRUCT_MATCH_CALL_LIST, + POKENAV_SUBSTRUCT_MON_LIST, + POKENAV_SUBSTRUCT_COUNT, +}; + enum { POKENAV_GFX_MAIN_MENU, @@ -97,12 +122,12 @@ enum POKENAV_REGION_MAP, POKENAV_CONDITION_PARTY, POKENAV_CONDITION_SEARCH_RESULTS, - POKENAV_MENU_9, // Condition - POKENAV_MENU_A, // Condition + POKENAV_MENU_CONDITION_GRAPH_FROM_SEARCH, // opening condition graph from search list + POKENAV_RETURN_CONDITION_SEARCH, //return to search list from condition graph POKENAV_MATCH_CALL, POKENAV_RIBBONS_MON_LIST, - POKENAV_MENU_D, // Ribbons - POKENAV_MENU_E, // Ribbons + POKENAV_RIBBONS_SUMMARY_SCREEN, + POKENAV_RIBBONS_RETURN_TO_MON_LIST, }; enum @@ -207,7 +232,7 @@ enum // Pokenav Function IDs // Indices into the LoopedTask tables for each of the main Pokenav features -enum +enum RegionMapFuncIds { POKENAV_MENU_FUNC_NONE, POKENAV_MENU_FUNC_MOVE_CURSOR, @@ -220,6 +245,19 @@ enum POKENAV_MENU_FUNC_OPEN_FEATURE, }; +enum PartyConditionFuncIds +{ + PARTY_CONDITION_FUNC_NONE, + PARTY_CONDITION_FUNC_SLIDE_MON_IN, + PARTY_CONDITION_FUNC_RETURN, + PARTY_CONDITION_FUNC_NO_TRANSITION, + PARTY_CONDITION_FUNC_SLIDE_MON_OUT, + PARTY_CONDITION_FUNC_ADD_MARKINGS, + PARTY_CONDITION_FUNC_CLOSE_MARKINGS, +}; + +#define POKENAV_MENU_FUNC_EXIT -1 + enum { POKENAV_MC_FUNC_NONE, @@ -268,17 +306,17 @@ void SetPokenavVBlankCallback(void); void SetVBlankCallback_(IntrCallback callback); // pokenav_match_call_ui.c -u32 GetSelectedMatchCall(void); +u32 GetSelectedPokenavListIndex(void); bool32 sub_81C8224(void); int MatchCall_MoveCursorUp(void); int MatchCall_MoveCursorDown(void); int MatchCall_PageDown(void); int MatchCall_PageUp(void); -bool32 sub_81C8630(void); +bool32 IsMonListLoopedTaskActive(void); void ToggleMatchCallVerticalArrows(bool32 shouldHide); void sub_81C8838(void); void sub_81C877C(void); -bool32 sub_81C8820(void); +bool32 IsMatchCallListTaskActive(void); void PrintCheckPageInfo(s16 a0); u32 GetMatchCallListTopIndex(void); void sub_81C87F0(void); @@ -300,30 +338,30 @@ void MatchCall_GetNameAndDesc(u32 idx, const u8 **desc, const u8 **name); // pokenav_main_menu.c bool32 InitPokenavMainMenu(void); void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size); -void sub_81C7850(u32 a0); -u32 sub_81C786C(void); +void RunMainMenuLoopedTask(u32 a0); +u32 IsActiveMenuLoopTaskActive(void); void LoadLeftHeaderGfxForIndex(u32 arg0); -void sub_81C7FA0(u32 arg0, bool32 arg1, bool32 arg2); +void ShowLeftHeaderGfx(u32 menugfxId, bool32 arg1, bool32 isOnRightSide); void PokenavFadeScreen(s32 fadeType); -bool32 sub_81C8010(void); +bool32 AreLeftHeaderSpritesMoving(void); void InitBgTemplates(const struct BgTemplate *templates, int count); bool32 IsPaletteFadeActive(void); void PrintHelpBarText(u32 textId); bool32 WaitForHelpBar(void); -void sub_81C78A0(void); +void SlideMenuHeaderDown(void); bool32 MainMenuLoopedTaskIsBusy(void); -void sub_81C7FDC(void); -void sub_81C79BC(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u16 *palette); +void SetLeftHeaderSpritesInvisibility(void); +void PokenavCopyPalette(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u16 *palette); void sub_81C7B40(void); struct Sprite *PauseSpinningPokenavSprite(void); void ResumeSpinningPokenavSprite(void); -void sub_81C7E14(u32 arg0); -void sub_81C7FC4(u32 arg0, bool32 arg1); -void sub_81C7880(void); -void sub_81C7990(u32 a0, u16 a1); +void UpdateRegionMapRightHeaderTiles(u32 arg0); +void HideMainOrSubMenuLeftHeader(u32 id, bool32 onRightSide); +void SlideMenuHeaderUp(void); +void PokenavFillPalette(u32 palIndex, u16 fillValue); u32 PokenavMainMenuLoopedTaskIsActive(void); bool32 WaitForPokenavShutdownFade(void); -void sub_81C7834(void *func1, void *func2); +void SetActiveMenuLoopTasks(void *func1, void *func2); void ShutdownPokenav(void); // pokenav_menu_handler_1.c @@ -345,7 +383,7 @@ bool32 OpenPokenavMenuNotInitial(void); void CreateMenuHandlerLoopedTask(s32 ltIdx); bool32 IsMenuHandlerLoopedTaskActive(void); void FreeMenuHandlerSubstruct2(void); -void sub_81CAADC(void); +void ResetBldCnt_(void); // pokenav_match_call_1.c bool32 PokenavCallback_Init_MatchCall(void); @@ -364,7 +402,7 @@ const u8 *GetMatchCallMessageText(int index, u8 *arg1); u16 GetMatchCallOptionCursorPos(void); u16 GetMatchCallOptionId(int arg0); void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntries * arg0, u8 *str); -u8 sub_81CB0C8(int rematchIndex); +u8 GetMatchTableMapSectionId(int rematchIndex); int GetIndexDeltaOfNextCheckPageDown(int index); int GetIndexDeltaOfNextCheckPageUp(int index); bool32 IsRematchEntryRegistered(int index); @@ -385,60 +423,60 @@ void FreeRegionMapSubstruct1(void); void FreeRegionMapSubstruct2(void); // pokenav_conditions_1.c -u32 PokenavCallback_Init_7(void); -u32 PokenavCallback_Init_9(void); -u32 sub_81CD070(void); -void sub_81CD1C0(void); -bool32 sub_81CD3C4(void); -bool32 sub_81CDD5C(void); -struct ConditionGraph *sub_81CDC70(void); -u16 sub_81CDC60(void); -u16 sub_81CDC50(void); -u8 sub_81CDDB0(void); -bool32 sub_81CD548(u8 arg0); -u8 sub_81CDD7C(void); -u8 *sub_81CDD04(u8 id); -u8 *sub_81CDD24(u8 id); -u16 sub_81CDD48(void); -void *sub_81CDCB4(u8 id); -void *sub_81CDCD4(u8 id); +u32 PokenavCallback_Init_PartyCondition(void); +u32 PokenavCallback_Init_ConditionGraphFromSearch(void); +u32 GetPartyConditionCallback(void); +void FreePartyConditionSubstruct1(void); +bool32 LoadPartyConditionMenuGfx(void); +bool32 IsConditionMenuSearchMode(void); +struct ConditionGraph *GetConditionGraphDataPtr(void); +u16 GetConditionGraphCurrentMonIndex(void); +u16 GetMonListCount(void); +u8 GetMonSheen(void); +bool32 SetConditionGraphData(u8 arg0); +u8 TryGetMonMarkId(void); +u8 *GetConditionMonNameBuffer(u8 id); +u8 *GetConditionMonLocationBuffer(u8 id); +u16 GetConditionMonDataBuffer(void); +void *GetConditionMonPicGfx(u8 id); +void *GetConditionMonPal(u8 id); // pokenav_conditions_2.c -bool32 sub_81CDDD4(void); -void sub_81CDE2C(s32); -u32 sub_81CDE64(void); -void sub_81CECA0(void); -u8 sub_81CEF14(void); +bool32 OpenPartyConditionMenu(void); +void CreatePartyConditionLoopedTask(s32); +u32 IsPartyConditionLoopedTaskActive(void); +void FreePartyConditionSubstruct2(void); +u8 GetMonMarkingsData(void); // pokenav_conditions_3.c -u32 PokenavCallback_Init_8(void); -u32 PokenavCallback_Init_10(void); -u32 sub_81CEFDC(void); -void sub_81CEFF0(void); -bool32 sub_81CF330(void); -bool32 sub_81CF368(void); -void sub_81CF3A0(s32); -u32 sub_81CF3D0(void); -void sub_81CF3F8(void); +u32 PokenavCallback_Init_ConditionSearch(void); +u32 PokenavCallback_Init_ReturnToMonSearchList(void); +u32 GetConditionSearchResultsCallback(void); +void FreeSearchResultSubstruct1(void); +bool32 OpenConditionSearchResults(void); +bool32 OpenConditionSearchListFromGraph(void); +void CreateSearchResultsLoopedTask(s32); +u32 IsSearchResultLoopedTaskActive(void); +void FreeSearchResultSubstruct2(void); // pokenav_ribbons_1.c -u32 PokenavCallback_Init_12(void); -u32 PokenavCallback_Init_14(void); -u32 sub_81CFA34(void); -void sub_81CFA48(void); -bool32 sub_81CFDD0(void); -bool32 sub_81CFE08(void); -void sub_81CFE40(s32); -u32 sub_81CFE70(void); -void sub_81CFE98(void); +u32 PokenavCallback_Init_MonRibbonList(void); +u32 PokenavCallback_Init_RibbonsMonListFromSummary(void); +u32 GetRibbonsMonListCallback(void); +void FreeRibbonsMonList1(void); +bool32 OpenRibbonsMonList(void); +bool32 OpenRibbonsMonListFromRibbonsSummary(void); +void CreateRibbonsMonListLoopedTask(s32); +u32 IsRibbonsMonListLoopedTaskActive(void); +void FreeRibbonsMonList2(void); // pokenav_ribbons_2.c -u32 PokenavCallback_Init_13(void); -u32 sub_81D04A0(void); -void sub_81D04B8(void); -bool32 sub_81D0978(void); -void sub_81D09B0(s32); -u32 sub_81D09E0(void); -void sub_81D09F4(void); +u32 PokenavCallback_Init_RibbonsSummaryMenu(void); +u32 GetRibbonsSummaryMenuCallback(void); +void FreeRibbonsSummaryScreen1(void); +bool32 OpenRibbonsSummaryMenu(void); +void CreateRibbonsSummaryLoopedTask(s32); +u32 IsRibbonsSummaryLoopedTaskActive(void); +void FreeRibbonsSummaryScreen2(void); #endif // GUARD_POKENAV_H -- cgit v1.2.3 From 52ebc4252e0752ab3b918d4637c4c2672f033610 Mon Sep 17 00:00:00 2001 From: kageru Date: Wed, 7 Oct 2020 23:03:46 +0200 Subject: Document gUnknown_03006298 --- include/battle_tower.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/battle_tower.h b/include/battle_tower.h index 3bf2f004b..30649719b 100644 --- a/include/battle_tower.h +++ b/include/battle_tower.h @@ -43,7 +43,9 @@ extern const struct BattleFrontierTrainer gBattleFrontierTrainers[]; extern const struct FacilityMon gSlateportBattleTentMons[]; extern const struct BattleFrontierTrainer gSlateportBattleTentTrainers[]; -extern u16 gUnknown_03006298[]; +// Temporary storage for monIds of the opponent team +// during team generation in battle factory and similar facilities. +extern u16 gFrontierTempParty[]; extern const struct BattleFrontierTrainer *gFacilityTrainers; extern const struct FacilityMon *gFacilityTrainerMons; -- cgit v1.2.3 From f4909b4d964100b2e2dde75582ad647ef80fc6a8 Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 11 Oct 2020 08:50:58 -0600 Subject: align pokenav task funcs and update some pokenav menu bg gfx files --- include/pokenav.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/pokenav.h b/include/pokenav.h index 34692236d..3fc01ede3 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -122,7 +122,7 @@ enum POKENAV_REGION_MAP, POKENAV_CONDITION_PARTY, POKENAV_CONDITION_SEARCH_RESULTS, - POKENAV_MENU_CONDITION_GRAPH_FROM_SEARCH, // opening condition graph from search list + POKENAV_CONDITION_GRAPH_FROM_SEARCH, // opening condition graph from search list POKENAV_RETURN_CONDITION_SEARCH, //return to search list from condition graph POKENAV_MATCH_CALL, POKENAV_RIBBONS_MON_LIST, -- cgit v1.2.3 From 90211248af2f02aa696b38fbf77ddfd2d2950312 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 23 Oct 2020 20:47:10 -0400 Subject: re-match Cmd_unknown_24 (from #1140) changes to data structs are necessary. other things that look unnecessary, like the order of operands, are also necessary. fuck this function. --- include/battle.h | 18 +++++++++--------- include/constants/battle.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/battle.h b/include/battle.h index 6dddfd197..5284040f1 100644 --- a/include/battle.h +++ b/include/battle.h @@ -132,14 +132,14 @@ struct ProtectStruct struct SpecialStatus { - u8 statLowered:1; - u8 lightningRodRedirected:1; - u8 restoredBattlerSprite: 1; - u8 intimidatedMon:1; - u8 traced:1; - u8 ppNotAffectedByPressure:1; - u8 flag40:1; - u8 focusBanded:1; + u32 statLowered:1; + u32 lightningRodRedirected:1; + u32 restoredBattlerSprite: 1; + u32 intimidatedMon:1; + u32 traced:1; + u32 ppNotAffectedByPressure:1; + u32 flag40:1; + u32 focusBanded:1; s32 dmg; s32 physicalDmg; s32 specialDmg; @@ -254,7 +254,7 @@ struct BattleResults u16 playerMon2Species; // 0x26 u16 caughtMonSpecies; // 0x28 u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A - u8 filler35[1]; // 0x35 + u8 filler35; // 0x35 u8 catchAttempts[11]; // 0x36 }; diff --git a/include/constants/battle.h b/include/constants/battle.h index 8b860e384..fa8f422c4 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -186,7 +186,7 @@ #define HITMARKER_x4000000 (1 << 26) #define HITMARKER_CHARGING (1 << 27) #define HITMARKER_FAINTED(battler) (gBitTable[battler] << 28) -#define HITMARKER_FAINTED2(battler) (1 << (28 + battler)) +#define HITMARKER_FAINTED2(battler) ((1 << 28) << battler) // Per-side statuses that affect an entire party #define SIDE_STATUS_REFLECT (1 << 0) -- cgit v1.2.3 From 44c2d15ca9f3b1b758fc70acdf6d0cf1cf74cf5f Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Fri, 23 Oct 2020 22:07:30 -0400 Subject: re-match sub_81C79BC (from #1177) also re-define RBG macros --- include/constants/rgb.h | 4 ++++ include/pokenav.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/constants/rgb.h b/include/constants/rgb.h index 80d951f4b..1896250d2 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -1,6 +1,10 @@ #ifndef GUARD_RGB_H #define GUARD_RGB_H +#define GET_R(color) ((color) & 0x1F) +#define GET_G(color) (((color) >> 5) & 0x1F) +#define GET_B(color) (((color) >> 10) & 0x1F) + #define RGB(r, g, b) ((r) | ((g) << 5) | ((b) << 10)) #define RGB2(r, g, b) (((b) << 10) | ((g) << 5) | (r)) #define _RGB(r, g, b) ((((b) & 0x1F) << 10) + (((g) & 0x1F) << 5) + ((r) & 0x1F)) diff --git a/include/pokenav.h b/include/pokenav.h index ac916f3ba..ed4e5a906 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -313,7 +313,7 @@ bool32 WaitForHelpBar(void); void sub_81C78A0(void); bool32 MainMenuLoopedTaskIsBusy(void); void sub_81C7FDC(void); -void sub_81C79BC(const u16 *a0, const u16 *a1, u32 a2, u32 a3, u32 a4, u16 *a5); +void sub_81C79BC(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u16 *palette); void sub_81C7B40(void); struct Sprite *PauseSpinningPokenavSprite(void); void ResumeSpinningPokenavSprite(void); -- cgit v1.2.3 From 83846b913ac7dd23389588a23b3bb1aa2062a2ee Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 26 Oct 2020 00:01:53 -0400 Subject: port sub_806F160 fakematch fix --- include/pokemon.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/pokemon.h b/include/pokemon.h index d75ec94f3..a956b9c40 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -123,12 +123,12 @@ struct Pokemon struct Unknown_806F160_Struct { - u8 field_0_0:4; - u8 field_0_1:4; - u8 field_1; - u8 magic; - u8 field_3_0:4; - u8 field_3_1:4; + u32 field_0_0:4; + u32 field_0_1:4; + u32 field_1:8; + u16 magic:8; + u32 field_3_0:4; + u32 field_3_1:4; void *bytes; u8 **byteArrays; struct SpriteTemplate *templates; -- cgit v1.2.3 From fe40c0c4663d732c8ba9ca5f5e00b3c14a17d304 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 26 Oct 2020 05:52:00 -0400 Subject: re-match BattleIntroOpponent1SendsOutMonAnimation a lot of functions and a bit of data had to be moved from battle_main.c to battle_util.c; I have added a note to battle_util.c stating the reason for this --- include/battle_main.h | 1 + include/battle_util.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) (limited to 'include') diff --git a/include/battle_main.h b/include/battle_main.h index 890e47f39..1c2c50f1c 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -83,6 +83,7 @@ u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves); void RunBattleScriptCommands_PopCallbacksStack(void); void RunBattleScriptCommands(void); bool8 TryRunFromBattle(u8 battlerId); +void SpecialStatusesClear(void); extern struct UnknownPokemonStruct4 gMultiPartnerParty[MULTI_PARTY_SIZE]; diff --git a/include/battle_util.h b/include/battle_util.h index 157ba8eb6..81443f463 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -41,6 +41,19 @@ #define WEATHER_HAS_EFFECT ((!ABILITY_ON_FIELD(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD(ABILITY_AIR_LOCK))) #define WEATHER_HAS_EFFECT2 ((!ABILITY_ON_FIELD2(ABILITY_CLOUD_NINE) && !ABILITY_ON_FIELD2(ABILITY_AIR_LOCK))) +void HandleAction_UseMove(void); +void HandleAction_Switch(void); +void HandleAction_UseItem(void); +void HandleAction_Run(void); +void HandleAction_WatchesCarefully(void); +void HandleAction_SafariZoneBallThrow(void); +void HandleAction_ThrowPokeblock(void); +void HandleAction_GoNear(void); +void HandleAction_SafariZoneRun(void); +void HandleAction_WallyBallThrow(void); +void HandleAction_TryFinish(void); +void HandleAction_NothingIsFainted(void); +void HandleAction_ActionFinished(void); u8 GetBattlerForBattleScript(u8 caseId); void PressurePPLose(u8 target, u8 attacker, u16 move); void PressurePPLoseOnUsingPerishSong(u8 attacker); -- cgit v1.2.3 From be1685c87fd683c2c4efc6d2ca173d5344bfcf2f Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 29 Oct 2020 16:34:33 -0400 Subject: Use constants for menu info icon table --- include/menu.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/menu.h b/include/menu.h index 1bd800742..c9d8e374d 100644 --- a/include/menu.h +++ b/include/menu.h @@ -4,6 +4,7 @@ #include "task.h" #include "text.h" #include "window.h" +#include "constants/pokemon.h" #define MENU_NOTHING_CHOSEN -2 #define MENU_B_PRESSED -1 @@ -14,6 +15,14 @@ #define MENU_CURSOR_DELTA_LEFT -1 #define MENU_CURSOR_DELTA_RIGHT 1 +#define MENU_INFO_ICON_TYPE (NUMBER_OF_MON_TYPES + 1) +#define MENU_INFO_ICON_POWER (NUMBER_OF_MON_TYPES + 2) +#define MENU_INFO_ICON_ACCURACY (NUMBER_OF_MON_TYPES + 3) +#define MENU_INFO_ICON_PP (NUMBER_OF_MON_TYPES + 4) +#define MENU_INFO_ICON_EFFECT (NUMBER_OF_MON_TYPES + 5) +#define MENU_INFO_ICON_BALL_RED (NUMBER_OF_MON_TYPES + 6) +#define MENU_INFO_ICON_BALL_BLUE (NUMBER_OF_MON_TYPES + 7) + enum { SAVE_MENU_NAME, @@ -61,7 +70,7 @@ u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 i u8 Menu_GetCursorPos(void); s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); -void blit_move_info_icon(u8 winId, u8 a2, u16 x, u16 y); +void BlitMenuInfoIcon(u8 winId, u8 a2, u16 x, u16 y); void ResetTempTileDataBuffers(void); void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); bool8 FreeTempTileDataBuffersIfPossible(void); -- cgit v1.2.3 From 8bf401c2272b7c4182f54cb1285f6067fb5247f9 Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Mon, 2 Nov 2020 18:43:11 -0500 Subject: address comments --- include/battle_main.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/battle_main.h b/include/battle_main.h index 1c2c50f1c..0176f7f24 100644 --- a/include/battle_main.h +++ b/include/battle_main.h @@ -73,8 +73,6 @@ void nullsub_20(void); void BeginBattleIntro(void); void SwitchInClearSetData(void); void FaintClearSetData(void); -void sub_803B3AC(void); // unused -void sub_803B598(void); // unused void BattleTurnPassed(void); u8 IsRunningFromBattleImpossible(void); void SwitchPartyOrder(u8 battlerId); -- cgit v1.2.3 From 3b91735e63409f4c5fd88d9984b036a6304952f9 Mon Sep 17 00:00:00 2001 From: MCboy Date: Fri, 6 Nov 2020 22:59:46 +0330 Subject: use constants for ball throw count --- include/battle.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/battle.h b/include/battle.h index 8dad6bc25..a58f69cda 100644 --- a/include/battle.h +++ b/include/battle.h @@ -12,6 +12,8 @@ #include "battle_util2.h" #include "battle_bg.h" +#include "pokeball.h" // i'm not sure about this one + #define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler]) #define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE) #define GET_BATTLER_SIDE2(battler) (GET_BATTLER_POSITION(battler) & BIT_SIDE) @@ -255,7 +257,7 @@ struct BattleResults u16 caughtMonSpecies; // 0x28 u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A u8 filler35; // 0x35 - u8 catchAttempts[11]; // 0x36 + u8 catchAttempts[POKEBALL_COUNT-1]; // 0x36 Doesn't include Master ball }; struct BattleTv_Side -- cgit v1.2.3 From e31158d017c71110d421864beee166d1facbebd9 Mon Sep 17 00:00:00 2001 From: MCboy Date: Fri, 6 Nov 2020 23:29:52 +0330 Subject: add spaces around - and remove comment from include in battle.h --- include/battle.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/battle.h b/include/battle.h index a58f69cda..820684a69 100644 --- a/include/battle.h +++ b/include/battle.h @@ -11,8 +11,7 @@ #include "battle_gfx_sfx_util.h" #include "battle_util2.h" #include "battle_bg.h" - -#include "pokeball.h" // i'm not sure about this one +#include "pokeball.h" #define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler]) #define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE) @@ -257,7 +256,7 @@ struct BattleResults u16 caughtMonSpecies; // 0x28 u8 caughtMonNick[POKEMON_NAME_LENGTH + 1]; // 0x2A u8 filler35; // 0x35 - u8 catchAttempts[POKEBALL_COUNT-1]; // 0x36 Doesn't include Master ball + u8 catchAttempts[POKEBALL_COUNT - 1]; // 0x36 Doesn't include Master ball }; struct BattleTv_Side -- cgit v1.2.3 From 6f91f7e0e341ec410f0d231625cdb7aea1cb0359 Mon Sep 17 00:00:00 2001 From: kageru Date: Tue, 17 Nov 2020 17:21:34 +0100 Subject: Use more constants in Battle Tower code --- include/global.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/global.h b/include/global.h index 85166e0ec..4ccd2be50 100644 --- a/include/global.h +++ b/include/global.h @@ -328,11 +328,12 @@ struct BattleDomeTrainer }; #define DOME_TOURNAMENT_TRAINERS_COUNT 16 +#define BATTLE_TOWER_RECORD_COUNT 5 struct BattleFrontier { /*0x64C*/ struct EmeraldBattleTowerRecord towerPlayer; - /*0x738*/ struct EmeraldBattleTowerRecord towerRecords[5]; // From record mixing. + /*0x738*/ struct EmeraldBattleTowerRecord towerRecords[BATTLE_TOWER_RECORD_COUNT]; // From record mixing. /*0xBEB*/ struct BattleTowerInterview towerInterview; /*0xBEC*/ struct BattleTowerEReaderTrainer ereaderTrainer; /*0xCA8*/ u8 challengeStatus; -- cgit v1.2.3 From bf65c1fb2505cad8c29ee4beceb1f41eab3151d2 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 23 Nov 2020 14:12:07 -0500 Subject: Name object event pals/tags --- include/global.fieldmap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 4598e87fa..83123c834 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -219,8 +219,8 @@ struct ObjectEvent struct ObjectEventGraphicsInfo { /*0x00*/ u16 tileTag; - /*0x02*/ u16 paletteTag1; - /*0x04*/ u16 paletteTag2; + /*0x02*/ u16 paletteTag; + /*0x04*/ u16 reflectionPaletteTag; /*0x06*/ u16 size; /*0x08*/ s16 width; /*0x0A*/ s16 height; -- cgit v1.2.3 From 513c7c5f45b3c79e710ea1e48298d8a7bf9bb591 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 23 Nov 2020 14:41:22 -0500 Subject: Clarify Kecleon objects --- include/constants/event_objects.h | 4 ++-- include/constants/flags.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index ca312e957..8e026ef2d 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -205,7 +205,7 @@ #define OBJ_EVENT_GFX_REGICE 201 #define OBJ_EVENT_GFX_REGISTEEL 202 #define OBJ_EVENT_GFX_SKITTY 203 -#define OBJ_EVENT_GFX_KECLEON_1 204 +#define OBJ_EVENT_GFX_KECLEON 204 #define OBJ_EVENT_GFX_KYOGRE_2 205 #define OBJ_EVENT_GFX_GROUDON_2 206 #define OBJ_EVENT_GFX_RAYQUAZA_2 207 @@ -213,7 +213,7 @@ #define OBJ_EVENT_GFX_PIKACHU 209 #define OBJ_EVENT_GFX_AZUMARILL 210 #define OBJ_EVENT_GFX_WINGULL 211 -#define OBJ_EVENT_GFX_KECLEON_2 212 +#define OBJ_EVENT_GFX_KECLEON_BRIDGE_SHADOW 212 #define OBJ_EVENT_GFX_TUBER_M_SWIMMING 213 #define OBJ_EVENT_GFX_AZURILL 214 #define OBJ_EVENT_GFX_MOM 215 diff --git a/include/constants/flags.h b/include/constants/flags.h index a562b0670..9be269105 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1012,7 +1012,7 @@ #define FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_STEVEN 0x3C7 #define FLAG_HIDE_MOSSDEEP_CITY_STEVENS_HOUSE_BELDUM_POKEBALL 0x3C8 #define FLAG_HIDE_FORTREE_CITY_KECLEON 0x3C9 -#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_INVISIBLE 0x3CA +#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE 0x3CA #define FLAG_HIDE_LILYCOVE_CITY_RIVAL 0x3CB #define FLAG_HIDE_ROUTE_120_STEVEN 0x3CC #define FLAG_HIDE_SOOTOPOLIS_CITY_STEVEN 0x3CD @@ -1023,7 +1023,7 @@ #define FLAG_HIDE_AQUA_HIDEOUT_B1F_ELECTRODE_2 0x3D2 #define FLAG_HIDE_OLDALE_TOWN_RIVAL 0x3D3 #define FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE 0x3D4 -#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_VISIBLE 0x3D5 +#define FLAG_HIDE_ROUTE_120_KECLEON_BRIDGE_SHADOW 0x3D5 #define FLAG_HIDE_ROUTE_120_KECLEON_1 0x3D6 #define FLAG_HIDE_RUSTURF_TUNNEL_WANDA 0x3D7 #define FLAG_HIDE_VERDANTURF_TOWN_WANDAS_HOUSE_WANDA 0x3D8 -- cgit v1.2.3 From 9d056e865655af52c16be7c04df42be378259439 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 23 Nov 2020 14:45:16 -0500 Subject: Move object event pal declarations to graphics --- include/graphics.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/graphics.h b/include/graphics.h index 32268d6db..936f95aa8 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -5014,4 +5014,10 @@ extern const u16 gPokenavMessageBox_Pal[]; extern const u32 gPokenavOptions_Gfx[]; extern const u16 gPokenavOptions_Pal[]; +// Object event pals +extern const u16 gObjectEventPal_Brendan[]; +extern const u16 gObjectEventPal_May[]; +extern const u16 gObjectEventPal_RubySapphireBrendan[]; +extern const u16 gObjectEventPal_RubySapphireMay[]; + #endif //GUARD_GRAPHICS_H -- cgit v1.2.3