mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
RemoveFieldObjectsOutsideView
This commit is contained in:
parent
f128e4c4f0
commit
341a4735bc
@ -567,7 +567,7 @@ _0809C32E:
|
||||
.pool
|
||||
_0809C33C:
|
||||
movs r4, 0
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
_0809C340:
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0x1
|
||||
|
@ -5,57 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start RemoveFieldObjectsOutsideView
|
||||
@ void RemoveFieldObjectsOutsideView()
|
||||
RemoveFieldObjectsOutsideView: @ 808E08C
|
||||
push {r4-r6,lr}
|
||||
movs r3, 0
|
||||
ldr r6, =gUnknown_02032308
|
||||
_0808E092:
|
||||
movs r2, 0
|
||||
movs r4, 0
|
||||
adds r5, r3, 0x1
|
||||
_0808E098:
|
||||
lsls r0, r2, 2
|
||||
adds r1, r0, r6
|
||||
ldrb r0, [r1]
|
||||
cmp r0, 0
|
||||
beq _0808E0AA
|
||||
ldrb r1, [r1, 0x2]
|
||||
cmp r3, r1
|
||||
bne _0808E0AA
|
||||
movs r4, 0x1
|
||||
_0808E0AA:
|
||||
adds r0, r2, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r2, r0, 24
|
||||
cmp r2, 0x3
|
||||
bls _0808E098
|
||||
cmp r4, 0
|
||||
bne _0808E0D2
|
||||
lsls r0, r3, 3
|
||||
adds r0, r3
|
||||
lsls r0, 2
|
||||
ldr r1, =gMapObjects
|
||||
adds r2, r0, r1
|
||||
ldr r0, [r2]
|
||||
ldr r1, =0x00010001
|
||||
ands r0, r1
|
||||
cmp r0, 0x1
|
||||
bne _0808E0D2
|
||||
adds r0, r2, 0
|
||||
bl RemoveFieldObjectIfOutsideView
|
||||
_0808E0D2:
|
||||
lsls r0, r5, 24
|
||||
lsrs r3, r0, 24
|
||||
cmp r3, 0xF
|
||||
bls _0808E092
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end RemoveFieldObjectsOutsideView
|
||||
|
||||
thumb_func_start RemoveFieldObjectIfOutsideView
|
||||
@ void RemoveFieldObjectIfOutsideView(npc_state *fieldObject)
|
||||
RemoveFieldObjectIfOutsideView: @ 808E0EC
|
||||
@ -183,7 +132,7 @@ sub_808E1B8: @ 808E1B8
|
||||
lsrs r2, 16
|
||||
str r2, [sp, 0x24]
|
||||
movs r7, 0
|
||||
ldr r2, =gUnknown_02032308
|
||||
ldr r2, =gLinkPlayerMapObjects
|
||||
_0808E1DA:
|
||||
lsls r0, r7, 2
|
||||
adds r1, r0, r2
|
||||
|
28
asm/rom4.s
28
asm/rom4.s
@ -5480,7 +5480,7 @@ sub_80872D8: @ 80872D8
|
||||
movs r0, 0x1
|
||||
_080872EA:
|
||||
strb r0, [r6, 0x1]
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
lsls r0, r4, 2
|
||||
adds r0, r1
|
||||
ldrb r0, [r0, 0x3]
|
||||
@ -5977,7 +5977,7 @@ sub_80876C4: @ 80876C4
|
||||
thumb_func_start strange_npc_table_clear
|
||||
strange_npc_table_clear: @ 80876CC
|
||||
push {lr}
|
||||
ldr r0, =gUnknown_02032308
|
||||
ldr r0, =gLinkPlayerMapObjects
|
||||
movs r1, 0
|
||||
movs r2, 0x10
|
||||
bl memset
|
||||
@ -6025,7 +6025,7 @@ sub_80876F0: @ 80876F0
|
||||
lsls r6, 24
|
||||
lsrs r6, 24
|
||||
lsls r4, r7, 2
|
||||
ldr r0, =gUnknown_02032308
|
||||
ldr r0, =gLinkPlayerMapObjects
|
||||
adds r4, r0
|
||||
lsls r5, r6, 3
|
||||
adds r5, r6
|
||||
@ -6118,7 +6118,7 @@ sub_80877DC: @ 80877DC
|
||||
lsls r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r2, r1, 24
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
lsrs r0, 22
|
||||
adds r1, r0, r1
|
||||
ldrb r0, [r1]
|
||||
@ -6142,7 +6142,7 @@ sub_808780C: @ 808780C
|
||||
push {r4,r5,lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 22
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
adds r5, r0, r1
|
||||
ldrb r1, [r5, 0x2]
|
||||
lsls r0, r1, 3
|
||||
@ -6176,7 +6176,7 @@ _08087838:
|
||||
thumb_func_start sub_8087858
|
||||
sub_8087858: @ 8087858
|
||||
lsls r0, 24
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
lsrs r0, 22
|
||||
adds r0, r1
|
||||
ldrb r1, [r0, 0x2]
|
||||
@ -6193,7 +6193,7 @@ sub_8087858: @ 8087858
|
||||
thumb_func_start sub_8087878
|
||||
sub_8087878: @ 8087878
|
||||
lsls r0, 24
|
||||
ldr r3, =gUnknown_02032308
|
||||
ldr r3, =gLinkPlayerMapObjects
|
||||
lsrs r0, 22
|
||||
adds r0, r3
|
||||
ldrb r3, [r0, 0x2]
|
||||
@ -6213,7 +6213,7 @@ sub_8087878: @ 8087878
|
||||
thumb_func_start sub_80878A0
|
||||
sub_80878A0: @ 80878A0
|
||||
lsls r0, 24
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
lsrs r0, 22
|
||||
adds r0, r1
|
||||
ldrb r1, [r0, 0x2]
|
||||
@ -6230,7 +6230,7 @@ sub_80878A0: @ 80878A0
|
||||
thumb_func_start sub_80878C0
|
||||
sub_80878C0: @ 80878C0
|
||||
lsls r0, 24
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
lsrs r0, 22
|
||||
adds r0, r1
|
||||
ldrb r1, [r0, 0x2]
|
||||
@ -6249,7 +6249,7 @@ sub_80878C0: @ 80878C0
|
||||
thumb_func_start sub_80878E4
|
||||
sub_80878E4: @ 80878E4
|
||||
lsls r0, 24
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
lsrs r0, 22
|
||||
adds r0, r1
|
||||
ldrb r1, [r0, 0x2]
|
||||
@ -6271,7 +6271,7 @@ sub_80878E4: @ 80878E4
|
||||
sub_808790C: @ 808790C
|
||||
push {r4-r6,lr}
|
||||
movs r2, 0
|
||||
ldr r5, =gUnknown_02032308
|
||||
ldr r5, =gLinkPlayerMapObjects
|
||||
lsls r0, 16
|
||||
asrs r4, r0, 16
|
||||
lsls r1, 16
|
||||
@ -6326,7 +6326,7 @@ sub_808796C: @ 808796C
|
||||
lsrs r3, r1, 24
|
||||
adds r2, r3, 0
|
||||
lsrs r0, 22
|
||||
ldr r1, =gUnknown_02032308
|
||||
ldr r1, =gLinkPlayerMapObjects
|
||||
adds r5, r0, r1
|
||||
ldrb r1, [r5, 0x2]
|
||||
lsls r0, r1, 3
|
||||
@ -6654,7 +6654,7 @@ sub_8087BCC: @ 8087BCC
|
||||
lsls r1, 24
|
||||
lsrs r3, r1, 24
|
||||
lsls r2, r5, 2
|
||||
ldr r0, =gUnknown_02032308
|
||||
ldr r0, =gLinkPlayerMapObjects
|
||||
adds r2, r0
|
||||
ldrb r1, [r2, 0x2]
|
||||
lsls r0, r1, 3
|
||||
@ -6742,7 +6742,7 @@ sub_8087C8C: @ 8087C8C
|
||||
movs r0, 0x2E
|
||||
ldrsh r4, [r5, r0]
|
||||
lsls r4, 2
|
||||
ldr r0, =gUnknown_02032308
|
||||
ldr r0, =gLinkPlayerMapObjects
|
||||
adds r4, r0
|
||||
ldrb r1, [r4, 0x2]
|
||||
lsls r0, r1, 3
|
||||
|
@ -2,6 +2,28 @@
|
||||
#ifndef POKEEMERALD_ROM4_H
|
||||
#define POKEEMERALD_ROM4_H
|
||||
|
||||
struct UnkPlayerStruct
|
||||
{
|
||||
u8 player_field_0;
|
||||
u8 player_field_1;
|
||||
};
|
||||
|
||||
struct LinkPlayerMapObject
|
||||
{
|
||||
u8 active;
|
||||
u8 linkPlayerId;
|
||||
u8 mapObjId;
|
||||
u8 mode;
|
||||
};
|
||||
|
||||
struct UCoords32
|
||||
{
|
||||
u32 x, y;
|
||||
};
|
||||
|
||||
|
||||
extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
|
||||
|
||||
void strange_npc_table_clear(void);
|
||||
|
||||
#endif //POKEEMERALD_ROM4_H
|
||||
|
@ -33,6 +33,7 @@ void sub_8096518(struct MapObject *, struct Sprite *);
|
||||
/*static*/ void GetFieldObjectMovingCameraOffset(s16 *, s16 *);
|
||||
/*static*/ struct MapObjectTemplate *GetFieldObjectTemplateByLocalIdAndMap(u8, u8, u8);
|
||||
/*static*/ void sub_808E894(u16);
|
||||
/*static*/ void RemoveFieldObjectIfOutsideView(struct MapObject *mapObject);
|
||||
|
||||
// ROM data
|
||||
|
||||
@ -739,3 +740,27 @@ void SpawnFieldObjectsInView(s16 cameraX, s16 cameraY)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveFieldObjectsOutsideView(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 j;
|
||||
bool8 isActiveLinkPlayer;
|
||||
struct MapObject *mapObject;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gMapObjects); i ++)
|
||||
{
|
||||
for (j = 0, isActiveLinkPlayer = FALSE; j < ARRAY_COUNT(gLinkPlayerMapObjects); j ++)
|
||||
{
|
||||
if (gLinkPlayerMapObjects[j].active && i == gLinkPlayerMapObjects[j].mapObjId)
|
||||
isActiveLinkPlayer = TRUE;
|
||||
}
|
||||
if (!isActiveLinkPlayer)
|
||||
{
|
||||
mapObject = &gMapObjects[i];
|
||||
|
||||
if (mapObject->active && !mapObject->mapobj_bit_16)
|
||||
RemoveFieldObjectIfOutsideView(mapObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -740,7 +740,7 @@ gUnknown_02032304: @ 2032304
|
||||
gUnknown_02032306: @ 2032306
|
||||
.space 0x2
|
||||
|
||||
gUnknown_02032308: @ 2032308
|
||||
gLinkPlayerMapObjects: @ 2032308
|
||||
.space 0x10
|
||||
|
||||
gUnknown_02032318: @ 2032318
|
||||
|
Loading…
Reference in New Issue
Block a user