tunnelbridge_cmd.c
changeset 3216 425b6575d297
parent 3215 c5dcb0d4b297
child 3217 c170368a2c9a
equal deleted inserted replaced
3215:c5dcb0d4b297 3216:425b6575d297
  1031 		} else {
  1031 		} else {
  1032 			// bridge middle part.
  1032 			// bridge middle part.
  1033 			uint z;
  1033 			uint z;
  1034 			int x,y;
  1034 			int x,y;
  1035 
  1035 
  1036 			image = GB(ti->map5, 3, 2); // type of stuff under bridge (only defined for 0,1)
  1036 			if (IsTransportUnderBridge(ti->tile)) {
  1037 			/** @todo So why do we even WASTE that one bit?! (map5, bit 4) */
       
  1038 			assert(image <= 1);
       
  1039 
       
  1040 			if (!(ti->map5 & 0x20)) {
       
  1041 				// draw land under bridge
       
  1042 				if (ice) image += 2;
       
  1043 
       
  1044 				if (image != 1 || ti->tileh == 0) {
       
  1045 					DrawGroundSprite(_bridge_land_below[image] + _tileh_to_sprite[ti->tileh]);
       
  1046 				} else {
       
  1047 					DrawGroundSprite(_water_shore_sprites[ti->tileh]);
       
  1048 				}
       
  1049 
       
  1050 				// draw canal water?
       
  1051 				if (ti->map5 & 8 && ti->z != 0) DrawCanalWater(ti->tile);
       
  1052 			} else {
       
  1053 				// draw transport route under bridge
  1037 				// draw transport route under bridge
  1054 
  1038 
  1055 				// draw foundation?
  1039 				// draw foundation?
  1056 				if (ti->tileh) {
  1040 				if (ti->tileh) {
  1057 					int f = _bridge_foundations[ti->map5&1][ti->tileh];
  1041 					int f = _bridge_foundations[ti->map5&1][ti->tileh];
  1058 					if (f) DrawFoundation(ti, f);
  1042 					if (f) DrawFoundation(ti, f);
  1059 				}
  1043 				}
  1060 
  1044 
  1061 				if (!(image&1)) {
  1045 				if (GetTransportTypeUnderBridge(ti->tile) == TRANSPORT_RAIL) {
  1062 					const RailtypeInfo *rti = GetRailTypeInfo(GB(_m[ti->tile].m3, 0, 4));
  1046 					const RailtypeInfo *rti = GetRailTypeInfo(GB(_m[ti->tile].m3, 0, 4));
  1063 					// railway
  1047 
  1064 					image = SPR_RAIL_TRACK_Y + (ti->map5 & 1);
  1048 					image = SPR_RAIL_TRACK_Y + (ti->map5 & 1);
  1065 					if (ti->tileh != 0) image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1];
  1049 					if (ti->tileh != 0) image = SPR_RAIL_TRACK_Y + _track_sloped_sprites[ti->tileh - 1];
  1066 					image += rti->total_offset;
  1050 					image += rti->total_offset;
  1067 					if (ice) image += rti->snow_offset;
  1051 					if (ice) image += rti->snow_offset;
  1068 				} else {
  1052 				} else {
  1070 					image = SPR_ROAD_Y + (ti->map5 & 1);
  1054 					image = SPR_ROAD_Y + (ti->map5 & 1);
  1071 					if (ti->tileh != 0) image = _road_sloped_sprites[ti->tileh - 1] + 0x53F;
  1055 					if (ti->tileh != 0) image = _road_sloped_sprites[ti->tileh - 1] + 0x53F;
  1072 					if (ice) image += 19;
  1056 					if (ice) image += 19;
  1073 				}
  1057 				}
  1074 				DrawGroundSprite(image);
  1058 				DrawGroundSprite(image);
       
  1059 			} else {
       
  1060 				if (IsClearUnderBridge(ti->tile)) {
       
  1061 					image = (ice ? SPR_FLAT_SNOWY_TILE : SPR_FLAT_GRASS_TILE);
       
  1062 					DrawGroundSprite(image + _tileh_to_sprite[ti->tileh]);
       
  1063 				} else {
       
  1064 					if (ti->tileh == 0) {
       
  1065 						DrawGroundSprite(SPR_FLAT_WATER_TILE);
       
  1066 						if (ti->z != 0) DrawCanalWater(ti->tile);
       
  1067 					} else {
       
  1068 						DrawGroundSprite(_water_shore_sprites[ti->tileh]);
       
  1069 					}
       
  1070 				}
  1075 			}
  1071 			}
  1076 
  1072 
  1077 			/* Cope for the direction of the bridge */
  1073 			/* Cope for the direction of the bridge */
  1078 			if (HASBIT(ti->map5, 0)) base_offset += 4;
  1074 			if (HASBIT(ti->map5, 0)) base_offset += 4;
  1079 
  1075