mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
add ride list window
This commit is contained in:
parent
6b0ba5c6d0
commit
27d9fccfcf
8 changed files with 545 additions and 46 deletions
18
src/game.c
18
src/game.c
|
@ -369,31 +369,31 @@ static void game_handle_input_mouse(int x, int y, int state)
|
|||
switch (ebx & 0xFF) {
|
||||
case 2:
|
||||
if (*((uint8*)edx) == 0)
|
||||
RCT2_CALLPROC_X(0x006B4857, 0, 0, 0, 0, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006B4857, eax, 0, ecx, 0, 0, 0, 0);
|
||||
break;
|
||||
case 3:
|
||||
RCT2_CALLPROC_X(0x006CC056, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006CC056, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 5:
|
||||
RCT2_CALLPROC_X(0x006E08D2, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006E08D2, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 6:
|
||||
RCT2_CALLPROC_X(0x006A614A, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006A614A, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 7:
|
||||
RCT2_CALLPROC_X(0x006A61AB, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006A61AB, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 8:
|
||||
RCT2_CALLPROC_X(0x00666C0E, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x00666C0E, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 9:
|
||||
RCT2_CALLPROC_X(0x006E57A9, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006E57A9, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 10:
|
||||
RCT2_CALLPROC_X(0x006B88DC, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006B88DC, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
case 12:
|
||||
RCT2_CALLPROC_X(0x006BA233, 0, 0, 0, edx, 0, 0, 0);
|
||||
RCT2_CALLPROC_X(0x006BA233, eax, 0, ecx, edx, 0, 0, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
89
src/ride.c
89
src/ride.c
|
@ -24,6 +24,77 @@
|
|||
#define GET_RIDE(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[x]))
|
||||
#define GET_RIDE_MEASUREMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_MEASUREMENTS, rct_ride_measurement)[x]))
|
||||
|
||||
#pragma region Ride classification table
|
||||
|
||||
const uint8 gRideClassifications[255] = {
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL,
|
||||
RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_RIDE, RIDE_CLASS_SHOP_OR_STALL,
|
||||
RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_KIOSK_OR_FACILITY, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_RIDE, RIDE_CLASS_SHOP_OR_STALL,
|
||||
RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_SHOP_OR_STALL, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE, RIDE_CLASS_RIDE
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
|
||||
int ride_get_count()
|
||||
{
|
||||
rct_ride *ride;
|
||||
|
@ -38,6 +109,24 @@ int ride_get_count()
|
|||
return count;
|
||||
}
|
||||
|
||||
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)
|
||||
queueLength += ride->queue_length[i];
|
||||
return queueLength;
|
||||
}
|
||||
|
||||
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)
|
||||
queueTime = max(queueTime, ride->queue_time[i]);
|
||||
return queueTime;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ACA89
|
||||
|
|
46
src/ride.h
46
src/ride.h
|
@ -29,9 +29,15 @@
|
|||
*/
|
||||
typedef struct {
|
||||
uint8 type; // 0x000
|
||||
uint8 pad_001[0x4F];
|
||||
uint32 var_001;
|
||||
uint8 pad_005[0x44];
|
||||
uint8 status; // 0x049
|
||||
uint16 var_04A;
|
||||
uint32 pad_04C;
|
||||
uint16 var_050; // 0x050
|
||||
uint8 pad_052[0x34];
|
||||
uint8 pad_052[0x18];
|
||||
uint16 var_06A[4]; // probably entrance map coordinates
|
||||
uint8 pad_072[0x14];
|
||||
uint16 var_086[1];
|
||||
uint8 pad_088[0x68];
|
||||
sint16 excitement; // 0x0F0
|
||||
|
@ -53,11 +59,25 @@ typedef struct {
|
|||
sint16 var_142;
|
||||
uint16 pad_144;
|
||||
uint16 reliability; // 0x146
|
||||
uint8 pad_148[0x51];
|
||||
uint16 pad_148;
|
||||
uint16 var_14A;
|
||||
uint8 pad_14C;
|
||||
uint8 var_14D;
|
||||
uint8 pad_14E[0x0A];
|
||||
uint16 var_158;
|
||||
uint8 pad_15A[0x3C];
|
||||
uint16 var_196;
|
||||
uint8 pad_198;
|
||||
uint8 var_199;
|
||||
uint8 pad_19A[0x36];
|
||||
uint8 pad_19A[0x1A];
|
||||
sint32 profit; // 0x1B4
|
||||
uint8 queue_time[4]; // 0x1B8
|
||||
uint8 pad_1BC[0x12];
|
||||
uint16 guests_favourite; // 0x1CE
|
||||
uint32 var_1D0;
|
||||
uint8 pad_1D4[0x8C];
|
||||
uint8 pad_1D4[0x2C];
|
||||
uint16 queue_length[4]; // 0x200
|
||||
uint8 pad_208[0x58];
|
||||
} rct_ride;
|
||||
|
||||
/**
|
||||
|
@ -69,6 +89,12 @@ typedef struct {
|
|||
uint8 pad_01[0x4B0B];
|
||||
} rct_ride_measurement;
|
||||
|
||||
enum {
|
||||
RIDE_CLASS_RIDE,
|
||||
RIDE_CLASS_SHOP_OR_STALL,
|
||||
RIDE_CLASS_KIOSK_OR_FACILITY
|
||||
};
|
||||
|
||||
enum {
|
||||
RIDE_TYPE_NULL = 255,
|
||||
RIDE_TYPE_SPIRAL_ROLLER_COASTER = 0,
|
||||
|
@ -163,10 +189,20 @@ enum {
|
|||
RIDE_TYPE_LIM_LAUNCHED_ROLLER_COASTER
|
||||
};
|
||||
|
||||
enum {
|
||||
RIDE_STATUS_CLOSED,
|
||||
RIDE_STATUS_OPEN,
|
||||
RIDE_STATUS_TESTING
|
||||
};
|
||||
|
||||
#define MAX_RIDES 255
|
||||
#define MAX_RIDE_MEASUREMENTS 8
|
||||
|
||||
extern const uint8 gRideClassifications[255];
|
||||
|
||||
int ride_get_count();
|
||||
int ride_get_total_queue_length(rct_ride *ride);
|
||||
int ride_get_max_queue_time(rct_ride *ride);
|
||||
void ride_init_all();
|
||||
|
||||
#endif
|
|
@ -160,7 +160,8 @@ enum {
|
|||
|
||||
STR_OPEN_OR_CLOSE_ALL_RIDES = 1009,
|
||||
STR_OPEN_OR_CLOSE_PARK_TIP = 1010,
|
||||
|
||||
STR_CLOSE_ALL = 1011,
|
||||
STR_OPEN_ALL = 1012,
|
||||
STR_CLOSE_PARK = 1013,
|
||||
STR_OPEN_PARK = 1014,
|
||||
|
||||
|
@ -173,6 +174,18 @@ enum {
|
|||
|
||||
STR_BUILD_FOOTPATH_TIP = 1173,
|
||||
|
||||
STR_CLOSED = 1194,
|
||||
STR_TEST_RUN = 1195,
|
||||
STR_OPEN = 1196,
|
||||
STR_BROKEN_DOWN = 1197,
|
||||
STR_CRASHED = 1198,
|
||||
|
||||
STR_QUEUE_EMPTY = 1201,
|
||||
STR_QUEUE_ONE_PERSON = 1202,
|
||||
STR_QUEUE_PEOPLE = 1203,
|
||||
STR_QUEUE_TIME_LABEL = 1204,
|
||||
STR_QUEUE_TIME_PLURAL_LABEL = 1205,
|
||||
|
||||
STR_NUMERIC_UP = 1218,
|
||||
STR_NUMERIC_DOWN = 1219,
|
||||
|
||||
|
@ -205,8 +218,6 @@ enum {
|
|||
STR_GUESTS_FILTER_THINKING = STR_GUESTS_FILTER + 1,
|
||||
STR_GUESTS_FILTER_THINKING_ABOUT = STR_GUESTS_FILTER + 2,
|
||||
|
||||
STR_RIDE_LIST_INFORMATION_TYPE_TIP = 8144,
|
||||
|
||||
STR_STATUS = 1826,
|
||||
STR_POPULARITY = 1827,
|
||||
STR_SATISFACTION = 1828,
|
||||
|
@ -216,7 +227,16 @@ enum {
|
|||
STR_RELIABILITY = 1832,
|
||||
STR_DOWN_TIME = 1833,
|
||||
STR_GUESTS_FAVOURITE = 1834,
|
||||
|
||||
STR_POPULARITY_UNKNOWN_LABEL = 1835,
|
||||
STR_POPULARITY_LABEL = 1836,
|
||||
STR_SATISFACTION_UNKNOWN_LABEL = 1837,
|
||||
STR_SATISFACTION_LABEL = 1838,
|
||||
STR_RELIABILITY_LABEL = 1839,
|
||||
STR_DOWN_TIME_LABEL = 1840,
|
||||
STR_PROFIT_LABEL = 1841,
|
||||
STR_GUESTS_FAVOURITE_LABEL = 1842,
|
||||
STR_GUESTS_FAVOURITE_PLURAL_LABEL = 1843,
|
||||
STR_RIDE_LIST_INFORMATION_TYPE_TIP = 1844,
|
||||
STR_NUM_GUESTS = 1846,
|
||||
|
||||
STR_BUILD_RIDE_TIP = 1895,
|
||||
|
|
|
@ -110,7 +110,7 @@ typedef struct rct_window {
|
|||
rct_windownumber number; // 0x03C
|
||||
uint16 flags; // 0x03E
|
||||
rct_scroll scrolls[3]; // 0x040
|
||||
uint8 pad_076[0x400];
|
||||
uint8 var_076[0x400];
|
||||
sint16 var_476;
|
||||
sint16 pad_478;
|
||||
sint16 var_47A;
|
||||
|
|
|
@ -100,6 +100,34 @@ static uint32 window_dropdown_events[] = {
|
|||
* @param colour (al)
|
||||
*/
|
||||
void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 flags, int num_items)
|
||||
{
|
||||
int i, string_width, max_string_width;
|
||||
char buffer[256];
|
||||
|
||||
// Calculate the longest string width
|
||||
max_string_width = 0;
|
||||
for (i = 0; i < num_items; i++) {
|
||||
format_string(buffer, gDropdownItemsFormat[i], (void*)(&gDropdownItemsArgs[i]));
|
||||
RCT2_GLOBAL(0x013CE950, sint16) = 224;
|
||||
string_width = gfx_get_string_width(buffer);
|
||||
max_string_width = max(string_width, max_string_width);
|
||||
}
|
||||
|
||||
window_dropdown_show_text_custom_width(x, y, extray, colour, flags, num_items, max_string_width + 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a text dropdown menu.
|
||||
* rct2: 0x006ECFB9, although 0x006ECE50 is real version
|
||||
*
|
||||
* @param x (cx)
|
||||
* @param y (dx)
|
||||
* @param extray (di)
|
||||
* @param flags (bh)
|
||||
* @param num_items (bx)
|
||||
* @param colour (al)
|
||||
*/
|
||||
void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colour, uint8 flags, int num_items, int width)
|
||||
{
|
||||
rct_window* w;
|
||||
int i, string_width, max_string_width;
|
||||
|
@ -115,22 +143,12 @@ void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 fla
|
|||
|
||||
window_dropdown_close();
|
||||
_dropdown_num_columns = 1;
|
||||
_dropdown_item_width = 0;
|
||||
_dropdown_item_width = width;
|
||||
_dropdown_item_height = 10;
|
||||
if (flags & 0x40)
|
||||
_dropdown_item_height = flags & 0x3F;
|
||||
|
||||
// Calculate the longest string width
|
||||
max_string_width = 0;
|
||||
for (i = 0; i < num_items; i++) {
|
||||
format_string(buffer, gDropdownItemsFormat[i], (void*)(&gDropdownItemsArgs[i]));
|
||||
RCT2_GLOBAL(0x013CE950, sint16) = 224;
|
||||
string_width = gfx_get_string_width(buffer);
|
||||
max_string_width = max(string_width, max_string_width);
|
||||
}
|
||||
|
||||
// Set the widgets
|
||||
_dropdown_item_width = max_string_width + 3;
|
||||
_dropdown_num_items = num_items;
|
||||
_dropdown_num_rows = num_items;
|
||||
window_dropdown_widgets[WIDX_BACKGROUND].bottom = _dropdown_item_height * num_items + 3;
|
||||
|
@ -166,7 +184,7 @@ void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 fla
|
|||
}
|
||||
|
||||
/**
|
||||
* Shows am image dropdown menu.
|
||||
* Shows an image dropdown menu.
|
||||
* rct2: 0x006ECFB9
|
||||
*
|
||||
* @param x (cx)
|
||||
|
|
|
@ -29,5 +29,6 @@ extern sint32 gDropdownItemsArgs[64];
|
|||
extern uint32 gDropdownItemsChecked;
|
||||
|
||||
void window_dropdown_show_text(int x, int y, int extray, uint8 colour, uint8 flags, int num_items);
|
||||
void window_dropdown_show_text_custom_width(int x, int y, int extray, uint8 colour, uint8 flags, int num_items, int width);
|
||||
void window_dropdown_show_image(int x, int y, int extray, uint8 colour, uint8 flags, int numItems, int itemWidth, int itemHeight, int numColumns);
|
||||
void window_dropdown_close();
|
|
@ -18,13 +18,13 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include "addresses.h"
|
||||
#include "park.h"
|
||||
#include "ride.h"
|
||||
#include "strings.h"
|
||||
#include "sprites.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
#include "window_dropdown.h"
|
||||
|
||||
enum {
|
||||
PAGE_RIDES,
|
||||
|
@ -65,15 +65,20 @@ static rct_widget window_ride_list_widgets[] = {
|
|||
|
||||
static void window_ride_list_emptysub() { }
|
||||
static void window_ride_list_mouseup();
|
||||
static void window_ride_list_resize();
|
||||
static void window_ride_list_mousedown();
|
||||
static void window_ride_list_dropdown();
|
||||
static void window_ride_list_update();
|
||||
static void window_ride_list_scrollgetsize();
|
||||
static void window_ride_list_tooltip();
|
||||
static void window_ride_list_invalidate();
|
||||
static void window_ride_list_paint();
|
||||
static void window_ride_list_scrollpaint();
|
||||
|
||||
static uint32 window_ride_list_events[] = {
|
||||
window_ride_list_emptysub,
|
||||
window_ride_list_mouseup,
|
||||
window_ride_list_emptysub,
|
||||
window_ride_list_resize,
|
||||
window_ride_list_mousedown,
|
||||
window_ride_list_dropdown,
|
||||
window_ride_list_emptysub,
|
||||
|
@ -86,7 +91,7 @@ static uint32 window_ride_list_events[] = {
|
|||
window_ride_list_emptysub,
|
||||
window_ride_list_emptysub,
|
||||
window_ride_list_emptysub,
|
||||
window_ride_list_emptysub,
|
||||
window_ride_list_scrollgetsize,
|
||||
window_ride_list_emptysub,
|
||||
window_ride_list_emptysub,
|
||||
window_ride_list_emptysub,
|
||||
|
@ -98,7 +103,7 @@ static uint32 window_ride_list_events[] = {
|
|||
window_ride_list_emptysub,
|
||||
window_ride_list_invalidate,
|
||||
window_ride_list_paint,
|
||||
window_ride_list_emptysub
|
||||
window_ride_list_scrollpaint
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -113,9 +118,12 @@ enum {
|
|||
INFORMATION_TYPE_GUESTS_FAVOURITE
|
||||
};
|
||||
|
||||
static void window_ride_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
static int _window_ride_list_information_type;
|
||||
|
||||
static int window_ride_list_information_type;
|
||||
static void window_ride_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
static void window_ride_list_refresh_list(rct_window *w);
|
||||
static void window_ride_list_close_all(rct_window *w);
|
||||
static void window_ride_list_open_all(rct_window *w);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -128,7 +136,7 @@ void window_ride_list_open()
|
|||
// Check if window is already open
|
||||
window = window_bring_to_front_by_id(WC_RIDE_LIST, 0);
|
||||
if (window == NULL) {
|
||||
window = window_create_auto_pos(340, 240, window_ride_list_events, WC_PARK_INFORMATION, 0x0400);
|
||||
window = window_create_auto_pos(340, 240, window_ride_list_events, WC_RIDE_LIST, 0x0400);
|
||||
window->widgets = window_ride_list_widgets;
|
||||
window->enabled_widgets =
|
||||
(1 << WIDX_CLOSE) |
|
||||
|
@ -153,10 +161,14 @@ void window_ride_list_open()
|
|||
window->colours[1] = 26;
|
||||
window->colours[2] = 26;
|
||||
}
|
||||
window_ride_list_information_type = INFORMATION_TYPE_STATUS;
|
||||
_window_ride_list_information_type = INFORMATION_TYPE_STATUS;
|
||||
window->var_490 = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3511
|
||||
*/
|
||||
static void window_ride_list_mouseup()
|
||||
{
|
||||
int i;
|
||||
|
@ -171,7 +183,7 @@ static void window_ride_list_mouseup()
|
|||
window_close(w);
|
||||
break;
|
||||
case WIDX_SORT:
|
||||
w->var_490 = window_ride_list_information_type;
|
||||
w->var_490 = _window_ride_list_information_type;
|
||||
w->var_476 = 0;
|
||||
w->var_47A = -1;
|
||||
break;
|
||||
|
@ -182,32 +194,108 @@ static void window_ride_list_mouseup()
|
|||
w->page = widgetIndex - WIDX_TAB_1;
|
||||
w->var_476 = 0;
|
||||
w->var_47A = -1;
|
||||
if (w->page != PAGE_RIDES && window_ride_list_information_type > INFORMATION_TYPE_PROFIT)
|
||||
window_ride_list_information_type = INFORMATION_TYPE_PROFIT;
|
||||
if (w->page != PAGE_RIDES && _window_ride_list_information_type > INFORMATION_TYPE_PROFIT)
|
||||
_window_ride_list_information_type = INFORMATION_TYPE_PROFIT;
|
||||
window_invalidate(w);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B38A7
|
||||
*/
|
||||
static void window_ride_list_resize()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
__asm mov w, esi
|
||||
|
||||
w->min_width = 340;
|
||||
w->min_height = 124;
|
||||
if (w->width < w->min_width) {
|
||||
window_invalidate(w);
|
||||
w->width = w->min_width;
|
||||
}
|
||||
if (w->height < w->min_height) {
|
||||
window_invalidate(w);
|
||||
w->height = w->min_height;
|
||||
}
|
||||
|
||||
window_ride_list_refresh_list(w);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3532
|
||||
*/
|
||||
static void window_ride_list_mousedown()
|
||||
{
|
||||
int numItems, i;
|
||||
short widgetIndex;
|
||||
rct_window *w;
|
||||
rct_widget *widget;
|
||||
|
||||
__asm mov widgetIndex, dx
|
||||
__asm mov w, esi
|
||||
__asm mov widget, edi
|
||||
|
||||
if (widgetIndex == WIDX_OPEN_CLOSE_ALL) {
|
||||
gDropdownItemsFormat[0] = STR_CLOSE_ALL;
|
||||
gDropdownItemsFormat[1] = STR_OPEN_ALL;
|
||||
window_dropdown_show_text(w->x + widget->left, w->y + widget->top, widget->bottom - widget->top, w->colours[1], 0, 2);
|
||||
} else if (widgetIndex == WIDX_INFORMATION_TYPE_DROPDOWN) {
|
||||
widget--;
|
||||
|
||||
numItems = 9;
|
||||
if (w->page != PAGE_RIDES)
|
||||
numItems -= 5;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_FLAGS, uint32) & GAME_FLAGS_NO_MONEY)
|
||||
numItems--;
|
||||
|
||||
for (i = 0; i < numItems; i++) {
|
||||
gDropdownItemsFormat[i] = 1142;
|
||||
gDropdownItemsArgs[i] = STR_STATUS + i;
|
||||
}
|
||||
window_dropdown_show_text_custom_width(w->x + widget->left, w->y + widget->top, widget->bottom - widget->top, w->colours[1], 0x80, numItems, widget->right - widget->left - 3);
|
||||
gDropdownItemsChecked |= (1 << _window_ride_list_information_type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3547
|
||||
*/
|
||||
static void window_ride_list_dropdown()
|
||||
{
|
||||
short widgetIndex;
|
||||
int i;
|
||||
short dropdownIndex, widgetIndex;
|
||||
rct_window *w;
|
||||
rct_ride *ride;
|
||||
|
||||
__asm mov dropdownIndex, ax
|
||||
__asm mov widgetIndex, dx
|
||||
__asm mov w, esi
|
||||
|
||||
if (widgetIndex == WIDX_OPEN_CLOSE_ALL) {
|
||||
if (dropdownIndex == 0)
|
||||
window_ride_list_close_all(w);
|
||||
else if (dropdownIndex == 1)
|
||||
window_ride_list_open_all(w);
|
||||
} else if (widgetIndex == WIDX_INFORMATION_TYPE_DROPDOWN) {
|
||||
if (dropdownIndex == -1)
|
||||
return;
|
||||
|
||||
_window_ride_list_information_type = gDropdownItemsArgs[dropdownIndex] - STR_STATUS;
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B386B
|
||||
*/
|
||||
static void window_ride_list_update()
|
||||
{
|
||||
rct_window *w;
|
||||
|
@ -216,15 +304,52 @@ static void window_ride_list_update()
|
|||
|
||||
w->var_48E = (w->var_48E + 1) % 64;
|
||||
widget_invalidate(w->classification, w->number, WIDX_TAB_1 + w->page);
|
||||
if (window_ride_list_information_type != INFORMATION_TYPE_STATUS)
|
||||
if (_window_ride_list_information_type != INFORMATION_TYPE_STATUS)
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B35A1
|
||||
*/
|
||||
static void window_ride_list_scrollgetsize()
|
||||
{
|
||||
int top, height;
|
||||
rct_window *w;
|
||||
|
||||
__asm mov w, esi
|
||||
|
||||
height = w->var_476 * 10;
|
||||
if (w->var_47A != -1) {
|
||||
w->var_47A = -1;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
top = height - window_ride_list_widgets[WIDX_LIST].bottom + window_ride_list_widgets[WIDX_LIST].top + 21;
|
||||
if (top < 0)
|
||||
top = 0;
|
||||
if (top < w->scrolls[0].v_top) {
|
||||
w->scrolls[0].v_top = top;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
__asm mov ecx, 0
|
||||
__asm mov edx, height
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3861
|
||||
*/
|
||||
static void window_ride_list_tooltip()
|
||||
{
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = STR_LIST;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3182
|
||||
*/
|
||||
static void window_ride_list_invalidate()
|
||||
{
|
||||
int i, x, y;
|
||||
|
@ -232,7 +357,7 @@ static void window_ride_list_invalidate()
|
|||
|
||||
__asm mov w, esi
|
||||
|
||||
window_ride_list_widgets[WIDX_CURRENT_INFORMATION_TYPE].image = STR_STATUS + window_ride_list_information_type;
|
||||
window_ride_list_widgets[WIDX_CURRENT_INFORMATION_TYPE].image = STR_STATUS + _window_ride_list_information_type;
|
||||
|
||||
// Set correct active tab
|
||||
for (i = 0; i < 3; i++)
|
||||
|
@ -254,6 +379,10 @@ static void window_ride_list_invalidate()
|
|||
w->widgets[WIDX_OPEN_CLOSE_ALL].left = w->width - 25;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3235
|
||||
*/
|
||||
static void window_ride_list_paint()
|
||||
{
|
||||
rct_window *w;
|
||||
|
@ -266,6 +395,121 @@ static void window_ride_list_paint()
|
|||
window_ride_list_draw_tab_images(dpi, w);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006AF561
|
||||
*/
|
||||
static void ride_get_status(int rideIndex, int *formatSecondary, int *argument)
|
||||
{
|
||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
edx = rideIndex;
|
||||
RCT2_CALLFUNC_X(0x006AF561, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
*formatSecondary = ebx & 0xFFFF;
|
||||
*argument = eax;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B3240
|
||||
*/
|
||||
static void window_ride_list_scrollpaint()
|
||||
{
|
||||
int i, y, format, formatSecondary, argument;
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
rct_ride *ride;
|
||||
|
||||
__asm mov w, esi
|
||||
__asm mov dpi, edi
|
||||
|
||||
gfx_fill_rect(dpi, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height, RCT2_GLOBAL(0x0141FC48 + (w->colours[1] * 8), uint8));
|
||||
|
||||
y = 0;
|
||||
for (i = 0; i < w->var_476; i++) {
|
||||
format = 1191;
|
||||
if (i == w->var_47A) {
|
||||
gfx_fill_rect(dpi, 0, y, 800, y + 9, 0x02000031);
|
||||
format = 1193;
|
||||
}
|
||||
formatSecondary = 0;
|
||||
|
||||
ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[w->var_076[i]];
|
||||
gfx_draw_string_left_clipped(dpi, format, &ride->var_04A, 0, 0, y - 1, 159);
|
||||
switch (_window_ride_list_information_type) {
|
||||
case INFORMATION_TYPE_STATUS:
|
||||
ride_get_status(i, &formatSecondary, &argument);
|
||||
RCT2_GLOBAL(0x013CE952 + 2, sint32) = argument;
|
||||
break;
|
||||
case INFORMATION_TYPE_POPULARITY:
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
break;
|
||||
case INFORMATION_TYPE_PROFIT:
|
||||
formatSecondary = 0;
|
||||
if (ride->profit != 0x80000000) {
|
||||
formatSecondary = STR_PROFIT_LABEL;
|
||||
RCT2_GLOBAL(0x013CE952 + 2, sint32) = ride->profit;
|
||||
}
|
||||
break;
|
||||
case INFORMATION_TYPE_QUEUE_LENGTH:
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ride_get_total_queue_length(ride);
|
||||
formatSecondary = STR_QUEUE_EMPTY;
|
||||
if (RCT2_GLOBAL(0x013CE952 + 2, uint16) == 1)
|
||||
formatSecondary = STR_QUEUE_ONE_PERSON;
|
||||
else if (RCT2_GLOBAL(0x013CE952 + 2, uint16) > 1)
|
||||
formatSecondary = STR_QUEUE_PEOPLE;
|
||||
break;
|
||||
case INFORMATION_TYPE_QUEUE_TIME:
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ride_get_max_queue_time(ride);
|
||||
formatSecondary = STR_QUEUE_TIME_LABEL;
|
||||
if (RCT2_GLOBAL(0x013CE952 + 2, uint16) > 1)
|
||||
formatSecondary = STR_QUEUE_TIME_PLURAL_LABEL;
|
||||
break;
|
||||
case INFORMATION_TYPE_RELIABILITY:
|
||||
// edx = RCT2_GLOBAL(0x009ACFA4 + (ride->var_001 * 4), uint32);
|
||||
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ride->var_196 >> 8;
|
||||
formatSecondary = STR_RELIABILITY_LABEL;
|
||||
break;
|
||||
case INFORMATION_TYPE_DOWN_TIME:
|
||||
// edx = RCT2_GLOBAL(0x009ACFA4 + (ride->var_001 * 4), uint32);
|
||||
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ride->var_199;
|
||||
formatSecondary = STR_DOWN_TIME_LABEL;
|
||||
break;
|
||||
case INFORMATION_TYPE_GUESTS_FAVOURITE:
|
||||
formatSecondary = 0;
|
||||
if (RCT2_ADDRESS(0x0097C3AF, uint8)[ride->type] == PAGE_RIDES) {
|
||||
RCT2_GLOBAL(0x013CE952 + 2, uint16) = ride->guests_favourite;
|
||||
formatSecondary = ride->guests_favourite == 1 ? STR_GUESTS_FAVOURITE_LABEL : STR_GUESTS_FAVOURITE_PLURAL_LABEL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Make test red and bold if broken down or crashed
|
||||
if (formatSecondary == STR_BROKEN_DOWN || formatSecondary == STR_CRASHED)
|
||||
format = 1192;
|
||||
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = formatSecondary;
|
||||
gfx_draw_string_left_clipped(dpi, format, 0x013CE952, 0, 160, y - 1, 157);
|
||||
y += 10;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B38EA
|
||||
*/
|
||||
static void window_ride_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w)
|
||||
{
|
||||
int sprite_idx;
|
||||
|
@ -287,4 +531,95 @@ static void window_ride_list_draw_tab_images(rct_drawpixelinfo *dpi, rct_window
|
|||
if (w->page == PAGE_KIOSKS_AND_FACILITIES)
|
||||
sprite_idx += (w->var_48E / 4) % 8;
|
||||
gfx_draw_sprite(dpi, sprite_idx, w->x + w->widgets[WIDX_TAB_3].left, w->y + w->widgets[WIDX_TAB_3].top);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006B39A8
|
||||
*/
|
||||
static void window_ride_list_refresh_list(rct_window *w)
|
||||
{
|
||||
int i, j, countA, countB;
|
||||
rct_ride *ride;
|
||||
|
||||
countA = countB = 0;
|
||||
for (i = 0; i < MAX_RIDES; i++) {
|
||||
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
continue;
|
||||
if (w->page != gRideClassifications[ride->type])
|
||||
continue;
|
||||
|
||||
countA++;
|
||||
if (ride->var_14D & 8) {
|
||||
ride->var_14D &= ~8;
|
||||
countB++;
|
||||
}
|
||||
}
|
||||
|
||||
if (countB != 0)
|
||||
window_invalidate(w);
|
||||
|
||||
if (countA == w->var_476)
|
||||
return;
|
||||
|
||||
w->var_476 = countA;
|
||||
j = 0;
|
||||
for (i = 0; i < MAX_RIDES; i++) {
|
||||
ride = &(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i]);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
continue;
|
||||
if (w->page != gRideClassifications[ride->type])
|
||||
continue;
|
||||
|
||||
w->var_076[j] = i;
|
||||
switch (w->var_490) {
|
||||
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
w->var_47A = -1;
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
static void window_ride_list_close_all(rct_window *w)
|
||||
{
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
|
||||
for (i = 0; i < MAX_RIDES; i++) {
|
||||
ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i];
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
continue;
|
||||
if (w->page != gRideClassifications[ride->type])
|
||||
continue;
|
||||
if (ride->status == RIDE_STATUS_CLOSED)
|
||||
continue;
|
||||
RCT2_GLOBAL(0x013CE952 + 6, uint16) = w->scrolls[0].v_top;
|
||||
RCT2_GLOBAL(0x013CE952 + 8, uint32) = w->scrolls[0].v_bottom;
|
||||
|
||||
RCT2_CALLPROC_X(0x006677F2, 0, 1, 0, i, 8, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void window_ride_list_open_all(rct_window *w)
|
||||
{
|
||||
int i;
|
||||
rct_ride *ride;
|
||||
|
||||
for (i = 0; i < MAX_RIDES; i++) {
|
||||
ride = &RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride)[i];
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
continue;
|
||||
if (w->page != gRideClassifications[ride->type])
|
||||
continue;
|
||||
if (ride->status == RIDE_STATUS_OPEN)
|
||||
continue;
|
||||
RCT2_GLOBAL(0x013CE952 + 6, uint16) = w->scrolls[0].v_top;
|
||||
RCT2_GLOBAL(0x013CE952 + 8, uint32) = w->scrolls[0].v_bottom;
|
||||
|
||||
RCT2_CALLPROC_X(0x006677F2, 0, 1, 0, (1 << 8) | i, 8, 0, 0);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue