pokeemerald/src/pokenav_conditions_2.c

886 lines
27 KiB
C
Raw Normal View History

2019-07-20 04:06:42 +02:00
#include "global.h"
#include "bg.h"
#include "window.h"
#include "pokenav.h"
2019-07-24 17:02:52 +02:00
#include "decompress.h"
#include "gpu_regs.h"
#include "graphics.h"
#include "menu.h"
#include "menu_specialized.h"
#include "mon_markings.h"
#include "palette.h"
#include "pokenav.h"
#include "scanline_effect.h"
#include "string_util.h"
#include "strings.h"
#include "text.h"
2019-07-20 04:06:42 +02:00
2020-10-11 00:17:34 +02:00
u32 LoopedTask_TransitionMons(s32);
u32 LoopedTask_ExitPartyConditionMenu(s32);
u32 LoopedTask_MoveCursorNoTransition(s32);
u32 LoopedTask_SlideMonOut(s32);
u32 LoopedTask_OpenMonMarkingsWindow(s32);
u32 LoopedTask_CloseMonMarkingsWindow(s32);
2019-07-20 04:06:42 +02:00
BSS_DATA u8 gUnknown_030012BC;
2019-07-20 18:30:41 +02:00
2020-08-10 19:48:16 +02:00
const u16 gConditionGraphData_Pal[] = INCBIN_U16("graphics/pokenav/condition/graph_data.gbapal");
2020-08-10 23:05:42 +02:00
const u16 gConditionText_Pal[] = INCBIN_U16("graphics/pokenav/condition/text.gbapal");
2019-07-20 04:06:42 +02:00
const u32 gUnknown_08623228[] = INCBIN_U32("graphics/pokenav/8623228.4bpp.lz");
2020-10-11 00:17:34 +02:00
const u32 sConditionGraph_Tilemap[] = INCBIN_U32("graphics/pokenav/862323C.bin.lz");
const u16 sConditionGraphMonMarkingsPal[] = INCBIN_U16("graphics/pokenav/8623338.gbapal");
2019-07-20 04:06:42 +02:00
2020-10-11 00:17:34 +02:00
const struct BgTemplate sPartyConditionBgTemplates[3] =
2019-07-20 04:06:42 +02:00
{
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 0x1F,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
},
{
.bg = 2,
.charBaseIndex = 3,
.mapBaseIndex = 0x1D,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0
},
{
.bg = 3,
.charBaseIndex = 2,
.mapBaseIndex = 0x1E,
.screenSize = 0,
.paletteMode = 0,
.priority = 3,
.baseTile = 0
}
};
2020-10-11 00:17:34 +02:00
const struct WindowTemplate sMonNameGenderWindowTemplate =
2019-07-20 04:06:42 +02:00
{
.bg = 1,
.tilemapLeft = 13,
.tilemapTop = 1,
.width = 13,
.height = 4,
.paletteNum = 15,
.baseBlock = 2
};
2020-10-11 00:17:34 +02:00
const struct WindowTemplate sConditionGraphListIdWindowTemplate =
2019-07-20 04:06:42 +02:00
{
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 6,
.width = 7,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x36
};
2020-10-11 00:17:34 +02:00
const struct WindowTemplate sUnusedWindowTemplate1 =
2019-07-20 04:06:42 +02:00
{
.bg = 1,
.tilemapLeft = 1,
.tilemapTop = 0x1C,
.width = 5,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x44
};
2020-10-11 00:17:34 +02:00
const struct WindowTemplate sUnusedWindowTemplate2 =
2019-07-20 04:06:42 +02:00
{
.bg = 1,
.tilemapLeft = 13,
.tilemapTop = 0x1C,
.width = 3,
.height = 2,
.paletteNum = 15,
.baseBlock = 0x44
};
2020-10-11 00:17:34 +02:00
const LoopedTask sPartyConditionLoopedTaskFuncs[] =
2019-07-20 04:06:42 +02:00
{
[PARTY_CONDITION_FUNC_NONE] = NULL,
[PARTY_CONDITION_FUNC_SLIDE_MON_IN] = LoopedTask_TransitionMons,
[PARTY_CONDITION_FUNC_RETURN] = LoopedTask_ExitPartyConditionMenu,
[PARTY_CONDITION_FUNC_NO_TRANSITION] = LoopedTask_MoveCursorNoTransition,
[PARTY_CONDITION_FUNC_SLIDE_MON_OUT] = LoopedTask_SlideMonOut,
[PARTY_CONDITION_FUNC_ADD_MARKINGS] = LoopedTask_OpenMonMarkingsWindow,
2020-10-11 00:17:34 +02:00
[PARTY_CONDITION_FUNC_CLOSE_MARKINGS] = LoopedTask_CloseMonMarkingsWindow
2019-07-20 04:06:42 +02:00
};
2019-07-29 19:06:45 +02:00
2019-07-24 17:02:52 +02:00
struct Pokenav7Struct
{
u32 loopedTaskId;
u8 tilemapBuffers[3][BG_SCREEN_SIZE];
u8 filler[2];
2020-10-11 00:17:34 +02:00
u8 partyPokeballSpriteIds[10];
u32 (*callback)(void);
s16 monTransitionX;
u8 monPicSpriteId;
u16 monPalIndex;
u16 monGfxTileStart;
2019-07-24 17:02:52 +02:00
void *unk181C;
2020-10-11 00:17:34 +02:00
u8 nameGenderWindowId;
u8 listIndexWindowId;
u8 unusedWindowId1;
u8 unusedWindowId2;
2019-07-24 17:02:52 +02:00
struct PokemonMarkMenu monMarks;
2020-10-11 00:17:34 +02:00
struct Sprite *monMarksSprite;
struct Sprite *conditionSparkleSprites[MAX_CONDITION_SPARKLES];
u8 windowModeState;
2019-07-24 17:02:52 +02:00
u8 filler2[0x38ac - 0x2909];
};
extern s8 GetMonMarkIndex(void); // This function's declaration here is s8 vs. u8 in pokenav_conditions_1.c
2019-07-25 18:56:08 +02:00
2020-10-11 00:17:34 +02:00
u32 LoopedTask_OpenPartyConditionGraph(s32 state);
u32 GetPartyConditionLoopedTaskActive(void);
void CreateConditionMonPic(u8 var);
void CreateMonMarkingsOrPokeballIndicators(void);
void CopyUnusedConditionWindowsToVram(void);
bool32 UpdateConditionGraphWindows(u8 a0, u16 a1, bool8 a2);
2019-07-24 17:02:52 +02:00
void sub_81CEE44(void);
2020-10-11 00:17:34 +02:00
void DoConditionGraphTransition(void);
2019-07-24 17:02:52 +02:00
void sub_81CEEC8(void);
void sub_81CEE68(void);
2020-10-11 00:17:34 +02:00
void ToggleBg2(bool8 showBg);
2019-07-24 17:02:52 +02:00
// code
2020-10-11 00:17:34 +02:00
bool32 OpenPartyConditionMenu(void)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_MON_MARK_MENU, sizeof(struct Pokenav7Struct));
2019-07-24 17:02:52 +02:00
if (structPtr == NULL)
return FALSE;
2021-02-20 06:30:37 +01:00
structPtr->monPicSpriteId = SPRITE_NONE;
2020-10-11 00:17:34 +02:00
structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_OpenPartyConditionGraph, 1);
structPtr->callback = GetPartyConditionLoopedTaskActive;
structPtr->windowModeState = 0;
2019-07-24 17:02:52 +02:00
return TRUE;
}
2020-10-11 00:17:34 +02:00
void CreatePartyConditionLoopedTask(s32 id)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
structPtr->loopedTaskId = CreateLoopedTask(sPartyConditionLoopedTaskFuncs[id], 1);
structPtr->callback = GetPartyConditionLoopedTaskActive;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 IsPartyConditionLoopedTaskActive(void)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
return structPtr->callback();
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 GetPartyConditionLoopedTaskActive(void)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
return IsLoopedTaskActive(structPtr->loopedTaskId);
}
2020-10-11 00:17:34 +02:00
u32 LoopedTask_OpenPartyConditionGraph(s32 state)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
switch (state)
{
case 0:
2020-10-11 00:17:34 +02:00
if (LoadPartyConditionMenuGfx() != TRUE)
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 1:
2020-10-11 00:17:34 +02:00
InitBgTemplates(sPartyConditionBgTemplates, ARRAY_COUNT(sPartyConditionBgTemplates));
2019-07-24 17:02:52 +02:00
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
ChangeBgX(2, 0, 0);
ChangeBgY(2, 0, 0);
ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG3_ON);
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG3);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(11, 4));
2020-05-14 10:37:09 +02:00
DecompressAndCopyTileDataToVram(3, gPokenavCondition_Gfx, 0, 0, 0);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 2:
2020-05-14 10:37:09 +02:00
if (FreeTempTileDataBuffersIfPossible())
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2020-05-14 10:37:09 +02:00
DecompressAndCopyTileDataToVram(2, gUnknown_08623228, 0, 0, 0);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 3:
2020-05-14 10:37:09 +02:00
if (FreeTempTileDataBuffersIfPossible())
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
LZ77UnCompVram(gPokenavCondition_Tilemap, structPtr->tilemapBuffers[0]);
SetBgTilemapBuffer(3, structPtr->tilemapBuffers[0]);
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
CopyToBgTilemapBufferRect(3, gPokenavOptions_Tilemap, 0, 5, 9, 4);
CopyBgTilemapBufferToVram(3);
CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, 0x10, 0x20);
2020-08-10 23:05:42 +02:00
CopyPaletteIntoBufferUnfaded(gConditionText_Pal, 0xF0, 0x20);
2020-10-11 00:17:34 +02:00
structPtr->monTransitionX = -80;
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 4:
2020-05-14 10:37:09 +02:00
if (FreeTempTileDataBuffersIfPossible())
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
LZ77UnCompVram(sConditionGraph_Tilemap, structPtr->tilemapBuffers[2]);
2019-07-24 17:02:52 +02:00
SetBgTilemapBuffer(2, structPtr->tilemapBuffers[2]);
CopyBgTilemapBufferToVram(2);
2020-08-10 19:48:16 +02:00
CopyPaletteIntoBufferUnfaded(gConditionGraphData_Pal, 0x30, 0x20);
2020-10-11 00:17:34 +02:00
SetConditionGraphIOWindows(2);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 5:
sub_8199DF0(1, 0, 0, 1);
sub_8199DF0(1, 17, 1, 1);
CpuFill32(0, structPtr->tilemapBuffers[1], BG_SCREEN_SIZE);
SetBgTilemapBuffer(1, structPtr->tilemapBuffers[1]);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 6:
2020-05-14 10:37:09 +02:00
if (FreeTempTileDataBuffersIfPossible())
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
structPtr->nameGenderWindowId = AddWindow(&sMonNameGenderWindowTemplate);
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
structPtr->listIndexWindowId = AddWindow(&sConditionGraphListIdWindowTemplate);
structPtr->unusedWindowId1 = AddWindow(&sUnusedWindowTemplate1);
structPtr->unusedWindowId2 = AddWindow(&sUnusedWindowTemplate2);
2019-07-24 17:02:52 +02:00
}
DeactivateAllTextPrinters();
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 7:
2020-10-11 00:17:34 +02:00
CreateConditionMonPic(0);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 8:
2020-10-11 00:17:34 +02:00
CreateMonMarkingsOrPokeballIndicators();
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 9:
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == TRUE)
CopyUnusedConditionWindowsToVram();
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 10:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(0, GetMonMarkIndex(), TRUE);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 11:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(1, GetMonMarkIndex(), TRUE);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 12:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(2, GetMonMarkIndex(), TRUE);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 13:
2020-10-11 00:17:34 +02:00
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), TRUE) != TRUE)
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2020-10-11 00:17:34 +02:00
PutWindowTilemap(structPtr->nameGenderWindowId);
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
PutWindowTilemap(structPtr->listIndexWindowId);
PutWindowTilemap(structPtr->unusedWindowId1);
PutWindowTilemap(structPtr->unusedWindowId2);
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 14:
ShowBg(1);
HideBg(2);
ShowBg(3);
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == TRUE)
2019-12-07 10:08:21 +01:00
PrintHelpBarText(HELPBAR_CONDITION_MON_STATUS);
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 15:
2020-02-05 08:47:32 +01:00
PokenavFadeScreen(1);
2020-10-11 00:17:34 +02:00
if (!IsConditionMenuSearchMode())
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
LoadLeftHeaderGfxForIndex(POKENAV_GFX_PARTY_MENU);
ShowLeftHeaderGfx(POKENAV_GFX_CONDITION_MENU, TRUE, 0);
ShowLeftHeaderGfx(POKENAV_GFX_PARTY_MENU, TRUE, 0);
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 16:
if (IsPaletteFadeActive())
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2020-10-11 00:17:34 +02:00
if (!IsConditionMenuSearchMode() && AreLeftHeaderSpritesMoving())
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
SetVBlankCallback_(sub_81CEE44);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 17:
2020-10-11 00:17:34 +02:00
DoConditionGraphTransition();
InitConditionGraphState(GetConditionGraphDataPtr());
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 18:
2020-10-11 00:17:34 +02:00
if (SetupConditionGraphScanlineParams(GetConditionGraphDataPtr()))
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 19:
2020-10-11 00:17:34 +02:00
ToggleBg2(TRUE);
2019-12-07 10:08:21 +01:00
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 20:
2020-10-11 00:17:34 +02:00
if (!TryUpdateConditionMonTransitionOn(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
if (IsConditionMenuSearchMode() == TRUE || GetConditionGraphCurrentMonIndex() != GetMonListCount())
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetMonSheen());
2019-07-24 17:02:52 +02:00
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 LoopedTask_ExitPartyConditionMenu(s32 state)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
switch (state)
{
case 0:
sub_81CEEC8();
2020-10-11 00:17:34 +02:00
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 1:
2020-10-11 00:17:34 +02:00
if (TryUpdateConditionMonTransitionOff(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
2019-07-24 17:02:52 +02:00
return 2;
2020-10-11 00:17:34 +02:00
ToggleBg2(FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 2:
2020-02-05 08:47:32 +01:00
PokenavFadeScreen(0);
2020-10-11 00:17:34 +02:00
if (!IsConditionMenuSearchMode())
SlideMenuHeaderDown();
return LT_INC_AND_PAUSE;
2019-07-24 17:02:52 +02:00
case 3:
if (IsPaletteFadeActive() || MainMenuLoopedTaskIsBusy())
2020-10-11 00:17:34 +02:00
return LT_PAUSE;
FreeConditionSparkles(structPtr->conditionSparkleSprites);
2019-07-24 17:02:52 +02:00
HideBg(1);
HideBg(2);
HideBg(3);
2020-10-11 00:17:34 +02:00
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 LoopedTask_TransitionMons(s32 state)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
struct ConditionGraph *unkPtr = GetConditionGraphDataPtr();
2019-07-24 17:02:52 +02:00
switch (state)
{
case 0:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(0);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 1:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(1);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 2:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(2);
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 3:
TransitionConditionGraph(unkPtr);
2020-10-11 00:17:34 +02:00
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 4:
2020-10-11 00:17:34 +02:00
if (!MoveConditionMonOffscreen(&structPtr->monTransitionX))
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
CreateConditionMonPic(GetMonMarkIndex());
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
case 5:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(0, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 6:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(1, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 7:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(2, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 8:
2020-10-11 00:17:34 +02:00
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), FALSE) == TRUE)
return LT_INC_AND_CONTINUE;
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
case 9:
2020-10-11 00:17:34 +02:00
unkPtr = GetConditionGraphDataPtr();
if (!TryUpdateConditionMonTransitionOn(unkPtr, &structPtr->monTransitionX))
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
if (IsConditionMenuSearchMode() != TRUE && GetConditionGraphCurrentMonIndex() == GetMonListCount())
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetMonSheen());
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 LoopedTask_MoveCursorNoTransition(s32 state)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
switch (state)
{
case 0:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(0);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 1:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(1);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 2:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(2);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 3:
2020-10-11 00:17:34 +02:00
CreateConditionMonPic(GetMonMarkIndex());
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 4:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(0, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 5:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(1, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 6:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(2, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 7:
2020-10-11 00:17:34 +02:00
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), FALSE) == TRUE)
return LT_INC_AND_CONTINUE;
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
case 8:
2020-10-11 00:17:34 +02:00
if (!TryUpdateConditionMonTransitionOn(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
ResetConditionSparkleSprites(structPtr->conditionSparkleSprites);
CreateConditionSparkleSprites(structPtr->conditionSparkleSprites, structPtr->monPicSpriteId, GetMonSheen());
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 LoopedTask_SlideMonOut(s32 state)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
switch (state)
{
case 0:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(0);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 1:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(1);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 2:
2020-10-11 00:17:34 +02:00
SetConditionGraphData(2);
DestroyConditionSparkleSprites(structPtr->conditionSparkleSprites);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 3:
2020-10-11 00:17:34 +02:00
if (!TryUpdateConditionMonTransitionOff(GetConditionGraphDataPtr(), &structPtr->monTransitionX))
return LT_INC_AND_CONTINUE;
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
case 4:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(0, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 5:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(1, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 6:
2020-10-11 00:17:34 +02:00
UpdateConditionGraphWindows(2, GetMonMarkIndex(), FALSE);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 7:
2020-10-11 00:17:34 +02:00
if (UpdateConditionGraphWindows(3, GetMonMarkIndex(), FALSE) == TRUE)
return LT_INC_AND_CONTINUE;
return LT_PAUSE;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 LoopedTask_OpenMonMarkingsWindow(s32 state)
2019-07-24 17:02:52 +02:00
{
switch (state)
{
case 0:
2020-10-11 00:17:34 +02:00
sub_811FAA4(TryGetMonMarkId(), 176, 32);
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 1:
2019-12-07 10:08:21 +01:00
PrintHelpBarText(HELPBAR_CONDITION_MARKINGS);
2020-10-11 00:17:34 +02:00
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 2:
2019-12-07 10:08:21 +01:00
if (WaitForHelpBar() == TRUE)
2020-10-11 00:17:34 +02:00
return LT_PAUSE;
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u32 LoopedTask_CloseMonMarkingsWindow(s32 state)
2019-07-24 17:02:52 +02:00
{
switch (state)
{
case 0:
sub_811FAF8();
2020-10-11 00:17:34 +02:00
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 1:
2019-12-07 10:08:21 +01:00
PrintHelpBarText(HELPBAR_CONDITION_MON_STATUS);
2020-10-11 00:17:34 +02:00
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
case 2:
2019-12-07 10:08:21 +01:00
if (WaitForHelpBar() == TRUE)
2020-10-11 00:17:34 +02:00
return LT_PAUSE;
return LT_INC_AND_CONTINUE;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
return LT_FINISH;
2019-07-24 17:02:52 +02:00
}
2019-12-07 10:08:21 +01:00
static u8 *UnusedPrintNumberString(u8 *dst, u16 num)
2019-07-24 17:02:52 +02:00
{
u8 *txtPtr = ConvertIntToDecimalStringN(dst, num, STR_CONV_MODE_RIGHT_ALIGN, 4);
txtPtr = StringCopy(txtPtr, gText_Number2);
return txtPtr;
}
2020-10-11 00:17:34 +02:00
bool32 UpdateConditionGraphWindows(u8 mode, u16 bufferIndex, bool8 winMode)
2019-07-24 17:02:52 +02:00
{
u8 text[32];
const u8 *str;
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
switch (mode)
2019-07-24 17:02:52 +02:00
{
case 0:
2020-10-11 00:17:34 +02:00
FillWindowPixelBuffer(structPtr->nameGenderWindowId, 0);
if (IsConditionMenuSearchMode() == TRUE)
FillWindowPixelBuffer(structPtr->listIndexWindowId, 0);
2019-07-24 17:02:52 +02:00
break;
case 1:
2020-10-11 00:17:34 +02:00
if (GetConditionGraphCurrentMonIndex() != GetMonListCount() - 1 || IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
str = GetConditionMonNameBuffer(bufferIndex);
AddTextPrinterParameterized(structPtr->nameGenderWindowId, 1, str, 0, 1, 0, NULL);
2019-07-24 17:02:52 +02:00
}
break;
case 2:
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
str = GetConditionMonLocationBuffer(bufferIndex);
AddTextPrinterParameterized(structPtr->nameGenderWindowId, 1, str, 0, 17, 0, NULL);
2019-07-24 17:02:52 +02:00
text[0] = EXT_CTRL_CODE_BEGIN;
2020-08-11 05:50:49 +02:00
text[1] = EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW;
text[2] = TEXT_COLOR_BLUE;
text[3] = TEXT_COLOR_TRANSPARENT;
text[4] = TEXT_COLOR_LIGHT_BLUE;
2019-07-24 17:02:52 +02:00
StringCopy(text + 5, gText_Number2);
2020-10-11 00:17:34 +02:00
AddTextPrinterParameterized(structPtr->listIndexWindowId, 1, text, 4, 1, 0, NULL);
ConvertIntToDecimalStringN(text + 5, GetConditionMonDataBuffer(), STR_CONV_MODE_RIGHT_ALIGN, 4);
AddTextPrinterParameterized(structPtr->listIndexWindowId, 1, text, 28, 1, 0, NULL);
2019-07-24 17:02:52 +02:00
}
break;
case 3:
2020-10-11 00:17:34 +02:00
switch (structPtr->windowModeState)
2019-07-24 17:02:52 +02:00
{
case 0:
2020-10-11 00:17:34 +02:00
if (winMode)
CopyWindowToVram(structPtr->nameGenderWindowId, 3);
2019-07-24 17:02:52 +02:00
else
2020-10-11 00:17:34 +02:00
CopyWindowToVram(structPtr->nameGenderWindowId, 2);
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
structPtr->windowModeState++;
2019-07-24 17:02:52 +02:00
return FALSE;
}
else
{
2020-10-11 00:17:34 +02:00
structPtr->windowModeState = 0;
2019-07-24 17:02:52 +02:00
return TRUE;
}
case 1:
2020-10-11 00:17:34 +02:00
if (winMode)
CopyWindowToVram(structPtr->listIndexWindowId, 3);
2019-07-24 17:02:52 +02:00
else
2020-10-11 00:17:34 +02:00
CopyWindowToVram(structPtr->listIndexWindowId, 2);
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
structPtr->windowModeState = 0;
2019-07-24 17:02:52 +02:00
return TRUE;
}
}
return FALSE;
}
2020-10-11 00:17:34 +02:00
void CopyUnusedConditionWindowsToVram(void)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
CopyWindowToVram(structPtr->unusedWindowId1, 3);
CopyWindowToVram(structPtr->unusedWindowId2, 3);
2019-07-24 17:02:52 +02:00
}
void sub_81CE964(struct Sprite *sprite)
{
2020-10-11 00:17:34 +02:00
if (sprite->data[0] == GetConditionGraphCurrentMonIndex())
2019-07-24 17:02:52 +02:00
StartSpriteAnim(sprite, 0);
else
StartSpriteAnim(sprite, 1);
}
2020-10-11 00:17:34 +02:00
void HighlightCurrentPartyIndexPokeball(struct Sprite *sprite)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
if (GetConditionGraphCurrentMonIndex() == GetMonListCount() - 1)
2019-07-24 17:02:52 +02:00
sprite->oam.paletteNum = IndexOfSpritePaletteTag(0x65);
else
sprite->oam.paletteNum = IndexOfSpritePaletteTag(0x66);
}
2020-10-11 00:17:34 +02:00
void MonMarkingsCallback(struct Sprite *sprite)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
StartSpriteAnim(sprite, TryGetMonMarkId());
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
void CreateMonMarkingsOrPokeballIndicators(void)
2019-07-24 17:02:52 +02:00
{
struct SpriteSheet sprSheets[4];
struct SpriteTemplate sprTemplate;
struct SpritePalette sprPals[3];
struct SpriteSheet sprSheet;
struct Sprite *sprite;
u16 i, spriteId;
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
2020-08-10 19:48:16 +02:00
LoadConditionSelectionIcons(sprSheets, &sprTemplate, sprPals);
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
structPtr->monMarks.baseTileTag = 0x6A;
structPtr->monMarks.basePaletteTag = 0x6A;
sub_811F90C(&structPtr->monMarks);
sub_811FA90();
2020-10-11 00:17:34 +02:00
sprite = CreateMonMarkingsSpriteWithPal(0x69, 0x69, sConditionGraphMonMarkingsPal);
2019-07-24 17:02:52 +02:00
sprite->oam.priority = 3;
sprite->pos1.x = 192;
sprite->pos1.y = 32;
2020-10-11 00:17:34 +02:00
sprite->callback = MonMarkingsCallback;
structPtr->monMarksSprite = sprite;
PokenavFillPalette(IndexOfSpritePaletteTag(0x69), 0);
2019-07-24 17:02:52 +02:00
}
else
{
2020-10-11 00:17:34 +02:00
// party mode -> add pokeballs on right hand side
2019-07-24 17:02:52 +02:00
LoadSpriteSheets(sprSheets);
Pokenav_AllocAndLoadPalettes(sprPals);
2020-10-11 00:17:34 +02:00
for (i = 0; i < GetMonListCount() - 1; i++)
2019-07-24 17:02:52 +02:00
{
spriteId = CreateSprite(&sprTemplate, 226, (i * 20) + 8, 0);
if (spriteId != MAX_SPRITES)
{
2020-10-11 00:17:34 +02:00
structPtr->partyPokeballSpriteIds[i] = spriteId;
2019-07-24 17:02:52 +02:00
gSprites[spriteId].data[0] = i;
gSprites[spriteId].callback = sub_81CE964;
}
else
{
2021-02-20 06:30:37 +01:00
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
2019-07-24 17:02:52 +02:00
}
}
sprTemplate.tileTag = 0x67;
sprTemplate.callback = SpriteCallbackDummy;
for (; i < 6; i++)
{
spriteId = CreateSprite(&sprTemplate, 230, (i * 20) + 8, 0);
if (spriteId != MAX_SPRITES)
{
2020-10-11 00:17:34 +02:00
structPtr->partyPokeballSpriteIds[i] = spriteId;
2019-07-24 17:02:52 +02:00
gSprites[spriteId].oam.size = 0;
}
else
{
2021-02-20 06:30:37 +01:00
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
2019-07-24 17:02:52 +02:00
}
}
sprTemplate.tileTag = 0x66;
2020-10-11 00:17:34 +02:00
sprTemplate.callback = HighlightCurrentPartyIndexPokeball;
2019-07-24 17:02:52 +02:00
spriteId = CreateSprite(&sprTemplate, 222, (i * 20) + 8, 0);
if (spriteId != MAX_SPRITES)
{
2020-10-11 00:17:34 +02:00
structPtr->partyPokeballSpriteIds[i] = spriteId;
gSprites[spriteId].oam.shape = SPRITE_SHAPE(32x16);
gSprites[spriteId].oam.size = SPRITE_SIZE(32x16);
2019-07-24 17:02:52 +02:00
}
else
{
2021-02-20 06:30:37 +01:00
structPtr->partyPokeballSpriteIds[i] = SPRITE_NONE;
2019-07-24 17:02:52 +02:00
}
}
2020-08-10 19:48:16 +02:00
LoadConditionSparkle(&sprSheet, &sprPals[0]);
2019-07-24 17:02:52 +02:00
LoadSpriteSheet(&sprSheet);
sprPals[1].data = NULL;
Pokenav_AllocAndLoadPalettes(sprPals);
}
void sub_81CEBF4(struct Pokenav7Struct *structPtr)
{
u8 i;
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
DestroySprite(structPtr->monMarksSprite);
2019-07-24 17:02:52 +02:00
FreeSpriteTilesByTag(0x6A);
FreeSpriteTilesByTag(0x69);
FreeSpritePaletteByTag(0x6A);
FreeSpritePaletteByTag(0x69);
}
else
{
for (i = 0; i < 7; i++)
2020-10-11 00:17:34 +02:00
DestroySprite(&gSprites[structPtr->partyPokeballSpriteIds[i]]);
2019-07-24 17:02:52 +02:00
FreeSpriteTilesByTag(0x65);
FreeSpriteTilesByTag(0x66);
FreeSpriteTilesByTag(0x67);
FreeSpritePaletteByTag(0x65);
FreeSpritePaletteByTag(0x66);
}
2021-02-20 06:30:37 +01:00
if (structPtr->monPicSpriteId != SPRITE_NONE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
DestroySprite(&gSprites[structPtr->monPicSpriteId]);
2019-07-24 17:02:52 +02:00
FreeSpriteTilesByTag(0x64);
FreeSpritePaletteByTag(0x64);
}
}
2020-10-11 00:17:34 +02:00
void FreePartyConditionSubstruct2(void)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
RemoveWindow(structPtr->nameGenderWindowId);
if (IsConditionMenuSearchMode() == TRUE)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
RemoveWindow(structPtr->listIndexWindowId);
RemoveWindow(structPtr->unusedWindowId1);
RemoveWindow(structPtr->unusedWindowId2);
2019-07-24 17:02:52 +02:00
}
else
{
2020-10-11 00:17:34 +02:00
SetLeftHeaderSpritesInvisibility();
2019-07-24 17:02:52 +02:00
}
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG0_ON | DISPCNT_OBJ_1D_MAP);
sub_81CEBF4(structPtr);
sub_81CEE68();
2020-10-11 00:17:34 +02:00
FreePokenavSubstruct(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
void MonPicGfxSpriteCallback(struct Sprite *sprite)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
sprite->pos1.x = structPtr->monTransitionX + 38;
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
void CreateConditionMonPic(u8 id)
2019-07-24 17:02:52 +02:00
{
struct SpriteTemplate sprTemplate;
struct SpriteSheet sprSheet;
struct SpritePalette sprPal;
u8 spriteId;
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
2021-02-20 06:30:37 +01:00
if (structPtr->monPicSpriteId == SPRITE_NONE)
2019-07-24 17:02:52 +02:00
{
2020-08-10 23:05:42 +02:00
LoadConditionMonPicTemplate(&sprSheet, &sprTemplate, &sprPal);
2020-10-11 00:17:34 +02:00
sprSheet.data = GetConditionMonPicGfx(id);
sprPal.data = GetConditionMonPal(id);
structPtr->monPalIndex = LoadSpritePalette(&sprPal);
structPtr->monGfxTileStart = LoadSpriteSheet(&sprSheet);
2019-07-24 17:02:52 +02:00
spriteId = CreateSprite(&sprTemplate, 38, 104, 0);
2020-10-11 00:17:34 +02:00
structPtr->monPicSpriteId = spriteId;
2019-07-24 17:02:52 +02:00
if (spriteId == MAX_SPRITES)
{
FreeSpriteTilesByTag(0x64);
FreeSpritePaletteByTag(0x64);
2021-02-20 06:30:37 +01:00
structPtr->monPicSpriteId = SPRITE_NONE;
2019-07-24 17:02:52 +02:00
}
else
{
2020-10-11 00:17:34 +02:00
structPtr->monPicSpriteId = spriteId;
gSprites[structPtr->monPicSpriteId].callback = MonPicGfxSpriteCallback;
structPtr->unk181C = (void*)(VRAM) + 0x10000 + (structPtr->monGfxTileStart * 32);
structPtr->monPalIndex = (structPtr->monPalIndex * 16) + 0x100;
2019-07-24 17:02:52 +02:00
}
}
else
{
2020-10-11 00:17:34 +02:00
DmaCopy16Defvars(3, GetConditionMonPicGfx(id), structPtr->unk181C, 0x800);
LoadPalette(GetConditionMonPal(id), structPtr->monPalIndex, 0x20);
2019-07-24 17:02:52 +02:00
}
}
void sub_81CEE44(void)
{
2020-10-11 00:17:34 +02:00
struct ConditionGraph *unk = GetConditionGraphDataPtr();
2019-07-24 17:02:52 +02:00
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
sub_81D2108(unk);
ScanlineEffect_InitHBlankDmaTransfer();
}
void sub_81CEE68(void)
{
SetPokenavVBlankCallback();
}
2020-10-11 00:17:34 +02:00
void ToggleBg2(bool8 showBg)
2019-07-24 17:02:52 +02:00
{
if (showBg)
ShowBg(2);
else
HideBg(2);
}
2020-10-11 00:17:34 +02:00
void DoConditionGraphTransition(void)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct ConditionGraph *conditionPtr = GetConditionGraphDataPtr();
u8 id = GetMonMarkIndex();
2019-07-24 17:02:52 +02:00
gUnknown_030012BC = id;
2020-10-11 00:17:34 +02:00
sub_81D1F84(conditionPtr, conditionPtr->unk14[3], conditionPtr->unk14[id]);
TransitionConditionGraph(conditionPtr);
2019-07-24 17:02:52 +02:00
}
void sub_81CEEC8(void)
{
2020-10-11 00:17:34 +02:00
struct ConditionGraph *conditionPtr = GetConditionGraphDataPtr();
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() || GetConditionGraphCurrentMonIndex() != GetMonListCount() - 1)
sub_81D1F84(conditionPtr, conditionPtr->unk14[GetMonMarkIndex()], conditionPtr->unk14[3]);
2019-07-24 17:02:52 +02:00
}
2020-10-11 00:17:34 +02:00
u8 GetMonMarkingsData(void)
2019-07-24 17:02:52 +02:00
{
2020-10-11 00:17:34 +02:00
struct Pokenav7Struct *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_MON_MARK_MENU);
2019-07-24 17:02:52 +02:00
2020-10-11 00:17:34 +02:00
if (IsConditionMenuSearchMode() == 1)
2019-07-24 17:02:52 +02:00
return structPtr->monMarks.markings;
else
return 0;
}