diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-08-11 19:12:52 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-08-11 19:12:52 (GMT) |
| commit | d5435c50a966c0fb5a0c62a5af7aa834ccf9e48d (patch) | |
| tree | dece342fdb3f1245d8f962183a37a334a89ddeaf /src | |
| parent | 4f8720eecc034fcbb91fb5045bd7670140ba2f2f (diff) | |
| download | powder-d5435c50a966c0fb5a0c62a5af7aa834ccf9e48d.zip powder-d5435c50a966c0fb5a0c62a5af7aa834ccf9e48d.tar.gz | |
Debug info for particles allocation
Diffstat (limited to 'src')
| -rw-r--r-- | src/graphics.c | 20 | ||||
| -rw-r--r-- | src/luaconsole.c | 7 | ||||
| -rw-r--r-- | src/main.c | 6 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/graphics.c b/src/graphics.c index 055a867..3110ea5 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -4436,6 +4436,26 @@ int sdl_open(void) return 1; } +int draw_debug_info(pixel* vid) +{ + if(debug_flags & DEBUG_PARTS) + { + int i = 0, x = 0, y = 0; + for(i = 0; i < NPART; i++){ + if(parts[i].type){ + drawpixel(vid, x, y, 255, 255, 255, 120); + } else { + drawpixel(vid, x, y, 0, 0, 0, 120); + } + x++; + if(x>=XRES){ + y++; + x = 0; + } + } + } +} + #ifdef OpenGL void Enable2D () { diff --git a/src/luaconsole.c b/src/luaconsole.c index e1d08e3..78b633d 100644 --- a/src/luaconsole.c +++ b/src/luaconsole.c @@ -54,6 +54,7 @@ void luacon_open(){ {"throw_error", &luatpt_error}, {"heat", &luatpt_heat}, {"setfire", &luatpt_setfire}, + {"setdebug", &luatpt_setdebug}, {NULL,NULL} }; @@ -1048,4 +1049,10 @@ int luatpt_setfire(lua_State* l) prepare_alpha(firesize, fireintensity); return 0; } +int luatpt_setdebug(lua_State* l) +{ + int debug = luaL_optint(l, 1, 0); + debug_flags = debug; + return 0; +} #endif @@ -188,6 +188,7 @@ int frameidx = 0; //int CGOL = 0; //int GSPEED = 1;//causes my .exe to crash.. int sound_enable = 0; +int debug_flags = 0; sign signs[MAXSIGNS]; @@ -1960,6 +1961,11 @@ int main(int argc, char *argv[]) clearrect(vid_buf, XRES-1, 0, BARSIZE+1, YRES); draw_svf_ui(vid_buf, sdl_mod & (KMOD_LCTRL|KMOD_RCTRL)); + + if(debug_flags) + { + draw_debug_info(vid_buf); + } if (http_ver_check) { |
