From 9592ed0e53f4e982d40c9c22d6193b7097df58b8 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Fri, 23 May 2014 20:57:50 +0900 Subject: [PATCH] move the last bit of data into a table --- src/ride_data.c | 286 +++++++++++++++++++++++++++++++++++++++++++++ src/ride_data.h | 4 + src/ride_ratings.c | 14 +-- 3 files changed, 295 insertions(+), 9 deletions(-) diff --git a/src/ride_data.c b/src/ride_data.c index f73d809013..61b2419fbf 100644 --- a/src/ride_data.c +++ b/src/ride_data.c @@ -292,3 +292,289 @@ const uint8 costPerTrackPiece[0x59] = { 80, // 58 Mine Ride 80, // 59 LIM Launched Roller Coaster } + +/** + * Data initially at 0x0097E3B4 + */ +const uint8 rideUnknownData1[0x59] = { + 10, // 00 Spiral Roller coaster + 10, // 01 Stand Up Coaster + 20, // 02 Suspended Swinging + 13, // 03 Inverted + 8, // 04 Steel Mini Coaster + 10, // 05 Mini Railroad + 10, // 06 Monorail + 10, // 07 Mini Suspended Coaster + 4, // 08 Bumper Boats + 9, // 09 Wooden Wild Mine/Mouse + 10, // 0a Steeplechase/Motorbike/Soap Box Derby + 8, // 0b Car Ride + 10, // 0c Launched Freefall + 10, // 0d Bobsleigh Coaster + 10, // 0e Observation Tower + 10, // 0f Looping Roller Coaster + 4, // 10 Dinghy Slide + 10, // 11 Mine Train Coaster + 4, // 12 Chairlift + 11, // 13 Corkscrew Roller Coaster + 0, // 14 Maze + 0, // 15 Spiral Slide + 8, // 16 Go Karts + 9, // 17 Log Flume + 10, // 18 River Rapids + 5, // 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 + 10, // 2b Elevator + 11, // 2c Vertical Drop Roller Coaster + 0, // 2d ATM + 0, // 2e Twist + 0, // 2f Haunted House + 0, // 30 First Aid + 0, // 31 Circus Show + 8, // 32 Ghost Train + 11, // 33 Twister Roller Coaster + 10, // 34 Wooden Roller Coaster + 10, // 35 Side-Friction Roller Coaster + 9, // 36 Wild Mouse + 11, // 37 Multi Dimension Coaster + 11, // 38 (none) + 11, // 39 Flying Roller Coaster + 11, // 3a (none) + 10, // 3b Virginia Reel + 9, // 3c Splash Boats + 8, // 3d Mini Helicopters + 11, // 3e Lay-down Roller Coaster + 10, // 3f Suspended Monorail + 11, // 40 (none) + 10, // 41 Reverser Roller Coaster + 11, // 42 Heartline Twister Roller Coaster + 11, // 43 Mini Golf + 12, // 44 Giga Coaster + 10, // 45 Roto-Drop + 5, // 46 Flying Saucers + 0, // 47 Crooked House + 8, // 48 Monorail Cycles + 13, // 49 Compact Inverted Coaster + 8, // 4a Water Coaster + 0, // 4b Air Powered Vertical Coaster + 9, // 4c Inverted Hairpin Coaster + 0, // 4d Magic Carpet + 4, // 4e Submarine Ride + 9, // 4f River Rafts + 0, // 50 (none) + 0, // 51 Enterprise + 0, // 52 (none) + 0, // 53 (none) + 0, // 54 (none) + 11, // 55 (none) + 11, // 56 Inverted Impulse Coaster + 8, // 57 Mini Roller Coaster + 10, // 58 Mine Ride + 9, // 59 LIM Launched Roller Coaster +} + +/** + * Data at 0x0097E3B6, originally set to either be 3 or 0 and replaced here by + * a boolean table. This may be exactly the same as hasRunningTrack above. + */ +const bool rideUnknownData2[0x59] = { + true, // 00 Spiral Roller coaster + true, // 01 Stand Up Coaster + true, // 02 Suspended Swinging + true, // 03 Inverted + true, // 04 Steel Mini Coaster + true, // 05 Mini Railroad + true, // 06 Monorail + true, // 07 Mini Suspended Coaster + false, // 08 Bumper Boats + true, // 09 Wooden Wild Mine/Mouse + true, // 0a Steeplechase/Motorbike/Soap Box Derby + true, // 0b Car Ride + false, // 0c Launched Freefall + true, // 0d Bobsleigh Coaster + false, // 0e Observation Tower + true, // 0f Looping Roller Coaster + true, // 10 Dinghy Slide + true, // 11 Mine Train Coaster + true, // 12 Chairlift + true, // 13 Corkscrew Roller Coaster + false, // 14 Maze + false, // 15 Spiral Slide + false, // 16 Go Karts + false, // 17 Log Flume + false, // 18 River Rapids + false, // 19 Bumper Cars + false, // 1a Pirate Ship + false, // 1b Swinging Inverter Ship + false, // 1c Food Stall + false, // 1d (none) + false, // 1e Drink Stall + false, // 1f (none) + false, // 20 Shop (all types) + false, // 21 Merry Go Round + false, // 22 Balloon Stall (maybe) + false, // 23 Information Kiosk + false, // 24 Bathroom + false, // 25 Ferris Wheel + false, // 26 Motion Simulator + false, // 27 3D Cinema + false, // 28 Gravitron + false, // 29 Space Rings + false, // 2a Reverse Freefall Coaster + false, // 2b Elevator + true, // 2c Vertical Drop Roller Coaster + false, // 2d ATM + false, // 2e Twist + false, // 2f Haunted House + false, // 30 First Aid + false, // 31 Circus Show + true, // 32 Ghost Train + true, // 33 Twister Roller Coaster + true, // 34 Wooden Roller Coaster + true, // 35 Side-Friction Roller Coaster + true, // 36 Wild Mouse + true, // 37 Multi Dimension Coaster + true, // 38 (none) + true, // 39 Flying Roller Coaster + true, // 3a (none) + true, // 3b Virginia Reel + false, // 3c Splash Boats + true, // 3d Mini Helicopters + true, // 3e Lay-down Roller Coaster + true, // 3f Suspended Monorail + true, // 40 (none) + true, // 41 Reverser Roller Coaster + true, // 42 Heartline Twister Roller Coaster + true, // 43 Mini Golf + true, // 44 Giga Coaster + false, // 45 Roto-Drop + false, // 46 Flying Saucers + false, // 47 Crooked House + true, // 48 Monorail Cycles + true, // 49 Compact Inverted Coaster + true, // 4a Water Coaster + false, // 4b Air Powered Vertical Coaster + true, // 4c Inverted Hairpin Coaster + false, // 4d Magic Carpet + false, // 4e Submarine Ride + false, // 4f River Rafts + false, // 50 (none) + false, // 51 Enterprise + false, // 52 (none) + false, // 53 (none) + false, // 54 (none) + true, // 55 (none) + true, // 56 Inverted Impulse Coaster + true, // 57 Mini Roller Coaster + true, // 58 Mine Ride + true, // 59 LIM Launched Roller Coaster +} + +const uint8 rideUnknownData3[0x59] = { + 10, // 00 Spiral Roller coaster + 10, // 01 Stand Up Coaster + 10, // 02 Suspended Swinging + 10, // 03 Inverted + 5, // 04 Steel Mini Coaster + 5, // 05 Mini Railroad + 10, // 06 Monorail + 10, // 07 Mini Suspended Coaster + 0, // 08 Bumper Boats + 10, // 09 Wooden Wild Mine/Mouse + 10, // 0a Steeplechase/Motorbike/Soap Box Derby + 5, // 0b Car Ride + 0, // 0c Launched Freefall + 10, // 0d Bobsleigh Coaster + 0, // 0e Observation Tower + 10, // 0f Looping Roller Coaster + 10, // 10 Dinghy Slide + 10, // 11 Mine Train Coaster + 10, // 12 Chairlift + 10, // 13 Corkscrew Roller Coaster + 0, // 14 Maze + 0, // 15 Spiral Slide + 0, // 16 Go Karts + 10, // 17 Log Flume + 10, // 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 + 10, // 2a Reverse Freefall Coaster + 0, // 2b Elevator + 10, // 2c Vertical Drop Roller Coaster + 0, // 2d ATM + 0, // 2e Twist + 0, // 2f Haunted House + 0, // 30 First Aid + 0, // 31 Circus Show + 5, // 32 Ghost Train + 10, // 33 Twister Roller Coaster + 10, // 34 Wooden Roller Coaster + 10, // 35 Side-Friction Roller Coaster + 10, // 36 Wild Mouse + 15, // 37 Multi Dimension Coaster + 15, // 38 (none) + 15, // 39 Flying Roller Coaster + 15, // 3a (none) + 10, // 3b Virginia Reel + 10, // 3c Splash Boats + 5, // 3d Mini Helicopters + 15, // 3e Lay-down Roller Coaster + 10, // 3f Suspended Monorail + 15, // 40 (none) + 10, // 41 Reverser Roller Coaster + 10, // 42 Heartline Twister Roller Coaster + 10, // 43 Mini Golf + 40, // 44 Giga Coaster + 0, // 45 Roto-Drop + 0, // 46 Flying Saucers + 0, // 47 Crooked House + 5, // 48 Monorail Cycles + 10, // 49 Compact Inverted Coaster + 10, // 4a Water Coaster + 10, // 4b Air Powered Vertical Coaster + 10, // 4c Inverted Hairpin Coaster + 0, // 4d Magic Carpet + 0, // 4e Submarine Ride + 10, // 4f River Rafts + 0, // 50 (none) + 0, // 51 Enterprise + 0, // 52 (none) + 0, // 53 (none) + 0, // 54 (none) + 10, // 55 (none) + 10, // 56 Inverted Impulse Coaster + 10, // 57 Mini Roller Coaster + 10, // 58 Mine Ride + 10, // 59 LIM Launched Roller Coaster +} diff --git a/src/ride_data.h b/src/ride_data.h index 5d239a915c..a6fcfcbd6c 100644 --- a/src/ride_data.h +++ b/src/ride_data.h @@ -21,3 +21,7 @@ extern const uint8 hasRunningTrack[0x59]; extern const uint8 initialUpkeepCosts[0x59]; extern const uint8 costPerTrackPiece[0x59]; + +extern const uint8 rideUnknownData1[0x59]; +extern const bool rideUnknownData2[0x59]; +extern const uint8 rideUnknownData3[0x59]; diff --git a/src/ride_ratings.c b/src/ride_ratings.c index 3428663cb3..7eea972220 100644 --- a/src/ride_ratings.c +++ b/src/ride_ratings.c @@ -69,8 +69,6 @@ void crooked_house_excitement(rct_ride *ride) */ uint16 compute_upkeep(rct_ride *ride) { - uint8 type_idx = ride->type * 0x12; - // data stored at 0x0057E3A8, incrementing 18 bytes at a time uint16 upkeep = initialUpkeepCosts[ride->type]; @@ -79,7 +77,6 @@ uint16 compute_upkeep(rct_ride *ride) dl = dl >> 6; dl = dl & 3; - eax = eax * dl; upkeep += trackCost * dl; uint32 cuml = ride->var_0E4; @@ -131,17 +128,16 @@ uint16 compute_upkeep(rct_ride *ride) // various variables set on the ride itself. // https://gist.github.com/kevinburke/e19b803cd2769d96c540 - eax = RCT2_GLOBAL(0x0097E3B4 + type_idx, uint16); - upkeep += eax * ride->var_0C8; + upkeep += rideUnknownData1[ride->type] * ride->var_0C8; // either set to 3 or 0, extra boosts for some rides including mini golf - eax = RCT2_GLOBAL(0x0097E3B6 + type_idx, uint16); - upkeep += eax * ride->var_0C9; + if (rideUnknownData2[ride->type]) { + upkeep += 3 * ride->var_0C9; + } // slight upkeep boosts for some rides - 5 for mini railroad, 10 for log // flume/rapids, 10 for roller coaster, 28 for giga coaster - eax = RCT2_GLOBAL(0x0097E3B8 + type_idx, uint16); - upkeep += eax * ride->var_0C7; + upkeep += rideUnknownData3[ride->type] * ride->var_0C7; if (ride->mode == RIDE_MODE_REVERSE_INCLINED_SHUTTLE) { upkeep += 30;