summaryrefslogtreecommitdiff
path: root/src/d/snd/d_snd_source_py_bird.cpp
blob: 40efd1ee3492c4799397cff673c1332f8a33ecb2 (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
#include "d/snd/d_snd_source_py_bird.h"
#include "common.h"
#include "d/snd/d_snd_anim_sound.h"
#include "d/snd/d_snd_se_sound_2.h"
#include "d/snd/d_snd_util.h"
#include "d/snd/d_snd_wzsound.h"
#include "nw4r/snd/snd_SeqSoundHandle.h"

void dSndSourcePyBird_c::load(void *data, const char *name) {
    if (streq(name, "GlideDive")) {
        mSeqVarValue = 1;
    } else if (streq(name, "SwitchToDive") && mSeqVarValue != 1) {
        mSeqVarValue = 1;
    } else if (streq(name, "Brake")) {
        mSeqVarValue = 2;
        startSound(SE_PyBird_V_BRAKE, nullptr);
    } else if (streq(name, "DamageTornado")) {
        startSound(SE_PyBird_V_TORNADE, nullptr);
    } else if (mSeqVarValue == 1) {
        if (!streq(name, "Attack") && !streq(name, "Accel")) {
            mSeqVarValue = 0;
        }
    } else {
        mSeqVarValue = 0;
    }
    dSndSeSound2_c *glideSound = getHandleType2ForSoundId(SE_PyBird_GLIDE);
    if (glideSound != nullptr && glideSound->getHandle() != nullptr) {
        nw4r::snd::SeqSoundHandle handle(glideSound->getHandle());
        handle.WriteVariable(10, mSeqVarValue);
    }
    mAnimSound.setData(data, name);
}