mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-23 09:14:55 -05:00
splt code_807 files
This commit is contained in:
@@ -1,441 +0,0 @@
|
||||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8072778
|
||||
sub_8072778:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0xD0
|
||||
mov r9, r1
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
str r2, [sp, 0xC4]
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
str r3, [sp, 0xC8]
|
||||
ldr r0, [r1, 0x70]
|
||||
mov r8, r0
|
||||
movs r1, 0
|
||||
str r1, [sp, 0xCC]
|
||||
ldrb r0, [r0, 0x6]
|
||||
cmp r0, 0
|
||||
beq _080727A8
|
||||
movs r2, 0
|
||||
str r2, [sp, 0xC8]
|
||||
movs r4, 0
|
||||
str r4, [sp, 0xC4]
|
||||
_080727A8:
|
||||
mov r0, r8
|
||||
movs r2, 0x2
|
||||
ldrsh r1, [r0, r2]
|
||||
ldrb r2, [r0, 0x9]
|
||||
movs r4, 0xC
|
||||
ldrsh r3, [r0, r4]
|
||||
mov r0, sp
|
||||
bl GetMovesLearnedAtLevel
|
||||
adds r7, r0, 0
|
||||
add r4, sp, 0x20
|
||||
movs r1, 0x8C
|
||||
lsls r1, 1
|
||||
add r1, r8
|
||||
adds r0, r4, 0
|
||||
bl unk_CopyMoves4To8AndClearFlag2Unk4
|
||||
mov r10, r4
|
||||
cmp r7, 0
|
||||
beq _08072810
|
||||
adds r0, r7, 0
|
||||
bl DungeonRandInt
|
||||
movs r2, 0
|
||||
lsls r0, 1
|
||||
mov r1, sp
|
||||
adds r6, r1, r0
|
||||
mov r5, sp
|
||||
adds r5, 0x21
|
||||
mov r3, r10
|
||||
_080727E4:
|
||||
lsls r0, r2, 3
|
||||
add r0, sp
|
||||
adds r0, 0x20
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08072806
|
||||
ldrh r1, [r6]
|
||||
adds r0, r3, 0
|
||||
bl InitPokemonMove
|
||||
ldrb r1, [r5]
|
||||
movs r0, 0x4
|
||||
orrs r0, r1
|
||||
strb r0, [r5]
|
||||
b _08072810
|
||||
_08072806:
|
||||
adds r5, 0x8
|
||||
adds r3, 0x8
|
||||
adds r2, 0x1
|
||||
cmp r2, 0x7
|
||||
ble _080727E4
|
||||
_08072810:
|
||||
movs r5, 0
|
||||
movs r4, 0x1
|
||||
_08072814:
|
||||
movs r7, 0
|
||||
movs r2, 0
|
||||
_08072818:
|
||||
lsls r0, r2, 3
|
||||
add r0, sp
|
||||
adds r0, 0x20
|
||||
ldrb r1, [r0]
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0807282A
|
||||
adds r7, 0x1
|
||||
_0807282A:
|
||||
adds r2, 0x1
|
||||
cmp r2, 0x7
|
||||
ble _08072818
|
||||
cmp r7, 0x4
|
||||
bgt _080728D4
|
||||
movs r3, 0
|
||||
movs r5, 0
|
||||
cmp r3, r7
|
||||
bge _0807287C
|
||||
movs r4, 0x8C
|
||||
lsls r4, 1
|
||||
add r4, r8
|
||||
mov r6, r10
|
||||
_08072844:
|
||||
lsls r0, r5, 3
|
||||
movs r2, 0x8C
|
||||
lsls r2, 1
|
||||
add r2, r8
|
||||
adds r2, r0
|
||||
ldr r0, [r6]
|
||||
ldr r1, [r6, 0x4]
|
||||
str r0, [r2]
|
||||
str r1, [r2, 0x4]
|
||||
ldrb r1, [r4, 0x1]
|
||||
movs r0, 0x4
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08072872
|
||||
movs r0, 0xFB
|
||||
ands r0, r1
|
||||
strb r0, [r4, 0x1]
|
||||
add r0, sp, 0x60
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl BufferMoveName
|
||||
movs r3, 0x1
|
||||
_08072872:
|
||||
adds r4, 0x8
|
||||
adds r6, 0x8
|
||||
adds r5, 0x1
|
||||
cmp r5, r7
|
||||
blt _08072844
|
||||
_0807287C:
|
||||
cmp r5, 0x3
|
||||
bgt _08072894
|
||||
movs r2, 0x8C
|
||||
lsls r2, 1
|
||||
movs r1, 0
|
||||
_08072886:
|
||||
lsls r0, r5, 3
|
||||
add r0, r8
|
||||
adds r0, r2
|
||||
strb r1, [r0]
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _08072886
|
||||
_08072894:
|
||||
cmp r3, 0
|
||||
beq _08072928
|
||||
ldr r2, [sp, 0xC4]
|
||||
cmp r2, 0
|
||||
beq _08072928
|
||||
ldr r0, _080728C8
|
||||
mov r1, r8
|
||||
movs r2, 0
|
||||
bl SetMessageArgument_2
|
||||
ldr r0, _080728CC
|
||||
add r1, sp, 0x60
|
||||
bl strcpy
|
||||
mov r0, r9
|
||||
movs r1, 0x9C
|
||||
lsls r1, 1
|
||||
bl sub_80421C0
|
||||
ldr r0, _080728D0
|
||||
ldr r1, [r0]
|
||||
mov r0, r9
|
||||
bl DisplayDungeonLoggableMessage
|
||||
b _08072928
|
||||
.align 2, 0
|
||||
_080728C8: .4byte gFormatBuffer_Monsters
|
||||
_080728CC: .4byte gFormatBuffer_Items
|
||||
_080728D0: .4byte gUnknown_80F9F04
|
||||
_080728D4:
|
||||
mov r1, r8
|
||||
ldrb r0, [r1, 0x6]
|
||||
cmp r0, 0
|
||||
bne _08072918
|
||||
ldr r2, [sp, 0xC8]
|
||||
cmp r2, 0
|
||||
beq _08072918
|
||||
ldr r0, [sp, 0xCC]
|
||||
cmp r0, 0
|
||||
bne _08072902
|
||||
ldr r1, [sp, 0xC4]
|
||||
cmp r1, 0
|
||||
beq _08072902
|
||||
movs r0, 0xA
|
||||
movs r1, 0x6
|
||||
bl sub_803E708
|
||||
ldr r0, _08072914
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl DisplayDungeonMessage
|
||||
_08072902:
|
||||
movs r2, 0x1
|
||||
str r2, [sp, 0xCC]
|
||||
mov r0, r9
|
||||
mov r1, r10
|
||||
movs r3, 0
|
||||
bl sub_8063E70
|
||||
b _08072920
|
||||
.align 2, 0
|
||||
_08072914: .4byte gUnknown_80F9FA4
|
||||
_08072918:
|
||||
mov r0, r9
|
||||
mov r1, r10
|
||||
bl sub_8072B24
|
||||
_08072920:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x1D
|
||||
bgt _08072928
|
||||
b _08072814
|
||||
_08072928:
|
||||
add sp, 0xD0
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8072778
|
||||
|
||||
thumb_func_start sub_8072938
|
||||
sub_8072938:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0xA4
|
||||
mov r9, r0
|
||||
lsls r1, 16
|
||||
lsrs r5, r1, 16
|
||||
ldr r0, [r0, 0x70]
|
||||
mov r8, r0
|
||||
movs r1, 0
|
||||
mov r10, r1
|
||||
movs r1, 0x8C
|
||||
lsls r1, 1
|
||||
add r1, r8
|
||||
mov r0, sp
|
||||
bl unk_CopyMoves4To8AndClearFlag2Unk4
|
||||
movs r3, 0
|
||||
mov r4, sp
|
||||
mov r2, sp
|
||||
_08072964:
|
||||
ldrb r1, [r4]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08072980
|
||||
adds r0, r2, 0
|
||||
adds r1, r5, 0
|
||||
bl InitPokemonMove
|
||||
ldrb r1, [r4, 0x1]
|
||||
movs r0, 0x4
|
||||
orrs r0, r1
|
||||
strb r0, [r4, 0x1]
|
||||
b _0807298A
|
||||
_08072980:
|
||||
adds r4, 0x8
|
||||
adds r2, 0x8
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x7
|
||||
ble _08072964
|
||||
_0807298A:
|
||||
movs r4, 0
|
||||
movs r5, 0x1
|
||||
_0807298E:
|
||||
movs r7, 0
|
||||
mov r2, sp
|
||||
movs r3, 0x7
|
||||
_08072994:
|
||||
ldrb r1, [r2]
|
||||
adds r0, r5, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080729A0
|
||||
adds r7, 0x1
|
||||
_080729A0:
|
||||
adds r2, 0x8
|
||||
subs r3, 0x1
|
||||
cmp r3, 0
|
||||
bge _08072994
|
||||
cmp r7, 0x4
|
||||
bgt _08072A50
|
||||
movs r5, 0
|
||||
cmp r5, r7
|
||||
bge _080729F4
|
||||
movs r4, 0x8C
|
||||
lsls r4, 1
|
||||
add r4, r8
|
||||
mov r6, sp
|
||||
_080729BA:
|
||||
lsls r0, r5, 3
|
||||
movs r2, 0x8C
|
||||
lsls r2, 1
|
||||
add r2, r8
|
||||
adds r2, r0
|
||||
ldr r0, [r6]
|
||||
ldr r1, [r6, 0x4]
|
||||
str r0, [r2]
|
||||
str r1, [r2, 0x4]
|
||||
ldrb r1, [r4, 0x1]
|
||||
movs r0, 0x4
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _080729EA
|
||||
movs r0, 0xFB
|
||||
ands r0, r1
|
||||
strb r0, [r4, 0x1]
|
||||
add r0, sp, 0x40
|
||||
adds r1, r4, 0
|
||||
movs r2, 0
|
||||
bl BufferMoveName
|
||||
movs r0, 0x1
|
||||
mov r10, r0
|
||||
_080729EA:
|
||||
adds r4, 0x8
|
||||
adds r6, 0x8
|
||||
adds r5, 0x1
|
||||
cmp r5, r7
|
||||
blt _080729BA
|
||||
_080729F4:
|
||||
cmp r5, 0x3
|
||||
bgt _08072A0C
|
||||
movs r2, 0x8C
|
||||
lsls r2, 1
|
||||
movs r1, 0
|
||||
_080729FE:
|
||||
lsls r0, r5, 3
|
||||
add r0, r8
|
||||
adds r0, r2
|
||||
strb r1, [r0]
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _080729FE
|
||||
_08072A0C:
|
||||
mov r1, r10
|
||||
cmp r1, 0
|
||||
beq _08072A92
|
||||
mov r1, r8
|
||||
ldrb r0, [r1, 0x6]
|
||||
cmp r0, 0
|
||||
bne _08072A8C
|
||||
ldr r0, _08072A44
|
||||
mov r1, r9
|
||||
movs r2, 0
|
||||
bl SubstitutePlaceholderStringTags
|
||||
ldr r0, _08072A48
|
||||
add r1, sp, 0x40
|
||||
bl strcpy
|
||||
mov r0, r9
|
||||
movs r1, 0x9C
|
||||
lsls r1, 1
|
||||
bl sub_80421C0
|
||||
ldr r0, _08072A4C
|
||||
ldr r1, [r0]
|
||||
mov r0, r9
|
||||
bl DisplayDungeonLoggableMessage
|
||||
b _08072A8C
|
||||
.align 2, 0
|
||||
_08072A44: .4byte gFormatBuffer_Monsters
|
||||
_08072A48: .4byte gFormatBuffer_Items
|
||||
_08072A4C: .4byte gUnknown_80F9F04
|
||||
_08072A50:
|
||||
movs r0, 0
|
||||
mov r10, r0
|
||||
mov r1, r8
|
||||
ldrb r0, [r1, 0x6]
|
||||
cmp r0, 0
|
||||
bne _08072A84
|
||||
ldr r0, _08072A80
|
||||
ldr r1, [r0]
|
||||
movs r0, 0
|
||||
movs r2, 0x1
|
||||
bl DisplayDungeonMessage
|
||||
mov r0, r9
|
||||
mov r1, sp
|
||||
movs r2, 0x1
|
||||
movs r3, 0x1
|
||||
bl sub_8063E70
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08072A84
|
||||
movs r0, 0
|
||||
b _08072AB0
|
||||
.align 2, 0
|
||||
_08072A80: .4byte gUnknown_80FDF40
|
||||
_08072A84:
|
||||
adds r4, 0x1
|
||||
cmp r4, 0x1D
|
||||
bgt _08072A8C
|
||||
b _0807298E
|
||||
_08072A8C:
|
||||
mov r0, r10
|
||||
cmp r0, 0
|
||||
bne _08072AAE
|
||||
_08072A92:
|
||||
mov r1, r8
|
||||
ldrb r0, [r1, 0x6]
|
||||
cmp r0, 0
|
||||
bne _08072AAE
|
||||
ldr r0, _08072AC0
|
||||
mov r1, r9
|
||||
movs r2, 0
|
||||
bl SubstitutePlaceholderStringTags
|
||||
ldr r0, _08072AC4
|
||||
ldr r1, [r0]
|
||||
mov r0, r9
|
||||
bl DisplayDungeonLoggableMessage
|
||||
_08072AAE:
|
||||
movs r0, 0x1
|
||||
_08072AB0:
|
||||
add sp, 0xA4
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_08072AC0: .4byte gFormatBuffer_Monsters
|
||||
_08072AC4: .4byte gUnknown_80F9F2C
|
||||
thumb_func_end sub_8072938
|
||||
|
||||
.align 2, 0
|
||||
@@ -243,10 +243,10 @@ SECTIONS {
|
||||
src/code_806FDF4.o(.text);
|
||||
src/status_checks.o(.text);
|
||||
src/dungeon_logic.o(.text);
|
||||
src/dungeon_8071B48.o(.text);
|
||||
src/code_80718D8.o(.text);
|
||||
asm/code_80718D8.o(.text);
|
||||
src/code_8072B78.o(.text);
|
||||
src/dungeon_ai_leader.o(.text);
|
||||
src/dungeon_8072CF4.o(.text);
|
||||
src/dungeon_ai_items.o(.text);
|
||||
src/code_8073CF0.o(.text);
|
||||
src/code_8075708.o(.text);
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
#include "code_805D8C8.h"
|
||||
#include "structs/str_806B7F8.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "moves.h"
|
||||
#include "pokemon_mid.h"
|
||||
#include "structs/dungeon_entity.h"
|
||||
#include "structs/map.h"
|
||||
#include "structs/str_pokemon.h"
|
||||
#include "structs/str_806B7F8.h"
|
||||
|
||||
EWRAM_DATA s32 gUnknown_202F31C[2] = {0, 0};
|
||||
EWRAM_DATA s32 gUnknown_202F324[2] = {0, 0};
|
||||
@@ -31,11 +38,16 @@ extern u8 *gUnknown_80F9E80[];
|
||||
extern u8 *gUnknown_80F9EC8[];
|
||||
extern u8 *gUnknown_80F9EEC[];
|
||||
extern u8 *gUnknown_80FCF18[];
|
||||
extern u8 *gUnknown_80FED68[];
|
||||
extern u8 *gUnknown_80FF730[];
|
||||
extern u8 gUnknown_8107010[8];
|
||||
extern u8 *gUnknown_8107018[3];
|
||||
extern u8 *gUnknown_80FE2EC[];
|
||||
|
||||
extern void ResetMonEntityData(EntityInfo *, u32);
|
||||
void sub_8069E0C(Entity *pokemon);
|
||||
void sub_8042A44(Entity *r0);
|
||||
void sub_8083D78(void);
|
||||
extern bool8 sub_803D930(u32);
|
||||
void sub_8083D58(void);
|
||||
void sub_8072778(Entity *, Entity *, u8, u8);
|
||||
bool8 sub_80725A4(Entity *, Entity *);
|
||||
@@ -44,111 +56,10 @@ bool8 sub_80723D0(Entity *, Entity *, u8, u8);
|
||||
void sub_807218C(Entity *);
|
||||
void sub_806A2BC(Entity *, u32);
|
||||
void sub_806A3D4(u8 *, s32, s32, s32);
|
||||
extern void sub_8042920(struct Entity *r0);
|
||||
extern s16 sub_803D970(u32);
|
||||
extern s32 sub_803DA20(s32 param_1);
|
||||
extern bool8 sub_806AA0C(s32, u32);
|
||||
extern bool8 sub_8083660(DungeonPos *param_1);
|
||||
|
||||
extern bool8 sub_803D930(u32);
|
||||
extern void sub_8072B78(Entity *pokemon, Entity *target, s16 id);
|
||||
|
||||
void sub_8071B48(void)
|
||||
{
|
||||
const Tile *tile;
|
||||
struct Entity *entity2;
|
||||
struct Entity *entity;
|
||||
int index;
|
||||
int index1;
|
||||
int counter;
|
||||
struct Entity *entityPtr;
|
||||
s32 level;
|
||||
struct Dungeon *dungeon; // feels like a hack
|
||||
struct unkStruct_806B7F8 local_2c;
|
||||
|
||||
entityPtr = NULL;
|
||||
dungeon = gDungeon;
|
||||
if ((dungeon->unk644.unk20 != 0) &&
|
||||
((dungeon->unk644.dungeonLocation.id != DUNGEON_METEOR_CAVE || (dungeon->unk37FD == 0)))) {
|
||||
dungeon->unk644.unk1E++;
|
||||
if (dungeon->unk644.unk2A == 0) {
|
||||
if ( dungeon->unk644.unk1E < gUnknown_80F4DAA) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( dungeon->unk644.unk1E < gUnknown_80F4DAC) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dungeon->unk644.unk1E > 900) {
|
||||
entity2 = dungeon->unk17B34;
|
||||
if ((EntityIsValid(entity2)) && (entity2->spawnGenID == dungeon->unk17B40)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity2,0);
|
||||
entityPtr = entity2;
|
||||
}
|
||||
}
|
||||
|
||||
dungeon->unk644.unk1E = 0;
|
||||
dungeon->unk17B34 = NULL;
|
||||
|
||||
counter = 0;
|
||||
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
|
||||
{
|
||||
entity = dungeon->wildPokemon[index];
|
||||
if ((EntityIsValid(entity)) &&
|
||||
(tile = GetTile((entity->pos).x, (entity->pos).y),
|
||||
(tile->terrainType & 0x100) == 0)) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (dungeon->unk644.unk2A == 0) {
|
||||
if (gDungeon->monsterHouseRoom == 0xff) {
|
||||
if (counter >= gUnknown_80F4DA6) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (counter >= gUnknown_80F4DA8) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (entityPtr != NULL) {
|
||||
DisplayDungeonLoggableMessageTrue(0,*gUnknown_80FED68);
|
||||
sub_8042920(entityPtr);
|
||||
}
|
||||
if (dungeon->unk644.unk2A != 0) {
|
||||
index1 = 0x17c;
|
||||
}
|
||||
else {
|
||||
index1 = sub_803D970(0);
|
||||
}
|
||||
|
||||
level = sub_803DA20(index1);
|
||||
if (level == 0) {
|
||||
level = 1;
|
||||
}
|
||||
if ((sub_806AA0C(index1, 0)) && (sub_8083660(&local_2c.pos))) {
|
||||
local_2c.species = index1;
|
||||
local_2c.level = level;
|
||||
local_2c.unk2 = 0;
|
||||
if(DungeonRandInt(100) < GetRandomMovementChance(gDungeon->unk644.dungeonLocation.id))
|
||||
{
|
||||
local_2c.unk4 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_2c.unk4 = 0;
|
||||
}
|
||||
local_2c.unk10 = 0;
|
||||
sub_806B7F8(&local_2c, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8071D4C(Entity *pokemon, Entity *target, s32 exp)
|
||||
{
|
||||
s32 newExp;
|
||||
@@ -656,3 +567,546 @@ bool8 sub_80725A4(Entity *pokemon, Entity *target)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// https://decomp.me/scratch/hOsTU
|
||||
NAKED
|
||||
void sub_8072778(Entity *a0, Entity *a1, u8 a2, u8 a3)
|
||||
{
|
||||
asm_unified(" push {r4-r7,lr}\n"
|
||||
" mov r7, r10\n"
|
||||
" mov r6, r9\n"
|
||||
" mov r5, r8\n"
|
||||
" push {r5-r7}\n"
|
||||
" sub sp, 0xD0\n"
|
||||
" mov r9, r1\n"
|
||||
" lsls r2, 24\n"
|
||||
" lsrs r2, 24\n"
|
||||
" str r2, [sp, 0xC4]\n"
|
||||
" lsls r3, 24\n"
|
||||
" lsrs r3, 24\n"
|
||||
" str r3, [sp, 0xC8]\n"
|
||||
" ldr r0, [r1, 0x70]\n"
|
||||
" mov r8, r0\n"
|
||||
" movs r1, 0\n"
|
||||
" str r1, [sp, 0xCC]\n"
|
||||
" ldrb r0, [r0, 0x6]\n"
|
||||
" cmp r0, 0\n"
|
||||
" beq _080727A8\n"
|
||||
" movs r2, 0\n"
|
||||
" str r2, [sp, 0xC8]\n"
|
||||
" movs r4, 0\n"
|
||||
" str r4, [sp, 0xC4]\n"
|
||||
"_080727A8:\n"
|
||||
" mov r0, r8\n"
|
||||
" movs r2, 0x2\n"
|
||||
" ldrsh r1, [r0, r2]\n"
|
||||
" ldrb r2, [r0, 0x9]\n"
|
||||
" movs r4, 0xC\n"
|
||||
" ldrsh r3, [r0, r4]\n"
|
||||
" mov r0, sp\n"
|
||||
" bl GetMovesLearnedAtLevel\n"
|
||||
" adds r7, r0, 0\n"
|
||||
" add r4, sp, 0x20\n"
|
||||
" movs r1, 0x8C\n"
|
||||
" lsls r1, 1\n"
|
||||
" add r1, r8\n"
|
||||
" adds r0, r4, 0\n"
|
||||
" bl unk_CopyMoves4To8AndClearFlag2Unk4\n"
|
||||
" mov r10, r4\n"
|
||||
" cmp r7, 0\n"
|
||||
" beq _08072810\n"
|
||||
" adds r0, r7, 0\n"
|
||||
" bl DungeonRandInt\n"
|
||||
" movs r2, 0\n"
|
||||
" lsls r0, 1\n"
|
||||
" mov r1, sp\n"
|
||||
" adds r6, r1, r0\n"
|
||||
" mov r5, sp\n"
|
||||
" adds r5, 0x21\n"
|
||||
" mov r3, r10\n"
|
||||
"_080727E4:\n"
|
||||
" lsls r0, r2, 3\n"
|
||||
" add r0, sp\n"
|
||||
" adds r0, 0x20\n"
|
||||
" ldrb r1, [r0]\n"
|
||||
" movs r0, 0x1\n"
|
||||
" ands r0, r1\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072806\n"
|
||||
" ldrh r1, [r6]\n"
|
||||
" adds r0, r3, 0\n"
|
||||
" bl InitPokemonMove\n"
|
||||
" ldrb r1, [r5]\n"
|
||||
" movs r0, 0x4\n"
|
||||
" orrs r0, r1\n"
|
||||
" strb r0, [r5]\n"
|
||||
" b _08072810\n"
|
||||
"_08072806:\n"
|
||||
" adds r5, 0x8\n"
|
||||
" adds r3, 0x8\n"
|
||||
" adds r2, 0x1\n"
|
||||
" cmp r2, 0x7\n"
|
||||
" ble _080727E4\n"
|
||||
"_08072810:\n"
|
||||
" movs r5, 0\n"
|
||||
" movs r4, 0x1\n"
|
||||
"_08072814:\n"
|
||||
" movs r7, 0\n"
|
||||
" movs r2, 0\n"
|
||||
"_08072818:\n"
|
||||
" lsls r0, r2, 3\n"
|
||||
" add r0, sp\n"
|
||||
" adds r0, 0x20\n"
|
||||
" ldrb r1, [r0]\n"
|
||||
" adds r0, r4, 0\n"
|
||||
" ands r0, r1\n"
|
||||
" cmp r0, 0\n"
|
||||
" beq _0807282A\n"
|
||||
" adds r7, 0x1\n"
|
||||
"_0807282A:\n"
|
||||
" adds r2, 0x1\n"
|
||||
" cmp r2, 0x7\n"
|
||||
" ble _08072818\n"
|
||||
" cmp r7, 0x4\n"
|
||||
" bgt _080728D4\n"
|
||||
" movs r3, 0\n"
|
||||
" movs r5, 0\n"
|
||||
" cmp r3, r7\n"
|
||||
" bge _0807287C\n"
|
||||
" movs r4, 0x8C\n"
|
||||
" lsls r4, 1\n"
|
||||
" add r4, r8\n"
|
||||
" mov r6, r10\n"
|
||||
"_08072844:\n"
|
||||
" lsls r0, r5, 3\n"
|
||||
" movs r2, 0x8C\n"
|
||||
" lsls r2, 1\n"
|
||||
" add r2, r8\n"
|
||||
" adds r2, r0\n"
|
||||
" ldr r0, [r6]\n"
|
||||
" ldr r1, [r6, 0x4]\n"
|
||||
" str r0, [r2]\n"
|
||||
" str r1, [r2, 0x4]\n"
|
||||
" ldrb r1, [r4, 0x1]\n"
|
||||
" movs r0, 0x4\n"
|
||||
" ands r0, r1\n"
|
||||
" cmp r0, 0\n"
|
||||
" beq _08072872\n"
|
||||
" movs r0, 0xFB\n"
|
||||
" ands r0, r1\n"
|
||||
" strb r0, [r4, 0x1]\n"
|
||||
" add r0, sp, 0x60\n"
|
||||
" adds r1, r4, 0\n"
|
||||
" movs r2, 0\n"
|
||||
" bl BufferMoveName\n"
|
||||
" movs r3, 0x1\n"
|
||||
"_08072872:\n"
|
||||
" adds r4, 0x8\n"
|
||||
" adds r6, 0x8\n"
|
||||
" adds r5, 0x1\n"
|
||||
" cmp r5, r7\n"
|
||||
" blt _08072844\n"
|
||||
"_0807287C:\n"
|
||||
" cmp r5, 0x3\n"
|
||||
" bgt _08072894\n"
|
||||
" movs r2, 0x8C\n"
|
||||
" lsls r2, 1\n"
|
||||
" movs r1, 0\n"
|
||||
"_08072886:\n"
|
||||
" lsls r0, r5, 3\n"
|
||||
" add r0, r8\n"
|
||||
" adds r0, r2\n"
|
||||
" strb r1, [r0]\n"
|
||||
" adds r5, 0x1\n"
|
||||
" cmp r5, 0x3\n"
|
||||
" ble _08072886\n"
|
||||
"_08072894:\n"
|
||||
" cmp r3, 0\n"
|
||||
" beq _08072928\n"
|
||||
" ldr r2, [sp, 0xC4]\n"
|
||||
" cmp r2, 0\n"
|
||||
" beq _08072928\n"
|
||||
" ldr r0, _080728C8\n"
|
||||
" mov r1, r8\n"
|
||||
" movs r2, 0\n"
|
||||
" bl SetMessageArgument_2\n"
|
||||
" ldr r0, _080728CC\n"
|
||||
" add r1, sp, 0x60\n"
|
||||
" bl strcpy\n"
|
||||
" mov r0, r9\n"
|
||||
" movs r1, 0x9C\n"
|
||||
" lsls r1, 1\n"
|
||||
" bl sub_80421C0\n"
|
||||
" ldr r0, _080728D0\n"
|
||||
" ldr r1, [r0]\n"
|
||||
" mov r0, r9\n"
|
||||
" bl DisplayDungeonLoggableMessage\n"
|
||||
" b _08072928\n"
|
||||
" .align 2, 0\n"
|
||||
"_080728C8: .4byte gFormatBuffer_Monsters\n"
|
||||
"_080728CC: .4byte gFormatBuffer_Items\n"
|
||||
"_080728D0: .4byte gUnknown_80F9F04\n"
|
||||
"_080728D4:\n"
|
||||
" mov r1, r8\n"
|
||||
" ldrb r0, [r1, 0x6]\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072918\n"
|
||||
" ldr r2, [sp, 0xC8]\n"
|
||||
" cmp r2, 0\n"
|
||||
" beq _08072918\n"
|
||||
" ldr r0, [sp, 0xCC]\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072902\n"
|
||||
" ldr r1, [sp, 0xC4]\n"
|
||||
" cmp r1, 0\n"
|
||||
" beq _08072902\n"
|
||||
" movs r0, 0xA\n"
|
||||
" movs r1, 0x6\n"
|
||||
" bl sub_803E708\n"
|
||||
" ldr r0, _08072914\n"
|
||||
" ldr r1, [r0]\n"
|
||||
" movs r0, 0\n"
|
||||
" movs r2, 0x1\n"
|
||||
" bl DisplayDungeonMessage\n"
|
||||
"_08072902:\n"
|
||||
" movs r2, 0x1\n"
|
||||
" str r2, [sp, 0xCC]\n"
|
||||
" mov r0, r9\n"
|
||||
" mov r1, r10\n"
|
||||
" movs r3, 0\n"
|
||||
" bl sub_8063E70\n"
|
||||
" b _08072920\n"
|
||||
" .align 2, 0\n"
|
||||
"_08072914: .4byte gUnknown_80F9FA4\n"
|
||||
"_08072918:\n"
|
||||
" mov r0, r9\n"
|
||||
" mov r1, r10\n"
|
||||
" bl sub_8072B24\n"
|
||||
"_08072920:\n"
|
||||
" adds r5, 0x1\n"
|
||||
" cmp r5, 0x1D\n"
|
||||
" bgt _08072928\n"
|
||||
" b _08072814\n"
|
||||
"_08072928:\n"
|
||||
" add sp, 0xD0\n"
|
||||
" pop {r3-r5}\n"
|
||||
" mov r8, r3\n"
|
||||
" mov r9, r4\n"
|
||||
" mov r10, r5\n"
|
||||
" pop {r4-r7}\n"
|
||||
" pop {r0}\n"
|
||||
" bx r0\n");
|
||||
}
|
||||
|
||||
// https://decomp.me/scratch/Sb2mo
|
||||
NAKED
|
||||
u8 sub_8072938(Entity * a0, u16 a1)
|
||||
{
|
||||
asm_unified(" push {r4-r7,lr}\n"
|
||||
" mov r7, r10\n"
|
||||
" mov r6, r9\n"
|
||||
" mov r5, r8\n"
|
||||
" push {r5-r7}\n"
|
||||
" sub sp, 0xA4\n"
|
||||
" mov r9, r0\n"
|
||||
" lsls r1, 16\n"
|
||||
" lsrs r5, r1, 16\n"
|
||||
" ldr r0, [r0, 0x70]\n"
|
||||
" mov r8, r0\n"
|
||||
" movs r1, 0\n"
|
||||
" mov r10, r1\n"
|
||||
" movs r1, 0x8C\n"
|
||||
" lsls r1, 1\n"
|
||||
" add r1, r8\n"
|
||||
" mov r0, sp\n"
|
||||
" bl unk_CopyMoves4To8AndClearFlag2Unk4\n"
|
||||
" movs r3, 0\n"
|
||||
" mov r4, sp\n"
|
||||
" mov r2, sp\n"
|
||||
"_08072964:\n"
|
||||
" ldrb r1, [r4]\n"
|
||||
" movs r0, 0x1\n"
|
||||
" ands r0, r1\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072980\n"
|
||||
" adds r0, r2, 0\n"
|
||||
" adds r1, r5, 0\n"
|
||||
" bl InitPokemonMove\n"
|
||||
" ldrb r1, [r4, 0x1]\n"
|
||||
" movs r0, 0x4\n"
|
||||
" orrs r0, r1\n"
|
||||
" strb r0, [r4, 0x1]\n"
|
||||
" b _0807298A\n"
|
||||
"_08072980:\n"
|
||||
" adds r4, 0x8\n"
|
||||
" adds r2, 0x8\n"
|
||||
" adds r3, 0x1\n"
|
||||
" cmp r3, 0x7\n"
|
||||
" ble _08072964\n"
|
||||
"_0807298A:\n"
|
||||
" movs r4, 0\n"
|
||||
" movs r5, 0x1\n"
|
||||
"_0807298E:\n"
|
||||
" movs r7, 0\n"
|
||||
" mov r2, sp\n"
|
||||
" movs r3, 0x7\n"
|
||||
"_08072994:\n"
|
||||
" ldrb r1, [r2]\n"
|
||||
" adds r0, r5, 0\n"
|
||||
" ands r0, r1\n"
|
||||
" cmp r0, 0\n"
|
||||
" beq _080729A0\n"
|
||||
" adds r7, 0x1\n"
|
||||
"_080729A0:\n"
|
||||
" adds r2, 0x8\n"
|
||||
" subs r3, 0x1\n"
|
||||
" cmp r3, 0\n"
|
||||
" bge _08072994\n"
|
||||
" cmp r7, 0x4\n"
|
||||
" bgt _08072A50\n"
|
||||
" movs r5, 0\n"
|
||||
" cmp r5, r7\n"
|
||||
" bge _080729F4\n"
|
||||
" movs r4, 0x8C\n"
|
||||
" lsls r4, 1\n"
|
||||
" add r4, r8\n"
|
||||
" mov r6, sp\n"
|
||||
"_080729BA:\n"
|
||||
" lsls r0, r5, 3\n"
|
||||
" movs r2, 0x8C\n"
|
||||
" lsls r2, 1\n"
|
||||
" add r2, r8\n"
|
||||
" adds r2, r0\n"
|
||||
" ldr r0, [r6]\n"
|
||||
" ldr r1, [r6, 0x4]\n"
|
||||
" str r0, [r2]\n"
|
||||
" str r1, [r2, 0x4]\n"
|
||||
" ldrb r1, [r4, 0x1]\n"
|
||||
" movs r0, 0x4\n"
|
||||
" ands r0, r1\n"
|
||||
" cmp r0, 0\n"
|
||||
" beq _080729EA\n"
|
||||
" movs r0, 0xFB\n"
|
||||
" ands r0, r1\n"
|
||||
" strb r0, [r4, 0x1]\n"
|
||||
" add r0, sp, 0x40\n"
|
||||
" adds r1, r4, 0\n"
|
||||
" movs r2, 0\n"
|
||||
" bl BufferMoveName\n"
|
||||
" movs r0, 0x1\n"
|
||||
" mov r10, r0\n"
|
||||
"_080729EA:\n"
|
||||
" adds r4, 0x8\n"
|
||||
" adds r6, 0x8\n"
|
||||
" adds r5, 0x1\n"
|
||||
" cmp r5, r7\n"
|
||||
" blt _080729BA\n"
|
||||
"_080729F4:\n"
|
||||
" cmp r5, 0x3\n"
|
||||
" bgt _08072A0C\n"
|
||||
" movs r2, 0x8C\n"
|
||||
" lsls r2, 1\n"
|
||||
" movs r1, 0\n"
|
||||
"_080729FE:\n"
|
||||
" lsls r0, r5, 3\n"
|
||||
" add r0, r8\n"
|
||||
" adds r0, r2\n"
|
||||
" strb r1, [r0]\n"
|
||||
" adds r5, 0x1\n"
|
||||
" cmp r5, 0x3\n"
|
||||
" ble _080729FE\n"
|
||||
"_08072A0C:\n"
|
||||
" mov r1, r10\n"
|
||||
" cmp r1, 0\n"
|
||||
" beq _08072A92\n"
|
||||
" mov r1, r8\n"
|
||||
" ldrb r0, [r1, 0x6]\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072A8C\n"
|
||||
" ldr r0, _08072A44\n"
|
||||
" mov r1, r9\n"
|
||||
" movs r2, 0\n"
|
||||
" bl SubstitutePlaceholderStringTags\n"
|
||||
" ldr r0, _08072A48\n"
|
||||
" add r1, sp, 0x40\n"
|
||||
" bl strcpy\n"
|
||||
" mov r0, r9\n"
|
||||
" movs r1, 0x9C\n"
|
||||
" lsls r1, 1\n"
|
||||
" bl sub_80421C0\n"
|
||||
" ldr r0, _08072A4C\n"
|
||||
" ldr r1, [r0]\n"
|
||||
" mov r0, r9\n"
|
||||
" bl DisplayDungeonLoggableMessage\n"
|
||||
" b _08072A8C\n"
|
||||
" .align 2, 0\n"
|
||||
"_08072A44: .4byte gFormatBuffer_Monsters\n"
|
||||
"_08072A48: .4byte gFormatBuffer_Items\n"
|
||||
"_08072A4C: .4byte gUnknown_80F9F04\n"
|
||||
"_08072A50:\n"
|
||||
" movs r0, 0\n"
|
||||
" mov r10, r0\n"
|
||||
" mov r1, r8\n"
|
||||
" ldrb r0, [r1, 0x6]\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072A84\n"
|
||||
" ldr r0, _08072A80\n"
|
||||
" ldr r1, [r0]\n"
|
||||
" movs r0, 0\n"
|
||||
" movs r2, 0x1\n"
|
||||
" bl DisplayDungeonMessage\n"
|
||||
" mov r0, r9\n"
|
||||
" mov r1, sp\n"
|
||||
" movs r2, 0x1\n"
|
||||
" movs r3, 0x1\n"
|
||||
" bl sub_8063E70\n"
|
||||
" lsls r0, 24\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072A84\n"
|
||||
" movs r0, 0\n"
|
||||
" b _08072AB0\n"
|
||||
" .align 2, 0\n"
|
||||
"_08072A80: .4byte gUnknown_80FDF40\n"
|
||||
"_08072A84:\n"
|
||||
" adds r4, 0x1\n"
|
||||
" cmp r4, 0x1D\n"
|
||||
" bgt _08072A8C\n"
|
||||
" b _0807298E\n"
|
||||
"_08072A8C:\n"
|
||||
" mov r0, r10\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072AAE\n"
|
||||
"_08072A92:\n"
|
||||
" mov r1, r8\n"
|
||||
" ldrb r0, [r1, 0x6]\n"
|
||||
" cmp r0, 0\n"
|
||||
" bne _08072AAE\n"
|
||||
" ldr r0, _08072AC0\n"
|
||||
" mov r1, r9\n"
|
||||
" movs r2, 0\n"
|
||||
" bl SubstitutePlaceholderStringTags\n"
|
||||
" ldr r0, _08072AC4\n"
|
||||
" ldr r1, [r0]\n"
|
||||
" mov r0, r9\n"
|
||||
" bl DisplayDungeonLoggableMessage\n"
|
||||
"_08072AAE:\n"
|
||||
" movs r0, 0x1\n"
|
||||
"_08072AB0:\n"
|
||||
" add sp, 0xA4\n"
|
||||
" pop {r3-r5}\n"
|
||||
" mov r8, r3\n"
|
||||
" mov r9, r4\n"
|
||||
" mov r10, r5\n"
|
||||
" pop {r4-r7}\n"
|
||||
" pop {r1}\n"
|
||||
" bx r1\n"
|
||||
" .align 2, 0\n"
|
||||
"_08072AC0: .4byte gFormatBuffer_Monsters\n"
|
||||
"_08072AC4: .4byte gUnknown_80F9F2C\n");
|
||||
}
|
||||
|
||||
void sub_8072AC8(s16 *param_1, s16 species, s32 param_3)
|
||||
{
|
||||
const u8 *levelUpMoves;
|
||||
s32 arrIndex;
|
||||
s32 counter;
|
||||
u16 moveIDs [2];
|
||||
s32 species_s32;
|
||||
s32 index;
|
||||
|
||||
species_s32 = species;
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++) {
|
||||
param_1[index] = MOVE_NOTHING;
|
||||
}
|
||||
|
||||
counter = 0;
|
||||
levelUpMoves = GetLevelUpMoves(species_s32);
|
||||
|
||||
while( 1 ) {
|
||||
if (*levelUpMoves == 0) {
|
||||
return;
|
||||
}
|
||||
levelUpMoves = DecompressMoveID(levelUpMoves,moveIDs);
|
||||
if (*levelUpMoves++ > param_3) break;
|
||||
if (counter == MAX_MON_MOVES) {
|
||||
arrIndex = DungeonRandInt(MAX_MON_MOVES);
|
||||
counter = MAX_MON_MOVES;
|
||||
}
|
||||
else {
|
||||
arrIndex = counter;
|
||||
counter++;
|
||||
}
|
||||
param_1[arrIndex] = moveIDs[0];
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8072B24(Entity *entity, Move *moves)
|
||||
{
|
||||
int index;
|
||||
int count;
|
||||
|
||||
count = 0;
|
||||
for(index = 0; index < 8; index++)
|
||||
{
|
||||
if (moves[index].moveFlags & MOVE_FLAG_EXISTS) {
|
||||
moves[index].moveFlags &= 0xfd;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
index = DungeonRandInt(count);
|
||||
for (; index < 7; index++) {
|
||||
moves[index] = moves[index + 1];
|
||||
}
|
||||
moves[7].moveFlags = 0;
|
||||
}
|
||||
|
||||
static inline void fu(EntityInfo *entityInfo, s16 id)
|
||||
{
|
||||
++id; --id;
|
||||
entityInfo->apparentID = id;
|
||||
entityInfo->id = id;
|
||||
}
|
||||
|
||||
void sub_8072B78(Entity *pokemon, Entity *target, s16 id)
|
||||
{
|
||||
OpenedFile *file;
|
||||
const Tile *tile;
|
||||
int index;
|
||||
s32 id_s32;
|
||||
EntityInfo *entityInfo;
|
||||
LevelData levelData;
|
||||
struct unkStruct_806B7F8 local_2c;
|
||||
|
||||
id_s32 = id;
|
||||
entityInfo = GetEntInfo(target);
|
||||
SetMessageArgument_2(gFormatBuffer_Monsters[0],entityInfo,0);
|
||||
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1],id_s32);
|
||||
file = GetSpriteData(id_s32);
|
||||
fu(entityInfo, id_s32);
|
||||
GetPokemonLevelData(&levelData,id_s32,entityInfo->level);
|
||||
entityInfo->exp = levelData.expRequired;
|
||||
target->axObj.spriteFile = file;
|
||||
ResetMonEntityData(entityInfo,0);
|
||||
sub_8069E0C(target);
|
||||
sub_806CCB4(target,7);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE2EC);
|
||||
sub_8042A44(target);
|
||||
sub_8083D78();
|
||||
if (id_s32 == MONSTER_NINJASK) {
|
||||
for (index = 0; index < 8; index++) {
|
||||
tile = GetTile(gAdjacentTileOffsets[index].x + target->pos.x,gAdjacentTileOffsets[index].y + target->pos.y);
|
||||
if (sub_807034C(MONSTER_SHEDINJA,tile) == 0) break;
|
||||
}
|
||||
if (sub_803D930(MONSTER_SHEDINJA)) {
|
||||
local_2c.species = MONSTER_SHEDINJA;
|
||||
local_2c.level = entityInfo->level;
|
||||
local_2c.unk2 = 0;
|
||||
local_2c.pos.x = gAdjacentTileOffsets[index].x + target->pos.x;
|
||||
local_2c.pos.y = gAdjacentTileOffsets[index].y + target->pos.y;
|
||||
local_2c.unk4 = 0;
|
||||
local_2c.unk10 = 0;
|
||||
sub_806B7F8(&local_2c, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "code_805D8C8.h"
|
||||
#include "code_806CD90.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_message.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "moves.h"
|
||||
#include "pokemon_mid.h"
|
||||
#include "structs/dungeon_entity.h"
|
||||
#include "structs/map.h"
|
||||
#include "structs/str_pokemon.h"
|
||||
#include "structs/str_806B7F8.h"
|
||||
#include "dungeon_logic.h"
|
||||
|
||||
extern u8 *gUnknown_80FE2EC[];
|
||||
|
||||
extern void ResetMonEntityData(EntityInfo *, u32);
|
||||
void sub_8069E0C(Entity *pokemon);
|
||||
void sub_8042A44(Entity *r0);
|
||||
void sub_8083D78(void);
|
||||
extern bool8 sub_803D930(u32);
|
||||
|
||||
void sub_8072AC8(s16 *param_1, s16 species, s32 param_3)
|
||||
{
|
||||
const u8 *levelUpMoves;
|
||||
s32 arrIndex;
|
||||
s32 counter;
|
||||
u16 moveIDs [2];
|
||||
s32 species_s32;
|
||||
s32 index;
|
||||
|
||||
species_s32 = species;
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++) {
|
||||
param_1[index] = MOVE_NOTHING;
|
||||
}
|
||||
|
||||
counter = 0;
|
||||
levelUpMoves = GetLevelUpMoves(species_s32);
|
||||
|
||||
while( 1 ) {
|
||||
if (*levelUpMoves == 0) {
|
||||
return;
|
||||
}
|
||||
levelUpMoves = DecompressMoveID(levelUpMoves,moveIDs);
|
||||
if (*levelUpMoves++ > param_3) break;
|
||||
if (counter == MAX_MON_MOVES) {
|
||||
arrIndex = DungeonRandInt(MAX_MON_MOVES);
|
||||
counter = MAX_MON_MOVES;
|
||||
}
|
||||
else {
|
||||
arrIndex = counter;
|
||||
counter++;
|
||||
}
|
||||
param_1[arrIndex] = moveIDs[0];
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8072B24(Entity *entity, Move *moves)
|
||||
{
|
||||
int index;
|
||||
int count;
|
||||
|
||||
count = 0;
|
||||
for(index = 0; index < 8; index++)
|
||||
{
|
||||
if (moves[index].moveFlags & MOVE_FLAG_EXISTS) {
|
||||
moves[index].moveFlags &= 0xfd;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
index = DungeonRandInt(count);
|
||||
for (; index < 7; index++) {
|
||||
moves[index] = moves[index + 1];
|
||||
}
|
||||
moves[7].moveFlags = 0;
|
||||
}
|
||||
|
||||
static inline void fu(EntityInfo *entityInfo, s16 id)
|
||||
{
|
||||
++id; --id;
|
||||
entityInfo->apparentID = id;
|
||||
entityInfo->id = id;
|
||||
}
|
||||
|
||||
void sub_8072B78(Entity *pokemon, Entity *target, s16 id)
|
||||
{
|
||||
OpenedFile *file;
|
||||
const Tile *tile;
|
||||
int index;
|
||||
s32 id_s32;
|
||||
EntityInfo *entityInfo;
|
||||
LevelData levelData;
|
||||
struct unkStruct_806B7F8 local_2c;
|
||||
|
||||
id_s32 = id;
|
||||
entityInfo = GetEntInfo(target);
|
||||
SetMessageArgument_2(gFormatBuffer_Monsters[0],entityInfo,0);
|
||||
CopyCyanMonsterNametoBuffer(gFormatBuffer_Monsters[1],id_s32);
|
||||
file = GetSpriteData(id_s32);
|
||||
fu(entityInfo, id_s32);
|
||||
GetPokemonLevelData(&levelData,id_s32,entityInfo->level);
|
||||
entityInfo->exp = levelData.expRequired;
|
||||
target->axObj.spriteFile = file;
|
||||
ResetMonEntityData(entityInfo,0);
|
||||
sub_8069E0C(target);
|
||||
sub_806CCB4(target,7);
|
||||
TryDisplayDungeonLoggableMessage3(pokemon,target,*gUnknown_80FE2EC);
|
||||
sub_8042A44(target);
|
||||
sub_8083D78();
|
||||
if (id_s32 == MONSTER_NINJASK) {
|
||||
for (index = 0; index < 8; index++) {
|
||||
tile = GetTile(gAdjacentTileOffsets[index].x + target->pos.x,gAdjacentTileOffsets[index].y + target->pos.y);
|
||||
if (sub_807034C(MONSTER_SHEDINJA,tile) == 0) break;
|
||||
}
|
||||
if (sub_803D930(MONSTER_SHEDINJA)) {
|
||||
local_2c.species = MONSTER_SHEDINJA;
|
||||
local_2c.level = entityInfo->level;
|
||||
local_2c.unk2 = 0;
|
||||
local_2c.pos.x = gAdjacentTileOffsets[index].x + target->pos.x;
|
||||
local_2c.pos.y = gAdjacentTileOffsets[index].y + target->pos.y;
|
||||
local_2c.unk4 = 0;
|
||||
local_2c.unk10 = 0;
|
||||
sub_806B7F8(&local_2c, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
src/dungeon_8071B48.c
Normal file
122
src/dungeon_8071B48.c
Normal file
@@ -0,0 +1,122 @@
|
||||
#include "global.h"
|
||||
#include "constants/tactic.h"
|
||||
#include "dungeon_config.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_message.h"
|
||||
#include "code_8041AD0.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "dungeon_map_access.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "dungeon.h"
|
||||
#include "pokemon_3.h"
|
||||
#include "code_805D8C8.h"
|
||||
#include "structs/str_806B7F8.h"
|
||||
#include "dungeon_logic.h"
|
||||
|
||||
extern u8 *gUnknown_80FED68[];
|
||||
|
||||
extern void sub_8042920(struct Entity *r0);
|
||||
extern s16 sub_803D970(u32);
|
||||
extern s32 sub_803DA20(s32 param_1);
|
||||
extern bool8 sub_806AA0C(s32, u32);
|
||||
extern bool8 sub_8083660(DungeonPos *param_1);
|
||||
|
||||
void sub_8071B48(void)
|
||||
{
|
||||
const Tile *tile;
|
||||
struct Entity *entity2;
|
||||
struct Entity *entity;
|
||||
int index;
|
||||
int index1;
|
||||
int counter;
|
||||
struct Entity *entityPtr;
|
||||
s32 level;
|
||||
struct Dungeon *dungeon; // feels like a hack
|
||||
struct unkStruct_806B7F8 local_2c;
|
||||
|
||||
entityPtr = NULL;
|
||||
dungeon = gDungeon;
|
||||
if ((dungeon->unk644.unk20 != 0) &&
|
||||
((dungeon->unk644.dungeonLocation.id != DUNGEON_METEOR_CAVE || (dungeon->unk37FD == 0)))) {
|
||||
dungeon->unk644.unk1E++;
|
||||
if (dungeon->unk644.unk2A == 0) {
|
||||
if ( dungeon->unk644.unk1E < gUnknown_80F4DAA) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( dungeon->unk644.unk1E < gUnknown_80F4DAC) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dungeon->unk644.unk1E > 900) {
|
||||
entity2 = dungeon->unk17B34;
|
||||
if ((EntityIsValid(entity2)) && (entity2->spawnGenID == dungeon->unk17B40)) {
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity2,0);
|
||||
entityPtr = entity2;
|
||||
}
|
||||
}
|
||||
|
||||
dungeon->unk644.unk1E = 0;
|
||||
dungeon->unk17B34 = NULL;
|
||||
|
||||
counter = 0;
|
||||
for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++)
|
||||
{
|
||||
entity = dungeon->wildPokemon[index];
|
||||
if ((EntityIsValid(entity)) &&
|
||||
(tile = GetTile((entity->pos).x, (entity->pos).y),
|
||||
(tile->terrainType & 0x100) == 0)) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
if (dungeon->unk644.unk2A == 0) {
|
||||
if (gDungeon->monsterHouseRoom == 0xff) {
|
||||
if (counter >= gUnknown_80F4DA6) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (counter >= gUnknown_80F4DA8) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (entityPtr != NULL) {
|
||||
DisplayDungeonLoggableMessageTrue(0,*gUnknown_80FED68);
|
||||
sub_8042920(entityPtr);
|
||||
}
|
||||
if (dungeon->unk644.unk2A != 0) {
|
||||
index1 = 0x17c;
|
||||
}
|
||||
else {
|
||||
index1 = sub_803D970(0);
|
||||
}
|
||||
|
||||
level = sub_803DA20(index1);
|
||||
if (level == 0) {
|
||||
level = 1;
|
||||
}
|
||||
if ((sub_806AA0C(index1, 0)) && (sub_8083660(&local_2c.pos))) {
|
||||
local_2c.species = index1;
|
||||
local_2c.level = level;
|
||||
local_2c.unk2 = 0;
|
||||
if(DungeonRandInt(100) < GetRandomMovementChance(gDungeon->unk644.dungeonLocation.id))
|
||||
{
|
||||
local_2c.unk4 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
local_2c.unk4 = 0;
|
||||
}
|
||||
local_2c.unk10 = 0;
|
||||
sub_806B7F8(&local_2c, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
506
src/dungeon_8072CF4.c
Normal file
506
src/dungeon_8072CF4.c
Normal file
@@ -0,0 +1,506 @@
|
||||
#include "global.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
#include "dungeon_move_util.h"
|
||||
#include "code_803E46C.h"
|
||||
#include "code_8041AD0.h"
|
||||
#include "code_804267C.h"
|
||||
#include "code_8066D04.h"
|
||||
#include "dungeon_message.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_807CD9C.h"
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "constants/iq_skill.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/targeting.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "move_util.h"
|
||||
#include "moves.h"
|
||||
#include "pokemon_3.h"
|
||||
#include "pokemon.h"
|
||||
#include "status.h"
|
||||
#include "trap.h"
|
||||
#include "dungeon_config.h"
|
||||
#include "dungeon_misc.h"
|
||||
|
||||
extern u8 gUnknown_202F221;
|
||||
extern u8 gUnknown_202F222;
|
||||
extern u8 gUnknown_202F32C;
|
||||
extern u8 gUnknown_202F32D;
|
||||
extern u8 gUnknown_203B434;
|
||||
|
||||
extern u8 *gUnknown_80FA5B4[];
|
||||
extern u8 *gUnknown_80FCF50[];
|
||||
extern u8 *gUnknown_80FCF38[];
|
||||
extern u8 *gUnknown_80FD2CC[];
|
||||
extern u8 *gUnknown_80FE478[];
|
||||
extern u8 *gUnknown_80FE6D4[];
|
||||
|
||||
void sub_8075BA4(Entity *param_1, u8 param_2);
|
||||
void sub_804178C(u8 param_1);
|
||||
void nullsub_95(Entity *);
|
||||
bool8 IsNotAttacking(Entity *, bool8);
|
||||
extern void sub_80671A0(Entity *);
|
||||
extern void sub_8067110(Entity *);
|
||||
void HandleUseMoveAIAction(Entity *target);
|
||||
void sub_8041888(u8 param_1);
|
||||
void sub_8085140(void);
|
||||
void sub_807360C(void);
|
||||
void sub_805EFB4(Entity *, u8);
|
||||
void sub_8074FB0(Entity *, u8, DungeonPos *);
|
||||
|
||||
void HandlePlaceItemAction(Entity *);
|
||||
void HandlePickUpPlayerAction(Entity *);
|
||||
void sub_8066E14(Entity * );
|
||||
void sub_807348C(void);
|
||||
void sub_80732F0(void);
|
||||
void sub_8066BD4(Entity*);
|
||||
void HandleTalkFieldAction(Entity *);
|
||||
void HandleUseMovePlayerAction(Entity *);
|
||||
void HandleUseOrbAction(Entity *);
|
||||
void sub_8067904(Entity *, u32);
|
||||
void HandleGiveItemAction(Entity *);
|
||||
void HandleTakeItemAction(Entity *);
|
||||
void HandleUseItemAction(Entity *);
|
||||
void sub_8066FA4(Entity *);
|
||||
void HandleUnsetItemAction(Entity *,bool8);
|
||||
extern u8 sub_8044B28(void);
|
||||
extern u8 UseAttack(Entity *);
|
||||
void sub_806A1E8(Entity *pokemon);
|
||||
bool8 sub_804AE08(DungeonPos *pos);
|
||||
void HandlePickUpAIAction(Entity *pokemon);
|
||||
void HandleThrowItemAIAction(Entity *pokemon);
|
||||
void HandleEatAIAction(Entity *pokemon);
|
||||
bool8 sub_8044B84(void);
|
||||
extern void sub_8074094(Entity *);
|
||||
extern void sub_8071DA4(Entity *);
|
||||
u32 sub_8075818(Entity *entity);
|
||||
extern void MarkLastUsedMonMove(Entity *entity, Move *move);
|
||||
bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move);
|
||||
extern void sub_80838EC(u8 *a);
|
||||
|
||||
bool8 sub_8072CF4(Entity *entity)
|
||||
{
|
||||
bool8 bVar4;
|
||||
bool8 bVar5;
|
||||
Move *move;
|
||||
s32 index;
|
||||
EntityInfo *info;
|
||||
bool8 bVar14;
|
||||
DungeonPos pos;
|
||||
DungeonPos pos1;
|
||||
|
||||
sub_804178C(1);
|
||||
gUnknown_203B434 = 1;
|
||||
info = GetEntInfo(entity);
|
||||
info->useHeldItem = FALSE;
|
||||
info->unkF3 = FALSE;
|
||||
gDungeon->unkB8 = entity;
|
||||
if (gUnknown_80F58F4[(info->action).action][0] != 0) {
|
||||
if (info->isTeamLeader) {
|
||||
sub_805EFB4(entity,gUnknown_80F58F4[(info->action).action][1]);
|
||||
}
|
||||
else {
|
||||
sub_8075BA4(entity,gUnknown_80F58F4[(info->action).action][1]);
|
||||
}
|
||||
}
|
||||
if ((CannotAttack(entity, FALSE)) && (IsChargingAnyTwoTurnMove(entity, TRUE))) {
|
||||
sub_8079764(entity);
|
||||
}
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++)
|
||||
{
|
||||
move = &info->moves.moves[index];
|
||||
if ((move->moveFlags & MOVE_FLAG_EXISTS)) {
|
||||
move->moveFlags2 &= ~(MOVE_FLAG2_UNK4);
|
||||
}
|
||||
}
|
||||
if (!IsNotAttacking(entity, FALSE)) {
|
||||
if (UseAttack(entity)) {
|
||||
if (sub_8044B28()) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!EntityIsValid(entity)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (gUnknown_202F32D != 0) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (!info->isTeamLeader) {
|
||||
sub_8052740(10);
|
||||
}
|
||||
sub_806A1E8(entity);
|
||||
DungeonRunFrameActions(10);
|
||||
}
|
||||
if (((ACTION_PASS_TURN < info->action.action) && (info->action.action != 4)) && (info->action.action != ACTION_WALK)) {
|
||||
info->attacking = TRUE;
|
||||
}
|
||||
bVar14 = FALSE;
|
||||
info->unk14A = 0;
|
||||
gUnknown_202F221 = 0;
|
||||
gUnknown_202F222 = 0;
|
||||
switch(info->action.action) {
|
||||
case ACTION_WALK:
|
||||
if(info->frozenClassStatus.status == STATUS_SHADOW_HOLD)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_CONSTRICTION)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_INGRAIN)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_WRAP)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_WRAPPED)
|
||||
{
|
||||
_282:
|
||||
info->action.action = ACTION_NOTHING;
|
||||
info->waiting = TRUE;
|
||||
}
|
||||
else {
|
||||
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 & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) &&
|
||||
(!CanMoveInDirection(entity,(info->action).direction))) {
|
||||
bVar5 = TRUE;
|
||||
}
|
||||
if (bVar5) {
|
||||
info->action.action = ACTION_NOTHING;
|
||||
info->waiting = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.x = entity->pos.x;
|
||||
pos.y = entity->pos.y;
|
||||
sub_80694C0(entity,pos1.x,pos1.y,0);
|
||||
sub_8074FB0(entity,(info->action).direction,&pos);
|
||||
if (((IQSkillIsEnabled(entity, IQ_SUPER_MOBILE)) && (info->invisibleClassStatus.status != STATUS_MOBILE)) &&
|
||||
(!HasHeldItem(entity,ITEM_MOBILE_SCARF))) {
|
||||
sub_804AE08(&entity->pos);
|
||||
}
|
||||
bVar14 = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_USE_MOVE_AI:
|
||||
HandleUseMoveAIAction(entity);
|
||||
break;
|
||||
case ACTION_STAIRS:
|
||||
if ((gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE) && (!gDungeon->deoxysDefeat)) {
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FA5B4); // It's impossible to go down the stairs now!
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayStairsSound();
|
||||
gDungeon->unk2 = 1;
|
||||
gUnknown_202F32C = (info->action).direction;
|
||||
}
|
||||
break;
|
||||
case ACTION_EAT_BERRY_SEED_DRINK:
|
||||
case 0xe:
|
||||
case ACTION_USE_TM:
|
||||
sub_8067110(entity);
|
||||
break;
|
||||
case ACTION_USE_ORB:
|
||||
HandleUseOrbAction(entity);
|
||||
break;
|
||||
case ACTION_PICK_UP_PLAYER:
|
||||
HandlePickUpPlayerAction(entity);
|
||||
break;
|
||||
case ACTION_GIVE_ITEM:
|
||||
HandleGiveItemAction(entity);
|
||||
break;
|
||||
case ACTION_TAKE_ITEM:
|
||||
HandleTakeItemAction(entity);
|
||||
break;
|
||||
case 0x3e:
|
||||
sub_8066BD4(entity); // ITEM_SWITCH_TOOLBOX (When you switch item in Toolbox)
|
||||
break;
|
||||
case ACTION_USE_ITEM:
|
||||
HandleUseItemAction(entity);
|
||||
break;
|
||||
case ACTION_SET_ITEM:
|
||||
HandleSetItemAction(entity, TRUE);
|
||||
break;
|
||||
case ACTION_UNSET_ITEM:
|
||||
HandleUnsetItemAction(entity, TRUE);
|
||||
break;
|
||||
case 0x3b:
|
||||
gDungeon->unkBC = gDungeon->teamPokemon[(info->action).actionParameters[0].actionUseIndex];
|
||||
break;
|
||||
case ACTION_PLACE_ITEM:
|
||||
HandlePlaceItemAction(entity);
|
||||
break;
|
||||
case 10: // Switch with Item on Ground
|
||||
sub_8066E14(entity);
|
||||
break;
|
||||
case 0x3a: // Switch with Item on Ground (also??)
|
||||
sub_8066FA4(entity);
|
||||
break;
|
||||
case ACTION_THROW_ITEM_PLAYER:
|
||||
case ACTION_THROW_STRAIGHT_PLAYER:
|
||||
case ACTION_THROW_ARC_PLAYER:
|
||||
if (MonsterCanThrowItems(info)) {
|
||||
nullsub_95(entity);
|
||||
sub_80671A0(entity);
|
||||
break;
|
||||
}
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE6D4);
|
||||
break;
|
||||
case ACTION_TALK_FIELD:
|
||||
HandleTalkFieldAction(entity);
|
||||
break;
|
||||
case ACTION_USE_MOVE_PLAYER:
|
||||
HandleUseMovePlayerAction(entity);
|
||||
break;
|
||||
case ACTION_STRUGGLE:
|
||||
sub_8067904(entity, MOVE_STRUGGLE);
|
||||
break;
|
||||
case ACTION_REGULAR_ATTACK:
|
||||
sub_8067904(entity, MOVE_REGULAR_ATTACK);
|
||||
break;
|
||||
case ACTION_STEPPED_ON_TRAP:
|
||||
HandleTrap(entity,&entity->pos,0,0);
|
||||
break;
|
||||
case ACTION_PICK_UP_AI:
|
||||
HandlePickUpAIAction(entity);
|
||||
break;
|
||||
case ACTION_EAT_AI:
|
||||
HandleEatAIAction(entity);
|
||||
break;
|
||||
case ACTION_THROW_ITEM_AI:
|
||||
HandleThrowItemAIAction(entity);
|
||||
break;
|
||||
case ACTION_SECOND_THOUGHTS:
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE478);
|
||||
break;
|
||||
default:
|
||||
info->action.action = ACTION_PASS_TURN;
|
||||
break;
|
||||
}
|
||||
sub_807FD84(entity);
|
||||
if (EntityIsValid(entity)) {
|
||||
if (GetEntInfo(entity)->unk14A == 0) {
|
||||
GetEntInfo(entity)->unk14A = 0;
|
||||
sub_8079764(entity);
|
||||
}
|
||||
sub_8041888(0);
|
||||
if (EntityIsValid(entity)) {
|
||||
sub_8085140();
|
||||
if (info->unk14B != 0) {
|
||||
bVar4 = FALSE;
|
||||
info->unk14B = 0;
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++)
|
||||
{
|
||||
move = &info->moves.moves[index];
|
||||
if ((info->moves.moves[index].moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LAST_USED)) {
|
||||
move->PP = 0;
|
||||
bVar4 = TRUE;
|
||||
}
|
||||
}
|
||||
if (bVar4) {
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FD2CC);
|
||||
}
|
||||
}
|
||||
sub_807360C();
|
||||
if (!sub_8044B84()) {
|
||||
sub_807348C();
|
||||
sub_80732F0();
|
||||
if (!EntityIsValid(entity)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (bVar14) {
|
||||
sub_8075818(entity);
|
||||
}
|
||||
if (EntityIsValid(entity)) {
|
||||
if (!sub_8044B84()) {
|
||||
sub_8046D20();
|
||||
}
|
||||
sub_8041888(0);
|
||||
if (((EntityIsValid(entity)) && (!info->aiAllySkip)) && (!bVar14)) {
|
||||
if (sub_80706A4(entity,&entity->pos) != '\0') {
|
||||
WarpTarget(entity,entity,0,0);
|
||||
}
|
||||
sub_8074094(entity);
|
||||
sub_8071DA4(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_80732F0(void)
|
||||
{
|
||||
s32 index;
|
||||
Entity *entity;
|
||||
EntityInfo *info;
|
||||
s32 moveIndex;
|
||||
s32 counter;
|
||||
s32 otherIndex;
|
||||
u8 flag;
|
||||
Move *move;
|
||||
Move *move2;
|
||||
Move moveStack;
|
||||
u8 sl;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++){
|
||||
flag = FALSE;
|
||||
entity = gDungeon->activePokemon[index];
|
||||
if(EntityIsValid(entity)){
|
||||
info = GetEntInfo(entity);
|
||||
if(info->unk164 != 0xFF){
|
||||
sl = info->unk164;
|
||||
if(CannotAttack(entity, TRUE)){
|
||||
info->unk164 |= 0xFF;
|
||||
}
|
||||
else if(!IsSleeping(entity)){
|
||||
info->unk164 |= 0xFF;
|
||||
}
|
||||
else if(info->muzzled.muzzled == TRUE){
|
||||
info->unk164 |= 0xFF;
|
||||
}
|
||||
else{
|
||||
moveIndex = DungeonRandInt(MAX_MON_MOVES);
|
||||
for(counter = 0; counter < MAX_MON_MOVES; counter++){
|
||||
move = &info->moves.moves[moveIndex];
|
||||
if(MoveFlagExists(move)){
|
||||
moveStack = *move;
|
||||
if(moveStack.id == MOVE_SKETCH)
|
||||
goto _increase;
|
||||
if(moveStack.id == MOVE_MIMIC)
|
||||
goto _increase;
|
||||
for(otherIndex = 0; otherIndex < MAX_MON_MOVES; otherIndex++){
|
||||
move2 = &info->moves.moves[otherIndex];
|
||||
if(MoveFlagExists(move2)){
|
||||
if(!info->isTeamLeader){
|
||||
if(!(move2->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) continue;
|
||||
}
|
||||
if(move2->id == MOVE_SLEEP_TALK){
|
||||
if(CanMonsterUseMove(entity, move2, TRUE))
|
||||
{
|
||||
sub_80838EC(&move2->PP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
|
||||
LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk!
|
||||
info->action.direction = sl & DIRECTION_MASK;
|
||||
TryUseChosenMove(entity, 0, ITEM_NOTHING, 1, FALSE, &moveStack);
|
||||
flag = TRUE;
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_increase:
|
||||
moveIndex++;
|
||||
if(moveIndex == MAX_MON_MOVES)
|
||||
moveIndex = 0;
|
||||
}
|
||||
}
|
||||
info->unk164 |= 0xFF;
|
||||
if(flag)
|
||||
sub_80421C0(entity, 0x2E0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807348C(void)
|
||||
{
|
||||
int index;
|
||||
s32 moveIndex;
|
||||
Move *move;
|
||||
EntityInfo *info;
|
||||
Entity *pokemon;
|
||||
Move chosenMove;
|
||||
u8 r8;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++) {
|
||||
pokemon = gDungeon->activePokemon[index];
|
||||
if (EntityIsValid(pokemon)) {
|
||||
info = GetEntInfo(pokemon);
|
||||
if (info->unk165 != 0xff) {
|
||||
r8 = info->unk165;
|
||||
if (CannotAttack(pokemon,TRUE)) {
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
else if (!IsSleeping(pokemon)) {
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
else if (info->muzzled.muzzled == TRUE) {
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
else {
|
||||
for(moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
||||
{
|
||||
move = &info->moves.moves[moveIndex];
|
||||
if (((MoveFlagExists(move)) &&
|
||||
((info->isTeamLeader || (move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) && move->id == MOVE_SNORE)) &&
|
||||
(CanMonsterUseMove(pokemon,move,TRUE))) {
|
||||
chosenMove = *move;
|
||||
sub_80838EC(&move->PP);
|
||||
MarkLastUsedMonMove(pokemon,move);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0);
|
||||
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FCF50);
|
||||
info->action.direction = r8 & DIRECTION_MASK;
|
||||
TryUseChosenMove(pokemon,0,ITEM_NOTHING,1,FALSE,&chosenMove);
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807360C(void)
|
||||
{
|
||||
s32 index;
|
||||
Entity *entity;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->activePokemon[index];
|
||||
if(EntityIsValid(entity))
|
||||
{
|
||||
if(GetEntInfo(entity)->unk152 != 0)
|
||||
{
|
||||
GetEntInfo(entity)->unk152 = 0;
|
||||
UpdateFlashFireBoost(entity, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,92 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
#include "dungeon_move_util.h"
|
||||
#include "code_803E46C.h"
|
||||
#include "code_8041AD0.h"
|
||||
#include "code_804267C.h"
|
||||
#include "code_8066D04.h"
|
||||
#include "dungeon_message.h"
|
||||
#include "code_8077274_1.h"
|
||||
#include "code_807CD9C.h"
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "constants/iq_skill.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/status.h"
|
||||
#include "constants/targeting.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_items.h"
|
||||
#include "dungeon_leader.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_logic.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "move_util.h"
|
||||
#include "moves.h"
|
||||
#include "pokemon_3.h"
|
||||
#include "pokemon.h"
|
||||
#include "status.h"
|
||||
#include "trap.h"
|
||||
#include "dungeon_config.h"
|
||||
#include "dungeon_misc.h"
|
||||
|
||||
extern u8 gUnknown_202F221;
|
||||
extern u8 gUnknown_202F222;
|
||||
extern u8 gUnknown_202F32C;
|
||||
extern u8 gUnknown_202F32D;
|
||||
extern u8 gUnknown_203B434;
|
||||
|
||||
extern u8 *gUnknown_80FA5B4[];
|
||||
extern u8 *gUnknown_80FCF50[];
|
||||
extern u8 *gUnknown_80FCF38[];
|
||||
extern u8 *gUnknown_80FD2CC[];
|
||||
extern u8 *gUnknown_80FE478[];
|
||||
extern u8 *gUnknown_80FE6D4[];
|
||||
|
||||
void sub_8075BA4(Entity *param_1, u8 param_2);
|
||||
void sub_804178C(u8 param_1);
|
||||
void nullsub_95(Entity *);
|
||||
bool8 IsNotAttacking(Entity *, bool8);
|
||||
extern void sub_80671A0(Entity *);
|
||||
extern void sub_8067110(Entity *);
|
||||
void HandleUseMoveAIAction(Entity *target);
|
||||
void sub_8041888(u8 param_1);
|
||||
void sub_8085140(void);
|
||||
void sub_807360C(void);
|
||||
void sub_805EFB4(Entity *, u8);
|
||||
void sub_8074FB0(Entity *, u8, DungeonPos *);
|
||||
|
||||
void HandlePlaceItemAction(Entity *);
|
||||
void HandlePickUpPlayerAction(Entity *);
|
||||
void sub_8066E14(Entity * );
|
||||
void sub_807348C(void);
|
||||
void sub_80732F0(void);
|
||||
void sub_8066BD4(Entity*);
|
||||
void HandleTalkFieldAction(Entity *);
|
||||
void HandleUseMovePlayerAction(Entity *);
|
||||
void HandleUseOrbAction(Entity *);
|
||||
void sub_8067904(Entity *, u32);
|
||||
void HandleGiveItemAction(Entity *);
|
||||
void HandleTakeItemAction(Entity *);
|
||||
void HandleUseItemAction(Entity *);
|
||||
void sub_8066FA4(Entity *);
|
||||
void HandleUnsetItemAction(Entity *,bool8);
|
||||
extern u8 sub_8044B28(void);
|
||||
extern u8 UseAttack(Entity *);
|
||||
void sub_806A1E8(Entity *pokemon);
|
||||
bool8 sub_804AE08(DungeonPos *pos);
|
||||
void HandlePickUpAIAction(Entity *pokemon);
|
||||
void HandleThrowItemAIAction(Entity *pokemon);
|
||||
void HandleEatAIAction(Entity *pokemon);
|
||||
bool8 sub_8044B84(void);
|
||||
extern void sub_8074094(Entity *);
|
||||
extern void sub_8071DA4(Entity *);
|
||||
u32 sub_8075818(Entity *entity);
|
||||
extern void MarkLastUsedMonMove(Entity *entity, Move *move);
|
||||
bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move);
|
||||
extern void sub_80838EC(u8 *a);
|
||||
|
||||
|
||||
bool8 TargetLeader(Entity *pokemon)
|
||||
{
|
||||
@@ -113,421 +32,3 @@ Entity* GetLeaderIfVisible(Entity *pokemon)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool8 sub_8072CF4(Entity *entity)
|
||||
{
|
||||
bool8 bVar4;
|
||||
bool8 bVar5;
|
||||
Move *move;
|
||||
s32 index;
|
||||
EntityInfo *info;
|
||||
bool8 bVar14;
|
||||
DungeonPos pos;
|
||||
DungeonPos pos1;
|
||||
|
||||
sub_804178C(1);
|
||||
gUnknown_203B434 = 1;
|
||||
info = GetEntInfo(entity);
|
||||
info->useHeldItem = FALSE;
|
||||
info->unkF3 = FALSE;
|
||||
gDungeon->unkB8 = entity;
|
||||
if (gUnknown_80F58F4[(info->action).action][0] != 0) {
|
||||
if (info->isTeamLeader) {
|
||||
sub_805EFB4(entity,gUnknown_80F58F4[(info->action).action][1]);
|
||||
}
|
||||
else {
|
||||
sub_8075BA4(entity,gUnknown_80F58F4[(info->action).action][1]);
|
||||
}
|
||||
}
|
||||
if ((CannotAttack(entity, FALSE)) && (IsChargingAnyTwoTurnMove(entity, TRUE))) {
|
||||
sub_8079764(entity);
|
||||
}
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++)
|
||||
{
|
||||
move = &info->moves.moves[index];
|
||||
if ((move->moveFlags & MOVE_FLAG_EXISTS)) {
|
||||
move->moveFlags2 &= ~(MOVE_FLAG2_UNK4);
|
||||
}
|
||||
}
|
||||
if (!IsNotAttacking(entity, FALSE)) {
|
||||
if (UseAttack(entity)) {
|
||||
if (sub_8044B28()) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!EntityIsValid(entity)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (gUnknown_202F32D != 0) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (!info->isTeamLeader) {
|
||||
sub_8052740(10);
|
||||
}
|
||||
sub_806A1E8(entity);
|
||||
DungeonRunFrameActions(10);
|
||||
}
|
||||
if (((ACTION_PASS_TURN < info->action.action) && (info->action.action != 4)) && (info->action.action != ACTION_WALK)) {
|
||||
info->attacking = TRUE;
|
||||
}
|
||||
bVar14 = FALSE;
|
||||
info->unk14A = 0;
|
||||
gUnknown_202F221 = 0;
|
||||
gUnknown_202F222 = 0;
|
||||
switch(info->action.action) {
|
||||
case ACTION_WALK:
|
||||
if(info->frozenClassStatus.status == STATUS_SHADOW_HOLD)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_CONSTRICTION)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_INGRAIN)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_WRAP)
|
||||
{
|
||||
goto _282;
|
||||
}
|
||||
else if(info->frozenClassStatus.status == STATUS_WRAPPED)
|
||||
{
|
||||
_282:
|
||||
info->action.action = ACTION_NOTHING;
|
||||
info->waiting = TRUE;
|
||||
}
|
||||
else {
|
||||
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 & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) &&
|
||||
(!CanMoveInDirection(entity,(info->action).direction))) {
|
||||
bVar5 = TRUE;
|
||||
}
|
||||
if (bVar5) {
|
||||
info->action.action = ACTION_NOTHING;
|
||||
info->waiting = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.x = entity->pos.x;
|
||||
pos.y = entity->pos.y;
|
||||
sub_80694C0(entity,pos1.x,pos1.y,0);
|
||||
sub_8074FB0(entity,(info->action).direction,&pos);
|
||||
if (((IQSkillIsEnabled(entity, IQ_SUPER_MOBILE)) && (info->invisibleClassStatus.status != STATUS_MOBILE)) &&
|
||||
(!HasHeldItem(entity,ITEM_MOBILE_SCARF))) {
|
||||
sub_804AE08(&entity->pos);
|
||||
}
|
||||
bVar14 = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_USE_MOVE_AI:
|
||||
HandleUseMoveAIAction(entity);
|
||||
break;
|
||||
case ACTION_STAIRS:
|
||||
if ((gDungeon->unk644.dungeonLocation.id == DUNGEON_METEOR_CAVE) && (!gDungeon->deoxysDefeat)) {
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FA5B4); // It's impossible to go down the stairs now!
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayStairsSound();
|
||||
gDungeon->unk2 = 1;
|
||||
gUnknown_202F32C = (info->action).direction;
|
||||
}
|
||||
break;
|
||||
case ACTION_EAT_BERRY_SEED_DRINK:
|
||||
case 0xe:
|
||||
case ACTION_USE_TM:
|
||||
sub_8067110(entity);
|
||||
break;
|
||||
case ACTION_USE_ORB:
|
||||
HandleUseOrbAction(entity);
|
||||
break;
|
||||
case ACTION_PICK_UP_PLAYER:
|
||||
HandlePickUpPlayerAction(entity);
|
||||
break;
|
||||
case ACTION_GIVE_ITEM:
|
||||
HandleGiveItemAction(entity);
|
||||
break;
|
||||
case ACTION_TAKE_ITEM:
|
||||
HandleTakeItemAction(entity);
|
||||
break;
|
||||
case 0x3e:
|
||||
sub_8066BD4(entity); // ITEM_SWITCH_TOOLBOX (When you switch item in Toolbox)
|
||||
break;
|
||||
case ACTION_USE_ITEM:
|
||||
HandleUseItemAction(entity);
|
||||
break;
|
||||
case ACTION_SET_ITEM:
|
||||
HandleSetItemAction(entity, TRUE);
|
||||
break;
|
||||
case ACTION_UNSET_ITEM:
|
||||
HandleUnsetItemAction(entity, TRUE);
|
||||
break;
|
||||
case 0x3b:
|
||||
gDungeon->unkBC = gDungeon->teamPokemon[(info->action).actionParameters[0].actionUseIndex];
|
||||
break;
|
||||
case ACTION_PLACE_ITEM:
|
||||
HandlePlaceItemAction(entity);
|
||||
break;
|
||||
case 10: // Switch with Item on Ground
|
||||
sub_8066E14(entity);
|
||||
break;
|
||||
case 0x3a: // Switch with Item on Ground (also??)
|
||||
sub_8066FA4(entity);
|
||||
break;
|
||||
case ACTION_THROW_ITEM_PLAYER:
|
||||
case ACTION_THROW_STRAIGHT_PLAYER:
|
||||
case ACTION_THROW_ARC_PLAYER:
|
||||
if (MonsterCanThrowItems(info)) {
|
||||
nullsub_95(entity);
|
||||
sub_80671A0(entity);
|
||||
break;
|
||||
}
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE6D4);
|
||||
break;
|
||||
case ACTION_TALK_FIELD:
|
||||
HandleTalkFieldAction(entity);
|
||||
break;
|
||||
case ACTION_USE_MOVE_PLAYER:
|
||||
HandleUseMovePlayerAction(entity);
|
||||
break;
|
||||
case ACTION_STRUGGLE:
|
||||
sub_8067904(entity, MOVE_STRUGGLE);
|
||||
break;
|
||||
case ACTION_REGULAR_ATTACK:
|
||||
sub_8067904(entity, MOVE_REGULAR_ATTACK);
|
||||
break;
|
||||
case ACTION_STEPPED_ON_TRAP:
|
||||
HandleTrap(entity,&entity->pos,0,0);
|
||||
break;
|
||||
case ACTION_PICK_UP_AI:
|
||||
HandlePickUpAIAction(entity);
|
||||
break;
|
||||
case ACTION_EAT_AI:
|
||||
HandleEatAIAction(entity);
|
||||
break;
|
||||
case ACTION_THROW_ITEM_AI:
|
||||
HandleThrowItemAIAction(entity);
|
||||
break;
|
||||
case ACTION_SECOND_THOUGHTS:
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],entity,0);
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FE478);
|
||||
break;
|
||||
default:
|
||||
info->action.action = ACTION_PASS_TURN;
|
||||
break;
|
||||
}
|
||||
sub_807FD84(entity);
|
||||
if (EntityIsValid(entity)) {
|
||||
if (GetEntInfo(entity)->unk14A == 0) {
|
||||
GetEntInfo(entity)->unk14A = 0;
|
||||
sub_8079764(entity);
|
||||
}
|
||||
sub_8041888(0);
|
||||
if (EntityIsValid(entity)) {
|
||||
sub_8085140();
|
||||
if (info->unk14B != 0) {
|
||||
bVar4 = FALSE;
|
||||
info->unk14B = 0;
|
||||
|
||||
for(index = 0; index < MAX_MON_MOVES; index++)
|
||||
{
|
||||
move = &info->moves.moves[index];
|
||||
if ((info->moves.moves[index].moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_LAST_USED)) {
|
||||
move->PP = 0;
|
||||
bVar4 = TRUE;
|
||||
}
|
||||
}
|
||||
if (bVar4) {
|
||||
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80FD2CC);
|
||||
}
|
||||
}
|
||||
sub_807360C();
|
||||
if (!sub_8044B84()) {
|
||||
sub_807348C();
|
||||
sub_80732F0();
|
||||
if (!EntityIsValid(entity)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (bVar14) {
|
||||
sub_8075818(entity);
|
||||
}
|
||||
if (EntityIsValid(entity)) {
|
||||
if (!sub_8044B84()) {
|
||||
sub_8046D20();
|
||||
}
|
||||
sub_8041888(0);
|
||||
if (((EntityIsValid(entity)) && (!info->aiAllySkip)) && (!bVar14)) {
|
||||
if (sub_80706A4(entity,&entity->pos) != '\0') {
|
||||
WarpTarget(entity,entity,0,0);
|
||||
}
|
||||
sub_8074094(entity);
|
||||
sub_8071DA4(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void sub_80732F0(void)
|
||||
{
|
||||
s32 index;
|
||||
Entity *entity;
|
||||
EntityInfo *info;
|
||||
s32 moveIndex;
|
||||
s32 counter;
|
||||
s32 otherIndex;
|
||||
u8 flag;
|
||||
Move *move;
|
||||
Move *move2;
|
||||
Move moveStack;
|
||||
u8 sl;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++){
|
||||
flag = FALSE;
|
||||
entity = gDungeon->activePokemon[index];
|
||||
if(EntityIsValid(entity)){
|
||||
info = GetEntInfo(entity);
|
||||
if(info->unk164 != 0xFF){
|
||||
sl = info->unk164;
|
||||
if(CannotAttack(entity, TRUE)){
|
||||
info->unk164 |= 0xFF;
|
||||
}
|
||||
else if(!IsSleeping(entity)){
|
||||
info->unk164 |= 0xFF;
|
||||
}
|
||||
else if(info->muzzled.muzzled == TRUE){
|
||||
info->unk164 |= 0xFF;
|
||||
}
|
||||
else{
|
||||
moveIndex = DungeonRandInt(MAX_MON_MOVES);
|
||||
for(counter = 0; counter < MAX_MON_MOVES; counter++){
|
||||
move = &info->moves.moves[moveIndex];
|
||||
if(MoveFlagExists(move)){
|
||||
moveStack = *move;
|
||||
if(moveStack.id == MOVE_SKETCH)
|
||||
goto _increase;
|
||||
if(moveStack.id == MOVE_MIMIC)
|
||||
goto _increase;
|
||||
for(otherIndex = 0; otherIndex < MAX_MON_MOVES; otherIndex++){
|
||||
move2 = &info->moves.moves[otherIndex];
|
||||
if(MoveFlagExists(move2)){
|
||||
if(!info->isTeamLeader){
|
||||
if(!(move2->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) continue;
|
||||
}
|
||||
if(move2->id == MOVE_SLEEP_TALK){
|
||||
if(CanMonsterUseMove(entity, move2, TRUE))
|
||||
{
|
||||
sub_80838EC(&move2->PP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0], entity, 0);
|
||||
LogMessageByIdWithPopupCheckUser(entity, *gUnknown_80FCF38); // {ARG_POKEMON_0} uttered its sleep talk!
|
||||
info->action.direction = sl & DIRECTION_MASK;
|
||||
TryUseChosenMove(entity, 0, ITEM_NOTHING, 1, FALSE, &moveStack);
|
||||
flag = TRUE;
|
||||
break;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_increase:
|
||||
moveIndex++;
|
||||
if(moveIndex == MAX_MON_MOVES)
|
||||
moveIndex = 0;
|
||||
}
|
||||
}
|
||||
info->unk164 |= 0xFF;
|
||||
if(flag)
|
||||
sub_80421C0(entity, 0x2E0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807348C(void)
|
||||
{
|
||||
int index;
|
||||
s32 moveIndex;
|
||||
Move *move;
|
||||
EntityInfo *info;
|
||||
Entity *pokemon;
|
||||
Move chosenMove;
|
||||
u8 r8;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++) {
|
||||
pokemon = gDungeon->activePokemon[index];
|
||||
if (EntityIsValid(pokemon)) {
|
||||
info = GetEntInfo(pokemon);
|
||||
if (info->unk165 != 0xff) {
|
||||
r8 = info->unk165;
|
||||
if (CannotAttack(pokemon,TRUE)) {
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
else if (!IsSleeping(pokemon)) {
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
else if (info->muzzled.muzzled == TRUE) {
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
else {
|
||||
for(moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
||||
{
|
||||
move = &info->moves.moves[moveIndex];
|
||||
if (((MoveFlagExists(move)) &&
|
||||
((info->isTeamLeader || (move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI)) && move->id == MOVE_SNORE)) &&
|
||||
(CanMonsterUseMove(pokemon,move,TRUE))) {
|
||||
chosenMove = *move;
|
||||
sub_80838EC(&move->PP);
|
||||
MarkLastUsedMonMove(pokemon,move);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SubstitutePlaceholderStringTags(gFormatBuffer_Monsters[0],pokemon,0);
|
||||
LogMessageByIdWithPopupCheckUser(pokemon,*gUnknown_80FCF50);
|
||||
info->action.direction = r8 & DIRECTION_MASK;
|
||||
TryUseChosenMove(pokemon,0,ITEM_NOTHING,1,FALSE,&chosenMove);
|
||||
info->unk165 |= 0xff;
|
||||
info->unk164 |= 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807360C(void)
|
||||
{
|
||||
s32 index;
|
||||
Entity *entity;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->activePokemon[index];
|
||||
if(EntityIsValid(entity))
|
||||
{
|
||||
if(GetEntInfo(entity)->unk152 != 0)
|
||||
{
|
||||
GetEntInfo(entity)->unk152 = 0;
|
||||
UpdateFlashFireBoost(entity, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user