train_cmd.c
changeset 288 6bd97cdf1652
parent 244 57a3922a029c
child 300 4ecaff334af8
equal deleted inserted replaced
287:ca9584af45a0 288:6bd97cdf1652
  2251 {
  2251 {
  2252 	static int8 _random_dir_change[4] = { -1, 0, 0, 1};
  2252 	static int8 _random_dir_change[4] = { -1, 0, 0, 1};
  2253 
  2253 
  2254 	do {
  2254 	do {
  2255 		//I need to buffer the train direction
  2255 		//I need to buffer the train direction
  2256 		if (!v->u.rail.track & 0x40)
  2256 		if (!(v->u.rail.track & 0x40))
  2257 			v->direction = (v->direction + _random_dir_change[Random()&3]) & 7;
  2257 			v->direction = (v->direction + _random_dir_change[InteractiveRandom()&3]) & 7;
  2258 		if (!(v->vehstatus & VS_HIDDEN)) {
  2258 		if (!(v->vehstatus & VS_HIDDEN)) {
  2259 			BeginVehicleMove(v);
  2259 			BeginVehicleMove(v);
  2260 			UpdateTrainDeltaXY(v, v->direction);
  2260 			UpdateTrainDeltaXY(v, v->direction);
  2261 			v->cur_image = GetTrainImage(v, v->direction);
  2261 			v->cur_image = GetTrainImage(v, v->direction);
  2262 			AfterSetTrainPos(v);
  2262 			AfterSetTrainPos(v);
  2272 
  2272 
  2273 	if ( (state == 4) && (v->u.rail.track != 0x40) ) {
  2273 	if ( (state == 4) && (v->u.rail.track != 0x40) ) {
  2274 		CreateEffectVehicleRel(v, 4, 4, 8, EV_CRASHED_SMOKE);
  2274 		CreateEffectVehicleRel(v, 4, 4, 8, EV_CRASHED_SMOKE);
  2275 	}
  2275 	}
  2276 
  2276 
  2277 	if (state <= 200 && (uint16)(r=Random()) <= 0x2492) {
  2277 	if (state <= 200 && (uint16)(r=InteractiveRandom()) <= 0x2492) {
  2278 		index = (r * 10 >> 16);
  2278 		index = (r * 10 >> 16);
  2279 
  2279 
  2280 		u = v;
  2280 		u = v;
  2281 		do {
  2281 		do {
  2282 			if (--index < 0) {
  2282 			if (--index < 0) {
  2283 				r = Random();
  2283 				r = InteractiveRandom();
  2284 
  2284 
  2285 				CreateEffectVehicleRel(u,
  2285 				CreateEffectVehicleRel(u,
  2286 					2 + ((r>>8)&7),
  2286 					2 + ((r>>8)&7),
  2287 					2 + ((r>>16)&7),
  2287 					2 + ((r>>16)&7),
  2288 					5 + (r&7),
  2288 					5 + (r&7),