From 139ad58c727f5a659079f54d1bf0f7950cbbaa1d Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 30 Apr 2017 16:25:19 +0000 Subject: [PATCH] Restore dropped hoard test Commit 829e95b dropped a test for game_mode_hoard when computing light. Since hoard orbs are in a union which overlaps the score in mission mode, this caused a bug where a player in mission mode with non-zero score would pulse light like a player carrying orbs in hoard mode. Restore the test for hoard mode. Fixes: 829e95b6f818f82c1f90502f8a3a7002479b3802 ("Separate hoard/proximity tracking") --- similar/main/lighting.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/similar/main/lighting.cpp b/similar/main/lighting.cpp index 167f87fae..4209fbc9a 100644 --- a/similar/main/lighting.cpp +++ b/similar/main/lighting.cpp @@ -268,13 +268,14 @@ static g3s_lrgb compute_light_emission(const vobjptridx_t obj) { case OBJ_PLAYER: #if defined(DXX_BUILD_DESCENT_II) + uint8_t hoard_orbs; if (obj->ctype.player_info.powerup_flags & PLAYER_FLAGS_HEADLIGHT_ON) { if (Num_headlights < MAX_HEADLIGHTS) Headlights[Num_headlights++] = obj; light_intensity = HEADLIGHT_SCALE; } - else if (const auto hoard_orbs = obj->ctype.player_info.hoard.orbs) // If hoard game and player, add extra light based on how many orbs you have Pulse as well. + else if (game_mode_hoard() && (hoard_orbs = obj->ctype.player_info.hoard.orbs)) // If hoard game and player, add extra light based on how many orbs you have Pulse as well. { fix hoardlight = 1 + (i2f(hoard_orbs) / 2); auto s = fix_sin(static_cast(GameTime64 >> 1) & 0xFFFF); // probably a bad way to do it