mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
(svn r26746) -Codechange: Separate enums for visual effect type and spawning model.
This commit is contained in:
parent
d263fcce82
commit
17e88d644a
@ -2386,8 +2386,15 @@ void Vehicle::ShowVisualEffect() const
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
int effect_offset = GB(v->vcache.cached_vis_effect, VE_OFFSET_START, VE_OFFSET_COUNT) - VE_OFFSET_CENTRE;
|
int effect_offset = GB(v->vcache.cached_vis_effect, VE_OFFSET_START, VE_OFFSET_COUNT) - VE_OFFSET_CENTRE;
|
||||||
byte effect_type = GB(v->vcache.cached_vis_effect, VE_TYPE_START, VE_TYPE_COUNT);
|
VisualEffectSpawnModel effect_model = VESM_NONE;
|
||||||
bool disable_effect = HasBit(v->vcache.cached_vis_effect, VE_DISABLE_EFFECT);
|
|
||||||
|
if (!HasBit(v->vcache.cached_vis_effect, VE_DISABLE_EFFECT)) {
|
||||||
|
effect_model = (VisualEffectSpawnModel)GB(v->vcache.cached_vis_effect, VE_TYPE_START, VE_TYPE_COUNT);
|
||||||
|
assert(effect_model != (VisualEffectSpawnModel)VE_TYPE_DEFAULT); // should have been resolved by UpdateVisualEffect
|
||||||
|
assert_compile((uint)VESM_STEAM == (uint)VE_TYPE_STEAM);
|
||||||
|
assert_compile((uint)VESM_DIESEL == (uint)VE_TYPE_DIESEL);
|
||||||
|
assert_compile((uint)VESM_ELECTRIC == (uint)VE_TYPE_ELECTRIC);
|
||||||
|
}
|
||||||
|
|
||||||
/* Show no smoke when:
|
/* Show no smoke when:
|
||||||
* - Smoke has been disabled for this vehicle
|
* - Smoke has been disabled for this vehicle
|
||||||
@ -2396,7 +2403,7 @@ void Vehicle::ShowVisualEffect() const
|
|||||||
* - The vehicle is on a depot tile
|
* - The vehicle is on a depot tile
|
||||||
* - The vehicle is on a tunnel tile
|
* - The vehicle is on a tunnel tile
|
||||||
* - The vehicle is a train engine that is currently unpowered */
|
* - The vehicle is a train engine that is currently unpowered */
|
||||||
if (disable_effect ||
|
if (effect_model == VESM_NONE ||
|
||||||
v->vehstatus & VS_HIDDEN ||
|
v->vehstatus & VS_HIDDEN ||
|
||||||
(MayHaveBridgeAbove(v->tile) && IsBridgeAbove(v->tile)) ||
|
(MayHaveBridgeAbove(v->tile) && IsBridgeAbove(v->tile)) ||
|
||||||
IsDepotTile(v->tile) ||
|
IsDepotTile(v->tile) ||
|
||||||
@ -2407,8 +2414,8 @@ void Vehicle::ShowVisualEffect() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
EffectVehicleType evt = EV_END;
|
EffectVehicleType evt = EV_END;
|
||||||
switch (effect_type) {
|
switch (effect_model) {
|
||||||
case VE_TYPE_STEAM:
|
case VESM_STEAM:
|
||||||
/* Steam smoke - amount is gradually falling until vehicle reaches its maximum speed, after that it's normal.
|
/* Steam smoke - amount is gradually falling until vehicle reaches its maximum speed, after that it's normal.
|
||||||
* Details: while vehicle's current speed is gradually increasing, steam plumes' density decreases by one third each
|
* Details: while vehicle's current speed is gradually increasing, steam plumes' density decreases by one third each
|
||||||
* third of its maximum speed spectrum. Steam emission finally normalises at very close to vehicle's maximum speed.
|
* third of its maximum speed spectrum. Steam emission finally normalises at very close to vehicle's maximum speed.
|
||||||
@ -2419,7 +2426,7 @@ void Vehicle::ShowVisualEffect() const
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VE_TYPE_DIESEL: {
|
case VESM_DIESEL: {
|
||||||
/* Diesel smoke - thicker when vehicle is starting, gradually subsiding till it reaches its maximum speed
|
/* Diesel smoke - thicker when vehicle is starting, gradually subsiding till it reaches its maximum speed
|
||||||
* when smoke emission stops.
|
* when smoke emission stops.
|
||||||
* Details: Vehicle's (max.) speed spectrum is divided into 32 parts. When max. speed is reached, chance for smoke
|
* Details: Vehicle's (max.) speed spectrum is divided into 32 parts. When max. speed is reached, chance for smoke
|
||||||
@ -2442,7 +2449,7 @@ void Vehicle::ShowVisualEffect() const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case VE_TYPE_ELECTRIC:
|
case VESM_ELECTRIC:
|
||||||
/* Electric train's spark - more often occurs when train is departing (more load)
|
/* Electric train's spark - more often occurs when train is departing (more load)
|
||||||
* Details: Electric locomotives are usually at least twice as powerful as their diesel counterparts, so spark
|
* Details: Electric locomotives are usually at least twice as powerful as their diesel counterparts, so spark
|
||||||
* emissions are kept simple. Only when starting, creating huge force are sparks more likely to happen, but when
|
* emissions are kept simple. Only when starting, creating huge force are sparks more likely to happen, but when
|
||||||
@ -2456,7 +2463,7 @@ void Vehicle::ShowVisualEffect() const
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evt != EV_END) {
|
if (evt != EV_END) {
|
||||||
|
@ -92,6 +92,16 @@ enum VisualEffect {
|
|||||||
VE_DEFAULT = 0xFF, ///< Default value to indicate that visual effect should be based on engine class
|
VE_DEFAULT = 0xFF, ///< Default value to indicate that visual effect should be based on engine class
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Models for spawning visual effects. */
|
||||||
|
enum VisualEffectSpawnModel {
|
||||||
|
VESM_NONE = 0, ///< No visual effect
|
||||||
|
VESM_STEAM, ///< Steam model
|
||||||
|
VESM_DIESEL, ///< Diesel model
|
||||||
|
VESM_ELECTRIC, ///< Electric model
|
||||||
|
|
||||||
|
VESM_END
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum to handle ground vehicle subtypes.
|
* Enum to handle ground vehicle subtypes.
|
||||||
* This is defined here instead of at #GroundVehicle because some common function require access to these flags.
|
* This is defined here instead of at #GroundVehicle because some common function require access to these flags.
|
||||||
|
Loading…
Reference in New Issue
Block a user