- 119
- Posts
- 15
- Years
- Mt. Silver
- Seen Aug 4, 2024
In my attempt to change the Pokémon summary (or status) screen (PSS) I've run into some difficulties I can't seem to solve myself.
When replacing the tilemaps for the respective pages of the screen, it only changes those pages partially. Some parts of the screen are changed within the code of the game, most likely in src/pokemon_summary_screen.c.
Now there are different things the code changes, which include (1) pagination at the top of the screen; (2) showing/hiding the power/accuracy window when selecting a move; (3) changing the tiles in the moves list to accommodate for "cancel" when selecting a move, and after having selected a move; (4) various tiles in the bottom left corner of the screen on some pages (where the power/accuracy window is supposed to appear).
Now, I do not mind the pagination as is, and I will leave what happens when selecting a move for now. What bothers me most of all is nr. 4: the bottom left corner of the tilemap is not loaded into the screen. My question therefore is: Where in the code is this triggered, and how do I disable it? I would like the entire tilemap as shown in Tilemap studio to display for each page of the PSS. This would allow me then to replace it with a graphic of my own design.
In order to show what is happening, I replaced the original tilemaps for the PSS pages "Info", "Skills" and "Battle Moves" with fully colored pages. This is how they look like in Tilemap Studio:
And this is how they are displayed in-game:
As you can see, for page "Info", it loads a number of specific tiles in the bottom left corner. Page "Skills" is loaded in its entirety, so that's good. This is the way I would like it to be. Page "Battle Moves" however turns the bottom left corner into transparent tiles.
Of course, I've made an attempt at identifying the functions at work here. Here are some candidates, but in no case have I managed to turn off the abovementioned changes...
So I hope someone has already tried to edit the summary screen and can point me in the right direction. Many thanks in advance.
When replacing the tilemaps for the respective pages of the screen, it only changes those pages partially. Some parts of the screen are changed within the code of the game, most likely in src/pokemon_summary_screen.c.
Now there are different things the code changes, which include (1) pagination at the top of the screen; (2) showing/hiding the power/accuracy window when selecting a move; (3) changing the tiles in the moves list to accommodate for "cancel" when selecting a move, and after having selected a move; (4) various tiles in the bottom left corner of the screen on some pages (where the power/accuracy window is supposed to appear).
Now, I do not mind the pagination as is, and I will leave what happens when selecting a move for now. What bothers me most of all is nr. 4: the bottom left corner of the tilemap is not loaded into the screen. My question therefore is: Where in the code is this triggered, and how do I disable it? I would like the entire tilemap as shown in Tilemap studio to display for each page of the PSS. This would allow me then to replace it with a graphic of my own design.
In order to show what is happening, I replaced the original tilemaps for the PSS pages "Info", "Skills" and "Battle Moves" with fully colored pages. This is how they look like in Tilemap Studio:
![[PokeCommunity.com] [pokeemerald] Editing the summary (status) screen [PokeCommunity.com] [pokeemerald] Editing the summary (status) screen](https://i.ibb.co/djC8XLD/All.jpg)
And this is how they are displayed in-game:
![[PokeCommunity.com] [pokeemerald] Editing the summary (status) screen [PokeCommunity.com] [pokeemerald] Editing the summary (status) screen](https://i.ibb.co/WghhXzr/pss-edited-2.png)
![[PokeCommunity.com] [pokeemerald] Editing the summary (status) screen [PokeCommunity.com] [pokeemerald] Editing the summary (status) screen](https://i.ibb.co/kXcmWNR/pss-edited-3.png)
![[PokeCommunity.com] [pokeemerald] Editing the summary (status) screen [PokeCommunity.com] [pokeemerald] Editing the summary (status) screen](https://i.ibb.co/BqdwH7Y/pss-edited-1.png)
As you can see, for page "Info", it loads a number of specific tiles in the bottom left corner. Page "Skills" is loaded in its entirety, so that's good. This is the way I would like it to be. Page "Battle Moves" however turns the bottom left corner into transparent tiles.
Of course, I've made an attempt at identifying the functions at work here. Here are some candidates, but in no case have I managed to turn off the abovementioned changes...
Spoiler:
The undocumented and hence cryptic TilemapCtrl struct:
Something in this function determining the default tilemaps:
These functions literally called "change tilemap" and the functions "handling" the tilemaps in the bottom left corner (?):
Code:
struct TilemapCtrl
{
const u16 *gfx;
u16 field_4;
u8 field_6;
u8 field_7;
u8 field_8;
u8 field_9;
};
static const u16 sStatusTilemap[] = INCBIN_U16("graphics/interface/status_tilemap.bin");
static const struct TilemapCtrl sStatusTilemapCtrl1 =
{
sStatusTilemap, 1, 10, 2, 0, 18
};
static const struct TilemapCtrl sStatusTilemapCtrl2 =
{
sStatusTilemap, 1, 10, 2, 0, 50
};
static const struct TilemapCtrl sBattleMoveTilemapCtrl =
{
gSummaryScreenPowAcc_Tilemap, 0, 10, 7, 0, 45
};
static const struct TilemapCtrl sContestMoveTilemapCtrl =
{
gSummaryScreenAppealJam_Tilemap, 0, 10, 7, 0, 45
};
Something in this function determining the default tilemaps:
Code:
static void SetDefaultTilemaps(void)
{
if (sMonSummaryScreen->currPageIndex != PSS_PAGE_BATTLE_MOVES && sMonSummaryScreen->currPageIndex != PSS_PAGE_CONTEST_MOVES)
{
HandlePowerAccTilemap(0, 0xFF);
HandleAppealJamTilemap(0, 0xFF, 0);
}
else
{
DrawContestMoveHearts(sMonSummaryScreen->summary.moves[sMonSummaryScreen->firstMoveIndex]);
TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], 3, FALSE);
TilemapFiveMovesDisplay(sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0], 1, FALSE);
SetBgTilemapBuffer(1, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_CONTEST_MOVES][0]);
SetBgTilemapBuffer(2, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0]);
ChangeBgX(2, 0x10000, 1);
ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES);
ClearWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
}
if (sMonSummaryScreen->summary.ailment == AILMENT_NONE)
HandleStatusTilemap(0, 0xFF);
else if (sMonSummaryScreen->currPageIndex != PSS_PAGE_BATTLE_MOVES && sMonSummaryScreen->currPageIndex != PSS_PAGE_CONTEST_MOVES)
PutWindowTilemap(PSS_LABEL_WINDOW_POKEMON_SKILLS_STATUS);
LimitEggSummaryPageDisplay();
DrawPokerusCuredSymbol(&sMonSummaryScreen->currentMon);
}
These functions literally called "change tilemap" and the functions "handling" the tilemaps in the bottom left corner (?):
Code:
static void ChangeTilemap(const struct TilemapCtrl *unkStruct, u16 *dest, u8 c, bool8 d)
{
u16 i;
u16 *alloced = Alloc(unkStruct->field_6 * 2 * unkStruct->field_7);
CpuFill16(unkStruct->field_4, alloced, unkStruct->field_6 * 2 * unkStruct->field_7);
if (unkStruct->field_6 != c)
{
if (!d)
{
for (i = 0; i < unkStruct->field_7; i++)
CpuCopy16(&unkStruct->gfx[c + unkStruct->field_6 * i], &alloced[unkStruct->field_6 * i], (unkStruct->field_6 - c) * 2);
}
else
{
for (i = 0; i < unkStruct->field_7; i++)
CpuCopy16(&unkStruct->gfx[unkStruct->field_6 * i], &alloced[c + unkStruct->field_6 * i], (unkStruct->field_6 - c) * 2);
}
}
for (i = 0; i < unkStruct->field_7; i++)
CpuCopy16(&alloced[unkStruct->field_6 * i], &dest[(unkStruct->field_9 + i) * 32 + unkStruct->field_8], unkStruct->field_6 * 2);
Free(alloced);
}
static void HandlePowerAccTilemap(u16 a, s16 b)
{
if (b > sBattleMoveTilemapCtrl.field_6)
b = sBattleMoveTilemapCtrl.field_6;
if (b == 0 || b == sBattleMoveTilemapCtrl.field_6)
{
ChangeTilemap(&sBattleMoveTilemapCtrl, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_BATTLE_MOVES][0], b, TRUE);
}
else
{
u8 taskId = FindTaskIdByFunc(Task_ShowPowerAccWindow);
if (taskId == TASK_NONE)
taskId = CreateTask(Task_ShowPowerAccWindow, 8);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = a;
}
}
(...)
static void HandleStatusTilemap(u16 a, s16 b)
{
if (b > sStatusTilemapCtrl1.field_6)
b = sStatusTilemapCtrl1.field_6;
if (b == 0 || b == sStatusTilemapCtrl1.field_6)
{
ChangeTilemap(&sStatusTilemapCtrl1, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0], b, FALSE);
ChangeTilemap(&sStatusTilemapCtrl2, sMonSummaryScreen->bgTilemapBuffers[PSS_PAGE_INFO][0], b, FALSE);
}
else
{
u8 taskId = CreateTask(Task_ShowStatusWindow, 8);
gTasks[taskId].data[0] = b;
gTasks[taskId].data[1] = a;
}
}
So I hope someone has already tried to edit the summary screen and can point me in the right direction. Many thanks in advance.