mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Continue script_menu.c
This commit is contained in:
parent
32d2640dc7
commit
645830624d
@ -5,224 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start ScriptMenu_Multichoice
|
||||
@ bool8 ScriptMenu_Multichoice(u8 x, u8 y, u8 menuId, bool8 noCancelling)
|
||||
ScriptMenu_Multichoice: @ 80E1E08
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0x4
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r6, r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r5, r2, 24
|
||||
lsls r3, 24
|
||||
lsrs r4, r3, 24
|
||||
ldr r0, =sub_80E2058
|
||||
bl FuncIsActiveTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
beq _080E1E4C
|
||||
ldr r0, =gSpecialVar_Result
|
||||
movs r1, 0xFF
|
||||
strh r1, [r0]
|
||||
movs r0, 0
|
||||
str r0, [sp]
|
||||
adds r0, r7, 0
|
||||
adds r1, r6, 0
|
||||
adds r2, r5, 0
|
||||
adds r3, r4, 0
|
||||
bl DoMultichoice
|
||||
movs r0, 0x1
|
||||
b _080E1E4E
|
||||
.pool
|
||||
_080E1E4C:
|
||||
movs r0, 0
|
||||
_080E1E4E:
|
||||
add sp, 0x4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end ScriptMenu_Multichoice
|
||||
|
||||
thumb_func_start ScriptMenu_MultichoiceWithDefault
|
||||
ScriptMenu_MultichoiceWithDefault: @ 80E1E58
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
ldr r4, [sp, 0x1C]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r8, r0
|
||||
lsls r1, 24
|
||||
lsrs r7, r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
lsls r3, 24
|
||||
lsrs r5, r3, 24
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
ldr r0, =sub_80E2058
|
||||
bl FuncIsActiveTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
beq _080E1EA8
|
||||
ldr r1, =gSpecialVar_Result
|
||||
movs r0, 0xFF
|
||||
strh r0, [r1]
|
||||
str r4, [sp]
|
||||
mov r0, r8
|
||||
adds r1, r7, 0
|
||||
adds r2, r6, 0
|
||||
adds r3, r5, 0
|
||||
bl DoMultichoice
|
||||
movs r0, 0x1
|
||||
b _080E1EAA
|
||||
.pool
|
||||
_080E1EA8:
|
||||
movs r0, 0
|
||||
_080E1EAA:
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end ScriptMenu_MultichoiceWithDefault
|
||||
|
||||
thumb_func_start sub_80E1EB8
|
||||
sub_80E1EB8: @ 80E1EB8
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
movs r5, 0
|
||||
b _080E1EEC
|
||||
_080E1EC0:
|
||||
cmp r1, 0xFD
|
||||
bne _080E1EE4
|
||||
adds r4, 0x1
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0x1
|
||||
bne _080E1EEC
|
||||
ldr r0, =gSaveBlock2Ptr
|
||||
ldr r0, [r0]
|
||||
bl StringLength
|
||||
adds r0, r5, r0
|
||||
lsls r0, 16
|
||||
lsrs r5, r0, 16
|
||||
adds r4, 0x1
|
||||
b _080E1EEC
|
||||
.pool
|
||||
_080E1EE4:
|
||||
adds r4, 0x1
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r5, r0, 16
|
||||
_080E1EEC:
|
||||
ldrb r1, [r4]
|
||||
adds r0, r1, 0
|
||||
cmp r0, 0xFF
|
||||
bne _080E1EC0
|
||||
adds r0, r5, 0
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80E1EB8
|
||||
|
||||
thumb_func_start DoMultichoice
|
||||
@ void DoMultichoice(u8 x, u8 y, u8 menuId, bool8 noCancelling)
|
||||
DoMultichoice: @ 80E1EFC
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x8
|
||||
ldr r4, [sp, 0x28]
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
mov r9, r1
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
mov r10, r2
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
str r3, [sp]
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
str r4, [sp, 0x4]
|
||||
ldr r1, =gUnknown_0858B760
|
||||
lsls r0, r2, 3
|
||||
adds r0, r1
|
||||
ldrb r6, [r0, 0x4]
|
||||
ldr r0, [r0]
|
||||
mov r8, r0
|
||||
movs r1, 0
|
||||
cmp r1, r6
|
||||
bge _080E1F4C
|
||||
mov r5, r8
|
||||
adds r4, r6, 0
|
||||
_080E1F3C:
|
||||
ldr r0, [r5]
|
||||
bl display_text_and_get_width
|
||||
adds r1, r0, 0
|
||||
adds r5, 0x8
|
||||
subs r4, 0x1
|
||||
cmp r4, 0
|
||||
bne _080E1F3C
|
||||
_080E1F4C:
|
||||
adds r0, r1, 0
|
||||
bl convert_pixel_width_to_tile_width
|
||||
adds r4, r0, 0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
bl sub_80E2D5C
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
lsls r3, r6, 25
|
||||
lsrs r3, 24
|
||||
adds r0, r7, 0
|
||||
mov r1, r9
|
||||
adds r2, r4, 0
|
||||
bl CreateWindowFromRect
|
||||
adds r4, r0, 0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
adds r0, r4, 0
|
||||
movs r1, 0
|
||||
bl SetStandardWindowBorderStyle
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
mov r2, r8
|
||||
bl PrintMenuTable
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
ldr r2, [sp, 0x4]
|
||||
bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed
|
||||
movs r0, 0
|
||||
bl schedule_bg_copy_tilemap_to_vram
|
||||
ldr r0, [sp]
|
||||
adds r1, r6, 0
|
||||
adds r2, r4, 0
|
||||
mov r3, r10
|
||||
bl sub_80E1FBC
|
||||
add sp, 0x8
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end DoMultichoice
|
||||
|
||||
thumb_func_start sub_80E1FBC
|
||||
sub_80E1FBC: @ 80E1FBC
|
||||
push {r4-r7,lr}
|
||||
@ -243,7 +25,7 @@ sub_80E1FBC: @ 80E1FBC
|
||||
movs r0, 0x2
|
||||
strb r0, [r1]
|
||||
movs r2, 0
|
||||
ldr r6, =sub_80E2058
|
||||
ldr r6, =Task_HandleMultichoiceInput
|
||||
ldr r5, =gUnknown_0858BB68
|
||||
movs r3, 0xC
|
||||
_080E1FE6:
|
||||
@ -298,8 +80,8 @@ _080E202E:
|
||||
.pool
|
||||
thumb_func_end sub_80E1FBC
|
||||
|
||||
thumb_func_start sub_80E2058
|
||||
sub_80E2058: @ 80E2058
|
||||
thumb_func_start Task_HandleMultichoiceInput
|
||||
Task_HandleMultichoiceInput: @ 80E2058
|
||||
push {r4-r6,lr}
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
@ -377,7 +159,7 @@ _080E20FC:
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80E2058
|
||||
thumb_func_end Task_HandleMultichoiceInput
|
||||
|
||||
thumb_func_start ScriptMenu_YesNo
|
||||
ScriptMenu_YesNo: @ 80E2108
|
||||
@ -680,7 +462,7 @@ _080E2360:
|
||||
@ bool ScrSpecial_CreatePCMenu()
|
||||
ScrSpecial_CreatePCMenu: @ 80E236C
|
||||
push {lr}
|
||||
ldr r0, =sub_80E2058
|
||||
ldr r0, =Task_HandleMultichoiceInput
|
||||
bl FuncIsActiveTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -887,7 +669,7 @@ ScriptMenu_DisplayPCStartupPrompt: @ 80E2514
|
||||
thumb_func_start sub_80E2548
|
||||
sub_80E2548: @ 80E2548
|
||||
push {lr}
|
||||
ldr r0, =sub_80E2058
|
||||
ldr r0, =Task_HandleMultichoiceInput
|
||||
bl FuncIsActiveTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -1642,7 +1424,7 @@ _080E2B70:
|
||||
thumb_func_start sp106_CreateStartMenu
|
||||
sp106_CreateStartMenu: @ 80E2B7C
|
||||
push {lr}
|
||||
ldr r0, =sub_80E2058
|
||||
ldr r0, =Task_HandleMultichoiceInput
|
||||
bl FuncIsActiveTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -1792,7 +1574,7 @@ sub_80E2CC4: @ 80E2CC4
|
||||
ldr r1, =gUnknown_02039F90
|
||||
movs r0, 0x2
|
||||
strb r0, [r1]
|
||||
ldr r0, =sub_80E2058
|
||||
ldr r0, =Task_HandleMultichoiceInput
|
||||
movs r1, 0x50
|
||||
bl CreateTask
|
||||
lsls r0, 24
|
||||
|
@ -13,6 +13,6 @@ s32 convert_pixel_width_to_tile_width(s32);
|
||||
u8 CreateWindowFromRect(u8, u8, u8, u8);
|
||||
void sub_80E2A78(u8);
|
||||
u32 display_text_and_get_width(const u8*, u32);
|
||||
u8 sub_80E2D5C(u8 arg0, u8 tileWidth);
|
||||
u32 sub_80E2D5C(u8 arg0, u8 tileWidth);
|
||||
|
||||
#endif //GUARD_SCRIPT_MENU_H
|
||||
|
@ -139,6 +139,7 @@ SECTIONS {
|
||||
src/shop.o(.text);
|
||||
src/fldeff_escalator.o(.text);
|
||||
src/berry.o(.text);
|
||||
src/script_menu.o(.text);
|
||||
asm/script_menu.o(.text);
|
||||
src/naming_screen.o(.text);
|
||||
src/money.o(.text);
|
||||
|
@ -3144,7 +3144,7 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion)
|
||||
eventObj->spriteId = AddPseudoEventObject(GetRSAvatarGraphicsIdByGender(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0);
|
||||
break;
|
||||
case VERSION_EMERALD:
|
||||
eventObj->spriteId = AddPseudoEventObject(GetRivalAvatarGraphicsIdByStateIdAndGender(0, eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0);
|
||||
eventObj->spriteId = AddPseudoEventObject(GetRivalAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ int GameClear(void)
|
||||
u8 partyIndex;
|
||||
u8 count;
|
||||
} ribbonCounts[6];
|
||||
s8 val;
|
||||
|
||||
HealPlayerParty();
|
||||
|
||||
|
@ -1,16 +1,102 @@
|
||||
|
||||
// Includes
|
||||
#include "global.h"
|
||||
#include "event_data.h"
|
||||
#include "menu.h"
|
||||
#include "script_menu.h"
|
||||
#include "string_util.h"
|
||||
#include "task.h"
|
||||
#include "text.h"
|
||||
|
||||
// Static type declarations
|
||||
struct MultichoiceListStruct
|
||||
{
|
||||
const struct MenuAction *list;
|
||||
u8 count;
|
||||
};
|
||||
|
||||
// Static RAM declarations
|
||||
extern const struct MultichoiceListStruct gUnknown_0858B760[];
|
||||
|
||||
IWRAM_DATA u8 gUnknown_03001124[6];
|
||||
IWRAM_DATA u32 filler_0300112c;
|
||||
|
||||
// Static ROM declarations
|
||||
/*static*/ void Task_HandleMultichoiceInput(u8);
|
||||
/*static*/ void DrawMultichoiceMenu(u8, u8, u8, bool8, u8);
|
||||
/*static*/ void sub_80E1FBC(u8, u8, u8, u8);
|
||||
|
||||
// .rodata
|
||||
bool8 ScriptMenu_Multichoice(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress)
|
||||
{
|
||||
if (FuncIsActiveTask(Task_HandleMultichoiceInput) == TRUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialVar_Result = 0xFF;
|
||||
DrawMultichoiceMenu(left, top, multichoiceId, ignoreBPress, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// .text
|
||||
bool8 ScriptMenu_MultichoiceWithDefault(u8 left, u8 top, u8 multichoiceId, bool8 ignoreBPress, u8 defaultChoice)
|
||||
{
|
||||
if (FuncIsActiveTask(Task_HandleMultichoiceInput) == TRUE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialVar_Result = 0xFF;
|
||||
DrawMultichoiceMenu(left, top, multichoiceId, ignoreBPress, defaultChoice);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*static*/ u16 sub_80E1EB8(const u8 *str)
|
||||
{
|
||||
u16 length = 0;
|
||||
|
||||
while (*str != EOS)
|
||||
{
|
||||
if (*str == PLACEHOLDER_BEGIN)
|
||||
{
|
||||
str++;
|
||||
if (*str == 1)
|
||||
{
|
||||
length += StringLength(gSaveBlock2Ptr->playerName);
|
||||
str++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
str++;
|
||||
length++;
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/*static*/ void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress, u8 cursorPos)
|
||||
{
|
||||
int i;
|
||||
u8 right;
|
||||
u8 bottom;
|
||||
u8 windowId;
|
||||
int count = gUnknown_0858B760[multichoiceId].count;
|
||||
const struct MenuAction *actions = gUnknown_0858B760[multichoiceId].list;
|
||||
int width = 0;
|
||||
u8 newWidth;
|
||||
|
||||
i = count;
|
||||
while (0 < i)
|
||||
{
|
||||
width = display_text_and_get_width(actions[count - i].text, width);
|
||||
}
|
||||
|
||||
newWidth = convert_pixel_width_to_tile_width(width);
|
||||
left = sub_80E2D5C(left, newWidth);
|
||||
windowId = CreateWindowFromRect(left, top, newWidth, count * 2);
|
||||
SetStandardWindowBorderStyle(windowId, 0);
|
||||
PrintMenuTable(windowId, count, actions);
|
||||
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(windowId, count, cursorPos);
|
||||
schedule_bg_copy_tilemap_to_vram(0);
|
||||
sub_80E1FBC(ignoreBPress, count, windowId, multichoiceId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user