187 const int *BB_data = _tunnel_wire_BB[dir]; |
187 const int *BB_data = _tunnel_wire_BB[dir]; |
188 AddSortableSpriteToDraw( |
188 AddSortableSpriteToDraw( |
189 sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
189 sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
190 BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1, |
190 BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1, |
191 GetTileZ(ti->tile) + sss->z_offset, |
191 GetTileZ(ti->tile) + sss->z_offset, |
192 IsTransparencySet(TO_BUILDINGS), |
192 IsTransparencySet(TO_CATENARY), |
193 BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset |
193 BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset |
194 ); |
194 ); |
195 } |
195 } |
196 |
196 |
197 /** Draws wires and, if required, pylons on a given tile |
197 /** Draws wires and, if required, pylons on a given tile |
334 continue; /* No neighbour, go looking for a better position */ |
334 continue; /* No neighbour, go looking for a better position */ |
335 } |
335 } |
336 |
336 |
337 AddSortableSpriteToDraw(pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, |
337 AddSortableSpriteToDraw(pylon_sprites[temp], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, |
338 GetPCPElevation(ti->tile, i), |
338 GetPCPElevation(ti->tile, i), |
339 IsTransparencySet(TO_BUILDINGS), -1, -1); |
339 IsTransparencySet(TO_CATENARY), -1, -1); |
340 break; /* We already have drawn a pylon, bail out */ |
340 break; /* We already have drawn a pylon, bail out */ |
341 } |
341 } |
342 } |
342 } |
343 } |
343 } |
344 } |
344 } |
345 |
345 |
346 /* Don't draw a wire under a low bridge */ |
346 /* Don't draw a wire under a low bridge */ |
347 if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_BUILDINGS)) { |
347 if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) { |
348 uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); |
348 uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); |
349 |
349 |
350 if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; |
350 if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; |
351 } |
351 } |
352 |
352 |
369 * Therefore it is save to use GetSlopeZ() for the elevation. |
369 * Therefore it is save to use GetSlopeZ() for the elevation. |
370 * Also note, that the result of GetSlopeZ() is very special for bridge-ramps. |
370 * Also note, that the result of GetSlopeZ() is very special for bridge-ramps. |
371 */ |
371 */ |
372 AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
372 AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
373 sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset, |
373 sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset, |
374 IsTransparencySet(TO_BUILDINGS)); |
374 IsTransparencySet(TO_CATENARY)); |
375 } |
375 } |
376 } |
376 } |
377 } |
377 } |
378 |
378 |
379 static void DrawCatenaryOnBridge(const TileInfo *ti) |
379 static void DrawCatenaryOnBridge(const TileInfo *ti) |
402 |
402 |
403 height = GetBridgeHeight(end); |
403 height = GetBridgeHeight(end); |
404 |
404 |
405 AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
405 AddSortableSpriteToDraw(sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
406 sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset, |
406 sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset, |
407 IsTransparencySet(TO_BUILDINGS) |
407 IsTransparencySet(TO_CATENARY) |
408 ); |
408 ); |
409 |
409 |
410 /* Finished with wires, draw pylons */ |
410 /* Finished with wires, draw pylons */ |
411 /* every other tile needs a pylon on the northern end */ |
411 /* every other tile needs a pylon on the northern end */ |
412 if (num % 2) { |
412 if (num % 2) { |
413 DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_NE : DIAGDIR_NW); |
413 DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_NE : DIAGDIR_NW); |
414 Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE); |
414 Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE); |
415 if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos); |
415 if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos); |
416 uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos]; |
416 uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos]; |
417 uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos]; |
417 uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos]; |
418 AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1); |
418 AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1); |
419 } |
419 } |
420 |
420 |
421 /* need a pylon on the southern end of the bridge */ |
421 /* need a pylon on the southern end of the bridge */ |
422 if (GetTunnelBridgeLength(ti->tile, start) + 1 == length) { |
422 if (GetTunnelBridgeLength(ti->tile, start) + 1 == length) { |
423 DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE); |
423 DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE); |
424 Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE); |
424 Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE); |
425 if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos); |
425 if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos); |
426 uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos]; |
426 uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos]; |
427 uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos]; |
427 uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos]; |
428 AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1); |
428 AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1); |
429 } |
429 } |
430 } |
430 } |
431 |
431 |
432 void DrawCatenary(const TileInfo *ti) |
432 void DrawCatenary(const TileInfo *ti) |
433 { |
433 { |
449 /* This wire is not visible with the default depot sprites */ |
449 /* This wire is not visible with the default depot sprites */ |
450 AddSortableSpriteToDraw( |
450 AddSortableSpriteToDraw( |
451 sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
451 sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, |
452 sss->x_size, sss->y_size, sss->z_size, |
452 sss->x_size, sss->y_size, sss->z_size, |
453 GetTileMaxZ(ti->tile) + sss->z_offset, |
453 GetTileMaxZ(ti->tile) + sss->z_offset, |
454 IsTransparencySet(TO_BUILDINGS) |
454 IsTransparencySet(TO_CATENARY) |
455 ); |
455 ); |
456 return; |
456 return; |
457 } |
457 } |
458 break; |
458 break; |
459 |
459 |