Port timer code to SDL
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 28
This commit is contained in:
parent
5c11c607b8
commit
0f9690eb41
2 changed files with 25 additions and 25 deletions
2
TODO
2
TODO
|
|
@ -1,6 +1,6 @@
|
|||
To do:
|
||||
|
||||
* Port sound+timer code to SDL
|
||||
* Port sound code to SDL
|
||||
* Startup messages
|
||||
* Fix Final Doom, Ultimate Doom, IWAD selection in general
|
||||
* Check quit messages selected correctly
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// $Id: i_system.c 22 2005-07-23 19:42:56Z fraggle $
|
||||
// $Id: i_system.c 28 2005-07-25 20:41:59Z fraggle $
|
||||
//
|
||||
// Copyright(C) 1993-1996 Id Software, Inc.
|
||||
// Copyright(C) 2005 Simon Howard
|
||||
|
|
@ -22,6 +22,9 @@
|
|||
// 02111-1307, USA.
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.5 2005/07/25 20:41:59 fraggle
|
||||
// Port timer code to SDL
|
||||
//
|
||||
// Revision 1.4 2005/07/23 19:42:56 fraggle
|
||||
// Startup messages as in the DOS exes
|
||||
//
|
||||
|
|
@ -40,7 +43,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
static const char
|
||||
rcsid[] = "$Id: i_system.c 22 2005-07-23 19:42:56Z fraggle $";
|
||||
rcsid[] = "$Id: i_system.c 28 2005-07-25 20:41:59Z fraggle $";
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
|
@ -48,8 +51,7 @@ rcsid[] = "$Id: i_system.c 22 2005-07-23 19:42:56Z fraggle $";
|
|||
#include <string.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "m_misc.h"
|
||||
|
|
@ -107,16 +109,17 @@ byte* I_ZoneBase (int* size)
|
|||
//
|
||||
int I_GetTime (void)
|
||||
{
|
||||
struct timeval tp;
|
||||
struct timezone tzp;
|
||||
int newtics;
|
||||
static int basetime=0;
|
||||
|
||||
gettimeofday(&tp, &tzp);
|
||||
if (!basetime)
|
||||
basetime = tp.tv_sec;
|
||||
newtics = (tp.tv_sec-basetime)*TICRATE + tp.tv_usec*TICRATE/1000000;
|
||||
return newtics;
|
||||
static Uint32 basetime = 0;
|
||||
Uint32 ticks;
|
||||
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
if (basetime == 0)
|
||||
basetime = ticks;
|
||||
|
||||
ticks -= basetime;
|
||||
|
||||
return (ticks * 35) / 1000;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -127,7 +130,10 @@ int I_GetTime (void)
|
|||
void I_Init (void)
|
||||
{
|
||||
I_InitSound();
|
||||
// I_InitGraphics();
|
||||
|
||||
// initialise timer
|
||||
|
||||
SDL_Init(SDL_INIT_TIMER);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -145,23 +151,17 @@ void I_Quit (void)
|
|||
|
||||
void I_WaitVBL(int count)
|
||||
{
|
||||
#ifdef SGI
|
||||
sginap(1);
|
||||
#else
|
||||
#ifdef SUN
|
||||
sleep(0);
|
||||
#else
|
||||
usleep (count * (1000000/70) );
|
||||
#endif
|
||||
#endif
|
||||
SDL_Delay((count * 1000) / 70);
|
||||
}
|
||||
|
||||
void I_BeginRead(void)
|
||||
{
|
||||
// display "reading" disk
|
||||
}
|
||||
|
||||
void I_EndRead(void)
|
||||
{
|
||||
// remove "reading" disk
|
||||
}
|
||||
|
||||
byte* I_AllocLow(int length)
|
||||
|
|
|
|||
Loading…
Reference in a new issue