Remaining functions in mauville_old_man

This commit is contained in:
PikalaxALT 2018-05-07 16:35:29 -04:00
parent 8aa462cd74
commit 0231ed13ee
4 changed files with 115 additions and 311 deletions

View File

@ -1,310 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81211EC
sub_81211EC: @ 81211EC
push {r4,r5,lr}
sub sp, 0xC
ldr r1, =gText_Exit
movs r0, 0x1
movs r2, 0
bl GetStringWidth
adds r5, r0, 0
movs r4, 0
ldr r0, =gUnknown_0203A12C
ldr r0, [r0]
ldrb r0, [r0, 0x4]
cmp r0, 0
beq _08121230
_08121208:
bl sub_8120EB4
adds r1, r0, 0
movs r0, 0x1
movs r2, 0
bl GetStringWidth
cmp r0, r5
ble _0812121C
adds r5, r0, 0
_0812121C:
adds r4, 0x1
cmp r4, 0x3
bgt _08121230
ldr r0, =gUnknown_0203A12C
ldr r0, [r0]
adds r0, 0x4
adds r0, r4
ldrb r0, [r0]
cmp r0, 0
bne _08121208
_08121230:
adds r0, r5, 0
bl convert_pixel_width_to_tile_width
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl sub_8120ED8
adds r3, r0, 0
lsls r3, 25
movs r0, 0x80
lsls r0, 18
adds r3, r0
lsrs r3, 24
movs r0, 0
movs r1, 0
adds r2, r4, 0
bl CreateWindowFromRect
ldr r1, =gUnknown_0203A130
strb r0, [r1]
ldrb r0, [r1]
movs r1, 0
bl SetStandardWindowBorderStyle
movs r4, 0
ldr r0, =gUnknown_0203A12C
ldr r0, [r0]
ldrb r0, [r0, 0x4]
cmp r0, 0
beq _081212AA
movs r5, 0x80
lsls r5, 17
_08121272:
bl sub_8120EB4
adds r2, r0, 0
ldr r0, =gUnknown_0203A130
ldrb r0, [r0]
lsrs r1, r5, 24
str r1, [sp]
movs r1, 0xFF
str r1, [sp, 0x4]
movs r1, 0
str r1, [sp, 0x8]
movs r1, 0x1
movs r3, 0x8
bl PrintTextOnWindow
movs r0, 0x80
lsls r0, 21
adds r5, r0
adds r4, 0x1
cmp r4, 0x3
bgt _081212AA
ldr r0, =gUnknown_0203A12C
ldr r0, [r0]
adds r0, 0x4
adds r0, r4
ldrb r0, [r0]
cmp r0, 0
bne _08121272
_081212AA:
ldr r5, =gUnknown_0203A130
ldrb r0, [r5]
ldr r2, =gText_Exit
lsls r1, r4, 4
adds r1, 0x1
lsls r1, 24
lsrs r1, 24
str r1, [sp]
movs r1, 0xFF
str r1, [sp, 0x4]
movs r1, 0
str r1, [sp, 0x8]
movs r1, 0x1
movs r3, 0x8
bl PrintTextOnWindow
ldrb r4, [r5]
bl sub_8120ED8
adds r1, r0, 0
adds r1, 0x1
lsls r1, 24
lsrs r1, 24
adds r0, r4, 0
movs r2, 0
bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed
ldrb r0, [r5]
movs r1, 0x3
bl CopyWindowToVram
add sp, 0xC
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_81211EC
thumb_func_start sub_81212FC
sub_81212FC: @ 81212FC
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r0, r6, 2
adds r0, r6
lsls r0, 3
ldr r1, =gTasks
adds r4, r0, r1
movs r0, 0x8
ldrsh r5, [r4, r0]
cmp r5, 0
beq _08121320
cmp r5, 0x1
beq _0812132C
b _08121376
.pool
_08121320:
bl sub_81211EC
ldrh r0, [r4, 0x8]
adds r0, 0x1
strh r0, [r4, 0x8]
b _08121376
_0812132C:
bl ProcessMenuInput
lsls r0, 24
asrs r4, r0, 24
movs r0, 0x2
negs r0, r0
cmp r4, r0
beq _08121376
adds r0, 0x1
cmp r4, r0
beq _0812134E
bl sub_8120ED8
lsls r0, 24
lsrs r0, 24
cmp r4, r0
bne _0812135C
_0812134E:
ldr r1, =gSpecialVar_Result
movs r0, 0
strh r0, [r1]
b _08121364
.pool
_0812135C:
ldr r0, =gSpecialVar_Result
strh r5, [r0]
ldr r0, =gUnknown_03001178
strb r4, [r0]
_08121364:
ldr r0, =gUnknown_0203A130
ldrb r0, [r0]
bl sub_80E2A78
adds r0, r6, 0
bl DestroyTask
bl EnableBothScriptContexts
_08121376:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_81212FC
thumb_func_start sub_8121388
sub_8121388: @ 8121388
push {lr}
ldr r0, =sub_81212FC
movs r1, 0x50
bl CreateTask
pop {r0}
bx r0
.pool
thumb_func_end sub_8121388
thumb_func_start sub_812139C
sub_812139C: @ 812139C
push {lr}
ldr r0, =gUnknown_03001178
ldrb r0, [r0]
bl sub_8121178
pop {r0}
bx r0
.pool
thumb_func_end sub_812139C
thumb_func_start sub_81213B0
sub_81213B0: @ 81213B0
push {lr}
ldr r1, =gUnknown_0203A12C
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r2, =0x00002e28
adds r0, r2
str r0, [r1]
bl sub_8120ED8
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
.pool
thumb_func_end sub_81213B0
thumb_func_start sub_81213D8
sub_81213D8: @ 81213D8
push {r4,r5,lr}
ldr r2, =gUnknown_0203A12C
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
ldr r3, =0x00002e28
adds r0, r1, r3
str r0, [r2]
ldr r5, =gUnknown_03001178
ldrb r0, [r5]
ldr r2, =0x00002e2c
adds r1, r2
adds r1, r0
ldrb r4, [r1]
bl sub_8120F4C
cmp r0, 0x1
beq _08121414
movs r0, 0
b _0812141E
.pool
_08121414:
ldrb r0, [r5]
adds r1, r4, 0
bl sub_8120FDC
movs r0, 0x1
_0812141E:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_81213D8
thumb_func_start sub_8121424
sub_8121424: @ 8121424
push {lr}
ldr r1, =gUnknown_0203A12C
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r2, =0x00002e28
adds r0, r2
str r0, [r1]
ldrb r0, [r0, 0x1]
cmp r0, 0
beq _08121448
movs r0, 0x1
b _0812144A
.pool
_08121448:
movs r0, 0
_0812144A:
pop {r1}
bx r1
thumb_func_end sub_8121424
thumb_func_start sub_8121450
sub_8121450: @ 8121450
push {lr}
ldr r1, =gUnknown_0203A12C
ldr r0, =gSaveBlock1Ptr
ldr r0, [r0]
ldr r2, =0x00002e28
adds r0, r2
str r0, [r1]
bl sub_81210B8
lsls r0, 24
lsrs r0, 24
pop {r1}
bx r1
.pool
thumb_func_end sub_8121450
.align 2, 0 @ Don't pad with nop.

