diff --git a/projects/openrct2.vcxproj b/projects/openrct2.vcxproj
index 6c3f33f482..328636c259 100644
--- a/projects/openrct2.vcxproj
+++ b/projects/openrct2.vcxproj
@@ -68,6 +68,7 @@
+
@@ -183,6 +184,7 @@
+
diff --git a/projects/openrct2.vcxproj.filters b/projects/openrct2.vcxproj.filters
index cbb78b897f..6020eafffc 100644
--- a/projects/openrct2.vcxproj.filters
+++ b/projects/openrct2.vcxproj.filters
@@ -332,7 +332,6 @@
-
Source
@@ -344,7 +343,7 @@
Source\World
-
+
Source\World
@@ -423,6 +422,9 @@
Source\Windows
+
+ Source\Ride
+
@@ -614,5 +616,8 @@
Source
+
+ Source\Ride
+
\ No newline at end of file
diff --git a/src/ride/track_data.c b/src/ride/track_data.c
new file mode 100644
index 0000000000..636cb95522
--- /dev/null
+++ b/src/ride/track_data.c
@@ -0,0 +1,280 @@
+/*****************************************************************************
+* Copyright (c) 2014 Ted John
+* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+*
+* This file is part of OpenRCT2.
+*
+* OpenRCT2 is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*****************************************************************************/
+
+#include "track_data.h"
+
+const rct_track_coordinates TrackCoordinates[256] = {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 0, 64, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 32, 0, 0 },
+ { 0, 0, 0, 32, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 64, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 32, 0, 0, 0 },
+ { 0, 0, 32, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 3, 0, 0, -64, -64 },
+ { 0, 1, 0, 0, -64, 64 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 3, 0, 0, -64, -64 },
+ { 0, 1, 0, 0, -64, 64 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 3, 0, 64, -64, -64 },
+ { 0, 1, 0, 64, -64, 64 },
+ { 0, 3, 64, 0, -64, -64 },
+ { 0, 1, 64, 0, -64, 64 },
+ { 0, 0, 0, 0, -64, -32 },
+ { 0, 0, 0, 0, -64, 32 },
+ { 0, 0, 0, 0, -32, -32 },
+ { 0, 0, 0, 0, -32, 32 },
+ { 0, 3, 0, 0, -32, -32 },
+ { 0, 1, 0, 0, -32, 32 },
+ { 0, 3, 0, 0, -32, -32 },
+ { 0, 1, 0, 0, -32, 32 },
+ { 0, 3, 0, 32, -32, -32 },
+ { 0, 1, 0, 32, -32, 32 },
+ { 0, 3, 32, 0, -32, -32 },
+ { 0, 1, 32, 0, -32, 32 },
+ { 0, 3, 0, 0, 0, 0 },
+ { 0, 1, 0, 0, 0, 0 },
+ { 0, 0, 0, 16, -64, 0 },
+ { 0, 0, 0, 16, -64, 0 },
+ { 0, 0, 0, -16, -64, 0 },
+ { 0, 0, 0, -16, -64, 0 },
+ { 0, 2, 0, 152, -32, 0 },
+ { 0, 2, 0, -152, 32, 0 },
+ { 0, 3, 0, 80, -32, -32 },
+ { 0, 1, 0, 80, -32, 32 },
+ { 0, 3, 0, -80, -32, -32 },
+ { 0, 1, 0, -80, -32, 32 },
+ { 0, 0, 0, 24, 0, 0 },
+ { 0, 0, 0, 24, 0, 0 },
+ { 0, 0, 24, 0, 0, 0 },
+ { 0, 0, 24, 0, 0, 0 },
+ { 0, 0, 0, 96, 32, 0 },
+ { 0, 0, 0, 32, 32, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 0, 64, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 32, 0, 0 },
+ { 0, 0, 0, 32, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 64, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 32, 0, 0, 0 },
+ { 0, 0, 32, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 3, 0, 0, -64, -64 },
+ { 0, 1, 0, 0, -64, 64 },
+ { 0, 0, 0, 0, -64, -32 },
+ { 0, 0, 0, 0, -64, 32 },
+ { 0, 3, 0, 0, -32, -32 },
+ { 0, 1, 0, 0, -32, 32 },
+ { 0, 2, 0, 16, 0, -96 },
+ { 0, 2, 0, 16, 0, 96 },
+ { 0, 2, 16, 0, 0, -96 },
+ { 0, 2, 16, 0, 0, 96 },
+ { 0, 2, 0, 16, 0, -160 },
+ { 0, 2, 0, 16, 0, 160 },
+ { 0, 2, 16, 0, 0, -160 },
+ { 0, 2, 16, 0, 0, 160 },
+ { 0, 3, 0, 64, 0, 0 },
+ { 0, 1, 0, 64, 0, 0 },
+ { 0, 3, 64, 0, 0, 0 },
+ { 0, 1, 64, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 3, 0, 16, -64, -64 },
+ { 0, 1, 0, 16, -64, 64 },
+ { 0, 3, 16, 0, -64, -64 },
+ { 0, 1, 16, 0, -64, 64 },
+ { 0, 3, 0, 16, -64, -64 },
+ { 0, 1, 0, 16, -64, 64 },
+ { 0, 3, 16, 0, -64, -64 },
+ { 0, 1, 16, 0, -64, 64 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 16, 16, -128, 0 },
+ { 0, 0, 0, 88, -96, 0 },
+ { 0, 0, 0, 88, -96, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 88, 0, -96, 0 },
+ { 0, 0, 88, 0, -96, 0 },
+ { 0, 0, 0, -96, -96, 0 },
+ { 0, 0, 0, 240, -160, 0 },
+ { 0, 0, 0, 80, 32, 0 },
+ { 0, 0, 0, 32, 32, 0 },
+ { 0, 0, 32, 0, 32, 0 },
+ { 0, 0, 0, 56, 32, 0 },
+ { 0, 0, 56, 0, 0, 0 },
+ { 0, 0, 0, 56, 0, 0 },
+ { 0, 0, 56, 0, 32, 0 },
+ { 0, 0, 24, 0, 0, 0 },
+ { 0, 7, 0, 0, -64, -32 },
+ { 0, 4, 0, 0, -64, 32 },
+ { 4, 0, 0, 0, -64, 32 },
+ { 4, 1, 0, 0, -32, 64 },
+ { 0, 7, 0, 0, -64, -32 },
+ { 0, 4, 0, 0, -64, 32 },
+ { 4, 0, 0, 0, -64, 32 },
+ { 4, 1, 0, 0, -32, 64 },
+ { 4, 4, 0, 0, -32, 32 },
+ { 4, 4, 0, 16, -32, 32 },
+ { 4, 4, 0, 64, -32, 32 },
+ { 4, 4, 0, 8, -32, 32 },
+ { 4, 4, 0, 32, -32, 32 },
+ { 4, 4, 0, 32, -32, 32 },
+ { 4, 4, 0, 8, -32, 32 },
+ { 4, 4, 16, 0, -32, 32 },
+ { 4, 4, 64, 0, -32, 32 },
+ { 4, 4, 8, 0, -32, 32 },
+ { 4, 4, 32, 0, -32, 32 },
+ { 4, 4, 32, 0, -32, 32 },
+ { 4, 4, 8, 0, -32, 32 },
+ { 4, 4, 0, 24, -32, 32 },
+ { 4, 4, 0, 24, -32, 32 },
+ { 4, 4, 24, 0, -32, 32 },
+ { 4, 4, 24, 0, -32, 32 },
+ { 4, 4, 0, 0, -32, 32 },
+ { 4, 4, 0, 0, -32, 32 },
+ { 4, 4, 0, 0, -32, 32 },
+ { 4, 4, 0, 0, -32, 32 },
+ { 4, 4, 0, 8, -32, 32 },
+ { 4, 4, 0, 8, -32, 32 },
+ { 4, 4, 0, 8, -32, 32 },
+ { 4, 4, 0, 8, -32, 32 },
+ { 4, 4, 8, 0, -32, 32 },
+ { 4, 4, 8, 0, -32, 32 },
+ { 4, 4, 8, 0, -32, 32 },
+ { 4, 4, 8, 0, -32, 32 },
+ { 4, 4, 0, 0, -32, 32 },
+ { 4, 4, 0, 0, -32, 32 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 32, -64, 0 },
+ { 0, 0, 0, 32, -64, 0 },
+ { 0, 0, 0, -32, -64, 0 },
+ { 0, 0, 0, -32, -64, 0 },
+ { 0, 3, 0, 24, -32, -32 },
+ { 0, 1, 0, 24, -32, 32 },
+ { 0, 3, 24, 0, -32, -32 },
+ { 0, 1, 24, 0, -32, 32 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 2, 0, 280, -64, -32 },
+ { 0, 2, 0, 280, -64, 32 },
+ { 0, 2, 0, -280, 64, -32 },
+ { 0, 2, 0, -280, 64, 32 },
+ { 0, 0, 0, -16, -64, 0 },
+ { 0, 0, 0, -16, -64, 0 },
+ { 0, 0, 0, 16, -64, 0 },
+ { 0, 0, 0, 16, -64, 0 },
+ { 0, 2, 0, 120, -32, 0 },
+ { 0, 2, 0, -120, 32, 0 },
+ { 0, 3, 0, 48, -32, -32 },
+ { 0, 1, 0, 48, -32, 32 },
+ { 0, 3, 0, -48, -32, -32 },
+ { 0, 1, 0, -48, -32, 32 },
+ { 0, 2, 0, 32, 0, 0 },
+ { 0, 2, 0, -32, 0, 0 },
+ { 0, 0, 0, 0, -160, 0 },
+ { 0, 0, 0, 0, -160, 0 },
+ { 0, 0, 0, 0, -32, 0 },
+ { 0, 0, 0, 0, -32, 0 },
+ { 0, 0, 0, 0, -32, 0 },
+ { 0, 1, 0, 0, -32, 32 },
+ { 0, 3, 0, 0, -32, -32 },
+ { 0, 2, 0, -96, -96, 0 },
+ { 0, 2, 0, 128, 64, 0 },
+ { 0, 2, 0, -128, -96, 0 },
+ { 0, 3, 0, 16, -32, -32 },
+ { 0, 1, 0, 16, -32, 32 },
+ { 0, 0, 0, 0, -64, 0 },
+ { 0, 0, 0, 0, -64, 0 },
+ { 0, 0, 0, 0, -32, 0 },
+ { 0, 0, 80, 0, 32, 0 },
+ { 0, 0, 240, 0, -160, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 3, 0, 32, -32, -32 },
+ { 0, 1, 0, 32, -32, 32 },
+ { 0, 3, 32, 0, -32, -32 },
+ { 0, 1, 32, 0, -32, 32 },
+ { 0, 3, 0, 64, -64, -64 },
+ { 0, 1, 0, 64, -64, 64 },
+ { 0, 3, 64, 0, -64, -64 },
+ { 0, 1, 64, 0, -64, 64 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 0, 16, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 16, 0, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 0, 8, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 0, 8, 0, 0, 0 },
+ { 0, 3, 0, 96, 0, 32 },
+ { 0, 1, 0, 96, 0, -32 },
+ { 0, 3, 96, 0, 0, 32 },
+ { 0, 1, 96, 0, 0, -32 },
+ { 0, 2, 0, 96, 64, 0 },
+ { 0, 2, 0, -128, -96, 0 },
+ { 0, 2, 0, 128, 64, 0 }
+};
\ No newline at end of file
diff --git a/src/ride/track_data.h b/src/ride/track_data.h
new file mode 100644
index 0000000000..c10ad9bd3d
--- /dev/null
+++ b/src/ride/track_data.h
@@ -0,0 +1,33 @@
+/*****************************************************************************
+* Copyright (c) 2014 Ted John
+* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
+*
+* This file is part of OpenRCT2.
+*
+* OpenRCT2 is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*****************************************************************************/
+#include "../common.h"
+
+/* size 0x0A */
+typedef struct{
+ sint8 rotation_negative; // 0x00
+ sint8 rotation_positive; // 0x01
+ sint16 z_negative; // 0x02
+ sint16 z_positive; // 0x04
+ sint16 x; // 0x06
+ sint16 y; // 0x08
+}rct_track_coordinates;
+
+// 0x009968BB, 0x009968BC, 0x009968BD, 0x009968BF, 0x009968C1, 0x009968C3
+extern const rct_track_coordinates TrackCoordinates[256];
\ No newline at end of file
diff --git a/src/windows/track_place.c b/src/windows/track_place.c
index 77776e1b95..785cc66364 100644
--- a/src/windows/track_place.c
+++ b/src/windows/track_place.c
@@ -28,6 +28,7 @@
#include "../localisation/localisation.h"
#include "../sprites.h"
#include "../ride/track.h"
+#include "../ride/track_data.h"
#define TRACK_MINI_PREVIEW_WIDTH 168
#define TRACK_MINI_PREVIEW_HEIGHT 78
@@ -211,28 +212,30 @@ static void window_track_place_draw_mini_preview()
// Change rotation and next position based on track curvature
rotation &= 3;
+ const rct_track_coordinates* track_coordinate = &TrackCoordinates[trackType];
+
trackType *= 10;
switch (rotation) {
case 0:
- originX += RCT2_GLOBAL(0x009968C1 + trackType, sint16);
- originY += RCT2_GLOBAL(0x009968C3 + trackType, sint16);
+ originX += track_coordinate->x;
+ originY += track_coordinate->y;
break;
case 1:
- originX += RCT2_GLOBAL(0x009968C3 + trackType, sint16);
- originY -= RCT2_GLOBAL(0x009968C1 + trackType, sint16);
+ originX += track_coordinate->y;
+ originY -= track_coordinate->x;
break;
case 2:
- originX -= RCT2_GLOBAL(0x009968C1 + trackType, sint16);
- originY -= RCT2_GLOBAL(0x009968C3 + trackType, sint16);
+ originX -= track_coordinate->x;
+ originY -= track_coordinate->y;
break;
case 3:
- originX -= RCT2_GLOBAL(0x009968C3 + trackType, sint16);
- originY += RCT2_GLOBAL(0x009968C1 + trackType, sint16);
+ originX -= track_coordinate->y;
+ originY += track_coordinate->x;
break;
}
- rotation += RCT2_ADDRESS(0x009968BC, uint8)[trackType] - RCT2_ADDRESS(0x009968BB, uint8)[trackType];
+ rotation += track_coordinate->rotation_positive - track_coordinate->rotation_negative;
rotation &= 3;
- if (RCT2_ADDRESS(0x009968BC, uint8)[trackType] & 4)
+ if (track_coordinate->rotation_positive & 4)
rotation |= 4;
if (!(rotation & 4)) {
originX += RCT2_GLOBAL(0x00993CCC + (rotation * 4), sint16);