diff options
author | peter1138 <peter1138@openttd.org> | 2006-09-27 18:17:01 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-09-27 18:17:01 +0000 |
commit | 653e7fa54843b4427908b47d2e7da8ee48071a18 (patch) | |
tree | 89f67db5c4825d95a0c5687363b43db1311ffae7 /vehicle.c | |
parent | 3ded010d91a755f3f719d5bfe91cda6d161ef2d0 (diff) | |
download | openttd-653e7fa54843b4427908b47d2e7da8ee48071a18.tar.xz |
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -33,6 +33,7 @@ #include "yapf/yapf.h" #include "date.h" #include "newgrf_engine.h" +#include "newgrf_sound.h" #define INVALID_COORD (-0x8000) #define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6)) @@ -646,6 +647,22 @@ void CallVehicleTicks(void) FOR_ALL_VEHICLES(v) { _vehicle_tick_procs[v->type - 0x10](v); + + switch (v->type) { + case VEH_Train: + case VEH_Road: + case VEH_Aircraft: + case VEH_Ship: + if (v->type == VEH_Train && IsTrainWagon(v)) continue; + if (v->type == VEH_Aircraft && v->subtype > 0) continue; + + v->motion_counter += (v->direction & 1) ? (v->cur_speed * 3) / 4 : v->cur_speed; + /* Play a running sound if the motion counter passes 256 (Do we not skip sounds?) */ + if (GB(v->motion_counter, 0, 8) < v->cur_speed) PlayVehicleSound(v, VSE_RUNNING); + + /* Play an alterate running sound every 16 ticks */ + if (GB(v->tick_counter, 0, 4) == 0) PlayVehicleSound(v, v->cur_speed > 0 ? VSE_RUNNING_16 : VSE_STOPPED_16); + } } // now we handle all the vehicles that entered a depot this tick |