mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-18 23:06:53 -05:00
decomp a few more
This commit is contained in:
@@ -7184,7 +7184,7 @@ _080560CC:
|
||||
.align 2, 0
|
||||
_08056108: .4byte gDungeonGlobalData
|
||||
_0805610C: .4byte 0x00003a0e
|
||||
_08056110: .4byte gUnknown_80F5D10
|
||||
_08056110: .4byte gNaturePowerMoveTable
|
||||
_08056114: .4byte gUnknown_80FECE0
|
||||
_08056118: .4byte gAvailablePokemonNames
|
||||
_0805611C: .4byte gUnknown_202DE58
|
||||
|
||||
@@ -96,156 +96,4 @@ _080571DE:
|
||||
_080571EC: .4byte 0x00000163
|
||||
thumb_func_end sub_8057144
|
||||
|
||||
thumb_func_start sub_80571F0
|
||||
sub_80571F0:
|
||||
push {lr}
|
||||
ldr r0, [r0, 0x70]
|
||||
adds r2, r0, 0
|
||||
adds r2, 0xFF
|
||||
ldrb r2, [r2]
|
||||
cmp r2, 0x1
|
||||
bne _08057212
|
||||
ldrh r1, [r1, 0x2]
|
||||
cmp r1, 0x88
|
||||
beq _08057274
|
||||
cmp r1, 0xA2
|
||||
beq _08057274
|
||||
cmp r1, 0x39
|
||||
beq _08057274
|
||||
cmp r1, 0x40
|
||||
beq _08057274
|
||||
b _08057264
|
||||
_08057212:
|
||||
cmp r2, 0x2
|
||||
bne _08057274
|
||||
adds r0, 0xC0
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x9
|
||||
bne _0805722A
|
||||
ldrh r1, [r1, 0x2]
|
||||
cmp r1, 0x20
|
||||
beq _08057274
|
||||
cmp r1, 0xDB
|
||||
bne _08057264
|
||||
b _08057274
|
||||
_0805722A:
|
||||
cmp r0, 0xA
|
||||
bne _08057264
|
||||
ldrh r1, [r1, 0x2]
|
||||
cmp r1, 0x76
|
||||
beq _08057274
|
||||
movs r0, 0x94
|
||||
lsls r0, 1
|
||||
cmp r1, r0
|
||||
beq _08057274
|
||||
cmp r1, 0x77
|
||||
bne _08057264
|
||||
ldr r0, _08057268
|
||||
ldr r0, [r0]
|
||||
ldr r1, _0805726C
|
||||
adds r0, r1
|
||||
movs r2, 0
|
||||
ldrsh r1, [r0, r2]
|
||||
cmp r1, 0
|
||||
bge _08057252
|
||||
movs r1, 0
|
||||
_08057252:
|
||||
cmp r1, 0x4A
|
||||
ble _08057258
|
||||
movs r1, 0x4A
|
||||
_08057258:
|
||||
ldr r0, _08057270
|
||||
lsls r1, 3
|
||||
adds r1, r0
|
||||
ldrh r0, [r1]
|
||||
cmp r0, 0x76
|
||||
beq _08057274
|
||||
_08057264:
|
||||
movs r0, 0x1
|
||||
b _08057276
|
||||
.align 2, 0
|
||||
_08057268: .4byte gDungeonGlobalData
|
||||
_0805726C: .4byte 0x00003a0e
|
||||
_08057270: .4byte gUnknown_80F5D10
|
||||
_08057274:
|
||||
movs r0, 0
|
||||
_08057276:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_80571F0
|
||||
|
||||
thumb_func_start sub_805727C
|
||||
sub_805727C:
|
||||
push {r4-r6,lr}
|
||||
adds r6, r0, 0
|
||||
adds r5, r1, 0
|
||||
adds r4, r2, 0
|
||||
bl sub_8044B28
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _080572FC
|
||||
adds r0, r6, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080572FC
|
||||
adds r0, r5, 0
|
||||
bl EntityExists
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080572FC
|
||||
ldr r1, [r5, 0x70]
|
||||
movs r2, 0xAC
|
||||
lsls r2, 1
|
||||
adds r0, r1, r2
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _080572FC
|
||||
movs r2, 0xE
|
||||
ldrsh r0, [r1, r2]
|
||||
cmp r0, 0
|
||||
beq _080572FC
|
||||
cmp r4, 0
|
||||
beq _080572DE
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x26
|
||||
bl HasAbility
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _080572D2
|
||||
lsls r0, r4, 1
|
||||
b _080572D4
|
||||
_080572D2:
|
||||
adds r0, r4, 0
|
||||
_080572D4:
|
||||
bl RollPercentChance_2
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
b _080572E0
|
||||
_080572DE:
|
||||
movs r4, 0x1
|
||||
_080572E0:
|
||||
cmp r4, 0
|
||||
beq _08057300
|
||||
cmp r6, r5
|
||||
beq _08057300
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x4C
|
||||
bl HasAbility
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
beq _08057300
|
||||
adds r0, r5, 0
|
||||
bl sub_80429C8
|
||||
_080572FC:
|
||||
movs r0, 0
|
||||
b _08057302
|
||||
_08057300:
|
||||
adds r0, r4, 0
|
||||
_08057302:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_805727C
|
||||
|
||||
.align 2, 0
|
||||
|
||||
@@ -2446,7 +2446,7 @@ _08058F7E:
|
||||
.align 2, 0
|
||||
_08058FB0: .4byte gDungeonGlobalData
|
||||
_08058FB4: .4byte 0x00003a0e
|
||||
_08058FB8: .4byte gUnknown_80F5D10
|
||||
_08058FB8: .4byte gNaturePowerMoveTable
|
||||
thumb_func_end sub_8058F58
|
||||
|
||||
thumb_func_start sub_8058FBC
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
gUnknown_80F59C8: @ 80F59C8
|
||||
.incbin "baserom.gba", 0xF59C8, 0x348
|
||||
|
||||
.global gUnknown_80F5D10
|
||||
gUnknown_80F5D10: @ 80F5D10
|
||||
.global gNaturePowerMoveTable
|
||||
gNaturePowerMoveTable: @ 80F5D10
|
||||
.incbin "baserom.gba", 0xF5D10, 0x260
|
||||
|
||||
.global gUnknown_80F5F70
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
void MoveIfPossible(struct DungeonEntity *pokemon, bool8 showRunAwayEffect);
|
||||
bool8 CanTakeItem(struct DungeonEntity *pokemon);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -170,7 +170,8 @@ struct DungeonEntityData
|
||||
// This is done by going to the teammate's held item in the toolbox and selecting "Use".
|
||||
/* 0xFC */ bool8 useHeldItem;
|
||||
/* 0xFD */ u8 perishSongTimer; // When this reaches 0, the Pokémon faints from Perish Song. Doubles as a bool for whether the Pokémon is afflicted by Perish Song.
|
||||
u8 fillFE[0x100 - 0xFE];
|
||||
u8 unkFE;
|
||||
u8 unkFF;
|
||||
/* 0x100 */ u8 targetingDecoy; // If the Pokémon is targeting a decoy, this indicates whether the decoy target is a team or wild Pokémon.
|
||||
/* 0x104 */ s32 movementSpeed;
|
||||
// The turn counter for movement speed up/down is split into five timers each. Multiple timers are used if the Pokémon is affected by multiple
|
||||
@@ -195,7 +196,9 @@ struct DungeonEntityData
|
||||
/* 0x14E */ u16 visualFlags;
|
||||
/* 0x150 */ u16 previousVisualFlags;
|
||||
/* 0x152 */ u8 unk152;
|
||||
u8 fill153[0x15A - 0x153];
|
||||
u8 fill153[0x158 - 0x153];
|
||||
u8 unk158;
|
||||
u8 unk159;
|
||||
u8 unk15A;
|
||||
u8 unk15B;
|
||||
u8 unk15C;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "number_util.h"
|
||||
#include "map.h"
|
||||
|
||||
extern bool8 CanTakeItem(struct DungeonEntity *pokemon);
|
||||
extern bool8 ChooseTargetPosition(struct DungeonEntity *pokemon);
|
||||
extern void DecideMovement(struct DungeonEntity *pokemon, bool8 showRunAwayEffect);
|
||||
|
||||
@@ -97,9 +96,9 @@ bool8 CanTakeItem(struct DungeonEntity *pokemon)
|
||||
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)) {
|
||||
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))) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,82 @@
|
||||
#include "dungeon_util.h"
|
||||
#include "dungeon_pokemon_attributes.h"
|
||||
#include "dungeon_random.h"
|
||||
#include "dungeon_global_data.h"
|
||||
|
||||
|
||||
extern bool8 sub_8044B28(void);
|
||||
extern void sub_80429C8(struct DungeonEntity *r0);
|
||||
extern u16 gNaturePowerMoveTable[];
|
||||
|
||||
bool8 sub_80571F0(struct DungeonEntity * pokemon, struct PokemonMove *move)
|
||||
{
|
||||
u16 moveID;
|
||||
s32 tileset;
|
||||
struct DungeonEntityData *entityData;
|
||||
|
||||
entityData = pokemon->entityData;
|
||||
|
||||
if (entityData->unkFF == 1) {
|
||||
moveID = move->moveID;
|
||||
if ((moveID == MOVE_SKY_UPPERCUT) || (moveID == MOVE_TWISTER) || (moveID == MOVE_GUST) || (moveID == MOVE_THUNDER))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
else if (entityData->unkFF == 2) {
|
||||
if (entityData->chargingStatus == CHARGING_STATUS_DIVE) {
|
||||
if (move->moveID == MOVE_WHIRLPOOL || move->moveID == MOVE_SURF) return FALSE;
|
||||
}
|
||||
else if (entityData->chargingStatus == CHARGING_STATUS_DIG) {
|
||||
moveID = move->moveID;
|
||||
if (moveID == MOVE_EARTHQUAKE || moveID == MOVE_MAGNITUDE) return FALSE;
|
||||
if (moveID == MOVE_NATURE_POWER) {
|
||||
tileset = gDungeonGlobalData->tileset;
|
||||
if (tileset < 0) {
|
||||
tileset = 0;
|
||||
}
|
||||
if (0x4a < tileset) {
|
||||
tileset = 0x4a;
|
||||
}
|
||||
if (gNaturePowerMoveTable[tileset << 2] == MOVE_EARTHQUAKE) return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_805727C(struct DungeonEntity * pokemon, struct DungeonEntity * target, s32 chance)
|
||||
{
|
||||
bool8 uVar2;
|
||||
if (!sub_8044B28() && EntityExists(pokemon) && EntityExists(target) &&
|
||||
(target->entityData->unk158 != 0) &&
|
||||
(target->entityData->HP != 0)) {
|
||||
if (chance != 0) {
|
||||
if (HasAbility(pokemon, ABILITY_SERENE_GRACE)) {
|
||||
uVar2 = RollPercentChance_2(chance * 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
uVar2 = RollPercentChance_2(chance);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uVar2 = TRUE;
|
||||
}
|
||||
if ((uVar2 != 0) && (pokemon != target) && HasAbility(target, ABILITY_SHIELD_DUST))
|
||||
{
|
||||
sub_80429C8(target);
|
||||
end:
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return uVar2;
|
||||
}
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
bool8 sub_8057308(struct DungeonEntity *pokemon, s32 chance)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user