Decompile map_name_popup

This commit is contained in:
KDSKardabox 2018-04-09 12:52:28 +05:30
parent 3948614bff
commit a18dc6aa80
7 changed files with 460 additions and 644 deletions

View File

@ -1,570 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_80D47D4
sub_80D47D4: @ 80D47D4
push {lr}
bl HideStartMenu
bl ShowMapNamePopup
movs r0, 0x1
pop {r1}
bx r1
thumb_func_end sub_80D47D4
thumb_func_start ShowMapNamePopup
ShowMapNamePopup: @ 80D47E4
push {r4,lr}
movs r0, 0x80
lsls r0, 7
bl FlagGet
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
beq _080D486C
ldr r4, =Task_MapNamePopUpWindow
adds r0, r4, 0
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
bne _080D4844
adds r0, r4, 0
movs r1, 0x5A
bl CreateTask
ldr r4, =gUnknown_02039DD4
strb r0, [r4]
movs r0, 0x12
movs r1, 0x28
bl SetGpuReg
ldr r2, =gTasks
ldrb r1, [r4]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0x6
strh r1, [r0, 0x8]
ldrb r1, [r4]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
movs r1, 0x28
strh r1, [r0, 0xC]
b _080D486C
.pool
_080D4844:
ldr r3, =gTasks
ldr r2, =gUnknown_02039DD4
ldrb r0, [r2]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r3
movs r4, 0x8
ldrsh r0, [r1, r4]
cmp r0, 0x2
beq _080D485E
movs r0, 0x2
strh r0, [r1, 0x8]
_080D485E:
ldrb r0, [r2]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r3
movs r0, 0x1
strh r0, [r1, 0xE]
_080D486C:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end ShowMapNamePopup
thumb_func_start Task_MapNamePopUpWindow
Task_MapNamePopUpWindow: @ 80D487C
push {r4,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks
adds r4, r1, r0
movs r2, 0x8
ldrsh r1, [r4, r2]
adds r3, r0, 0
cmp r1, 0x6
bhi _080D4966
lsls r0, r1, 2
ldr r1, =_080D48A8
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080D48A8:
.4byte _080D48DE
.4byte _080D4908
.4byte _080D4920
.4byte _080D4966
.4byte _080D494C
.4byte _080D4960
.4byte _080D48C4
_080D48C4:
ldrh r0, [r4, 0x10]
adds r0, 0x1
movs r1, 0
strh r0, [r4, 0x10]
lsls r0, 16
asrs r0, 16
cmp r0, 0x1E
ble _080D4966
strh r1, [r4, 0x8]
strh r1, [r4, 0x10]
bl ShowMapNamePopUpWindow
b _080D4966
_080D48DE:
ldrh r0, [r4, 0xC]
subs r0, 0x2
movs r2, 0
strh r0, [r4, 0xC]
lsls r0, 16
cmp r0, 0
bgt _080D4966
strh r2, [r4, 0xC]
movs r0, 0x1
strh r0, [r4, 0x8]
ldr r0, =gUnknown_02039DD4
ldrb r1, [r0]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r3
strh r2, [r0, 0xA]
b _080D4966
.pool
_080D4908:
ldrh r0, [r4, 0xA]
adds r0, 0x1
strh r0, [r4, 0xA]
lsls r0, 16
asrs r0, 16
cmp r0, 0x78
ble _080D4966
movs r0, 0
strh r0, [r4, 0xA]
movs r0, 0x2
strh r0, [r4, 0x8]
b _080D4966
_080D4920:
ldrh r0, [r4, 0xC]
adds r0, 0x2
movs r1, 0
strh r0, [r4, 0xC]
lsls r0, 16
asrs r0, 16
cmp r0, 0x27
ble _080D4966
movs r0, 0x28
strh r0, [r4, 0xC]
movs r2, 0xE
ldrsh r0, [r4, r2]
cmp r0, 0
beq _080D4946
movs r0, 0x6
strh r0, [r4, 0x8]
strh r1, [r4, 0x10]
strh r1, [r4, 0xE]
b _080D4966
_080D4946:
movs r0, 0x4
strh r0, [r4, 0x8]
b _080D496E
_080D494C:
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
bl sub_819746C
movs r0, 0x5
strh r0, [r4, 0x8]
b _080D4966
_080D4960:
bl HideMapNamePopUpWindow
b _080D496E
_080D4966:
ldrh r1, [r4, 0xC]
movs r0, 0x12
bl SetGpuReg
_080D496E:
pop {r4}
pop {r0}
bx r0
thumb_func_end Task_MapNamePopUpWindow
thumb_func_start HideMapNamePopUpWindow
HideMapNamePopUpWindow: @ 80D4974
push {lr}
ldr r0, =Task_MapNamePopUpWindow
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
beq _080D49A4
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x1
bl sub_819746C
bl RemoveMapNamePopUpWindow
movs r0, 0x12
movs r1, 0
bl SetGpuReg_ForcedBlank
ldr r0, =gUnknown_02039DD4
ldrb r0, [r0]
bl DestroyTask
_080D49A4:
pop {r0}
bx r0
.pool
thumb_func_end HideMapNamePopUpWindow
thumb_func_start ShowMapNamePopUpWindow
ShowMapNamePopUpWindow: @ 80D49B0
push {r4,r5,lr}
sub sp, 0x24
bl InBattlePyramid
lsls r0, 24
cmp r0, 0
beq _080D4A08
ldr r0, =gMapHeader
ldrh r1, [r0, 0x12]
movs r0, 0xBD
lsls r0, 1
cmp r1, r0
bne _080D49DC
mov r4, sp
adds r4, 0xF
ldr r0, =gUnknown_0857F544
ldr r1, [r0, 0x1C]
b _080D49F2
.pool
_080D49DC:
mov r4, sp
adds r4, 0xF
ldr r1, =gUnknown_0857F544
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
ldr r2, =0x00000cb2
adds r0, r2
ldrh r0, [r0]
lsls r0, 2
adds r0, r1
ldr r1, [r0]
_080D49F2:
adds r0, r4, 0
bl StringCopy
b _080D4A18
.pool
_080D4A08:
mov r4, sp
adds r4, 0xF
ldr r0, =gMapHeader
ldrb r1, [r0, 0x14]
adds r0, r4, 0
movs r2, 0
bl GetMapName
_080D4A18:
bl AddMapNamePopUpWindow
bl LoadMapNamePopUpWindowBg
movs r0, 0x7
adds r1, r4, 0
movs r2, 0x50
bl GetStringCenterAlignXOffset
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
add r1, sp, 0xC
movs r5, 0
movs r0, 0xFC
strb r0, [r1]
movs r0, 0x2
strb r0, [r1, 0x1]
adds r0, r1, 0
strb r5, [r0, 0x2]
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x3
str r1, [sp]
movs r1, 0xFF
str r1, [sp, 0x4]
str r5, [sp, 0x8]
movs r1, 0x7
add r2, sp, 0xC
adds r3, r4, 0
bl PrintTextOnWindow
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r0, 24
movs r1, 0x3
bl CopyWindowToVram
add sp, 0x24
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end ShowMapNamePopUpWindow
thumb_func_start sub_80D4A78
sub_80D4A78: @ 80D4A78
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x1C
ldr r4, [sp, 0x3C]
lsls r0, 24
lsrs r7, r0, 24
lsls r1, 24
lsrs r1, 24
mov r10, r1
lsls r2, 24
lsls r3, 24
lsrs r3, 24
str r3, [sp, 0x10]
lsls r4, 24
lsrs r4, 24
str r4, [sp, 0x14]
movs r5, 0
lsls r0, r1, 24
asrs r1, r0, 24
lsrs r3, r2, 24
str r3, [sp, 0xC]
movs r6, 0xFF
lsls r6, 24
adds r6, r2
mov r8, r6
str r0, [sp, 0x18]
subs r4, r1, 0x1
_080D4AB4:
ldr r0, =0x0000021d
adds r1, r5, r0
lsls r1, 16
lsrs r1, 16
lsls r2, r4, 24
lsrs r2, 24
movs r3, 0x1
str r3, [sp]
str r3, [sp, 0x4]
movs r6, 0xE
mov r9, r6
str r6, [sp, 0x8]
adds r0, r7, 0
mov r6, r8
lsrs r3, r6, 24
bl FillBgTilemapBufferRect
adds r4, 0x1
adds r5, 0x1
cmp r5, 0xB
ble _080D4AB4
ldr r1, =0x00000229
movs r0, 0x1
negs r0, r0
add r0, r10
lsls r0, 24
lsrs r0, 24
mov r8, r0
movs r5, 0x1
str r5, [sp]
str r5, [sp, 0x4]
mov r2, r9
str r2, [sp, 0x8]
adds r0, r7, 0
mov r2, r8
ldr r3, [sp, 0xC]
bl FillBgTilemapBufferRect
ldr r1, =0x0000022a
ldr r6, [sp, 0x10]
add r6, r10
lsls r6, 24
lsrs r6, 24
str r5, [sp]
str r5, [sp, 0x4]
mov r3, r9
str r3, [sp, 0x8]
adds r0, r7, 0
adds r2, r6, 0
ldr r3, [sp, 0xC]
bl FillBgTilemapBufferRect
ldr r1, =0x0000022b
ldr r4, [sp, 0xC]
adds r4, 0x1
lsls r4, 24
lsrs r4, 24
str r5, [sp]
str r5, [sp, 0x4]
mov r0, r9
str r0, [sp, 0x8]
adds r0, r7, 0
mov r2, r8
adds r3, r4, 0
bl FillBgTilemapBufferRect
movs r1, 0x8B
lsls r1, 2
str r5, [sp]
str r5, [sp, 0x4]
mov r2, r9
str r2, [sp, 0x8]
adds r0, r7, 0
adds r2, r6, 0
adds r3, r4, 0
bl FillBgTilemapBufferRect
ldr r1, =0x0000022d
ldr r4, [sp, 0xC]
adds r4, 0x2
lsls r4, 24
lsrs r4, 24
str r5, [sp]
str r5, [sp, 0x4]
mov r3, r9
str r3, [sp, 0x8]
adds r0, r7, 0
mov r2, r8
adds r3, r4, 0
bl FillBgTilemapBufferRect
ldr r1, =0x0000022e
str r5, [sp]
str r5, [sp, 0x4]
mov r0, r9
str r0, [sp, 0x8]
adds r0, r7, 0
adds r2, r6, 0
adds r3, r4, 0
bl FillBgTilemapBufferRect
movs r5, 0
ldr r1, [sp, 0xC]
ldr r2, [sp, 0x14]
adds r0, r1, r2
lsls r4, r0, 24
movs r6, 0x1
_080D4B8A:
ldr r3, =0x0000022f
adds r1, r5, r3
lsls r1, 16
lsrs r1, 16
subs r0, r5, 0x1
ldr r3, [sp, 0x18]
asrs r2, r3, 24
adds r2, r0
lsls r2, 24
lsrs r2, 24
str r6, [sp]
str r6, [sp, 0x4]
movs r0, 0xE
str r0, [sp, 0x8]
adds r0, r7, 0
lsrs r3, r4, 24
bl FillBgTilemapBufferRect
adds r5, 0x1
cmp r5, 0xB
ble _080D4B8A
add sp, 0x1C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80D4A78
thumb_func_start LoadMapNamePopUpWindowBg
LoadMapNamePopUpWindowBg: @ 80D4BE0
push {r4,r5,lr}
sub sp, 0x8
bl GetMapNamePopUpWindowId
lsls r0, 24
lsrs r5, r0, 24
ldr r0, =gMapHeader
ldrb r1, [r0, 0x14]
cmp r1, 0x57
bls _080D4C0A
cmp r1, 0xC4
bls _080D4C08
adds r0, r1, 0
subs r0, 0x6D
lsls r0, 16
lsrs r1, r0, 16
b _080D4C0A
.pool
_080D4C08:
movs r1, 0
_080D4C0A:
ldr r0, =gUnknown_0857F464
adds r0, r1, r0
ldrb r4, [r0]
adds r0, r5, 0
movs r1, 0
bl GetWindowAttribute
lsls r0, 24
lsrs r0, 24
lsls r1, r4, 4
subs r1, r4
lsls r1, 6
ldr r2, =gMapPopUp_Outline_Table
adds r1, r2
movs r2, 0x80
lsls r2, 3
ldr r3, =0x0000021d
bl LoadBgTiles
ldr r1, =sub_80D4A78
adds r0, r5, 0
bl CallWindowFunction
adds r0, r5, 0
bl PutWindowTilemap
ldr r0, =gMapHeader
ldrb r0, [r0, 0x16]
cmp r0, 0xE
bne _080D4C6C
ldr r0, =gUnknown_0857F444
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
b _080D4C7A
.pool
_080D4C6C:
lsls r0, r4, 5
ldr r1, =gMapPopUp_Palette_Table
adds r0, r1
movs r1, 0xE0
movs r2, 0x20
bl LoadPalette
_080D4C7A:
lsls r1, r4, 4
subs r1, r4
lsls r1, 6
ldr r0, =gMapPopUp_Table
adds r1, r0
movs r0, 0x50
str r0, [sp]
movs r0, 0x18
str r0, [sp, 0x4]
adds r0, r5, 0
movs r2, 0
movs r3, 0
bl BlitBitmapToWindow
add sp, 0x8
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end LoadMapNamePopUpWindowBg
.align 2, 0 @ Don't pad with nop.

View File

@ -1,69 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2, 0
gMapPopUp_Table:: @ 857C684
.incbin "graphics/interface/map_popup/wood.4bpp"
.incbin "graphics/interface/map_popup/marble.4bpp"
.incbin "graphics/interface/map_popup/stone.4bpp"
.incbin "graphics/interface/map_popup/brick.4bpp"
.incbin "graphics/interface/map_popup/underwater.4bpp"
.incbin "graphics/interface/map_popup/stone2.4bpp"
gMapPopUp_Outline_Table:: @ 857DD04
.incbin "graphics/interface/map_popup/wood_outline.4bpp"
.incbin "graphics/interface/map_popup/marble_outline.4bpp"
.incbin "graphics/interface/map_popup/stone_outline.4bpp"
.incbin "graphics/interface/map_popup/brick_outline.4bpp"
.incbin "graphics/interface/map_popup/underwater_outline.4bpp"
.incbin "graphics/interface/map_popup/stone2_outline.4bpp"
gMapPopUp_Palette_Table:: @ 857F384
.incbin "graphics/interface/map_popup/wood.gbapal"
.incbin "graphics/interface/map_popup/marble.gbapal"
.incbin "graphics/interface/map_popup/stone.gbapal"
.incbin "graphics/interface/map_popup/brick.gbapal"
.incbin "graphics/interface/map_popup/underwater.gbapal"
.incbin "graphics/interface/map_popup/stone2.gbapal"
gUnknown_0857F444:: @ 857F444
.incbin "graphics/interface/map_popup/857F444.gbapal"
gUnknown_0857F464:: @ 857F464
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x02, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x05, 0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x05, 0x02, 0x05, 0x05, 0x05, 0x02, 0x02, 0x02, 0x01
gUnknown_0857F4CC:: @ 857F4CC
.string "PYRAMID FLOOR 1$"
gUnknown_0857F4DC:: @ 857F4DC
.string "PYRAMID FLOOR 2$"
gUnknown_0857F4EC:: @ 857F4EC
.string "PYRAMID FLOOR 3$"
gUnknown_0857F4FC:: @ 857F4FC
.string "PYRAMID FLOOR 4$"
gUnknown_0857F50C:: @ 857F50C
.string "PYRAMID FLOOR 5$"
gUnknown_0857F51C:: @ 857F51C
.string "PYRAMID FLOOR 6$"
gUnknown_0857F52C:: @ 857F52C
.string "PYRAMID FLOOR 7$"
gUnknown_0857F53C:: @ 857F53C
.string "PYRAMID$"
gUnknown_0857F544:: @ 857F544
.4byte gUnknown_0857F4CC
.4byte gUnknown_0857F4DC
.4byte gUnknown_0857F4EC
.4byte gUnknown_0857F4FC
.4byte gUnknown_0857F50C
.4byte gUnknown_0857F51C
.4byte gUnknown_0857F52C
.4byte gUnknown_0857F53C

View File

@ -7,5 +7,5 @@
// Exported ROM declarations // Exported ROM declarations
void HideMapNamePopUpWindow(void); void HideMapNamePopUpWindow(void);
void ShowMapNamePopup(void);
#endif //GUARD_MAP_NAME_POPUP_H #endif //GUARD_MAP_NAME_POPUP_H

View File

@ -81,5 +81,8 @@ void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress);
void RemoveStartMenuWindow(void); void RemoveStartMenuWindow(void);
void sub_8197948(u8 initialCursorPos); void sub_8197948(u8 initialCursorPos);
void sub_819A344(u8 a0, u8 *dest, u8 color); void sub_819A344(u8 a0, u8 *dest, u8 color);
void RemoveMapNamePopUpWindow(void);
u8 GetMapNamePopUpWindowId(void);
u8 AddMapNamePopUpWindow(void);
#endif // GUARD_MENU_H #endif // GUARD_MENU_H

