1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 11:03:00 +01:00

rudimentary save prompt

This commit is contained in:
anyc
2014-05-23 11:30:19 +02:00
parent b3c852a074
commit 7811497e8c
4 changed files with 42 additions and 13 deletions

View File

@@ -42,6 +42,7 @@
#define RCT2_ADDRESS_RIDE_PROPERTIES 0x00997C9D
#define RCT2_ADDRESS_LAND_TOOL_SIZE 0x009A9800
#define RCT2_ADDRESS_SAVE_PROMPT_MODE 0x009A9802
#define RCT2_ADDRESS_SCENARIO_LIST 0x009A9FF4
#define RCT2_ADDRESS_NUM_SCENARIOS 0x009AA008

View File

@@ -1361,13 +1361,12 @@ static void game_load_or_quit()
__asm__ ( "mov %[input_di], di " : [input_di] "+m" (input_di) );
#endif
if (!(input_bl & 1))
return; // 0;
switch (input_dl) {
case 0:
RCT2_GLOBAL(0x009A9802, uint16) = input_di;
RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) = input_di;
window_save_prompt_open();
break;
case 1:
@@ -1603,14 +1602,14 @@ static void rct2_exit()
*/
void game_load_or_quit_no_save_prompt()
{
if (RCT2_GLOBAL(0x009A9802, uint16) < 1) {
if (RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) < 1) {
game_do_command(0, 1, 0, 1, 5, 0, 0);
tool_cancel();
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
load_landscape();
else
load_game();
} else if (RCT2_GLOBAL(0x009A9802, uint16) == 1) {
} else if (RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) == 1) {
game_do_command(0, 1, 0, 1, 5, 0, 0);
if (RCT2_GLOBAL(0x009DE518, uint32) & (1 << 5)) {
RCT2_CALLPROC_EBPSAFE(0x0040705E);

View File

@@ -36,7 +36,7 @@ typedef enum {
WWT_FLATBTN = 9,
WWT_DROPDOWN_BUTTON = 10,
WWT_11,
WWT_12,
WWT_12, // looks like a normal label to me
WWT_13,
WWT_14,
WWT_SPINNER = 15,

View File

@@ -32,7 +32,7 @@ enum WINDOW_SAVE_PROMPT_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_3,
WIDX_LABEL,
WIDX_SAVE,
WIDX_DONT_SAVE,
WIDX_CANCEL
@@ -42,10 +42,10 @@ static rct_widget window_save_prompt_widgets[] = {
{ WWT_FRAME, 0, 0, 259, 0, 49, -1, STR_NONE }, // panel / background
{ WWT_CAPTION, 0, 1, 258, 1, 14, 0, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, 247, 257, 2, 13, 824, STR_CLOSE_WINDOW_TIP }, // close x button
{ WWT_12, 0, 2, 257, 19, 30, 0, STR_NONE }, //
{ WWT_DROPDOWN_BUTTON, 0, 8, 85, 35, 46, STR_SAVE_PROMPT_SAVE, STR_NONE }, // save
{ WWT_DROPDOWN_BUTTON, 0, 91, 168, 35, 46, STR_SAVE_PROMPT_DONT_SAVE, STR_NONE }, // don't save
{ WWT_DROPDOWN_BUTTON, 0, 174, 251, 35, 46, STR_SAVE_PROMPT_CANCEL, STR_NONE }, // cancel
{ WWT_12, 0, 2, 257, 19, 30, 0, STR_NONE }, // question/label
{ WWT_DROPDOWN_BUTTON, 0, 8, 85, 35, 46, 0, STR_SAVE_PROMPT_SAVE }, // save
{ WWT_DROPDOWN_BUTTON, 0, 91, 168, 35, 46, 0, STR_SAVE_PROMPT_DONT_SAVE },// don't save
{ WWT_DROPDOWN_BUTTON, 0, 174, 251, 35, 46, 0, STR_SAVE_PROMPT_CANCEL }, // cancel
{ WIDGETS_END },
};
@@ -123,13 +123,14 @@ void window_save_prompt_open()
window_invalidate_by_id(0x80 | WC_TOP_TOOLBAR, 0);
}
stringId = RCT2_GLOBAL(0x009A9802, uint16) + STR_LOAD_GAME;
stringId = RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) + STR_LOAD_GAME;
if (stringId == STR_LOAD_GAME && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
stringId = STR_LOAD_LANDSCAPE;
if (stringId == STR_QUIT_GAME && RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
stringId = STR_QUIT_SCENARIO_EDITOR;
window_save_prompt_widgets[WIDX_TITLE].image = stringId;
window_save_prompt_widgets[WIDX_3].image = RCT2_GLOBAL(0x009A9802, uint16) + STR_SAVE_BEFORE_LOADING;
window_save_prompt_widgets[WIDX_LABEL].image =
RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) + STR_SAVE_BEFORE_LOADING;
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0D) {
game_load_or_quit_no_save_prompt();
@@ -189,6 +190,20 @@ static void window_save_prompt_mouseup()
// TODO
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
window_save_prompt_close();
break;
case WIDX_SAVE:
break;
case WIDX_DONT_SAVE:
break;
case WIDX_CANCEL:
window_close(w);
window_save_prompt_close();
break;
}
}
static void window_save_prompt_paint()
@@ -210,4 +225,18 @@ static void window_save_prompt_paint()
window_draw_widgets(w, dpi);
gfx_draw_string_centred(dpi, window_save_prompt_widgets[WIDX_LABEL].image,
w->x + window_save_prompt_widgets[WIDX_LABEL].left + 125,
w->y + window_save_prompt_widgets[WIDX_LABEL].top + 1, 2, w);
gfx_draw_string_centred(dpi, STR_SAVE_PROMPT_SAVE,
w->x + window_save_prompt_widgets[WIDX_SAVE].left + 38,
w->y + window_save_prompt_widgets[WIDX_SAVE].top + 1, 2, w);
gfx_draw_string_centred(dpi, STR_SAVE_PROMPT_DONT_SAVE,
w->x + window_save_prompt_widgets[WIDX_DONT_SAVE].left + 38,
w->y + window_save_prompt_widgets[WIDX_DONT_SAVE].top + 1, 2, w);
gfx_draw_string_centred(dpi, STR_SAVE_PROMPT_CANCEL,
w->x + window_save_prompt_widgets[WIDX_CANCEL].left + 38,
w->y + window_save_prompt_widgets[WIDX_CANCEL].top + 1, 2, w);
}