summaryrefslogtreecommitdiff
path: root/src/manager/floatingPlatformManager.c
blob: 9f42b50ea51d1dd06020beef3f3dc7952bef9bee (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
/**
 * @file floatingPlatformManager.c
 * @ingroup Managers
 *
 * @brief Spawns lists of floating platforms together.
 */
#include "manager/floatingPlatformManager.h"
#include "entity.h"
#include "room.h"

void FloatingPlatformManager_Init(FloatingPlatformManager*);
void FloatingPlatformManager_Action1(FloatingPlatformManager*);

void FloatingPlatformManager_Main(FloatingPlatformManager* this) {
    static void (*const FloatingPlatformManager_Actions[])(FloatingPlatformManager*) = {
        FloatingPlatformManager_Init,
        FloatingPlatformManager_Action1,
    };
    FloatingPlatformManager_Actions[super->action](this);
}

void FloatingPlatformManager_Init(FloatingPlatformManager* this) {
    EntityData* entityData;
    Entity* entity;

    super->action = 1;
    super->timer = 0;
    entityData = (EntityData*)GetCurrentRoomProperty(super->type);
    if (entityData == NULL) {
        DeleteThisEntity();
    }
    while (*(u8*)entityData != 0xff) {
        entity = LoadRoomEntity(entityData++);
        entity->parent = (Entity*)this;
        entity->timer = 255;
    }
}

void FloatingPlatformManager_Action1(FloatingPlatformManager* this) {
    super->timer = 0;
}