mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 08:41:11 +00:00
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:
parent
db8eee502f
commit
cca9983a48
12 changed files with 204 additions and 281 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue