train_cmd.c
changeset 541 625227bb2a3d
parent 540 2987d7976ea2
child 555 02df8a1b7f33
equal deleted inserted replaced
540:2987d7976ea2 541:625227bb2a3d
  1241 
  1241 
  1242 }
  1242 }
  1243 
  1243 
  1244 static void TrainPlayLeaveStationSound(Vehicle *v)
  1244 static void TrainPlayLeaveStationSound(Vehicle *v)
  1245 {
  1245 {
  1246 	static const byte sfx[3] = { 0x2, 0x8, 0x8 };
  1246 	static const SoundFx sfx[] = {
       
  1247 		SND_04_TRAIN,
       
  1248 		SND_0A_TRAIN_HORN,
       
  1249 		SND_0A_TRAIN_HORN
       
  1250 	};
       
  1251 
  1247 	int engtype = v->engine_type;
  1252 	int engtype = v->engine_type;
  1248 
  1253 
  1249 	switch (_engines[engtype].railtype) {
  1254 	switch (_engines[engtype].railtype) {
  1250 		case 0:
  1255 		case 0:
  1251 			SndPlayVehicleFx(sfx[RailVehInfo(engtype)->engclass], v);
  1256 			SndPlayVehicleFx(sfx[RailVehInfo(engtype)->engclass], v);
  2005 		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
  2010 		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
  2006 		v->index,
  2011 		v->index,
  2007 		0);
  2012 		0);
  2008 
  2013 
  2009 	ModifyStationRatingAround(v->tile, v->owner, -160, 30);
  2014 	ModifyStationRatingAround(v->tile, v->owner, -160, 30);
  2010 	SndPlayVehicleFx(17, v);
  2015 	SndPlayVehicleFx(SND_13_BIG_CRASH, v);
  2011 }
  2016 }
  2012 
  2017 
  2013 static void *CheckVehicleAtSignal(Vehicle *v, void *data)
  2018 static void *CheckVehicleAtSignal(Vehicle *v, void *data)
  2014 {
  2019 {
  2015 	uint32 d = (uint32)data;
  2020 	uint32 d = (uint32)data;
  2318 			v->breakdowns_since_last_service++;
  2323 			v->breakdowns_since_last_service++;
  2319 
  2324 
  2320 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
  2325 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
  2321 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
  2326 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
  2322 
  2327 
  2323 		SndPlayVehicleFx((_opt.landscape != LT_CANDY) ? 0xE : 0x3A, v);
  2328 		SndPlayVehicleFx((_opt.landscape != LT_CANDY) ?
       
  2329 			SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
  2324 
  2330 
  2325 		if (!(v->vehstatus & VS_HIDDEN)) {
  2331 		if (!(v->vehstatus & VS_HIDDEN)) {
  2326 			Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
  2332 			Vehicle *u = CreateEffectVehicleRel(v, 4, 4, 5, EV_BREAKDOWN_SMOKE);
  2327 			if (u)
  2333 			if (u)
  2328 				u->u.special.unk0 = v->breakdown_delay * 2;
  2334 				u->u.special.unk0 = v->breakdown_delay * 2;
  2415 		if ((ts &= (ts >> 16)) == 0) {
  2421 		if ((ts &= (ts >> 16)) == 0) {
  2416 			// make a rail/road crossing red
  2422 			// make a rail/road crossing red
  2417 			if (IS_TILETYPE(tile, MP_STREET) && (_map5[tile] & 0xF0)==0x10) {
  2423 			if (IS_TILETYPE(tile, MP_STREET) && (_map5[tile] & 0xF0)==0x10) {
  2418 				if (!(_map5[tile] & 4)) {
  2424 				if (!(_map5[tile] & 4)) {
  2419 					_map5[tile] |= 4;
  2425 					_map5[tile] |= 4;
  2420 					SndPlayVehicleFx(12, v);
  2426 					SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v);
  2421 					MarkTileDirtyByTile(tile);
  2427 					MarkTileDirtyByTile(tile);
  2422 				}
  2428 				}
  2423 			}
  2429 			}
  2424 			return;
  2430 			return;
  2425 		}
  2431 		}