View File

@ -9,5 +9,8 @@ bool8 ScriptMenu_YesNo(u8 var1, u8 var2);
bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 a4, u8 columnCount);
bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3);
bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void);
u8 convert_pixel_width_to_tile_width(s32);
u8 CreateWindowFromRect(u8, u8, u8, u8);
void sub_80E2A78(u8);
#endif //GUARD_SCRIPT_MENU_H

View File

@ -163,7 +163,6 @@ SECTIONS {
asm/easy_chat.o(.text);
src/mon_markings.o(.text);
src/mauville_old_man.o(.text);
asm/mauville_old_man.o(.text);
src/mail.o(.text);
asm/menu_helpers.o(.text);
src/dewford_trend.o(.text);

View File

@ -20,6 +20,7 @@
#include "strings.h"
#include "overworld.h"
#include "field_message_box.h"
#include "script_menu.h"
#define CHAR_SONG_WORD_SEPARATOR 0x37
@ -1140,3 +1141,114 @@ void sub_8121178(u32 player) // StorytellerDisplayStory
ConvertInternationalString(gStringVar3, gUnknown_0203A12C->unk34[player]);
ShowFieldMessage(sub_8120EC0(stat));
}
void sub_81211EC(void) // PrintStoryList
{
s32 i;
s32 width = GetStringWidth(1, gText_Exit, 0);
u8 tileWidth;
for (i = 0; i < 4; i++)
{
s32 curWidth;
u16 gameStatID = gUnknown_0203A12C->gameStatIDs[i];
if (gameStatID == 0)
break;
curWidth = GetStringWidth(1, sub_8120EB4(gameStatID), 0);
if (curWidth > width)
width = curWidth;
}
gUnknown_0203A130 = CreateWindowFromRect(0, 0, convert_pixel_width_to_tile_width(width), sub_8120ED8() * 2 + 2);
SetStandardWindowBorderStyle(gUnknown_0203A130, 0);
for (i = 0; i < 4; i++)
{
u16 gameStatID = gUnknown_0203A12C->gameStatIDs[i];
if (gameStatID == 0)
break;
PrintTextOnWindow(gUnknown_0203A130, 1, sub_8120EB4(gameStatID), 8, 16 * i + 1, 0xFF, NULL);
}
PrintTextOnWindow(gUnknown_0203A130, 1, gText_Exit, 8, 16 * i + 1, 0xFF, NULL);
InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_0203A130, sub_8120ED8() + 1, 0);
CopyWindowToVram(gUnknown_0203A130, 3);
}
void sub_81212FC(u8 taskId) // Task_StoryListMenu
{
struct Task *task = &gTasks[taskId];
s32 selection;
switch (task->data[0])
{
case 0:
sub_81211EC();
task->data[0]++;
break;
case 1:
selection = ProcessMenuInput();
if (selection == -2)
break;
if (selection == -1 || selection == sub_8120ED8())
{
gSpecialVar_Result = 0;
}
else
{
gSpecialVar_Result = 1;
gUnknown_03001178 = selection;
}
sub_80E2A78(gUnknown_0203A130);
DestroyTask(taskId);
EnableBothScriptContexts();
break;
}
}
// Sets gSpecialVar_Result to TRUE if player selected a story
void sub_8121388(void) // ScrSpecial_StorytellerStoryListMenu
{
CreateTask(sub_81212FC, 80);
}
void sub_812139C(void) // ScrSpecial_StorytellerDisplayStory
{
sub_8121178(gUnknown_03001178);
}
u8 sub_81213B0(void) // ScrSpecial_StorytellerDisplayStory
{
gUnknown_0203A12C = &gSaveBlock1Ptr->oldMan.storyteller;
return sub_8120ED8();
}
// Returns TRUE if stat has increased
bool8 sub_81213D8(void) // ScrSpecial_StorytellerUpdateStat
{
u8 r4;
gUnknown_0203A12C = &gSaveBlock1Ptr->oldMan.storyteller;
r4 = gUnknown_0203A12C->gameStatIDs[gUnknown_03001178];
if (sub_8120F4C(gUnknown_03001178) == TRUE)
{
sub_8120FDC(gUnknown_03001178, r4);
return TRUE;
}
return FALSE;
}
bool8 sub_8121424(void) // ScrSpecial_HasStorytellerAlreadyRecorded
{
gUnknown_0203A12C = &gSaveBlock1Ptr->oldMan.storyteller;
if (gUnknown_0203A12C->alreadyRecorded == FALSE)
return FALSE;
else
return TRUE;
}
bool8 sub_8121450(void) // ScrSpecial_StorytellerInitializeRandomStat
{
gUnknown_0203A12C = &gSaveBlock1Ptr->oldMan.storyteller;
return sub_81210B8();
}