summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-11-13 23:26:46 -0500
committerGitHub <noreply@github.com>2021-11-13 23:26:46 -0500
commitf42eafc85b007cd27e90bc9a1350d589e31bda43 (patch)
tree7a09999f6ac2fc2d1b36ece5ec484ec6527a201f /include
parent4c4fa1f25e55e41f469604a984a820f5a7f30e90 (diff)
parent8d18d03c791c40bad532c62f217b0f82aadec6d2 (diff)
Merge branch 'master' into doc-banim
Diffstat (limited to 'include')
-rw-r--r--include/constants/battle.h3
-rwxr-xr-xinclude/constants/event_object_movement.h8
-rw-r--r--include/constants/sound.h48
-rw-r--r--include/crt0.h5
-rw-r--r--include/event_object_movement.h2
-rw-r--r--include/graphics.h8
-rw-r--r--include/item.h1
-rw-r--r--include/load_save.h34
-rw-r--r--include/menu.h35
-rw-r--r--include/palette.h8
-rw-r--r--include/pokeball.h2
-rw-r--r--include/pokemon_icon.h2
-rw-r--r--include/save.h129
-rw-r--r--include/sound.h33
-rw-r--r--include/strings.h4
15 files changed, 188 insertions, 134 deletions
diff --git a/include/constants/battle.h b/include/constants/battle.h
index 2534ade4b..d87a800e2 100644
--- a/include/constants/battle.h
+++ b/include/constants/battle.h
@@ -358,4 +358,7 @@
// Flag for BattlePutTextOnWindow. Never set
#define B_WIN_COPYTOVRAM (1 << 7)
+// Indicator for the party summary bar to display an empty slot.
+#define HP_EMPTY_SLOT 0xFFFF
+
#endif // GUARD_CONSTANTS_BATTLE_H
diff --git a/include/constants/event_object_movement.h b/include/constants/event_object_movement.h
index 9611d008b..2c4273524 100755
--- a/include/constants/event_object_movement.h
+++ b/include/constants/event_object_movement.h
@@ -121,10 +121,10 @@
#define MOVEMENT_ACTION_WALK_IN_PLACE_FAST_UP 0x22
#define MOVEMENT_ACTION_WALK_IN_PLACE_FAST_LEFT 0x23
#define MOVEMENT_ACTION_WALK_IN_PLACE_FAST_RIGHT 0x24
-#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_DOWN 0x25
-#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_UP 0x26
-#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_LEFT 0x27
-#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_RIGHT 0x28
+#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_DOWN 0x25
+#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_UP 0x26
+#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_LEFT 0x27
+#define MOVEMENT_ACTION_WALK_IN_PLACE_FASTER_RIGHT 0x28
#define MOVEMENT_ACTION_RIDE_WATER_CURRENT_DOWN 0x29
#define MOVEMENT_ACTION_RIDE_WATER_CURRENT_UP 0x2A
#define MOVEMENT_ACTION_RIDE_WATER_CURRENT_LEFT 0x2B
diff --git a/include/constants/sound.h b/include/constants/sound.h
new file mode 100644
index 000000000..dc434bcf8
--- /dev/null
+++ b/include/constants/sound.h
@@ -0,0 +1,48 @@
+#ifndef GUARD_CONSTANTS_SOUND_H
+#define GUARD_CONSTANTS_SOUND_H
+
+#define FANFARE_LEVEL_UP 0
+#define FANFARE_OBTAIN_ITEM 1
+#define FANFARE_EVOLVED 2
+#define FANFARE_OBTAIN_TMHM 3
+#define FANFARE_HEAL 4
+#define FANFARE_OBTAIN_BADGE 5
+#define FANFARE_MOVE_DELETED 6
+#define FANFARE_OBTAIN_BERRY 7
+#define FANFARE_AWAKEN_LEGEND 8
+#define FANFARE_SLOTS_JACKPOT 9
+#define FANFARE_SLOTS_WIN 10
+#define FANFARE_TOO_BAD 11
+#define FANFARE_RG_POKE_FLUTE 12
+#define FANFARE_RG_OBTAIN_KEY_ITEM 13
+#define FANFARE_RG_DEX_RATING 14
+#define FANFARE_OBTAIN_B_POINTS 15
+#define FANFARE_OBTAIN_SYMBOL 16
+#define FANFARE_REGISTER_MATCH_CALL 17
+
+#define CRY_MODE_NORMAL 0 // Default
+#define CRY_MODE_DOUBLES 1 // Shortened cry for double battles
+#define CRY_MODE_ENCOUNTER 2 // Used when starting a static encounter, or when a Pokémon is "aggressive"
+#define CRY_MODE_HIGH_PITCH 3 // Highest pitch mode, used exclusively by the move Howl
+#define CRY_MODE_ECHO_START 4 // For 1st half of cry used by the move Hyper Voice. Played in reverse
+#define CRY_MODE_FAINT 5 // Used when a Pokémon faints
+#define CRY_MODE_ECHO_END 6 // For 2nd half of cry used by the move Hyper Voice
+#define CRY_MODE_ROAR_1 7 // For 1st cry used by the move Roar
+#define CRY_MODE_ROAR_2 8 // For 2nd cry used by the move Roar
+#define CRY_MODE_GROWL_1 9 // For 1st cry used by the move Growl. Played in reverse
+#define CRY_MODE_GROWL_2 10 // For 2nd cry used by the move Growl
+#define CRY_MODE_WEAK 11 // Used when a Pokémon is unhealthy
+#define CRY_MODE_WEAK_DOUBLES 12 // Equivalent to CRY_MODE_DOUBLES for CRY_MODE_WEAK
+
+// Given to SoundTask_PlayDoubleCry to determine which cry mode to use. Values are arbitrary
+#define DOUBLE_CRY_ROAR 2
+#define DOUBLE_CRY_GROWL 255
+
+#define CRY_PRIORITY_NORMAL 10
+#define CRY_PRIORITY_AMBIENT 1
+
+// Cry volume was changed from 125 in R/S to 120 for FRLG/Em, but was (accidentally?) not updated outside of sound.c
+#define CRY_VOLUME 120
+#define CRY_VOLUME_RS 125
+
+#endif // GUARD_CONSTANTS_SOUND_H
diff --git a/include/crt0.h b/include/crt0.h
index 3121eeaed..a4a5c7f79 100644
--- a/include/crt0.h
+++ b/include/crt0.h
@@ -1,11 +1,6 @@
#ifndef GUARD_CRT0_H
#define GUARD_CRT0_H
-// Exported type declarations
-
-// Exported RAM declarations
-
-// Exported ROM declarations
extern u32 IntrMain[];
#endif //GUARD_CRT0_H
diff --git a/include/event_object_movement.h b/include/event_object_movement.h
index 9ed524e66..6ad4b55e4 100644
--- a/include/event_object_movement.h
+++ b/include/event_object_movement.h
@@ -121,7 +121,7 @@ void InitObjectEventPalettes(u8 palSlot);
void UpdateObjectEventCurrentMovement(struct ObjectEvent *, struct Sprite *, bool8(struct ObjectEvent *, struct Sprite *));
u8 ObjectEventFaceOppositeDirection(struct ObjectEvent *, u8);
u8 GetOppositeDirection(u8);
-u8 GetWalkInPlaceFastestMovementAction(u32);
+u8 GetWalkInPlaceFasterMovementAction(u32);
u8 GetWalkInPlaceFastMovementAction(u32);
u8 GetWalkInPlaceNormalMovementAction(u32);
u8 GetWalkInPlaceSlowMovementAction(u32);
diff --git a/include/graphics.h b/include/graphics.h
index a58b0f0f1..eeb8f65a3 100644
--- a/include/graphics.h
+++ b/include/graphics.h
@@ -3855,10 +3855,10 @@ extern const u32 gItemIcon_ReturnToFieldArrow[];
extern const u32 gItemIconPalette_ReturnToFieldArrow[];
//menu graphics
-extern const u16 gFireRedMenuElements1_Pal[16];
-extern const u16 gFireRedMenuElements2_Pal[16];
-extern const u16 gFireRedMenuElements3_Pal[16];
-extern const u8 gFireRedMenuElements_Gfx[];
+extern const u16 gMenuInfoElements1_Pal[16];
+extern const u16 gMenuInfoElements2_Pal[16];
+extern const u16 gMenuInfoElements3_Pal[16];
+extern const u8 gMenuInfoElements_Gfx[];
// item menu graphics
extern const u32 gBagScreen_Gfx[];
diff --git a/include/item.h b/include/item.h
index 87ff57bc7..ceca83bd5 100644
--- a/include/item.h
+++ b/include/item.h
@@ -29,6 +29,7 @@ struct BagPocket
u8 capacity;
};
+extern const struct Item gItems[];
extern struct BagPocket gBagPockets[];
void ApplyNewEncryptionKeyToBagItems(u32 newKey);
diff --git a/include/load_save.h b/include/load_save.h
index 2f4a9ace6..309e62e2b 100644
--- a/include/load_save.h
+++ b/include/load_save.h
@@ -1,9 +1,33 @@
#ifndef GUARD_LOAD_SAVE_H
#define GUARD_LOAD_SAVE_H
-extern struct SaveBlock1 gSaveblock1;
-extern struct SaveBlock2 gSaveblock2;
-extern struct PokemonStorage gPokemonStorage;
+#include "pokemon_storage_system.h"
+
+#define SAVEBLOCK_MOVE_RANGE 128
+
+/**
+ * These structs are to prevent them from being reordered on newer or modern
+ * toolchains. If this is not done, the ClearSav functions will end up erasing
+ * the wrong memory leading to various glitches.
+ */
+struct SaveBlock2DMA {
+ struct SaveBlock2 block;
+ u8 dma[SAVEBLOCK_MOVE_RANGE];
+};
+
+struct SaveBlock1DMA {
+ struct SaveBlock1 block;
+ u8 dma[SAVEBLOCK_MOVE_RANGE];
+};
+
+struct PokemonStorageDMA {
+ struct PokemonStorage block;
+ u8 dma[SAVEBLOCK_MOVE_RANGE];
+};
+
+extern struct SaveBlock1DMA gSaveblock1;
+extern struct SaveBlock2DMA gSaveblock2;
+extern struct PokemonStorageDMA gPokemonStorage;
extern bool32 gFlashMemoryPresent;
extern struct SaveBlock1 *gSaveBlock1Ptr;
@@ -24,8 +48,8 @@ void SavePlayerParty(void);
void LoadPlayerParty(void);
void SaveObjectEvents(void);
void LoadObjectEvents(void);
-void SaveSerializedGame(void);
-void LoadSerializedGame(void);
+void CopyPartyAndObjectsToSave(void);
+void CopyPartyAndObjectsFromSave(void);
void LoadPlayerBag(void);
void SavePlayerBag(void);
void ApplyNewEncryptionKeyToHword(u16 *hWord, u32 newKey);
diff --git a/include/menu.h b/include/menu.h
index eb391e565..69000d408 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -59,14 +59,14 @@ u32 GetPlayerTextSpeed(void);
u8 GetPlayerTextSpeedDelay(void);
void Menu_LoadStdPalAt(u16 arg0);
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16));
-void sub_8199DF0(u32 bg, u8 a1, int a2, int a3);
+void BgDmaFill(u32 bg, u8 a1, int a2, int a3);
void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str);
void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
void DrawStdFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette);
void ScheduleBgCopyTilemapToVram(u8 bgNum);
void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs);
-u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos);
+u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 numItems, u8 initialCursorPos);
u8 Menu_GetCursorPos(void);
s8 Menu_ProcessInput(void);
s8 Menu_ProcessInputNoWrap(void);
@@ -83,24 +83,23 @@ void DoScheduledBgTilemapCopiesToVram(void);
void ClearScheduledBgCopiesToVram(void);
void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str);
void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 a2, u8 a3);
-void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds);
+void PrintMenuActionTextsInUpperLeftCorner(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds);
void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram);
-u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16);
void *malloc_and_decompress(const void *src, u32 *sizeOut);
u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode);
void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress);
-void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8);
+void PrintMenuActionTexts(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8);
void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8);
u8 InitMenuActionGrid(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos);
-u8 ChangeListMenuCursorPosition(s8 deltaX, s8 deltaY);
+u8 ChangeMenuGridCursorPosition(s8 deltaX, s8 deltaY);
u8 GetStartMenuWindowId(void);
void ListMenuLoadStdPalAt(u8, u8);
u8 Menu_MoveCursor(s8 cursorDelta);
u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta);
void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram);
-u8 sub_81979C4(u8 a1);
-u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos);
-void sub_819786C(u8 windowId, bool8 copyToVram);
+u8 AddStartMenuWindow(u8 numActions);
+u8 InitMenuNormal(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos);
+void LoadMessageBoxAndFrameGfx(u8 windowId, bool8 copyToVram);
void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress);
void RemoveStartMenuWindow(void);
void DisplayYesNoMenuWithDefault(u8 initialCursorPos);
@@ -110,21 +109,21 @@ u8 GetMapNamePopUpWindowId(void);
u8 AddMapNamePopUpWindow(void);
void AddTextPrinterParameterized5(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 letterSpacing, u8 lineSpacing);
void SetBgTilemapPalette(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette);
-void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP);
-void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram);
-void sub_8197AE8(bool8 copyToVram);
+void AddValToTilemapBuffer(void *ptr, int delta, int width, int height, bool32 is8BPP);
+void EraseFieldMessageBox(bool8 copyToVram);
void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs);
-s8 Menu_ProcessInputGridLayout(void);
+s8 Menu_ProcessGridInput(void);
u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted);
s8 Menu_ProcessInputNoWrapAround_other(void);
void CopyToBufferFromBgTilemap(u8 bgId, u16 *dest, u8 left, u8 top, u8 width, u8 height);
-u8 sub_81980F0(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile);
-void sub_8198314(void);
-void sub_8198180(const u8 *string, u8 a2, bool8 copyToVram);
+u8 HofPCTopBar_AddWindow(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile);
+void HofPCTopBar_RemoveWindow(void);
+void HofPCTopBar_Print(const u8 *string, u8 left, bool8 copyToVram);
+void HofPCTopBar_PrintPair(const u8 *string, const u8 *string2, bool8 noBg, u8 left, bool8 copyToVram);
void ResetBgPositions(void);
void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed);
-void sub_8198C78(void);
-void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs);
+void EraseYesNoWindow(void);
+void PrintMenuActionTextsAtPos(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs);
void Menu_LoadStdPal(void);
#endif // GUARD_MENU_H
diff --git a/include/palette.h b/include/palette.h
index be2a0dd48..81a1e1cae 100644
--- a/include/palette.h
+++ b/include/palette.h
@@ -58,15 +58,9 @@ void FillPalette(u16, u16, u16);
void TransferPlttBuffer(void);
u8 UpdatePaletteFade(void);
void ResetPaletteFade(void);
-void ReadPlttIntoBuffers(void);
bool8 BeginNormalPaletteFade(u32, s8, u8, u8, u16);
-bool8 unref_sub_8073D3C(u32, u8, u8, u8, u16);
-void unref_sub_8073D84(u8, u32 *);
-void ResetPaletteStructByUid(u16);
-void ResetPaletteStruct(u8);
+void PaletteStruct_ResetById(u16);
void ResetPaletteFadeControl(void);
-void unref_sub_8074168(u16);
-void unref_sub_8074194(u16);
void InvertPlttBuffer(u32);
void TintPlttBuffer(u32, s8, s8, s8);
void UnfadePlttBuffer(u32);
diff --git a/include/pokeball.h b/include/pokeball.h
index d88e80173..297788db1 100644
--- a/include/pokeball.h
+++ b/include/pokeball.h
@@ -26,6 +26,8 @@ enum {
BALL_AFFINE_ANIM_4
};
+extern const struct CompressedSpriteSheet gBallSpriteSheets[];
+extern const struct CompressedSpritePalette gBallSpritePalettes[];
extern const struct SpriteTemplate gBallSpriteTemplates[];
#define POKEBALL_PLAYER_SENDOUT 0xFF
diff --git a/include/pokemon_icon.h b/include/pokemon_icon.h
index 4731da90e..9b917c3bf 100644
--- a/include/pokemon_icon.h
+++ b/include/pokemon_icon.h
@@ -2,6 +2,8 @@
#define GUARD_POKEMON_ICON_H
extern const u8 gMonIconPaletteIndices[];
+extern const u8 *const gMonIconTable[];
+extern const struct SpritePalette gMonIconPaletteTable[];
const u8 *GetMonIconTiles(u16 species, bool32);
void TryLoadAllMonIconPalettesAtOffset(u16 offset);
diff --git a/include/save.h b/include/save.h
index 406e2e492..be7961136 100644
--- a/include/save.h
+++ b/include/save.h
@@ -1,43 +1,43 @@
#ifndef GUARD_SAVE_H
#define GUARD_SAVE_H
-struct SaveSectionLocation
-{
- void *data;
- u16 size;
-};
-
-struct SaveSection
-{
- u8 data[0xFF4];
- u16 id;
- u16 checksum;
- u32 security;
- u32 counter;
-}; // size is 0x1000
-
-// headless save section?
-struct UnkSaveSection
-{
- u8 data[0xFF4];
- u32 security;
-}; // size is 0xFF8
-
-struct SaveSectionOffsets
-{
- u16 toAdd;
- u16 size;
-};
-
-// Each 4 KiB flash sector contains 3968 bytes of actual data followed by a 128 byte footer
+// Each 4 KiB flash sector contains 3968 bytes of actual data followed by a 128 byte footer.
+// Only 12 bytes of the footer are used.
#define SECTOR_DATA_SIZE 3968
#define SECTOR_FOOTER_SIZE 128
#define SECTOR_SIZE (SECTOR_DATA_SIZE + SECTOR_FOOTER_SIZE)
#define NUM_SAVE_SLOTS 2
-#define UNKNOWN_CHECK_VALUE 0x8012025
-#define SPECIAL_SECTION_SENTINEL 0xB39D
+// If the sector's security field is not this value then the sector is either invalid or empty.
+#define SECTOR_SECURITY_NUM 0x8012025
+
+#define SPECIAL_SECTOR_SENTINEL 0xB39D
+
+#define SECTOR_ID_SAVEBLOCK2 0
+#define SECTOR_ID_SAVEBLOCK1_START 1
+#define SECTOR_ID_SAVEBLOCK1_END 4
+#define SECTOR_ID_PKMN_STORAGE_START 5
+#define SECTOR_ID_PKMN_STORAGE_END 13
+#define NUM_SECTORS_PER_SLOT 14
+// Save Slot 1: 0-13; Save Slot 2: 14-27
+#define SECTOR_ID_HOF_1 28
+#define SECTOR_ID_HOF_2 29
+#define SECTOR_ID_TRAINER_HILL 30
+#define SECTOR_ID_RECORDED_BATTLE 31
+#define SECTORS_COUNT 32
+
+#define NUM_HOF_SECTORS 2
+
+#define SAVE_STATUS_EMPTY 0
+#define SAVE_STATUS_OK 1
+#define SAVE_STATUS_CORRUPT 2
+#define SAVE_STATUS_NO_FLASH 4
+#define SAVE_STATUS_ERROR 0xFF
+
+// Special sector id value for certain save functions to
+// indicate that no specific sector should be used.
+#define FULL_SAVE_SLOT 0xFFFF
// SetDamagedSectorBits states
enum
@@ -51,7 +51,7 @@ enum
enum
{
SAVE_NORMAL,
- SAVE_LINK,
+ SAVE_LINK, // Link / Battle Frontier
//EREADER_SAVE, // deprecated in Emerald
SAVE_LINK2, // unknown 2nd link save
SAVE_HALL_OF_FAME,
@@ -59,54 +59,55 @@ enum
SAVE_HALL_OF_FAME_ERASE_BEFORE // unused
};
-#define SECTOR_ID_SAVEBLOCK2 0
-#define SECTOR_ID_SAVEBLOCK1_START 1
-#define SECTOR_ID_SAVEBLOCK1_END 4
-#define SECTOR_ID_PKMN_STORAGE_START 5
-#define SECTOR_ID_PKMN_STORAGE_END 13
-#define NUM_SECTORS_PER_SLOT 14
-// Save Slot 1: 0-13; Save Slot 2: 14-27
-#define SECTOR_ID_HOF_1 28
-#define SECTOR_ID_HOF_2 29
-#define SECTOR_ID_TRAINER_HILL 30
-#define SECTOR_ID_RECORDED_BATTLE 31
-#define SECTORS_COUNT 32
+// A save sector location holds a pointer to the data for a particular sector
+// and the size of that data. Size cannot be greater than SECTOR_DATA_SIZE.
+struct SaveSectorLocation
+{
+ void *data;
+ u16 size;
+};
-#define SAVE_STATUS_EMPTY 0
-#define SAVE_STATUS_OK 1
-#define SAVE_STATUS_CORRUPT 2
-#define SAVE_STATUS_NO_FLASH 4
-#define SAVE_STATUS_ERROR 0xFF
+struct SaveSector
+{
+ u8 data[SECTOR_DATA_SIZE];
+ u8 unused[SECTOR_FOOTER_SIZE - 12]; // Unused portion of the footer
+ u16 id;
+ u16 checksum;
+ u32 security;
+ u32 counter;
+}; // size is SECTOR_SIZE (0x1000)
+
+#define SECTOR_SECURITY_OFFSET offsetof(struct SaveSector, security)
+#define SECTOR_COUNTER_OFFSET offsetof(struct SaveSector, counter)
extern u16 gLastWrittenSector;
extern u32 gLastSaveCounter;
extern u16 gLastKnownGoodSector;
extern u32 gDamagedSaveSectors;
extern u32 gSaveCounter;
-extern struct SaveSection *gFastSaveSection;
-extern u16 gUnknown_03006208;
+extern struct SaveSector *gFastSaveSector;
+extern u16 gIncrementalSectorId;
extern u16 gSaveFileStatus;
extern void (*gGameContinueCallback)(void);
-extern struct SaveSectionLocation gRamSaveSectionLocations[];
-extern u16 gUnknown_03006294;
+extern struct SaveSectorLocation gRamSaveSectorLocations[];
-extern struct SaveSection gSaveDataBuffer;
+extern struct SaveSector gSaveDataBuffer;
void ClearSaveData(void);
void Save_ResetSaveCounters(void);
u8 HandleSavingData(u8 saveType);
u8 TrySavingData(u8 saveType);
-bool8 sub_8153380(void);
-bool8 sub_81533AC(void);
-bool8 sub_81533E0(void);
-bool8 sub_8153408(void);
-bool8 FullSaveGame(void);
-bool8 CheckSaveFile(void);
-u8 Save_LoadGameData(u8 saveType);
+bool8 LinkFullSave_Init(void);
+bool8 LinkFullSave_WriteSector(void);
+bool8 LinkFullSave_ReplaceLastSector(void);
+bool8 LinkFullSave_SetLastSectorSecurity(void);
+bool8 WriteSaveBlock2(void);
+bool8 WriteSaveBlock1Sector(void);
+u8 LoadGameSave(u8 saveType);
u16 GetSaveBlocksPointersBaseOffset(void);
-u32 TryReadSpecialSaveSection(u8 sector, u8* dst);
-u32 TryWriteSpecialSaveSection(u8 sector, u8* src);
-void Task_LinkSave(u8 taskId);
+u32 TryReadSpecialSaveSector(u8 sector, u8* dst);
+u32 TryWriteSpecialSaveSector(u8 sector, u8* src);
+void Task_LinkFullSave(u8 taskId);
// save_failed_screen.c
void DoSaveFailedScreen(u8 saveType);
diff --git a/include/sound.h b/include/sound.h
index 25ffa2d6e..a5463a456 100644
--- a/include/sound.h
+++ b/include/sound.h
@@ -1,26 +1,7 @@
#ifndef GUARD_SOUND_H
#define GUARD_SOUND_H
-enum {
- FANFARE_LEVEL_UP,
- FANFARE_OBTAIN_ITEM,
- FANFARE_EVOLVED,
- FANFARE_OBTAIN_TMHM,
- FANFARE_HEAL,
- FANFARE_OBTAIN_BADGE,
- FANFARE_MOVE_DELETED,
- FANFARE_OBTAIN_BERRY,
- FANFARE_AWAKEN_LEGEND,
- FANFARE_SLOTS_JACKPOT,
- FANFARE_SLOTS_WIN,
- FANFARE_TOO_BAD,
- FANFARE_RG_POKE_FLUTE,
- FANFARE_RG_OBTAIN_KEY_ITEM,
- FANFARE_RG_DEX_RATING,
- FANFARE_OBTAIN_B_POINTS,
- FANFARE_OBTAIN_SYMBOL,
- FANFARE_REGISTER_MATCH_CALL,
-};
+#include "constants/sound.h"
void InitMapMusic(void);
void MapMusicMain(void);
@@ -44,12 +25,12 @@ bool8 IsBGMPausedOrStopped(void);
void FadeInBGM(u8 speed);
void FadeOutBGM(u8 speed);
bool8 IsBGMStopped(void);
-void PlayCry1(u16 species, s8 pan);
-void PlayCry2(u16 species, s8 pan, s8 volume, u8 priority);
-void PlayCry3(u16 species, s8 pan, u8 mode);
-void PlayCry4(u16 species, s8 pan, u8 mode);
-void PlayCry5(u16 species, u8 mode);
-void PlayCry6(u16 species, s8 pan, u8 mode);
+void PlayCry_Normal(u16 species, s8 pan);
+void PlayCry_NormalNoDucking(u16 species, s8 pan, s8 volume, u8 priority);
+void PlayCry_ByMode(u16 species, s8 pan, u8 mode);
+void PlayCry_ReleaseDouble(u16 species, s8 pan, u8 mode);
+void PlayCry_Script(u16 species, u8 mode);
+void PlayCry_DuckNoRestore(u16 species, s8 pan, u8 mode);
void PlayCryInternal(u16 species, s8 pan, s8 volume, u8 priority, u8 mode);
bool8 IsCryFinished(void);
void StopCryAndClearCrySongs(void);
diff --git a/include/strings.h b/include/strings.h
index 7317f8aac..845e96a8c 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -611,6 +611,10 @@ extern const u8 gText_PlayersBattleResults[];
extern const u8 gText_WinLoseDraw[];
extern const u8 gText_ColorTransparent[];
extern const u8 gText_Slash[];
+extern const u8 gText_HealthboxNickname[];
+extern const u8 gText_HealthboxGender_None[];
+extern const u8 gText_HealthboxGender_Male[];
+extern const u8 gText_HealthboxGender_Female[];
extern const u8 gText_99TimesPlus[];
extern const u8 gText_1MinutePlus[];