Added NONMATCHING for Wander()

This commit is contained in:
AnonymousRandomPerson 2022-05-29 00:10:38 -04:00
parent 4e2a813822
commit 1448e5903d
9 changed files with 503 additions and 395 deletions

View File

@ -531,7 +531,7 @@ _0807B2B4:
strh r1, [r2]
_0807B2C0:
mov r0, r8
bl Explore
bl Wander
_0807B2C6:
movs r0, 0x1
add sp, 0xC

View File

@ -1,326 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start Explore
Explore:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x10
adds r6, r0, 0
ldr r7, [r6, 0x70]
bl GetEntityRoomIndex
lsls r0, 24
lsrs r3, r0, 24
cmp r3, 0xFF
bne _0807B9DC
movs r0, 0
str r0, [sp, 0x4]
adds r4, r7, 0
adds r4, 0x46
ldrb r0, [r4]
adds r0, 0x4
mov r8, r0
movs r0, 0x7
mov r1, r8
ands r1, r0
mov r8, r1
adds r0, r6, 0
bl IsAtJunction
lsls r0, 24
mov r9, r4
cmp r0, 0
beq _0807B96C
movs r0, 0x8
bl DungeonRandomCapped
strb r0, [r4]
movs r2, 0x1
str r2, [sp, 0x4]
_0807B96C:
movs r3, 0
movs r4, 0x78
adds r4, r7
mov r10, r4
adds r0, r7, 0
adds r0, 0x88
str r0, [sp, 0x8]
adds r7, 0x8A
ldr r5, _0807B9D4
_0807B97E:
mov r1, r9
ldrb r0, [r1]
ldr r1, [r5]
adds r4, r0, r1
movs r0, 0x7
ands r4, r0
ldr r2, [sp, 0x4]
cmp r2, 0
beq _0807B994
cmp r4, r8
beq _0807B9AA
_0807B994:
adds r0, r6, 0
adds r1, r4, 0
mov r2, sp
str r3, [sp, 0xC]
bl CanMoveForward
lsls r0, 24
ldr r3, [sp, 0xC]
cmp r0, 0
beq _0807B9AA
b _0807BB42
_0807B9AA:
adds r5, 0x4
adds r3, 0x1
cmp r3, 0x7
ble _0807B97E
movs r0, 0x8
bl DungeonRandomCapped
movs r1, 0x6
mov r3, r10
strb r1, [r3]
ldr r1, _0807B9D8
lsls r0, 2
adds r0, r1
ldrh r1, [r0]
ldrh r4, [r6, 0x4]
adds r1, r4
ldr r2, [sp, 0x8]
strh r1, [r2]
ldrh r0, [r0, 0x2]
b _0807BB5A
.align 2, 0
_0807B9D4: .4byte gFaceDirectionIncrements
_0807B9D8: .4byte gAdjacentTileOffsets
_0807B9DC:
ldr r0, _0807BA30
ldr r2, [r0]
lsls r1, r3, 1
ldr r4, _0807BA34
adds r0, r2, r4
adds r0, r1
movs r4, 0
ldrsh r1, [r0, r4]
mov r8, r1
lsls r0, r3, 7
ldr r1, _0807BA38
adds r0, r1
adds r2, r0
mov r9, r2
movs r2, 0x8A
lsls r2, 1
adds r0, r7, r2
ldr r0, [r0]
cmp r0, 0
beq _0807BA40
movs r0, 0x8
bl DungeonRandomCapped
adds r2, r7, 0
adds r2, 0x78
movs r1, 0x6
strb r1, [r2]
ldr r1, _0807BA3C
lsls r0, 2
adds r0, r1
ldrh r1, [r0]
ldrh r3, [r6, 0x4]
adds r1, r3
adds r2, 0x10
strh r1, [r2]
ldrh r0, [r0, 0x2]
ldrh r6, [r6, 0x6]
adds r0, r6
adds r1, r7, 0
adds r1, 0x8A
strh r0, [r1]
b _0807BB60
.align 2, 0
_0807BA30: .4byte gDungeonGlobalData
_0807BA34: .4byte 0x00010844
_0807BA38: .4byte 0x00010884
_0807BA3C: .4byte gAdjacentTileOffsets
_0807BA40:
adds r0, r7, 0
adds r0, 0x78
ldrb r1, [r0]
mov r10, r0
cmp r1, 0x4
beq _0807BAA2
mov r4, r8
cmp r4, 0
bne _0807BA84
movs r0, 0x8
bl DungeonRandomCapped
adds r4, r0, 0
movs r0, 0x6
mov r1, r10
strb r0, [r1]
ldr r0, _0807BA80
lsls r2, r4, 2
adds r2, r0
ldrh r0, [r2]
ldrh r3, [r6, 0x4]
adds r0, r3
adds r1, r7, 0
adds r1, 0x88
strh r0, [r1]
ldrh r0, [r2, 0x2]
ldrh r6, [r6, 0x6]
adds r0, r6
adds r1, 0x2
strh r0, [r1]
b _0807BB60
.align 2, 0
_0807BA80: .4byte gAdjacentTileOffsets
_0807BA84:
movs r5, 0
_0807BA86:
mov r0, r8
bl DungeonRandomCapped
adds r4, r0, 0
ldr r0, [r6, 0x4]
lsls r1, r4, 2
mov r4, r9
adds r2, r1, r4
ldr r1, [r2]
cmp r0, r1
bne _0807BB18
adds r5, 0x1
cmp r5, 0x9
ble _0807BA86
_0807BAA2:
movs r1, 0x4
ldrsh r0, [r6, r1]
movs r2, 0x6
ldrsh r1, [r6, r2]
bl GetMapTile_1
ldrh r1, [r0]
movs r0, 0x8
ands r0, r1
cmp r0, 0
beq _0807BB60
movs r0, 0x8
bl DungeonRandomCapped
adds r4, r0, 0
movs r3, 0
mov r9, r3
_0807BAC4:
movs r0, 0x7
ands r4, r0
movs r0, 0x4
ldrsh r2, [r6, r0]
ldr r0, _0807BB14
lsls r1, r4, 2
adds r1, r0
movs r3, 0
ldrsh r0, [r1, r3]
adds r2, r0
mov r8, r2
movs r0, 0x6
ldrsh r2, [r6, r0]
movs r3, 0x2
ldrsh r0, [r1, r3]
adds r5, r2, r0
mov r0, r8
adds r1, r5, 0
bl GetMapTile_1
ldrb r0, [r0, 0x9]
cmp r0, 0xFF
bne _0807BB04
adds r0, r6, 0
adds r1, r4, 0
mov r2, sp
adds r2, 0x1
bl CanMoveForward
lsls r0, 24
cmp r0, 0
bne _0807BB2E
_0807BB04:
movs r0, 0x1
add r9, r0
adds r4, 0x1
mov r1, r9
cmp r1, 0x7
ble _0807BAC4
b _0807BB60
.align 2, 0
_0807BB14: .4byte gAdjacentTileOffsets
_0807BB18:
movs r0, 0x4
mov r3, r10
strb r0, [r3]
ldrh r1, [r2]
adds r0, r7, 0
adds r0, 0x88
strh r1, [r0]
ldrh r1, [r2, 0x2]
adds r0, 0x2
strh r1, [r0]
b _0807BB60
_0807BB2E:
movs r0, 0x3
mov r4, r10
strb r0, [r4]
adds r0, r7, 0
adds r0, 0x88
mov r1, r8
strh r1, [r0]
adds r0, 0x2
strh r5, [r0]
b _0807BB60
_0807BB42:
movs r0, 0x3
mov r2, r10
strb r0, [r2]
ldr r0, _0807BB74
lsls r1, r4, 2
adds r1, r0
ldrh r0, [r1]
ldrh r3, [r6, 0x4]
adds r0, r3
ldr r4, [sp, 0x8]
strh r0, [r4]
ldrh r0, [r1, 0x2]
_0807BB5A:
ldrh r6, [r6, 0x6]
adds r0, r6
strh r0, [r7]
_0807BB60:
movs r0, 0x1
add sp, 0x10
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
.align 2, 0
_0807BB74: .4byte gAdjacentTileOffsets
thumb_func_end Explore
thumb_func_start sub_807BB78
sub_807BB78:
ldr r3, [r0, 0x70]
adds r1, r3, 0
adds r1, 0x78
movs r2, 0
strb r2, [r1]
adds r1, 0x10
ldr r0, [r0, 0x4]
str r0, [r1]
adds r0, r3, 0
adds r0, 0x80
str r2, [r0]
subs r0, 0x4
strh r2, [r0]
bx lr
thumb_func_end sub_807BB78
.align 2, 0

