mirror of
https://github.com/pret/pmd-red.git
synced 2026-04-24 06:57:18 -05:00
sub_8067768
This commit is contained in:
parent
55f576b252
commit
1ce273c082
|
|
@ -6,332 +6,6 @@
|
|||
.text
|
||||
|
||||
|
||||
thumb_func_start HandleTalkFieldAction
|
||||
HandleTalkFieldAction:
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
bl sub_806773C
|
||||
adds r1, r0, 0
|
||||
movs r2, 0x1
|
||||
negs r2, r2
|
||||
adds r0, r4, 0
|
||||
bl sub_8067558
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end HandleTalkFieldAction
|
||||
|
||||
thumb_func_start sub_806752C
|
||||
sub_806752C:
|
||||
push {r4,lr}
|
||||
ldr r1, _08067550
|
||||
ldr r1, [r1]
|
||||
ldrb r0, [r0, 0x4]
|
||||
lsls r0, 2
|
||||
ldr r2, _08067554
|
||||
adds r1, r2
|
||||
adds r1, r0
|
||||
ldr r4, [r1]
|
||||
bl GetLeader
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl sub_8067558
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08067550: .4byte gDungeon
|
||||
_08067554: .4byte 0x0001357c
|
||||
thumb_func_end sub_806752C
|
||||
|
||||
thumb_func_start sub_8067558
|
||||
sub_8067558:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
sub sp, 0x12C
|
||||
adds r6, r0, 0
|
||||
adds r5, r1, 0
|
||||
mov r9, r2
|
||||
ldr r0, [r6, 0x70]
|
||||
mov r8, r0
|
||||
cmp r5, 0
|
||||
bne _0806757C
|
||||
ldr r0, _08067578
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
b _08067716
|
||||
.align 2, 0
|
||||
_08067578: .4byte gCannotTalk
|
||||
_0806757C:
|
||||
adds r0, r6, 0
|
||||
bl sub_8070BC0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08067594
|
||||
ldr r0, _08067590
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
b _08067716
|
||||
.align 2, 0
|
||||
_08067590: .4byte gCannotTalk
|
||||
_08067594:
|
||||
adds r0, r6, 0
|
||||
adds r1, r5, 0
|
||||
movs r2, 0x1
|
||||
movs r3, 0
|
||||
bl GetTreatmentBetweenMonsters
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _080675AA
|
||||
b _0806771E
|
||||
_080675AA:
|
||||
adds r0, r5, 0
|
||||
adds r1, r6, 0
|
||||
movs r2, 0x1
|
||||
movs r3, 0
|
||||
bl GetTreatmentBetweenMonsters
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _080675C0
|
||||
b _0806771E
|
||||
_080675C0:
|
||||
ldr r7, [r5, 0x70]
|
||||
ldr r4, _08067608
|
||||
adds r0, r4, 0
|
||||
adds r1, r7, 0
|
||||
movs r2, 0
|
||||
bl SetMessageArgument_2
|
||||
adds r4, 0x50
|
||||
adds r0, r4, 0
|
||||
mov r1, r8
|
||||
movs r2, 0x7
|
||||
bl SetMessageArgument_2
|
||||
bl sub_8084778
|
||||
adds r0, r6, 0
|
||||
adds r1, r5, 0
|
||||
bl TrySendImmobilizeSleepEndMsg
|
||||
adds r0, r5, 0
|
||||
bl sub_8070BC0
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08067600
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1
|
||||
bl CheckVariousStatuses2
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08067610
|
||||
_08067600:
|
||||
ldr r0, _0806760C
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
b _08067716
|
||||
.align 2, 0
|
||||
_08067608: .4byte gFormatBuffer_Monsters
|
||||
_0806760C: .4byte gUnknown_80FE008
|
||||
_08067610:
|
||||
adds r0, r6, 0x4
|
||||
adds r1, r5, 0x4
|
||||
bl GetDirectionTowardsPosition
|
||||
adds r1, r0, 0
|
||||
adds r0, r6, 0
|
||||
bl sub_806CEFC
|
||||
mov r1, r9
|
||||
cmp r1, 0
|
||||
blt _0806762E
|
||||
adds r0, r5, 0
|
||||
bl sub_806CEFC
|
||||
b _0806763C
|
||||
_0806762E:
|
||||
mov r0, r8
|
||||
adds r0, 0x46
|
||||
ldrb r1, [r0]
|
||||
adds r1, 0x4
|
||||
adds r0, r5, 0
|
||||
bl sub_806CEFC
|
||||
_0806763C:
|
||||
ldrb r0, [r7, 0x8]
|
||||
cmp r0, 0x1
|
||||
bne _08067648
|
||||
bl sub_807EF84
|
||||
b _0806772A
|
||||
_08067648:
|
||||
adds r0, r7, 0
|
||||
adds r0, 0xA4
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
bne _08067694
|
||||
ldr r0, _08067668
|
||||
ldr r1, [r0]
|
||||
ldr r2, _0806766C
|
||||
adds r0, r1, r2
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08067674
|
||||
ldr r0, _08067670
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
b _08067716
|
||||
.align 2, 0
|
||||
_08067668: .4byte gDungeon
|
||||
_0806766C: .4byte 0x0000066e
|
||||
_08067670: .4byte gUnknown_80FF674
|
||||
_08067674:
|
||||
ldr r3, _08067688
|
||||
adds r0, r1, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _0806768C
|
||||
adds r0, r5, 0
|
||||
bl sub_80845E0
|
||||
b _0806772A
|
||||
.align 2, 0
|
||||
_08067688: .4byte 0x00000677
|
||||
_0806768C:
|
||||
adds r0, r5, 0
|
||||
bl sub_8084448
|
||||
b _0806772A
|
||||
_08067694:
|
||||
movs r0, 0x4
|
||||
ldrsh r5, [r7, r0]
|
||||
movs r6, 0
|
||||
adds r0, r7, 0
|
||||
adds r0, 0x40
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x4A
|
||||
bne _080676AA
|
||||
movs r5, 0xD2
|
||||
lsls r5, 1
|
||||
b _080676CC
|
||||
_080676AA:
|
||||
cmp r0, 0x47
|
||||
bne _080676B8
|
||||
ldr r5, _080676B4
|
||||
b _080676CC
|
||||
.align 2, 0
|
||||
_080676B4: .4byte 0x000001a5
|
||||
_080676B8:
|
||||
cmp r0, 0x41
|
||||
bne _080676CC
|
||||
ldr r0, _080676E8
|
||||
ldr r0, [r0]
|
||||
ldr r1, _080676EC
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _080676CC
|
||||
movs r6, 0x1
|
||||
_080676CC:
|
||||
movs r3, 0x10
|
||||
ldrsh r2, [r7, r3]
|
||||
adds r0, r2, 0
|
||||
cmp r2, 0
|
||||
bge _080676D8
|
||||
adds r0, r2, 0x3
|
||||
_080676D8:
|
||||
movs r3, 0xE
|
||||
ldrsh r1, [r7, r3]
|
||||
asrs r0, 2
|
||||
cmp r1, r0
|
||||
bgt _080676F0
|
||||
movs r2, 0x2
|
||||
b _08067708
|
||||
.align 2, 0
|
||||
_080676E8: .4byte gDungeon
|
||||
_080676EC: .4byte 0x0000065c
|
||||
_080676F0:
|
||||
movs r0, 0xE
|
||||
ldrsh r4, [r7, r0]
|
||||
lsls r0, r2, 1
|
||||
adds r0, r2
|
||||
lsls r0, 1
|
||||
movs r1, 0xA
|
||||
bl __divsi3
|
||||
movs r2, 0
|
||||
cmp r4, r0
|
||||
bgt _08067708
|
||||
movs r2, 0x1
|
||||
_08067708:
|
||||
mov r0, sp
|
||||
adds r1, r5, 0
|
||||
adds r3, r6, 0
|
||||
bl sub_806A3D4
|
||||
movs r0, 0
|
||||
mov r1, sp
|
||||
_08067716:
|
||||
movs r2, 0x1
|
||||
bl DisplayDungeonMessage
|
||||
b _0806772A
|
||||
_0806771E:
|
||||
ldr r0, _08067738
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl DisplayDungeonMessage
|
||||
_0806772A:
|
||||
add sp, 0x12C
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_08067738: .4byte gCannotTalk
|
||||
thumb_func_end sub_8067558
|
||||
|
||||
thumb_func_start sub_806773C
|
||||
sub_806773C:
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
bl sub_80696A8
|
||||
adds r4, r0, 0
|
||||
cmp r4, 0
|
||||
beq _08067760
|
||||
adds r0, r4, 0
|
||||
bl GetEntityType
|
||||
cmp r0, 0x1
|
||||
bne _08067760
|
||||
ldr r0, [r5, 0x70]
|
||||
ldrb r0, [r0, 0x6]
|
||||
cmp r0, 0
|
||||
bne _08067760
|
||||
adds r0, r4, 0
|
||||
b _08067762
|
||||
_08067760:
|
||||
movs r0, 0
|
||||
_08067762:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_806773C
|
||||
|
||||
thumb_func_start sub_8067768
|
||||
sub_8067768:
|
||||
push {r4,lr}
|
||||
ldr r1, _0806778C
|
||||
ldr r1, [r1]
|
||||
ldrb r0, [r0, 0x4]
|
||||
lsls r0, 2
|
||||
ldr r2, _08067790
|
||||
adds r1, r2
|
||||
adds r1, r0
|
||||
ldr r4, [r1]
|
||||
bl GetLeader
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl sub_8067794
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0806778C: .4byte gDungeon
|
||||
_08067790: .4byte 0x0001357c
|
||||
thumb_func_end sub_8067768
|
||||
|
||||
thumb_func_start sub_8067794
|
||||
sub_8067794:
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ typedef struct unkDungeon644
|
|||
/* 0x30 */ u8 unk30;
|
||||
/* 0x31 */ u8 unk31;
|
||||
/* 0x32 */ bool8 itemHoldersIdentified;
|
||||
/* 0x33 */ u8 fill33;
|
||||
/* 0x33 */ u8 unk33;
|
||||
/* 0x34 */ u8 unk34;
|
||||
/* 0x35 */ u8 unk35;
|
||||
/* 0x36 */ u8 unk36;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ void sub_806752C(ActionContainer *a0);
|
|||
bool8 sub_8061A38(ActionContainer *a0, bool8 a1);
|
||||
void sub_8063A70(ActionContainer *a0, bool8 a1);
|
||||
void sub_8063CF0(ActionContainer *a0, bool8 a1);
|
||||
void sub_8067768(UNUSED ActionContainer *a0);
|
||||
void sub_8067768(ActionContainer *a0);
|
||||
void ShowTacticsMenu(ActionContainer *a0);
|
||||
void sub_804A728(DungeonPos *pos, s32 a1, u8 a2, u8 a3);
|
||||
extern bool8 sub_8071A8C(Entity *pokemon);
|
||||
|
|
|
|||
|
|
@ -7,14 +7,20 @@
|
|||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_movement.h"
|
||||
#include "dungeon_music.h"
|
||||
#include "position_util.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "items.h"
|
||||
#include "string_format.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "status_checks_1.h"
|
||||
#include "dungeon_ai_targeting.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_8084778.h"
|
||||
#include "dungeon_capabilities.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/dungeon.h"
|
||||
|
||||
extern u8 *gUnknown_80F8BE0[];
|
||||
extern u8 *gUnknown_80FF76C[];
|
||||
|
|
@ -40,6 +46,9 @@ extern u8 *gNoExchangesHere[];
|
|||
extern u8 *gSwappedGroundItem[];
|
||||
extern const u8 *const gMonThrewItem2;
|
||||
extern const u8 *const gMonThrewItem1;
|
||||
extern const u8 *const gCannotTalk;
|
||||
extern const u8 *const gUnknown_80FE008;
|
||||
extern const u8 *const gUnknown_80FF674;
|
||||
|
||||
extern void sub_8045C08(u8 *buffer, Item *item);
|
||||
extern bool8 sub_8045888(Entity *);
|
||||
|
|
@ -607,3 +616,122 @@ void sub_80671A0(Entity *entity)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Entity *sub_806773C(Entity *entity);
|
||||
void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2);
|
||||
void sub_8067794(Entity *entity, Entity *targetEntity, s32 a2);
|
||||
extern void sub_807EF84(void);
|
||||
extern void sub_80845E0(Entity *entity);
|
||||
extern void sub_8084448(Entity *entity);
|
||||
extern void sub_806A3D4(u8 *dst, s32 _a1, s32 id, bool32 _a3);
|
||||
extern Entity * sub_80696A8(Entity *target);
|
||||
|
||||
void HandleTalkFieldAction(Entity *entity)
|
||||
{
|
||||
sub_8067558(entity, sub_806773C(entity), -1);
|
||||
}
|
||||
|
||||
void sub_806752C(ActionContainer *a0)
|
||||
{
|
||||
Entity *targetEntity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex];
|
||||
sub_8067558(GetLeader(), targetEntity, 0);
|
||||
}
|
||||
|
||||
void sub_8067558(Entity *entity, Entity *targetEntity, s32 a2)
|
||||
{
|
||||
EntityInfo *info1 = GetEntInfo(entity);
|
||||
|
||||
if (targetEntity == NULL) {
|
||||
DisplayDungeonMessage(NULL, gCannotTalk, TRUE);
|
||||
}
|
||||
else if (!sub_8070BC0(entity)) {
|
||||
DisplayDungeonMessage(NULL, gCannotTalk, TRUE);
|
||||
}
|
||||
else if (GetTreatmentBetweenMonsters(entity, targetEntity, TRUE, FALSE) != 1
|
||||
&& GetTreatmentBetweenMonsters(targetEntity, entity, TRUE, FALSE) != 1)
|
||||
{
|
||||
EntityInfo *info2 = GetEntInfo(targetEntity);
|
||||
|
||||
SetMessageArgument_2(gFormatBuffer_Monsters[0], info2, 0);
|
||||
SetMessageArgument_2(gFormatBuffer_Monsters[1], info1, 7);
|
||||
sub_8084778();
|
||||
TrySendImmobilizeSleepEndMsg(entity, targetEntity);
|
||||
if (!sub_8070BC0(targetEntity) || CheckVariousStatuses2(targetEntity, TRUE)) {
|
||||
DisplayDungeonMessage(NULL, gUnknown_80FE008, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
sub_806CEFC(entity, GetDirectionTowardsPosition(&entity->pos, &targetEntity->pos));
|
||||
if (a2 >= 0) {
|
||||
sub_806CEFC(targetEntity, a2);
|
||||
}
|
||||
else {
|
||||
sub_806CEFC(targetEntity, info1->action.direction + 4);
|
||||
}
|
||||
|
||||
if (info2->shopkeeper == SHOPKEEPER_MODE_SHOPKEEPER) {
|
||||
sub_807EF84();
|
||||
return;
|
||||
}
|
||||
|
||||
if (info2->monsterBehavior == 1) {
|
||||
if (gDungeon->unk644.unk2A != 0) {
|
||||
DisplayDungeonMessage(NULL, gUnknown_80FF674, TRUE);
|
||||
}
|
||||
else if (gDungeon->unk644.unk33) {
|
||||
sub_80845E0(targetEntity);
|
||||
}
|
||||
else {
|
||||
sub_8084448(targetEntity);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u8 txt[300];
|
||||
s32 r2;
|
||||
s32 speciesId = info2->apparentID;
|
||||
bool8 r6 = FALSE;
|
||||
|
||||
if (info2->joinedAt.id == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) {
|
||||
speciesId = MONSTER_MUNCHLAX;
|
||||
}
|
||||
else if (info2->joinedAt.id == DUNGEON_RESCUE_TEAM_BASE) {
|
||||
speciesId = MONSTER_DECOY;
|
||||
}
|
||||
else if (info2->joinedAt.id == DUNGEON_JOIN_LOCATION_PARTNER && !gDungeon->unk644.unk18) {
|
||||
r6 = TRUE;
|
||||
}
|
||||
|
||||
if (info2->HP <= info2->maxHPStat / 4) {
|
||||
r2 = 2;
|
||||
}
|
||||
else if (info2->HP <= (info2->maxHPStat * 6) / 10) {
|
||||
r2 = 1;
|
||||
}
|
||||
else {
|
||||
r2 = 0;
|
||||
}
|
||||
|
||||
sub_806A3D4(txt, speciesId, r2, r6);
|
||||
DisplayDungeonMessage(NULL, txt, TRUE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
DisplayDungeonMessage(NULL, gCannotTalk, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
Entity *sub_806773C(Entity *entity)
|
||||
{
|
||||
Entity *ret = sub_80696A8(entity);
|
||||
if (ret == NULL) return NULL;
|
||||
if (GetEntityType(ret) != ENTITY_MONSTER) return NULL;
|
||||
if (GetEntInfo(entity)->isNotTeamMember) return NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sub_8067768(ActionContainer *a0)
|
||||
{
|
||||
Entity *targetEntity = gDungeon->teamPokemon[a0->actionParameters[0].actionUseIndex];
|
||||
sub_8067794(GetLeader(), targetEntity, 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user