View File

@ -134,7 +134,7 @@ SECTIONS {
asm/script_movement.o(.text); asm/script_movement.o(.text);
asm/fldeff_cut.o(.text); asm/fldeff_cut.o(.text);
src/mail_data.o(.text); src/mail_data.o(.text);
asm/map_name_popup.o(.text); src/map_name_popup.o(.text);
src/item_menu_icons.o(.text); src/item_menu_icons.o(.text);
asm/battle_anim_80D51AC.o(.text); asm/battle_anim_80D51AC.o(.text);
src/item.o(.text); src/item.o(.text);
@ -433,7 +433,7 @@ SECTIONS {
data/pokemon_storage_system.o(.rodata); data/pokemon_storage_system.o(.rodata);
src/pokemon_icon.o(.rodata); src/pokemon_icon.o(.rodata);
data/fldeff_cut.o(.rodata); data/fldeff_cut.o(.rodata);
data/map_name_popup.o(.rodata); src/map_name_popup.o(.rodata);
src/item_menu_icons.o(.rodata); src/item_menu_icons.o(.rodata);
data/item_menu_icons.o(.rodata); data/item_menu_icons.o(.rodata);
data/contest.o(.rodata); data/contest.o(.rodata);

452
src/map_name_popup.c Normal file
View File

@ -0,0 +1,452 @@
#include "global.h"
#include "bg.h"
#include "event_data.h"
#include "gpu_regs.h"
#include "international_string_util.h"
#include "menu.h"
#include "map_name_popup.h"
#include "palette.h"
#include "region_map.h"
#include "rom_818CFC8.h"
#include "start_menu.h"
#include "string_util.h"
#include "task.h"
// enums
enum MapPopUp_Themes
{
MAPPOPUP_THEME_WOOD,
MAPPOPUP_THEME_MARBLE,
MAPPOPUP_THEME_STONE,
MAPPOPUP_THEME_BRICK,
MAPPOPUP_THEME_UNDERWATER,
MAPPOPUP_THEME_STONE2,
};
// static functions
static void Task_MapNamePopUpWindow(u8 taskId);
static void ShowMapNamePopUpWindow(void);
static void LoadMapNamePopUpWindowBg(void);
// EWRAM
static EWRAM_DATA u8 mapNamePopupTaskId = 0;
// .rodata
static const u8 gMapPopUp_Table[][960] =
{
INCBIN_U8("graphics/interface/map_popup/wood.4bpp"),
INCBIN_U8("graphics/interface/map_popup/marble.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone.4bpp"),
INCBIN_U8("graphics/interface/map_popup/brick.4bpp"),
INCBIN_U8("graphics/interface/map_popup/underwater.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone2.4bpp"),
};
static const u8 gMapPopUp_Outline_Table[][960] =
{
INCBIN_U8("graphics/interface/map_popup/wood_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/marble_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/brick_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/underwater_outline.4bpp"),
INCBIN_U8("graphics/interface/map_popup/stone2_outline.4bpp"),
};
static const u16 gMapPopUp_Palette_Table[][16] =
{
INCBIN_U16("graphics/interface/map_popup/wood.gbapal"),
INCBIN_U16("graphics/interface/map_popup/marble_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/stone_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/brick_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/underwater_outline.gbapal"),
INCBIN_U16("graphics/interface/map_popup/stone2_outline.gbapal"),
};
static const u16 gUnknown_0857F444[16] = INCBIN_U16("graphics/interface/map_popup/857F444.gbapal");
static const u8 gRegionMapSectionId_To_PopUpThemeIdMapping[] =
{
//TO-DO: Replace with enum entries
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x01, 0x03, 0x01, 0x03, 0x01, 0x03,
0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x02, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x02,
0x02, 0x02, 0x02, 0x02, 0x02, 0x05, 0x02, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x02, 0x05,
0x02, 0x02, 0x02, 0x02, 0x00, 0x02, 0x02, 0x01, 0x02, 0x02, 0x02, 0x00, 0x00, 0x02, 0x02, 0x05,
0x02, 0x05, 0x05, 0x05, 0x02, 0x02, 0x02, 0x01
};
static const u8 gText_PyramidFloor1[] = _("PYRAMID FLOOR 1");
static const u8 gText_PyramidFloor2[] = _("PYRAMID FLOOR 2");
static const u8 gText_PyramidFloor3[] = _("PYRAMID FLOOR 3");
static const u8 gText_PyramidFloor4[] = _("PYRAMID FLOOR 4");
static const u8 gText_PyramidFloor5[] = _("PYRAMID FLOOR 5");
static const u8 gText_PyramidFloor6[] = _("PYRAMID FLOOR 6");
static const u8 gText_PyramidFloor7[] = _("PYRAMID FLOOR 7");
static const u8 gText_Pyramid[] = _("PYRAMID");
static const u8 * const gBattlePyramid_MapHeaderStrings[] =
{
gText_PyramidFloor1,
gText_PyramidFloor2,
gText_PyramidFloor3,
gText_PyramidFloor4,
gText_PyramidFloor5,
gText_PyramidFloor6,
gText_PyramidFloor7,
gText_Pyramid,
};
// text
bool8 sub_80D47D4(void)
{
HideStartMenu();
ShowMapNamePopup();
return 1;
}
void ShowMapNamePopup(void)
{
if (FlagGet(FLAG_SPECIAL_FLAG_0x4000) != TRUE)
{
if (!FuncIsActiveTask(Task_MapNamePopUpWindow))
{
mapNamePopupTaskId = CreateTask(Task_MapNamePopUpWindow, 90);
SetGpuReg(REG_OFFSET_BG0VOFS, 40);
gTasks[mapNamePopupTaskId].data[0] = 6;
gTasks[mapNamePopupTaskId].data[2] = 40;
}
else
{
if (gTasks[mapNamePopupTaskId].data[0] != 2)
gTasks[mapNamePopupTaskId].data[0] = 2;
gTasks[mapNamePopupTaskId].data[3] = 1;
}
}
}
static void Task_MapNamePopUpWindow(u8 taskId)
{
struct Task *task = &gTasks[taskId];
switch (task->data[0])
{
case 6:
task->data[4]++;
if (task->data[4] > 30)
{
task->data[0] = 0;
task->data[4] = 0;
ShowMapNamePopUpWindow();
}
break;
case 0:
task->data[2] -= 2;
if (task->data[2] <= 0 )
{
task->data[2] = 0;
task->data[0] = 1;
gTasks[mapNamePopupTaskId].data[1] = 0;
}
break;
case 1:
task->data[1]++;
if (task->data[1] > 120 )
{
task->data[1] = 0;
task->data[0] = 2;
}
break;
case 2:
task->data[2] += 2;
if (task->data[2] > 39)
{
task->data[2] = 40;
if (task->data[3])
{
task->data[0] = 6;
task->data[4] = 0;
task->data[3] = 0;
}
else
{
task->data[0] = 4;
return;
}
}
break;
case 4:
sub_819746C(GetMapNamePopUpWindowId(), TRUE);
task->data[0] = 5;
break;
case 5:
HideMapNamePopUpWindow();
return;
}
SetGpuReg(REG_OFFSET_BG0VOFS, task->data[2]);
}
void HideMapNamePopUpWindow(void)
{
if (FuncIsActiveTask(Task_MapNamePopUpWindow))
{
sub_819746C(GetMapNamePopUpWindowId(), TRUE);
RemoveMapNamePopUpWindow();
SetGpuReg_ForcedBlank(REG_OFFSET_BG0VOFS, 0);
DestroyTask(mapNamePopupTaskId);
}
}
static void ShowMapNamePopUpWindow(void)
{
u8 mapDisplayHeader[24];
u8 *withoutPrefixPtr;
u8 x;
const u8* mapDisplayHeaderSource;
if(InBattlePyramid())
{
if(gMapHeader.mapDataId == 0x17A)
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[7];
}
else
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
mapDisplayHeaderSource = gBattlePyramid_MapHeaderStrings[gSaveBlock2Ptr->battlePyramidWildHeaderId];
}
StringCopy(withoutPrefixPtr, mapDisplayHeaderSource);
}
else
{
withoutPrefixPtr = &(mapDisplayHeader[3]);
GetMapName(withoutPrefixPtr, gMapHeader.regionMapSectionId, 0);
}
AddMapNamePopUpWindow();
LoadMapNamePopUpWindowBg();
x = GetStringCenterAlignXOffset(7, withoutPrefixPtr, 80);
mapDisplayHeader[0] = 0xFC;
mapDisplayHeader[1] = 0x2;
mapDisplayHeader[2] = 0x0;
PrintTextOnWindow(GetMapNamePopUpWindowId(), 7, mapDisplayHeader, x, 3, 0xFF, NULL);
CopyWindowToVram(GetMapNamePopUpWindowId(), 3);
}
#ifdef NONMATCHING
static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
{
s32 i;
for(i=0; i<=11; i++)
{
FillBgTilemapBufferRect(bg, 0x21D + i, x + i - 1, y - 1, 1, 1, 0xE);
}
FillBgTilemapBufferRect(bg, 0x229 + i, x - 1, y, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22A + i, deltaX + x, y, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22B + i, x - 1, y + 1 , 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22C + i, deltaX + x, y + 1, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22D + i, x - 1, y + 2, 1, 1, 0xE);
FillBgTilemapBufferRect(bg, 0x22E + i, deltaX + x, y + 2, 1, 1, 0xE);
for(i=0; i<=11; i++)
{
FillBgTilemapBufferRect(bg, 0x22F + i, x + i - 1, y + deltaY, 1, 1, 0xE);
}
}
#else
ASM_DIRECT
static void sub_80D4A78(u8 bg, u8 x, u8 y, u8 deltaX, u8 deltaY, u8 unused)
{
asm("\n\
.syntax unified\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0x1C\n\
ldr r4, [sp, 0x3C]\n\
lsls r0, 24\n\
lsrs r7, r0, 24\n\
lsls r1, 24\n\
lsrs r1, 24\n\
mov r10, r1\n\
lsls r2, 24\n\
lsls r3, 24\n\
lsrs r3, 24\n\
str r3, [sp, 0x10]\n\
lsls r4, 24\n\
lsrs r4, 24\n\
str r4, [sp, 0x14]\n\
movs r5, 0\n\
lsls r0, r1, 24\n\
asrs r1, r0, 24\n\
lsrs r3, r2, 24\n\
str r3, [sp, 0xC]\n\
movs r6, 0xFF\n\
lsls r6, 24\n\
adds r6, r2\n\
mov r8, r6\n\
str r0, [sp, 0x18]\n\
subs r4, r1, 0x1\n\
_080D4AB4:\n\
ldr r0, =0x0000021d\n\
adds r1, r5, r0\n\
lsls r1, 16\n\
lsrs r1, 16\n\
lsls r2, r4, 24\n\
lsrs r2, 24\n\
movs r3, 0x1\n\
str r3, [sp]\n\
str r3, [sp, 0x4]\n\
movs r6, 0xE\n\
mov r9, r6\n\
str r6, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r6, r8\n\
lsrs r3, r6, 24\n\
bl FillBgTilemapBufferRect\n\
adds r4, 0x1\n\
adds r5, 0x1\n\
cmp r5, 0xB\n\
ble _080D4AB4\n\
ldr r1, =0x00000229\n\
movs r0, 0x1\n\
negs r0, r0\n\
add r0, r10\n\
lsls r0, 24\n\
lsrs r0, 24\n\
mov r8, r0\n\
movs r5, 0x1\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r2, r9\n\
str r2, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r2, r8\n\
ldr r3, [sp, 0xC]\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022a\n\
ldr r6, [sp, 0x10]\n\
add r6, r10\n\
lsls r6, 24\n\
lsrs r6, 24\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r3, r9\n\
str r3, [sp, 0x8]\n\
adds r0, r7, 0\n\
adds r2, r6, 0\n\
ldr r3, [sp, 0xC]\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022b\n\
ldr r4, [sp, 0xC]\n\
adds r4, 0x1\n\
lsls r4, 24\n\
lsrs r4, 24\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r0, r9\n\
str r0, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r2, r8\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
movs r1, 0x8B\n\
lsls r1, 2\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r2, r9\n\
str r2, [sp, 0x8]\n\
adds r0, r7, 0\n\
adds r2, r6, 0\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022d\n\
ldr r4, [sp, 0xC]\n\
adds r4, 0x2\n\
lsls r4, 24\n\
lsrs r4, 24\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r3, r9\n\
str r3, [sp, 0x8]\n\
adds r0, r7, 0\n\
mov r2, r8\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
ldr r1, =0x0000022e\n\
str r5, [sp]\n\
str r5, [sp, 0x4]\n\
mov r0, r9\n\
str r0, [sp, 0x8]\n\
adds r0, r7, 0\n\
adds r2, r6, 0\n\
adds r3, r4, 0\n\
bl FillBgTilemapBufferRect\n\
movs r5, 0\n\
ldr r1, [sp, 0xC]\n\
ldr r2, [sp, 0x14]\n\
adds r0, r1, r2\n\
lsls r4, r0, 24\n\
movs r6, 0x1\n\
_080D4B8A:\n\
ldr r3, =0x0000022f\n\
adds r1, r5, r3\n\
lsls r1, 16\n\
lsrs r1, 16\n\
subs r0, r5, 0x1\n\
ldr r3, [sp, 0x18]\n\
asrs r2, r3, 24\n\
adds r2, r0\n\
lsls r2, 24\n\
lsrs r2, 24\n\
str r6, [sp]\n\
str r6, [sp, 0x4]\n\
movs r0, 0xE\n\
str r0, [sp, 0x8]\n\
adds r0, r7, 0\n\
lsrs r3, r4, 24\n\
bl FillBgTilemapBufferRect\n\
adds r5, 0x1\n\
cmp r5, 0xB\n\
ble _080D4B8A\n\
add sp, 0x1C\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0\n\
.pool\n\
.syntax divided");
}
#endif // NONMATCHING
static void LoadMapNamePopUpWindowBg(void)
{
u8 popupWindowId;
u16 regionMapSectionId;
u8 popUpThemeId;
popupWindowId = GetMapNamePopUpWindowId();
regionMapSectionId = gMapHeader.regionMapSectionId;
if(regionMapSectionId > 0x57)
{
if(regionMapSectionId > 0xC4)
regionMapSectionId -= 0x6D;
else
regionMapSectionId = 0;
}
popUpThemeId = gRegionMapSectionId_To_PopUpThemeIdMapping[regionMapSectionId];
LoadBgTiles(GetWindowAttribute(popupWindowId, 0), &(gMapPopUp_Outline_Table[popUpThemeId][0]), 0x400, 0x21D);
CallWindowFunction(popupWindowId, sub_80D4A78);
PutWindowTilemap(popupWindowId);
if(gMapHeader.weather == 0xE)
LoadPalette(&gUnknown_0857F444, 0xE0, 0x20);
else
LoadPalette(&(gMapPopUp_Palette_Table[popUpThemeId][0]), 0xE0, 0x20);
BlitBitmapToWindow(popupWindowId, &(gMapPopUp_Table[popUpThemeId][0]), 0, 0, 80, 24);
}

View File

@ -414,8 +414,8 @@ gUnknown_02039D90: @ 2039D90
gUnknown_02039DD0: @ 2039DD0 gUnknown_02039DD0: @ 2039DD0
.space 0x4 .space 0x4
gUnknown_02039DD4: @ 2039DD4 .include "src/map_name_popup.o"
.space 0x4 .space 0x3
gBagPockets: @ 2039DD8 gBagPockets: @ 2039DD8
.space 0x28 .space 0x28