diff --git a/src/map_name_popup.c b/src/map_name_popup.c index 1faecf9ac..59b1622eb 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -1,4 +1,6 @@ #include "global.h" +#include "constants/region_map_sections.h" +#include "constants/weather.h" #include "bg.h" #include "event_data.h" #include "gpu_regs.h" @@ -11,6 +13,8 @@ #include "start_menu.h" #include "string_util.h" #include "task.h" +#include "text.h" + // enums enum MapPopUp_Themes @@ -66,14 +70,32 @@ static const u16 gUnknown_0857F444[16] = INCBIN_U16("graphics/interface/map_popu static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] = { - //TO-DO: Replace with enum entries - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x02, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x02, - 0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x05, - 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x05, - 0x02, 0x05, 0x05, 0x05, 0x02, 0x02, 0x02, 0x01 + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_BRICK, + MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK, + MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, + MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_UNDERWATER, + MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, + MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, + MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, + MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_STONE, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_MARBLE, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_WOOD, + MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, MAPPOPUP_THEME_STONE2, + MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_STONE, MAPPOPUP_THEME_MARBLE }; static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1"); @@ -226,9 +248,9 @@ static void ShowMapNamePopUpWindow(void) AddMapNamePopUpWindow(); LoadMapNamePopUpWindowBg(); x = GetStringCenterAlignXOffset(7, withoutPrefixPtr, 80); - mapDisplayHeader[0] = 0xFC; - mapDisplayHeader[1] = 0x2; - mapDisplayHeader[2] = 0x0; + mapDisplayHeader[0] = EXT_CTRL_CODE_BEGIN; + mapDisplayHeader[1] = EXT_CTRL_CODE_HIGHLIGHT; + mapDisplayHeader[2] = TEXT_COLOR_TRANSPARENT; PrintTextOnWindow(GetMapNamePopUpWindowId(), 7, mapDisplayHeader, x, 3, 0xFF, NULL); CopyWindowToVram(GetMapNamePopUpWindowId(), 3); } @@ -432,19 +454,19 @@ static void LoadMapNamePopUpWindowBg(void) popupWindowId = GetMapNamePopUpWindowId(); regionMapSectionId = gMapHeader.regionMapSectionId; - if(regionMapSectionId > 0x57) + if(regionMapSectionId > MAPSEC_DYNAMIC) { - if(regionMapSectionId > 0xC4) - regionMapSectionId -= 0x6D; + if(regionMapSectionId > MAPSEC_SPECIAL_AREA) + regionMapSectionId -= (MAPSEC_SPECIAL_AREA - MAPSEC_DYNAMIC); else - regionMapSectionId = 0; + regionMapSectionId = 0; //discard kanto region sections } popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId]; LoadBgTiles(GetWindowAttribute(popupWindowId, 0), &(gMapPopUp_Outline_Table[popUpThemeId][0]), 0x400, 0x21D); CallWindowFunction(popupWindowId, sub_80D4A78); PutWindowTilemap(popupWindowId); - if(gMapHeader.weather == 0xE) + if(gMapHeader.weather == WEATHER_BUBBLES) LoadPalette(&gUnknown_0857F444, 0xE0, 0x20); else LoadPalette(&(gMapPopUp_Palette_Table[popUpThemeId][0]), 0xE0, 0x20); diff --git a/src/map_obj_lock.c b/src/map_obj_lock.c index e6a28d416..688d0594d 100644 --- a/src/map_obj_lock.c +++ b/src/map_obj_lock.c @@ -139,35 +139,35 @@ static void sub_80985BC(u8 taskId) void sub_8098630(void) { - u8 mapObjectIdArray0, mapObjectIdArray1, taskId; - mapObjectIdArray0 = GetChosenApproachingTrainerMapObjectId(0); + u8 trainerObjectId1, trainerObjectId2, taskId; + trainerObjectId1 = GetChosenApproachingTrainerMapObjectId(0); if(gNoOfApproachingTrainers == 2) { - mapObjectIdArray1 = GetChosenApproachingTrainerMapObjectId(1); - sub_8098074(mapObjectIdArray0, mapObjectIdArray1); + trainerObjectId2 = GetChosenApproachingTrainerMapObjectId(1); + sub_8098074(trainerObjectId1, trainerObjectId2); taskId = CreateTask(sub_80985BC, 80); - gTasks[taskId].data[2] = mapObjectIdArray0; - if(!gMapObjects[mapObjectIdArray0].mapobj_bit_1) + gTasks[taskId].data[2] = trainerObjectId1; + if(!gMapObjects[trainerObjectId1].mapobj_bit_1) { - FreezeMapObject(&gMapObjects[mapObjectIdArray0]); + FreezeMapObject(&gMapObjects[trainerObjectId1]); gTasks[taskId].data[1] = 1; } taskId = CreateTask(sub_80985BC, 81); - gTasks[taskId].data[2] = mapObjectIdArray1; - if(!gMapObjects[mapObjectIdArray1].mapobj_bit_1) + gTasks[taskId].data[2] = trainerObjectId2; + if(!gMapObjects[trainerObjectId2].mapobj_bit_1) { - FreezeMapObject(&gMapObjects[mapObjectIdArray1]); + FreezeMapObject(&gMapObjects[trainerObjectId2]); gTasks[taskId].data[1] = 1; } } else { - FreezeMapObjectsExceptOne(mapObjectIdArray0); + FreezeMapObjectsExceptOne(trainerObjectId1); taskId = CreateTask(sub_80985BC, 80); - gTasks[taskId].data[2] = mapObjectIdArray0; - if(!gMapObjects[mapObjectIdArray0].mapobj_bit_1) + gTasks[taskId].data[2] = trainerObjectId1; + if(!gMapObjects[trainerObjectId1].mapobj_bit_1) { - FreezeMapObject(&gMapObjects[mapObjectIdArray0]); + FreezeMapObject(&gMapObjects[trainerObjectId1]); gTasks[taskId].data[1] = 1; } } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index bbe2a4059..e7fcce629 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -2778,23 +2778,23 @@ void sub_81C2C38(u8 a) u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) { - u8 *r4 = &(gUnknown_0203CF1C->unk40CB[a]); - if (*r4 == 0xFF) + u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]); + if (*windowIdPtr == 0xFF) { - *r4 = AddWindow(&template[a]); - FillWindowPixelBuffer(*r4, 0); + *windowIdPtr = AddWindow(&template[a]); + FillWindowPixelBuffer(*windowIdPtr, 0); } - return *r4; + return *windowIdPtr; } void sub_81C2D68(u8 a) { - u8 *r4 = &(gUnknown_0203CF1C->unk40CB[a]); - if (*r4 != 0xFF) + u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]); + if (*windowIdPtr != 0xFF) { - ClearWindowTilemap(*r4); - RemoveWindow(*r4); - *r4 = 0xFF; + ClearWindowTilemap(*windowIdPtr); + RemoveWindow(*windowIdPtr); + *windowIdPtr = 0xFF; } }