summaryrefslogtreecommitdiff
path: root/include/toBeSorted/event_manager.h
blob: 929cb869a98aa8303493208abfbeac046765e90d (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
59
60
61
62
63
64
65
66
67
68
69
#ifndef EVENT_MANAGER_H
#define EVENT_MANAGER_H

#include "common.h"
#include "f/f_base.h"
#include "sized_string.h"
#include "toBeSorted/event.h"

class dAcBase_c;
class dAcObjBase_c;

class EventManager {
public:
    static bool setEvent(dAcBase_c *actor, Event *, dAcBase_c *);
    static bool isInEvent(dAcBase_c *actor, const char *eventName);
    static bool finishEvent(dAcBase_c *actor, const char *eventName);
    static void changeOwnEvent(dAcBase_c *actor1, dAcBase_c *actor2, Event *event, UNKWORD);
    static bool alsoSetAsCurrentEvent(dAcBase_c *actor, Event *event, void *unknown);
    static dAcObjBase_c *fn_800A08F0(fBase_c::GROUP_TYPE_e);
    static bool canSkipCurrentEvent();
    static dAcBase_c *getMainActorInEvent();

    static Event *getSkipOnlyEvent();
    static bool fn_800A0B80();
    static void fn_8009FA10(dAcBase_c *actor, Event *event, void *unknown);
    static void execute();

    static EventManager *sInstance;

    static bool isInEvent() {
        return sInstance != nullptr && sInstance->mState != 0;
    }

    static bool isInEvent0Or7() {
        return sInstance != nullptr && (sInstance->mState == 0 || sInstance->mState == 7);
    }

    static bool isInEventOtherThan0Or7() {
        return isInEvent() && !isInEvent0Or7();
    }

    static const char *getCurrentEventName() {
        return isInEvent() ? sInstance->mCurrentEvent.eventName : nullptr;
    }

    static s32 getCurrentEventRoomId() {
        return isInEvent() ? sInstance->mCurrentEvent.roomid : -1;
    }

    static bool isCurrentEvent(const char *name) {
        return strequals(getCurrentEventName(), name);
    }

    static bool eventRelatedStateFlags_shift0x11_1();

    // Something like isActorInEvent maybe?
    static bool FUN_800a0570(const dAcBase_c *actor);
    static bool FUN_800a0ba0();
    static bool fn_8009F990();

private:
    /* 0x000 */ u8 _000[0x084 - 0x000];
    /* 0x084 */ Event mCurrentEvent;
    /* 0x0C4 */ u8 _0C4[0x184 - 0x0C4];
    /* 0x184 */ int mState;
    /* 0x18C */ u8 _18C[0x19C - 0x18C];
};

#endif