summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authornotyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com>2020-08-08 10:24:02 -0700
committerGitHub <noreply@github.com>2020-08-08 10:24:02 -0700
commitf73606fc2e4aea1bfc51f30a06dacb8734747eed (patch)
tree9870b51bb191ee492650b47e02faed527e66053b /src/object
parent10819392f7a23c5390cbb3505e3ed1eea79bbe4b (diff)
parentd53fdf3f473728c2e399253beb4e65838f5dfd56 (diff)
Merge pull request #45 from huderlem:nonmatchings
Nonmatchings
Diffstat (limited to 'src/object')
-rw-r--r--src/object/minecart.c187
-rw-r--r--src/object/railtrack.c24
2 files changed, 109 insertions, 102 deletions
diff --git a/src/object/minecart.c b/src/object/minecart.c
index 5bf59c5d..bc434ff7 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;
@@ -115,111 +125,92 @@ void sub_080918A4(Entity *this)
}
}
-#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 ((gLinkState.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 ((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;
}
- 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;
+ gLinkEntity.nonPlanarMovement = 0;
+ sub_0806F69C(this);
+ CopyPosition(this,&gLinkEntity);
+ gLinkEntity.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);
+ 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(this)) {
+ sub_08091C0C(this);
+ gLinkEntity.animationState = this->animationState << 1;
+ return;
+ }
+ break;
+ }
+ }
+
+ gLinkEntity.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/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