summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-03-11 17:08:21 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2022-03-11 17:08:21 +0100
commit2044fdcaff7fde3d49362f38c34ce9fcdff4d348 (patch)
treefbb9632bd03bd4499e5e15fedd27f2e9e27cb2ff /src
parent1aef85e81c2e51e40b9d77aa1adc4a7688bf2ba3 (diff)
Decompile Object1E
Diffstat (limited to 'src')
-rw-r--r--src/object/object1E.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/src/object/object1E.c b/src/object/object1E.c
new file mode 100644
index 00000000..844fb0f5
--- /dev/null
+++ b/src/object/object1E.c
@@ -0,0 +1,107 @@
+/**
+ * @file object1E.c
+ * @ingroup Objects
+ *
+ * @brief Object1E object
+ */
+
+#define NENT_DEPRECATED
+#include "global.h"
+#include "object.h"
+#include "functions.h"
+#include "area.h"
+
+
+void sub_08087528(Entity*);
+void sub_080875F4(Entity*);
+void sub_08087640(Entity*);
+
+void Object1E(Entity* this) {
+ static void (*const gUnk_081208B8[])(Entity*) = {sub_08087528, sub_080875F4, };
+ if (!EntityIsDeleted(this)) {
+ gUnk_081208B8[this->action](this);
+ }
+}
+
+NONMATCH("asm/non_matching/object1E/sub_08087528.inc", void sub_08087528(Entity* this)) {
+ u32 palette;
+
+ this->action = 1;
+ this->animationState = gPlayerEntity.animationState >> 1;
+ this->spriteRendering.b3 = 2;
+ this->spritePriority.b0 = 3;
+ this->spriteOrientation.flipY--;
+ if (this->type2 != 0) {
+ this->palette.b.b0 = 1;
+ if (this->animationState == 1) {
+ this->spriteSettings.flipX = 1;
+ }
+ sub_08087640(this);
+ } else {
+ if (gArea.locationIndex == 0x10) {
+ palette = 0x16a;
+ } else {
+ palette = 4;
+ }
+ ChangeObjPalette(this, palette);
+ switch (this->animationState) {
+ case 1:
+ this->spriteSettings.flipX = 1;
+ if (this->type == 0x40) {
+ this->y.HALF.HI += 4;
+ }
+ break;
+ case 3:
+ if (this->type == 0x40) {
+ this->y.HALF.HI += 4;
+ }
+ break;
+ default:
+ if (this->type == 0x40) {
+ this->spriteSettings.flipX = 1;
+ }
+ break;
+ }
+ }
+ SetDefaultPriority(this, 3);
+ InitializeAnimation(this, this->type2 * 4 + this->animationState);
+}
+END_NONMATCH
+
+void sub_080875F4(Entity* this) {
+ GetNextFrame(this);
+ if ((this->frame & 0x80) != 0) {
+ DeleteThisEntity();
+ }
+ if (this->type2 != 0) {
+ this->spritePriority.b0 =gPlayerEntity.spritePriority.b0 + 1 - this->frame;
+ }
+}
+
+void sub_08087640(Entity* this) {
+ static const s8 gUnk_081208C0[] = { 0, -12, 16, 0, 0, 15, -16, 0 };
+ s32 oldX;
+ s32 oldY;
+ u32 tmp;
+ const s8* ptr;
+
+ oldX = this->x.HALF.HI;
+ oldY = this->y.HALF.HI;
+ ptr = &gUnk_081208C0[this->animationState * 2];
+ this->x.HALF.HI += ptr[0];
+ this->y.HALF.HI += ptr[1];
+ if (gRoomControls.area == 3 && gRoomControls.room == 4) {
+#ifdef EU
+ tmp = 0x18;
+ } else {
+ tmp = 0x17;
+#else
+ tmp = 0x17;
+ } else {
+ tmp = 0x16;
+#endif
+ }
+ CreateRandomItemDrop(this, tmp);
+ this->x.HALF.HI = oldX;
+ this->y.HALF.HI = oldY;
+}