mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-19 18:04:22 +01:00
TryGetFieldObjectIdByLocalIdAndMap
This commit is contained in:
parent
f3f8c5ec2c
commit
ea9dabdfab
@ -5,56 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start GetFieldObjectIdByLocalIdAndMap
|
||||
@ u8 GetFieldObjectIdByLocalIdAndMap(u8 localId, u8 mapId, u8 mapGroupId)
|
||||
GetFieldObjectIdByLocalIdAndMap: @ 808D524
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
cmp r0, 0xFE
|
||||
bls _0808D53C
|
||||
bl GetFieldObjectIdByLocalId
|
||||
b _0808D540
|
||||
_0808D53C:
|
||||
bl GetFieldObjectIdByLocalIdAndMapInternal
|
||||
_0808D540:
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end GetFieldObjectIdByLocalIdAndMap
|
||||
|
||||
thumb_func_start TryGetFieldObjectIdByLocalIdAndMap
|
||||
@ bool8 TryGetFieldObjectIdByLocalIdAndMap(u8 localId, u8 mapId, u8 mapGroupId, u8 *fieldObjectId)
|
||||
TryGetFieldObjectIdByLocalIdAndMap: @ 808D548
|
||||
push {r4,lr}
|
||||
adds r4, r3, 0
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
bl GetFieldObjectIdByLocalIdAndMap
|
||||
strb r0, [r4]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x10
|
||||
beq _0808D56A
|
||||
movs r0, 0
|
||||
b _0808D56C
|
||||
_0808D56A:
|
||||
movs r0, 0x1
|
||||
_0808D56C:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end TryGetFieldObjectIdByLocalIdAndMap
|
||||
|
||||
thumb_func_start GetFieldObjectIdByXY
|
||||
@ u8 GetFieldObjectIdByXY(s16 x, s16 y)
|
||||
GetFieldObjectIdByXY: @ 808D574
|
||||
|
@ -10,6 +10,8 @@ extern struct MapObject gUnknown_02037350[16];
|
||||
// Exported ROM declarations
|
||||
|
||||
void sub_808D438(void);
|
||||
u8 GetFieldObjectIdByLocalIdAndMap(u8, u8, u8);
|
||||
bool8 TryGetFieldObjectIdByLocalIdAndMap(u8, u8, u8, u8 *);
|
||||
|
||||
// Exported data declarations
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
||||
// Static ROM declarations
|
||||
|
||||
/*static*/ void sub_808D450(void);
|
||||
/*static*/ u8 GetFieldObjectIdByLocalId(u8);
|
||||
/*static*/ u8 GetFieldObjectIdByLocalIdAndMapInternal(u8, u8, u8);
|
||||
|
||||
// ROM data
|
||||
|
||||
@ -75,3 +77,22 @@ u8 sub_808D4F4(void)
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
u8 GetFieldObjectIdByLocalIdAndMap(u8 localId, u8 mapId, u8 mapGroupId)
|
||||
{
|
||||
if (localId < 0xff)
|
||||
{
|
||||
return GetFieldObjectIdByLocalIdAndMapInternal(localId, mapId, mapGroupId);
|
||||
}
|
||||
return GetFieldObjectIdByLocalId(localId);
|
||||
}
|
||||
|
||||
bool8 TryGetFieldObjectIdByLocalIdAndMap(u8 localId, u8 mapId, u8 mapGroupId, u8 *fieldObjectId)
|
||||
{
|
||||
*fieldObjectId = GetFieldObjectIdByLocalIdAndMap(localId, mapId, mapGroupId);
|
||||
if (*fieldObjectId == 16)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user