(svn r13499) -Codechange: Allow drawing (ugly) leveled foundations on steep slopes, just in case someone needs them for fallback.
This commit is contained in:
		| @@ -337,8 +337,7 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh) | |||||||
| 	IndustryGfx gfx = GetIndustryGfx(tile); | 	IndustryGfx gfx = GetIndustryGfx(tile); | ||||||
|  |  | ||||||
| 	/* For NewGRF industry tiles we might not be drawing a foundation. We need to | 	/* For NewGRF industry tiles we might not be drawing a foundation. We need to | ||||||
| 	 * account for this, otherwise we might be applying a FOUNDATION_LEVELED | 	 * account for this, as other structures should | ||||||
| 	 * on a steep slope which is not allowed. Furthermore other structures should |  | ||||||
| 	 * draw the wall of the foundation in this case. | 	 * draw the wall of the foundation in this case. | ||||||
| 	 */ | 	 */ | ||||||
| 	if (gfx >= NEW_INDUSTRYTILEOFFSET) { | 	if (gfx >= NEW_INDUSTRYTILEOFFSET) { | ||||||
|   | |||||||
| @@ -79,8 +79,9 @@ uint ApplyFoundationToSlope(Foundation f, Slope *s) | |||||||
| 	if (!IsFoundation(f)) return 0; | 	if (!IsFoundation(f)) return 0; | ||||||
|  |  | ||||||
| 	if (IsLeveledFoundation(f)) { | 	if (IsLeveledFoundation(f)) { | ||||||
|  | 		uint dz = TILE_HEIGHT + (IsSteepSlope(*s) ? TILE_HEIGHT : 0); | ||||||
| 		*s = SLOPE_FLAT; | 		*s = SLOPE_FLAT; | ||||||
| 		return TILE_HEIGHT; | 		return dz; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (f != FOUNDATION_STEEP_BOTH && IsNonContinuousFoundation(f)) { | 	if (f != FOUNDATION_STEEP_BOTH && IsNonContinuousFoundation(f)) { | ||||||
| @@ -402,6 +403,9 @@ void DrawFoundation(TileInfo *ti, Foundation f) | |||||||
|  |  | ||||||
| 			AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, 16, 16, 1, ti->z); | 			AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, 16, 16, 1, ti->z); | ||||||
| 			OffsetGroundSprite(31, 9); | 			OffsetGroundSprite(31, 9); | ||||||
|  | 		} else if (IsLeveledFoundation(f)) { | ||||||
|  | 			AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z - TILE_HEIGHT); | ||||||
|  | 			OffsetGroundSprite(31, 1); | ||||||
| 		} else if (f == FOUNDATION_STEEP_LOWER) { | 		} else if (f == FOUNDATION_STEEP_LOWER) { | ||||||
| 			/* one corner raised */ | 			/* one corner raised */ | ||||||
| 			OffsetGroundSprite(31, 1); | 			OffsetGroundSprite(31, 1); | ||||||
|   | |||||||
| @@ -347,13 +347,11 @@ static inline Corner GetRailFoundationCorner(Foundation f) | |||||||
|  * Returns the foundation needed to flatten a slope. |  * Returns the foundation needed to flatten a slope. | ||||||
|  * The returned foundation is either FOUNDATION_NONE if the tile was already flat, or FOUNDATION_LEVELED. |  * The returned foundation is either FOUNDATION_NONE if the tile was already flat, or FOUNDATION_LEVELED. | ||||||
|  * |  * | ||||||
|  * @pre      The slope must not be steep. |  | ||||||
|  * @param s  The current #Slope. |  * @param s  The current #Slope. | ||||||
|  * @return   The needed #Foundation. |  * @return   The needed #Foundation. | ||||||
|  */ |  */ | ||||||
| static inline Foundation FlatteningFoundation(Slope s) | static inline Foundation FlatteningFoundation(Slope s) | ||||||
| { | { | ||||||
| 	assert(!IsSteepSlope(s)); |  | ||||||
| 	return (s == SLOPE_FLAT ? FOUNDATION_NONE : FOUNDATION_LEVELED); | 	return (s == SLOPE_FLAT ? FOUNDATION_NONE : FOUNDATION_LEVELED); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 frosch
					frosch