diff options
Diffstat (limited to 'include')
36 files changed, 239 insertions, 200 deletions
diff --git a/include/battle_anim.h b/include/battle_anim.h index 248e2a9f5..fc0f603eb 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -94,7 +94,7 @@ void sub_80A66DC(struct Sprite *sprite); void SetSpriteCoordsToAnimAttackerCoords(struct Sprite *sprite); void RunStoredCallbackWhenAnimEnds(struct Sprite *sprite); void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 a2); -s16 sub_80A861C(u8 battlerId, u8 a2); +s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 a2); u8 GetBattlerYCoordWithElevation(u8 battlerId); void WaitAnimForDuration(struct Sprite *sprite); void sub_80A7938(struct Sprite *sprite); @@ -122,7 +122,7 @@ s16 CloneBattlerSpriteWithBlend(u8); void obj_delete_but_dont_free_vram(struct Sprite*); u8 sub_80A89C8(int, u8, int); void sub_80A6D60(struct UnknownAnimStruct2*, const void*, u32); -void sub_80A6CC0(u32, const void*, u32); +void sub_80A6CC0(u32, const u32*, u32); void sub_80A6DAC(bool8); void TranslateSpriteInGrowingCircleOverDuration(struct Sprite *); void sub_80A653C(struct Sprite *); @@ -147,8 +147,9 @@ void sub_80A78AC(struct Sprite *sprite); void sub_80A6BFC(struct UnknownAnimStruct2 *unk, u8 unused); u8 sub_80A8394(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, u32 a10); void sub_80A749C(struct Sprite *sprite); -void sub_80A6814(u8 taskId); -void sub_80A8610(struct Sprite *sprite); +void sub_80A6DEC(struct Sprite *sprite); +void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); +void DestroySpriteAndFreeResources_(struct Sprite *sprite); void SetBattlerSpriteYOffsetFromOtherYScale(u8 spriteId, u8 otherSpriteId); enum @@ -160,6 +161,17 @@ enum BATTLER_COORD_Y_PIC_OFFSET_DEFAULT, }; +enum +{ + BATTLER_COORD_ATTR_HEIGHT, + BATTLER_COORD_ATTR_WIDTH, + BATTLER_COORD_ATTR_TOP, + BATTLER_COORD_ATTR_BOTTOM, + BATTLER_COORD_ATTR_LEFT, + BATTLER_COORD_ATTR_RIGHT, + BATTLER_COORD_ATTR_RAW_BOTTOM, +}; + u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); bool8 IsBattlerSpritePresent(u8 battlerId); @@ -198,7 +210,7 @@ u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, // battle_anim_utility_funcs.s void sub_8116EB4(u8); -void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u8 *arg8, const u8 *arg9, const u16 *palette); +void sub_8117854(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette); u32 UnpackSelectedBattleAnimPalettes(s16); diff --git a/include/berry.h b/include/berry.h index bef56ae41..ee581b9c1 100644 --- a/include/berry.h +++ b/include/berry.h @@ -46,7 +46,7 @@ bool32 IsEnigmaBerryValid(void); const struct Berry *GetBerryInfo(u8 berry); struct BerryTree *GetBerryTreeInfo(u8 id); bool32 EventObjectInteractionWaterBerryTree(void); -bool8 IsPlayerFacingPlantedBerryTree(void); +bool8 IsPlayerFacingEmptyBerryTreePatch(void); bool8 TryToWaterBerryTree(void); void ClearBerryTrees(void); void BerryTreeTimeUpdate(s32 minutes); diff --git a/include/bg.h b/include/bg.h index ffcaf43ed..1366923f1 100644 --- a/include/bg.h +++ b/include/bg.h @@ -13,14 +13,16 @@ struct BGCntrlBitfield // for the I/O registers enum { - BG_CTRL_ATTR_VISIBLE = 1, - BG_CTRL_ATTR_CHARBASEINDEX = 2, - BG_CTRL_ATTR_MAPBASEINDEX = 3, - BG_CTRL_ATTR_SCREENSIZE = 4, - BG_CTRL_ATTR_PALETTEMODE = 5, - BG_CTRL_ATTR_PRIORITY = 6, - BG_CTRL_ATTR_MOSAIC = 7, - BG_CTRL_ATTR_WRAPAROUND = 8, + BG_ATTR_CHARBASEINDEX = 1, + BG_ATTR_MAPBASEINDEX, + BG_ATTR_SCREENSIZE, + BG_ATTR_PALETTEMODE, + BG_ATTR_MOSAIC, + BG_ATTR_WRAPAROUND, + BG_ATTR_PRIORITY, + BG_ATTR_METRIC, + BG_ATTR_TYPE, + BG_ATTR_BASETILE, }; struct BgTemplate @@ -38,8 +40,6 @@ void ResetBgs(void); u8 GetBgMode(void); void ResetBgControlStructs(void); void Unused_ResetBgControlStruct(u8 bg); -void SetBgControlAttributes(u8 bg, u8 charBaseIndex, u8 mapBaseIndex, u8 screenSize, u8 paletteMode, u8 priority, u8 mosaic, u8 wraparound); -u16 GetBgControlAttribute(u8 bg, u8 attributeId); u8 LoadBgVram(u8 bg, const void *src, u16 size, u16 destOffset, u8 mode); void SetTextModeAndHideBgs(void); bool8 IsInvalidBg(u8 bg); diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index 7a97c4caf..9973477da 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -241,12 +241,26 @@ #define EVENT_OBJ_GFX_LUGIA 237 #define EVENT_OBJ_GFX_HOOH 238 #define EVENT_OBJ_GFX_BARD_2 239 -#define EVENT_OBJ_GFX_HIPSTER 240 -#define EVENT_OBJ_GFX_TRADER 241 -#define EVENT_OBJ_GFX_STORYTELLER 242 -#define EVENT_OBJ_GFX_GIDDY 243 -#define EVENT_OBJ_GFX_PLACEHOLDER_1 244 -#define EVENT_OBJ_GFX_PLACEHOLDER_2 245 + +// These are dynamic object gfx ids. +// They correspond with the values of the VAR_OBJ_GFX_ID_X vars. +// More info about them in include/constants/vars.h +#define EVENT_OBJ_GFX_VAR_0 240 +#define EVENT_OBJ_GFX_VAR_1 241 +#define EVENT_OBJ_GFX_VAR_2 242 +#define EVENT_OBJ_GFX_VAR_3 243 +#define EVENT_OBJ_GFX_VAR_4 244 +#define EVENT_OBJ_GFX_VAR_5 245 +#define EVENT_OBJ_GFX_VAR_6 246 +#define EVENT_OBJ_GFX_VAR_7 247 +#define EVENT_OBJ_GFX_VAR_8 248 +#define EVENT_OBJ_GFX_VAR_9 249 +#define EVENT_OBJ_GFX_VAR_A 250 +#define EVENT_OBJ_GFX_VAR_B 251 +#define EVENT_OBJ_GFX_VAR_C 252 +#define EVENT_OBJ_GFX_VAR_D 253 +#define EVENT_OBJ_GFX_VAR_E 254 +#define EVENT_OBJ_GFX_VAR_F 255 #define SHADOW_SIZE_S 0 #define SHADOW_SIZE_M 1 diff --git a/include/constants/field_effects.h b/include/constants/field_effects.h index b93b98201..add195df8 100644 --- a/include/constants/field_effects.h +++ b/include/constants/field_effects.h @@ -67,6 +67,6 @@ #define FLDEFF_USE_TELEPORT 63 #define FLDEFF_64 64 #define FLDEFF_65 65 -#define FLDEFF_66 66 +#define FLDEFF_MOVE_DEOXYS_ROCK 66 #endif diff --git a/include/constants/flags.h b/include/constants/flags.h index 0c5fda495..35453384b 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1396,7 +1396,7 @@ #define FLAG_SYS_FRONTIER_PASS (SYSTEM_FLAGS + 0x72) #define FLAG_MAP_SCRIPT_CHECKED_DEOXYS (SYSTEM_FLAGS + 0x73) -#define FLAG_0x8D4 (SYSTEM_FLAGS + 0x74) +#define FLAG_DEOXYS_ROCK_COMPLETE (SYSTEM_FLAGS + 0x74) #define FLAG_ENABLE_SHIP_BIRTH_ISLAND (SYSTEM_FLAGS + 0x75) #define FLAG_ENABLE_SHIP_FARAWAY_ISLAND (SYSTEM_FLAGS + 0x76) diff --git a/include/constants/global.h b/include/constants/global.h new file mode 100644 index 000000000..ff28d6a4b --- /dev/null +++ b/include/constants/global.h @@ -0,0 +1,77 @@ +#ifndef GUARD_CONSTANTS_GLOBAL_H +#define GUARD_CONSTANTS_GLOBAL_H +// Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. +// In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. +// In Gen 4 only, migrated Pokemon with Diamond, Pearl, or Platinum's ID show as "----------". +// Gen 5 and up read Diamond, Pearl, or Platinum's ID as "Sinnoh". +// In Gen 4 and up, migrated Pokemon with HeartGold or SoulSilver's ID show the otherwise unused "Johto" string. +#define VERSION_SAPPHIRE 1 +#define VERSION_RUBY 2 +#define VERSION_EMERALD 3 +#define VERSION_FIRE_RED 4 +#define VERSION_LEAF_GREEN 5 +#define VERSION_HEART_GOLD 7 +#define VERSION_SOUL_SILVER 8 +#define VERSION_DIAMOND 10 +#define VERSION_PEARL 11 +#define VERSION_PLATINUM 12 +#define VERSION_GAMECUBE 15 + +#define LANGUAGE_JAPANESE 1 +#define LANGUAGE_ENGLISH 2 +#define LANGUAGE_FRENCH 3 +#define LANGUAGE_ITALIAN 4 +#define LANGUAGE_GERMAN 5 +#define LANGUAGE_KOREAN 6 // 6 goes unused but the theory is it was meant to be Korean +#define LANGUAGE_SPANISH 7 + +#define GAME_VERSION (VERSION_EMERALD) +#define GAME_LANGUAGE (LANGUAGE_ENGLISH) + +// capacities of various saveblock objects +#define DAYCARE_MON_COUNT 2 +#define POKEBLOCKS_COUNT 40 +#define EVENT_OBJECTS_COUNT 16 +#define BERRY_TREES_COUNT 128 +#define FLAGS_COUNT 300 +#define VARS_COUNT 256 +#define MAIL_COUNT 16 +#define SECRET_BASES_COUNT 20 +#define TV_SHOWS_COUNT 25 +#define POKE_NEWS_COUNT 16 +#define PC_ITEMS_COUNT 50 +#define BAG_ITEMS_COUNT 30 +#define BAG_KEYITEMS_COUNT 30 +#define BAG_POKEBALLS_COUNT 16 +#define BAG_TMHM_COUNT 64 +#define BAG_BERRIES_COUNT 46 +#define EVENT_OBJECT_TEMPLATES_COUNT 64 + +#define PYRAMID_BAG_ITEMS_COUNT 10 +#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode. + +// string lengths +#define ITEM_NAME_LENGTH 14 +#define POKEMON_NAME_LENGTH 10 +#define PLAYER_NAME_LENGTH 7 +#define MAIL_WORDS_COUNT 9 +#define MOVE_NAME_LENGTH 12 + +#define MALE 0 +#define FEMALE 1 + +#define OPTIONS_BUTTON_MODE_NORMAL 0 +#define OPTIONS_BUTTON_MODE_LR 1 +#define OPTIONS_BUTTON_MODE_L_EQUALS_A 2 + +#define OPTIONS_TEXT_SPEED_SLOW 0 +#define OPTIONS_TEXT_SPEED_MID 1 +#define OPTIONS_TEXT_SPEED_FAST 2 + +#define OPTIONS_SOUND_MONO 0 +#define OPTIONS_SOUND_STEREO 1 + +#define OPTIONS_BATTLE_STYLE_SHIFT 0 +#define OPTIONS_BATTLE_STYLE_SET 1 + +#endif // GUARD_CONSTANTS_GLOBAL_H diff --git a/include/constants/rgb.h b/include/constants/rgb.h index fd9c5c5a7..80d951f4b 100644 --- a/include/constants/rgb.h +++ b/include/constants/rgb.h @@ -2,6 +2,7 @@ #define GUARD_RGB_H #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)) #define RGB_BLACK RGB(0, 0, 0) @@ -12,6 +13,6 @@ #define RGB_YELLOW RGB(31, 31, 0) #define RGB_MAGENTA RGB(31, 0, 31) #define RGB_CYAN RGB(0, 31, 31) -#define RGB_WHITEALPHA RGB_WHITE | 0x8000 +#define RGB_WHITEALPHA (RGB_WHITE | 0x8000) #endif // GUARD_RGB_H diff --git a/include/constants/songs.h b/include/constants/songs.h index 58a8e725c..a459edd24 100644 --- a/include/constants/songs.h +++ b/include/constants/songs.h @@ -536,6 +536,6 @@ #define PH_NURSE_HELD 608 #define PH_NURSE_SOLO 609 -#define MUS_ROUTE_118 0x7FFF // What is this for? +#define MUS_ROUTE_118 0x7FFF // map is split into 2 music sections. controlled by GetCurrLocationDefaultMusic(). #endif // GUARD_CONSTANTS_SONGS_H diff --git a/include/constants/vars.h b/include/constants/vars.h index faffe7c70..30df01f55 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -68,8 +68,8 @@ #define VAR_FRONTIER_GAMBLER_AMOUNT_BET 0x4032 #define VAR_FRONTIER_GAMBLER_PLACED_BET_F 0x4033 -#define VAR_0x4034 0x4034 -#define VAR_0x4035 0x4035 +#define VAR_DEOXYS_ROCK_STEP_COUNT 0x4034 +#define VAR_DEOXYS_ROCK_LEVEL 0x4035 #define VAR_STORAGE_UNKNOWN 0x4036 #define VAR_0x4037 0x4037 #define VAR_0x4038 0x4038 @@ -81,8 +81,8 @@ #define VAR_ALTERING_CAVE_WILD_SET 0x403E #define VAR_0x403F 0x403F #define VAR_DAYS 0x4040 -#define VAR_FANCLUB_UNKNOWN_1 0x4041 -#define VAR_FANCLUB_UNKNOWN_2 0x4042 +#define VAR_FANCLUB_UNKNOWN_1 0x4041 +#define VAR_FANCLUB_UNKNOWN_2 0x4042 #define VAR_DEPT_STORE_FLOOR 0x4043 #define VAR_0x4044 0x4044 #define VAR_POKELOT_PRIZE 0x4045 diff --git a/include/data2.h b/include/data2.h index 268dc9ac8..37ce5bf20 100644 --- a/include/data2.h +++ b/include/data2.h @@ -1,8 +1,6 @@ #ifndef GUARD_DATA2_H #define GUARD_DATA2_H -#define MOVE_NAME_LENGTH 12 - struct MonCoords { // This would use a bitfield, but some function diff --git a/include/event_scripts.h b/include/event_scripts.h index 3dcb7f929..e611dc6e0 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -538,7 +538,7 @@ extern const u8 EventScript_TV[]; extern const u8 EventScript_ClosedSootopolisDoor[]; extern const u8 SkyPillar_Outside_EventScript_2393F9[]; extern const u8 EventScript_CableBoxResults[]; -extern const u8 EventScript_2A4BAC[]; +extern const u8 EventScript_PokeBlockFeeder[]; extern const u8 Route110_TrickHouseEntrance_EventScript_26A22A[]; extern const u8 EventScript_RegionMap[]; extern const u8 EventScript_RunningShoesManual[]; diff --git a/include/field_control_avatar.h b/include/field_control_avatar.h index 24adbe4b3..3cc4a8324 100644 --- a/include/field_control_avatar.h +++ b/include/field_control_avatar.h @@ -7,8 +7,8 @@ struct FieldInput bool8 checkStandardWildEncounter:1; bool8 pressedStartButton:1; bool8 pressedSelectButton:1; - bool8 input_field_0_4:1; - bool8 input_field_0_5:1; + bool8 heldDirection:1; + bool8 heldDirection2:1; bool8 tookStep:1; bool8 pressedBButton:1; bool8 input_field_1_0:1; @@ -20,7 +20,6 @@ struct FieldInput bool8 input_field_1_6:1; bool8 input_field_1_7:1; u8 dpadDirection; - u8 input_field_3; }; void FieldClearPlayerInput(struct FieldInput *pStruct); diff --git a/include/field_screen_effect.h b/include/field_screen_effect.h index f3ac2e866..3daf8d892 100644 --- a/include/field_screen_effect.h +++ b/include/field_screen_effect.h @@ -19,11 +19,11 @@ void sub_80AF688(void); bool8 sub_80AF6A4(void); void sub_80AF6D4(void); void sub_80AF6F0(void); -void sub_80AF734(void); -void sp13E_warp_to_last_warp(void); +void DoWarp(void); +void DoDiveWarp(void); void sub_80AF79C(void); -void sub_80AF7D0(void); -void sp13F_fall_to_last_warp(void); +void DoDoorWarp(void); +void DoFallWarp(void); void sub_80AF80C(u8 metatileBehavior); void sub_80AF828(void); void sub_80AF838(void); diff --git a/include/field_specials.h b/include/field_specials.h index 7c29ecbad..10433299b 100644 --- a/include/field_specials.h +++ b/include/field_specials.h @@ -6,7 +6,7 @@ u8 sub_813B260(void); u16 get_unknown_box_id(void); bool8 InMultiBattleRoom(void); void sub_813BF10(void); -void increment_var_x4026_on_birth_island_modulo_100(void); +void IncrementBirthIslandRockStepCount(void); bool8 sub_813B3B0(void); bool8 ShouldDoBrailleRegicePuzzle(void); bool32 is_tile_that_overrides_player_control(void); diff --git a/include/fieldmap.h b/include/fieldmap.h index a50c79b43..3f5cc5ec8 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -7,8 +7,9 @@ #define NUM_METATILES_TOTAL 1024 #define NUM_PALS_IN_PRIMARY 6 #define NUM_PALS_TOTAL 13 +#define MAX_MAP_DATA_SIZE 0x2800 -extern struct BackupMapLayout gUnknown_03005DC0; +extern struct BackupMapLayout gBackupMapLayout; u32 MapGridGetMetatileIdAt(int, int); u32 MapGridGetMetatileBehaviorAt(int, int); @@ -19,23 +20,19 @@ bool8 MapGridIsImpassableAt(int, int); int GetMapBorderIdAt(int x, int y); int CanCameraMoveInDirection(int direction); u16 GetBehaviorByMetatileId(u16 metatileId); -void sav1_camera_get_focus_coords(u16 *x, u16 *y); +void GetCameraFocusCoords(u16 *x, u16 *y); u8 MapGridGetMetatileLayerTypeAt(s32 x, s32 y); u8 MapGridGetZCoordAt(int x, int y); u8 CameraMove(s32 deltaX, s32 deltaY); -void mapheader_copy_mapdata_with_padding(struct MapHeader *mapHeader); -void map_copy_with_padding(u16 *map, u16 width, u16 height); -void mapheader_copy_mapdata_of_adjacent_maps(struct MapHeader *); -void fillSouthConnection(struct MapHeader const *, struct MapHeader const *, s32); -void fillNorthConnection(struct MapHeader const *, struct MapHeader const *, s32); -void fillWestConnection(struct MapHeader const *, struct MapHeader const *, s32); -void fillEastConnection(struct MapHeader const *, struct MapHeader const *, s32); -void mapdata_from_sav2(void); -bool8 sub_8088BF0(u16*, u16, u8); struct MapConnection *sub_8088950(u8 direction, int x, int y); bool8 sub_80889A8(u8 direction, int x, int y, struct MapConnection *connection); bool8 sub_8088A0C(int x, int src_width, int dest_width, int offset); void save_serialize_map(void); +void sub_8088B3C(u16 x, u16 y); +void InitMap(void); +void InitMapFromSavedGame(void); +void InitTrainerHillMap(void); +void InitBattlePyramidMap(u8 a0); void SpriteCB_PokeballGlow(struct Sprite *); void SpriteCB_PokecenterMonitor(struct Sprite *); diff --git a/include/fldeff.h b/include/fldeff.h index 99758fdb5..e095396a4 100644 --- a/include/fldeff.h +++ b/include/fldeff.h @@ -6,8 +6,8 @@ bool8 SetUpFieldMove_Cut(void); bool8 FldEff_UseCutOnGrass(void); bool8 FldEff_UseCutOnTree(void); bool8 FldEff_CutGrass(void); -void sub_80D423C(s16 x, s16 y); -void sub_80D42B8(s16 x, s16 y); +void FixLongGrassMetatilesWindowTop(s16 x, s16 y); +void FixLongGrassMetatilesWindowBottom(s16 x, s16 y); extern const struct SpritePalette gFieldEffectObjectPaletteInfo6; diff --git a/include/gba/defines.h b/include/gba/defines.h index 16f1315d0..b68a2ad1e 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -66,6 +66,4 @@ #define TOTAL_OBJ_TILE_COUNT 1024 -#define WIN_RANGE(a, b) (((a) << 8) | (b)) - #endif // GUARD_GBA_DEFINES diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h index c20b69886..df79b084d 100644 --- a/include/gba/io_reg.h +++ b/include/gba/io_reg.h @@ -576,6 +576,9 @@ #define WINOUT_WINOBJ_OBJ (1 << 12) #define WINOUT_WINOBJ_CLR (1 << 13) +#define WIN_RANGE(a, b) (((a) << 8) | (b)) +#define WIN_RANGE2(a, b) ((b) | ((a) << 8)) + // BLDCNT // Bits 0-5 select layers for the 1st target #define BLDCNT_TGT1_BG0 (1 << 0) diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 5ed9b250a..74a8363bb 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -137,8 +137,7 @@ struct MapHeader /* 0x15 */ u8 cave; /* 0x16 */ u8 weather; /* 0x17 */ u8 mapType; - /* 0x18 */ u8 filler_18; - /* 0x19 */ u8 escapeRope; + /* 0x18 */ u8 filler_18[2]; /* 0x1A */ u8 flags; /* 0x1B */ u8 battleType; }; diff --git a/include/global.h b/include/global.h index 090ba7ce4..c11bddc2d 100644 --- a/include/global.h +++ b/include/global.h @@ -4,6 +4,7 @@ #include <string.h> #include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" +#include "constants/global.h" // Prevent cross-jump optimization. #define BLOCK_CROSS_JUMP asm(""); @@ -93,100 +94,6 @@ f; \ }) -// Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen. -// In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen. -// In Gen 4 only, migrated Pokemon with Diamond, Pearl, or Platinum's ID show as "----------". -// Gen 5 and up read Diamond, Pearl, or Platinum's ID as "Sinnoh". -// In Gen 4 and up, migrated Pokemon with HeartGold or SoulSilver's ID show the otherwise unused "Johto" string. -enum -{ - VERSION_SAPPHIRE = 1, - VERSION_RUBY = 2, - VERSION_EMERALD = 3, - VERSION_FIRE_RED = 4, - VERSION_LEAF_GREEN = 5, - VERSION_HEART_GOLD = 7, - VERSION_SOUL_SILVER = 8, - VERSION_DIAMOND = 10, - VERSION_PEARL = 11, - VERSION_PLATINUM = 12, - VERSION_GAMECUBE = 15, -}; - -enum LanguageId -{ - LANGUAGE_JAPANESE = 1, - LANGUAGE_ENGLISH = 2, - LANGUAGE_FRENCH = 3, - LANGUAGE_ITALIAN = 4, - LANGUAGE_GERMAN = 5, - // 6 goes unused but the theory is it was meant to be Korean - LANGUAGE_SPANISH = 7, -}; - -#define GAME_VERSION (VERSION_EMERALD) -#define GAME_LANGUAGE (LANGUAGE_ENGLISH) - -// capacities of various saveblock objects -#define DAYCARE_MON_COUNT 2 -#define POKEBLOCKS_COUNT 40 -#define EVENT_OBJECTS_COUNT 16 -#define BERRY_TREES_COUNT 128 -#define FLAGS_COUNT 300 -#define VARS_COUNT 256 -#define MAIL_COUNT 16 -#define SECRET_BASES_COUNT 20 -#define TV_SHOWS_COUNT 25 -#define POKE_NEWS_COUNT 16 -#define PC_ITEMS_COUNT 50 -#define BAG_ITEMS_COUNT 30 -#define BAG_KEYITEMS_COUNT 30 -#define BAG_POKEBALLS_COUNT 16 -#define BAG_TMHM_COUNT 64 -#define BAG_BERRIES_COUNT 46 -#define EVENT_OBJECT_TEMPLATES_COUNT 64 - -#define PYRAMID_BAG_ITEMS_COUNT 10 -#define HALL_FACILITIES_COUNT 9 // 7 facilities for single mode + tower double mode + tower multi mode. - -// string lengths -#define ITEM_NAME_LENGTH 14 -#define POKEMON_NAME_LENGTH 10 -#define PLAYER_NAME_LENGTH 7 -#define MAIL_WORDS_COUNT 9 - -enum -{ - MALE, - FEMALE -}; - -enum -{ - OPTIONS_BUTTON_MODE_NORMAL, - OPTIONS_BUTTON_MODE_LR, - OPTIONS_BUTTON_MODE_L_EQUALS_A -}; - -enum -{ - OPTIONS_TEXT_SPEED_SLOW, - OPTIONS_TEXT_SPEED_MID, - OPTIONS_TEXT_SPEED_FAST -}; - -enum -{ - OPTIONS_SOUND_MONO, - OPTIONS_SOUND_STEREO -}; - -enum -{ - OPTIONS_BATTLE_STYLE_SHIFT, - OPTIONS_BATTLE_STYLE_SET -}; - struct Coords8 { s8 x; @@ -521,7 +428,7 @@ struct SaveBlock2 { /*0x00*/ u8 playerName[PLAYER_NAME_LENGTH + 1]; /*0x08*/ u8 playerGender; // MALE, FEMALE - /*0x09*/ u8 specialSaveWarp; + /*0x09*/ u8 specialSaveWarpFlags; /*0x0A*/ u8 playerTrainerId[4]; /*0x0E*/ u16 playTimeHours; /*0x10*/ u8 playTimeMinutes; @@ -889,10 +796,10 @@ struct SaveBlock1 { /*0x00*/ struct Coords16 pos; /*0x04*/ struct WarpData location; - /*0x0C*/ struct WarpData warp1; - /*0x14*/ struct WarpData warp2; - /*0x1C*/ struct WarpData lastHealLocation; - /*0x24*/ struct WarpData warp4; + /*0x0C*/ struct WarpData continueGameWarp; + /*0x14*/ struct WarpData dynamicWarp; + /*0x1C*/ struct WarpData lastHealLocation; // used by white-out and teleport + /*0x24*/ struct WarpData escapeWarp; // used by Dig and Escape Rope /*0x2C*/ u16 savedMusic; /*0x2E*/ u8 weather; /*0x2F*/ u8 weatherCycleStage; diff --git a/include/graphics.h b/include/graphics.h index 5cb6354aa..ad2b39260 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3071,7 +3071,7 @@ extern const u32 gTrainerBackPicPalette_Leaf[]; // pokeblock extern const u32 gMenuPokeblock_Gfx[]; -extern const u8 gMenuPokeblock_Pal[]; +extern const u32 gMenuPokeblock_Pal[]; extern const u32 gMenuPokeblock_Tilemap[]; extern const u32 gMenuPokeblockDevice_Gfx[]; extern const u32 gMenuPokeblockDevice_Pal[]; @@ -3859,8 +3859,8 @@ extern const u8 gFireRedMenuElements_Gfx[]; // item menu graphics extern const u32 gBagScreen_Gfx[]; -extern const u16 gBagScreenFemale_Pal[]; -extern const u16 gBagScreenMale_Pal[]; +extern const u32 gBagScreenFemale_Pal[]; +extern const u32 gBagScreenMale_Pal[]; extern const u8 gBagMenuHMIcon_Gfx[]; // item menu icons graphics @@ -3914,7 +3914,7 @@ extern const u32 gIntro2FlygonGfx[]; // party menu graphics extern const u32 gPartyMenuMisc_Gfx[]; extern const u32 gPartyMenuMisc_Tilemap[]; -extern const u8 gPartyMenuMisc_Pal[]; +extern const u32 gPartyMenuMisc_Pal[]; // berry pics extern const u32 gBerryPic_Cheri[]; @@ -4105,6 +4105,10 @@ extern const u32 gUnknown_08D83C3C[]; extern const u32 gUnknown_08D83900[]; extern const u32 gBattleFrontierGfx_DomeOptions[]; +extern const u32 gUnknown_08D854E8[]; +extern const u32 gUnknown_08D855E8[]; +extern const u32 gContest2Pal[]; + extern const u32 gBattleAnimSpriteSheet_000[]; extern const u32 gBattleAnimSpriteSheet_001[]; extern const u32 gBattleAnimSpriteSheet_002[]; @@ -4626,9 +4630,9 @@ extern const u32 gBattleAnimSpritePalette_241[]; extern const u32 gBattleAnimSpritePalette_242[]; extern const u32 gBattleAnimSpritePalette_243[]; extern const u32 gBattleAnimSpritePalette_244[]; -extern const u8 gUnknown_08C2DC68[]; -extern const u16 gUnknown_08C2DDA4[]; -extern const u8 gUnknown_08C2DDC4[]; +extern const u32 gCureBubblesGfx[]; +extern const u32 gCureBubblesPal[]; +extern const u32 gCureBubblesTilemap[]; extern const u32 gBattleAnimSpritePalette_245[]; extern const u32 gBattleAnimSpritePalette_248[]; extern const u32 gBattleAnimSpritePalette_249[]; @@ -4797,6 +4801,16 @@ extern const u32 gCableCarDoor_Gfx[]; extern const u32 gCableCarCord_Gfx[]; extern const u16 gCableCar_Pal[]; +// Trade +extern const u16 gUnknown_08DDB3E4[]; +extern const u8 gUnknown_08DDB464[]; +extern const u16 gUnknown_08DDCF04[]; +extern const u16 gTradeGba2_Pal[]; +extern const u8 gTradeGba_Gfx[]; +extern const u16 gUnknown_08DDD704[]; +extern const u8 gUnknown_08DDC6E4[]; +extern const u16 gUnknown_08DDB444[]; + // Party menu extern const u32 gPartyMenuPokeball_Gfx[]; extern const u32 gPartyMenuPokeballSmall_Gfx[]; diff --git a/include/librfu.h b/include/librfu.h index 49df42541..38c819835 100644 --- a/include/librfu.h +++ b/include/librfu.h @@ -255,6 +255,6 @@ void rfu_REQ_recvData(void); void rfu_UNI_readySendData(u8 a0); void rfu_UNI_clearRecvNewDataFlag(u8 a0); void rfu_REQ_PARENT_resumeRetransmitAndChange(void); -void rfu_NI_setSendData(u8, u8, u8 *, u8); +void rfu_NI_setSendData(u8, u8, const void *, u32); #endif // GUARD_LIBRFU_H diff --git a/include/link.h b/include/link.h index f12f0990f..9552f062c 100644 --- a/include/link.h +++ b/include/link.h @@ -240,7 +240,7 @@ void SerialCB(void); u8 GetLinkPlayerCount(void); bool32 InUnionRoom(void); void sub_800E0E8(void); -bool8 sub_800A520(void); +bool8 IsLinkTaskFinished(void); void CreateWirelessStatusIndicatorSprite(u8, u8); void sub_800ADF8(void); void sub_800B488(void); @@ -311,5 +311,6 @@ void sub_800AD10(void); void sub_800AB18(void); void sub_8009F18(void); bool8 sub_800AA60(void); +void sub_800ABF4(u16 a0); #endif // GUARD_LINK_H diff --git a/include/link_rfu.h b/include/link_rfu.h index e394e2611..715b4cdd9 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -279,5 +279,7 @@ void sub_8011DE0(u32 arg0); u8 sub_801100C(int a0); void sub_800EF7C(void); bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); +s32 sub_800E87C(u8 idx); +void sub_8011BA4(void); #endif //GUARD_LINK_RFU_H diff --git a/include/load_save.h b/include/load_save.h index c64a1179b..bf50bffd7 100644 --- a/include/load_save.h +++ b/include/load_save.h @@ -15,11 +15,11 @@ void ClearSav2(void); void ClearSav1(void); void SetSaveBlocksPointers(u16 offset); void MoveSaveBlocks_ResetHeap(void); -u32 GetSecretBase2Field_9(void); -void ClearSecretBase2Field_9(void); -void SetSecretBase2Field_9(void); -void sub_8076D5C(void); -void sav2_gender2_inplace_and_xFE(void); +u32 UseContinueGameWarp(void); +void ClearContinueGameWarpStatus(void); +void SetContinueGameWarpStatus(void); +void SetContinueGameWarpStatusToDynamicWarp(void); +void ClearContinueGameWarpStatus2(void); void SavePlayerParty(void); void LoadPlayerParty(void); void SaveEventObjects(void); diff --git a/include/menu.h b/include/menu.h index 9b2341e58..aca462468 100644 --- a/include/menu.h +++ b/include/menu.h @@ -20,7 +20,8 @@ struct MenuAction extern const u16 gUnknown_0860F074[]; -void sub_81971D0(void); +void FreeAllOverworldWindowBuffers(void); +void InitStandardTextBoxWindows(void); void sub_8197200(void); u16 RunTextPrintersAndIsPrinter0Active(void); void sub_81973A4(void); diff --git a/include/overworld.h b/include/overworld.h index 1f53662b3..79cbf1da3 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -46,28 +46,25 @@ void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y); void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType); const struct MapLayout *GetMapLayout(void); void ApplyCurrentWarp(void); -void set_warp2_warp3_to_neg_1(void); struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum); struct MapHeader const *const GetDestinationWarpMapHeader(void); void WarpIntoMap(void); -void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); -void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId); -void saved_warp2_set(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId); -void saved_warp2_set_2(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); -void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused); -void sub_8084CCC(u8 a1); -void Overworld_SetWarpDestToLastHealLoc(void); -void Overworld_SetHealLocationWarp(u8 healLocationId); -void sub_8084D5C(s16 a1, s16 a2); -void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); -void sub_8084E14(void); +void SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); +void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpId); +void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId); +void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); +void SetWarpDestinationToDynamicWarp(u8 unused); +void SetWarpDestinationToHealLocation(u8 a1); +void SetWarpDestinationToLastHealLocation(void); +void SetLastHealLocationWarp(u8 healLocationId); +void UpdateEscapeWarp(s16 x, s16 y); +void SetEscapeWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); +void SetWarpDestinationToEscapeWarp(void); void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); -void SetFixedHoleWarpAsDestination(s16 x, s16 y); -void warp1_set_to_sav1w(void); -void sub_8084F2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); -void sub_8084F6C(u8 a1); -void sub_8084FAC(int unused); +void SetWarpDestinationToFixedHoleWarp(s16 x, s16 y); +void SetContinueGameWarpToHealLocation(u8 a1); +void SetContinueGameWarpToDynamicWarp(int unused); const struct MapConnection *GetMapConnection(u8 dir); bool8 SetDiveWarpEmerge(u16 x, u16 y); bool8 SetDiveWarpDive(u16 x, u16 y); @@ -78,7 +75,7 @@ bool32 Overworld_IsBikingAllowed(void); void SetDefaultFlashLevel(void); void Overworld_SetFlashLevel(s32 flashLevel); u8 Overworld_GetFlashLevel(void); -void sub_8085524(u16 mapLayoutId); +void SetCurrentMapLayout(u16 mapLayoutId); void sub_8085540(u8 var); u8 sub_808554C(void); u16 GetLocationMusic(struct WarpData *warp); @@ -97,15 +94,15 @@ void Overworld_FadeOutMapMusic(void); void UpdateAmbientCry(s16 *state, u16 *delayCounter); u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum); u8 GetMapTypeByWarpData(struct WarpData *warp); -u8 Overworld_GetMapTypeOfSaveblockLocation(void); +u8 GetCurrentMapType(void); u8 GetLastUsedWarpMapType(void); bool8 is_map_type_1_2_3_5_or_6(u8 mapType); bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType); bool8 Overworld_MapTypeIsIndoors(u8 mapType); -u8 sav1_saved_warp2_map_get_name(void); -u8 sav1_map_get_name(void); +u8 GetSavedWarpRegionMapSectionId(void); +u8 GetCurrentRegionMapSectionId(void); u8 GetCurrentMapBattleScene(void); -void overworld_free_bg_tilemaps(void); +void CleanupOverworldWindowsAndTilemaps(void); bool32 is_c1_link_related_active(void); void CB1_Overworld(void); void CB2_OverworldBasic(void); diff --git a/include/palette.h b/include/palette.h index c14e9f453..540452f3d 100644 --- a/include/palette.h +++ b/include/palette.h @@ -43,7 +43,7 @@ extern u8 gPaletteDecompressionBuffer[]; extern u16 gPlttBufferUnfaded[]; extern u16 gPlttBufferFaded[]; -void LoadCompressedPalette(const void *, u16, u16); +void LoadCompressedPalette(const u32 *, u16, u16); void LoadPalette(const void *, u16, u16); void FillPalette(u16, u16, u16); void TransferPlttBuffer(void); diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index c1bdbdf34..faffd3375 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -5,6 +5,7 @@ // Exported RAM declarations +extern u8 gUnknown_02022C2C; extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; extern u16 gUnknown_02022C3C; extern u8 gUnknown_02022C3E; diff --git a/include/save_location.h b/include/save_location.h index 71dbd3fd8..c330124ad 100644 --- a/include/save_location.h +++ b/include/save_location.h @@ -1,6 +1,12 @@ #ifndef GUARD_SAVE_LOCATION_H #define GUARD_SAVE_LOCATION_H +// specialSaveWarp flags +#define CONTINUE_GAME_WARP (1 << 0) +#define POKECENTER_SAVEWARP (1 << 1) +#define LOBBY_SAVEWARP (1 << 2) +#define UNK_SPECIAL_SAVE_WARP_FLAG_3 (1 << 3) + void TrySetMapSaveWarpStatus(void); void sub_81AFDA0(void); void sub_81AFDD0(void); diff --git a/include/secret_base.h b/include/secret_base.h index ac15357e3..4b44d4678 100644 --- a/include/secret_base.h +++ b/include/secret_base.h @@ -15,13 +15,13 @@ const u8 *GetSecretBaseTrainerLoseText(void); void sub_80E8EE0(struct MapEvents const *events); void sub_80E9238(u8 flagIn); bool8 CurrentMapIsSecretBase(void); -void sub_80EA3E4(u8 taskId); +void SecretBasePerStepCallback(u8 taskId); bool8 sub_80E9680(void); void sub_80EB498(void); void sub_80EB56C(void); void sub_80EB9E0(void); void sub_80EBB28(void); -void sub_80E9668(const struct MapPosition *position, const struct MapEvents *events); +void WarpIntoSecretBase(const struct MapPosition *position, const struct MapEvents *events); // SetCurrentSecretBaseFromPosition void sub_80E9608(const struct MapPosition *position, const struct MapEvents *events); diff --git a/include/strings.h b/include/strings.h index 64222cddb..7c6ca14ba 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1893,7 +1893,6 @@ extern const u8 gText_PkmnTransferredSomeonesPC[]; extern const u8 gText_PkmnTransferredLanettesPC[]; // hall of fame -extern const u8 gText_SavingDontTurnOffPower[]; extern const u8 gText_LeagueChamp[]; extern const u8 gText_HOFNumber[]; extern const u8 gText_PickNextCancel[]; @@ -1984,4 +1983,11 @@ extern const u8 gText_EggCantBeTradedNow[]; extern const u8 gText_OtherTrainerCantAcceptPkmn[]; extern const u8 gText_CantTradeWithTrainer[]; +// trade +extern const u8 gText_XWillBeSentToY[]; +extern const u8 gText_ByeByeVar1[]; +extern const u8 gText_XSentOverY[]; +extern const u8 gText_TakeGoodCareOfX[]; +extern const u8 gText_CommunicationStandby5[]; + #endif //GUARD_STRINGS_H diff --git a/include/trade.h b/include/trade.h index e3c18bffd..95a10cacf 100644 --- a/include/trade.h +++ b/include/trade.h @@ -12,8 +12,12 @@ s32 sub_807A728(void); void sub_80773AC(void); void sub_807AE50(void); -int sub_807A8D0(u32 /* probably wrong */, u16, u16, u8); -int sub_807A7E0(u32 /* probably wrong */, u32 /* probably wrong */, u16, u16, u16, u16, u8); +int sub_807A8D0(struct UnkLinkRfuStruct_02022B14Substruct a0, u16, u16, u8); +int sub_807A7E0(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6); int sub_807A918(struct Pokemon*, u16); +void sub_807B140(void); +void sub_807B154(void); +void sub_807F19C(void); +void sub_807F1A8(u8, const u8 *, u8); #endif //GUARD_TRADE_H diff --git a/include/trainer_card.h b/include/trainer_card.h index d80a5fa52..1af247d8a 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -38,5 +38,6 @@ void sub_80C3120(struct TrainerCard *arg0, u16 *arg1, u8 gameVersion); void TrainerCard_ShowLinkCard(u8 arg0, void (*callback)(void)); void TrainerCard_GenerateCardForPlayer(struct TrainerCard *); u8 sub_80C4904(u8); +void sub_80C6D80(const u8 *, u8 *, u8, u8, u8); #endif // GUARD_TRAINER_CARD_H diff --git a/include/util.h b/include/util.h index 997c8f713..9d13453c2 100644 --- a/include/util.h +++ b/include/util.h @@ -14,5 +14,6 @@ u16 CalcCRC16(u8 *data, s32 length); u16 CalcCRC16WithTable(u8 *data, u32 length); u32 CalcByteArraySum(const u8* data, u32 length); void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); +void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); #endif // GUARD_UTIL_H |