summaryrefslogtreecommitdiff
path: root/src/projectile/keatonDagger.c
blob: 90e89e05a6e3b46aa8d2e0f0eba45d7d2e7d0209 (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
/**
 * @file keatonDagger.c
 * @ingroup Projectiles
 *
 * @brief Keaton Dagger Projectile
 */
#include "entity.h"
#include "player.h"
#include "physics.h"

extern void StealRupees(Entity*);

extern const Hitbox* const gUnk_08129998[];

void KeatonDagger(Entity* this) {
    Entity* parent;

    if (this->action == 0) {
        this->action = 1;
    }
    parent = this->parent;
    if (((parent == NULL) || (parent->health == 0)) || (parent->next == NULL)) {
        if (((this->contactFlags & CONTACT_NOW) != 0) && (this->contactedEntity == &gPlayerEntity.base)) {
            StealRupees(this);
        }
        DeleteEntity(this);
    } else {
        this->hitbox = (Hitbox*)gUnk_08129998[parent->animationState];
        CopyPosition(parent, this);
        if ((parent->iframes != 0) && (this->iframes == 0)) {
            this->iframes = 0xff;
        }
    }
}

extern const Hitbox gUnk_081299A8;
extern const Hitbox gUnk_081299B0;
extern const Hitbox gUnk_081299B8;
extern const Hitbox gUnk_081299C0;

const Hitbox* const gUnk_08129998[] = {
    &gUnk_081299A8,
    &gUnk_081299B0,
    &gUnk_081299B8,
    &gUnk_081299C0,
};

const Hitbox gUnk_081299A8 = { 4, -16, { 0, 0, 0, 0 }, 2, 3 };
const Hitbox gUnk_081299B0 = { 9, -2, { 0, 0, 0, 0 }, 3, 2 };
const Hitbox gUnk_081299B8 = { -4, 1, { 0, 0, 0, 0 }, 2, 3 };
const Hitbox gUnk_081299C0 = { -9, -2, { 0, 0, 0, 0 }, 3, 3 };