From 487d54793f30a68321b3a3235fa70e23a65ea8bd Mon Sep 17 00:00:00 2001 From: helixhorned Date: Fri, 24 May 2013 13:54:32 +0000 Subject: [PATCH] For DNCOORDS display, add current sprite count and #inserted sprites / last sec. Only in debugging builds. git-svn-id: https://svn.eduke32.com/eduke32@3808 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 25 ++++++++++++++++++++- polymer/eduke32/source/lunatic/savegame.lua | 1 + polymer/eduke32/source/savegame.c | 7 +++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 37c4471ed..2e32c7b5c 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1765,6 +1765,13 @@ static void G_PrintFPS(void) // yxaspect and viewingrange just before the 'main' drawrooms call static int32_t dr_yxaspect, dr_viewingrange; +#ifdef DEBUGGINGAIDS +static struct { + uint32_t lastgtic; + uint32_t lastnumins, numins; +} g_spriteStat; +#endif + static void G_PrintCoords(int32_t snum) { const int32_t x = 250; @@ -1802,7 +1809,19 @@ static void G_PrintCoords(int32_t snum) printext256(x,y+54,31,-1,tempbuf,0); Bsprintf(tempbuf,"GAMETIC= %d",g_moveThingsCount); printext256(x,y+63,31,-1,tempbuf,0); - +#ifdef DEBUGGINGAIDS + Bsprintf(tempbuf,"NUMSPRITES= %d", Numsprites); + printext256(x,y+72,31,-1,tempbuf,0); + if (g_moveThingsCount > g_spriteStat.lastgtic + REALGAMETICSPERSEC) + { + g_spriteStat.lastgtic = g_moveThingsCount; + g_spriteStat.lastnumins = g_spriteStat.numins; + g_spriteStat.numins = 0; + } + Bsprintf(tempbuf,"INSERTIONS/s= %u", g_spriteStat.lastnumins); + printext256(x,y+81,31,-1,tempbuf,0); + y += 2*9; +#endif y += 7; Bsprintf(tempbuf,"VR=%.03f YX=%.03f",(double)dr_viewingrange/65536.0,(double)dr_yxaspect/65536.0); printext256(x,y+72,31,-1,tempbuf,0); @@ -4139,6 +4158,10 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3 G_GameExit("Too many sprites spawned."); } +#ifdef DEBUGGINGAIDS + g_spriteStat.numins++; +#endif + s = &sprite[i]; Bmemcpy(s, &spr_temp, sizeof(spritetype)); diff --git a/polymer/eduke32/source/lunatic/savegame.lua b/polymer/eduke32/source/lunatic/savegame.lua index 66414adcb..258eab39a 100644 --- a/polymer/eduke32/source/lunatic/savegame.lua +++ b/polymer/eduke32/source/lunatic/savegame.lua @@ -134,6 +134,7 @@ local function sb_get_initial_strbuf() return { "local nan, inf = 0/0, 1/0", "local t, f = true, false", + "local pairs = assert(pairs)", -- Clear table function: "local function ct(t)", " for k in pairs(t) do t[k]=nil end", diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 9f58b96d1..0126b91dd 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -1057,14 +1057,15 @@ static void sv_makevarspec() static char *magic = "blK:vars"; int32_t i, j, numsavedvars=0, per; - if (svgm_vars) - Bfree(svgm_vars); - for (i=0; i