src/rail_cmd.cpp
changeset 5989 88540735bad4
parent 5986 1b9ab9629d36
child 6253 23983700e3d7
child 6317 c73bda71ac16
equal deleted inserted replaced
5988:1807f4d572f0 5989:88540735bad4
  1322 
  1322 
  1323 				if (dts != NULL && dts->seq != NULL) {
  1323 				if (dts != NULL && dts->seq != NULL) {
  1324 					relocation = GetCustomStationRelocation(statspec, st, ti->tile);
  1324 					relocation = GetCustomStationRelocation(statspec, st, ti->tile);
  1325 
  1325 
  1326 					image = dts->ground_sprite;
  1326 					image = dts->ground_sprite;
  1327 					if (HASBIT(image, 31)) {
  1327 					if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
  1328 						CLRBIT(image, 31);
       
  1329 						image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
  1328 						image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
  1330 						image += rti->custom_ground_offset;
  1329 						image += rti->custom_ground_offset;
  1331 					} else {
  1330 					} else {
  1332 						image += rti->total_offset;
  1331 						image += rti->total_offset;
  1333 					}
  1332 					}
  1347 		DrawGroundSprite(image, PAL_NONE);
  1346 		DrawGroundSprite(image, PAL_NONE);
  1348 
  1347 
  1349 		if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
  1348 		if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
  1350 
  1349 
  1351 		foreach_draw_tile_seq(dtss, dts->seq) {
  1350 		foreach_draw_tile_seq(dtss, dts->seq) {
  1352 			SpriteID image = dtss->image + relocation;
  1351 			SpriteID image = dtss->image;
  1353 			SpriteID pal;
  1352 			SpriteID pal;
       
  1353 
       
  1354 			/* Unlike stations, our default waypoint has no variation for
       
  1355 			 * different railtype, so don't use the railtype offset if
       
  1356 			 * no relocation is set */
       
  1357 			if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
       
  1358 				image += rti->total_offset;
       
  1359 			} else {
       
  1360 				image += relocation;
       
  1361 			}
  1354 
  1362 
  1355 			if (_display_opt & DO_TRANS_BUILDINGS) {
  1363 			if (_display_opt & DO_TRANS_BUILDINGS) {
  1356 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
  1364 				SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
  1357 				pal = PALETTE_TO_TRANSPARENT;
  1365 				pal = PALETTE_TO_TRANSPARENT;
  1358 			} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
  1366 			} else if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
  1359 				pal = _drawtile_track_palette;
  1367 				pal = _drawtile_track_palette;
  1360 			} else {
  1368 			} else {
  1361 				pal = dtss->pal;
  1369 				pal = dtss->pal;
  1362 			}
  1370 			}
  1363 
  1371 
  1364 			AddSortableSpriteToDraw(
  1372 			if ((byte)dtss->delta_z != 0x80) {
  1365 				image, pal,
  1373 				AddSortableSpriteToDraw(
  1366 				ti->x + dtss->delta_x, ti->y + dtss->delta_y,
  1374 					image, pal,
  1367 				dtss->size_x, dtss->size_y,
  1375 					ti->x + dtss->delta_x, ti->y + dtss->delta_y,
  1368 				dtss->size_z, ti->z + dtss->delta_z
  1376 					dtss->size_x, dtss->size_y,
  1369 			);
  1377 					dtss->size_z, ti->z + dtss->delta_z
       
  1378 				);
       
  1379 			} else {
       
  1380 				AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
       
  1381 			}
  1370 		}
  1382 		}
  1371 	}
  1383 	}
  1372 	DrawBridgeMiddle(ti);
  1384 	DrawBridgeMiddle(ti);
  1373 }
  1385 }
  1374 
  1386