26
asm/code_807BB78.s Normal file
View File

@ -0,0 +1,26 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_807BB78
sub_807BB78:
ldr r3, [r0, 0x70]
adds r1, r3, 0
adds r1, 0x78
movs r2, 0
strb r2, [r1]
adds r1, 0x10
ldr r0, [r0, 0x4]
str r0, [r1]
adds r0, r3, 0
adds r0, 0x80
str r2, [r0]
subs r0, 0x4
strh r2, [r0]
bx lr
thumb_func_end sub_807BB78
.align 2, 0

View File

@ -81,67 +81,3 @@ gUnknown_80F4CC4: @ 80F4CC4
@ replacing .incbin "baserom.gba", 0x000f4cc4, 0x40
.byte 0x10, 0x48, 0x0f, 0x08, 0x01, 0x00, 0x01, 0x00, 0x30, 0x4b, 0x0f, 0x08, 0x01, 0x00, 0x01, 0x00, 0x9c, 0x49, 0x0f, 0x08, 0x01, 0x00, 0x01, 0x00, 0x30, 0x4b, 0x0f, 0x08, 0x01, 0x00, 0xff, 0xff
.byte 0x10, 0x48, 0x0f, 0x08, 0xff, 0xff, 0xff, 0xff, 0x30, 0x4b, 0x0f, 0x08, 0xff, 0xff, 0xff, 0xff, 0x9c, 0x49, 0x0f, 0x08, 0xff, 0xff, 0xff, 0xff, 0x30, 0x4b, 0x0f, 0x08, 0xff, 0xff, 0x01, 0x00
.global gFaceDirectionIncrements
gFaceDirectionIncrements: @ 80F4D04
@ replacing .incbin "baserom.gba", 0x000f4d04, 0x40
.byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
.global gUnknown_80F4D44
gUnknown_80F4D44: @ 80F4D44
@ replacing .incbin "baserom.gba", 0x000f4d44, 0x20
.byte 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01
.global gUnknown_80F4D64
gUnknown_80F4D64: @ 80F4D64
@ replacing .incbin "baserom.gba", 0x000f4d64, 0x28
.byte 0x02, 0x06, 0x04, 0x00, 0x02, 0x00, 0x04, 0x06, 0x04, 0x00, 0x06, 0x02, 0x04, 0x02, 0x06, 0x00, 0x06, 0x02, 0x00, 0x04, 0x06, 0x04, 0x02, 0x00, 0x00, 0x04, 0x02, 0x06, 0x00, 0x06, 0x02, 0x04
.string "pksdir0\0"
.align 2,0
.global gUnknown_80F4D8C
gUnknown_80F4D8C: @ 80F4D8C
@ replacing .incbin "baserom.gba", 0x000f4d8c, 0x14
.string "mapparam\0"
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_80F4DA0
gUnknown_80F4DA0: @ 80F4DA0
@ replacing .incbin "baserom.gba", 0x000f4da0, 0x2
.byte 0x07, 0x00
.global gUnknown_80F4DA2
gUnknown_80F4DA2: @ 80F4DA2
.byte 0x08, 0x00
.global gUnknown_80F4DA4
gUnknown_80F4DA4: @ 80F4DA4
.byte 0x0C, 0x00
.global gUnknown_80F4DA6
gUnknown_80F4DA6: @ 80F4DA6
.byte 0x0A, 0x00
.global gUnknown_80F4DA8
gUnknown_80F4DA8: @ 80F4DA8
.byte 0x04, 0x00
.global gUnknown_80F4DAA
gUnknown_80F4DAA: @ 80F4DAA
.byte 0x24, 0x00
.global gUnknown_80F4DAC
gUnknown_80F4DAC: @ 80F4DAC
.byte 0x05, 0x00
.global gUnknown_80F4DAE
gUnknown_80F4DAE: @ 80F4DAE
.byte 0x28, 0x00
.global gUnknown_80F4DB0
gUnknown_80F4DB0: @ 80F4DB0
@ replacing .incbin "baserom.gba", 0x000f4db0, 0x2
.byte 0x28, 0x00

