summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-03-11 17:08:36 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2022-03-11 17:08:36 +0100
commit3006233238ac10faa86975afa75e0488ffe06bcf (patch)
tree108e46f1d423398a5aee957efcd7401048f39cd9 /src/object
parent09ddc08f51e856c572758ee5b59b93089a46a9ae (diff)
Decompile Object5B
Diffstat (limited to 'src/object')
-rw-r--r--src/object/object5B.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/object/object5B.c b/src/object/object5B.c
new file mode 100644
index 00000000..01c324d7
--- /dev/null
+++ b/src/object/object5B.c
@@ -0,0 +1,86 @@
+/**
+ * @file object5B.c
+ * @ingroup Objects
+ *
+ * @brief Object5B object
+ */
+
+#define NENT_DEPRECATED
+#include "global.h"
+#include "object.h"
+#include "functions.h"
+
+typedef struct {
+ /*0x00*/ Entity base;
+ /*0x68*/ u8 unk_68[0x1a];
+ /*0x82*/ u16 unk_82;
+ /*0x84*/ ScriptExecutionContext* unk_84;
+} Object5BEntity;
+
+void sub_080928C8(Object5BEntity*);
+void nullsub_119(Object5BEntity*);
+void sub_08092930(Object5BEntity*);
+void sub_08092940(Object5BEntity*);
+void sub_08092958(Object5BEntity*, ScriptExecutionContext*);
+
+void Object5B(Object5BEntity* this) {
+ static void (*const gUnk_08122794[])(Object5BEntity*) = {
+ sub_080928C8,
+ nullsub_119,
+ };
+ static void (*const gUnk_0812279C[])(Object5BEntity*) = {
+ sub_08092930,
+ sub_08092940,
+ };
+ if ((super->flags & 2) != 0) {
+ gUnk_0812279C[super->action](this);
+ } else {
+ gUnk_08122794[super->action](this);
+ }
+}
+
+void sub_080928C8(Object5BEntity* this) {
+ super->action = 1;
+ super->spriteSettings.draw = 1;
+ super->frameIndex = super->type;
+ super->spriteRendering.b3 = 3;
+ super->spritePriority.b0 = 6;
+ super->spriteOrientation.flipY = 2;
+ switch (super->type) {
+ case 2:
+ CreateObjectWithParent(super, OBJECT_5B, 4, 0);
+ break;
+ case 4:
+ super->spritePriority.b0 = 7;
+ break;
+ }
+}
+
+void nullsub_119(Object5BEntity* this) {
+}
+
+void sub_08092930(Object5BEntity* this) {
+ sub_080928C8(this);
+ this->unk_82 = 0;
+}
+
+void sub_08092940(Object5BEntity* this) {
+ ExecuteScript(super, this->unk_84);
+ sub_08092958(this, this->unk_84);
+}
+
+void sub_08092958(Object5BEntity* this, ScriptExecutionContext* context) {
+ u32 tmp;
+ while (context->postScriptActions != 0) {
+ tmp = (~context->postScriptActions + 1) & context->postScriptActions;
+ context->postScriptActions = context->postScriptActions ^ tmp;
+ switch (tmp) {
+ case 1:
+ super->frameIndex = 0;
+ break;
+ case 2:
+ super->frameIndex = context->intVariable;
+ break;
+ }
+ }
+}