Index: src/lang/english.txt =================================================================== --- src/lang/english.txt (revision 20362) +++ src/lang/english.txt (working copy) @@ -1084,6 +1084,7 @@ STR_CONFIG_SETTING_CATCHMENT :{LTBLUE}Allow more realistically sized catchment areas: {ORANGE}{STRING1} STR_CONFIG_SETTING_EXTRADYNAMITE :{LTBLUE}Allow removal of more town-owned roads, bridges, etc: {ORANGE}{STRING1} STR_CONFIG_SETTING_MAMMOTHTRAINS :{LTBLUE}Enable building very long trains: {ORANGE}{STRING1} +STR_CONFIG_SETTING_SMOKE_AMOUNT :{LTBLUE}Locomotive smoke amount (0=none, 1=small, 2=realistic): {ORANGE}{STRING1} STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL :{LTBLUE}Train acceleration model: {ORANGE}{STRING1} STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_ORIGINAL :Original STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_REALISTIC :Realistic Index: src/settings_gui.cpp =================================================================== --- src/settings_gui.cpp (revision 20362) +++ src/settings_gui.cpp (working copy) @@ -1441,6 +1441,7 @@ SettingEntry("vehicle.train_acceleration_model"), SettingEntry("vehicle.train_slope_steepness"), SettingEntry("vehicle.mammoth_trains"), + SettingEntry("vehicle.smoke_amount"), SettingEntry("gui.lost_train_warn"), SettingEntry("vehicle.wagon_speed_limits"), SettingEntry("vehicle.disable_elrails"), Index: src/settings_type.h =================================================================== --- src/settings_type.h (revision 20362) +++ src/settings_type.h (working copy) @@ -313,6 +313,7 @@ /** Settings related to vehicles. */ struct VehicleSettings { bool mammoth_trains; ///< allow very long trains + uint8 smoke_amount; ///< choose amount of smoke/sparks locomotives produce uint8 train_acceleration_model; ///< realistic acceleration for trains uint8 roadveh_acceleration_model; ///< realistic acceleration for road vehicles uint8 train_slope_steepness; ///< Steepness of hills for trains when using realistic acceleration Index: src/table/settings.h =================================================================== --- src/table/settings.h (revision 20362) +++ src/table/settings.h (working copy) @@ -382,6 +382,7 @@ SDT_CONDVAR(GameSettings, vehicle.roadveh_slope_steepness, SLE_UINT8,139, SL_MAX_VERSION, 0, 0, 7, 0, 10, 1, STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS, RoadVehSlopeSteepnessChanged), SDT_BOOL(GameSettings, pf.forbid_90_deg, 0, 0, false, STR_CONFIG_SETTING_FORBID_90_DEG, NULL), SDT_BOOL(GameSettings, vehicle.mammoth_trains, 0,NN, true, STR_CONFIG_SETTING_MAMMOTHTRAINS, NULL), + SDT_CONDVAR(GameSettings, vehicle.smoke_amount, SLE_UINT8, 0, SL_MAX_VERSION, 0, 0, 1, 0, 2, 0, STR_CONFIG_SETTING_SMOKE_AMOUNT, NULL), SDT_BOOL(GameSettings, order.gotodepot, 0, 0, true, STR_CONFIG_SETTING_GOTODEPOT, NULL), SDT_BOOL(GameSettings, pf.roadveh_queue, 0, 0, true, STR_CONFIG_SETTING_ROAD_VEHICLE_QUEUEING, NULL), Index: src/train_cmd.cpp =================================================================== --- src/train_cmd.cpp (revision 20362) +++ src/train_cmd.cpp (working copy) @@ -2034,7 +2034,16 @@ { bool sound = false; - if ((v->vehstatus & VS_TRAIN_SLOWING) || v->cur_speed < 2) { + /* Do not show any locomotive smoke/sparks when smoke_amount is set to none (0) or train is: + * slowin down or + * it is ordered to reverse direction (by player) so it is slowing down to do it or + * it is ordered to stop (by player) + * its current speed is less than 2 km/h or + * it is entering station with an order to stop there and its speed is equal to maximum station entering speed. */ + if ((_settings_game.vehicle.smoke_amount == 0) || + (v->vehstatus & VS_TRAIN_SLOWING) || HasBit(v->flags, VRF_REVERSING) || (v->vehstatus & VS_STOPPED) || v->cur_speed < 2 || + (IsRailStationTile(v->tile) && v->IsFrontEngine() && v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) && + v->cur_speed == v->Train::GetCurrentMaxSpeed())) { return; } @@ -2076,24 +2085,50 @@ switch (effect_type) { case 0: - /* steam smoke. */ - if (GB(v->tick_counter, 0, 4) == 0) { + /* Steam smoke - amount is gradually falling until train reaches its maximum speed, after that it's normal. + * Details: while train'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 train's maximum speed. + * REGULATION: + * - instead of 1, 4 / 2^smoke_amount (max. 2) is used to provide sufficient regulation to steam puffs' amount. */ + if (GB(v->tick_counter, 0, ((4 >> _settings_game.vehicle.smoke_amount) + ((u->cur_speed * 3) / u->tcache.cached_max_speed))) == 0) { CreateEffectVehicleRel(v, x, y, 10, EV_STEAM_SMOKE); sound = true; } break; case 1: - /* diesel smoke */ - if (u->cur_speed <= 40 && Chance16(15, 128)) { + /* Diesel smoke - thicker when train is starting, gradually + * subsiding till locomotive reaches its maximum speed when it stops. + * Details: Train's (max.) speed spectrum is divided into 32 parts. + * When max. speed is reached, chance for smoke emission erodes by 32 (1/4). + * Power and train's weight come in handy too to either increase smoke emission + * in 6 steps (1000HP each) if the power is low or decrease smoke emission in + * 6 steps (512 tonnes each) if the train isn't overweight. Power and weight + * contributions are expressed in a way that neither extreme power, nor extreme + * weight can ruin the balance (e.g. FreightWagonMultiplier) in the formula. + * When the train reaches maximum speed no diesel_smoke is emitted as train + * has enough traction to keep locomotive running optimally. + * REGULATION: + * - up to which speed a diesel train is emitting smoke (with reduced/small setting only until 1/2 of max_speed), + * - in Chance16 - the last value is 512 / 2^smoke_amount (max. smoke when 128 = smoke_amount of 2). */ + if (u->cur_speed < (u->tcache.cached_max_speed >> (2 >> _settings_game.vehicle.smoke_amount)) && Chance16((64 - ((u->cur_speed << 5) / u->tcache.cached_max_speed) + (32 >> (u->acc_cache.cached_power >> 10)) - (32 >> (u->acc_cache.cached_weight >> 9))), (512 >> _settings_game.vehicle.smoke_amount))) { CreateEffectVehicleRel(v, 0, 0, 10, EV_DIESEL_SMOKE); sound = true; } break; case 2: - /* blue spark */ - if (GB(v->tick_counter, 0, 2) == 0 && Chance16(1, 45)) { + /* 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 emissions are kept simple. Only when starting, creating huge + * force are sparks more likely to happen, but when reaching its max. speed, quarter by + * quarter of it, chance decreases untill the usuall 2,22% at train's top speed. + * REGULATION: + * - in Chance16 the last value is 360 / 2^smoke_amount (max. sparks when 90 = smoke_amount of 2). */ + if (GB(v->tick_counter, 0, 2) == 0 && Chance16((6 - ((u->cur_speed << 2) / u->tcache.cached_max_speed)), (360 >> _settings_game.vehicle.smoke_amount))) { CreateEffectVehicleRel(v, 0, 0, 10, EV_ELECTRIC_SPARK); sound = true; }