Clean up the startup file diffs.

This also makes functionality consistent across the platforms, such as
adding support for -dedicated to sdl based nq, and various timing
calculations are now consistent.
This commit is contained in:
Bill Currie 2011-09-03 19:58:03 +09:00
parent db8eee502f
commit cca9983a48
12 changed files with 204 additions and 281 deletions

View file

@ -34,6 +34,6 @@
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
extern int noconinput;
extern int qf_sdl_link;
static __attribute__ ((used)) int *const _noconinput = &noconinput;
static __attribute__ ((used)) int *const _qf_sdl_link = &qf_sdl_link;

View file

@ -31,12 +31,6 @@
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_CONIO_H
# include <conio.h>
#endif
#ifdef HAVE_IO_H
# include <io.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
@ -47,35 +41,29 @@ static __attribute__ ((used)) const char rcsid[] =
# include <unistd.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef _WIN32
# include <signal.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/fcntl.h>
#endif
#include <SDL.h>
#include <SDL_main.h>
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "client.h"
#include "compat.h"
#include "host.h"
qboolean isDedicated = false;
int noconinput;
#ifdef _WIN32
# include "winquake.h"
#endif
int qf_sdl_link;
qboolean isDedicated = false;
static void
startup (void)
{
@ -103,7 +91,9 @@ static void
shutdown_f (void)
{
#ifndef _WIN32
// change stdin to blocking
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
fflush (stdout);
#endif
}
@ -112,7 +102,7 @@ shutdown_f (void)
#endif
int
SDL_main (int c, char **v)
SDL_main (int argc, const char **argv)
{
double time, oldtime, newtime;
@ -120,29 +110,43 @@ SDL_main (int c, char **v)
memset (&host_parms, 0, sizeof (host_parms));
COM_InitArgv (c, (const char **)v);
COM_InitArgv (argc, argv);
host_parms.argc = com_argc;
host_parms.argv = com_argv;
#ifndef _WIN32
noconinput = COM_CheckParm ("-noconinput");
if (!noconinput)
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
#endif
isDedicated = (COM_CheckParm ("-dedicated") != 0);
Sys_RegisterShutdown (Host_Shutdown);
Sys_RegisterShutdown (shutdown_f);
Host_Init ();
oldtime = Sys_DoubleTime ();
while (1) {
#ifndef _WIN32
if (!sys_nostdout->int_val) {
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
Sys_Printf ("Quake -- Version %s\n", NQ_VERSION);
}
#endif
oldtime = Sys_DoubleTime () - 0.1;
while (1) { // Main message loop
// find time spent rendering last frame
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
if (cls.state == ca_dedicated) { // play vcrfiles at max speed
if (time < sys_ticrate->value && (!vcrFile || recording)) {
usleep (1);
continue; // not time to run a server-only tic yet
}
time = sys_ticrate->value;
}
if (time > sys_ticrate->value * 2)
oldtime = newtime;
else
oldtime += time;
Host_Frame (time);
oldtime = newtime;
}
return 0; // shouldn't be reachable, but mingw gcc 3.1 is being weird
}

View file

@ -29,7 +29,7 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_STRING_H
@ -42,14 +42,11 @@ static __attribute__ ((used)) const char rcsid[] =
# include <unistd.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/time.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/fcntl.h>
#endif
#include "QF/cvar.h"
#include "QF/qargs.h"
@ -57,7 +54,6 @@ static __attribute__ ((used)) const char rcsid[] =
#include "client.h"
#include "host.h"
#include "server.h"
qboolean isDedicated = false;
@ -66,24 +62,22 @@ shutdown_f (void)
{
// change stdin to blocking
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
fflush (stdout);
}
int
main (int c, const char *v[])
main (int argc, const char **argv)
{
double time, oldtime, newtime;
memset (&host_parms, 0, sizeof (host_parms));
COM_InitArgv (c, v);
COM_InitArgv (argc, argv);
host_parms.argc = com_argc;
host_parms.argv = com_argv;
isDedicated = (COM_CheckParm ("-dedicated") != 0);
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
Sys_RegisterShutdown (Host_Shutdown);
Sys_RegisterShutdown (shutdown_f);
@ -95,7 +89,7 @@ main (int c, const char *v[])
}
oldtime = Sys_DoubleTime () - 0.1;
while (1) {
while (1) { // Main message loop
// find time spent rendering last frame
newtime = Sys_DoubleTime ();
time = newtime - oldtime;

View file

@ -1,7 +1,7 @@
/*
sys_unixd.c
@description@
(description)
Copyright (C) 1996-1997 Id Software, Inc.
@ -28,7 +28,7 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_STRING_H
@ -49,19 +49,16 @@ static __attribute__ ((used)) const char rcsid[] =
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/qtypes.h"
#include "QF/sys.h"
#include "client.h"
#include "host.h"
qboolean isDedicated = true;
int nostdout = 0;
static void
shutdown_f (void)
{
// change stdin to blocking
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
fflush (stdout);
}
@ -92,13 +89,13 @@ main (int argc, const char **argv)
host_parms.argc = com_argc;
host_parms.argv = com_argv;
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
Sys_RegisterShutdown (Host_Shutdown);
Sys_RegisterShutdown (shutdown_f);
Host_Init ();
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
oldtime = Sys_DoubleTime () - 0.1;
while (1) { // Main message loop
Sys_CheckInput (0, -1);
@ -108,7 +105,7 @@ main (int argc, const char **argv)
time = newtime - oldtime;
if (time < sys_ticrate->value) {
usleep (1);
continue;
continue; // not time to run a server-only tic yet
}
time = sys_ticrate->value;
@ -119,5 +116,4 @@ main (int argc, const char **argv)
Host_Frame (time);
}
return true; // return success
}

View file

@ -28,24 +28,22 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#include "winquake.h"
#include "win32/resources/resource.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/quakeio.h"
#include "QF/screen.h"
#include "QF/sys.h"
#include "client.h"
#include "compat.h"
#include "game.h"
#include "host.h"
qboolean isDedicated = false;
#define MINIMUM_WIN_MEMORY 0x0880000
#define MAXIMUM_WIN_MEMORY 0x1000000
@ -59,11 +57,8 @@ qboolean WinNT;
static double pfreq;
static int lowshift;
qboolean isDedicated;
HANDLE hinput, houtput;
static const char tracking_tag[] = "Clams & Mooses";
static HANDLE tevent;
// SYSTEM IO ==================================================================
@ -132,60 +127,11 @@ const char *argv[MAX_NUM_ARGVS];
static const char *empty_string = "";
HWND hwnd_dialog;
int WINAPI
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
static void
init_handles (HINSTANCE hInstance)
{
double time, oldtime, newtime;
MEMORYSTATUS lpBuffer;
static char cwd[1024];
RECT rect;
// previous instances do not exist in Win32
if (hPrevInstance)
return 0;
startup ();
global_hInstance = hInstance;
global_nCmdShow = nCmdShow;
lpBuffer.dwLength = sizeof (MEMORYSTATUS);
GlobalMemoryStatus (&lpBuffer);
if (!GetCurrentDirectory (sizeof (cwd), cwd))
Sys_Error ("Couldn't determine current directory");
if (cwd[strlen (cwd) - 1] == '/')
cwd[strlen (cwd) - 1] = 0;
host_parms.argc = 1;
argv[0] = empty_string;
while (*lpCmdLine && (host_parms.argc < MAX_NUM_ARGVS)) {
while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
lpCmdLine++;
if (*lpCmdLine) {
argv[host_parms.argc] = lpCmdLine;
host_parms.argc++;
while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
lpCmdLine++;
if (*lpCmdLine) {
*lpCmdLine = 0;
lpCmdLine++;
}
}
}
COM_InitArgv (host_parms.argc, argv);
host_parms.argc = com_argc;
host_parms.argv = com_argv;
isDedicated = (COM_CheckParm ("-dedicated") != 0);
if (!isDedicated) {
hwnd_dialog = CreateDialog (hInstance, MAKEINTRESOURCE (IDD_DIALOG1),
NULL, NULL);
@ -210,26 +156,68 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
if (!tevent)
Sys_Error ("Couldn't create event");
}
Host_Init ();
int WINAPI
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{
double time, oldtime, newtime;
MEMORYSTATUS lpBuffer;
int argc;
// previous instances do not exist in Win32
if (hPrevInstance)
return 0;
startup ();
global_hInstance = hInstance;
global_nCmdShow = nCmdShow;
lpBuffer.dwLength = sizeof (MEMORYSTATUS);
GlobalMemoryStatus (&lpBuffer);
argc = 1;
argv[0] = empty_string;
while (*lpCmdLine && (argc < MAX_NUM_ARGVS)) {
while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
lpCmdLine++;
if (*lpCmdLine) {
argv[argc] = lpCmdLine;
argc++;
while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
lpCmdLine++;
if (*lpCmdLine) {
*lpCmdLine = 0;
lpCmdLine++;
}
}
}
memset (&host_parms, 0, sizeof (host_parms));
COM_InitArgv (argc, argv);
host_parms.argc = com_argc;
host_parms.argv = com_argv;
isDedicated = (COM_CheckParm ("-dedicated") != 0);
if (!isDedicated)
init_handles (hInstance);
Sys_RegisterShutdown (Host_Shutdown);
Sys_RegisterShutdown (shutdown_f);
oldtime = Sys_DoubleTime ();
Host_Init ();
// main window message loop
while (1) {
if (isDedicated) {
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
while (time < sys_ticrate->value) {
Sleep (1);
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
}
} else {
oldtime = Sys_DoubleTime () - 0.1;
while (1) { // Main message loop
if (!isDedicated) {
// yield the CPU for a little while when paused, minimized, or
// not the focus
if ((cl.paused && !ActiveApp) || Minimized) {
@ -238,15 +226,24 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
} else if (!ActiveApp) {
SleepUntilInput (NOT_FOCUS_SLEEP);
}
}
// find time spent rendering last frame
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
if (cls.state == ca_dedicated) { // play vcrfiles at max speed
if (time < sys_ticrate->value && (!vcrFile || recording)) {
Sleep (1);
continue; // not time to run a server-only tic yet
}
time = sys_ticrate->value;
}
Host_Frame (time);
oldtime = newtime;
}
if (time > sys_ticrate->value * 2)
oldtime = newtime;
else
oldtime += time;
// return success of application
return TRUE;
Host_Frame (time);
}
}

View file

@ -1,7 +1,7 @@
/*
sys_wind.c
@description@
(description)
Copyright (C) 1996-1997 Id Software, Inc.
@ -28,24 +28,18 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#include <sys/types.h>
#include <sys/timeb.h>
#include <conio.h>
#include "winquake.h"
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "game.h"
#include "host.h"
#include "winquake.h"
qboolean isDedicated = true;
qboolean isDedicated = true;
static void
shutdown_f (void)
@ -55,16 +49,11 @@ shutdown_f (void)
int
main (int argc, const char **argv)
{
double time, oldtime;
double time, oldtime, newtime;
int i;
memset (&host_parms, 0, sizeof (host_parms));
#if 0
_getcwd (cwd, sizeof (cwd));
if (cwd[Q_strlen (cwd) - 1] == '\\')
cwd[Q_strlen (cwd) - 1] = 0;
#endif
// dedicated server ONLY!
for (i = 1; i < argc; i++)
if (!strcmp (argv[i], "-dedicated"))
@ -72,8 +61,8 @@ main (int argc, const char **argv)
if (i == argc) {
const char **newargv;
newargv = malloc ((argc + 2) * sizeof (*newargv));
memcpy (newargv, argv, argc * 4);
newargv = malloc ((argc + 2) * sizeof (char *));
memcpy (newargv, argv, argc * sizeof (char *));
newargv[argc++] = "-dedicated";
newargv[argc] = 0;
argv = newargv;
@ -88,20 +77,22 @@ main (int argc, const char **argv)
Host_Init ();
oldtime = Sys_DoubleTime ();
/* main window message loop */
while (1) {
time = Sys_DoubleTime ();
if (time - oldtime < sys_ticrate->value) {
oldtime = Sys_DoubleTime () - 0.1;
while (1) { // Main message loop
// find time spent rendering last frame
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
if (time < sys_ticrate->value) {
Sleep (1);
continue;
continue; // not time to run a server-only tic yet
}
time = sys_ticrate->value;
Host_Frame (time - oldtime);
oldtime = time;
if (time > sys_ticrate->value * 2)
oldtime = newtime;
else
oldtime += time;
Host_Frame (time);
}
/* return success of application */
return TRUE;
}

View file

@ -47,11 +47,11 @@ static __attribute__ ((used)) const char rcsid[] =
# include <unistd.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/fcntl.h>
#endif
#ifndef _WIN32
# include <signal.h>
@ -60,20 +60,18 @@ static __attribute__ ((used)) const char rcsid[] =
#include <SDL.h>
#include <SDL_main.h>
#include "QF/console.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "client.h"
#include "compat.h"
#include "host.h"
int noconinput;
#include "netchan.h"
#ifdef _WIN32
# include "winquake.h"
#endif
int qf_sdl_link;
static void
startup (void)
{
@ -98,10 +96,12 @@ startup (void)
}
static void
shutdown (void)
shutdown_f (void)
{
#ifndef _WIN32
// change stdin to blocking
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
fflush (stdout);
#endif
}
@ -110,7 +110,7 @@ shutdown (void)
#endif
int
SDL_main (int c, char **v)
SDL_main (int argc, const char **argv)
{
double time, oldtime, newtime;
@ -118,24 +118,21 @@ SDL_main (int c, char **v)
memset (&host_parms, 0, sizeof (host_parms));
COM_InitArgv (c, (const char **)v);
COM_InitArgv (argc, argv);
host_parms.argc = com_argc;
host_parms.argv = com_argv;
#ifndef _WIN32
noconinput = COM_CheckParm ("-noconinput");
if (!noconinput)
if (!COM_CheckParm ("-noconinput"))
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
#endif
Sys_RegisterShutdown (Host_Shutdown);
Sys_RegisterShutdown (Net_LogStop);
Sys_RegisterShutdown (shutdown);
Sys_RegisterShutdown (shutdown_f);
Host_Init ();
oldtime = Sys_DoubleTime ();
while (1) {
while (1) { // Main message loop
// find time spent rendering last frame
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
@ -143,5 +140,4 @@ SDL_main (int c, char **v)
Host_Frame (time);
oldtime = newtime;
}
return 0; // shouldn't be reachable, but mingw gcc 3.1 is being weird
}

View file

@ -29,7 +29,7 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_STRING_H
@ -42,59 +42,48 @@ static __attribute__ ((used)) const char rcsid[] =
# include <unistd.h>
#endif
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/types.h>
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/fcntl.h>
#endif
#include "QF/console.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "host.h"
#include "netchan.h"
int noconinput = 0;
static void
shutdown (void)
shutdown_f (void)
{
// change stdin to blocking
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
fflush (stdout);
}
int skipframes;
int
main (int c, const char *v[])
main (int argc, const char **argv)
{
// static char cwd[1024];
double time, oldtime, newtime;
memset (&host_parms, 0, sizeof (host_parms));
COM_InitArgv (c, v);
COM_InitArgv (argc, argv);
host_parms.argc = com_argc;
host_parms.argv = com_argv;
noconinput = COM_CheckParm ("-noconinput");
if (!noconinput)
if (!COM_CheckParm ("-noconinput"))
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | O_NONBLOCK);
Sys_RegisterShutdown (Host_Shutdown);
Sys_RegisterShutdown (Net_LogStop);
Sys_RegisterShutdown (shutdown);
Sys_RegisterShutdown (shutdown_f);
Host_Init ();
oldtime = Sys_DoubleTime ();
while (1) {
while (1) { // Main message loop
// find time spent rendering last frame
newtime = Sys_DoubleTime ();
time = newtime - oldtime;

View file

@ -28,33 +28,17 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_CONIO_H
# include <conio.h>
#endif
#ifdef HAVE_IO_H
# include <io.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include "winquake.h"
#include "QF/qargs.h"
#include "QF/screen.h"
#include "QF/sound.h"
#include "QF/sys.h"
#include "QF/vid.h"
#include "client.h"
#include "compat.h"
#include "host.h"
#include "netchan.h"
#include "win32/resources/resource.h"
#define MAXIMUM_WIN_MEMORY 0x1000000
#define MINIMUM_WIN_MEMORY 0x0c00000
@ -112,7 +96,7 @@ startup (void)
}
static void
shutdown (void)
shutdown_f (void)
{
if (tevent)
CloseHandle (tevent);
@ -129,18 +113,17 @@ SleepUntilInput (int time)
HINSTANCE global_hInstance;
int global_nCmdShow;
const char *argv[MAX_NUM_ARGVS];
static const char *empty_string = "";
int WINAPI
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{
// MSG msg;
static char cwd[1024];
double time, oldtime, newtime;
int argc;
const char *argv[MAX_NUM_ARGVS];
double time, oldtime, newtime;
#ifdef SPLASH_SCREEN
RECT rect;
RECT rect;
#endif
// previous instances do not exist in Win32
@ -152,22 +135,16 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
global_hInstance = hInstance;
global_nCmdShow = nCmdShow;
if (!GetCurrentDirectory (sizeof (cwd), cwd))
Sys_Error ("Couldn't determine current directory");
if (cwd[strlen (cwd) - 1] == '/')
cwd[strlen (cwd) - 1] = 0;
host_parms.argc = 1;
argc = 1;
argv[0] = empty_string;
while (*lpCmdLine && (host_parms.argc < MAX_NUM_ARGVS)) {
while (*lpCmdLine && (argc < MAX_NUM_ARGVS)) {
while (*lpCmdLine && ((*lpCmdLine <= 32) || (*lpCmdLine > 126)))
lpCmdLine++;
if (*lpCmdLine) {
argv[host_parms.argc] = lpCmdLine;
host_parms.argc++;
argv[argc] = lpCmdLine;
argc++;
while (*lpCmdLine && ((*lpCmdLine > 32) && (*lpCmdLine <= 126)))
lpCmdLine++;
@ -179,7 +156,7 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
}
}
COM_InitArgv (host_parms.argc, argv);
COM_InitArgv (argc, argv);
host_parms.argc = com_argc;
host_parms.argv = com_argv;
@ -207,17 +184,14 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
if (!tevent)
Sys_Error ("Couldn't create event");
Sys_Printf ("Host_Init\n");
Host_Init ();
Sys_RegisterShutdown (Host_Shutdown);
Sys_RegisterShutdown (Net_LogStop);
Sys_RegisterShutdown (shutdown);
Sys_RegisterShutdown (shutdown_f);
Host_Init ();
oldtime = Sys_DoubleTime ();
// main window message loop
while (1) {
while (1) { // Main message loop
// yield CPU for a little bit when paused, minimized, or not the focus
if ((cl.paused && (!ActiveApp)) || Minimized) {
SleepUntilInput (PAUSE_SLEEP);
@ -228,10 +202,8 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
newtime = Sys_DoubleTime ();
time = newtime - oldtime;
Host_Frame (time);
oldtime = newtime;
}
// return success of application
return TRUE;
}

View file

@ -34,6 +34,6 @@
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
extern int noconinput;
extern int qf_sdl_link;
static __attribute__ ((used)) int *const _noconinput = &noconinput;
static __attribute__ ((used)) int *const _sdl_link = &qf_sdl_link;

View file

@ -29,7 +29,7 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#ifdef HAVE_STRING_H
@ -42,13 +42,6 @@ static __attribute__ ((used)) const char rcsid[] =
# include <unistd.h>
#endif
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include "QF/cvar.h"
#include "QF/qargs.h"
#include "QF/sys.h"
@ -118,7 +111,7 @@ startup (void)
}
int
main (int argc, const char *argv[])
main (int argc, const char **argv)
{
double time, oldtime, newtime;
@ -137,9 +130,8 @@ main (int argc, const char *argv[])
// run one frame immediately for first heartbeat
SV_Frame (0.1);
// main loop
oldtime = Sys_DoubleTime () - 0.1;
while (1) {
while (1) { // Main message loop
Sys_CheckInput (!svs.num_clients, net_socket);
// find time passed since last cycle
@ -154,5 +146,4 @@ main (int argc, const char *argv[])
if (sys_extrasleep->int_val)
usleep (sys_extrasleep->int_val);
}
return 1;
}

View file

@ -28,7 +28,7 @@
# include "config.h"
#endif
static __attribute__ ((used)) const char rcsid[] =
static __attribute__ ((used)) const char rcsid[] =
"$Id$";
#include "winquake.h"
@ -36,11 +36,9 @@ static __attribute__ ((used)) const char rcsid[] =
#include <winsock.h>
#include "QF/cvar.h"
#include "QF/info.h"
#include "QF/qargs.h"
#include "QF/sys.h"
#include "compat.h"
#include "server.h"
qboolean WinNT;
@ -70,12 +68,10 @@ startup (void)
WinNT = false;
}
char *newargv[256];
int
main (int argc, const char **argv)
{
double newtime, time, oldtime;
double time, oldtime, newtime;
startup ();
@ -105,9 +101,8 @@ main (int argc, const char **argv)
// run one frame immediately for first heartbeat
SV_Frame (0.1);
// main loop
oldtime = Sys_DoubleTime () - 0.1;
while (1) {
while (1) { // Main message loop
Sys_CheckInput (!svs.num_clients, net_socket);
// find time passed since last cycle
@ -117,6 +112,4 @@ main (int argc, const char **argv)
SV_Frame (time);
}
return true;
}