mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-10 01:55:51 -05:00
sub_8060CE8
This commit is contained in:
@@ -7,500 +7,6 @@
|
||||
|
||||
|
||||
|
||||
thumb_func_start sub_8060900
|
||||
sub_8060900:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
mov r9, r0
|
||||
ldr r4, _08060964
|
||||
adds r1, r4, 0
|
||||
movs r2, 0xA
|
||||
bl sub_8044CC8
|
||||
adds r7, r0, 0
|
||||
mov r0, r9
|
||||
ldr r0, [r0, 0x70]
|
||||
mov r10, r0
|
||||
ldr r1, _08060968
|
||||
movs r0, 0
|
||||
str r0, [r1]
|
||||
ldrb r0, [r4]
|
||||
cmp r0, 0x8F
|
||||
bls _0806092C
|
||||
b _08060BD0
|
||||
_0806092C:
|
||||
cmp r0, 0x80
|
||||
bne _080609B0
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x9
|
||||
bl sub_8044F5C
|
||||
ldrb r0, [r7, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x6
|
||||
beq _08060992
|
||||
movs r2, 0
|
||||
ldr r0, _0806096C
|
||||
ldr r0, [r0]
|
||||
ldr r1, _08060970
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08060978
|
||||
ldr r0, _08060974
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x4C
|
||||
ldrb r0, [r0]
|
||||
movs r2, 0x1
|
||||
ands r2, r0
|
||||
b _08060988
|
||||
.align 2, 0
|
||||
_08060964: .4byte gUnknown_202F238
|
||||
_08060968: .4byte gUnknown_202EE6C
|
||||
_0806096C: .4byte gDungeon
|
||||
_08060970: .4byte 0x0000065b
|
||||
_08060974: .4byte gTeamInventoryRef
|
||||
_08060978:
|
||||
mov r0, r10
|
||||
adds r0, 0x60
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060988
|
||||
movs r2, 0x1
|
||||
_08060988:
|
||||
cmp r2, 0
|
||||
beq _08060992
|
||||
movs r0, 0x9
|
||||
bl sub_8044FF0
|
||||
_08060992:
|
||||
ldr r0, _08060A20
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x80
|
||||
bne _080609B0
|
||||
ldr r0, _08060A24
|
||||
ldr r0, [r0]
|
||||
ldr r2, _08060A28
|
||||
adds r0, r2
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _080609B0
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0xA
|
||||
bl sub_8044F5C
|
||||
_080609B0:
|
||||
adds r0, r7, 0
|
||||
bl sub_8044DC8
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
cmp r4, 0
|
||||
beq _080609E8
|
||||
ldrb r1, [r7, 0x2]
|
||||
adds r0, r4, 0
|
||||
bl sub_8044F5C
|
||||
ldrb r1, [r7]
|
||||
movs r0, 0x8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080609D6
|
||||
adds r0, r4, 0
|
||||
bl sub_8044FF0
|
||||
_080609D6:
|
||||
adds r0, r7, 0
|
||||
bl sub_8046F00
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080609E8
|
||||
adds r0, r4, 0
|
||||
bl sub_8044FF0
|
||||
_080609E8:
|
||||
ldr r0, _08060A20
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x14
|
||||
bhi _08060A6C
|
||||
ldrb r0, [r7, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060A0A
|
||||
ldrb r0, [r7, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _08060A6C
|
||||
_08060A0A:
|
||||
ldrb r1, [r7]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060A3A
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x3D
|
||||
bl sub_8044F5C
|
||||
b _08060A42
|
||||
.align 2, 0
|
||||
_08060A20: .4byte gUnknown_202F238
|
||||
_08060A24: .4byte gDungeon
|
||||
_08060A28: .4byte 0x0000065b
|
||||
_08060A2C:
|
||||
movs r0, 0x3C
|
||||
bl sub_8044FF0
|
||||
movs r0, 0x3D
|
||||
bl sub_8044FF0
|
||||
b _08060A6C
|
||||
_08060A3A:
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x3C
|
||||
bl sub_8044F5C
|
||||
_08060A42:
|
||||
movs r3, 0
|
||||
ldr r0, _08060AD4
|
||||
ldr r2, [r0]
|
||||
movs r4, 0x1
|
||||
_08060A4A:
|
||||
ldrb r1, [r2]
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060A64
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060A64
|
||||
movs r0, 0x8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08060A2C
|
||||
_08060A64:
|
||||
adds r2, 0x4
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x13
|
||||
ble _08060A4A
|
||||
_08060A6C:
|
||||
ldr r0, _08060AD8
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x81
|
||||
beq _08060AE8
|
||||
cmp r0, 0x80
|
||||
beq _08060B3C
|
||||
movs r3, 0
|
||||
mov r8, r3
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x36
|
||||
bl sub_8044F5C
|
||||
movs r6, 0
|
||||
_08060A86:
|
||||
ldr r0, _08060ADC
|
||||
ldr r0, [r0]
|
||||
lsls r1, r6, 2
|
||||
ldr r2, _08060AE0
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060ABE
|
||||
ldr r0, [r4, 0x70]
|
||||
ldr r3, _08060AE4
|
||||
adds r5, r0, r3
|
||||
movs r0, 0
|
||||
strb r0, [r5]
|
||||
adds r0, r4, 0
|
||||
bl CannotUseItems
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08060ABE
|
||||
movs r0, 0x1
|
||||
mov r8, r0
|
||||
mov r1, r8
|
||||
strb r1, [r5]
|
||||
_08060ABE:
|
||||
adds r6, 0x1
|
||||
cmp r6, 0x3
|
||||
ble _08060A86
|
||||
mov r2, r8
|
||||
cmp r2, 0
|
||||
bne _08060B3C
|
||||
movs r0, 0x36
|
||||
bl sub_8044FF0
|
||||
b _08060B3C
|
||||
.align 2, 0
|
||||
_08060AD4: .4byte gTeamInventoryRef
|
||||
_08060AD8: .4byte gUnknown_202F238
|
||||
_08060ADC: .4byte gDungeon
|
||||
_08060AE0: .4byte 0x0001357c
|
||||
_08060AE4: .4byte 0x00000157
|
||||
_08060AE8:
|
||||
ldr r0, _08060B10
|
||||
ldr r0, [r0]
|
||||
ldr r3, _08060B14
|
||||
adds r0, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08060B3C
|
||||
ldr r0, _08060B18
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x4C
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060B1C
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x3E
|
||||
bl sub_8044F5C
|
||||
b _08060B24
|
||||
.align 2, 0
|
||||
_08060B10: .4byte gDungeon
|
||||
_08060B14: .4byte 0x0000065b
|
||||
_08060B18: .4byte gTeamInventoryRef
|
||||
_08060B1C:
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x37
|
||||
bl sub_8044F5C
|
||||
_08060B24:
|
||||
mov r0, r9
|
||||
bl CannotUseItems
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060B3C
|
||||
movs r0, 0x37
|
||||
bl sub_8044FF0
|
||||
movs r0, 0x3E
|
||||
bl sub_8044FF0
|
||||
_08060B3C:
|
||||
ldr r0, _08060B64
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x14
|
||||
bhi _08060B78
|
||||
mov r1, r9
|
||||
movs r2, 0x4
|
||||
ldrsh r0, [r1, r2]
|
||||
movs r3, 0x6
|
||||
ldrsh r1, [r1, r3]
|
||||
bl GetTile
|
||||
ldr r0, [r0, 0x14]
|
||||
cmp r0, 0
|
||||
bne _08060B68
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x8
|
||||
bl sub_8044F5C
|
||||
b _08060B78
|
||||
.align 2, 0
|
||||
_08060B64: .4byte gUnknown_202F238
|
||||
_08060B68:
|
||||
bl GetEntityType
|
||||
cmp r0, 0x3
|
||||
bne _08060B78
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x3A
|
||||
bl sub_8044F5C
|
||||
_08060B78:
|
||||
ldrb r0, [r7, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08060B8E
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x27
|
||||
bl sub_8044F5C
|
||||
b _08060BAE
|
||||
_08060B8E:
|
||||
ldrb r0, [r7, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _08060BA6
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x41
|
||||
bl sub_8044F5C
|
||||
b _08060BAE
|
||||
_08060BA6:
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0xB
|
||||
bl sub_8044F5C
|
||||
_08060BAE:
|
||||
mov r0, r10
|
||||
bl ToolboxEnabled
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060BBC
|
||||
b _08060CCC
|
||||
_08060BBC:
|
||||
movs r0, 0x27
|
||||
bl sub_8044FF0
|
||||
movs r0, 0x41
|
||||
bl sub_8044FF0
|
||||
movs r0, 0xB
|
||||
bl sub_8044FF0
|
||||
b _08060CCC
|
||||
_08060BD0:
|
||||
ldrb r1, [r4]
|
||||
subs r1, 0x90
|
||||
ldr r0, _08060C50
|
||||
mov r9, r0
|
||||
ldr r0, [r0]
|
||||
lsls r1, 2
|
||||
ldr r2, _08060C54
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08060CCC
|
||||
ldr r3, [r4, 0x70]
|
||||
mov r8, r3
|
||||
movs r5, 0
|
||||
adds r0, r4, 0
|
||||
bl CannotUseItems
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
negs r1, r0
|
||||
orrs r1, r0
|
||||
lsrs r6, r1, 31
|
||||
ldr r0, _08060C58
|
||||
ldr r0, [r0]
|
||||
adds r0, 0x4C
|
||||
ldrb r0, [r0]
|
||||
movs r4, 0x1
|
||||
ands r4, r0
|
||||
ldrb r0, [r7, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x5
|
||||
bne _08060C22
|
||||
movs r5, 0x1
|
||||
_08060C22:
|
||||
ldrb r0, [r7, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x9
|
||||
bne _08060C32
|
||||
movs r5, 0x1
|
||||
_08060C32:
|
||||
mov r1, r9
|
||||
ldr r0, [r1]
|
||||
ldr r2, _08060C5C
|
||||
adds r0, r2
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08060C78
|
||||
cmp r4, 0
|
||||
beq _08060C60
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x3E
|
||||
bl sub_8044F5C
|
||||
b _08060C68
|
||||
.align 2, 0
|
||||
_08060C50: .4byte gDungeon
|
||||
_08060C54: .4byte 0x0001357c
|
||||
_08060C58: .4byte gTeamInventoryRef
|
||||
_08060C5C: .4byte 0x0000065b
|
||||
_08060C60:
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x37
|
||||
bl sub_8044F5C
|
||||
_08060C68:
|
||||
cmp r6, 0
|
||||
beq _08060C78
|
||||
movs r0, 0x37
|
||||
bl sub_8044FF0
|
||||
movs r0, 0x3E
|
||||
bl sub_8044FF0
|
||||
_08060C78:
|
||||
mov r3, r8
|
||||
ldrb r0, [r3, 0x7]
|
||||
cmp r0, 0
|
||||
beq _08060CBA
|
||||
adds r0, r7, 0
|
||||
bl sub_8044DC8
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
cmp r4, 0
|
||||
beq _08060CCC
|
||||
ldrb r1, [r7, 0x2]
|
||||
adds r0, r4, 0
|
||||
bl sub_8044F5C
|
||||
ldrb r1, [r7]
|
||||
movs r0, 0x8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08060CA6
|
||||
adds r0, r4, 0
|
||||
bl sub_8044FF0
|
||||
_08060CA6:
|
||||
adds r0, r7, 0
|
||||
bl sub_8046F00
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08060CCC
|
||||
adds r0, r4, 0
|
||||
bl sub_8044FF0
|
||||
b _08060CCC
|
||||
_08060CBA:
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0x38
|
||||
bl sub_8044F5C
|
||||
cmp r5, 0
|
||||
beq _08060CCC
|
||||
movs r0, 0x38
|
||||
bl sub_8044FF0
|
||||
_08060CCC:
|
||||
ldrb r1, [r7, 0x2]
|
||||
movs r0, 0xC
|
||||
bl sub_8044F5C
|
||||
bl sub_8045064
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8060900
|
||||
|
||||
thumb_func_start sub_8060CE8
|
||||
sub_8060CE8:
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r1, _08060D18
|
||||
ldr r0, _08060D1C
|
||||
movs r2, 0x18
|
||||
ldrsh r0, [r0, r2]
|
||||
lsls r0, 2
|
||||
adds r0, r1
|
||||
ldrh r1, [r0]
|
||||
adds r0, r4, 0
|
||||
bl SetMonsterActionFields
|
||||
ldr r0, _08060D20
|
||||
ldr r1, [r0, 0x4]
|
||||
ldr r0, [r0]
|
||||
str r0, [r4, 0x4]
|
||||
str r1, [r4, 0x8]
|
||||
movs r0, 0
|
||||
strb r0, [r4, 0xC]
|
||||
strh r0, [r4, 0x10]
|
||||
strh r0, [r4, 0x12]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08060D18: .4byte gUnknown_202EE44
|
||||
_08060D1C: .4byte gUnknown_202EE10
|
||||
_08060D20: .4byte gUnknown_202F238
|
||||
thumb_func_end sub_8060CE8
|
||||
|
||||
thumb_func_start sub_8060D24
|
||||
sub_8060D24:
|
||||
|
||||
13
include/code_8044CC8.h
Normal file
13
include/code_8044CC8.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef GUARD_CODE_8044CC8_H
|
||||
#define GUARD_CODE_8044CC8_H
|
||||
|
||||
struct unkStruct_202EE44
|
||||
{
|
||||
u16 unk0;
|
||||
u8 unk2;
|
||||
bool8 unk3;
|
||||
};
|
||||
|
||||
extern struct unkStruct_202EE44 gUnknown_202EE44[10];
|
||||
|
||||
#endif // GUARD_CODE_8044CC8_H
|
||||
@@ -155,7 +155,8 @@ typedef struct Dungeon
|
||||
/* 0x644 */ DungeonLocation dungeonLocation;
|
||||
u8 fill646[0x654 - 0x648];
|
||||
u8 unk654;
|
||||
u8 fill655[0x65C - 0x655];
|
||||
u8 fill655[0x65B - 0x655];
|
||||
u8 unk65B;
|
||||
u8 unk65C;
|
||||
u8 fill65D[0x660 - 0x65D];
|
||||
/* 0x660 */ s16 fractionalTurn; // Handles turn order when Pokémon have different movement speeds.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "code_8044CC8.h"
|
||||
#include "items.h"
|
||||
|
||||
typedef struct ItemText
|
||||
@@ -23,22 +24,14 @@ void sub_80460F8(Position *, Item *, u32);
|
||||
extern u8 sub_8043D10(void);
|
||||
extern bool8 sub_8045888(Entity *);
|
||||
|
||||
struct unkStruct_202EE44
|
||||
{
|
||||
u16 unk0;
|
||||
u8 unk2;
|
||||
bool8 unk3;
|
||||
};
|
||||
|
||||
struct unkStruct_202EE44 gUnknown_202EE44[10];
|
||||
|
||||
EWRAM_DATA struct unkStruct_202EE44 gUnknown_202EE44[10] = {0};
|
||||
|
||||
Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2)
|
||||
{
|
||||
Tile *tile;
|
||||
Item *item;
|
||||
EntityInfo *info;
|
||||
|
||||
|
||||
if ((u8)(param_2->actionUseIndex - 1) < INVENTORY_SIZE) {
|
||||
item = &gTeamInventoryRef->teamItems[param_2->actionUseIndex - 1];
|
||||
}
|
||||
@@ -65,7 +58,7 @@ bool8 sub_8044D40(ActionContainer *param_1,s32 index)
|
||||
{
|
||||
Item *item;
|
||||
unkStruct_8044CC8 *puVar1;
|
||||
|
||||
|
||||
puVar1 = ¶m_1->unk4[index];
|
||||
if ((u8)(puVar1->actionUseIndex - 1) < INVENTORY_SIZE) {
|
||||
item = &gTeamInventoryRef->teamItems[puVar1->actionUseIndex - 1];
|
||||
@@ -95,13 +88,13 @@ Entity *sub_8044DA4(Entity *entity, s32 index)
|
||||
return gDungeon->teamPokemon[info->action.unk4[index].actionUseIndex];
|
||||
}
|
||||
|
||||
u16 sub_8044DC8(u8 *param_1)
|
||||
u16 sub_8044DC8(Item *param_1)
|
||||
{
|
||||
if (param_1[2] == ITEM_SWITCH_BOX) {
|
||||
if (param_1->id == ITEM_SWITCH_BOX) {
|
||||
return 0x35;
|
||||
}
|
||||
else {
|
||||
return gUnknown_80F6964[GetItemCategory(param_1[2])];
|
||||
return gUnknown_80F6964[GetItemCategory(param_1->id)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +102,7 @@ void sub_8044DF0(Entity *entity, s32 index, u32 unused)
|
||||
{
|
||||
Item *item;
|
||||
EntityInfo *info;
|
||||
|
||||
|
||||
info = entity->info;
|
||||
item = sub_8044D90(entity,index,unused);
|
||||
if ((info->action).unk4[0].actionUseIndex == 0x80) {
|
||||
@@ -130,7 +123,7 @@ void sub_8044E24(Entity *entity,int index,u32 unused)
|
||||
EntityInfo *info;
|
||||
Position *pos;
|
||||
Item item;
|
||||
|
||||
|
||||
itemPtr = sub_8044D90(entity,index,unused);
|
||||
info = entity->info;
|
||||
if (!IsHMItem(itemPtr->id)) {
|
||||
@@ -192,7 +185,7 @@ bool8 sub_8044F3C(s32 param_1)
|
||||
void sub_8044F5C(u16 param_1, u8 param_2)
|
||||
{
|
||||
int index;
|
||||
|
||||
|
||||
if (gUnknown_202EE6C < 10) {
|
||||
for(index = 0; index < gUnknown_202EE6C; index++)
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "text2.h"
|
||||
#include "text1.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "code_8044CC8.h"
|
||||
#include "dungeon_capabilities.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "constants/status.h"
|
||||
@@ -3970,10 +3971,210 @@ void sub_8060890(Position *a0)
|
||||
gUnknown_202F238.lastItemThrowPosition.x = a0->x;
|
||||
gUnknown_202F238.lastItemThrowPosition.y = a0->y;
|
||||
}
|
||||
/*
|
||||
|
||||
extern Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2, UNUSED s32 a3);
|
||||
extern void sub_8044F5C(u16 param_1, u8 param_2);
|
||||
extern void sub_8044FF0(u16 param_1);
|
||||
extern u16 sub_8044DC8(Item *param_1);
|
||||
extern bool8 sub_8046F00(Item *item);
|
||||
extern void sub_8045064(void);
|
||||
|
||||
void sub_8060900(Entity *a0)
|
||||
{
|
||||
u16 val_sub8044DC8;
|
||||
Item *item = sub_8044CC8(a0, &gUnknown_202F238, 0xA);
|
||||
EntityInfo *a0Info = a0->info;
|
||||
|
||||
gUnknown_202EE6C = 0;
|
||||
if (gUnknown_202F238.actionUseIndex < 144) {
|
||||
if (gUnknown_202F238.actionUseIndex == 128) {
|
||||
sub_8044F5C(9, item->id);
|
||||
if (GetItemCategory(item->id) != CATEGORY_POKE) {
|
||||
bool32 r2 = 0;
|
||||
if (gDungeon->unk65B != 0) {
|
||||
if (gTeamInventoryRef->teamItems[INVENTORY_SIZE - 1].flags & ITEM_FLAG_EXISTS) {
|
||||
r2 = TRUE;
|
||||
}
|
||||
}
|
||||
else if (a0Info->heldItem.flags & ITEM_FLAG_EXISTS) {
|
||||
r2 = TRUE;
|
||||
}
|
||||
|
||||
if (r2) {
|
||||
sub_8044FF0(9);
|
||||
}
|
||||
}
|
||||
// Why is it checking actionUseIndex again?
|
||||
if (gUnknown_202F238.actionUseIndex == 128 && gDungeon->unk65B != 0) {
|
||||
sub_8044F5C(10, item->id);
|
||||
}
|
||||
}
|
||||
val_sub8044DC8 = sub_8044DC8(item);
|
||||
if (val_sub8044DC8 != 0) {
|
||||
sub_8044F5C(val_sub8044DC8, item->id);
|
||||
if (item->flags & ITEM_FLAG_STICKY) {
|
||||
sub_8044FF0(val_sub8044DC8);
|
||||
}
|
||||
if (!sub_8046F00(item)) {
|
||||
sub_8044FF0(val_sub8044DC8);
|
||||
}
|
||||
}
|
||||
|
||||
if (gUnknown_202F238.actionUseIndex <= 20
|
||||
&& (GetItemCategory(item->id) == CATEGORY_THROWN_LINE || GetItemCategory(item->id) == CATEGORY_THROWN_ARC))
|
||||
{
|
||||
s32 i;
|
||||
|
||||
if (item->flags & ITEM_FLAG_SET) {
|
||||
sub_8044F5C(0x3D, item->id);
|
||||
}
|
||||
else {
|
||||
sub_8044F5C(0x3C, item->id);
|
||||
}
|
||||
|
||||
for (i = 0; i < INVENTORY_SIZE; i++) {
|
||||
// Compiler uses r5 without the fakematch trick. It's gTeamInventoryRef causing matching issues again...
|
||||
#ifndef NONMATCHING
|
||||
item++;item--;
|
||||
#endif // NONMATCHING
|
||||
if (gTeamInventoryRef->teamItems[i].flags & ITEM_FLAG_EXISTS
|
||||
&& gTeamInventoryRef->teamItems[i].flags & ITEM_FLAG_SET
|
||||
&& gTeamInventoryRef->teamItems[i].flags & ITEM_FLAG_STICKY)
|
||||
{
|
||||
sub_8044FF0(0x3C);
|
||||
sub_8044FF0(0x3D);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (gUnknown_202F238.actionUseIndex != 129) {
|
||||
if (gUnknown_202F238.actionUseIndex != 128) {
|
||||
s32 i;
|
||||
bool32 r8 = FALSE;
|
||||
|
||||
sub_8044F5C(0x36, item->id);
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
Entity *teamMon = gDungeon->teamPokemon[i];
|
||||
if (EntityExists(teamMon)) {
|
||||
EntityInfo *teamMonInfo = teamMon->info;
|
||||
teamMonInfo->unk157 = FALSE;
|
||||
if (!CannotUseItems(teamMon)) {
|
||||
r8 = TRUE;
|
||||
teamMonInfo->unk157 = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!r8) {
|
||||
sub_8044FF0(0x36);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gDungeon->unk65B) {
|
||||
if (gTeamInventoryRef->teamItems[INVENTORY_SIZE - 1].flags & ITEM_FLAG_EXISTS) {
|
||||
sub_8044F5C(0x3E, item->id);
|
||||
}
|
||||
else {
|
||||
sub_8044F5C(0x37, item->id);
|
||||
}
|
||||
|
||||
if (CannotUseItems(a0)) {
|
||||
sub_8044FF0(0x37);
|
||||
sub_8044FF0(0x3E);
|
||||
}
|
||||
}
|
||||
|
||||
if (gUnknown_202F238.actionUseIndex <= 20) {
|
||||
Entity *tileEntity = GetTile(a0->pos.x, a0->pos.y)->object;
|
||||
if (tileEntity == NULL) {
|
||||
sub_8044F5C(8, item->id);
|
||||
}
|
||||
else if (GetEntityType(tileEntity) == ENTITY_ITEM) {
|
||||
sub_8044F5C(0x3A, item->id);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetItemCategory(item->id) == CATEGORY_THROWN_LINE) {
|
||||
sub_8044F5C(0x27, item->id);
|
||||
}
|
||||
else if (GetItemCategory(item->id) == CATEGORY_THROWN_ARC) {
|
||||
sub_8044F5C(0x41, item->id);
|
||||
}
|
||||
else {
|
||||
sub_8044F5C(0xB, item->id);
|
||||
}
|
||||
|
||||
if (!ToolboxEnabled(a0Info)) {
|
||||
sub_8044FF0(0x27);
|
||||
sub_8044FF0(0x41);
|
||||
sub_8044FF0(0xB);
|
||||
}
|
||||
}
|
||||
else {
|
||||
s32 index = gUnknown_202F238.actionUseIndex - 144;
|
||||
Entity *teamMon = gDungeon->teamPokemon[index];
|
||||
if (EntityExists(teamMon)) {
|
||||
bool32 r5, r6, r4;
|
||||
EntityInfo *teamMonInfo = teamMon->info;
|
||||
|
||||
r5 = FALSE;
|
||||
if (CannotUseItems(teamMon))
|
||||
r6 = TRUE;
|
||||
else
|
||||
r6 = FALSE;
|
||||
|
||||
if (gTeamInventoryRef->teamItems[INVENTORY_SIZE - 1].flags & ITEM_FLAG_EXISTS)
|
||||
r4 = TRUE;
|
||||
else
|
||||
r4 = FALSE;
|
||||
|
||||
if (GetItemCategory(item->id) == CATEGORY_TMS_HMS) r5 = TRUE;
|
||||
if (GetItemCategory(item->id) == CATEGORY_ORBS) r5 = TRUE;
|
||||
|
||||
if (gDungeon->unk65B) {
|
||||
if (r4) {
|
||||
sub_8044F5C(0x3E, item->id);
|
||||
}
|
||||
else {
|
||||
sub_8044F5C(0x37, item->id);
|
||||
}
|
||||
|
||||
if (r6) {
|
||||
sub_8044FF0(0x37);
|
||||
sub_8044FF0(0x3E);
|
||||
}
|
||||
}
|
||||
|
||||
if (teamMonInfo->isTeamLeader) {
|
||||
val_sub8044DC8 = sub_8044DC8(item);
|
||||
if (val_sub8044DC8 != 0) {
|
||||
sub_8044F5C(val_sub8044DC8, item->id);
|
||||
if (item->flags & ITEM_FLAG_STICKY) {
|
||||
sub_8044FF0(val_sub8044DC8);
|
||||
}
|
||||
if (!sub_8046F00(item)) {
|
||||
sub_8044FF0(val_sub8044DC8);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
sub_8044F5C(0x38, item->id);
|
||||
if (r5) {
|
||||
sub_8044FF0(0x38);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub_8044F5C(0xC, item->id);
|
||||
sub_8045064();
|
||||
}
|
||||
|
||||
//*/
|
||||
void sub_8060CE8(ActionContainer *a0)
|
||||
{
|
||||
SetMonsterActionFields(a0, gUnknown_202EE44[gUnknown_202EE10.menuIndex].unk0);
|
||||
a0->unk4[0] = gUnknown_202F238;
|
||||
a0->unk4[1].actionUseIndex = 0;
|
||||
a0->unk4[1].lastItemThrowPosition.x = 0;
|
||||
a0->unk4[1].lastItemThrowPosition.y = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user