59
data/data_80F4D44.s Normal file
View File

@ -0,0 +1,59 @@
.section .rodata
.global gUnknown_80F4D44
gUnknown_80F4D44: @ 80F4D44
@ replacing .incbin "baserom.gba", 0x000f4d44, 0x20
.byte 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x01
.global gUnknown_80F4D64
gUnknown_80F4D64: @ 80F4D64
@ replacing .incbin "baserom.gba", 0x000f4d64, 0x28
.byte 0x02, 0x06, 0x04, 0x00, 0x02, 0x00, 0x04, 0x06, 0x04, 0x00, 0x06, 0x02, 0x04, 0x02, 0x06, 0x00, 0x06, 0x02, 0x00, 0x04, 0x06, 0x04, 0x02, 0x00, 0x00, 0x04, 0x02, 0x06, 0x00, 0x06, 0x02, 0x04
.string "pksdir0\0"
.align 2,0
.global gUnknown_80F4D8C
gUnknown_80F4D8C: @ 80F4D8C
@ replacing .incbin "baserom.gba", 0x000f4d8c, 0x14
.string "mapparam\0"
.align 2,0
.string "pksdir0\0"
.align 2,0
.global gUnknown_80F4DA0
gUnknown_80F4DA0: @ 80F4DA0
@ replacing .incbin "baserom.gba", 0x000f4da0, 0x2
.byte 0x07, 0x00
.global gUnknown_80F4DA2
gUnknown_80F4DA2: @ 80F4DA2
.byte 0x08, 0x00
.global gUnknown_80F4DA4
gUnknown_80F4DA4: @ 80F4DA4
.byte 0x0C, 0x00
.global gUnknown_80F4DA6
gUnknown_80F4DA6: @ 80F4DA6
.byte 0x0A, 0x00
.global gUnknown_80F4DA8
gUnknown_80F4DA8: @ 80F4DA8
.byte 0x04, 0x00
.global gUnknown_80F4DAA
gUnknown_80F4DAA: @ 80F4DAA
.byte 0x24, 0x00
.global gUnknown_80F4DAC
gUnknown_80F4DAC: @ 80F4DAC
.byte 0x05, 0x00
.global gUnknown_80F4DAE
gUnknown_80F4DAE: @ 80F4DAE
.byte 0x28, 0x00
.global gUnknown_80F4DB0
gUnknown_80F4DB0: @ 80F4DB0
@ replacing .incbin "baserom.gba", 0x000f4db0, 0x2
.byte 0x28, 0x00

