From bc79312d48781a35597705bf6663ac2a39598873 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 7 Jan 2019 08:54:56 -0500 Subject: Start decomping fieldmap --- include/fieldmap.h | 2 ++ include/global.fieldmap.h | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/fieldmap.h b/include/fieldmap.h index c5abdb2e1..fe2b5a928 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -3,6 +3,8 @@ #include "global.h" +#define VIRTUAL_MAP_SIZE 0x2800 + extern struct MapCoords { int width; int height; diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index ed5054b7d..3b3648121 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -67,8 +67,8 @@ struct MapData struct BackupMapData { - s32 width; - s32 height; + s32 Xsize; + s32 Ysize; u16 *map; }; @@ -149,9 +149,9 @@ struct MapEvents struct MapConnection { /*0x00*/ u8 direction; - /*0x01*/ u32 offset; - /*0x05*/ u8 mapGroup; - /*0x06*/ u8 mapNum; + /*0x04*/ u32 offset; + /*0x08*/ u8 mapGroup; + /*0x09*/ u8 mapNum; }; struct MapConnections -- cgit v1.2.3 From 9aab26afa5315c32f83ae7f40e19c9053d602089 Mon Sep 17 00:00:00 2001 From: scnorton Date: Mon, 7 Jan 2019 14:39:28 -0500 Subject: through MapGridGetMetatileIdAt --- include/fieldmap.h | 2 +- include/global.fieldmap.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/fieldmap.h b/include/fieldmap.h index fe2b5a928..e6a1e944a 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -15,7 +15,7 @@ u32 MapGridGetMetatileBehaviorAt(int, int); void MapGridSetMetatileIdAt(int, int, u16); void MapGridSetMetatileEntryAt(int, int, u16); void GetCameraCoords(u16*, u16*); -bool8 MapGridIsImpassableAt(s16, s16); +bool8 MapGridIsImpassableAt(s32, s32); s32 GetMapBorderIdAt(s16, s16); bool32 CanCameraMoveInDirection(u8); u16 GetBehaviorByMetatileId(u16 metatileId); diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 3b3648121..c7a55fd02 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -63,6 +63,8 @@ struct MapData /*0x0c*/ u16 *map; /*0x10*/ struct Tileset *primaryTileset; /*0x14*/ struct Tileset *secondaryTileset; + /*0x18*/ u8 unk18; + /*0x19*/ u8 unk19; }; struct BackupMapData -- cgit v1.2.3 From e1bd043bf3049b8a91b718ca1e4416711f0b8646 Mon Sep 17 00:00:00 2001 From: scnorton Date: Mon, 7 Jan 2019 15:32:11 -0500 Subject: through sub_8059250 --- include/fieldmap.h | 8 +++++++- include/global.fieldmap.h | 2 +- include/global.h | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/fieldmap.h b/include/fieldmap.h index e6a1e944a..38f1d30d0 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -3,6 +3,12 @@ #include "global.h" +#define NUM_TILES_IN_PRIMARY 512 +#define NUM_TILES_TOTAL 1024 +#define NUM_METATILES_IN_PRIMARY 512 +#define NUM_METATILES_TOTAL 1024 +#define NUM_PALS_IN_PRIMARY 6 +#define NUM_PALS_TOTAL 13 #define VIRTUAL_MAP_SIZE 0x2800 extern struct MapCoords { @@ -18,6 +24,6 @@ void GetCameraCoords(u16*, u16*); bool8 MapGridIsImpassableAt(s32, s32); s32 GetMapBorderIdAt(s16, s16); bool32 CanCameraMoveInDirection(u8); -u16 GetBehaviorByMetatileId(u16 metatileId); +u32 GetBehaviorByMetatileIdAndMapData(struct MapData *mapData, u16 metatile, u8 attr); #endif //GUARD_FIELDMAP_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index c7a55fd02..b602741a6 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -51,8 +51,8 @@ struct Tileset /*0x04*/ void *tiles; /*0x08*/ void *palettes; /*0x0c*/ void *metatiles; - /*0x10*/ void *metatileAttributes; /*0x14*/ TilesetCB callback; + /*0x10*/ void *metatileAttributes; }; struct MapData diff --git a/include/global.h b/include/global.h index f418ff757..26ce4a8cc 100644 --- a/include/global.h +++ b/include/global.h @@ -328,7 +328,8 @@ struct SaveBlock2 /*0x0AC*/ u8 filler_AC[0x3F4]; /*0x4A0*/ u32 unk_4A0[0x2F]; /*0x55c*/ struct UnkSaveBlock2Substruct_55C unk_55C; - /*0x574*/ u8 filler_574[0x524]; + /*0x574*/ u8 filler_574[0x324]; + /*0x898*/ u16 mapView[0x100]; /*0xA98*/ struct LinkBattleRecords linkBattleRecords; /*0xAF0*/ struct BerryCrush berryCrush; /*0xB00*/ u8 filler_B00[0x420]; -- cgit v1.2.3 From 34cf3662fc0343d77fe36b1a3083605110764c9a Mon Sep 17 00:00:00 2001 From: scnorton Date: Mon, 7 Jan 2019 15:48:36 -0500 Subject: GetMapBorderIdAt --- include/fieldmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/fieldmap.h b/include/fieldmap.h index 38f1d30d0..016baf153 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -22,7 +22,7 @@ void MapGridSetMetatileIdAt(int, int, u16); void MapGridSetMetatileEntryAt(int, int, u16); void GetCameraCoords(u16*, u16*); bool8 MapGridIsImpassableAt(s32, s32); -s32 GetMapBorderIdAt(s16, s16); +s32 GetMapBorderIdAt(s32, s32); bool32 CanCameraMoveInDirection(u8); u32 GetBehaviorByMetatileIdAndMapData(struct MapData *mapData, u16 metatile, u8 attr); -- cgit v1.2.3 From 38abcf9774612094d8552904fbeed3d1b2c4bba1 Mon Sep 17 00:00:00 2001 From: scnorton Date: Mon, 7 Jan 2019 16:39:32 -0500 Subject: through sub_80598CC --- include/fieldmap.h | 2 +- include/menu.h | 1 + include/new_menu_helpers.h | 1 + include/overworld.h | 3 +++ include/palette.h | 2 ++ include/quest_log.h | 1 + 6 files changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/fieldmap.h b/include/fieldmap.h index 016baf153..1ce83ee38 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -23,7 +23,7 @@ void MapGridSetMetatileEntryAt(int, int, u16); void GetCameraCoords(u16*, u16*); bool8 MapGridIsImpassableAt(s32, s32); s32 GetMapBorderIdAt(s32, s32); -bool32 CanCameraMoveInDirection(u8); +bool32 CanCameraMoveInDirection(s32); u32 GetBehaviorByMetatileIdAndMapData(struct MapData *mapData, u16 metatile, u8 attr); #endif //GUARD_FIELDMAP_H diff --git a/include/menu.h b/include/menu.h index b932693f7..b5078df5e 100644 --- a/include/menu.h +++ b/include/menu.h @@ -37,5 +37,6 @@ void clear_scheduled_bg_copies_to_vram(void); void AddTextPrinterParametrized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const struct TextColor *color, s8 speed, const u8 *str); void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u16 a3); void sub_810F4D8(u8 windowId, bool32 someBool); +void *sub_80F68F0(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); #endif // GUARD_MENU_H diff --git a/include/new_menu_helpers.h b/include/new_menu_helpers.h index ce8e8d697..32b46b552 100644 --- a/include/new_menu_helpers.h +++ b/include/new_menu_helpers.h @@ -22,5 +22,6 @@ void sub_80F6EE4(u8 windowId, bool8 transfer); void sub_80F7974(const u8 *); u8 GetStartMenuWindowId(void); void sub_80F7998(void); +void sub_80F69E8(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); #endif // GUARD_NEW_MENU_HELPERS_H diff --git a/include/overworld.h b/include/overworld.h index fbea3a4d9..b32d9cf48 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -24,6 +24,8 @@ struct UCoords32 u32 x, y; }; +extern struct UCoords32 gDirectionToVectors[]; + extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4]; extern MainCallback gFieldCallback; @@ -96,5 +98,6 @@ extern u8 gUnknown_2036E28; extern bool8 (* gUnknown_3005024)(void); void SetLastHealLocationWarp(u8 healLocaionId); +void sub_8055864(u8 mapGroup, u8 mapNum); #endif //GUARD_ROM4_H diff --git a/include/palette.h b/include/palette.h index 3af0d5d7b..31c8ffefe 100644 --- a/include/palette.h +++ b/include/palette.h @@ -70,6 +70,8 @@ void BeginHardwarePaletteFade(u8, u8, u8, u8, u8); void BlendPalettes(u32, u8, u16); void BlendPalettesUnfaded(u32, u8, u16); void sub_80716F8(const u16 *, u16 *, u16, u8); +void TintPalette_GrayScale(u16 *, u16); +void TintPalette_SepiaTone(u16 *, u16); extern struct PaletteFadeControl gPaletteFade; diff --git a/include/quest_log.h b/include/quest_log.h index 31220b86c..7f4bafada 100644 --- a/include/quest_log.h +++ b/include/quest_log.h @@ -24,6 +24,7 @@ void sub_8113550(u16, const u16 *); void sub_8115748(u16); u8 sub_8112CAC(void); bool8 sub_81119D4(void (*func)(void)); +void sub_8111F38(u16, u16); extern u8 gUnknown_203ADFA; -- cgit v1.2.3 From 316975ebeae7ca15f9a55bcfc3c493a9f35c6242 Mon Sep 17 00:00:00 2001 From: scnorton Date: Mon, 7 Jan 2019 16:47:21 -0500 Subject: Complete code decomp of fieldmap.s --- include/fieldmap.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/fieldmap.h b/include/fieldmap.h index 1ce83ee38..24e85aace 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -3,11 +3,11 @@ #include "global.h" -#define NUM_TILES_IN_PRIMARY 512 +#define NUM_TILES_IN_PRIMARY 640 #define NUM_TILES_TOTAL 1024 -#define NUM_METATILES_IN_PRIMARY 512 +#define NUM_METATILES_IN_PRIMARY 640 #define NUM_METATILES_TOTAL 1024 -#define NUM_PALS_IN_PRIMARY 6 +#define NUM_PALS_IN_PRIMARY 7 #define NUM_PALS_TOTAL 13 #define VIRTUAL_MAP_SIZE 0x2800 -- cgit v1.2.3 From 6da60e9b36303ac9d67a59db9092adb1dae6b43f Mon Sep 17 00:00:00 2001 From: scnorton Date: Mon, 7 Jan 2019 16:53:28 -0500 Subject: fieldmap: Common and EWRAM syms --- include/fieldmap.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/fieldmap.h b/include/fieldmap.h index 24e85aace..537626edc 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -11,10 +11,7 @@ #define NUM_PALS_TOTAL 13 #define VIRTUAL_MAP_SIZE 0x2800 -extern struct MapCoords { - int width; - int height; -} gUnknown_03005DC0; +extern struct BackupMapData VMap; u32 MapGridGetMetatileIdAt(int, int); u32 MapGridGetMetatileBehaviorAt(int, int); -- cgit v1.2.3