mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
UpdateFieldObjectCoordsForCameraUpdate
This commit is contained in:
parent
5bb5886774
commit
79b19a36b8
@ -827,7 +827,7 @@ unc_grass_normal: @ 8154550
|
||||
lsrs r4, r0, 8
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
ldr r3, =gUnknown_02037334
|
||||
ldr r3, =gCamera
|
||||
ldrb r1, [r3]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
@ -1166,7 +1166,7 @@ unc_grass_tall: @ 8154800
|
||||
lsrs r7, r0, 8
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
ldr r3, =gUnknown_02037334
|
||||
ldr r3, =gCamera
|
||||
ldrb r1, [r3]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
|
@ -5,62 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start UpdateFieldObjectCoordsForCameraUpdate
|
||||
@ void UpdateFieldObjectCoordsForCameraUpdate()
|
||||
UpdateFieldObjectCoordsForCameraUpdate: @ 808EC10
|
||||
push {r4,r5,lr}
|
||||
ldr r2, =gUnknown_02037334
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0808EC68
|
||||
movs r3, 0
|
||||
ldr r5, =gMapObjects
|
||||
movs r0, 0x4
|
||||
ldrsh r4, [r2, r0]
|
||||
movs r0, 0x8
|
||||
ldrsh r1, [r2, r0]
|
||||
_0808EC2A:
|
||||
lsls r0, r3, 3
|
||||
adds r0, r3
|
||||
lsls r0, 2
|
||||
adds r2, r0, r5
|
||||
ldrb r0, [r2]
|
||||
lsls r0, 31
|
||||
cmp r0, 0
|
||||
beq _0808EC5E
|
||||
ldrh r0, [r2, 0xC]
|
||||
subs r0, r4
|
||||
strh r0, [r2, 0xC]
|
||||
ldrh r0, [r2, 0xE]
|
||||
subs r0, r1
|
||||
strh r0, [r2, 0xE]
|
||||
ldrh r0, [r2, 0x10]
|
||||
subs r0, r4
|
||||
strh r0, [r2, 0x10]
|
||||
ldrh r0, [r2, 0x12]
|
||||
subs r0, r1
|
||||
strh r0, [r2, 0x12]
|
||||
ldrh r0, [r2, 0x14]
|
||||
subs r0, r4
|
||||
strh r0, [r2, 0x14]
|
||||
ldrh r0, [r2, 0x16]
|
||||
subs r0, r1
|
||||
strh r0, [r2, 0x16]
|
||||
_0808EC5E:
|
||||
adds r0, r3, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r3, r0, 24
|
||||
cmp r3, 0xF
|
||||
bls _0808EC2A
|
||||
_0808EC68:
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end UpdateFieldObjectCoordsForCameraUpdate
|
||||
|
||||
thumb_func_start GetFieldObjectIdByXYZ
|
||||
@ u8 GetFieldObjectIdByXYZ(u16 x, u16 y, u8 z)
|
||||
GetFieldObjectIdByXYZ: @ 808EC78
|
||||
|
@ -1858,7 +1858,7 @@ _0809E6F8:
|
||||
cmp r6, 0xD
|
||||
ble _0809E6F8
|
||||
_0809E708:
|
||||
ldr r2, =gUnknown_02037334
|
||||
ldr r2, =gCamera
|
||||
ldrb r1, [r2]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
|
@ -1508,12 +1508,12 @@ CameraMove: @ 808887C
|
||||
push {r5-r7}
|
||||
mov r10, r0
|
||||
mov r9, r1
|
||||
ldr r1, =gUnknown_02037334
|
||||
ldr r1, =gCamera
|
||||
ldrb r0, [r1]
|
||||
movs r1, 0x2
|
||||
negs r1, r1
|
||||
ands r1, r0
|
||||
ldr r2, =gUnknown_02037334
|
||||
ldr r2, =gCamera
|
||||
strb r1, [r2]
|
||||
mov r0, r10
|
||||
mov r1, r9
|
||||
@ -1556,23 +1556,23 @@ _080888C4:
|
||||
ldrb r0, [r4, 0x8]
|
||||
ldrb r1, [r4, 0x9]
|
||||
bl mliX_load_map
|
||||
ldr r1, =gUnknown_02037334
|
||||
ldr r1, =gCamera
|
||||
ldrb r0, [r1]
|
||||
movs r1, 0x1
|
||||
orrs r0, r1
|
||||
ldr r2, =gUnknown_02037334
|
||||
ldr r2, =gCamera
|
||||
strb r0, [r2]
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r1, [r0]
|
||||
movs r2, 0
|
||||
ldrsh r0, [r1, r2]
|
||||
subs r5, r0
|
||||
ldr r0, =gUnknown_02037334
|
||||
ldr r0, =gCamera
|
||||
str r5, [r0, 0x4]
|
||||
movs r2, 0x2
|
||||
ldrsh r0, [r1, r2]
|
||||
subs r6, r0
|
||||
ldr r0, =gUnknown_02037334
|
||||
ldr r0, =gCamera
|
||||
str r6, [r0, 0x8]
|
||||
ldrh r0, [r1]
|
||||
add r0, r10
|
||||
@ -1583,7 +1583,7 @@ _080888C4:
|
||||
mov r0, r8
|
||||
bl sub_80885C4
|
||||
_08088932:
|
||||
ldr r0, =gUnknown_02037334
|
||||
ldr r0, =gCamera
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 31
|
||||
lsrs r0, 31
|
||||
|
@ -379,7 +379,7 @@ struct PlayerAvatar /* 0x202E858 */
|
||||
|
||||
struct Camera
|
||||
{
|
||||
bool8 field_0:1;
|
||||
bool8 active:1;
|
||||
s32 x;
|
||||
s32 y;
|
||||
};
|
||||
@ -388,5 +388,6 @@ extern struct MapObject gMapObjects[NUM_FIELD_OBJECTS];
|
||||
extern u8 gSelectedMapObject;
|
||||
extern struct MapHeader gMapHeader;
|
||||
extern struct PlayerAvatar gPlayerAvatar;
|
||||
extern struct Camera gCamera;
|
||||
|
||||
#endif // GUARD_GLOBAL_FIELDMAP_H
|
||||
|
@ -1279,3 +1279,28 @@ void npc_coords_shift_still(struct MapObject *mapObject)
|
||||
npc_coords_shift(mapObject, mapObject->coords2.x, mapObject->coords2.y);
|
||||
}
|
||||
|
||||
void UpdateFieldObjectCoordsForCameraUpdate(void)
|
||||
{
|
||||
u8 i;
|
||||
s16 dx;
|
||||
s16 dy;
|
||||
|
||||
if (gCamera.active)
|
||||
{
|
||||
dx = gCamera.x;
|
||||
dy = gCamera.y;
|
||||
for (i = 0; i < NUM_FIELD_OBJECTS; i ++)
|
||||
{
|
||||
if (gMapObjects[i].active)
|
||||
{
|
||||
gMapObjects[i].coords1.x -= dx;
|
||||
gMapObjects[i].coords1.y -= dy;
|
||||
gMapObjects[i].coords2.x -= dx;
|
||||
gMapObjects[i].coords2.y -= dy;
|
||||
gMapObjects[i].coords3.x -= dx;
|
||||
gMapObjects[i].coords3.y -= dy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ gUnknown_02032318: @ 2032318
|
||||
gMapHeader: @ 2037318
|
||||
.space 0x1C
|
||||
|
||||
gUnknown_02037334: @ 2037334
|
||||
gCamera: @ 2037334
|
||||
.space 0xC
|
||||
|
||||
gUnknown_02037340: @ 2037340
|
||||
|
Loading…
Reference in New Issue
Block a user