train_cmd.c
changeset 3186 4317b5b295c4
parent 3185 a9d0cdff7b84
child 3191 b2bebf380cd7
equal deleted inserted replaced
3185:a9d0cdff7b84 3186:4317b5b295c4
   398 
   398 
   399 	int img = rvi->image_index;
   399 	int img = rvi->image_index;
   400 	uint32 image = 0;
   400 	uint32 image = 0;
   401 
   401 
   402 	if (is_custom_sprite(img)) {
   402 	if (is_custom_sprite(img)) {
   403 		image = GetCustomVehicleIcon(engine, 6);
   403 		image = GetCustomVehicleIcon(engine, DIR_W);
   404 		if (image == 0) {
   404 		if (image == 0) {
   405 			img = orig_rail_vehicle_info[engine].image_index;
   405 			img = orig_rail_vehicle_info[engine].image_index;
   406 		} else {
   406 		} else {
   407 			y += _traininfo_vehicle_pitch;
   407 			y += _traininfo_vehicle_pitch;
   408 		}
   408 		}
  3151 	/* Calc position within the current tile ?? */
  3151 	/* Calc position within the current tile ?? */
  3152 	x = v->x_pos & 0xF;
  3152 	x = v->x_pos & 0xF;
  3153 	y = v->y_pos & 0xF;
  3153 	y = v->y_pos & 0xF;
  3154 
  3154 
  3155 	switch (v->direction) {
  3155 	switch (v->direction) {
  3156 		case 0: x = ~x + ~y + 24; break;
  3156 		case DIR_N : x = ~x + ~y + 24; break;
  3157 		case 7: x = y;            /* FALLTHROUGH */
  3157 		case DIR_NW: x = y;            /* FALLTHROUGH */
  3158 		case 1: x = ~x + 16;      break;
  3158 		case DIR_NE: x = ~x + 16;      break;
  3159 		case 2: x = ~x + y + 8;   break;
  3159 		case DIR_E : x = ~x + y + 8;   break;
  3160 		case 3: x = y;            break;
  3160 		case DIR_SE: x = y;            break;
  3161 		case 4: x = x + y - 8;    break;
  3161 		case DIR_S : x = x + y - 8;    break;
  3162 		case 6: x = ~y + x + 8;   break;
  3162 		case DIR_W : x = ~y + x + 8;   break;
  3163 	}
  3163 	}
  3164 
  3164 
  3165 	if (GB(ts, 0, 16) != 0) {
  3165 	if (GB(ts, 0, 16) != 0) {
  3166 		/* If we approach a rail-piece which we can't enter, or the back of a depot, don't enter it! */
  3166 		/* If we approach a rail-piece which we can't enter, or the back of a depot, don't enter it! */
  3167 		if (x + 4 > 15 &&
  3167 		if (x + 4 > 15 &&