From d0d51e477b5d75187b01d77ef122485d0683333a Mon Sep 17 00:00:00 2001 From: ZedThree Date: Mon, 5 May 2014 19:34:24 +0200 Subject: [PATCH 1/2] Add ride mode enum and name some ride variables --- src/news_item.c | 6 ++--- src/ride.c | 4 +-- src/ride.h | 67 +++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 64 insertions(+), 13 deletions(-) diff --git a/src/news_item.c b/src/news_item.c index 624c1b3aeb..3bc978f7bb 100644 --- a/src/news_item.c +++ b/src/news_item.c @@ -182,12 +182,12 @@ void news_item_get_subject_location(int type, int subject, int *x, int *y, int * switch (type) { case NEWS_ITEM_RIDE: ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[subject]); - if (ride->var_050 == 0xFFFF) { + if (ride->overall_view == 0xFFFF) { *x = SPRITE_LOCATION_NULL; break; } - *x = (ride->var_050 & 0xFF) * 32 + 16; - *y = (ride->var_050 >> 8) * 32 + 16; + *x = (ride->overall_view & 0xFF) * 32 + 16; + *y = (ride->overall_view >> 8) * 32 + 16; *z = map_element_height(*x, *y); break; case NEWS_ITEM_PEEP_ON_RIDE: diff --git a/src/ride.c b/src/ride.c index c04019e7b5..cc6f543d7f 100644 --- a/src/ride.c +++ b/src/ride.c @@ -113,7 +113,7 @@ int ride_get_total_queue_length(rct_ride *ride) { int i, queueLength = 0; for (i = 0; i < 4; i++) - if (ride->var_06A[i] != 0xFFFF) + if (ride->entrances[i] != 0xFFFF) queueLength += ride->queue_length[i]; return queueLength; } @@ -122,7 +122,7 @@ int ride_get_max_queue_time(rct_ride *ride) { int i, queueTime = 0; for (i = 0; i < 4; i++) - if (ride->var_06A[i] != 0xFFFF) + if (ride->entrances[i] != 0xFFFF) queueTime = max(queueTime, ride->queue_time[i]); return queueTime; } diff --git a/src/ride.h b/src/ride.h index 2519125595..78574be103 100644 --- a/src/ride.h +++ b/src/ride.h @@ -31,16 +31,20 @@ typedef struct { uint8 type; // 0x000 uint8 subtype; // 0x001 uint16 pad_002; - uint8 var_004; - uint8 pad_005[0x44]; + uint8 mode; // 0x004 + uint8 colour_scheme_type; // 0x005 + uint16 car_colours[32]; // 0x006 + uint8 pad_046[0x03]; uint8 status; // 0x049 uint16 var_04A; uint32 var_04C; - uint16 var_050; // 0x050 - uint8 pad_052[0x18]; - uint16 var_06A[4]; // probably entrance map coordinates - uint8 pad_072[0x14]; - uint16 train_car_map[1]; // 0x86 Points to the first car in the train + uint16 overall_view; // 0x050 + uint16 station_starts[4]; // 0x052 + uint8 pad_05A[0x10]; + uint16 entrances[4]; // 0x06A + uint16 exits[4]; // 0x072 + uint8 pad_07A[0x0C]; + uint16 train_car_map[1]; // 0x086 Points to the first car in the train uint8 pad_088[0x68]; sint16 var_0F0; sint16 var_0F2; @@ -56,7 +60,8 @@ typedef struct { sint16 running_cost; // 0x132 sint16 var_134; sint16 var_136; - uint8 pad_138[0x08]; + sint16 price; // 0x138 + uint8 pad_13A[0x06]; sint16 excitement; // 0x140 sint16 intensity; // 0x142 uint16 nausea; // 0x144 @@ -197,6 +202,52 @@ enum { RIDE_STATUS_TESTING }; +enum { + RIDE_MODE_NORMAL = 0, + RIDE_MODE_CONTINUOUS_CIRCUIT, + RIDE_MODE_REVERSE_INCLINED_SHUTTLE, + RIDE_MODE_POWERED_LAUNCH, // RCT1 style? + RIDE_MODE_SHUTTLE, + RIDE_MODE_BOAT_HIRE, + RIDE_MODE_UPWARD_LAUNCH, + RIDE_MODE_ROTATING_LIFT, + RIDE_MODE_STATION_TO_STATION, + RIDE_MODE_SINGLE_RIDE_PER_ADMISSION, + RIDE_MODE_UNLIMITED_RIDES_PER_ADMISSION, + RIDE_MODE_MAZE, + RIDE_MODE_RACE, + RIDE_MODE_BUMPERCAR, + RIDE_MODE_SWING, + RIDE_MODE_SHOP_STALL, + RIDE_MODE_ROTATION, + RIDE_MODE_FORWARD_ROTATION, + RIDE_MODE_BACKWARD_ROTATION, + RIDE_MODE_FILM_AVENGING_AVIATORS, + RIDE_MODE_3D_FILM_MOUSE_TAILS, + RIDE_MODE_SPACE_RINGS, + RIDE_MODE_BEGINNERS, + RIDE_MODE_LIM_POWERED_LAUNCH, + RIDE_MODE_FILM_THRILL_RIDERS, + RIDE_MODE_3D_FILM_STORM_CHASERS, + RIDE_MODE_3D_FILM_SPACE_RAIDERS, + RIDE_MODE_INTENSE, + RIDE_MODE_BERSERK, + RIDE_MODE_HAUNTED_HOUSE, + RIDE_MODE_CIRCUS_SHOW, + RIDE_MODE_DOWNWARD_LAUNCH, + RIDE_MODE_CROOKED_HOUSE, + RIDE_MODE_FREEFALL_DROP, + RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED, + RIDE_MODE_POWERED_LAUNCH2, // RCT2 style? + RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED +}; + +enum { + RIDE_COLOUR_SCHEME_ALL_SAME, + RIDE_COLOUR_SCHEME_DIFFERENT_PER_TRAIN, + RIDE_COLOUR_SCHEME_DIFFERENT_PER_CAR +}; + #define MAX_RIDES 255 #define MAX_RIDE_MEASUREMENTS 8 From 290255a32d2e45afe7c90c41f12db1f8c2fbb3a7 Mon Sep 17 00:00:00 2001 From: ZedThree Date: Mon, 5 May 2014 20:55:25 +0200 Subject: [PATCH 2/2] Fix bug: rides not sorted correctly --- src/window_ride_list.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/window_ride_list.c b/src/window_ride_list.c index 92d08a7918..390261673b 100644 --- a/src/window_ride_list.c +++ b/src/window_ride_list.c @@ -497,14 +497,14 @@ static void window_ride_list_scrollpaint() formatSecondary = STR_POPULARITY_UNKNOWN_LABEL; if ((ride->var_158 & 0xFF) != 255) { formatSecondary = STR_POPULARITY_LABEL; - RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_158 * 4) & 0xFF; - } + RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_158 & 0xFF) * 4; + } break; case INFORMATION_TYPE_SATISFACTION: formatSecondary = STR_SATISFACTION_UNKNOWN_LABEL; if ((ride->var_14A & 0xFF) != 255) { formatSecondary = STR_SATISFACTION_LABEL; - RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_14A * 5) & 0xFF; + RCT2_GLOBAL(0x013CE952 + 2, uint16) = (ride->var_14A & 0xFF) * 5; } break; case INFORMATION_TYPE_PROFIT: @@ -647,7 +647,7 @@ static void window_ride_list_refresh_list(rct_window *w) case INFORMATION_TYPE_POPULARITY: while (--k >= 0) { otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); - if ((ride->var_158 * 4) & 0xFF <= (otherRide->var_158 * 4) & 0xFF) + if ((ride->var_158 & 0xFF) * 4 <= (otherRide->var_158 & 0xFF) * 4) break; swapper = w->var_076[k]; @@ -658,7 +658,7 @@ static void window_ride_list_refresh_list(rct_window *w) case INFORMATION_TYPE_SATISFACTION: while (--k >= 0) { otherRide = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[k]]); - if ((ride->var_14A * 5) & 0xFF <= (otherRide->var_14A * 5) & 0xFF) + if ((ride->var_14A & 0xFF) * 5 <= (otherRide->var_14A & 0xFF) * 5) break; swapper = w->var_076[k];