From 653e7fa54843b4427908b47d2e7da8ee48071a18 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Wed, 27 Sep 2006 18:17:01 +0000 Subject: (svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported. --- roadveh_cmd.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'roadveh_cmd.c') diff --git a/roadveh_cmd.c b/roadveh_cmd.c index ef3cf4e10..e8f0d2884 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -26,6 +26,7 @@ #include "newgrf_callbacks.h" #include "newgrf_engine.h" #include "newgrf_text.h" +#include "newgrf_sound.h" #include "yapf/yapf.h" #include "date.h" @@ -621,8 +622,10 @@ static void HandleBrokenRoadVeh(Vehicle *v) InvalidateWindow(WC_VEHICLE_VIEW, v->index); InvalidateWindow(WC_VEHICLE_DETAILS, v->index); - SndPlayVehicleFx((_opt.landscape != LT_CANDY) ? - SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v); + if (!PlayVehicleSound(v, VSE_BREAKDOWN)) { + SndPlayVehicleFx((_opt.landscape != LT_CANDY) ? + SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v); + } if (!(v->vehstatus & VS_HIDDEN)) { Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE); @@ -760,10 +763,12 @@ static void HandleRoadVehLoading(Vehicle *v) static void StartRoadVehSound(const Vehicle* v) { - SoundFx s = RoadVehInfo(v->engine_type)->sfx; - if (s == SND_19_BUS_START_PULL_AWAY && (v->tick_counter & 3) == 0) - s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN; - SndPlayVehicleFx(s, v); + if (!PlayVehicleSound(v, VSE_START)) { + SoundFx s = RoadVehInfo(v->engine_type)->sfx; + if (s == SND_19_BUS_START_PULL_AWAY && (v->tick_counter & 3) == 0) + s = SND_1A_BUS_START_PULL_AWAY_WITH_HORN; + SndPlayVehicleFx(s, v); + } } typedef struct RoadVehFindData { -- cgit v1.2.3-54-g00ecf