mirror of
https://github.com/pret/pmd-red.git
synced 2026-06-16 13:40:31 -05:00
Decomped HasNegativeStatus()
This commit is contained in:
parent
3cdde2a92a
commit
cbf41c6bf3
|
|
@ -1397,165 +1397,4 @@ _08070A50: .4byte gRecruitedPokemonRef
|
|||
_08070A54: .4byte 0x00008df8
|
||||
thumb_func_end sub_80709C8
|
||||
|
||||
thumb_func_start HasNegativeStatus
|
||||
HasNegativeStatus:
|
||||
push {r4,lr}
|
||||
ldr r0, [r0, 0x70]
|
||||
mov r12, r0
|
||||
adds r0, 0xA8
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _08070ADE
|
||||
cmp r0, 0x3
|
||||
beq _08070ADE
|
||||
cmp r0, 0x4
|
||||
beq _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xAC
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xB0
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x5
|
||||
beq _08070A86
|
||||
cmp r0, 0
|
||||
bne _08070ADE
|
||||
_08070A86:
|
||||
mov r0, r12
|
||||
adds r0, 0xBC
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xC8
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _08070ADE
|
||||
cmp r0, 0x2
|
||||
beq _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xD0
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xDC
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x2
|
||||
beq _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xE8
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _08070ADE
|
||||
cmp r0, 0x2
|
||||
beq _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xEC
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xF5
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _08070ADE
|
||||
mov r0, r12
|
||||
adds r0, 0xFD
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
beq _08070AE2
|
||||
_08070ADE:
|
||||
movs r0, 0x1
|
||||
b _08070B1E
|
||||
_08070AE2:
|
||||
movs r3, 0
|
||||
movs r4, 0x1
|
||||
movs r2, 0x8C
|
||||
lsls r2, 1
|
||||
add r2, r12
|
||||
_08070AEC:
|
||||
ldrb r1, [r2]
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08070B00
|
||||
ldrb r1, [r2, 0x1]
|
||||
adds r0, r4, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _08070ADE
|
||||
_08070B00:
|
||||
adds r2, 0x8
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x3
|
||||
ble _08070AEC
|
||||
movs r3, 0
|
||||
ldr r1, _08070B24
|
||||
add r1, r12
|
||||
_08070B0E:
|
||||
adds r0, r1, r3
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0
|
||||
bne _08070ADE
|
||||
adds r3, 0x1
|
||||
cmp r3, 0x4
|
||||
ble _08070B0E
|
||||
movs r0, 0
|
||||
_08070B1E:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.align 2, 0
|
||||
_08070B24: .4byte 0x0000010d
|
||||
thumb_func_end HasNegativeStatus
|
||||
|
||||
thumb_func_start IsSleeping
|
||||
IsSleeping:
|
||||
push {lr}
|
||||
ldr r0, [r0, 0x70]
|
||||
adds r0, 0xA8
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _08070B40
|
||||
cmp r0, 0x5
|
||||
beq _08070B40
|
||||
cmp r0, 0x3
|
||||
beq _08070B40
|
||||
movs r0, 0
|
||||
b _08070B42
|
||||
_08070B40:
|
||||
movs r0, 0x1
|
||||
_08070B42:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end IsSleeping
|
||||
|
||||
thumb_func_start HasQuarterHPOrLess
|
||||
HasQuarterHPOrLess:
|
||||
push {lr}
|
||||
ldr r0, [r0, 0x70]
|
||||
adds r1, r0, 0
|
||||
movs r2, 0x10
|
||||
ldrsh r0, [r1, r2]
|
||||
cmp r0, 0
|
||||
bge _08070B58
|
||||
adds r0, 0x3
|
||||
_08070B58:
|
||||
movs r2, 0xE
|
||||
ldrsh r1, [r1, r2]
|
||||
asrs r0, 2
|
||||
cmp r1, r0
|
||||
ble _08070B66
|
||||
movs r0, 0
|
||||
b _08070B68
|
||||
_08070B66:
|
||||
movs r0, 0x1
|
||||
_08070B68:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end HasQuarterHPOrLess
|
||||
|
||||
.align 2, 0
|
||||
.align 2, 0
|
||||
54
asm/code_8070B28.s
Normal file
54
asm/code_8070B28.s
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#include "asm/constants/gba_constants.inc"
|
||||
#include "asm/macros.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start IsSleeping
|
||||
IsSleeping:
|
||||
push {lr}
|
||||
ldr r0, [r0, 0x70]
|
||||
adds r0, 0xA8
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0x1
|
||||
beq _08070B40
|
||||
cmp r0, 0x5
|
||||
beq _08070B40
|
||||
cmp r0, 0x3
|
||||
beq _08070B40
|
||||
movs r0, 0
|
||||
b _08070B42
|
||||
_08070B40:
|
||||
movs r0, 0x1
|
||||
_08070B42:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end IsSleeping
|
||||
|
||||
thumb_func_start HasQuarterHPOrLess
|
||||
HasQuarterHPOrLess:
|
||||
push {lr}
|
||||
ldr r0, [r0, 0x70]
|
||||
adds r1, r0, 0
|
||||
movs r2, 0x10
|
||||
ldrsh r0, [r1, r2]
|
||||
cmp r0, 0
|
||||
bge _08070B58
|
||||
adds r0, 0x3
|
||||
_08070B58:
|
||||
movs r2, 0xE
|
||||
ldrsh r1, [r1, r2]
|
||||
asrs r0, 2
|
||||
cmp r1, r0
|
||||
ble _08070B66
|
||||
movs r0, 0
|
||||
b _08070B68
|
||||
_08070B66:
|
||||
movs r0, 0x1
|
||||
_08070B68:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end HasQuarterHPOrLess
|
||||
|
||||
.align 2, 0
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
#include "item.h"
|
||||
#include "position.h"
|
||||
|
||||
#define NUM_SPEED_TURN_COUNTERS 5
|
||||
|
||||
struct DungeonActionContainer
|
||||
{
|
||||
/* 0x0 */ u16 action;
|
||||
|
|
@ -167,8 +169,8 @@ struct DungeonEntityData
|
|||
/* 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
|
||||
// speed-up/slow effects at once, like using Agility twice.
|
||||
/* 0x108 */ u8 speedUpTurnsLeft[5];
|
||||
/* 0x10D */ u8 slowTurnsLeft[5];
|
||||
/* 0x108 */ u8 speedUpTurnsLeft[NUM_SPEED_TURN_COUNTERS];
|
||||
/* 0x10D */ u8 slowTurnsLeft[NUM_SPEED_TURN_COUNTERS];
|
||||
/* 0x112 */ u8 stockpileCount;
|
||||
u8 fill113;
|
||||
// When true, an AI Pokémon will move in a random direction every turn.
|
||||
|
|
|
|||
9
include/status_checks.h
Normal file
9
include/status_checks.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef GUARD_STATUS_CHECKS_H
|
||||
#define GUARD_STATUS_CHECKS_H
|
||||
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
// 0x70A58
|
||||
bool8 HasNegativeStatus(struct DungeonEntity *pokemon);
|
||||
|
||||
#endif
|
||||
|
|
@ -208,6 +208,8 @@ SECTIONS {
|
|||
src/code_806CD90.o(.text);
|
||||
asm/code_806CD90.o(.text);
|
||||
asm/code_807001C.o(.text);
|
||||
src/status_checks.o(.text);
|
||||
asm/code_8070B28.o(.text);
|
||||
src/dungeon_capabilities.o(.text);
|
||||
asm/code_8070BC0.o(.text);
|
||||
src/dungeon_capabilities_1.o(.text);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,7 @@
|
|||
#include "dungeon_util.h"
|
||||
#include "moves.h"
|
||||
#include "number_util.h"
|
||||
|
||||
extern bool8 HasNegativeStatus(struct DungeonEntity*);
|
||||
#include "status_checks.h"
|
||||
|
||||
u32 EvaluateItem(struct DungeonEntity *targetPokemon, struct ItemSlot *item, u32 itemTargetFlags)
|
||||
{
|
||||
|
|
@ -96,7 +95,7 @@ u32 EvaluateItem(struct DungeonEntity *targetPokemon, struct ItemSlot *item, u32
|
|||
}
|
||||
}
|
||||
}
|
||||
if (itemWeight > 98)
|
||||
if (itemWeight >= 99)
|
||||
{
|
||||
itemWeight = 99;
|
||||
}
|
||||
|
|
|
|||
44
src/status_checks.c
Normal file
44
src/status_checks.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "global.h"
|
||||
#include "status_checks.h"
|
||||
|
||||
#include "constants/status.h"
|
||||
|
||||
bool8 HasNegativeStatus(struct DungeonEntity *pokemon)
|
||||
{
|
||||
struct DungeonEntityData *pokemonData = pokemon->entityData;
|
||||
s32 i;
|
||||
if (pokemonData->sleepStatus == SLEEP_STATUS_SLEEP ||
|
||||
pokemonData->sleepStatus == SLEEP_STATUS_NIGHTMARE ||
|
||||
pokemonData->sleepStatus == SLEEP_STATUS_YAWNING ||
|
||||
pokemonData->nonVolatileStatus != NON_VOLATILE_STATUS_NONE ||
|
||||
(pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_INGRAIN && pokemonData->immobilizeStatus != IMMOBILIZE_STATUS_NONE) ||
|
||||
pokemonData->volatileStatus != VOLATILE_STATUS_NONE ||
|
||||
pokemonData->waitingStatus == WAITING_STATUS_CURSED ||
|
||||
pokemonData->waitingStatus == WAITING_STATUS_DECOY ||
|
||||
pokemonData->linkedStatus == LINKED_STATUS_LEECH_SEED ||
|
||||
pokemonData->moveStatus == MOVE_STATUS_WHIFFER ||
|
||||
pokemonData->eyesightStatus == EYESIGHT_STATUS_BLINKER ||
|
||||
pokemonData->eyesightStatus == EYESIGHT_STATUS_CROSS_EYED ||
|
||||
pokemonData->muzzledStatus == MUZZLED_STATUS_MUZZLED ||
|
||||
pokemonData->exposedStatus ||
|
||||
pokemonData->perishSongTimer != 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
struct PokemonMove *moves = pokemonData->moves;
|
||||
if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].sealed & TRUE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < NUM_SPEED_TURN_COUNTERS; i++)
|
||||
{
|
||||
if (pokemonData->slowTurnsLeft[i] != 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user