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

remove rct2_endupdate

This commit is contained in:
IntelOrca
2016-01-09 00:25:09 +00:00
parent 20697ac2bc
commit 3073bc64fd
9 changed files with 32 additions and 134 deletions

View File

@@ -235,23 +235,21 @@ static void set_all_land_owned()
*
* rct2: 0x006758C0
*/
void editor_load_landscape(const char *path)
bool editor_load_landscape(const utf8 *path)
{
window_close_construction_windows();
char *extension = strrchr(path, '.');
if (extension != NULL) {
if (_stricmp(extension, ".sv4") == 0) {
editor_load_landscape_from_sv4(path);
return;
return editor_load_landscape_from_sv4(path);
} else if (_stricmp(extension, ".sc4") == 0) {
editor_load_landscape_from_sc4(path);
return;
return editor_load_landscape_from_sc4(path);
}
}
// Load SC6 / SV6
editor_read_s6(path);
return editor_read_s6(path);
}
/**

View File

@@ -41,7 +41,7 @@ void editor_load();
void editor_convert_save_to_scenario();
void trackdesigner_load();
void trackmanager_load();
void editor_load_landscape(const char *path);
bool editor_load_landscape(const utf8 *path);
void editor_open_windows_for_current_step();

View File

@@ -637,33 +637,6 @@ static int open_load_game_dialog()
static void load_landscape()
{
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE, NULL);
return;
if (open_landscape_file_dialog() == 0) {
gfx_invalidate_screen();
} else {
// Set default filename
char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
break;
if (*esi != 0)
continue;
strcpy(esi, ".SC6");
break;
}
safe_strncpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)0x0141EF68, MAX_PATH);
editor_load_landscape((char*)0x0141EF68);
if (1) {
gfx_invalidate_screen();
rct2_endupdate();
} else {
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, uint16) = 0;
rct2_endupdate();
}
}
}
/**
@@ -887,7 +860,7 @@ int game_load_network(SDL_RWops* rw)
*
* rct2: 0x00675E1B
*/
int game_load_save(const char *path)
bool game_load_save(const utf8 *path)
{
log_verbose("loading saved game, %s", path);
@@ -901,22 +874,24 @@ int game_load_save(const char *path)
log_error("unable to open %s", path);
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_FILE_CONTAINS_INVALID_DATA;
return 0;
return false;
}
if (!game_load_sv6(rw)) {
title_load();
rct2_endupdate();
SDL_RWclose(rw);
return 0;
}
bool result = game_load_sv6(rw);
SDL_RWclose(rw);
game_load_init();
if (network_get_mode() == NETWORK_MODE_SERVER) {
network_send_map();
if (result) {
game_load_init();
if (network_get_mode() == NETWORK_MODE_SERVER) {
network_send_map();
}
return true;
} else {
// If loading the SV6 failed, the current park state will be corrupted
// so just go back to the title screen.
title_load();
return false;
}
return 1;
}
void game_load_init()
@@ -976,41 +951,6 @@ void reset_all_sprite_quadrant_placements()
sprite_move(spr->unknown.x, spr->unknown.y, spr->unknown.z, spr);
}
/**
*
* rct2: 0x0066DBB7
*/
static void load_game()
{
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL);
return;
if (open_load_game_dialog() == 0) {
gfx_invalidate_screen();
} else {
// Set default filename
char *esi = (char*)0x0141EF67;
while (1) {
esi++;
if (*esi == '.')
break;
if (*esi != 0)
continue;
strcpy(esi, ".SV6");
break;
}
safe_strncpy((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, (char*)0x0141EF68, MAX_PATH);
if (game_load_save((char *)0x0141EF68)) {
gfx_invalidate_screen();
rct2_endupdate();
} else {
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_AGE, uint16) = 0;
rct2_endupdate();
}
}
}
/**
*
* rct2: 0x006750E9
@@ -1196,8 +1136,6 @@ void rct2_exit_reason(rct_string_id title, rct_string_id body){
*/
void rct2_exit()
{
//audio_close();
//Post quit message does not work in 0x6e3879 as its windows only.
openrct2_finish();
}
@@ -1210,10 +1148,11 @@ void game_load_or_quit_no_save_prompt()
if (RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) < 1) {
game_do_command(0, 1, 0, 1, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
tool_cancel();
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2)
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) {
load_landscape();
else
load_game();
} else {
window_loadsave_open(LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME, NULL);
}
} else if (RCT2_GLOBAL(RCT2_ADDRESS_SAVE_PROMPT_MODE, uint16) == 1) {
game_do_command(0, 1, 0, 1, GAME_COMMAND_LOAD_OR_QUIT, 0, 0);
tool_cancel();
@@ -1222,7 +1161,6 @@ void game_load_or_quit_no_save_prompt()
}
gGameSpeed = 1;
title_load();
rct2_endupdate();
} else {
rct2_exit();
}

View File

