mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-25 05:48:03 -04:00
add an FPS counter widget
and the SHOWFPS cheat to enable it (only if not in automap)
This commit is contained in:
parent
827447c628
commit
a5da1900d0
@ -70,7 +70,9 @@ typedef enum
|
||||
// No damage, no health loss.
|
||||
CF_GODMODE = 2,
|
||||
// Not really a cheat, just a debug aid.
|
||||
CF_NOMOMENTUM = 4
|
||||
CF_NOMOMENTUM = 4,
|
||||
// [FG] FPS counter widget
|
||||
CF_SHOWFPS = 8
|
||||
|
||||
} cheat_t;
|
||||
|
||||
|
@ -173,6 +173,7 @@ static hu_textline_t w_keys; //jff 2/16/98 new keys widget for hud
|
||||
static hu_textline_t w_gkeys; //jff 3/7/98 graphic keys widget for hud
|
||||
static hu_textline_t w_monsec; //jff 2/16/98 new kill/secret widget for hud
|
||||
static hu_mtext_t w_rtext; //jff 2/26/98 text message refresh widget
|
||||
static hu_textline_t w_fps; // [FG] FPS counter widget
|
||||
|
||||
static boolean always_off = false;
|
||||
static char chat_dest[MAXPLAYERS];
|
||||
@ -222,6 +223,7 @@ static char hud_weapstr[80];
|
||||
static char hud_keysstr[80];
|
||||
static char hud_gkeysstr[80]; //jff 3/7/98 add support for graphic key display
|
||||
static char hud_monsecstr[80];
|
||||
static char hud_fpsstr[32]; // [FG] FPS counter widget
|
||||
|
||||
//
|
||||
// Builtin map names.
|
||||
@ -527,6 +529,9 @@ void HU_Start(void)
|
||||
HU_FONTSTART, colrngs[hudcolor_xyco]);
|
||||
HUlib_initTextLine(&w_coordz, HU_COORDX, HU_COORDZ_Y, hu_font,
|
||||
HU_FONTSTART, colrngs[hudcolor_xyco]);
|
||||
// [FG] FPS counter widget
|
||||
HUlib_initTextLine(&w_fps, HU_COORDX, HU_COORDX_Y, hu_font,
|
||||
HU_FONTSTART, colrngs[hudcolor_xyco]);
|
||||
|
||||
// initialize the automaps coordinate widget
|
||||
//jff 3/3/98 split coordstr widget into 3 parts
|
||||
@ -542,6 +547,11 @@ void HU_Start(void)
|
||||
s = hud_coordstrz;
|
||||
while (*s)
|
||||
HUlib_addCharToTextLine(&w_coordz, *s++);
|
||||
// [FG] FPS counter widget
|
||||
sprintf(hud_fpsstr,"%-5d FPS",0);
|
||||
s = hud_fpsstr;
|
||||
while (*s)
|
||||
HUlib_addCharToTextLine(&w_fps, *s++);
|
||||
|
||||
//jff 2/16/98 initialize ammo widget
|
||||
sprintf(hud_ammostr,"AMM ");
|
||||
@ -719,6 +729,18 @@ void HU_Drawer(void)
|
||||
HUlib_addCharToTextLine(&w_coordz, *s++);
|
||||
HUlib_drawTextLine(&w_coordz, false);
|
||||
}
|
||||
// [FG] FPS counter widget
|
||||
else if (plr->cheats & CF_SHOWFPS)
|
||||
{
|
||||
extern int fps;
|
||||
|
||||
sprintf(hud_fpsstr,"%-5d FPS", fps); // killough 10/98
|
||||
HUlib_clearTextLine(&w_fps);
|
||||
s = hud_fpsstr;
|
||||
while (*s)
|
||||
HUlib_addCharToTextLine(&w_fps, *s++);
|
||||
HUlib_drawTextLine(&w_fps, false);
|
||||
}
|
||||
|
||||
// draw the weapon/health/ammo/armor/kills/keys displays if optioned
|
||||
//jff 2/17/98 allow new hud stuff to be turned off
|
||||
|
@ -682,6 +682,8 @@ static int in_page_flip, in_hires;
|
||||
static void I_DrawDiskIcon(), I_RestoreDiskBackground();
|
||||
static unsigned int disk_to_draw, disk_to_restore;
|
||||
|
||||
int fps; // [FG] FPS counter widget
|
||||
|
||||
void I_FinishUpdate(void)
|
||||
{
|
||||
if (noblit || !in_graphics_mode)
|
||||
@ -726,6 +728,26 @@ void I_FinishUpdate(void)
|
||||
}
|
||||
}
|
||||
|
||||
// [crispy] [AM] Real FPS counter
|
||||
{
|
||||
static int lastmili;
|
||||
static int fpscount;
|
||||
int i, mili;
|
||||
|
||||
fpscount++;
|
||||
|
||||
i = SDL_GetTicks();
|
||||
mili = i - lastmili;
|
||||
|
||||
// Update FPS counter every second
|
||||
if (mili >= 1000)
|
||||
{
|
||||
fps = (fpscount * 1000) / mili;
|
||||
fpscount = 0;
|
||||
lastmili = i;
|
||||
}
|
||||
}
|
||||
|
||||
I_DrawDiskIcon();
|
||||
|
||||
SDL_LowerBlit(sdlscreen, &blit_rect, argbbuffer, &blit_rect);
|
||||
|
@ -83,6 +83,7 @@ static void cheat_printstats(); // killough 8/23/98
|
||||
|
||||
static void cheat_autoaim(); // killough 7/19/98
|
||||
static void cheat_tst();
|
||||
static void cheat_showfps(); // [FG] FPS counter widget
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
@ -256,6 +257,10 @@ struct cheat_s cheat[] = {
|
||||
cheat_printstats},
|
||||
#endif
|
||||
|
||||
// [FG] FPS counter widget
|
||||
{"showfps", NULL, always,
|
||||
cheat_showfps},
|
||||
|
||||
{NULL} // end-of-list marker
|
||||
};
|
||||
|
||||
@ -269,6 +274,12 @@ static void cheat_printstats() // killough 8/23/98
|
||||
}
|
||||
#endif
|
||||
|
||||
// [FG] FPS counter widget
|
||||
static void cheat_showfps()
|
||||
{
|
||||
plyr->cheats ^= CF_SHOWFPS;
|
||||
}
|
||||
|
||||
// killough 7/19/98: Autoaiming optional in beta emulation mode
|
||||
static void cheat_autoaim()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user