blob: 0854634ad2968380a4aa133b67b235d5ba2666cb (
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 <libultraship/bridge/consolevariablebridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
#include "2s2h/ShipInit.hpp"
extern "C" {
#include "variables.h"
#include "functions.h"
}
#define CVAR_NAME "gEnhancements.DifficultyOptions.HyperEnemies"
#define CVAR CVarGetInteger(CVAR_NAME, 0)
void RegisterHyperEnemies() {
COND_HOOK(OnActorUpdate, CVAR, [](Actor* actor) {
if (actor->category != ACTORCAT_ENEMY || actor->id == ACTOR_EN_DG) {
return;
}
if (Player_InBlockingCsMode(gPlayState, GET_PLAYER(gPlayState))) {
return;
}
if (actor->update != NULL) {
// Everywhere we need to disable the collision checks already checks if frameAdvance is enabled, so we abuse
// that temporarily. This doesn't have any _known_ side effects :)
bool prevFrameAdv = gPlayState->frameAdvCtx.enabled;
gPlayState->frameAdvCtx.enabled = true;
actor->update(actor, gPlayState);
gPlayState->frameAdvCtx.enabled = prevFrameAdv;
}
});
}
static RegisterShipInitFunc initFunc(RegisterHyperEnemies, { CVAR_NAME });
|