summaryrefslogtreecommitdiff
path: root/src/projectile/v3HandProjectile.c
blob: b896a9db2553f6777989e2051755a4c6c192a4e8 (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
/**
 * @file v3HandProjectile.c
 * @ingroup Projectiles
 *
 * @brief V3 Hand Projectile
 */
#include "collision.h"
#include "enemy.h"
#include "sound.h"
#include "projectile.h"
#include "physics.h"
#include "player.h"

extern void (*const V3HandProjectile_Functions[])(Entity*);

void V3HandProjectile(Entity* this) {
    V3HandProjectile_Functions[GetNextFunction(this)](this);
}

void V3HandProjectile_OnTick(Entity* this) {
    if (this->action == 0) {
        this->action = 1;
        this->direction = GetFacingDirection(this, &gPlayerEntity.base);
        InitializeAnimation(this, 0);
        SoundReq(SFX_199);
    }
    if (this->z.HALF.HI < -6) {
        this->z.HALF.HI += 2;
    }
    ProcessMovement3(this);
    if (this->collisions != COL_NONE) {
        DeleteThisEntity();
    }
    GetNextFrame(this);
    if (IsProjectileOffScreen(this)) {
        DeleteThisEntity();
    }
}

void V3HandProjectile_OnCollision(Entity* this) {
    DeleteThisEntity();
}

void (*const V3HandProjectile_Functions[])(Entity*) = {
    V3HandProjectile_OnTick, V3HandProjectile_OnCollision, DeleteEntity, DeleteEntity, DeleteEntity,
};