Skip to content
Permalink
Browse files

Fixed two issues with game's transparency effects feature (which I in…

…troduced 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()
  • Loading branch information...
zicodxx committed Aug 8, 2019
1 parent ec234e0 commit 38fabd7c499e48193c1748d5e957fba63db90218
Showing with 8 additions and 3 deletions.
  1. +2 −1 common/main/effects.h
  2. +5 −1 similar/main/object.cpp
  3. +1 −1 similar/main/render.cpp
@@ -50,7 +50,8 @@ constexpr std::integral_constant<uint16_t, UINT16_MAX> 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<eclip>
@@ -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);
@@ -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;

0 comments on commit 38fabd7

Please sign in to comment.
You can’t perform that action at this time.