mirror of
https://github.com/pret/pmd-sky.git
synced 2026-04-25 15:42:34 -05:00
Decomped GetTileSafe
This commit is contained in:
parent
de612ccf8f
commit
32fc16b838
|
|
@ -1,4 +0,0 @@
|
|||
#pragma once
|
||||
.public DEFAULT_TILE
|
||||
.public DUNGEON_PTR
|
||||
.public ov29_0237CAB8
|
||||
2
asm/include/overlay_29_023361D4.inc
Normal file
2
asm/include/overlay_29_023361D4.inc
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#pragma once
|
||||
.public DUNGEON_PTR
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "overlay_29_02336164.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start GetTileSafe
|
||||
GetTileSafe: ; 0x02336164
|
||||
stmdb sp!, {r4, lr}
|
||||
cmp r0, #0
|
||||
cmpge r1, #0
|
||||
blt _02336180
|
||||
cmp r0, #0x38
|
||||
cmplt r1, #0x20
|
||||
blt _023361A8
|
||||
_02336180:
|
||||
ldr r0, _023361C8 ; =DEFAULT_TILE
|
||||
ldr lr, _023361CC ; =ov29_0237CAB8
|
||||
ldr r4, [r0]
|
||||
mov ip, lr
|
||||
ldmia r4!, {r0, r1, r2, r3}
|
||||
stmia lr!, {r0, r1, r2, r3}
|
||||
ldr r1, [r4]
|
||||
mov r0, ip
|
||||
str r1, [lr]
|
||||
ldmia sp!, {r4, pc}
|
||||
_023361A8:
|
||||
ldr r3, _023361D0 ; =DUNGEON_PTR
|
||||
mov r2, #0xe0
|
||||
ldr r3, [r3]
|
||||
mla r2, r1, r2, r3
|
||||
add r0, r2, r0, lsl #2
|
||||
add r0, r0, #0xd000
|
||||
#ifdef JAPAN
|
||||
ldr r0, [r0, #0x240]
|
||||
#else
|
||||
ldr r0, [r0, #0x2e4]
|
||||
#endif
|
||||
ldmia sp!, {r4, pc}
|
||||
.align 2, 0
|
||||
_023361C8: .word DEFAULT_TILE
|
||||
_023361CC: .word ov29_0237CAB8
|
||||
_023361D0: .word DUNGEON_PTR
|
||||
arm_func_end GetTileSafe
|
||||
|
||||
arm_func_start IsFullFloorFixedRoom
|
||||
IsFullFloorFixedRoom: ; 0x023361D4
|
||||
ldr r0, _02336200 ; =DUNGEON_PTR
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x4000
|
||||
#ifdef JAPAN
|
||||
ldrb r0, [r0, #0x36]
|
||||
#else
|
||||
ldrb r0, [r0, #0xda]
|
||||
#endif
|
||||
cmp r0, #0
|
||||
beq _023361F8
|
||||
cmp r0, #0xa5
|
||||
movlo r0, #1
|
||||
bxlo lr
|
||||
_023361F8:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02336200: .word DUNGEON_PTR
|
||||
arm_func_end IsFullFloorFixedRoom
|
||||
26
asm/overlay_29_023361D4.s
Normal file
26
asm/overlay_29_023361D4.s
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "overlay_29_023361D4.inc"
|
||||
|
||||
.text
|
||||
|
||||
arm_func_start IsFullFloorFixedRoom
|
||||
IsFullFloorFixedRoom: ; 0x023361D4
|
||||
ldr r0, _02336200 ; =DUNGEON_PTR
|
||||
ldr r0, [r0]
|
||||
add r0, r0, #0x4000
|
||||
#ifdef JAPAN
|
||||
ldrb r0, [r0, #0x36]
|
||||
#else
|
||||
ldrb r0, [r0, #0xda]
|
||||
#endif
|
||||
cmp r0, #0
|
||||
beq _023361F8
|
||||
cmp r0, #0xa5
|
||||
movlo r0, #1
|
||||
bxlo lr
|
||||
_023361F8:
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
_02336200: .word DUNGEON_PTR
|
||||
arm_func_end IsFullFloorFixedRoom
|
||||
|
|
@ -68,8 +68,8 @@ ov29_0237CAA0:
|
|||
.global ov29_0237CAAC
|
||||
ov29_0237CAAC:
|
||||
.space 0xC
|
||||
.global ov29_0237CAB8
|
||||
ov29_0237CAB8:
|
||||
.global DEFAULT_TILE_COPY
|
||||
DEFAULT_TILE_COPY:
|
||||
.space 0x14
|
||||
.global ov29_0237CACC
|
||||
ov29_0237CACC:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
|
||||
#include "dungeon_mode.h"
|
||||
|
||||
// Get the tile at some position. If the coordinates are out of bounds, returns a default tile.
|
||||
struct tile* GetTile(s32 x, s32 y);
|
||||
// Get the tile at some position. If the coordinates are out of bounds, returns a pointer to a copy of the default tile.
|
||||
struct tile* GetTileSafe(s32 x, s32 y);
|
||||
|
||||
#endif //PMDSKY_DUNGEON_MAP_ACCESS_H
|
||||
|
|
|
|||
2
main.lsf
2
main.lsf
|
|
@ -506,7 +506,7 @@ Overlay OVY_29
|
|||
Object src/overlay_29_023350D8.o
|
||||
Object asm/overlay_29_023350FC.o
|
||||
Object src/dungeon_map_access.o
|
||||
Object asm/overlay_29_02336164.o
|
||||
Object asm/overlay_29_023361D4.o
|
||||
Object src/run_dungeon.o
|
||||
Object asm/overlay_29_02336224.o
|
||||
Object src/overlay_29_02337CA8.o
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "dungeon_map_access.h"
|
||||
#include "dungeon.h"
|
||||
|
||||
extern struct tile DEFAULT_TILE_COPY;
|
||||
extern struct tile* DEFAULT_TILE;
|
||||
extern struct dungeon *DUNGEON_PTR[];
|
||||
|
||||
|
|
@ -20,3 +21,15 @@ struct tile* GetTile(s32 x, s32 y)
|
|||
|
||||
return DUNGEON_PTR[0]->tile_ptrs[y][x];
|
||||
}
|
||||
|
||||
struct tile* GetTileSafe(s32 x, s32 y)
|
||||
{
|
||||
if (x < 0 || y < 0 || x >= DUNGEON_MAX_SIZE_X || y >= DUNGEON_MAX_SIZE_Y)
|
||||
{
|
||||
struct tile *tile = &DEFAULT_TILE_COPY;
|
||||
DEFAULT_TILE_COPY = *DEFAULT_TILE;
|
||||
return tile;
|
||||
}
|
||||
|
||||
return DUNGEON_PTR[0]->tile_ptrs[y][x];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "overlay_29_022EDC30.h"
|
||||
#include "dungeon.h"
|
||||
|
||||
extern struct tile* GetTileSafe(s16 x, s16 y);
|
||||
#include "dungeon_map_access.h"
|
||||
|
||||
// https://decomp.me/scratch/EcuBP
|
||||
#ifdef NONMATCHING
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user