From 095066ffcddab40bee2c4f77cc9cd7a5104cfdc7 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sat, 11 Mar 2023 18:47:56 +0100 Subject: [PATCH] Enemy Rando - Arwing range check (Khan Edition) (#2613) * Arwing range check * Small code cleanup --- soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index a095ae500..62e991d38 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -475,9 +475,13 @@ void EnClearTag_Update(Actor* thisx, PlayState* play2) { Math_ApproachS(&this->actor.world.rot.z, 0, 15, this->targetDirection.z); Math_ApproachF(&this->targetDirection.z, 0x500, 1.0f, 0x100); + // Introduce a range requirement in Enemy Rando so Arwings don't shoot the player from + // across the map. Especially noticeable in big maps like Lake Hylia and Hyrule Field. + uint8_t enemyRandoShootLaser = !CVarGetInteger("gRandomizedEnemies", 0) || this->actor.xzDistToPlayer < 1000.0f; + // Check if the Arwing should fire its laser. if ((this->frameCounter % 4) == 0 && (Rand_ZeroOne() < 0.75f) && - (this->state == CLEAR_TAG_STATE_TARGET_LOCKED)) { + (this->state == CLEAR_TAG_STATE_TARGET_LOCKED) && enemyRandoShootLaser) { this->shouldShootLaser = true; } } else {