summaryrefslogtreecommitdiff
path: root/src/d/snd/d_snd_event_demo_callbacks.cpp
blob: 8d806c066277de421684caa996eb3366cabe0572 (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
#include "common.h"
#include "d/snd/d_snd_event.h"
#include "d/snd/d_snd_state_mgr.h"

void todoInititalizeSndEvent();
void todoExecuteSndEvent();

// clang-format off

static const SndEventDef sSndEventDefs_DEMO[] = {
    {"Demo03_03", SND_EVENT_Demo03_03, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo08_01", SND_EVENT_Demo08_01, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo15_04", SND_EVENT_Demo15_04, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo36_01", SND_EVENT_Demo36_01,                 nullptr, todoExecuteSndEvent, nullptr},
    {"Demo41_01", SND_EVENT_Demo41_01, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo59_01", SND_EVENT_Demo59_01,                 nullptr, todoExecuteSndEvent, nullptr},
    {"Demo62_01", SND_EVENT_Demo62_01, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo64_06", SND_EVENT_Demo64_06, todoInititalizeSndEvent,             nullptr, nullptr},
    {"Demo70_01", SND_EVENT_Demo70_01, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo70_02", SND_EVENT_Demo70_02, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo72_01", SND_EVENT_Demo72_01, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo77_01", SND_EVENT_Demo77_01, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
    {"Demo79_01", SND_EVENT_Demo79_01, todoInititalizeSndEvent, todoExecuteSndEvent, nullptr},
};

// clang-format on

void dSndStateMgr_c::handleDemoEvent(const char *name) {
    for (const SndEventDef *def = sSndEventDefs_DEMO; def < sSndEventDefs_DEMO + ARRAY_LENGTH(sSndEventDefs_DEMO);
         def++) {
        if (streq(name, def->eventName)) {
            mSoundEventId = def->eventId;
            mpSoundEventDef = def;
            sEventExecuteCallback = def->executeCb;
            if (def->initializeCb != nullptr) {
                (def->initializeCb)();
            }
            break;
        }
    }

    if (mSoundEventId == SND_EVENT_0x89) {
        mSoundEventId = SND_EVENT_0x78;
    }

    return;
}