diff options
author | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-12-28 17:26:58 -0500 |
---|---|---|
committer | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-12-28 17:26:58 -0500 |
commit | 77b7462dbb376fd7fa4215ad5cf21244efa52f62 (patch) | |
tree | 3498fc738b339cfb0ce5423675c348e9090f94e8 /src | |
parent | 03a2a3b81bba374bdf3a74a37a4dc3e2d17a196f (diff) | |
parent | 1496ea3a24f188cad26ac40f5bfcc3e571f3311a (diff) |
merge
Diffstat (limited to 'src')
-rw-r--r-- | src/decoration.c | 2 | ||||
-rw-r--r-- | src/evolution_scene.c | 102 | ||||
-rw-r--r-- | src/hall_of_fame.c | 4 | ||||
-rw-r--r-- | src/landmark.c | 441 | ||||
-rw-r--r-- | src/palette.c | 62 | ||||
-rw-r--r-- | src/region_map.c | 11 | ||||
-rw-r--r-- | src/tv.c | 7 |
7 files changed, 567 insertions, 62 deletions
diff --git a/src/decoration.c b/src/decoration.c index faef779b7..c539091c8 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -25,7 +25,7 @@ #include "sound.h" #include "event_scripts.h" #include "event_data.h" -#include "region_map.h" +#include "constants/region_map_sections.h" #include "player_pc.h" #include "strings.h" #include "tv.h" diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 85310eace..4b59147ff 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -60,16 +60,8 @@ extern u8 gBattleCommunication[]; extern const struct WindowTemplate gUnknown_0833900C; extern const struct CompressedSpriteSheet gMonFrontPicTable[]; -extern const u8 gUnknown_085B58C9[][4]; -extern const u16 gUnknown_085B5884[]; -extern const u8 gUnknown_085B58D9[]; -extern const u16 gUnknown_085B51E4[]; -extern const u32 gUnknown_085B4134[]; -extern const u32 gUnknown_085B482C[]; -extern const u32 gUnknown_085B4D10[]; // strings -extern const u8 gText_ShedinjaJapaneseName2[]; extern const u8 gText_PkmnIsEvolving[]; extern const u8 gText_CongratsPkmnEvolved[]; extern const u8 gText_BattleYesNoChoice[]; @@ -108,6 +100,80 @@ static void InitMovingBackgroundTask(bool8 isLink); static void sub_813FEE8(u8 taskId); static void sub_8140174(void); +// const data +static const u16 sUnknown_085B4114[] = INCBIN_U16("graphics/evolution_scene/unknown_5B4114.gbapal"); +static const u32 sUnknown_085B4134[] = INCBIN_U32("graphics/evolution_scene/bg.4bpp.lz"); +static const u32 sUnknown_085B482C[] = INCBIN_U32("graphics/evolution_scene/bg.bin.lz"); +static const u32 sUnknown_085B4D10[] = INCBIN_U32("graphics/evolution_scene/bg2.bin.lz"); +static const u16 sUnknown_085B51E4[] = INCBIN_U16("graphics/evolution_scene/gray_transition_intro.gbapal"); +static const u16 sUnknown_085B53E4[] = INCBIN_U16("graphics/evolution_scene/gray_transition_lighten.gbapal"); +static const u16 sUnknown_085B5544[] = INCBIN_U16("graphics/evolution_scene/gray_transition_darken.gbapal"); +static const u16 sUnknown_085B56E4[] = INCBIN_U16("graphics/evolution_scene/gray_transition_outro.gbapal"); +static const u16 sUnknown_085B5884[] = INCBIN_U16("graphics/evolution_scene/transition.gbapal"); + +static const u8 Text_ShedinjaJapaneseName[] = _("ヌケニン"); + +static const u8 sUnknown_085B58C9[][4] = +{ + { 0x00, 0x0C, 0x01, 0x06 }, + { 0x0D, 0x24, 0x05, 0x02 }, + { 0x0D, 0x18, 0x01, 0x02 }, + { 0x25, 0x31, 0x01, 0x06 }, +}; + +static const u8 sUnknown_085B58D9[][16] = { + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x0B, 0x00, 0x00 }, + { 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x00, 0x00 }, + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x00, 0x00 }, + { 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x00, 0x00 }, + { 0x00, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x00, 0x00 }, + { 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x00, 0x00 }, + { 0x00, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x00, 0x00 }, + { 0x00, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x00, 0x00 }, + { 0x00, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x00, 0x00 }, + { 0x00, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x00, 0x00 }, + { 0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x00, 0x00 }, + { 0x00, 0x0A, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x00, 0x00 }, + { 0x00, 0x0B, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x00, 0x00 }, + { 0x00, 0x0C, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x00, 0x00 }, + { 0x00, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00 }, + { 0x00, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x00, 0x00 }, + { 0x00, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x00, 0x00 }, + { 0x00, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x00, 0x00 }, + { 0x00, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00 }, + { 0x00, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00, 0x00 }, + { 0x00, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x00, 0x00 }, + { 0x00, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, 0x00 }, + { 0x00, 0x05, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00, 0x00 }, + { 0x00, 0x04, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x00, 0x00 }, + { 0x00, 0x03, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x00, 0x00 }, + { 0x00, 0x02, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x00, 0x00 }, + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x00, 0x00 }, + { 0x00, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00 }, + { 0x00, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x0A, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x04, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } +}; + static void CB2_BeginEvolutionScene(void) { UpdatePaletteFade(); @@ -544,7 +610,7 @@ static void CreateShedinja(u16 preEvoSpecies, struct Pokemon* mon) if (GetMonData(Shedinja, MON_DATA_SPECIES) == SPECIES_SHEDINJA && GetMonData(Shedinja, MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE && GetMonData(mon, MON_DATA_SPECIES) == SPECIES_NINJASK) - SetMonData(Shedinja, MON_DATA_NICKNAME, gText_ShedinjaJapaneseName2); + SetMonData(Shedinja, MON_DATA_NICKNAME, Text_ShedinjaJapaneseName); } } @@ -1330,17 +1396,17 @@ static void sub_813FDEC(u8 taskId) if (data[5]++ < 20) return; - if (data[0]++ > gUnknown_085B58C9[data[2]][3]) + if (data[0]++ > sUnknown_085B58C9[data[2]][3]) { - if (gUnknown_085B58C9[data[2]][1] == data[1]) + if (sUnknown_085B58C9[data[2]][1] == data[1]) { data[3]++; - if (data[3] == gUnknown_085B58C9[data[2]][2]) + if (data[3] == sUnknown_085B58C9[data[2]][2]) { data[3] = 0; data[2]++; } - data[1] = gUnknown_085B58C9[data[2]][0]; + data[1] = sUnknown_085B58C9[data[2]][0]; } else { @@ -1411,7 +1477,7 @@ static void InitMovingBgValues(u16 *movingBgs) { for (j = 0; j < 16; j++) { - movingBgs[i * 16 + j] = gUnknown_085B5884[gUnknown_085B58D9[i * 16 + j]]; + movingBgs[i * 16 + j] = sUnknown_085B5884[sUnknown_085B58D9[i][j]]; } } } @@ -1428,11 +1494,11 @@ static void InitMovingBackgroundTask(bool8 isLink) else innerBgId = 1, outerBgId = 3; - LoadPalette(gUnknown_085B51E4, 0xA0, 0x20); + LoadPalette(sUnknown_085B51E4, 0xA0, 0x20); - copy_decompressed_tile_data_to_vram_autofree(1, gUnknown_085B4134, FALSE, 0, 0); - CopyToBgTilemapBuffer(1, gUnknown_085B482C, 0, 0); - CopyToBgTilemapBuffer(outerBgId, gUnknown_085B4D10, 0, 0); + copy_decompressed_tile_data_to_vram_autofree(1, sUnknown_085B4134, FALSE, 0, 0); + CopyToBgTilemapBuffer(1, sUnknown_085B482C, 0, 0); + CopyToBgTilemapBuffer(outerBgId, sUnknown_085B4D10, 0, 0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(outerBgId); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 2496b9564..414959882 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -97,7 +97,7 @@ extern u16 sub_818D7D8(u16 species, u32 trainerId, u32 personality, u8 arg3, s16 extern void sub_8198204(u8 *dst, const u8 *src, u8, u8, u8); extern bool8 sub_80F9C30(void); extern void sub_8198314(void); -extern void sub_8137C3C(void); +extern void ReturnFromHallOfFamePC(void); extern void sub_8198180(const u8 *src, u8, u8); extern void sub_80F9BF4(u16, u16, u8); extern void sub_81980F0(u8, u8, u8, u8, u16); @@ -1108,7 +1108,7 @@ static void Task_HofPC_HandleExit(u8 taskId) if (sHofMonPtr != NULL) FREE_AND_SET_NULL(sHofMonPtr); - sub_8137C3C(); + ReturnFromHallOfFamePC(); } } diff --git a/src/landmark.c b/src/landmark.c new file mode 100644 index 000000000..4eade159a --- /dev/null +++ b/src/landmark.c @@ -0,0 +1,441 @@ +#include "global.h" +#include "event_data.h" +#include "constants/region_map_sections.h" + +struct Landmark +{ + const u8 *name; + u16 flag; +}; + +struct LandmarkList +{ + u8 mapSection; + u8 id; + const struct Landmark *const *landmarks; +}; + +static const u8 LandmarkName_FlowerShop[] = _("FLOWER SHOP"); +static const u8 LandmarkName_PetalburgWoods[] = _("PETALBURG WOODS"); +static const u8 LandmarkName_MrBrineysCottage[] = _("MR. BRINEY’S COTTAGE"); +static const u8 LandmarkName_AbandonedShip[] = _("ABANDONED SHIP"); +static const u8 LandmarkName_SeashoreHouse[] = _("SEASHORE HOUSE"); +static const u8 LandmarkName_SlateportBeach[] = _("SLATEPORT BEACH"); +static const u8 LandmarkName_CyclingRoad[] = _("CYCLING ROAD"); +static const u8 LandmarkName_NewMauville[] = _("NEW MAUVILLE"); +static const u8 LandmarkName_TrickHouse[] = _("TRICK HOUSE"); +static const u8 LandmarkName_OldLadysRestShop[] = _("OLD LADY’S REST STOP"); +static const u8 LandmarkName_Desert[] = _("DESERT"); +static const u8 LandmarkName_WinstrateFamily[] = _("THE WINSTRATE FAMILY"); +static const u8 LandmarkName_CableCar[] = _("CABLE CAR"); +static const u8 LandmarkName_GlassWorkshop[] = _("GLASS WORKSHOP"); +static const u8 LandmarkName_WeatherInstitute[] = _("WEATHER INSTITUTE"); +static const u8 LandmarkName_MeteorFalls[] = _("METEOR FALLS"); +static const u8 LandmarkName_TunnelersRestHouse[] = _("TUNNELER’S RESTHOUSE"); +static const u8 LandmarkName_RusturfTunnel[] = _("RUSTURF TUNNEL"); +static const u8 LandmarkName_PokemonDayCare[] = _("POKéMON DAY CARE"); +static const u8 LandmarkName_SafariZoneEntrance[] = _("SAFARI ZONE ENTRANCE"); +static const u8 LandmarkName_MtPyre[] = _("MT. PYRE"); +static const u8 LandmarkName_ShoalCave[] = _("SHOAL CAVE"); +static const u8 LandmarkName_SeafloorCavern[] = _("SEAFLOOR CAVERN"); +static const u8 LandmarkName_GraniteCave[] = _("GRANITE CAVE"); +static const u8 LandmarkName_OceanCurrent[] = _("OCEAN CURRENT"); +static const u8 LandmarkName_LanettesHouse[] = _("LANETTE’S HOUSE"); +static const u8 LandmarkName_FieryPath[] = _("FIERY PATH"); +static const u8 LandmarkName_JaggedPass[] = _("JAGGED PASS"); +static const u8 LandmarkName_SkyPillar[] = _("SKY PILLAR"); +static const u8 LandmarkName_BerryMastersHouse[] = _("BERRY MASTER’S HOUSE"); +static const u8 LandmarkName_IslandCave[] = _("ISLAND CAVE"); +static const u8 LandmarkName_DesertRuins[] = _("DESERT RUINS"); +static const u8 LandmarkName_ScorchedSlab[] = _("SCORCHED SLAB"); +static const u8 LandmarkName_AncientTomb[] = _("ANCIENT TOMB"); +static const u8 LandmarkName_SealedChamber[] = _("SEALED CHAMBER"); +static const u8 LandmarkName_FossilManiacsHouse[] = _("FOSSIL MANIAC’S HOUSE"); +static const u8 LandmarkName_HuntersHouse[] = _("HUNTER’S HOUSE"); +static const u8 LandmarkName_MagmaHideout[] = _("MAGMA HIDEOUT"); +static const u8 LandmarkName_MirageTower[] = _("MIRAGE TOWER"); +static const u8 LandmarkName_AlteringCave[] = _("ALTERING CAVE"); +static const u8 LandmarkName_DesertUnderpass[] = _("DESERT UNDERPASS"); +static const u8 LandmarkName_TrainerHill[] = _("TRAINER HILL"); + +static const struct Landmark Landmark_FlowerShop = {LandmarkName_FlowerShop, FLAG_LANDMARK_FLOWER_SHOP}; +static const struct Landmark Landmark_PetalburgWoods = {LandmarkName_PetalburgWoods, -1}; +static const struct Landmark Landmark_MrBrineysCottage = {LandmarkName_MrBrineysCottage, FLAG_LANDMARK_MR_BRINEY_HOUSE}; +static const struct Landmark Landmark_AbandonedShip = {LandmarkName_AbandonedShip, FLAG_LANDMARK_ABANDONED_SHIP}; +static const struct Landmark Landmark_SeashoreHouse = {LandmarkName_SeashoreHouse, FLAG_LANDMARK_SEASHORE_HOUSE}; +static const struct Landmark Landmark_SlateportBeach = {LandmarkName_SlateportBeach, -1}; +static const struct Landmark Landmark_CyclingRoad = {LandmarkName_CyclingRoad, -1}; +static const struct Landmark Landmark_NewMauville = {LandmarkName_NewMauville, FLAG_LANDMARK_NEW_MAUVILLE}; +static const struct Landmark Landmark_TrickHouse = {LandmarkName_TrickHouse, FLAG_LANDMARK_TRICK_HOUSE}; +static const struct Landmark Landmark_OldLadysRestShop = {LandmarkName_OldLadysRestShop, FLAG_LANDMARK_OLD_LADY_REST_SHOP}; +static const struct Landmark Landmark_Desert = {LandmarkName_Desert, -1}; +static const struct Landmark Landmark_WinstrateFamily = {LandmarkName_WinstrateFamily, FLAG_LANDMARK_WINSTRATE_FAMILY}; +static const struct Landmark Landmark_CableCar = {LandmarkName_CableCar, -1}; +static const struct Landmark Landmark_GlassWorkshop = {LandmarkName_GlassWorkshop, FLAG_LANDMARK_GLASS_WORKSHOP}; +static const struct Landmark Landmark_WeatherInstitute = {LandmarkName_WeatherInstitute, -1}; +static const struct Landmark Landmark_MeteorFalls = {LandmarkName_MeteorFalls, -1}; +static const struct Landmark Landmark_TunnelersRestHouse = {LandmarkName_TunnelersRestHouse, FLAG_LANDMARK_TUNNELERS_REST_HOUSE}; +static const struct Landmark Landmark_RusturfTunnel = {LandmarkName_RusturfTunnel, -1}; +static const struct Landmark Landmark_PokemonDayCare = {LandmarkName_PokemonDayCare, FLAG_LANDMARK_POKEMON_DAYCARE}; +static const struct Landmark Landmark_SafariZoneEntrance = {LandmarkName_SafariZoneEntrance, -1}; +static const struct Landmark Landmark_MtPyre = {LandmarkName_MtPyre, -1}; +static const struct Landmark Landmark_ShoalCave = {LandmarkName_ShoalCave, -1}; +static const struct Landmark Landmark_SeafloorCavern = {LandmarkName_SeafloorCavern, FLAG_LANDMARK_SEAFLOOR_CAVERN}; +static const struct Landmark Landmark_GraniteCave = {LandmarkName_GraniteCave, -1}; +static const struct Landmark Landmark_OceanCurrent = {LandmarkName_OceanCurrent, -1}; +static const struct Landmark Landmark_LanettesHouse = {LandmarkName_LanettesHouse, FLAG_LANDMARK_LANETTES_HOUSE}; +static const struct Landmark Landmark_FieryPath = {LandmarkName_FieryPath, FLAG_LANDMARK_FIERY_PATH}; +static const struct Landmark Landmark_JaggedPass = {LandmarkName_JaggedPass, -1}; +static const struct Landmark Landmark_BerryMastersHouse = {LandmarkName_BerryMastersHouse, FLAG_LANDMARK_BERRY_MASTERS_HOUSE}; +static const struct Landmark Landmark_IslandCave = {LandmarkName_IslandCave, FLAG_LANDMARK_ISLAND_CAVE}; +static const struct Landmark Landmark_DesertRuins = {LandmarkName_DesertRuins, FLAG_LANDMARK_DESERT_RUINS}; +static const struct Landmark Landmark_ScorchedSlab = {LandmarkName_ScorchedSlab, FLAG_LANDMARK_SCORCHED_SLAB}; +static const struct Landmark Landmark_AncientTomb = {LandmarkName_AncientTomb, FLAG_LANDMARK_ANCIENT_TOMB}; +static const struct Landmark Landmark_SealedChamber = {LandmarkName_SealedChamber, FLAG_LANDMARK_SEALED_CHAMBER}; +static const struct Landmark Landmark_FossilManiacsHouse = {LandmarkName_FossilManiacsHouse, FLAG_LANDMARK_FOSSIL_MANIACS_HOUSE}; +static const struct Landmark Landmark_HuntersHouse = {LandmarkName_HuntersHouse, FLAG_LANDMARK_HUNTERS_HOUSE}; +static const struct Landmark Landmark_SkyPillar = {LandmarkName_SkyPillar, FLAG_LANDMARK_SKY_PILLAR}; +static const struct Landmark Landmark_MirageTower = {LandmarkName_MirageTower, FLAG_LANDMARK_MIRAGE_TOWER}; +static const struct Landmark Landmark_AlteringCave = {LandmarkName_AlteringCave, FLAG_LANDMARK_ALTERING_CAVE}; +static const struct Landmark Landmark_DesertUnderpass = {LandmarkName_DesertUnderpass, FLAG_LANDMARK_DESERT_UNDERPASS}; +static const struct Landmark Landmark_TrainerHill = {LandmarkName_TrainerHill, FLAG_LANDMARK_TRAINER_HILL}; + +static const struct Landmark *const Landmarks_Route103_2[] = +{ + &Landmark_AlteringCave, + NULL, +}; + +static const struct Landmark *const Landmarks_Route104_0[] = +{ + &Landmark_FlowerShop, + NULL, +}; + +static const struct Landmark *const Landmarks_Route104_1[] = +{ + &Landmark_PetalburgWoods, + &Landmark_MrBrineysCottage, + NULL, +}; + +static const struct Landmark *const Landmarks_Route105_0[] = +{ + &Landmark_IslandCave, + NULL, +}; + +static const struct Landmark *const Landmarks_Route106_1[] = +{ + &Landmark_GraniteCave, + NULL, +}; + +static const struct Landmark *const Landmarks_Route108_0[] = +{ + &Landmark_AbandonedShip, + NULL, +}; + +static const struct Landmark *const Landmarks_Route109_0[] = +{ + &Landmark_SeashoreHouse, + &Landmark_SlateportBeach, + NULL, +}; + +static const struct Landmark *const Landmarks_Route110_0[] = +{ + &Landmark_CyclingRoad, + &Landmark_NewMauville, + NULL, +}; + +static const struct Landmark *const Landmarks_Route110_1[] = +{ + &Landmark_CyclingRoad, + NULL, +}; + +static const struct Landmark *const Landmarks_Route110_2[] = +{ + &Landmark_CyclingRoad, + &Landmark_TrickHouse, + NULL, +}; + +static const struct Landmark *const Landmarks_Route111_0[] = +{ + &Landmark_OldLadysRestShop, + NULL, +}; + +static const struct Landmark *const Landmarks_Route111_1[] = +{ + &Landmark_Desert, + NULL, +}; + +static const struct Landmark *const Landmarks_Route111_2[] = +{ + &Landmark_MirageTower, + &Landmark_Desert, + NULL, +}; + +static const struct Landmark *const Landmarks_Route111_3[] = +{ + &Landmark_DesertRuins, + &Landmark_Desert, + NULL, +}; + +static const struct Landmark *const Landmarks_Route111_4[] = +{ + &Landmark_TrainerHill, + &Landmark_WinstrateFamily, + &Landmark_Desert, + NULL, +}; + +static const struct Landmark *const Landmarks_Route112_0[] = +{ + &Landmark_FieryPath, + &Landmark_JaggedPass, + NULL, +}; + +static const struct Landmark *const Landmarks_Route112_1[] = +{ + &Landmark_CableCar, + &Landmark_FieryPath, + NULL, +}; + +static const struct Landmark *const Landmarks_Route113_1[] = +{ + &Landmark_GlassWorkshop, + NULL, +}; + +static const struct Landmark *const Landmarks_Route114_1[] = +{ + &Landmark_DesertUnderpass, + &Landmark_FossilManiacsHouse, + NULL, +}; + +static const struct Landmark *const Landmarks_Route114_2[] = +{ + &Landmark_LanettesHouse, + NULL, +}; + +static const struct Landmark *const Landmarks_MeteorFalls[] = +{ + &Landmark_MeteorFalls, + NULL, +}; + +static const struct Landmark *const Landmarks_Route116_1[] = +{ + &Landmark_TunnelersRestHouse, + &Landmark_RusturfTunnel, + NULL, +}; + +static const struct Landmark *const Landmarks_Route116_2[] = +{ + &Landmark_RusturfTunnel, + NULL, +}; + +static const struct Landmark *const Landmarks_Route117_2[] = +{ + &Landmark_PokemonDayCare, + NULL, +}; + +static const struct Landmark *const Landmarks_Route119_1[] = +{ + &Landmark_WeatherInstitute, + NULL, +}; + +static const struct Landmark *const Landmarks_Route120_0[] = +{ + &Landmark_ScorchedSlab, + NULL, +}; + +static const struct Landmark *const Landmarks_Route120_2[] = +{ + &Landmark_AncientTomb, + NULL, +}; + +static const struct Landmark *const Landmarks_Route121_2[] = +{ + &Landmark_SafariZoneEntrance, + NULL, +}; + +static const struct Landmark *const Landmarks_Route122_0[] = +{ + &Landmark_MtPyre, + NULL, +}; + +static const struct Landmark *const Landmarks_Route123_0[] = +{ + &Landmark_BerryMastersHouse, + NULL, +}; + +static const struct Landmark *const Landmarks_Route124_7[] = +{ + &Landmark_HuntersHouse, + NULL, +}; + +static const struct Landmark *const Landmarks_Route125_2[] = +{ + &Landmark_ShoalCave, + NULL, +}; + +static const struct Landmark *const Landmarks_Route128_1[] = +{ + &Landmark_SeafloorCavern, + NULL, +}; + +static const struct Landmark *const Landmarks_Route131_1[] = +{ + &Landmark_SkyPillar, + NULL, +}; + +static const struct Landmark *const Landmarks_OceanCurrent[] = +{ + &Landmark_OceanCurrent, + NULL, +}; + +static const struct Landmark *const Landmarks_Route134_2[] = +{ + &Landmark_SealedChamber, + &Landmark_OceanCurrent, + NULL, +}; + +static const struct Landmark *const Landmarks_MtChimney_2[] = +{ + &Landmark_CableCar, + &Landmark_JaggedPass, + NULL, +}; + +static const struct LandmarkList gLandmarkLists[] = +{ + {MAPSEC_ROUTE_103, 2, Landmarks_Route103_2}, + {MAPSEC_ROUTE_104, 0, Landmarks_Route104_0}, + {MAPSEC_ROUTE_104, 1, Landmarks_Route104_1}, + {MAPSEC_ROUTE_105, 0, Landmarks_Route105_0}, + {MAPSEC_ROUTE_106, 1, Landmarks_Route106_1}, + {MAPSEC_ROUTE_108, 0, Landmarks_Route108_0}, + {MAPSEC_ROUTE_109, 0, Landmarks_Route109_0}, + {MAPSEC_ROUTE_110, 0, Landmarks_Route110_0}, + {MAPSEC_ROUTE_110, 1, Landmarks_Route110_1}, + {MAPSEC_ROUTE_110, 2, Landmarks_Route110_2}, + {MAPSEC_ROUTE_111, 0, Landmarks_Route111_0}, + {MAPSEC_ROUTE_111, 1, Landmarks_Route111_1}, + {MAPSEC_ROUTE_111, 2, Landmarks_Route111_2}, + {MAPSEC_ROUTE_111, 3, Landmarks_Route111_3}, + {MAPSEC_ROUTE_111, 4, Landmarks_Route111_4}, + {MAPSEC_ROUTE_112, 0, Landmarks_Route112_0}, + {MAPSEC_ROUTE_112, 1, Landmarks_Route112_1}, + {MAPSEC_ROUTE_113, 1, Landmarks_Route113_1}, + {MAPSEC_ROUTE_114, 1, Landmarks_Route114_1}, + {MAPSEC_ROUTE_114, 2, Landmarks_Route114_2}, + {MAPSEC_ROUTE_114, 3, Landmarks_MeteorFalls}, + {MAPSEC_ROUTE_115, 0, Landmarks_MeteorFalls}, + {MAPSEC_ROUTE_115, 1, Landmarks_MeteorFalls}, + {MAPSEC_ROUTE_116, 1, Landmarks_Route116_1}, + {MAPSEC_ROUTE_116, 2, Landmarks_Route116_2}, + {MAPSEC_ROUTE_117, 2, Landmarks_Route117_2}, + {MAPSEC_ROUTE_119, 1, Landmarks_Route119_1}, + {MAPSEC_ROUTE_120, 0, Landmarks_Route120_0}, + {MAPSEC_ROUTE_120, 2, Landmarks_Route120_2}, + {MAPSEC_ROUTE_121, 2, Landmarks_Route121_2}, + {MAPSEC_ROUTE_122, 0, Landmarks_Route122_0}, + {MAPSEC_ROUTE_123, 0, Landmarks_Route123_0}, + {MAPSEC_ROUTE_122, 1, Landmarks_Route122_0}, + {MAPSEC_ROUTE_124, 7, Landmarks_Route124_7}, + {MAPSEC_ROUTE_125, 2, Landmarks_Route125_2}, + {MAPSEC_ROUTE_128, 1, Landmarks_Route128_1}, + {MAPSEC_ROUTE_131, 1, Landmarks_Route131_1}, + {MAPSEC_ROUTE_132, 0, Landmarks_OceanCurrent}, + {MAPSEC_ROUTE_132, 1, Landmarks_OceanCurrent}, + {MAPSEC_ROUTE_133, 0, Landmarks_OceanCurrent}, + {MAPSEC_ROUTE_133, 1, Landmarks_OceanCurrent}, + {MAPSEC_ROUTE_133, 2, Landmarks_OceanCurrent}, + {MAPSEC_ROUTE_134, 0, Landmarks_OceanCurrent}, + {MAPSEC_ROUTE_134, 1, Landmarks_OceanCurrent}, + {MAPSEC_ROUTE_134, 2, Landmarks_Route134_2}, + {MAPSEC_MT_CHIMNEY, 2, Landmarks_MtChimney_2}, + {MAPSEC_NONE, 0, NULL}, +}; + +static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id); + +const u8 *GetLandmarkName(u8 mapSection, u8 id, u8 count) +{ + const struct Landmark *const *landmarks = GetLandmarks(mapSection, id); + + if (!landmarks) + return NULL; + + while (1) + { + const struct Landmark *landmark = *landmarks; + + if (landmark->flag == 0xFFFF || FlagGet(landmark->flag) == TRUE) + { + if (count == 0) + break; + else + count--; + } + + landmarks++; + if (!*landmarks) + return NULL; + } + + return (*landmarks)->name; +} + +static const struct Landmark *const *GetLandmarks(u8 mapSection, u8 id) +{ + u16 i = 0; + + for (; gLandmarkLists[i].mapSection != MAPSEC_NONE; i++) + { + if (gLandmarkLists[i].mapSection > mapSection) + return NULL; + if (gLandmarkLists[i].mapSection == mapSection) + break; + } + + if (gLandmarkLists[i].mapSection == MAPSEC_NONE) + return NULL; + + for (; gLandmarkLists[i].mapSection == mapSection; i++) + { + if (gLandmarkLists[i].id == id) + return gLandmarkLists[i].landmarks; + } + + return NULL; +} diff --git a/src/palette.c b/src/palette.c index 6d8abbde6..d7b6ad479 100644 --- a/src/palette.c +++ b/src/palette.c @@ -65,7 +65,8 @@ static const struct PaletteStructTemplate gDummyPaletteStructTemplate = { .uid = 0xFFFF, .pst_field_B_5 = 1 }; -static const u8 sUnknown_0852489C[] = { + +static const u8 sRoundedDownGrayscaleMap[] = { 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 11, 11, 11, 11, 11, @@ -620,7 +621,7 @@ static u8 UpdateFastPaletteFade(void) gPlttBufferFaded[i] = r | (g << 5) | (b << 10); } break; - case FAST_FADE_OUT_TO_WHTIE: + case FAST_FADE_OUT_TO_WHITE: for (i = paletteOffsetStart; i < paletteOffsetEnd; i++) { struct PlttData *data = (struct PlttData *)&gPlttBufferFaded[i]; @@ -701,7 +702,7 @@ static u8 UpdateFastPaletteFade(void) case FAST_FADE_IN_FROM_BLACK: CpuCopy32(gPlttBufferUnfaded, gPlttBufferFaded, PLTT_SIZE); break; - case FAST_FADE_OUT_TO_WHTIE: + case FAST_FADE_OUT_TO_WHITE: CpuFill32(0xFFFFFFFF, gPlttBufferFaded, PLTT_SIZE); break; case FAST_FADE_OUT_TO_BLACK: @@ -838,10 +839,10 @@ void BlendPalettesUnfaded(u32 selectedPalettes, u8 coeff, u16 color) void TintPalette_GrayScale(u16 *palette, u16 count) { - s32 r; - s32 g; - s32 b; - s32 gray; + int r; + int g; + int b; + u32 gray; int i; for (i = 0; i < count; i++) @@ -850,23 +851,22 @@ void TintPalette_GrayScale(u16 *palette, u16 count) g = (*palette >> 5) & 0x1F; b = (*palette >> 10) & 0x1F; - r *= 0x4C; - r += g * 0x97; - r += b * 0x1D; + r = r * Q_8_8(0.2969); + r += g * Q_8_8(0.5899); + r += b * Q_8_8(0.1133); gray = r >> 8; *palette++ = gray << 10 | gray << 5 | gray; } - return; } void TintPalette_GrayScale2(u16 *palette, u16 count) { - s32 r; - s32 g; - s32 b; - s32 gray; + int r; + int g; + int b; + u32 gray; int i; for (i = 0; i < count; i++) @@ -875,28 +875,27 @@ void TintPalette_GrayScale2(u16 *palette, u16 count) g = (*palette >> 5) & 0x1F; b = (*palette >> 10) & 0x1F; - r *= 0x4C; - r += g * 0x97; - r += b * 0x1D; + r = r * Q_8_8(0.2969); + r += g * Q_8_8(0.5899); + r += b * Q_8_8(0.1133); gray = r >> 8; - if ((u32)gray > 0x1F) + if (gray > 0x1F) gray = 0x1F; - gray = sUnknown_0852489C[gray]; + gray = sRoundedDownGrayscaleMap[gray]; *palette++ = gray << 10 | gray << 5 | gray; } - return; } #ifdef NONMATCHING void TintPalette_SepiaTone(u16 *palette, u16 count) { - s32 r; - s32 g; - s32 b; + int red; + int green; + int blue; u32 gray; u32 sepia; s8 r2; @@ -929,7 +928,6 @@ void TintPalette_SepiaTone(u16 *palette, u16 count) *palette++ = b2 << 10 | g2 << 5 | r2; } - return; } #else __attribute__((naked)) @@ -995,7 +993,7 @@ _080A2BA2:\n\ #endif // NONMATCHING #ifdef NONMATCHING -void sub_80A2BAC(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) +void TintPalette_CustomTone(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) { s32 r; s32 g; @@ -1039,7 +1037,7 @@ void sub_80A2BAC(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) } #else __attribute__((naked)) -void sub_80A2BAC(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) +void TintPalette_CustomTone(u16 *palette, u16 count, u16 a3, u16 a4, u16 a5) { asm("push {r4-r7,lr}\n\ mov r7, r9\n\ @@ -1153,7 +1151,7 @@ void sub_80A2C44(u32 a1, s8 a2, u8 a3, u8 a4, u16 a5, u8 a6, u8 a7) gTasks[taskId].func(taskId); } -u32 sub_80A2CF8(u8 var) +bool32 sub_80A2CF8(u8 var) { int i; @@ -1181,7 +1179,7 @@ void sub_80A2D54(u8 taskId) { u32 wordVar; s16 *data; - u16 temp; + s16 temp; data = gTasks[taskId].data; wordVar = GetWordTaskArg(taskId, 5); @@ -1191,7 +1189,7 @@ void sub_80A2D54(u8 taskId) data[4] = 0; BlendPalettes(wordVar, data[0], data[7]); temp = data[1]; - if (data[0] == (s16)temp) + if (data[0] == temp) { DestroyTask(taskId); } @@ -1200,12 +1198,12 @@ void sub_80A2D54(u8 taskId) data[0] += data[2]; if (data[2] >= 0) { - if (data[0] < (s16)temp) + if (data[0] < temp) { return; } } - else if (data[0] > (s16)temp) + else if (data[0] > temp) { return; } diff --git a/src/region_map.c b/src/region_map.c index f28f07d52..086c0ba68 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -21,6 +21,7 @@ #include "m4a.h" #include "field_effect.h" #include "region_map.h" +#include "constants/region_map_sections.h" #define MAP_WIDTH 28 #define MAP_HEIGHT 15 @@ -306,7 +307,7 @@ static const struct { } gUnknown_085A1EDC[] = { gUnknown_085A1ED4, MAPSEC_EVER_GRANDE_CITY, - FLAG_SYS_POKEMON_LEAGUE_FLY + FLAG_LANDMARK_POKEMON_LEAGUE }; static const struct BgTemplate gUnknown_085A1EE4[] = { @@ -327,7 +328,7 @@ static const struct SpritePalette gUnknown_085A1F10 = { }; static const u16 sUnknown_085A1F18[][2] = { - {FLAG_UNLOCK_BATTLE_FRONTIER, MAPSEC_BATTLE_FRONTIER}, + {FLAG_LANDMARK_BATTLE_FRONTIER, MAPSEC_BATTLE_FRONTIER}, {-1, MAPSEC_NONE} }; @@ -1126,9 +1127,9 @@ static u8 get_flagnr_blue_points(u16 mapSecId) case MAPSEC_EVER_GRANDE_CITY: return FlagGet(FLAG_VISITED_EVER_GRANDE_CITY) ? MAPSECTYPE_CITY_CANFLY : MAPSECTYPE_CITY_CANTFLY; case MAPSEC_BATTLE_FRONTIER: - return FlagGet(FLAG_UNLOCK_BATTLE_FRONTIER) ? MAPSECTYPE_BATTLE_FRONTIER : MAPSECTYPE_NONE; + return FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER) ? MAPSECTYPE_BATTLE_FRONTIER : MAPSECTYPE_NONE; case MAPSEC_SOUTHERN_ISLAND: - return FlagGet(FLAG_UNLOCK_SOUTHERN_ISLAND) ? MAPSECTYPE_PLAIN : MAPSECTYPE_NONE; + return FlagGet(FLAG_LANDMARK_SOUTHERN_ISLAND) ? MAPSECTYPE_PLAIN : MAPSECTYPE_NONE; default: return MAPSECTYPE_PLAIN; } @@ -1916,7 +1917,7 @@ static void sub_8124E0C(void) sub_8084CCC(gSaveBlock2Ptr->playerGender == MALE ? 0x0C : 0x0D); break; case MAPSEC_EVER_GRANDE_CITY: - sub_8084CCC(FlagGet(FLAG_SYS_POKEMON_LEAGUE_FLY) && gUnknown_0203A148->regionMap.posWithinMapSec == 0 ? 0x14 : 0x0B); + sub_8084CCC(FlagGet(FLAG_LANDMARK_POKEMON_LEAGUE) && gUnknown_0203A148->regionMap.posWithinMapSec == 0 ? 0x14 : 0x0B); break; default: if (sUnknown_085A1E3C[gUnknown_0203A148->regionMap.mapSecId][2] != 0) @@ -1,5 +1,3 @@ - -// Includes #include "global.h" #include "rtc.h" #include "overworld.h" @@ -34,6 +32,7 @@ #include "naming_screen.h" #include "malloc.h" #include "region_map.h" +#include "constants/region_map_sections.h" #include "decoration.h" #include "secret_base.h" #include "tv.h" @@ -6504,7 +6503,7 @@ void DoTVShowTodaysRivalTrainer(void) break; case 1: TV_PrintIntToStringVar(0, show->rivalTrainer.badgeCount); - if (FlagGet(CODE_FLAGS + 0x48)) + if (FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) { if (show->rivalTrainer.nSilverSymbols || show->rivalTrainer.nGoldSymbols) { @@ -6521,7 +6520,7 @@ void DoTVShowTodaysRivalTrainer(void) } break; case 2: - if (FlagGet(CODE_FLAGS + 0x48)) + if (FlagGet(FLAG_LANDMARK_BATTLE_FRONTIER)) { if (show->rivalTrainer.nSilverSymbols || show->rivalTrainer.nGoldSymbols) { |