summaryrefslogtreecommitdiff
path: root/src/object/mineralWaterSource.c
blob: dd602e0dfd98df79a35dc2f0947b1c7b211f5877 (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
/**
 * @file mineralWaterSource.c
 * @ingroup Objects
 *
 * @brief Mineral Water Source object
 */
#include "object.h"
#include "asm.h"
#include "physics.h"

void MineralWaterSource_Init(Entity*);
void MineralWaterSource_Action1(Entity*);

typedef struct {
    u8 type2;
    u8 hitboxWidth;
    u8 hitboxHeight;
    u8 hurtType;
} UnkStruct_MineralWater;

void MineralWaterSource(Entity* this) {
    static void (*const MineralWaterSource_Actions[])(Entity*) = {
        MineralWaterSource_Init,
        MineralWaterSource_Action1,
    };
    MineralWaterSource_Actions[this->action](this);
}

void MineralWaterSource_Init(Entity* this) {
    static const UnkStruct_MineralWater MineralWaterSourceParameters[] = {
        { 0x27, 0x30, 0x20, 0x4D },
    };
    const UnkStruct_MineralWater* unknownParameters;

    if (AllocMutableHitbox(this) == NULL) {
        return;
    }

    unknownParameters = &MineralWaterSourceParameters[this->type];

    this->type2 = unknownParameters->type2;
    this->hurtType = unknownParameters->hurtType;

    this->hitbox->width = unknownParameters->hitboxWidth;
    this->hitbox->height = unknownParameters->hitboxHeight;

    COLLISION_ON(this);

    this->collisionFlags = 7;
    this->hitType = 145;
    this->collisionMask = 2;

    this->action = 1;
}

void MineralWaterSource_Action1(Entity* this) {
    this->contactFlags = 0;
}