Merge branch 'quickrun' into 'main'

Pressing B in wild encounters now moves the cursor to the "RUN" option.

See merge request tbld/game!11
This commit is contained in:
Jess 2022-12-22 02:58:38 +00:00
commit 92216ce4e8
3 changed files with 60 additions and 1 deletions

View File

@ -322,6 +322,16 @@ static void HandleInputChooseAction(void)
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_CANCEL_PARTNER, 0);
PlayerBufferExecCompleted();
}
else
{
if(!(gBattleTypeFlags & BATTLE_TYPE_TRAINER)) //if wild, pressing B moves cursor to run
{
PlaySE(SE_SELECT);
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] = 3;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
}
else if (JOY_NEW(START_BUTTON))
{

View File

@ -69,6 +69,8 @@ u8 gLinkVSyncDisabled;
u32 IntrMain_Buffer[0x200];
s8 gPcmDmaCounter;
extern void CB2_FlashNotDetectedScreen(void); // for Crust's sake use mGBA, people!
static EWRAM_DATA u16 gTrainerId = 0;
//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL;
@ -114,7 +116,7 @@ void AgbMain()
gSoftResetDisabled = FALSE;
if (gFlashMemoryPresent != TRUE)
SetMainCallback2(NULL);
SetMainCallback2(CB2_FlashNotDetectedScreen);
gLinkTransferringData = FALSE;
sUnusedVar = 0xFC0;

View File

@ -401,3 +401,50 @@ static bool8 WipeSectors(u32 sectorBits)
else
return TRUE;
}
void CB2_FlashNotDetectedScreen(void){
static const struct WindowTemplate textWin[] = {
{
.bg = 0,
.tilemapLeft = 3,
.tilemapTop = 2,
.width = 24,
.height = 16,
.paletteNum = 15,
.baseBlock = 1,
}
};
static const char errorMsg[] = _(
"{COLOR RED}Hey!\n"
"{COLOR DARK_GRAY}Flash memory not detected.\n\n"
"Please make sure you\nare playing the game\n"
"on the mGBA emu-\nlator"
);
if (!gMain.state){
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
DmaFill16(3, 0, VRAM, VRAM_SIZE);
DmaFill32(3, 0, OAM, OAM_SIZE);
DmaFill16(3, 0, PLTT, PLTT_SIZE);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
LoadBgTiles(0, gTextWindowFrame1_Gfx, 0x120, 0x214);
DeactivateAllTextPrinters();
ResetTasks();
ResetPaletteFade();
LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
InitWindows(textWin);
DrawStdFrameWithCustomTileAndPalette(0, TRUE, 0x214, 0xE);
SaveFailedScreenTextPrint(errorMsg, 1, 0);
TransferPlttBuffer();
*(u16*)PLTT = RGB(17, 18, 31);
ShowBg(0);
gMain.state++;
}
}