finish out oct2023 rebase work

This commit is contained in:
Seth Barberee
2023-10-23 12:02:26 -07:00
parent 0a1b39c9fe
commit 44882449c0
2 changed files with 382 additions and 748 deletions

View File

@@ -93,752 +93,4 @@ _08096102:
_08096110: .4byte gUnknown_203B490
thumb_func_end sub_8096078
thumb_func_start sub_8096114
sub_8096114:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x14
movs r1, 0
_08096122:
adds r0, r1, 0x1
mov r10, r0
mov r8, r10
cmp r0, 0x3
bgt _08096198
ldr r2, _080961B0
mov r9, r2
lsls r0, r1, 2
adds r0, r1
lsls r0, 2
mov r12, r0
mov r3, r10
lsls r0, r3, 2
add r0, r10
lsls r4, r0, 2
_08096140:
mov r5, r9
ldr r1, [r5]
adds r3, r1, r4
ldrb r0, [r3]
cmp r0, 0
beq _0809618C
mov r6, r12
adds r2, r1, r6
ldrb r1, [r2, 0x4]
ldrb r0, [r3, 0x4]
cmp r1, r0
bhi _08096164
cmp r1, r0
bne _0809618C
ldrb r0, [r2, 0x5]
ldrb r7, [r3, 0x5]
cmp r0, r7
bls _0809618C
_08096164:
mov r1, sp
adds r0, r2, 0
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
ldm r0!, {r5,r6}
stm r1!, {r5,r6}
adds r1, r2, 0
adds r0, r3, 0
ldm r0!, {r2,r3,r7}
stm r1!, {r2,r3,r7}
ldm r0!, {r5,r6}
stm r1!, {r5,r6}
mov r7, r9
ldr r1, [r7]
adds r1, r4
mov r0, sp
ldm r0!, {r2,r3,r5}
stm r1!, {r2,r3,r5}
ldm r0!, {r6,r7}
stm r1!, {r6,r7}
_0809618C:
adds r4, 0x14
movs r0, 0x1
add r8, r0
mov r1, r8
cmp r1, 0x3
ble _08096140
_08096198:
mov r1, r10
cmp r1, 0x2
ble _08096122
add sp, 0x14
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080961B0: .4byte gUnknown_203B490
thumb_func_end sub_8096114
thumb_func_start sub_80961B4
sub_80961B4:
push {lr}
bl sub_8096E2C
lsls r0, 24
cmp r0, 0
beq _080961CE
ldr r0, _080961D4
ldr r0, [r0]
movs r1, 0xCA
lsls r1, 2
adds r0, r1
movs r1, 0x1
strb r1, [r0]
_080961CE:
pop {r0}
bx r0
.align 2, 0
_080961D4: .4byte gUnknown_203B490
thumb_func_end sub_80961B4
thumb_func_start sub_80961D8
sub_80961D8:
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r7, 0
bl CountFilledMailboxSlots
adds r6, r0, 0
movs r1, 0x4
bl RandRange
mov r8, r0
cmp r6, 0x3
bgt _08096202
ldr r4, _08096208
ldr r0, [r4]
movs r2, 0xCA
lsls r2, 2
adds r1, r0, r2
ldrb r0, [r1]
cmp r0, 0
bne _0809620C
_08096202:
movs r0, 0
b _080963A8
.align 2, 0
_08096208: .4byte gUnknown_203B490
_0809620C:
strb r7, [r1]
movs r5, 0x38
movs r0, 0xA
movs r1, 0x31
movs r2, 0x1
bl sub_8001D08
lsls r0, 24
cmp r0, 0
beq _0809623A
ldr r0, [r4]
ldr r1, _08096328
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _0809623A
movs r0, 0x35
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _0809623A
movs r5, 0x35
_0809623A:
movs r0, 0xF
bl sub_80023E4
lsls r0, 24
cmp r0, 0
beq _0809629C
ldr r0, _0809632C
ldr r0, [r0]
movs r2, 0xC9
lsls r2, 2
adds r0, r2
ldrb r0, [r0]
cmp r0, 0
bne _08096264
movs r0, 0x34
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _08096264
movs r5, 0x34
_08096264:
ldr r0, _0809632C
ldr r0, [r0]
ldr r1, _08096330
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _08096280
movs r0, 0x33
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _08096280
movs r5, 0x33
_08096280:
ldr r0, _0809632C
ldr r0, [r0]
ldr r2, _08096334
adds r0, r2
ldrb r0, [r0]
cmp r0, 0
bne _0809629C
movs r0, 0x32
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _0809629C
movs r5, 0x32
_0809629C:
bl GetRescueTeamRank
lsls r0, 24
lsrs r0, 24
cmp r0, 0x6
bne _080962C4
ldr r0, _0809632C
ldr r0, [r0]
ldr r1, _08096338
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _080962C4
movs r0, 0x36
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _080962C4
movs r5, 0x36
_080962C4:
movs r0, 0x6
bl sub_80023E4
lsls r0, 24
cmp r0, 0
beq _080962EC
ldr r0, _0809632C
ldr r0, [r0]
ldr r2, _0809633C
adds r0, r2
ldrb r0, [r0]
cmp r0, 0
bne _080962EC
movs r0, 0x37
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _080962EC
movs r5, 0x37
_080962EC:
cmp r5, 0x38
bne _08096310
cmp r6, r8
bgt _08096392
bl sub_8096E2C
lsls r0, 24
lsrs r5, r0, 24
movs r0, 0xE
bl sub_80023E4
lsls r0, 24
cmp r0, 0
bne _0809630C
cmp r5, 0x2
bhi _0809638E
_0809630C:
cmp r5, 0x31
bhi _0809638E
_08096310:
lsls r0, r6, 24
lsrs r0, 24
bl GetMailboxSlotInfo
adds r4, r0, 0
movs r0, 0x1
strb r0, [r4]
movs r0, 0x62
strb r0, [r4, 0x4]
strb r5, [r4, 0x5]
b _0809638A
.align 2, 0
_08096328: .4byte 0x00000325
_0809632C: .4byte gUnknown_203B490
_08096330: .4byte 0x00000323
_08096334: .4byte 0x00000322
_08096338: .4byte 0x00000326
_0809633C: .4byte 0x00000327
_08096340:
lsls r0, r6, 24
lsrs r0, 24
bl GetMailboxSlotInfo
adds r4, r0, 0
bl GenerateMailJobInfo
lsls r0, 24
cmp r0, 0
beq _08096392
bl sub_8095E78
lsls r0, 24
lsrs r5, r0, 24
adds r0, r4, 0x4
ldrb r1, [r4, 0x1]
bl sub_803C1D0
lsls r0, 24
cmp r0, 0
bne _0809636C
movs r5, 0
_0809636C:
movs r0, 0x5
movs r1, 0xA
bl RandRange
strb r0, [r4, 0x11]
lsls r0, 24
lsrs r0, 24
cmp r0, 0x9
bne _0809638A
cmp r5, 0
bne _08096388
movs r0, 0x5
strb r0, [r4, 0x11]
b _0809638A
_08096388:
strb r5, [r4, 0x13]
_0809638A:
movs r7, 0x1
adds r6, 0x1
_0809638E:
cmp r6, r8
ble _08096340
_08096392:
bl sub_80963B4
lsls r0, 24
cmp r0, 0
beq _0809639E
movs r7, 0x1
_0809639E:
bl sub_8096078
bl sub_8096114
adds r0, r7, 0
_080963A8:
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_80961D8
thumb_func_start sub_80963B4
sub_80963B4:
push {r4-r6,lr}
movs r6, 0
bl sub_8096E2C
lsls r0, 24
lsrs r5, r0, 24
bl CountFilledMailboxSlots
adds r4, r0, 0
cmp r4, 0x3
ble _080963CE
movs r0, 0
b _080963F4
_080963CE:
movs r0, 0xE
bl sub_80023E4
lsls r0, 24
cmp r0, 0
beq _080963F2
cmp r5, 0x31
bhi _080963F2
lsls r0, r4, 24
lsrs r0, 24
bl GetMailboxSlotInfo
movs r1, 0x1
strb r1, [r0]
movs r1, 0x62
strb r1, [r0, 0x4]
strb r5, [r0, 0x5]
movs r6, 0x1
_080963F2:
adds r0, r6, 0
_080963F4:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end sub_80963B4
thumb_func_start sub_80963FC
sub_80963FC:
push {r4-r6,lr}
movs r6, 0
_08096400:
lsls r0, r6, 24
lsrs r4, r0, 24
adds r0, r4, 0
bl GetMailboxSlotInfo
adds r5, r0, 0
ldrb r0, [r5]
cmp r0, 0x1
beq _08096418
adds r0, r4, 0
bl ResetMailboxSlot
_08096418:
adds r6, 0x1
cmp r6, 0x3
ble _08096400
bl sub_8096078
bl CountFilledMailboxSlots
lsls r0, 24
lsrs r0, 24
bl GetMailboxSlotInfo
adds r5, r0, 0
movs r0, 0
movs r4, 0x5
strb r4, [r5]
strb r0, [r5, 0x1]
strb r0, [r5, 0x2]
movs r0, 0x2
strb r0, [r5, 0x4]
movs r0, 0x3
strb r0, [r5, 0x5]
bl Rand32Bit
ldr r1, _08096484
ands r1, r0
str r1, [r5, 0x8]
movs r0, 0x10
strh r0, [r5, 0xC]
strh r0, [r5, 0xE]
ldrb r0, [r5, 0x4]
bl sub_8095F28
strb r0, [r5, 0x10]
strb r4, [r5, 0x11]
_0809645C:
ldrb r1, [r5, 0x1]
adds r0, r5, 0x4
adds r2, r5, 0
adds r2, 0x12
bl sub_803C37C
ldrb r0, [r5, 0x10]
ldrb r1, [r5, 0x12]
cmp r0, r1
beq _0809645C
movs r0, 0
strb r0, [r5, 0x13]
bl sub_8096078
bl sub_8096114
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_08096484: .4byte 0x00ffffff
thumb_func_end sub_80963FC
thumb_func_start sub_8096488
sub_8096488:
push {r4,lr}
movs r4, 0
_0809648C:
lsls r0, r4, 24
lsrs r0, 24
bl ResetMailboxSlot
adds r4, 0x1
cmp r4, 0x3
ble _0809648C
movs r0, 0
bl GetMailboxSlotInfo
movs r2, 0
movs r1, 0x1
strb r1, [r0]
movs r1, 0x62
strb r1, [r0, 0x4]
strb r2, [r0, 0x5]
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_8096488
thumb_func_start sub_80964B4
sub_80964B4:
push {lr}
ldr r0, _080964D4
ldr r0, [r0]
ldr r1, _080964D8
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _080964DC
movs r0, 0x35
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _080964DC
movs r0, 0
b _080964DE
.align 2, 0
_080964D4: .4byte gUnknown_203B490
_080964D8: .4byte 0x00000325
_080964DC:
movs r0, 0x1
_080964DE:
pop {r1}
bx r1
thumb_func_end sub_80964B4
thumb_func_start sub_80964E4
sub_80964E4:
push {lr}
ldr r0, _08096504
ldr r0, [r0]
ldr r1, _08096508
adds r0, r1
ldrb r0, [r0]
cmp r0, 0
bne _0809650C
movs r0, 0x36
bl sub_8096E80
lsls r0, 24
cmp r0, 0
bne _0809650C
movs r0, 0
b _0809650E
.align 2, 0
_08096504: .4byte gUnknown_203B490
_08096508: .4byte 0x00000326
_0809650C:
movs r0, 0x1
_0809650E:
pop {r1}
bx r1
thumb_func_end sub_80964E4
thumb_func_start CountFilledPelipperBoardSlots
CountFilledPelipperBoardSlots:
push {r4,r5,lr}
movs r5, 0
movs r4, 0
_0809651A:
lsls r0, r4, 24
lsrs r0, 24
bl IsPelipperBoardSlotEmpty
lsls r0, 24
cmp r0, 0
bne _0809652A
adds r5, 0x1
_0809652A:
adds r4, 0x1
cmp r4, 0x7
ble _0809651A
adds r0, r5, 0
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end CountFilledPelipperBoardSlots
thumb_func_start sub_8096538
sub_8096538:
push {r4,r5,lr}
adds r4, r0, 0
movs r3, 0
ldr r5, _08096560
movs r2, 0
_08096542:
ldr r0, [r5]
adds r0, r2
adds r1, r0, 0
adds r1, 0x50
ldrb r0, [r1]
cmp r0, 0
bne _08096564
adds r0, r4, 0
ldm r0!, {r2-r4}
stm r1!, {r2-r4}
ldm r0!, {r2,r3}
stm r1!, {r2,r3}
movs r0, 0
b _0809656E
.align 2, 0
_08096560: .4byte gUnknown_203B490
_08096564:
adds r2, 0x14
adds r3, 0x1
cmp r3, 0x7
ble _08096542
movs r0, 0x1
_0809656E:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8096538
thumb_func_start GetPelipperBoardSlotInfo
GetPelipperBoardSlotInfo:
lsls r0, 24
lsrs r0, 24
ldr r2, _08096588
lsls r1, r0, 2
adds r1, r0
lsls r1, 2
adds r1, 0x50
ldr r0, [r2]
adds r0, r1
bx lr
.align 2, 0
_08096588: .4byte gUnknown_203B490
thumb_func_end GetPelipperBoardSlotInfo
thumb_func_start IsPelipperBoardSlotEmpty
IsPelipperBoardSlotEmpty:
push {lr}
lsls r0, 24
lsrs r0, 24
ldr r1, _080965AC
ldr r2, [r1]
lsls r1, r0, 2
adds r1, r0
lsls r1, 2
adds r2, r1
adds r2, 0x50
ldrb r0, [r2]
cmp r0, 0
beq _080965B0
movs r0, 0
b _080965B2
.align 2, 0
_080965AC: .4byte gUnknown_203B490
_080965B0:
movs r0, 0x1
_080965B2:
pop {r1}
bx r1
thumb_func_end IsPelipperBoardSlotEmpty
thumb_func_start ResetPelipperBoardSlot
ResetPelipperBoardSlot:
push {r4,lr}
lsls r0, 24
lsrs r0, 24
ldr r4, _080965F0
ldr r1, [r4]
lsls r2, r0, 2
adds r2, r0
lsls r2, 2
adds r1, r2
adds r1, 0x50
movs r3, 0
strb r3, [r1]
ldr r0, [r4]
adds r0, r2
adds r0, 0x54
movs r1, 0x63
strb r1, [r0]
ldr r0, [r4]
adds r0, r2
adds r0, 0x55
strb r3, [r0]
ldr r0, [r4]
adds r0, r2
adds r0, 0x61
strb r3, [r0]
pop {r4}
pop {r0}
bx r0
.align 2, 0
_080965F0: .4byte gUnknown_203B490
thumb_func_end ResetPelipperBoardSlot
thumb_func_start sub_80965F4
sub_80965F4:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
movs r2, 0
movs r3, 0
ldr r0, _0809660C
mov r12, r0
mov r8, r3
movs r4, 0
mov r9, r4
b _08096636
.align 2, 0
_0809660C: .4byte gUnknown_203B490
_08096610:
cmp r2, r3
ble _0809662A
mov r1, r12
ldr r0, [r1]
mov r5, r8
adds r1, r0, r5
adds r0, r4
adds r1, 0x50
adds r0, 0x50
ldm r0!, {r5-r7}
stm r1!, {r5-r7}
ldm r0!, {r6,r7}
stm r1!, {r6,r7}
_0809662A:
adds r4, 0x14
movs r0, 0x14
add r9, r0
adds r2, 0x1
add r8, r0
adds r3, 0x1
_08096636:
cmp r2, 0x7
bgt _08096666
mov r1, r12
ldr r0, [r1]
adds r0, r4
adds r0, 0x50
ldrb r0, [r0]
cmp r0, 0
bne _08096666
ldr r6, _08096694
mov r1, r9
_0809664C:
adds r1, 0x14
adds r4, 0x14
movs r5, 0x14
add r9, r5
adds r2, 0x1
cmp r2, 0x7
bgt _08096666
ldr r0, [r6]
adds r0, r1
adds r0, 0x50
ldrb r0, [r0]
cmp r0, 0
beq _0809664C
_08096666:
cmp r2, 0x8
bne _08096610
cmp r3, 0x7
bgt _08096688
ldr r4, _08096694
movs r2, 0
lsls r0, r3, 2
adds r0, r3
lsls r1, r0, 2
_08096678:
ldr r0, [r4]
adds r0, r1
adds r0, 0x50
strb r2, [r0]
adds r1, 0x14
adds r3, 0x1
cmp r3, 0x7
ble _08096678
_08096688:
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08096694: .4byte gUnknown_203B490
thumb_func_end sub_80965F4
.align 2,0

