mirror of
https://github.com/pret/pmd-red.git
synced 2026-10-02 13:58:56 -05:00
decomp a few funcs
This commit is contained in:
@@ -5,82 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start CanTakeItem
|
||||
CanTakeItem:
|
||||
push {r4-r6,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r5, [r4, 0x70]
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _0807AF50
|
||||
adds r0, r4, 0
|
||||
bl CannotUseItems
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0807AF50
|
||||
adds r0, r4, 0
|
||||
bl GetMapTileForDungeonEntity_2
|
||||
adds r6, r0, 0
|
||||
ldr r4, [r6, 0x14]
|
||||
cmp r4, 0
|
||||
beq _0807AF50
|
||||
adds r0, r4, 0
|
||||
bl GetEntityType
|
||||
cmp r0, 0x5
|
||||
bhi _0807AF50
|
||||
lsls r0, 2
|
||||
ldr r1, _0807AEFC
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.align 2, 0
|
||||
_0807AEFC: .4byte _0807AF00
|
||||
.align 2, 0
|
||||
_0807AF00:
|
||||
.4byte _0807AF50
|
||||
.4byte _0807AF50
|
||||
.4byte _0807AF50
|
||||
.4byte _0807AF18
|
||||
.4byte _0807AF50
|
||||
.4byte _0807AF50
|
||||
_0807AF18:
|
||||
ldrb r0, [r5, 0x7]
|
||||
cmp r0, 0
|
||||
bne _0807AF50
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x60
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807AF50
|
||||
ldrh r1, [r6]
|
||||
movs r0, 0x3
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807AF3C
|
||||
ldrb r0, [r5, 0x6]
|
||||
cmp r0, 0
|
||||
bne _0807AF50
|
||||
_0807AF3C:
|
||||
adds r0, r4, 0
|
||||
bl GetItemData
|
||||
ldrb r1, [r0]
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0807AF50
|
||||
movs r0, 0x1
|
||||
b _0807AF52
|
||||
_0807AF50:
|
||||
movs r0, 0
|
||||
_0807AF52:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end CanTakeItem
|
||||
|
||||
thumb_func_start ChooseTargetPosition
|
||||
ChooseTargetPosition:
|
||||
push {r4-r7,lr}
|
||||
@@ -944,4 +868,4 @@ _0807B5CE:
|
||||
bx r0
|
||||
thumb_func_end DecideMovement
|
||||
|
||||
.align 2, 0
|
||||
.align 2, 0
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#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
|
||||
@@ -246,7 +246,6 @@ SECTIONS {
|
||||
src/dungeon_ai_movement.o(.text);
|
||||
asm/code_807AEBC.o(.text);
|
||||
src/dungeon_ai_movement_1.o(.text);
|
||||
asm/code_807BB78.o(.text);
|
||||
src/dungeon_ai_attack.o(.text);
|
||||
asm/code_807CABC.o(.text);
|
||||
src/targeting_flags.o(.text);
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
#include "constants/dungeon_action.h"
|
||||
#include "constants/tactic.h"
|
||||
#include "dungeon_action.h"
|
||||
#include "dungeon_capabilities_1.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_ai_movement_1.h"
|
||||
#include "dungeon_ai_targeting.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "item.h"
|
||||
#include "number_util.h"
|
||||
#include "map.h"
|
||||
|
||||
extern bool8 CanTakeItem(struct DungeonEntity *pokemon);
|
||||
extern bool8 ChooseTargetPosition(struct DungeonEntity *pokemon);
|
||||
@@ -72,3 +76,34 @@ void MoveIfPossible(struct DungeonEntity *pokemon, bool8 showRunAwayEffect)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool8 CanTakeItem(struct DungeonEntity *pokemon)
|
||||
{
|
||||
struct MapTile *mapTile;
|
||||
struct ItemSlot *item;
|
||||
struct DungeonEntity *mapEntity;
|
||||
struct DungeonEntityData *entityData;
|
||||
|
||||
entityData = pokemon->entityData;
|
||||
if (EntityExists(pokemon) && !CannotUseItems(pokemon)) {
|
||||
mapTile = GetMapTileForDungeonEntity_2(pokemon);
|
||||
mapEntity = mapTile->mapObject;
|
||||
if (mapEntity != NULL) {
|
||||
switch(GetEntityType(mapEntity)) {
|
||||
case ENTITY_NONE:
|
||||
case ENTITY_POKEMON:
|
||||
case ENTITY_TRAP:
|
||||
case 4:
|
||||
case 5:
|
||||
break;
|
||||
case ENTITY_ITEM:
|
||||
if ((((!entityData->isLeader) && !(entityData->heldItem.itemFlags & ITEM_FLAG_EXISTS)) &&
|
||||
(((mapTile->tileType & (TILE_TYPE_FLOOR | TILE_TYPE_LIQUID)) || (!entityData->isEnemy)))) &&
|
||||
(item = GetItemData(mapEntity), (item->itemFlags & ITEM_FLAG_FOR_SALE) == 0)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -618,3 +618,14 @@ bool8 Wander(struct DungeonEntity *pokemon)
|
||||
"_0807BB74: .4byte gAdjacentTileOffsets");
|
||||
}
|
||||
#endif
|
||||
|
||||
void sub_807BB78(struct DungeonEntity *pokemon)
|
||||
{
|
||||
struct DungeonEntityData *entityData;
|
||||
|
||||
entityData = pokemon->entityData;
|
||||
entityData->movementAction = 0;
|
||||
entityData->targetMovePosition = pokemon->posWorld;
|
||||
entityData->targetPokemon = 0;
|
||||
entityData->targetPokemonSpawnIndex = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user