From 9aecd883568759da417bfb2958f31a965049bd3c Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Sat, 19 Mar 2022 08:41:38 +0200 Subject: Decompile picoBloom --- src/object/picoBloom.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/object/picoBloom.c (limited to 'src/object') diff --git a/src/object/picoBloom.c b/src/object/picoBloom.c new file mode 100644 index 00000000..de912b8a --- /dev/null +++ b/src/object/picoBloom.c @@ -0,0 +1,47 @@ +#define NENT_DEPRECATED +#include "entity.h" +#include "asm.h" +#include "sound.h" + +void PicoBloom_Init(Entity*); +void PicoBloom_Action1(Entity*); +void PicoBloom_Action2(Entity*); + +void PicoBloom(Entity* this) { + static void (*const actionFuncs[])(Entity*) = { + PicoBloom_Init, + PicoBloom_Action1, + PicoBloom_Action2, + }; + + actionFuncs[this->action](this); +} + +void PicoBloom_Init(Entity* this) { + static const u8 typeAnimationStates[] = { 3, 0, 3, 3, 3, 3 }; + u32 nextAction; + + nextAction = this->type2; + if (nextAction != 1) { + nextAction = 2; + } + this->action = nextAction; + this->actionDelay = (Random() & 0x7f) + 0x7f; + this->collisionLayer = 1; + UpdateSpriteForCollisionLayer(this); + InitializeAnimation(this, typeAnimationStates[this->type] + this->type2); +} + +void PicoBloom_Action1(Entity* this) { + if (--this->actionDelay == 0) { + this->action++; + } +} + +void PicoBloom_Action2(Entity* this) { + GetNextFrame(this); + if (this->frame & 1) { + this->frame &= ~1; + EnqueueSFX(SFX_21B); + } +} -- cgit v1.2.3