Integrate gRideProperties

This commit is contained in:
Michał Janiszewski 2016-07-30 22:04:32 +02:00
parent a71e60bed5
commit 09a20524a5
7 changed files with 112 additions and 8 deletions

View File

@ -124,6 +124,100 @@ uint8 gTypeToRideEntryIndexMap[TYPE_TO_RIDE_ENTRY_SLOTS];
#pragma endregion
const rct_ride_properties gRideProperties[91] = {
{ 0xdc1046b7, 10, 27, 30, 17 },
{ 0xdc1046b7, 7, 27, 0, 0 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0xdc1046b7, 7, 27, 0, 0 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0xd4004214, 0, 0, 0, 0 },
{ 0xd4004217, 0, 0, 0, 0 },
{ 0xdc1046b5, 0, 0, 0, 0 },
{ 0x9c004845, 0, 0, 0, 0 },
{ 0x9c1046b5, 0, 0, 0, 0 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0x94104227, 0, 0, 0, 0 },
{ 0x9414430f, 10, 40, 0, 0 },
{ 0x9c1046b7, 0, 0, 0, 0 },
{ 0x9404410f, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 26, 18 },
{ 0x9c1056b7, 0, 0, 0, 0 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0x94004005, 1, 4, 0, 0 },
{ 0xdc1046b7, 10, 12, 30, 25 },
{ 0x1044280c, 1, 16, 0, 0 },
{ 0xca90f, 1, 5, 0, 0 },
{ 0x94140805, 1, 10, 0, 0 },
{ 0x94104637, 0, 0, 0, 0 },
{ 0x94144635, 0, 0, 0, 0 },
{ 0x40c890f, 20, 180, 0, 0 },
{ 0x40dc10d, 7, 25, 0, 0 },
{ 0x40dc10f, 7, 15, 0, 0 },
{ 0x8ea908, 0, 0, 0, 0 },
{ 0x8ea908, 0, 0, 0, 0 },
{ 0x10ea908, 0, 0, 0, 0 },
{ 0x10ea908, 0, 0, 0, 0 },
{ 0xea909, 0, 0, 0, 0 },
{ 0x40dc108, 4, 25, 0, 0 },
{ 0xea909, 0, 0, 0, 0 },
{ 0xea909, 0, 0, 0, 0 },
{ 0x26ea908, 4, 4, 0, 0 },
{ 0x40d8109, 1, 3, 0, 0 },
{ 0x40dc108, 0, 0, 0, 0 },
{ 0x44dc108, 0, 0, 0, 0 },
{ 0x40dc10f, 0, 0, 0, 0 },
{ 0x40c8908, 0, 0, 0, 0 },
{ 0x9c1046a7, 7, 30, 30, 40 },
{ 0xb404410d, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 26, 18 },
{ 0xea908, 0, 0, 0, 0 },
{ 0x40dc108, 3, 6, 0, 0 },
{ 0x4dc108, 0, 0, 0, 0 },
{ 0x6ea908, 8, 8, 0, 0 },
{ 0x44dc108, 0, 0, 0, 0 },
{ 0x941046a7, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 30, 17 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0x9c1046b7, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 30, 25 },
{ 0xdc1046b7, 10, 27, 30, 25 },
{ 0xdc1046b7, 10, 27, 30, 25 },
{ 0xdc1046b7, 10, 27, 30, 25 },
{ 0x9c1046b7, 0, 0, 0, 0 },
{ 0x94104637, 0, 0, 0, 0 },
{ 0x94104227, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 30, 25 },
{ 0xd4004217, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 30, 25 },
{ 0x9c1046b7, 0, 0, 0, 0 },
{ 0x9c1046b7, 10, 27, 30, 25 },
{ 0x90000807, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 30, 17 },
{ 0x9414430f, 0, 0, 0, 0 },
{ 0x40c890b, 20, 180, 0, 0 },
{ 0x4dc108, 0, 0, 0, 0 },
{ 0x94104a27, 0, 0, 0, 0 },
{ 0xdc1046b7, 7, 27, 0, 0 },
{ 0xdc1056b7, 0, 0, 0, 0 },
{ 0x9c1046a7, 30, 50, 30, 40 },
{ 0x9c1046b7, 0, 0, 0, 0 },
{ 0x40dc10f, 7, 15, 0, 0 },
{ 0x94104057, 0, 0, 0, 0 },
{ 0x94104237, 0, 0, 0, 0 },
{ 0x8ea908, 0, 0, 0, 0 },
{ 0x41dc108, 10, 20, 0, 0 },
{ 0x10ea908, 0, 0, 0, 0 },
{ 0x8ea908, 0, 0, 0, 0 },
{ 0x10ea908, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 27, 30, 25 },
{ 0x9c1046b7, 10, 33, 30, 25 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0xdc1046b7, 0, 0, 0, 0 },
{ 0x9c1046b7, 0, 0, 0, 0 },
{ 0xdc1046b7, 10, 31, 26, 18 },
};
static const int RideInspectionInterval[] = {
10, 20, 30, 45, 60, 120, 0, 0
};

