summaryrefslogtreecommitdiff
path: root/src/object/bench.c
blob: 8ca49a3cb10f0d2cdd6d8550d7853fede944bba1 (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
/**
 * @file bench.c
 * @ingroup Objects
 *
 * @brief Bench object
 */
#include "asm.h"
#include "entity.h"
#include "room.h"
#include "player.h"

typedef struct {
    Entity base;
    u8 filler[0x18];
    u16 tilePos;
} BenchEntity;

void Bench_Init(BenchEntity* this);
void Bench_Action1(BenchEntity* this);

void Bench(Entity* this) {
    static void (*const Bench_Actions[])(BenchEntity*) = {
        Bench_Init,
        Bench_Action1,
    };

    Bench_Actions[this->action]((BenchEntity*)this);
}

void Bench_Init(BenchEntity* this) {
    super->action = 1;
    super->timer = 0;
    this->tilePos = COORD_TO_TILE(super);
    if (gPlayerState.flags & PL_MINISH) {
        super->collisionLayer = 2;
    } else {
        super->collisionLayer = 1;
    }
    UpdateSpriteForCollisionLayer(super);
    SetCollisionData(0x47, this->tilePos - 0x40, 1);
}

void Bench_Action1(BenchEntity* this) {
}