summaryrefslogtreecommitdiff
path: root/src/enemy/enemyE.c
blob: 5b59069b3b03ff57934c81d449a4ec420017ee18 (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
69
70
71
72
73
74
/**
 * @file enemyE.c
 * @ingroup Enemies
 *
 * @brief EnemyE enemy
 */
#include "enemy.h"
#include "effects.h"

void sub_08023000(Entity*, int);

extern void (*const EnemyE_Functions[])(Entity*);
extern void (*const gUnk_080CBBDC[])(Entity*);

void EnemyE(Entity* this) {
    EnemyFunctionHandler(this, EnemyE_Functions);
}

void EnemyE_OnTick(Entity* this) {
    gUnk_080CBBDC[this->action](this);
}

void EnemyE_OnCollision(Entity* this) {
}

void sub_08022FD0(Entity* this) {
    this->action = 1;
    this->spriteSettings.draw = 1;
    sub_08023000(this, 0);
}

void sub_08022FEC(Entity* this) {
    sub_08023000(this, 0x80);
}

void sub_08022FF8(Entity* this) {
}

void sub_08022FFC(Entity* this) {
}

void sub_08023000(Entity* this, int frames) {
    int tmp;

    if (frames == 0x80) {
        UpdateAnimationSingleFrame(this);
    } else {
        InitAnimationForceUpdate(this, frames);
    }

    tmp = 0x80;
    if (this->frameSpriteSettings == 0x40)
        tmp *= -1;

    this->spriteRendering.b0 = 3;
    SetAffineInfo(this, tmp, 0x80, 0);
}

// clang-format off
void (*const EnemyE_Functions[])(Entity*) = {
    EnemyE_OnTick,
    EnemyE_OnCollision,
    GenericKnockback,
    GenericDeath,
    GenericConfused,
};

void (*const gUnk_080CBBDC[])(Entity*) = {
    sub_08022FD0,
    sub_08022FEC,
    sub_08022FF8,
    sub_08022FFC,
};
// clang-format on