From 38fabd7c499e48193c1748d5e957fba63db90218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Beckh=C3=A4user?= Date: Thu, 8 Aug 2019 11:57:52 +0200 Subject: [PATCH] Fixed two issues with game's transparency effects feature (which I introduced when implementing it): First, Superprox mines dropped by enemies were made undesirably transparent since they have their own ID not considered by is_proximity_bomb_or_smart_mine(). Second, only some force field textures in D2X had transparency effects since the game has two different textures for force fields - eclip num 78 and 93 - but only the former was defined and used in is_alphablend_eclip() --- common/main/effects.h | 3 ++- similar/main/object.cpp | 6 +++++- similar/main/render.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/main/effects.h b/common/main/effects.h index 976a4458d..2620e694b 100644 --- a/common/main/effects.h +++ b/common/main/effects.h @@ -50,7 +50,8 @@ constexpr std::integral_constant eclip_none{}; #define ECLIP_NUM_FUELCEN 2 #define ECLIP_NUM_BOSS 53 #ifdef DXX_BUILD_DESCENT_II -#define ECLIP_NUM_FORCE_FIELD 78 +#define ECLIP_NUM_FORCE_FIELD 78 // diagonal force field texture +#define ECLIP_NUM_FORCE_FIELD2 93 // straight force field texture #endif struct eclip : public prohibit_void_ptr diff --git a/similar/main/object.cpp b/similar/main/object.cpp index 5052311e4..7c860fe28 100644 --- a/similar/main/object.cpp +++ b/similar/main/object.cpp @@ -683,7 +683,11 @@ void render_object(grs_canvas &canvas, const d_level_unique_light_state &LevelUn break; case RT_WEAPON_VCLIP: - if (PlayerCfg.AlphaBlendWeapons && !is_proximity_bomb_or_smart_mine(get_weapon_id(obj))) // set nice transparency/blending for certain objects + if (PlayerCfg.AlphaBlendWeapons && (!is_proximity_bomb_or_smart_mine(get_weapon_id(obj)) +#if defined(DXX_BUILD_DESCENT_II) + && get_weapon_id(obj) != ROBOT_SUPERPROX_ID // superprox dropped by robots have their own ID not considered by is_proximity_bomb_or_smart_mine() and since that function is used in many other places, I didn't feel safe to add this weapon type in it +#endif + )) // set nice transparency/blending for certain objects { alpha = true; gr_settransblend(canvas, 7, GR_BLEND_ADDITIVE_A); diff --git a/similar/main/render.cpp b/similar/main/render.cpp index 0dea5b07f..961fbb3f3 100644 --- a/similar/main/render.cpp +++ b/similar/main/render.cpp @@ -207,7 +207,7 @@ void flash_frame() static inline int is_alphablend_eclip(int eclip_num) { #if defined(DXX_BUILD_DESCENT_II) - if (eclip_num == ECLIP_NUM_FORCE_FIELD) + if (eclip_num == ECLIP_NUM_FORCE_FIELD || eclip_num == ECLIP_NUM_FORCE_FIELD2) return 1; #endif return eclip_num == ECLIP_NUM_FUELCEN;