From dc35feeac9e692191b99ba44122dbab203d1cd6c Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Mon, 21 Feb 2011 03:08:50 +0800 Subject: [PATCH 1/3] Fix console preventing window from closing --- src/interface.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/interface.c b/src/interface.c index 703ac068b..0efc7809b 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3953,6 +3953,7 @@ char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show } } } + console_mode = 0; return NULL; } From 1419337374ad254eddab69fa1bff11204abca69d Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Mon, 21 Feb 2011 04:55:47 +0800 Subject: [PATCH 2/3] Reduce overlap of HUD text when in debug/beta mode Also reduce duplication of some HUD code --- src/main.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/main.c b/src/main.c index 2f3a6414f..6667f7710 100644 --- a/src/main.c +++ b/src/main.c @@ -1935,35 +1935,29 @@ int main(int argc, char *argv[]) } if (!((cr>>8)>=NPART || !cr)) { -#ifdef BETA if (DEBUG_MODE) { int tctype = parts[cr>>8].ctype; if (tctype>=PT_NUM) tctype = 0; - sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life, cr>>8); - //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); - } else + sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); + sprintf(coordtext, "#%d, X:%d Y:%d", cr>>8, x/sdl_scale, y/sdl_scale); + } else { +#ifdef BETA sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); #else - if (DEBUG_MODE) - { - int tctype = parts[cr>>8].ctype; - if (tctype>=PT_NUM) - tctype = 0; - sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, #%d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life ,cr>>8); - //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); - } else { sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); - } #endif + } } else { sprintf(heattext, "Empty, Pressure: %3.2f", pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL]); + if (DEBUG_MODE) + { + sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale); + } } - if (DEBUG_MODE) - sprintf(coordtext, "X:%d Y:%d", x/sdl_scale, y/sdl_scale); } mx = x; my = y; From 6f2965d0d069e8586d9ca32d042ee6dd094cb0f0 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Mon, 21 Feb 2011 06:38:19 +0800 Subject: [PATCH 3/3] Zoom key conflict with international keyboards Change zoom key to only use keysym.sym, like all the other keyboard controls. This may mean it is no longer the 'z' key on all systems, but will prevent it conflicting with the other keyboard controls. --- includes/interface.h | 2 -- src/interface.c | 7 ++----- src/main.c | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/includes/interface.h b/includes/interface.h index e1d7e6f22..a49f75f9e 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -154,8 +154,6 @@ extern char search_expr[256]; extern char *tag_names[TAG_MAX]; extern int tag_votes[TAG_MAX]; -extern int Z_keysym; - extern int zoom_en; extern int zoom_x, zoom_y; extern int zoom_wx, zoom_wy; diff --git a/src/interface.c b/src/interface.c index 0efc7809b..2aef3632b 100644 --- a/src/interface.c +++ b/src/interface.c @@ -60,8 +60,6 @@ char search_expr[256] = ""; char *tag_names[TAG_MAX]; int tag_votes[TAG_MAX]; -int Z_keysym = 'z'; - int zoom_en = 0; int zoom_x=(XRES-ZSIZE_D)/2, zoom_y=(YRES-ZSIZE_D)/2; int zoom_wx=0, zoom_wy=0; @@ -1763,10 +1761,9 @@ int sdl_poll(void) sdl_ascii=event.key.keysym.unicode; if (event.key.keysym.sym == SDLK_CAPSLOCK) sdl_caps = 1; - if (event.key.keysym.unicode=='z' || event.key.keysym.unicode=='Z') + if (event.key.keysym.sym=='z') { sdl_zoom_trig = 1; - Z_keysym = event.key.keysym.sym; } if ( event.key.keysym.sym == SDLK_PLUS) { @@ -1816,7 +1813,7 @@ int sdl_poll(void) case SDL_KEYUP: if (event.key.keysym.sym == SDLK_CAPSLOCK) sdl_caps = 0; - if (event.key.keysym.sym == Z_keysym) + if (event.key.keysym.sym == 'z') sdl_zoom_trig = 0; if (event.key.keysym.sym == SDLK_RIGHT || event.key.keysym.sym == SDLK_LEFT) { diff --git a/src/main.c b/src/main.c index 6667f7710..84e440ca6 100644 --- a/src/main.c +++ b/src/main.c @@ -2108,7 +2108,7 @@ int main(int argc, char *argv[]) if (!sdl_zoom_trig && zoom_en==1) zoom_en = 0; - if (sdl_key==Z_keysym && zoom_en==2) + if (sdl_key=='z' && zoom_en==2) zoom_en = 1; if (load_mode)