mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Füge misc.c auch wirklich ein
This commit is contained in:
parent
64836562ee
commit
c53b967fb0
1 changed files with 91 additions and 0 deletions
91
src/unix/misc.c
Normal file
91
src/unix/misc.c
Normal file
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* This file implements some misc stuff like the main loop
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "../common/header/common.h"
|
||||
|
||||
cvar_t *nostdout;
|
||||
uid_t saved_euid;
|
||||
|
||||
char *
|
||||
strlwr ( char *s )
|
||||
{
|
||||
char *p = s;
|
||||
|
||||
while ( *s )
|
||||
{
|
||||
*s = tolower( *s );
|
||||
s++;
|
||||
}
|
||||
|
||||
return ( p );
|
||||
}
|
||||
|
||||
int
|
||||
main ( int argc, char **argv )
|
||||
{
|
||||
int time, oldtime, newtime;
|
||||
|
||||
/* go back to real user for config loads */
|
||||
saved_euid = geteuid();
|
||||
seteuid( getuid() );
|
||||
|
||||
printf( "Quake 2\n" );
|
||||
|
||||
Qcommon_Init( argc, argv );
|
||||
|
||||
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY );
|
||||
|
||||
nostdout = Cvar_Get( "nostdout", "0", 0 );
|
||||
|
||||
if ( !nostdout->value )
|
||||
{
|
||||
fcntl( 0, F_SETFL, fcntl( 0, F_GETFL, 0 ) | FNDELAY );
|
||||
}
|
||||
|
||||
oldtime = Sys_Milliseconds();
|
||||
|
||||
/* The legendary Quake II mainloop */
|
||||
while ( 1 )
|
||||
{
|
||||
/* find time spent rendering last frame */
|
||||
do
|
||||
{
|
||||
newtime = Sys_Milliseconds();
|
||||
time = newtime - oldtime;
|
||||
}
|
||||
while ( time < 1 );
|
||||
|
||||
Qcommon_Frame( time );
|
||||
oldtime = newtime;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue