through sub_8121178

This commit is contained in:
PikalaxALT 2018-05-03 18:05:07 -04:00
parent 876e1eb7cc
commit 8aa462cd74
5 changed files with 57 additions and 154 deletions

View File

@ -5,147 +5,6 @@
.text
thumb_func_start sub_81210B8
sub_81210B8: @ 81210B8
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
mov r7, sp
mov r8, sp
ldr r0, =gUnknown_0859F288
ldr r0, [r0]
lsls r0, 3
lsrs r0, 3
adds r0, 0x3
lsrs r0, 2
lsls r0, 2
mov r1, sp
subs r1, r0
mov sp, r1
mov r9, sp
mov r0, sp
movs r1, 0x24
bl sub_8121064
movs r5, 0
_081210E4:
ldr r1, =gUnknown_0859F048
mov r2, r9
adds r0, r2, r5
ldrb r0, [r0]
lsls r0, 4
adds r0, r1
ldrb r4, [r0]
ldrb r6, [r0, 0x1]
movs r1, 0
ldr r2, =gUnknown_0203A12C
ldr r0, [r2]
ldrb r0, [r0, 0x4]
cmp r0, r4
beq _08121112
_08121100:
adds r1, 0x1
cmp r1, 0x3
bgt _08121112
ldr r0, [r2]
adds r0, 0x4
adds r0, r1
ldrb r0, [r0]
cmp r0, r4
bne _08121100
_08121112:
cmp r1, 0x4
bne _08121162
adds r0, r4, 0
bl sub_8120E74
cmp r0, r6
bcc _08121162
ldr r0, =gUnknown_0203A12C
ldr r1, [r0]
movs r0, 0x1
strb r0, [r1, 0x1]
bl sub_8120ED8
lsls r0, 24
lsrs r0, 24
cmp r0, 0x4
bne _08121150
ldr r0, =gUnknown_03001178
ldrb r0, [r0]
adds r1, r4, 0
bl sub_8120FDC
b _0812115E
.pool
_08121150:
bl sub_8120ED8
lsls r0, 24
lsrs r0, 24
adds r1, r4, 0
bl sub_8120FDC
_0812115E:
movs r0, 0x1
b _0812116A
_08121162:
adds r5, 0x1
cmp r5, 0x23
ble _081210E4
movs r0, 0
_0812116A:
mov sp, r8
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_81210B8
thumb_func_start sub_8121178
sub_8121178: @ 8121178
push {r4-r6,lr}
mov r6, r8
push {r6}
adds r5, r0, 0
ldr r6, =gUnknown_0203A12C
ldr r0, [r6]
adds r0, 0x4
adds r0, r5
ldrb r0, [r0]
mov r8, r0
ldr r4, =gStringVar1
adds r0, r5, 0
bl sub_8120F08
adds r1, r0, 0
adds r0, r4, 0
movs r2, 0
movs r3, 0xA
bl ConvertIntToDecimalStringN
ldr r4, =gStringVar2
mov r0, r8
bl sub_8120ECC
adds r1, r0, 0
adds r0, r4, 0
bl StringCopy
ldr r4, =gStringVar3
adds r0, r5, 0
adds r1, r4, 0
bl sub_8120F7C
ldr r0, [r6]
adds r0, 0x34
adds r0, r5
ldrb r1, [r0]
adds r0, r4, 0
bl ConvertInternationalString
mov r0, r8
bl sub_8120EC0
bl ShowFieldMessage
pop {r3}
mov r8, r3
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8121178
thumb_func_start sub_81211EC
sub_81211EC: @ 81211EC
push {r4,r5,lr}

View File

@ -1,8 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2, 0
gUnknown_0859F288:: @ 859F288
.4byte 0x00000024, 0x00000008

View File

@ -458,7 +458,6 @@ SECTIONS {
data/easy_chat.o(.rodata);
src/mon_markings.o(.rodata);
src/mauville_old_man.o(.rodata);
data/mauville_old_man.o(.rodata);
src/mail.o(.rodata);
data/menu_helpers.o(.rodata);
src/heal_location.o(.rodata);

View File

@ -19,6 +19,7 @@
#include "sound.h"
#include "strings.h"
#include "overworld.h"
#include "field_message_box.h"
#define CHAR_SONG_WORD_SEPARATOR 0x37
@ -33,6 +34,8 @@ void sub_8120E50(void);
void sub_81339F8(void); // TraderSetup
void sub_8133A60(void);
IWRAM_DATA u8 gUnknown_03001178;
struct BardSong gUnknown_03006130;
EWRAM_DATA u16 gUnknown_0203A128 = 0;
@ -1085,3 +1088,55 @@ void sub_8121064(u8 * arr, s32 count) // ScrambleStatList
arr[b] = temp;
}
}
struct UnknownStruct_0859F288
{
u32 length;
u32 unused2;
};
const struct UnknownStruct_0859F288 gUnknown_0859F288 = {
36,
8
};
bool8 sub_81210B8(void) // StorytellerInitializeRandomStat
{
u8 arr[gUnknown_0859F288.length];
s32 i;
s32 j;
sub_8121064(arr, 36);
for (i = 0; i < 36; i++)
{
u8 stat = gUnknown_0859F048[arr[i]].stat;
u8 minVal = gUnknown_0859F048[arr[i]].minVal;
for (j = 0; j < 4; j++)
{
if (gUnknown_0203A12C->gameStatIDs[j] == stat)
break;
}
if (j == 4 && sub_8120E74(stat) >= minVal)
{
gUnknown_0203A12C->alreadyRecorded = TRUE;
if (sub_8120ED8() == 4)
sub_8120FDC(gUnknown_03001178, stat);
else
sub_8120FDC(sub_8120ED8(), stat);
return TRUE;
}
}
return FALSE;
}
void sub_8121178(u32 player) // StorytellerDisplayStory
{
u8 stat = gUnknown_0203A12C->gameStatIDs[player];
ConvertIntToDecimalStringN(gStringVar1, sub_8120F08(player), 0, 10);
StringCopy(gStringVar2, sub_8120ECC(stat));
sub_8120F7C(player, gStringVar3);
ConvertInternationalString(gStringVar3, gUnknown_0203A12C->unk34[player]);
ShowFieldMessage(sub_8120EC0(stat));
}

View File

@ -28,11 +28,9 @@
.include "src/script_menu.o"
.include "src/record_mixing.o"
.include "src/tv.o"
.include "src/mauville_old_man.o"
.space 1 @ TODO: define this u32 in mauville_old_man
gUnknown_03001178: @ 3001178
.space 0x4
.align 2
gUnknown_0300117C: @ 300117C
.space 0x4