mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 13:33:02 +01:00
add new load / save window, closes #580
This commit is contained in:
@@ -70,10 +70,10 @@ void screenshot_check()
|
||||
|
||||
static int screenshot_get_next_path(char *path, int format)
|
||||
{
|
||||
char *screenshotPath = platform_get_orct2_homesubfolder("screenshot");
|
||||
if (!platform_ensure_directory_exists(screenshotPath)) {
|
||||
free(screenshotPath);
|
||||
char screenshotPath[MAX_PATH];
|
||||
|
||||
platform_get_user_directory(screenshotPath, "screenshot");
|
||||
if (!platform_ensure_directory_exists(screenshotPath)) {
|
||||
fprintf(stderr, "Unable to save screenshots in OpenRCT2 screenshot directory.\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -83,14 +83,14 @@ static int screenshot_get_next_path(char *path, int format)
|
||||
RCT2_GLOBAL(0x013CE952, uint16) = i;
|
||||
|
||||
// Glue together path and filename
|
||||
sprintf(path, "%s%cSCR%d%s", screenshotPath, platform_get_path_separator(), i, _screenshot_format_extension[format]);
|
||||
sprintf(path, "%sSCR%d%s", screenshotPath, i, _screenshot_format_extension[format]);
|
||||
|
||||
if (!platform_file_exists(path)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
free(screenshotPath);
|
||||
fprintf(stderr, "You have too many saved screenshots.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -457,6 +457,15 @@ rct_window *window_create_auto_pos(int width, int height, uint32 *event_handlers
|
||||
return (rct_window*)esi;
|
||||
}
|
||||
|
||||
rct_window *window_create_centred(int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
x = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width) / 2;
|
||||
y = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height) / 2;
|
||||
return window_create(x, y, width, height, event_handlers, cls, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the specified window.
|
||||
* rct2: 0x006ECD4C
|
||||
@@ -479,6 +488,8 @@ void window_close(rct_window* window)
|
||||
RCT2_CALLPROC_X(window->event_handlers[WE_CLOSE], 0, 0, 0, 0, (int)window, 0, 0);
|
||||
|
||||
window = window_find_by_number(cls, number);
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
||||
// Remove viewport
|
||||
if (window->viewport != NULL) {
|
||||
|
||||
@@ -398,7 +398,9 @@ enum {
|
||||
WC_RESEARCH = 111,
|
||||
WC_VIEWPORT = 112,
|
||||
WC_TEXTINPUT = 113,
|
||||
WC_MAPGEN = 114
|
||||
WC_MAPGEN = 114,
|
||||
WC_LOADSAVE = 115,
|
||||
WC_LOADSAVE_OVERWRITE_PROMPT = 116
|
||||
} WINDOW_CLASS;
|
||||
|
||||
enum PROMPT_MODE {
|
||||
@@ -416,6 +418,15 @@ typedef enum {
|
||||
BTM_TB_DIRTY_FLAG_PARK_RATING = (1 << 4)
|
||||
} BTM_TOOLBAR_DIRTY_FLAGS;
|
||||
|
||||
enum {
|
||||
LOADSAVETYPE_LOAD = 0 << 0,
|
||||
LOADSAVETYPE_SAVE = 1 << 0,
|
||||
|
||||
LOADSAVETYPE_GAME = 0 << 1,
|
||||
LOADSAVETYPE_LANDSCAPE = 1 << 1,
|
||||
LOADSAVETYPE_SCENARIO = 2 << 1
|
||||
};
|
||||
|
||||
|
||||
// rct2: 0x01420078
|
||||
extern rct_window* g_window_list;
|
||||
@@ -427,6 +438,7 @@ void window_dispatch_update_all();
|
||||
void window_update_all();
|
||||
rct_window *window_create(int x, int y, int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
rct_window *window_create_auto_pos(int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
rct_window *window_create_centred(int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
void window_close(rct_window *window);
|
||||
void window_close_by_class(rct_windowclass cls);
|
||||
void window_close_by_number(rct_windowclass cls, rct_windownumber number);
|
||||
@@ -538,6 +550,7 @@ void window_track_manage_open();
|
||||
void window_viewport_open();
|
||||
void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uint32 existing_args, int maxLength);
|
||||
rct_window *window_mapgen_open();
|
||||
rct_window *window_loadsave_open(int type);
|
||||
|
||||
void window_editor_main_open();
|
||||
void window_editor_bottom_toolbar_open();
|
||||
|
||||
Reference in New Issue
Block a user