Decomped GetVisibilityRange

This commit is contained in:
AnonymousRandomPerson 2025-03-12 23:57:27 -04:00
parent 6e0a890e51
commit 8305ee8a40
6 changed files with 16 additions and 20 deletions

View File

@ -1,25 +1,8 @@
.include "asm/macros.inc"
.include "overlay_29_022E333C.inc"
.include "overlay_29_022E335C.inc"
.text
arm_func_start GetVisibilityRange
GetVisibilityRange: ; 0x022E333C
ldr r0, _022E3358 ; =DUNGEON_PTR
ldr r0, [r0]
add r0, r0, #0x1a000
#ifdef JAPAN
ldrb r0, [r0, #0x199]
#else
ldrb r0, [r0, #0x23d]
#endif
cmp r0, #0
moveq r0, #2
bx lr
.align 2, 0
_022E3358: .word DUNGEON_PTR
arm_func_end GetVisibilityRange
arm_func_start ov29_022E335C
ov29_022E335C: ; 0x022E335C
#ifdef JAPAN

View File

@ -7,5 +7,6 @@
bool8 EntityIsValid__022E32E8(struct entity *entity);
// Checks if a monster is holding a certain item that isn't disabled by Klutz.
bool8 ItemIsActive__022E330C(struct entity *entity, enum item_id item_id);
s16 GetVisibilityRange();
#endif //PMDSKY_OVERLAY_29_022E32E8_H

View File

@ -240,7 +240,7 @@ Overlay OVY_29
Object src/dungeon_visibility.o
Object asm/overlay_29_022E2810.o
Object src/dg_camera.o
Object asm/overlay_29_022E333C.o
Object asm/overlay_29_022E335C.o
Object src/dg_effect.o
Object asm/overlay_29_022E37DC.o
Object src/dungeon_range.o

View File

@ -1,7 +1,10 @@
#include "dg_camera.h"
#include "dungeon.h"
#include "dungeon_items.h"
#include "dungeon_pokemon_attributes.h"
extern struct dungeon *DUNGEON_PTR[];
// file starts at 0x022e26b68
bool8 EntityIsValid__022E32E8(struct entity *entity)
@ -19,3 +22,12 @@ bool8 ItemIsActive__022E330C(struct entity *entity, enum item_id item_id)
return HasHeldItem(entity, item_id);
}
s16 GetVisibilityRange()
{
s16 visibility_range = DUNGEON_PTR[0]->display_data.visibility_range;
if (visibility_range == 0)
return 2;
return visibility_range;
}

View File

@ -1,10 +1,10 @@
#include "dungeon_range.h"
#include "dg_camera.h"
#include "dungeon.h"
#include "map.h"
extern struct dungeon *DUNGEON_PTR[];
extern s16 GetVisibilityRange();
extern struct tile* GetTile(int x, int y);
extern s32 abs(s32 value);