summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-03-10 20:52:50 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2022-03-10 20:52:50 +0100
commit53913b78d0028c24289bfee00eae7051331cb48c (patch)
tree596772ff92959f20cebc4eff2af7d04b502f0136 /src/object
parentcffa1024ca98b517031dc6965717774e25e6482a (diff)
Decompile Object4B
Diffstat (limited to 'src/object')
-rw-r--r--src/object/object4B.c117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/object/object4B.c b/src/object/object4B.c
new file mode 100644
index 00000000..9181944f
--- /dev/null
+++ b/src/object/object4B.c
@@ -0,0 +1,117 @@
+/**
+ * @file object4B.c
+ * @ingroup Objects
+ *
+ * @brief Object4B object
+ */
+
+#define NENT_DEPRECATED
+#include "global.h"
+#include "object.h"
+#include "functions.h"
+#include "menu.h"
+
+typedef struct {
+ /*0x00*/ Entity base;
+} Object4BEntity;
+
+void Object4B_Init(Object4BEntity*);
+void Object4B_Action1(Object4BEntity*);
+void Object4B_Action2(Object4BEntity*);
+void Object4B_Action3(Object4BEntity*);
+void Object4B_Action4(Object4BEntity*);
+void Object4B_Action5(Object4BEntity*);
+void Object4B_Action6(Object4BEntity*);
+void Object4B_Action7(Object4BEntity*);
+
+void Object4B(Object4BEntity* this) {
+ static void (*const Object4B_Actions[])(Object4BEntity*) = {
+ Object4B_Init, Object4B_Action1, Object4B_Action2, Object4B_Action3, Object4B_Action4, Object4B_Action5, Object4B_Action6, Object4B_Action7,
+ };
+ Object4B_Actions[super->action](this);
+}
+
+void Object4B_Init(Object4BEntity* this) {
+ super->action = 1;
+ super->actionDelay = 0x3c;
+ InitializeAnimation(super, 0);
+}
+
+void Object4B_Action1(Object4BEntity* this) {
+ if (--super->actionDelay == 0) {
+ super->actionDelay = 0x78;
+ super->action++;
+ super->spriteSettings.draw = 1;
+ }
+}
+
+void Object4B_Action2(Object4BEntity* this) {
+ GetNextFrame(super);
+ if ((super->frame & 0x80) != 0) {
+ super->action++;
+ super->spritePriority.b1 = 3;
+ InitializeAnimation(super, 2);
+ }
+}
+
+void Object4B_Action3(Object4BEntity* this) {
+ GetNextFrame(super);
+ if (--super->actionDelay == 0) {
+ super->action++;
+ super->direction = 0;
+ super->speed = 0x100;
+ super->zVelocity = 0x20000;
+ super->spriteOrientation.flipY = 0;
+ super->actionDelay = 0;
+ InitializeAnimation(super, 3);
+ SoundReq(SFX_12B);
+ }
+}
+
+void Object4B_Action4(Object4BEntity* this) {
+ if ((super->frame & 0x10) != 0) {
+ LinearMoveUpdate(super);
+ if (GravityUpdate(super, 0x2000) == 0) {
+ GetNextFrame(super);
+ }
+ } else {
+ GetNextFrame(super);
+ }
+ if ((super->y.HALF.HI - gRoomControls.origin_y) < 0x231) {
+ super->y.HALF.HI = gRoomControls.origin_y + 0x230;
+ if ((super->frame & 0x80) != 0) {
+ super->action++;
+ super->actionDelay = 0x78;
+ InitializeAnimation(super, 2);
+ }
+ } else if ((super->frame & 0x80) != 0) {
+ super->zVelocity = 0x20000;
+ InitializeAnimation(super, 3);
+ SoundReq(SFX_12B);
+ }
+}
+
+void Object4B_Action5(Object4BEntity* this) {
+ GetNextFrame(super);
+ if (--super->actionDelay == 0) {
+ super->action++;
+ InitializeAnimation(super, 5);
+ }
+}
+
+void Object4B_Action6(Object4BEntity* this) {
+ GetNextFrame(super);
+ if ((super->frame & 0x80) != 0) {
+ super->action++;
+ super->actionDelay = 0x3c;
+ InitializeAnimation(super, 1);
+ }
+}
+
+void Object4B_Action7(Object4BEntity* this) {
+ GetNextFrame(super);
+ if (--super->actionDelay == 0) {
+ gMenu.overlayType++;
+ DeleteThisEntity();
+ }
+}