mirror of
https://github.com/pret/pmd-red.git
synced 2026-10-01 21:38:41 -05:00
more documentation and some decomp
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.align 2, 0
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8095B28
|
||||
sub_8095B28:
|
||||
thumb_func_start GenerateMailJobInfo
|
||||
GenerateMailJobInfo:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
@@ -14,7 +14,7 @@ sub_8095B28:
|
||||
ldr r4, _08095B44
|
||||
add sp, r4
|
||||
adds r4, r0, 0
|
||||
bl sub_8095CE0
|
||||
bl GenerateMailJobDungeonInfo
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08095B48
|
||||
@@ -224,375 +224,6 @@ _08095CCC:
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8095B28
|
||||
|
||||
thumb_func_start sub_8095CE0
|
||||
sub_8095CE0:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x60
|
||||
str r0, [sp, 0x44]
|
||||
mov r0, sp
|
||||
bl sub_80A29B0
|
||||
str r0, [sp, 0x4C]
|
||||
cmp r0, 0
|
||||
bne _08095D0C
|
||||
mov r0, sp
|
||||
add r1, sp, 0x4C
|
||||
ldrb r1, [r1]
|
||||
strb r1, [r0]
|
||||
mov r1, sp
|
||||
movs r0, 0x1
|
||||
strb r0, [r1, 0x1]
|
||||
movs r2, 0x2
|
||||
str r2, [sp, 0x4C]
|
||||
_08095D0C:
|
||||
ldr r0, [sp, 0x4C]
|
||||
bl RandInt
|
||||
mov r9, r0
|
||||
str r0, [sp, 0x48]
|
||||
mov r1, sp
|
||||
adds r1, 0x40
|
||||
str r1, [sp, 0x5C]
|
||||
_08095D1C:
|
||||
mov r0, sp
|
||||
add r0, r9
|
||||
ldrb r7, [r0]
|
||||
adds r0, r7, 0
|
||||
bl GetDungeonFloorCount
|
||||
str r0, [sp, 0x58]
|
||||
lsrs r0, 31
|
||||
ldr r2, [sp, 0x58]
|
||||
adds r0, r2, r0
|
||||
asrs r0, 1
|
||||
str r0, [sp, 0x54]
|
||||
adds r1, r2, 0
|
||||
bl RandRange
|
||||
adds r4, r0, 0
|
||||
str r4, [sp, 0x50]
|
||||
_08095D3E:
|
||||
movs r0, 0x1
|
||||
mov r8, r0
|
||||
ldr r1, _08095DF4
|
||||
ldr r0, [sp, 0x40]
|
||||
ands r0, r1
|
||||
orrs r0, r7
|
||||
lsls r2, r4, 24
|
||||
lsrs r2, 16
|
||||
ldr r1, _08095DF8
|
||||
ands r0, r1
|
||||
orrs r0, r2
|
||||
str r0, [sp, 0x40]
|
||||
ldr r0, [sp, 0x5C]
|
||||
bl sub_809017C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08095D66
|
||||
movs r1, 0
|
||||
mov r8, r1
|
||||
_08095D66:
|
||||
ldr r2, _08095DFC
|
||||
mov r10, r2
|
||||
movs r6, 0
|
||||
movs r5, 0x3
|
||||
_08095D6E:
|
||||
mov r1, r10
|
||||
ldr r0, [r1]
|
||||
adds r0, r6
|
||||
adds r1, r7, 0
|
||||
adds r2, r4, 0
|
||||
movs r3, 0x1
|
||||
bl sub_8095E38
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08095D88
|
||||
movs r2, 0
|
||||
mov r8, r2
|
||||
_08095D88:
|
||||
adds r6, 0x14
|
||||
subs r5, 0x1
|
||||
cmp r5, 0
|
||||
bge _08095D6E
|
||||
ldr r0, _08095DFC
|
||||
mov r10, r0
|
||||
movs r6, 0x50
|
||||
movs r5, 0x7
|
||||
_08095D98:
|
||||
mov r1, r10
|
||||
ldr r0, [r1]
|
||||
adds r0, r6
|
||||
adds r1, r7, 0
|
||||
adds r2, r4, 0
|
||||
movs r3, 0x1
|
||||
bl sub_8095E38
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08095DB2
|
||||
movs r2, 0
|
||||
mov r8, r2
|
||||
_08095DB2:
|
||||
adds r6, 0x14
|
||||
subs r5, 0x1
|
||||
cmp r5, 0
|
||||
bge _08095D98
|
||||
ldr r0, _08095DFC
|
||||
mov r10, r0
|
||||
movs r6, 0xF0
|
||||
movs r5, 0x7
|
||||
_08095DC2:
|
||||
mov r1, r10
|
||||
ldr r0, [r1]
|
||||
adds r0, r6
|
||||
adds r1, r7, 0
|
||||
adds r2, r4, 0
|
||||
movs r3, 0x1
|
||||
bl sub_8095E38
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08095DDC
|
||||
movs r2, 0
|
||||
mov r8, r2
|
||||
_08095DDC:
|
||||
adds r6, 0x14
|
||||
subs r5, 0x1
|
||||
cmp r5, 0
|
||||
bge _08095DC2
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
beq _08095E00
|
||||
ldr r1, [sp, 0x44]
|
||||
strb r7, [r1, 0x4]
|
||||
strb r4, [r1, 0x5]
|
||||
movs r0, 0x1
|
||||
b _08095E28
|
||||
.align 2, 0
|
||||
_08095DF4: .4byte 0xffffff00
|
||||
_08095DF8: .4byte 0xffff00ff
|
||||
_08095DFC: .4byte gUnknown_203B490
|
||||
_08095E00:
|
||||
adds r4, 0x1
|
||||
ldr r2, [sp, 0x58]
|
||||
cmp r4, r2
|
||||
blt _08095E0A
|
||||
ldr r4, [sp, 0x54]
|
||||
_08095E0A:
|
||||
ldr r0, [sp, 0x50]
|
||||
cmp r4, r0
|
||||
bne _08095D3E
|
||||
movs r1, 0x1
|
||||
add r9, r1
|
||||
ldr r2, [sp, 0x4C]
|
||||
cmp r9, r2
|
||||
bne _08095E1E
|
||||
movs r0, 0
|
||||
mov r9, r0
|
||||
_08095E1E:
|
||||
ldr r1, [sp, 0x48]
|
||||
cmp r9, r1
|
||||
beq _08095E26
|
||||
b _08095D1C
|
||||
_08095E26:
|
||||
movs r0, 0
|
||||
_08095E28:
|
||||
add sp, 0x60
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8095CE0
|
||||
|
||||
thumb_func_start sub_8095E38
|
||||
sub_8095E38:
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0
|
||||
beq _08095E6E
|
||||
ldrb r0, [r4, 0x1]
|
||||
cmp r0, 0x2
|
||||
bne _08095E5E
|
||||
cmp r3, 0x1
|
||||
bne _08095E5E
|
||||
ldrb r0, [r4, 0x4]
|
||||
cmp r0, r1
|
||||
bne _08095E6E
|
||||
movs r0, 0x1
|
||||
b _08095E70
|
||||
_08095E5E:
|
||||
ldrb r0, [r4, 0x4]
|
||||
cmp r0, r1
|
||||
bne _08095E6E
|
||||
ldrb r0, [r4, 0x5]
|
||||
cmp r0, r2
|
||||
bne _08095E6E
|
||||
movs r0, 0x1
|
||||
b _08095E70
|
||||
_08095E6E:
|
||||
movs r0, 0
|
||||
_08095E70:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8095E38
|
||||
|
||||
thumb_func_start sub_8095E78
|
||||
sub_8095E78:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x3C
|
||||
movs r6, 0
|
||||
movs r5, 0x1
|
||||
_08095E84:
|
||||
ldr r0, _08095F04
|
||||
ldr r0, [r0]
|
||||
adds r0, r5
|
||||
ldrb r0, [r0]
|
||||
adds r1, r5, 0x1
|
||||
mov r8, r1
|
||||
cmp r0, 0
|
||||
bne _08095EF6
|
||||
lsls r0, r5, 24
|
||||
lsrs r0, 24
|
||||
bl GetFriendAreaUnlockCondition
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
bne _08095EF6
|
||||
movs r4, 0
|
||||
ldr r0, _08095F08
|
||||
ldr r1, [r0]
|
||||
movs r3, 0x3
|
||||
_08095EAC:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _08095EBA
|
||||
ldrb r0, [r1, 0x11]
|
||||
cmp r0, 0x9
|
||||
bne _08095EBA
|
||||
movs r4, 0x1
|
||||
_08095EBA:
|
||||
adds r1, 0x14
|
||||
subs r3, 0x1
|
||||
cmp r3, 0
|
||||
bge _08095EAC
|
||||
ldr r0, _08095F08
|
||||
ldr r0, [r0]
|
||||
adds r2, r0, 0
|
||||
adds r2, 0xF0
|
||||
adds r1, r0, 0
|
||||
movs r3, 0x7
|
||||
_08095ECE:
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0
|
||||
beq _08095EE0
|
||||
ldr r7, _08095F0C
|
||||
adds r0, r1, r7
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x9
|
||||
bne _08095EE0
|
||||
movs r4, 0x1
|
||||
_08095EE0:
|
||||
adds r2, 0x14
|
||||
adds r1, 0x14
|
||||
subs r3, 0x1
|
||||
cmp r3, 0
|
||||
bge _08095ECE
|
||||
cmp r4, 0
|
||||
bne _08095EF6
|
||||
mov r1, sp
|
||||
adds r0, r1, r6
|
||||
strb r5, [r0]
|
||||
adds r6, 0x1
|
||||
_08095EF6:
|
||||
mov r5, r8
|
||||
cmp r5, 0x39
|
||||
ble _08095E84
|
||||
cmp r6, 0
|
||||
bne _08095F10
|
||||
movs r0, 0
|
||||
b _08095F1A
|
||||
.align 2, 0
|
||||
_08095F04: .4byte gFriendAreas
|
||||
_08095F08: .4byte gUnknown_203B490
|
||||
_08095F0C: .4byte 0x00000101
|
||||
_08095F10:
|
||||
adds r0, r6, 0
|
||||
bl RandInt
|
||||
add r0, sp
|
||||
ldrb r0, [r0]
|
||||
_08095F1A:
|
||||
add sp, 0x3C
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8095E78
|
||||
|
||||
thumb_func_start sub_8095F28
|
||||
sub_8095F28:
|
||||
push {r4-r7,lr}
|
||||
sub sp, 0xF0
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
movs r6, 0
|
||||
movs r5, 0x1
|
||||
_08095F34:
|
||||
lsls r4, r5, 24
|
||||
cmp r7, 0x63
|
||||
beq _08095F48
|
||||
lsrs r1, r4, 24
|
||||
adds r0, r7, 0
|
||||
bl xxx_bit_lut_lookup_8091E50
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08095F6A
|
||||
_08095F48:
|
||||
lsrs r4, 24
|
||||
adds r0, r4, 0
|
||||
bl IsThrowableItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08095F6A
|
||||
adds r0, r4, 0
|
||||
bl IsNotMoneyOrUsedTMItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08095F6A
|
||||
mov r1, sp
|
||||
adds r0, r1, r6
|
||||
strb r5, [r0]
|
||||
adds r6, 0x1
|
||||
_08095F6A:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0xEF
|
||||
ble _08095F34
|
||||
cmp r6, 0
|
||||
beq _08095F80
|
||||
adds r0, r6, 0
|
||||
bl RandInt
|
||||
add r0, sp
|
||||
ldrb r0, [r0]
|
||||
b _08095F82
|
||||
_08095F80:
|
||||
movs r0, 0
|
||||
_08095F82:
|
||||
add sp, 0xF0
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8095F28
|
||||
|
||||
thumb_func_end GenerateMailJobInfo
|
||||
|
||||
.align 2,0
|
||||
|
||||
@@ -377,7 +377,7 @@ _08096340:
|
||||
lsrs r0, 24
|
||||
bl GetMailboxSlotInfo
|
||||
adds r4, r0, 0
|
||||
bl sub_8095B28
|
||||
bl GenerateMailJobInfo
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08096392
|
||||
|
||||
@@ -125,7 +125,7 @@ bool8 IsNotMoneyOrUsedTMItem(u8 id);
|
||||
s32 FindItemInInventory(u8 id);
|
||||
bool8 IsHMItem(u8 id);
|
||||
bool8 IsEdibleItem(u8 id);
|
||||
|
||||
u8 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1);
|
||||
|
||||
void RestoreHeldItem(struct unkStruct_8094924*, struct BulkItem*);
|
||||
void SaveHeldItem(struct unkStruct_8094924*, struct BulkItem*);
|
||||
|
||||
@@ -15,18 +15,16 @@ extern struct unkStruct_203B2F4 *gUnknown_203B2F4;
|
||||
struct unkStruct_802C39C
|
||||
{
|
||||
/* 0x0 */ u32 unk0[2];
|
||||
/* 0x8 */ struct DungeonLocation *unk8;
|
||||
/* 0x8 */ struct DungeonLocation *dungeon;
|
||||
/* 0xC */ u8 *playerName;
|
||||
/* 0x10 */ s16 unk10;
|
||||
/* 0x12 */ s16 unk12;
|
||||
/* 0x10 */ s16 clientSpecies;
|
||||
/* 0x12 */ s16 targetSpecies;
|
||||
/* 0x14 */ u8 unk14;
|
||||
/* 0x15 */ u8 fill15[0x1B];
|
||||
/* 0x34 */ u8 fill34[2];
|
||||
/* 0x36 */ u8 fill36[0x3C - 0x36];
|
||||
/* 0x3C */ u8 unk3C[0xC];
|
||||
/* 0x48 */ u8 fill48[4];
|
||||
/* 0x4C */ u32 unk4C;
|
||||
/* 0x50 */ u8 *unk50[3];
|
||||
/* 0x15 */ u8 fill15[0x38 - 0x15];
|
||||
/* 0x38 */ u8 unk38[0x48 - 0x38];
|
||||
/* 0x48 */ u32 y;
|
||||
/* 0x4C */ u8 *unk4C;
|
||||
/* 0x50 */ u8 *unk50[2];
|
||||
};
|
||||
|
||||
struct unkStruct_803B344
|
||||
|
||||
@@ -318,6 +318,7 @@ SECTIONS {
|
||||
src/code_8095824.o(.text);
|
||||
src/code_80958E8.o(.text);
|
||||
asm/code_80958E8.o(.text);
|
||||
src/code_80958E8_mid.o(.text);
|
||||
src/mailbox_8095F8C.o(.text);
|
||||
asm/code_80958E8_1.o(.text);
|
||||
src/code_80958E8_1.o(.text);
|
||||
|
||||
@@ -26,7 +26,7 @@ extern void sub_80965F4();
|
||||
extern void SortPelipperJobs();
|
||||
extern struct WonderMail *GetPelipperBoardSlotInfo(u8);
|
||||
u8 sub_8097318(s16 param_1);
|
||||
extern u8 sub_8095B28(struct WonderMail *);
|
||||
extern bool8 GenerateMailJobInfo(struct WonderMail *);
|
||||
|
||||
void SortPelipperJobs(void)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ void GeneratePelipperJobs(void)
|
||||
index++;
|
||||
}
|
||||
for (; index <= range; index++) {
|
||||
if (sub_8095B28(&gUnknown_203B490->pelipperBoardJobs[index]) == 0) break;
|
||||
if (!GenerateMailJobInfo(&gUnknown_203B490->pelipperBoardJobs[index])) break;
|
||||
gUnknown_203B490->pelipperBoardJobs[index].rewardType = RandRange(MONEY, BLANK_4);
|
||||
}
|
||||
sub_80965F4();
|
||||
|
||||
178
src/code_80958E8_mid.c
Normal file
178
src/code_80958E8_mid.c
Normal file
@@ -0,0 +1,178 @@
|
||||
#include "global.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "constants/friend_area.h"
|
||||
#include "constants/wonder_mail.h"
|
||||
#include "item.h"
|
||||
#include "random.h"
|
||||
#include "friend_area.h"
|
||||
#include "code_80958E8.h"
|
||||
|
||||
extern u8 *gFriendAreas;
|
||||
bool8 sub_8095E38(struct WonderMail *mail, u8 dungeon, u32 floor, u8 param_4);
|
||||
extern s32 sub_80A29B0(u8 *param_1);
|
||||
extern s32 GetDungeonFloorCount(u8);
|
||||
extern bool8 sub_809017C(struct DungeonLocation *);
|
||||
|
||||
bool8 GenerateMailJobDungeonInfo(struct WonderMail *mail)
|
||||
{
|
||||
s32 counter;
|
||||
s32 floor;
|
||||
s32 index;
|
||||
u8 dungeon;
|
||||
bool8 flag;
|
||||
u8 dungeonStack [64];
|
||||
s32 counter_1;
|
||||
s32 cap;
|
||||
s32 floor_1;
|
||||
s32 halfFloorCount;
|
||||
s32 floorCount;
|
||||
struct DungeonLocation dungeonLoc;
|
||||
|
||||
|
||||
cap = sub_80A29B0(dungeonStack);
|
||||
if (cap == 0) {
|
||||
dungeonStack[0] = DUNGEON_TINY_WOODS;
|
||||
dungeonStack[1] = DUNGEON_THUNDERWAVE_CAVE;
|
||||
cap = 2;
|
||||
}
|
||||
counter = RandInt(cap);
|
||||
counter_1 = counter;
|
||||
do {
|
||||
dungeon = dungeonStack[counter];
|
||||
floorCount = GetDungeonFloorCount(dungeon);
|
||||
halfFloorCount = floorCount / 2;
|
||||
floor = RandRange(halfFloorCount, floorCount);
|
||||
floor_1 = floor;
|
||||
do {
|
||||
flag = TRUE;
|
||||
dungeonLoc.id = dungeon;
|
||||
dungeonLoc.floor = floor;
|
||||
|
||||
if(sub_809017C(&dungeonLoc))
|
||||
flag = FALSE;
|
||||
|
||||
for(index = 0; index < 4; index++)
|
||||
{
|
||||
if (sub_8095E38(&gUnknown_203B490->mailboxSlots[index],dungeon,floor,1)) {
|
||||
flag = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for(index = 0; index < 8; index++)
|
||||
{
|
||||
if (sub_8095E38(&gUnknown_203B490->pelipperBoardJobs[index],dungeon,floor,1)) {
|
||||
flag = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
for(index = 0; index < 8; index++)
|
||||
{
|
||||
if (sub_8095E38(&gUnknown_203B490->jobSlots[index],dungeon,floor,1)) {
|
||||
flag = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
mail->dungeon.id = dungeon;
|
||||
mail->dungeon.floor = floor;
|
||||
return TRUE;
|
||||
}
|
||||
floor++;
|
||||
if (floor >= floorCount) {
|
||||
floor = halfFloorCount;
|
||||
}
|
||||
} while (floor != floor_1);
|
||||
|
||||
counter++;
|
||||
if (counter == cap) {
|
||||
counter = 0;
|
||||
}
|
||||
if (counter == counter_1) {
|
||||
return FALSE;
|
||||
}
|
||||
} while( TRUE );
|
||||
}
|
||||
|
||||
bool8 sub_8095E38(struct WonderMail *mail, u8 dungeon, u32 floor, u8 param_4)
|
||||
{
|
||||
if (mail->mailType != 0) {
|
||||
if ((mail->missionType == WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT) && (param_4 == 1)) {
|
||||
if (mail->dungeon.id == dungeon) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if ((mail->dungeon.id == dungeon) && (mail->dungeon.floor == floor)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u8 sub_8095E78(void)
|
||||
{
|
||||
bool8 flag;
|
||||
s32 index;
|
||||
s32 friendAreaIndex;
|
||||
s32 counter;
|
||||
|
||||
u8 friendAreaStack[NUM_FRIEND_AREAS];
|
||||
|
||||
counter = 0;
|
||||
for(friendAreaIndex = BOUNTIFUL_SEA; friendAreaIndex < NUM_FRIEND_AREAS; friendAreaIndex++)
|
||||
{
|
||||
if ((!gFriendAreas[friendAreaIndex]) &&
|
||||
(GetFriendAreaUnlockCondition(friendAreaIndex) == UNLOCK_WONDER_MAIL)) {
|
||||
flag = FALSE;
|
||||
|
||||
|
||||
for(index = 0; index < 4; index++)
|
||||
{
|
||||
if((gUnknown_203B490->mailboxSlots[index].mailType != 0) && (gUnknown_203B490->mailboxSlots[index].rewardType == FRIEND_AREA))
|
||||
flag = TRUE;
|
||||
}
|
||||
|
||||
|
||||
for(index = 0; index < 8; index++)
|
||||
{
|
||||
if((gUnknown_203B490->jobSlots[index].mailType != 0) && (gUnknown_203B490->jobSlots[index].rewardType == FRIEND_AREA))
|
||||
flag = TRUE;
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
friendAreaStack[counter] = friendAreaIndex;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter != 0) {
|
||||
return friendAreaStack[RandInt(counter)];
|
||||
}
|
||||
else {
|
||||
return NONE;
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_8095F28(u8 param_1)
|
||||
{
|
||||
s32 itemID;
|
||||
s32 counter;
|
||||
u8 itemStack [NUMBER_OF_ITEM_IDS];
|
||||
|
||||
counter = 0;
|
||||
for(itemID = ITEM_STICK; itemID < NUMBER_OF_ITEM_IDS; itemID++)
|
||||
{
|
||||
if ((param_1 == 0x63) ||
|
||||
(xxx_bit_lut_lookup_8091E50(param_1, itemID) != 0)) {
|
||||
if ((!IsThrowableItem(itemID)) && (IsNotMoneyOrUsedTMItem(itemID))) {
|
||||
itemStack[counter] = itemID;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (counter == 0) {
|
||||
return ITEM_NOTHING;
|
||||
}
|
||||
else {
|
||||
return itemStack[RandInt(counter)];
|
||||
}
|
||||
}
|
||||
@@ -1237,7 +1237,7 @@ const char *sub_8091E50(u8 index)
|
||||
return gUnknown_810AF50[index];
|
||||
}
|
||||
|
||||
u32 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1)
|
||||
u8 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1)
|
||||
{
|
||||
if (i0 > 0x3e)
|
||||
return 0;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/wonder_mail.h"
|
||||
#include "file_system.h"
|
||||
#include "input.h"
|
||||
@@ -389,8 +390,8 @@ void sub_802B3E0(void)
|
||||
mail = sub_8095228(gUnknown_203B2C8->unk1);
|
||||
sub_803C37C(&mail->dungeon, 0, gUnknown_203B2C8->unk114.itemRewards);
|
||||
gUnknown_203B2C8->unk114.teamRankPtsReward = GetDungeonTeamRankPts(&mail->dungeon, 0);
|
||||
gUnknown_203B2C8->unk114.itemRewards[1] = 0;
|
||||
gUnknown_203B2C8->unk114.itemRewards[2] = 0;
|
||||
gUnknown_203B2C8->unk114.itemRewards[1] = ITEM_NOTHING;
|
||||
gUnknown_203B2C8->unk114.itemRewards[2] = ITEM_NOTHING;
|
||||
gUnknown_203B2C8->unk114.quantity = 10;
|
||||
gUnknown_203B2C8->unk114.friendAreaReward = 0;
|
||||
sub_802F204(&gUnknown_203B2C8->unk114, 0);
|
||||
|
||||
@@ -8,17 +8,16 @@
|
||||
struct unkStruct_802C39C
|
||||
{
|
||||
/* 0x0 */ u32 unk0[2];
|
||||
/* 0x8 */ struct DungeonLocation *unk8;
|
||||
/* 0xC */ u8 *unkC;
|
||||
/* 0x10 */ s16 unk10;
|
||||
/* 0x12 */ s16 unk12;
|
||||
/* 0x8 */ struct DungeonLocation *dungeon;
|
||||
/* 0xC */ u8 *playerName;
|
||||
/* 0x10 */ s16 clientSpecies;
|
||||
/* 0x12 */ s16 targetSpecies;
|
||||
/* 0x14 */ u8 unk14;
|
||||
/* 0x15 */ u8 fill15[0x1B];
|
||||
/* 0x36 */ u8 fill36[0x3C - 0x36];
|
||||
/* 0x3C */ u8 unk3C[0xC];
|
||||
/* 0x48 */ u8 fill48[4];
|
||||
/* 0x4C */ u32 unk4C;
|
||||
/* 0x50 */ u32 unk50[3];
|
||||
/* 0x15 */ u8 fill15[0x38 - 0x15];
|
||||
/* 0x38 */ u8 unk38[0x48 - 0x38];
|
||||
/* 0x48 */ u32 y;
|
||||
/* 0x4C */ u8 *unk4C;
|
||||
/* 0x50 */ u32 unk50[2];
|
||||
};
|
||||
|
||||
struct unkStruct_203B2E8
|
||||
@@ -365,8 +364,8 @@ void sub_802C6DC(void)
|
||||
|
||||
void sub_802C750(void)
|
||||
{
|
||||
struct WonderMail *uVar1;
|
||||
int iVar2;
|
||||
struct WonderMail *mail;
|
||||
int index;
|
||||
s32 r4;
|
||||
s32 r5;
|
||||
struct unkStruct_802C39C local;
|
||||
@@ -380,18 +379,18 @@ void sub_802C750(void)
|
||||
r4 += 4;
|
||||
r5 = r4 + gUnknown_203B2E8->unkA4[2] * 8;
|
||||
sub_8012BC4(r5,0,gUnknown_203B2E8->unk26 + 1,2,7,gUnknown_203B2E8->unk3C);
|
||||
iVar2 = 0;
|
||||
index = 0;
|
||||
|
||||
if(( iVar2 < gUnknown_203B2E8->unk22))
|
||||
if(( index < gUnknown_203B2E8->unk22))
|
||||
do
|
||||
{
|
||||
uVar1 = GetJobSlotInfo(gUnknown_203B2E8->unk0[gUnknown_203B2E8->unk26 * gUnknown_203B2E8->unk24 + iVar2]);
|
||||
mail = GetJobSlotInfo(gUnknown_203B2E8->unk0[gUnknown_203B2E8->unk26 * gUnknown_203B2E8->unk24 + index]);
|
||||
local.unk0[0] = gUnknown_203B2E8->unk3C;
|
||||
local.unk4C = sub_8013800(&gUnknown_203B2E8->unk8,iVar2);
|
||||
sub_803B35C(uVar1,local.unk0);
|
||||
local.y = sub_8013800(&gUnknown_203B2E8->unk8,index);
|
||||
sub_803B35C(mail,local.unk0);
|
||||
CreateRescueTitle(&local);
|
||||
iVar2++;
|
||||
} while( iVar2 < gUnknown_203B2E8->unk22);
|
||||
index++;
|
||||
} while( index < gUnknown_203B2E8->unk22);
|
||||
sub_80073E0(gUnknown_203B2E8->unk3C);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,18 +79,16 @@ extern struct unkStruct_203B2E0 *gUnknown_203B2E0;
|
||||
struct unkStruct_802C39C
|
||||
{
|
||||
/* 0x0 */ u32 unk0[2];
|
||||
/* 0x8 */ struct DungeonLocation *unk8;
|
||||
/* 0xC */ u8 *unkC;
|
||||
/* 0x10 */ s16 unk10;
|
||||
/* 0x12 */ s16 unk12;
|
||||
/* 0x8 */ struct DungeonLocation *dungeon;
|
||||
/* 0xC */ u8 *playerName;
|
||||
/* 0x10 */ s16 clientSpecies;
|
||||
/* 0x12 */ s16 targetSpecies;
|
||||
/* 0x14 */ u8 unk14;
|
||||
/* 0x15 */ u8 fill15[0x1B];
|
||||
/* 0x34 */ u8 fill34[2];
|
||||
/* 0x36 */ u8 fill36[0x3C - 0x36];
|
||||
/* 0x3C */ u8 unk3C[0xC];
|
||||
/* 0x48 */ u8 fill48[4];
|
||||
/* 0x4C */ u32 unk4C;
|
||||
/* 0x50 */ u32 unk50[3];
|
||||
/* 0x15 */ u8 fill15[0x38 - 0x15];
|
||||
/* 0x38 */ u8 unk38[0x48 - 0x38];
|
||||
/* 0x48 */ u32 y;
|
||||
/* 0x4C */ u8 *unk4C;
|
||||
/* 0x50 */ u8 *unk50[2];
|
||||
};
|
||||
|
||||
extern struct UnkTextStruct2 gUnknown_80DFCB4;
|
||||
@@ -110,21 +108,21 @@ void CreateMailMenu(void)
|
||||
{
|
||||
struct WonderMail *mail;
|
||||
s32 y;
|
||||
s32 iVar5;
|
||||
s32 index;
|
||||
struct unkStruct_802C39C local;
|
||||
u8 buffer [128];
|
||||
|
||||
sub_8008C54(gUnknown_203B2D8->unk38);
|
||||
sub_80073B8(gUnknown_203B2D8->unk38);
|
||||
xxx_call_draw_string(gUnknown_203B2D8->unk22 * 8 + 10,0,gMailboxText,gUnknown_203B2D8->unk38,0);
|
||||
iVar5 = 0;
|
||||
if (iVar5 < gUnknown_203B2D8->unk1E) {
|
||||
index = 0;
|
||||
if (index < gUnknown_203B2D8->unk1E) {
|
||||
do {
|
||||
mail = GetMailboxSlotInfo(gUnknown_203B2D8->unk0[(gUnknown_203B2D8->unk22 * gUnknown_203B2D8->unk20) + iVar5]);
|
||||
mail = GetMailboxSlotInfo(gUnknown_203B2D8->unk0[(gUnknown_203B2D8->unk22 * gUnknown_203B2D8->unk20) + index]);
|
||||
local.unk0[0] = gUnknown_203B2D8->unk38;
|
||||
local.unk4C = sub_8013800(&gUnknown_203B2D8->unk4, iVar5);
|
||||
local.y = sub_8013800(&gUnknown_203B2D8->unk4, index);
|
||||
if (mail->mailType == 1) {
|
||||
y = sub_8013800(&gUnknown_203B2D8->unk4, iVar5);
|
||||
y = sub_8013800(&gUnknown_203B2D8->unk4, index);
|
||||
sub_803B6B0(10,y,6,gUnknown_203B2D8->unk38);
|
||||
PrintPokeNameToBuffer(gAvailablePokemonNames, GetPlayerPokemonStruct());
|
||||
sprintfStatic(buffer, GetPokemonMailHeadline(mail->dungeon.floor), gAvailablePokemonNames);
|
||||
@@ -133,12 +131,12 @@ void CreateMailMenu(void)
|
||||
else {
|
||||
sub_803B35C(mail,local.unk0);
|
||||
if (IsMailinJobSlot(mail)) {
|
||||
local.unk3C[11] = 2;
|
||||
local.unk38[11] = 2;
|
||||
}
|
||||
CreateRescueTitle(&local);
|
||||
}
|
||||
iVar5++;
|
||||
} while (iVar5 < gUnknown_203B2D8->unk1E);
|
||||
index++;
|
||||
} while (index < gUnknown_203B2D8->unk1E);
|
||||
}
|
||||
sub_80073E0(gUnknown_203B2D8->unk38);
|
||||
}
|
||||
@@ -326,11 +324,11 @@ void sub_802C328(void)
|
||||
|
||||
void sub_802C39C(void)
|
||||
{
|
||||
u32 uVar1;
|
||||
u32 slotIndex;
|
||||
struct WonderMail *mail;
|
||||
s32 iVar4;
|
||||
s32 x;
|
||||
s32 iVar6;
|
||||
s32 index;
|
||||
struct unkStruct_802C39C local;
|
||||
|
||||
sub_8008C54(gUnknown_203B2E0->unk3C);
|
||||
@@ -343,20 +341,20 @@ void sub_802C39C(void)
|
||||
x = iVar4 + gUnknown_203B2E0->unkA4[2] * 8;
|
||||
sub_8012BC4(x,0,gUnknown_203B2E0->unk26 + 1,2,7,gUnknown_203B2E0->unk3C);
|
||||
|
||||
iVar6 = 0;
|
||||
if(iVar6 < gUnknown_203B2E0->unk22)
|
||||
index = 0;
|
||||
if(index < gUnknown_203B2E0->unk22)
|
||||
do
|
||||
{
|
||||
uVar1 = (gUnknown_203B2E0->unk0[gUnknown_203B2E0->unk26 * gUnknown_203B2E0->unk24 + iVar6]);
|
||||
mail = GetPelipperBoardSlotInfo(uVar1);
|
||||
slotIndex = (gUnknown_203B2E0->unk0[gUnknown_203B2E0->unk26 * gUnknown_203B2E0->unk24 + index]);
|
||||
mail = GetPelipperBoardSlotInfo(slotIndex);
|
||||
local.unk0[0] = gUnknown_203B2E0->unk3C;
|
||||
local.unk4C = sub_8013800(&gUnknown_203B2E0->unk8,iVar6);
|
||||
local.y = sub_8013800(&gUnknown_203B2E0->unk8,index);
|
||||
sub_803B35C(mail,local.unk0);
|
||||
if (IsMailinJobSlot(GetPelipperBoardSlotInfo(uVar1))) {
|
||||
local.unk3C[11] = 2;
|
||||
if (IsMailinJobSlot(GetPelipperBoardSlotInfo(slotIndex))) {
|
||||
local.unk38[11] = 2;
|
||||
}
|
||||
CreateRescueTitle(&local);
|
||||
iVar6++;
|
||||
} while (iVar6 < gUnknown_203B2E0->unk22);
|
||||
index++;
|
||||
} while (index < gUnknown_203B2E0->unk22);
|
||||
sub_80073E0(gUnknown_203B2E0->unk3C);
|
||||
}
|
||||
|
||||
@@ -179,10 +179,10 @@ void sub_802CFD0(void)
|
||||
while(r5 < gUnknown_203B2F4->unk1A) {
|
||||
iVar1 = sub_803B344(gUnknown_203B2F4->unk1E * gUnknown_203B2F4->unk1C + r5);
|
||||
local.unk0[0] = gUnknown_203B2F4->unk34;
|
||||
local.unk4C = sub_8013800(gUnknown_203B2F4,r5);
|
||||
local.y = sub_8013800(gUnknown_203B2F4,r5);
|
||||
sub_803B35C(iVar1,local.unk0);
|
||||
local.unk3C[11] = 1;
|
||||
local.unk50[0] = iVar1->unk14;
|
||||
local.unk38[11] = 1;
|
||||
local.unk4C = iVar1->unk14;
|
||||
CreateRescueTitle(&local);
|
||||
r5++;
|
||||
}
|
||||
|
||||
@@ -35,17 +35,16 @@ extern struct unkStruct_203B480 *gUnknown_203B480;
|
||||
struct unkStruct_802C39C
|
||||
{
|
||||
/* 0x0 */ u32 unk0[2];
|
||||
/* 0x8 */ struct DungeonLocation *unk8;
|
||||
/* 0xC */ u8 *unkC;
|
||||
/* 0x10 */ s16 unk10;
|
||||
/* 0x12 */ s16 unk12;
|
||||
/* 0x8 */ struct DungeonLocation *dungeon;
|
||||
/* 0xC */ u8 *playerName;
|
||||
/* 0x10 */ s16 clientSpecies;
|
||||
/* 0x12 */ s16 targetSpecies;
|
||||
/* 0x14 */ u8 unk14;
|
||||
/* 0x15 */ u8 fill15[0x1B];
|
||||
/* 0x34 */ u8 fill34[2];
|
||||
/* 0x36 */ u8 fill36[0x3C - 0x36];
|
||||
/* 0x3C */ u8 unk3C[0x10];
|
||||
/* 0x4C */ u32 unk4C;
|
||||
/* 0x50 */ u32 unk50[3];
|
||||
/* 0x15 */ u8 fill15[0x38 - 0x15];
|
||||
/* 0x38 */ u8 unk38[0x48 - 0x38];
|
||||
/* 0x48 */ u32 y;
|
||||
/* 0x4C */ u8 *unk4C;
|
||||
/* 0x50 */ u8 *unk50[2];
|
||||
};
|
||||
|
||||
extern bool8 HasNoWonderMailType(u32);
|
||||
@@ -236,7 +235,7 @@ void sub_803092C(void)
|
||||
struct unkStruct_203B480 *mail;
|
||||
s32 r4;
|
||||
s32 r5;
|
||||
s32 r6;
|
||||
s32 index;
|
||||
struct unkStruct_802C39C local;
|
||||
|
||||
sub_8008C54(gUnknown_203B320->unk58);
|
||||
@@ -249,43 +248,43 @@ void sub_803092C(void)
|
||||
r5 = r4 + gUnknown_203B320->unkC0[2] * 8;
|
||||
sub_8012BC4(r5,0,gUnknown_203B320->unk42 + 1,1,7,gUnknown_203B320->unk58);
|
||||
|
||||
r6 = 0;
|
||||
if (r6 < gUnknown_203B320->unk3E) {
|
||||
index = 0;
|
||||
if (index < gUnknown_203B320->unk3E) {
|
||||
do {
|
||||
mail = sub_8095228(gUnknown_203B320->unk0[(gUnknown_203B320->unk42 * gUnknown_203B320->unk40) + r6]);
|
||||
mail = sub_8095228(gUnknown_203B320->unk0[(gUnknown_203B320->unk42 * gUnknown_203B320->unk40) + index]);
|
||||
local.unk0[0] = gUnknown_203B320->unk58;
|
||||
local.unk4C = sub_8013800(&gUnknown_203B320->unk24,r6);
|
||||
local.unk3C[8] = 7;
|
||||
local.unk3C[10] = 0;
|
||||
local.unk3C[12] = 0;
|
||||
local.y = sub_8013800(&gUnknown_203B320->unk24,index);
|
||||
local.unk38[8] = 7;
|
||||
local.unk38[10] = 0;
|
||||
local.unk38[12] = 0;
|
||||
|
||||
local.unk8 = &mail->dungeon;
|
||||
local.unkC = mail->playerName;
|
||||
local.dungeon = &mail->dungeon;
|
||||
local.playerName = mail->playerName;
|
||||
|
||||
local.unk10 = (mail->clientSpecies);
|
||||
local.unk12 = (mail->clientSpecies);
|
||||
local.clientSpecies = (mail->clientSpecies);
|
||||
local.targetSpecies = (mail->clientSpecies);
|
||||
local.unk14 = 0;
|
||||
local.fill15[0x19] = 5;
|
||||
|
||||
switch(mail->mailType)
|
||||
{
|
||||
case WONDER_MAIL_TYPE_AOK:
|
||||
local.unk3C[11] = 3;
|
||||
local.unk38[11] = 3;
|
||||
break;
|
||||
case WONDER_MAIL_TYPE_THANK_YOU:
|
||||
local.unk3C[11] = 4;
|
||||
local.unk38[11] = 4;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
local.unk3C[11]= 1;
|
||||
local.unk38[11]= 1;
|
||||
break;
|
||||
default:
|
||||
local.unk3C[11]= 0;
|
||||
local.unk38[11]= 0;
|
||||
break;
|
||||
}
|
||||
CreateRescueTitle(&local);
|
||||
r6++;
|
||||
} while (r6 < gUnknown_203B320->unk3E);
|
||||
index++;
|
||||
} while (index < gUnknown_203B320->unk3E);
|
||||
}
|
||||
sub_80073E0(gUnknown_203B320->unk58);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user