Decomped IsMonsterDrowsy

This commit is contained in:
AnonymousRandomPerson
2025-05-09 00:01:35 -04:00
parent ce66deac4c
commit 167beb68f3
8 changed files with 155 additions and 139 deletions

View File

@@ -6,7 +6,6 @@
.public GetName
.public GetNameRaw
.public GetNameWithGender
.public IsBlinded
.public StringFromId
.public ov29_0234B0B4
.public ov29_023527C0

View File

@@ -0,0 +1,2 @@
#pragma once
.public IsBlinded

View File

@@ -402,140 +402,3 @@ _02300490:
bl ov29_0234B0B4
ldmia sp!, {r3, r4, r5, r6, r7, pc}
arm_func_end ov29_0230040C
arm_func_start IsMonsterDrowsy
IsMonsterDrowsy: ; 0x023004B0
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xbd]
cmp r0, #1
moveq r0, #1
bxeq lr
cmp r0, #3
moveq r0, #1
bxeq lr
cmp r0, #4
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end IsMonsterDrowsy
arm_func_start MonsterHasNonvolatileNonsleepStatus
MonsterHasNonvolatileNonsleepStatus: ; 0x023004E4
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xbf]
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasNonvolatileNonsleepStatus
arm_func_start MonsterHasImmobilizingStatus
MonsterHasImmobilizingStatus: ; 0x02300500
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xc4]
cmp r0, #3
cmpne r0, #5
cmpne r0, #0
movne r0, #1
moveq r0, #0
bx lr
arm_func_end MonsterHasImmobilizingStatus
arm_func_start MonsterHasAttackInterferingStatus
MonsterHasAttackInterferingStatus: ; 0x02300520
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xd0]
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasAttackInterferingStatus
arm_func_start MonsterHasSkillInterferingStatus
MonsterHasSkillInterferingStatus: ; 0x0230053C
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xd8]
cmp r0, #1
moveq r0, #1
bxeq lr
cmp r0, #2
moveq r0, #1
bxeq lr
cmp r0, #4
moveq r0, #1
bxeq lr
cmp r0, #5
moveq r0, #1
bxeq lr
cmp r0, #6
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasSkillInterferingStatus
arm_func_start MonsterHasLeechSeedStatus
MonsterHasLeechSeedStatus: ; 0x02300588
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xe0]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasLeechSeedStatus
arm_func_start MonsterHasWhifferStatus
MonsterHasWhifferStatus: ; 0x023005A4
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xec]
cmp r0, #2
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasWhifferStatus
arm_func_start IsMonsterVisuallyImpaired
IsMonsterVisuallyImpaired: ; 0x023005C0
stmdb sp!, {r4, lr}
ldr r4, [r0, #0xb4]
bl IsBlinded
cmp r0, #0
movne r0, #1
ldmneia sp!, {r4, pc}
ldrb r0, [r4, #0xf1]
cmp r0, #2
moveq r0, #1
ldmeqia sp!, {r4, pc}
cmp r0, #4
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
ldmia sp!, {r4, pc}
arm_func_end IsMonsterVisuallyImpaired
arm_func_start IsMonsterMuzzled
IsMonsterMuzzled: ; 0x023005FC
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xf3]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end IsMonsterMuzzled
arm_func_start MonsterHasMiracleEyeStatus
MonsterHasMiracleEyeStatus: ; 0x02300618
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xf5]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasMiracleEyeStatus

124
asm/overlay_29_023004E4.s Normal file
View File

