mirror of
https://github.com/pret/pmd-red.git
synced 2026-04-26 00:15:48 -05:00
sub_806B7F8
This commit is contained in:
parent
8e62c70af9
commit
59675af1f9
|
|
@ -5,309 +5,6 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_806B678
|
||||
sub_806B678:
|
||||
push {r4,r5,lr}
|
||||
movs r5, 0
|
||||
_0806B67C:
|
||||
ldr r0, _0806B6AC
|
||||
ldr r0, [r0]
|
||||
lsls r1, r5, 2
|
||||
ldr r2, _0806B6B0
|
||||
adds r0, r2
|
||||
adds r0, r1
|
||||
ldr r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0806B6B8
|
||||
ldr r0, [r4, 0x70]
|
||||
ldrb r0, [r0, 0x7]
|
||||
cmp r0, 0
|
||||
beq _0806B6B8
|
||||
adds r0, r4, 0
|
||||
bl sub_803F4A0
|
||||
ldr r1, _0806B6B4
|
||||
ldr r0, [r4, 0x4]
|
||||
str r0, [r1]
|
||||
b _0806B6BE
|
||||
.align 2, 0
|
||||
_0806B6AC: .4byte gDungeon
|
||||
_0806B6B0: .4byte 0x0001357c
|
||||
_0806B6B4: .4byte gUnknown_202EE0C
|
||||
_0806B6B8:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x3
|
||||
ble _0806B67C
|
||||
_0806B6BE:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_806B678
|
||||
|
||||
thumb_func_start sub_806B6C4
|
||||
sub_806B6C4:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x14
|
||||
ldr r4, _0806B708
|
||||
ldr r0, [r4]
|
||||
movs r1, 0xD1
|
||||
lsls r1, 3
|
||||
adds r0, r1
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
negs r0, r1
|
||||
orrs r0, r1
|
||||
lsrs r0, 31
|
||||
mov r8, r0
|
||||
movs r0, 0x7A
|
||||
bl sub_80860A8
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0806B710
|
||||
movs r0, 0x97
|
||||
bl HasRecruitedMon
|
||||
lsls r0, 24
|
||||
lsrs r1, r0, 24
|
||||
cmp r1, 0
|
||||
bne _0806B710
|
||||
ldr r0, [r4]
|
||||
ldr r2, _0806B70C
|
||||
adds r0, r2
|
||||
b _0806B71A
|
||||
.align 2, 0
|
||||
_0806B708: .4byte gDungeon
|
||||
_0806B70C: .4byte 0x000037ff
|
||||
_0806B710:
|
||||
ldr r0, _0806B77C
|
||||
ldr r0, [r0]
|
||||
ldr r1, _0806B780
|
||||
adds r0, r1
|
||||
movs r1, 0x1
|
||||
_0806B71A:
|
||||
strb r1, [r0]
|
||||
movs r0, 0x38
|
||||
bl DungeonRandInt
|
||||
adds r5, r0, 0
|
||||
movs r0, 0x20
|
||||
bl DungeonRandInt
|
||||
adds r7, r0, 0
|
||||
movs r0, 0
|
||||
_0806B72E:
|
||||
adds r7, 0x1
|
||||
cmp r7, 0x20
|
||||
bne _0806B736
|
||||
movs r7, 0
|
||||
_0806B736:
|
||||
adds r0, 0x1
|
||||
mov r10, r0
|
||||
mov r4, sp
|
||||
movs r2, 0x37
|
||||
mov r9, r2
|
||||
_0806B740:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x38
|
||||
bne _0806B748
|
||||
movs r5, 0
|
||||
_0806B748:
|
||||
adds r0, r5, 0
|
||||
adds r1, r7, 0
|
||||
bl GetTile
|
||||
ldrh r1, [r0, 0x4]
|
||||
movs r0, 0x8
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0806B7C2
|
||||
movs r6, 0
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
beq _0806B784
|
||||
ldr r0, _0806B77C
|
||||
ldr r0, [r0]
|
||||
movs r1, 0xD1
|
||||
lsls r1, 3
|
||||
adds r0, r1
|
||||
ldrh r0, [r0]
|
||||
strh r0, [r4]
|
||||
movs r1, 0x1
|
||||
movs r0, 0x1
|
||||
strh r0, [r4, 0x8]
|
||||
strb r1, [r4, 0x2]
|
||||
movs r6, 0x1
|
||||
b _0806B794
|
||||
.align 2, 0
|
||||
_0806B77C: .4byte gDungeon
|
||||
_0806B780: .4byte 0x000037ff
|
||||
_0806B784:
|
||||
movs r0, 0
|
||||
bl sub_803D970
|
||||
movs r1, 0
|
||||
strh r0, [r4]
|
||||
mov r2, r8
|
||||
strh r2, [r4, 0x8]
|
||||
strb r1, [r4, 0x2]
|
||||
_0806B794:
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x4]
|
||||
strb r0, [r4, 0x10]
|
||||
strh r5, [r4, 0xC]
|
||||
strh r7, [r4, 0xE]
|
||||
cmp r6, 0
|
||||
bne _0806B7B2
|
||||
movs r1, 0
|
||||
ldrsh r0, [r4, r1]
|
||||
movs r1, 0x1
|
||||
bl sub_806AA0C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0806B7C2
|
||||
_0806B7B2:
|
||||
mov r0, sp
|
||||
movs r1, 0
|
||||
bl sub_806B7F8
|
||||
cmp r0, 0
|
||||
beq _0806B7C2
|
||||
movs r2, 0
|
||||
mov r8, r2
|
||||
_0806B7C2:
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
add r9, r0
|
||||
mov r1, r9
|
||||
cmp r1, 0
|
||||
bge _0806B740
|
||||
mov r0, r10
|
||||
cmp r0, 0x1F
|
||||
ble _0806B72E
|
||||
mov r2, r8
|
||||
cmp r2, 0
|
||||
beq _0806B7E2
|
||||
ldr r0, _0806B7F4
|
||||
ldr r1, [r0]
|
||||
movs r0, 0x1
|
||||
strb r0, [r1, 0xA]
|
||||
_0806B7E2:
|
||||
add sp, 0x14
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.align 2, 0
|
||||
_0806B7F4: .4byte gDungeon
|
||||
thumb_func_end sub_806B6C4
|
||||
|
||||
thumb_func_start sub_806B7F8
|
||||
sub_806B7F8:
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
sub sp, 0x8
|
||||
adds r6, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
mov r8, r1
|
||||
movs r1, 0xC
|
||||
ldrsh r0, [r6, r1]
|
||||
movs r2, 0xE
|
||||
ldrsh r1, [r6, r2]
|
||||
bl GetTile
|
||||
adds r1, r0, 0
|
||||
movs r3, 0
|
||||
ldrsh r0, [r6, r3]
|
||||
bl sub_807034C
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0806B834
|
||||
movs r4, 0
|
||||
ldrsh r0, [r6, r4]
|
||||
bl sub_804550C
|
||||
adds r7, r0, 0
|
||||
cmp r7, 0
|
||||
bne _0806B838
|
||||
_0806B834:
|
||||
movs r0, 0
|
||||
b _0806B8B8
|
||||
_0806B838:
|
||||
ldr r3, _0806B8C8
|
||||
movs r0, 0
|
||||
adds r1, r7, 0
|
||||
adds r2, r6, 0
|
||||
bl sub_806BC68
|
||||
ldr r5, [r7, 0x70]
|
||||
movs r0, 0x1
|
||||
strb r0, [r5, 0x6]
|
||||
movs r1, 0x8C
|
||||
lsls r1, 1
|
||||
adds r0, r5, r1
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x10
|
||||
adds r2, r5, 0
|
||||
adds r2, 0x14
|
||||
movs r3, 0x16
|
||||
adds r3, r5
|
||||
mov r9, r3
|
||||
movs r3, 0x2
|
||||
ldrsh r4, [r5, r3]
|
||||
str r4, [sp]
|
||||
ldrb r4, [r5, 0x9]
|
||||
str r4, [sp, 0x4]
|
||||
mov r3, r9
|
||||
bl sub_806AED8
|
||||
ldrh r0, [r5, 0x10]
|
||||
strh r0, [r5, 0xE]
|
||||
movs r4, 0x8A
|
||||
lsls r4, 1
|
||||
adds r1, r5, r4
|
||||
ldr r0, [r6, 0x4]
|
||||
str r0, [r1]
|
||||
ldrb r0, [r6, 0x2]
|
||||
cmp r0, 0
|
||||
bne _0806B8B6
|
||||
mov r0, r8
|
||||
cmp r0, 0
|
||||
bne _0806B8B6
|
||||
ldrb r0, [r6, 0x10]
|
||||
cmp r0, 0
|
||||
bne _0806B8B6
|
||||
movs r0, 0x64
|
||||
bl DungeonRandInt
|
||||
adds r4, r0, 0
|
||||
movs r1, 0
|
||||
ldrsh r0, [r6, r1]
|
||||
bl GetChanceAsleep
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, r4
|
||||
ble _0806B8B6
|
||||
adds r0, r7, 0
|
||||
movs r1, 0x7F
|
||||
bl sub_8075BF4
|
||||
adds r0, r7, 0
|
||||
movs r1, 0x8
|
||||
bl sub_806CE68
|
||||
_0806B8B6:
|
||||
adds r0, r7, 0
|
||||
_0806B8B8:
|
||||
add sp, 0x8
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_0806B8C8: .4byte gUnknown_202EE0C
|
||||
thumb_func_end sub_806B7F8
|
||||
|
||||
thumb_func_start sub_806B8CC
|
||||
sub_806B8CC:
|
||||
push {r4-r7,lr}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "status_checks_1.h"
|
||||
#include "dungeon_ai_movement.h"
|
||||
#include "constants/iq_skill.h"
|
||||
#include "structs/str_806B7F8.h"
|
||||
|
||||
struct unkStruct_80F520C
|
||||
{
|
||||
|
|
@ -1107,6 +1108,7 @@ void sub_806B168(void)
|
|||
PokemonStruct2 *currMonPtr = monPtrs2[i];
|
||||
|
||||
if (currMonPtr != NULL) {
|
||||
DungeonPos unkPosition;
|
||||
s32 j;
|
||||
const Tile *tile;
|
||||
bool8 skipSecondLoop;
|
||||
|
|
@ -1118,7 +1120,7 @@ void sub_806B168(void)
|
|||
skipSecondLoop = FALSE;
|
||||
j = 0;
|
||||
while (1) {
|
||||
DungeonPos unkPosition = gUnknown_80F4598[j];
|
||||
unkPosition = gUnknown_80F4598[j];
|
||||
if (unkPosition.x == 99)
|
||||
break;
|
||||
|
||||
|
|
@ -1136,7 +1138,7 @@ void sub_806B168(void)
|
|||
|
||||
j = 0;
|
||||
while (1) {
|
||||
DungeonPos unkPosition = gUnknown_80F4598[j];
|
||||
unkPosition = gUnknown_80F4598[j];
|
||||
if (unkPosition.x == 99)
|
||||
break;
|
||||
|
||||
|
|
@ -1248,4 +1250,125 @@ void sub_806B404(void)
|
|||
}
|
||||
}
|
||||
|
||||
extern DungeonPos gUnknown_202EE0C;
|
||||
extern void sub_803F4A0(Entity *a0);
|
||||
extern bool8 sub_80860A8(u8 id);
|
||||
|
||||
void sub_806B678(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
|
||||
Entity *mon = gDungeon->teamPokemon[i];
|
||||
if (EntityExists(mon)) {
|
||||
EntityInfo *monInfo = GetEntInfo(mon);
|
||||
if (monInfo->isTeamLeader) {
|
||||
sub_803F4A0(mon);
|
||||
gUnknown_202EE0C = mon->pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* s16 species;
|
||||
u8 unk2;
|
||||
u32 unk4;
|
||||
u16 level;
|
||||
DungeonPos pos;
|
||||
u8 unk10;*/
|
||||
|
||||
extern s16 sub_803D970(u32);
|
||||
|
||||
void sub_806B6C4(void)
|
||||
{
|
||||
struct unkStruct_806B7F8 spStruct;
|
||||
s32 i, j;
|
||||
s32 x, y;
|
||||
bool8 r8 = (gDungeon->unk644.unk44 != 0);
|
||||
|
||||
if (sub_80860A8(ITEM_MUSIC_BOX) && !HasRecruitedMon(MONSTER_MEW)) {
|
||||
gDungeon->unk37FF = FALSE;
|
||||
}
|
||||
else {
|
||||
gDungeon->unk37FF = TRUE;
|
||||
}
|
||||
|
||||
x = DungeonRandInt(DUNGEON_MAX_SIZE_X);
|
||||
y = DungeonRandInt(DUNGEON_MAX_SIZE_Y);
|
||||
|
||||
for (j = 0; j < DUNGEON_MAX_SIZE_Y; j++) {
|
||||
y++;
|
||||
if (y == DUNGEON_MAX_SIZE_Y) {y = 0;}
|
||||
|
||||
for (i = 0; i < DUNGEON_MAX_SIZE_X; i++) {
|
||||
x++;
|
||||
if (x == DUNGEON_MAX_SIZE_X) {x = 0;}
|
||||
|
||||
if (GetTile(x, y)->spawnOrVisibilityFlags & 8) {
|
||||
bool8 r6 = FALSE;
|
||||
|
||||
if (r8) {
|
||||
spStruct.species = gDungeon->unk644.unk44;
|
||||
spStruct.level = 1;
|
||||
spStruct.unk2 = 1;
|
||||
r6 = TRUE;
|
||||
}
|
||||
else {
|
||||
spStruct.species = sub_803D970(0);
|
||||
spStruct.level = 0;
|
||||
spStruct.unk2 = 0;
|
||||
}
|
||||
|
||||
spStruct.unk4 = 0;
|
||||
spStruct.unk10 = 0;
|
||||
spStruct.pos.x = x;
|
||||
spStruct.pos.y = y;
|
||||
if (r6 || sub_806AA0C(spStruct.species, TRUE)) {
|
||||
if (sub_806B7F8(&spStruct, FALSE)) {
|
||||
r8 = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (r8) {
|
||||
gDungeon->unkA = 1;
|
||||
}
|
||||
}
|
||||
|
||||
extern Entity *sub_804550C(s16 a);
|
||||
|
||||
void sub_806BC68(bool8 a0, Entity *entity, struct unkStruct_806B7F8 *structPtr, DungeonPos *pos);
|
||||
|
||||
Entity* sub_806B7F8(struct unkStruct_806B7F8 *structPtr, bool8 a1)
|
||||
{
|
||||
Entity *entity;
|
||||
EntityInfo *entityInfo;
|
||||
const Tile *tile = GetTile(structPtr->pos.x, structPtr->pos.y);
|
||||
|
||||
if (sub_807034C(structPtr->species, tile))
|
||||
return FALSE;
|
||||
|
||||
entity = sub_804550C(structPtr->species);
|
||||
if (entity == NULL)
|
||||
return FALSE;
|
||||
|
||||
sub_806BC68(FALSE, entity, structPtr, &gUnknown_202EE0C);
|
||||
entityInfo = GetEntInfo(entity);
|
||||
entityInfo->isNotTeamMember = TRUE;
|
||||
sub_806AED8(&entityInfo->moves, &entityInfo->maxHPStat, entityInfo->atk, entityInfo->def, entityInfo->id, entityInfo->level);
|
||||
entityInfo->HP = entityInfo->maxHPStat;
|
||||
entityInfo->moveRandomly = structPtr->unk4;
|
||||
if (!structPtr->unk2 && !a1 && !structPtr->unk10) {
|
||||
s32 rand = DungeonRandInt(100);
|
||||
if (GetChanceAsleep(structPtr->species) > rand) {
|
||||
sub_8075BF4(entity, 0x7F);
|
||||
sub_806CE68(entity, NUM_DIRECTIONS);
|
||||
}
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user