From 51c8dfcef4b3c44826fe16b12b6b825daaea1efe Mon Sep 17 00:00:00 2001 From: Jacob1 Date: Wed, 14 Mar 2012 21:03:00 -0400 Subject: [PATCH] ngrav/amb. heat quickoptions, amb. heat drawn in heat display when on, fix render_ui position --- includes/defines.h | 1 + includes/interface.h | 2 ++ src/graphics.c | 19 ++++++++++++------- src/interface.c | 15 ++++++++++++++- src/main.c | 2 +- 5 files changed, 30 insertions(+), 9 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index 1a9b1e9ec..3d5c4bf03 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -166,6 +166,7 @@ extern int active_menu; extern int hud_enable; extern int pretty_powder; extern int drawgrav_enable; +extern int ngrav_enable; int limitFPS; int water_equal_test; extern int quickoptions_tooltip_fade; diff --git a/includes/interface.h b/includes/interface.h index 6eb6647b3..2c1a2900a 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -77,6 +77,8 @@ static quick_option quickmenu[] = {"P", "Sand effect", QM_TOGGLE, &pretty_powder}, {"G", "Draw gravity grid", QM_TOGGLE, &drawgrav_enable}, {"D", "Show decorations", QM_TOGGLE, &decorations_enable}, + {"N", "Newtonian gravity", QM_TOGGLE, &ngrav_enable}, + {"A", "Ambient heat", QM_TOGGLE, &aheat_enable}, {NULL} }; diff --git a/src/graphics.c b/src/graphics.c index 080cb2a9d..cf5a76037 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1314,14 +1314,19 @@ void draw_air(pixel *vid) clamp_flt(pv[y][x], 0.0f, 8.0f),//pressure adds green clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));//vy adds blue } - else if (display_mode & DISPLAY_AIRH) + else if ((display_mode & DISPLAY_AIRH)) { - float ttemp = hv[y][x]+(-MIN_TEMP); - int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/1024) ) *3, 0.0f, (1024.0f*3)-3); - c = PIXRGB((int)((unsigned char)color_data[caddress]*0.7f), (int)((unsigned char)color_data[caddress+1]*0.7f), (int)((unsigned char)color_data[caddress+2]*0.7f)); - //c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f),//vx adds red - // clamp_flt(hv[y][x], 0.0f, 1600.0f),//heat adds green - // clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));//vy adds blue + if (aheat_enable) + { + float ttemp = hv[y][x]+(-MIN_TEMP); + int caddress = restrict_flt((int)( restrict_flt(ttemp, 0.0f, MAX_TEMP+(-MIN_TEMP)) / ((MAX_TEMP+(-MIN_TEMP))/1024) ) *3, 0.0f, (1024.0f*3)-3); + c = PIXRGB((int)((unsigned char)color_data[caddress]*0.7f), (int)((unsigned char)color_data[caddress+1]*0.7f), (int)((unsigned char)color_data[caddress+2]*0.7f)); + //c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f),//vx adds red + // clamp_flt(hv[y][x], 0.0f, 1600.0f),//heat adds green + // clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));//vy adds blue + } + else + c = PIXRGB(0,0,0); } else if (display_mode & DISPLAY_AIRC) { diff --git a/src/interface.c b/src/interface.c index 4badd0c1c..eede146e2 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2621,7 +2621,15 @@ void quickoptions_menu(pixel *vid_buf, int b, int bq, int x, int y) quickoptions_tooltip_y = (i*16)+5; if(b && !bq) { - *(quickmenu[i].variable) = !(*(quickmenu[i].variable)); + if (!strcmp(quickmenu[i].name,"Newtonian gravity")) + { + if(!ngrav_enable) + start_grav_async(); + else + stop_grav_async(); + } + else + *(quickmenu[i].variable) = !(*(quickmenu[i].variable)); } } } @@ -2886,6 +2894,11 @@ void set_cmode(int cm) // sets to given view mode { colour_mode = COLOUR_HEAT; strcpy(itc_msg, "Heat Display"); + free(display_modes); + display_modes = calloc(2, sizeof(unsigned int)); + display_mode |= DISPLAY_AIRH; + display_modes[0] = DISPLAY_AIRH; + display_modes[1] = 0; } else if (cmode==CM_FANCY) { diff --git a/src/main.c b/src/main.c index 9d5d8472a..0f70de4a2 100644 --- a/src/main.c +++ b/src/main.c @@ -2227,7 +2227,7 @@ int main(int argc, char *argv[]) } if (x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq) { - render_ui(vid_buf, XRES+BARSIZE-(510-491), YRES+(MENUSIZE-19), 3); + render_ui(vid_buf, XRES+BARSIZE-(510-491), YRES-2, 3); } if (x>=(XRES+BARSIZE-(510-494)) && x<=(XRES+BARSIZE-(510-509)) && !bq) sys_pause = !sys_pause;