summaryrefslogtreecommitdiff
path: root/landscape.c
diff options
context:
space:
mode:
authordominik <dominik@openttd.org>2004-08-13 11:28:59 +0000
committerdominik <dominik@openttd.org>2004-08-13 11:28:59 +0000
commit0c25a4b10ce61dad50f4e0c353fc582669d4f85f (patch)
treedaf6f3c92e522d986c86c27ae66003b4ccc39661 /landscape.c
parentec31ae9f16a53a3c6a67bc11c23728f64b6c8cf3 (diff)
downloadopenttd-0c25a4b10ce61dad50f4e0c353fc582669d4f85f.tar.xz
(svn r38) Preliminary slopes graphics fix. Neighboring tile check not done yet
Diffstat (limited to 'landscape.c')
-rw-r--r--landscape.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/landscape.c b/landscape.c
index 7f953d96d..7863b0e1f 100644
--- a/landscape.c
+++ b/landscape.c
@@ -241,19 +241,33 @@ uint GetSlopeZ(int x, int y)
return _tile_type_procs[ti.type]->get_slope_z_proc(&ti);
}
+/* TODO: add check if this tile has a foundation or not. Since this can't be done easily with the
+ current landscape arrays, we might have to add a new TileTypeProc. */
+bool hasFoundation(uint tile)
+{
+ return true;
+}
+
void DrawFoundation(TileInfo *ti, uint f)
{
+ uint32 sprite_base = SPR_SLOPES_BASE-14;
+ if(hasFoundation( TILE_FROM_XY(ti->x, ti->y-1) )) sprite_base += 22; // foundation in NW direction
+ if(hasFoundation( TILE_FROM_XY(ti->x-1, ti->y) )) sprite_base += 22*2; // foundation in NE direction
+
if (f < 15) {
// leveled foundation
- AddSortableSpriteToDraw(f + 0x3DE - 1, ti->x, ti->y, 16, 16, 7, ti->z);
+ if( sprite_base < SPR_SLOPES_BASE ) sprite_base = 990; // use original slope sprites
+
+ AddSortableSpriteToDraw(f-1 + sprite_base, ti->x, ti->y, 16, 16, 7, ti->z);
ti->z += 8;
ti->tileh = 0;
OffsetGroundSprite(31, 1);
} else {
// inclined foundation
+ sprite_base += 14;
AddSortableSpriteToDraw(
- HASBIT( (1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? (SPR_OPENTTD_BASE+17) + (f - 15) : ti->tileh + 0x3DE - 1,
+ HASBIT( (1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? sprite_base + (f - 15) : ti->tileh + 0x3DE - 1,
ti->x, ti->y, 1, 1, 1, ti->z
);