[chocolate-doom] 22/83: Port timer code to SDL
Jonathan Dowland
jmtd at moszumanska.debian.org
Mon Jan 30 15:06:23 UTC 2017
This is an automated email from the git hooks/post-receive script.
jmtd pushed a commit to annotated tag chocolate-doom-0.0.1
in repository chocolate-doom.
commit 0f9690eb41e0aecbc6cee2d6c335b9dfbf0e02bf
Author: Simon Howard <fraggle at gmail.com>
Date: Mon Jul 25 20:41:59 2005 +0000
Port timer code to SDL
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 28
---
TODO | 2 +-
src/i_system.c | 48 ++++++++++++++++++++++++------------------------
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/TODO b/TODO
index 58ff7ed..3ef84cb 100644
--- a/TODO
+++ b/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
diff --git a/src/i_system.c b/src/i_system.c
index 8e237fc..5c7fe23 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -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)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/chocolate-doom.git
More information about the Pkg-games-commits
mailing list