@@ -0,0 +1,124 @@
.include "asm/macros.inc"
.include "overlay_29_023004E4.inc"
.text
arm_func_start MonsterHasNonvolatileNonsleepStatus
MonsterHasNonvolatileNonsleepStatus: ; 0x023004E4
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xbf]
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasNonvolatileNonsleepStatus
arm_func_start MonsterHasImmobilizingStatus
MonsterHasImmobilizingStatus: ; 0x02300500
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xc4]
cmp r0, #3
cmpne r0, #5
cmpne r0, #0
movne r0, #1
moveq r0, #0
bx lr
arm_func_end MonsterHasImmobilizingStatus
arm_func_start MonsterHasAttackInterferingStatus
MonsterHasAttackInterferingStatus: ; 0x02300520
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xd0]
cmp r0, #0
movne r0, #1
moveq r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasAttackInterferingStatus
arm_func_start MonsterHasSkillInterferingStatus
MonsterHasSkillInterferingStatus: ; 0x0230053C
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xd8]
cmp r0, #1
moveq r0, #1
bxeq lr
cmp r0, #2
moveq r0, #1
bxeq lr
cmp r0, #4
moveq r0, #1
bxeq lr
cmp r0, #5
moveq r0, #1
bxeq lr
cmp r0, #6
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasSkillInterferingStatus
arm_func_start MonsterHasLeechSeedStatus
MonsterHasLeechSeedStatus: ; 0x02300588
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xe0]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasLeechSeedStatus
arm_func_start MonsterHasWhifferStatus
MonsterHasWhifferStatus: ; 0x023005A4
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xec]
cmp r0, #2
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasWhifferStatus
arm_func_start IsMonsterVisuallyImpaired
IsMonsterVisuallyImpaired: ; 0x023005C0
stmdb sp!, {r4, lr}
ldr r4, [r0, #0xb4]
bl IsBlinded
cmp r0, #0
movne r0, #1
ldmneia sp!, {r4, pc}
ldrb r0, [r4, #0xf1]
cmp r0, #2
moveq r0, #1
ldmeqia sp!, {r4, pc}
cmp r0, #4
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
ldmia sp!, {r4, pc}
arm_func_end IsMonsterVisuallyImpaired
arm_func_start IsMonsterMuzzled
IsMonsterMuzzled: ; 0x023005FC
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xf3]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end IsMonsterMuzzled
arm_func_start MonsterHasMiracleEyeStatus
MonsterHasMiracleEyeStatus: ; 0x02300618
ldr r0, [r0, #0xb4]
ldrb r0, [r0, #0xf5]
cmp r0, #1
moveq r0, #1
movne r0, #0
and r0, r0, #0xff
bx lr
arm_func_end MonsterHasMiracleEyeStatus

View File

@@ -0,0 +1,9 @@
#ifndef PMDSKY_DUNGEON_LOGIC_0_H
#define PMDSKY_DUNGEON_LOGIC_0_H
#include "dungeon_mode.h"
// Checks if a monster has the sleep, nightmare, or yawning status. Note that this excludes the napping status.
bool8 IsMonsterDrowsy(struct entity *monster);
#endif //PMDSKY_DUNGEON_LOGIC_0_H

View File

@@ -296,6 +296,8 @@ Overlay OVY_29
Object asm/overlay_29_022FF8C8.o
Object src/overlay_29_023000E4.o
Object asm/overlay_29_02300108.o
Object src/dungeon_logic_0.o
Object asm/overlay_29_023004E4.o
Object src/dungeon_logic.o
Object asm/overlay_29_023007A8.o
Object src/dungeon_capabilities.o

View File

@@ -1,7 +1,7 @@
#include "dungeon_logic.h"
#include "dungeon_logic_0.h"
#include "dungeon_util_static.h"
extern bool8 IsMonsterDrowsy(struct entity *monster);
extern bool8 MonsterHasNonvolatileNonsleepStatus(struct entity *monster);
extern bool8 MonsterHasImmobilizingStatus(struct entity *monster);
extern bool8 MonsterHasAttackInterferingStatus(struct entity *monster);

17
src/dungeon_logic_0.c Normal file
View File

@@ -0,0 +1,17 @@
#include "dungeon_logic_0.h"
#include "dungeon_util_static.h"
bool8 IsMonsterDrowsy(struct entity *monster)
{
struct monster *pokemon_info = GetEntInfo(monster);
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_SLEEP)
return TRUE;
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_NIGHTMARE)
return TRUE;
if (pokemon_info->sleep_class_status.sleep == STATUS_SLEEP_YAWNING)
return TRUE;
return FALSE;
}