Skip to content

Commit

Permalink
Random Enemy Sizes fixes (HarbourMasters#3452)
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus authored Nov 28, 2023
1 parent 717074f commit 420bdab
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions soh/soh/Enhancements/mods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,16 @@ void RegisterRandomizedEnemySizes() {
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) {
// Exclude wobbly platforms in Jabu because they need to act like platforms.
// Exclude Dead Hand hands and Bongo Bongo main body because they make the fights (near) impossible.
uint8_t excludedEnemy = actor->id == ACTOR_EN_BROB || actor->id == ACTOR_EN_DHA || (actor->id == ACTOR_BOSS_SST && actor->params == -1);

// Dodongo, Volvagia and Dead Hand are always smaller because they're impossible when bigger.
uint8_t smallOnlyEnemy =
actor->id == ACTOR_BOSS_DODONGO || actor->id == ACTOR_BOSS_FD || actor->id == ACTOR_BOSS_FD2 || ACTOR_EN_DH;

// Only apply to enemies and bosses.
if (!CVarGetInteger("gRandomizedEnemySizes", 0) || (actor->category != ACTORCAT_ENEMY && actor->category != ACTORCAT_BOSS) || excludedEnemy) {
return;
}

Expand All @@ -1043,9 +1051,8 @@ void RegisterRandomizedEnemySizes() {

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) {
// Big actor
if (bigActor && !smallOnlyEnemy) {
randomNumber = rand() % 200;
// Between 100% and 300% size.
randomScale = 1.0f + (randomNumber / 100);
Expand Down

0 comments on commit 420bdab

Please sign in to comment.