summaryrefslogtreecommitdiff
path: root/src/s/s_Phase.cpp
blob: 1f8681e81587b1bf24c825d6a2c4ac657562697b (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
#include "s/s_Phase.hpp"

// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made

sPhase_c::sPhase_c(phaseMethod **methodList, int count) {
    mpMethodList = methodList;
    mPhaseLength = count;
    mCurrMethod = 0;
}

sPhase_c::METHOD_RESULT_e sPhase_c::callMethod(void *thisPtr) {
    if (mCurrMethod >= mPhaseLength) {
        return DONE;
    }

    METHOD_RESULT_e result = OK;
    while (result == OK) {
        result = (mpMethodList[mCurrMethod])(thisPtr);

        if (result == OK) {
            // Go to the next method
            mCurrMethod++;
            if (mCurrMethod >= mPhaseLength) {
                return DONE;
            }
        }
    }

    return result;
}