road_cmd.c
changeset 3097 4c9edce4d22c
parent 3091 ea4f5ae735d2
child 3098 aed45c5c1e11
equal deleted inserted replaced
3096:c99edbe5f20f 3097:4c9edce4d22c
   762 				(i++, bits == (ROAD_NW | ROAD_SE))
   762 				(i++, bits == (ROAD_NW | ROAD_SE))
   763 			)) {
   763 			)) {
   764 		return i + 15;
   764 		return i + 15;
   765 	}
   765 	}
   766 
   766 
   767 	// rail crossing
       
   768 	if ((bits & 0x10) && _valid_tileh_slopes_road[2][tileh]) return tileh;
       
   769 
       
   770 	return 0;
   767 	return 0;
   771 }
   768 }
   772 
   769 
   773 const byte _road_sloped_sprites[14] = {
   770 const byte _road_sloped_sprites[14] = {
   774 	0,  0,  2,  0,
   771 	0,  0,  2,  0,
   846 		case 0: // normal road
   843 		case 0: // normal road
   847 			DrawRoadBits(ti, GB(ti->map5, 0, 4), GB(_m[ti->tile].m4, 4, 3), HASBIT(_m[ti->tile].m4, 7), false);
   844 			DrawRoadBits(ti, GB(ti->map5, 0, 4), GB(_m[ti->tile].m4, 4, 3), HASBIT(_m[ti->tile].m4, 7), false);
   848 			break;
   845 			break;
   849 
   846 
   850 		case 1: { // level crossing
   847 		case 1: { // level crossing
   851 			int f = GetRoadFoundation(ti->tileh, ti->map5 & 0xF);
   848 			if (ti->tileh != 0) DrawFoundation(ti, ti->tileh);
   852 			if (f) DrawFoundation(ti, f);
       
   853 
   849 
   854 			image = GetRailTypeInfo(GB(_m[ti->tile].m4, 0, 4))->base_sprites.crossing;
   850 			image = GetRailTypeInfo(GB(_m[ti->tile].m4, 0, 4))->base_sprites.crossing;
   855 
   851 
   856 			if (GB(ti->map5, 3, 1) == 0) image++; /* direction */
   852 			if (GB(ti->map5, 3, 1) == 0) image++; /* direction */
   857 
   853 
   929 	int th = ti->tileh;
   925 	int th = ti->tileh;
   930 
   926 
   931 	// check if it's a foundation
   927 	// check if it's a foundation
   932 	if (ti->tileh != 0) {
   928 	if (ti->tileh != 0) {
   933 		switch (GB(ti->map5, 4, 4)) {
   929 		switch (GB(ti->map5, 4, 4)) {
   934 			case 0: // normal road
   930 			case 0: { // normal road
   935 			case 1: { // level crossing
   931 				uint f = GetRoadFoundation(ti->tileh, GB(ti->map5, 0, 4));
   936 				uint f = GetRoadFoundation(ti->tileh, ti->map5 & 0x3F);
       
   937 				if (f != 0) {
   932 				if (f != 0) {
   938 					if (f < 15) {
   933 					if (f < 15) {
   939 						// leveled foundation
   934 						// leveled foundation
   940 						return z + 8;
   935 						return z + 8;
   941 					}
   936 					}
   943 					th = _inclined_tileh[f - 15];
   938 					th = _inclined_tileh[f - 15];
   944 				}
   939 				}
   945 				break;
   940 				break;
   946 			}
   941 			}
   947 
   942 
       
   943 			// if these are on a slope then there's a level foundation
       
   944 			case 1: // level crossing
   948 			case 2: // depot
   945 			case 2: // depot
   949 				return z + 8;
   946 				return z + 8;
   950 
   947 
   951 			default: break;
   948 			default: break;
   952 		}
   949 		}
   958 static uint GetSlopeTileh_Road(const TileInfo *ti)
   955 static uint GetSlopeTileh_Road(const TileInfo *ti)
   959 {
   956 {
   960 	// check if it's a foundation
   957 	// check if it's a foundation
   961 	if (ti->tileh != 0) {
   958 	if (ti->tileh != 0) {
   962 		switch (GB(ti->map5, 4, 4)) {
   959 		switch (GB(ti->map5, 4, 4)) {
   963 			case 0: // normal road
   960 			case 0: { // normal road
   964 			case 1: { // level crossing
   961 				uint f = GetRoadFoundation(ti->tileh, GB(ti->map5, 0, 4));
   965 				uint f = GetRoadFoundation(ti->tileh, ti->map5 & 0x3F);
       
   966 				if (f != 0) {
   962 				if (f != 0) {
   967 					if (f < 15) {
   963 					if (f < 15) {
   968 						// leveled foundation
   964 						// leveled foundation
   969 						return 0;
   965 						return 0;
   970 					}
   966 					}
   972 					return _inclined_tileh[f - 15];
   968 					return _inclined_tileh[f - 15];
   973 				}
   969 				}
   974 				break;
   970 				break;
   975 			}
   971 			}
   976 
   972 
       
   973 			// if these are on a slope then there's a level foundation
       
   974 			case 1: // level crossing
   977 			case 2: // depot
   975 			case 2: // depot
   978 				return 0;
   976 				return 0;
   979 
   977 
   980 			default: break;
   978 			default: break;
   981 		}
   979 		}