summaryrefslogtreecommitdiff
path: root/mm/2s2h/Rando/MiscBehavior/OnFlagSet.cpp
blob: c09aca149a723d327a3c3e49a8438af4bdf6e02a (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
#include "MiscBehavior.h"

extern "C" {
#include "variables.h"
}

void Rando::MiscBehavior::OnFlagSet(FlagType flagType, u32 flag) {
    auto randoStaticCheck = Rando::StaticData::GetCheckFromFlag(flagType, flag);
    if (randoStaticCheck.randoCheckId == RC_UNKNOWN) {
        return;
    }

    auto& randoSaveCheck = RANDO_SAVE_CHECKS[randoStaticCheck.randoCheckId];
    if (randoSaveCheck.shuffled) {
        randoSaveCheck.eligible = true;
    }
}

void Rando::MiscBehavior::OnSceneFlagSet(s16 sceneId, FlagType flagType, u32 flag) {
    auto randoStaticCheck = Rando::StaticData::GetCheckFromFlag(flagType, flag, sceneId);
    if (randoStaticCheck.randoCheckId == RC_UNKNOWN) {
        return;
    }

    // Pots handle their own items, ignore them
    if (randoStaticCheck.randoCheckType == RCTYPE_POT) {
        return;
    }

    auto& randoSaveCheck = RANDO_SAVE_CHECKS[randoStaticCheck.randoCheckId];
    if (randoSaveCheck.shuffled) {
        randoSaveCheck.eligible = true;
    }
}