summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-01-29 10:42:49 -0800
committerGitHub <noreply@github.com>2022-01-29 10:42:49 -0800
commit870f14893dee22e44eca7856dc154ce0e45e2388 (patch)
tree80869acd4554c89414dc7f9ddc48f0e84dd566cb /src/object
parentfd9049f59801a77ced44d85329ee871fda031d22 (diff)
parent7a2fefb8a4692a6bf1a65172a39f520f7a6143a3 (diff)
Merge pull request #323 from hatal175/object2a
Diffstat (limited to 'src/object')
-rw-r--r--src/object/object2A.c64
1 files changed, 61 insertions, 3 deletions
diff --git a/src/object/object2A.c b/src/object/object2A.c
index 5ef7ba3e..743eb305 100644
--- a/src/object/object2A.c
+++ b/src/object/object2A.c
@@ -4,13 +4,15 @@
#include "functions.h"
#include "flags.h"
-extern void (*const gUnk_08120DD0[])(Entity*);
+extern void sub_0807AB44(Entity*, s32, s32);
+
+void (*const gUnk_08120DD0[])(Entity*);
void Object2A(Entity* this) {
gUnk_08120DD0[this->action](this);
}
-void sub_08089B18(Entity* this) {
+void Object2A_Init(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
if (this->type2 != 0) {
@@ -36,5 +38,61 @@ void sub_08089B18(Entity* this) {
return;
}
}
- EnqueueSFX(0x124);
+ EnqueueSFX(SFX_124);
}
+
+void sub_08089BA0(Entity* this) {
+ u32 val;
+ GetNextFrame(this);
+
+ switch (this->type) {
+ case 0:
+ default:
+ if (this->type2 == 0)
+ return;
+ case 1:
+ case 2:
+ if (--this->actionDelay != 0xff)
+ return;
+ if (this->type == 2) {
+ sub_0807B7D8(((u16*)this->child)[3], COORD_TO_TILE(this), this->collisionLayer);
+ sub_0807AB44(this, 0, 0x10);
+ sub_0807AB44(this, 0, -0x10);
+ sub_0807AB44(this, 0x10, 0);
+ sub_0807AB44(this, -0x10, 0);
+ }
+ DeleteThisEntity();
+ break;
+ case 3:
+ if (this->parent->next == NULL) {
+ DeleteThisEntity();
+ }
+ if (--this->actionDelay == 0) {
+ DeleteThisEntity();
+ }
+
+ CopyPosition(this->parent, this);
+ break;
+ case 4:
+ val = CheckFlags(this->field_0x86.HWORD);
+ if (this->subAction == 0) {
+ if (val)
+ return;
+ this->subAction = 1;
+ this->spriteSettings.draw = 0;
+ } else {
+ if (!val)
+ return;
+ this->subAction = 0;
+ this->spriteSettings.draw = 1;
+ InitializeAnimation(this, 0);
+ EnqueueSFX(SFX_124);
+ }
+ break;
+ }
+}
+
+void (*const gUnk_08120DD0[])(Entity*) = {
+ Object2A_Init,
+ sub_08089BA0,
+};