names for link player code

This commit is contained in:
YamaArashi 2016-10-28 10:39:13 -07:00
parent b528e1214c
commit 53305e3f94
8 changed files with 122 additions and 121 deletions

View File

@ -460,7 +460,7 @@ sub_8110290: @ 8110290
ldr r3, _081102DC @ =gUnknown_02024D26
ldrb r3, [r3]
ldr r6, _081102E0 @ =gLinkPlayers
ldr r5, _081102E4 @ =gUnknown_02029818
ldr r5, _081102E4 @ =gLinkPlayerMapObjects
lsls r4, 2
adds r4, r5
ldrb r5, [r4, 0x1]
@ -480,7 +480,7 @@ _081102D4: .4byte gSaveBlock1 + 0x30B8
_081102D8: .4byte gUnknown_0202FFF0
_081102DC: .4byte gUnknown_02024D26
_081102E0: .4byte gLinkPlayers
_081102E4: .4byte gUnknown_02029818
_081102E4: .4byte gLinkPlayerMapObjects
thumb_func_end sub_8110290
thumb_func_start PrintLinkBattleWinsLossesDraws

View File

@ -710,7 +710,7 @@ _08083248: .4byte gScriptResult
_0808324C: .4byte sub_80833C4
_08083250:
bl GetLinkPlayerCount_2
ldr r4, _08083278 @ =gUnknown_03004864
ldr r4, _08083278 @ =gFieldLinkPlayerCount
strb r0, [r4]
bl GetMultiplayerId
ldr r1, _0808327C @ =gUnknown_03004860
@ -727,7 +727,7 @@ _08083270:
pop {r0}
bx r0
.align 2, 0
_08083278: .4byte gUnknown_03004864
_08083278: .4byte gFieldLinkPlayerCount
_0808327C: .4byte gUnknown_03004860
_08083280: .4byte gBlockSendBuffer
_08083284: .4byte sub_8083314
@ -763,7 +763,7 @@ _080832C0: .4byte gTasks
_080832C4: .4byte sub_80833C4
_080832C8:
bl GetLinkPlayerCount_2
ldr r4, _08083300 @ =gUnknown_03004864
ldr r4, _08083300 @ =gFieldLinkPlayerCount
strb r0, [r4]
bl GetMultiplayerId
ldr r1, _08083304 @ =gUnknown_03004860
@ -786,7 +786,7 @@ _080832F8:
pop {r0}
bx r0
.align 2, 0
_08083300: .4byte gUnknown_03004864
_08083300: .4byte gFieldLinkPlayerCount
_08083304: .4byte gUnknown_03004860
_08083308: .4byte gBlockSendBuffer
_0808330C: .4byte gTasks

View File

@ -12480,7 +12480,7 @@ _0805B630: .4byte gSaveBlock1 + 0xC20
RemoveFieldObjectsOutsideView: @ 805B634
push {r4-r6,lr}
movs r3, 0
ldr r6, _0805B688 @ =gUnknown_02029818
ldr r6, _0805B688 @ =gLinkPlayerMapObjects
_0805B63A:
movs r2, 0
movs r4, 0
@ -12524,7 +12524,7 @@ _0805B67A:
pop {r0}
bx r0
.align 2, 0
_0805B688: .4byte gUnknown_02029818
_0805B688: .4byte gLinkPlayerMapObjects
_0805B68C: .4byte gMapObjects
_0805B690: .4byte 0x00010001
thumb_func_end RemoveFieldObjectsOutsideView
@ -12656,7 +12656,7 @@ sub_805B75C: @ 805B75C
lsrs r2, 16
mov r10, r2
movs r7, 0
ldr r2, _0805B900 @ =gUnknown_02029818
ldr r2, _0805B900 @ =gLinkPlayerMapObjects
_0805B77E:
lsls r0, r7, 2
adds r1, r0, r2
@ -12845,7 +12845,7 @@ _0805B8EE:
pop {r0}
bx r0
.align 2, 0
_0805B900: .4byte gUnknown_02029818
_0805B900: .4byte gLinkPlayerMapObjects
_0805B904: .4byte gMapObjects
_0805B908: .4byte 0xffff0000
_0805B90C: .4byte 0x0000ffff

View File

