tunnelbridge_cmd.c
changeset 2952 58522ed8f0f1
parent 2951 2de6d3a59743
child 2958 ac0a9673b522
equal deleted inserted replaced
2951:2de6d3a59743 2952:58522ed8f0f1
   691 {
   691 {
   692 	int direction = GB(_m[tile].m5, 0, 1);
   692 	int direction = GB(_m[tile].m5, 0, 1);
   693 	TileIndex start;
   693 	TileIndex start;
   694 
   694 
   695 	// find start of bridge
   695 	// find start of bridge
   696 	for(;;) {
   696 	for (;;) {
   697 		if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0x80)
   697 		if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0x80)
   698 			break;
   698 			break;
   699 		tile += direction ? TileDiffXY(0, -1) : TileDiffXY(-1, 0);
   699 		tile += direction ? TileDiffXY(0, -1) : TileDiffXY(-1, 0);
   700 	}
   700 	}
   701 
   701 
   702 	start = tile;
   702 	start = tile;
   703 
   703 
   704 	// find end of bridge
   704 	// find end of bridge
   705 	for(;;) {
   705 	for (;;) {
   706 		if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0xA0)
   706 		if (IsTileType(tile, MP_TUNNELBRIDGE) && (_m[tile].m5 & 0xE0) == 0xA0)
   707 			break;
   707 			break;
   708 		tile += direction ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
   708 		tile += direction ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
   709 	}
   709 	}
   710 
   710 
  1005 		if (IsSteepTileh(ti->tileh)) {
  1005 		if (IsSteepTileh(ti->tileh)) {
  1006 			if (!(ti->tileh & p[2])) front_height += 8;
  1006 			if (!(ti->tileh & p[2])) front_height += 8;
  1007 			if (!(ti->tileh & p[3])) back_height += 8;
  1007 			if (!(ti->tileh & p[3])) back_height += 8;
  1008 		}
  1008 		}
  1009 
  1009 
  1010 		for(; z>=front_height || z>=back_height; z=z-8) {
  1010 		for (; z >= front_height || z >= back_height; z = z - 8) {
  1011 			if (z>=front_height) AddSortableSpriteToDraw(image, x,y, p[4], p[5], 0x28, z); // front facing pillar
  1011 			if (z >= front_height) {
  1012 			if (z>=back_height && z<i-8) AddSortableSpriteToDraw(image, x - p[6], y - p[7], p[4], p[5], 0x28, z); // back facing pillar
  1012 				// front facing pillar
       
  1013 				AddSortableSpriteToDraw(image, x,y, p[4], p[5], 0x28, z);
       
  1014 			}
       
  1015 			if (z >= back_height && z < i - 8) {
       
  1016 				// back facing pillar
       
  1017 				AddSortableSpriteToDraw(image, x - p[6], y - p[7], p[4], p[5], 0x28, z);
       
  1018 			}
  1013 		}
  1019 		}
  1014 	}
  1020 	}
  1015 }
  1021 }
  1016 
  1022 
  1017 uint GetBridgeFoundation(uint tileh, byte direction)
  1023 uint GetBridgeFoundation(uint tileh, byte direction)