From ae587390b4af257a39b3dfb6d2f656fdaed82d77 Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Fri, 11 Mar 2022 17:08:40 +0100 Subject: Decompile ObjectB3 --- src/object/objectB3.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 src/object/objectB3.c (limited to 'src/object') diff --git a/src/object/objectB3.c b/src/object/objectB3.c new file mode 100644 index 00000000..770d4e27 --- /dev/null +++ b/src/object/objectB3.c @@ -0,0 +1,106 @@ +/** + * @file objectB3.c + * @ingroup Objects + * + * @brief ObjectB3 object + */ + +#define NENT_DEPRECATED +#include "global.h" +#include "object.h" +#include "functions.h" +#include "kinstone.h" + +void sub_080A0ADC(Entity*); +void sub_080A0AF0(Entity*); +void sub_080A0AC4(Entity*); +void sub_080A0AD0(Entity*); +void sub_080A0B4C(Entity*); +void sub_080A0B60(Entity*); +void sub_080A0B80(Entity*); + +void ObjectB3(Entity* this) { + static void (*const gUnk_08124A10[])(Entity*) = { + sub_080A0ADC, + sub_080A0AF0, + }; + static void (*const gUnk_08124A18[])(Entity*) = { + sub_080A0AC4, + sub_080A0AD0, + }; + static void (*const gUnk_08124A20[])(Entity*) = { + sub_080A0B4C, + sub_080A0B60, + sub_080A0B80, + }; + void (*const* ptr)(Entity*); + + switch (this->type) { + case 0: + if ((this->flags & 2) != 0) { + ptr = gUnk_08124A10; + } else { + ptr = gUnk_08124A18; + } + break; + case 1: + ptr = gUnk_08124A20; + break; + } + ptr[this->action](this); + if (this->action == 0) { + this->action = 1; + this->spriteRendering.b3 = 1; + this->spritePriority.b0 = 0; + this->spriteOrientation.flipY = 1; + ChangeObjPalette(this, gUnk_080C9CBC[gFuseInfo._3].unk0); + } + GetNextFrame(this); +} + +void sub_080A0AC4(Entity* this) { + InitializeAnimation(this, this->type); +} + +void sub_080A0AD0(Entity* this) { + GravityUpdate(this, 0x80); +} + +void sub_080A0ADC(Entity* this) { + sub_0807DD64(this); + ExecuteScriptForEntity(this, NULL); +} + +void sub_080A0AF0(Entity* this) { + ExecuteScriptForEntity(this, NULL); + GetNextFrame(this); + if (this->animIndex == 5) { + if ((this->frame & 0x80) != 0) { + DeleteThisEntity(); + } + } + GravityUpdate(this, 0x80); +} + +void sub_080A0B28(Entity* this, ScriptExecutionContext* context) { + sub_0807DEDC(this, context, this->x.HALF.HI, this->y.HALF.HI); + this->y.HALF.HI -= 0xb0; + this->spriteSettings.draw = 0; +} + +void sub_080A0B4C(Entity* this) { + this->x.HALF.HI = 0x78; + this->y.HALF.HI = 0x50; + InitializeAnimation(this, 0); +} + +void sub_080A0B60(Entity* this) { + if ((this->frame & 0x40) != 0) { + this->action = 2; + SoundReq(SFX_136); + } +} + +void sub_080A0B80(Entity* this) { + this->y.WORD -= 0x28000; +} -- cgit v1.2.3