summaryrefslogtreecommitdiff
path: root/src/object/unusedSkull.c
blob: b2b9def3501d1c0ea84c19d1971356ad4cc901b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
 * @file unusedSkull.c
 * @ingroup Objects
 *
 * @brief Unused Skull object
 */
#include "functions.h"
#include "hitbox.h"
#include "object.h"
#include "tiles.h"

typedef struct {
    /*0x00*/ Entity base;
    /*0x68*/ u8 unk_68[0x1e];
    /*0x86*/ u16 flag;
} UnusedSkullEntity;

void UnusedSkull_Init(UnusedSkullEntity*);
void UnusedSkull_Action1(UnusedSkullEntity*);
void UnusedSkull_Action2(UnusedSkullEntity*);

void (*const UnusedSkull_Actions[])(UnusedSkullEntity*) = {
    UnusedSkull_Init,
    UnusedSkull_Action1,
    UnusedSkull_Action2,
    (void (*)(UnusedSkullEntity*))GetNextFrame,
};

void UnusedSkull(UnusedSkullEntity* this) {
    UnusedSkull_Actions[super->action](this);
}

void UnusedSkull_Init(UnusedSkullEntity* this) {
    super->action = 1;
    super->flags |= 0x80;
    super->spriteSettings.draw = 1;
    super->collisionFlags = 7;
    super->hitType = 1;
    super->hurtType = 0x47;
    super->collisionMask = 2;
    super->hitbox = (Hitbox*)&gHitbox_4;
    SetTile(SPECIAL_TILE_80, COORD_TO_TILE(super), super->collisionLayer);
    if (super->type == 1 || CheckFlags(this->flag)) {
        super->action = 3;
        SetFlag(this->flag);
        InitializeAnimation(super, 1);
    } else {
        InitializeAnimation(super, super->type);
    }
}

void UnusedSkull_Action1(UnusedSkullEntity* this) {
    if (super->contactFlags == (CONTACT_NOW | 0x1c)) {
        super->action = 2;
        super->flags &= ~0x80;
        CreateFx(super, FX_ICE, 0);
        EnqueueSFX(SFX_10D);
    }
}

void UnusedSkull_Action2(UnusedSkullEntity* this) {
    GetNextFrame(super);
    if ((super->frame & 1) != 0) {
        super->action = 3;
        SetFlag(this->flag);
        EnqueueSFX(SFX_BUTTON_PRESS);
    }
}