tunnelbridge_cmd.c
changeset 1562 a5507e041d97
parent 1542 2ca6d1624e6d
child 1585 3dc279e97623
equal deleted inserted replaced
1561:b52c96c6edcf 1562:a5507e041d97
   195 	sx = TileX(p1) * 16;
   195 	sx = TileX(p1) * 16;
   196 	sy = TileY(p1) * 16;
   196 	sy = TileY(p1) * 16;
   197 
   197 
   198 	direction = 0;
   198 	direction = 0;
   199 
   199 
       
   200 	if (bridge_type >= MAX_BRIDGES) // out of bounds bridge
       
   201 		return_cmd_error(STR_5015_CAN_T_BUILD_BRIDGE_HERE);
       
   202 
   200 	/* check if valid, and make sure that (x,y) are smaller than (sx,sy) */
   203 	/* check if valid, and make sure that (x,y) are smaller than (sx,sy) */
   201 	if (x == sx) {
   204 	if (x == sx) {
   202 		if (y == sy)
   205 		if (y == sy)
   203 			return_cmd_error(STR_5008_CANNOT_START_AND_END_ON);
   206 			return_cmd_error(STR_5008_CANNOT_START_AND_END_ON);
   204 		direction = 1;
   207 		direction = 1;
  1044 				// default sloped sprites..
  1047 				// default sloped sprites..
  1045 				if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
  1048 				if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
  1046 			}
  1049 			}
  1047 
  1050 
  1048 			// bridge ending.
  1051 			// bridge ending.
  1049 			b = _bridge_sprite_table[_map2[ti->tile]>>4][6];
  1052 			b = _bridge_sprite_table[(_map2[ti->tile] >> 4) & 0xF][6];
  1050 			b += (tmp&(3<<1))*4; /* actually ((tmp>>2)&3)*8 */
  1053 			b += (tmp&(3<<1))*4; /* actually ((tmp>>2)&3)*8 */
  1051 			b += (tmp&1); // direction
  1054 			b += (tmp&1); // direction
  1052 			if (ti->tileh == 0) b += 4; // sloped "entrance" ?
  1055 			if (ti->tileh == 0) b += 4; // sloped "entrance" ?
  1053 			if (ti->map5 & 0x20) b += 2; // which side
  1056 			if (ti->map5 & 0x20) b += 2; // which side
  1054 
  1057 
  1104 					if (ice) image += 19; // ice?
  1107 					if (ice) image += 19; // ice?
  1105 				}
  1108 				}
  1106 				DrawGroundSprite(image);
  1109 				DrawGroundSprite(image);
  1107 			}
  1110 			}
  1108 			// get bridge sprites
  1111 			// get bridge sprites
  1109 			b = _bridge_sprite_table[_map2[ti->tile]>>4][_map2[ti->tile]&0xF] + tmp * 4;
  1112 			b = _bridge_sprite_table[(_map2[ti->tile] >> 4) & 0xF][_map2[ti->tile]&0xF] + tmp * 4;
  1110 
  1113 
  1111 			z = GetBridgeHeight(ti) + 5;
  1114 			z = GetBridgeHeight(ti) + 5;
  1112 
  1115 
  1113 			// draw rail
  1116 			// draw rail
  1114 			image = b[0];
  1117 			image = b[0];