ref: a4ca7824d148d3dea70d222711cc05977a6ccd2b
parent: 344823214b77a076351e1101a89e8c2a407dca48
author: Simon Howard <fraggle@gmail.com>
date: Fri May 19 16:01:59 EDT 2006
Add a config file setting to allow a delay to be specified on startup. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 484
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_main.c 475 2006-05-05 19:49:34Z fraggle $
+// $Id: d_main.c 484 2006-05-19 20:01:59Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -184,7 +184,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_main.c 475 2006-05-05 19:49:34Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 484 2006-05-19 20:01:59Z fraggle $";
#define BGCOLOR 7
#define FGCOLOR 8
@@ -570,6 +570,8 @@
TryRunTics();
I_InitGraphics ();
+
+ D_StartGameLoop();
while (1)
{
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_net.c 475 2006-05-05 19:49:34Z fraggle $
+// $Id: d_net.c 484 2006-05-19 20:01:59Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -117,7 +117,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_net.c 475 2006-05-05 19:49:34Z fraggle $";
+static const char rcsid[] = "$Id: d_net.c 484 2006-05-19 20:01:59Z fraggle $";
#include "doomfeatures.h"
@@ -221,6 +221,7 @@
// check time
nowtime = GetAdjustedTime() / ticdup;
newtics = nowtime - lasttime;
+
lasttime = nowtime;
if (skiptics <= newtics)
@@ -286,8 +287,18 @@
}
}
+//
+// Start game loop
+//
+// Called after the screen is set but before the game starts running.
+//
+void D_StartGameLoop(void)
+{
+ lasttime = GetAdjustedTime() / ticdup;
+}
+
//
// D_CheckNetGame
// Works out player numbers among the net participants
@@ -574,6 +585,7 @@
I_Error ("gametic>lowtic");
if (advancedemo)
D_DoAdvanceDemo ();
+
G_Ticker ();
gametic++;
--- a/src/d_net.h
+++ b/src/d_net.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_net.h 388 2006-02-24 19:14:22Z fraggle $
+// $Id: d_net.h 484 2006-05-19 20:01:59Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -49,6 +49,8 @@
//? how many ticks to run?
void TryRunTics (void);
+// Called at start of game loop to initialise timers
+void D_StartGameLoop(void);
#endif
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_video.c 478 2006-05-08 21:54:32Z fraggle $
+// $Id: i_video.c 484 2006-05-19 20:01:59Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -175,7 +175,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: i_video.c 478 2006-05-08 21:54:32Z fraggle $";
+rcsid[] = "$Id: i_video.c 484 2006-05-19 20:01:59Z fraggle $";
#include <SDL.h>
#include <ctype.h>
@@ -234,6 +234,10 @@
// Run in full screen mode? (int type for config code)
int fullscreen = FULLSCREEN_ON;
+// Time to wait for the screen to settle on startup before starting the
+// game (ms)
+int startup_delay = 0;
+
// Grab the mouse? (int type for config code)
int grabmouse = true;
@@ -868,7 +872,7 @@
// If we have a palette to set, the act of setting the palette
// updates the screen
- if (palette_to_set)
+ if (palette_to_set ||true)
{
SDL_SetColors(screen, palette, 0, 256);
palette_to_set = 0;
@@ -1138,6 +1142,16 @@
UpdateFocus();
UpdateGrab();
+
+ // On some systems, it takes a second or so for the screen to settle
+ // after changing modes. We include the option to add a delay when
+ // setting the screen mode, so that the game doesn't start immediately
+ // with the player unable to see anything.
+
+ if (fullscreen || true)
+ {
+ SDL_Delay(startup_delay);
+ }
// Check if we have a native surface we can use
// If we have to lock the screen, draw to a buffer and copy
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_video.h 147 2005-10-02 03:16:29Z fraggle $
+// $Id: i_video.h 484 2006-05-19 20:01:59Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -65,6 +65,7 @@
extern boolean fullscreen;
extern boolean grabmouse;
extern float mouse_acceleration;
+extern int startup_delay;
#endif
//-----------------------------------------------------------------------------
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: m_misc.c 444 2006-03-25 21:50:32Z fraggle $
+// $Id: m_misc.c 484 2006-05-19 20:01:59Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -106,7 +106,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: m_misc.c 444 2006-03-25 21:50:32Z fraggle $";
+rcsid[] = "$Id: m_misc.c 484 2006-05-19 20:01:59Z fraggle $";
#include <stdio.h>
#include <stdlib.h>
@@ -402,6 +402,7 @@
{"mouse_acceleration", &mouse_acceleration, DEFAULT_FLOAT},
{"show_endoom", &show_endoom},
{"vanilla_savegame_limit", &vanilla_savegame_limit},
+ {"startup_delay", &startup_delay},
#ifdef FEATURE_MULTIPLAYER
{"player_name", &net_player_name, DEFAULT_STRING},
#endif