summaryrefslogtreecommitdiff
path: root/mm/2s2h/Enhancements/DifficultyOptions/NoDropDespawning.cpp
blob: d59e4908183fd05c4e9df372f8eb5f9a62847ec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <libultraship/bridge/consolevariablebridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/ShipInit.hpp"

#define CVAR_NAME "gEnhancements.DifficultyOptions.NoDropDespawning"
#define CVAR CVarGetInteger(CVAR_NAME, 0)

void RegisterNoDropDespawning() {
    // Stop dropped items from despawning after a set amount of time
    COND_VB_SHOULD(VB_UPDATE_ITEM00, CVAR, {
        EnItem00* itemActor = va_arg(args, EnItem00*);
        if (itemActor->unk14C <= 0) {
            *should = false;
        }
    });
}

static RegisterShipInitFunc initFunc(RegisterNoDropDespawning, { CVAR_NAME });