View File

@@ -1,5 +1,6 @@
#include "constants/mailbox.h"
#include "global.h"
#include "constants/friend_area.h"
#include "constants/dungeon.h"
#include "constants/monster.h"
#include "constants/wonder_mail.h"
@@ -9,6 +10,10 @@
#include "random.h"
#include "pokemon.h"
#include "code_8096AF8.h"
#include "mailbox_8095F8C.h"
#include "event_flag.h"
#include "rescue_team_info.h"
extern bool8 IsValidWonderMail(WonderMail *WonderMailData);
extern u8 sub_8095E38(WonderMail *, u8, u8, bool8);
@@ -17,6 +22,383 @@ extern void SortPelipperJobs();
u8 sub_8097318(s16 param_1);
extern bool8 GenerateMailJobInfo(WonderMail *);
bool8 sub_803C1D0(DungeonLocation *, u8);
u8 sub_8095F28(u8);
void sub_803C37C(DungeonLocation *, u8, u8 *);
bool8 sub_8096E80(u32);
u8 sub_8096E2C(void);
u8 sub_8095E78(void);
void sub_8096078(void);
s32 CountFilledMailboxSlots(void);
void ResetJobSlot(u8);
bool8 IsJobSlotEmpty(u8);
bool8 sub_80963B4(void);
static void SortMailboxSlots(void)
{
s32 r1;
s32 r6;
WonderMail job;
for(r1 = 0; r1 < NUM_MAILBOX_SLOTS - 1; r1++)
{
for(r6 = r1 + 1; r6 < NUM_MAILBOX_SLOTS; r6++)
{
if(gUnknown_203B490->mailboxSlots[r6].mailType != 0)
{
if((gUnknown_203B490->mailboxSlots[r1].unk4.dungeon.id > gUnknown_203B490->mailboxSlots[r6].unk4.dungeon.id) ||
((gUnknown_203B490->mailboxSlots[r1].unk4.dungeon.id == gUnknown_203B490->mailboxSlots[r6].unk4.dungeon.id) &&
(gUnknown_203B490->mailboxSlots[r1].unk4.dungeon.floor > gUnknown_203B490->mailboxSlots[r6].unk4.dungeon.floor)))
{
job = gUnknown_203B490->mailboxSlots[r1];
gUnknown_203B490->mailboxSlots[r1] = gUnknown_203B490->mailboxSlots[r6];
gUnknown_203B490->mailboxSlots[r6] = job;
}
}
}
}
}
void sub_80961B4(void)
{
if (sub_8096E2C() != 0) {
gUnknown_203B490->unk328 = TRUE;
}
return;
}
bool8 sub_80961D8(void)
{
s32 num;
s32 index;
u32 floor;
s32 friendAreaReward;
WonderMail *slot;
bool8 flag = FALSE;
num = CountFilledMailboxSlots();
index = RandRange(num, NUM_MAILBOX_SLOTS);
if(num >= NUM_MAILBOX_SLOTS) return 0;
if(!gUnknown_203B490->unk328)
return 0;
else
{
gUnknown_203B490->unk328 = flag;
}
floor = 0x38;
if(sub_8001D08(0xA, 0x31, 0x1))
{
if(!gUnknown_203B490->PKMNNewsReceived[0x35])
if(!sub_8096E80(0x35)) floor = 0x35;
}
if(sub_80023E4(0xF))
{
if(!gUnknown_203B490->PKMNNewsReceived[0x34])
if(!sub_8096E80(0x34)) floor = 0x34;
if(!gUnknown_203B490->PKMNNewsReceived[0x33])
if(!sub_8096E80(0x33)) floor = 0x33;
if(!gUnknown_203B490->PKMNNewsReceived[0x32])
if(!sub_8096E80(0x32)) floor = 0x32;
}
if(GetRescueTeamRank() == 6)
{
if(!gUnknown_203B490->PKMNNewsReceived[0x36])
if(!sub_8096E80(0x36)) floor = 0x36;
}
if(sub_80023E4(6))
{
if(!gUnknown_203B490->PKMNNewsReceived[0x37])
if(!sub_8096E80(0x37)) floor = 0x37;
}
if(floor != 0x38) goto _slot;
if(num > index) goto _08096392;
floor = sub_8096E2C();
if(!sub_80023E4(0xE) && (floor > 2)) goto _0809638E;
if (floor > 0x31) goto _0809638E;
_slot:
slot = GetMailboxSlotInfo(num);
slot->mailType = 1;
slot->unk4.dungeon.id = 0x62;
slot->unk4.dungeon.floor = floor;
goto _flag;
_0809638E:
for(; num <= index; num++)
{
slot = GetMailboxSlotInfo(num);
if(GenerateMailJobInfo(slot))
{
friendAreaReward = sub_8095E78();
if(!sub_803C1D0(&slot->unk4.dungeon, slot->missionType)) friendAreaReward = FRIEND_AREA_NONE;
slot->rewardType = RandRange(MONEY1, END_REWARDS);
if(slot->rewardType == FRIEND_AREA)
{
if(friendAreaReward == FRIEND_AREA_NONE)
{
slot->rewardType = MONEY1;
flag = TRUE;
}
else
{
slot->friendAreaReward = friendAreaReward;
flag = TRUE;
}
}
else
{
_flag:
flag = TRUE;
}
} else break;
}
_08096392:
if(sub_80963B4())
flag = TRUE;
sub_8096078();
SortMailboxSlots();
return flag;
}
bool8 sub_80963B4(void)
{
u8 floor;
s32 num;
WonderMail *slot;
bool8 flag = FALSE;
floor = sub_8096E2C();
num = CountFilledMailboxSlots();
if(num >= NUM_MAILBOX_SLOTS) return FALSE;
if(sub_80023E4(0xE))
{
if(floor < 0x32)
{
slot = GetMailboxSlotInfo(num);
slot->mailType = 1;
slot->unk4.dungeon.id = 0x62;
slot->unk4.dungeon.floor = floor;
flag = TRUE;
}
}
return flag;
}
void sub_80963FC(void)
{
s32 index;
WonderMail *slot;
for(index = 0; index < NUM_MAILBOX_SLOTS; index++)
{
slot = GetMailboxSlotInfo(index);
if(slot->mailType != 1)
{
ResetMailboxSlot(index);
}
}
sub_8096078();
slot = GetMailboxSlotInfo(CountFilledMailboxSlots());
slot->mailType = 5;
slot->missionType = 0;
slot->unk2 = 0;
slot->unk4.dungeon.id = 2;
slot->unk4.dungeon.floor = 3;
slot->unk4.seed = 0x00ffffff & Rand32Bit();
slot->clientSpecies = MONSTER_PIDGEY;
slot->targetSpecies = MONSTER_PIDGEY;
slot->targetItem = sub_8095F28(slot->unk4.dungeon.id);
slot->rewardType = MONEY1;
do
{
sub_803C37C(&slot->unk4.dungeon, slot->missionType, &slot->itemReward);
} while (slot->targetItem == slot->itemReward);
slot->friendAreaReward = FRIEND_AREA_NONE;
sub_8096078();
SortMailboxSlots();
}
void sub_8096488(void)
{
WonderMail *mail;
s32 index;
for(index = 0; index < NUM_MAILBOX_SLOTS; index++){
ResetMailboxSlot(index);
}
mail = GetMailboxSlotInfo(0);
mail->mailType = 1;
mail->unk4.dungeon.id = 98;
mail->unk4.dungeon.floor = 0;
}
bool8 sub_80964B4(void)
{
if ((gUnknown_203B490->PKMNNewsReceived[0x35] == 0) && (sub_8096E80(0x35) == 0)) {
return FALSE;
}
else {
return TRUE;
}
}
bool8 sub_80964E4(void)
{
if ((gUnknown_203B490->PKMNNewsReceived[0x36] == 0) && (sub_8096E80(0x36) == 0)) {
return FALSE;
}
else {
return TRUE;
}
}
s32 CountFilledPelipperBoardSlots(void)
{
s32 index;
s32 slots;
slots = 0;
for(index = 0; index < MAX_ACCEPTED_JOBS; index++) {
if (!IsPelipperBoardSlotEmpty(index)) {
slots++;
}
}
return slots;
}
UNUSED bool8 sub_8096538(WonderMail *mail)
{
s32 index;
for(index = 0; index < MAX_ACCEPTED_JOBS; index++)
{
if(gUnknown_203B490->pelipperBoardJobs[index].mailType == 0)
{
gUnknown_203B490->pelipperBoardJobs[index] = *mail;
return FALSE;
}
}
return TRUE;
}
WonderMail *GetPelipperBoardSlotInfo(u8 index)
{
return &gUnknown_203B490->pelipperBoardJobs[index];
}
bool8 IsPelipperBoardSlotEmpty(u8 index)
{
if (gUnknown_203B490->pelipperBoardJobs[index].mailType == 0)
return TRUE;
else
return FALSE;
}
void ResetPelipperBoardSlot(u8 index)
{
gUnknown_203B490->pelipperBoardJobs[index].mailType = MAIL_TYPE_NONE;
gUnknown_203B490->pelipperBoardJobs[index].unk4.dungeon.id = 99;
gUnknown_203B490->pelipperBoardJobs[index].unk4.dungeon.floor = 0;
gUnknown_203B490->pelipperBoardJobs[index].rewardType = 0;
}
NAKED
void sub_80965F4(void)
{
asm_unified(
"\tpush {r4-r7,lr}\n"
"\tmov r7, r9\n"
"\tmov r6, r8\n"
"\tpush {r6,r7}\n"
"\tmovs r2, 0\n"
"\tmovs r3, 0\n"
"\tldr r0, _0809660C\n"
"\tmov r12, r0\n"
"\tmov r8, r3\n"
"\tmovs r4, 0\n"
"\tmov r9, r4\n"
"\tb _08096636\n"
"\t.align 2, 0\n"
"_0809660C: .4byte gUnknown_203B490\n"
"_08096610:\n"
"\tcmp r2, r3\n"
"\tble _0809662A\n"
"\tmov r1, r12\n"
"\tldr r0, [r1]\n"
"\tmov r5, r8\n"
"\tadds r1, r0, r5\n"
"\tadds r0, r4\n"
"\tadds r1, 0x50\n"
"\tadds r0, 0x50\n"
"\tldm r0!, {r5-r7}\n"
"\tstm r1!, {r5-r7}\n"
"\tldm r0!, {r6,r7}\n"
"\tstm r1!, {r6,r7}\n"
"_0809662A:\n"
"\tadds r4, 0x14\n"
"\tmovs r0, 0x14\n"
"\tadd r9, r0\n"
"\tadds r2, 0x1\n"
"\tadd r8, r0\n"
"\tadds r3, 0x1\n"
"_08096636:\n"
"\tcmp r2, 0x7\n"
"\tbgt _08096666\n"
"\tmov r1, r12\n"
"\tldr r0, [r1]\n"
"\tadds r0, r4\n"
"\tadds r0, 0x50\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0\n"
"\tbne _08096666\n"
"\tldr r6, _08096694\n"
"\tmov r1, r9\n"
"_0809664C:\n"
"\tadds r1, 0x14\n"
"\tadds r4, 0x14\n"
"\tmovs r5, 0x14\n"
"\tadd r9, r5\n"
"\tadds r2, 0x1\n"
"\tcmp r2, 0x7\n"
"\tbgt _08096666\n"
"\tldr r0, [r6]\n"
"\tadds r0, r1\n"
"\tadds r0, 0x50\n"
"\tldrb r0, [r0]\n"
"\tcmp r0, 0\n"
"\tbeq _0809664C\n"
"_08096666:\n"
"\tcmp r2, 0x8\n"
"\tbne _08096610\n"
"\tcmp r3, 0x7\n"
"\tbgt _08096688\n"
"\tldr r4, _08096694\n"
"\tmovs r2, 0\n"
"\tlsls r0, r3, 2\n"
"\tadds r0, r3\n"
"\tlsls r1, r0, 2\n"
"_08096678:\n"
"\tldr r0, [r4]\n"
"\tadds r0, r1\n"
"\tadds r0, 0x50\n"
"\tstrb r2, [r0]\n"
"\tadds r1, 0x14\n"
"\tadds r3, 0x1\n"
"\tcmp r3, 0x7\n"
"\tble _08096678\n"
"_08096688:\n"
"\tpop {r3,r4}\n"
"\tmov r8, r3\n"
"\tmov r9, r4\n"
"\tpop {r4-r7}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_08096694: .4byte gUnknown_203B490");
}
void SortPelipperJobs(void)
{
s32 index1;