diff --git a/asm/include/overlay_12_battle_command.inc b/asm/include/overlay_12_battle_command.inc index 3480961ef7..6db859e4ea 100644 --- a/asm/include/overlay_12_battle_command.inc +++ b/asm/include/overlay_12_battle_command.inc @@ -104,7 +104,7 @@ .public _s32_div_f .public _u32_div_f .public gGameLanguage -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gSystem .public ov07_02232F58 .public ov07_02232F60 diff --git a/asm/include/overlay_14.inc b/asm/include/overlay_14.inc index 9680178eb3..6c4614ad23 100644 --- a/asm/include/overlay_14.inc +++ b/asm/include/overlay_14.inc @@ -292,7 +292,7 @@ .public _fsub .public _s32_div_f .public _u32_div_f -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gOverlayTemplate_PokemonSummary .public gSystem .public PCBox_Init diff --git a/asm/include/overlay_43.inc b/asm/include/overlay_43.inc index 4fd2409020..88d88adf45 100644 --- a/asm/include/overlay_43.inc +++ b/asm/include/overlay_43.inc @@ -192,7 +192,7 @@ .public _ull_mod .public _s32_div_f .public _u32_div_f -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public _02102620 .public gSystem .public ov42_02227060 diff --git a/asm/include/overlay_80_0222BDF4.inc b/asm/include/overlay_80_0222BDF4.inc index 8e1c7dd341..83d8e3fa53 100644 --- a/asm/include/overlay_80_0222BDF4.inc +++ b/asm/include/overlay_80_0222BDF4.inc @@ -180,7 +180,7 @@ .public _s32_div_f .public _u32_div_f .public gOverlayTemplate_Battle -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gSystem .public ov00_021E6EBC .public _0223DC20 diff --git a/asm/include/unk_02082908.inc b/asm/include/unk_02082908.inc deleted file mode 100644 index b6542cbda0..0000000000 --- a/asm/include/unk_02082908.inc +++ /dev/null @@ -1,149 +0,0 @@ -#include -#pragma once -.public CopyU16StringArray -.public StringLength -.public StringNotEqual -.public FontID_Alloc -.public FontID_SetAccessDirect -.public FontID_SetAccessLazy -.public FontID_Release -.public FontID_FlatArray_GetWidth -.public FontID_String_GetWidth -.public LoadFontPal1 -.public sub_02004EC4 -.public PlaySE -.public CreateSysTaskAndEnvironment -.public DestroySysTaskAndEnvironment -.public OverlayManager_CreateAndGetData -.public OverlayManager_GetData -.public OverlayManager_FreeData -.public OverlayManager_GetArgs -.public NARC_New -.public NARC_Delete -.public GfGfxLoader_LoadScrnData -.public GfGfxLoader_GXLoadPal -.public GfGfxLoader_GetCharData -.public GfGfxLoader_GetPlttData -.public GfGfxLoader_LoadCharDataFromOpenNarc -.public GfGfxLoader_LoadScrnDataFromOpenNarc -.public GfGfxLoader_GXLoadPalFromOpenNarc -.public GfGfxLoader_GetCharDataFromOpenNarc -.public CreateSpriteResourcesHeader -.public G2dRenderer_Init -.public G2dRenderer_SetSubSurfaceCoords -.public Create2DGfxResObjMan -.public Destroy2DGfxResObjMan -.public AddCharResObjFromOpenNarc -.public AddPlttResObjFromOpenNarc -.public AddCellOrAnimResObjFromOpenNarc -.public sub_0200ACF0 -.public sub_0200AEB0 -.public sub_0200AF94 -.public sub_0200B0A8 -.public OamManager_Create -.public OamManager_ApplyAndResetBuffers -.public OamManager_Free -.public NewMsgDataFromNarc -.public DestroyMsgData -.public NewString_ReadMsgData -.public ReadMsgData_ExpandPlaceholders -.public MessageFormat_New -.public MessageFormat_Delete -.public BufferString -.public BufferBoxMonSpeciesName -.public BufferPCBoxName -.public LoadUserFrameGfx2 -.public DrawFrameAndWindow2 -.public BeginNormalPaletteFade -.public IsPaletteFadeFinished -.public sub_02013A50 -.public sub_020163E0 -.public sub_020164C4 -.public sub_02018410 -.public Main_SetVBlankIntrCB -.public HBlankInterruptDisable -.public SetKeyRepeatTimers -.public CreateHeap -.public DestroyHeap -.public AllocFromHeap -.public FreeToHeap -.public FreeToHeapExplicit -.public BgConfig_Alloc -.public SetBothScreensModesAndDisable -.public InitBgFromTemplate -.public FreeBgTilemapBuffer -.public SetBgPriority -.public BgSetPosTextAndCommit -.public BG_ClearCharDataRange -.public BG_SetMaskColor -.public BgClearTilemapBufferAndCommit -.public AddWindowParameterized -.public RemoveWindow -.public CopyWindowToVram -.public FillWindowPixelBuffer -.public BlitBitmapRectToWindow -.public FillWindowPixelRect -.public GetWindowWidth -.public SysTask_GetData -.public GF_SinDeg -.public LCRandom -.public TextPrinterCheckActive -.public AddTextPrinterParameterized -.public AddTextPrinterParameterizedWithColor -.public GF_RunVramTransferTasks -.public ObjCharTransfer_Init -.public ObjCharTransfer_Destroy -.public ObjCharTransfer_ClearBuffers -.public ObjPlttTransfer_Init -.public ObjPlttTransfer_Destroy -.public ObjPlttTransfer_Reset -.public GfGfx_SetBanks -.public GfGfx_DisableEngineAPlanes -.public GfGfx_EngineATogglePlanes -.public GfGfx_DisableEngineBPlanes -.public GfGfx_EngineBTogglePlanes -.public GfGfx_SwapDisplay -.public SpriteList_Delete -.public SpriteList_RenderAndAnimateSprites -.public Sprite_CreateAffine -.public Sprite_SetMatrix -.public Sprite_SetVisibleFlag -.public Sprite_SetAnimActiveFlag -.public Sprite_GetMatrixPtr -.public Sprite_GetVisibleFlag -.public Sprite_SetAnimCtrlSeq -.public Sprite_SetAnimCtrlCurrentFrame -.public Sprite_SetDrawPriority -.public Sprite_IsCellAnimationRunning -.public Sprite_SetOamMode -.public GF_AssertFail -.public String_New -.public String_Delete -.public String_Copy -.public CopyU16ArrayToString -.public CopyStringToU16Array -.public Options_GetFrame -.public AllocMonZeroed -.public CreateMon -.public Mon_GetBoxMon -.public PCStorage_GetActiveBox -.public PCStorage_FindFirstBoxWithEmptySlot -.public GetMonIconNaixEx -.public GetMonIconPaletteEx -.public sub_02074490 -.public NamingScreen_CreateArgs -.public NamingScreen_DeleteArgs -.public NNS_G2dInitOamManagerModule -.public G2x_SetBlendAlpha_ -.public GX_LoadOBJPltt -.public GX_LoadOBJ -.public GXS_LoadOBJ -.public DC_FlushRange -.public MIi_CpuClear16 -.public memset -.public _s32_div_f -.public gOverlayTemplate_Battle -.public gNatureStatMods -.public sOverlayTemplate_NamingScreen -.public gSystem -.public OS_IRQTable diff --git a/asm/include/unk_020910D8.inc b/asm/include/unk_020910D8.inc index 6803a854ce..4869867a16 100644 --- a/asm/include/unk_020910D8.inc +++ b/asm/include/unk_020910D8.inc @@ -21,7 +21,7 @@ .public MonSetTrainerMemo .public CallTask_HatchEggInParty .public sub_02093134 -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public ov95_021E6D70 .public ov95_021E6E88 .public ov95_021E6F0C diff --git a/asm/include/unk_020912AC.inc b/asm/include/unk_020912AC.inc index 84815540ff..67aaae13b9 100644 --- a/asm/include/unk_020912AC.inc +++ b/asm/include/unk_020912AC.inc @@ -5,4 +5,4 @@ .public sub_020912AC .public sub_020912D0 .public _u32_div_f -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen diff --git a/asm/include/unk_02091564.inc b/asm/include/unk_02091564.inc index c8af9ef687..f13c0c0ffc 100644 --- a/asm/include/unk_02091564.inc +++ b/asm/include/unk_02091564.inc @@ -37,7 +37,7 @@ .public sub_02091598 .public sub_020915A0 .public sub_020915A4 -.public sOverlayTemplate_NamingScreen +.public gOverlayTemplate_NamingScreen .public gApplication_OakSpeech .public OakSpeech_Init .public OakSpeech_Main diff --git a/asm/overlay_12_battle_command.s b/asm/overlay_12_battle_command.s index 4799c4eb0a..fb54218b54 100644 --- a/asm/overlay_12_battle_command.s +++ b/asm/overlay_12_battle_command.s @@ -1187,7 +1187,7 @@ _02246DB0: mov r2, #0 bl GetMonData str r0, [r5, #0x10] - ldr r0, _0224706C ; =sOverlayTemplate_NamingScreen + ldr r0, _0224706C ; =gOverlayTemplate_NamingScreen add r1, r5, #0 mov r2, #5 bl OverlayManager_New @@ -1484,7 +1484,7 @@ _0224702E: _02247060: .word 0x0000FFFF _02247064: .word 0x0000219C _02247068: .word 0x00000496 -_0224706C: .word sOverlayTemplate_NamingScreen +_0224706C: .word gOverlayTemplate_NamingScreen _02247070: .word 0x00000498 _02247074: add r0, r5, #0 diff --git a/asm/overlay_14.s b/asm/overlay_14.s index db7de131d1..166be02705 100644 --- a/asm/overlay_14.s +++ b/asm/overlay_14.s @@ -6717,7 +6717,7 @@ ov14_021E8B3C: ; 0x021E8B3C ldr r0, [r4, #4] ldr r2, [r2, #0x18] bl PCStorage_GetBoxName - ldr r0, _021E8B7C ; =sOverlayTemplate_NamingScreen + ldr r0, _021E8B7C ; =gOverlayTemplate_NamingScreen ldr r1, [r4, #0x18] mov r2, #9 bl OverlayManager_New @@ -6726,7 +6726,7 @@ ov14_021E8B3C: ; 0x021E8B3C add sp, #8 pop {r4, pc} .balign 4, 0 -_021E8B7C: .word sOverlayTemplate_NamingScreen +_021E8B7C: .word gOverlayTemplate_NamingScreen thumb_func_end ov14_021E8B3C thumb_func_start ov14_021E8B80 diff --git a/asm/overlay_43.s b/asm/overlay_43.s index 6302fa043a..0e630dc7ec 100644 --- a/asm/overlay_43.s +++ b/asm/overlay_43.s @@ -5792,7 +5792,7 @@ _0222CBE2: str r0, [r4, #8] add r0, r7, #0 bl ov43_0222A1DC - ldr r0, _0222CD2C ; =sOverlayTemplate_NamingScreen + ldr r0, _0222CD2C ; =gOverlayTemplate_NamingScreen ldr r1, [r4, #4] add r2, r6, #0 bl OverlayManager_New @@ -5865,7 +5865,7 @@ _0222CCAC: str r0, [r4, #4] add r0, r7, #0 bl ov43_0222A1DC - ldr r0, _0222CD2C ; =sOverlayTemplate_NamingScreen + ldr r0, _0222CD2C ; =gOverlayTemplate_NamingScreen ldr r1, [r4, #4] add r2, r6, #0 bl OverlayManager_New @@ -5918,7 +5918,7 @@ _0222CD26: add sp, #0x18 pop {r3, r4, r5, r6, r7, pc} .balign 4, 0 -_0222CD2C: .word sOverlayTemplate_NamingScreen +_0222CD2C: .word gOverlayTemplate_NamingScreen _0222CD30: .word _02102620 thumb_func_end ov43_0222CBB4 diff --git a/asm/overlay_80_0222BDF4.s b/asm/overlay_80_0222BDF4.s index b7e9684cc1..6cc0183908 100644 --- a/asm/overlay_80_0222BDF4.s +++ b/asm/overlay_80_0222BDF4.s @@ -1829,7 +1829,7 @@ FrtCmd_052: ; 0x0222CB54 bl NamingScreen_CreateArgs add r2, r0, #0 ldr r0, _0222CB8C ; =ov80_0222CB94 - ldr r1, _0222CB90 ; =sOverlayTemplate_NamingScreen + ldr r1, _0222CB90 ; =gOverlayTemplate_NamingScreen str r0, [sp] ldr r0, [r4] mov r3, #0 @@ -1840,7 +1840,7 @@ FrtCmd_052: ; 0x0222CB54 pop {r4, pc} .balign 4, 0 _0222CB8C: .word ov80_0222CB94 -_0222CB90: .word sOverlayTemplate_NamingScreen +_0222CB90: .word gOverlayTemplate_NamingScreen thumb_func_end FrtCmd_052 thumb_func_start ov80_0222CB94 diff --git a/asm/unk_02082908.s b/asm/unk_02082908.s deleted file mode 100644 index e3fba8a718..0000000000 --- a/asm/unk_02082908.s +++ /dev/null @@ -1,5521 +0,0 @@ -#include "constants/items.h" -#include "constants/moves.h" -#include "constants/pokemon.h" -#include "constants/ribbon.h" -#include "constants/party_menu.h" -#include "msgdata/msg/msg_0300.h" - .include "asm/macros.inc" - .include "unk_02082908.inc" - .include "global.inc" - - .public gOverlayTemplate_Battle - .public gNatureStatMods - - .bss - -_021D43B0: - .space 0x4 - - .text - - thumb_func_start sub_02082908 -sub_02082908: ; 0x02082908 - push {r4, r5, r6, r7, lr} - sub sp, #0xc - add r5, r1, #0 - ldr r1, [r5] - add r6, r0, #0 - cmp r1, #0 - beq _0208291E - cmp r1, #1 - bne _0208291C - b _02082A88 -_0208291C: - b _02082AC2 -_0208291E: - mov r0, #0 - add r1, r0, #0 - bl Main_SetVBlankIntrCB - bl HBlankInterruptDisable - bl GfGfx_DisableEngineAPlanes - bl GfGfx_DisableEngineBPlanes - mov r2, #1 - lsl r2, r2, #0x1a - ldr r1, [r2] - ldr r0, _02082AC8 ; =0xFFFFE0FF - and r1, r0 - str r1, [r2] - ldr r2, _02082ACC ; =0x04001000 - ldr r1, [r2] - and r0, r1 - str r0, [r2] - mov r2, #0xa - mov r0, #3 - mov r1, #0x12 - lsl r2, r2, #0xe - bl CreateHeap - ldr r1, _02082AD0 ; =0x000005D4 - add r0, r6, #0 - mov r2, #0x12 - bl OverlayManager_CreateAndGetData - ldr r2, _02082AD0 ; =0x000005D4 - mov r1, #0 - add r4, r0, #0 - bl memset - mov r0, #0x12 - bl BgConfig_Alloc - mov r1, #0x16 - lsl r1, r1, #4 - str r0, [r4, r1] - mov r0, #0x1f - mov r1, #0x12 - bl NARC_New - add r7, r0, #0 - mov r0, #0x12 - bl MessageFormat_New - mov r1, #0x5a - lsl r1, r1, #2 - str r0, [r4, r1] - mov r0, #0 - mov r1, #0x1b - mov r2, #0xf9 - mov r3, #0x12 - bl NewMsgDataFromNarc - mov r1, #0x5b - lsl r1, r1, #2 - str r0, [r4, r1] - mov r0, #1 - mov r1, #0x1b - mov r2, #0xfe - mov r3, #0x12 - bl NewMsgDataFromNarc - mov r1, #0x17 - lsl r1, r1, #4 - str r0, [r4, r1] - mov r0, #1 - mov r1, #0x1b - mov r2, #0xc5 - mov r3, #0x12 - bl NewMsgDataFromNarc - mov r1, #0x5d - lsl r1, r1, #2 - str r0, [r4, r1] - mov r0, #4 - mov r1, #8 - bl SetKeyRepeatTimers - bl sub_02083184 - mov r0, #0x16 - lsl r0, r0, #4 - ldr r0, [r4, r0] - bl sub_020831A4 - add r0, r6, #0 - bl OverlayManager_GetArgs - add r1, r0, #0 - add r0, r4, #0 - bl sub_02083160 - add r0, r4, #0 - add r1, r7, #0 - bl sub_02083654 - mov r0, #2 - mov r1, #0x12 - bl FontID_Alloc - ldr r0, _02082AD4 ; =sub_02083140 - mov r1, #0 - bl Main_SetVBlankIntrCB - add r0, r4, #0 - add r1, r6, #0 - bl sub_02083334 - mov r0, #0 - mov r1, #0x12 - bl FontID_SetAccessDirect - bl sub_0208377C - add r0, r4, #0 - add r1, r7, #0 - bl sub_020837AC - add r0, r4, #0 - bl sub_020839EC - add r0, r4, #0 - add r1, r6, #0 - add r2, r7, #0 - bl sub_02083F9C - ldr r0, _02082AD8 ; =0x000004C4 - mov r3, #0x5f - add r1, r4, r0 - lsl r3, r3, #2 - str r1, [sp] - ldr r1, [r4, r3] - add r2, r3, #0 - str r1, [sp, #4] - sub r2, #0x24 - sub r0, #0xcc - add r1, r4, #0 - sub r3, #0x22 - ldrh r2, [r4, r2] - add r0, r4, r0 - add r1, #0xd8 - add r3, r4, r3 - bl sub_02084740 - mov r1, #0 - mov r0, #0x34 - add r2, r1, #0 - bl sub_02004EC4 - mov r0, #0x10 - str r0, [sp] - mov r1, #1 - str r1, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #0 - add r2, r1, #0 - add r3, r0, #0 - bl BeginNormalPaletteFade - mov r0, #1 - bl sub_020832E4 - ldr r0, _02082ADC ; =gSystem + 0x60 - mov r1, #1 - strb r1, [r0, #9] - bl GfGfx_SwapDisplay - add r0, r7, #0 - bl NARC_Delete - ldr r0, [r5] - add r0, r0, #1 - str r0, [r5] - b _02082AC2 -_02082A88: - bl OverlayManager_GetData - add r4, r0, #0 - ldr r0, [r4] - cmp r0, #1 - bne _02082AA4 - ldr r1, _02082AE0 ; =0x000004B8 - ldr r2, [r4, #4] - ldr r0, [r4, r1] - add r1, #8 - ldr r1, [r4, r1] - ldr r3, [r4, #8] - bl sub_02082AEC -_02082AA4: - ldr r0, _02082AE4 ; =_021D43B0 - mov r1, #1 - str r4, [r0] - mov r0, #0 - mov r2, #0xc - mov r3, #0x12 - bl sub_020163E0 - ldr r1, _02082AE8 ; =0x000005C4 - add sp, #0xc - str r0, [r4, r1] - mov r0, #0 - str r0, [r5] - mov r0, #1 - pop {r4, r5, r6, r7, pc} -_02082AC2: - mov r0, #0 - add sp, #0xc - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_02082AC8: .word 0xFFFFE0FF -_02082ACC: .word 0x04001000 -_02082AD0: .word 0x000005D4 -_02082AD4: .word sub_02083140 -_02082AD8: .word 0x000004C4 -_02082ADC: .word gSystem + 0x60 -_02082AE0: .word 0x000004B8 -_02082AE4: .word _021D43B0 -_02082AE8: .word 0x000005C4 - thumb_func_end sub_02082908 - - thumb_func_start sub_02082AEC -sub_02082AEC: ; 0x02082AEC - push {r4, r5, r6, lr} - add r4, r1, #0 - add r5, r2, #0 - mov r2, #2 - ldr r0, [r0, #0x14] - ldr r1, _02082B1C ; =0x000057E0 - add r6, r3, #0 - lsl r2, r2, #8 - bl GX_LoadOBJ - ldr r4, [r4, #0xc] - add r0, r5, #0 - add r1, r6, #0 - mov r2, #0 - bl GetMonIconPaletteEx - lsl r0, r0, #5 - add r0, r4, r0 - mov r1, #0xc0 - mov r2, #0x20 - bl GX_LoadOBJPltt - pop {r4, r5, r6, pc} - nop -_02082B1C: .word 0x000057E0 - thumb_func_end sub_02082AEC - - thumb_func_start sub_02082B20 -sub_02082B20: ; 0x02082B20 - push {r4, r5, r6, lr} - sub sp, #0x10 - add r5, r1, #0 - add r6, r0, #0 - bl OverlayManager_GetData - ldr r1, [r5] - add r4, r0, #0 - cmp r1, #3 - bhi _02082B84 - add r2, r1, r1 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_02082B40: ; jump table - .short _02082B48 - _02082B40 - 2 ; case 0 - .short _02082B5C - _02082B40 - 2 ; case 1 - .short _02082B90 - _02082B40 - 2 ; case 2 - .short _02082CBE - _02082B40 - 2 ; case 3 -_02082B48: - bl IsPaletteFadeFinished - cmp r0, #0 - beq _02082B84 - mov r0, #1 - str r0, [r5] - ldr r0, _02082CDC ; =0x000005CC - mov r1, #0 - str r1, [r4, r0] - b _02082CCC -_02082B5C: - ldr r1, _02082CDC ; =0x000005CC - ldr r2, [r4, r1] - add r2, r2, #1 - str r2, [r4, r1] - bl sub_02084FCC - mov r2, #0x49 - lsl r2, r2, #4 - add r0, r4, r2 - mov r1, #0xcb - sub r2, #0x30 - lsl r1, r1, #2 - ldr r2, [r4, r2] - add r1, r4, r1 - bl sub_02084F3C - ldr r0, _02082CDC ; =0x000005CC - ldr r1, [r4, r0] - cmp r1, #5 - bgt _02082B86 -_02082B84: - b _02082CCC -_02082B86: - mov r1, #2 - str r1, [r5] - mov r1, #0 - str r1, [r4, r0] - b _02082CCC -_02082B90: - ldr r3, _02082CE0 ; =0x0000045C - ldr r2, [r4, r3] - cmp r2, #7 - bhi _02082C6A - add r2, r2, r2 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_02082BA4: ; jump table - .short _02082C6A - _02082BA4 - 2 ; case 0 - .short _02082C6A - _02082BA4 - 2 ; case 1 - .short _02082C6A - _02082BA4 - 2 ; case 2 - .short _02082C6A - _02082BA4 - 2 ; case 3 - .short _02082BB4 - _02082BA4 - 2 ; case 4 - .short _02082BC8 - _02082BA4 - 2 ; case 5 - .short _02082C14 - _02082BA4 - 2 ; case 6 - .short _02082C40 - _02082BA4 - 2 ; case 7 -_02082BB4: - ldr r2, [r4, #0x34] - cmp r2, #0 - bne _02082BC0 - bl sub_02082CF8 - str r0, [r5] -_02082BC0: - add r0, r4, #0 - bl sub_02084FCC - b _02082C6A -_02082BC8: - add r1, r6, #0 - bl sub_020834FC - ldr r0, _02082CE4 ; =0x00000448 - mov r1, #0xf - add r0, r4, r0 - bl FillWindowPixelBuffer - ldr r0, _02082CE4 ; =0x00000448 - mov r2, #1 - add r0, r4, r0 - mov r1, #0 - lsl r2, r2, #8 - mov r3, #0xa - bl DrawFrameAndWindow2 - mov r3, #0 - mov r2, #6 - ldr r0, _02082CE4 ; =0x00000448 - str r3, [sp] - mov r1, #1 - str r1, [sp, #4] - str r3, [sp, #8] - lsl r2, r2, #6 - ldr r2, [r4, r2] - add r0, r4, r0 - bl AddTextPrinterParameterized - ldr r1, _02082CE8 ; =0x00000458 - str r0, [r4, r1] - sub r1, #0x10 - add r0, r4, r1 - bl CopyWindowToVram - ldr r0, _02082CE0 ; =0x0000045C - mov r1, #6 - str r1, [r4, r0] - b _02082C6A -_02082C14: - sub r0, r3, #4 - ldr r0, [r4, r0] - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - bl TextPrinterCheckActive - cmp r0, #0 - bne _02082C6A - ldr r0, _02082CEC ; =0x000005E2 - bl PlaySE - ldr r1, _02082CF0 ; =0x000004A8 - mov r2, #0 - ldr r0, [r4, r1] - add r0, r0, #1 - str r0, [r4, r1] - ldr r0, _02082CDC ; =0x000005CC - sub r1, #0x4c - str r2, [r4, r0] - mov r0, #7 - str r0, [r4, r1] - b _02082C6A -_02082C40: - ldr r0, _02082CDC ; =0x000005CC - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - ldr r0, [r4, r0] - cmp r0, #0x1e - ble _02082C6A - mov r0, #0x10 - str r0, [sp] - mov r1, #0 - mov r0, #1 - str r0, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #2 - add r2, r1, #0 - add r3, r1, #0 - bl BeginNormalPaletteFade - mov r0, #3 - str r0, [r5] -_02082C6A: - ldr r3, _02082CF4 ; =0x00000464 - mov r1, #0xcb - add r0, r4, r3 - str r0, [sp] - add r0, r3, #4 - add r0, r4, r0 - lsl r1, r1, #2 - str r0, [sp, #4] - add r0, r4, r1 - str r0, [sp, #8] - add r0, r3, #0 - add r0, #0x4c - ldr r0, [r4, r0] - add r2, r3, #0 - ldr r0, [r0, #0x14] - add r1, #0x8c - str r0, [sp, #0xc] - mov r0, #0x16 - lsl r0, r0, #4 - sub r3, r3, #4 - sub r2, #8 - ldr r0, [r4, r0] - ldr r3, [r4, r3] - add r1, r4, r1 - add r2, r4, r2 - bl sub_02083D34 - mov r2, #0x49 - lsl r2, r2, #4 - add r0, r4, r2 - mov r1, #0xcb - sub r2, #0x30 - lsl r1, r1, #2 - ldr r2, [r4, r2] - add r1, r4, r1 - bl sub_02084F3C - add r0, r4, #0 - add r0, #0x38 - bl sub_02084500 - b _02082CCC -_02082CBE: - bl IsPaletteFadeFinished - cmp r0, #0 - beq _02082CCC - add sp, #0x10 - mov r0, #1 - pop {r4, r5, r6, pc} -_02082CCC: - mov r0, #0x62 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl SpriteList_RenderAndAnimateSprites - mov r0, #0 - add sp, #0x10 - pop {r4, r5, r6, pc} - .balign 4, 0 -_02082CDC: .word 0x000005CC -_02082CE0: .word 0x0000045C -_02082CE4: .word 0x00000448 -_02082CE8: .word 0x00000458 -_02082CEC: .word 0x000005E2 -_02082CF0: .word 0x000004A8 -_02082CF4: .word 0x00000464 - thumb_func_end sub_02082B20 - - thumb_func_start sub_02082CF8 -sub_02082CF8: ; 0x02082CF8 - push {r3, r4, r5, lr} - add r5, r0, #0 - add r4, r1, #0 - bl sub_0208432C - ldr r0, _02082E10 ; =gSystem - mov r1, #4 - ldr r0, [r0, #0x48] - tst r1, r0 - beq _02082D9C - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl Sprite_GetVisibleFlag - cmp r0, #0 - bne _02082D2A - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - add r0, r4, #0 - pop {r3, r4, r5, pc} -_02082D2A: - ldr r0, [r5] - cmp r0, #4 - beq _02082D74 - ldr r1, _02082E14 ; =0x0000045C - mov r0, #0 - str r0, [r5, r1] - add r2, r1, #4 - ldr r2, [r5, r2] - add r3, r2, #1 - add r2, r1, #4 - str r3, [r5, r2] - ldr r2, [r5, r2] - cmp r2, #3 - blt _02082D4A - add r1, r1, #4 - str r0, [r5, r1] -_02082D4A: - mov r2, #0x49 - lsl r2, r2, #4 - add r1, r2, #0 - sub r1, #0x30 - ldr r1, [r5, r1] - add r0, r5, r2 - lsl r3, r1, #2 - ldr r1, [r0, r3] - sub r2, #0x30 - add r1, r1, #1 - str r1, [r0, r3] - add r0, r5, #0 - ldr r1, [r5, r2] - add r0, #0x3a - bl sub_02084830 - ldr r0, _02082E18 ; =0x0000069D - bl PlaySE - mov r0, #1 - str r0, [r5, #0x30] -_02082D74: - mov r2, #0x49 - lsl r2, r2, #4 - add r1, r2, #0 - sub r1, #0x30 - ldr r1, [r5, r1] - add r0, r5, r2 - lsl r3, r1, #2 - ldr r1, [r0, r3] - sub r2, #0x30 - add r1, r1, #1 - str r1, [r0, r3] - add r0, r5, #0 - ldr r1, [r5, r2] - add r0, #0x3a - bl sub_02084830 - ldr r0, _02082E18 ; =0x0000069D - bl PlaySE - b _02082E0A -_02082D9C: - mov r2, #1 - add r1, r0, #0 - tst r1, r2 - beq _02082DC2 - ldr r3, [r5, #0x20] - mov r1, #0x1a - mul r1, r3 - add r3, r5, r1 - ldr r1, [r5, #0x1c] - add r0, r5, #0 - lsl r1, r1, #1 - add r1, r3, r1 - ldrh r1, [r1, #0x3a] - bl sub_02084884 - add r4, r0, #0 - mov r0, #1 - str r0, [r5, #0x30] - b _02082E0A -_02082DC2: - ldr r1, _02082E1C ; =0x000005C8 - ldr r1, [r5, r1] - cmp r1, #1 - bne _02082DE6 - ldr r2, [r5, #0x20] - mov r1, #0x1a - mul r1, r2 - add r2, r5, r1 - ldr r1, [r5, #0x1c] - add r0, r5, #0 - lsl r1, r1, #1 - add r1, r2, r1 - ldrh r1, [r1, #0x3a] - mov r2, #0 - bl sub_02084884 - add r4, r0, #0 - b _02082E0A -_02082DE6: - mov r1, #2 - add r3, r0, #0 - tst r3, r1 - beq _02082DFA - ldr r1, _02082E20 ; =0x0000E007 - add r0, r5, #0 - bl sub_02084884 - add r4, r0, #0 - b _02082E0A -_02082DFA: - add r1, #0xfe - tst r0, r1 - beq _02082E0A - ldr r1, _02082E24 ; =0x0000E006 - add r0, r5, #0 - bl sub_02084884 - add r4, r0, #0 -_02082E0A: - add r0, r4, #0 - pop {r3, r4, r5, pc} - nop -_02082E10: .word gSystem -_02082E14: .word 0x0000045C -_02082E18: .word 0x0000069D -_02082E1C: .word 0x000005C8 -_02082E20: .word 0x0000E007 -_02082E24: .word 0x0000E006 - thumb_func_end sub_02082CF8 - - thumb_func_start sub_02082E28 -sub_02082E28: ; 0x02082E28 - push {r4, r5, r6, lr} - add r5, r0, #0 - ldr r0, [r5] - add r4, r1, #0 - cmp r0, #0 - bne _02082E8A - ldr r0, [r5, #4] - cmp r0, #0 - bne _02082E52 - bl LCRandom - mov r1, #0x12 - bl _s32_div_f - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r5, r0] -#ifndef HEARTGOLD - add r1, #0x2A -#endif - bl NewString_ReadMsgData - add r6, r0, #0 - b _02082E6E -_02082E52: - cmp r0, #1 - bne _02082E6E - bl LCRandom - mov r1, #0x12 - bl _s32_div_f - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r5, r0] -#ifdef HEARTGOLD - add r1, #0x12 -#else - add r1, #0x3C -#endif - bl NewString_ReadMsgData - add r6, r0, #0 -_02082E6E: - ldr r0, [r4, #0x18] - add r1, r6, #0 - bl String_Copy - add r0, r6, #0 - bl String_Delete - ldr r0, [r4, #0x18] - add r4, #0x1c - add r1, r4, #0 - mov r2, #0xa - bl CopyStringToU16Array - pop {r4, r5, r6, pc} -_02082E8A: - cmp r0, #3 - bne _02082EB8 - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r5, r0] -#ifdef HEARTGOLD - mov r1, #0x54 -#else - mov r1, #0x55 -#endif - bl NewString_ReadMsgData - add r5, r0, #0 - ldr r0, [r4, #0x18] - add r1, r5, #0 - bl String_Copy - add r0, r5, #0 - bl String_Delete - ldr r0, [r4, #0x18] - add r4, #0x1c - add r1, r4, #0 - mov r2, #0xa - bl CopyStringToU16Array - pop {r4, r5, r6, pc} -_02082EB8: - mov r0, #1 - str r0, [r4, #0x14] - pop {r4, r5, r6, pc} - .balign 4, 0 - thumb_func_end sub_02082E28 - - thumb_func_start sub_02082EC0 -sub_02082EC0: ; 0x02082EC0 - push {r4, r5} - ldr r1, _02082EE0 ; =0x000001DE - ldr r2, _02082EE4 ; =0x0000FFFF - mov r5, #1 - mov r3, #0 -_02082ECA: - ldrh r4, [r0] - cmp r4, r2 - beq _02082EDA - cmp r4, r1 - beq _02082ED6 - add r5, r3, #0 -_02082ED6: - add r0, r0, #2 - b _02082ECA -_02082EDA: - add r0, r5, #0 - pop {r4, r5} - bx lr - .balign 4, 0 -_02082EE0: .word 0x000001DE -_02082EE4: .word 0x0000FFFF - thumb_func_end sub_02082EC0 - - thumb_func_start sub_02082EE8 -sub_02082EE8: ; 0x02082EE8 - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - str r0, [sp, #0x10] - bl OverlayManager_GetData - add r4, r0, #0 - ldr r0, [sp, #0x10] - bl OverlayManager_GetArgs - add r5, r0, #0 - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - ldr r1, _020830C0 ; =0x0000FFFF - lsl r0, r0, #1 - add r0, r4, r0 - add r0, #0xd8 - strh r1, [r0] - ldr r0, [r4] - cmp r0, #1 - bne _02082F32 - mov r0, #0x12 - bl AllocMonZeroed - mov r3, #0xa - str r3, [sp] - str r3, [sp, #4] - str r3, [sp, #8] - str r3, [sp, #0xc] - ldr r1, [r4, #4] - add r6, r0, #0 - mov r2, #5 - bl CreateMon - add r0, r6, #0 - bl FreeToHeap -_02082F32: - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r0, [r4, r1] - cmp r0, #0 - beq _02082F58 - add r0, r4, #0 - sub r1, #0x40 - add r0, #0xd8 - add r1, r4, r1 - bl StringNotEqual - cmp r0, #0 - beq _02082F58 - add r0, r4, #0 - add r0, #0xd8 - bl sub_02082EC0 - cmp r0, #0 - beq _02082F62 -_02082F58: - add r0, r4, #0 - add r1, r5, #0 - bl sub_02082E28 - b _02082F86 -_02082F62: - mov r0, #0x46 - lsl r0, r0, #2 - add r1, r4, #0 - add r0, r4, r0 - add r1, #0xd8 - bl CopyU16StringArray - add r0, r5, #0 - add r1, r4, #0 - add r0, #0x1c - add r1, #0xd8 - bl CopyU16StringArray - add r1, r4, #0 - ldr r0, [r5, #0x18] - add r1, #0xd8 - bl CopyU16ArrayToString -_02082F86: - mov r0, #0x61 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl String_Delete - mov r7, #0xe7 - mov r6, #0 - add r5, r4, #0 - lsl r7, r7, #2 -_02082F98: - ldr r0, [r5, r7] - bl DestroySysTaskAndEnvironment - add r6, r6, #1 - add r5, r5, #4 - cmp r6, #7 - blt _02082F98 - mov r0, #0xb1 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200AEB0 - mov r0, #0xb5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200AEB0 - mov r0, #0xb2 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200B0A8 - mov r0, #0xb6 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl sub_0200B0A8 - mov r7, #0xad - mov r6, #0 - add r5, r4, #0 - lsl r7, r7, #2 -_02082FD6: - ldr r0, [r5, r7] - bl Destroy2DGfxResObjMan - add r6, r6, #1 - add r5, r5, #4 - cmp r6, #4 - blt _02082FD6 - mov r0, #0x62 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl SpriteList_Delete - bl OamManager_Free - ldr r1, _020830C4 ; =0x000004AC - mov r0, #0x12 - ldr r1, [r4, r1] - bl FreeToHeapExplicit - ldr r0, [r4] - cmp r0, #1 - bne _02083016 - ldr r1, _020830C8 ; =0x000004B4 - mov r0, #0x12 - ldr r1, [r4, r1] - bl FreeToHeapExplicit - ldr r1, _020830CC ; =0x000004BC - mov r0, #0x12 - ldr r1, [r4, r1] - bl FreeToHeapExplicit -_02083016: - mov r0, #0x16 - lsl r0, r0, #4 - ldr r0, [r4, r0] - mov r1, #7 - bl FreeBgTilemapBuffer - bl ObjCharTransfer_Destroy - bl ObjPlttTransfer_Destroy - mov r0, #0x16 - lsl r0, r0, #4 - mov r1, #0xee - lsl r1, r1, #2 - ldr r0, [r4, r0] - add r1, r4, r1 - bl sub_02083614 - mov r0, #0 - bl FontID_SetAccessLazy - mov r2, #1 - lsl r2, r2, #0x1a - ldr r1, [r2] - ldr r0, _020830D0 ; =0xFFFF1FFF - and r0, r1 - str r0, [r2] - mov r0, #2 - bl FontID_Release - mov r0, #6 - lsl r0, r0, #6 - ldr r0, [r4, r0] - cmp r0, #0 - beq _02083060 - bl String_Delete -_02083060: - mov r0, #0x5e - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl String_Delete - mov r0, #0x5f - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl String_Delete - mov r0, #0x5d - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl DestroyMsgData - mov r0, #0x17 - lsl r0, r0, #4 - ldr r0, [r4, r0] - bl DestroyMsgData - mov r0, #0x5b - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl DestroyMsgData - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl MessageFormat_Delete - ldr r0, [sp, #0x10] - bl OverlayManager_FreeData - mov r0, #0 - add r1, r0, #0 - bl Main_SetVBlankIntrCB - mov r0, #0x12 - bl DestroyHeap - ldr r0, _020830D4 ; =gSystem + 0x60 - mov r1, #0 - strb r1, [r0, #9] - bl GfGfx_SwapDisplay - mov r0, #1 - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_020830C0: .word 0x0000FFFF -_020830C4: .word 0x000004AC -_020830C8: .word 0x000004B4 -_020830CC: .word 0x000004BC -_020830D0: .word 0xFFFF1FFF -_020830D4: .word gSystem + 0x60 - thumb_func_end sub_02082EE8 - - thumb_func_start NamingScreen_CreateArgs -NamingScreen_CreateArgs: ; 0x020830D8 - push {r3, r4, r5, r6, r7, lr} - add r5, r1, #0 - mov r1, #0x54 - str r0, [sp] - add r6, r2, #0 - add r7, r3, #0 - bl AllocFromHeap - add r4, r0, #0 - str r5, [r4] - str r6, [r4, #4] - str r7, [r4, #0xc] - mov r0, #0 - str r0, [r4, #0x14] - ldr r0, _02083118 ; =0x0000FFFF - ldr r1, [sp] - strh r0, [r4, #0x1c] - mov r0, #0x20 - bl String_New - str r0, [r4, #0x18] - mov r1, #0 - str r1, [r4, #0x44] - str r1, [r4, #0x48] - ldr r0, [sp, #0x18] - str r1, [r4, #0x10] - str r0, [r4, #0x4c] - ldr r0, [sp, #0x1c] - str r1, [r4, #8] - str r0, [r4, #0x50] - add r0, r4, #0 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02083118: .word 0x0000FFFF - thumb_func_end NamingScreen_CreateArgs - - thumb_func_start NamingScreen_DeleteArgs -NamingScreen_DeleteArgs: ; 0x0208311C - push {r4, lr} - add r4, r0, #0 - ldr r0, [r4, #0x18] - cmp r0, #0 - bne _0208312A - bl GF_AssertFail -_0208312A: - cmp r4, #0 - bne _02083132 - bl GF_AssertFail -_02083132: - ldr r0, [r4, #0x18] - bl String_Delete - add r0, r4, #0 - bl FreeToHeap - pop {r4, pc} - thumb_func_end NamingScreen_DeleteArgs - - thumb_func_start sub_02083140 -sub_02083140: ; 0x02083140 - push {r3, lr} - bl GF_RunVramTransferTasks - bl OamManager_ApplyAndResetBuffers - ldr r3, _02083158 ; =OS_IRQTable - ldr r1, _0208315C ; =0x00003FF8 - mov r0, #1 - ldr r2, [r3, r1] - orr r0, r2 - str r0, [r3, r1] - pop {r3, pc} - .balign 4, 0 -_02083158: .word OS_IRQTable -_0208315C: .word 0x00003FF8 - thumb_func_end sub_02083140 - - thumb_func_start sub_02083160 -sub_02083160: ; 0x02083160 - ldr r2, [r1] - str r2, [r0] - ldr r2, [r1, #4] - str r2, [r0, #4] - ldr r2, [r1, #8] - str r2, [r0, #8] - ldr r2, [r1, #0xc] - str r2, [r0, #0xc] - ldr r2, [r1, #0x10] - str r2, [r0, #0x10] - ldr r2, [r1, #0x4c] - str r2, [r0, #0x18] - ldr r2, [r1, #0x50] - mov r1, #0x5d - lsl r1, r1, #4 - str r2, [r0, r1] - bx lr - .balign 4, 0 - thumb_func_end sub_02083160 - - thumb_func_start sub_02083184 -sub_02083184: ; 0x02083184 - push {r4, lr} - sub sp, #0x28 - ldr r4, _020831A0 ; =_02102140 - add r3, sp, #0 - mov r2, #5 -_0208318E: - ldmia r4!, {r0, r1} - stmia r3!, {r0, r1} - sub r2, r2, #1 - bne _0208318E - add r0, sp, #0 - bl GfGfx_SetBanks - add sp, #0x28 - pop {r4, pc} - .balign 4, 0 -_020831A0: .word _02102140 - thumb_func_end sub_02083184 - - thumb_func_start sub_020831A4 -sub_020831A4: ; 0x020831A4 - push {r3, r4, r5, lr} - sub sp, #0x80 - ldr r5, _020832C8 ; =_02101D60 - add r3, sp, #0x70 - add r4, r0, #0 - add r2, r3, #0 - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - add r0, r2, #0 - bl SetBothScreensModesAndDisable - ldr r5, _020832CC ; =_02101ED4 - add r3, sp, #0x54 - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #0 - str r0, [r3] - add r0, r4, #0 - add r3, r1, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #0 - bl BgClearTilemapBufferAndCommit - ldr r5, _020832D0 ; =_02101FB4 - add r3, sp, #0x38 - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #1 - str r0, [r3] - add r0, r4, #0 - mov r3, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #1 - bl BgClearTilemapBufferAndCommit - ldr r5, _020832D4 ; =_02102078 - add r3, sp, #0x1c - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #2 - str r0, [r3] - add r0, r4, #0 - mov r3, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #2 - bl BgClearTilemapBufferAndCommit - ldr r5, _020832D8 ; =_02101E10 - add r3, sp, #0 - ldmia r5!, {r0, r1} - add r2, r3, #0 - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r5!, {r0, r1} - stmia r3!, {r0, r1} - ldr r0, [r5] - mov r1, #4 - str r0, [r3] - add r0, r4, #0 - mov r3, #0 - bl InitBgFromTemplate - add r0, r4, #0 - mov r1, #4 - bl BgClearTilemapBufferAndCommit - mov r0, #0 - bl sub_020832E4 - mov r0, #0 - mov r1, #0x20 - add r2, r0, #0 - mov r3, #0x12 - bl BG_ClearCharDataRange - mov r0, #4 - mov r1, #0x20 - mov r2, #0 - mov r3, #0x12 - bl BG_ClearCharDataRange - mov r0, #1 - lsl r0, r0, #0x1a - add r4, r0, #0 - ldr r2, [r0] - ldr r1, _020832DC ; =0xFFFF1FFF - add r4, #0x48 - and r2, r1 - lsr r1, r0, #0xd - orr r1, r2 - str r1, [r0] - ldrh r3, [r4] - mov r2, #0x3f - mov r1, #0x14 - bic r3, r2 - orr r1, r3 - mov r3, #0x20 - orr r1, r3 - strh r1, [r4] - add r4, r0, #0 - add r4, #0x4a - ldrh r5, [r4] - mov r1, #0x1f - bic r5, r2 - orr r1, r5 - orr r1, r3 - strh r1, [r4] - add r1, r0, #0 - mov r2, #0xff - add r1, #0x40 - strh r2, [r1] - mov r1, #0x40 - add r0, #0x44 - strh r1, [r0] - ldr r0, _020832E0 ; =0x04001050 - mov r1, #0 - strh r1, [r0] - add sp, #0x80 - pop {r3, r4, r5, pc} - .balign 4, 0 -_020832C8: .word _02101D60 -_020832CC: .word _02101ED4 -_020832D0: .word _02101FB4 -_020832D4: .word _02102078 -_020832D8: .word _02101E10 -_020832DC: .word 0xFFFF1FFF -_020832E0: .word 0x04001050 - thumb_func_end sub_020831A4 - - thumb_func_start sub_020832E4 -sub_020832E4: ; 0x020832E4 - push {r4, lr} - add r4, r0, #0 - lsl r1, r4, #0x18 - mov r0, #1 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #2 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #4 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - mov r0, #8 - mov r1, #0 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #0x10 - lsr r1, r1, #0x18 - bl GfGfx_EngineATogglePlanes - lsl r1, r4, #0x18 - mov r0, #1 - lsr r1, r1, #0x18 - bl GfGfx_EngineBTogglePlanes - mov r0, #2 - mov r1, #0 - bl GfGfx_EngineBTogglePlanes - mov r0, #0x10 - mov r1, #0 - bl GfGfx_EngineBTogglePlanes - pop {r4, pc} - thumb_func_end sub_020832E4 - - thumb_func_start sub_02083334 -sub_02083334: ; 0x02083334 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r4, r0, #0 - add r0, r1, #0 - bl OverlayManager_GetArgs - add r7, r0, #0 - ldr r0, _020834E4 ; =0x0000045C - mov r1, #4 - str r1, [r4, r0] - add r0, #0xc - add r0, r4, r0 - mov r1, #0 - bl sub_0208423C - ldr r6, _020834E8 ; =0x00000464 - mov r0, #0x16 - ldr r3, [r4, r6] - mov r5, #0xc - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r5, r6, #4 - ldr r0, [r4, r0] - ldr r3, [r3, r5] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r3, [r4, r6] - mov r5, #0xc - mov r0, #0x16 - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r6, #8 - ldr r0, [r4, r0] - ldr r3, [r3, r6] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - ldr r6, _020834E8 ; =0x00000464 - mov r0, #1 - ldr r1, [r4, r6] - mov r5, #0xc - add r3, r1, #0 - eor r3, r0 - mov r0, #0x16 - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r5, r6, #4 - ldr r0, [r4, r0] - ldr r3, [r3, r5] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r1, [r4, r6] - mov r0, #1 - add r3, r1, #0 - eor r3, r0 - mov r5, #0xc - mov r0, #0x16 - lsl r0, r0, #4 - lsl r1, r3, #0x18 - mul r5, r3 - add r3, r4, r5 - add r6, #8 - ldr r0, [r4, r0] - ldr r3, [r3, r6] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - mov r1, #0x46 - ldr r0, _020834EC ; =0x0000FFFF - lsl r1, r1, #2 - strh r0, [r4, r1] - ldr r0, [r7, #0x18] - cmp r0, #0 - beq _020833E8 - add r1, r4, r1 - mov r2, #0x20 - bl CopyStringToU16Array -_020833E8: - add r1, r4, #0 - mov r0, #1 - add r1, #0xd8 - mov r2, #0x40 - bl MIi_CpuClear16 - ldr r0, [r4] - cmp r0, #1 - bne _0208342E - mov r0, #0x12 - bl AllocMonZeroed - mov r3, #0xa - str r3, [sp] - str r3, [sp, #4] - str r3, [sp, #8] - str r3, [sp, #0xc] - ldr r1, [r4, #4] - add r5, r0, #0 - mov r2, #5 - bl CreateMon - add r0, r5, #0 - bl Mon_GetBoxMon - add r2, r0, #0 - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0 - bl BufferBoxMonSpeciesName - add r0, r5, #0 - bl FreeToHeap -_0208342E: - ldr r0, [r7, #0x44] - cmp r0, #0 - beq _02083438 - mov r0, #1 - str r0, [r4, #0x14] -_02083438: - ldr r2, [r4] - mov r1, #0x5a - lsl r1, r1, #2 - lsl r3, r2, #2 - ldr r2, _020834F0 ; =_021020B4 - ldr r0, [r4, r1] - add r1, r1, #4 - ldr r2, [r2, r3] - ldr r1, [r4, r1] - mov r3, #0x12 - bl ReadMsgData_ExpandPlaceholders - mov r1, #0x5e - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - sub r0, #0x10 - sub r1, #0xc - ldr r0, [r4, r0] - ldr r1, [r4, r1] - mov r2, #9 - mov r3, #0x12 - bl ReadMsgData_ExpandPlaceholders - mov r1, #0x5f - lsl r1, r1, #2 - str r0, [r4, r1] - sub r1, #0x10 - ldr r0, [r4, r1] - mov r1, #7 - bl NewString_ReadMsgData - mov r1, #0x61 - lsl r1, r1, #2 - str r0, [r4, r1] - sub r1, #0x6c - add r0, r4, r1 - bl StringLength - mov r1, #0x56 - lsl r1, r1, #2 - strh r0, [r4, r1] - mov r0, #0 - mov r2, #1 - str r0, [r4, #0x1c] - str r2, [r4, #0x20] - sub r1, r2, #2 - str r1, [r4, #0x24] - str r1, [r4, #0x28] - str r2, [r4, #0x30] - ldr r2, _020834F4 ; =0x00000484 - str r0, [r4, #0x34] - str r1, [r4, r2] - add r1, r2, #4 - str r0, [r4, r1] - add r2, #8 - str r0, [r4, r2] - ldr r1, [r4, #0xc] - ldr r2, _020834EC ; =0x0000FFFF - lsl r1, r1, #1 - add r1, r4, r1 - add r1, #0xd8 - strh r2, [r1] - mov r1, #0x49 - add r3, r4, #0 - add r2, r0, #0 - lsl r1, r1, #4 -_020834BE: - add r0, r0, #1 - str r2, [r3, r1] - add r3, r3, #4 - cmp r0, #7 - blt _020834BE - ldr r0, [r4] - cmp r0, #4 - bne _020834D8 - ldr r0, _020834F8 ; =0x0000049C - mov r1, #1 - add sp, #0x10 - str r1, [r4, r0] - pop {r3, r4, r5, r6, r7, pc} -_020834D8: - mov r0, #0x49 - mov r1, #1 - lsl r0, r0, #4 - str r1, [r4, r0] - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_020834E4: .word 0x0000045C -_020834E8: .word 0x00000464 -_020834EC: .word 0x0000FFFF -_020834F0: .word _021020B4 -_020834F4: .word 0x00000484 -_020834F8: .word 0x0000049C - thumb_func_end sub_02083334 - - thumb_func_start sub_020834FC -sub_020834FC: ; 0x020834FC - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r5, r0, #0 - add r0, r1, #0 - bl OverlayManager_GetArgs - add r4, r0, #0 - ldr r0, [r4, #0x44] - cmp r0, #0 - beq _0208360C - mov r0, #0xc8 - mov r1, #0x12 - bl String_New - add r7, r0, #0 - mov r0, #6 - mov r1, #0 - lsl r0, r0, #6 - str r1, [r5, r0] - ldr r0, [r4, #0x48] - bl PCStorage_GetActiveBox - add r6, r0, #0 - ldr r0, [r4, #0x48] - bl PCStorage_FindFirstBoxWithEmptySlot - str r0, [sp, #0x10] - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r2, [r4, #0x48] - mov r1, #1 - add r3, r6, #0 - bl BufferPCBoxName - ldr r0, [sp, #0x10] - cmp r6, r0 - beq _02083560 - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r2, [r4, #0x48] - ldr r3, [sp, #0x10] - mov r1, #2 - bl BufferPCBoxName - ldr r0, [r4, #0x44] - add r0, r0, #2 - str r0, [r4, #0x44] - b _02083570 -_02083560: - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r2, [r4, #0x48] - mov r1, #2 - add r3, r6, #0 - bl BufferPCBoxName -_02083570: - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r5, r0] - cmp r0, #0 - beq _02083586 - add r0, r5, #0 - add r0, #0xd8 - bl sub_02082EC0 - cmp r0, #0 - beq _020835BC -_02083586: - mov r0, #0x12 - bl AllocMonZeroed - mov r3, #0 - str r3, [sp] - str r3, [sp, #4] - str r3, [sp, #8] - str r3, [sp, #0xc] - ldr r1, [r5, #4] - add r6, r0, #0 - mov r2, #1 - bl CreateMon - add r0, r6, #0 - bl Mon_GetBoxMon - add r2, r0, #0 - mov r0, #0x5a - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0 - bl BufferBoxMonSpeciesName - add r0, r6, #0 - bl FreeToHeap - b _020835EA -_020835BC: - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r1, [r5, r1] - ldr r0, _02083610 ; =0x0000FFFF - lsl r1, r1, #1 - add r1, r5, r1 - add r1, #0xd8 - strh r0, [r1] - add r1, r5, #0 - add r0, r7, #0 - add r1, #0xd8 - bl CopyU16ArrayToString - mov r1, #0 - str r1, [sp] - mov r0, #0x5a - str r1, [sp, #4] - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r2, r7, #0 - add r3, r1, #0 - bl BufferString -_020835EA: - mov r1, #0x5a - lsl r1, r1, #2 - ldr r0, [r5, r1] - add r1, #0xc - ldr r1, [r5, r1] - ldr r2, [r4, #0x44] - mov r3, #0x12 - bl ReadMsgData_ExpandPlaceholders - mov r1, #6 - lsl r1, r1, #6 - str r0, [r5, r1] - mov r0, #1 - str r0, [r5, #0x14] - add r0, r7, #0 - bl String_Delete -_0208360C: - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_02083610: .word 0x0000FFFF - thumb_func_end sub_020834FC - - thumb_func_start sub_02083614 -sub_02083614: ; 0x02083614 - push {r4, r5, r6, lr} - add r6, r0, #0 - add r5, r1, #0 - mov r4, #0 -_0208361C: - add r0, r5, #0 - bl RemoveWindow - add r4, r4, #1 - add r5, #0x10 - cmp r4, #0xa - blt _0208361C - add r0, r6, #0 - mov r1, #4 - bl FreeBgTilemapBuffer - add r0, r6, #0 - mov r1, #2 - bl FreeBgTilemapBuffer - add r0, r6, #0 - mov r1, #1 - bl FreeBgTilemapBuffer - add r0, r6, #0 - mov r1, #0 - bl FreeBgTilemapBuffer - mov r0, #0x12 - add r1, r6, #0 - bl FreeToHeapExplicit - pop {r4, r5, r6, pc} - thumb_func_end sub_02083614 - - thumb_func_start sub_02083654 -sub_02083654: ; 0x02083654 - push {r4, r5, r6, lr} - sub sp, #0x10 - add r5, r0, #0 - mov r0, #0x16 - lsl r0, r0, #4 - ldr r6, [r5, r0] - mov r0, #0x60 - add r4, r1, #0 - mov r1, #0 - str r0, [sp] - mov r0, #0x12 - str r0, [sp, #4] - add r0, r4, #0 - add r2, r1, #0 - add r3, r1, #0 - bl GfGfxLoader_GXLoadPalFromOpenNarc - mov r0, #0x20 - str r0, [sp] - mov r0, #0x12 - str r0, [sp, #4] - mov r0, #0xe - mov r1, #0x47 - mov r2, #4 - mov r3, #0 - bl GfGfxLoader_GXLoadPal - mov r0, #4 - mov r1, #0 - bl BG_SetMaskColor - mov r0, #0 - str r0, [sp] - mov r0, #2 - lsl r0, r0, #0xc - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #0x12 - mov r1, #2 - str r0, [sp, #0xc] - add r0, r4, #0 - add r2, r6, #0 - add r3, r1, #0 - bl GfGfxLoader_LoadCharDataFromOpenNarc - mov r0, #0 - str r0, [sp] - mov r0, #6 - lsl r0, r0, #8 - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #4 - add r2, r6, #0 - mov r3, #2 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r0, #0 - str r0, [sp] - mov r0, #2 - lsl r0, r0, #0xc - str r0, [sp, #4] - mov r3, #1 - str r3, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #2 - add r2, r6, #0 - bl GfGfxLoader_LoadCharDataFromOpenNarc - mov r0, #0 - str r0, [sp] - mov r0, #0xe - lsl r0, r0, #6 - str r0, [sp, #4] - mov r3, #1 - str r3, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #6 - add r2, r6, #0 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r3, #0 - mov r0, #0xe - str r3, [sp] - lsl r0, r0, #6 - str r0, [sp, #4] - mov r0, #1 - str r0, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - add r0, r4, #0 - mov r1, #7 - add r2, r6, #0 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r1, #6 - mov r0, #0 - lsl r1, r1, #6 - mov r2, #0x12 - bl LoadFontPal1 - ldr r0, [r5, #0x18] - bl Options_GetFrame - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - str r0, [sp] - mov r0, #0x12 - str r0, [sp, #4] - mov r0, #0x16 - lsl r0, r0, #4 - mov r1, #4 - add r2, r1, #0 - ldr r0, [r5, r0] - add r2, #0xfc - mov r3, #0xa - bl LoadUserFrameGfx2 - mov r1, #6 - mov r0, #4 - lsl r1, r1, #6 - mov r2, #0x12 - bl LoadFontPal1 - mov r3, #0x4b - mov r0, #0x12 - lsl r3, r3, #4 - str r0, [sp] - add r0, r4, #0 - mov r1, #0x10 - mov r2, #1 - add r3, r5, r3 - bl GfGfxLoader_GetCharDataFromOpenNarc - ldr r1, _02083778 ; =0x000004AC - str r0, [r5, r1] - add sp, #0x10 - pop {r4, r5, r6, pc} - .balign 4, 0 -_02083778: .word 0x000004AC - thumb_func_end sub_02083654 - - thumb_func_start sub_0208377C -sub_0208377C: ; 0x0208377C - push {r4, lr} - sub sp, #0x10 - ldr r4, _020837A8 ; =_02101D70 - add r3, sp, #0 - add r2, r3, #0 - ldmia r4!, {r0, r1} - stmia r3!, {r0, r1} - ldmia r4!, {r0, r1} - stmia r3!, {r0, r1} - add r0, r2, #0 - bl ObjCharTransfer_Init - mov r0, #0x14 - mov r1, #0x12 - bl ObjPlttTransfer_Init - bl ObjCharTransfer_ClearBuffers - bl ObjPlttTransfer_Reset - add sp, #0x10 - pop {r4, pc} - .balign 4, 0 -_020837A8: .word _02101D70 - thumb_func_end sub_0208377C - - thumb_func_start sub_020837AC -sub_020837AC: ; 0x020837AC - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r5, r0, #0 - add r7, r1, #0 - bl NNS_G2dInitOamManagerModule - mov r2, #1 - lsl r2, r2, #0x1a - ldr r1, [r2] - ldr r0, _020839A4 ; =0xFFCFFFEF - add r3, r1, #0 - and r3, r0 - mov r1, #0x10 - orr r3, r1 - str r3, [r2] - ldr r3, _020839A8 ; =0x04001000 - ldr r2, [r3] - and r0, r2 - orr r0, r1 - str r0, [r3] - mov r0, #0 - str r0, [sp] - mov r1, #0x80 - str r1, [sp, #4] - str r0, [sp, #8] - mov r3, #0x20 - str r3, [sp, #0xc] - mov r2, #0x12 - str r2, [sp, #0x10] - add r2, r0, #0 - bl OamManager_Create - mov r1, #0x63 - lsl r1, r1, #2 - mov r0, #0x2c - add r1, r5, r1 - mov r2, #0x12 - bl G2dRenderer_Init - mov r1, #0x62 - lsl r1, r1, #2 - str r0, [r5, r1] - add r0, r1, #4 - mov r2, #1 - add r0, r5, r0 - mov r1, #0 - lsl r2, r2, #0x14 - bl G2dRenderer_SetSubSurfaceCoords - mov r6, #0 - add r4, r5, #0 -_02083812: - mov r0, #2 - add r1, r6, #0 - mov r2, #0x12 - bl Create2DGfxResObjMan - mov r1, #0xad - lsl r1, r1, #2 - str r0, [r4, r1] - add r6, r6, #1 - add r4, r4, #4 - cmp r6, #4 - blt _02083812 - mov r0, #0 - str r0, [sp] - mov r3, #1 - str r3, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - add r0, r1, #0 - ldr r0, [r5, r0] - add r1, r7, #0 - mov r2, #0xa - bl AddCharResObjFromOpenNarc - mov r1, #0xb1 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r3, #0 - str r3, [sp] - mov r2, #1 - str r2, [sp, #4] - mov r0, #9 - str r0, [sp, #8] - mov r0, #0x12 - sub r1, #0xc - str r0, [sp, #0xc] - ldr r0, [r5, r1] - add r1, r7, #0 - bl AddPlttResObjFromOpenNarc - mov r1, #0xb2 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r0, #0 - str r0, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0xc - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xc - mov r3, #1 - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0xb3 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r0, #0 - str r0, [sp] - mov r0, #3 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0xc - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xe - mov r3, #1 - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0x2d - lsl r1, r1, #4 - str r0, [r5, r1] - ldr r0, [r5] - cmp r0, #1 - bne _020838FC - ldr r0, [r5, #4] - ldr r2, [r5, #8] - mov r1, #0 - bl GetMonIconNaixEx - ldr r3, _020839AC ; =0x000004B8 - add r1, r0, #0 - mov r0, #0x12 - str r0, [sp] - mov r0, #0x14 - mov r2, #0 - add r3, r5, r3 - bl GfGfxLoader_GetCharData - ldr r1, _020839B0 ; =0x000004B4 - str r0, [r5, r1] - add r0, r1, #4 - mov r1, #2 - ldr r0, [r5, r0] - lsl r1, r1, #8 - bl DC_FlushRange - bl sub_02074490 - mov r2, #0x13 - lsl r2, r2, #6 - add r1, r0, #0 - mov r0, #0x14 - add r2, r5, r2 - mov r3, #0x12 - bl GfGfxLoader_GetPlttData - ldr r1, _020839B4 ; =0x000004BC - str r0, [r5, r1] - add r0, r1, #4 - ldr r0, [r5, r0] - mov r1, #0x80 - bl DC_FlushRange -_020838FC: - mov r3, #1 - str r3, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #0xad - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r1, r7, #0 - mov r2, #0xb - bl AddCharResObjFromOpenNarc - mov r1, #0xb5 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r2, #1 - str r2, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #3 - str r0, [sp, #8] - mov r0, #0x12 - sub r1, #0x1c - str r0, [sp, #0xc] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r3, #0 - bl AddPlttResObjFromOpenNarc - mov r1, #0xb6 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r3, #1 - str r3, [sp] - mov r0, #2 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0x1c - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xd - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0xb7 - lsl r1, r1, #2 - str r0, [r5, r1] - mov r3, #1 - str r3, [sp] - mov r0, #3 - str r0, [sp, #4] - mov r0, #0x12 - sub r1, #0x1c - str r0, [sp, #8] - ldr r0, [r5, r1] - add r1, r7, #0 - mov r2, #0xf - bl AddCellOrAnimResObjFromOpenNarc - mov r1, #0x2e - lsl r1, r1, #4 - str r0, [r5, r1] - sub r1, #0x1c - ldr r0, [r5, r1] - bl sub_0200ACF0 - mov r0, #0xb5 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl sub_0200ACF0 - mov r0, #0xb2 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl sub_0200AF94 - mov r0, #0xb6 - lsl r0, r0, #2 - ldr r0, [r5, r0] - bl sub_0200AF94 - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_020839A4: .word 0xFFCFFFEF -_020839A8: .word 0x04001000 -_020839AC: .word 0x000004B8 -_020839B0: .word 0x000004B4 -_020839B4: .word 0x000004BC - thumb_func_end sub_020837AC - - thumb_func_start sub_020839B8 -sub_020839B8: ; 0x020839B8 - push {r3, r4, lr} - sub sp, #0xc - add r4, r1, #0 - ldr r0, [r4] - bl Sprite_GetMatrixPtr - ldr r1, [r0] - ldr r0, [r4, #8] - add r0, r1, r0 - str r0, [sp] - ldr r0, [r4, #0xc] - lsl r1, r0, #4 - ldr r0, _020839E8 ; =_021021E8 + 4 - ldr r0, [r0, r1] - add r1, sp, #0 - lsl r0, r0, #0xc - str r0, [sp, #4] - mov r0, #0 - str r0, [sp, #8] - ldr r0, [r4, #4] - bl Sprite_SetMatrix - add sp, #0xc - pop {r3, r4, pc} - .balign 4, 0 -_020839E8: .word _021021E8 + 4 - thumb_func_end sub_020839B8 - - thumb_func_start sub_020839EC -sub_020839EC: ; 0x020839EC - push {r4, r5, r6, r7, lr} - sub sp, #0x5c - mov r1, #0 - add r6, r0, #0 - str r1, [sp] - sub r0, r1, #1 - str r0, [sp, #4] - str r0, [sp, #8] - mov r2, #0xad - str r1, [sp, #0xc] - mov r0, #1 - lsl r2, r2, #2 - str r0, [sp, #0x10] - ldr r0, [r6, r2] - add r3, r1, #0 - str r0, [sp, #0x14] - add r0, r2, #4 - ldr r0, [r6, r0] - str r0, [sp, #0x18] - add r0, r2, #0 - add r0, #8 - ldr r0, [r6, r0] - str r0, [sp, #0x1c] - add r0, r2, #0 - add r0, #0xc - ldr r0, [r6, r0] - add r2, #0x30 - str r0, [sp, #0x20] - str r1, [sp, #0x24] - add r0, r6, r2 - add r2, r1, #0 - str r1, [sp, #0x28] - bl CreateSpriteResourcesHeader - mov r1, #1 - mov r3, #0xad - str r1, [sp] - sub r0, r1, #2 - str r0, [sp, #4] - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - str r0, [sp, #0x10] - lsl r3, r3, #2 - ldr r2, [r6, r3] - str r2, [sp, #0x14] - add r2, r3, #4 - ldr r2, [r6, r2] - str r2, [sp, #0x18] - add r2, r3, #0 - add r2, #8 - ldr r2, [r6, r2] - str r2, [sp, #0x1c] - add r2, r3, #0 - add r2, #0xc - ldr r2, [r6, r2] - add r3, #0x54 - str r2, [sp, #0x20] - str r0, [sp, #0x24] - str r0, [sp, #0x28] - add r0, r6, r3 - add r2, r1, #0 - add r3, r1, #0 - bl CreateSpriteResourcesHeader - mov r0, #0x62 - lsl r0, r0, #2 - ldr r0, [r6, r0] - mov r1, #2 - str r0, [sp, #0x2c] - mov r0, #0xb9 - lsl r0, r0, #2 - add r0, r6, r0 - str r0, [sp, #0x30] - mov r0, #6 - lsl r1, r1, #0x10 - lsl r0, r0, #0x10 - str r0, [sp, #0x38] - lsr r0, r1, #5 - mov r7, #0 - str r1, [sp, #0x34] - str r7, [sp, #0x3c] - str r0, [sp, #0x40] - str r0, [sp, #0x44] - str r0, [sp, #0x48] - add r0, sp, #0x2c - strh r7, [r0, #0x20] - mov r0, #1 - str r0, [sp, #0x50] - str r0, [sp, #0x54] - mov r0, #0x12 - ldr r4, _02083BAC ; =_021021E8 - str r0, [sp, #0x58] - add r5, r6, #0 -_02083AA8: - ldr r0, [r4] - lsl r0, r0, #0xc - str r0, [sp, #0x34] - ldr r0, [r4, #4] - lsl r0, r0, #0xc - str r0, [sp, #0x38] - add r0, sp, #0x2c - bl Sprite_CreateAffine - mov r1, #0xcb - lsl r1, r1, #2 - str r0, [r5, r1] - add r0, r1, #0 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - mov r0, #0xcb - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r1, [r4, #8] - bl Sprite_SetAnimCtrlSeq - mov r0, #0xcb - lsl r0, r0, #2 - ldr r0, [r5, r0] - ldr r1, [r4, #0xc] - bl Sprite_SetDrawPriority - add r7, r7, #1 - add r4, #0x10 - add r5, r5, #4 - cmp r7, #9 - blt _02083AA8 - mov r0, #0xcf - lsl r0, r0, #2 - ldr r0, [r6, r0] - mov r1, #0 - bl Sprite_SetVisibleFlag - ldr r7, _02083BAC ; =_021021E8 - mov r5, #0 - add r4, r6, #0 -_02083AFE: - ldr r0, _02083BB0 ; =sub_020839B8 - mov r1, #0x10 - mov r2, #5 - mov r3, #0x12 - bl CreateSysTaskAndEnvironment - mov r1, #0xe7 - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - ldr r0, [r4, r0] - bl SysTask_GetData - mov r1, #0xd2 - lsl r1, r1, #2 - ldr r1, [r6, r1] - str r1, [r0] - mov r1, #0xcb - lsl r1, r1, #2 - ldr r1, [r4, r1] - add r4, r4, #4 - str r1, [r0, #4] - ldr r1, [r7] - add r7, #0x10 - lsl r1, r1, #0xc - str r1, [r0, #8] - str r5, [r0, #0xc] - add r5, r5, #1 - cmp r5, #7 - blt _02083AFE - ldr r2, [r6, #0xc] - mov r7, #0 - cmp r2, #0 - ble _02083B7E - mov r5, #0x50 - add r4, r6, #0 -_02083B46: - lsl r0, r5, #0xc - str r0, [sp, #0x34] - mov r0, #0x27 - lsl r0, r0, #0xc - str r0, [sp, #0x38] - add r0, sp, #0x2c - bl Sprite_CreateAffine - mov r1, #0xd9 - lsl r1, r1, #2 - str r0, [r4, r1] - add r0, r1, #0 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - mov r0, #0xd9 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x2b - bl Sprite_SetAnimCtrlSeq - ldr r2, [r6, #0xc] - add r7, r7, #1 - add r5, #0xc - add r4, r4, #4 - cmp r7, r2 - blt _02083B46 -_02083B7E: - mov r1, #0x56 - lsl r1, r1, #2 - mov r0, #0xd9 - lsl r0, r0, #2 - ldrh r1, [r6, r1] - add r0, r6, r0 - bl sub_02084E18 - add r0, r6, #0 - add r1, sp, #0x2c - bl sub_02083BB4 - mov r0, #0x10 - mov r1, #1 - bl GfGfx_EngineATogglePlanes - mov r0, #0x10 - mov r1, #1 - bl GfGfx_EngineBTogglePlanes - add sp, #0x5c - pop {r4, r5, r6, r7, pc} - nop -_02083BAC: .word _021021E8 -_02083BB0: .word sub_020839B8 - thumb_func_end sub_020839EC - - thumb_func_start sub_02083BB4 -sub_02083BB4: ; 0x02083BB4 - push {r3, r4, r5, lr} - add r4, r0, #0 - mov r0, #6 - add r5, r1, #0 - lsl r0, r0, #0xe - str r0, [r5, #8] - mov r0, #2 - lsl r0, r0, #0xe - str r0, [r5, #0xc] - add r0, r5, #0 - bl Sprite_CreateAffine - mov r1, #0xe5 - lsl r1, r1, #2 - str r0, [r4, r1] - ldr r0, [r4, r1] - mov r1, #1 - bl Sprite_SetAnimActiveFlag - ldr r0, [r4] - cmp r0, #7 - bhi _02083CAA - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02083BEC: ; jump table - .short _02083BFC - _02083BEC - 2 ; case 0 - .short _02083C64 - _02083BEC - 2 ; case 1 - .short _02083C56 - _02083BEC - 2 ; case 2 - .short _02083C1E - _02083BEC - 2 ; case 3 - .short _02083C48 - _02083BEC - 2 ; case 4 - .short _02083C3A - _02083BEC - 2 ; case 5 - .short _02083C2C - _02083BEC - 2 ; case 6 - .short _02083C48 - _02083BEC - 2 ; case 7 -_02083BFC: - ldr r0, [r4, #4] - cmp r0, #0 - bne _02083C10 - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x30 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C10: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x31 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C1E: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x33 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C2C: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x37 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C3A: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x36 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C48: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x35 - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C56: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x2f - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083C64: - mov r0, #0xe5 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x32 - bl Sprite_SetAnimCtrlSeq - ldr r0, [r4, #0x10] - cmp r0, #2 - beq _02083CAA - ldr r1, [r4, #0xc] - mov r0, #0xd - mul r0, r1 - add r0, #0x50 - lsl r0, r0, #0xc - str r0, [r5, #8] - mov r0, #0x1b - lsl r0, r0, #0xc - str r0, [r5, #0xc] - add r0, r5, #0 - bl Sprite_CreateAffine - mov r1, #0xe6 - lsl r1, r1, #2 - str r0, [r4, r1] - ldr r0, [r4, #0x10] - cmp r0, #0 - ldr r0, [r4, r1] - bne _02083CA4 - mov r1, #0x2d - bl Sprite_SetAnimCtrlSeq - pop {r3, r4, r5, pc} -_02083CA4: - mov r1, #0x2e - bl Sprite_SetAnimCtrlSeq -_02083CAA: - pop {r3, r4, r5, pc} - thumb_func_end sub_02083BB4 - - thumb_func_start sub_02083CAC -sub_02083CAC: ; 0x02083CAC - push {r4, r5, lr} - sub sp, #0xc - add r4, r1, #0 - add r5, r0, #0 - ldr r0, [r4, #0xc] - str r0, [sp, #4] - mov r0, #0 - str r0, [sp, #8] - ldr r0, [r4, #4] - cmp r0, #6 - bhi _02083D2A - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_02083CCE: ; jump table - .short _02083CDC - _02083CCE - 2 ; case 0 - .short _02083D2A - _02083CCE - 2 ; case 1 - .short _02083CF0 - _02083CCE - 2 ; case 2 - .short _02083D2A - _02083CCE - 2 ; case 3 - .short _02083D04 - _02083CCE - 2 ; case 4 - .short _02083D2A - _02083CCE - 2 ; case 5 - .short _02083D18 - _02083CCE - 2 ; case 6 -_02083CDC: - mov r0, #1 - ldr r1, [r4, #8] - lsl r0, r0, #0xe - add r0, r1, r0 - str r0, [sp] - ldr r0, [r4] - add r1, sp, #0 - bl Sprite_SetMatrix - b _02083D2A -_02083CF0: - mov r0, #3 - ldr r1, [r4, #8] - lsl r0, r0, #0xc - sub r0, r1, r0 - str r0, [sp] - ldr r0, [r4] - add r1, sp, #0 - bl Sprite_SetMatrix - b _02083D2A -_02083D04: - mov r0, #2 - ldr r1, [r4, #8] - lsl r0, r0, #0xc - add r0, r1, r0 - str r0, [sp] - ldr r0, [r4] - add r1, sp, #0 - bl Sprite_SetMatrix - b _02083D2A -_02083D18: - ldr r0, [r4, #8] - add r1, sp, #0 - str r0, [sp] - ldr r0, [r4] - bl Sprite_SetMatrix - add r0, r5, #0 - bl DestroySysTaskAndEnvironment -_02083D2A: - ldr r0, [r4, #4] - add r0, r0, #1 - str r0, [r4, #4] - add sp, #0xc - pop {r4, r5, pc} - thumb_func_end sub_02083CAC - - thumb_func_start sub_02083D34 -sub_02083D34: ; 0x02083D34 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x28 - str r1, [sp, #0x14] - ldr r1, [sp, #0x40] - add r5, r2, #0 - str r1, [sp, #0x40] - ldr r1, [sp, #0x48] - mov r2, #1 - str r1, [sp, #0x48] - ldr r1, [sp, #0x40] - str r0, [sp, #0x10] - ldr r6, [r1] - add r7, r3, #0 - add r1, r6, #0 - eor r1, r2 - str r1, [sp, #0x18] - ldr r1, [r5] - ldr r4, [sp, #0x44] - cmp r1, #4 - bls _02083D5E - b _02083F02 -_02083D5E: - add r1, r1, r1 - add r1, pc - ldrh r1, [r1, #6] - lsl r1, r1, #0x10 - asr r1, r1, #0x10 - add pc, r1 -_02083D6A: ; jump table - .short _02083D74 - _02083D6A - 2 ; case 0 - .short _02083DC0 - _02083D6A - 2 ; case 1 - .short _02083DE6 - _02083D6A - 2 ; case 2 - .short _02083E80 - _02083D6A - 2 ; case 3 - .short _02083F02 - _02083D6A - 2 ; case 4 -_02083D74: - mov r0, #0 - str r0, [sp] - mov r0, #0xe - lsl r0, r0, #6 - str r0, [sp, #4] - str r2, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - ldr r2, [sp, #0x10] - mov r0, #0x1f - add r1, r7, #6 - add r3, r6, #0 - bl GfGfxLoader_LoadScrnData - add r0, r4, #0 - add r1, r6, #0 - bl sub_0208423C - ldr r0, _02083F08 ; =_02101D40 - lsl r2, r6, #4 - ldrb r1, [r0, r7] - ldr r0, [sp, #0x4c] - ldr r3, _02083F0C ; =0x000E0F00 - str r0, [sp] - ldr r0, [sp, #0x14] - add r0, r0, r2 - lsl r2, r1, #4 - orr r1, r2 - lsl r1, r1, #0x10 - lsr r1, r1, #0x10 - add r2, r7, #0 - bl sub_02084E54 - ldr r0, [r5] - add sp, #0x28 - add r0, r0, #1 - str r0, [r5] - pop {r3, r4, r5, r6, r7, pc} -_02083DC0: - lsl r1, r6, #0x18 - lsr r1, r1, #0x18 - mov r2, #0 - mov r3, #0xee - bl BgSetPosTextAndCommit - mov r2, #3 - lsl r1, r6, #0x18 - add r3, r2, #0 - ldr r0, [sp, #0x10] - lsr r1, r1, #0x18 - sub r3, #0x53 - bl BgSetPosTextAndCommit - ldr r0, [r5] - add sp, #0x28 - add r0, r0, #1 - str r0, [r5] - pop {r3, r4, r5, r6, r7, pc} -_02083DE6: - mov r1, #0xc - add r0, r6, #0 - mul r0, r1 - ldr r2, [r4, r0] - str r0, [sp, #0x1c] - sub r2, #0x18 - str r2, [r4, r0] - ldr r0, [r4, r0] - sub r1, #0xd - cmp r0, r1 - bge _02083E3E - ldr r0, _02083F10 ; =sub_02083CAC - mov r1, #0x10 - mov r2, #0 - mov r3, #0x12 - bl CreateSysTaskAndEnvironment - bl SysTask_GetData - add r7, r0, #0 - ldr r0, [sp, #0x48] - ldr r0, [r0, #0x1c] - str r0, [r7] - mov r0, #0 - str r0, [r7, #4] - ldr r0, [sp, #0x48] - ldr r0, [r0, #0x1c] - bl Sprite_GetMatrixPtr - ldr r0, [r0] - str r0, [r7, #8] - ldr r0, [sp, #0x48] - ldr r0, [r0, #0x1c] - bl Sprite_GetMatrixPtr - ldr r0, [r0, #4] - mov r1, #0xa - str r0, [r7, #0xc] - ldr r0, [sp, #0x1c] - mvn r1, r1 - str r1, [r4, r0] - ldr r0, [r5] - add r0, r0, #1 - str r0, [r5] -_02083E3E: - ldr r0, [sp, #0x18] - mov r1, #0xc - add r7, r0, #0 - add r5, r4, #4 - mul r7, r1 - ldr r0, [r5, r7] - sub r0, #0xa - str r0, [r5, r7] - add r0, r1, #0 - ldr r2, [r5, r7] - sub r0, #0xd0 - cmp r2, r0 - bge _02083E5C - sub r1, #0xd0 - str r1, [r5, r7] -_02083E5C: - ldr r3, [sp, #0x1c] - lsl r1, r6, #0x18 - ldr r0, [sp, #0x10] - ldr r3, [r4, r3] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r1, [sp, #0x18] - ldr r0, [sp, #0x10] - lsl r1, r1, #0x18 - ldr r3, [r5, r7] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - add sp, #0x28 - pop {r3, r4, r5, r6, r7, pc} -_02083E80: - ldr r1, [sp, #0x18] - mov r0, #0xc - add r2, r1, #0 - mul r2, r0 - str r2, [sp, #0x20] - add r7, r4, #4 - ldr r2, [r7, r2] - ldr r1, [sp, #0x20] - sub r2, #0xa - str r2, [r7, r1] - ldr r2, [r7, r1] - add r1, r0, #0 - sub r1, #0xd0 - cmp r2, r1 - bge _02083EA4 - ldr r1, [sp, #0x20] - sub r0, #0xd0 - str r0, [r7, r1] -_02083EA4: - mov r0, #0xc - mul r0, r6 - str r0, [sp, #0x24] - ldr r3, [sp, #0x24] - lsl r1, r6, #0x18 - ldr r0, [sp, #0x10] - ldr r3, [r4, r3] - lsr r1, r1, #0x18 - mov r2, #0 - bl BgSetPosTextAndCommit - ldr r1, [sp, #0x18] - ldr r3, [sp, #0x20] - lsl r1, r1, #0x18 - ldr r0, [sp, #0x10] - ldr r3, [r7, r3] - lsr r1, r1, #0x18 - mov r2, #3 - bl BgSetPosTextAndCommit - ldr r0, [sp, #0x24] - mov r1, #0xa - ldr r0, [r4, r0] - mvn r1, r1 - cmp r0, r1 - bne _02083F02 - ldr r0, [sp, #0x20] - sub r1, #0xb9 - ldr r0, [r7, r0] - cmp r0, r1 - bne _02083F02 - ldr r0, [r5] - add r2, r4, #0 - add r0, r0, #1 - str r0, [r5] - ldr r0, [sp, #0x40] - ldr r1, [r0] - mov r0, #1 - eor r1, r0 - ldr r0, [sp, #0x40] - str r1, [r0] - ldr r0, [sp, #0x10] - bl sub_0208421C - ldr r0, _02083F14 ; =0x0000069A - bl PlaySE -_02083F02: - add sp, #0x28 - pop {r3, r4, r5, r6, r7, pc} - nop -_02083F08: .word _02101D40 -_02083F0C: .word 0x000E0F00 -_02083F10: .word sub_02083CAC -_02083F14: .word 0x0000069A - thumb_func_end sub_02083D34 - - thumb_func_start sub_02083F18 -sub_02083F18: ; 0x02083F18 - push {r4, r5, lr} - sub sp, #0xc - add r4, r2, #0 - mov r2, #1 - mov r1, #0 - lsl r2, r2, #8 - mov r3, #0xa - add r5, r0, #0 - bl DrawFrameAndWindow2 - mov r3, #0 - str r3, [sp] - str r3, [sp, #4] - add r0, r5, #0 - mov r1, #1 - add r2, r4, #0 - str r3, [sp, #8] - bl AddTextPrinterParameterized - add r0, r5, #0 - bl CopyWindowToVram - add sp, #0xc - pop {r4, r5, pc} - thumb_func_end sub_02083F18 - - thumb_func_start sub_02083F48 -sub_02083F48: ; 0x02083F48 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x10 - add r5, r0, #0 - add r7, r2, #0 - mov r0, #0 - add r1, r7, #0 - add r2, r0, #0 - mov r4, #0x10 - bl FontID_String_GetWidth - add r6, r0, #0 - add r0, r5, #0 - bl GetWindowWidth - lsl r1, r0, #3 - add r0, r6, #0 - add r0, #0x10 - cmp r0, r1 - ble _02083F70 - sub r4, r1, r6 -_02083F70: - add r0, r5, #0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r1, #0 - str r1, [sp] - ldr r0, _02083F98 ; =0x000E0F01 - str r1, [sp, #4] - str r0, [sp, #8] - add r0, r5, #0 - add r2, r7, #0 - add r3, r4, #0 - str r1, [sp, #0xc] - bl AddTextPrinterParameterizedWithColor - add r0, r5, #0 - bl CopyWindowToVram - add sp, #0x10 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02083F98: .word 0x000E0F01 - thumb_func_end sub_02083F48 - - thumb_func_start sub_02083F9C -sub_02083F9C: ; 0x02083F9C - push {r4, r5, r6, r7, lr} - sub sp, #0x14 - add r6, r1, #0 - mov r1, #1 - add r5, r0, #0 - str r1, [sp] - mov r0, #0x1a - str r0, [sp, #4] - mov r0, #0xc - str r0, [sp, #8] - str r1, [sp, #0xc] - add r0, #0xf4 - str r0, [sp, #0x10] - mov r0, #0x16 - lsl r0, r0, #4 - mov r1, #0xee - lsl r1, r1, #2 - add r4, r2, #0 - ldr r0, [r5, r0] - add r1, r5, r1 - mov r2, #0 - mov r3, #2 - bl AddWindowParameterized - mov r2, #1 - mov r1, #0xf2 - lsl r1, r1, #2 - str r2, [sp] - mov r0, #0x1a - str r0, [sp, #4] - mov r0, #0xc - str r0, [sp, #8] - mov r0, #0x8e - str r2, [sp, #0xc] - lsl r0, r0, #2 - str r0, [sp, #0x10] - sub r0, #0xd8 - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #2 - bl AddWindowParameterized - ldr r0, [r5] - cmp r0, #4 - bne _02084040 - mov r0, #0 - str r0, [sp] - mov r0, #0xe - lsl r0, r0, #6 - str r0, [sp, #4] - mov r3, #1 - mov r2, #0x16 - str r3, [sp, #8] - mov r0, #0x12 - str r0, [sp, #0xc] - lsl r2, r2, #4 - ldr r2, [r5, r2] - add r0, r4, #0 - mov r1, #9 - bl GfGfxLoader_LoadScrnDataFromOpenNarc - mov r0, #0x46 - mov r1, #4 - lsl r0, r0, #4 - str r1, [r5, r0] - add r0, r5, #0 - add r0, #0x3a - bl sub_02084830 - mov r0, #0x4b - lsl r0, r0, #4 - ldr r1, [r5, r0] - sub r0, #0xe8 - ldr r1, [r1, #0x14] - ldr r3, _02084200 ; =0x000E0F00 - str r1, [sp] - ldr r1, _02084204 ; =0x00000A0A - add r0, r5, r0 - mov r2, #4 - bl sub_02084E54 - b _0208406A -_02084040: - mov r0, #0x46 - mov r1, #0 - lsl r0, r0, #4 - str r1, [r5, r0] - add r0, r5, #0 - add r0, #0x3a - bl sub_02084830 - mov r1, #0x4b - lsl r1, r1, #4 - ldr r0, [r5, r1] - ldr r3, _02084200 ; =0x000E0F00 - ldr r0, [r0, #0x14] - mov r2, #0 - str r0, [sp] - add r0, r1, #0 - sub r0, #0xe8 - add r0, r5, r0 - sub r1, #0xac - bl sub_02084E54 -_0208406A: - mov r2, #2 - str r2, [sp] - mov r3, #0x16 - str r3, [sp, #4] - mov r1, #0x37 - str r2, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - lsl r1, r1, #4 - str r1, [sp, #0x10] - lsl r0, r3, #4 - add r1, #0x68 - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #7 - bl AddWindowParameterized - ldr r1, [r5, #0xc] - mov r0, #0xc - add r2, r1, #0 - mul r2, r0 - asr r0, r2, #2 - lsr r0, r0, #0x1d - add r0, r2, r0 - asr r0, r0, #3 - add r4, r0, #1 - mov r0, #3 - str r0, [sp] - lsl r0, r4, #0x18 - lsr r0, r0, #0x18 - str r0, [sp, #4] - mov r2, #2 - mov r1, #0xe7 - str r2, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - lsl r1, r1, #2 - mov r0, #0x16 - str r1, [sp, #0x10] - lsl r0, r0, #4 - add r1, #0x4c - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #0xa - bl AddWindowParameterized - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r5, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #3 - str r0, [sp] - mov r0, #7 - str r0, [sp, #4] - mov r2, #2 - mov r1, #0xf - add r4, #9 - lsl r3, r4, #0x18 - str r2, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - lsl r1, r1, #6 - mov r0, #0x16 - str r1, [sp, #0x10] - lsl r0, r0, #4 - add r1, #0x78 - ldr r0, [r5, r0] - add r1, r5, r1 - lsr r3, r3, #0x18 - bl AddWindowParameterized - ldr r0, _02084208 ; =0x00000438 - mov r1, #1 - add r0, r5, r0 - bl FillWindowPixelBuffer - ldr r1, [r5] - cmp r1, #5 - bne _02084122 - mov r2, #0x61 - ldr r0, _02084208 ; =0x00000438 - lsl r2, r2, #2 - ldr r2, [r5, r2] - add r0, r5, r0 - bl sub_02083F48 - ldr r0, _02084208 ; =0x00000438 - add r0, r5, r0 - bl CopyWindowToVram -_02084122: - mov r0, #0x13 - str r0, [sp] - mov r0, #0x1b - str r0, [sp, #4] - mov r2, #4 - ldr r1, _0208420C ; =0x00000448 - str r2, [sp, #8] - mov r0, #0xc - str r0, [sp, #0xc] - mov r0, #0x84 - str r0, [sp, #0x10] - add r0, #0xdc - ldr r0, [r5, r0] - add r1, r5, r1 - mov r3, #2 - bl AddWindowParameterized - ldr r0, _0208420C ; =0x00000448 - mov r1, #0xf - add r0, r5, r0 - bl FillWindowPixelBuffer - mov r2, #0x5e - ldr r0, _0208420C ; =0x00000448 - lsl r2, r2, #2 - ldr r1, [r5] - ldr r2, [r5, r2] - add r0, r5, r0 - bl sub_02083F18 - add r0, r6, #0 - bl OverlayManager_GetArgs - mov r1, #0x46 - lsl r1, r1, #2 - ldrh r2, [r5, r1] - ldr r0, _02084210 ; =0x0000FFFF - cmp r2, r0 - beq _02084198 - add r0, r5, #0 - add r0, #0xd8 - add r1, r5, r1 - bl CopyU16StringArray - mov r0, #0xc - str r0, [sp] - mov r2, #0 - add r1, r5, #0 - ldr r0, _02084214 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r5, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 -_02084198: - mov r0, #0xee - lsl r0, r0, #2 - mov r4, #0 - add r7, r5, r0 -_020841A0: - add r0, r4, #4 - lsl r6, r0, #4 - mov r0, #0 - str r0, [sp] - mov r0, #2 - str r0, [sp, #4] - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - mov r0, #0x78 - str r0, [sp, #0x10] - add r0, #0xe8 - ldr r0, [r5, r0] - add r1, r7, r6 - mov r2, #2 - mov r3, #0 - bl AddWindowParameterized - add r0, r7, r6 - mov r1, #0 - bl FillWindowPixelBuffer - add r4, r4, #1 - cmp r4, #3 - blt _020841A0 - mov r3, #0 - str r3, [sp] - mov r0, #0x10 - str r0, [sp, #4] - mov r2, #2 - str r2, [sp, #8] - ldr r1, _02084218 ; =0x00000428 - str r3, [sp, #0xc] - mov r0, #0x84 - str r0, [sp, #0x10] - add r0, #0xdc - ldr r0, [r5, r0] - add r1, r5, r1 - bl AddWindowParameterized - ldr r0, _02084218 ; =0x00000428 - mov r1, #0 - add r0, r5, r0 - bl FillWindowPixelBuffer - add sp, #0x14 - pop {r4, r5, r6, r7, pc} - nop -_02084200: .word 0x000E0F00 -_02084204: .word 0x00000A0A -_02084208: .word 0x00000438 -_0208420C: .word 0x00000448 -_02084210: .word 0x0000FFFF -_02084214: .word 0x000E0F01 -_02084218: .word 0x00000428 - thumb_func_end sub_02083F9C - - thumb_func_start sub_0208421C -sub_0208421C: ; 0x0208421C - push {r4, lr} - add r4, r1, #0 - lsl r0, r4, #0x18 - lsr r0, r0, #0x18 - mov r1, #1 - bl SetBgPriority - mov r0, #1 - eor r0, r4 - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - mov r1, #2 - bl SetBgPriority - pop {r4, pc} - .balign 4, 0 - thumb_func_end sub_0208421C - - thumb_func_start sub_0208423C -sub_0208423C: ; 0x0208423C - push {r3, r4} - mov r3, #0xc - add r4, r1, #0 - mul r4, r3 - mov r2, #0xee - str r2, [r0, r4] - add r2, r3, #0 - sub r2, #0x5c - add r4, r0, r4 - str r2, [r4, #4] - mov r4, #1 - eor r1, r4 - mul r3, r1 - sub r4, #0xc - str r4, [r0, r3] - add r0, r0, r3 - str r2, [r0, #4] - pop {r3, r4} - bx lr - .balign 4, 0 - thumb_func_end sub_0208423C - - thumb_func_start sub_02084264 -sub_02084264: ; 0x02084264 - cmp r0, r2 - blt _0208426A - add r0, r1, #0 -_0208426A: - cmp r0, r1 - bge _02084270 - sub r0, r2, #1 -_02084270: - bx lr - .balign 4, 0 - thumb_func_end sub_02084264 - - thumb_func_start sub_02084274 -sub_02084274: ; 0x02084274 - push {r3, r4, r5, r6, r7, lr} - add r5, r0, #0 - cmp r1, #0 - beq _02084318 - ldr r3, [r5, #0x20] - mov r2, #0x1a - mul r2, r3 - ldr r0, [r5, #0x1c] - add r3, r5, r2 - lsl r2, r0, #1 - add r2, r3, r2 - ldrh r2, [r2, #0x3a] - lsl r6, r1, #3 - ldr r1, _0208431C ; =_02102168 - str r2, [sp] - ldr r1, [r1, r6] - mov r2, #0xd - add r0, r0, r1 - mov r1, #0 - bl sub_02084264 - add r4, r0, #0 - ldr r0, _02084320 ; =_02102168 + 4 - ldr r1, [r5, #0x20] - ldr r0, [r0, r6] - mov r2, #6 - add r0, r1, r0 - mov r1, #0 - bl sub_02084264 - add r7, r0, #0 - ldr r0, _0208431C ; =_02102168 - add r6, r0, r6 - b _020842F6 -_020842B8: - ldr r1, [r5, #0x28] - cmp r1, #0 - bne _020842DA - ldr r1, _02084324 ; =0x0000D004 - cmp r0, r1 - bne _020842DA - ldr r0, [r6, #4] - cmp r0, #0 - beq _020842DA - ldr r0, [r5, #0x2c] - mov r1, #0 - add r0, r4, r0 - mov r2, #0xd - bl sub_02084264 - add r4, r0, #0 - b _020842F6 -_020842DA: - ldr r0, [r6] - mov r1, #0 - add r0, r4, r0 - mov r2, #0xd - bl sub_02084264 - add r4, r0, #0 - ldr r0, [r6, #4] - mov r1, #0 - add r0, r7, r0 - mov r2, #6 - bl sub_02084264 - add r7, r0, #0 -_020842F6: - mov r0, #0x1a - mul r0, r7 - lsl r1, r4, #1 - add r0, r5, r0 - add r0, r1, r0 - ldrh r0, [r0, #0x3a] - ldr r1, _02084324 ; =0x0000D004 - cmp r0, r1 - beq _020842B8 - ldr r1, [sp] - cmp r1, r0 - bne _02084314 - ldr r1, _02084328 ; =0x0000E001 - cmp r0, r1 - bhi _020842B8 -_02084314: - str r4, [r5, #0x1c] - str r7, [r5, #0x20] -_02084318: - pop {r3, r4, r5, r6, r7, pc} - nop -_0208431C: .word _02102168 -_02084320: .word _02102168 + 4 -_02084324: .word 0x0000D004 -_02084328: .word 0x0000E001 - thumb_func_end sub_02084274 - - thumb_func_start sub_0208432C -sub_0208432C: ; 0x0208432C - push {r3, r4, r5, r6, r7, lr} - add r5, r0, #0 - mov r0, #0xd3 - lsl r0, r0, #2 - mov r4, #0 - ldr r0, [r5, r0] - add r6, r4, #0 - add r7, r4, #0 - bl Sprite_GetVisibleFlag - cmp r0, #0 - bne _02084346 - mov r7, #1 -_02084346: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x40 - tst r0, r1 - beq _02084366 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #1 - add r4, r4, #1 -_02084366: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x80 - tst r0, r1 - beq _02084386 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #2 - add r4, r4, #1 -_02084386: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x20 - tst r0, r1 - beq _020843A6 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #3 - add r4, r4, #1 -_020843A6: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x4c] - mov r0, #0x10 - tst r0, r1 - beq _020843C6 - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r6, #4 - add r4, r4, #1 -_020843C6: - ldr r0, _02084424 ; =gSystem - ldr r1, [r0, #0x48] - mov r0, #8 - tst r0, r1 - beq _020843EC - ldr r0, _02084428 ; =0x000005DC - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r0, #0xc - str r0, [r5, #0x1c] - mov r0, #0 - str r0, [r5, #0x20] - add r4, r4, #1 -_020843EC: - add r0, r5, #0 - bl sub_0208503C - ldr r1, _0208442C ; =0x000005C8 - str r0, [r5, r1] - ldr r0, [r5, r1] - cmp r0, #1 - bne _02084400 - mov r6, #0 - add r4, r4, #1 -_02084400: - cmp r7, #1 - bne _0208440E - add r0, r5, #0 - add r1, r6, #0 - mov r4, #0 - bl sub_02084430 -_0208440E: - cmp r4, #0 - beq _02084422 - add r0, r5, #0 - add r1, r6, #0 - bl sub_02084274 - add r0, r5, #0 - add r1, r6, #0 - bl sub_02084430 -_02084422: - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084424: .word gSystem -_02084428: .word 0x000005DC -_0208442C: .word 0x000005C8 - thumb_func_end sub_0208432C - - thumb_func_start sub_02084430 -sub_02084430: ; 0x02084430 - push {r3, r4, r5, lr} - sub sp, #0x18 - add r5, r0, #0 - add r4, r1, #0 - ldr r1, [r5, #0x20] - cmp r1, #0 - beq _0208448A - ldr r0, [r5, #0x28] - cmp r0, #0 - bne _02084454 - cmp r0, r1 - beq _02084454 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq -_02084454: - cmp r4, #0 - beq _02084464 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq -_02084464: - ldr r0, [r5, #0x1c] - lsl r0, r0, #4 - add r0, #0x1a - lsl r0, r0, #0xc - str r0, [sp, #0xc] - ldr r0, [r5, #0x20] - sub r1, r0, #1 - mov r0, #0x13 - mul r0, r1 - add r0, #0x5b - lsl r0, r0, #0xc - str r0, [sp, #0x10] - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r1, sp, #0xc - bl Sprite_SetMatrix - b _020844C6 -_0208448A: - mov r0, #0x1a - mul r0, r1 - add r1, r5, r0 - ldr r0, [r5, #0x1c] - lsl r0, r0, #1 - add r0, r1, r0 - ldrh r1, [r0, #0x3a] - ldr r0, _020844F0 ; =0x0000E002 - sub r1, r1, r0 - ldr r0, _020844F4 ; =_02101D80 - lsl r2, r1, #1 - ldrh r0, [r0, r2] - ldr r2, _020844F8 ; =_02101D4C - lsl r0, r0, #0xc - str r0, [sp] - mov r0, #0x11 - lsl r0, r0, #0xe - str r0, [sp, #4] - mov r0, #0xd3 - lsl r0, r0, #2 - ldrb r1, [r2, r1] - ldr r0, [r5, r0] - bl Sprite_SetAnimCtrlSeq - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - add r1, sp, #0 - bl Sprite_SetMatrix -_020844C6: - mov r0, #0xb4 - strh r0, [r5, #0x38] - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r5, r0] - mov r1, #0 - bl Sprite_SetAnimCtrlCurrentFrame - ldr r0, [r5, #0x1c] - lsl r1, r4, #3 - str r0, [r5, #0x24] - ldr r0, [r5, #0x20] - str r0, [r5, #0x28] - ldr r0, _020844FC ; =_02102168 - ldr r0, [r0, r1] - cmp r0, #0 - beq _020844EA - str r0, [r5, #0x2c] -_020844EA: - add sp, #0x18 - pop {r3, r4, r5, pc} - nop -_020844F0: .word 0x0000E002 -_020844F4: .word _02101D80 -_020844F8: .word _02101D4C -_020844FC: .word _02102168 - thumb_func_end sub_02084430 - - thumb_func_start sub_02084500 -sub_02084500: ; 0x02084500 - push {r3, lr} - ldrh r1, [r0] - add r1, #0x14 - strh r1, [r0] - ldrh r2, [r0] - mov r1, #0x5a - lsl r1, r1, #2 - cmp r2, r1 - bls _02084516 - mov r1, #0 - strh r1, [r0] -_02084516: - ldrh r0, [r0] - bl GF_SinDeg - mov r1, #0xa - mul r1, r0 - asr r0, r1, #0xb - lsr r0, r0, #0x14 - add r0, r1, r0 - asr r0, r0, #0xc - add r0, #0xf - lsl r1, r0, #5 - mov r0, #0x1d - orr r1, r0 - add r0, sp, #0 - strh r1, [r0] - add r0, sp, #0 - mov r1, #0x3a - mov r2, #2 - bl GX_LoadOBJPltt - pop {r3, pc} - thumb_func_end sub_02084500 - - thumb_func_start sub_02084540 -sub_02084540: ; 0x02084540 - push {r4, r5, r6, r7, lr} - sub sp, #0x3c - str r0, [sp, #0x18] - add r7, r1, #0 - mov r0, #2 - mov r1, #0x12 - str r2, [sp, #0x1c] - str r3, [sp, #0x20] - mov r4, #0 - bl String_New - str r0, [sp, #0x28] - ldrh r1, [r7] - ldr r0, _02084630 ; =0x0000FFFF - cmp r1, r0 - beq _02084626 - ldr r0, [sp, #0x54] - ldr r6, [sp, #0x50] - str r0, [sp, #0x24] - ldr r0, [sp, #0x58] - str r0, [sp, #0x34] - ldr r0, [sp, #0x20] - add r0, r0, #2 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - str r0, [sp, #0x2c] - ldr r0, [sp, #0x5c] - str r0, [sp, #0x30] -_02084578: - lsl r0, r4, #1 - ldrh r1, [r7, r0] - ldr r0, _02084634 ; =0x00002FFF - add r0, r1, r0 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - cmp r0, #2 - bhi _020845C4 - mov r0, #0xc - str r0, [sp] - str r0, [sp, #4] - add r2, r4, #0 - ldr r0, [sp, #0x1c] - mul r2, r6 - add r0, r0, r2 - ldr r2, _02084638 ; =0x0000D001 - lsl r0, r0, #0x10 - sub r1, r1, r2 - lsl r1, r1, #0x10 - lsr r0, r0, #0x10 - lsr r2, r1, #8 - str r0, [sp, #8] - ldr r0, [sp, #0x2c] - lsr r1, r2, #0x1f - add r1, r2, r1 - str r0, [sp, #0xc] - mov r0, #0xc - asr r2, r1, #1 - ldr r1, [sp, #0x30] - str r0, [sp, #0x10] - str r0, [sp, #0x14] - add r1, r1, r2 - mov r2, #0 - ldr r0, [sp, #0x18] - add r3, r2, #0 - bl BlitBitmapRectToWindow - b _0208461A -_020845C4: - ldr r0, _0208463C ; =0x0000D004 - cmp r1, r0 - bne _020845CE - add r4, r4, #1 - b _0208461C -_020845CE: - add r0, sp, #0x38 - strh r1, [r0] - ldr r1, _02084630 ; =0x0000FFFF - strh r1, [r0, #2] - mov r0, #0 - add r1, sp, #0x38 - add r2, r0, #0 - bl FontID_FlatArray_GetWidth - add r5, r0, #0 - ldr r0, [sp, #0x28] - add r1, sp, #0x38 - bl CopyU16ArrayToString - ldr r0, [sp, #0x20] - sub r3, r6, r5 - str r0, [sp] - ldr r0, [sp, #0x24] - lsr r5, r3, #0x1f - add r5, r3, r5 - asr r3, r5, #1 - str r0, [sp, #4] - ldr r0, [sp, #0x34] - mov ip, r3 - add r5, r4, #0 - str r0, [sp, #8] - mov r0, #0 - str r0, [sp, #0xc] - ldr r3, [sp, #0x1c] - mul r5, r6 - add r3, r3, r5 - mov r5, ip - ldr r0, [sp, #0x18] - ldr r2, [sp, #0x28] - mov r1, #0 - add r3, r5, r3 - bl AddTextPrinterParameterizedWithColor -_0208461A: - add r4, r4, #1 -_0208461C: - lsl r0, r4, #1 - ldrh r1, [r7, r0] - ldr r0, _02084630 ; =0x0000FFFF - cmp r1, r0 - bne _02084578 -_02084626: - ldr r0, [sp, #0x28] - bl String_Delete - add sp, #0x3c - pop {r4, r5, r6, r7, pc} - .balign 4, 0 -_02084630: .word 0x0000FFFF -_02084634: .word 0x00002FFF -_02084638: .word 0x0000D001 -_0208463C: .word 0x0000D004 - thumb_func_end sub_02084540 - - thumb_func_start sub_02084640 -sub_02084640: ; 0x02084640 - push {r4, r5, r6, lr} - sub sp, #0x10 - mov r5, #0 - add r6, r1, #0 - str r5, [sp] - mov r1, #0xff - str r1, [sp, #4] - str r3, [sp, #8] - add r1, r2, #0 - add r2, r6, #0 - add r3, r5, #0 - add r4, r0, #0 - str r5, [sp, #0xc] - bl AddTextPrinterParameterizedWithColor - ldr r0, [r4, #0xc] - add sp, #0x10 - pop {r4, r5, r6, pc} - thumb_func_end sub_02084640 - - thumb_func_start sub_02084664 -sub_02084664: ; 0x02084664 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x38 - add r6, r0, #0 - str r1, [sp, #8] - add r0, #0x30 - mov r1, #0 - add r5, r2, #0 - add r4, r3, #0 - bl FillWindowPixelBuffer - add r0, r6, #0 - ldr r3, _02084730 ; =0x000D0E0F - add r0, #0x30 - add r1, r4, #0 - mov r2, #2 - bl sub_02084640 - mov r1, #2 - lsl r1, r1, #0xa - bl DC_FlushRange - add r7, r6, #0 - mov r4, #0 - add r7, #0x30 -_02084694: - mov r0, #0 - str r0, [sp] - add r0, r7, #0 - mov r1, #4 - mov r2, #2 - lsl r3, r4, #2 - str r5, [sp, #4] - bl sub_02013A50 - mov r1, #1 - add r0, r5, #0 - lsl r1, r1, #8 - bl DC_FlushRange - ldr r1, _02084734 ; =_02101D3C - mov r2, #1 - ldrb r1, [r1, r4] - add r0, r5, #0 - lsl r2, r2, #8 - lsl r1, r1, #5 - bl GXS_LoadOBJ - add r0, r4, #1 - lsl r0, r0, #0x10 - lsr r4, r0, #0x10 - cmp r4, #4 - blo _02084694 - mov r0, #0x15 - mov r1, #0x12 - bl String_New - add r4, r0, #0 - mov r5, #0 -_020846D6: - ldr r0, [sp, #8] - lsl r1, r5, #1 - ldrh r1, [r0, r1] - add r0, sp, #0xc - lsl r7, r5, #4 - strh r1, [r0] - ldr r1, _02084738 ; =0x0000FFFF - strh r1, [r0, #2] - add r0, r6, r7 - mov r1, #0 - bl FillWindowPixelBuffer - add r0, r4, #0 - add r1, sp, #0xc - bl CopyU16ArrayToString - ldr r3, _02084730 ; =0x000D0E0F - add r0, r6, r7 - add r1, r4, #0 - mov r2, #2 - bl sub_02084640 - mov r1, #0x80 - add r7, r0, #0 - bl DC_FlushRange - ldr r1, _0208473C ; =_02101D54 - lsl r2, r5, #2 - ldr r1, [r1, r2] - add r0, r7, #0 - lsl r1, r1, #5 - mov r2, #0x80 - bl GXS_LoadOBJ - add r0, r5, #1 - lsl r0, r0, #0x10 - lsr r5, r0, #0x10 - cmp r5, #3 - blo _020846D6 - add r0, r4, #0 - bl String_Delete - add sp, #0x38 - pop {r3, r4, r5, r6, r7, pc} - nop -_02084730: .word 0x000D0E0F -_02084734: .word _02101D3C -_02084738: .word 0x0000FFFF -_0208473C: .word _02101D54 - thumb_func_end sub_02084664 - - thumb_func_start sub_02084740 -sub_02084740: ; 0x02084740 - push {r3, r4, r5, lr} - cmp r2, #0 - bne _0208474A - ldr r1, _0208481C ; =0x0000D003 - b _02084750 -_0208474A: - sub r2, r2, #1 - lsl r2, r2, #1 - ldrh r1, [r1, r2] -_02084750: - ldr r4, _02084820 ; =0x0000E003 - cmp r1, r4 - bgt _02084780 - bge _020847A6 - ldr r2, _02084824 ; =0x0000D004 - cmp r1, r2 - bgt _02084778 - sub r2, r2, #3 - sub r2, r1, r2 - bmi _020847A8 - add r2, r2, r2 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_02084770: ; jump table - .short _020847A6 - _02084770 - 2 ; case 0 - .short _020847A6 - _02084770 - 2 ; case 1 - .short _020847A6 - _02084770 - 2 ; case 2 - .short _020847A6 - _02084770 - 2 ; case 3 -_02084778: - ldr r2, _02084828 ; =0x0000E002 - cmp r1, r2 - beq _020847A6 - b _020847A8 -_02084780: - add r2, r4, #1 - cmp r1, r2 - bgt _0208478A - beq _020847A6 - b _020847A8 -_0208478A: - add r2, r4, #2 - sub r2, r1, r2 - cmp r2, #3 - bhi _020847A8 - add r2, r2, r2 - add r2, pc - ldrh r2, [r2, #6] - lsl r2, r2, #0x10 - asr r2, r2, #0x10 - add pc, r2 -_0208479E: ; jump table - .short _020847A6 - _0208479E - 2 ; case 0 - .short _020847A6 - _0208479E - 2 ; case 1 - .short _020847A6 - _0208479E - 2 ; case 2 - .short _020847A6 - _0208479E - 2 ; case 3 -_020847A6: - mov r1, #1 -_020847A8: - mov r4, #0 - add r5, r3, #0 - mov r2, #1 -_020847AE: - add r4, r4, #1 - strh r2, [r5] - add r5, r5, #2 - cmp r4, #3 - blt _020847AE - strh r1, [r3] - cmp r1, #1 - beq _0208480E - ldr r5, _0208482C ; =_02102422 - mov r2, #0 -_020847C2: - ldrh r4, [r5] - cmp r1, r4 - bne _020847E4 - mov r4, #6 - ldr r5, _0208482C ; =_02102422 - mul r4, r2 - add r4, r5, r4 - mov r1, #0 - add r5, r3, #0 -_020847D4: - ldrh r2, [r4] - add r1, r1, #1 - add r4, r4, #2 - strh r2, [r5] - add r5, r5, #2 - cmp r1, #3 - blt _020847D4 - b _0208480E -_020847E4: - ldrh r4, [r5, #4] - cmp r1, r4 - bne _02084806 - mov r4, #6 - ldr r5, _0208482C ; =_02102422 - mul r4, r2 - add r4, r5, r4 - mov r1, #0 - add r5, r3, #0 -_020847F6: - ldrh r2, [r4] - add r1, r1, #1 - add r4, r4, #2 - strh r2, [r5] - add r5, r5, #2 - cmp r1, #3 - blt _020847F6 - b _0208480E -_02084806: - add r2, r2, #1 - add r5, r5, #6 - cmp r2, #0x52 - blo _020847C2 -_0208480E: - add r1, r3, #0 - ldr r2, [sp, #0x10] - ldr r3, [sp, #0x14] - bl sub_02084664 - pop {r3, r4, r5, pc} - nop -_0208481C: .word 0x0000D003 -_02084820: .word 0x0000E003 -_02084824: .word 0x0000D004 -_02084828: .word 0x0000E002 -_0208482C: .word _02102422 - thumb_func_end sub_02084740 - - thumb_func_start sub_02084830 -sub_02084830: ; 0x02084830 - push {r4, r5, r6, r7} - mov r4, #0 - ldr r3, _0208487C ; =_021104E4 - add r5, r4, #0 - add r6, r0, #0 - lsl r2, r1, #2 -_0208483C: - ldr r7, [r3, r2] - add r4, r4, #1 - ldrh r7, [r7, r5] - add r5, r5, #2 - strh r7, [r6] - add r6, r6, #2 - cmp r4, #0xd - blt _0208483C - mov r3, #0x14 - ldr r4, _02084880 ; =_021104F8 - mul r3, r1 - mov r2, #0 - add r3, r4, r3 - add r1, r2, #0 -_02084858: - add r6, r1, #0 - add r4, r1, #0 - add r5, r0, #0 -_0208485E: - ldr r7, [r3] - add r6, r6, #1 - ldrh r7, [r7, r4] - add r4, r4, #2 - strh r7, [r5, #0x1a] - add r5, r5, #2 - cmp r6, #0xd - blt _0208485E - add r2, r2, #1 - add r3, r3, #4 - add r0, #0x1a - cmp r2, #5 - blt _02084858 - pop {r4, r5, r6, r7} - bx lr - .balign 4, 0 -_0208487C: .word _021104E4 -_02084880: .word _021104F8 - thumb_func_end sub_02084830 - - thumb_func_start sub_02084884 -sub_02084884: ; 0x02084884 - push {r4, r5, r6, lr} - sub sp, #0x10 - add r4, r0, #0 - ldr r0, _02084BBC ; =0x00002FFD - add r5, r1, #0 - add r0, r5, r0 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - add r6, r2, #0 - cmp r0, #1 - bhi _0208489C - mov r5, #1 -_0208489C: - ldr r0, [r4] - cmp r0, #4 - bne _020848B0 - ldr r0, _02084BC0 ; =0x00001FFE - add r0, r5, r0 - lsl r0, r0, #0x10 - lsr r0, r0, #0x10 - cmp r0, #3 - bhi _020848B0 - mov r5, #1 -_020848B0: - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl Sprite_GetVisibleFlag - cmp r0, #0 - bne _020848D8 - ldr r0, _02084BC4 ; =gSystem + 0x40 - ldrh r0, [r0, #0x24] - cmp r0, #0 - bne _020848D8 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - add sp, #0x10 - mov r0, #2 - pop {r4, r5, r6, pc} -_020848D8: - ldr r0, _02084BC8 ; =0x0000E002 - cmp r5, r0 - bgt _020848F6 - blt _020848E2 - b _02084A0A -_020848E2: - ldr r3, _02084BCC ; =0x0000D002 - cmp r5, r3 - bgt _020848F4 - sub r0, r3, #1 - cmp r5, r0 - blt _020848F4 - beq _02084918 - cmp r5, r3 - beq _0208496A -_020848F4: - b _02084B2E -_020848F6: - add r0, r0, #1 - sub r0, r5, r0 - cmp r0, #5 - bls _02084900 - b _02084B2E -_02084900: - add r0, r0, r0 - add r0, pc - ldrh r0, [r0, #6] - lsl r0, r0, #0x10 - asr r0, r0, #0x10 - add pc, r0 -_0208490C: ; jump table - .short _02084A0A - _0208490C - 2 ; case 0 - .short _02084A0A - _0208490C - 2 ; case 1 - .short _02084A0A - _0208490C - 2 ; case 2 - .short _020849B8 - _0208490C - 2 ; case 3 - .short _02084A40 - _0208490C - 2 ; case 4 - .short _02084AE4 - _0208490C - 2 ; case 5 -_02084918: - add r0, r4, #0 - add r0, #0xd8 - str r0, [sp] - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - ldr r3, _02084BD0 ; =0x0000D001 - mov r1, #0x52 - str r0, [sp, #4] - mov r0, #0x2a - mov r2, #1 - bl sub_02084D04 - cmp r0, #0 - bne _02084938 - b _02084C4E -_02084938: - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r4, #0xd8 - add r1, r4, #0 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - b _02084C4E -_0208496A: - add r0, r4, #0 - add r0, #0xd8 - str r0, [sp] - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - mov r1, #0x52 - mov r2, #2 - str r0, [sp, #4] - mov r0, #0x48 - bl sub_02084D04 - cmp r0, #0 - beq _02084A4A - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r4, #0xd8 - add r1, r4, #0 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - b _02084C4E -_020849B8: - mov r3, #0x56 - lsl r3, r3, #2 - ldrh r3, [r4, r3] - add r2, r4, #0 - mov r0, #0 - mov r1, #0x52 - add r2, #0xd8 - bl sub_02084C98 - cmp r0, #0 - beq _02084A4A - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - add r1, r4, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - mov r0, #0x4a - lsl r0, r0, #4 - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - b _02084C4E -_02084A0A: - mov r1, #0x46 - lsl r1, r1, #4 - ldr r0, _02084BC8 ; =0x0000E002 - ldr r2, [r4, r1] - sub r5, r5, r0 - cmp r2, r5 - beq _02084A4A - mov r2, #0 - sub r0, r1, #4 - str r2, [r4, r0] - str r5, [r4, r1] - add r0, r4, #0 - ldr r1, [r4, r1] - add r0, #0x3a - bl sub_02084830 - mov r0, #0x49 - lsl r0, r0, #4 - add r2, r4, r0 - lsl r1, r5, #2 - ldr r0, [r2, r1] - add r0, r0, #1 - str r0, [r2, r1] - ldr r0, _02084BDC ; =0x0000069D - bl PlaySE - b _02084C4E -_02084A40: - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r0, [r4, r1] - cmp r0, #0 - bne _02084A4C -_02084A4A: - b _02084C4E -_02084A4C: - sub r0, r0, #1 - lsl r0, r0, #1 - add r0, r4, r0 - ldr r2, _02084BE0 ; =0x0000FFFF - add r0, #0xd8 - strh r2, [r0] - ldrh r0, [r4, r1] - sub r0, r0, #1 - strh r0, [r4, r1] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r0, [r4, r0] - cmp r0, #0 - bne _02084A80 - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - bl CopyWindowToVram - b _02084A9E -_02084A80: - mov r0, #0xc - str r0, [sp] - mov r2, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r1, r4, #0 - add r0, r4, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 -_02084A9E: - ldr r0, _02084BE4 ; =0x000004C4 - mov r3, #0x5f - add r1, r4, r0 - lsl r3, r3, #2 - str r1, [sp] - ldr r1, [r4, r3] - add r2, r3, #0 - str r1, [sp, #4] - sub r2, #0x24 - sub r0, #0xcc - add r1, r4, #0 - sub r3, #0x22 - ldrh r2, [r4, r2] - add r0, r4, r0 - add r1, #0xd8 - add r3, r4, r3 - bl sub_02084740 - mov r1, #0x56 - lsl r1, r1, #2 - mov r0, #0xd9 - lsl r0, r0, #2 - ldrh r1, [r4, r1] - ldr r2, [r4, #0xc] - add r0, r4, r0 - bl sub_02084E18 - ldr r0, _02084BE8 ; =0x000004A4 - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - ldr r0, _02084BEC ; =0x000005DC - bl PlaySE - b _02084C4E -_02084AE4: - ldr r0, _02084BF0 ; =0x000005C4 - ldr r0, [r4, r0] - bl sub_020164C4 - ldr r0, [r4, #0x14] - cmp r0, #0 - bne _02084B26 - ldr r0, _02084BF4 ; =0x000005E2 - bl PlaySE - ldr r0, _02084BF8 ; =0x000004A8 - ldr r1, [r4, r0] - add r1, r1, #1 - str r1, [r4, r0] - mov r1, #0 - mov r0, #0x10 - str r0, [sp] - mov r0, #1 - str r0, [sp, #4] - mov r0, #0x12 - str r0, [sp, #8] - mov r0, #2 - add r2, r1, #0 - add r3, r1, #0 - bl BeginNormalPaletteFade - add r0, r4, #0 - add r1, r6, #0 - bl sub_02084C58 - add sp, #0x10 - mov r0, #3 - pop {r4, r5, r6, pc} -_02084B26: - ldr r0, _02084BFC ; =0x0000045C - mov r1, #5 - str r1, [r4, r0] - b _02084C4E -_02084B2E: - mov r0, #0x46 - lsl r0, r0, #4 - ldr r0, [r4, r0] - cmp r0, #4 - bne _02084B42 - cmp r5, #1 - bne _02084B42 - add sp, #0x10 - mov r0, #2 - pop {r4, r5, r6, pc} -_02084B42: - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r1, [r4, r0] - ldr r0, [r4, #0xc] - cmp r1, r0 - beq _02084C4E - lsl r0, r1, #1 - add r0, r4, r0 - add r0, #0xd8 - strh r5, [r0] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - mov r1, #1 - bl FillWindowPixelBuffer - mov r0, #0xc - str r0, [sp] - mov r2, #0 - add r1, r4, #0 - ldr r0, _02084BD4 ; =0x000E0F01 - str r2, [sp, #4] - str r0, [sp, #8] - mov r0, #0xfa - lsl r0, r0, #2 - add r0, r4, r0 - add r1, #0xd8 - add r3, r2, #0 - str r2, [sp, #0xc] - bl sub_02084540 - mov r1, #0x56 - lsl r1, r1, #2 - ldrh r0, [r4, r1] - add r0, r0, #1 - strh r0, [r4, r1] - mov r0, #0xd9 - lsl r0, r0, #2 - ldrh r1, [r4, r1] - ldr r2, [r4, #0xc] - add r0, r4, r0 - bl sub_02084E18 - ldr r0, _02084BD8 ; =0x000005EB - bl PlaySE - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetVisibleFlag - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #1 - bl Sprite_SetOamMode - mov r3, #8 - ldr r0, _02084C00 ; =0x04000050 - b _02084C04 - .balign 4, 0 -_02084BBC: .word 0x00002FFD -_02084BC0: .word 0x00001FFE -_02084BC4: .word gSystem + 0x40 -_02084BC8: .word 0x0000E002 -_02084BCC: .word 0x0000D002 -_02084BD0: .word 0x0000D001 -_02084BD4: .word 0x000E0F01 -_02084BD8: .word 0x000005EB -_02084BDC: .word 0x0000069D -_02084BE0: .word 0x0000FFFF -_02084BE4: .word 0x000004C4 -_02084BE8: .word 0x000004A4 -_02084BEC: .word 0x000005DC -_02084BF0: .word 0x000005C4 -_02084BF4: .word 0x000005E2 -_02084BF8: .word 0x000004A8 -_02084BFC: .word 0x0000045C -_02084C00: .word 0x04000050 -_02084C04: - mov r1, #0 - mov r2, #7 - str r3, [sp] - bl G2x_SetBlendAlpha_ - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x3c - bl Sprite_SetAnimCtrlSeq - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r1, [r4, r0] - ldr r0, [r4, #0xc] - cmp r1, r0 - bne _02084C2A - mov r0, #1 - str r0, [r4, #0x34] -_02084C2A: - ldr r0, _02084C54 ; =0x000004C4 - mov r3, #0x5f - add r1, r4, r0 - lsl r3, r3, #2 - str r1, [sp] - ldr r1, [r4, r3] - add r2, r3, #0 - str r1, [sp, #4] - sub r2, #0x24 - sub r0, #0xcc - add r1, r4, #0 - sub r3, #0x22 - ldrh r2, [r4, r2] - add r0, r4, r0 - add r1, #0xd8 - add r3, r4, r3 - bl sub_02084740 -_02084C4E: - mov r0, #2 - add sp, #0x10 - pop {r4, r5, r6, pc} - .balign 4, 0 -_02084C54: .word 0x000004C4 - thumb_func_end sub_02084884 - - thumb_func_start sub_02084C58 -sub_02084C58: ; 0x02084C58 - push {r3, lr} - mov r2, #0x5d - lsl r2, r2, #4 - ldr r0, [r0, r2] - cmp r0, #0 - beq _02084C76 - cmp r1, #1 - bne _02084C70 - mov r1, #0 - bl sub_02018410 - pop {r3, pc} -_02084C70: - mov r1, #1 - bl sub_02018410 -_02084C76: - pop {r3, pc} - thumb_func_end sub_02084C58 - - thumb_func_start sub_02084C78 -sub_02084C78: ; 0x02084C78 - push {r4, r5, r6, lr} - add r5, r0, #0 - mov r4, #0 - mov r6, #3 -_02084C80: - add r0, r1, #1 - add r1, r4, #0 - add r2, r6, #0 - bl sub_02084264 - add r1, r0, #0 - lsl r0, r1, #1 - ldrh r0, [r5, r0] - cmp r0, #1 - beq _02084C80 - pop {r4, r5, r6, pc} - .balign 4, 0 - thumb_func_end sub_02084C78 - - thumb_func_start sub_02084C98 -sub_02084C98: ; 0x02084C98 - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r4, r0, #0 - add r0, r1, #0 - str r2, [sp] - cmp r3, #0 - bne _02084CAC - add sp, #8 - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} -_02084CAC: - sub r1, r3, #1 - lsl r1, r1, #1 - str r1, [sp, #4] - ldrh r3, [r2, r1] - cmp r4, r0 - bge _02084CFA - mov r1, #6 - ldr r2, _02084D00 ; =_02102422 - mul r1, r4 - add r5, r2, r1 - mov r7, #0 -_02084CC2: - add r2, r7, #0 - add r6, r5, #0 -_02084CC6: - ldrh r1, [r6] - cmp r3, r1 - bne _02084CEA - cmp r3, #1 - beq _02084CEA - mov r0, #6 - ldr r1, _02084D00 ; =_02102422 - mul r0, r4 - add r0, r1, r0 - add r1, r2, #0 - bl sub_02084C78 - ldr r2, [sp] - ldr r1, [sp, #4] - add sp, #8 - strh r0, [r2, r1] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084CEA: - add r2, r2, #1 - add r6, r6, #2 - cmp r2, #3 - blt _02084CC6 - add r4, r4, #1 - add r5, r5, #6 - cmp r4, r0 - blt _02084CC2 -_02084CFA: - mov r0, #0 - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084D00: .word _02102422 - thumb_func_end sub_02084C98 - - thumb_func_start sub_02084D04 -sub_02084D04: ; 0x02084D04 - push {r3, r4, r5, r6, r7, lr} - add r4, r0, #0 - add r0, r1, #0 - ldr r1, [sp, #0x1c] - mov lr, r2 - mov ip, r3 - cmp r1, #0 - beq _02084D20 - sub r1, r1, #1 - ldr r6, [sp, #0x18] - lsl r7, r1, #1 - ldrh r5, [r6, r7] - cmp r5, #1 - bne _02084D24 -_02084D20: - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} -_02084D24: - add r2, r4, #0 - cmp r4, r0 - bge _02084D56 - mov r1, #6 - ldr r3, _02084DFC ; =_02102422 - mul r1, r4 - add r3, r3, r1 -_02084D32: - ldrh r1, [r3] - cmp r5, r1 - bne _02084D4E - add r3, r2, #0 - mov r0, #6 - mul r3, r0 - mov r0, lr - ldr r2, _02084DFC ; =_02102422 - lsl r1, r0, #1 - add r0, r2, r3 - ldrh r0, [r1, r0] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084D4E: - add r2, r2, #1 - add r3, r3, #6 - cmp r2, r0 - blt _02084D32 -_02084D56: - cmp r4, r0 - bge _02084D86 - mov r2, lr - ldr r1, _02084DFC ; =_02102422 - lsl r2, r2, #1 - add r1, r1, r2 - mov r2, #6 - mul r2, r4 - add r2, r1, r2 -_02084D68: - ldrh r1, [r2] - cmp r5, r1 - bne _02084D7E - mov r0, #6 - add r1, r4, #0 - mul r1, r0 - ldr r0, _02084DFC ; =_02102422 - ldrh r0, [r0, r1] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084D7E: - add r4, r4, #1 - add r2, r2, #6 - cmp r4, r0 - blt _02084D68 -_02084D86: - ldr r1, _02084E00 ; =0x0000D001 - mov r0, ip - cmp r0, r1 - beq _02084DA0 - add r1, r1, #1 - mov r0, ip - cmp r0, r1 - beq _02084DC0 - ldr r1, _02084E04 ; =0x0000E006 - mov r0, ip - cmp r0, r1 - beq _02084DE0 - b _02084DF8 -_02084DA0: - ldr r1, _02084E08 ; =_021021B8 - mov r2, #0 -_02084DA4: - ldrh r0, [r1] - cmp r5, r0 - bne _02084DB6 - ldr r0, _02084E0C ; =_021021B8 + 2 - lsl r1, r2, #2 - ldrh r0, [r0, r1] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DB6: - add r2, r2, #1 - add r1, r1, #4 - cmp r2, #0xc - blo _02084DA4 - b _02084DF8 -_02084DC0: - ldr r1, _02084E10 ; =_02102190 - mov r2, #0 -_02084DC4: - ldrh r0, [r1] - cmp r5, r0 - bne _02084DD6 - ldr r0, _02084E14 ; =_02102190 + 2 - lsl r1, r2, #2 - ldrh r0, [r0, r1] - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DD6: - add r2, r2, #1 - add r1, r1, #4 - cmp r2, #0xa - blo _02084DC4 - b _02084DF8 -_02084DE0: - cmp r5, #0x26 - bne _02084DEC - mov r0, #0x24 - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DEC: - cmp r5, #0x76 - bne _02084DF8 - mov r0, #0x74 - strh r0, [r6, r7] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_02084DF8: - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084DFC: .word _02102422 -_02084E00: .word 0x0000D001 -_02084E04: .word 0x0000E006 -_02084E08: .word _021021B8 -_02084E0C: .word _021021B8 + 2 -_02084E10: .word _02102190 -_02084E14: .word _02102190 + 2 - thumb_func_end sub_02084D04 - - thumb_func_start sub_02084E18 -sub_02084E18: ; 0x02084E18 - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r6, r2, #0 - mov r4, #0 - str r0, [sp] - str r1, [sp, #4] - cmp r6, #0 - ble _02084E3C - add r5, r0, #0 - mov r7, #0x2b -_02084E2C: - ldr r0, [r5] - add r1, r7, #0 - bl Sprite_SetAnimCtrlSeq - add r4, r4, #1 - add r5, r5, #4 - cmp r4, r6 - blt _02084E2C -_02084E3C: - ldr r0, [sp, #4] - cmp r0, r6 - beq _02084E4E - lsl r1, r0, #2 - ldr r0, [sp] - ldr r0, [r0, r1] - mov r1, #0x2c - bl Sprite_SetAnimCtrlSeq -_02084E4E: - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 - thumb_func_end sub_02084E18 - - thumb_func_start sub_02084E54 -sub_02084E54: ; 0x02084E54 - push {r3, r4, r5, r6, r7, lr} - sub sp, #0x18 - str r2, [sp, #0x10] - ldr r2, [sp, #0x30] - lsl r1, r1, #0x18 - lsr r1, r1, #0x18 - add r5, r0, #0 - str r3, [sp, #0x14] - str r2, [sp, #0x30] - bl FillWindowPixelBuffer - ldr r1, _02084F34 ; =_02101D44 - ldr r0, [sp, #0x10] - mov r7, #0 - ldrb r4, [r1, r0] - mov r6, #0x10 -_02084E74: - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0 - bl FillWindowPixelRect - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x26 - bl FillWindowPixelRect - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x4c - bl FillWindowPixelRect - add r7, r7, #1 - add r6, #0x20 - cmp r7, #6 - blt _02084E74 - mov r7, #0 - add r6, r7, #0 -_02084EC2: - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x13 - bl FillWindowPixelRect - mov r0, #0x10 - str r0, [sp] - mov r0, #0x13 - lsl r2, r6, #0x10 - str r0, [sp, #4] - add r0, r5, #0 - add r1, r4, #0 - lsr r2, r2, #0x10 - mov r3, #0x39 - bl FillWindowPixelRect - add r7, r7, #1 - add r6, #0x20 - cmp r7, #7 - blt _02084EC2 - ldr r0, [sp, #0x10] - mov r1, #0x14 - ldr r2, _02084F38 ; =_021104F8 - mul r1, r0 - mov r7, #0 - mov r6, #4 - add r4, r2, r1 -_02084F04: - mov r0, #0x10 - str r0, [sp] - mov r0, #0xff - str r0, [sp, #4] - ldr r0, [sp, #0x14] - mov r2, #0 - str r0, [sp, #8] - ldr r0, [sp, #0x30] - add r3, r6, #0 - str r0, [sp, #0xc] - ldr r1, [r4] - add r0, r5, #0 - bl sub_02084540 - add r7, r7, #1 - add r6, #0x13 - add r4, r4, #4 - cmp r7, #5 - blt _02084F04 - add r0, r5, #0 - bl CopyWindowToVram - add sp, #0x18 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084F34: .word _02101D44 -_02084F38: .word _021104F8 - thumb_func_end sub_02084E54 - - thumb_func_start sub_02084F3C -sub_02084F3C: ; 0x02084F3C - push {r3, r4, r5, r6, r7, lr} - sub sp, #8 - add r6, r1, #0 - str r0, [sp] - mov r7, #0 - add r1, r0, #0 -_02084F48: - ldr r0, [r1] - cmp r0, #0 - beq _02084F7E - mov r0, #0 - ldr r4, _02084FC0 ; =_021021E8 - str r0, [sp, #4] - add r5, r6, #0 -_02084F56: - ldr r0, [r5] - ldr r1, [r4, #8] - bl Sprite_SetAnimCtrlSeq - ldr r0, [sp, #4] - add r4, #0x10 - add r0, r0, #1 - add r5, r5, #4 - str r0, [sp, #4] - cmp r0, #3 - blt _02084F56 - ldr r1, _02084FC4 ; =_021021E8 + 8 - lsl r2, r7, #4 - lsl r0, r7, #2 - ldr r1, [r1, r2] - ldr r0, [r6, r0] - sub r1, r1, #3 - bl Sprite_SetAnimCtrlSeq - b _02084F86 -_02084F7E: - add r7, r7, #1 - add r1, r1, #4 - cmp r7, #3 - blt _02084F48 -_02084F86: - ldr r4, [sp] - ldr r5, _02084FC8 ; =_02102238 - mov r7, #5 - add r4, #0x14 - add r6, #0x14 -_02084F90: - ldr r0, [r4] - cmp r0, #0 - beq _02084FA0 - ldr r1, [r5, #8] - ldr r0, [r6] - add r1, r1, #1 - bl Sprite_SetAnimCtrlSeq -_02084FA0: - add r7, r7, #1 - add r4, r4, #4 - add r5, #0x10 - add r6, r6, #4 - cmp r7, #7 - blt _02084F90 - mov r2, #0 - add r1, r2, #0 -_02084FB0: - ldr r0, [sp] - add r2, r2, #1 - stmia r0!, {r1} - str r0, [sp] - cmp r2, #7 - blt _02084FB0 - add sp, #8 - pop {r3, r4, r5, r6, r7, pc} - .balign 4, 0 -_02084FC0: .word _021021E8 -_02084FC4: .word _021021E8 + 8 -_02084FC8: .word _02102238 - thumb_func_end sub_02084F3C - - thumb_func_start sub_02084FCC -sub_02084FCC: ; 0x02084FCC - push {r4, lr} - add r4, r0, #0 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - bl Sprite_IsCellAnimationRunning - cmp r0, #0 - bne _02085038 - mov r0, #0x56 - lsl r0, r0, #2 - ldrh r1, [r4, r0] - ldr r0, [r4, #0xc] - cmp r1, r0 - bne _02085004 - mov r0, #0xc - str r0, [r4, #0x1c] - mov r0, #0 - str r0, [r4, #0x20] - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq - mov r0, #0 - str r0, [r4, #0x34] - b _02085010 -_02085004: - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0x27 - bl Sprite_SetAnimCtrlSeq -_02085010: - ldr r0, [r4, #0x30] - cmp r0, #0 - bne _02085024 - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0 - bl Sprite_SetVisibleFlag - b _0208502C -_02085024: - add r0, r4, #0 - mov r1, #0 - bl sub_02084430 -_0208502C: - mov r0, #0xd3 - lsl r0, r0, #2 - ldr r0, [r4, r0] - mov r1, #0 - bl Sprite_SetOamMode -_02085038: - pop {r4, pc} - .balign 4, 0 - thumb_func_end sub_02084FCC - - thumb_func_start sub_0208503C -sub_0208503C: ; 0x0208503C - push {r3, r4, r5, r6, r7, lr} - str r0, [sp] - mov r0, #0 - mov ip, r0 - ldr r0, [sp] - ldr r0, [r0] - cmp r0, #4 - bne _02085050 - mov r0, #4 - mov ip, r0 -_02085050: - ldr r2, _020850EC ; =gSystem + 0x40 - ldrh r0, [r2, #0x24] - cmp r0, #0 - beq _020850E6 - ldrh r0, [r2, #0x20] - lsl r0, r0, #0x18 - lsr r0, r0, #0x18 - mov lr, r0 - ldrh r0, [r2, #0x22] - lsl r0, r0, #0x18 - lsr r7, r0, #0x18 - mov r0, ip - cmp r0, #0x47 - bhs _020850E6 - mov r0, #6 - mov r2, ip - mul r0, r2 - ldr r2, _020850F0 ; =_02102278 - add r2, r2, r0 - add r3, r2, #0 -_02085078: - ldrh r4, [r3, #2] - ldrb r0, [r2] - ldrb r6, [r2, #1] - lsl r4, r4, #0x1e - lsr r4, r4, #0x1e - beq _0208508E - cmp r4, #1 - beq _02085094 - cmp r4, #2 - beq _0208509A - b _0208509E -_0208508E: - mov r5, #0x1f - mov r1, #0x16 - b _0208509E -_02085094: - mov r5, #0x20 - mov r1, #0x16 - b _0208509E -_0208509A: - mov r5, #0x10 - mov r1, #0x13 -_0208509E: - mov r4, lr - cmp r4, r0 - blo _020850D8 - cmp r7, r6 - blo _020850D8 - add r4, r0, r5 - mov r0, lr - cmp r0, r4 - bgt _020850D8 - add r0, r6, r1 - cmp r7, r0 - bgt _020850D8 - ldr r2, _020850F0 ; =_02102278 - mov r1, #6 - mov r0, ip - mul r1, r0 - add r2, r2, r1 - ldrb r0, [r2, #4] - lsl r0, r0, #0x1b - lsr r1, r0, #0x1b - ldr r0, [sp] - str r1, [r0, #0x1c] - ldrb r0, [r2, #5] - lsl r0, r0, #0x1b - lsr r1, r0, #0x1b - ldr r0, [sp] - str r1, [r0, #0x20] - mov r0, #1 - pop {r3, r4, r5, r6, r7, pc} -_020850D8: - mov r0, ip - add r0, r0, #1 - add r2, r2, #6 - add r3, r3, #6 - mov ip, r0 - cmp r0, #0x47 - blo _02085078 -_020850E6: - mov r0, #0 - pop {r3, r4, r5, r6, r7, pc} - nop -_020850EC: .word gSystem + 0x40 -_020850F0: .word _02102278 - thumb_func_end sub_0208503C - - .rodata - -_02101D3C: - .byte 0x60, 0x68, 0x50, 0x58 -_02101D40: - .byte 0x04, 0x07, 0x0D, 0x0A -_02101D44: - .byte 0x03, 0x06, 0x0C, 0x09, 0x09, 0x00, 0x00, 0x00 -_02101D4C: - .byte 0x28, 0x28, 0x28, 0x28 - .byte 0x29, 0x29, 0x29, 0x00 -_02101D54: - .byte 0x70, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00 -_02101D60: - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -_02101D70: - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 -_02101D80: - .byte 0x19, 0x00, 0x39, 0x00, 0x59, 0x00, 0x61, 0x00, 0x7A, 0x00, 0x9E, 0x00, 0xC6, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x2B, 0x00, 0x20, 0x00, 0x2F, 0x00, 0x01, 0x00, 0x2B, 0x00, 0x3F, 0x00, 0x09, 0x00 - .byte 0x30, 0x00, 0xE2, 0x00, 0xFF, 0xFF, 0x8D, 0x00, 0x74, 0x00, 0x60, 0x00, 0x6A, 0x00, 0x2F, 0x00 - .byte 0x01, 0x00, 0x2B, 0x00, 0x3F, 0x00, 0x09, 0x00, 0x30, 0x00, 0xE2, 0x00, 0xFF, 0xFF - - ; File boundary - -_02101DBE: - .byte 0x02, 0xE0 - .byte 0x02, 0xE0, 0x03, 0xE0, 0x03, 0xE0, 0x04, 0xE0, 0x04, 0xE0, 0x04, 0xD0, 0x04, 0xD0, 0x07, 0xE0 - .byte 0x07, 0xE0, 0x07, 0xE0, 0x08, 0xE0, 0x08, 0xE0 -_02101DD8: - .byte 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0 - .byte 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0, 0x04, 0xD0, 0x07, 0xE0, 0x07, 0xE0, 0x07, 0xE0, 0x08, 0xE0 - .byte 0x08, 0xE0 -_02101DF2: - .short 0x00E3, 0x00E4, 0x00F9, 0x00F8, 0x00E5, 0x00E6, 0x00F5 - .short 0x00F6, 0x00F7, 0x00E7, 0x0001, 0x00EE, 0x00EF, 0xFFFF, 0x0000 -_02101E10: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000 - .short 0x0001, 0x041F, 0x0000, 0x0000, 0x0000, 0x0000 -_02101E2C: - .short 0x01DE, 0x01DE - .short 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE - .short 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101E48: - .short 0x0107, 0x0108, 0x0109, 0x010A - .short 0x010B, 0x010C, 0x010D, 0x010E, 0x0111, 0x010F, 0x0110, 0x0001 - .short 0x0001, 0xFFFF -_02101E64: - .short 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126 - .short 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101E80: - .short 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132 - .short 0x0133, 0x0134, 0x01DE, 0x01AD, 0x01AE, 0xFFFF -_02101E9C: - .short 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x01DE, 0x01B3, 0x01BE, 0xFFFF -_02101EB8: - .short 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF -_02101ED4: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0003, 0x041E, 0x0100, 0x0000, 0x0000, 0x0000 -_02101EF0: - .short 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x01DE, 0x01AD, 0x01AE, 0xFFFF -_02101F0C: - .short 0x014F, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x01DE, 0x01B3, 0x01BE, 0xFFFF -_02101F28: - .short 0x00FF, 0x0100, 0x0101, 0x0102, 0x0103, 0x00FC, 0x00FA, 0x00FD, 0x00FB, 0x00FE, 0x0105, 0x0001, 0x0001, 0xFFFF -_02101F44: - .short 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0106, 0x0104, 0xFFFF -_02101F60: - .short 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101F7C: - .short 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x0001, 0x00E1, 0x00E2, 0xFFFF -_02101F98: - .short 0x01AD, 0x01AE, 0x01C4, 0x01C5, 0x01AB, 0x01AC, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0x01DE, 0x01DE, 0xFFFF -_02101FB4: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x1000, 0x0000, 0x0000, 0x0000, 0x0003, 0x041C, 0x0200, 0x0000, 0x0000, 0x0000 -_02101FD0: - .short 0x01B4, 0x01B5, 0x01B2, 0x01B3, 0x01B9, 0x01BA, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02101FEC: - .short 0x01AF, 0x01B0, 0x01C3, 0x01D0, 0x01C0, 0x01D2, 0x01BD, 0x01BE, 0x01BF, 0x01B1, 0x01C1, 0x01DE, 0x01DE, 0xFFFF -_02102008: - .short 0x01CB, 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01C6, 0x01C8, 0x01C9, 0x01C7, 0x01CA, 0x01D1, 0x01DE, 0x01DE, 0xFFFF -_02102024: - .short 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x01DE, 0x01DE, 0x01DE, 0xFFFF -_02102040: - .short 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DD, 0x01DB, 0x01DC, 0x01DE, 0x01DE, 0xFFFF -_0210205C: - .short 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01DE, 0x01BB, 0x01BC, 0xFFFF -_02102078: - .short 0x0000, 0x0000, 0x0000, 0x0000, 0x0800, 0x0000, 0x0000, 0x0000, 0x0001, 0x001A, 0x0300, 0x0000, 0x0000, 0x0000, 0x008E, 0x0062, 0x0093, 0x00A1, 0x002F, 0x0001, 0x007C, 0x0074, 0x0060, 0x007E, 0x00F1, 0x0091, 0x0030, 0x00E2, 0xFFFF - - ; File boundary - - .balign 4, 0 -_021020B4: - .short 0x0000, 0x0000, 0x0001, 0x0000, 0x0002, 0x0000, 0x0003, 0x0000, 0x0004, 0x0000, 0x0005, 0x0000, 0x0006, 0x0000, 0x0008, 0x0000 -_021020D4: - .short 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF -_021020F8: - .short 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF -_0210211C: - .short 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0xFFFF -_02102140: - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -_02102168: - .word 0, 0 - .word 0, -1 - .word 0, 1 - .word -1, 0 - .word 1, 0 -_02102190: - .short 0x0031, 0x0032 - .short 0x0034, 0x0035 - .short 0x0037, 0x0038 - .short 0x003A, 0x003B - .short 0x003D, 0x003E - .short 0x0081, 0x0082 - .short 0x0084, 0x0085 - .short 0x0087, 0x0088 - .short 0x008A, 0x008B - .short 0x008D, 0x008E -_021021B8: - .short 0x0024, 0x0026 - .short 0x0074, 0x0076 - .short 0x0032, 0x0031 - .short 0x0035, 0x0034 - .short 0x0038, 0x0037 - .short 0x003B, 0x003A - .short 0x003E, 0x003D - .short 0x0082, 0x0081 - .short 0x0085, 0x0084 - .short 0x0088, 0x0087 - .short 0x008B, 0x008A - .short 0x008E, 0x008D -_021021E8: - .byte 0x04, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x24, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x44, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 -_02102218: - .byte 0x00, 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x65, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 -_02102238: - .byte 0x88, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0xB0, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x16, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x1A, 0x00, 0x00, 0x00, 0x5B, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -_02102278: - .byte 0x19, 0x3C - .short 0x00 - .byte 0x00, 0x00 - .byte 0x39, 0x3C - .short 0x00 - .byte 0x02, 0x00 - .byte 0x59, 0x3C - .short 0x00 - .byte 0x04, 0x00 - .byte 0x00, 0xC0 - .short 0x00 - .byte 0x04, 0x00 - .byte 0x9D, 0x3C - .short 0x01 - .byte 0x08, 0x00 - .byte 0xC5, 0x3C - .short 0x01 - .byte 0x0B, 0x00 - .byte 0x1C, 0x58 - .short 0x02 - .byte 0x00, 0x01 - .byte 0x2C, 0x58 - .short 0x02 - .byte 0x01, 0x01 - .byte 0x3C, 0x58 - .short 0x0002 - .byte 0x02, 0x01 - .byte 0x4C, 0x58 - .short 0x0002 - .byte 0x03, 0x01 - .byte 0x5C, 0x58 - .short 0x0002 - .byte 0x04, 0x01 - .byte 0x6C, 0x58 - .short 0x0002 - .byte 0x05, 0x01 - .byte 0x7C, 0x58 - .short 0x0002 - .byte 0x06, 0x01 - .byte 0x8C, 0x58 - .short 0x0002 - .byte 0x07, 0x01 - .byte 0x9C, 0x58 - .short 0x0002 - .byte 0x08, 0x01 - .byte 0xAC, 0x58 - .short 0x0002 - .byte 0x09, 0x01 - .byte 0xBC, 0x58 - .short 0x0002 - .byte 0x0A, 0x01 - .byte 0xCC, 0x58 - .short 0x0002 - .byte 0x0B, 0x01 - .byte 0xDC, 0x58 - .short 0x0002 - .byte 0x0C, 0x01 - .byte 0x1C, 0x6B - .short 0x0002 - .byte 0x00, 0x02 - .byte 0x2C, 0x6B - .short 0x0002 - .byte 0x01, 0x02 - .byte 0x3C, 0x6B - .short 0x0002 - .byte 0x02, 0x02 - .byte 0x4C, 0x6B - .short 0x0002 - .byte 0x03, 0x02 - .byte 0x5C, 0x6B - .short 0x0002 - .byte 0x04, 0x02 - .byte 0x6C, 0x6B - .short 0x0002 - .byte 0x05, 0x02 - .byte 0x7C, 0x6B - .short 0x0002 - .byte 0x06, 0x02 - .byte 0x8C, 0x6B - .short 0x0002 - .byte 0x07, 0x02 - .byte 0x9C, 0x6B - .short 0x0002 - .byte 0x08, 0x02 - .byte 0xAC, 0x6B - .short 0x0002 - .byte 0x09, 0x02 - .byte 0xBC, 0x6B - .short 0x0002 - .byte 0x0A, 0x02 - .byte 0xCC, 0x6B - .short 0x0002 - .byte 0x0B, 0x02 - .byte 0xDC, 0x6B - .short 0x0002 - .byte 0x0C, 0x02 - .byte 0x1C, 0x7E - .short 0x0002 - .byte 0x00, 0x03 - .byte 0x2C, 0x7E - .short 0x0002 - .byte 0x01, 0x03 - .byte 0x3C, 0x7E - .short 0x0002 - .byte 0x02, 0x03 - .byte 0x4C, 0x7E - .short 0x0002 - .byte 0x03, 0x03 - .byte 0x5C, 0x7E - .short 0x0002 - .byte 0x04, 0x03 - .byte 0x6C, 0x7E - .short 0x0002 - .byte 0x05, 0x03 - .byte 0x7C, 0x7E - .short 0x0002 - .byte 0x06, 0x03 - .byte 0x8C, 0x7E - .short 0x0002 - .byte 0x07, 0x03 - .byte 0x9C, 0x7E - .short 0x0002 - .byte 0x08, 0x03 - .byte 0xAC, 0x7E - .short 0x0002 - .byte 0x09, 0x03 - .byte 0xBC, 0x7E - .short 0x0002 - .byte 0x0A, 0x03 - .byte 0xCC, 0x7E - .short 0x0002 - .byte 0x0B, 0x03 - .byte 0xDC, 0x7E - .short 0x0002 - .byte 0x0C, 0x03 - .byte 0x1C, 0x91 - .short 0x0002 - .byte 0x00, 0x04 - .byte 0x2C, 0x91 - .short 0x0002 - .byte 0x01, 0x04 - .byte 0x3C, 0x91 - .short 0x0002 - .byte 0x02, 0x04 - .byte 0x4C, 0x91 - .short 0x0002 - .byte 0x03, 0x04 - .byte 0x5C, 0x91 - .short 0x0002 - .byte 0x04, 0x04 - .byte 0x6C, 0x91 - .short 0x0002 - .byte 0x05, 0x04 - .byte 0x7C, 0x91 - .short 0x0002 - .byte 0x06, 0x04 - .byte 0x8C, 0x91 - .short 0x0002 - .byte 0x07, 0x04 - .byte 0x9C, 0x91 - .short 0x0002 - .byte 0x08, 0x04 - .byte 0xAC, 0x91 - .short 0x0002 - .byte 0x09, 0x04 - .byte 0xBC, 0x91 - .short 0x0002 - .byte 0x0A, 0x04 - .byte 0xCC, 0x91 - .short 0x0002 - .byte 0x0B, 0x04 - .byte 0xDC, 0x91 - .short 0x0002 - .byte 0x0C, 0x04 - .byte 0x1C, 0xA4 - .short 0x0002 - .byte 0x00, 0x05 - .byte 0x2C, 0xA4 - .short 0x0002 - .byte 0x01, 0x05 - .byte 0x3C, 0xA4 - .short 0x0002 - .byte 0x02, 0x05 - .byte 0x4C, 0xA4 - .short 0x0002 - .byte 0x03, 0x05 - .byte 0x5C, 0xA4 - .short 0x0002 - .byte 0x04, 0x05 - .byte 0x6C, 0xA4 - .short 0x0002 - .byte 0x05, 0x05 - .byte 0x7C, 0xA4 - .short 0x0002 - .byte 0x06, 0x05 - .byte 0x8C, 0xA4 - .short 0x0002 - .byte 0x07, 0x05 - .byte 0x9C, 0xA4 - .short 0x0002 - .byte 0x08, 0x05 - .byte 0xAC, 0xA4 - .short 0x0002 - .byte 0x09, 0x05 - .byte 0xBC, 0xA4 - .short 0x0002 - .byte 0x0A, 0x05 - .byte 0xCC, 0xA4 - .short 0x0002 - .byte 0x0B, 0x05 - .byte 0xDC, 0xA4 - .short 0x0002 - .byte 0x0C, 0x05 -_02102422: - .short 0x0003, 0x0001, 0x0002 - .short 0x0005, 0x0001, 0x0004 - .short 0x0007, 0x0001, 0x0006 - .short 0x0009, 0x0001, 0x0008 - .short 0x000B, 0x0001, 0x000A - .short 0x0053, 0x0001, 0x0052 - .short 0x0055, 0x0001, 0x0054 - .short 0x0057, 0x0001, 0x0056 - .short 0x0059, 0x0001, 0x0058 - .short 0x005B, 0x0001, 0x005A - .short 0x0045, 0x0001, 0x0044 - .short 0x0047, 0x0001, 0x0046 - .short 0x0049, 0x0001, 0x0048 - .short 0x0095, 0x0001, 0x0094 - .short 0x0097, 0x0001, 0x0096 - .short 0x0099, 0x0001, 0x0098 - .short 0x00AC, 0x0001, 0x00C6 - .short 0x00AD, 0x0001, 0x00C7 - .short 0x00AE, 0x0001, 0x00C8 - .short 0x00AF, 0x0001, 0x00C9 - .short 0x00B0, 0x0001, 0x00CA - .short 0x00B1, 0x0001, 0x00CB - .short 0x00B2, 0x0001, 0x00CC - .short 0x00B3, 0x0001, 0x00CD - .short 0x00B4, 0x0001, 0x00CE - .short 0x00B5, 0x0001, 0x00CF - .short 0x00B6, 0x0001, 0x00D0 - .short 0x00B7, 0x0001, 0x00D1 - .short 0x00B8, 0x0001, 0x00D2 - .short 0x00B9, 0x0001, 0x00D3 - .short 0x00BA, 0x0001, 0x00D4 - .short 0x00BB, 0x0001, 0x00D5 - .short 0x00BC, 0x0001, 0x00D6 - .short 0x00BD, 0x0001, 0x00D7 - .short 0x00BE, 0x0001, 0x00D8 - .short 0x00BF, 0x0001, 0x00D9 - .short 0x00C0, 0x0001, 0x00DA - .short 0x00C1, 0x0001, 0x00DB - .short 0x00C2, 0x0001, 0x00DC - .short 0x00C3, 0x0001, 0x00DD - .short 0x00C4, 0x0001, 0x00DE - .short 0x00C5, 0x0001, 0x00DF - .short 0x0025, 0x0026, 0x0024 - .short 0x0075, 0x0076, 0x0074 - .short 0x000C, 0x000D, 0x0001 - .short 0x000E, 0x000F, 0x0001 - .short 0x0010, 0x0011, 0x0001 - .short 0x0012, 0x0013, 0x0001 - .short 0x0014, 0x0015, 0x0001 - .short 0x0016, 0x0017, 0x0001 - .short 0x0018, 0x0019, 0x0001 - .short 0x001A, 0x001B, 0x0001 - .short 0x001C, 0x001D, 0x0001 - .short 0x001E, 0x001F, 0x0001 - .short 0x0020, 0x0021, 0x0001 - .short 0x0022, 0x0023, 0x0001 - .short 0x0027, 0x0028, 0x0001 - .short 0x0029, 0x002A, 0x0001 - .short 0x005C, 0x005D, 0x0001 - .short 0x005E, 0x005F, 0x0001 - .short 0x0060, 0x0061, 0x0001 - .short 0x0062, 0x0063, 0x0001 - .short 0x0064, 0x0065, 0x0001 - .short 0x0066, 0x0067, 0x0001 - .short 0x0068, 0x0069, 0x0001 - .short 0x006A, 0x006B, 0x0001 - .short 0x006C, 0x006D, 0x0001 - .short 0x006E, 0x006F, 0x0001 - .short 0x0070, 0x0071, 0x0001 - .short 0x0072, 0x0073, 0x0001 - .short 0x0077, 0x0078, 0x0001 - .short 0x0079, 0x007A, 0x0001 - .short 0x0030, 0x0031, 0x0032 - .short 0x0033, 0x0034, 0x0035 - .short 0x0036, 0x0037, 0x0038 - .short 0x0039, 0x003A, 0x003B - .short 0x003C, 0x003D, 0x003E - .short 0x0080, 0x0081, 0x0082 - .short 0x0083, 0x0084, 0x0085 - .short 0x0086, 0x0087, 0x0088 - .short 0x0089, 0x008A, 0x008B - .short 0x008C, 0x008D, 0x008E - - ; File boundary - - .balign 4, 0 - .public sOverlayTemplate_NamingScreen -sOverlayTemplate_NamingScreen: - .word sub_02082908, sub_02082B20, sub_02082EE8, 0xFFFFFFFF - - .data - -_021104E4: - .word _02101DBE - .word _02101DBE - .word _02101DBE - .word _02101DBE - .word _02101DD8 -_021104F8: - .word _02101E80 - .word _02101E9C - .word _02101EB8 - .word _02101E2C - .word _02101E64 - .word _02101EF0 - .word _02101F0C - .word _0210205C - .word _02101F60 - .word _02102024 - .word _02101F98 - .word _02101FD0 - .word _02101FEC - .word _02102008 - .word _02102040 - .word _02101F7C - .word _02101DF2 - .word _02101F44 - .word _02101F28 - .word _02101E48 - .word _021020D4 - .word _021020F8 - .word _0210211C - .word _0210211C - .word _0210211C - - ; File boundary diff --git a/asm/unk_020910D8.s b/asm/unk_020910D8.s index 67c8731373..e895697797 100644 --- a/asm/unk_020910D8.s +++ b/asm/unk_020910D8.s @@ -8,7 +8,7 @@ .include "unk_020910D8.inc" .include "global.inc" - .public sOverlayTemplate_NamingScreen + .public gOverlayTemplate_NamingScreen .text @@ -136,7 +136,7 @@ _0209119A: bl GetMonData ldr r1, [r4, #8] str r0, [r1, #8] - ldr r1, _0209123C ; =sOverlayTemplate_NamingScreen + ldr r1, _0209123C ; =gOverlayTemplate_NamingScreen ldr r2, [r4, #8] add r0, r5, #0 bl CallApplicationAsTask @@ -178,7 +178,7 @@ _02091232: pop {r3, r4, r5, r6, r7, pc} .balign 4, 0 _02091238: .word _02106048 -_0209123C: .word sOverlayTemplate_NamingScreen +_0209123C: .word gOverlayTemplate_NamingScreen thumb_func_end Task_HatchEggInParty thumb_func_start CallTask_HatchEggInParty diff --git a/asm/unk_020912AC.s b/asm/unk_020912AC.s index 9d17083d9e..b327eb4f05 100644 --- a/asm/unk_020912AC.s +++ b/asm/unk_020912AC.s @@ -7,7 +7,7 @@ .include "unk_020912AC.inc" .include "global.inc" - .public sOverlayTemplate_NamingScreen + .public gOverlayTemplate_NamingScreen .text diff --git a/asm/unk_02091564.s b/asm/unk_02091564.s index e5cfa1ee83..759c147b6a 100644 --- a/asm/unk_02091564.s +++ b/asm/unk_02091564.s @@ -7,7 +7,7 @@ .include "unk_02091564.inc" .include "global.inc" - .public sOverlayTemplate_NamingScreen + .public gOverlayTemplate_NamingScreen .text diff --git a/files/.gitignore b/files/.gitignore index 975eb5efaa..9e69f13d85 100644 --- a/files/.gitignore +++ b/files/.gitignore @@ -13,6 +13,7 @@ a/0/2/0 a/0/2/1 a/0/2/7 a/0/3/0 +a/0/3/1 a/0/3/2 a/0/3/3 a/0/3/4 @@ -78,4 +79,5 @@ data/photo_data.narc graphic/camera_viewfinder.narc application/guinness.narc demo/intro/intro.narc +data/namein.narc *.NCLR diff --git a/files/a/0/3/1 b/files/a/0/3/1 deleted file mode 100644 index fabac04b02..0000000000 Binary files a/files/a/0/3/1 and /dev/null differ diff --git a/files/data/namein.mk b/files/data/namein.mk new file mode 100644 index 0000000000..65902dacaf --- /dev/null +++ b/files/data/namein.mk @@ -0,0 +1,30 @@ +DATA_NAMEIN_DIR := files/data/namein +DATA_NAMEIN_NARC := $(DATA_NAMEIN_DIR).narc +DATA_NAMEIN_FILES := \ + namein_00000000.NCLR \ + namein_00000001.NCLR \ + namein_00000002.NCGR.lz \ + namein_00000003.NCGR.lz \ + namein_00000004.NSCR.lz \ + namein_00000005.NSCR.lz \ + namein_00000006.NSCR.lz \ + namein_00000007.NSCR.lz \ + namein_00000008.NSCR.lz \ + namein_00000009.NSCR.lz \ + namein_00000010.NCGR.lz \ + namein_00000011.NCGR.lz \ + namein_00000012.NCER.lz \ + namein_00000013.NCER.lz \ + namein_00000014.NANR.lz \ + namein_00000015.NANR.lz \ + namein_00000016.NCGR.lz \ + namein_00000017.NSCR.lz \ + namein_00000018.NSCR.lz + +$(DATA_NAMEIN_NARC): $(addprefix $(DATA_NAMEIN_DIR)/,$(DATA_NAMEIN_FILES)) + +clean-data-namein: + $(RM) $(filter %.lz,$(addprefix $(DATA_NAMEIN_DIR)/,$(DATA_NAMEIN_FILES))) + +.PHONY: clean-data-namein +clean-filesystem: clean-data-namein diff --git a/files/data/namein/.knarcignore b/files/data/namein/.knarcignore new file mode 100644 index 0000000000..50b6c58607 --- /dev/null +++ b/files/data/namein/.knarcignore @@ -0,0 +1,4 @@ +*.NCGR +*.NSCR +*.NANR +*.NCER diff --git a/files/data/namein/namein_00000000.NCLR b/files/data/namein/namein_00000000.NCLR new file mode 100644 index 0000000000..7798438213 Binary files /dev/null and b/files/data/namein/namein_00000000.NCLR differ diff --git a/files/data/namein/namein_00000001.NCLR b/files/data/namein/namein_00000001.NCLR new file mode 100644 index 0000000000..9850267e4b Binary files /dev/null and b/files/data/namein/namein_00000001.NCLR differ diff --git a/files/data/namein/namein_00000002.NCGR b/files/data/namein/namein_00000002.NCGR new file mode 100644 index 0000000000..573b84fa54 Binary files /dev/null and b/files/data/namein/namein_00000002.NCGR differ diff --git a/files/data/namein/namein_00000003.NCGR b/files/data/namein/namein_00000003.NCGR new file mode 100644 index 0000000000..dd7c31ea89 Binary files /dev/null and b/files/data/namein/namein_00000003.NCGR differ diff --git a/files/data/namein/namein_00000004.NSCR b/files/data/namein/namein_00000004.NSCR new file mode 100644 index 0000000000..cab16df3e8 Binary files /dev/null and b/files/data/namein/namein_00000004.NSCR differ diff --git a/files/data/namein/namein_00000005.NSCR b/files/data/namein/namein_00000005.NSCR new file mode 100644 index 0000000000..9bcabe6287 Binary files /dev/null and b/files/data/namein/namein_00000005.NSCR differ diff --git a/files/data/namein/namein_00000006.NSCR b/files/data/namein/namein_00000006.NSCR new file mode 100644 index 0000000000..0eb39a037d Binary files /dev/null and b/files/data/namein/namein_00000006.NSCR differ diff --git a/files/data/namein/namein_00000007.NSCR b/files/data/namein/namein_00000007.NSCR new file mode 100644 index 0000000000..0289705014 Binary files /dev/null and b/files/data/namein/namein_00000007.NSCR differ diff --git a/files/data/namein/namein_00000008.NSCR b/files/data/namein/namein_00000008.NSCR new file mode 100644 index 0000000000..1de33a89a5 Binary files /dev/null and b/files/data/namein/namein_00000008.NSCR differ diff --git a/files/data/namein/namein_00000009.NSCR b/files/data/namein/namein_00000009.NSCR new file mode 100644 index 0000000000..7b04c5190c Binary files /dev/null and b/files/data/namein/namein_00000009.NSCR differ diff --git a/files/data/namein/namein_00000010.NCGR b/files/data/namein/namein_00000010.NCGR new file mode 100644 index 0000000000..8c1d29e9f6 Binary files /dev/null and b/files/data/namein/namein_00000010.NCGR differ diff --git a/files/data/namein/namein_00000011.NCGR b/files/data/namein/namein_00000011.NCGR new file mode 100644 index 0000000000..47c8749807 Binary files /dev/null and b/files/data/namein/namein_00000011.NCGR differ diff --git a/files/data/namein/namein_00000012.NCER b/files/data/namein/namein_00000012.NCER new file mode 100644 index 0000000000..bdd7a54481 Binary files /dev/null and b/files/data/namein/namein_00000012.NCER differ diff --git a/files/data/namein/namein_00000013.NCER b/files/data/namein/namein_00000013.NCER new file mode 100644 index 0000000000..8584822e07 Binary files /dev/null and b/files/data/namein/namein_00000013.NCER differ diff --git a/files/data/namein/namein_00000014.NANR b/files/data/namein/namein_00000014.NANR new file mode 100644 index 0000000000..87873846c5 Binary files /dev/null and b/files/data/namein/namein_00000014.NANR differ diff --git a/files/data/namein/namein_00000015.NANR b/files/data/namein/namein_00000015.NANR new file mode 100644 index 0000000000..e3ad94f414 Binary files /dev/null and b/files/data/namein/namein_00000015.NANR differ diff --git a/files/data/namein/namein_00000016.NCGR b/files/data/namein/namein_00000016.NCGR new file mode 100644 index 0000000000..d1461b49cd Binary files /dev/null and b/files/data/namein/namein_00000016.NCGR differ diff --git a/files/data/namein/namein_00000017.NSCR b/files/data/namein/namein_00000017.NSCR new file mode 100644 index 0000000000..d3c5f0e9a5 Binary files /dev/null and b/files/data/namein/namein_00000017.NSCR differ diff --git a/files/data/namein/namein_00000018.NSCR b/files/data/namein/namein_00000018.NSCR new file mode 100644 index 0000000000..b79e861ca6 Binary files /dev/null and b/files/data/namein/namein_00000018.NSCR differ diff --git a/filesystem.mk b/filesystem.mk index 8e67b5a5e5..f959ee89a4 100644 --- a/filesystem.mk +++ b/filesystem.mk @@ -410,6 +410,7 @@ $(eval $(call arc_strip_name,files/itemtool/itemdata/item_icon.narc,files/a/0/1/ $(eval $(call arc_strip_name,files/graphic/plist_gra.narc,files/a/0/2/1)) $(eval $(call arc_strip_name,files/msgdata/msg.narc,files/a/0/2/7)) $(eval $(call arc_strip_name,files/battledata/script/effect_script.narc,files/a/0/3/0)) +$(eval $(call arc_strip_name,files/data/namein.narc,files/a/0/3/1)) $(eval $(call arc_strip_name,files/fielddata/eventdata/zone_event.narc,files/a/0/3/2)) $(eval $(call arc_strip_name,files/poketool/personal/wotbl.narc,files/a/0/3/3)) $(eval $(call arc_strip_name,files/poketool/personal/evo.narc,files/a/0/3/4)) @@ -519,6 +520,7 @@ include files/data/photo_data.mk include files/graphic/camera_viewfinder.mk include files/application/guinness.mk include files/demo/intro/intro.mk +include files/data/namein.mk $(filter-out $(DIFF_ARCS) $(FS_RULE_OVERRIDES),$(NITROFS_FILES)): ; diff --git a/include/bg_window.h b/include/bg_window.h index a1492688f5..a9565a1535 100644 --- a/include/bg_window.h +++ b/include/bg_window.h @@ -206,12 +206,12 @@ BgConfig *BgConfig_Alloc(HeapID heapId); HeapID BgConfig_GetHeapId(BgConfig *bgConfig); void SetBothScreensModesAndDisable(const GraphicsModes *modes); void SetScreenModeAndDisable(const struct GraphicsModes *gfxModes, enum GFScreen screen); -void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, GFPlaneToggle enable); +void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, u8 enable); void InitBgFromTemplate(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType); void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value); void FreeBgTilemapBuffer(BgConfig *bgConfig, u8 bgId); void SetBgPriority(u8 bgId, u16 priority); -void ToggleBgLayer(u8 bgId, GFPlaneToggle toggle); +void ToggleBgLayer(u8 bgId, u8 toggle); void BgSetPosTextAndCommit(BgConfig *bgConfig, u8 bgId, enum BgPosAdjustOp op, int val); int Bg_GetXpos(const BgConfig *bgConfig, GFBgLayer bgId); int Bg_GetYpos(const BgConfig *bgConfig, GFBgLayer bgId); diff --git a/include/constants/charcode.h b/include/constants/charcode.h index 8d572188c7..25b26894a6 100644 --- a/include/constants/charcode.h +++ b/include/constants/charcode.h @@ -1,265 +1,499 @@ #ifndef POKEHEARTGOLD_CONSTANTS_CHARCODE_H #define POKEHEARTGOLD_CONSTANTS_CHARCODE_H -#define CHAR_NUL 0 -#define CHAR_JP_SPACE 1 - -#define CHAR_JP_HIRA_A_SMALL 2 -#define CHAR_JP_HIRA_A 3 -#define CHAR_JP_HIRA_I_SMALL 4 -#define CHAR_JP_HIRA_I 5 -#define CHAR_JP_HIRA_U_SMALL 6 -#define CHAR_JP_HIRA_U 7 -#define CHAR_JP_HIRA_E_SMALL 8 -#define CHAR_JP_HIRA_E 9 -#define CHAR_JP_HIRA_O_SMALL 10 -#define CHAR_JP_HIRA_O 11 -#define CHAR_JP_HIRA_KA 12 -#define CHAR_JP_HIRA_GA 13 -#define CHAR_JP_HIRA_KI 14 -#define CHAR_JP_HIRA_GI 15 -#define CHAR_JP_HIRA_KU 16 -#define CHAR_JP_HIRA_GU 17 -#define CHAR_JP_HIRA_KE 18 -#define CHAR_JP_HIRA_GE 19 -#define CHAR_JP_HIRA_KO 20 -#define CHAR_JP_HIRA_GO 21 -#define CHAR_JP_HIRA_SA 22 -#define CHAR_JP_HIRA_ZA 23 -#define CHAR_JP_HIRA_SI 24 -#define CHAR_JP_HIRA_ZI 25 -#define CHAR_JP_HIRA_SU 26 -#define CHAR_JP_HIRA_ZU 27 -#define CHAR_JP_HIRA_SE 28 -#define CHAR_JP_HIRA_ZE 29 -#define CHAR_JP_HIRA_SO 30 -#define CHAR_JP_HIRA_ZO 31 -#define CHAR_JP_HIRA_TA 32 -#define CHAR_JP_HIRA_DA 33 -#define CHAR_JP_HIRA_TI 34 -#define CHAR_JP_HIRA_DI 35 -#define CHAR_JP_HIRA_TU_SMALL 36 -#define CHAR_JP_HIRA_TU 37 -#define CHAR_JP_HIRA_DU 38 -#define CHAR_JP_HIRA_TE 39 -#define CHAR_JP_HIRA_DE 40 -#define CHAR_JP_HIRA_TO 41 -#define CHAR_JP_HIRA_DO 42 -#define CHAR_JP_HIRA_NA 43 -#define CHAR_JP_HIRA_NI 44 -#define CHAR_JP_HIRA_NU 45 -#define CHAR_JP_HIRA_NE 46 -#define CHAR_JP_HIRA_NO 47 -#define CHAR_JP_HIRA_HA 48 -#define CHAR_JP_HIRA_BA 49 -#define CHAR_JP_HIRA_PA 50 -#define CHAR_JP_HIRA_HI 51 -#define CHAR_JP_HIRA_BI 52 -#define CHAR_JP_HIRA_PI 53 -#define CHAR_JP_HIRA_HU 54 -#define CHAR_JP_HIRA_BU 55 -#define CHAR_JP_HIRA_PU 56 -#define CHAR_JP_HIRA_HE 57 -#define CHAR_JP_HIRA_BE 58 -#define CHAR_JP_HIRA_PE 59 -#define CHAR_JP_HIRA_HO 60 -#define CHAR_JP_HIRA_BO 61 -#define CHAR_JP_HIRA_PO 62 -#define CHAR_JP_HIRA_MA 63 -#define CHAR_JP_HIRA_MI 64 -#define CHAR_JP_HIRA_MU 65 -#define CHAR_JP_HIRA_ME 66 -#define CHAR_JP_HIRA_MO 67 -#define CHAR_JP_HIRA_YA_SMALL 68 -#define CHAR_JP_HIRA_YA 69 -#define CHAR_JP_HIRA_YU_SMALL 70 -#define CHAR_JP_HIRA_YU 71 -#define CHAR_JP_HIRA_YO_SMALL 72 -#define CHAR_JP_HIRA_YO 73 -#define CHAR_JP_HIRA_RA 74 -#define CHAR_JP_HIRA_RI 75 -#define CHAR_JP_HIRA_RU 76 -#define CHAR_JP_HIRA_RE 77 -#define CHAR_JP_HIRA_RO 78 -#define CHAR_JP_HIRA_WA 79 -#define CHAR_JP_HIRA_WO 80 -#define CHAR_JP_HIRA_N_ 81 - -#define CHAR_JP_KATA_A_SMALL 82 -#define CHAR_JP_KATA_A 83 -#define CHAR_JP_KATA_I_SMALL 84 -#define CHAR_JP_KATA_I 85 -#define CHAR_JP_KATA_U_SMALL 86 -#define CHAR_JP_KATA_U 87 -#define CHAR_JP_KATA_E_SMALL 88 -#define CHAR_JP_KATA_E 89 -#define CHAR_JP_KATA_O_SMALL 90 -#define CHAR_JP_KATA_O 91 -#define CHAR_JP_KATA_KA 92 -#define CHAR_JP_KATA_GA 93 -#define CHAR_JP_KATA_KI 94 -#define CHAR_JP_KATA_GI 95 -#define CHAR_JP_KATA_KU 96 -#define CHAR_JP_KATA_GU 97 -#define CHAR_JP_KATA_KE 98 -#define CHAR_JP_KATA_GE 99 -#define CHAR_JP_KATA_KO 100 -#define CHAR_JP_KATA_GO 101 -#define CHAR_JP_KATA_SA 102 -#define CHAR_JP_KATA_ZA 103 -#define CHAR_JP_KATA_SI 104 -#define CHAR_JP_KATA_ZI 105 -#define CHAR_JP_KATA_SU 106 -#define CHAR_JP_KATA_ZU 107 -#define CHAR_JP_KATA_SE 108 -#define CHAR_JP_KATA_ZE 109 -#define CHAR_JP_KATA_SO 110 -#define CHAR_JP_KATA_ZO 111 -#define CHAR_JP_KATA_TA 112 -#define CHAR_JP_KATA_DA 113 -#define CHAR_JP_KATA_TI 114 -#define CHAR_JP_KATA_DI 115 -#define CHAR_JP_KATA_TU_SMALL 116 -#define CHAR_JP_KATA_TU 117 -#define CHAR_JP_KATA_DU 118 -#define CHAR_JP_KATA_TE 119 -#define CHAR_JP_KATA_DE 120 -#define CHAR_JP_KATA_TO 121 -#define CHAR_JP_KATA_DO 122 -#define CHAR_JP_KATA_NA 123 -#define CHAR_JP_KATA_NI 124 -#define CHAR_JP_KATA_NU 125 -#define CHAR_JP_KATA_NE 126 -#define CHAR_JP_KATA_NO 127 -#define CHAR_JP_KATA_HA 128 -#define CHAR_JP_KATA_BA 129 -#define CHAR_JP_KATA_PA 130 -#define CHAR_JP_KATA_HI 131 -#define CHAR_JP_KATA_BI 132 -#define CHAR_JP_KATA_PI 133 -#define CHAR_JP_KATA_HU 134 -#define CHAR_JP_KATA_BU 135 -#define CHAR_JP_KATA_PU 136 -#define CHAR_JP_KATA_HE 137 -#define CHAR_JP_KATA_BE 138 -#define CHAR_JP_KATA_PE 139 -#define CHAR_JP_KATA_HO 140 -#define CHAR_JP_KATA_BO 141 -#define CHAR_JP_KATA_PO 142 -#define CHAR_JP_KATA_MA 143 -#define CHAR_JP_KATA_MI 144 -#define CHAR_JP_KATA_MU 145 -#define CHAR_JP_KATA_ME 146 -#define CHAR_JP_KATA_MO 147 -#define CHAR_JP_KATA_YA_SMALL 148 -#define CHAR_JP_KATA_YA 149 -#define CHAR_JP_KATA_YU_SMALL 150 -#define CHAR_JP_KATA_YU 151 -#define CHAR_JP_KATA_YO_SMALL 152 -#define CHAR_JP_KATA_YO 153 -#define CHAR_JP_KATA_RA 154 -#define CHAR_JP_KATA_RI 155 -#define CHAR_JP_KATA_RU 156 -#define CHAR_JP_KATA_RE 157 -#define CHAR_JP_KATA_RO 158 -#define CHAR_JP_KATA_WA 159 -#define CHAR_JP_KATA_WO 160 -#define CHAR_JP_KATA_N_ 161 - -#define CHAR_JP_0 162 -#define CHAR_JP_1 163 -#define CHAR_JP_2 164 -#define CHAR_JP_3 165 -#define CHAR_JP_4 166 -#define CHAR_JP_5 167 -#define CHAR_JP_6 168 -#define CHAR_JP_7 169 -#define CHAR_JP_8 170 -#define CHAR_JP_9 171 -#define CHAR_JP_A 172 -#define CHAR_JP_B 173 -#define CHAR_JP_C 174 -#define CHAR_JP_D 175 -#define CHAR_JP_E 176 -#define CHAR_JP_F 177 - -#define CHAR_JP_QUESTION_MARK 226 - -#define CHAR_JP_HYPHEN 241 - -#define CHAR_0 289 -#define CHAR_1 290 -#define CHAR_2 291 -#define CHAR_3 292 -#define CHAR_4 293 -#define CHAR_5 294 -#define CHAR_6 295 -#define CHAR_7 296 -#define CHAR_8 297 -#define CHAR_9 298 -#define CHAR_A 299 -#define CHAR_B 300 -#define CHAR_C 301 -#define CHAR_D 302 -#define CHAR_E 303 -#define CHAR_F 304 -#define CHAR_G 305 -#define CHAR_H 306 -#define CHAR_I 307 -#define CHAR_J 308 -#define CHAR_K 309 -#define CHAR_L 310 -#define CHAR_M 311 -#define CHAR_N 312 -#define CHAR_O 313 -#define CHAR_P 314 -#define CHAR_Q 315 -#define CHAR_R 316 -#define CHAR_S 317 -#define CHAR_T 318 -#define CHAR_U 319 -#define CHAR_V 320 -#define CHAR_W 321 -#define CHAR_X 322 -#define CHAR_Y 323 -#define CHAR_Z 324 -#define CHAR_a 325 -#define CHAR_b 326 -#define CHAR_c 327 -#define CHAR_d 328 -#define CHAR_e 329 -#define CHAR_f 330 -#define CHAR_g 331 -#define CHAR_h 332 -#define CHAR_i 333 -#define CHAR_j 334 -#define CHAR_k 335 -#define CHAR_l 336 -#define CHAR_m 337 -#define CHAR_n 338 -#define CHAR_o 339 -#define CHAR_p 340 -#define CHAR_q 341 -#define CHAR_r 342 -#define CHAR_s 343 -#define CHAR_t 344 -#define CHAR_u 345 -#define CHAR_v 346 -#define CHAR_w 347 -#define CHAR_x 348 -#define CHAR_y 349 -#define CHAR_z 350 - -#define CHAR_ELLIPSIS 431 - -#define CHAR_HYPHEN 446 - -#define CHAR_SPACE 478 - -#define CHAR_NARROW_SPACE 482 - -#define CHAR_ONE_DOT 491 -#define CHAR_TWO_DOTS 492 +#define CHAR_NUL 0 +#define CHAR_JP_SPACE 1 +#define CHAR_JP_HIRA_A_SMALL 2 +#define CHAR_JP_HIRA_A 3 +#define CHAR_JP_HIRA_I_SMALL 4 +#define CHAR_JP_HIRA_I 5 +#define CHAR_JP_HIRA_U_SMALL 6 +#define CHAR_JP_HIRA_U 7 +#define CHAR_JP_HIRA_E_SMALL 8 +#define CHAR_JP_HIRA_E 9 +#define CHAR_JP_HIRA_O_SMALL 10 +#define CHAR_JP_HIRA_O 11 +#define CHAR_JP_HIRA_KA 12 +#define CHAR_JP_HIRA_GA 13 +#define CHAR_JP_HIRA_KI 14 +#define CHAR_JP_HIRA_GI 15 +#define CHAR_JP_HIRA_KU 16 +#define CHAR_JP_HIRA_GU 17 +#define CHAR_JP_HIRA_KE 18 +#define CHAR_JP_HIRA_GE 19 +#define CHAR_JP_HIRA_KO 20 +#define CHAR_JP_HIRA_GO 21 +#define CHAR_JP_HIRA_SA 22 +#define CHAR_JP_HIRA_ZA 23 +#define CHAR_JP_HIRA_SI 24 +#define CHAR_JP_HIRA_ZI 25 +#define CHAR_JP_HIRA_SU 26 +#define CHAR_JP_HIRA_ZU 27 +#define CHAR_JP_HIRA_SE 28 +#define CHAR_JP_HIRA_ZE 29 +#define CHAR_JP_HIRA_SO 30 +#define CHAR_JP_HIRA_ZO 31 +#define CHAR_JP_HIRA_TA 32 +#define CHAR_JP_HIRA_DA 33 +#define CHAR_JP_HIRA_TI 34 +#define CHAR_JP_HIRA_DI 35 +#define CHAR_JP_HIRA_TU_SMALL 36 +#define CHAR_JP_HIRA_TU 37 +#define CHAR_JP_HIRA_DU 38 +#define CHAR_JP_HIRA_TE 39 +#define CHAR_JP_HIRA_DE 40 +#define CHAR_JP_HIRA_TO 41 +#define CHAR_JP_HIRA_DO 42 +#define CHAR_JP_HIRA_NA 43 +#define CHAR_JP_HIRA_NI 44 +#define CHAR_JP_HIRA_NU 45 +#define CHAR_JP_HIRA_NE 46 +#define CHAR_JP_HIRA_NO 47 +#define CHAR_JP_HIRA_HA 48 +#define CHAR_JP_HIRA_BA 49 +#define CHAR_JP_HIRA_PA 50 +#define CHAR_JP_HIRA_HI 51 +#define CHAR_JP_HIRA_BI 52 +#define CHAR_JP_HIRA_PI 53 +#define CHAR_JP_HIRA_HU 54 +#define CHAR_JP_HIRA_BU 55 +#define CHAR_JP_HIRA_PU 56 +#define CHAR_JP_HIRA_HE 57 +#define CHAR_JP_HIRA_BE 58 +#define CHAR_JP_HIRA_PE 59 +#define CHAR_JP_HIRA_HO 60 +#define CHAR_JP_HIRA_BO 61 +#define CHAR_JP_HIRA_PO 62 +#define CHAR_JP_HIRA_MA 63 +#define CHAR_JP_HIRA_MI 64 +#define CHAR_JP_HIRA_MU 65 +#define CHAR_JP_HIRA_ME 66 +#define CHAR_JP_HIRA_MO 67 +#define CHAR_JP_HIRA_YA_SMALL 68 +#define CHAR_JP_HIRA_YA 69 +#define CHAR_JP_HIRA_YU_SMALL 70 +#define CHAR_JP_HIRA_YU 71 +#define CHAR_JP_HIRA_YO_SMALL 72 +#define CHAR_JP_HIRA_YO 73 +#define CHAR_JP_HIRA_RA 74 +#define CHAR_JP_HIRA_RI 75 +#define CHAR_JP_HIRA_RU 76 +#define CHAR_JP_HIRA_RE 77 +#define CHAR_JP_HIRA_RO 78 +#define CHAR_JP_HIRA_WA 79 +#define CHAR_JP_HIRA_WO 80 +#define CHAR_JP_HIRA_N_ 81 +#define CHAR_JP_KATA_A_SMALL 82 +#define CHAR_JP_KATA_A 83 +#define CHAR_JP_KATA_I_SMALL 84 +#define CHAR_JP_KATA_I 85 +#define CHAR_JP_KATA_U_SMALL 86 +#define CHAR_JP_KATA_U 87 +#define CHAR_JP_KATA_E_SMALL 88 +#define CHAR_JP_KATA_E 89 +#define CHAR_JP_KATA_O_SMALL 90 +#define CHAR_JP_KATA_O 91 +#define CHAR_JP_KATA_KA 92 +#define CHAR_JP_KATA_GA 93 +#define CHAR_JP_KATA_KI 94 +#define CHAR_JP_KATA_GI 95 +#define CHAR_JP_KATA_KU 96 +#define CHAR_JP_KATA_GU 97 +#define CHAR_JP_KATA_KE 98 +#define CHAR_JP_KATA_GE 99 +#define CHAR_JP_KATA_KO 100 +#define CHAR_JP_KATA_GO 101 +#define CHAR_JP_KATA_SA 102 +#define CHAR_JP_KATA_ZA 103 +#define CHAR_JP_KATA_SI 104 +#define CHAR_JP_KATA_ZI 105 +#define CHAR_JP_KATA_SU 106 +#define CHAR_JP_KATA_ZU 107 +#define CHAR_JP_KATA_SE 108 +#define CHAR_JP_KATA_ZE 109 +#define CHAR_JP_KATA_SO 110 +#define CHAR_JP_KATA_ZO 111 +#define CHAR_JP_KATA_TA 112 +#define CHAR_JP_KATA_DA 113 +#define CHAR_JP_KATA_TI 114 +#define CHAR_JP_KATA_DI 115 +#define CHAR_JP_KATA_TU_SMALL 116 +#define CHAR_JP_KATA_TU 117 +#define CHAR_JP_KATA_DU 118 +#define CHAR_JP_KATA_TE 119 +#define CHAR_JP_KATA_DE 120 +#define CHAR_JP_KATA_TO 121 +#define CHAR_JP_KATA_DO 122 +#define CHAR_JP_KATA_NA 123 +#define CHAR_JP_KATA_NI 124 +#define CHAR_JP_KATA_NU 125 +#define CHAR_JP_KATA_NE 126 +#define CHAR_JP_KATA_NO 127 +#define CHAR_JP_KATA_HA 128 +#define CHAR_JP_KATA_BA 129 +#define CHAR_JP_KATA_PA 130 +#define CHAR_JP_KATA_HI 131 +#define CHAR_JP_KATA_BI 132 +#define CHAR_JP_KATA_PI 133 +#define CHAR_JP_KATA_HU 134 +#define CHAR_JP_KATA_BU 135 +#define CHAR_JP_KATA_PU 136 +#define CHAR_JP_KATA_HE 137 +#define CHAR_JP_KATA_BE 138 +#define CHAR_JP_KATA_PE 139 +#define CHAR_JP_KATA_HO 140 +#define CHAR_JP_KATA_BO 141 +#define CHAR_JP_KATA_PO 142 +#define CHAR_JP_KATA_MA 143 +#define CHAR_JP_KATA_MI 144 +#define CHAR_JP_KATA_MU 145 +#define CHAR_JP_KATA_ME 146 +#define CHAR_JP_KATA_MO 147 +#define CHAR_JP_KATA_YA_SMALL 148 +#define CHAR_JP_KATA_YA 149 +#define CHAR_JP_KATA_YU_SMALL 150 +#define CHAR_JP_KATA_YU 151 +#define CHAR_JP_KATA_YO_SMALL 152 +#define CHAR_JP_KATA_YO 153 +#define CHAR_JP_KATA_RA 154 +#define CHAR_JP_KATA_RI 155 +#define CHAR_JP_KATA_RU 156 +#define CHAR_JP_KATA_RE 157 +#define CHAR_JP_KATA_RO 158 +#define CHAR_JP_KATA_WA 159 +#define CHAR_JP_KATA_WO 160 +#define CHAR_JP_KATA_N_ 161 +#define CHAR_JP_0 162 +#define CHAR_JP_1 163 +#define CHAR_JP_2 164 +#define CHAR_JP_3 165 +#define CHAR_JP_4 166 +#define CHAR_JP_5 167 +#define CHAR_JP_6 168 +#define CHAR_JP_7 169 +#define CHAR_JP_8 170 +#define CHAR_JP_9 171 +#define CHAR_JP_A 172 +#define CHAR_JP_B 173 +#define CHAR_JP_C 174 +#define CHAR_JP_D 175 +#define CHAR_JP_E 176 +#define CHAR_JP_F 177 +#define CHAR_JP_G 178 +#define CHAR_JP_H 179 +#define CHAR_JP_I 180 +#define CHAR_JP_J 181 +#define CHAR_JP_K 182 +#define CHAR_JP_L 183 +#define CHAR_JP_M 184 +#define CHAR_JP_N 185 +#define CHAR_JP_O 186 +#define CHAR_JP_P 187 +#define CHAR_JP_Q 188 +#define CHAR_JP_R 189 +#define CHAR_JP_S 190 +#define CHAR_JP_T 191 +#define CHAR_JP_U 192 +#define CHAR_JP_V 193 +#define CHAR_JP_W 194 +#define CHAR_JP_X 195 +#define CHAR_JP_Y 196 +#define CHAR_JP_Z 197 +#define CHAR_JP_a 198 +#define CHAR_JP_b 199 +#define CHAR_JP_c 200 +#define CHAR_JP_d 201 +#define CHAR_JP_e 202 +#define CHAR_JP_f 203 +#define CHAR_JP_g 204 +#define CHAR_JP_h 205 +#define CHAR_JP_i 206 +#define CHAR_JP_j 207 +#define CHAR_JP_k 208 +#define CHAR_JP_l 209 +#define CHAR_JP_m 210 +#define CHAR_JP_n 211 +#define CHAR_JP_o 212 +#define CHAR_JP_p 213 +#define CHAR_JP_q 214 +#define CHAR_JP_r 215 +#define CHAR_JP_s 216 +#define CHAR_JP_t 217 +#define CHAR_JP_u 218 +#define CHAR_JP_v 219 +#define CHAR_JP_w 220 +#define CHAR_JP_x 221 +#define CHAR_JP_y 222 +#define CHAR_JP_z 223 +#define CHAR_INVALID_E0 224 +#define CHAR_JP_EXCLAM_MARK 225 +#define CHAR_JP_QUESTION_MARK 226 +#define CHAR_JP_COMMA 227 +#define CHAR_JP_FULLSTOP 228 +#define CHAR_JP_ELLIPSIS 229 +#define CHAR_JP_CENTER_DOT 230 +#define CHAR_JP_SLASH 231 +#define CHAR_JP_OPEN_QUOT 232 +#define CHAR_JP_CLOSE_QUOT 233 +#define CHAR_JP_OPEN_DQUOT 234 +#define CHAR_JP_CLOSE_DQUOT 235 +#define CHAR_JP_OPEN_PAREN 236 +#define CHAR_JP_CLOSE_PAREN 237 +#define CHAR_JP_OTOKO 238 +#define CHAR_JP_ONNA 239 +#define CHAR_JP_PLUS 240 +#define CHAR_JP_HYPHEN 241 +#define CHAR_JP_MULT 242 +#define CHAR_JP_DIV 243 +#define CHAR_JP_EQUAL 244 +#define CHAR_JP_TILDE 245 +#define CHAR_JP_HW_COLON 246 +#define CHAR_JP_HW_SEMICOLON 247 +#define CHAR_JP_HW_PERIOD 248 +#define CHAR_JP_HW_COMMA 249 +#define CHAR_JP_SPADE_SUIT 250 +#define CHAR_JP_CLUB_SUIT 251 +#define CHAR_JP_HEART_SUIT 252 +#define CHAR_JP_DIAMOND_SUIT 253 +#define CHAR_JP_STAR 254 +#define CHAR_JP_CIRCLE_DOT 255 +#define CHAR_JP_CIRCLE 256 +#define CHAR_JP_SQUARE 257 +#define CHAR_JP_TRIANGLE 258 +#define CHAR_JP_DIAMOND 259 +#define CHAR_JP_AT 260 +#define CHAR_JP_MUSIC_NOTE 261 +#define CHAR_JP_PERCENT 262 +#define CHAR_JP_SUN 263 +#define CHAR_JP_TREBLE_CLEF 264 +#define CHAR_JP_UMBRELLA 265 +#define CHAR_JP_SNOWMAN 266 +#define CHAR_JP_SMILEY 267 +#define CHAR_JP_LAUGHING 268 +#define CHAR_JP_ANGUISH 269 +#define CHAR_JP_ANGRY 270 +#define CHAR_JP_UP_ARROW 271 +#define CHAR_JP_DOWN_ARROW 272 +#define CHAR_JP_SNORING 273 +#define CHAR_JP_YEN 274 +#define CHAR_JP_ITEMS 275 +#define CHAR_JP_KEY_ITEMS 276 +#define CHAR_JP_TMHM 277 +#define CHAR_JP_MAIL 278 +#define CHAR_JP_MEDICINE 279 +#define CHAR_JP_BERRIES 280 +#define CHAR_JP_BALLS 281 +#define CHAR_JP_BATTLE_ITEMS 282 +#define CHAR_JP_DIR_LEFT 283 +#define CHAR_JP_DIR_UP 284 +#define CHAR_JP_DIR_DOWN 285 +#define CHAR_JP_DIR_RIGHT 286 +#define CHAR_JP_CONTINUE_ARROW 287 +#define CHAR_JP_AMPERSAND 288 +#define CHAR_0 289 +#define CHAR_1 290 +#define CHAR_2 291 +#define CHAR_3 292 +#define CHAR_4 293 +#define CHAR_5 294 +#define CHAR_6 295 +#define CHAR_7 296 +#define CHAR_8 297 +#define CHAR_9 298 +#define CHAR_A 299 +#define CHAR_B 300 +#define CHAR_C 301 +#define CHAR_D 302 +#define CHAR_E 303 +#define CHAR_F 304 +#define CHAR_G 305 +#define CHAR_H 306 +#define CHAR_I 307 +#define CHAR_J 308 +#define CHAR_K 309 +#define CHAR_L 310 +#define CHAR_M 311 +#define CHAR_N 312 +#define CHAR_O 313 +#define CHAR_P 314 +#define CHAR_Q 315 +#define CHAR_R 316 +#define CHAR_S 317 +#define CHAR_T 318 +#define CHAR_U 319 +#define CHAR_V 320 +#define CHAR_W 321 +#define CHAR_X 322 +#define CHAR_Y 323 +#define CHAR_Z 324 +#define CHAR_a 325 +#define CHAR_b 326 +#define CHAR_c 327 +#define CHAR_d 328 +#define CHAR_e 329 +#define CHAR_f 330 +#define CHAR_g 331 +#define CHAR_h 332 +#define CHAR_i 333 +#define CHAR_j 334 +#define CHAR_k 335 +#define CHAR_l 336 +#define CHAR_m 337 +#define CHAR_n 338 +#define CHAR_o 339 +#define CHAR_p 340 +#define CHAR_q 341 +#define CHAR_r 342 +#define CHAR_s 343 +#define CHAR_t 344 +#define CHAR_u 345 +#define CHAR_v 346 +#define CHAR_w 347 +#define CHAR_x 348 +#define CHAR_y 349 +#define CHAR_z 350 +#define CHAR_Agrave 351 +#define CHAR_Aacute 352 +#define CHAR_Acarat 353 +#define CHAR_Atilde 354 +#define CHAR_Aumlaut 355 +#define CHAR_Aring 356 +#define CHAR_AE 357 +#define CHAR_Ccedilla 358 +#define CHAR_Egrave 359 +#define CHAR_Eacute 360 +#define CHAR_Ecarat 361 +#define CHAR_Eumlaut 362 +#define CHAR_Igrave 363 +#define CHAR_Iacute 364 +#define CHAR_Icarat 365 +#define CHAR_Iumlaut 366 +#define CHAR_ETH 367 +#define CHAR_Ntilde 368 +#define CHAR_Ograve 369 +#define CHAR_Oacute 370 +#define CHAR_Ocarat 371 +#define CHAR_Otilde 372 +#define CHAR_Oumlaut 373 +#define CHAR_MULT 374 +#define CHAR_Oslash 375 +#define CHAR_Ugrave 376 +#define CHAR_Uacute 377 +#define CHAR_Ucarat 378 +#define CHAR_Uumlaut 379 +#define CHAR_Yacute 380 +#define CHAR_THORN 381 +#define CHAR_ESZETT 382 +#define CHAR_agrave 383 +#define CHAR_aacute 384 +#define CHAR_acarat 385 +#define CHAR_atilde 386 +#define CHAR_aumlaut 387 +#define CHAR_aring 388 +#define CHAR_ae 389 +#define CHAR_ccedilla 390 +#define CHAR_egrave 391 +#define CHAR_eacute 392 +#define CHAR_ecarat 393 +#define CHAR_eumlaut 394 +#define CHAR_igrave 395 +#define CHAR_iacute 396 +#define CHAR_icarat 397 +#define CHAR_iumlaut 398 +#define CHAR_eth 399 +#define CHAR_ntilde 400 +#define CHAR_ograve 401 +#define CHAR_oacute 402 +#define CHAR_ocarat 403 +#define CHAR_otilde 404 +#define CHAR_oumlaut 405 +#define CHAR_div 406 +#define CHAR_oslash 407 +#define CHAR_ugrave 408 +#define CHAR_uacute 409 +#define CHAR_ucarat 410 +#define CHAR_uumlaut 411 +#define CHAR_yacute 412 +#define CHAR_thorm 413 +#define CHAR_eszett 414 +#define CHAR_OE 415 +#define CHAR_oe 416 +#define CHAR_Scedilla 417 +#define CHAR_scedilla 418 +#define CHAR_super_a 419 // latin f ordinal +#define CHAR_super_o 420 // latin m ordinal +#define CHAR_super_er 421 +#define CHAR_super_re 422 +#define CHAR_super_r 423 +#define CHAR_POKEMONEY 424 +#define CHAR_UPSIDEDOWN_EXCL 425 +#define CHAR_UPSIDEDOWN_QMARK 426 +#define CHAR_EXCL 427 +#define CHAR_QMARK 428 +#define CHAR_COMMA 429 +#define CHAR_PERIOD 430 +#define CHAR_ELLIPSIS 431 +#define CHAR_CTRDOT 432 +#define CHAR_SLASH 433 +#define CHAR_LAPOST 434 // left single quote +#define CHAR_RAPOST 435 // right single quote (apostrophe) +#define CHAR_LDQUOT 436 // left double quote +#define CHAR_RDQUOT 437 // right double quote +#define CHAR_LOW_RDQUOT 438 +#define CHAR_FR_LQUOT 439 +#define CHAR_FR_RQUOT 440 +#define CHAR_LPAREN 441 +#define CHAR_RPAREN 442 +#define CHAR_MALE 443 +#define CHAR_FEMALE 444 +#define CHAR_PLUS 445 +#define CHAR_HYPHEN 446 +#define CHAR_ASTERISK 447 +#define CHAR_HASH 448 +#define CHAR_EQUALS 449 +#define CHAR_AMPERSAND 450 +#define CHAR_TILDE 451 +#define CHAR_COLON 452 +#define CHAR_SEMICOLON 453 +#define CHAR_SPADE_SUIT 454 +#define CHAR_CLUB_SUIT 455 +#define CHAR_HEART_SUIT 456 +#define CHAR_DIAMOND_SUIT 457 +#define CHAR_STAR 458 +#define CHAR_CIRCLE_DOT 459 +#define CHAR_CIRCLE 460 +#define CHAR_SQUARE 461 +#define CHAR_TRIANGLE 462 +#define CHAR_DIAMOND 463 +#define CHAR_AT 464 +#define CHAR_MUSIC_NOTE 465 +#define CHAR_PERCENT 466 +#define CHAR_SUN 467 +#define CHAR_TREBLE_CLEF 468 +#define CHAR_UMBRELLA 469 +#define CHAR_SNOWMAN 470 +#define CHAR_SMILEY 471 +#define CHAR_LAUGHING 472 +#define CHAR_ANGUISH 473 +#define CHAR_ANGRY 474 +#define CHAR_UP_ARROW 475 +#define CHAR_DOWN_ARROW 476 +#define CHAR_SNORING 477 +#define CHAR_SPACE 478 +#define CHAR_super_e 479 +#define CHAR_PK 480 +#define CHAR_MN 481 +#define CHAR_NARROW_SPACE 482 +#define CHAR_FILL1PX 483 +#define CHAR_FILL2PX 484 +#define CHAR_FILL4PX 485 +#define CHAR_FILL8PX 486 +#define CHAR_FILL16PX 487 +#define CHAR_DEGREE 488 +#define CHAR_UNDERSCORE 489 +#define CHAR_UNDERSCORE2 490 +#define CHAR_ONE_DOT 491 +#define CHAR_TWO_DOTS 492 #define CHAR_LF 0xE000 #define TRNAMECODE 0xF100 diff --git a/include/filesystem_files_def.h b/include/filesystem_files_def.h index 8a182e6c61..2d0814ccbf 100644 --- a/include/filesystem_files_def.h +++ b/include/filesystem_files_def.h @@ -35,7 +35,7 @@ typedef enum NarcId { NARC_a_0_2_8 = 28, NARC_a_0_2_9 = 29, NARC_a_0_3_0 = 30, - NARC_a_0_3_1 = 31, + NARC_data_namein = 31, NARC_fielddata_eventdata_zone_event = 32, NARC_poketool_personal_wotbl = 33, NARC_poketool_personal_evo = 34, diff --git a/include/gf_gfx_planes.h b/include/gf_gfx_planes.h index ce1e21ec2f..df03d5e1fc 100644 --- a/include/gf_gfx_planes.h +++ b/include/gf_gfx_planes.h @@ -1,8 +1,7 @@ #ifndef POKEHEARTGOLD_GF_GFX_PLANES_H #define POKEHEARTGOLD_GF_GFX_PLANES_H -#include -#include +#include "system.h" typedef enum { GF_PLANE_TOGGLE_OFF, @@ -51,13 +50,18 @@ typedef struct GraphicsBanks { void GfGfx_SetBanks(const GraphicsBanks *banks); void GfGfx_DisableEngineAPlanes(void); -void GfGfx_EngineATogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable); +void GfGfx_EngineATogglePlanes(u8 planeMask, u8 enable); void GfGfx_EngineASetPlanes(u32 planes); void GfGfx_DisableEngineBPlanes(void); -void GfGfx_EngineBTogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable); +void GfGfx_EngineBTogglePlanes(u8 planeMask, u8 enable); void GfGfx_EngineBSetPlanes(u32 planes); void GfGfx_BothDispOn(void); void GfGfx_SwapDisplay(void); u32 GfGfx_EngineAGetPlanes(void); +static inline void GfGfx_SetMainDisplay(PMLCDTarget screen) { + gSystem.screensFlipped = (BOOL)screen; + GfGfx_SwapDisplay(); +} + #endif // POKEHEARTGOLD_GF_GFX_PLANES_H diff --git a/include/heap.h b/include/heap.h index 3a02d0628d..1e3fb71b5c 100644 --- a/include/heap.h +++ b/include/heap.h @@ -17,6 +17,7 @@ typedef enum HeapID { HEAP_ID_10, HEAP_ID_FIELD, HEAP_ID_PARTY_MENU, + HEAP_ID_NAMING_SCREEN = 18, HEAP_ID_20 = 20, HEAP_ID_26 = 26, HEAP_ID_TITLE_SCREEN = 30, diff --git a/include/launch_application_internal.h b/include/launch_application_internal.h index 3efca28912..dca2eaaaf2 100644 --- a/include/launch_application_internal.h +++ b/include/launch_application_internal.h @@ -2,8 +2,8 @@ #define POKEHEARTGOLD_FIELD_LAUNCH_APPLICATION_INTERNAL_H #include "launch_application.h" +#include "naming_screen.h" #include "unk_0202C034.h" -#include "unk_02082908.h" typedef enum PartyMenuMoveSelectState { PMMS_OPEN_PARTY_MENU, diff --git a/include/naming_screen.h b/include/naming_screen.h new file mode 100644 index 0000000000..d2bd4f29cd --- /dev/null +++ b/include/naming_screen.h @@ -0,0 +1,29 @@ +#ifndef POKEHEARTGOLD_NAMING_SCREEN_H +#define POKEHEARTGOLD_NAMING_SCREEN_H + +#include "launch_application.h" +#include "options.h" +#include "overlay_manager.h" +#include "pm_string.h" + +extern const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen; + +typedef struct NamingScreenArgs { + NameScreenType kind; + int playerGenderOrMonSpecies; // monSpecies + int monForm; + int maxLen; + int monGender; + BOOL noInput; + String *nameInputString; + u16 nameInputFlat[20]; + int battleMsgId; + PCStorage *pcStorage; + Options *options; + BOOL *pMenuInputState; +} NamingScreenArgs; + +NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, BOOL *pMenuInputState); +void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs); + +#endif // POKEHEARTGOLD_NAMING_SCREEN_H diff --git a/include/oaks_speech.h b/include/oaks_speech.h index 98e5bb63ce..d8447c3c2a 100644 --- a/include/oaks_speech.h +++ b/include/oaks_speech.h @@ -2,11 +2,11 @@ #define GUARD_POKEHEARTGOLD_OAKS_SPEECH_H #include "bg_window.h" +#include "naming_screen.h" #include "options.h" #include "overlay_manager.h" #include "save.h" #include "unk_0200CF18.h" -#include "unk_02082908.h" BOOL OakSpeech_Init(OVY_MANAGER *ovyMan, int *pState); BOOL OakSpeech_Main(OVY_MANAGER *ovyMan, int *pState); diff --git a/include/oaks_speech_internal.h b/include/oaks_speech_internal.h index 7e483a2000..8b0bf6756b 100644 --- a/include/oaks_speech_internal.h +++ b/include/oaks_speech_internal.h @@ -3,11 +3,11 @@ #include "bg_window.h" #include "msgdata.h" +#include "naming_screen.h" #include "options.h" #include "overlay_manager.h" #include "unk_0200CF18.h" #include "unk_020163E0.h" -#include "unk_02082908.h" #define GENDER_CURSOR_MALE 0 #define GENDER_CURSOR_FEMALE 1 diff --git a/include/sprite.h b/include/sprite.h index 64a8a1fed5..a683c69d7f 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -147,7 +147,7 @@ int Sprite_GetPalIndex(Sprite *sprite); void Sprite_SetPalOffset(Sprite *sprite, u8 offset); void Sprite_SetPalOffsetRespectVramOffset(Sprite *sprite, u8 offset); u8 Sprite_GetPalOffset(Sprite *sprite); -void Sprite_SetDrawPriority(Sprite *sprite, u16 priority); +void Sprite_SetDrawPriority(Sprite *sprite, u32 priority); u16 Sprite_GetDrawPriority(Sprite *sprite); void Sprite_SetImageProxy(Sprite *sprite, NNSG2dImageProxy *proxy); NNSG2dImageProxy *Sprite_GetImageProxy(Sprite *sprite); diff --git a/include/unk_02013534.h b/include/unk_02013534.h index 509bf126c9..7cd6592747 100644 --- a/include/unk_02013534.h +++ b/include/unk_02013534.h @@ -1,8 +1,10 @@ #ifndef POKEHEARTGOLD_UNK_02013534_H #define POKEHEARTGOLD_UNK_02013534_H +#include "bg_window.h" #include "heap.h" void *sub_02013534(int, HeapID); +void sub_02013A50(Window *window, int a1, int a2, int a3, int a4, void *a5); #endif // POKEHEARTGOLD_UNK_02013534_H diff --git a/include/unk_02082908.h b/include/unk_02082908.h deleted file mode 100644 index 77d369c1fc..0000000000 --- a/include/unk_02082908.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef POKEHEARTGOLD_UNK_02082908_H -#define POKEHEARTGOLD_UNK_02082908_H - -#include "options.h" -#include "overlay_manager.h" -#include "pm_string.h" - -extern const OVY_MGR_TEMPLATE sOverlayTemplate_NamingScreen; - -typedef struct NamingScreenArgs { - int kind; - int playerGender; - int monForm; - u8 unkC[0x4]; - int monGender; - int unk14; - String *nameInputString; - u16 unk1C[PLAYER_NAME_LENGTH + 1]; -} NamingScreenArgs; - -void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs); -NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, int kind, int param, int maxLen, Options *options, int *a5); - -#endif // POKEHEARTGOLD_UNK_02082908_H diff --git a/lib/include/nitro/gx/gx.h b/lib/include/nitro/gx/gx.h index e6e5802bca..ce4b7b7b0b 100644 --- a/lib/include/nitro/gx/gx.h +++ b/lib/include/nitro/gx/gx.h @@ -1,19 +1,19 @@ #ifndef NITRO_GX_GX_H_ #define NITRO_GX_GX_H_ -#include #include +#include #define GX_LCD_SIZE_X 256 #define GX_LCD_SIZE_Y 192 typedef enum { GX_DISPMODE_GRAPHICS = 0x01, - GX_DISPMODE_VRAM_A = 0x02, - GX_DISPMODE_VRAM_B = 0x06, - GX_DISPMODE_VRAM_C = 0x0a, - GX_DISPMODE_VRAM_D = 0x0e, - GX_DISPMODE_MMEM = 0x03 + GX_DISPMODE_VRAM_A = 0x02, + GX_DISPMODE_VRAM_B = 0x06, + GX_DISPMODE_VRAM_C = 0x0a, + GX_DISPMODE_VRAM_D = 0x0e, + GX_DISPMODE_MMEM = 0x03 } GXDispMode; typedef enum { @@ -54,22 +54,18 @@ typedef enum { } GXBGCharOffset; typedef enum { - GX_OBJVRAMMODE_CHAR_2D = (0 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_32K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_64K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (1 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_128K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (2 << REG_GX_DISPCNT_EXOBJ_SHIFT), - GX_OBJVRAMMODE_CHAR_1D_256K = - (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (3 << REG_GX_DISPCNT_EXOBJ_SHIFT) + GX_OBJVRAMMODE_CHAR_2D = (0 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_32K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (0 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_64K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (1 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_128K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (2 << REG_GX_DISPCNT_EXOBJ_SHIFT), + GX_OBJVRAMMODE_CHAR_1D_256K = (1 << REG_GX_DISPCNT_OBJMAP_SHIFT) | (3 << REG_GX_DISPCNT_EXOBJ_SHIFT) } GXOBJVRamModeChar; typedef enum { GX_POWER_OFF = 0, GX_POWER_2D_MAIN = 1 << REG_GX_POWCNT_E2DG_SHIFT, - GX_POWER_2D_SUB = 1 << REG_GX_POWCNT_E2DGB_SHIFT, + GX_POWER_2D_SUB = 1 << REG_GX_POWCNT_E2DGB_SHIFT, GX_POWER_RE = 1 << REG_GX_POWCNT_RE_SHIFT, GX_POWER_GE = 1 << REG_GX_POWCNT_GE_SHIFT, @@ -97,6 +93,13 @@ typedef enum { GX_PLANEMASK_ALL = GX_PLANEMASK_BG0 | GX_PLANEMASK_BG1 | GX_PLANEMASK_BG2 | GX_PLANEMASK_BG3 | GX_PLANEMASK_OBJ, } GXPlaneMask; +typedef enum { + GX_WNDMASK_NONE = 0x00, + GX_WNDMASK_W0 = 0x01, + GX_WNDMASK_W1 = 0x02, + GX_WNDMASK_OW = 0x04 +} GXWndMask; + void GX_SetGraphicsMode(GXDispMode dispMode, GXBGMode bgMode, GXBG0As bg0_2d3d); void GXS_SetGraphicsMode(GXBGMode bgMode); @@ -123,15 +126,12 @@ static inline void GX_SetVCountEqVal(s32 val) { reg_GX_DISPSTAT = (u16)(reg_GX_DISPSTAT & (REG_GX_DISPSTAT_VBLK_MASK | REG_GX_DISPSTAT_HBLK_MASK | REG_GX_DISPSTAT_LYC_MASK | REG_GX_DISPSTAT_VBI_MASK | REG_GX_DISPSTAT_HBI_MASK | REG_GX_DISPSTAT_VQI_MASK) | ((val & 0xFF) << 8) | ((val & 0x100) >> 1)); } -static inline void GX_SetBGScrOffset(GXBGScrOffset offset) -{ - reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGSCREENOFFSET_MASK) | - (offset << REG_GX_DISPCNT_BGSCREENOFFSET_SHIFT)); +static inline void GX_SetBGScrOffset(GXBGScrOffset offset) { + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGSCREENOFFSET_MASK) | (offset << REG_GX_DISPCNT_BGSCREENOFFSET_SHIFT)); } static inline void GX_SetBGCharOffset(GXBGCharOffset offset) { - reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGCHAROFFSET_MASK) | - (offset << REG_GX_DISPCNT_BGCHAROFFSET_SHIFT)); + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGCHAROFFSET_MASK) | (offset << REG_GX_DISPCNT_BGCHAROFFSET_SHIFT)); } s32 GX_VBlankIntr(BOOL enable); @@ -196,4 +196,4 @@ static inline int GXS_GetMasterBrightness(void) { return GXx_GetMasterBrightness_(®_GXS_DB_MASTER_BRIGHT); } -#endif //NITRO_GX_GX_H_ +#endif // NITRO_GX_GX_H_ diff --git a/main.lsf b/main.lsf index cd063f3a2b..a2f60bd267 100644 --- a/main.lsf +++ b/main.lsf @@ -273,7 +273,7 @@ Static main Object src/party_menu_sprites.o Object src/party_menu_list_items.o Object src/party_menu_items.o - Object asm/unk_02082908.o + Object src/naming_screen.o Object asm/unk_020850F4.o Object asm/unk_02085604.o Object asm/unk_020863F4.o diff --git a/src/bg_window.c b/src/bg_window.c index e7147034e4..80bea8596f 100644 --- a/src/bg_window.c +++ b/src/bg_window.c @@ -124,7 +124,7 @@ void SetScreenModeAndDisable(const struct GraphicsModes *gfxModes, enum GFScreen } } -void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, GFPlaneToggle enable) { +void InitBgFromTemplateEx(BgConfig *bgConfig, u8 bgId, const BgTemplate *template, u8 bgType, u8 enable) { u8 screenSize = TranslateGFBgModePairToGXScreenSize((enum GFBgScreenSize) template->size, (enum GFBgType)bgType); switch (bgId) { @@ -624,7 +624,7 @@ void SetBgPriority(u8 bgId, u16 priority) { } } -void ToggleBgLayer(u8 bgId, GFPlaneToggle toggle) { +void ToggleBgLayer(u8 bgId, u8 toggle) { switch (bgId) { case GF_BG_LYR_MAIN_0: GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, toggle); diff --git a/src/communication_error.c b/src/communication_error.c index 16fc8e1457..74c8582408 100644 --- a/src/communication_error.c +++ b/src/communication_error.c @@ -148,7 +148,7 @@ void ShowCommunicationError(HeapID heapId, u32 error, u32 errorCode) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sCommunicationErrorGraphicsBanks); diff --git a/src/error_message_reset.c b/src/error_message_reset.c index 65f9f0396e..042d984eb7 100644 --- a/src/error_message_reset.c +++ b/src/error_message_reset.c @@ -116,7 +116,7 @@ void PrintErrorMessageAndReset(void) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sErrorMessageBanksConfig); diff --git a/src/gf_gfx_planes.c b/src/gf_gfx_planes.c index cb1c0f07f3..ff73cad70c 100644 --- a/src/gf_gfx_planes.c +++ b/src/gf_gfx_planes.c @@ -36,7 +36,7 @@ void GfGfx_DisableEngineAPlanes(void) { sEngineAPlanes = 0; } -void GfGfx_EngineATogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable) { +void GfGfx_EngineATogglePlanes(u8 planeMask, u8 enable) { if (enable == GF_PLANE_TOGGLE_ON) { if (sEngineAPlanes & planeMask) { return; @@ -59,7 +59,7 @@ void GfGfx_DisableEngineBPlanes(void) { sEngineBPlanes = 0; } -void GfGfx_EngineBTogglePlanes(GXPlaneMask planeMask, GFPlaneToggle enable) { +void GfGfx_EngineBTogglePlanes(u8 planeMask, u8 enable) { if (enable == GF_PLANE_TOGGLE_ON) { if (sEngineBPlanes & planeMask) { return; diff --git a/src/intro_movie.c b/src/intro_movie.c index 0aba237836..c0d199a00b 100644 --- a/src/intro_movie.c +++ b/src/intro_movie.c @@ -154,7 +154,7 @@ static BOOL IntroMovie_Exit(OVY_MANAGER *man, int *state) { Main_SetHBlankIntrCB(NULL, NULL); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); sub_0200FB70(); SetLCRNGSeed(data->savedLCRngSeed); diff --git a/src/intro_movie_scene_3.c b/src/intro_movie_scene_3.c index 004f26228e..886c68caad 100644 --- a/src/intro_movie_scene_3.c +++ b/src/intro_movie_scene_3.c @@ -336,7 +336,7 @@ static BOOL IntroMovie_Scene3_Main(IntroMovieOverlayData *data, IntroMovieScene3 break; case INTRO_SCENE3_LOAD_ROCKETS: if (IntroMovie_WaitBgScrollAnim(bgAnimCnt->scroll, GF_BG_LYR_SUB_2)) { - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfxLoader_LoadCharData(NARC_demo_opening_gs_opening, NARC_gs_opening_gs_opening_00000041_NCGR_lz, bgConfig, GF_BG_LYR_SUB_3, 0, 0x4000, TRUE, HEAP_ID_INTRO_MOVIE); IntroMovie_AdvanceSceneStep(data); diff --git a/src/intro_movie_scene_4.c b/src/intro_movie_scene_4.c index add9aa550b..d4261877ad 100644 --- a/src/intro_movie_scene_4.c +++ b/src/intro_movie_scene_4.c @@ -189,7 +189,7 @@ static BOOL IntroMovie_Scene4_Main(IntroMovieOverlayData *data, IntroMovieScene4 IntroMovie_StartSpriteAnimAndMakeVisible(sceneData->hand2Sprite, FALSE); GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF); GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); IntroMovie_AdvanceSceneStep(data); } diff --git a/src/intro_movie_scenes_lib.c b/src/intro_movie_scenes_lib.c index c301dc19b5..2cae0c5ac1 100644 --- a/src/intro_movie_scenes_lib.c +++ b/src/intro_movie_scenes_lib.c @@ -325,7 +325,7 @@ void Task_IntroMovie_WindowPanEffect(SysTask *task, void *pVoid) { void IntroMovie_WindowsOn_SetInsideOutsidePlanes(int winIn, int winOut, u8 topScreenEffect, u8 bottomScreenEffect, int whichScreen) { if (whichScreen) { - GX_SetVisibleWnd(3); // both + GX_SetVisibleWnd(GX_WNDMASK_W0 | GX_WNDMASK_W1); G2_SetWnd0InsidePlane(winIn, topScreenEffect); G2_SetWnd1InsidePlane(winIn, topScreenEffect); G2_SetWndOutsidePlane(winOut, topScreenEffect); @@ -374,7 +374,7 @@ int IntroMovie_GetTotalFrameCount(IntroMovieOverlayData *data) { void IntroMovie_InitBgAnimGxState(IntroMovieOverlayData *data) { G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); for (int i = 0; i < 8; ++i) { BgSetPosTextAndCommit(data->bgConfig, i, BG_POS_OP_SET_X, 0); @@ -456,7 +456,7 @@ void Task_IntroMovie_CircleWipeEffect(SysTask *task, void *pVoid) { sub_0200FBF4(screen, RGB_BLACK); } else { if (effectData->whichScreen) { - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); } else { GXS_SetVisibleWnd(0); } diff --git a/src/launch_application.c b/src/launch_application.c index c0aede6ab9..c205c7e0eb 100644 --- a/src/launch_application.c +++ b/src/launch_application.c @@ -19,6 +19,7 @@ #include "get_egg.h" #include "launch_application_internal.h" #include "mail_misc.h" +#include "naming_screen.h" #include "overlay_02.h" #include "overlay_100.h" #include "overlay_101.h" @@ -80,7 +81,6 @@ #include "unk_0205A44C.h" #include "unk_0206D494.h" #include "unk_020755E8.h" -#include "unk_02082908.h" #include "unk_02087A78.h" #include "unk_02088288.h" #include "unk_020910D8.h" @@ -1036,7 +1036,7 @@ static BOOL Task_NamingScreen(TaskManager *taskman) { data->state++; break; case 1: - CallApplicationAsTask(taskman, &sOverlayTemplate_NamingScreen, data->args); + CallApplicationAsTask(taskman, &gOverlayTemplate_NamingScreen, data->args); data->state++; break; case 2: @@ -1047,21 +1047,21 @@ static BOOL Task_NamingScreen(TaskManager *taskman) { NamingScreenArgs *args = data->args; if (args->kind == 1) { if (String_Compare(args->nameInputString, data->unk10) == 0) { - data->args->unk14 = 1; + data->args->noInput = 1; } } else if (args->kind == 5) { u16 *var2 = String_cstr(args->nameInputString); SAV_FRIEND_GRP *friendGroup = Save_FriendGroup_Get(fieldSystem->saveData); if (sub_0202C88C(friendGroup, var2)) { - data->args->unk14 = 2; + data->args->noInput = 2; } } - if (data->args->unk14 == 0) { + if (data->args->noInput == 0) { SetName(taskman); } u16 *retVar = data->retVar; if (data->retVar != NULL) { - *retVar = data->args->unk14; + *retVar = data->args->noInput; } NamingScreen_DeleteArgs(data->args); String_Delete(data->unk10); @@ -1077,7 +1077,7 @@ static void SetName(TaskManager *taskman) { switch (data->args->kind) { case NAME_SCREEN_PLAYER: PlayerProfile *profile = Save_PlayerData_GetProfileAddr(fieldSystem->saveData); - Save_Profile_PlayerName_Set(profile, data->args->unk1C); + Save_Profile_PlayerName_Set(profile, data->args->nameInputFlat); break; case NAME_SCREEN_RIVAL: SAVE_MISC_DATA *miscData = Save_Misc_Get(fieldSystem->saveData); @@ -1091,7 +1091,7 @@ static void SetName(TaskManager *taskman) { } else { mon = Party_GetMonByIndex(SaveArray_Party_Get(fieldSystem->saveData), data->partyIdx); } - SetMonData(mon, MON_DATA_NICKNAME_FLAT_COMPARE, data->args->unk1C); + SetMonData(mon, MON_DATA_NICKNAME_FLAT_COMPARE, data->args->nameInputFlat); break; case NAME_SCREEN_GROUP: SAV_FRIEND_GRP *friendGroup = Save_FriendGroup_Get(fieldSystem->saveData); diff --git a/src/naming_screen.c b/src/naming_screen.c new file mode 100644 index 0000000000..016bacb7d0 --- /dev/null +++ b/src/naming_screen.c @@ -0,0 +1,2029 @@ +#include "naming_screen.h" + +#include "global.h" + +#include "data/namein.naix" +#include "msgdata/msg.naix" +#include "msgdata/msg/msg_0197.h" +#include "msgdata/msg/msg_0249.h" +#include "msgdata/msg/msg_0254.h" + +#include "bg_window.h" +#include "filesystem.h" +#include "font.h" +#include "gf_gfx_loader.h" +#include "gf_gfx_planes.h" +#include "launch_application.h" +#include "math_util.h" +#include "message_format.h" +#include "msgdata.h" +#include "obj_char_transfer.h" +#include "obj_pltt_transfer.h" +#include "pokemon_icon_idx.h" +#include "sound_02004A44.h" +#include "systask_environment.h" +#include "system.h" +#include "text.h" +#include "unk_02005D10.h" +#include "unk_0200ACF0.h" +#include "unk_0200B150.h" +#include "unk_0200FA24.h" +#include "unk_02013534.h" +#include "unk_020163E0.h" +#include "unk_020183F0.h" +#include "vram_transfer_manager.h" + +#define NAME_SCREEN_CONTROL_DAKU 0xD001 // unused +#define NAME_SCREEN_CONTROL_HANDAKU 0xD002 // unused +#define NAME_SCREEN_CONTROL_SPACE 0xD003 // unused +#define NAME_SCREEN_CONTROL_SKIP 0xD004 // unused but because it's greyed out +#define NAME_SCREEN_BUTTON_START 0xE001 +#define NAME_SCREEN_BUTTON_PAGE_UPPER 0xE002 +#define NAME_SCREEN_BUTTON_PAGE_LOWER 0xE003 +#define NAME_SCREEN_BUTTON_PAGE_SYMBOLS 0xE004 +#define NAME_SCREEN_BUTTON_PAGE_JP_UNUSED 0xE005 +#define NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2 0xE006 +#define NAME_SCREEN_BUTTON_BACK 0xE007 +#define NAME_SCREEN_BUTTON_OK 0xE008 + +typedef enum NamingScreenInitState { + NS_INIT_STATE_LOAD_GFX, + NS_INIT_STATE_LOAD_MON_ICON, +} NamingScreenInitState; + +typedef enum NamingScreenMainState { + NS_MAIN_STATE_WAIT_FADE_IN, + NS_MAIN_STATE_FINISH_INIT, + NS_MAIN_STATE_INPUT_LOOP, + NS_MAIN_STATE_WAIT_FADE_OUT, +} NamingScreenMainState; + +typedef enum NamingScreenPageSwitchState { + NS_PAGESWITCH_STATE_DRAW_NEW_PAGE, + NS_PAGESWITCH_STATE_SET_INIT_POS, + NS_PAGESWITCH_STATE_MOVE_BGS, + NS_PAGESWITCH_STATE_FINISH_BGS, + NS_PAGESWITCH_STATE_IDLE, + NS_PAGESWITCH_STATE_PRINT_BATTLE_MESSAGE, + NS_PAGESWITCH_STATE_WAIT_BATTLE_MESSAGE, + NS_PAGESWITCH_STATE_DELAY_AND_FADE_OUT, +} NamingScreenPageSwitchState; + +typedef struct NamingScreenCursor { + int x; + int y; + int prevX; + int prevY; + int deltaX; + BOOL showCursor; // always TRUE + BOOL ignoreInput; +} NamingScreenCursor; + +typedef struct NamingScreenAppData { + NameScreenType type; + int playerGenderOrMonSpecies; + int monForm; + int maxLen; + int monGender; + BOOL printedFromBattleGMM; // logic that makes this TRUE is unreachable + Options *options; + NamingScreenCursor kbCursor; + u16 plttGlowEffectAngle; + u16 keyboard[6][13]; + u8 filler_0D6[2]; + u16 entryBuf[0x20]; + u16 entryBufBak[0x20]; + u16 textCursorPos; + u16 tmpBuf[3]; + BgConfig *bgConfig; // 0x160 + BOOL unk_164; // unused + MessageFormat *msgFormat; // 0x168 + MsgData *msgData_249; // 0x16C + MsgData *msgData_254; // 0x170 + MsgData *msgData_197; // 0x174 + String *promptString; + String *unkJapaneseString; + String *battleMsgString; + String *unk_184; // set to a message that was not localized + SpriteList *spriteList; + GF_G2dRenderer g2dRender; + GF_2DGfxResMan *gfxResMen[4]; + GF_2DGfxResObj *gfxResObjs[2][4]; + SpriteResourcesHeader spriteResHdr_Main; + SpriteResourcesHeader spriteResHdr_Sub; + Sprite *uiSprites[14]; + Sprite *textEntrySprites[12]; + Sprite *iconSprites[2]; + SysTask *tasks[7]; + Window windows[10]; + int battleMessageTextPrinterId; + int pageSwitchState; + int pageNum; + GFBgLayer activeKeyboardBgId; // alternates between main 0/1 + VecFx32 bgPosVecs[2]; + int unk_480; // unused + int unk_484; // set but never used + int unk_488; // set but never used + int unk_48C; // set but never used + BOOL spriteAnimUpdateReq[7]; + void *charDataRaw; + NNSG2dCharacterData *charData; + void *monIconCharDaraRaw; + NNSG2dCharacterData *monIconCharData; + void *plttDataRaw; + NNSG2dPaletteData *plttData; + u8 charBuf[0x100]; + UnkStruct_020163E0 *unk_5C4; + BOOL isTouchInput; + int delayCounter; + BOOL *pMenuInputState; +} NamingScreenAppData; // size: 0x5D4 + +typedef struct UnkStruct_02102278 { + u8 x; + u8 y; + u16 sizeParam : 2; // GameFreak tried to be size-efficient here, but + u8 cursorX : 5; // messed up the data types. + u8 cursorY : 5; // cursorX and cursorY should both be u16. +} NamingScreenTouchHitboxDef; + +BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState); +static void NamingScreen_LoadMonIcon(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form); +BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState); +static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState state); +static void NamingScreen_SetDefaultName(NamingScreenAppData *data, NamingScreenArgs *args); +static BOOL NamingScreen_PMCharArrayIsAllSpaces(const u16 *s); +BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState); +static void NamingScreen_VBlankCB(void *param); +static void NamingScreen_InitFromArgs(NamingScreenAppData *data, NamingScreenArgs *args); +static void NamingScreen_SetGraphicsBanks(void); +static void NamingScreen_SetBgModesAndInitBuffers(BgConfig *bgConfig); +static void NamingScreen_ToggleGfxPlanes(GFPlaneToggle enable); +static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +static void NamingScreen_PrepareBattleMessage(NamingScreenAppData *data, OVY_MANAGER *ovyMan); +static void NamingScreen_UnloadBgGfx(BgConfig *bgConfig, Window *windows); +static void NamingScreen_CreateBgConfigAndLoadGfx(NamingScreenAppData *data, NARC *narc); +static void NamingScreen_InitObjCharPlttTransfer(void); +static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc); +static void SysTask_NamingScreen_SubspritePosController(SysTask *task, void *taskData); +static void NamingScreen_CreateSprites(NamingScreenAppData *data); +static void NamingScreen_CreateIconSprite(NamingScreenAppData *data, SpriteTemplate *tmplate); +static void SysTask_NamingScreen_WiggleEffect(SysTask *task, void *taskData); +static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData); +static void NamingScreen_PrintMessageOnWindowLeftAlign(Window *window, NameScreenType unused, String *msg); +static void NamingScreen_PrintMessageOnWindowWithMargin(Window *window, NameScreenType unused, String *msg); +static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc); +static void NamingScreen_SetPageBgPriorities(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos); +static void NamingScreen_SetPagePgPosVecs(VecFx32 *posVecs, GFBgLayer bgId); +static int NamingScreen_WrapAroundWithinInterval(int val, int lo, int hi); +static void NamingScreen_MoveKeyboardCursor(NamingScreenAppData *data, int dpadMovement); +static void NamingScreen_GetPlayerInput(NamingScreenAppData *data); +static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement); +static void NamingScreen_PaletteGlowEffect(u16 *pSinArg); +static void NamingScreen_BlitRawCharactersToWindow(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels); +static void *NamingScreen_PrintStringOnWindow_GetPixelBuffer(Window *window, String *string, FontID fontId, u32 color); +static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 *tmpBuf, void *charBuf, String *string); +static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entryBuf, u16 cursorPos, u16 *tmpBuf, void *charBuf, String *string); +static void NamingScreen_LoadKeyboardLayout(u16 (*keyboard)[13], const int pageNum); +static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppData *data, u16 key, BOOL isButtonInput); +static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle); +static int NamingScreen_SearchJpConvTableForNonSpace(const u16 *table, int pos); +static BOOL NamingScreen_JP_FlipAlphaCase(int tableStart, int tableEnd, u16 *pmCharBuf, int cursorPos); +static BOOL NamingScreen_JP_FlipDiacritic(int tableStart, int tableEnd, int convColno, int mode, u16 *pmCharBuf, int cursorPos); +static void NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(Sprite **sprites, int cursorPos, int maxLen); +static void NamingScreen_DrawKeyboardOnWindow(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData); +static void NamingScreen_UpdateSpritesAnims(BOOL *req, Sprite **sprites, int pageNum); +static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data); +static BOOL NamingScreen_HandleTouchInput(NamingScreenAppData *data); + +// set but never referenced, never cleaned up +static NamingScreenAppData *sAppData; + +// sprite params +// [0]: x coord +// [1]: y coord +// [2]: anim +// [3]: priority +static const int sUISpritesParam[][4] = { + { 0x04, 0x44, 0x03, 0x01 }, + { 0x24, 0x44, 0x08, 0x01 }, + { 0x44, 0x44, 0x0D, 0x01 }, + { 0x00, 0xC8, 0x12, 0x01 }, + { 0x65, 0x44, 0x14, 0x01 }, + { 0x88, 0x44, 0x17, 0x01 }, + { 0xB0, 0x44, 0x19, 0x01 }, + { 0x16, 0x38, 0x25, 0x02 }, + { 0x1A, 0x5B, 0x27, 0x00 }, +}; + +static const u16 sKeyboardHomeRow_All[] = { NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_UPPER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_LOWER, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_BUTTON_PAGE_SYMBOLS, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_OK, NAME_SCREEN_BUTTON_OK }; + +static const u16 sKeyboardHomeRow_Numpad[] = { NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_CONTROL_SKIP, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_BACK, NAME_SCREEN_BUTTON_OK, NAME_SCREEN_BUTTON_OK }; + +static const u16 *sKeyboardHomeRowLayoutPtrs[] = { + sKeyboardHomeRow_All, + sKeyboardHomeRow_All, + sKeyboardHomeRow_All, + sKeyboardHomeRow_All, + sKeyboardHomeRow_Numpad, +}; + +// x coordinates +static const u16 sHomeRowCursorXCoords[] = { + 0x0019, // Upper + 0x0039, // Lower + 0x0059, // Symbols + 0x0061, // JP Symbols + 0x007A, // Numpad + 0x009E, // Back + 0x00C6, // OK + 0x0000, +}; + +// anim ids +static const u8 sHomeRowCursorAnimIDs[] = { + 0x28, // Upper + 0x28, // Lower + 0x28, // Symbols + 0x28, // JP Symbols + 0x29, // Numpad + 0x29, // Back + 0x29, // OK +}; + +static const u16 sKeyboardRow_Upper_1[] = { CHAR_A, CHAR_B, CHAR_C, CHAR_D, CHAR_E, CHAR_F, CHAR_G, CHAR_H, CHAR_I, CHAR_J, CHAR_SPACE, CHAR_COMMA, CHAR_PERIOD, EOS }; + +static const u16 sKeyboardRow_Upper_2[] = { CHAR_K, CHAR_L, CHAR_M, CHAR_N, CHAR_O, CHAR_P, CHAR_Q, CHAR_R, CHAR_S, CHAR_T, CHAR_SPACE, CHAR_RAPOST, CHAR_HYPHEN, EOS }; + +static const u16 sKeyboardRow_Upper_3[] = { CHAR_U, CHAR_V, CHAR_W, CHAR_X, CHAR_Y, CHAR_Z, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_MALE, CHAR_FEMALE, EOS }; + +static const u16 sKeyboardRow_Upper_4[] = { CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Upper_5[] = { CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5, CHAR_6, CHAR_7, CHAR_8, CHAR_9, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Lower_1[] = { CHAR_a, CHAR_b, CHAR_c, CHAR_d, CHAR_e, CHAR_f, CHAR_g, CHAR_h, CHAR_i, CHAR_j, CHAR_SPACE, CHAR_COMMA, CHAR_PERIOD, EOS }; + +static const u16 sKeyboardRow_Lower_2[] = { CHAR_k, CHAR_l, CHAR_m, CHAR_n, CHAR_o, CHAR_p, CHAR_q, CHAR_r, CHAR_s, CHAR_t, CHAR_SPACE, CHAR_RAPOST, CHAR_HYPHEN, EOS }; + +static const u16 sKeyboardRow_Lower_3[] = { CHAR_u, CHAR_v, CHAR_w, CHAR_x, CHAR_y, CHAR_z, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_MALE, CHAR_FEMALE, EOS }; + +static const u16 sKeyboardRow_Lower_4[] = { CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Lower_5[] = { CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5, CHAR_6, CHAR_7, CHAR_8, CHAR_9, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Symbols_1[] = { CHAR_COMMA, CHAR_PERIOD, CHAR_COLON, CHAR_SEMICOLON, CHAR_EXCL, CHAR_QMARK, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_MALE, CHAR_FEMALE, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Symbols_2[] = { CHAR_LDQUOT, CHAR_RDQUOT, CHAR_LAPOST, CHAR_RAPOST, CHAR_LPAREN, CHAR_RPAREN, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Symbols_3[] = { CHAR_ELLIPSIS, CHAR_CTRDOT, CHAR_TILDE, CHAR_AT, CHAR_HASH, CHAR_PERCENT, CHAR_PLUS, CHAR_HYPHEN, CHAR_ASTERISK, CHAR_SLASH, CHAR_EQUALS, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Symbols_4[] = { CHAR_CIRCLE_DOT, CHAR_CIRCLE, CHAR_SQUARE, CHAR_TRIANGLE, CHAR_DIAMOND, CHAR_SPADE_SUIT, CHAR_HEART_SUIT, CHAR_DIAMOND_SUIT, CHAR_CLUB_SUIT, CHAR_STAR, CHAR_MUSIC_NOTE, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_Symbols_5[] = { CHAR_SUN, CHAR_TREBLE_CLEF, CHAR_UMBRELLA, CHAR_SNOWMAN, CHAR_SMILEY, CHAR_LAUGHING, CHAR_ANGUISH, CHAR_ANGRY, CHAR_SNORING, CHAR_UP_ARROW, CHAR_DOWN_ARROW, CHAR_SPACE, CHAR_SPACE, EOS }; + +static const u16 sKeyboardRow_JPMisc_1[] = { CHAR_JP_0, CHAR_JP_1, CHAR_JP_2, CHAR_JP_3, CHAR_JP_4, CHAR_JP_5, CHAR_JP_6, CHAR_JP_7, CHAR_JP_8, CHAR_JP_9, CHAR_JP_SPACE, CHAR_JP_EXCLAM_MARK, CHAR_JP_QUESTION_MARK, EOS }; + +static const u16 sKeyboardRow_JPMisc_2[] = { CHAR_JP_COMMA, CHAR_JP_FULLSTOP, CHAR_JP_HW_COMMA, CHAR_JP_HW_PERIOD, CHAR_JP_ELLIPSIS, CHAR_JP_CENTER_DOT, CHAR_JP_TILDE, CHAR_JP_HW_COLON, CHAR_JP_HW_SEMICOLON, CHAR_JP_SLASH, CHAR_JP_SPACE, CHAR_JP_OTOKO, CHAR_JP_ONNA, EOS }; + +static const u16 sKeyboardRow_JPMisc_3[] = { CHAR_JP_OPEN_QUOT, CHAR_JP_CLOSE_QUOT, CHAR_JP_OPEN_DQUOT, CHAR_JP_CLOSE_DQUOT, CHAR_JP_OPEN_PAREN, CHAR_JP_CLOSE_PAREN, CHAR_JP_PLUS, CHAR_JP_HYPHEN, CHAR_JP_MULT, CHAR_JP_DIV, CHAR_JP_EQUAL, CHAR_JP_PERCENT, CHAR_JP_AT, EOS }; + +static const u16 sKeyboardRow_JPMisc_4[] = { CHAR_JP_CIRCLE_DOT, CHAR_JP_CIRCLE, CHAR_JP_SQUARE, CHAR_JP_TRIANGLE, CHAR_JP_DIAMOND, CHAR_JP_HEART_SUIT, CHAR_JP_SPADE_SUIT, CHAR_JP_DIAMOND_SUIT, CHAR_JP_CLUB_SUIT, CHAR_JP_STAR, CHAR_JP_MUSIC_NOTE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; + +static const u16 sKeyboardRow_JPMisc_5[] = { CHAR_JP_SUN, CHAR_JP_TREBLE_CLEF, CHAR_JP_UMBRELLA, CHAR_JP_SNOWMAN, CHAR_JP_SMILEY, CHAR_JP_LAUGHING, CHAR_JP_ANGUISH, CHAR_JP_ANGRY, CHAR_JP_SNORING, CHAR_JP_UP_ARROW, CHAR_JP_DOWN_ARROW, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; + +static const u16 sKeyboardRow_Numpad_1[] = { CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; + +static const u16 sKeyboardRow_Numpad_2[] = { CHAR_5, CHAR_6, CHAR_7, CHAR_8, CHAR_9, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; + +static const u16 sKeyboardRow_Numpad_345[] = { CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, CHAR_JP_SPACE, EOS }; + +static const u16 *sKeyboardLayoutPtrs[][5] = { + { sKeyboardRow_Upper_1, sKeyboardRow_Upper_2, sKeyboardRow_Upper_3, sKeyboardRow_Upper_4, sKeyboardRow_Upper_5 }, + { sKeyboardRow_Lower_1, sKeyboardRow_Lower_2, sKeyboardRow_Lower_3, sKeyboardRow_Lower_4, sKeyboardRow_Lower_5 }, + { sKeyboardRow_Symbols_1, sKeyboardRow_Symbols_2, sKeyboardRow_Symbols_3, sKeyboardRow_Symbols_4, sKeyboardRow_Symbols_5 }, + { sKeyboardRow_JPMisc_1, sKeyboardRow_JPMisc_2, sKeyboardRow_JPMisc_3, sKeyboardRow_JPMisc_4, sKeyboardRow_JPMisc_5 }, + { sKeyboardRow_Numpad_1, sKeyboardRow_Numpad_2, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345, sKeyboardRow_Numpad_345 }, +}; + +// These arrays are used to convert Japanese characters in response to pressing R. +static const u16 sJpCharConvTable[][3] = { + { CHAR_JP_HIRA_A, CHAR_JP_SPACE, CHAR_JP_HIRA_A_SMALL }, + { CHAR_JP_HIRA_I, CHAR_JP_SPACE, CHAR_JP_HIRA_I_SMALL }, + { CHAR_JP_HIRA_U, CHAR_JP_SPACE, CHAR_JP_HIRA_U_SMALL }, + { CHAR_JP_HIRA_E, CHAR_JP_SPACE, CHAR_JP_HIRA_E_SMALL }, + { CHAR_JP_HIRA_O, CHAR_JP_SPACE, CHAR_JP_HIRA_O_SMALL }, + { CHAR_JP_KATA_A, CHAR_JP_SPACE, CHAR_JP_KATA_A_SMALL }, + { CHAR_JP_KATA_I, CHAR_JP_SPACE, CHAR_JP_KATA_I_SMALL }, + { CHAR_JP_KATA_U, CHAR_JP_SPACE, CHAR_JP_KATA_U_SMALL }, + { CHAR_JP_KATA_E, CHAR_JP_SPACE, CHAR_JP_KATA_E_SMALL }, + { CHAR_JP_KATA_O, CHAR_JP_SPACE, CHAR_JP_KATA_O_SMALL }, + { CHAR_JP_HIRA_YA, CHAR_JP_SPACE, CHAR_JP_HIRA_YA_SMALL }, + { CHAR_JP_HIRA_YU, CHAR_JP_SPACE, CHAR_JP_HIRA_YU_SMALL }, + { CHAR_JP_HIRA_YO, CHAR_JP_SPACE, CHAR_JP_HIRA_YO_SMALL }, + { CHAR_JP_KATA_YA, CHAR_JP_SPACE, CHAR_JP_KATA_YA_SMALL }, + { CHAR_JP_KATA_YU, CHAR_JP_SPACE, CHAR_JP_KATA_YU_SMALL }, + { CHAR_JP_KATA_YO, CHAR_JP_SPACE, CHAR_JP_KATA_YO_SMALL }, + { CHAR_JP_A, CHAR_JP_SPACE, CHAR_JP_a }, + { CHAR_JP_B, CHAR_JP_SPACE, CHAR_JP_b }, + { CHAR_JP_C, CHAR_JP_SPACE, CHAR_JP_c }, + { CHAR_JP_D, CHAR_JP_SPACE, CHAR_JP_d }, + { CHAR_JP_E, CHAR_JP_SPACE, CHAR_JP_e }, + { CHAR_JP_F, CHAR_JP_SPACE, CHAR_JP_f }, + { CHAR_JP_G, CHAR_JP_SPACE, CHAR_JP_g }, + { CHAR_JP_H, CHAR_JP_SPACE, CHAR_JP_h }, + { CHAR_JP_I, CHAR_JP_SPACE, CHAR_JP_i }, + { CHAR_JP_J, CHAR_JP_SPACE, CHAR_JP_j }, + { CHAR_JP_K, CHAR_JP_SPACE, CHAR_JP_k }, + { CHAR_JP_L, CHAR_JP_SPACE, CHAR_JP_l }, + { CHAR_JP_M, CHAR_JP_SPACE, CHAR_JP_m }, + { CHAR_JP_N, CHAR_JP_SPACE, CHAR_JP_n }, + { CHAR_JP_O, CHAR_JP_SPACE, CHAR_JP_o }, + { CHAR_JP_P, CHAR_JP_SPACE, CHAR_JP_p }, + { CHAR_JP_Q, CHAR_JP_SPACE, CHAR_JP_q }, + { CHAR_JP_R, CHAR_JP_SPACE, CHAR_JP_r }, + { CHAR_JP_S, CHAR_JP_SPACE, CHAR_JP_s }, + { CHAR_JP_T, CHAR_JP_SPACE, CHAR_JP_t }, + { CHAR_JP_U, CHAR_JP_SPACE, CHAR_JP_u }, + { CHAR_JP_V, CHAR_JP_SPACE, CHAR_JP_v }, + { CHAR_JP_W, CHAR_JP_SPACE, CHAR_JP_w }, + { CHAR_JP_X, CHAR_JP_SPACE, CHAR_JP_x }, + { CHAR_JP_Y, CHAR_JP_SPACE, CHAR_JP_y }, + { CHAR_JP_Z, CHAR_JP_SPACE, CHAR_JP_z }, + { CHAR_JP_HIRA_TU, CHAR_JP_HIRA_DU, CHAR_JP_HIRA_TU_SMALL }, + { CHAR_JP_KATA_TU, CHAR_JP_KATA_DU, CHAR_JP_KATA_TU_SMALL }, + { CHAR_JP_HIRA_KA, CHAR_JP_HIRA_GA, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KI, CHAR_JP_HIRA_GI, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KU, CHAR_JP_HIRA_GU, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KE, CHAR_JP_HIRA_GE, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_KO, CHAR_JP_HIRA_GO, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SA, CHAR_JP_HIRA_ZA, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SI, CHAR_JP_HIRA_ZI, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SU, CHAR_JP_HIRA_ZU, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SE, CHAR_JP_HIRA_ZE, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_SO, CHAR_JP_HIRA_ZO, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TA, CHAR_JP_HIRA_DA, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TI, CHAR_JP_HIRA_DI, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TE, CHAR_JP_HIRA_DE, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_TO, CHAR_JP_HIRA_DO, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KA, CHAR_JP_KATA_GA, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KI, CHAR_JP_KATA_GI, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KU, CHAR_JP_KATA_GU, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KE, CHAR_JP_KATA_GE, CHAR_JP_SPACE }, + { CHAR_JP_KATA_KO, CHAR_JP_KATA_GO, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SA, CHAR_JP_KATA_ZA, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SI, CHAR_JP_KATA_ZI, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SU, CHAR_JP_KATA_ZU, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SE, CHAR_JP_KATA_ZE, CHAR_JP_SPACE }, + { CHAR_JP_KATA_SO, CHAR_JP_KATA_ZO, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TA, CHAR_JP_KATA_DA, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TI, CHAR_JP_KATA_DI, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TE, CHAR_JP_KATA_DE, CHAR_JP_SPACE }, + { CHAR_JP_KATA_TO, CHAR_JP_KATA_DO, CHAR_JP_SPACE }, + { CHAR_JP_HIRA_HA, CHAR_JP_HIRA_BA, CHAR_JP_HIRA_PA }, + { CHAR_JP_HIRA_HI, CHAR_JP_HIRA_BI, CHAR_JP_HIRA_PI }, + { CHAR_JP_HIRA_HU, CHAR_JP_HIRA_BU, CHAR_JP_HIRA_PU }, + { CHAR_JP_HIRA_HE, CHAR_JP_HIRA_BE, CHAR_JP_HIRA_PE }, + { CHAR_JP_HIRA_HO, CHAR_JP_HIRA_BO, CHAR_JP_HIRA_PO }, + { CHAR_JP_KATA_HA, CHAR_JP_KATA_BA, CHAR_JP_KATA_PA }, + { CHAR_JP_KATA_HI, CHAR_JP_KATA_BI, CHAR_JP_KATA_PI }, + { CHAR_JP_KATA_HU, CHAR_JP_KATA_BU, CHAR_JP_KATA_PU }, + { CHAR_JP_KATA_HE, CHAR_JP_KATA_BE, CHAR_JP_KATA_PE }, + { CHAR_JP_KATA_HO, CHAR_JP_KATA_BO, CHAR_JP_KATA_PO }, +}; + +#define CHARCONVTBL_ALPHA_BEGIN 0 +#define CHARCONVTBL_DAKU_BEGIN 42 +#define CHARCONVTBL_HANDAKU_BEGIN 72 + +static const u16 sDakutenTable[][2] = { + { CHAR_JP_HIRA_TU_SMALL, CHAR_JP_HIRA_DU }, + { CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_DU }, + { CHAR_JP_HIRA_PA, CHAR_JP_HIRA_BA }, + { CHAR_JP_HIRA_PI, CHAR_JP_HIRA_BI }, + { CHAR_JP_HIRA_PU, CHAR_JP_HIRA_BU }, + { CHAR_JP_HIRA_PE, CHAR_JP_HIRA_BE }, + { CHAR_JP_HIRA_PO, CHAR_JP_HIRA_BO }, + { CHAR_JP_KATA_PA, CHAR_JP_KATA_BA }, + { CHAR_JP_KATA_PI, CHAR_JP_KATA_BI }, + { CHAR_JP_KATA_PU, CHAR_JP_KATA_BU }, + { CHAR_JP_KATA_PE, CHAR_JP_KATA_BE }, + { CHAR_JP_KATA_PO, CHAR_JP_KATA_BO }, +}; + +static const u16 sHandakutenTable[][2] = { + { CHAR_JP_HIRA_BA, CHAR_JP_HIRA_PA }, + { CHAR_JP_HIRA_BI, CHAR_JP_HIRA_PI }, + { CHAR_JP_HIRA_BU, CHAR_JP_HIRA_PU }, + { CHAR_JP_HIRA_BE, CHAR_JP_HIRA_PE }, + { CHAR_JP_HIRA_BO, CHAR_JP_HIRA_PO }, + { CHAR_JP_KATA_BA, CHAR_JP_KATA_PA }, + { CHAR_JP_KATA_BI, CHAR_JP_KATA_PI }, + { CHAR_JP_KATA_BU, CHAR_JP_KATA_PU }, + { CHAR_JP_KATA_BE, CHAR_JP_KATA_PE }, + { CHAR_JP_KATA_BO, CHAR_JP_KATA_PO }, +}; + +// offsets for GXS_LoadOBJ +static const int sSpriteGfxOffsets[] = { + 0x00000070, + 0x0000004C, + 0x00000048, +}; + +static const u8 sKeyboardFrameColors[] = { + 0x04, + 0x07, + 0x0D, + 0x0A, +}; + +// These were intended for the Japanese build, but their purpose was replaced with GMM. +// The arrays still appear in the final English ROM. +const u16 sPrompt_YourName[] = { CHAR_JP_HIRA_A, CHAR_JP_HIRA_NA, CHAR_JP_HIRA_TA, CHAR_JP_HIRA_NO, CHAR_JP_SPACE, CHAR_JP_HIRA_NA, CHAR_JP_HIRA_MA, CHAR_JP_HIRA_E, CHAR_JP_HIRA_HA, CHAR_JP_QUESTION_MARK, EOS }; + +const u16 sPrompt_PokemonsNickname[] = { CHAR_JP_KATA_PO, CHAR_JP_KATA_KE, CHAR_JP_KATA_MO, CHAR_JP_KATA_N_, CHAR_JP_HIRA_NO, CHAR_JP_SPACE, CHAR_JP_KATA_NI, CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_KU, CHAR_JP_KATA_NE, CHAR_JP_HYPHEN, CHAR_JP_KATA_MU, CHAR_JP_HIRA_HA, CHAR_JP_QUESTION_MARK, EOS }; + +const u16 sPrompt_BoxName[] = { CHAR_JP_KATA_BO, CHAR_JP_KATA_TU_SMALL, CHAR_JP_KATA_KU, CHAR_JP_KATA_SU, CHAR_JP_HIRA_NO, CHAR_JP_SPACE, CHAR_JP_HIRA_NA, CHAR_JP_HIRA_MA, CHAR_JP_HIRA_E, CHAR_JP_HIRA_HA, CHAR_JP_QUESTION_MARK, EOS }; + +// Required to force the above three arrays to appear in the final ROM. +// This pointer array does not appear in the final ROM. +static const u16 *sDeadstrippedPointersTable[] = { + sPrompt_YourName, + sPrompt_PokemonsNickname, + sPrompt_BoxName, +}; + +// These are the GMMs that replace the above. +static const int _021020B4[] = { + msg_0249_00000, + msg_0249_00001, + msg_0249_00002, + msg_0249_00003, + msg_0249_00004, + msg_0249_00005, + msg_0249_00006, + msg_0249_00008, +}; + +const OVY_MGR_TEMPLATE gOverlayTemplate_NamingScreen = { + NamingScreenApp_Init, + NamingScreenApp_Main, + NamingScreenApp_Exit, + FS_OVERLAY_ID_NONE, +}; + +BOOL NamingScreenApp_Init(OVY_MANAGER *ovyMan, int *pState) { + NamingScreenAppData *data; + NARC *narc; + switch ((NamingScreenInitState)*pState) { + case NS_INIT_STATE_LOAD_GFX: + Main_SetVBlankIntrCB(NULL, NULL); + HBlankInterruptDisable(); + GfGfx_DisableEngineAPlanes(); + GfGfx_DisableEngineBPlanes(); + GX_SetVisiblePlane(0); + GXS_SetVisiblePlane(0); + CreateHeap(HEAP_ID_3, HEAP_ID_NAMING_SCREEN, 0x28000); + + data = OverlayManager_CreateAndGetData(ovyMan, sizeof(NamingScreenAppData), HEAP_ID_NAMING_SCREEN); + memset(data, 0, sizeof(NamingScreenAppData)); + data->bgConfig = BgConfig_Alloc(HEAP_ID_NAMING_SCREEN); + narc = NARC_New(NARC_data_namein, HEAP_ID_NAMING_SCREEN); + data->msgFormat = MessageFormat_New(HEAP_ID_NAMING_SCREEN); + data->msgData_249 = NewMsgDataFromNarc(MSGDATA_LOAD_DIRECT, NARC_msgdata_msg, NARC_msg_msg_0249_bin, HEAP_ID_NAMING_SCREEN); + data->msgData_254 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0254_bin, HEAP_ID_NAMING_SCREEN); + data->msgData_197 = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0197_bin, HEAP_ID_NAMING_SCREEN); + SetKeyRepeatTimers(4, 8); + NamingScreen_SetGraphicsBanks(); + NamingScreen_SetBgModesAndInitBuffers(data->bgConfig); + NamingScreen_InitFromArgs(data, OverlayManager_GetArgs(ovyMan)); + NamingScreen_CreateBgConfigAndLoadGfx(data, narc); + FontID_Alloc(2, HEAP_ID_NAMING_SCREEN); + Main_SetVBlankIntrCB(NamingScreen_VBlankCB, NULL); + NamingScreen_InitKeyboardAndEntryCursors(data, ovyMan); + FontID_SetAccessDirect(0, HEAP_ID_NAMING_SCREEN); + NamingScreen_InitObjCharPlttTransfer(); + NamingScreen_LoadObjGfx(data, narc); + NamingScreen_CreateSprites(data); + NamingScreen_InitWindows(data, ovyMan, narc); + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->tmpBuf, data->charBuf, data->unkJapaneseString); + sub_02004EC4(0x34, 0, 0); // sound-related + BeginNormalPaletteFade(0, 1, 1, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); + NamingScreen_ToggleGfxPlanes(GF_PLANE_TOGGLE_ON); + GfGfx_SetMainDisplay(PM_LCD_BOTTOM); + NARC_Delete(narc); + ++(*pState); + break; + case NS_INIT_STATE_LOAD_MON_ICON: + data = OverlayManager_GetData(ovyMan); + if (data->type == NAME_SCREEN_POKEMON) { + NamingScreen_LoadMonIcon(data->monIconCharData, data->plttData, data->playerGenderOrMonSpecies, data->monForm); + } + sAppData = data; + data->unk_5C4 = sub_020163E0(NULL, PM_LCD_BOTTOM, 12, HEAP_ID_NAMING_SCREEN); + *pState = NS_MAIN_STATE_WAIT_FADE_IN; + return TRUE; + } + + return FALSE; +} + +static void NamingScreen_LoadMonIcon(NNSG2dCharacterData *pCharData, NNSG2dPaletteData *pPlttData, int species, int form) { + GX_LoadOBJ(pCharData->pRawData, 0x57E0, 0x200); + const u16 *rawPltt = pPlttData->pRawData; + u32 plttNo = GetMonIconPaletteEx(species, form, FALSE); + GX_LoadOBJPltt(rawPltt + 16 * plttNo, 0xC0, 0x20); +} + +BOOL NamingScreenApp_Main(OVY_MANAGER *ovyMan, int *pState) { + NamingScreenAppData *data = OverlayManager_GetData(ovyMan); + + switch ((NamingScreenMainState)*pState) { + case NS_MAIN_STATE_WAIT_FADE_IN: + if (IsPaletteFadeFinished()) { + *pState = NS_MAIN_STATE_FINISH_INIT; + data->delayCounter = 0; + } + break; + case NS_MAIN_STATE_FINISH_INIT: + ++data->delayCounter; + NamingScreen_PlaceCursorSprite(data); + NamingScreen_UpdateSpritesAnims(data->spriteAnimUpdateReq, data->uiSprites, data->pageNum); + if (data->delayCounter > 5) { + *pState = NS_MAIN_STATE_INPUT_LOOP; + data->delayCounter = 0; + } + break; + case NS_MAIN_STATE_INPUT_LOOP: + switch (data->pageSwitchState) { + case NS_PAGESWITCH_STATE_DRAW_NEW_PAGE: + case NS_PAGESWITCH_STATE_SET_INIT_POS: + case NS_PAGESWITCH_STATE_MOVE_BGS: + case NS_PAGESWITCH_STATE_FINISH_BGS: + break; + case NS_PAGESWITCH_STATE_IDLE: + if (!data->kbCursor.ignoreInput) { + *pState = NamingScreen_HandleInput(data, (NamingScreenMainState)*pState); + } + NamingScreen_PlaceCursorSprite(data); + break; + case NS_PAGESWITCH_STATE_PRINT_BATTLE_MESSAGE: + NamingScreen_PrepareBattleMessage(data, ovyMan); + FillWindowPixelBuffer(&data->windows[9], 15); + DrawFrameAndWindow2(&data->windows[9], FALSE, 256, 10); + data->battleMessageTextPrinterId = AddTextPrinterParameterized(&data->windows[9], 1, data->battleMsgString, 0, 0, 1, NULL); + CopyWindowToVram(&data->windows[9]); + data->pageSwitchState = NS_PAGESWITCH_STATE_WAIT_BATTLE_MESSAGE; + break; + case NS_PAGESWITCH_STATE_WAIT_BATTLE_MESSAGE: + if (!TextPrinterCheckActive(data->battleMessageTextPrinterId)) { + PlaySE(SEQ_SE_DP_PIRORIRO); + ++data->spriteAnimUpdateReq[6]; + data->delayCounter = 0; + data->pageSwitchState = NS_PAGESWITCH_STATE_DELAY_AND_FADE_OUT; + } + break; + case NS_PAGESWITCH_STATE_DELAY_AND_FADE_OUT: + ++data->delayCounter; + if (data->delayCounter > 30) { + BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); + *pState = NS_MAIN_STATE_WAIT_FADE_OUT; + } + break; + } + NamingScreen_HandlePageSwitch(data->bgConfig, data->windows, &data->pageSwitchState, data->pageNum, &data->activeKeyboardBgId, data->bgPosVecs, data->uiSprites, data->charData->pRawData); + NamingScreen_UpdateSpritesAnims(data->spriteAnimUpdateReq, data->uiSprites, data->pageNum); + NamingScreen_PaletteGlowEffect(&data->plttGlowEffectAngle); + break; + case NS_MAIN_STATE_WAIT_FADE_OUT: + if (IsPaletteFadeFinished()) { + return TRUE; + } + break; + } + + SpriteList_RenderAndAnimateSprites(data->spriteList); + return FALSE; +} + +static NamingScreenMainState NamingScreen_HandleInput(NamingScreenAppData *data, NamingScreenMainState state) { + NamingScreenMainState ret = state; + + NamingScreen_GetPlayerInput(data); + if (gSystem.newKeys & PAD_BUTTON_SELECT) { + if (!Sprite_GetVisibleFlag(data->uiSprites[8])) { + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + return ret; + } + if (data->type != NAME_SCREEN_UNK4) { + data->pageSwitchState = NS_PAGESWITCH_STATE_DRAW_NEW_PAGE; + ++data->pageNum; + if (data->pageNum >= 3) { + data->pageNum = 0; + } + ++data->spriteAnimUpdateReq[data->pageNum]; + NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); + PlaySE(SEQ_SE_DP_SYU03); + data->kbCursor.showCursor = TRUE; + } + ++data->spriteAnimUpdateReq[data->pageNum]; + NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); + PlaySE(SEQ_SE_DP_SYU03); + } else if (gSystem.newKeys & PAD_BUTTON_A) { + ret = NamingScreen_HandleCharacterInput(data, data->keyboard[data->kbCursor.y][data->kbCursor.x], TRUE); + data->kbCursor.showCursor = TRUE; + } else if (data->isTouchInput == TRUE) { + ret = NamingScreen_HandleCharacterInput(data, data->keyboard[data->kbCursor.y][data->kbCursor.x], FALSE); + } else if (gSystem.newKeys & PAD_BUTTON_B) { + ret = NamingScreen_HandleCharacterInput(data, NAME_SCREEN_BUTTON_BACK, TRUE); + } else if (gSystem.newKeys & PAD_BUTTON_R) { + ret = NamingScreen_HandleCharacterInput(data, NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2, TRUE); + } + return ret; +} + +#ifdef HEARTGOLD +#define FIRST_DEFAULT_NAME_MALE msg_0254_00000 +#define FIRST_DEFAULT_NAME_FEMALE msg_0254_00018 +#define FIRST_DEFAULT_NAME_RIVAL msg_0254_00084 +#else +#define FIRST_DEFAULT_NAME_MALE msg_0254_00042 +#define FIRST_DEFAULT_NAME_FEMALE msg_0254_00060 +#define FIRST_DEFAULT_NAME_RIVAL msg_0254_00085 +#endif // HEARTGOLD + +// Called when the input is empty +static void NamingScreen_SetDefaultName(NamingScreenAppData *data, NamingScreenArgs *args) { + String *string; + + if (data->type == NAME_SCREEN_PLAYER) { + if (data->playerGenderOrMonSpecies == PLAYER_GENDER_MALE) { + string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_MALE + (LCRandom() % 18)); + } else if (data->playerGenderOrMonSpecies == PLAYER_GENDER_FEMALE) { + string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_FEMALE + (LCRandom() % 18)); + } + // UB: Nonbinary players will not initialize string. + String_Copy(args->nameInputString, string); + String_Delete(string); + CopyStringToU16Array(args->nameInputString, args->nameInputFlat, 10); + } else if (data->type == NAME_SCREEN_RIVAL) { + string = NewString_ReadMsgData(data->msgData_254, FIRST_DEFAULT_NAME_RIVAL); + String_Copy(args->nameInputString, string); + String_Delete(string); + CopyStringToU16Array(args->nameInputString, args->nameInputFlat, 10); + } else { + // Remaining cases have their own separate handlers. + args->noInput = TRUE; + } +} + +static BOOL NamingScreen_PMCharArrayIsAllSpaces(const u16 *s) { + BOOL ret = TRUE; + int i; + + for (i = 0;; ++i) { + if (s[i] == EOS) { + break; + } + if (s[i] != CHAR_SPACE) { + ret = FALSE; + // break; + } + } + return ret; +} + +BOOL NamingScreenApp_Exit(OVY_MANAGER *ovyMan, int *pState) { + NamingScreenAppData *data = OverlayManager_GetData(ovyMan); + NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); + + data->entryBuf[data->textCursorPos] = EOS; + if (data->type == NAME_SCREEN_POKEMON) { + Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); + CreateMon(mon, data->playerGenderOrMonSpecies, 5, 10, 10, 10, 10, 10); + // wtf + FreeToHeap(mon); + } + if (data->textCursorPos == 0 || !StringNotEqual(data->entryBuf, data->entryBufBak) || NamingScreen_PMCharArrayIsAllSpaces(data->entryBuf)) { + NamingScreen_SetDefaultName(data, args); + } else { + CopyU16StringArray(data->entryBufBak, data->entryBuf); + CopyU16StringArray(args->nameInputFlat, data->entryBuf); + CopyU16ArrayToString(args->nameInputString, data->entryBuf); + } + String_Delete(data->unk_184); + for (int i = 0; i < 7; ++i) { + DestroySysTaskAndEnvironment(data->tasks[i]); + } + sub_0200AEB0(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); + sub_0200AEB0(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); + sub_0200B0A8(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); + sub_0200B0A8(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); + for (int i = 0; i < 4; ++i) { + Destroy2DGfxResObjMan(data->gfxResMen[i]); + } + SpriteList_Delete(data->spriteList); + OamManager_Free(); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->charDataRaw); + if (data->type == NAME_SCREEN_POKEMON) { + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->monIconCharDaraRaw); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, data->plttDataRaw); + } + FreeBgTilemapBuffer(data->bgConfig, GF_BG_LYR_SUB_3); + ObjCharTransfer_Destroy(); + ObjPlttTransfer_Destroy(); + NamingScreen_UnloadBgGfx(data->bgConfig, data->windows); + FontID_SetAccessLazy(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); + FontID_Release(2); + if (data->battleMsgString != NULL) { + String_Delete(data->battleMsgString); + } + String_Delete(data->promptString); + String_Delete(data->unkJapaneseString); + DestroyMsgData(data->msgData_197); + DestroyMsgData(data->msgData_254); + DestroyMsgData(data->msgData_249); + MessageFormat_Delete(data->msgFormat); + OverlayManager_FreeData(ovyMan); + Main_SetVBlankIntrCB(NULL, NULL); + DestroyHeap(HEAP_ID_NAMING_SCREEN); + GfGfx_SetMainDisplay(PM_LCD_TOP); + return TRUE; +} + +// ------------------------------- +// Public functions +// ------------------------------- + +NamingScreenArgs *NamingScreen_CreateArgs(HeapID heapId, NameScreenType kind, int param, int maxLen, Options *options, BOOL *pMenuInputState) { + NamingScreenArgs *ret = AllocFromHeap(heapId, sizeof(NamingScreenArgs)); + ret->kind = kind; + ret->playerGenderOrMonSpecies = param; + ret->maxLen = maxLen; + ret->noInput = FALSE; + ret->nameInputFlat[0] = EOS; + ret->nameInputString = String_New(32, heapId); + ret->battleMsgId = 0; + ret->pcStorage = 0; + ret->monGender = 0; + ret->options = options; + ret->monForm = 0; + ret->pMenuInputState = pMenuInputState; + return ret; +} + +void NamingScreen_DeleteArgs(NamingScreenArgs *namingScreenArgs) { + GF_ASSERT(namingScreenArgs->nameInputString != NULL); + GF_ASSERT(namingScreenArgs != NULL); // UB: should check this first + String_Delete(namingScreenArgs->nameInputString); + FreeToHeap(namingScreenArgs); +} + +// ------------------------------- +// Back to private scope +// ------------------------------- + +static void NamingScreen_VBlankCB(void *param) { + GF_RunVramTransferTasks(); + OamManager_ApplyAndResetBuffers(); + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +static void NamingScreen_InitFromArgs(NamingScreenAppData *data, NamingScreenArgs *args) { + data->type = args->kind; + data->playerGenderOrMonSpecies = args->playerGenderOrMonSpecies; + data->monForm = args->monForm; + data->maxLen = args->maxLen; + data->monGender = args->monGender; + data->options = args->options; + data->pMenuInputState = args->pMenuInputState; +} + +static void NamingScreen_SetGraphicsBanks(void) { + GraphicsBanks graphicsBanks = { + GX_VRAM_BG_128_A, + GX_VRAM_BGEXTPLTT_NONE, + GX_VRAM_SUB_BG_128_C, + GX_VRAM_SUB_BGEXTPLTT_NONE, + GX_VRAM_OBJ_128_B, + GX_VRAM_OBJEXTPLTT_NONE, + GX_VRAM_SUB_OBJ_16_I, + GX_VRAM_SUB_OBJEXTPLTT_NONE, + GX_VRAM_TEX_NONE, + GX_VRAM_TEXPLTT_NONE, + }; + ; + GfGfx_SetBanks(&graphicsBanks); +} + +static void NamingScreen_SetBgModesAndInitBuffers(BgConfig *bgConfig) { + { + GraphicsModes graphicsModes = { + GX_DISPMODE_GRAPHICS, + GX_BGMODE_0, + GX_BGMODE_0, + GX_BG0_AS_2D, + }; + SetBothScreensModesAndDisable(&graphicsModes); + } + + { + BgTemplate bgTemplate = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_512x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_512x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xf000, + .charBase = GX_BG_CHARBASE_0x10000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 1, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; + InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_0, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_0); + } + + { + BgTemplate bgTemplate = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_512x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_512x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xe000, + .charBase = GX_BG_CHARBASE_0x10000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 2, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; + InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_1, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_1); + } + + { + BgTemplate bgTemplate = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_256x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xd000, + .charBase = GX_BG_CHARBASE_0x00000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 3, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; + InitBgFromTemplate(bgConfig, GF_BG_LYR_MAIN_2, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_MAIN_2); + } + + { + BgTemplate bgTemplate = { + .x = 0x00000000, + .y = 0x00000000, + .bufferSize = GF_BG_BUF_SIZE_256x256_4BPP, + .baseTile = 0x00000000, + .size = GF_BG_SCR_SIZE_256x256, + .colorMode = GX_BG_COLORMODE_16, + .screenBase = GX_BG_SCRBASE_0xf800, + .charBase = GX_BG_CHARBASE_0x10000, + .bgExtPltt = GX_BG_EXTPLTT_01, + .priority = 0, + .areaOver = GX_BG_AREAOVER_XLU, + .mosaic = 0x00000000, + }; + InitBgFromTemplate(bgConfig, GF_BG_LYR_SUB_0, &bgTemplate, GF_BG_TYPE_TEXT); + BgClearTilemapBufferAndCommit(bgConfig, GF_BG_LYR_SUB_0); + } + + NamingScreen_ToggleGfxPlanes(GF_PLANE_TOGGLE_OFF); + BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); + BG_ClearCharDataRange(GF_BG_LYR_SUB_0, 0x20, 0, HEAP_ID_NAMING_SCREEN); + GX_SetVisibleWnd(GX_WNDMASK_W0); + G2_SetWnd0InsidePlane(GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_OBJ, 1); + G2_SetWndOutsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3 | GX_WND_PLANEMASK_OBJ, + 1); + G2_SetWnd0Position(0, 0, 255, 64); + G2S_BlendNone(); +} + +static void NamingScreen_ToggleGfxPlanes(GFPlaneToggle enable) { + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, enable); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, enable); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG2, enable); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG3, GF_PLANE_TOGGLE_OFF); + GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, enable); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG0, enable); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_OFF); +} + +static void NamingScreen_InitKeyboardAndEntryCursors(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { + NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); + + data->pageSwitchState = NS_PAGESWITCH_STATE_IDLE; + NamingScreen_SetPagePgPosVecs(data->bgPosVecs, GF_BG_LYR_MAIN_0); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId, BG_POS_OP_SET_X, data->bgPosVecs[data->activeKeyboardBgId].x); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId, BG_POS_OP_SET_Y, data->bgPosVecs[data->activeKeyboardBgId].y); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId ^ 1, BG_POS_OP_SET_X, data->bgPosVecs[data->activeKeyboardBgId ^ 1].x); + BgSetPosTextAndCommit(data->bgConfig, data->activeKeyboardBgId ^ 1, BG_POS_OP_SET_Y, data->bgPosVecs[data->activeKeyboardBgId ^ 1].y); + data->entryBufBak[0] = EOS; + if (args->nameInputString != NULL) { + CopyStringToU16Array(args->nameInputString, data->entryBufBak, 32); + } + MI_CpuFill16(data->entryBuf, 1, sizeof(data->entryBuf)); + if (data->type == NAME_SCREEN_POKEMON) { + Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); + CreateMon(mon, data->playerGenderOrMonSpecies, 5, 10, 10, 10, 10, 10); + BufferBoxMonSpeciesName(data->msgFormat, 0, Mon_GetBoxMon(mon)); + FreeToHeap(mon); + } + if (args->battleMsgId != 0) { + data->printedFromBattleGMM = TRUE; + } + data->promptString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, _021020B4[data->type], HEAP_ID_NAMING_SCREEN); + data->unkJapaneseString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_249, msg_0249_00009, HEAP_ID_NAMING_SCREEN); + data->unk_184 = NewString_ReadMsgData(data->msgData_249, msg_0249_00007); + data->textCursorPos = StringLength(data->entryBufBak); + data->kbCursor.x = 0; + data->kbCursor.y = 1; + data->kbCursor.prevX = -1; + data->kbCursor.prevY = -1; + data->kbCursor.showCursor = TRUE; + data->kbCursor.ignoreInput = FALSE; + data->unk_484 = -1; + data->unk_488 = 0; + data->unk_48C = 0; + data->entryBuf[data->maxLen] = EOS; + for (int i = 0; i < 7; ++i) { + data->spriteAnimUpdateReq[i] = 0; + } + if (data->type == NAME_SCREEN_UNK4) { + data->spriteAnimUpdateReq[3] = 1; + } else { + data->spriteAnimUpdateReq[0] = 1; + } +} + +static void NamingScreen_PrepareBattleMessage(NamingScreenAppData *data, OVY_MANAGER *ovyMan) { + NamingScreenArgs *args = OverlayManager_GetArgs(ovyMan); + if (args->battleMsgId != 0) { + String *string = String_New(200, HEAP_ID_NAMING_SCREEN); + data->battleMsgString = NULL; + int boxno = PCStorage_GetActiveBox(args->pcStorage); + int nextOpenBoxNo = PCStorage_FindFirstBoxWithEmptySlot(args->pcStorage); + BufferPCBoxName(data->msgFormat, 1, args->pcStorage, boxno); + if (boxno != nextOpenBoxNo) { + BufferPCBoxName(data->msgFormat, 2, args->pcStorage, nextOpenBoxNo); + args->battleMsgId += 2; + } else { + BufferPCBoxName(data->msgFormat, 2, args->pcStorage, boxno); + } + if (data->textCursorPos == 0 || NamingScreen_PMCharArrayIsAllSpaces(data->entryBuf)) { + Pokemon *mon = AllocMonZeroed(HEAP_ID_NAMING_SCREEN); + CreateMon(mon, data->playerGenderOrMonSpecies, 1, 0, 0, 0, 0, 0); + BufferBoxMonSpeciesName(data->msgFormat, 0, Mon_GetBoxMon(mon)); + FreeToHeap(mon); + } else { + data->entryBuf[data->textCursorPos] = EOS; + CopyU16ArrayToString(string, data->entryBuf); + BufferString(data->msgFormat, 0, string, 0, 0, 0); + } + data->battleMsgString = ReadMsgData_ExpandPlaceholders(data->msgFormat, data->msgData_197, args->battleMsgId, HEAP_ID_NAMING_SCREEN); + data->printedFromBattleGMM = TRUE; + String_Delete(string); + } +} + +static void NamingScreen_UnloadBgGfx(BgConfig *bgConfig, Window *windows) { + for (int i = 0; i < 10; ++i) { + RemoveWindow(&windows[i]); + } + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_SUB_0); + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_MAIN_2); + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_MAIN_1); + FreeBgTilemapBuffer(bgConfig, GF_BG_LYR_MAIN_0); + FreeToHeapExplicit(HEAP_ID_NAMING_SCREEN, bgConfig); +} + +static void NamingScreen_CreateBgConfigAndLoadGfx(NamingScreenAppData *data, NARC *narc) { + BgConfig *bgConfig = data->bgConfig; + + GfGfxLoader_GXLoadPalFromOpenNarc(narc, NARC_namein_namein_00000000_NCLR, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x60, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_GXLoadPal(NARC_a_0_1_4, 71, GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0, 0x20, HEAP_ID_NAMING_SCREEN); + BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB_BLACK); + + GfGfxLoader_LoadCharDataFromOpenNarc(narc, NARC_namein_namein_00000002_NCGR_lz, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000004_NSCR_lz, bgConfig, GF_BG_LYR_MAIN_2, 0, 0x600, TRUE, HEAP_ID_NAMING_SCREEN); + + GfGfxLoader_LoadCharDataFromOpenNarc(narc, NARC_namein_namein_00000002_NCGR_lz, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x2000, TRUE, HEAP_ID_NAMING_SCREEN); + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000006_NSCR_lz, bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000007_NSCR_lz, bgConfig, GF_BG_LYR_MAIN_0, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + + LoadFontPal1(GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); + LoadUserFrameGfx2(data->bgConfig, GF_BG_LYR_SUB_0, 0x100, 10, Options_GetFrame(data->options), HEAP_ID_NAMING_SCREEN); + LoadFontPal1(GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0x180, HEAP_ID_NAMING_SCREEN); + + data->charDataRaw = GfGfxLoader_GetCharDataFromOpenNarc(narc, NARC_namein_namein_00000016_NCGR_lz, TRUE, &data->charData, HEAP_ID_NAMING_SCREEN); +} + +static void NamingScreen_InitObjCharPlttTransfer(void) { + ObjCharTransferTemplate tmplate = { + .maxTasks = 20, + .sizeMain = 0x800, + .sizeSub = 0x800, + .heapId = HEAP_ID_NAMING_SCREEN, + }; + ObjCharTransfer_Init(&tmplate); + ObjPlttTransfer_Init(20, HEAP_ID_NAMING_SCREEN); + ObjCharTransfer_ClearBuffers(); + ObjPlttTransfer_Reset(); +} + +static void NamingScreen_LoadObjGfx(NamingScreenAppData *data, NARC *narc) { + NNS_G2dInitOamManagerModule(); + GX_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); + GXS_SetOBJVRamModeChar(GX_OBJVRAMMODE_CHAR_1D_32K); + OamManager_Create(0, 128, 0, 32, 0, 128, 0, 32, HEAP_ID_NAMING_SCREEN); + data->spriteList = G2dRenderer_Init(44, &data->g2dRender, HEAP_ID_NAMING_SCREEN); + G2dRenderer_SetSubSurfaceCoords(&data->g2dRender, 0, FX32_CONST(256)); + + for (int i = 0; i < 4; ++i) { + data->gfxResMen[i] = Create2DGfxResObjMan(2, (GfGfxResType)i, HEAP_ID_NAMING_SCREEN); + } + + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, NARC_namein_namein_00000010_NCGR_lz, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, NARC_namein_namein_00000001_NCLR, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 9, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, NARC_namein_namein_00000012_NCER_lz, TRUE, 0, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, NARC_namein_namein_00000014_NANR_lz, TRUE, 0, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + if (data->type == NAME_SCREEN_POKEMON) { + data->monIconCharDaraRaw = GfGfxLoader_GetCharData(NARC_poketool_icongra_poke_icon, GetMonIconNaixEx(data->playerGenderOrMonSpecies, FALSE, data->monForm), FALSE, &data->monIconCharData, HEAP_ID_NAMING_SCREEN); + DC_FlushRange(data->monIconCharData, 0x200); + data->plttDataRaw = GfGfxLoader_GetPlttData(NARC_poketool_icongra_poke_icon, sub_02074490(), &data->plttData, HEAP_ID_NAMING_SCREEN); + DC_FlushRange(data->plttData, 0x80); + } + + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CHAR], narc, NARC_namein_namein_00000011_NCGR_lz, TRUE, 1, NNS_G2D_VRAM_TYPE_2DSUB, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_PLTT], narc, NARC_namein_namein_00000001_NCLR, FALSE, 1, NNS_G2D_VRAM_TYPE_2DSUB, 3, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_CELL], narc, NARC_namein_namein_00000013_NCER_lz, TRUE, 1, GF_GFX_RES_TYPE_CELL, HEAP_ID_NAMING_SCREEN); + data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromOpenNarc(data->gfxResMen[GF_GFX_RES_TYPE_ANIM], narc, NARC_namein_namein_00000015_NANR_lz, TRUE, 1, GF_GFX_RES_TYPE_ANIM, HEAP_ID_NAMING_SCREEN); + + sub_0200ACF0(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_CHAR]); + sub_0200ACF0(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_CHAR]); + sub_0200AF94(data->gfxResObjs[PM_LCD_TOP][GF_GFX_RES_TYPE_PLTT]); + sub_0200AF94(data->gfxResObjs[PM_LCD_BOTTOM][GF_GFX_RES_TYPE_PLTT]); +} + +typedef struct SubspritePosControllerTaskData { + Sprite *parent; + Sprite *child; + fx32 dx; + int i; +} SubspritePosControllerTaskData; + +static void SysTask_NamingScreen_SubspritePosController(SysTask *task, void *taskData) { + SubspritePosControllerTaskData *data = taskData; + VecFx32 *pMatrix = Sprite_GetMatrixPtr(data->parent); + VecFx32 matrix; + matrix.x = pMatrix->x + data->dx; + matrix.y = FX32_ONE * sUISpritesParam[data->i][1]; + matrix.z = 0; + Sprite_SetMatrix(data->child, &matrix); +} + +static void NamingScreen_CreateSprites(NamingScreenAppData *data) { + int i; + CreateSpriteResourcesHeader(&data->spriteResHdr_Main, 0, 0, 0, 0, -1, -1, 0, 1, data->gfxResMen[GF_GFX_RES_TYPE_CHAR], data->gfxResMen[GF_GFX_RES_TYPE_PLTT], data->gfxResMen[GF_GFX_RES_TYPE_CELL], data->gfxResMen[GF_GFX_RES_TYPE_ANIM], NULL, NULL); + CreateSpriteResourcesHeader(&data->spriteResHdr_Sub, 1, 1, 1, 1, -1, -1, 0, 0, data->gfxResMen[GF_GFX_RES_TYPE_CHAR], data->gfxResMen[GF_GFX_RES_TYPE_PLTT], data->gfxResMen[GF_GFX_RES_TYPE_CELL], data->gfxResMen[GF_GFX_RES_TYPE_ANIM], NULL, NULL); + { + SpriteTemplate spriteTemplate; + spriteTemplate.spriteList = data->spriteList; + spriteTemplate.header = &data->spriteResHdr_Main; + spriteTemplate.position.x = FX32_CONST(32); + spriteTemplate.position.y = FX32_CONST(96); + spriteTemplate.position.z = 0; + spriteTemplate.scale.x = FX32_ONE; + spriteTemplate.scale.y = FX32_ONE; + spriteTemplate.scale.z = FX32_ONE; + spriteTemplate.rotation = 0; + spriteTemplate.priority = 1; + spriteTemplate.whichScreen = NNS_G2D_VRAM_TYPE_2DMAIN; + spriteTemplate.heapId = HEAP_ID_NAMING_SCREEN; + + for (i = 0; i < 9; ++i) { + spriteTemplate.position.x = sUISpritesParam[i][0] * FX32_ONE; + spriteTemplate.position.y = sUISpritesParam[i][1] * FX32_ONE; + data->uiSprites[i] = Sprite_CreateAffine(&spriteTemplate); + Sprite_SetAnimActiveFlag(data->uiSprites[i], TRUE); + Sprite_SetAnimCtrlSeq(data->uiSprites[i], sUISpritesParam[i][2]); + Sprite_SetDrawPriority(data->uiSprites[i], sUISpritesParam[i][3]); + } + Sprite_SetVisibleFlag(data->uiSprites[4], FALSE); + for (i = 0; i < 7; ++i) { + data->tasks[i] = CreateSysTaskAndEnvironment(SysTask_NamingScreen_SubspritePosController, sizeof(SubspritePosControllerTaskData), 5, HEAP_ID_NAMING_SCREEN); + SubspritePosControllerTaskData *taskData = SysTask_GetData(data->tasks[i]); + taskData->parent = data->uiSprites[7]; + taskData->child = data->uiSprites[i]; + taskData->dx = sUISpritesParam[i][0] * FX32_ONE; + taskData->i = i; + } + for (i = 0; i < data->maxLen; ++i) { + spriteTemplate.position.x = FX32_ONE * (80 + i * 12); + spriteTemplate.position.y = FX32_ONE * 39; + data->textEntrySprites[i] = Sprite_CreateAffine(&spriteTemplate); + Sprite_SetAnimActiveFlag(data->textEntrySprites[i], TRUE); + Sprite_SetAnimCtrlSeq(data->textEntrySprites[i], 43); + } + NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(data->textEntrySprites, data->textCursorPos, data->maxLen); + NamingScreen_CreateIconSprite(data, &spriteTemplate); + } + GfGfx_EngineATogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); + GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON); +} + +static void NamingScreen_CreateIconSprite(NamingScreenAppData *data, SpriteTemplate *tmplate) { + tmplate->position.x = FX32_CONST(24); + tmplate->position.y = FX32_CONST(8); + data->iconSprites[0] = Sprite_CreateAffine(tmplate); + Sprite_SetAnimActiveFlag(data->iconSprites[0], TRUE); + + switch (data->type) { + case NAME_SCREEN_PLAYER: + if (data->playerGenderOrMonSpecies == PLAYER_GENDER_MALE) { + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 48); + } else { + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 49); + } + break; + case NAME_SCREEN_RIVAL: + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 51); + break; + case NAME_SCREEN_UNK6: + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 55); + break; + case NAME_SCREEN_GROUP: + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 54); + break; + case NAME_SCREEN_UNK4: + case NAME_SCREEN_UNK7: + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 53); + break; + case NAME_SCREEN_BOX: + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 47); + break; + case NAME_SCREEN_POKEMON: + Sprite_SetAnimCtrlSeq(data->iconSprites[0], 50); + if (data->monGender != 2) { + tmplate->position.x = (13 * data->maxLen + 80) * FX32_ONE; + tmplate->position.y = FX32_CONST(27); + data->iconSprites[1] = Sprite_CreateAffine(tmplate); + if (data->monGender == 0) { + Sprite_SetAnimCtrlSeq(data->iconSprites[1], 45); + } else { + Sprite_SetAnimCtrlSeq(data->iconSprites[1], 46); + } + } + break; + } +} + +typedef struct WiggleEffectTaskData { + Sprite *sprite; + int state; + fx32 x; + int y; +} WiggleEffectTaskData; + +static void SysTask_NamingScreen_WiggleEffect(SysTask *task, void *taskData) { + WiggleEffectTaskData + *data + = taskData; + + VecFx32 matrix; + + matrix.y = data->y; + matrix.z = 0; + switch (data->state) { + case 0: + matrix.x = data->x + FX32_CONST(4); + Sprite_SetMatrix(data->sprite, &matrix); + break; + case 2: + matrix.x = data->x - FX32_CONST(3); + Sprite_SetMatrix(data->sprite, &matrix); + break; + case 4: + matrix.x = data->x + FX32_CONST(2); + Sprite_SetMatrix(data->sprite, &matrix); + break; + case 6: + matrix.x = data->x; + Sprite_SetMatrix(data->sprite, &matrix); + DestroySysTaskAndEnvironment(task); // invalidates data + break; + } + ++data->state; // UB: potential use after free +} + +static void NamingScreen_HandlePageSwitch(BgConfig *bgConfig, Window *windows, int *pState, int pageNum, GFBgLayer *pBgId, VecFx32 *posVecs, Sprite **pSprites, void *pRawData) { + GFBgLayer bgId_prev = *pBgId; + GFBgLayer bgId_curr = (GFBgLayer)(bgId_prev ^ 1); + + switch (*pState) { + case NS_PAGESWITCH_STATE_DRAW_NEW_PAGE: { + u16 fillVal = sKeyboardFrameColors[pageNum] | (sKeyboardFrameColors[pageNum] << 4); + GfGfxLoader_LoadScrnData(NARC_data_namein, pageNum + 6, bgConfig, bgId_prev, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + NamingScreen_SetPagePgPosVecs(posVecs, bgId_prev); + NamingScreen_DrawKeyboardOnWindow(&windows[bgId_prev], fillVal, pageNum, MAKE_TEXT_COLOR(14, 15, 0), pRawData); + ++(*pState); + break; + } + case NS_PAGESWITCH_STATE_SET_INIT_POS: + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, 238); + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_Y, -80); + ++*(pState); + break; + case NS_PAGESWITCH_STATE_MOVE_BGS: + posVecs[bgId_prev].x -= 24; + if (posVecs[bgId_prev].x < -1) { + WiggleEffectTaskData + *data; + SysTask *task; + + task = CreateSysTaskAndEnvironment(SysTask_NamingScreen_WiggleEffect, sizeof(WiggleEffectTaskData), 0, HEAP_ID_NAMING_SCREEN); + data = SysTask_GetData(task); + data->sprite = pSprites[7]; + data->state = 0; + data->x = Sprite_GetMatrixPtr(pSprites[7])->x; + data->y = Sprite_GetMatrixPtr(pSprites[7])->y; + posVecs[bgId_prev].x = -11; + ++(*pState); + } + posVecs[bgId_curr].y -= 10; + if (posVecs[bgId_curr].y < -196) { + posVecs[bgId_curr].y = -196; + } + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, posVecs[bgId_prev].x); + BgSetPosTextAndCommit(bgConfig, bgId_curr, BG_POS_OP_SET_Y, posVecs[bgId_curr].y); + break; + case NS_PAGESWITCH_STATE_FINISH_BGS: + posVecs[bgId_curr].y -= 10; + if (posVecs[bgId_curr].y < -196) { + posVecs[bgId_curr].y = -196; + } + BgSetPosTextAndCommit(bgConfig, bgId_prev, BG_POS_OP_SET_X, posVecs[bgId_prev].x); + BgSetPosTextAndCommit(bgConfig, bgId_curr, BG_POS_OP_SET_Y, posVecs[bgId_curr].y); + if (posVecs[bgId_prev].x == -11 && posVecs[bgId_curr].y == -196) { + ++(*pState); + (*pBgId) ^= 1; + NamingScreen_SetPageBgPriorities(bgConfig, *pBgId, posVecs); + PlaySE(SEQ_SE_DP_NAMEIN_01); + } + break; + case NS_PAGESWITCH_STATE_IDLE: + break; + } +} + +static void NamingScreen_PrintMessageOnWindowLeftAlign(Window *window, NameScreenType unused, String *msg) { + DrawFrameAndWindow2(window, FALSE, 0x100, 10); + AddTextPrinterParameterized(window, 1, msg, 0, 0, TEXT_SPEED_INSTANT, NULL); + CopyWindowToVram(window); +} + +static void NamingScreen_PrintMessageOnWindowWithMargin(Window *window, NameScreenType unused, String *msg) { + int x = 16; + int width = FontID_String_GetWidth(0, msg, 0); + int windowWidth = GetWindowWidth(window) * 8; + if (width + 16 > windowWidth) { + x = windowWidth - width; + } + FillWindowPixelBuffer(window, 1); + AddTextPrinterParameterizedWithColor(window, 0, msg, x, 0, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + CopyWindowToVram(window); +} + +static void NamingScreen_InitWindows(NamingScreenAppData *data, OVY_MANAGER *ovyMan, NARC *narc) { + AddWindowParameterized(data->bgConfig, &data->windows[0], GF_BG_LYR_MAIN_0, 2, 1, 26, 12, 1, 0x100); + AddWindowParameterized(data->bgConfig, &data->windows[1], GF_BG_LYR_MAIN_1, 2, 1, 26, 12, 1, 0x238); + + if (data->type == NAME_SCREEN_UNK4) { + GfGfxLoader_LoadScrnDataFromOpenNarc(narc, NARC_namein_namein_00000009_NSCR_lz, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0x380, TRUE, HEAP_ID_NAMING_SCREEN); + data->pageNum = 4; + NamingScreen_LoadKeyboardLayout(data->keyboard, 4); + NamingScreen_DrawKeyboardOnWindow(&data->windows[1], 0x0A0A, 4, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); + } else { + data->pageNum = 0; + NamingScreen_LoadKeyboardLayout(data->keyboard, 0); + NamingScreen_DrawKeyboardOnWindow(&data->windows[1], 0x0404, 0, MAKE_TEXT_COLOR(14, 15, 0), data->charData->pRawData); + } + + AddWindowParameterized(data->bgConfig, &data->windows[2], GF_BG_LYR_MAIN_2, 7, 2, 22, 2, 0, 0x370); + + int win3Width = (data->maxLen * 12) / 8 + 1; + AddWindowParameterized(data->bgConfig, &data->windows[3], GF_BG_LYR_MAIN_2, 10, 3, win3Width, 2, 0, 0x39C); + FillWindowPixelBuffer(&data->windows[3], 1); + + AddWindowParameterized(data->bgConfig, &data->windows[8], GF_BG_LYR_MAIN_2, win3Width + 9, 3, 7, 2, 0, 0x3C0); + FillWindowPixelBuffer(&data->windows[8], 1); + + if (data->type == NAME_SCREEN_GROUP) { + NamingScreen_PrintMessageOnWindowWithMargin(&data->windows[8], data->type, data->unk_184); + CopyWindowToVram(&data->windows[8]); + } + + AddWindowParameterized(data->bgConfig, &data->windows[9], GF_BG_LYR_SUB_0, 2, 19, 27, 4, 12, 0x084); + FillWindowPixelBuffer(&data->windows[9], 15); + NamingScreen_PrintMessageOnWindowLeftAlign(&data->windows[9], data->type, data->promptString); + + OverlayManager_GetArgs(ovyMan); + + if (data->entryBufBak[0] != EOS) { + CopyU16StringArray(data->entryBuf, data->entryBufBak); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + } + + for (int i = 0; i < 3; ++i) { + AddWindowParameterized(data->bgConfig, &data->windows[i + 4], GF_BG_LYR_MAIN_2, 0, 0, 2, 2, 0, 0x078); + FillWindowPixelBuffer(&data->windows[i + 4], 0); + } + + AddWindowParameterized(data->bgConfig, &data->windows[7], GF_BG_LYR_MAIN_2, 0, 0, 16, 2, 0, 0x084); + FillWindowPixelBuffer(&data->windows[7], 0); +} + +static void NamingScreen_SetPageBgPriorities(BgConfig *bgConfig, GFBgLayer bgId, VecFx32 *pos) { + SetBgPriority(bgId, 1); + SetBgPriority(bgId ^ 1, 2); +} + +static void NamingScreen_SetPagePgPosVecs(VecFx32 *posVecs, GFBgLayer bgId) { + posVecs[bgId].x = 238; + posVecs[bgId].y = -80; + posVecs[bgId ^ 1].x = -11; + posVecs[bgId ^ 1].y = -80; +} + +static const int sDpadMovementCoordDeltas[][2] = { + { 0, 0 }, + { 0, -1 }, + { 0, 1 }, + { -1, 0 }, + { 1, 0 }, +}; + +// If val is outside the range, clamp to the opposite side of that range +// The interval is right half open. +static int NamingScreen_WrapAroundWithinInterval(int val, int lo, int hi) { + if (val >= hi) { + val = lo; + } + if (val < lo) { + val = hi - 1; + } + return val; +} + +static void NamingScreen_MoveKeyboardCursor(NamingScreenAppData *data, int dpadMovement) { + // Only run this logic if the keyboard cursor is moving in response to dpad input. + if (dpadMovement == 0) { + return; + } + + u16 prevKey = data->keyboard[data->kbCursor.y][data->kbCursor.x]; + int newX = NamingScreen_WrapAroundWithinInterval(data->kbCursor.x + sDpadMovementCoordDeltas[dpadMovement][0], 0, 13); + int newY = NamingScreen_WrapAroundWithinInterval(data->kbCursor.y + sDpadMovementCoordDeltas[dpadMovement][1], 0, 6); + while (data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP || (data->keyboard[newY][newX] == prevKey && data->keyboard[newY][newX] > NAME_SCREEN_BUTTON_START)) { + if (data->kbCursor.prevY == 0 && data->keyboard[newY][newX] == NAME_SCREEN_CONTROL_SKIP && sDpadMovementCoordDeltas[dpadMovement][1] != 0) { + newX = NamingScreen_WrapAroundWithinInterval(newX + data->kbCursor.deltaX, 0, 13); + } else { + newX = NamingScreen_WrapAroundWithinInterval(newX + sDpadMovementCoordDeltas[dpadMovement][0], 0, 13); + newY = NamingScreen_WrapAroundWithinInterval(newY + sDpadMovementCoordDeltas[dpadMovement][1], 0, 6); + } + } + data->kbCursor.x = newX; + data->kbCursor.y = newY; +} + +static void NamingScreen_GetPlayerInput(NamingScreenAppData *data) { + int doUpdateCursor = 0; + int dpadMovement = 0; + BOOL buttonInputIsTransition = FALSE; + if (!Sprite_GetVisibleFlag(data->uiSprites[8])) { + buttonInputIsTransition = TRUE; + } + + if (gSystem.newAndRepeatedKeys & PAD_KEY_UP) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + dpadMovement = 1; + ++doUpdateCursor; + } + if (gSystem.newAndRepeatedKeys & PAD_KEY_DOWN) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + dpadMovement = 2; + ++doUpdateCursor; + } + if (gSystem.newAndRepeatedKeys & PAD_KEY_LEFT) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + dpadMovement = 3; + ++doUpdateCursor; + } + if (gSystem.newAndRepeatedKeys & PAD_KEY_RIGHT) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + dpadMovement = 4; + ++doUpdateCursor; + } + if (gSystem.newKeys & PAD_BUTTON_START) { + PlaySE(SEQ_SE_DP_SELECT); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + data->kbCursor.x = 12; + data->kbCursor.y = 0; + ++doUpdateCursor; + } + data->isTouchInput = NamingScreen_HandleTouchInput(data); + if (data->isTouchInput == TRUE) { + dpadMovement = 0; + ++doUpdateCursor; + } + if (buttonInputIsTransition == TRUE) { + doUpdateCursor = 0; + NamingScreen_UpdateCursorSpritePosition(data, dpadMovement); + } + if (doUpdateCursor) { + NamingScreen_MoveKeyboardCursor(data, dpadMovement); + NamingScreen_UpdateCursorSpritePosition(data, dpadMovement); + } +} + +static void NamingScreen_UpdateCursorSpritePosition(NamingScreenAppData *data, int dpadMovement) { + if (data->kbCursor.y != 0) { + if (data->kbCursor.prevY == 0 && data->kbCursor.prevY != data->kbCursor.y) { + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); + } + if (dpadMovement != 0) { + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); + } + + VecFx32 vec; + vec.x = (data->kbCursor.x * 16 + 26) * FX32_ONE; + vec.y = ((data->kbCursor.y - 1) * 19 + 91) * FX32_ONE; + // vec.z = 0; + Sprite_SetMatrix(data->uiSprites[8], &vec); + } else { + int buttonId = data->keyboard[data->kbCursor.y][data->kbCursor.x] - NAME_SCREEN_BUTTON_PAGE_UPPER; + VecFx32 vec; + + vec.x = sHomeRowCursorXCoords[buttonId] * FX32_ONE; + vec.y = FX32_CONST(68); + // vec.z = 0; + Sprite_SetAnimCtrlSeq(data->uiSprites[8], sHomeRowCursorAnimIDs[buttonId]); + Sprite_SetMatrix(data->uiSprites[8], &vec); + } + + data->plttGlowEffectAngle = 180; + Sprite_SetAnimCtrlCurrentFrame(data->uiSprites[8], 0); + data->kbCursor.prevX = data->kbCursor.x; + data->kbCursor.prevY = data->kbCursor.y; + if (sDpadMovementCoordDeltas[dpadMovement][0] != 0) { + data->kbCursor.deltaX = sDpadMovementCoordDeltas[dpadMovement][0]; + } +} + +static void NamingScreen_PaletteGlowEffect(u16 *pSinArg) { + *pSinArg += 20; + if (*pSinArg > 360) { + *pSinArg = 0; + } + int val = ((GF_SinDeg(*pSinArg) * 10) / FX32_ONE) + 15; + u16 col = RGB(29, val, 0); + GX_LoadOBJPltt(&col, 0x3A, sizeof(col)); +} + +static void NamingScreen_BlitRawCharactersToWindow(Window *window, const u16 *rawChars, int x, int y, int spacing, int textSpeed, u32 color, u8 *buttonPixels) { + int i = 0; + int width; + int centerX; + u16 pmCharBuf[2]; + String *string = String_New(2, HEAP_ID_NAMING_SCREEN); + while (rawChars[i] != EOS) { + if (rawChars[i] == NAME_SCREEN_CONTROL_DAKU || rawChars[i] == NAME_SCREEN_CONTROL_HANDAKU || rawChars[i] == NAME_SCREEN_CONTROL_SPACE) { + // This is unreachable outside of Japan. + u16 buttonId = rawChars[i] - NAME_SCREEN_CONTROL_DAKU; + BlitBitmapRectToWindow(window, buttonPixels + (buttonId * 256) / 2, 0, 0, 12, 12, x + i * spacing, y + 2, 12, 12); + } else if (rawChars[i] == NAME_SCREEN_CONTROL_SKIP) { + ++i; + continue; + } else { + pmCharBuf[0] = rawChars[i]; + pmCharBuf[1] = EOS; + width = FontID_FlatArray_GetWidth(0, pmCharBuf, 0); + CopyU16ArrayToString(string, pmCharBuf); + centerX = x + i * spacing + ((spacing - width) / 2); + AddTextPrinterParameterizedWithColor(window, 0, string, centerX, y, textSpeed, color, NULL); + } + ++i; + } + String_Delete(string); +} + +static const u8 _02101D3C[] = { 0x60, 0x68, 0x50, 0x58 }; + +static void *NamingScreen_PrintStringOnWindow_GetPixelBuffer(Window *window, String *string, FontID fontId, u32 color) { + AddTextPrinterParameterizedWithColor(window, fontId, string, 0, 0, TEXT_SPEED_NOTRANSFER, color, NULL); + return window->pixelBuffer; +} + +static void NamingScreen_PrintCharacterOnWindowAndOBJ(Window *windows, const u16 *tmpBuf, void *charBuf, String *string) { + u16 curCharBuf[21]; + u16 i; + void *ptr; + String *string2; + + FillWindowPixelBuffer(&windows[3], 0); + ptr = NamingScreen_PrintStringOnWindow_GetPixelBuffer(&windows[3], string, 2, MAKE_TEXT_COLOR(13, 14, 15)); + DC_FlushRange(ptr, 0x800); + + for (i = 0; i < 4; ++i) { + sub_02013A50(&windows[3], 4, 2, i * 4, 0, charBuf); + DC_FlushRange(charBuf, 0x100); + GXS_LoadOBJ(charBuf, _02101D3C[i] * 32, 0x100); + } + + string2 = String_New(21, HEAP_ID_NAMING_SCREEN); + for (i = 0; i < 3; ++i) { + curCharBuf[0] = tmpBuf[i]; + curCharBuf[1] = EOS; + + FillWindowPixelBuffer(&windows[i], 0); + CopyU16ArrayToString(string2, curCharBuf); + ptr = NamingScreen_PrintStringOnWindow_GetPixelBuffer(&windows[i], string2, 2, MAKE_TEXT_COLOR(13, 14, 15)); + DC_FlushRange(ptr, 0x80); + GXS_LoadOBJ(ptr, sSpriteGfxOffsets[i] * 32, 0x80); + } + + String_Delete(string2); +} + +static void NamingScreen_PrintLastCharacterOfEntryBuf(Window *window, u16 *entryBuf, u16 cursorPos, u16 *tmpBuf, void *charBuf, String *string) { + int i; + int j; + u16 character; + + if (cursorPos == 0) { + character = NAME_SCREEN_CONTROL_SPACE; + } else { + character = entryBuf[cursorPos - 1]; + } + + switch (character) { + case NAME_SCREEN_CONTROL_DAKU: + case NAME_SCREEN_CONTROL_HANDAKU: + case NAME_SCREEN_CONTROL_SPACE: + case NAME_SCREEN_CONTROL_SKIP: + case NAME_SCREEN_BUTTON_PAGE_UPPER: + case NAME_SCREEN_BUTTON_PAGE_LOWER: + case NAME_SCREEN_BUTTON_PAGE_SYMBOLS: + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED: + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: + case NAME_SCREEN_BUTTON_BACK: + case NAME_SCREEN_BUTTON_OK: + character = CHAR_JP_SPACE; + break; + } + + for (i = 0; i < 3; ++i) { + tmpBuf[i] = CHAR_JP_SPACE; + } + + tmpBuf[0] = character; + if (character != CHAR_JP_SPACE) { + for (i = 0; i < NELEMS(sJpCharConvTable); ++i) { + if (character == sJpCharConvTable[i][0]) { + for (j = 0; j < 3; ++j) { + tmpBuf[j] = sJpCharConvTable[i][j]; + } + break; + } + if (character == sJpCharConvTable[i][2]) { + for (j = 0; j < 3; ++j) { + tmpBuf[j] = sJpCharConvTable[i][j]; + } + break; + } + } + } + + NamingScreen_PrintCharacterOnWindowAndOBJ(window, tmpBuf, charBuf, string); +} + +static void NamingScreen_LoadKeyboardLayout(u16 (*keyboard)[13], const int pageNum) { + int i; + int j; + + for (i = 0; i < 13; ++i) { + keyboard[0][i] = sKeyboardHomeRowLayoutPtrs[pageNum][i]; + } + for (j = 0; j < 5; ++j) { + for (i = 0; i < 13; ++i) { + keyboard[j + 1][i] = sKeyboardLayoutPtrs[pageNum][j][i]; + } + } +} + +static NamingScreenMainState NamingScreen_HandleCharacterInput(NamingScreenAppData *data, u16 key, BOOL isButtonInput) { + if (key == NAME_SCREEN_CONTROL_SPACE || key == NAME_SCREEN_CONTROL_SKIP) { + key = CHAR_JP_SPACE; + } + if (data->type == NAME_SCREEN_UNK4) { + if (key == NAME_SCREEN_BUTTON_PAGE_UPPER || key == NAME_SCREEN_BUTTON_PAGE_LOWER || key == NAME_SCREEN_BUTTON_PAGE_SYMBOLS || key == NAME_SCREEN_BUTTON_PAGE_JP_UNUSED) { + key = CHAR_JP_SPACE; + } + } + if (!Sprite_GetVisibleFlag(data->uiSprites[8]) && gSystem.touchNew == 0) { + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + return NS_MAIN_STATE_INPUT_LOOP; + } + + switch (key) { + case NAME_SCREEN_CONTROL_DAKU: + if (NamingScreen_JP_FlipDiacritic(CHARCONVTBL_DAKU_BEGIN, NELEMS(sJpCharConvTable), 1, NAME_SCREEN_CONTROL_DAKU, data->entryBuf, data->textCursorPos)) { + FillWindowPixelBuffer(&data->windows[3], 1); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + PlaySE(SEQ_SE_DP_BOX02); + } + break; + case NAME_SCREEN_CONTROL_HANDAKU: + if (NamingScreen_JP_FlipDiacritic(CHARCONVTBL_HANDAKU_BEGIN, NELEMS(sJpCharConvTable), 2, NAME_SCREEN_CONTROL_HANDAKU, data->entryBuf, data->textCursorPos)) { + FillWindowPixelBuffer(&data->windows[3], 1); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + PlaySE(SEQ_SE_DP_BOX02); + } + break; + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: + if (NamingScreen_JP_FlipAlphaCase(CHARCONVTBL_ALPHA_BEGIN, NELEMS(sJpCharConvTable), data->entryBuf, data->textCursorPos)) { + FillWindowPixelBuffer(&data->windows[3], 1); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + ++data->spriteAnimUpdateReq[4]; + PlaySE(SEQ_SE_DP_BOX02); + } + break; + case NAME_SCREEN_BUTTON_PAGE_UPPER: + case NAME_SCREEN_BUTTON_PAGE_LOWER: + case NAME_SCREEN_BUTTON_PAGE_SYMBOLS: + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED: + if (data->pageNum != key - NAME_SCREEN_BUTTON_PAGE_UPPER) { + data->pageSwitchState = NS_PAGESWITCH_STATE_DRAW_NEW_PAGE; + data->pageNum = key - NAME_SCREEN_BUTTON_PAGE_UPPER; + NamingScreen_LoadKeyboardLayout(data->keyboard, data->pageNum); + ++data->spriteAnimUpdateReq[key - NAME_SCREEN_BUTTON_PAGE_UPPER]; + PlaySE(SEQ_SE_DP_SYU03); + } + break; + case NAME_SCREEN_BUTTON_BACK: + if (data->textCursorPos != 0) { + data->entryBuf[data->textCursorPos - 1] = EOS; + --data->textCursorPos; + FillWindowPixelBuffer(&data->windows[3], 1); + if (data->textCursorPos == 0) { + CopyWindowToVram(&data->windows[3]); + } else { + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + } + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->tmpBuf, data->charBuf, data->unkJapaneseString); + NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(data->textEntrySprites, data->textCursorPos, data->maxLen); + ++data->spriteAnimUpdateReq[5]; + PlaySE(SEQ_SE_DP_SELECT); + } + break; + case NAME_SCREEN_BUTTON_OK: + sub_020164C4(data->unk_5C4); + if (!data->printedFromBattleGMM) { + PlaySE(SEQ_SE_DP_PIRORIRO); + ++data->spriteAnimUpdateReq[6]; + BeginNormalPaletteFade(2, 0, 0, RGB_BLACK, 16, 1, HEAP_ID_NAMING_SCREEN); + NamingScreen_UpdateFieldMenuInputState(data, isButtonInput); + return NS_MAIN_STATE_WAIT_FADE_OUT; + } else { + data->pageSwitchState = NS_PAGESWITCH_STATE_PRINT_BATTLE_MESSAGE; + } + break; + default: + if (data->pageNum == 4 && key == CHAR_JP_SPACE) { + return NS_MAIN_STATE_INPUT_LOOP; + } + if (data->textCursorPos != data->maxLen) { + data->entryBuf[data->textCursorPos] = key; + FillWindowPixelBuffer(&data->windows[3], 1); + NamingScreen_BlitRawCharactersToWindow(&data->windows[3], data->entryBuf, 0, 0, 12, TEXT_SPEED_INSTANT, MAKE_TEXT_COLOR(14, 15, 1), NULL); + ++data->textCursorPos; + NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(data->textEntrySprites, data->textCursorPos, data->maxLen); + PlaySE(SEQ_SE_DP_BOX02); + Sprite_SetVisibleFlag(data->uiSprites[8], TRUE); + Sprite_SetOamMode(data->uiSprites[8], GX_OAM_MODE_XLU); + G2_SetBlendAlpha(0, GX_BLEND_PLANEMASK_BG0 | GX_BLEND_PLANEMASK_BG1 | GX_BLEND_PLANEMASK_BG2, 8, 8); + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 60); + if (data->textCursorPos == data->maxLen) { + data->kbCursor.ignoreInput = TRUE; + } + NamingScreen_PrintLastCharacterOfEntryBuf(&data->windows[4], data->entryBuf, data->textCursorPos, data->tmpBuf, data->charBuf, data->unkJapaneseString); + } + break; + } + + return NS_MAIN_STATE_INPUT_LOOP; +} + +static void NamingScreen_UpdateFieldMenuInputState(NamingScreenAppData *data, BOOL toggle) { + if (data->pMenuInputState != NULL) { + if (toggle == TRUE) { + sub_02018410(data->pMenuInputState, FALSE); + } else { + sub_02018410(data->pMenuInputState, TRUE); + } + } +} + +static int NamingScreen_SearchJpConvTableForNonSpace(const u16 *table, int pos) { + do { + pos = NamingScreen_WrapAroundWithinInterval(pos + 1, 0, 3); + } while (table[pos] == CHAR_JP_SPACE); + return table[pos]; +} + +static BOOL NamingScreen_JP_FlipAlphaCase(int tableStart, int tableEnd, u16 *pmCharBuf, int cursorPos) { + int i; + int j; + u16 key; + + if (cursorPos == 0) { + return FALSE; + } + key = pmCharBuf[cursorPos - 1]; + for (i = tableStart; i < tableEnd; ++i) { + for (j = 0; j < 3; ++j) { + // This whole loop could be bypassed by simply checking whether key is space up-front + if (key == sJpCharConvTable[i][j] && key != CHAR_JP_SPACE) { + pmCharBuf[cursorPos - 1] = NamingScreen_SearchJpConvTableForNonSpace(sJpCharConvTable[i], j); + return TRUE; + } + } + } + + return FALSE; +} + +static BOOL NamingScreen_JP_FlipDiacritic(int tableStart, int tableEnd, int convColno, int mode, u16 *pmCharBuf, int cursorPos) { + int i; + u16 key; + + if (cursorPos == 0 || pmCharBuf[cursorPos - 1] == CHAR_JP_SPACE) { + return FALSE; + } + key = pmCharBuf[cursorPos - 1]; + for (i = tableStart; i < tableEnd; ++i) { + if (key == sJpCharConvTable[i][0]) { + pmCharBuf[cursorPos - 1] = sJpCharConvTable[i][convColno]; + return TRUE; + } + } + for (i = tableStart; i < tableEnd; ++i) { + if (key == sJpCharConvTable[i][convColno]) { + pmCharBuf[cursorPos - 1] = sJpCharConvTable[i][0]; + return TRUE; + } + } + switch (mode) { + case NAME_SCREEN_CONTROL_DAKU: + for (i = 0; i < NELEMS(sDakutenTable); ++i) { + if (key == sDakutenTable[i][0]) { + pmCharBuf[cursorPos - 1] = sDakutenTable[i][1]; + return TRUE; + } + } + break; + case NAME_SCREEN_CONTROL_HANDAKU: + for (i = 0; i < NELEMS(sHandakutenTable); ++i) { + if (key == sHandakutenTable[i][0]) { + pmCharBuf[cursorPos - 1] = sHandakutenTable[i][1]; + return TRUE; + } + } + break; + case NAME_SCREEN_BUTTON_PAGE_JP_UNUSED_2: + if (key == CHAR_JP_HIRA_DU) { + pmCharBuf[cursorPos - 1] = CHAR_JP_HIRA_TU_SMALL; + return TRUE; + } + if (key == CHAR_JP_KATA_DU) { + pmCharBuf[cursorPos - 1] = CHAR_JP_KATA_TU_SMALL; + return TRUE; + } + break; + } + + return FALSE; +} + +static void NamingScreen_UpdateSprite_HighlightedCharacterInInputBuffer(Sprite **sprites, int cursorPos, int maxLen) { + for (int i = 0; i < maxLen; ++i) { + Sprite_SetAnimCtrlSeq(sprites[i], 43); + } + if (cursorPos != maxLen) { + Sprite_SetAnimCtrlSeq(sprites[cursorPos], 44); + } +} + +static const u8 sKeyboardFillValues[] = { 0x03, 0x06, 0x0C, 0x09, 0x09 }; + +static void NamingScreen_DrawKeyboardOnWindow(Window *window, u16 fillVal, int pageNum, u32 textColor, u8 *pRawData) { + FillWindowPixelBuffer(window, fillVal); + + for (int i = 0; i < 6; ++i) { + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i + 16, 0, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i + 16, 38, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i + 16, 76, 16, 19); + } + + for (int i = 0; i < 7; ++i) { + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i, 19, 16, 19); + FillWindowPixelRect(window, sKeyboardFillValues[pageNum], 32 * i, 57, 16, 19); + } + + for (int i = 0; i < 5; ++i) { + NamingScreen_BlitRawCharactersToWindow(window, sKeyboardLayoutPtrs[pageNum][i], 0, 19 * i + 4, 16, TEXT_SPEED_NOTRANSFER, textColor, pRawData); + } + + CopyWindowToVram(window); +} + +static void NamingScreen_UpdateSpritesAnims(BOOL *req, Sprite **sprites, int pageNum) { + for (int i = 0; i < 3; ++i) { + if (req[i]) { + for (int j = 0; j < 3; ++j) { + Sprite_SetAnimCtrlSeq(sprites[j], sUISpritesParam[j][2]); + } + Sprite_SetAnimCtrlSeq(sprites[i], sUISpritesParam[i][2] - 3); + break; + } + } + for (int i = 5; i < 7; ++i) { + if (req[i]) { + Sprite_SetAnimCtrlSeq(sprites[i], sUISpritesParam[i][2] + 1); + } + } + for (int i = 0; i < 7; ++i) { + req[i] = FALSE; + } +} + +static void NamingScreen_PlaceCursorSprite(NamingScreenAppData *data) { + if (Sprite_IsCellAnimationRunning(data->uiSprites[8])) { + return; + } + + if (data->textCursorPos == data->maxLen) { + data->kbCursor.x = 12; + data->kbCursor.y = 0; + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); + data->kbCursor.ignoreInput = FALSE; + } else { + Sprite_SetAnimCtrlSeq(data->uiSprites[8], 39); + } + if (!data->kbCursor.showCursor) { + Sprite_SetVisibleFlag(data->uiSprites[8], FALSE); + } else { + NamingScreen_UpdateCursorSpritePosition(data, 0); + } + Sprite_SetOamMode(data->uiSprites[8], GX_OAM_MODE_NORMAL); +} + +static const NamingScreenTouchHitboxDef sTouchHitboxDef[] = { + { .x = 0x19, .y = 0x3C, .sizeParam = 0, .cursorX = 0, .cursorY = 0 }, + { .x = 0x39, .y = 0x3C, .sizeParam = 0, .cursorX = 2, .cursorY = 0 }, + { .x = 0x59, .y = 0x3C, .sizeParam = 0, .cursorX = 4, .cursorY = 0 }, + { .x = 0x00, .y = 0xC0, .sizeParam = 0, .cursorX = 4, .cursorY = 0 }, + { .x = 0x9D, .y = 0x3C, .sizeParam = 1, .cursorX = 8, .cursorY = 0 }, + { .x = 0xC5, .y = 0x3C, .sizeParam = 1, .cursorX = 11, .cursorY = 0 }, + { .x = 0x1C, .y = 0x58, .sizeParam = 2, .cursorX = 0, .cursorY = 1 }, + { .x = 0x2C, .y = 0x58, .sizeParam = 2, .cursorX = 1, .cursorY = 1 }, + { .x = 0x3C, .y = 0x58, .sizeParam = 2, .cursorX = 2, .cursorY = 1 }, + { .x = 0x4C, .y = 0x58, .sizeParam = 2, .cursorX = 3, .cursorY = 1 }, + { .x = 0x5C, .y = 0x58, .sizeParam = 2, .cursorX = 4, .cursorY = 1 }, + { .x = 0x6C, .y = 0x58, .sizeParam = 2, .cursorX = 5, .cursorY = 1 }, + { .x = 0x7C, .y = 0x58, .sizeParam = 2, .cursorX = 6, .cursorY = 1 }, + { .x = 0x8C, .y = 0x58, .sizeParam = 2, .cursorX = 7, .cursorY = 1 }, + { .x = 0x9C, .y = 0x58, .sizeParam = 2, .cursorX = 8, .cursorY = 1 }, + { .x = 0xAC, .y = 0x58, .sizeParam = 2, .cursorX = 9, .cursorY = 1 }, + { .x = 0xBC, .y = 0x58, .sizeParam = 2, .cursorX = 10, .cursorY = 1 }, + { .x = 0xCC, .y = 0x58, .sizeParam = 2, .cursorX = 11, .cursorY = 1 }, + { .x = 0xDC, .y = 0x58, .sizeParam = 2, .cursorX = 12, .cursorY = 1 }, + { .x = 0x1C, .y = 0x6B, .sizeParam = 2, .cursorX = 0, .cursorY = 2 }, + { .x = 0x2C, .y = 0x6B, .sizeParam = 2, .cursorX = 1, .cursorY = 2 }, + { .x = 0x3C, .y = 0x6B, .sizeParam = 2, .cursorX = 2, .cursorY = 2 }, + { .x = 0x4C, .y = 0x6B, .sizeParam = 2, .cursorX = 3, .cursorY = 2 }, + { .x = 0x5C, .y = 0x6B, .sizeParam = 2, .cursorX = 4, .cursorY = 2 }, + { .x = 0x6C, .y = 0x6B, .sizeParam = 2, .cursorX = 5, .cursorY = 2 }, + { .x = 0x7C, .y = 0x6B, .sizeParam = 2, .cursorX = 6, .cursorY = 2 }, + { .x = 0x8C, .y = 0x6B, .sizeParam = 2, .cursorX = 7, .cursorY = 2 }, + { .x = 0x9C, .y = 0x6B, .sizeParam = 2, .cursorX = 8, .cursorY = 2 }, + { .x = 0xAC, .y = 0x6B, .sizeParam = 2, .cursorX = 9, .cursorY = 2 }, + { .x = 0xBC, .y = 0x6B, .sizeParam = 2, .cursorX = 10, .cursorY = 2 }, + { .x = 0xCC, .y = 0x6B, .sizeParam = 2, .cursorX = 11, .cursorY = 2 }, + { .x = 0xDC, .y = 0x6B, .sizeParam = 2, .cursorX = 12, .cursorY = 2 }, + { .x = 0x1C, .y = 0x7E, .sizeParam = 2, .cursorX = 0, .cursorY = 3 }, + { .x = 0x2C, .y = 0x7E, .sizeParam = 2, .cursorX = 1, .cursorY = 3 }, + { .x = 0x3C, .y = 0x7E, .sizeParam = 2, .cursorX = 2, .cursorY = 3 }, + { .x = 0x4C, .y = 0x7E, .sizeParam = 2, .cursorX = 3, .cursorY = 3 }, + { .x = 0x5C, .y = 0x7E, .sizeParam = 2, .cursorX = 4, .cursorY = 3 }, + { .x = 0x6C, .y = 0x7E, .sizeParam = 2, .cursorX = 5, .cursorY = 3 }, + { .x = 0x7C, .y = 0x7E, .sizeParam = 2, .cursorX = 6, .cursorY = 3 }, + { .x = 0x8C, .y = 0x7E, .sizeParam = 2, .cursorX = 7, .cursorY = 3 }, + { .x = 0x9C, .y = 0x7E, .sizeParam = 2, .cursorX = 8, .cursorY = 3 }, + { .x = 0xAC, .y = 0x7E, .sizeParam = 2, .cursorX = 9, .cursorY = 3 }, + { .x = 0xBC, .y = 0x7E, .sizeParam = 2, .cursorX = 10, .cursorY = 3 }, + { .x = 0xCC, .y = 0x7E, .sizeParam = 2, .cursorX = 11, .cursorY = 3 }, + { .x = 0xDC, .y = 0x7E, .sizeParam = 2, .cursorX = 12, .cursorY = 3 }, + { .x = 0x1C, .y = 0x91, .sizeParam = 2, .cursorX = 0, .cursorY = 4 }, + { .x = 0x2C, .y = 0x91, .sizeParam = 2, .cursorX = 1, .cursorY = 4 }, + { .x = 0x3C, .y = 0x91, .sizeParam = 2, .cursorX = 2, .cursorY = 4 }, + { .x = 0x4C, .y = 0x91, .sizeParam = 2, .cursorX = 3, .cursorY = 4 }, + { .x = 0x5C, .y = 0x91, .sizeParam = 2, .cursorX = 4, .cursorY = 4 }, + { .x = 0x6C, .y = 0x91, .sizeParam = 2, .cursorX = 5, .cursorY = 4 }, + { .x = 0x7C, .y = 0x91, .sizeParam = 2, .cursorX = 6, .cursorY = 4 }, + { .x = 0x8C, .y = 0x91, .sizeParam = 2, .cursorX = 7, .cursorY = 4 }, + { .x = 0x9C, .y = 0x91, .sizeParam = 2, .cursorX = 8, .cursorY = 4 }, + { .x = 0xAC, .y = 0x91, .sizeParam = 2, .cursorX = 9, .cursorY = 4 }, + { .x = 0xBC, .y = 0x91, .sizeParam = 2, .cursorX = 10, .cursorY = 4 }, + { .x = 0xCC, .y = 0x91, .sizeParam = 2, .cursorX = 11, .cursorY = 4 }, + { .x = 0xDC, .y = 0x91, .sizeParam = 2, .cursorX = 12, .cursorY = 4 }, + { .x = 0x1C, .y = 0xA4, .sizeParam = 2, .cursorX = 0, .cursorY = 5 }, + { .x = 0x2C, .y = 0xA4, .sizeParam = 2, .cursorX = 1, .cursorY = 5 }, + { .x = 0x3C, .y = 0xA4, .sizeParam = 2, .cursorX = 2, .cursorY = 5 }, + { .x = 0x4C, .y = 0xA4, .sizeParam = 2, .cursorX = 3, .cursorY = 5 }, + { .x = 0x5C, .y = 0xA4, .sizeParam = 2, .cursorX = 4, .cursorY = 5 }, + { .x = 0x6C, .y = 0xA4, .sizeParam = 2, .cursorX = 5, .cursorY = 5 }, + { .x = 0x7C, .y = 0xA4, .sizeParam = 2, .cursorX = 6, .cursorY = 5 }, + { .x = 0x8C, .y = 0xA4, .sizeParam = 2, .cursorX = 7, .cursorY = 5 }, + { .x = 0x9C, .y = 0xA4, .sizeParam = 2, .cursorX = 8, .cursorY = 5 }, + { .x = 0xAC, .y = 0xA4, .sizeParam = 2, .cursorX = 9, .cursorY = 5 }, + { .x = 0xBC, .y = 0xA4, .sizeParam = 2, .cursorX = 10, .cursorY = 5 }, + { .x = 0xCC, .y = 0xA4, .sizeParam = 2, .cursorX = 11, .cursorY = 5 }, + { .x = 0xDC, .y = 0xA4, .sizeParam = 2, .cursorX = 12, .cursorY = 5 }, +}; + +static BOOL NamingScreen_HandleTouchInput(NamingScreenAppData *data) { + int i; + int start = 0; + u8 x; + u8 y; + u8 x0; + u8 y0; + u8 dx; + u8 dy; + if (data->type == NAME_SCREEN_UNK4) { + start = 4; + } + if (gSystem.touchNew) { + x = gSystem.touchX; + y = gSystem.touchY; + + for (i = start; i < NELEMS(sTouchHitboxDef); ++i) { + x0 = sTouchHitboxDef[i].x; + y0 = sTouchHitboxDef[i].y; + switch (sTouchHitboxDef[i].sizeParam) { + case 0: + dx = 31; + dy = 22; + break; + case 1: + dx = 32; + dy = 22; + break; + case 2: + dx = 16; + dy = 19; + break; + } + if (x >= x0 && y >= y0 && x <= x0 + dx && y <= y0 + dy) { + data->kbCursor.x = sTouchHitboxDef[i].cursorX; + data->kbCursor.y = sTouchHitboxDef[i].cursorY; + return TRUE; + } + } + } + + return FALSE; +} diff --git a/src/oaks_speech.c b/src/oaks_speech.c index 8ec5fffb3e..4926a9ba30 100644 --- a/src/oaks_speech.c +++ b/src/oaks_speech.c @@ -14,6 +14,7 @@ #include "launch_application.h" #include "main.h" #include "math_util.h" +#include "naming_screen.h" #include "oaks_speech_internal.h" #include "overlay_36.h" #include "overlay_manager.h" @@ -26,7 +27,6 @@ #include "touchscreen.h" #include "unk_02005D10.h" #include "unk_0200FA24.h" -#include "unk_02082908.h" #include "yes_no_prompt.h" FS_EXTERN_OVERLAY(OVY_36); @@ -641,7 +641,7 @@ BOOL OakSpeech_Exit(OVY_MANAGER *ovyMan, int *pState) { HeapID heapId = data->heapId; FontID_Release(4); PlayerName_StringToFlat(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->nameInputString); - PlayerProfile_SetTrainerGender(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->playerGender); + PlayerProfile_SetTrainerGender(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->playerGenderOrMonSpecies); Save_Misc_RivalName_Set(Save_Misc_Get(data->saveData), data->namingScreenArgs_Rival->nameInputString); NamingScreen_DeleteArgs(data->namingScreenArgs_Player); NamingScreen_DeleteArgs(data->namingScreenArgs_Rival); @@ -2008,9 +2008,9 @@ static BOOL OakSpeech_DoMainTask(OakSpeechData *data) { case OAK_SPEECH_MAIN_STATE_PROMPT_NAME_LAUNCH_NAMING_SCREEN: String_SetEmpty(data->namingScreenArgs_Player->nameInputString); - data->namingScreenArgs_Player->playerGender = data->playerGender; - data->overlayManager = OverlayManager_New(&sOverlayTemplate_NamingScreen, data->namingScreenArgs_Player, data->heapId); - data->state = OAK_SPEECH_MAIN_STATE_PROMPT_NAME_RESTORE_GRAPHICS_AFTER; + data->namingScreenArgs_Player->playerGenderOrMonSpecies = data->playerGender; + data->overlayManager = OverlayManager_New(&gOverlayTemplate_NamingScreen, data->namingScreenArgs_Player, data->heapId); + data->state = OAK_SPEECH_MAIN_STATE_PROMPT_NAME_RESTORE_GRAPHICS_AFTER; break; case OAK_SPEECH_MAIN_STATE_PROMPT_NAME_RESTORE_GRAPHICS_AFTER: diff --git a/src/save_data_read_error.c b/src/save_data_read_error.c index 6aa69035da..469351fe86 100644 --- a/src/save_data_read_error.c +++ b/src/save_data_read_error.c @@ -87,7 +87,7 @@ void ShowSaveDataReadError(HeapID heapId) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sDataReadErrorBanksConfig); @@ -146,7 +146,7 @@ void ShowGBACartRemovedError(HeapID heapId) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sDataReadErrorBanksConfig); diff --git a/src/save_data_write_error.c b/src/save_data_write_error.c index 37f2524024..4cdbf1209b 100644 --- a/src/save_data_write_error.c +++ b/src/save_data_write_error.c @@ -96,7 +96,7 @@ void ShowSaveDataWriteError(HeapID heapId, int code) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sDataWriteErrorBanksConfig); diff --git a/src/sprite.c b/src/sprite.c index 902d68e972..cadc85ab61 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -398,7 +398,7 @@ u8 Sprite_GetPalOffset(Sprite *sprite) { return sprite->palOffset; } -void Sprite_SetDrawPriority(Sprite *sprite, u16 priority) { +void Sprite_SetDrawPriority(Sprite *sprite, u32 priority) { SpriteList *spriteList = sprite->spriteList; sprite->drawPriority = priority; Sprite_EjectFromList(sprite); diff --git a/src/wfc_user_info_warning.c b/src/wfc_user_info_warning.c index 97a3b89034..c09c0b8c93 100644 --- a/src/wfc_user_info_warning.c +++ b/src/wfc_user_info_warning.c @@ -85,7 +85,7 @@ void ShowWFCUserInfoWarning(HeapID heapId, int a1) { GfGfx_SwapDisplay(); G2_BlendNone(); G2S_BlendNone(); - GX_SetVisibleWnd(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); GXS_SetVisibleWnd(0); GfGfx_SetBanks(&sWFCWarningMsgBanksConfig);