diff options
| author | Ibot02 <jtp.jtp@gmx.de> | 2020-08-09 12:16:02 +0200 |
|---|---|---|
| committer | Ibot02 <jtp.jtp@gmx.de> | 2020-08-09 12:17:09 +0200 |
| commit | 0934bc5301844a3fc95696d8d0e1c2899b8b74a9 (patch) | |
| tree | d313765680f2b94719806d221bef34f5d74d01db /src/object | |
| parent | a609afcf8372ff837564c16fb0ba1ed1e9004a39 (diff) | |
| parent | 72118a5ce9565791d15eae725185470e4a7b157b (diff) | |
Merge branch 'master' of github.com:zeldaret/tmc
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/cloud.c | 10 | ||||
| -rw-r--r-- | src/object/greatFairy.c | 4 | ||||
| -rw-r--r-- | src/object/heartContainer.c | 2 | ||||
| -rwxr-xr-x | src/object/houseDoorExterior.c | 6 | ||||
| -rw-r--r-- | src/object/mask.c | 10 | ||||
| -rw-r--r-- | src/object/minecart.c | 229 | ||||
| -rw-r--r-- | src/object/object49.c | 2 | ||||
| -rw-r--r-- | src/object/object86.c | 12 | ||||
| -rw-r--r-- | src/object/objectA8.c | 4 | ||||
| -rwxr-xr-x | src/object/pot.c | 169 | ||||
| -rw-r--r-- | src/object/railtrack.c | 24 | ||||
| -rw-r--r-- | src/object/treeHidingPortal.c | 4 | ||||
| -rw-r--r-- | src/object/well.c | 6 |
13 files changed, 329 insertions, 153 deletions
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 5bf59c5d..783e9696 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -3,6 +3,13 @@ #include "functions.h" #include "room.h" +extern u32 sub_08091DDC(Entity*); +extern u32 sub_080002B4(Entity*, u32, u32); +extern u32 sub_08007DD6(u32, u32); +extern void sub_08017744(Entity*); +extern u32 sub_080002B8(Entity*); +extern void sub_08091C0C(Entity*); + typedef struct { u16 field_0x0; u16 field_0x2; @@ -17,6 +24,9 @@ extern void (*const gUnk_081223A8[])(Entity*); extern struct_030010EC gUnk_030010EC[]; extern BoundingBox gUnk_080FD310; +extern const s8 gUnk_081223C8[]; +extern const u32 gUnk_081223D8[]; + void Minecart(Entity* this) { gUnk_081223A8[this->action](this); this->bitfield = 0; @@ -26,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; @@ -56,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; @@ -68,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); } @@ -85,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); @@ -108,118 +118,99 @@ 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; } } -#if 0 - -typedef struct { - u8 field_0x0; - u8 field_0x1; -} struct_081223C8; - -extern struct_081223C8 gUnk_081223C8[]; - -extern u32 gUnk_081223D8[]; - void sub_080919AC(Entity *this) { - u32 iVar2; - u32 uVar3; - u32 uVar4; - struct_081223C8* temp; + u32 iVar2; + u32 uVar3; - gRoomControls.unk5 = 7; - if ((gLinkState.flags.all & 0x1000) == 0) { - this->action = 1; - } - else { - if ((gLinkEntity.frames.all & 0xf) == 0) { - this->flags = this->flags & 0x7f; - CopyPosition(this,&gLinkEntity); - if ((gLinkEntity.frames.all & 0xf0) == 0x10) { - this->spriteOffsetY = 1; - } - else { - this->spriteOffsetY = 0; - } + gRoomControls.unk5 = 7; + if ((gPlayerState.flags.all & 0x1000) == 0) { + this->action = 1; + return; } - else { - this->flags = this->flags | 0x80; - gLinkEntity.nonPlanarMovement = 0; - sub_0806F69C(this); - CopyPosition(this,&gLinkEntity); - gLinkEntity.spritePriority.b0 = this->spritePriority.b0 - 1; - if (!sub_08091DDC(this)) { - if ((gScreenTransition.field_0x0 & 0xf) == 0) { - PlaySFX(0x138); - } - if (--this->field_0xf == 0xff) { - PlaySFX(0x7b); - this->field_0xf = 0x3c; - } - uVar3 = sub_03005800(this, gUnk_081223C8[this->animationState].field_0x0, gUnk_081223C8[this->animationState].field_0x1); - iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[this->animationState]); - if (iVar2 == 0) { - this->direction = this->direction ^ 0x10; - this->animationState = this->animationState ^ 2; + if ((gPlayerEntity.frames.all & 0xf) == 0) { + this->flags = this->flags & 0x7f; + CopyPosition(this,&gPlayerEntity); + if ((gPlayerEntity.frames.all & 0xf0) == 0x10) { + this->spriteOffsetY = 1; + } else { + this->spriteOffsetY = 0; } - else { - switch(uVar3) { - case 100: - this->flags = this->flags & 0xdf; - this->damageType = 1; - this->field_0x3c = 0x47; - this->field_0x40 = 0x44; - 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; - sub_08004168(this); - InitAnimationForceUpdate(this, this->animationState + 0xc); - PlaySFX(0x78); - PlaySFX(0x139); - return; - case 0x67: - case 0x68: - case 0x69: - case 0x6a: - case 0x6c: - case 0x6d: - case 0x6e: - case 0x6f: - if (uVar3 == sub_080002B8()) { - sub_08091C0C(this); - gLinkEntity.animationState *= 2; - return; - } + } else { + this->flags = this->flags | 0x80; + gPlayerEntity.nonPlanarMovement = 0; + sub_0806F69C(this); + CopyPosition(this,&gPlayerEntity); + gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1; + if (!sub_08091DDC(this)) { + if ((gScreenTransition.frameCount & 0xf) == 0) { + PlaySFX(0x138); + } + + if (--this->field_0xf == 0xff) { + PlaySFX(0x7b); + this->field_0xf = 0x3c; + } + + uVar3 = sub_080002B4(this, gUnk_081223C8[this->animationState * 2], gUnk_081223C8[this->animationState * 2 + 1]); + iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[this->animationState]); + if (iVar2 == 0) { + this->direction = this->direction ^ 0x10; + this->animationState = this->animationState ^ 2; + } else { + switch (uVar3) { + case 0x64: + this->flags = this->flags & 0xdf; + this->damageType = 1; + this->field_0x3c = 0x47; + this->field_0x40 = 0x44; + this->flags2 = 0x80; + this->action = 6; + sub_08017744(this); + 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); + PlaySFX(0x139); + return; + case 0x67: + case 0x68: + case 0x69: + case 0x6a: + case 0x6c: + case 0x6d: + case 0x6e: + case 0x6f: + if (uVar3 == sub_080002B8(this)) { + sub_08091C0C(this); + gPlayerEntity.animationState = this->animationState << 1; + return; + } + break; + } + } + + gPlayerEntity.animationState = this->animationState << 1; + if (this->animIndex == this->animationState) { + UpdateAnimationSingleFrame(this); + } + else { + InitAnimationForceUpdate(this, this->animationState); } } - gLinkEntity.animationState *= 2; - if (this->animIndex == this->animationState) { - UpdateAnimationSingleFrame(this); - } - else { - InitAnimationForceUpdate(this, this->animationState); - } - } } - } -} -#else -NAKED -void sub_080919AC(Entity *this) { - asm(".include \"asm/non_matching/minecart/sub_080919AC.inc\""); } -#endif
\ No newline at end of file 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/pot.c b/src/object/pot.c new file mode 100755 index 00000000..a31a5567 --- /dev/null +++ b/src/object/pot.c @@ -0,0 +1,169 @@ +#include "global.h" +#include "entity.h" +#include "functions.h" +#include "flags.h" +#include "player.h" +#include "room.h" + +extern void (*const gUnk_0811F090[])(Entity*); +extern void (*const gUnk_0811F0A8[])(Entity*); + +extern BoundingBox gUnk_080FD338; // TODO: should be const +extern BoundingBox gUnk_080FD340; // TODO: should be const + +extern u32 sub_08016A30(Entity*); +extern u32 sub_080001DA(u32, u32); +extern u32 GetTileTypeByEntity(Entity*); +extern void sub_08078930(Entity*); +extern void sub_08082824(Entity*); +extern u32 sub_080002B8(Entity*); +extern void sub_08082850(Entity*, Entity*); +extern void sub_08082608(Entity*); + +void Pot(Entity* this) { + gUnk_0811F090[this->action](this); + this->bitfield = 0; +} + +void sub_0808222C(Entity* this) { + if (this->entityType.parameter == 1 && CheckFlags(this->field_0x86)) { + DeleteThisEntity(); + } + + this->action = 1; + this->boundingBox = &gUnk_080FD338; + this->nonPlanarMovement = 0x80; + this->y.HALF.HI += 3; + this->possibleBool = 0; + this->flags |= 0x80; + this->currentHealth = 1; + this->field_0x3c = 7; + this->damageType = 0x6E; + this->flags2 = 0x84; + this->field_0x1c = 0x12; + if (this->collisionLayer == 0) { + sub_08016A30(this); + } + + this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer); + if ((u16)this->field_0x70.HALF.LO == 0x4000) { + DeleteThisEntity(); + } + + SetTile(0x4000, COORD_TO_TILE(this), this->collisionLayer); + InitializeAnimation(this, 5); +} + +void sub_08082310(Entity* this) { + u32 tileType; + u32 var0 = this->bitfield & 0x7F; + switch (var0) { + case 0x13: + this->action = 3; + this->previousActionFlag = 0; + break; + case 0x1D: + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + this->action = 5; + this->field_0x20 = 0x2A000; + this->spriteOffsetY = 0; + this->spriteSettings.b.shadow = 1; + this->spritePriority.b1 = 3; + this->flags &= 0x7F; + sub_08082824(this); + break; + default: + tileType = GetTileTypeByEntity(this); + if (tileType != 0x4000) { + switch (tileType) { + case 0x4004: + case 0x4003: + case 0x4002: + case 0x4001: + this->direction = (tileType - 0x4001) * 8; + this->actionDelay = 32; + this->action = 4; + if (gPlayerState.flags.all & 0x80) { + this->nonPlanarMovement >>= 1; + this->actionDelay = 64; + } + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + sub_08004488(0x10F); + break; + case 0x4067: + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + DeleteThisEntity(); + break; + default: + if (sub_080002B8(this) == 13) { + CreateFx(this, 0, 0); + } else if (tileType == 0x4005) { + gPlayerState.field_0xab = 4; + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + } + sub_08082850(this, NULL); + break; + } + } else { + sub_08078930(this); + } + break; + } +} + +void sub_080824F8(Entity* this) { + gUnk_0811F0A8[this->previousActionFlag](this); +} + +void sub_08082510(Entity* this) { + this->flags |= 0x80; + this->boundingBox = &gUnk_080FD340; + this->field_0x3c = 7; + this->damageType = 1; + this->flags2 = gPlayerEntity.flags2; + this->spriteOffsetY = 0; + SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); + this->previousActionFlag++; +} + + +void nullsub_511(Entity* this) { +} + +void sub_08082588(Entity* this) { + this->spritePriority.b1 = 3; +} + +void sub_0808259C(Entity* this) { + switch (sub_080043E8(this)) { + case 2: + CreateFx(this, 11, 0); + break; + case 1: + CreateFx(this, 0, 0); + break; + case 3: + CreateFx(this, 12, 0); + break; + default: + sub_08082850(this, &gPlayerEntity); + return; + } + + DeleteThisEntity(); +} + +void sub_080825E8(Entity* this) { + DeleteThisEntity(); +} + +void sub_080825F0(Entity* this) { + if (gPlayerState.heldObject == 0) { + sub_08082608(this); + } +} + +void sub_08082608(Entity* this) { + this->action = 1; + this->previousActionFlag = 0; +} diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 95c418f4..f2e9a10a 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -12,8 +12,8 @@ extern void SetTile(u32, u32, u32); extern void (*const gUnk_081205D0[])(Entity*); +extern s8 gUnk_080B4488[][2]; extern u16 gUnk_081205E0[]; -extern s8 gUnk_080B4488[]; void Railtrack(Entity* this) { gUnk_081205D0[this->action](this); @@ -135,14 +135,30 @@ void sub_0808543C(Entity *this) u32 uVar2; s8 temp; - temp = gUnk_080B4488[(this->animationState >> 1) << 1]; + temp = gUnk_080B4488[this->animationState / 2][0]; uVar2 = COORD_TO_TILE(this); SetTile(this->field_0x74, uVar2 - temp, this->collisionLayer); SetTile(this->field_0x76, uVar2, this->collisionLayer); SetTile(this->field_0x78.HWORD, uVar2 + temp, this->collisionLayer); } -NAKED u32 sub_080854A8(Entity *this) { - asm(".include \"asm/non_matching/railtrack/sub_080854A8.inc\""); + u16 var0; + u16* var1; + s8* var2; + + var0 = gUnk_081205E0[this->animationState / 2]; + var2 = gUnk_080B4488[this->animationState / 2]; + var1 = (u16 *)this->field_0x70.WORD; + if (var0 != *(var1 - var2[0])) { + return TRUE; + } + if (var0 != *var1) { + return TRUE; + } + if (var0 != *(var1 + var2[0])) { + return TRUE; + } + + return FALSE; }
\ No newline at end of file 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(); } } |
