mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-25 19:02:19 -05:00
Randomized Enemy Sizes (#3321)
This commit is contained in:
parent
39a7437fc8
commit
13a8a1a5cc
@ -1038,6 +1038,39 @@ void RegisterRandomizerSheikSpawn() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegisterRandomizedEnemySizes() {
|
||||||
|
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnActorInit>([](void* refActor) {
|
||||||
|
// Randomized Enemy Sizes
|
||||||
|
Player* player = GET_PLAYER(gPlayState);
|
||||||
|
Actor* actor = static_cast<Actor*>(refActor);
|
||||||
|
|
||||||
|
// Only apply to enemies and bosses. Exclude the wobbly platforms in Jabu because they need to act like platforms.
|
||||||
|
if (!CVarGetInteger("gRandomizedEnemySizes", 0) || (actor->category != ACTORCAT_ENEMY && actor->category != ACTORCAT_BOSS) || actor->id == ACTOR_EN_BROB) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float randomNumber;
|
||||||
|
float randomScale;
|
||||||
|
|
||||||
|
uint8_t bigActor = rand() % 2;
|
||||||
|
|
||||||
|
// Big actor. Dodongo and Volvagia are always smaller because they're impossible when bigger.
|
||||||
|
if (bigActor && actor->id != ACTOR_BOSS_DODONGO && actor->id != ACTOR_BOSS_FD &&
|
||||||
|
actor->id != ACTOR_BOSS_FD2) {
|
||||||
|
randomNumber = rand() % 200;
|
||||||
|
// Between 100% and 300% size.
|
||||||
|
randomScale = 1.0f + (randomNumber / 100);
|
||||||
|
// Small actor
|
||||||
|
} else {
|
||||||
|
randomNumber = rand() % 90;
|
||||||
|
// Between 10% and 100% size.
|
||||||
|
randomScale = 0.1f + (randomNumber / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
Actor_SetScale(actor, actor->scale.z * randomScale);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void InitMods() {
|
void InitMods() {
|
||||||
RegisterTTS();
|
RegisterTTS();
|
||||||
RegisterInfiniteMoney();
|
RegisterInfiniteMoney();
|
||||||
@ -1065,5 +1098,6 @@ void InitMods() {
|
|||||||
RegisterEnemyDefeatCounts();
|
RegisterEnemyDefeatCounts();
|
||||||
RegisterAltTrapTypes();
|
RegisterAltTrapTypes();
|
||||||
RegisterRandomizerSheikSpawn();
|
RegisterRandomizerSheikSpawn();
|
||||||
|
RegisterRandomizedEnemySizes();
|
||||||
NameTag_RegisterHooks();
|
NameTag_RegisterHooks();
|
||||||
}
|
}
|
||||||
|
@ -1115,6 +1115,9 @@ void DrawEnhancementsMenu() {
|
|||||||
"- Random (Seeded): Enemies are randomized based on the current randomizer seed/file\n"
|
"- Random (Seeded): Enemies are randomized based on the current randomizer seed/file\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
UIWidgets::PaddedEnhancementCheckbox("Randomized Enemy Sizes", "gRandomizedEnemySizes", true, false);
|
||||||
|
UIWidgets::Tooltip("Enemies and Bosses spawn with random sizes.");
|
||||||
|
|
||||||
UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false);
|
UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false);
|
||||||
UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and "
|
UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and "
|
||||||
"press the C-Buttons to use items and mess with Player 1!");
|
"press the C-Buttons to use items and mess with Player 1!");
|
||||||
|
Loading…
Reference in New Issue
Block a user