mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Merge branch 'anyc-testing'
This commit is contained in:
@@ -17,9 +17,9 @@ else()
|
||||
endif (APPLE)
|
||||
|
||||
# potential flags to make code more similar to MSVC:
|
||||
# -fshort-wchar -fshort-enums -mms-bitfields -fpack-struct=1
|
||||
# -fshort-wchar -fshort-enums -mms-bitfields
|
||||
#
|
||||
set(CMAKE_C_FLAGS "-masm=intel -std=gnu99" CACHE STRING "" FORCE)
|
||||
set(CMAKE_C_FLAGS "-masm=intel -std=gnu99 -fpack-struct=2" CACHE STRING "" FORCE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-static-libgcc" CACHE STRING "" FORCE)
|
||||
|
||||
include_directories("/usr/include/wine/windows/")
|
||||
|
||||
29
src/game.c
29
src/game.c
@@ -1597,6 +1597,35 @@ static void load_game()
|
||||
}
|
||||
}
|
||||
|
||||
char save_game()
|
||||
{
|
||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
RCT2_CALLFUNC_X(0x006750E9, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
if (eax == 0) {
|
||||
// user pressed "cancel"
|
||||
gfx_invalidate_screen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *src = (char*)0x0141EF67;
|
||||
do {
|
||||
src++;
|
||||
} while (*src != '.' && *src != '\0');
|
||||
strcpy(src, ".SV6");
|
||||
strcpy((char*) RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*) 0x0141EF68);
|
||||
|
||||
eax = 0;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 8)
|
||||
eax |= 1;
|
||||
RCT2_CALLPROC_X(0x006754F5, eax, 0, 0, 0, 0, 0, 0);
|
||||
// check success?
|
||||
|
||||
game_do_command(0, 1047, 0, -1, 0, 0, 0);
|
||||
gfx_invalidate_screen();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006E3879
|
||||
|
||||
@@ -29,5 +29,6 @@ int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int eb
|
||||
|
||||
void game_load_or_quit_no_save_prompt();
|
||||
int game_load_save();
|
||||
char save_game();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -384,30 +384,7 @@ static void window_game_top_toolbar_dropdown()
|
||||
break;
|
||||
case 1: // save game
|
||||
tool_cancel();
|
||||
{
|
||||
int eax, ebx, ecx, edx, esi, edi, ebp;
|
||||
RCT2_CALLFUNC_X(0x006750E9, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
if (eax == 0) {
|
||||
gfx_invalidate_screen();
|
||||
break;
|
||||
}
|
||||
|
||||
char *src = (char*)0x0141EF67;
|
||||
do {
|
||||
src++;
|
||||
} while (*src != '.' && *src != '\0');
|
||||
strcpy(src, ".SV6");
|
||||
strcpy((char*) RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*) 0x0141EF68);
|
||||
|
||||
eax = 0;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & 8)
|
||||
eax |= 1;
|
||||
RCT2_CALLPROC_X(0x006754F5, eax, 0, 0, 0, 0, 0, 0);
|
||||
// check success?
|
||||
|
||||
game_do_command(0, 1047, 0, -1, 0, 0, 0);
|
||||
gfx_invalidate_screen();
|
||||
}
|
||||
save_game();
|
||||
break;
|
||||
case 3: // about
|
||||
window_about_open();
|
||||
|
||||
@@ -257,11 +257,12 @@ static void window_save_prompt_mouseup()
|
||||
} else {
|
||||
switch (widgetIndex) {
|
||||
case WIDX_SAVE:
|
||||
// TODO to avoid data loss, treat SAVE as CANCEL
|
||||
RCT2_ERROR("TODO");
|
||||
window_close(w);
|
||||
window_save_prompt_close();
|
||||
return;
|
||||
if (!save_game()) {
|
||||
// user pressed cancel
|
||||
window_close(w);
|
||||
window_save_prompt_close();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case WIDX_DONT_SAVE:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user