mirror of
https://github.com/pret/pmd-red.git
synced 2026-10-01 13:28:04 -05:00
sub_8060D64
This commit is contained in:
@@ -8,144 +8,6 @@
|
||||
|
||||
|
||||
|
||||
thumb_func_start sub_8060D24
|
||||
sub_8060D24:
|
||||
push {r4,lr}
|
||||
bl GetLeader
|
||||
movs r1, 0
|
||||
movs r2, 0xB
|
||||
bl sub_8044D90
|
||||
adds r4, r0, 0
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
bl sub_803ECB4
|
||||
adds r0, r4, 0
|
||||
bl sub_801B3C0
|
||||
_08060D42:
|
||||
movs r0, 0x16
|
||||
bl sub_803E46C
|
||||
bl sub_801B410
|
||||
cmp r0, 0
|
||||
beq _08060D42
|
||||
bl sub_801B450
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
bl sub_803EAF0
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8060D24
|
||||
|
||||
thumb_func_start sub_8060D64
|
||||
sub_8060D64:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
adds r4, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r6, r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
mov r8, r3
|
||||
movs r7, 0
|
||||
ldr r0, _08060E28
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08060E2C
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08060DB8
|
||||
cmp r6, 0
|
||||
bne _08060DB8
|
||||
ldr r5, _08060E30
|
||||
ldr r0, [r5]
|
||||
ldrb r1, [r0]
|
||||
movs r3, 0x1
|
||||
adds r0, r3, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060DA2
|
||||
strh r7, [r4]
|
||||
movs r7, 0x1
|
||||
_08060DA2:
|
||||
ldr r0, [r5]
|
||||
adds r0, 0x28
|
||||
ldrb r1, [r0]
|
||||
adds r0, r3, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060DB8
|
||||
lsls r0, r7, 1
|
||||
adds r0, r4
|
||||
strh r3, [r0]
|
||||
adds r7, 0x1
|
||||
_08060DB8:
|
||||
cmp r2, 0
|
||||
beq _08060DD4
|
||||
ldr r0, [sp, 0x18]
|
||||
adds r0, 0x4
|
||||
bl sub_804ACE4
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060DD4
|
||||
lsls r0, r7, 1
|
||||
adds r0, r4
|
||||
movs r1, 0x2
|
||||
strh r1, [r0]
|
||||
adds r7, 0x1
|
||||
_08060DD4:
|
||||
cmp r6, 0
|
||||
bne _08060E1A
|
||||
mov r2, r8
|
||||
cmp r2, 0
|
||||
bne _08060E1A
|
||||
movs r5, 0
|
||||
lsls r0, r7, 1
|
||||
adds r6, r0, r4
|
||||
_08060DE4:
|
||||
ldr r0, _08060E28
|
||||
ldr r0, [r0]
|
||||
lsls r1, r5, 2
|
||||
ldr r2, _08060E34
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060E14
|
||||
ldr r0, [r4, 0x70]
|
||||
adds r0, 0x60
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060E14
|
||||
adds r0, r5, 0x4
|
||||
strh r0, [r6]
|
||||
adds r6, 0x2
|
||||
adds r7, 0x1
|
||||
_08060E14:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _08060DE4
|
||||
_08060E1A:
|
||||
adds r0, r7, 0
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_08060E28: .4byte gDungeon
|
||||
_08060E2C: .4byte 0x0000065b
|
||||
_08060E30: .4byte gTeamInventoryRef
|
||||
_08060E34: .4byte 0x0001357c
|
||||
thumb_func_end sub_8060D64
|
||||
|
||||
thumb_func_start sub_8060E38
|
||||
sub_8060E38:
|
||||
push {r4-r7,lr}
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "text1.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "code_8044CC8.h"
|
||||
#include "code_801B3C0.h"
|
||||
#include "dungeon_capabilities.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "constants/status.h"
|
||||
@@ -4178,3 +4179,49 @@ void sub_8060CE8(ActionContainer *a0)
|
||||
a0->unk4[1].lastItemThrowPosition.x = 0;
|
||||
a0->unk4[1].lastItemThrowPosition.y = 0;
|
||||
}
|
||||
|
||||
void sub_8060D24(UNUSED ActionContainer *a0)
|
||||
{
|
||||
Item *item = sub_8044D90(GetLeader(), 0, 0xB);
|
||||
sub_803ECB4(NULL, 0);
|
||||
sub_801B3C0(item);
|
||||
|
||||
do {
|
||||
sub_803E46C(0x16);
|
||||
} while (sub_801B410() == 0);
|
||||
|
||||
sub_801B450();
|
||||
sub_803EAF0(0, NULL);
|
||||
}
|
||||
|
||||
extern bool8 sub_804ACE4(Position *pos);
|
||||
|
||||
s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4)
|
||||
{
|
||||
s32 i;
|
||||
s32 count = 0;
|
||||
|
||||
if (gDungeon->unk65B && !a1) {
|
||||
if (gTeamInventoryRef->teamItems[0].flags & ITEM_FLAG_EXISTS) {
|
||||
a0[count++] = 0;
|
||||
}
|
||||
if (gTeamInventoryRef->teamItems[INVENTORY_SIZE / 2].flags & ITEM_FLAG_EXISTS) {
|
||||
a0[count++] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (a2 && sub_804ACE4(&a4->pos)) {
|
||||
a0[count++] = 2;
|
||||
}
|
||||
|
||||
if (!a1 && !a3) {
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
Entity *teamMon = gDungeon->teamPokemon[i];
|
||||
if (EntityExists(teamMon) && teamMon->info->heldItem.flags & ITEM_FLAG_EXISTS) {
|
||||
a0[count++] = i + MAX_TEAM_MEMBERS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user