Enemy Rando - Arwing range check (Khan Edition) (#2613)

* Arwing range check

* Small code cleanup
This commit is contained in:
aMannus 2023-03-11 18:47:56 +01:00 committed by GitHub
parent 1c00d56053
commit 095066ffcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -475,9 +475,13 @@ void EnClearTag_Update(Actor* thisx, PlayState* play2) {
Math_ApproachS(&this->actor.world.rot.z, 0, 15, this->targetDirection.z); Math_ApproachS(&this->actor.world.rot.z, 0, 15, this->targetDirection.z);
Math_ApproachF(&this->targetDirection.z, 0x500, 1.0f, 0x100); 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. // Check if the Arwing should fire its laser.
if ((this->frameCounter % 4) == 0 && (Rand_ZeroOne() < 0.75f) && 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; this->shouldShootLaser = true;
} }
} else { } else {