diff --git a/game/dialogy.c b/game/dialogy.c index 20d3b07..0472dd8 100644 --- a/game/dialogy.c +++ b/game/dialogy.c @@ -758,7 +758,7 @@ static void key_check(EVENT_MSG *msg,void **unused) } void wire_dialog(); -void wire_dialog_drw() +void wire_dialog_drw(void) { schovej_mysku(); wire_dialog(); diff --git a/game/gamesave.c b/game/gamesave.c index bfd1b3d..f2071e4 100644 --- a/game/gamesave.c +++ b/game/gamesave.c @@ -1711,7 +1711,7 @@ void wire_save_load(char save) { schovej_mysku(); mute_all_tracks(0); force_save=save & 1; - current_game_slot_list = get_all_savegames(current_campaign, save); + current_game_slot_list = get_all_savegames(current_campaign, save & (1+4)); curcolor = RGB555(0,0,0); bar32(0, 17, 639, 17 + 360); if (save == 1) { diff --git a/game/interfac.c b/game/interfac.c index 6b45e28..5b4461d 100644 --- a/game/interfac.c +++ b/game/interfac.c @@ -1514,7 +1514,7 @@ static int add_number_cb(EVENT_MSG *msg, void *x) { return 0; } -static void add_number() { +static void add_number(void) { if (o_aktual) { int n = o_aktual->id - 40; goto_control(10); @@ -1523,7 +1523,7 @@ static void add_number() { } } -static void remove_number() { +static void remove_number(void) { if (o_aktual) { goto_control(10); send_message_to(add_number_cb,NULL, E_KEYBOARD, 'O'<<8); @@ -1540,7 +1540,7 @@ THAGGLERESULT smlouvat_dlg(int cena,int puvod,int pocet,int posledni, int money, char j = is_joystick_used(); set_font(H_FBOLD,RGB555(31,31,31)); - add_window(170,130,300,100+j*20,H_WINTXTR,3,20,20); + add_window(170,130,300,100+j*135,H_WINTXTR,3,20,20); define(-1,10,15,1,1,0,label,texty[241]); define(-1,150,15,100,13,0,label,int2ascii(cena,buffer,10)); set_font(H_FBOLD,MSG_COLOR1); @@ -1551,11 +1551,14 @@ THAGGLERESULT smlouvat_dlg(int cena,int puvod,int pocet,int posledni, int money, define(30,110,20,80,20,2,button,texty[230]);property(def_border(5,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(terminate_gui); if (j) { char nstr[2] = "0"; - for (int i = 0; i < 10; ++i) { - nstr[0] = i+48; - define(40+i, 10+i*24,50,22,20,0,button,nstr);property(def_border(0,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(add_number); + for (int i = 0; i < 9; ++i) { + int gx = (2-(i % 3))*35; + int gy = (i/3)*35; + nstr[0] = i+49; + define(41+i, 50+gx,85+gy,30,30,2,button,nstr);property(def_border(0,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(add_number); } - define(50, 20,50,20,20,1,button,"<-");property(def_border(0,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(remove_number); + define(40, 85,50,30,30,2,button,"0");property(def_border(0,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(add_number); + define(50, 50,50,30,30,2,button,"<-");property(def_border(0,BAR_COLOR),NULL,NULL,BAR_COLOR);on_control_change(remove_number); } { redraw_window(); diff --git a/game/inv.c b/game/inv.c index f32397f..67094d4 100644 --- a/game/inv.c +++ b/game/inv.c @@ -2249,7 +2249,7 @@ static void fast_inv_action(void) { int x = ms_last_event.x; int y = ms_last_event.y; const T_CLK_MAP *item = find_in_click_map_entry(x, y, clk_inv_view, CLK_INV_VIEW, MS_EVENT_MOUSE_LPRESS); - if (item->proc == &uloz_sip) { + if (item && item->proc == &uloz_sip) { uloz_sip_action(1); } } diff --git a/game/setup.c b/game/setup.c index 8635365..3105a08 100644 --- a/game/setup.c +++ b/game/setup.c @@ -139,6 +139,10 @@ void skeldal_checkbox(OBJREC *); void setup_ok_button(OBJREC *); void skeldal_soupak(OBJREC *); +static void exit_setup_action(void) { + unwire_setup(); + wire_proc(); +} @@ -198,7 +202,7 @@ void new_setup() define(200+i*10,50+i*60,30,30,200,0,skeldal_soupak,effects[i]==SND_MUSIC?127:255);c_default(get_snd_effect(effects[i])); on_control_change(do_setup_change); } - define(300,559,336,81,21,0,setup_ok_button,texty[174]);on_control_change(unwire_setup); + define(300,559,336,81,21,0,setup_ok_button,texty[174]);on_control_change(exit_setup_action); property(NULL,ablock(H_FTINY),&color_topbar,0); redraw_window(); add_to_timer(TM_CHECKBOX,4,-1,checkbox_animator); @@ -210,6 +214,7 @@ void game_setup_(void) new_setup(); } + char game_setup(int id,int xa,int ya,int xr,int yr) { id;xa;ya;xr;yr; diff --git a/game/souboje.c b/game/souboje.c index aec3405..fffbf33 100644 --- a/game/souboje.c +++ b/game/souboje.c @@ -208,10 +208,10 @@ T_CLK_MAP clk_runes[]= #define CLK_POWER_WHO 7 T_CLK_MAP clk_power[]= { - {-1,500,376,637,480,power_info,1,H_MS_DEFAULT}, - {0,535,391,637,411,power,2,H_MS_DEFAULT}, - {1,535,421,637,441,power,2,H_MS_DEFAULT}, - {2,535,451,637,471,power,2,H_MS_DEFAULT}, + {-1,500,376,637,480,power_info,1,-1}, + {0,535,391,637,411,power,2,-1}, + {1,535,421,637,441,power,2,-1}, + {2,535,451,637,471,power,2,-1}, {-1,0,0,639,377,cancel_power,2+8,-1}, {-1,0,378,639,479,cancel_power,8,-1}, {-1,54,378,497,479,ask_who_proc,2,-1}, @@ -1723,6 +1723,23 @@ char cancel_runes(int id,int xa,int ya,int xr,int yr) return 1; } + + static void select_rune_kbd(EVENT_MSG *ev, void **user_ptr) { + if (ev->msg == E_KEYBOARD) { + int v = quit_request_as_escape(va_arg(ev->data, int)); + switch (v>>8) { + default: return; + case 1: cancel_runes(0,0,0,0,0);return; + case 32: + case 'M':sel_zivel = (sel_zivel +1) % 5;break; + case 30: + case 'K':sel_zivel = (sel_zivel +4) % 5;break; + } + free(runebar);runebar=NULL; + display_rune_bar(NULL); + } + } + void unwire_select_rune(void) { wire_proc=wire_select_rune; @@ -1730,6 +1747,7 @@ void unwire_select_rune(void) delete_from_timer(TM_SCENE); cancel_render=1; free(runebar);runebar=NULL; + send_message(E_DONE,E_KEYBOARD, select_rune_kbd); } void wire_select_rune(void) @@ -1747,6 +1765,7 @@ void wire_select_rune(void) change_click_map(clk_runes,CLK_RUNES); add_to_timer(TM_DELAIER,12,1,display_rune_bar); add_to_timer(TM_SCENE,gamespeed,-1,rune_bar_redrawing); + send_message(E_ADD,E_KEYBOARD, select_rune_kbd); unwire_proc=unwire_select_rune; cancel_render=1; } @@ -1758,6 +1777,7 @@ void wire_select_rune_fly() change_click_map(clk_runes,CLK_RUNES); add_to_timer(TM_DELAIER,12,1,display_rune_bar); add_to_timer(TM_SCENE,gamespeed,-1,rune_bar_redrawing); + send_message(E_ADD,E_KEYBOARD, select_rune_kbd); unwire_proc=unwire_select_rune; cancel_render=1; } diff --git a/libs/basicobj.c b/libs/basicobj.c index 4bf0b74..728932c 100644 --- a/libs/basicobj.c +++ b/libs/basicobj.c @@ -782,7 +782,7 @@ void input_line_event(EVENT_MSG *msg,OBJREC *o) { case 'M':if (cursor0) cursor--;break; - case 'S':if (cursor0) {strcpy(&c[cursor-1],&c[cursor]);cursor--;}break; + case 8:if (cursor>0) { + memmove(c+cursor-1, c+cursor, slen-cursor); + --slen; + c[slen] = 0; + cursor--; + }break; case 0:break; case 13:break; case 27:strcpy(c,save);slen=strlen(c);if (cursor>slen) cursor=slen;break; diff --git a/platform/timer.cpp b/platform/timer.cpp index a3c1d88..c435124 100644 --- a/platform/timer.cpp +++ b/platform/timer.cpp @@ -6,14 +6,16 @@ int timerspeed_val = TIMERSPEED; +static auto start_tm = std::chrono::steady_clock::now();; + int get_timer_value() { auto n = std::chrono::steady_clock::now(); - return std::chrono::duration_cast(n.time_since_epoch()).count()/timerspeed_val; + return std::chrono::duration_cast(n-start_tm).count()/timerspeed_val; } uint32_t get_game_tick_count() { auto n = std::chrono::steady_clock::now(); - return std::chrono::duration_cast(n.time_since_epoch()).count(); + return std::chrono::duration_cast(n-start_tm).count(); } void sleep_ms(uint32_t x) {