mirror of
https://github.com/pret/pmd-red.git
synced 2026-07-01 00:41:13 -05:00
continue decomping more funcs
This commit is contained in:
parent
12fd05a7d9
commit
d3cccf635b
|
|
@ -5,283 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8044CC8
|
||||
sub_8044CC8:
|
||||
push {lr}
|
||||
adds r3, r0, 0
|
||||
adds r2, r1, 0
|
||||
ldrb r1, [r2]
|
||||
subs r0, r1, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x13
|
||||
bhi _08044CEC
|
||||
ldr r0, _08044CE8
|
||||
ldrb r1, [r2]
|
||||
lsls r1, 2
|
||||
subs r1, 0x4
|
||||
ldr r0, [r0]
|
||||
adds r0, r1
|
||||
b _08044D34
|
||||
.align 2, 0
|
||||
_08044CE8: .4byte gTeamInventoryRef
|
||||
_08044CEC:
|
||||
adds r0, r1, 0
|
||||
cmp r0, 0x80
|
||||
bne _08044D06
|
||||
movs r1, 0x4
|
||||
ldrsh r0, [r2, r1]
|
||||
movs r3, 0x6
|
||||
ldrsh r1, [r2, r3]
|
||||
bl GetTile
|
||||
ldr r0, [r0, 0x14]
|
||||
bl GetItemData
|
||||
b _08044D34
|
||||
_08044D06:
|
||||
cmp r0, 0x81
|
||||
bne _08044D0E
|
||||
ldr r0, [r3, 0x70]
|
||||
b _08044D32
|
||||
_08044D0E:
|
||||
adds r0, r1, 0
|
||||
adds r0, 0x70
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x3
|
||||
bls _08044D1E
|
||||
movs r0, 0
|
||||
b _08044D34
|
||||
_08044D1E:
|
||||
ldr r0, _08044D38
|
||||
ldr r1, [r0]
|
||||
ldrb r0, [r2]
|
||||
subs r0, 0x90
|
||||
lsls r0, 2
|
||||
ldr r2, _08044D3C
|
||||
adds r1, r2
|
||||
adds r1, r0
|
||||
ldr r0, [r1]
|
||||
ldr r0, [r0, 0x70]
|
||||
_08044D32:
|
||||
adds r0, 0x60
|
||||
_08044D34:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_08044D38: .4byte gDungeon
|
||||
_08044D3C: .4byte 0x0001357c
|
||||
thumb_func_end sub_8044CC8
|
||||
|
||||
thumb_func_start sub_8044D40
|
||||
sub_8044D40:
|
||||
push {lr}
|
||||
lsls r1, 3
|
||||
adds r1, 0x4
|
||||
adds r2, r0, r1
|
||||
ldrb r1, [r2]
|
||||
subs r0, r1, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x13
|
||||
bhi _08044D74
|
||||
ldr r1, _08044D70
|
||||
ldrb r0, [r2]
|
||||
lsls r0, 2
|
||||
subs r0, 0x4
|
||||
ldr r1, [r1]
|
||||
adds r1, r0
|
||||
movs r0, 0
|
||||
strb r0, [r1, 0x2]
|
||||
strb r0, [r1, 0x1]
|
||||
strb r0, [r1]
|
||||
bl FillInventoryGaps
|
||||
b _08044D88
|
||||
.align 2, 0
|
||||
_08044D70: .4byte gTeamInventoryRef
|
||||
_08044D74:
|
||||
lsls r0, r1, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x80
|
||||
beq _08044D80
|
||||
movs r0, 0
|
||||
b _08044D8A
|
||||
_08044D80:
|
||||
adds r0, r2, 0x4
|
||||
movs r1, 0x1
|
||||
bl sub_80461C8
|
||||
_08044D88:
|
||||
movs r0, 0x1
|
||||
_08044D8A:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8044D40
|
||||
|
||||
thumb_func_start sub_8044D90
|
||||
sub_8044D90:
|
||||
push {lr}
|
||||
ldr r3, [r0, 0x70]
|
||||
lsls r1, 3
|
||||
adds r1, 0x48
|
||||
adds r3, r1
|
||||
adds r1, r3, 0
|
||||
bl sub_8044CC8
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8044D90
|
||||
|
||||
thumb_func_start sub_8044DA4
|
||||
sub_8044DA4:
|
||||
ldr r0, [r0, 0x70]
|
||||
ldr r2, _08044DC0
|
||||
ldr r2, [r2]
|
||||
lsls r1, 3
|
||||
adds r0, r1
|
||||
adds r0, 0x48
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 2
|
||||
ldr r1, _08044DC4
|
||||
adds r2, r1
|
||||
adds r2, r0
|
||||
ldr r0, [r2]
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_08044DC0: .4byte gDungeon
|
||||
_08044DC4: .4byte 0x0001357c
|
||||
thumb_func_end sub_8044DA4
|
||||
|
||||
thumb_func_start sub_8044DC8
|
||||
sub_8044DC8:
|
||||
push {r4,lr}
|
||||
adds r1, r0, 0
|
||||
ldrb r0, [r1, 0x2]
|
||||
cmp r0, 0xE9
|
||||
beq _08044DE8
|
||||
ldr r4, _08044DE4
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
lsrs r0, 23
|
||||
adds r0, r4
|
||||
ldrh r0, [r0]
|
||||
b _08044DEA
|
||||
.align 2, 0
|
||||
_08044DE4: .4byte gUnknown_80F6964
|
||||
_08044DE8:
|
||||
movs r0, 0x35
|
||||
_08044DEA:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8044DC8
|
||||
|
||||
thumb_func_start sub_8044DF0
|
||||
sub_8044DF0:
|
||||
push {r4,lr}
|
||||
ldr r4, [r0, 0x70]
|
||||
bl sub_8044D90
|
||||
adds r1, r0, 0
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x48
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x80
|
||||
bne _08044E10
|
||||
adds r0, r4, 0
|
||||
adds r0, 0x4C
|
||||
movs r1, 0x1
|
||||
bl sub_80461C8
|
||||
b _08044E1C
|
||||
_08044E10:
|
||||
movs r0, 0
|
||||
strb r0, [r1, 0x2]
|
||||
strb r0, [r1, 0x1]
|
||||
strb r0, [r1]
|
||||
bl FillInventoryGaps
|
||||
_08044E1C:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8044DF0
|
||||
|
||||
thumb_func_start sub_8044E24
|
||||
sub_8044E24:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
adds r4, r0, 0
|
||||
adds r6, r1, 0
|
||||
adds r7, r2, 0
|
||||
bl sub_8044D90
|
||||
adds r5, r0, 0
|
||||
ldr r0, [r4, 0x70]
|
||||
mov r8, r0
|
||||
ldrb r0, [r5, 0x2]
|
||||
bl IsHMItem
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08044EBA
|
||||
ldrb r0, [r5, 0x2]
|
||||
bl GetItemCategory
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x5
|
||||
bne _08044EB0
|
||||
lsls r1, r6, 3
|
||||
mov r2, r8
|
||||
adds r0, r2, r1
|
||||
adds r0, 0x48
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x80
|
||||
bne _08044EA4
|
||||
ldr r0, [r5]
|
||||
str r0, [sp]
|
||||
adds r4, r1, r2
|
||||
adds r4, 0x4C
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
bl sub_80461C8
|
||||
ldrb r1, [r5, 0x2]
|
||||
subs r1, 0x7D
|
||||
lsls r1, 24
|
||||
lsrs r1, 16
|
||||
ldr r2, _08044E9C
|
||||
ldr r0, [sp]
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
ldr r1, _08044EA0
|
||||
ands r0, r1
|
||||
movs r1, 0xF8
|
||||
lsls r1, 15
|
||||
orrs r0, r1
|
||||
str r0, [sp]
|
||||
adds r0, r4, 0
|
||||
mov r1, sp
|
||||
movs r2, 0x1
|
||||
bl sub_80460F8
|
||||
b _08044EBA
|
||||
.align 2, 0
|
||||
_08044E9C: .4byte 0xffff00ff
|
||||
_08044EA0: .4byte 0xff00ffff
|
||||
_08044EA4:
|
||||
ldrb r0, [r5, 0x2]
|
||||
subs r0, 0x7D
|
||||
strb r0, [r5, 0x1]
|
||||
movs r0, 0x7C
|
||||
strb r0, [r5, 0x2]
|
||||
b _08044EBA
|
||||
_08044EB0:
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
adds r2, r7, 0
|
||||
bl sub_8044DF0
|
||||
_08044EBA:
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8044E24
|
||||
|
||||
thumb_func_start sub_8044EC8
|
||||
sub_8044EC8:
|
||||
push {r4,r5,lr}
|
||||
|
|
|
|||
3951
asm/code_805D8C8.s
3951
asm/code_805D8C8.s
File diff suppressed because it is too large
Load Diff
3146
asm/code_8066D04.s
Normal file
3146
asm/code_8066D04.s
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -44,6 +44,7 @@ enum Action
|
|||
ACTION_UNSET_ITEM = 0x3D,
|
||||
ACTION_PICK_UP_AI = 0x3F,
|
||||
ACTION_THROW_ARC_PLAYER = 0x41, // Throwing Gravelerocks and Geo Pebbles.
|
||||
NUM_DUNGEON_ACTIONS
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@
|
|||
|
||||
bool8 TargetLeader(Entity *pokemon);
|
||||
Entity* GetLeaderIfVisible(Entity *pokemon);
|
||||
bool8 sub_8072CF4(Entity *entity);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,6 +23,12 @@
|
|||
#define STAT_STAGE_ACCURACY 0
|
||||
#define STAT_STAGE_EVASION 1
|
||||
|
||||
typedef struct unkStruct_8044CC8
|
||||
{
|
||||
u8 actionUseIndex;
|
||||
Position lastItemThrowPosition;
|
||||
} unkStruct_8044CC8;
|
||||
|
||||
// size: 0x18
|
||||
typedef struct ActionContainer
|
||||
{
|
||||
|
|
@ -30,12 +36,7 @@ typedef struct ActionContainer
|
|||
/* 0x2 */ u8 direction;
|
||||
u8 fill3;
|
||||
// Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset.
|
||||
/* 0x4 */ u8 actionUseIndex;
|
||||
// Position of the Pokémon the last time it threw an item.
|
||||
/* 0x8 */ Position lastItemThrowPosition;
|
||||
u8 unkC;
|
||||
u8 fillD[3];
|
||||
u8 fill10[4];
|
||||
/* 0x4 */ unkStruct_8044CC8 unk4[2];
|
||||
// Position of the target that the Pokémon wants throw an item at.
|
||||
/* 0x14 */ Position itemTargetPosition;
|
||||
} ActionContainer;
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ SECTIONS {
|
|||
src/dungeon_engine.o(.text);
|
||||
asm/code_8044210.o(.text);
|
||||
src/dungeon_action.o(.text);
|
||||
src/code_8044CC8.o(.text);
|
||||
asm/code_8044CC8.o(.text);
|
||||
src/dungeon_util.o(.text);
|
||||
asm/code_80450F8.o(.text);
|
||||
|
|
@ -226,6 +227,8 @@ SECTIONS {
|
|||
src/status_actions.o(.text);
|
||||
src/move_checks.o(.text);
|
||||
asm/code_805D8C8.o(.text);
|
||||
src/code_8066D04.o(.text);
|
||||
asm/code_8066D04.o(.text);
|
||||
src/code_805D8C8.o(.text);
|
||||
asm/code_805D8C8_1.o(.text);
|
||||
src/targeting.o(.text);
|
||||
|
|
|
|||
130
src/code_8044CC8.c
Normal file
130
src/code_8044CC8.c
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
#include "global.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "items.h"
|
||||
|
||||
extern u16 gUnknown_80F6964[];
|
||||
|
||||
bool8 sub_80461C8(Position *, u32);
|
||||
void sub_80460F8(Position *, Item *, u32);
|
||||
|
||||
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];
|
||||
}
|
||||
else if (param_2->actionUseIndex == 0x80) {
|
||||
tile = GetTile((param_2->lastItemThrowPosition).x,(param_2->lastItemThrowPosition).y);
|
||||
item = GetItemData(tile->object);
|
||||
}
|
||||
else {
|
||||
if (param_2->actionUseIndex == 0x81) {
|
||||
info = param_1->info;
|
||||
}
|
||||
else {
|
||||
if (3 < (u8)(param_2->actionUseIndex + 0x70)) {
|
||||
return NULL;
|
||||
}
|
||||
info = gDungeon->teamPokemon[param_2->actionUseIndex - 0x90]->info;
|
||||
}
|
||||
item = &info->heldItem;
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
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];
|
||||
item->id = ITEM_NOTHING;
|
||||
item->quantity = 0;
|
||||
item->flags = 0;
|
||||
FillInventoryGaps();
|
||||
}
|
||||
else {
|
||||
if (puVar1->actionUseIndex != 0x80) {
|
||||
return FALSE;
|
||||
}
|
||||
sub_80461C8(&puVar1->lastItemThrowPosition,1);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Item *sub_8044D90(Entity *entity, s32 index, s32 unused) {
|
||||
EntityInfo *info = entity->info;
|
||||
register unkStruct_8044CC8 *puVar1 asm("r3") = &info->action.unk4[index];
|
||||
return sub_8044CC8(entity, puVar1);
|
||||
}
|
||||
|
||||
Entity *sub_8044DA4(Entity *entity, s32 index)
|
||||
{
|
||||
EntityInfo *info = entity->info;
|
||||
return gDungeon->teamPokemon[info->action.unk4[index].actionUseIndex];
|
||||
}
|
||||
|
||||
u16 sub_8044DC8(u8 *param_1)
|
||||
{
|
||||
if (param_1[2] == ITEM_SWITCH_BOX) {
|
||||
return 0x35;
|
||||
}
|
||||
else {
|
||||
return gUnknown_80F6964[GetItemCategory(param_1[2])];
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
sub_80461C8(&(info->action).unk4[0].lastItemThrowPosition,1);
|
||||
}
|
||||
else {
|
||||
item->id = ITEM_NOTHING;
|
||||
item->quantity = 0;
|
||||
item->flags = 0;
|
||||
FillInventoryGaps();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sub_8044E24(Entity *entity,int index,u32 unused)
|
||||
{
|
||||
Item *itemPtr;
|
||||
EntityInfo *info;
|
||||
Position *pos;
|
||||
Item item;
|
||||
|
||||
itemPtr = sub_8044D90(entity,index,unused);
|
||||
info = entity->info;
|
||||
if (!IsHMItem(itemPtr->id)) {
|
||||
if (GetItemCategory(itemPtr->id) == CATEGORY_TMS_HMS) {
|
||||
if (info->action.unk4[index].actionUseIndex == 0x80) {
|
||||
item = *itemPtr;
|
||||
pos = &info->action.unk4[index].lastItemThrowPosition;
|
||||
sub_80461C8(pos,1);
|
||||
item.quantity = itemPtr->id - 125;
|
||||
item.id = ITEM_TM_USED_TM;
|
||||
sub_80460F8(pos,&item,1);
|
||||
}
|
||||
else {
|
||||
itemPtr->quantity = itemPtr->id - 125;
|
||||
itemPtr->id = ITEM_TM_USED_TM;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sub_8044DF0(entity,index,unused);
|
||||
}
|
||||
}
|
||||
}
|
||||
348
src/code_8066D04.c
Normal file
348
src/code_8066D04.c
Normal file
|
|
@ -0,0 +1,348 @@
|
|||
#include "global.h"
|
||||
#include "code_80521D0.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_music.h"
|
||||
#include "dungeon_movement.h"
|
||||
#include "items.h"
|
||||
|
||||
extern u8 gUnknown_202DE58[];
|
||||
extern u8 gUnknown_202DEA8[];
|
||||
extern u8 gAvailablePokemonNames[];
|
||||
extern u8 gUnknown_202DFE8[];
|
||||
|
||||
extern u8 *gUnknown_80F8BE0[];
|
||||
extern u8 *gUnknown_80F8D60[];
|
||||
extern u8 *gUnknown_80F8D7C[];
|
||||
extern u8 *gUnknown_80F8DB4[];
|
||||
extern u8 *gUnknown_80F8DE0[];
|
||||
extern u8 *gUnknown_80F8E04[];
|
||||
extern u8 *gUnknown_80F8E28[];
|
||||
extern u8 *gUnknown_80F8D44[];
|
||||
extern u8 *gUnknown_80F8C40[];
|
||||
extern u8 *gUnknown_80F8CA8[];
|
||||
extern u8 *gUnknown_80F8C44[];
|
||||
extern u8 *gUnknown_80F8C7C[];
|
||||
extern u8 *gUnknown_80F8D20[];
|
||||
|
||||
extern void SetMessageArgument(u8 *, Entity *, u32);
|
||||
extern Item *sub_8044D90(Entity *, s32, u32);
|
||||
void sub_8045BF8(u8 *, Item *);
|
||||
u8 sub_80460F8(Position *, Item *, u32);
|
||||
extern void sub_807AB38(Entity *, u32);
|
||||
extern Entity * sub_8044DA4(Entity *param_1,int param_2);
|
||||
extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3);
|
||||
extern void sub_806A6E8(Entity *);
|
||||
extern void sub_8044DF0(Entity *, u32, u32);
|
||||
extern void sub_8045DB4(Position *, u32);
|
||||
|
||||
extern u8 *gUnknown_80F8CE8[];
|
||||
extern u8 *gUnknown_80F8CE4[];
|
||||
extern u8 *gUnknown_80F8D04[];
|
||||
|
||||
void sub_8066744(Entity *entity)
|
||||
{
|
||||
entity->info->action.unk4[0].actionUseIndex = 1;
|
||||
sub_8045DB4(&entity->pos,0);
|
||||
}
|
||||
|
||||
void sub_806675C(Entity *param_1, bool8 param_2)
|
||||
{
|
||||
Item *item;
|
||||
Item *itemPtr;
|
||||
s32 index;
|
||||
|
||||
item = sub_8044D90(param_1,0,0xfe);
|
||||
for(index = 0; index < INVENTORY_SIZE; index++)
|
||||
{
|
||||
itemPtr = &gTeamInventoryRef->teamItems[index];
|
||||
if (((itemPtr->flags & ITEM_FLAG_EXISTS) != 0) && ((itemPtr->flags & ITEM_FLAG_SET) != 0)) {
|
||||
if ((itemPtr->flags & ITEM_FLAG_STICKY) != 0) {
|
||||
sub_8045BF8(gUnknown_202DE58,itemPtr);
|
||||
SendMessage(param_1,*gUnknown_80F8C7C);
|
||||
return;
|
||||
}
|
||||
itemPtr->flags &= ~(ITEM_FLAG_SET);
|
||||
}
|
||||
}
|
||||
sub_8045BF8(gUnknown_202DE58,item);
|
||||
PlaySoundEffect(0x133);
|
||||
if (param_2 != 0) {
|
||||
if ((item->flags & ITEM_FLAG_STICKY)) {
|
||||
SendMessage(param_1,*gUnknown_80F8D04);
|
||||
}
|
||||
else {
|
||||
if (GetItemCategory(item->id) == 0) {
|
||||
SendMessage(param_1,*gUnknown_80F8CE4);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage(param_1,*gUnknown_80F8CE8);
|
||||
}
|
||||
}
|
||||
}
|
||||
item->flags |= ITEM_FLAG_SET;
|
||||
if (((item->flags & ITEM_FLAG_STICKY)) && (param_2 != 0)) {
|
||||
sub_8045BF8(gUnknown_202DE58,item);
|
||||
SendMessage(param_1,*gUnknown_80F8BE0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sub_806684C(Entity *entity,bool8 enableMessage)
|
||||
{
|
||||
Item *item;
|
||||
int index;
|
||||
|
||||
for(index = 0; index < INVENTORY_SIZE; index++)
|
||||
{
|
||||
item = &gTeamInventoryRef->teamItems[index];
|
||||
if (((item->flags & ITEM_FLAG_EXISTS)) && ((item->flags & ITEM_FLAG_SET))) {
|
||||
if ((item->flags & ITEM_FLAG_STICKY)) {
|
||||
sub_8045BF8(gUnknown_202DE58,item);
|
||||
SendMessage(entity,*gUnknown_80F8C7C);
|
||||
return;
|
||||
}
|
||||
item->flags &= ~(ITEM_FLAG_SET);
|
||||
sub_8045BF8(gUnknown_202DE58,item);
|
||||
PlaySoundEffect(0x133);
|
||||
if (enableMessage) {
|
||||
SendMessage(entity,*gUnknown_80F8D20);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sub_80668D0(Entity *param_1)
|
||||
{
|
||||
Entity *entity;
|
||||
Item *item;
|
||||
EntityInfo *info1;
|
||||
EntityInfo *info2;
|
||||
bool8 bVar3;
|
||||
Item item1;
|
||||
Item item2;
|
||||
Item item3;
|
||||
|
||||
entity = sub_8044DA4(param_1,1);
|
||||
info1 = param_1->info;
|
||||
info2 = entity->info;
|
||||
item = sub_8044D90(param_1,0,2);
|
||||
|
||||
if((info1->action).unk4[0].actionUseIndex == 0x80)
|
||||
bVar3 = TRUE;
|
||||
else
|
||||
bVar3 = FALSE;
|
||||
|
||||
if ((!bVar3) && ((item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET))) {
|
||||
sub_8045BF8(gUnknown_202DEA8,item);
|
||||
SendMessage(param_1,*gUnknown_80F8C44);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMessageArgument(gUnknown_202DFE8,entity,0);
|
||||
if (((info2->heldItem).flags & ITEM_FLAG_EXISTS) != 0) {
|
||||
if (((info2->heldItem).flags & ITEM_FLAG_STICKY) != 0) {
|
||||
sub_8045BF8(gUnknown_202DEA8,&info2->heldItem);
|
||||
SendMessage(param_1,*gUnknown_80F8C40);
|
||||
return;
|
||||
}
|
||||
item1 = (info2->heldItem);
|
||||
item2 = *item;
|
||||
item1.flags &= ~(ITEM_FLAG_SET);
|
||||
item2.flags &= ~(ITEM_FLAG_SET);
|
||||
sub_8044DF0(param_1,0,100);
|
||||
if (bVar3) {
|
||||
sub_80460F8(¶m_1->pos,&item1,1);
|
||||
}
|
||||
else {
|
||||
AddItemToInventory(&item1);
|
||||
}
|
||||
info2->heldItem = item2;
|
||||
sub_8045BF8(gUnknown_202DE58,&item2);
|
||||
sub_8045BF8(gUnknown_202DE58 + 0x50,&item1);
|
||||
PlaySoundEffect(0x14d);
|
||||
SendMessage(param_1,*gUnknown_80F8CA8);
|
||||
if ((item2.flags & ITEM_FLAG_STICKY)) {
|
||||
SendMessage(param_1,*gUnknown_80F8BE0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
item3 = *item;
|
||||
item3.flags &= ~(ITEM_FLAG_SET);
|
||||
sub_8044DF0(param_1, 0, 101);
|
||||
info2->heldItem = item3;
|
||||
sub_8045BF8(gUnknown_202DE58,&item3);
|
||||
PlaySoundEffect(0x14d);
|
||||
SendMessage(param_1,*gUnknown_80F8D44);
|
||||
if ((item3.flags & ITEM_FLAG_STICKY)) {
|
||||
SendMessage(param_1,*gUnknown_80F8BE0);
|
||||
}
|
||||
}
|
||||
sub_806A6E8(entity);
|
||||
if (sub_80706A4(entity,&entity->pos) != 0) {
|
||||
sub_807D148(param_1,entity,0,0);
|
||||
}
|
||||
if (!info2->isTeamLeader) {
|
||||
info2->flags = info2->flags | 0x4000;
|
||||
}
|
||||
sub_807AB38(param_1,gDungeon->unk3A08);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sub_8066AC0(Entity *param_1)
|
||||
{
|
||||
Entity *entity;
|
||||
EntityInfo *info;
|
||||
EntityInfo *info2;
|
||||
Item *heldItem;
|
||||
Item item;
|
||||
|
||||
entity = sub_8044DA4(param_1,0);
|
||||
info = entity->info;
|
||||
info2 = entity->info;
|
||||
heldItem = &info->heldItem;
|
||||
if ((gTeamInventoryRef->teamItems[ITEM_POWER_BAND].flags & ITEM_FLAG_EXISTS)) {
|
||||
SendMessage(param_1,*gUnknown_80F8D60);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((heldItem->flags & ITEM_FLAG_STICKY)) {
|
||||
sub_8045BF8(gUnknown_202DE58,heldItem);
|
||||
SendMessage(param_1,*gUnknown_80F8BE0);
|
||||
}
|
||||
else
|
||||
{
|
||||
item = *heldItem;
|
||||
item.flags &= ~(ITEM_FLAG_SET);
|
||||
sub_8045BF8(gUnknown_202DE58,&item);
|
||||
SetMessageArgument(gAvailablePokemonNames,entity,0);
|
||||
heldItem->id = ITEM_NOTHING;
|
||||
heldItem->quantity = 0;
|
||||
heldItem->flags = 0;
|
||||
AddItemToInventory(&item);
|
||||
PlaySoundEffect(0x14d);
|
||||
SendMessage(param_1,*gUnknown_80F8D7C);
|
||||
sub_806A6E8(entity);
|
||||
if (sub_80706A4(entity,&entity->pos) != 0) {
|
||||
sub_807D148(param_1,entity,0,0);
|
||||
}
|
||||
if (!info2->isTeamLeader) {
|
||||
info2->flags = info2->flags | 0x4000;
|
||||
}
|
||||
sub_807AB38(param_1,gDungeon->unk3A08);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8066BD4(Entity *param_1)
|
||||
{
|
||||
Entity *entity;
|
||||
EntityInfo *info;
|
||||
EntityInfo *info2; // NOTE: needed two of these to match
|
||||
Item *item;
|
||||
Item *heldItem;
|
||||
Item temp;
|
||||
|
||||
entity = sub_8044DA4(param_1,0);
|
||||
info = entity->info;
|
||||
info2 = entity->info;
|
||||
heldItem = &info->heldItem;
|
||||
item = sub_8044D90(param_1,1,0x1565);
|
||||
if (heldItem->flags & ITEM_FLAG_STICKY)
|
||||
{
|
||||
sub_8045BF8(gUnknown_202DE58,heldItem);
|
||||
SendMessage(param_1,*gUnknown_80F8BE0);
|
||||
}
|
||||
else if ((item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) {
|
||||
sub_8045BF8(gUnknown_202DE58,item);
|
||||
SendMessage(param_1,*gUnknown_80F8BE0);
|
||||
}
|
||||
else
|
||||
{
|
||||
heldItem->flags &= ~(ITEM_FLAG_SET);
|
||||
item->flags &= ~(ITEM_FLAG_SET);
|
||||
sub_8045BF8(gUnknown_202DE58,heldItem);
|
||||
sub_8045BF8(gUnknown_202DE58 + 0x50,item);
|
||||
SetMessageArgument(gUnknown_202DFE8,entity,0);
|
||||
temp = info->heldItem;
|
||||
info->heldItem = *item;
|
||||
*item = temp;
|
||||
PlaySoundEffect(0x14d);
|
||||
SendMessage(param_1,*gUnknown_80F8DB4);
|
||||
if (sub_80706A4(entity,&entity->pos) != 0) {
|
||||
sub_807D148(param_1,entity,0,0);
|
||||
}
|
||||
if (!info2->isTeamLeader) {
|
||||
info2->flags = info2->flags | 0x4000;
|
||||
}
|
||||
sub_807AB38(param_1,gDungeon->unk3A08);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8066CF0(Entity *param_1)
|
||||
{
|
||||
Entity *entity;
|
||||
|
||||
entity = sub_8044DA4(param_1,0);
|
||||
entity->info->useHeldItem = TRUE;
|
||||
}
|
||||
|
||||
void sub_8066D04(Entity *param_1)
|
||||
{
|
||||
Item *item;
|
||||
Tile *tile;
|
||||
EntityInfo *info;
|
||||
register Entity *entity asm("r4");
|
||||
|
||||
entity = param_1;
|
||||
|
||||
info = entity->info;
|
||||
item = sub_8044D90(entity,0,4);
|
||||
sub_8045BF8(gUnknown_202DE58,item);
|
||||
if (info->action.unk4[0].actionUseIndex == 0x80) {
|
||||
SendMessage(entity,*gUnknown_80F8DE0);
|
||||
}
|
||||
else if ((info->action.unk4[0].actionUseIndex < 0x15) && ((item->flags & (ITEM_FLAG_STICKY | ITEM_FLAG_SET)) == (ITEM_FLAG_STICKY | ITEM_FLAG_SET))) {
|
||||
SendMessage(entity,*gUnknown_80F8BE0);
|
||||
}
|
||||
else if ((info->action.unk4[0].actionUseIndex == 0x81) && ((item->flags & ITEM_FLAG_STICKY))) {
|
||||
SendMessage(entity,*gUnknown_80F8BE0);
|
||||
}
|
||||
else {
|
||||
tile = GetTile(entity->pos.x, entity->pos.y);
|
||||
if ((tile->terrainType & 0x200) == 0)
|
||||
{
|
||||
if(((tile->terrainType & 3) == 1) &&
|
||||
(tile->object == NULL)) {
|
||||
item->flags &= ~(ITEM_FLAG_SET);
|
||||
sub_8045BF8(gUnknown_202DE58,item);
|
||||
if (sub_80460F8(&entity->pos,item,1) == 0) {
|
||||
_message:
|
||||
SendMessage(entity,*gUnknown_80F8E04);
|
||||
}
|
||||
else
|
||||
{
|
||||
item->id = ITEM_NOTHING;
|
||||
item->quantity = 0;
|
||||
item->flags = 0;
|
||||
FillInventoryGaps();
|
||||
PlaySoundEffect(0x14d);
|
||||
SetMessageArgument(gAvailablePokemonNames,entity,0);
|
||||
SendMessage(entity,*gUnknown_80F8E28);
|
||||
sub_807AB38(entity,gDungeon->unk3A08);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goto _message;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goto _message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#include "constants/ability.h"
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "dungeon_ai.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
#include "structs/dungeon_entity.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
#include "dungeon_leader.h"
|
||||
|
|
@ -37,7 +38,6 @@ extern void sub_8071B48(void);
|
|||
extern void TriggerWeatherAbilities(void);
|
||||
extern void sub_8074094(Entity *);
|
||||
extern void sub_8071DA4(Entity *);
|
||||
extern u8 sub_8072CF4(Entity *);
|
||||
extern void TickStatusHeal(Entity *);
|
||||
|
||||
void sub_8044820(void)
|
||||
|
|
@ -227,8 +227,8 @@ void sub_8044C10(u8 param_1)
|
|||
|
||||
if(param_1)
|
||||
{
|
||||
entityInfo->action.actionUseIndex = 0;
|
||||
entityInfo->action.unkC = 0;
|
||||
entityInfo->action.unk4[0].actionUseIndex = 0;
|
||||
entityInfo->action.unk4[1].actionUseIndex = 0;
|
||||
entityInfo->action.itemTargetPosition.x = -1;
|
||||
entityInfo->action.itemTargetPosition.y = -1;
|
||||
}
|
||||
|
|
@ -239,8 +239,9 @@ void sub_8044C50(u16 action)
|
|||
EntityInfo * entityInfo = GetLeaderInfo();
|
||||
|
||||
entityInfo->action.action = action;
|
||||
entityInfo->action.actionUseIndex = 0;
|
||||
entityInfo->action.unkC = 0;
|
||||
entityInfo->action.unk4[0].actionUseIndex = 0;
|
||||
entityInfo->action.unk4[1].actionUseIndex = 0;
|
||||
|
||||
entityInfo->action.itemTargetPosition.x = -1;
|
||||
entityInfo->action.itemTargetPosition.y = -1;
|
||||
}
|
||||
|
|
@ -248,15 +249,15 @@ void sub_8044C50(u16 action)
|
|||
void ClearMonsterActionFields(ActionContainer *actionPointer)
|
||||
{
|
||||
actionPointer->action = ACTION_NOTHING;
|
||||
actionPointer->actionUseIndex = 0;
|
||||
actionPointer->unkC = 0;
|
||||
actionPointer->unk4[0].actionUseIndex = 0;
|
||||
actionPointer->unk4[1].actionUseIndex = 0;
|
||||
}
|
||||
|
||||
void SetMonsterActionFields(ActionContainer *actionPointer, u16 action)
|
||||
{
|
||||
actionPointer->action = action;
|
||||
actionPointer->actionUseIndex = 0;
|
||||
actionPointer->unkC = 0;
|
||||
actionPointer->unk4[0].actionUseIndex = 0;
|
||||
actionPointer->unk4[1].actionUseIndex = 0;
|
||||
}
|
||||
|
||||
void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species)
|
||||
|
|
@ -269,6 +270,6 @@ void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species)
|
|||
{
|
||||
actionPointer->action = ACTION_PASS_TURN;
|
||||
}
|
||||
actionPointer->actionUseIndex = 0;
|
||||
actionPointer->unkC = 0;
|
||||
actionPointer->unk4[0].actionUseIndex = 0;
|
||||
actionPointer->unk4[1].actionUseIndex = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ void DecideAttack(Entity *pokemon)
|
|||
}
|
||||
}
|
||||
}
|
||||
pokemonInfo->action.actionUseIndex = chosenMoveIndex;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = chosenMoveIndex;
|
||||
TargetTileInFront(pokemon);
|
||||
return;
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ void DecideAttack(Entity *pokemon)
|
|||
}
|
||||
}
|
||||
pokemonInfo->action.direction = aiPossibleMove[i].direction & DIRECTION_MASK;
|
||||
pokemonInfo->action.actionUseIndex = chosenMoveIndex;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = chosenMoveIndex;
|
||||
TargetTileInFront(pokemon);
|
||||
}
|
||||
else
|
||||
|
|
@ -941,7 +941,7 @@ void sub_807CABC(Entity *target)
|
|||
if (counter >= sub_8070828(target, TRUE))
|
||||
break;
|
||||
entityInfo = target->info;
|
||||
sub_8055A00(target, entityInfo->action.actionUseIndex, 1, 0, 0);
|
||||
sub_8055A00(target, entityInfo->action.unk4[0].actionUseIndex, 1, 0, 0);
|
||||
if (!EntityExists(target))
|
||||
break;
|
||||
if (sub_8044B28())
|
||||
|
|
@ -953,7 +953,7 @@ void sub_807CABC(Entity *target)
|
|||
|
||||
sub_8057588(target, 1);
|
||||
if (EntityExists(target))
|
||||
sub_806A9B4(target, target->info->action.actionUseIndex);
|
||||
sub_806A9B4(target, target->info->action.unk4[0].actionUseIndex);
|
||||
|
||||
sub_806A1B0(target);
|
||||
}
|
||||
|
|
@ -1316,4 +1316,4 @@ void sub_807CB3C(Entity *pokemon)
|
|||
"\tpop {r0}\n"
|
||||
"\tbx r0");
|
||||
}
|
||||
#endif // NONMATCHING
|
||||
#endif // NONMATCHING
|
||||
|
|
|
|||
|
|
@ -94,9 +94,9 @@ void DecideUseItem(Entity *pokemon)
|
|||
if (DungeonRandOutcome(gPotentialItemTargetWeights[targetIndex]))
|
||||
{
|
||||
SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI);
|
||||
pokemonInfo->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.direction = gPotentialItemTargetDirections[targetIndex] & DIRECTION_MASK;
|
||||
break;
|
||||
}
|
||||
|
|
@ -118,9 +118,9 @@ void DecideUseItem(Entity *pokemon)
|
|||
{
|
||||
u32 chosenTargetIndex = DungeonRandInt(gNumPotentialTargets);
|
||||
SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI);
|
||||
pokemonInfo->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.direction = GetDirectionTowardsPosition(&pokemon->pos, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK;
|
||||
pokemonInfo->action.itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
|
||||
}
|
||||
|
|
@ -131,9 +131,9 @@ void DecideUseItem(Entity *pokemon)
|
|||
if (itemTypeCompare < CATEGORY_HELD_ITEMS - 2)
|
||||
{
|
||||
SetMonsterActionFields(&pokemonInfo->action, ACTION_EAT_AI);
|
||||
pokemonInfo->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -203,9 +203,9 @@ void DecideUseItem(Entity *pokemon)
|
|||
{
|
||||
SetMonsterActionFields(&pokemonInfo->action, ACTION_EAT_AI);
|
||||
}
|
||||
pokemonInfo->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -237,9 +237,9 @@ void DecideUseItem(Entity *pokemon)
|
|||
{
|
||||
u32 chosenTargetIndex = DungeonRandInt(gNumPotentialTargets);
|
||||
SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI);
|
||||
pokemonInfo->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.direction = GetDirectionTowardsPosition(&pokemon->pos, &potentialTargetPositions[chosenTargetIndex]) & DIRECTION_MASK;
|
||||
pokemonInfo->action.itemTargetPosition = potentialTargetPositions[chosenTargetIndex];
|
||||
return;
|
||||
|
|
@ -254,9 +254,9 @@ void DecideUseItem(Entity *pokemon)
|
|||
if (DungeonRandOutcome(potentialTargetWeights[targetIndex]))
|
||||
{
|
||||
SetMonsterActionFields(&pokemonInfo->action, ACTION_THROW_ITEM_AI);
|
||||
pokemonInfo->action.actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.unk4[0].actionUseIndex = selectedToolboxIndex;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.x = pokemon->pos.x;
|
||||
pokemonInfo->action.unk4[0].lastItemThrowPosition.y = pokemon->pos.y;
|
||||
pokemonInfo->action.direction = gPotentialItemTargetDirections[targetIndex] & DIRECTION_MASK;
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,13 @@
|
|||
#include "dungeon_ai_leader.h"
|
||||
|
||||
#include "constants/dungeon.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/iq_skill.h"
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/targeting.h"
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "code_80521D0.h"
|
||||
#include "dungeon_ai_targeting.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_leader.h"
|
||||
|
|
@ -18,31 +22,6 @@
|
|||
#include "pokemon_3.h"
|
||||
#include "code_8077274_1.h"
|
||||
|
||||
bool8 TargetLeader(Entity *pokemon)
|
||||
{
|
||||
if (pokemon->info->isNotTeamMember)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TacticsTargetLeader(pokemon->info->tactic);
|
||||
}
|
||||
|
||||
Entity* GetLeaderIfVisible(Entity *pokemon)
|
||||
{
|
||||
if (!pokemon->info->isNotTeamMember)
|
||||
{
|
||||
Entity *leader = GetLeader();
|
||||
if (leader &&
|
||||
leader->info->waitingStatus != STATUS_DECOY &&
|
||||
CanTarget(pokemon, leader, FALSE, FALSE) == TARGET_CAPABILITY_CANNOT_ATTACK &&
|
||||
CanTargetEntity(pokemon, leader))
|
||||
{
|
||||
return leader;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
extern u8 gUnknown_202F221;
|
||||
extern u8 gUnknown_202F32D;
|
||||
extern u8 gUnknown_202F222;
|
||||
|
|
@ -51,18 +30,14 @@ extern u8 *gUnknown_80FA5B4[];
|
|||
extern u8 gAvailablePokemonNames[];
|
||||
extern u8 *gUnknown_80FE478[];
|
||||
extern u8 *gUnknown_80FD2CC[];
|
||||
extern u8 gUnknown_80F58F4[0x42][2];
|
||||
extern u8 gUnknown_80F58F4[NUM_DUNGEON_ACTIONS][2];
|
||||
extern u8 gUnknown_203B434;
|
||||
extern u8 *gUnknown_80FE6D4[];
|
||||
|
||||
bool8 IsNotAttacking(Entity *, s32);
|
||||
void sub_805EFB4(Entity *, u8);
|
||||
void sub_8075BA4(Entity *param_1, u8 param_2);
|
||||
void sub_804178C(u8 param_1);
|
||||
void nullsub_95(Entity *);
|
||||
bool8 IsNotAttacking(Entity *, s32);
|
||||
void sub_8052740(u32);
|
||||
bool8 sub_804AE08(Position *pos);
|
||||
extern void sub_80671A0(Entity *);
|
||||
extern void sub_8067110(Entity *);
|
||||
void sub_807CABC(Entity *target);
|
||||
|
|
@ -99,7 +74,6 @@ void sub_806A1E8(Entity *pokemon);
|
|||
extern void sub_803E46C(u32);
|
||||
extern void sub_80694C0(Entity *, s32, s32, u32);
|
||||
bool8 sub_804AE08(Position *pos);
|
||||
void SendMessage(Entity *pokemon, const char message[]);
|
||||
void sub_8073D08(Entity *pokemon);
|
||||
void sub_8073CFC(Entity *pokemon);
|
||||
void sub_8073CF0(Entity *pokemon);
|
||||
|
|
@ -110,6 +84,31 @@ extern void sub_8071DA4(Entity *);
|
|||
extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3);
|
||||
u32 sub_8075818(Entity *entity);
|
||||
|
||||
bool8 TargetLeader(Entity *pokemon)
|
||||
{
|
||||
if (pokemon->info->isNotTeamMember)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
return TacticsTargetLeader(pokemon->info->tactic);
|
||||
}
|
||||
|
||||
Entity* GetLeaderIfVisible(Entity *pokemon)
|
||||
{
|
||||
if (!pokemon->info->isNotTeamMember)
|
||||
{
|
||||
Entity *leader = GetLeader();
|
||||
if (leader &&
|
||||
leader->info->waitingStatus != STATUS_DECOY &&
|
||||
CanTarget(pokemon, leader, FALSE, FALSE) == TARGET_CAPABILITY_CANNOT_ATTACK &&
|
||||
CanTargetEntity(pokemon, leader))
|
||||
{
|
||||
return leader;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool8 sub_8072CF4(Entity *entity)
|
||||
{
|
||||
bool8 bVar4;
|
||||
|
|
@ -124,7 +123,7 @@ bool8 sub_8072CF4(Entity *entity)
|
|||
sub_804178C(1);
|
||||
gUnknown_203B434 = 1;
|
||||
info = entity->info;
|
||||
info->useHeldItem = 0;
|
||||
info->useHeldItem = FALSE;
|
||||
info->fillF3 = 0;
|
||||
gDungeon->unkB8 = entity;
|
||||
if ((gUnknown_80F58F4)[(info->action).action][0] != 0) {
|
||||
|
|
@ -167,41 +166,41 @@ bool8 sub_8072CF4(Entity *entity)
|
|||
if (((ACTION_PASS_TURN < info->action.action) && (info->action.action != 4)) && (info->action.action != ACTION_WALK)) {
|
||||
info->attacking = TRUE;
|
||||
}
|
||||
bVar14 = 0;
|
||||
bVar14 = FALSE;
|
||||
info->unk14A = 0;
|
||||
gUnknown_202F221 = 0;
|
||||
gUnknown_202F222 = 0;
|
||||
switch(info->action.action) {
|
||||
case ACTION_WALK:
|
||||
if(info->immobilizeStatus == 2)
|
||||
if(info->immobilizeStatus == STATUS_SHADOW_HOLD)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->immobilizeStatus == 7)
|
||||
else if(info->immobilizeStatus == STATUS_CONSTRICTION)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->immobilizeStatus == 5)
|
||||
else if(info->immobilizeStatus == STATUS_INGRAIN)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->immobilizeStatus == 3)
|
||||
else if(info->immobilizeStatus == STATUS_WRAP)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->immobilizeStatus == 4)
|
||||
else if(info->immobilizeStatus == STATUS_WRAPPED)
|
||||
{
|
||||
_282:
|
||||
info->action.action = ACTION_NOTHING;
|
||||
info->waiting = TRUE;
|
||||
}
|
||||
else {
|
||||
bVar5 = 0;
|
||||
bVar5 = FALSE;
|
||||
pos1.x = (entity->pos).x + gAdjacentTileOffsets[(info->action).direction].x;
|
||||
pos1.y = (entity->pos).y + gAdjacentTileOffsets[(info->action).direction].y;
|
||||
if (((info->flags & 0x8000) == 0) &&
|
||||
(!CanMoveInDirection(entity,(info->action).direction))) {
|
||||
bVar5 = 1;
|
||||
bVar5 = TRUE;
|
||||
}
|
||||
if (bVar5) {
|
||||
info->action.action = ACTION_NOTHING;
|
||||
|
|
@ -212,13 +211,13 @@ bool8 sub_8072CF4(Entity *entity)
|
|||
{
|
||||
PStack_24.x = entity->pos.x;
|
||||
PStack_24.y = entity->pos.y;
|
||||
sub_80694C0(entity,pos1.x,pos1.y,'\0');
|
||||
sub_80694C0(entity,pos1.x,pos1.y,0);
|
||||
sub_8074FB0(entity,(info->action).direction,&PStack_24);
|
||||
if (((IQSkillIsEnabled(entity, 0xd)) && (info->transformStatus != 3)) &&
|
||||
(!HasHeldItem(entity,9))) {
|
||||
if (((IQSkillIsEnabled(entity, IQ_SUPER_MOBILE)) && (info->transformStatus != STATUS_MOBILE)) &&
|
||||
(!HasHeldItem(entity,ITEM_MOBILE_SCARF))) {
|
||||
sub_804AE08(&entity->pos);
|
||||
}
|
||||
bVar14 = 1;
|
||||
bVar14 = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -267,7 +266,7 @@ bool8 sub_8072CF4(Entity *entity)
|
|||
sub_806684C(entity,1);
|
||||
break;
|
||||
case 0x3b:
|
||||
gDungeon->unkBC = gDungeon->teamPokemon[(info->action).actionUseIndex];
|
||||
gDungeon->unkBC = gDungeon->teamPokemon[(info->action).unk4[0].actionUseIndex];
|
||||
break;
|
||||
case ACTION_PLACE_ITEM:
|
||||
sub_8066D04(entity);
|
||||
|
|
@ -296,10 +295,10 @@ bool8 sub_8072CF4(Entity *entity)
|
|||
sub_8067884(entity);
|
||||
break;
|
||||
case ACTION_STRUGGLE:
|
||||
sub_8067904(entity,0x160); // MOVE_STRUGGLE
|
||||
sub_8067904(entity, MOVE_STRUGGLE);
|
||||
break;
|
||||
case ACTION_REGULAR_ATTACK:
|
||||
sub_8067904(entity,0x163); // MOVE_REGULAR_ATTACK
|
||||
sub_8067904(entity, MOVE_REGULAR_ATTACK);
|
||||
break;
|
||||
case 0x25:
|
||||
sub_807FE9C(entity,&entity->pos,0,0);
|
||||
|
|
@ -331,15 +330,15 @@ bool8 sub_8072CF4(Entity *entity)
|
|||
if (EntityExists(entity)) {
|
||||
sub_8085140();
|
||||
if (info->unk14B != 0) {
|
||||
bVar4 = 0;
|
||||
bVar4 = FALSE;
|
||||
info->unk14B = 0;
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++)
|
||||
{
|
||||
move = &info->moves[index];
|
||||
if (((info->moves[index].moveFlags & MOVE_FLAG_EXISTS)) && ((move->moveFlags & 0x10) != 0)) {
|
||||
if ((info->moves[index].moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LAST_USED)) {
|
||||
move->PP = 0;
|
||||
bVar4 = 1;
|
||||
bVar4 = TRUE;
|
||||
}
|
||||
}
|
||||
if (bVar4) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "constants/dungeon.h"
|
||||
#include "structs/str_dungeon.h"
|
||||
#include "dungeon_ai.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_movement.h"
|
||||
#include "dungeon_util.h"
|
||||
|
|
@ -17,7 +18,6 @@ extern void sub_8044574(void);
|
|||
extern void sub_8044820(void);
|
||||
extern void sub_8044AB4(void);
|
||||
extern u8 UseAttack(u32);
|
||||
extern u8 sub_8072CF4(Entity *);
|
||||
extern void TickStatusHeal(Entity *);
|
||||
extern void sub_8086AC0(void);
|
||||
extern void sub_8043ED0(u32);
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ bool8 sub_80701A4(Entity *pokemon)
|
|||
(pokemonInfo->chargingStatusMoveIndex == index)) {
|
||||
SetMonsterActionFields(&pokemonInfo->action, ACTION_USE_MOVE_PLAYER);
|
||||
index_1 = index;
|
||||
r7 = &pokemonInfo->action.unkC;
|
||||
r7 = &pokemonInfo->action.unk4[1].actionUseIndex;
|
||||
if((index > 0) && (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))
|
||||
{
|
||||
do {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user