View File

@ -4,5 +4,6 @@
#include "dungeon_entity.h"
bool8 AvoidEnemies(struct DungeonEntity *pokemon);
bool8 Wander(struct DungeonEntity *pokemon);
#endif

View File

@ -300,7 +300,7 @@ enum MovementAction
{
MOVEMENT_ACTION_FOLLOW = 1,
MOVEMENT_ACTION_WANDER = 2,
MOVEMENT_ACTION_RUN_AWAY_WANDER = 3,
MOVEMENT_ACTION_WANDER_CORRIDOR = 3,
MOVEMENT_ACTION_EXIT_ROOM = 4,
MOVEMENT_ACTION_RUN_AWAY_FROM_ENEMY = 5,
MOVEMENT_ACTION_FACE_RANDOM_DIRECTION = 6,

View File

@ -247,7 +247,7 @@ SECTIONS {
src/dungeon_ai_movement.o(.text);
asm/code_807AEBC.o(.text);
src/dungeon_ai_movement_1.o(.text);
asm/code_807B920.o(.text);
asm/code_807BB78.o(.text);
src/dungeon_ai_attack.o(.text);
asm/code_807CABC.o(.text);
src/targeting_flags.o(.text);
@ -434,6 +434,8 @@ SECTIONS {
data/data_80F4278.o(.rodata);
src/dungeon_util.o(.rodata);
data/data_80F4468.o(.rodata);
src/dungeon_ai_movement_1.o(.rodata);
data/data_80F4D44.o(.rodata);
src/status_checks.o(.rodata);
data/data_80F4DB4.o(.rodata);
src/dungeon_ai_attack.o(.rodata);

View File

@ -13,7 +13,9 @@
#define INFINITY 999999
extern bool8 Explore(struct DungeonEntity *pokemon);
const s32 gFaceDirectionIncrements[] = {0, 1, -1, 2, -2, 3, -3, 4, 0, -1, 1, -2, 2, -3, 3, 4};
extern bool8 IsAtJunction(struct DungeonEntity *pokemon);
bool8 AvoidEnemies(struct DungeonEntity *pokemon)
{
@ -210,6 +212,414 @@ bool8 AvoidEnemies(struct DungeonEntity *pokemon)
}
else
{
return Explore(pokemon);
return Wander(pokemon);
}
}
#ifdef NONMATCHING
bool8 Wander(struct DungeonEntity *pokemon)
{
struct DungeonEntityData *pokemonData = pokemon->entityData;
s32 roomIndex = GetEntityRoomIndex(pokemon);
s32 targetFacingDir;
if (roomIndex == CORRIDOR_ROOM_INDEX)
{
bool8 isAtJunction = FALSE;
s32 oppositeFacingDir = (pokemonData->action.facingDir + NUM_DIRECTIONS / 2) & DIRECTION_MASK;
s32 targetFacingDir2;
s32 i;
if (IsAtJunction(pokemon))
{
pokemonData->action.facingDir = DungeonRandomCapped(NUM_DIRECTIONS);
isAtJunction = TRUE;
}
for (i = 0; i < NUM_DIRECTIONS; i++)
{
bool8 pokemonInFront;
targetFacingDir = (pokemonData->action.facingDir + gFaceDirectionIncrements[i]) & DIRECTION_MASK;
if ((!isAtJunction || targetFacingDir != oppositeFacingDir) &&
CanMoveForward(pokemon, targetFacingDir, &pokemonInFront))
{
pokemonData->movementAction = MOVEMENT_ACTION_WANDER_CORRIDOR;
pokemonData->targetMovePosition.x = pokemon->posWorld.x + gAdjacentTileOffsets[targetFacingDir].x;
pokemonData->targetMovePosition.y = pokemon->posWorld.y + gAdjacentTileOffsets[targetFacingDir].y;
return TRUE;
}
}
targetFacingDir2 = DungeonRandomCapped(NUM_DIRECTIONS);
pokemonData->movementAction = MOVEMENT_ACTION_FACE_RANDOM_DIRECTION;
pokemonData->targetMovePosition.x = pokemon->posWorld.x + gAdjacentTileOffsets[targetFacingDir2].x;
pokemonData->targetMovePosition.y = pokemon->posWorld.y + gAdjacentTileOffsets[targetFacingDir2].y;
}
else
{
s32 numRoomExits = gDungeonGlobalData->numRoomExits[roomIndex];
struct Position *roomExits = gDungeonGlobalData->roomExits[roomIndex];
if (pokemonData->moveRandomly)
{
s32 targetFacingDir = DungeonRandomCapped(NUM_DIRECTIONS);
pokemonData->movementAction = MOVEMENT_ACTION_FACE_RANDOM_DIRECTION;
pokemonData->targetMovePosition.x = pokemon->posWorld.x + gAdjacentTileOffsets[targetFacingDir].x;
pokemonData->targetMovePosition.y = pokemon->posWorld.y + gAdjacentTileOffsets[targetFacingDir].y;
}
else
{
if (pokemonData->movementAction != MOVEMENT_ACTION_EXIT_ROOM)
{
s32 i;
if (numRoomExits == 0)
{
targetFacingDir = DungeonRandomCapped(NUM_DIRECTIONS);
pokemonData->movementAction = MOVEMENT_ACTION_FACE_RANDOM_DIRECTION;
pokemonData->targetMovePosition.x = pokemon->posWorld.x + gAdjacentTileOffsets[targetFacingDir].x;
pokemonData->targetMovePosition.y = pokemon->posWorld.y + gAdjacentTileOffsets[targetFacingDir].y;
return TRUE;
}
do {
for (i = 0; i < 10; i++)
{
targetFacingDir = DungeonRandomCapped(numRoomExits);
if (pokemon->posWorld.x != roomExits[targetFacingDir].x ||
pokemon->posWorld.y != roomExits[targetFacingDir].y)
{
pokemonData->movementAction = MOVEMENT_ACTION_EXIT_ROOM;
pokemonData->targetMovePosition.x = roomExits[targetFacingDir].x;
pokemonData->targetMovePosition.y = roomExits[targetFacingDir].y;
goto a;
return TRUE;
}
}
} while (0);
// If the AI randomly picks the exit it's standing on 10 times,
// it gives up and exits the way it came.
// This occurs normally for one-exit rooms, but can happen rarely for multi-exit rooms.
}
if (GetMapTile_1(pokemon->posWorld.x, pokemon->posWorld.y)->tileType & TILE_TYPE_ROOM_EXIT)
{
s32 i;
targetFacingDir = DungeonRandomCapped(NUM_DIRECTIONS);
for (i = 0; i < NUM_DIRECTIONS; i++, targetFacingDir++)
{
bool8 pokemonInFront;
s32 forwardX, forwardY;
targetFacingDir &= DIRECTION_MASK;
forwardX = pokemon->posWorld.x + gAdjacentTileOffsets[targetFacingDir].x;
forwardY = pokemon->posWorld.y + gAdjacentTileOffsets[targetFacingDir].y;
if (GetMapTile_1(forwardX, forwardY)->roomIndex == CORRIDOR_ROOM_INDEX &&
CanMoveForward(pokemon, targetFacingDir, &pokemonInFront))
{
pokemonData->movementAction = MOVEMENT_ACTION_WANDER_CORRIDOR;
pokemonData->targetMovePosition.x = forwardX;
pokemonData->targetMovePosition.y = forwardY;
a:
return TRUE;
}
}
}
return TRUE;
}
}
return TRUE;
}
#else
NAKED
bool8 Wander(struct DungeonEntity *pokemon)
{
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, 0x10\n"
"adds r6, r0, 0\n"
"ldr r7, [r6, 0x70]\n"
"bl GetEntityRoomIndex\n"
"lsls r0, 24\n"
"lsrs r3, r0, 24\n"
"cmp r3, 0xFF\n"
"bne _0807B9DC\n"
"movs r0, 0\n"
"str r0, [sp, 0x4]\n"
"adds r4, r7, 0\n"
"adds r4, 0x46\n"
"ldrb r0, [r4]\n"
"adds r0, 0x4\n"
"mov r8, r0\n"
"movs r0, 0x7\n"
"mov r1, r8\n"
"ands r1, r0\n"
"mov r8, r1\n"
"adds r0, r6, 0\n"
"bl IsAtJunction\n"
"lsls r0, 24\n"
"mov r9, r4\n"
"cmp r0, 0\n"
"beq _0807B96C\n"
"movs r0, 0x8\n"
"bl DungeonRandomCapped\n"
"strb r0, [r4]\n"
"movs r2, 0x1\n"
"str r2, [sp, 0x4]\n"
"_0807B96C:\n"
"movs r3, 0\n"
"movs r4, 0x78\n"
"adds r4, r7\n"
"mov r10, r4\n"
"adds r0, r7, 0\n"
"adds r0, 0x88\n"
"str r0, [sp, 0x8]\n"
"adds r7, 0x8A\n"
"ldr r5, _0807B9D4\n"
"_0807B97E:\n"
"mov r1, r9\n"
"ldrb r0, [r1]\n"
"ldr r1, [r5]\n"
"adds r4, r0, r1\n"
"movs r0, 0x7\n"
"ands r4, r0\n"
"ldr r2, [sp, 0x4]\n"
"cmp r2, 0\n"
"beq _0807B994\n"
"cmp r4, r8\n"
"beq _0807B9AA\n"
"_0807B994:\n"
"adds r0, r6, 0\n"
"adds r1, r4, 0\n"
"mov r2, sp\n"
"str r3, [sp, 0xC]\n"
"bl CanMoveForward\n"
"lsls r0, 24\n"
"ldr r3, [sp, 0xC]\n"
"cmp r0, 0\n"
"beq _0807B9AA\n"
"b _0807BB42\n"
"_0807B9AA:\n"
"adds r5, 0x4\n"
"adds r3, 0x1\n"
"cmp r3, 0x7\n"
"ble _0807B97E\n"
"movs r0, 0x8\n"
"bl DungeonRandomCapped\n"
"movs r1, 0x6\n"
"mov r3, r10\n"
"strb r1, [r3]\n"
"ldr r1, _0807B9D8\n"
"lsls r0, 2\n"
"adds r0, r1\n"
"ldrh r1, [r0]\n"
"ldrh r4, [r6, 0x4]\n"
"adds r1, r4\n"
"ldr r2, [sp, 0x8]\n"
"strh r1, [r2]\n"
"ldrh r0, [r0, 0x2]\n"
"b _0807BB5A\n"
".align 2, 0\n"
"_0807B9D4: .4byte gFaceDirectionIncrements\n"
"_0807B9D8: .4byte gAdjacentTileOffsets\n"
"_0807B9DC:\n"
"ldr r0, _0807BA30\n"
"ldr r2, [r0]\n"
"lsls r1, r3, 1\n"
"ldr r4, _0807BA34\n"
"adds r0, r2, r4\n"
"adds r0, r1\n"
"movs r4, 0\n"
"ldrsh r1, [r0, r4]\n"
"mov r8, r1\n"
"lsls r0, r3, 7\n"
"ldr r1, _0807BA38\n"
"adds r0, r1\n"
"adds r2, r0\n"
"mov r9, r2\n"
"movs r2, 0x8A\n"
"lsls r2, 1\n"
"adds r0, r7, r2\n"
"ldr r0, [r0]\n"
"cmp r0, 0\n"
"beq _0807BA40\n"
"movs r0, 0x8\n"
"bl DungeonRandomCapped\n"
"adds r2, r7, 0\n"
"adds r2, 0x78\n"
"movs r1, 0x6\n"
"strb r1, [r2]\n"
"ldr r1, _0807BA3C\n"
"lsls r0, 2\n"
"adds r0, r1\n"
"ldrh r1, [r0]\n"
"ldrh r3, [r6, 0x4]\n"
"adds r1, r3\n"
"adds r2, 0x10\n"
"strh r1, [r2]\n"
"ldrh r0, [r0, 0x2]\n"
"ldrh r6, [r6, 0x6]\n"
"adds r0, r6\n"
"adds r1, r7, 0\n"
"adds r1, 0x8A\n"
"strh r0, [r1]\n"
"b _0807BB60\n"
".align 2, 0\n"
"_0807BA30: .4byte gDungeonGlobalData\n"
"_0807BA34: .4byte 0x00010844\n"
"_0807BA38: .4byte 0x00010884\n"
"_0807BA3C: .4byte gAdjacentTileOffsets\n"
"_0807BA40:\n"
"adds r0, r7, 0\n"
"adds r0, 0x78\n"
"ldrb r1, [r0]\n"
"mov r10, r0\n"
"cmp r1, 0x4\n"
"beq _0807BAA2\n"
"mov r4, r8\n"
"cmp r4, 0\n"
"bne _0807BA84\n"
"movs r0, 0x8\n"
"bl DungeonRandomCapped\n"
"adds r4, r0, 0\n"
"movs r0, 0x6\n"
"mov r1, r10\n"
"strb r0, [r1]\n"
"ldr r0, _0807BA80\n"
"lsls r2, r4, 2\n"
"adds r2, r0\n"
"ldrh r0, [r2]\n"
"ldrh r3, [r6, 0x4]\n"
"adds r0, r3\n"
"adds r1, r7, 0\n"
"adds r1, 0x88\n"
"strh r0, [r1]\n"
"ldrh r0, [r2, 0x2]\n"
"ldrh r6, [r6, 0x6]\n"
"adds r0, r6\n"
"adds r1, 0x2\n"
"strh r0, [r1]\n"
"b _0807BB60\n"
".align 2, 0\n"
"_0807BA80: .4byte gAdjacentTileOffsets\n"
"_0807BA84:\n"
"movs r5, 0\n"
"_0807BA86:\n"
"mov r0, r8\n"
"bl DungeonRandomCapped\n"
"adds r4, r0, 0\n"
"ldr r0, [r6, 0x4]\n"
"lsls r1, r4, 2\n"
"mov r4, r9\n"
"adds r2, r1, r4\n"
"ldr r1, [r2]\n"
"cmp r0, r1\n"
"bne _0807BB18\n"
"adds r5, 0x1\n"
"cmp r5, 0x9\n"
"ble _0807BA86\n"
"_0807BAA2:\n"
"movs r1, 0x4\n"
"ldrsh r0, [r6, r1]\n"
"movs r2, 0x6\n"
"ldrsh r1, [r6, r2]\n"
"bl GetMapTile_1\n"
"ldrh r1, [r0]\n"
"movs r0, 0x8\n"
"ands r0, r1\n"
"cmp r0, 0\n"
"beq _0807BB60\n"
"movs r0, 0x8\n"
"bl DungeonRandomCapped\n"
"adds r4, r0, 0\n"
"movs r3, 0\n"
"mov r9, r3\n"
"_0807BAC4:\n"
"movs r0, 0x7\n"
"ands r4, r0\n"
"movs r0, 0x4\n"
"ldrsh r2, [r6, r0]\n"
"ldr r0, _0807BB14\n"
"lsls r1, r4, 2\n"
"adds r1, r0\n"
"movs r3, 0\n"
"ldrsh r0, [r1, r3]\n"
"adds r2, r0\n"
"mov r8, r2\n"
"movs r0, 0x6\n"
"ldrsh r2, [r6, r0]\n"
"movs r3, 0x2\n"
"ldrsh r0, [r1, r3]\n"
"adds r5, r2, r0\n"
"mov r0, r8\n"
"adds r1, r5, 0\n"
"bl GetMapTile_1\n"
"ldrb r0, [r0, 0x9]\n"
"cmp r0, 0xFF\n"
"bne _0807BB04\n"
"adds r0, r6, 0\n"
"adds r1, r4, 0\n"
"mov r2, sp\n"
"adds r2, 0x1\n"
"bl CanMoveForward\n"
"lsls r0, 24\n"
"cmp r0, 0\n"
"bne _0807BB2E\n"
"_0807BB04:\n"
"movs r0, 0x1\n"
"add r9, r0\n"
"adds r4, 0x1\n"
"mov r1, r9\n"
"cmp r1, 0x7\n"
"ble _0807BAC4\n"
"b _0807BB60\n"
".align 2, 0\n"
"_0807BB14: .4byte gAdjacentTileOffsets\n"
"_0807BB18:\n"
"movs r0, 0x4\n"
"mov r3, r10\n"
"strb r0, [r3]\n"
"ldrh r1, [r2]\n"
"adds r0, r7, 0\n"
"adds r0, 0x88\n"
"strh r1, [r0]\n"
"ldrh r1, [r2, 0x2]\n"
"adds r0, 0x2\n"
"strh r1, [r0]\n"
"b _0807BB60\n"
"_0807BB2E:\n"
"movs r0, 0x3\n"
"mov r4, r10\n"
"strb r0, [r4]\n"
"adds r0, r7, 0\n"
"adds r0, 0x88\n"
"mov r1, r8\n"
"strh r1, [r0]\n"
"adds r0, 0x2\n"
"strh r5, [r0]\n"
"b _0807BB60\n"
"_0807BB42:\n"
"movs r0, 0x3\n"
"mov r2, r10\n"
"strb r0, [r2]\n"
"ldr r0, _0807BB74\n"
"lsls r1, r4, 2\n"
"adds r1, r0\n"
"ldrh r0, [r1]\n"
"ldrh r3, [r6, 0x4]\n"
"adds r0, r3\n"
"ldr r4, [sp, 0x8]\n"
"strh r0, [r4]\n"
"ldrh r0, [r1, 0x2]\n"
"_0807BB5A:\n"
"ldrh r6, [r6, 0x6]\n"
"adds r0, r6\n"
"strh r0, [r7]\n"
"_0807BB60:\n"
"movs r0, 0x1\n"
"add sp, 0x10\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"
"_0807BB74: .4byte gAdjacentTileOffsets");
}
#endif