mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-31 08:23:56 +01:00
RemoveFieldObjectInternal
This commit is contained in:
parent
942400ddbf
commit
398186d7c4
@ -5,80 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start RemoveFieldObjectByLocalIdAndMap
|
||||
@ void RemoveFieldObjectByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapBank)
|
||||
RemoveFieldObjectByLocalIdAndMap: @ 808D8C4
|
||||
push {lr}
|
||||
sub sp, 0x4
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
mov r3, sp
|
||||
bl TryGetFieldObjectIdByLocalIdAndMap
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _0808D902
|
||||
mov r0, sp
|
||||
ldrb r0, [r0]
|
||||
bl GetFieldObjectFlagIdByFieldObjectId
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
bl FlagSet
|
||||
mov r0, sp
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r1, 3
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, =gMapObjects
|
||||
adds r0, r1
|
||||
bl RemoveFieldObject
|
||||
_0808D902:
|
||||
add sp, 0x4
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end RemoveFieldObjectByLocalIdAndMap
|
||||
|
||||
thumb_func_start RemoveFieldObjectInternal
|
||||
@ void RemoveFieldObjectInternal(npc_state *fieldObject)
|
||||
RemoveFieldObjectInternal: @ 808D90C
|
||||
push {r4,lr}
|
||||
sub sp, 0x8
|
||||
adds r4, r0, 0
|
||||
ldrb r0, [r4, 0x5]
|
||||
bl GetFieldObjectGraphicsInfo
|
||||
ldrh r2, [r0, 0x6]
|
||||
ldr r1, =0xffff0000
|
||||
ldr r0, [sp, 0x4]
|
||||
ands r0, r1
|
||||
orrs r0, r2
|
||||
str r0, [sp, 0x4]
|
||||
ldr r2, =gSprites
|
||||
ldrb r1, [r4, 0x4]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r1, r2, 0
|
||||
adds r1, 0xC
|
||||
adds r0, r1
|
||||
mov r1, sp
|
||||
str r1, [r0]
|
||||
ldrb r1, [r4, 0x4]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
adds r0, r2
|
||||
bl DestroySprite
|
||||
add sp, 0x8
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end RemoveFieldObjectInternal
|
||||
|
||||
thumb_func_start sub_808D958
|
||||
sub_808D958: @ 808D958
|
||||
push {r4,lr}
|
||||
|
@ -21,6 +21,8 @@ static u8 GetFieldObjectIdByLocalIdAndMapInternal(u8, u8, u8);
|
||||
static bool8 GetAvailableFieldObjectSlot(u16, u8, u8, u8 *);
|
||||
/*static*/ void FieldObjectHandleDynamicGraphicsId(struct MapObject *);
|
||||
/*static*/ void RemoveFieldObjectInternal (struct MapObject *);
|
||||
/*static*/ u16 GetFieldObjectFlagIdByFieldObjectId(u8);
|
||||
/*static*/ struct MapObjectGraphicsInfo *GetFieldObjectGraphicsInfo(u8);
|
||||
|
||||
// ROM data
|
||||
|
||||
@ -422,3 +424,21 @@ void RemoveFieldObject(struct MapObject *mapObject)
|
||||
mapObject->active = FALSE;
|
||||
RemoveFieldObjectInternal(mapObject);
|
||||
}
|
||||
|
||||
void RemoveFieldObjectByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
{
|
||||
u8 index;
|
||||
if (!TryGetFieldObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &index))
|
||||
{
|
||||
FlagSet(GetFieldObjectFlagIdByFieldObjectId(index));
|
||||
RemoveFieldObject(&gMapObjects[index]);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveFieldObjectInternal(struct MapObject *mapObject)
|
||||
{
|
||||
struct SpriteFrameImage image;
|
||||
image.size = GetFieldObjectGraphicsInfo(mapObject->graphicsId)->size;
|
||||
gSprites[mapObject->spriteId].images = ℑ
|
||||
DestroySprite(&gSprites[mapObject->spriteId]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user