Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8691 → Rev 8716

/source/duke3d/src/demo.cpp
789,7 → 789,7
if (Demo_IsProfiling())
totalclock += TICSPERFRAME;
 
if (G_FPSLimit())
if (engineFPSLimit())
{
if (foundemo == 0)
{
/source/duke3d/src/game.cpp
120,10 → 120,6
 
int32_t g_levelTextTime = 0;
 
int32_t r_maxfps = -1;
int32_t r_maxfpsoffset;
uint64_t g_frameDelay;
 
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
extern char forcegl;
#endif
6325,27 → 6321,6
#endif
}
 
 
int G_FPSLimit(void)
{
if (!r_maxfps)
return true;
 
g_frameDelay = calcFrameDelay(r_maxfps, r_maxfpsoffset);
 
uint64_t const frameTicks = timerGetPerformanceCounter();
static uint64_t nextFrameTicks = frameTicks + g_frameDelay;
 
if (frameTicks >= nextFrameTicks)
{
while (frameTicks >= nextFrameTicks)
nextFrameTicks += g_frameDelay;
return true;
}
 
return false;
}
 
// TODO: reorder (net)actor_t to eliminate slop and update assertion
EDUKE32_STATIC_ASSERT(sizeof(actor_t)%4 == 0);
EDUKE32_STATIC_ASSERT(sizeof(DukePlayer_t)%4 == 0);
6749,7 → 6724,6
ud.setup.bpp = bpp;
}
 
g_frameDelay = calcFrameDelay(r_maxfps, r_maxfpsoffset);
videoSetPalette(ud.brightness>>2, myplayer.palette, 0);
S_SoundStartup();
S_MusicStartup();
6966,7 → 6940,7
{
idle();
}
else if (G_FPSLimit() || g_saveRequested)
else if (engineFPSLimit() || g_saveRequested)
{
if (!g_saveRequested)
{
/source/duke3d/src/game.h
341,8 → 341,6
extern int32_t g_restorePalette;
extern int32_t hud_glowingquotes;
extern int32_t hud_showmapname;
extern int32_t r_maxfps;
extern int32_t r_maxfpsoffset;
extern int32_t tempwallptr;
extern int32_t ticrandomseed;
extern int32_t vote_map;
356,17 → 354,6
extern palette_t CrosshairColors;
extern palette_t DefaultCrosshairColors;
 
extern uint64_t g_frameDelay;
static inline uint64_t calcFrameDelay(int const maxFPS, int const offset)
{
uint64_t const perfFreq = timerGetPerformanceFrequency();
 
if (maxFPS == -1)
return perfFreq / (refreshfreq - ceil(refreshfreq / 60.0));
 
return maxFPS ? perfFreq / (maxFPS + offset) : 0;
}
 
int32_t A_CheckInventorySprite(spritetype *s);
int32_t A_InsertSprite(int16_t whatsect, int32_t s_x, int32_t s_y, int32_t s_z, int16_t s_pn, int8_t s_s, uint8_t s_xr,
uint8_t s_yr, int16_t s_a, int16_t s_ve, int16_t s_zv, int16_t s_ow, int16_t s_ss);
406,7 → 393,7
void G_HandleMirror(int32_t x, int32_t y, int32_t z, fix16_t a, fix16_t horiz, int32_t smoothratio);
void G_DrawRooms(int32_t playerNum,int32_t smoothratio);
void G_DrawTXDigiNumZ(int32_t starttile,int32_t x,int32_t y,int32_t n,int32_t s,int32_t pal,int32_t cs,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z);
int G_FPSLimit(void);
int engineFPSLimit(void);
void G_GameExit(const char *msg) ATTRIBUTE((noreturn));
void G_GameQuit(void);
void G_GetCrosshairColor(void);
/source/duke3d/src/gameexec.cpp
1240,7 → 1240,7
 
ototalclock = totalclock + 1; // pause game like ANMs
 
if (!G_FPSLimit())
if (!engineFPSLimit())
continue;
 
videoClearScreen(0);
/source/duke3d/src/network.cpp
4701,7 → 4701,7
if (quitevent || keystatus[1])
G_GameExit("");
 
if (G_FPSLimit())
if (engineFPSLimit())
{
display_betascreen();
gametext_center_shade(170, "Waiting for server", 14);
/source/duke3d/src/osdcmds.cpp
1465,11 → 1465,6
ud.statusbarmode = (ud.screen_size < 8);
G_UpdateScreenArea();
}
else if (!Bstrcasecmp(parm->name, "r_maxfps") || !Bstrcasecmp(parm->name, "r_maxfpsoffset"))
{
if (r_maxfps > 0) r_maxfps = clamp(r_maxfps, 30, 1000);
g_frameDelay = calcFrameDelay(r_maxfps, r_maxfpsoffset);
}
else if (!Bstrcasecmp(parm->name, "r_ambientlight"))
{
if (r_ambientlight == 0)
1694,8 → 1689,6
{ "r_precache", "precache art assets during level load" CVAR_BOOL_OPTSTR, (void *)&ud.config.useprecache, CVAR_BOOL, 0, 1 },
 
{ "r_ambientlight", "sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
{ "r_maxfps", "limit the frame rate",(void *)&r_maxfps, CVAR_INT|CVAR_FUNCPTR, -1, 1000 },
{ "r_maxfpsoffset", "menu-controlled offset for r_maxfps",(void *)&r_maxfpsoffset, CVAR_INT|CVAR_FUNCPTR, -10, 10 },
 
{ "sensitivity","changes the mouse sensitivity", (void *)&CONTROL_MouseSensitivity, CVAR_FLOAT|CVAR_FUNCPTR, 0, 25 },
 
/source/duke3d/src/screens.cpp
1560,7 → 1560,7
 
while (totalclock < (120 * 7) && !I_GeneralTrigger())
{
if (G_FPSLimit())
if (engineFPSLimit())
{
videoClearScreen(0);
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, DREALMS, 0, 0, 2 + 8 + 64 + BGSTRETCH);
1601,7 → 1601,7
#endif
!I_GeneralTrigger())
{
if (G_FPSLimit())
if (engineFPSLimit())
{
videoClearScreen(0);
rotatesprite_fs(160 << 16, 100 << 16, 65536L, 0, BETASCREEN, 0, 0, 2 + 8 + 64 + BGSTRETCH);
1835,7 → 1835,7
 
do
{
if (G_FPSLimit())
if (engineFPSLimit())
{
videoClearScreen(0L);
rotatesprite_fs(0, 50<<16, 65536L, 0, VICTORY1, 0, 0, 2+8+16+64+128+BGSTRETCH);
2306,7 → 2306,7
gameHandleEvents();
MUSIC_Update();
 
if (G_FPSLimit())
if (engineFPSLimit())
{
videoClearScreen(0);
G_DisplayMPResultsScreen();
2350,7 → 2350,7
gameHandleEvents();
MUSIC_Update();
 
if (G_FPSLimit())
if (engineFPSLimit())
{
if (g_player[myconnectindex].ps->gm&MODE_EOL)
{