@@ -134,7 +134,7 @@ void game_reduce_game_speed();
void game_load_or_quit_no_save_prompt();
int game_load_sv6(SDL_RWops* rw);
int game_load_network(SDL_RWops* rw);
int game_load_save(const char *path);
bool game_load_save(const utf8 *path);
void game_load_init();
void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
void pause_toggle();

View File

@@ -832,7 +832,8 @@ void format_string_to_upper(utf8 *dest, rct_string_id format, void *args)
* error (eax)
* format (bx)
*/
void error_string_quit(int error, rct_string_id format){
void error_string_quit(int error, rct_string_id format)
{
RCT2_GLOBAL(0x14241A0, uint32) = error;
RCT2_GLOBAL(0x9E2DA0, uint32) = 1;
@@ -845,7 +846,6 @@ void error_string_quit(int error, rct_string_id format){
}
RCT2_GLOBAL(0x9E2D9C, uint32) = 1;
rct2_exit();
rct2_endupdate();
}
void generate_string_file()

View File

@@ -339,7 +339,7 @@ static void platform_resize(int width, int height)
gfx_invalidate_screen();
// Check if the window has been resized in windowed mode and update the config file accordingly
// This is called in rct2_update_2 and is only called after resizing a window has finished
// This is called in rct2_update and is only called after resizing a window has finished
const int nonWindowFlags =
SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP;
if (!(flags & nonWindowFlags)) {

View File

@@ -20,7 +20,6 @@
#pragma warning(disable : 4996) // GetVersionExA deprecated
#include <setjmp.h>
#include <time.h>
#include "addresses.h"
#include "audio/audio.h"
@@ -65,9 +64,6 @@ int rct2_init_directories();
int rct2_startup_checks();
static void rct2_draw_fps();
static void rct2_update_2();
static jmp_buf _end_update_jump;
void rct2_quit()
{
@@ -219,27 +215,6 @@ int rct2_startup_checks()
return 1;
}
void rct2_update()
{
// Set 0x009DE564 to the value of esp
// RCT2 sets the stack pointer to the value of this address when ending the current game tick from anywhere
#ifdef _MSC_VER
__asm {
mov eax, 009DE564h
mov [eax], esp
}
#else
__asm__ ( "\
\n\
movl $0x009DE564, %%eax \n\
movl %%esp, (%%eax) \n\
" : : : "eax" );
#endif
if (!setjmp(_end_update_jump))
rct2_update_2();
}
void rct2_draw()
{
redraw_rain();
@@ -426,7 +401,7 @@ int check_files_integrity()
return 1;
}
void rct2_update_2()
void rct2_update()
{
int tick, tick2;
@@ -459,11 +434,6 @@ void rct2_update_2()
console_update();
}
void rct2_endupdate()
{
longjmp(_end_update_jump, 0);
}
/**
*
* rct2: 0x00674E6C

View File

@@ -295,7 +295,6 @@ extern uint32 gCurrentDrawCount;
int rct2_init();
void rct2_update();
void rct2_draw();
void rct2_endupdate();
void substitute_path(char *dest, const char *path, const char *filename);
int check_mutex();
int check_file_paths();

View File

@@ -704,8 +704,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
window_close(w);
}
window_loadsave_invoke_callback(MODAL_RESULT_OK);
}
else if (game_load_save(path)) {
} else if (game_load_save(path)) {
if (_loadsaveType & LOADSAVETYPE_NETWORK) {
network_begin_server(gConfigNetwork.default_port);
}
@@ -716,9 +715,7 @@ static void window_loadsave_select(rct_window *w, const char *path)
window_close(w);
gfx_invalidate_screen();
window_loadsave_invoke_callback(MODAL_RESULT_OK);
rct2_endupdate();
}
else {
} else {
// 1050, not the best message...
window_error_open(STR_LOAD_GAME, 1050);
window_loadsave_invoke_callback(MODAL_RESULT_FAIL);
@@ -730,7 +727,6 @@ static void window_loadsave_select(rct_window *w, const char *path)
int success = scenario_save(rw, gConfigGeneral.save_plugin_data ? 1 : 0);
SDL_RWclose(rw);
if (success) {
safe_strncpy(gScenarioSavePath, path, MAX_PATH);
gFirstTimeSave = 0;
@@ -749,13 +745,10 @@ static void window_loadsave_select(rct_window *w, const char *path)
}
break;
case (LOADSAVETYPE_LOAD | LOADSAVETYPE_LANDSCAPE) :
editor_load_landscape(path);
if (1) {
if (editor_load_landscape(path)) {
gfx_invalidate_screen();
window_loadsave_invoke_callback(MODAL_RESULT_OK);
rct2_endupdate();
}
else {
} else {
// 1050, not the best message...
window_error_open(STR_LOAD_LANDSCAPE, 1050);
window_loadsave_invoke_callback(MODAL_RESULT_FAIL);