View File

@ -883,6 +883,16 @@ enum {
RIDE_SETTING_RIDE_TYPE,
};
typedef struct rct_ride_properties {
uint32 flags;
uint8 minValue;
uint8 maxValue;
uint8 maxBrakesSpeed;
uint8 accelaration;
} rct_ride_properties;
extern const rct_ride_properties gRideProperties[91];
#define MAX_RIDES 255
#define MAX_RIDE_MEASUREMENTS 8

View File

@ -622,7 +622,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in
enabledTrackPieces |= rideEntry->enabledTrackPiecesB & gResearchedTrackTypesB[ride->type];
enabledTrackPieces <<= 32;
enabledTrackPieces |= rideEntry->enabledTrackPiecesA & gResearchedTrackTypesA[ride->type];
uint32 rideTypeFlags = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32);
uint32 rideTypeFlags = gRideProperties[ride->type].flags;
RCT2_GLOBAL(0x00F44068, uint32) = rideTypeFlags;
if ((ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) && type == 1) {

View File

@ -260,7 +260,7 @@ static rct_track_td6 *track_design_open_from_buffer(uint8 *src, size_t srcLength
td6->var_50 = min(
td6->var_50,
RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + 5 + (td6->type * 8), uint8)
gRideProperties[td6->type].maxValue
);
// Set the element helper pointers

View File

@ -7201,7 +7201,7 @@ loc_6DAEB9:
if ((trackType == TRACK_ELEM_FLAT && ride->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER) ||
(trackType == TRACK_ELEM_POWERED_LIFT)
) {
vehicle->acceleration = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8) + 7, uint8) << 16;
vehicle->acceleration = gRideProperties[ride->type].accelaration << 16;
}
if (trackType == TRACK_ELEM_BRAKE_FOR_DROP) {
if (!vehicle->is_child) {

View File

@ -3136,8 +3136,8 @@ static void window_ride_mode_tweak_increase(rct_window *w)
{
rct_ride *ride = get_ride(w->number);
uint8 maxValue = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8) + 5, uint8);
uint8 minValue = gCheatsFastLiftHill ? 0 : RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8) + 4, uint8);
uint8 maxValue = gRideProperties[ride->type].maxValue;
uint8 minValue = gCheatsFastLiftHill ? 0 : gRideProperties[ride->type].minValue;
if (ride->mode == RIDE_MODE_MAZE) {
// Allow 64 people in mazes under non-cheat settings. The old maximum of 16 was too little for even moderately big mazes.
maxValue = 64;
@ -3159,8 +3159,8 @@ static void window_ride_mode_tweak_decrease(rct_window *w)
{
rct_ride *ride = get_ride(w->number);
uint8 maxValue = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8) + 5, uint8);
uint8 minValue = gCheatsFastLiftHill ? 0 : RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8) + 4, uint8);
uint8 maxValue = gRideProperties[ride->type].maxValue;
uint8 minValue = gCheatsFastLiftHill ? 0 : gRideProperties[ride->type].minValue;
if (ride->mode == RIDE_MODE_MAZE) {
// Allow 64 people in mazes under non-cheat settings. The old maximum of 16 was too little for even moderately big mazes.
maxValue = 64;

View File

@ -1511,7 +1511,7 @@ static void window_ride_construction_mousedown(int widgetIndex, rct_window *w, r
uint8 maxBrakesSpeed = 30;
if (RCT2_GLOBAL(0x00F440D3, uint8) != 1) {
brakesSpeedPtr = (uint8*)0x00F440CE;
maxBrakesSpeed = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + 6 + (ride->type * 8), uint8);
maxBrakesSpeed = gRideProperties[ride->type].maxBrakesSpeed;
}
uint8 brakesSpeed = *brakesSpeedPtr + 2;
if (brakesSpeed <= maxBrakesSpeed) {