Done requested changes

This commit is contained in:
KDSKardabox
2018-04-12 22:36:07 +05:30
parent 66e76d9633
commit ac7d69eb6e
3 changed files with 62 additions and 40 deletions
+38 -16
View File
@@ -1,4 +1,6 @@
#include "global.h" #include "global.h"
#include "constants/region_map_sections.h"
#include "constants/weather.h"
#include "bg.h" #include "bg.h"
#include "event_data.h" #include "event_data.h"
#include "gpu_regs.h" #include "gpu_regs.h"
@@ -11,6 +13,8 @@
#include "start_menu.h" #include "start_menu.h"
#include "string_util.h" #include "string_util.h"
#include "task.h" #include "task.h"
#include "text.h"
// enums // enums
enum MapPopUp_Themes 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[] = static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] =
{ {
//TO-DO: Replace with enum entries MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_BRICK,
0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK, MAPPOPUP_THEME_MARBLE, MAPPOPUP_THEME_BRICK,
0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x02, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x02, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x05, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_UNDERWATER,
0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x05, MAPPOPUP_THEME_UNDERWATER, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD, MAPPOPUP_THEME_WOOD,
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_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"); static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1");
@@ -226,9 +248,9 @@ static void ShowMapNamePopUpWindow(void)
AddMapNamePopUpWindow(); AddMapNamePopUpWindow();
LoadMapNamePopUpWindowBg(); LoadMapNamePopUpWindowBg();
x = GetStringCenterAlignXOffset(7, withoutPrefixPtr, 80); x = GetStringCenterAlignXOffset(7, withoutPrefixPtr, 80);
mapDisplayHeader[0] = 0xFC; mapDisplayHeader[0] = EXT_CTRL_CODE_BEGIN;
mapDisplayHeader[1] = 0x2; mapDisplayHeader[1] = EXT_CTRL_CODE_HIGHLIGHT;
mapDisplayHeader[2] = 0x0; mapDisplayHeader[2] = TEXT_COLOR_TRANSPARENT;
PrintTextOnWindow(GetMapNamePopUpWindowId(), 7, mapDisplayHeader, x, 3, 0xFF, NULL); PrintTextOnWindow(GetMapNamePopUpWindowId(), 7, mapDisplayHeader, x, 3, 0xFF, NULL);
CopyWindowToVram(GetMapNamePopUpWindowId(), 3); CopyWindowToVram(GetMapNamePopUpWindowId(), 3);
} }
@@ -432,19 +454,19 @@ static void LoadMapNamePopUpWindowBg(void)
popupWindowId = GetMapNamePopUpWindowId(); popupWindowId = GetMapNamePopUpWindowId();
regionMapSectionId = gMapHeader.regionMapSectionId; regionMapSectionId = gMapHeader.regionMapSectionId;
if(regionMapSectionId > 0x57) if(regionMapSectionId > MAPSEC_DYNAMIC)
{ {
if(regionMapSectionId > 0xC4) if(regionMapSectionId > MAPSEC_SPECIAL_AREA)
regionMapSectionId -= 0x6D; regionMapSectionId -= (MAPSEC_SPECIAL_AREA - MAPSEC_DYNAMIC);
else else
regionMapSectionId = 0; regionMapSectionId = 0; //discard kanto region sections
} }
popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId]; popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId];
LoadBgTiles(GetWindowAttribute(popupWindowId, 0), &(gMapPopUp_Outline_Table[popUpThemeId][0]), 0x400, 0x21D); LoadBgTiles(GetWindowAttribute(popupWindowId, 0), &(gMapPopUp_Outline_Table[popUpThemeId][0]), 0x400, 0x21D);
CallWindowFunction(popupWindowId, sub_80D4A78); CallWindowFunction(popupWindowId, sub_80D4A78);
PutWindowTilemap(popupWindowId); PutWindowTilemap(popupWindowId);
if(gMapHeader.weather == 0xE) if(gMapHeader.weather == WEATHER_BUBBLES)
LoadPalette(&gUnknown_0857F444, 0xE0, 0x20); LoadPalette(&gUnknown_0857F444, 0xE0, 0x20);
else else
LoadPalette(&(gMapPopUp_Palette_Table[popUpThemeId][0]), 0xE0, 0x20); LoadPalette(&(gMapPopUp_Palette_Table[popUpThemeId][0]), 0xE0, 0x20);
+14 -14
View File
@@ -139,35 +139,35 @@ static void sub_80985BC(u8 taskId)
void sub_8098630(void) void sub_8098630(void)
{ {
u8 mapObjectIdArray0, mapObjectIdArray1, taskId; u8 trainerObjectId1, trainerObjectId2, taskId;
mapObjectIdArray0 = GetChosenApproachingTrainerMapObjectId(0); trainerObjectId1 = GetChosenApproachingTrainerMapObjectId(0);
if(gNoOfApproachingTrainers == 2) if(gNoOfApproachingTrainers == 2)
{ {
mapObjectIdArray1 = GetChosenApproachingTrainerMapObjectId(1); trainerObjectId2 = GetChosenApproachingTrainerMapObjectId(1);
sub_8098074(mapObjectIdArray0, mapObjectIdArray1); sub_8098074(trainerObjectId1, trainerObjectId2);
taskId = CreateTask(sub_80985BC, 80); taskId = CreateTask(sub_80985BC, 80);
gTasks[taskId].data[2] = mapObjectIdArray0; gTasks[taskId].data[2] = trainerObjectId1;
if(!gMapObjects[mapObjectIdArray0].mapobj_bit_1) if(!gMapObjects[trainerObjectId1].mapobj_bit_1)
{ {
FreezeMapObject(&gMapObjects[mapObjectIdArray0]); FreezeMapObject(&gMapObjects[trainerObjectId1]);
gTasks[taskId].data[1] = 1; gTasks[taskId].data[1] = 1;
} }
taskId = CreateTask(sub_80985BC, 81); taskId = CreateTask(sub_80985BC, 81);
gTasks[taskId].data[2] = mapObjectIdArray1; gTasks[taskId].data[2] = trainerObjectId2;
if(!gMapObjects[mapObjectIdArray1].mapobj_bit_1) if(!gMapObjects[trainerObjectId2].mapobj_bit_1)
{ {
FreezeMapObject(&gMapObjects[mapObjectIdArray1]); FreezeMapObject(&gMapObjects[trainerObjectId2]);
gTasks[taskId].data[1] = 1; gTasks[taskId].data[1] = 1;
} }
} }
else else
{ {
FreezeMapObjectsExceptOne(mapObjectIdArray0); FreezeMapObjectsExceptOne(trainerObjectId1);
taskId = CreateTask(sub_80985BC, 80); taskId = CreateTask(sub_80985BC, 80);
gTasks[taskId].data[2] = mapObjectIdArray0; gTasks[taskId].data[2] = trainerObjectId1;
if(!gMapObjects[mapObjectIdArray0].mapobj_bit_1) if(!gMapObjects[trainerObjectId1].mapobj_bit_1)
{ {
FreezeMapObject(&gMapObjects[mapObjectIdArray0]); FreezeMapObject(&gMapObjects[trainerObjectId1]);
gTasks[taskId].data[1] = 1; gTasks[taskId].data[1] = 1;
} }
} }
+10 -10
View File
@@ -2778,23 +2778,23 @@ void sub_81C2C38(u8 a)
u8 sub_81C2D2C(struct WindowTemplate *template, u8 a) u8 sub_81C2D2C(struct WindowTemplate *template, u8 a)
{ {
u8 *r4 = &(gUnknown_0203CF1C->unk40CB[a]); u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]);
if (*r4 == 0xFF) if (*windowIdPtr == 0xFF)
{ {
*r4 = AddWindow(&template[a]); *windowIdPtr = AddWindow(&template[a]);
FillWindowPixelBuffer(*r4, 0); FillWindowPixelBuffer(*windowIdPtr, 0);
} }
return *r4; return *windowIdPtr;
} }
void sub_81C2D68(u8 a) void sub_81C2D68(u8 a)
{ {
u8 *r4 = &(gUnknown_0203CF1C->unk40CB[a]); u8 *windowIdPtr = &(gUnknown_0203CF1C->unk40CB[a]);
if (*r4 != 0xFF) if (*windowIdPtr != 0xFF)
{ {
ClearWindowTilemap(*r4); ClearWindowTilemap(*windowIdPtr);
RemoveWindow(*r4); RemoveWindow(*windowIdPtr);
*r4 = 0xFF; *windowIdPtr = 0xFF;
} }
} }