summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-01-03 09:45:07 +0000
committerpeter1138 <peter1138@openttd.org>2007-01-03 09:45:07 +0000
commit789b76d36b21f23c8654cf5767880894b3dab68f (patch)
tree6f03e2c6f82bcc7e06c4699d063c25ed5d37caeb
parent8e625b8b427fb7ac72bbb0625df3e8b18c2c28a6 (diff)
downloadopenttd-789b76d36b21f23c8654cf5767880894b3dab68f.tar.xz
(svn r7794) -Cleanup: Remove obsolete, never-used landscape rotation code. And spell obsolete correctly.
-rw-r--r--src/functions.h6
-rw-r--r--src/spritecache.c46
-rw-r--r--src/viewport.c52
3 files changed, 5 insertions, 99 deletions
diff --git a/src/functions.h b/src/functions.h
index 0529c1646..12490b10d 100644
--- a/src/functions.h
+++ b/src/functions.h
@@ -20,15 +20,9 @@ bool IsValidTile(TileIndex tile);
static inline Point RemapCoords(int x, int y, int z)
{
-#if !defined(NEW_ROTATION)
Point pt;
pt.x = (y - x) * 2;
pt.y = y + x - z;
-#else
- Point pt;
- pt.x = (x + y) * 2;
- pt.y = x - y - z;
-#endif
return pt;
}
diff --git a/src/spritecache.c b/src/spritecache.c
index 0b1c598cc..08a15c3ce 100644
--- a/src/spritecache.c
+++ b/src/spritecache.c
@@ -335,48 +335,6 @@ static void* AllocSprite(size_t mem_req)
}
}
-#if defined(NEW_ROTATION)
-#define X15(x) else if (s >= x && s < (x+15)) { s = _rotate_tile_sprite[s - x] + x; }
-#define X19(x) else if (s >= x && s < (x+19)) { s = _rotate_tile_sprite[s - x] + x; }
-#define MAP(from,to,map) else if (s >= from && s <= to) { s = map[s - from] + from; }
-
-
-static uint RotateSprite(uint s)
-{
- static const byte _rotate_tile_sprite[19] = { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 17, 18, 16, 15 };
- static const byte _coast_map[9] = {0, 4, 3, 1, 2, 6, 8, 5, 7};
- static const byte _fence_map[6] = {1, 0, 5, 4, 3, 2};
-
- if (0);
- X19(752)
- X15(990-1)
- X19(3924)
- X19(3943)
- X19(3962)
- X19(3981)
- X19(4000)
- X19(4023)
- X19(4042)
- MAP(4061, 4069, _coast_map)
- X19(4126)
- X19(4145)
- X19(4164)
- X19(4183)
- X19(4202)
- X19(4221)
- X19(4240)
- X19(4259)
- X19(4259)
- X19(4278)
- MAP(4090, 4095, _fence_map)
- MAP(4096, 4101, _fence_map)
- MAP(4102, 4107, _fence_map)
- MAP(4108, 4113, _fence_map)
- MAP(4114, 4119, _fence_map)
- MAP(4120, 4125, _fence_map)
- return s;
-}
-#endif
const void *GetRawSprite(SpriteID sprite)
{
@@ -384,10 +342,6 @@ const void *GetRawSprite(SpriteID sprite)
assert(sprite < MAX_SPRITES);
-#if defined(NEW_ROTATION)
- sprite = RotateSprite(sprite);
-#endif
-
// Update LRU
_sprite_lru_new[sprite] = ++_sprite_lru_counter;
diff --git a/src/viewport.c b/src/viewport.c
index fa19e7b60..7199edbd9 100644
--- a/src/viewport.c
+++ b/src/viewport.c
@@ -329,13 +329,8 @@ static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y)
x = ((x << vp->zoom) + vp->virtual_left) >> 2;
y = ((y << vp->zoom) + vp->virtual_top) >> 1;
-#if !defined(NEW_ROTATION)
a = y-x;
b = y+x;
-#else
- a = x+y;
- b = x-y;
-#endif
/* we need to move variables in to the valid range, as the
* GetTileZoomCenterWindow() function can call here with invalid x and/or y,
@@ -719,13 +714,9 @@ static void ViewportAddLandscape(void)
_cur_ti = &ti;
// Transform into tile coordinates and round to closest full tile
-#if !defined(NEW_ROTATION)
x = ((vd->dpi.top >> 1) - (vd->dpi.left >> 2)) & ~0xF;
y = ((vd->dpi.top >> 1) + (vd->dpi.left >> 2) - 0x10) & ~0xF;
-#else
- x = ((vd->dpi.top >> 1) + (vd->dpi.left >> 2) - 0x10) & ~0xF;
- y = ((vd->dpi.left >> 2) - (vd->dpi.top >> 1)) & ~0xF;
-#endif
+
// determine size of area
{
Point pt = RemapCoords(x, y, 241);
@@ -762,13 +753,9 @@ static void ViewportAddLandscape(void)
tt = MP_VOID;
}
-#if !defined(NEW_ROTATION)
y_cur += 0x10;
x_cur -= 0x10;
-#else
- y_cur += 0x10;
- x_cur += 0x10;
-#endif
+
_added_tile_sprite = false;
_offset_ground_sprites = false;
@@ -776,17 +763,11 @@ static void ViewportAddLandscape(void)
DrawTileSelection(&ti);
} while (--width_cur);
-#if !defined(NEW_ROTATION)
- if ( (direction^=1) != 0)
+ if ((direction ^= 1) != 0) {
y += 0x10;
- else
- x += 0x10;
-#else
- if ( (direction^=1) != 0)
+ } else {
x += 0x10;
- else
- y -= 0x10;
-#endif
+ }
} while (--height);
}
@@ -1263,7 +1244,6 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
vd.first_tile = NULL;
ViewportAddLandscape();
-#if !defined(NEW_ROTATION)
ViewportAddVehicles(&vd.dpi);
DrawTextEffects(&vd.dpi);
@@ -1271,7 +1251,6 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
ViewportAddStationNames(&vd.dpi);
ViewportAddSigns(&vd.dpi);
ViewportAddWaypoints(&vd.dpi);
-#endif
// This assert should never happen (because the length of the parent_list
// is checked)
@@ -1354,7 +1333,6 @@ void UpdateViewportPosition(Window *w)
SetViewportPosition(w, pt.x, pt.y);
} else {
-#if !defined(NEW_ROTATION)
int x;
int y;
int vx;
@@ -1376,26 +1354,6 @@ void UpdateViewportPosition(Window *w)
// Set position
WP(w, vp_d).scrollpos_x = x - vp->virtual_width / 2;
WP(w, vp_d).scrollpos_y = y - vp->virtual_height / 2;
-#else
- int x,y,t;
- int err;
-
- x = WP(w,vp_d).scrollpos_x >> 2;
- y = WP(w,vp_d).scrollpos_y >> 1;
-
- t = x;
- x = x + y;
- y = x - y;
- err= 0;
-
- if (err != 0) {
- /* coordinate remap */
- Point pt = RemapCoords(x, y, 0);
- t = (-1) << vp->zoom;
- WP(w,vp_d).scrollpos_x = pt.x & t;
- WP(w,vp_d).scrollpos_y = pt.y & t;
- }
-#endif
SetViewportPosition(w, WP(w, vp_d).scrollpos_x, WP(w, vp_d).scrollpos_y);
}