@ -558,7 +558,7 @@ _08068314: .4byte gUnknown_0821664C
_08068318: .4byte gMapObjects
_0806831C:
movs r4, 0
ldr r1, _08068354 @ =gUnknown_02029818
ldr r1, _08068354 @ =gLinkPlayerMapObjects
_08068320:
ldrb r0, [r1]
cmp r0, 0x1
@ -588,7 +588,7 @@ _0806834E:
pop {r1}
bx r1
.align 2, 0
_08068354: .4byte gUnknown_02029818
_08068354: .4byte gLinkPlayerMapObjects
_08068358: .4byte gSelectedMapObject
_0806835C: .4byte gUnknown_0202E8DE
_08068360: .4byte gUnknown_0202E8E0

View File

@ -35,7 +35,7 @@ sub_8093130: @ 8093130
bl SetMainCallback2
ldr r2, _08093168 @ =0x02000000
ldr r3, _0809316C @ =gLinkPlayers
ldr r0, _08093170 @ =gUnknown_02029818
ldr r0, _08093170 @ =gLinkPlayerMapObjects
lsls r4, 2
adds r4, r0
ldrb r1, [r4, 0x1]
@ -53,7 +53,7 @@ sub_8093130: @ 8093130
_08093164: .4byte sub_8093174
_08093168: .4byte 0x02000000
_0809316C: .4byte gLinkPlayers
_08093170: .4byte gUnknown_02029818
_08093170: .4byte gLinkPlayerMapObjects
thumb_func_end sub_8093130
thumb_func_start sub_8093174

View File

