From ac67812a254a71f6face762b96a2849ef4e9ea76 Mon Sep 17 00:00:00 2001 From: theo3 Date: Sat, 8 Aug 2020 14:59:11 -0700 Subject: renamed all occurences of "link" to "player" --- src/code_0805436C.c | 2 +- src/code_08077B98.c | 8 ++--- src/code_08077DF4.c | 54 +++++++++++++++--------------- src/enemy/bombPeahat.c | 6 ++-- src/enemy/keese.c | 6 ++-- src/enemy/lakitu.c | 10 +++--- src/enemy/lakituCloud.c | 4 +-- src/enemy/rupeeLike.c | 40 +++++++++++------------ src/enemy/wisp.c | 4 +-- src/entity.c | 6 ++-- src/initializeLink.c | 68 -------------------------------------- src/initializePlayer.c | 68 ++++++++++++++++++++++++++++++++++++++ src/item.c | 40 +++++++++++------------ src/item11.c | 28 ++++++++-------- src/manager/manager6.c | 10 +++--- src/modHealth.c | 4 +-- src/modRupees.c | 2 +- src/npc/anju.c | 4 +-- src/npc/beedle.c | 8 ++--- src/npc/bigGoron.c | 6 ++-- src/npc/bladeBrothers.c | 10 +++--- src/npc/carpenter.c | 4 +-- src/npc/cow.c | 8 ++--- src/npc/dampe.c | 4 +-- src/npc/epona.c | 8 ++--- src/npc/festari.c | 4 +-- src/npc/forestMinish.c | 2 +- src/npc/gentari.c | 4 +-- src/npc/guard.c | 8 ++--- src/npc/malon.c | 4 +-- src/npc/mayorHagen.c | 4 +-- src/npc/moblinLady.c | 2 +- src/npc/mutoh.c | 4 +-- src/npc/postman.c | 8 ++--- src/npc/smith.c | 2 +- src/npc/talon.c | 4 +-- src/npc/teachers.c | 4 +-- src/npc/townMinish.c | 2 +- src/npc/townsperson.c | 6 ++-- src/npc/zelda.c | 4 +-- src/object.c | 2 +- src/object/cloud.c | 10 +++--- src/object/greatFairy.c | 4 +-- src/object/heartContainer.c | 2 +- src/object/houseDoorExterior.c | 6 ++-- src/object/mask.c | 10 +++--- src/object/minecart.c | 74 +++++++++++++++++++++--------------------- src/object/object49.c | 2 +- src/object/object86.c | 12 +++---- src/object/objectA8.c | 4 +-- src/object/treeHidingPortal.c | 4 +-- src/object/well.c | 6 ++-- src/room.c | 40 +++++++++++------------ 53 files changed, 325 insertions(+), 325 deletions(-) delete mode 100644 src/initializeLink.c create mode 100644 src/initializePlayer.c (limited to 'src') diff --git a/src/code_0805436C.c b/src/code_0805436C.c index cc81546c..8ada4bd5 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "room.h" #include "menu.h" diff --git a/src/code_08077B98.c b/src/code_08077B98.c index a29e2c22..cf2b3b2c 100644 --- a/src/code_08077B98.c +++ b/src/code_08077B98.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "functions.h" @@ -23,8 +23,8 @@ extern struct_0811BE48 gUnk_0811BE48[]; void sub_08077B98(UnkItemStruct* unk) { - if ((gLinkState.field_0x2c == NULL) || (gLinkState.field_0x2c[9] != 1)) { - gLinkState.field_0x2c = sub_08077C54(unk); + if ((gPlayerState.field_0x2c == NULL) || (gPlayerState.field_0x2c[9] != 1)) { + gPlayerState.field_0x2c = sub_08077C54(unk); } } @@ -34,7 +34,7 @@ void sub_08077BB8(UnkItemStruct* unk) if (temp != NULL) { temp[0x10] = 0x20; } - gLinkState.field_0x2c = temp; + gPlayerState.field_0x2c = temp; } Entity* sub_08077BD4(ItemBehavior *beh) diff --git a/src/code_08077DF4.c b/src/code_08077DF4.c index 0b849819..1f6d9246 100644 --- a/src/code_08077DF4.c +++ b/src/code_08077DF4.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "functions.h" typedef struct { @@ -18,29 +18,29 @@ void sub_08077DF4(Entity *ent, u32 arg1) if ((arg1 & 0xff) > 0xb8) { arg1 += (ent->entityType).form >> 1; } - gLinkEntity.spriteIndex = (short)(arg1 >> 8); - InitAnimationForceUpdate(&gLinkEntity, (u8)arg1); + gPlayerEntity.spriteIndex = (short)(arg1 >> 8); + InitAnimationForceUpdate(&gPlayerEntity, (u8)arg1); sub_08077E54(ent); } void UpdateItemAnim(Entity *ent) { - UpdateAnimationSingleFrame(&gLinkEntity); + UpdateAnimationSingleFrame(&gPlayerEntity); sub_08077E54(ent); } void sub_08077E3C(Entity *ent) { - sub_080042BA(&gLinkEntity); + sub_080042BA(&gPlayerEntity); sub_08077E54(ent); } void sub_08077E54(Entity *ent) { - ent->action = gLinkEntity.animIndex; - *(u8 *)&ent->spriteIndex = gLinkEntity.frameIndex; - ent->previousActionFlag = gLinkEntity.frameDuration; - ent->actionDelay = gLinkEntity.frames.all; + ent->action = gPlayerEntity.animIndex; + *(u8 *)&ent->spriteIndex = gPlayerEntity.frameIndex; + ent->previousActionFlag = gPlayerEntity.frameDuration; + ent->actionDelay = gPlayerEntity.frames.all; } void sub_08077E78(void* arg0, u32 bits) @@ -49,27 +49,27 @@ void sub_08077E78(void* arg0, u32 bits) u32 not; if (bits == 0) { - if (gLinkState.field_0x2c != NULL) { - ((Unk_bitfield *)gLinkState.field_0x2c)[0x11].b0 = 6; - gLinkState.field_0x2c = (u8 *)bits; + if (gPlayerState.field_0x2c != NULL) { + ((Unk_bitfield *)gPlayerState.field_0x2c)[0x11].b0 = 6; + gPlayerState.field_0x2c = (u8 *)bits; } else { - gLinkState.field_0x2c = (u8 *)bits; + gPlayerState.field_0x2c = (u8 *)bits; } } not = (8 >> bits); - gLinkState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not); + gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not); not = ~not; - gLinkState.field_0xa &= not; - gLinkState.keepFacing &= not; + gPlayerState.field_0xa &= not; + gPlayerState.keepFacing &= not; _DmaZero(arg0, 0x1c); } u32 sub_08077EC8(Unk_struct* arg0) { - if ((gLinkState.field_0x1a[1] & 8) != 0) { + if ((gPlayerState.field_0x1a[1] & 8) != 0) { sub_08077DF4((Entity *)arg0,0x170); arg0->unk[7] = 0x28; arg0->unk[4] = 7; @@ -83,12 +83,12 @@ u32 sub_08077EC8(Unk_struct* arg0) void sub_08077EFC(ItemBehavior* arg0) { - sub_08077F24(arg0, (u16)gLinkState.field_0x90.HALF.LO); + sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO); } void sub_08077F10(ItemBehavior* arg0) { - sub_08077F24(arg0, (u16)gLinkState.field_0x90.HALF.HI); + sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI); } NAKED @@ -105,7 +105,7 @@ void sub_08077F50(ItemBehavior *beh, u32 arg1) u32 sub_08077F64(ItemBehavior* arg0, u32 unk) { u32 temp; - if (gLinkState.heldObject == 0) { + if (gPlayerState.heldObject == 0) { sub_08077F50(arg0, unk); temp = 0; } @@ -119,15 +119,15 @@ void sub_08077F84(void) { Entity *obj; - if (((gLinkEntity.collisionLayer & 2) == 0) && - GetTileTypeByPos(gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) { - sub_0807AA80(&gLinkEntity); - gLinkState.jumpStatus |= 8; + if (((gPlayerEntity.collisionLayer & 2) == 0) && + GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) { + sub_0807AA80(&gPlayerEntity); + gPlayerState.jumpStatus |= 8; obj = CreateObject(0x44, 0, 0); if (obj != NULL) { - obj->x = gLinkEntity.x; - obj->y.HALF.HI = gLinkEntity.y.HALF.HI - 0xc; - gLinkEntity.y.HALF.HI -= 0xc; + obj->x = gPlayerEntity.x; + obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc; + gPlayerEntity.y.HALF.HI -= 0xc; } } } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 1dc3d30f..932c7f6a 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "functions.h" -#include "link.h" +#include "player.h" extern s32 sub_080012DC(Entity*); extern u32 GetNextFunction(Entity*); @@ -72,8 +72,8 @@ void sub_0802A8F4(Entity *this) void sub_0802A8FC(Entity *this) { - if ((gLinkState.field_0x1c & 0xf) == 0) { - this->currentHealth = gLinkState.field_0x1c & 0xf; + if ((gPlayerState.field_0x1c & 0xf) == 0) { + this->currentHealth = gPlayerState.field_0x1c & 0xf; } } diff --git a/src/enemy/keese.c b/src/enemy/keese.c index ea25214b..825c75ed 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "enemy.h" -#include "link.h" +#include "player.h" extern void sub_0804AA30(Entity*, void *); extern u32 sub_0806F520(Entity*); @@ -113,7 +113,7 @@ void sub_08021EBC(Entity *this) this->actionDelay--; } else { - iVar1 = sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x70); + iVar1 = sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70); if (iVar1 != 0) { sub_08021EF0(this); } @@ -139,7 +139,7 @@ void sub_08021F24(Entity *this) this->actionDelay = gUnk_080CB6F6[Random() & 0xf]; InitializeAnimation(this, 1); } - else if (!this->field_0x7a && !(sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x70))) { + else if (!this->field_0x7a && !(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) { this->action = 3; this->actionDelay = 0x1e; InitializeAnimation(this, 1); diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 94dbd2f4..a6d32f1c 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -3,7 +3,7 @@ #include "functions.h" #include "trig.h" #include "random.h" -#include "link.h" +#include "player.h" // Lakitu extern void EnemyFunctionHandler(Entity *, void (*const funcs[])(Entity*)); @@ -268,8 +268,8 @@ void sub_0803CA0C(Entity *this) { } bool32 sub_0803CA4C(Entity *this) { - if (sub_0806FCB8(this, gLinkEntity.x.HALF.HI, gLinkEntity.y.HALF.HI, 0x28) == 0) { - if (sub_080041A0(this, &gLinkEntity, 0x70, 0x50)) { + if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) { + if (sub_080041A0(this, &gPlayerEntity, 0x70, 0x50)) { return 1; } } @@ -278,7 +278,7 @@ bool32 sub_0803CA4C(Entity *this) { } void sub_0803CA84(Entity *this, u32 unkParameter) { - u32 altAnimState = GetFacingDirection(this, &gLinkEntity); + u32 altAnimState = GetFacingDirection(this, &gPlayerEntity); if (((altAnimState - 3) & 7) > 2 || ((this->animationState - (altAnimState >> 3)) & 3) > 1) { u32 intermediate = (altAnimState + 4) & 0x18; @@ -324,7 +324,7 @@ void sub_0803CB34(Entity *this) { this->action = 5; this->damageType = 0xa6; - this->field_0x78.HALF.LO = GetFacingDirection(this, &gLinkEntity); + this->field_0x78.HALF.LO = GetFacingDirection(this, &gPlayerEntity); InitAnimationForceUpdate(this, this->animationState + 8); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 0dca3465..241c8f68 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" extern u32 GetNextFunction(Entity *); @@ -60,7 +60,7 @@ void sub_0803CD40(Entity *this) { ModHealth(-2); - sub_0800449C(&gLinkEntity, 122); + sub_0800449C(&gPlayerEntity, 122); sub_08079D84(); sub_0803CE3C(this); diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index cbd991c4..c127367e 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -4,7 +4,7 @@ #include "functions.h" #include "npc.h" #include "structures.h" -#include "link.h" +#include "player.h" extern void sub_080293DC(Entity*); extern void sub_080296D8(Entity*); @@ -61,7 +61,7 @@ void sub_08029318(Entity* this) { this->field_0xf = 0; this->field_0x82.HALF.HI = 0x41; this->flags2 &= 0xfc; - this->field_0x80.HALF.LO = gLinkEntity.spritePriority.b1; + this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1; sub_08004488(0x104); } else { if (this->field_0x43 != 0) { @@ -116,7 +116,7 @@ void sub_08029474(Entity* this) { if (this->frames.b.f3) { this->action = 3; this->actionDelay = 8; - bVar1 = GetFacingDirection(this, &gLinkEntity); + bVar1 = GetFacingDirection(this, &gPlayerEntity); this->direction = bVar1; this->animationState = (bVar1 << 0x18) >> 0x1c; InitializeAnimation(this, this->animationState); @@ -133,7 +133,7 @@ void sub_080294D4(Entity* this) { if (sub_08049FDC(this, 1) != 0) { if (--this->actionDelay == 0) { this->actionDelay = 8; - sub_08004596(this, GetFacingDirection(this, &gLinkEntity)); + sub_08004596(this, GetFacingDirection(this, &gPlayerEntity)); sub_0802969C(this); } sub_080AEF88(this); @@ -162,13 +162,13 @@ void sub_0802953C(Entity* this) { if (((this->field_0xf > 0x2d) || (gUnk_02002A40.stats.rupees == 0)) && (this->actionDelay == 0)) { sub_080296D8(this); } else { - ResetLink(); - gLinkState.field_0x1a[0] |= 0x80; - PositionRelative(this, &gLinkEntity, 0, 0x10000); + ResetPlayer(); + gPlayerState.field_0x1a[0] |= 0x80; + PositionRelative(this, &gPlayerEntity, 0, 0x10000); pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); - gLinkEntity.spriteOffsetX = pbVar3[0]; - gLinkEntity.spriteOffsetY = pbVar3[1] - 1; - gLinkEntity.spritePriority.b1 = 0; + gPlayerEntity.spriteOffsetX = pbVar3[0]; + gPlayerEntity.spriteOffsetY = pbVar3[1] - 1; + gPlayerEntity.spritePriority.b1 = 0; if (--this->field_0x82.HALF.HI == 0) { this->field_0x82.HALF.HI = 0x41; if (gUnk_02002A40.stats.rupees != 0) { @@ -230,16 +230,16 @@ void sub_080296C8(Entity* this) { } void sub_080296D8(Entity* this) { - gLinkState.jumpStatus = 0x41; - gLinkState.flags.all &= 0xffffffef; - gLinkEntity.flags |= 0x80; - gLinkEntity.field_0x20 = 0x18000; - gLinkEntity.hurtBlinkTime = 0xa6; - gLinkEntity.height.HALF.HI = -2; - gLinkEntity.direction = gLinkEntity.animationState << 2; - gLinkEntity.spritePriority.b1 = this->field_0x80.HALF.LO; - gLinkEntity.spriteOffsetY = 0; - gLinkEntity.nonPlanarMovement = 0x140; + gPlayerState.jumpStatus = 0x41; + gPlayerState.flags.all &= 0xffffffef; + gPlayerEntity.flags |= 0x80; + gPlayerEntity.field_0x20 = 0x18000; + gPlayerEntity.hurtBlinkTime = 0xa6; + gPlayerEntity.height.HALF.HI = -2; + gPlayerEntity.direction = gPlayerEntity.animationState << 2; + gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO; + gPlayerEntity.spriteOffsetY = 0; + gPlayerEntity.nonPlanarMovement = 0x140; this->action = 5; this->field_0xf = 0x3c; this->flags2 |= 3; diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index d6729201..b54bda31 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -2,7 +2,7 @@ #include "entity.h" #include "enemy.h" #include "structures.h" -#include "link.h" +#include "player.h" #include "functions.h" extern void (*const gUnk_080CEB74[])(Entity*); @@ -34,7 +34,7 @@ void sub_08033564(Entity* this) { this->spriteSettings.b.draw = FALSE; this->flags &= 0x7f; this->field_0x7c.HALF.LO = 0x27c; - gLinkState.flags.all |= 0x4000; + gPlayerState.flags.all |= 0x4000; gUnk_02002A40.stats.filler2[4] = this->entityType.form + 1; gUnk_02002A40.stats.field_0x20 = 600; if (this->entityType.form == 0) { diff --git a/src/entity.c b/src/entity.c index deedca95..1ceabce4 100644 --- a/src/entity.c +++ b/src/entity.c @@ -122,18 +122,18 @@ void DeleteEntity(Entity* ent) } } -extern Entity gLinkEntity; +extern Entity gPlayerEntity; void sub_0805E870(Entity*); void sub_0805E84C(void) { - Entity* ent = &gLinkEntity; + Entity* ent = &gPlayerEntity; do { if ((int)ent->field_0x0 < 0) { sub_0805E870(ent); } - } while (ent++, ent < (&gLinkEntity + 80)); + } while (ent++, ent < (&gPlayerEntity + 80)); return; } diff --git a/src/initializeLink.c b/src/initializeLink.c deleted file mode 100644 index 16be6528..00000000 --- a/src/initializeLink.c +++ /dev/null @@ -1,68 +0,0 @@ -#include "global.h" -#include "entity.h" -#include "link.h" -#include "structures.h" -#include "functions.h" -#include "room.h" -#include "flags.h" - -extern u32 gUnk_03000B80; -extern u32 gUnk_03003FC0; - -extern Entity gLinkEntity; - -extern u8 gUnk_080FCAC8[]; - -void InitializeLink(void) -{ - Entity* pl; - - sub_080784C8(); - _DmaZero((void *)&gUnk_03000B80, 0x70); - _DmaZero((void *)&gLinkState, 0xb0); - - _DmaFill32(0xffffffff, &gLinkState.field_0x40, 0x40); - pl = &gLinkEntity; - _DmaZero((void *)pl, 0x88); - gRoomControls.cameraTarget = pl; - gLinkState.linkAction = gUnk_080FCAC8[gScreenTransition.field_0xf]; - if (!CheckGlobalFlag(0x14)) { - gLinkState.flags.all |= 8; - } - switch (gScreenTransition.field_0xf) { - case 0x2: - case 0x6: - pl->height.HALF.HI = -0xc0; - break; - case 0x4: - gLinkState.field_0x34[4] = 0x10; - pl->direction = gScreenTransition.playerState << 2; - case 0x3: - pl->nonPlanarMovement = 0xe0; - break; - case 0x7: - case 0x8: - gLinkState.field_0x34[4] = 1; - gLinkState.field_0x34[5] = gScreenTransition.field_0xf; - break; - case 0xa: - gLinkState.field_0x34[4] = 1; - break; - case 0xb: - gLinkState.field_0x34[4] = 3; - break; - case 0xc: - gLinkState.field_0x34[4] = 4; - } - pl->entityType.type = 1; - pl->flags |= 0xa0; - pl->spritePriority.b0 = 4; - pl->currentHealth = gUnk_02002A40.stats.health; - pl->x.HALF.HI = gScreenTransition.playerStartPos.HALF.x; - pl->y.HALF.HI = gScreenTransition.playerStartPos.HALF.y; - pl->animationState = gScreenTransition.playerState; - pl->collisionLayer = gScreenTransition.playerLayer; - UpdateSpriteForCollisionLayer(pl); - sub_0805EA2C(pl, 1); - sub_08017640(); -} \ No newline at end of file diff --git a/src/initializePlayer.c b/src/initializePlayer.c new file mode 100644 index 00000000..589d550e --- /dev/null +++ b/src/initializePlayer.c @@ -0,0 +1,68 @@ +#include "global.h" +#include "entity.h" +#include "player.h" +#include "structures.h" +#include "functions.h" +#include "room.h" +#include "flags.h" + +extern u32 gUnk_03000B80; +extern u32 gUnk_03003FC0; + +extern Entity gPlayerEntity; + +extern u8 gUnk_080FCAC8[]; + +void InitializePlayer(void) +{ + Entity* pl; + + sub_080784C8(); + _DmaZero((void *)&gUnk_03000B80, 0x70); + _DmaZero((void *)&gPlayerState, 0xb0); + + _DmaFill32(0xffffffff, &gPlayerState.field_0x40, 0x40); + pl = &gPlayerEntity; + _DmaZero((void *)pl, 0x88); + gRoomControls.cameraTarget = pl; + gPlayerState.playerAction = gUnk_080FCAC8[gScreenTransition.field_0xf]; + if (!CheckGlobalFlag(0x14)) { + gPlayerState.flags.all |= 8; + } + switch (gScreenTransition.field_0xf) { + case 0x2: + case 0x6: + pl->height.HALF.HI = -0xc0; + break; + case 0x4: + gPlayerState.field_0x34[4] = 0x10; + pl->direction = gScreenTransition.playerState << 2; + case 0x3: + pl->nonPlanarMovement = 0xe0; + break; + case 0x7: + case 0x8: + gPlayerState.field_0x34[4] = 1; + gPlayerState.field_0x34[5] = gScreenTransition.field_0xf; + break; + case 0xa: + gPlayerState.field_0x34[4] = 1; + break; + case 0xb: + gPlayerState.field_0x34[4] = 3; + break; + case 0xc: + gPlayerState.field_0x34[4] = 4; + } + pl->entityType.type = 1; + pl->flags |= 0xa0; + pl->spritePriority.b0 = 4; + pl->currentHealth = gUnk_02002A40.stats.health; + pl->x.HALF.HI = gScreenTransition.playerStartPos.HALF.x; + pl->y.HALF.HI = gScreenTransition.playerStartPos.HALF.y; + pl->animationState = gScreenTransition.playerState; + pl->collisionLayer = gScreenTransition.playerLayer; + UpdateSpriteForCollisionLayer(pl); + sub_0805EA2C(pl, 1); + sub_08017640(); +} \ No newline at end of file diff --git a/src/item.c b/src/item.c index b757fa6c..8d3e0f72 100644 --- a/src/item.c +++ b/src/item.c @@ -61,28 +61,28 @@ extern u8 gUnk_02034490; #if 0 void Ocarina(ItemBehavior* beh, u32 inputFlags) { gOcarinaStates[beh->stateID](beh, inputFlags); - gLinkEntity.field_0x7a++; + gPlayerEntity.field_0x7a++; } void OcarinaUse(ItemBehavior *beh, u32 arg1) { u32 bVar1; - if (gLinkState.linkAction == 0x18) { - LinkChangeState(beh, arg1); + if (gPlayerState.playerAction == 0x18) { + PlayerChangeState(beh, arg1); } else { beh->field_0x5[4] = beh->field_0x5[4] | 0xf; - gLinkEntity.animationState = 4; - gLinkEntity.spriteSettings.b.flipX = 0; - gLinkEntity.flags &= 0x7f; - gLinkEntity.field_0x7a = 2; - gLinkState.flags.all |= 0x10000000; - gLinkState.field_0x27[0] = 0xff; + gPlayerEntity.animationState = 4; + gPlayerEntity.spriteSettings.b.flipX = 0; + gPlayerEntity.flags &= 0x7f; + gPlayerEntity.field_0x7a = 2; + gPlayerState.flags.all |= 0x10000000; + gPlayerState.field_0x27[0] = 0xff; gUnk_02034490 = 1; bVar1 = (8 >> arg1); - gLinkState.field_0xa |= bVar1; - gLinkState.keepFacing |= bVar1; + gPlayerState.field_0xa |= bVar1; + gPlayerState.keepFacing |= bVar1; sub_08078F60(); sub_08077D38(beh, arg1); PlaySFX(0x216); @@ -98,7 +98,7 @@ void PacciCane(ItemBehavior* beh, u32 arg1) { void sub_08076C98(ItemBehavior* beh, u32 arg1) { beh->field_0x5[4] |= 0xf; sub_08077D38(beh, arg1); - sub_0806F948(&gLinkEntity); + sub_0806F948(&gPlayerEntity); sub_08077BB8(beh); } @@ -118,25 +118,25 @@ void Shield(ItemBehavior* beh, u32 arg1) { } void sub_08076D04(ItemBehavior* beh, u32 arg1) { - gLinkState.field_0x3[0] = 0x81; + gPlayerState.field_0x3[0] = 0x81; beh->field_0x5[4] = 2; - sub_0806F948(&gLinkEntity); + sub_0806F948(&gPlayerEntity); sub_08077D38(beh, arg1); sub_08077BB8(beh); } void sub_08076D34(ItemBehavior* beh, u32 arg1) { if (sub_08077EFC() != 0) { - gLinkState.field_0x3[0] |= 1; + gPlayerState.field_0x3[0] |= 1; UpdateItemAnim(beh); if (beh->field_0x5[9] != 0) { beh->stateID++; beh->field_0xf = 0; - gLinkState.field_0xa &= ~(u8)(8 >> arg1); + gPlayerState.field_0xa &= ~(u8)(8 >> arg1); PlaySFX(0x15d); } } else { - gLinkState.field_0x3[0] = 0; + gPlayerState.field_0x3[0] = 0; sub_08077E78(beh, arg1); } } @@ -144,17 +144,17 @@ void sub_08076D34(ItemBehavior* beh, u32 arg1) { void sub_08076D94(ItemBehavior *beh, u32 arg1) { if (sub_08077EFC(beh)) { - gLinkState.field_0x3[0] |= 1; + gPlayerState.field_0x3[0] |= 1; UpdateItemAnim(beh); } else { - gLinkState.field_0x3[0] = 0; + gPlayerState.field_0x3[0] = 0; sub_08077E78(beh, arg1); } } void GustJar(ItemBehavior *beh, u32 arg1) { - gLinkState.field_0xa8[0] = 3; + gPlayerState.field_0xa8[0] = 3; gUnk_0811BDF4[beh->stateID](beh, arg1); } \ No newline at end of file diff --git a/src/item11.c b/src/item11.c index e6ab76de..a47bdaa9 100644 --- a/src/item11.c +++ b/src/item11.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" extern void DeleteThisEntity(); extern void sub_08078CD0(Entity*); @@ -31,14 +31,14 @@ void sub_08018CBC(Entity *this) u8 uVar2; Entity *pEVar3; - *(u32 *)&this->cutsceneBeh = this->x.WORD = gLinkEntity.x.WORD; - *(u32 *)&this->field_0x80 = this->y.WORD = gLinkEntity.y.WORD; - uVar2 = this->animationState = gLinkEntity.animationState & 0xe; + *(u32 *)&this->cutsceneBeh = this->x.WORD = gPlayerEntity.x.WORD; + *(u32 *)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD; + uVar2 = this->animationState = gPlayerEntity.animationState & 0xe; this->direction = (u8)(uVar2 << 2); this->nonPlanarMovement = 0x400; this->damageType = 0x96; - this->field_0x3c = (gLinkEntity.field_0x3c + 1) | 0x80; - this->flags2 = gLinkEntity.flags2; + this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x80; + this->flags2 = gPlayerEntity.flags2; pEVar3 = this->attachedEntity; if (pEVar3 != NULL) { this->action = 1; @@ -51,7 +51,7 @@ void sub_08018CBC(Entity *this) this->attachedEntity->spriteSettings.b.draw = 0; } else { - if (gLinkState.field_0x1c == 0) { + if (gPlayerState.field_0x1c == 0) { DeleteThisEntity(); } this->action = 2; @@ -59,14 +59,14 @@ void sub_08018CBC(Entity *this) this->spriteIndex = 0xa6; this->palette.raw = 0x33; this->spriteVramOffset = 0; - (this->entityType).form = gLinkState.field_0x1d[0] - 1; + (this->entityType).form = gPlayerState.field_0x1d[0] - 1; this->actionDelay = gUnk_080B3DE0[(this->entityType).form * 2]; this->field_0x44 = gUnk_080B3DE0[(this->entityType).form * 2 + 1]; this->field_0x40 = 0x1b; this->boundingBox = gUnk_080B3DE8[(this->entityType).form]; - (u32 *)gLinkEntity.field_0x70.WORD = this; - sub_08078CD0(&gLinkEntity); - (u32 *)gLinkEntity.field_0x70.WORD = pEVar3; + (u32 *)gPlayerEntity.field_0x70.WORD = this; + sub_08078CD0(&gPlayerEntity); + (u32 *)gPlayerEntity.field_0x70.WORD = pEVar3; InitializeAnimation(this, (this->entityType).form + 10); sub_08018FA0(this); } @@ -79,10 +79,10 @@ void sub_08018DE8(Entity *this) bVar1 = this->attachedEntity->field_0x3a & 4; if (bVar1 == 0) { - gLinkState.field_0x1c = bVar1; + gPlayerState.field_0x1c = bVar1; DeleteThisEntity(); } - switch (gLinkState.field_0x1c) { + switch (gPlayerState.field_0x1c) { case 0: sub_08018F6C(this); break; @@ -95,5 +95,5 @@ void sub_08018DE8(Entity *this) sub_08018FA0(this); break; } - sub_08078CD0(&gLinkEntity); + sub_08078CD0(&gPlayerEntity); } \ No newline at end of file diff --git a/src/manager/manager6.c b/src/manager/manager6.c index deb44026..7914a224 100644 --- a/src/manager/manager6.c +++ b/src/manager/manager6.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "manager.h" extern void* GetCurrentRoomProperty(u8); @@ -19,13 +19,13 @@ void sub_08057CB4(Entity * this) { return; } } - if (this->actionDelay == 0 || gLinkState.field_0x10[2] == 0x1e) { + if (this->actionDelay == 0 || gPlayerState.field_0x10[2] == 0x1e) { for (i = ((UnkManagerHelperStruct*) this->field_0x20);i->field_0x00 != 0xFFFF; i++) { tmp = (i->field_0x07.all & 0x3); - if (((tmp & (gLinkEntity.collisionLayer)) != 0) && - (((gLinkState.flags.all & 0x80) != 0) || ((i->field_0x07.b.unk2) != 0)) && + if (((tmp & (gPlayerEntity.collisionLayer)) != 0) && + (((gPlayerState.flags.all & 0x80) != 0) || ((i->field_0x07.b.unk2) != 0)) && (CheckPlayerInRegion(i->field_0x00,i->field_0x02,i->field_0x04,i->field_0x05) != 0) && - (gLinkEntity.height.HALF.HI == 0)) { + (gPlayerEntity.height.HALF.HI == 0)) { DoExitTransition(GetCurrentRoomProperty(i->field_0x06)); } } diff --git a/src/modHealth.c b/src/modHealth.c index 8706debe..a42917a4 100644 --- a/src/modHealth.c +++ b/src/modHealth.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" s32 ModHealth(s32 deltaHealth) @@ -15,6 +15,6 @@ s32 ModHealth(s32 deltaHealth) newHealth = (u32)gStats.maxHealth; } gStats.health = newHealth; - gLinkEntity.currentHealth = newHealth; + gPlayerEntity.currentHealth = newHealth; return newHealth; } diff --git a/src/modRupees.c b/src/modRupees.c index bbe8b88e..cedec389 100644 --- a/src/modRupees.c +++ b/src/modRupees.c @@ -1,5 +1,5 @@ #include "global.h" -#include "link.h" +#include "player.h" extern u16 gWalletSizes[4]; diff --git a/src/npc/anju.c b/src/npc/anju.c index 19e5a7a2..939e5c45 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "room.h" #include "flags.h" #include "sprite.h" @@ -28,7 +28,7 @@ void Anju(Entity *this) if (this->interactType == 2) { this->action = 2; this->interactType = 0; - InitializeAnimation(this,(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitializeAnimation(this,(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); } else { sub_0807DD94(this, 0); diff --git a/src/npc/beedle.c b/src/npc/beedle.c index bdcce8c7..3b30e19b 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -2,7 +2,7 @@ #include "entity.h" #include "functions.h" #include "textbox.h" -#include "link.h" +#include "player.h" #include "room.h" typedef struct { @@ -118,8 +118,8 @@ void sub_0806346C(Entity* this) { s32 iVar2; s32 iVar3; - iVar3 = (gLinkEntity.x.HALF.HI - this->x.HALF.HI); - iVar2 = (gLinkEntity.y.HALF.HI - this->y.HALF.HI); + iVar3 = (gPlayerEntity.x.HALF.HI - this->x.HALF.HI); + iVar2 = (gPlayerEntity.y.HALF.HI - this->y.HALF.HI); iVar3 += 0x30; iVar2 += 0x18; @@ -139,7 +139,7 @@ void sub_0806346C(Entity* this) { iVar3 >>= 4; iVar2 >>= 4; - bVar1 = gUnk_0810C8F0[(gLinkEntity.animationState >> 1) + iVar3 * 4 + iVar2 * 0x18]; + bVar1 = gUnk_0810C8F0[(gPlayerEntity.animationState >> 1) + iVar3 * 4 + iVar2 * 0x18]; if (bVar1 != this->entityType.parameter) { gUnk_0810C89C_struct* temp = &gUnk_0810C89C[bVar1]; sub_08078850(this, 1, temp->unk_04, temp); diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 3b3a5101..e2024a25 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "structures.h" extern void (*gUnk_081140D4[])(Entity*); @@ -37,10 +37,10 @@ void sub_0806CF30(Entity* this) { case 0: case 1: if (gScreenTransition.frameCount % 4 == 0) { - if (gLinkEntity.x.HALF.HI < this->x.HALF.HI && this->field_0x68.HWORD - 32 < this->x.HALF.HI) { + if (gPlayerEntity.x.HALF.HI < this->x.HALF.HI && this->field_0x68.HWORD - 32 < this->x.HALF.HI) { this->x.HALF.HI--; } - if (gLinkEntity.x.HALF.HI > this->x.HALF.HI && this->field_0x68.HWORD + 32 > this->x.HALF.HI) { + if (gPlayerEntity.x.HALF.HI > this->x.HALF.HI && this->field_0x68.HWORD + 32 > this->x.HALF.HI) { this->x.HALF.HI++; } } diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 3ebb104f..cc6433f6 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -2,7 +2,7 @@ #include "entity.h" #include "functions.h" #include "flags.h" -#include "link.h" +#include "player.h" #include "room.h" #include "textbox.h" @@ -122,7 +122,7 @@ void FUN_08068b2c(Entity* this) { if (this->interactType == '\x02') { this->action = 2; this->interactType = '\0'; - uVar1 = sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)); + uVar1 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); InitAnimationForceUpdate(this, uVar1); sub_0806F118(this); } else { @@ -345,16 +345,16 @@ void sub_08068E78(Entity* this) { } void sub_08068E90(Entity* this) { - LinkState* s = &gLinkState; + PlayerState* s = &gPlayerState; *(u16*)&s->field_0xac = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->field_0xac; } void sub_08068EB4(void) { - gLinkState.field_0xab = 0; + gPlayerState.field_0xab = 0; } void sub_08068EC4(Entity* param_1, Entity* param_2) { - if (gUnk_08111740[param_1->actionDelay] == gLinkState.field_0xab) { + if (gUnk_08111740[param_1->actionDelay] == gPlayerState.field_0xab) { *(u16*)¶m_2->flags = gUnk_0811172A[param_1->actionDelay]; *(u32*)¶m_2->animationState = 1; } else { diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index bbf9a1ed..b28fc197 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "sprite.h" -#include "link.h" +#include "player.h" extern void DeleteThisEntity(); extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*); @@ -35,7 +35,7 @@ void Carpenter(Entity* this) { this->action = 2; this->interactType = 0; this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4 + (this->entityType.form * 8)); + InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + (this->entityType.form * 8)); sub_0806F118(this); } else { sub_0807DDAC(this, 0); diff --git a/src/npc/cow.c b/src/npc/cow.c index ed448997..9c62c898 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" extern void sub_0806ED78(Entity*); extern void sub_0806920C(Entity*); @@ -19,7 +19,7 @@ extern u32 gUnk_08111938[]; extern void PlaySFX(u32); extern u32 Random(); extern u32 UpdateFuseInteraction(Entity*); -extern LinkState gLinkState; +extern PlayerState gPlayerState; void Cow(Entity* ent) { gUnk_08111914[ent->action](ent); @@ -191,7 +191,7 @@ void Cow_ShowDialogue(Entity* ent) { void sub_0806920C(Entity* ent) { // TODO: figure out what bitfield flag this is - u32 var0 = gLinkState.flags.all & 0x80; + u32 var0 = gPlayerState.flags.all & 0x80; u32 var1 = -var0 >> 0x1F; if (var1 != ent->field_0x6c.HALF.HI) { @@ -210,7 +210,7 @@ void sub_0806924C(Entity* ent) { s8 itype = ent->interactType; if (itype != 0) { // TODO: figure out what bitfield flag this is - if ((gLinkState.flags.all & 0x80) != 0) { + if ((gPlayerState.flags.all & 0x80) != 0) { if (itype == 2) { ent->action = 4; sub_0806F118(ent); diff --git a/src/npc/dampe.c b/src/npc/dampe.c index 8e9707a7..f424c1d8 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "room.h" #include "flags.h" #include "sprite.h" @@ -36,7 +36,7 @@ void Dampe(Entity* this) { if (this->interactType == 2) { this->action = 2; this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); sub_0806F118(this); } else { sub_0807DD94(this, 0); diff --git a/src/npc/epona.c b/src/npc/epona.c index 51e2da86..89c18204 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "textbox.h" -#include "link.h" +#include "player.h" #include "functions.h" void sub_08065A64(Entity* this); @@ -56,7 +56,7 @@ void sub_08065A50(Entity* this) { void sub_08065A64(Entity* this) { u32 uVar2; - uVar2 = -(gLinkState.flags.all & 0x80) >> 0x1f; + uVar2 = -(gPlayerState.flags.all & 0x80) >> 0x1f; if (uVar2 != this->field_0x68.HALF.HI) { if (uVar2 == 0) { sub_08078778(this); @@ -69,7 +69,7 @@ void sub_08065A64(Entity* this) { void sub_08065AA4(Entity* this) { if (this->interactType != 0) { - if (gLinkState.flags.all & 0x80) { + if (gPlayerState.flags.all & 0x80) { if (this->interactType == 2) { this->action = 4; sub_0806F118(this); @@ -78,7 +78,7 @@ void sub_08065AA4(Entity* this) { sub_0805E3A0(this, 2); sub_08065A50(this); } - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); } else { sub_08065A50(this); sub_080791D0(); diff --git a/src/npc/festari.c b/src/npc/festari.c index 310db3fa..54688ac2 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -2,7 +2,7 @@ #include "entity.h" #include "functions.h" #include "npc.h" -#include "link.h" +#include "player.h" extern void sub_0805E3A0(Entity*, u32); extern u32 sub_0801E99C(Entity*); @@ -41,7 +41,7 @@ void sub_0805FE48(Entity *this) if (this->interactType == 2) { this->action = 2; this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); } else { diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 7d0daab7..4fa025c6 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -3,7 +3,7 @@ #include "npc.h" #include "flags.h" #include "textbox.h" -#include "link.h" +#include "player.h" #include "structures.h" extern void sub_0805E3A0(Entity*, u32); diff --git a/src/npc/gentari.c b/src/npc/gentari.c index 31b3bdc4..f03f3f0f 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "npc.h" -#include "link.h" +#include "player.h" extern void sub_0805E3A0(Entity*, u32); extern u32 sub_0801E99C(Entity*); @@ -26,7 +26,7 @@ void Gentari(Entity *this) if (this->interactType == 2) { this->action = 2; this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); } else { sub_0807DD94(this, 0); diff --git a/src/npc/guard.c b/src/npc/guard.c index 60fa3fb4..675e2cb6 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "flags.h" #include "textbox.h" #include "room.h" @@ -93,7 +93,7 @@ void sub_08063DC8(Entity* this) { if ((this->entityType).form == 0xff) { this->action = 2; this->actionDelay = 0x1e; - this->animationState = sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)); + this->animationState = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); InitAnimationForceUpdate(this, this->animationState + 4); } else { sub_0806EE20(this); @@ -106,7 +106,7 @@ void sub_08063DC8(Entity* this) { if (this->interactType != 0) { this->action = 3; this->interactType = 0; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_08064428(this); } } @@ -166,7 +166,7 @@ void sub_08063F20(Entity* this) { if (this->interactType != 0) { this->action++; this->interactType = 0; - InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + *(s8*)&this->field_0x70); + InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + *(s8*)&this->field_0x70); sub_08064428(this); } } diff --git a/src/npc/malon.c b/src/npc/malon.c index 4a599435..15b8c1f4 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -2,7 +2,7 @@ #include "functions.h" #include "entity.h" -extern Entity gLinkEntity; +extern Entity gPlayerEntity; extern void (*gUnk_0810FF5C[])(Entity* this); extern void (*gUnk_0810FF64[])(Entity* this); @@ -41,7 +41,7 @@ void sub_080658BC(Entity* this) { if (this->interactType == 2) { this->action = 2; this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); } else { sub_0807DD94(this, 0); diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 9c9cbe51..222ec32c 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "room.h" #include "flags.h" #include "sprite.h" @@ -41,7 +41,7 @@ void MayorHagen(Entity *this) this->action = v; this->interactType = 0; this->field_0x68.HALF.HI = this->animIndex; - InitAnimationForceUpdate(this,4 + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitAnimationForceUpdate(this,4 + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); break; } diff --git a/src/npc/moblinLady.c b/src/npc/moblinLady.c index 2dc1e5f6..8d3f2f49 100644 --- a/src/npc/moblinLady.c +++ b/src/npc/moblinLady.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "room.h" #include "flags.h" #include "sprite.h" diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index e20d6ea6..b0e95a36 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "flags.h" #include "textbox.h" #include "npc.h" @@ -40,7 +40,7 @@ void Mutoh(Entity* this) if (this->interactType == 2) { this->action = 2; this->interactType = 0; - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4); sub_0806F118(this); } else { sub_0807DD94(this, 0); diff --git a/src/npc/postman.c b/src/npc/postman.c index c26dc457..2f357b57 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -3,7 +3,7 @@ #include "functions.h" #include "npc.h" #include "textbox.h" -#include "link.h" +#include "player.h" #include "room.h" #include "structures.h" @@ -145,14 +145,14 @@ void sub_08060528(Entity *this) this->action = 3; this->interactType = 0; sub_0806F118(this); - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); } else { if (this->interactType != 0) { this->action = 2; this->interactType = 0; sub_080606D8(this); - InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); } else { sub_0807DD94(this, 0); @@ -192,7 +192,7 @@ void sub_08060528(Entity *this) sub_080606C0(this); } if ((-1 < this->height.WORD) && - ((gLinkEntity.collisionLayer == 0 || (this->collisionLayer == gLinkEntity.collisionLayer)))) { + ((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) { sub_0806ED78(this); } sub_0800451C(this); diff --git a/src/npc/smith.c b/src/npc/smith.c index ef3b80ac..ca588dba 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -49,7 +49,7 @@ void Smith(Entity *this) this->action = 4; this->interactType = 0; iVar4 = (this->animIndex == 0xc) ? 8 : 0; - iVar2 = sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)); + iVar2 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); InitAnimationForceUpdate(this, iVar2 + iVar4); sub_0806F118(this); } diff --git a/src/npc/talon.c b/src/npc/talon.c index 5b01b650..b4ddbe84 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -2,7 +2,7 @@ #include "entity.h" #include "textbox.h" #include "functions.h" -#include "link.h" +#include "player.h" extern void (*gUnk_0810FEC4[])(Entity* this); extern void (*gUnk_0810FEBC[])(Entity* this); @@ -126,7 +126,7 @@ void sub_080656D4(Entity* this) { void sub_0806574C(Entity* this) { u32 j; - j = (this->animIndex & ~3) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)); + j = (this->animIndex & ~3) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); if (this->animIndex != j) { InitAnimationForceUpdate(this, j); } diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 1a98617f..0d3a9527 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" typedef struct { u8 filler[8]; @@ -41,7 +41,7 @@ void Teachers(Entity* this) { this->interactType = 0; this->field_0x68.HALF.HI = this->animIndex; InitializeAnimation(this, - (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); } else { sub_0807DD94(this, 0); diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index d6595f2b..80d207ef 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -50,7 +50,7 @@ void sub_0806ABFC(Entity *this) s32 unk; u8 field_0x68; - Entity *link = &gLinkEntity; + Entity *link = &gPlayerEntity; if (sub_080041A0(this, link, 0x18, 0x18)) { unk = GetFacingDirection(this, link) & (u8)0x1e; } diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 60748042..7fe6e64a 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "npc.h" -#include "link.h" +#include "player.h" #include "textbox.h" #include "flags.h" #include "structures.h" @@ -145,7 +145,7 @@ void sub_08061D64(Entity* this) { this->interactType = 0; sub_0806F118(this); this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); } else { sub_0807DDAC(this, 0); sub_0807DDE4(this); @@ -158,7 +158,7 @@ void sub_08061D64(Entity* this) { this->interactType = 0; sub_08062048(this); this->field_0x68.HALF.HI = this->animIndex; - InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity))); + InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); } } } diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 43a8e36f..4516b40e 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -20,7 +20,7 @@ extern void sub_0806F62C(Entity*, u32, u32); extern void PlaySFX(u32); extern void SetTileType(u32, u32, u32); -extern Entity gLinkEntity; +extern Entity gPlayerEntity; extern RoomControls gRoomControls; extern void (*gUnk_08110BD8[])(Entity* ent); @@ -86,7 +86,7 @@ void sub_08066D94(Entity* ent) { SetGlobalFlag(ZELDA_CHASE); npc = CreateNPC(0x2E, 0, 0); if (npc != NULL) { - npc->animationState = gLinkEntity.animationState; + npc->animationState = gPlayerEntity.animationState; npc->flags |= 0x20; npc->animationState = GetAnimationState(ent); roomID = gRoomControls.roomID; diff --git a/src/object.c b/src/object.c index d657e5de..6713b8e7 100644 --- a/src/object.c +++ b/src/object.c @@ -63,7 +63,7 @@ void (*const gObjectFunctions[])(Entity*) = { /*0x39*/ BossDoor, /*0x3a*/ Object3A, /*0x3b*/ MacroMushromStalks, - /*0x3c*/ MacroLink, + /*0x3c*/ MacroPlayer, /*0x3d*/ Object3D, /*0x3e*/ Object3E, /*0x3f*/ GiantLeaf, diff --git a/src/object/cloud.c b/src/object/cloud.c index 54fa6621..fce592f1 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "room.h" -#include "link.h" +#include "player.h" #include "flags.h" extern void sub_0809F7BC(Entity*); @@ -25,8 +25,8 @@ extern void sub_0807BB68(u32*, u32, u32); extern u8 gUnk_02034490; extern u32 gScreenTransition; extern void* gUnk_080DD750; -extern Entity gLinkEntity; -extern LinkState gLinkState; +extern Entity gPlayerEntity; +extern PlayerState gPlayerState; extern u8 gUnk_081247C0[]; extern u16 gUnk_081247C8[]; extern u32 gUnk_081247D0; @@ -123,7 +123,7 @@ void sub_0809F69C(Entity* this) { if (--this->actionDelay == 0) { this->actionDelay = 30; this->action = 4; - gRoomControls.cameraTarget = &gLinkEntity; + gRoomControls.cameraTarget = &gPlayerEntity; PlaySFX(115); } } @@ -131,7 +131,7 @@ void sub_0809F69C(Entity* this) { void sub_0809F6CC(Entity* this) { if (((gRoomControls.unk6 & 4) == 0) && (--this->actionDelay == 0)) { - gLinkState.field_0x8b = 1; + gPlayerState.field_0x8b = 1; DeleteThisEntity(); } } diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 4e2c4d40..bfdf0807 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -32,12 +32,12 @@ void GreatFairy(Entity* this) { void GreatFairy_CallBehavior(Entity* this) { GreatFairy_Behaviors[this->action](this); - if ((gLinkEntity.y.HALF.HI - gRoomControls.roomOriginY) < 168) { + if ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) < 168) { gRoomControls.cameraTarget = this; gRoomControls.unk5 = 2; } else { - gRoomControls.cameraTarget = &gLinkEntity; + gRoomControls.cameraTarget = &gPlayerEntity; gRoomControls.unk5 = 2; } } diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index b32b1981..d55f7171 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -63,7 +63,7 @@ static void sub_0808E714(Entity* this) { static void sub_0808E764(Entity* this) { sub_08080CB4(this); - if (!(gLinkState.flags.all & 0x80) && sub_08017850(this)) { + if (!(gPlayerState.flags.all & 0x80) && sub_08017850(this)) { SetFlag(this->cutsceneBeh.HWORD); CreateItemEntity(0x62, 0, 0); DeleteThisEntity(); diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index c68f6b23..4b53add6 100755 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -166,9 +166,9 @@ void sub_0808692C(Entity* this) { static u8 sub_08086954(Entity* this) { if (sub_0800445C(this)) { if (sub_0806ED9C(this, 6, 20) >= 0 && - gLinkEntity.animationState == 0 && - (u16)gLinkState.field_0x90.HALF.LO == 0x400 && - gLinkState.jumpStatus == 0) { + gPlayerEntity.animationState == 0 && + (u16)gPlayerState.field_0x90.HALF.LO == 0x400 && + gPlayerState.jumpStatus == 0) { this->actionDelay--; } } else { diff --git a/src/object/mask.c b/src/object/mask.c index 033039e4..dfabc160 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -3,7 +3,7 @@ #include "room.h" #include "random.h" -extern Entity gLinkEntity; +extern Entity gPlayerEntity; extern u16 gScreenTransition[]; extern void (*MaskActionFuncs[])(Entity *); @@ -76,20 +76,20 @@ void sub_080929A4(Entity *this) { // Probably related to knocking it down void sub_08092A94(Entity *this) { // Check for the first frame of bonking animation - if (gLinkEntity.action != 6) { + if (gPlayerEntity.action != 6) { return; } - if (gLinkEntity.animationState != 0) { + if (gPlayerEntity.animationState != 0) { return; } // Check if link is close enough to the mask - if (this->y.HALF.HI + 40 < gLinkEntity.y.HALF.HI) { + if (this->y.HALF.HI + 40 < gPlayerEntity.y.HALF.HI) { return; } - if (this->x.HALF.HI - gLinkEntity.x.HALF.HI >= this->field_0xf || this->x.HALF.HI - gLinkEntity.x.HALF.HI <= -this->field_0xf) { + if (this->x.HALF.HI - gPlayerEntity.x.HALF.HI >= this->field_0xf || this->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -this->field_0xf) { return; } diff --git a/src/object/minecart.c b/src/object/minecart.c index bc434ff7..783e9696 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -36,7 +36,7 @@ void sub_080916EC(Entity* this) { struct_030010EC* unk = &gUnk_030010EC[this->actionDelay]; *(struct_030010EC**)&this->cutsceneBeh.HWORD = unk; - if ((gRoomControls.roomID != unk->field_0x4) || (gLinkState.flags.all & 0x1000) != 0) { + if ((gRoomControls.roomID != unk->field_0x4) || (gPlayerState.flags.all & 0x1000) != 0) { DeleteThisEntity(); } this->x.HALF.HI = gRoomControls.roomOriginX + ((unk->field_0x0 & 0x3f) << 4) + 8; @@ -66,8 +66,8 @@ void sub_080917DC(Entity* this) { PlaySFX(0x13b); } else { if (sub_0800445C(this) != 0) { - if (((gLinkState.flags.all & 0x40080) == 0) && (gLinkState.field_0x1c == 0) && - (gLinkState.heldObject == 0) && (gLinkState.jumpStatus == 0)) { + if (((gPlayerState.flags.all & 0x40080) == 0) && (gPlayerState.field_0x1c == 0) && + (gPlayerState.heldObject == 0) && (gPlayerState.jumpStatus == 0)) { this->actionDelay++; } else { this->actionDelay = 0; @@ -78,12 +78,12 @@ void sub_080917DC(Entity* this) { if ((this->entityType).parameter == 0) { if (8 < this->actionDelay) { this->action = this->action + 1; - gLinkState.jumpStatus = 0x81; - gLinkState.flags.all |= 0x4000000; - gLinkEntity.field_0x20 = 0x20000; - gLinkEntity.nonPlanarMovement = 0x100; - gLinkEntity.flags &= 0x7f; - ResetLink(); + gPlayerState.jumpStatus = 0x81; + gPlayerState.flags.all |= 0x4000000; + gPlayerEntity.field_0x20 = 0x20000; + gPlayerEntity.nonPlanarMovement = 0x100; + gPlayerEntity.flags &= 0x7f; + ResetPlayer(); sub_0807A108(); PlaySFX(0x7c); } @@ -95,21 +95,21 @@ void sub_080917DC(Entity* this) { void sub_080918A4(Entity *this) { - if (sub_080041A0(this, &gLinkEntity, 2, 2) != 0) { - gLinkEntity.x.HALF.HI = this->x.HALF.HI; - gLinkEntity.y.HALF.HI = this->y.HALF.HI; - if (gLinkEntity.height.HALF.HI > -0x10) { - if ((s32)gLinkEntity.field_0x20 > -1) { + if (sub_080041A0(this, &gPlayerEntity, 2, 2) != 0) { + gPlayerEntity.x.HALF.HI = this->x.HALF.HI; + gPlayerEntity.y.HALF.HI = this->y.HALF.HI; + if (gPlayerEntity.height.HALF.HI > -0x10) { + if ((s32)gPlayerEntity.field_0x20 > -1) { return; } - gLinkEntity.animationState = this->animationState << 1; - gLinkState.flags.all = (gLinkState.flags.all ^ 0x4000000) | 0x1000; + gPlayerEntity.animationState = this->animationState << 1; + gPlayerState.flags.all = (gPlayerState.flags.all ^ 0x4000000) | 0x1000; this->action++; this->field_0xf = 1; this->flags |= 0x20; this->damageType = 0x97; - this->field_0x3c = (gLinkEntity.field_0x3c + 1) | 0x20; - this->flags2 = gLinkEntity.flags2; + this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x20; + this->flags2 = gPlayerEntity.flags2; this->field_0x40 = 0x18; this->field_0x44 = 8; sub_0801766C(this); @@ -118,10 +118,10 @@ void sub_080918A4(Entity *this) } } else { - gLinkEntity.direction = GetFacingDirection(&gLinkEntity, this); + gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, this); } - if (gLinkEntity.field_0x20 < 0) { - gLinkEntity.spritePriority.b0 = this->spritePriority.b0 - 1; + if (gPlayerEntity.field_0x20 < 0) { + gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1; } } @@ -131,25 +131,25 @@ void sub_080919AC(Entity *this) u32 uVar3; gRoomControls.unk5 = 7; - if ((gLinkState.flags.all & 0x1000) == 0) { + if ((gPlayerState.flags.all & 0x1000) == 0) { this->action = 1; return; } - if ((gLinkEntity.frames.all & 0xf) == 0) { + if ((gPlayerEntity.frames.all & 0xf) == 0) { this->flags = this->flags & 0x7f; - CopyPosition(this,&gLinkEntity); - if ((gLinkEntity.frames.all & 0xf0) == 0x10) { + CopyPosition(this,&gPlayerEntity); + if ((gPlayerEntity.frames.all & 0xf0) == 0x10) { this->spriteOffsetY = 1; } else { this->spriteOffsetY = 0; } } else { this->flags = this->flags | 0x80; - gLinkEntity.nonPlanarMovement = 0; + gPlayerEntity.nonPlanarMovement = 0; sub_0806F69C(this); - CopyPosition(this,&gLinkEntity); - gLinkEntity.spritePriority.b0 = this->spritePriority.b0 - 1; + CopyPosition(this,&gPlayerEntity); + gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1; if (!sub_08091DDC(this)) { if ((gScreenTransition.frameCount & 0xf) == 0) { PlaySFX(0x138); @@ -175,13 +175,13 @@ void sub_080919AC(Entity *this) this->flags2 = 0x80; this->action = 6; sub_08017744(this); - gLinkState.jumpStatus = 0x41; - gLinkState.flags.all = (gLinkState.flags.all ^ 0x1000) | 0x4000000; - gLinkEntity.field_0x20 = 0x20000; - gLinkEntity.nonPlanarMovement = 0x200; - gLinkEntity.animationState = this->animationState << 1; - gLinkEntity.direction = this->direction; - gLinkEntity.flags |= 0x80; + gPlayerState.jumpStatus = 0x41; + gPlayerState.flags.all = (gPlayerState.flags.all ^ 0x1000) | 0x4000000; + gPlayerEntity.field_0x20 = 0x20000; + gPlayerEntity.nonPlanarMovement = 0x200; + gPlayerEntity.animationState = this->animationState << 1; + gPlayerEntity.direction = this->direction; + gPlayerEntity.flags |= 0x80; sub_08004168(this); InitAnimationForceUpdate(this, this->animationState + 0xc); PlaySFX(0x78); @@ -197,14 +197,14 @@ void sub_080919AC(Entity *this) case 0x6f: if (uVar3 == sub_080002B8(this)) { sub_08091C0C(this); - gLinkEntity.animationState = this->animationState << 1; + gPlayerEntity.animationState = this->animationState << 1; return; } break; } } - gLinkEntity.animationState = this->animationState << 1; + gPlayerEntity.animationState = this->animationState << 1; if (this->animIndex == this->animationState) { UpdateAnimationSingleFrame(this); } diff --git a/src/object/object49.c b/src/object/object49.c index 925e47ea..e3fa37dd 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -236,7 +236,7 @@ void sub_0808F498(Entity* this) { DeleteThisEntity(); } - if (gLinkState.field_0x1c != 1) { + if (gPlayerState.field_0x1c != 1) { DeleteThisEntity(); } } else { diff --git a/src/object/object86.c b/src/object/object86.c index 5a1c0aec..0520cb55 100644 --- a/src/object/object86.c +++ b/src/object/object86.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "link.h" +#include "player.h" #include "flags.h" extern u32 sub_080041A0(Entity*, Entity*, u32, u32); @@ -58,7 +58,7 @@ void sub_08099E58(Entity *this) void sub_08099E8C(Entity *this) { - if (sub_080041A0(this, &gLinkEntity, 0xc, 0xc)) { + if (sub_080041A0(this, &gPlayerEntity, 0xc, 0xc)) { if (this->previousActionFlag == 0) { sub_08099ECC(this); sub_0805E4E0(this, 0x1e); @@ -74,8 +74,8 @@ void nullsub_534(Entity* this) {} void sub_08099ECC(Entity *this) { this->previousActionFlag = 1; - CopyPosition(this, &gLinkEntity); - gLinkState.linkAction = 3; - gLinkState.field_0x34[4] = 0; - gLinkState.flags.all |= 0x8000; + CopyPosition(this, &gPlayerEntity); + gPlayerState.playerAction = 3; + gPlayerState.field_0x34[4] = 0; + gPlayerState.flags.all |= 0x8000; } diff --git a/src/object/objectA8.c b/src/object/objectA8.c index b68a141a..ab7713c5 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -7,7 +7,7 @@ extern void sub_08080CB4(Entity*); extern void (*gUnk_08124824[])(Entity*); -extern Entity gLinkEntity; +extern Entity gPlayerEntity; void ObjectA8(Entity *this) { @@ -26,7 +26,7 @@ void ObjectA8(Entity *this) case 0x1e: case 0x1f: this->action = 5; - this->attachedEntity = &gLinkEntity; + this->attachedEntity = &gPlayerEntity; CreateItemEntity((this->entityType).form, 0, 0); DeleteThisEntity(); } diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 5b8522b3..52fa5a25 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "flags.h" -#include "link.h" +#include "player.h" #include "room.h" extern void sub_0809E96C(Entity*); @@ -34,7 +34,7 @@ void sub_0809E83C(Entity* this) { void sub_0809E86C(Entity* this) { - if (sub_0800419C(this, &gLinkEntity, 0x30, 0x30)) { + if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) { if (CheckGlobalFlag(EZERO_1ST)) { if (((gScreenTransition & 3) == 0)) { sub_080A2B80(this); diff --git a/src/object/well.c b/src/object/well.c index 07c1237b..fda35fed 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -1,7 +1,7 @@ #include "global.h" #include "entity.h" #include "room.h" -#include "link.h" +#include "player.h" void SetTile(u32 tileIndex, s32 tilePosition, s32 layerIndex); s32 GetTileType(s32 tilePosition, s32 layerIndex); @@ -29,8 +29,8 @@ void sub_080A0EF0(Entity* ent) { tileIndex = GetTileType(ent->field_0x80.HWORD, 1); if (tileIndex != 0x407D) { sub_08078B48(); - gLinkEntity.x.WORD = ent->x.WORD; - gLinkEntity.y.HALF.HI = ent->y.HALF.HI + 4; + gPlayerEntity.x.WORD = ent->x.WORD; + gPlayerEntity.y.HALF.HI = ent->y.HALF.HI + 4; DeleteThisEntity(); } } diff --git a/src/room.c b/src/room.c index 7d9e46d4..6a8136c6 100644 --- a/src/room.c +++ b/src/room.c @@ -5,7 +5,7 @@ #include "functions.h" #include "flags.h" #include "npc.h" -#include "link.h" +#include "player.h" #include "screen.h" #include "main.h" #include "structures.h" @@ -218,7 +218,7 @@ void sub_0804B580(void) { sub_080575C8(0x20); - if (gLinkEntity.y.HALF.HI - gRoomControls.roomOriginY > 0x40) + if (gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY > 0x40) LoadRoomEntityList(&gUnk_080D6138); } @@ -391,8 +391,8 @@ void sub_0804B7E8(void) { if (CheckLocalFlag(0x91)) { ClearLocalFlag(0x91); DoFade(5, 0x100); - gLinkEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x50; - gLinkEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; + gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x50; + gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; sub_080751E8(1, 2, &gUnk_08010A5C); } } @@ -417,8 +417,8 @@ void sub_0804B86C(void) { if (CheckLocalFlag(0x91) != 0) { ClearLocalFlag(0x91); DoFade(5, 0x100); - gLinkEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x50; - gLinkEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; + gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x50; + gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; sub_080751E8(1, 2, &gUnk_08010A5C); } } @@ -445,8 +445,8 @@ void sub_0804B8F0(void) { if (CheckLocalFlag(0x91)) { ClearLocalFlag(0x91); DoFade(5, 0x100); - gLinkEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x60; - gLinkEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; + gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x60; + gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; sub_080751E8(1, 2, &gUnk_08010A5C); } } @@ -652,8 +652,8 @@ extern u32 gUnk_08009E88; void sub_0804BC70(void) { if (!CheckLocalFlag(0x9f)) { DoFade(5, 0x100); - gLinkEntity.x.HALF.HI = gRoomControls.roomOriginX + 0xb0; - gLinkEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x40; + gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0xb0; + gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x40; sub_080751E8(0, 6, &gUnk_08009E88); } if (!CheckGlobalFlag(TABIDACHI)) { @@ -2057,7 +2057,7 @@ extern EntityData gUnk_080DE4C8; void sub_0804CBB0(void) { - if ((gLinkEntity.y.HALF.HI - gRoomControls.roomOriginY) < (gRoomControls.filler2[4] >> 1)) { + if ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) < (gRoomControls.filler2[4] >> 1)) { if (!CheckLocalFlag(0x17)) { LoadRoomEntityList(&gUnk_080DE4C8); } @@ -2425,7 +2425,7 @@ void sub_0804CED8(void) { if (CheckGlobalFlag(LV2_CLEAR)) { gUnk_0200B650 = 0; gScreen.lcd.lcdControl2 &= 0xfdff; - sub_0807AABC(&gLinkEntity); + sub_0807AABC(&gPlayerEntity); LoadRoomEntityList(&gUnk_080E1814); } else { PlaySFX(0x80100000); @@ -3511,14 +3511,14 @@ void sub_0804D6F0(void) { if ((gScreenTransition.field_0x38 & 1) && gScreenTransition.field_0x39) { if (gScreenTransition.field_0x3c == 1) { - gLinkEntity.x.HALF.HI = gScreenTransition.field_0x48; - gLinkEntity.y.HALF.HI = gScreenTransition.field_0x4a + 8; + gPlayerEntity.x.HALF.HI = gScreenTransition.field_0x48; + gPlayerEntity.y.HALF.HI = gScreenTransition.field_0x4a + 8; } else { if (gScreenTransition.field_0x3c) { return; } - gLinkEntity.x.HALF.HI = gScreenTransition.field_0x44; - gLinkEntity.y.HALF.HI = gScreenTransition.field_0x46 + 8; + gPlayerEntity.x.HALF.HI = gScreenTransition.field_0x44; + gPlayerEntity.y.HALF.HI = gScreenTransition.field_0x46 + 8; } } } @@ -4738,7 +4738,7 @@ void sub_0804E7A4(void) { // dog food if ((GetInventoryValue(0x36) == 1) && !CheckGlobalFlag(BIN_DOGFOOD) && - (gLinkState.flags.all & 0x80) == 0) { + (gPlayerState.flags.all & 0x80) == 0) { LoadRoomEntityList(&gUnk_080F30CC); } } @@ -4764,7 +4764,7 @@ void sub_0804E7DC(void) gArea.musicIndex = gArea.pMusicIndex; PlaySFX(0x800b0036); } - if ((gLinkState.flags.all & 8) == 0) { + if ((gPlayerState.flags.all & 8) == 0) { LoadRoomEntityList(&gUnk_080F31D8); } } @@ -4773,8 +4773,8 @@ extern u32 gUnk_08009E58; void sub_0804E864(void) { - gLinkEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x90; - gLinkEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; + gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x90; + gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; sub_080751E8(1, 6, &gUnk_08009E58); ModHealth(0xa0); } -- cgit v1.2.3