mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 20:13:07 +01:00
move some data tables into C
This commit is contained in:
@@ -62,6 +62,7 @@ typedef struct {
|
||||
sint32 var_0F0;
|
||||
uint8 pad_0F4[0x20];
|
||||
uint8 var_114;
|
||||
// Track length? Number of track segments?
|
||||
uint8 var_115;
|
||||
uint8 pad_116[0x0F];
|
||||
sint16 var_124;
|
||||
|
||||
195
src/ride_data.c
195
src/ride_data.c
@@ -3,6 +3,9 @@
|
||||
* being used in various places in the game.
|
||||
*
|
||||
* Data source is 0x0097E3AC
|
||||
*
|
||||
* Generating function is here
|
||||
* https://gist.github.com/kevinburke/eaeb1d8149a6eef0dcc1
|
||||
*/
|
||||
const bool hasRunningTrack[0x59] = {
|
||||
true, // 0 Spiral Roller coaster
|
||||
@@ -97,3 +100,195 @@ const bool hasRunningTrack[0x59] = {
|
||||
true, // 59 LIM Launched Roller Coaster
|
||||
}
|
||||
|
||||
/**
|
||||
* Data about ride running costs. This is widely adjusted by the upkeep
|
||||
* function, so values that don't make much sense here (a roller coaster having
|
||||
* cheaper upkeep than a car ride) are fixed later on.
|
||||
*
|
||||
* data generation script: https://gist.github.com/kevinburke/6bcf4a8fcc95faad7bac
|
||||
*/
|
||||
const uint8 initialUpkeepCosts[0x59] = {
|
||||
41, // 00 Spiral Roller coaster
|
||||
40, // 01 Stand Up Coaster
|
||||
40, // 02 Suspended Swinging
|
||||
40, // 03 Inverted
|
||||
40, // 04 Steel Mini Coaster
|
||||
60, // 05 Mini Railroad
|
||||
65, // 06 Monorail
|
||||
40, // 07 Mini Suspended Coaster
|
||||
50, // 08 Bumper Boats
|
||||
40, // 09 Wooden Wild Mine/Mouse
|
||||
40, // 0a Steeplechase/Motorbike/Soap Box Derby
|
||||
70, // 0b Car Ride
|
||||
50, // 0c Launched Freefall
|
||||
40, // 0d Bobsleigh Coaster
|
||||
50, // 0e Observation Tower
|
||||
40, // 0f Looping Roller Coaster
|
||||
40, // 10 Dinghy Slide
|
||||
40, // 11 Mine Train Coaster
|
||||
60, // 12 Chairlift
|
||||
40, // 13 Corkscrew Roller Coaster
|
||||
50, // 14 Maze
|
||||
50, // 15 Spiral Slide
|
||||
50, // 16 Go Karts
|
||||
80, // 17 Log Flume
|
||||
82, // 18 River Rapids
|
||||
50, // 19 Bumper Cars
|
||||
50, // 1a Pirate Ship
|
||||
50, // 1b Swinging Inverter Ship
|
||||
50, // 1c Food Stall
|
||||
50, // 1d (none)
|
||||
50, // 1e Drink Stall
|
||||
50, // 1f (none)
|
||||
50, // 20 Shop (all types)
|
||||
50, // 21 Merry Go Round
|
||||
50, // 22 Balloon Stall (maybe)
|
||||
50, // 23 Information Kiosk
|
||||
50, // 24 Bathroom
|
||||
50, // 25 Ferris Wheel
|
||||
50, // 26 Motion Simulator
|
||||
50, // 27 3D Cinema
|
||||
50, // 28 Gravitron
|
||||
50, // 29 Space Rings
|
||||
80, // 2a Reverse Freefall Coaster
|
||||
50, // 2b Elevator
|
||||
44, // 2c Vertical Drop Roller Coaster
|
||||
40, // 2d ATM
|
||||
50, // 2e Twist
|
||||
50, // 2f Haunted House
|
||||
45, // 30 First Aid
|
||||
50, // 31 Circus Show
|
||||
80, // 32 Ghost Train
|
||||
43, // 33 Twister Roller Coaster
|
||||
40, // 34 Wooden Roller Coaster
|
||||
39, // 35 Side-Friction Roller Coaster
|
||||
40, // 36 Wild Mouse
|
||||
75, // 37 Multi Dimension Coaster
|
||||
75, // 38 (none)
|
||||
49, // 39 Flying Roller Coaster
|
||||
49, // 3a (none)
|
||||
39, // 3b Virginia Reel
|
||||
70, // 3c Splash Boats
|
||||
70, // 3d Mini Helicopters
|
||||
49, // 3e Lay-down Roller Coaster
|
||||
70, // 3f Suspended Monorail
|
||||
49, // 40 (none)
|
||||
39, // 41 Reverser Roller Coaster
|
||||
47, // 42 Heartline Twister Roller Coaster
|
||||
30, // 43 Mini Golf
|
||||
10, // 44 Giga Coaster
|
||||
50, // 45 Roto-Drop
|
||||
90, // 46 Flying Saucers
|
||||
30, // 47 Crooked House
|
||||
47, // 48 Monorail Cycles
|
||||
40, // 49 Compact Inverted Coaster
|
||||
60, // 4a Water Coaster
|
||||
90, // 4b Air Powered Vertical Coaster
|
||||
40, // 4c Inverted Hairpin Coaster
|
||||
50, // 4d Magic Carpet
|
||||
50, // 4e Submarine Ride
|
||||
50, // 4f River Rafts
|
||||
50, // 50 (none)
|
||||
50, // 51 Enterprise
|
||||
50, // 52 (none)
|
||||
50, // 53 (none)
|
||||
50, // 54 (none)
|
||||
40, // 55 (none)
|
||||
180, // 56 Inverted Impulse Coaster
|
||||
35, // 57 Mini Roller Coaster
|
||||
50, // 58 Mine Ride
|
||||
42, // 59 LIM Launched Roller Coaster
|
||||
}
|
||||
|
||||
const uint8 costPerTrackPiece[0x59] = {
|
||||
80, // 00 Spiral Roller coaster
|
||||
80, // 01 Stand Up Coaster
|
||||
80, // 02 Suspended Swinging
|
||||
80, // 03 Inverted
|
||||
80, // 04 Steel Mini Coaster
|
||||
0, // 05 Mini Railroad
|
||||
0, // 06 Monorail
|
||||
80, // 07 Mini Suspended Coaster
|
||||
0, // 08 Bumper Boats
|
||||
80, // 09 Wooden Wild Mine/Mouse
|
||||
80, // 0a Steeplechase/Motorbike/Soap Box Derby
|
||||
0, // 0b Car Ride
|
||||
0, // 0c Launched Freefall
|
||||
80, // 0d Bobsleigh Coaster
|
||||
0, // 0e Observation Tower
|
||||
80, // 0f Looping Roller Coaster
|
||||
80, // 10 Dinghy Slide
|
||||
80, // 11 Mine Train Coaster
|
||||
0, // 12 Chairlift
|
||||
80, // 13 Corkscrew Roller Coaster
|
||||
0, // 14 Maze
|
||||
0, // 15 Spiral Slide
|
||||
0, // 16 Go Karts
|
||||
0, // 17 Log Flume
|
||||
0, // 18 River Rapids
|
||||
0, // 19 Bumper Cars
|
||||
0, // 1a Pirate Ship
|
||||
0, // 1b Swinging Inverter Ship
|
||||
0, // 1c Food Stall
|
||||
0, // 1d (none)
|
||||
0, // 1e Drink Stall
|
||||
0, // 1f (none)
|
||||
0, // 20 Shop (all types)
|
||||
0, // 21 Merry Go Round
|
||||
0, // 22 Balloon Stall (maybe)
|
||||
0, // 23 Information Kiosk
|
||||
0, // 24 Bathroom
|
||||
0, // 25 Ferris Wheel
|
||||
0, // 26 Motion Simulator
|
||||
0, // 27 3D Cinema
|
||||
0, // 28 Gravitron
|
||||
0, // 29 Space Rings
|
||||
0, // 2a Reverse Freefall Coaster
|
||||
0, // 2b Elevator
|
||||
80, // 2c Vertical Drop Roller Coaster
|
||||
0, // 2d ATM
|
||||
0, // 2e Twist
|
||||
0, // 2f Haunted House
|
||||
0, // 30 First Aid
|
||||
0, // 31 Circus Show
|
||||
0, // 32 Ghost Train
|
||||
80, // 33 Twister Roller Coaster
|
||||
80, // 34 Wooden Roller Coaster
|
||||
80, // 35 Side-Friction Roller Coaster
|
||||
80, // 36 Wild Mouse
|
||||
90, // 37 Multi Dimension Coaster
|
||||
90, // 38 (none)
|
||||
90, // 39 Flying Roller Coaster
|
||||
90, // 3a (none)
|
||||
80, // 3b Virginia Reel
|
||||
0, // 3c Splash Boats
|
||||
0, // 3d Mini Helicopters
|
||||
90, // 3e Lay-down Roller Coaster
|
||||
0, // 3f Suspended Monorail
|
||||
90, // 40 (none)
|
||||
80, // 41 Reverser Roller Coaster
|
||||
80, // 42 Heartline Twister Roller Coaster
|
||||
80, // 43 Mini Golf
|
||||
80, // 44 Giga Coaster
|
||||
0, // 45 Roto-Drop
|
||||
0, // 46 Flying Saucers
|
||||
0, // 47 Crooked House
|
||||
0, // 48 Monorail Cycles
|
||||
80, // 49 Compact Inverted Coaster
|
||||
80, // 4a Water Coaster
|
||||
0, // 4b Air Powered Vertical Coaster
|
||||
80, // 4c Inverted Hairpin Coaster
|
||||
0, // 4d Magic Carpet
|
||||
0, // 4e Submarine Ride
|
||||
0, // 4f River Rafts
|
||||
0, // 50 (none)
|
||||
0, // 51 Enterprise
|
||||
0, // 52 (none)
|
||||
0, // 53 (none)
|
||||
0, // 54 (none)
|
||||
80, // 55 (none)
|
||||
80, // 56 Inverted Impulse Coaster
|
||||
80, // 57 Mini Roller Coaster
|
||||
80, // 58 Mine Ride
|
||||
80, // 59 LIM Launched Roller Coaster
|
||||
}
|
||||
|
||||
@@ -18,4 +18,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
extern const uint8 runningTrack[100];
|
||||
extern const uint8 hasRunningTrack[0x59];
|
||||
extern const uint8 initialUpkeepCosts[0x59];
|
||||
extern const uint8 costPerTrackPiece[0x59];
|
||||
|
||||
@@ -71,15 +71,16 @@ uint16 compute_upkeep(rct_ride *ride)
|
||||
{
|
||||
uint8 type_idx = ride->type * 0x12;
|
||||
|
||||
// data values here: https://gist.github.com/kevinburke/456fe478b1822580a449
|
||||
uint16 upkeep = RCT2_GLOBAL(0x0097E3A8 + type_idx, uint16);
|
||||
// data stored at 0x0057E3A8, incrementing 18 bytes at a time
|
||||
uint16 upkeep = initialUpkeepCosts[ride->type];
|
||||
|
||||
uint16 eax = RCT2_GLOBAL(0x0097E3AA + type_idx, uint16);
|
||||
uint16 trackCost = costPerTrackPiece[ride->type];
|
||||
uint8 dl = ride->var_115;
|
||||
|
||||
dl = dl >> 6;
|
||||
dl = dl & 3;
|
||||
eax = eax * dl;
|
||||
upkeep += dl;
|
||||
upkeep += trackCost * dl;
|
||||
|
||||
uint32 cuml = ride->var_0E4;
|
||||
cuml += ride->var_0E8;
|
||||
@@ -105,16 +106,26 @@ uint16 compute_upkeep(rct_ride *ride)
|
||||
upkeep += 40;
|
||||
}
|
||||
|
||||
eax = RCT2_GLOBAL(0x0097E3B0 + type_idx, uint16);
|
||||
// Originally this data was at 0x0097E3B0 and incrementing in 18 byte
|
||||
// offsets. The value here for every ride is 80, except for the reverser,
|
||||
// which is 10
|
||||
uint16 eax;
|
||||
if (ride->type == RIDE_TYPE_REVERSER_ROLLER_COASTER) {
|
||||
eax = 10;
|
||||
} else {
|
||||
eax = 80;
|
||||
}
|
||||
|
||||
// not sure what this value is; it's only written to in one place, where
|
||||
// it's incremented.
|
||||
sint16 dx = RCT2_GLOBAL(0x0138B5CC, sint16);
|
||||
upkeep += eax * dx;
|
||||
|
||||
eax = RCT2_GLOBAL(0x0097E3B2 + type_idx, uint16);
|
||||
dx = RCT2_GLOBAL(0x0138B5CA, sint16);
|
||||
upkeep += eax * dx;
|
||||
// Originally there was a lookup into a table at 0x0097E3B0 and
|
||||
// incrementing in 18 byte offsets. The value here for every ride was 20,
|
||||
// so it's been replaced here by the constant.
|
||||
upkeep += 20 * dx;
|
||||
|
||||
// these seem to be adhoc adjustments to a ride's upkeep/cost, times
|
||||
// various variables set on the ride itself.
|
||||
|
||||
Reference in New Issue
Block a user