diff --git a/game/gamesave.c b/game/gamesave.c index ab69277..2a62923 100644 --- a/game/gamesave.c +++ b/game/gamesave.c @@ -1848,18 +1848,24 @@ void do_autosave() { DEFAULT_GAME_NAME(""); char prefix[50]; snprintf(prefix,50,"sav.%08lx.",current_campaign); - TSAVEGAME_CB_STATE st; - st.files = create_list(32); - st.prefix = prefix; - st.prefix_len = strlen(prefix); - st.count = 0; - st.skip_autosave = 0; - list_files(gpathtable[SR_SAVES], file_type_just_name|file_type_need_timestamp|file_type_normal, get_all_savegames_callback, &st); - for (size_t i = 0; i < st.count; ++i) { - const char *n = st.files[i]; - if (strstr(n, AUTOSAVE_SUFFIX)) { - remove(build_pathname(2, gpathtable[SR_SAVES],n)); - } + char isdead = 0; + for (int i = 0; i < POCET_POSTAV; ++i) { + isdead = isdead || (postavy[i].used && postavy[i].lives == 0 && postavy[i].inmaphash == current_map_hash); + } + if (!isdead) { + TSAVEGAME_CB_STATE st; + st.files = create_list(32); + st.prefix = prefix; + st.prefix_len = strlen(prefix); + st.count = 0; + st.skip_autosave = 0; + list_files(gpathtable[SR_SAVES], file_type_just_name|file_type_need_timestamp|file_type_normal, get_all_savegames_callback, &st); + for (size_t i = 0; i < st.count; ++i) { + const char *n = st.files[i]; + if (strstr(n, AUTOSAVE_SUFFIX)) { + remove(build_pathname(2, gpathtable[SR_SAVES],n)); + } + } } save_game(get_save_game_slot_id(), game_name,1); } @@ -1906,7 +1912,8 @@ static void save_as_dialog(int pos) { todel = local_strdup(todel); } unwire_proc(); - if (ask_save_dialog(game_name, sizeof(game_name))) { + char r = ask_save_dialog(game_name, sizeof(game_name), todel != NULL); + if (r==1) { prev_game_time_save = cur_time; save_game(get_save_game_slot_id(), game_name,0); if (todel) { @@ -1914,6 +1921,8 @@ static void save_as_dialog(int pos) { } wire_proc(); return; + } else if (r == 2 && todel) { + remove(todel); } wire_save_load(1); } diff --git a/game/globals.h b/game/globals.h index 313e377..2f60ef4 100644 --- a/game/globals.h +++ b/game/globals.h @@ -1413,7 +1413,7 @@ void load_map_description(TMPFILE_RD *f); void free_map_description(); void wire_save_load(char save); void do_save_dialog(); -char ask_save_dialog(char *name_buffer, size_t name_size); +char ask_save_dialog(char *name_buffer, size_t name_size, char allow_remove); void do_autosave(); #define autosave() if (autosave_enabled) do_autosave(); extern char autosave_enabled; diff --git a/game/interfac.c b/game/interfac.c index d8559e0..6d6cfaa 100644 --- a/game/interfac.c +++ b/game/interfac.c @@ -1602,7 +1602,7 @@ THAGGLERESULT smlouvat_dlg(int cena,int puvod,int pocet,int posledni, int money, return res; } -char ask_save_dialog(char *name_buffer, size_t name_size) { +char ask_save_dialog(char *name_buffer, size_t name_size, char allow_remove) { const char *str_label = texty[98]; // if (str_label == 0) str_label ="Ulo\x91it hru jako"; @@ -1613,11 +1613,14 @@ char ask_save_dialog(char *name_buffer, size_t name_size) { define(10,10,30,270,13,0,input_line,name_size-1);property(def_border(5,BAR_COLOR),NULL,NULL,0);set_default(name_buffer); define(20,20,20,60,20,2,button,texty[239]);property(def_border(5,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(terminate_gui); define(30,90,20,60,20,2,button,texty[80]);property(def_border(5,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(terminate_gui); + if (allow_remove) { + define(40,10,20,70,20,3,button,texty[172]);property(def_border(5,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(terminate_gui); + } redraw_window(); goto_control(10); escape(); get_value(0,10,name_buffer); - char ret = o_aktual->id==30; + char ret = o_aktual->id==40?2:o_aktual->id==30?1:0; close_current(); return ret; diff --git a/game/skeldal.c b/game/skeldal.c index 7bda15b..fd7d495 100644 --- a/game/skeldal.c +++ b/game/skeldal.c @@ -711,7 +711,7 @@ void done_skeldal(void) close_manager(); close_story_file(); - purge_temps(1); + temp_storage_clear(); stop_mixing(); // deinstall_mouse_handler(); if (texty != NULL) { @@ -805,7 +805,7 @@ void cti_texty(void) //patch stringtable if (!texty[98]) str_replace(&texty,98,"Ulo\x91it hru jako"); if (!texty[99]) str_replace(&texty,99,"CRT Filter (>720p)"); - str_replace(&texty,0,"Byl detekov\xA0n ovlada\x87\nPro aktivaci ovlada\x87""e stiskn\x88te kt\x82rekoliv tla\x87\xA1tko na ovlada\x87i"); + str_replace(&texty,0,"Byl nalezen p\xA9ipojen\x98 ovlada\x87\nPro aktivaci ovlada\x87""e stiskn\x88te kt\x82rekoliv tla\x87\xA1tko na ovlada\x87i"); lang_patch_stringtable(&texty, "ui.csv", ""); } @@ -945,14 +945,13 @@ void show_joystick_info(void) { curcolor = 0; - bar32(0,0,639,479); - set_font(H_FBOLD, NOSHADOW(RGB888(255,255,255))); + set_font(H_FBOLD, RGB888(255,255,255)); const char *prompt = texty[0]; char *buff = (char *)alloca(strlen(prompt)+10); int xs = 0; int ys = 0; zalamovani(prompt,buff,560, &xs, &ys); - int y = 320; + int y = 100; while (*buff) { set_aligned_position(320,y,1,1,buff); outtext(buff); @@ -972,6 +971,18 @@ void show_joystick_info(void) { } +void show_loading_picture(char *filename) + { + const void *p; + int32_t s; + + p=afile(filename,SR_BGRAFIKA,&s); + put_picture(0,0,p); + showview(0,0,0,0); + ablock_free(p); + } + + void init_skeldal(const INI_CONFIG *cfg) { @@ -995,6 +1006,7 @@ void init_skeldal(const INI_CONFIG *cfg) atexit(done_skeldal); init_DDL_manager(); + show_loading_picture("LOADING.HI"); if (lang_get_folder()) { texty_knihy = build_pathname(2, lang_get_folder(), "book.txt"); @@ -1742,6 +1754,7 @@ int skeldal_entry_point(const SKELDAL_CONFIG *start_cfg) closemode(); + ini_close(cfg); return 0; diff --git a/platform/sdl/input.cpp b/platform/sdl/input.cpp index b4dd55e..6f019b4 100644 --- a/platform/sdl/input.cpp +++ b/platform/sdl/input.cpp @@ -55,18 +55,18 @@ void init_joystick(const INI_CONFIG_SECTION *section) { cfg.buttons[10] = SDLContext::JoystickButton::mod_key; cfg.buttons_mod[10] = SDLContext::JoystickButton::mod_key; cfg.buttons[11] = SDLContext::JoystickButton::map; - cfg.buttons_mod[11] = SDLContext::JoystickButton::F6; cfg.buttons[12] = SDLContext::JoystickButton::merge; cfg.buttons[14] = SDLContext::JoystickButton::left; cfg.buttons[13] = SDLContext::JoystickButton::right; cfg.buttons[9] = SDLContext::JoystickButton::backspace; cfg.buttons_mod[5] = SDLContext::JoystickButton::escape; cfg.buttons_mod[9] = SDLContext::JoystickButton::F4; - cfg.buttons_mod[12] = SDLContext::JoystickButton::F7; - cfg.buttons_mod[0] = SDLContext::JoystickButton::F8; + cfg.buttons_mod[14] = SDLContext::JoystickButton::F6; + cfg.buttons_mod[2] = SDLContext::JoystickButton::F7; + cfg.buttons_mod[3] = SDLContext::JoystickButton::F8; cfg.buttons_mod[1] = SDLContext::JoystickButton::F9; - cfg.buttons_mod[2] = SDLContext::JoystickButton::F10; - cfg.buttons_mod[3] = SDLContext::JoystickButton::F11; + cfg.buttons_mod[0] = SDLContext::JoystickButton::F10; + cfg.buttons_mod[11] = SDLContext::JoystickButton::F11; cfg.buttons_mod[14] = SDLContext::JoystickButton::F12; cfg.buttons_mod[13] = SDLContext::JoystickButton::backspace; cfg.enabled = true;