mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
This commit is contained in:
parent
71822b6f1b
commit
460d24fd83
@ -565,6 +565,23 @@ static EffectTickProc * const _effect_tick_procs[] = {
|
|||||||
};
|
};
|
||||||
assert_compile(lengthof(_effect_tick_procs) == EV_END);
|
assert_compile(lengthof(_effect_tick_procs) == EV_END);
|
||||||
|
|
||||||
|
/** Transparency options affecting the effects. */
|
||||||
|
static const TransparencyOption _effect_transparency_options[] = {
|
||||||
|
TO_INDUSTRIES, // EV_CHIMNEY_SMOKE
|
||||||
|
TO_INVALID, // EV_STEAM_SMOKE
|
||||||
|
TO_INVALID, // EV_DIESEL_SMOKE
|
||||||
|
TO_INVALID, // EV_ELECTRIC_SPARK
|
||||||
|
TO_INVALID, // EV_CRASH_SMOKE
|
||||||
|
TO_INVALID, // EV_EXPLOSION_LARGE
|
||||||
|
TO_INVALID, // EV_BREAKDOWN_SMOKE
|
||||||
|
TO_INVALID, // EV_EXPLOSION_SMALL
|
||||||
|
TO_INVALID, // EV_BULLDOZER
|
||||||
|
TO_INDUSTRIES, // EV_BUBBLE
|
||||||
|
TO_INVALID, // EV_BREAKDOWN_SMOKE_AIRCRAFT
|
||||||
|
TO_INDUSTRIES, // EV_COPPER_MINE_SMOKE
|
||||||
|
};
|
||||||
|
assert_compile(lengthof(_effect_transparency_options) == EV_END);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an effect vehicle at a particular location.
|
* Create an effect vehicle at a particular location.
|
||||||
@ -637,3 +654,12 @@ void EffectVehicle::UpdateDeltaXY(Direction direction)
|
|||||||
this->y_extent = 1;
|
this->y_extent = 1;
|
||||||
this->z_extent = 1;
|
this->z_extent = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the transparency option affecting the effect.
|
||||||
|
* @return Transparency option, or TO_INVALID if none.
|
||||||
|
*/
|
||||||
|
TransparencyOption EffectVehicle::GetTransparencyOption() const
|
||||||
|
{
|
||||||
|
return _effect_transparency_options[this->subtype];
|
||||||
|
}
|
||||||
|
@ -33,6 +33,7 @@ struct EffectVehicle : public SpecializedVehicle<EffectVehicle, VEH_EFFECT> {
|
|||||||
|
|
||||||
void UpdateDeltaXY(Direction direction);
|
void UpdateDeltaXY(Direction direction);
|
||||||
bool Tick();
|
bool Tick();
|
||||||
|
TransparencyOption GetTransparencyOption() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,6 +32,7 @@ enum TransparencyOption {
|
|||||||
TO_CATENARY, ///< catenary
|
TO_CATENARY, ///< catenary
|
||||||
TO_LOADING, ///< loading indicators
|
TO_LOADING, ///< loading indicators
|
||||||
TO_END,
|
TO_END,
|
||||||
|
TO_INVALID, ///< Invalid transparency option
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef uint TransparencyOptionBits; ///< transparency option bits
|
typedef uint TransparencyOptionBits; ///< transparency option bits
|
||||||
|
@ -899,8 +899,18 @@ static void DoDrawVehicle(const Vehicle *v)
|
|||||||
|
|
||||||
if (v->vehstatus & VS_DEFPAL) pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
if (v->vehstatus & VS_DEFPAL) pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
||||||
|
|
||||||
|
/* Check whether the vehicle shall be transparent due to the game state */
|
||||||
|
bool shadowed = (v->vehstatus & VS_SHADOW);
|
||||||
|
|
||||||
|
if (v->type == VEH_EFFECT) {
|
||||||
|
/* Check whether the vehicle shall be transparent/invisible due to GUI settings.
|
||||||
|
* However, transparent smoke and bubbles look weird, so always hide them. */
|
||||||
|
TransparencyOption to = EffectVehicle::From(v)->GetTransparencyOption();
|
||||||
|
if (to != TO_INVALID && (IsTransparencySet(to) || IsInvisibilitySet(to))) return;
|
||||||
|
}
|
||||||
|
|
||||||
AddSortableSpriteToDraw(image, pal, v->x_pos + v->x_offs, v->y_pos + v->y_offs,
|
AddSortableSpriteToDraw(image, pal, v->x_pos + v->x_offs, v->y_pos + v->y_offs,
|
||||||
v->x_extent, v->y_extent, v->z_extent, v->z_pos, (v->vehstatus & VS_SHADOW) != 0);
|
v->x_extent, v->y_extent, v->z_extent, v->z_pos, shadowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user