Document map_name_popup task fields

This commit is contained in:
PikalaxALT
2020-03-29 10:42:31 -04:00
parent 75ae00beff
commit 581ec47ae2
7 changed files with 72 additions and 51 deletions
+1 -1
View File
@@ -1437,7 +1437,7 @@
// SPECIAL FLAGS (unknown purpose)
#define SPECIAL_FLAGS_START 0x4000
#define SPECIAL_FLAGS_COUNT 16
#define FLAG_SPECIAL_FLAG_0x4000 0x4000
#define FLAG_DONT_SHOW_MAP_NAME_POPUP 0x4000
#define FLAG_DONT_TRANSITION_MUSIC 0x4001
#define FLAG_SPECIAL_FLAG_0x4002 0x4002
#define FLAG_SPECIAL_FLAG_0x4003 0x4003
+1 -1
View File
@@ -916,7 +916,7 @@ extern const u8 gText_GiveUpTryingToTeachNewMove[];
extern const u8 gText_DecimalPoint[];
// map_name_popup
extern const u8 gUnknown_841D18D[];
extern const u8 gText_Rooftop2[];
// option menu
extern const u8 gText_TextSpeed[];
+2 -2
View File
@@ -738,7 +738,7 @@ static void CB2_Credits(void)
sCreditsMgr->unk_1D++;
break;
case 2:
FlagClear(FLAG_SPECIAL_FLAG_0x4000);
FlagClear(FLAG_DONT_SHOW_MAP_NAME_POPUP);
gDisableMapMusicChangeOnMapLoad = MUSIC_DISABLE_OFF;
Free(sCreditsMgr);
SoftReset(RESET_ALL);
@@ -785,7 +785,7 @@ static bool32 DoOverworldMapScrollScene(UNUSED u8 unused)
switch (sCreditsMgr->subseqno)
{
case 0:
FlagSet(FLAG_SPECIAL_FLAG_0x4000);
FlagSet(FLAG_DONT_SHOW_MAP_NAME_POPUP);
gDisableMapMusicChangeOnMapLoad = MUSIC_DISABLE_KEEP;
sCreditsMgr->ovwldseqno = 0;
sCreditsMgr->subseqno++;
+1 -1
View File
@@ -706,7 +706,7 @@ static void Task_Hof_HandleExit(u8 taskId)
static void SetWarpsToRollCredits(void)
{
VarSet(VAR_MAP_SCENE_INDIGO_PLATEAU_EXTERIOR, 1);
FlagSet(FLAG_SPECIAL_FLAG_0x4000);
FlagSet(FLAG_DONT_SHOW_MAP_NAME_POPUP);
gDisableMapMusicChangeOnMapLoad = 2;
SetWarpDestination(MAP_GROUP(INDIGO_PLATEAU_EXTERIOR), MAP_NUM(INDIGO_PLATEAU_EXTERIOR), -1, 11, 6);
DoWarp();
+65 -44
View File
@@ -18,26 +18,36 @@ static u16 MapNamePopupCreateWindow(bool32 palIntoFadedBuffer);
static void MapNamePopupPrintMapNameOnWindow(u16 windowId);
static u8 *MapNamePopupAppendFloorNum(u8 *dest, s8 flags);
#define tState data[0]
#define tTimer data[1]
#define tPos data[2]
#define tReshow data[3]
#define tWindowId data[4]
#define tWindowExists data[5]
#define tWindowCleared data[6]
#define tWindowDestroyed data[7]
#define tPalIntoFadedBuffer data[8]
void ShowMapNamePopup(bool32 palIntoFadedBuffer)
{
u8 taskId;
if (FlagGet(FLAG_SPECIAL_FLAG_0x4000) != TRUE && !(gQuestLogState == 2 || gQuestLogState == 3))
if (FlagGet(FLAG_DONT_SHOW_MAP_NAME_POPUP) != TRUE && !(gQuestLogState == QL_STATE_2 || gQuestLogState == QL_STATE_3))
{
taskId = FindTaskIdByFunc(Task_MapNamePopup);
if (taskId == 0xFF)
{
taskId = CreateTask(Task_MapNamePopup, 90);
ChangeBgX(0, 0x00000000, 0);
ChangeBgY(0, 0xFFFFEF7F, 0);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[8] = palIntoFadedBuffer;
ChangeBgX(0, 0x0000, 0);
ChangeBgY(0, -0x1081, 0);
gTasks[taskId].tState = 0;
gTasks[taskId].tPos = 0;
gTasks[taskId].tPalIntoFadedBuffer = palIntoFadedBuffer;
}
else
{
if (gTasks[taskId].data[0] != 4)
gTasks[taskId].data[0] = 4;
gTasks[taskId].data[3] = 1;
if (gTasks[taskId].tState != 4)
gTasks[taskId].tState = 4;
gTasks[taskId].tReshow = 1;
}
}
}
@@ -45,71 +55,71 @@ void ShowMapNamePopup(bool32 palIntoFadedBuffer)
static void Task_MapNamePopup(u8 taskId)
{
struct Task * task = &gTasks[taskId];
switch (task->data[0])
switch (task->tState)
{
case 0:
task->data[4] = MapNamePopupCreateWindow(task->data[8]);
task->data[5] = 1;
task->data[0] = 1;
task->tWindowId = MapNamePopupCreateWindow(task->tPalIntoFadedBuffer);
task->tWindowExists = 1;
task->tState = 1;
break;
case 1:
if (IsDma3ManagerBusyWithBgCopy())
break;
// fallthrough
case 2:
task->data[2] -= 2;
if (task->data[2] <= -24)
task->tPos -= 2;
if (task->tPos <= -24)
{
task->data[0] = 3;
task->data[1] = 0;
task->tState = 3;
task->tTimer = 0;
}
break;
case 3:
task->data[1]++;
if (task->data[1] > 120)
task->tTimer++;
if (task->tTimer > 120)
{
task->data[1] = 0;
task->data[0] = 4;
task->tTimer = 0;
task->tState = 4;
}
break;
case 4:
task->data[2] += 2;
if (task->data[2] >= 0)
task->tPos += 2;
if (task->tPos >= 0)
{
if (task->data[3])
if (task->tReshow)
{
MapNamePopupPrintMapNameOnWindow(task->data[4]);
CopyWindowToVram(task->data[4], 2);
task->data[0] = 1;
task->data[3] = 0;
MapNamePopupPrintMapNameOnWindow(task->tWindowId);
CopyWindowToVram(task->tWindowId, 2);
task->tState = 1;
task->tReshow = 0;
}
else
{
task->data[0] = 6;
task->tState = 6;
return;
}
}
case 5:
break;
case 6:
if (task->data[5] && !task->data[6])
if (task->tWindowExists && !task->tWindowCleared)
{
rbox_fill_rectangle(task->data[4]);
CopyWindowToVram(task->data[4], 1);
task->data[6] = 1;
rbox_fill_rectangle(task->tWindowId);
CopyWindowToVram(task->tWindowId, 1);
task->tWindowCleared = TRUE;
}
task->data[0] = 7;
task->tState = 7;
return;
case 7:
if (!IsDma3ManagerBusyWithBgCopy())
{
if (task->data[5])
if (task->tWindowExists)
{
RemoveWindow(task->data[4]);
task->data[5] = 0;
task->data[7] = 1;
RemoveWindow(task->tWindowId);
task->tWindowExists = FALSE;
task->tWindowDestroyed = 1;
}
task->data[0] = 8;
task->tState = 8;
ChangeBgY(0, 0x00000000, 0);
}
return;
@@ -117,7 +127,7 @@ static void Task_MapNamePopup(u8 taskId)
DestroyTask(taskId);
return;
}
SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]);
SetGpuReg(REG_OFFSET_BG0VOFS, task->tPos);
}
void DismissMapNamePopup(void)
@@ -128,8 +138,8 @@ void DismissMapNamePopup(void)
if (taskId != 0xFF)
{
data = gTasks[taskId].data;
if (data[0] < 6)
data[0] = 6;
if (tState < 6)
tState = 6;
}
}
@@ -160,6 +170,7 @@ static u16 MapNamePopupCreateWindow(bool32 palintoFadedBuffer)
}
else
{
// ROOFTOP
windowTemplate.width += 8;
r6 = 0x02D;
}
@@ -194,7 +205,7 @@ static void MapNamePopupPrintMapNameOnWindow(u16 windowId)
}
xpos = (maxWidth - GetStringWidth(2, mapName, -1)) / 2;
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
AddTextPrinterParameterized(windowId, 2, mapName, xpos, 2, 0xFF, NULL);
AddTextPrinterParameterized(windowId, 2, mapName, xpos, 2, TEXT_SPEED_FF, NULL);
}
static u8 *MapNamePopupAppendFloorNum(u8 *dest, s8 floorNum)
@@ -203,7 +214,7 @@ static u8 *MapNamePopupAppendFloorNum(u8 *dest, s8 floorNum)
return dest;
*dest++ = CHAR_SPACE;
if (floorNum == 0x7F)
return StringCopy(dest, gUnknown_841D18D);
return StringCopy(dest, gText_Rooftop2);
if (floorNum < 0)
{
*dest++ = CHAR_B;
@@ -214,3 +225,13 @@ static u8 *MapNamePopupAppendFloorNum(u8 *dest, s8 floorNum)
*dest = EOS;
return dest;
}
#undef tPalIntoFadedBuffer
#undef tWindowDestroyed
#undef tWindowCleared
#undef tWindowExists
#undef tWindowId
#undef tReshow
#undef tPos
#undef tTimer
#undef tState
+1 -1
View File
@@ -1313,7 +1313,7 @@ static void Task_EndQuestLog(u8 taskId)
break;
default:
if (gUnknown_203AE94.unk_0_6 == 1)
ShowMapNamePopup(1);
ShowMapNamePopup(TRUE);
CpuCopy16(gUnknown_203AE90, gPlttBufferUnfaded, 0x400);
Free(gUnknown_203AE90);
gUnknown_203AE94 = (struct UnkStruct_203AE94){};
+1 -1
View File
@@ -1059,7 +1059,7 @@ ALIGNED(4) const u8 gText_Ghost[] = _("GHOST");
const u8 gText_PokemonOnHook[] = _("A POKéMON's on the hook!{PAUSE_UNTIL_PRESS}");
const u8 gText_NotEvenANibble[] = _("Not even a nibble‥{PAUSE_UNTIL_PRESS}");
const u8 gText_ItGotAway[] = _("It got away‥{PAUSE_UNTIL_PRESS}");
const u8 gUnknown_841D18D[] = _("ROOFTOP");
const u8 gText_Rooftop2[] = _("ROOFTOP");
ALIGNED(4) const u8 gString_PokemonFireRed_Staff[] = _("Pokémon FireRed Version\nStaff");
ALIGNED(4) const u8 gString_PokemonLeafGreen_Staff[] = _("Pokémon LeafGreen Version\nStaff");
ALIGNED(4) const u8 gCreditsString_Director[] = _("\n\nDirector\n\n\n\n");