@ -60,9 +60,12 @@ struct UnkStruct_8054FF8
u16 field_C;
};
struct UnkMapObjStruct
struct LinkPlayerMapObject
{
u8 a, b, c, d;
u8 active;
u8 linkPlayerId;
u8 mapObjId;
u8 mode;
};
struct UCoords32
@ -77,7 +80,7 @@ extern struct WarpData gUnknown_02029808;
extern struct UnkPlayerStruct gUnknown_02029810;
extern u16 gUnknown_02029814;
extern bool8 gUnknown_02029816;
extern struct UnkMapObjStruct gUnknown_02029818[];
extern struct LinkPlayerMapObject gLinkPlayerMapObjects[];
extern u8 gUnknown_0202E85C;
extern u8 gUnknown_0202E85D;
@ -89,7 +92,7 @@ extern u8 gUnknown_03000588;
extern u16 word_3004858;
extern void (*gUnknown_0300485C)(void);
extern u8 gUnknown_03004860;
extern u8 gUnknown_03004864;
extern u8 gFieldLinkPlayerCount;
extern struct UnkTVStruct gUnknown_03004870;
@ -119,9 +122,9 @@ extern u8 gUnknown_081A4508[];
extern struct UCoords32 gUnknown_0821664C[];
extern u8 (*gUnknown_082166A0[])(struct UnkMapObjStruct *, struct MapObject *, u8);
extern u8 (*gUnknown_082166AC[])(struct UnkMapObjStruct *, struct MapObject *, u8);
extern void (*gUnknown_082166D8[])(struct UnkMapObjStruct *, struct MapObject *);
extern u8 (*gUnknown_082166A0[])(struct LinkPlayerMapObject *, struct MapObject *, u8);
extern u8 (*gUnknown_082166AC[])(struct LinkPlayerMapObject *, struct MapObject *, u8);
extern void (*gUnknown_082166D8[])(struct LinkPlayerMapObject *, struct MapObject *);
extern struct MapData * const gMapAttributes[];
extern struct MapHeader * const * const gMapGroups[];
@ -229,19 +232,19 @@ void sub_8055824(void);
void sub_8055840(u8 *);
void sub_805585C(void);
bool32 sub_8055870(void);
void sub_8055980(u8, s16, s16, u8);
void sub_8055A2C(struct MapObject *, s16, s16);
void SpawnLinkPlayerMapObject(u8, s16, s16, u8);
void InitLinkPlayerMapObjectPos(struct MapObject *, s16, s16);
void sub_80555B0(int, int, struct UnkStruct_8054FF8 *);
u8 sub_8055AE8(u8);
void sub_8055B08(u8, u16 *, u16 *);
u8 sub_8055B30(u8);
u8 sub_8055B50(u8);
u8 sub_8055B9C(s16, s16);
u8 GetLinkPlayerIdAt(s16, s16);
void sub_8055BFC(u8, u8);
u8 npc_something3(u8, u8);
u8 npc_080587EC(u8, u8, s16, s16);
void sub_8055E5C(u8);
void sub_8055ED8(struct Sprite *);
u8 LinkPlayerDetectCollision(u8, u8, s16, s16);
void CreateLinkPlayerSprite(u8);
void SpriteCB_LinkPlayer(struct Sprite *);
void sub_8056C50(u16, u16);
void sub_8052F5C(void)
@ -1831,10 +1834,10 @@ void sub_8054EC8(void)
sav1_camera_get_focus_coords(&x, &y);
x -= gUnknown_03004860;
for (i = 0; i < gUnknown_03004864; i++)
for (i = 0; i < gFieldLinkPlayerCount; i++)
{
sub_8055980(i, i + x, y, gLinkPlayers[i].gender);
sub_8055E5C(i);
SpawnLinkPlayerMapObject(i, i + x, y, gLinkPlayers[i].gender);
CreateLinkPlayerSprite(i);
}
sub_8055340(word_3002910);
@ -1843,8 +1846,8 @@ void sub_8054EC8(void)
void sub_8054F48(void)
{
u16 i;
for (i = 0; i < gUnknown_03004864; i++)
sub_8055E5C(i);
for (i = 0; i < gFieldLinkPlayerCount; i++)
CreateLinkPlayerSprite(i);
}
void sub_8054F70(void)
@ -1857,7 +1860,7 @@ void sub_8054F70(void)
bool32 sub_8054F88(u16 a1)
{
int i;
int count = gUnknown_03004864;
int count = gFieldLinkPlayerCount;
for (i = 0; i < count; i++)
if (gUnknown_03000580[i] != a1)
@ -1868,7 +1871,7 @@ bool32 sub_8054F88(u16 a1)
bool32 sub_8054FC0(u16 a1)
{
int i;
int count = gUnknown_03004864;
int count = gFieldLinkPlayerCount;
for (i = 0; i < count; i++)
if (gUnknown_03000580[i] == a1)
@ -2141,9 +2144,9 @@ u16 sub_8055468(u32 a1)
return 17;
}
u16 sub_805546C(u32 a1)
u16 sub_805546C(u32 linkPlayerId)
{
if (gUnknown_03000580[a1] == 0x82 && (gMain.newKeys & B_BUTTON))
if (gUnknown_03000580[linkPlayerId] == 0x82 && (gMain.newKeys & B_BUTTON))
{
sub_80543DC(sub_8055468);
return 29;
@ -2215,20 +2218,18 @@ u16 sub_805559C(void)
return 0;
}
void sub_80555B0(int a1, int a2, struct UnkStruct_8054FF8 *a3)
void sub_80555B0(int linkPlayerId, int a2, struct UnkStruct_8054FF8 *a3)
{
s16 x, y;
u8 val;
a3->a = a1;
a3->b = (a1 == a2) ? 1 : 0;
a3->c = gUnknown_02029818[a1].d;
val = a1;
a3->d = sub_8055B30(val);
sub_8055B08(val, &x, &y);
a3->a = linkPlayerId;
a3->b = (linkPlayerId == a2) ? 1 : 0;
a3->c = gLinkPlayerMapObjects[linkPlayerId].mode;
a3->d = sub_8055B30(linkPlayerId);
sub_8055B08(linkPlayerId, &x, &y);
a3->sub.x = x;
a3->sub.y = y;
a3->sub.field_8 = sub_8055B50(val);
a3->sub.field_8 = sub_8055B50(linkPlayerId);
a3->field_C = MapGridGetMetatileBehaviorAt(x, y);
}
@ -2271,8 +2272,7 @@ bool32 sub_8055660(struct UnkStruct_8054FF8 *a1)
u8 *sub_805568C(struct UnkStruct_8054FF8 *a1)
{
struct UnkStruct_8054FF8_Substruct unkStruct;
u8 v5;
register int v6 asm("r2");
u8 linkPlayerId;
if (a1->c && a1->c != 2)
return 0;
@ -2281,14 +2281,15 @@ u8 *sub_805568C(struct UnkStruct_8054FF8 *a1)
unkStruct.x += gUnknown_0821664C[a1->d].x;
unkStruct.y += gUnknown_0821664C[a1->d].y;
unkStruct.field_8 = 0;
v5 = sub_8055B9C(unkStruct.x, unkStruct.y);
v6 = v5;
linkPlayerId = GetLinkPlayerIdAt(unkStruct.x, unkStruct.y);
if (v5 != 4)
if (linkPlayerId != 4)
{
if (!a1->b || gUnknown_03000580[v5] != 0x80)
if (!a1->b)
return gUnknown_081A4495;
if (!sub_8083BF4(v6))
if (gUnknown_03000580[linkPlayerId] != 0x80)
return gUnknown_081A4495;
if (!sub_8083BF4(linkPlayerId))
return gUnknown_081A4479;
return gUnknown_081A4487;
}
@ -2424,44 +2425,44 @@ bool32 sub_8055940(void)
return TRUE;
}
void sub_8055954(struct UnkMapObjStruct *a1)
void ZeroLinkPlayerMapObject(struct LinkPlayerMapObject *linkPlayerMapObj)
{
memset(a1, 0, sizeof(struct UnkMapObjStruct));
memset(linkPlayerMapObj, 0, sizeof(struct LinkPlayerMapObject));
}
void strange_npc_table_clear(void)
{
memset(gUnknown_02029818, 0, 16);
memset(gLinkPlayerMapObjects, 0, 16);
}
void sub_8055970(void *a1)
void ZeroMapObject(struct MapObject *mapObj)
{
memset(a1, 0, 36);
memset(mapObj, 0, sizeof(struct MapObject));
}
void sub_8055980(u8 a1, s16 x, s16 y, u8 a4)
void SpawnLinkPlayerMapObject(u8 linkPlayerId, s16 x, s16 y, u8 a4)
{
u8 mapObjId = sub_805AB54();
struct UnkMapObjStruct *unkMapObjStruct = &gUnknown_02029818[a1];
struct LinkPlayerMapObject *linkPlayerMapObj = &gLinkPlayerMapObjects[linkPlayerId];
struct MapObject *mapObj = &gMapObjects[mapObjId];
sub_8055954(unkMapObjStruct);
sub_8055970(mapObj);
ZeroLinkPlayerMapObject(linkPlayerMapObj);
ZeroMapObject(mapObj);
unkMapObjStruct->a = 1;
unkMapObjStruct->b = a1;
unkMapObjStruct->c = mapObjId;
unkMapObjStruct->d = 0;
linkPlayerMapObj->active = 1;
linkPlayerMapObj->linkPlayerId = linkPlayerId;
linkPlayerMapObj->mapObjId = mapObjId;
linkPlayerMapObj->mode = 0;
mapObj->active = 1;
mapObj->mapobj_bit_1 = a4;
mapObj->mapobj_unk_19 = 2;
mapObj->spriteId = 64;
sub_8055A2C(mapObj, x, y);
InitLinkPlayerMapObjectPos(mapObj, x, y);
}
void sub_8055A2C(struct MapObject *mapObj, s16 x, s16 y)
void InitLinkPlayerMapObjectPos(struct MapObject *mapObj, s16 x, s16 y)
{
mapObj->coords2.x = x;
mapObj->coords2.y = y;
@ -2472,72 +2473,72 @@ void sub_8055A2C(struct MapObject *mapObj, s16 x, s16 y)
FieldObjectUpdateZCoord(mapObj);
}
void unref_sub_8055A6C(u8 a1, u8 a2)
void unref_sub_8055A6C(u8 linkPlayerId, u8 a2)
{
if (gUnknown_02029818[a1].a)
if (gLinkPlayerMapObjects[linkPlayerId].active)
{
u8 mapObjId = gUnknown_02029818[a1].c;
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
mapObj->mapobj_unk_19 = a2;
}
}
void unref_sub_8055A9C(u8 a1)
void unref_sub_8055A9C(u8 linkPlayerId)
{
struct UnkMapObjStruct *unkMapObjStruct = &gUnknown_02029818[a1];
u8 mapObjId = unkMapObjStruct->c;
struct LinkPlayerMapObject *linkPlayerMapObj = &gLinkPlayerMapObjects[linkPlayerId];
u8 mapObjId = linkPlayerMapObj->mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
if (mapObj->spriteId != 64 )
DestroySprite(&gSprites[mapObj->spriteId]);
unkMapObjStruct->a = 0;
linkPlayerMapObj->active = 0;
mapObj->active = 0;
}
u8 sub_8055AE8(u8 a1)
u8 sub_8055AE8(u8 linkPlayerId)
{
u8 mapObjId = gUnknown_02029818[a1].c;
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
return mapObj->spriteId;
}
void sub_8055B08(u8 a1, u16 *x, u16 *y)
void sub_8055B08(u8 linkPlayerId, u16 *x, u16 *y)
{
u8 mapObjId = gUnknown_02029818[a1].c;
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
*x = mapObj->coords2.x;
*y = mapObj->coords2.y;
}
u8 sub_8055B30(u8 a1)
u8 sub_8055B30(u8 linkPlayerId)
{
u8 mapObjId = gUnknown_02029818[a1].c;
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
return mapObj->mapobj_unk_19;
}
u8 sub_8055B50(u8 a1)
u8 sub_8055B50(u8 linkPlayerId)
{
u8 mapObjId = gUnknown_02029818[a1].c;
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
return mapObj->mapobj_unk_0B_0;
}
s32 unref_sub_8055B74(u8 a1)
s32 unref_sub_8055B74(u8 linkPlayerId)
{
u8 mapObjId = gUnknown_02029818[a1].c;
u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
return 16 - (s8)mapObj->mapobj_unk_21;
}
u8 sub_8055B9C(s16 x, s16 y)
u8 GetLinkPlayerIdAt(s16 x, s16 y)
{
u8 i;
for (i = 0; i < 4; i++)
{
if (gUnknown_02029818[i].a
&& (gUnknown_02029818[i].d == 0 || gUnknown_02029818[i].d == 2))
if (gLinkPlayerMapObjects[i].active
&& (gLinkPlayerMapObjects[i].mode == 0 || gLinkPlayerMapObjects[i].mode == 2))
{
struct MapObject *mapObj = &gMapObjects[gUnknown_02029818[i].c];
struct MapObject *mapObj = &gMapObjects[gLinkPlayerMapObjects[i].mapObjId];
if (mapObj->coords2.x == x && mapObj->coords2.y == y)
return i;
}
@ -2545,49 +2546,49 @@ u8 sub_8055B9C(s16 x, s16 y)
return 4;
}
void sub_8055BFC(u8 a1, u8 a2)
void sub_8055BFC(u8 linkPlayerId, u8 a2)
{
struct UnkMapObjStruct *unkMapObjStruct = &gUnknown_02029818[a1];
u8 mapObjId = unkMapObjStruct->c;
struct LinkPlayerMapObject *linkPlayerMapObj = &gLinkPlayerMapObjects[linkPlayerId];
u8 mapObjId = linkPlayerMapObj->mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
if (unkMapObjStruct->a)
if (linkPlayerMapObj->active)
{
if (a2 > 10)
mapObj->mapobj_bit_2 = 1;
else
gUnknown_082166D8[gUnknown_082166A0[unkMapObjStruct->d](unkMapObjStruct, mapObj, a2)](unkMapObjStruct, mapObj);
gUnknown_082166D8[gUnknown_082166A0[linkPlayerMapObj->mode](linkPlayerMapObj, mapObj, a2)](linkPlayerMapObj, mapObj);
}
}
u8 sub_8055C68(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj, u8 a3)
u8 sub_8055C68(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj, u8 a3)
{
return gUnknown_082166AC[a3](unkMapObjStruct, mapObj, a3);
return gUnknown_082166AC[a3](linkPlayerMapObj, mapObj, a3);
}
u8 sub_8055C88(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj, u8 a3)
u8 sub_8055C88(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj, u8 a3)
{
return 1;
}
u8 sub_8055C8C(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj, u8 a3)
u8 sub_8055C8C(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj, u8 a3)
{
return gUnknown_082166AC[a3](unkMapObjStruct, mapObj, a3);
return gUnknown_082166AC[a3](linkPlayerMapObj, mapObj, a3);
}
u8 sub_8055CAC(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj, u8 a3)
u8 sub_8055CAC(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj, u8 a3)
{
return 0;
}
u8 sub_8055CB0(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj, u8 a3)
u8 sub_8055CB0(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj, u8 a3)
{
s16 x, y;
mapObj->mapobj_unk_19 = npc_something3(a3, mapObj->mapobj_unk_19);
FieldObjectMoveDestCoords(mapObj, mapObj->mapobj_unk_19, &x, &y);
if (npc_080587EC(unkMapObjStruct->c, mapObj->mapobj_unk_19, x, y))
if (LinkPlayerDetectCollision(linkPlayerMapObj->mapObjId, mapObj->mapobj_unk_19, x, y))
{
return 0;
}
@ -2600,26 +2601,26 @@ u8 sub_8055CB0(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj
}
}
u8 sub_8055D18(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj, u8 a3)
u8 sub_8055D18(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj, u8 a3)
{
mapObj->mapobj_unk_19 = npc_something3(a3, mapObj->mapobj_unk_19);
return 0;
}
void sub_8055D30(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj)
void sub_8055D30(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj)
{
unkMapObjStruct->d = 0;
linkPlayerMapObj->mode = 0;
}
void sub_8055D38(struct UnkMapObjStruct *unkMapObjStruct, struct MapObject *mapObj)
void sub_8055D38(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj)
{
mapObj->mapobj_unk_21--;
unkMapObjStruct->d = 1;
linkPlayerMapObj->mode = 1;
MoveCoords(mapObj->mapobj_unk_19, &mapObj->coords1.x, &mapObj->coords1.y);
if (!mapObj->mapobj_unk_21)
{
npc_coords_shift_still(mapObj);
unkMapObjStruct->d = 2;
linkPlayerMapObj->mode = 2;
}
}
@ -2643,12 +2644,12 @@ u8 npc_something3(u8 a1, u8 a2)
return a2;
}
u8 npc_080587EC(u8 a1, u8 a2, s16 x, s16 y)
u8 LinkPlayerDetectCollision(u8 selfMapObjId, u8 a2, s16 x, s16 y)
{
u8 i;
for (i = 0; i < 16; i++)
{
if (i != a1)
if (i != selfMapObjId)
{
if ((gMapObjects[i].coords2.x == x && gMapObjects[i].coords2.y == y)
|| (gMapObjects[i].coords3.x == x && gMapObjects[i].coords3.y == y))
@ -2660,33 +2661,33 @@ u8 npc_080587EC(u8 a1, u8 a2, s16 x, s16 y)
return MapGridIsImpassableAt(x, y);
}
void sub_8055E5C(u8 a1)
void CreateLinkPlayerSprite(u8 linkPlayerId)
{
struct UnkMapObjStruct *unkMapObjStruct = &gUnknown_02029818[a1];
u8 mapObjId = unkMapObjStruct->c;
struct LinkPlayerMapObject *linkPlayerMapObj = &gLinkPlayerMapObjects[linkPlayerId];
u8 mapObjId = linkPlayerMapObj->mapObjId;
struct MapObject *mapObj = &gMapObjects[mapObjId];
struct Sprite *sprite;
if (unkMapObjStruct->a)
if (linkPlayerMapObj->active)
{
u8 val = sub_805983C(0, mapObj->mapobj_bit_1);
mapObj->spriteId = AddPseudoFieldObject(val, sub_8055ED8, 0, 0, 0);
mapObj->spriteId = AddPseudoFieldObject(val, SpriteCB_LinkPlayer, 0, 0, 0);
sprite = &gSprites[mapObj->spriteId];
sprite->coordOffsetEnabled = TRUE;
sprite->data0 = a1;
sprite->data0 = linkPlayerId;
mapObj->mapobj_bit_2 = 0;
}
}
void sub_8055ED8(struct Sprite *sprite)
void SpriteCB_LinkPlayer(struct Sprite *sprite)
{
struct UnkMapObjStruct *unkMapObjStruct = &gUnknown_02029818[sprite->data0];
struct MapObject *mapObj = &gMapObjects[unkMapObjStruct->c];
struct LinkPlayerMapObject *linkPlayerMapObj = &gLinkPlayerMapObjects[sprite->data0];
struct MapObject *mapObj = &gMapObjects[linkPlayerMapObj->mapObjId];
sprite->pos1.x = mapObj->coords1.x;
sprite->pos1.y = mapObj->coords1.y;
SetObjectSubpriorityByZCoord(mapObj->elevation, sprite, 1);
sprite->oam.priority = ZCoordToPriority(mapObj->elevation);
if (!unkMapObjStruct->d)
if (!linkPlayerMapObj->mode)
StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObj->mapobj_unk_19));
else
StartSpriteAnimIfDifferent(sprite, get_go_image_anim_num(mapObj->mapobj_unk_19));

View File

@ -179,7 +179,7 @@ gUnknown_0300485C: @ 300485C
gUnknown_03004860: @ 3004860
.space 0x4
gUnknown_03004864: @ 3004864
gFieldLinkPlayerCount: @ 3004864
.space 0xC
gUnknown_03004870: @ 3004870

View File

@ -361,7 +361,7 @@ gUnknown_02029814: @ 2029814
gUnknown_02029816: @ 2029816
.space 0x2
gUnknown_02029818: @ 2029818
gLinkPlayerMapObjects: @ 2029818
.space 0x10
gUnknown_02029828: @ 2029828