mirror of
https://github.com/zeldaret/tmc
synced 2026-05-25 07:23:16 -04:00
71 lines
1.6 KiB
C
71 lines
1.6 KiB
C
#define NENT_DEPRECATED
|
|
#include "entity.h"
|
|
#include "asm.h"
|
|
#include "sound.h"
|
|
#include "room.h"
|
|
#include "functions.h"
|
|
|
|
void sub_0808E298(Entity*);
|
|
void sub_0808E318(Entity*);
|
|
void sub_0808E354(Entity*, u32);
|
|
|
|
void Object44(Entity* this) {
|
|
static void (*const actionFuncs[])(Entity*) = {
|
|
sub_0808E298,
|
|
sub_0808E318,
|
|
};
|
|
|
|
actionFuncs[this->action]((Entity*)this);
|
|
}
|
|
|
|
void sub_0808E298(Entity* this) {
|
|
int x;
|
|
int y;
|
|
|
|
this->collisionLayer = 2;
|
|
this->action = 1;
|
|
x = 0;
|
|
y = 0;
|
|
switch (GetTileTypeByEntity(this)) {
|
|
case 0x343:
|
|
x = 0x10;
|
|
case 0x344:
|
|
y = 0x10;
|
|
break;
|
|
case 0x345:
|
|
x = 0x10;
|
|
break;
|
|
case 0x346:
|
|
break;
|
|
default:
|
|
DeleteThisEntity();
|
|
break;
|
|
}
|
|
|
|
this->x.HALF.HI = (this->x.HALF.HI + x) & 0xfff0;
|
|
this->y.HALF.HI = (this->y.HALF.HI + y) & 0xfff0;
|
|
InitializeAnimation(this, 0);
|
|
sub_0808E354(this, 0x347);
|
|
sub_0808E318(this);
|
|
}
|
|
|
|
void sub_0808E318(Entity* this) {
|
|
GetNextFrame(this);
|
|
if (this->frame & ANIM_DONE) {
|
|
sub_0808E354(this, 0x343);
|
|
DeleteThisEntity();
|
|
} else {
|
|
if (this->frame & 1) {
|
|
EnqueueSFX(SFX_18B);
|
|
}
|
|
}
|
|
}
|
|
|
|
void sub_0808E354(Entity* this, u32 param_2) {
|
|
u16 uVar1 = param_2;
|
|
sub_0807B7D8(uVar1, COORD_TO_TILE_OFFSET(this, 0x10, 0x10), 2);
|
|
sub_0807B7D8(uVar1 + 1, COORD_TO_TILE_OFFSET(this, 0, 0x10), 2);
|
|
sub_0807B7D8(uVar1 + 2, COORD_TO_TILE_OFFSET(this, 0x10, 0), 2);
|
|
sub_0807B7D8(uVar1 + 3, COORD_TO_TILE_OFFSET(this, 0, 0), 2);
|
|
}
|