use timer_delay instead of d_delay
authorBradley Bell <btb@icculus.org>
Thu, 27 Feb 2003 22:07:21 +0000 (22:07 +0000)
committerBradley Bell <btb@icculus.org>
Thu, 27 Feb 2003 22:07:21 +0000 (22:07 +0000)
12 files changed:
ChangeLog
arch/ggi/key.c
arch/sdl/key.c
arch/svgalib/key.c
include/d_delay.h [deleted file]
main/automap.c
main/game.c
main/kconfig.c
main/multi.c
main/newdemo.c
misc/Makefile.am
misc/d_delay.c [deleted file]

index 9a94cbd..525a713 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-02-27  Bradley Bell  <btb@icculus.org>
+
+       * arch/ggi/key.c, arch/sdl/key.c, arch/svgalib/key.c,
+       include/d_delay.h, main/automap.c, main/game.c, main/kconfig.c,
+       main/multi.c, main/newdemo.c, misc/Makefile.am, misc/d_delay.c:
+       use timer_delay instead of d_delay
+
 2003-02-27  Martin Schaffner <maschaffner@gmx.ch>
 
        * main/render.c: added replacement qsort for solaris
index 5985d59..fb4845d 100644 (file)
@@ -1,12 +1,15 @@
 /*
  * $Source: /cvs/cvsroot/d2x/arch/ggi/key.c,v $
- * $Revision: 1.1 $
- * $Author: bradleyb $
- * $Date: 2001-10-24 09:25:05 $
+ * $Revision: 1.2 $
+ * $Author: btb $
+ * $Date: 2003-02-27 22:07:21 $
  *
  * GGI keyboard input support
  *
  * $Log: not supported by cvs2svn $
+ * Revision 1.1  2001/10/24 09:25:05  bradleyb
+ * Moved input stuff to arch subdirs, as in d1x.
+ *
  * Revision 1.3  2001/01/29 14:03:57  bradleyb
  * Fixed build, minor fixes
  *
@@ -27,9 +30,6 @@
 #include "timer.h"
 #include "mono.h"
 
-//added on 9/3/98 by Matt Mueller to free some cpu instead of hogging during menus and such
-#include "d_delay.h"
-//end this section addition - Matt Mueller
 
 #define KEY_BUFFER_SIZE 16
 
@@ -382,7 +382,7 @@ int key_inkey()
                key_data.keyhead = add_one(key_data.keyhead);
        }
 //added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such
-//     else d_delay(1);
+//     else timer_delay(1);
 //end addition - Matt Mueller
         return key;
 }
index 088437c..de8a654 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: key.c,v 1.2 2003-01-15 02:42:41 btb Exp $ */
+/* $Id: key.c,v 1.3 2003-02-27 22:07:21 btb Exp $ */
 /*
  *
  * SDL keyboard input support
@@ -20,9 +20,6 @@
 #include "key.h"
 #include "timer.h"
 
-//added on 9/3/98 by Matt Mueller to free some cpu instead of hogging during menus and such
-#include "d_delay.h"
-//end this section addition - Matt Mueller
 
 #define KEY_BUFFER_SIZE 16
 
@@ -515,7 +512,7 @@ int key_inkey()
                key_data.keyhead = add_one(key_data.keyhead);
        }
 //added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such
-       else d_delay(1);
+       else timer_delay(1);
 //end addition - Matt Mueller
             
         return key;
index 572e354..8206c01 100644 (file)
@@ -1,12 +1,15 @@
 /*
  * $Source: /cvs/cvsroot/d2x/arch/svgalib/key.c,v $
- * $Revision: 1.1 $
- * $Author: bradleyb $
- * $Date: 2001-10-24 09:25:05 $
+ * $Revision: 1.2 $
+ * $Author: btb $
+ * $Date: 2003-02-27 22:07:21 $
  *
  * SVGALib keyboard input support
  *
  * $Log: not supported by cvs2svn $
+ * Revision 1.1  2001/10/24 09:25:05  bradleyb
+ * Moved input stuff to arch subdirs, as in d1x.
+ *
  * Revision 1.2  2001/01/29 14:03:57  bradleyb
  * Fixed build, minor fixes
  *
@@ -26,9 +29,6 @@
 #include "key.h"
 #include "timer.h"
 
-//added on 9/3/98 by Matt Mueller to free some cpu instead of hogging during menus and such
-#include "d_delay.h"
-//end this section addition - Matt Mueller
 
 #define KEY_BUFFER_SIZE 16
 
@@ -269,7 +269,7 @@ int key_inkey()
                key_data.keyhead = add_one(key_data.keyhead);
        }
 //added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such
-//     else d_delay(1);
+//     else timer_delay(1);
 //end addition - Matt Mueller
         return key;
 }
diff --git a/include/d_delay.h b/include/d_delay.h
deleted file mode 100644 (file)
index fda286c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-//added on 9/2/98 by Matt Mueller
-
-#ifndef _D_DELAY
-#define _D_DELAY
-
-void d_delay (int ms);
-
-#endif
index 9e74ffd..6ebd872 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: automap.c,v 1.6 2002-08-06 09:30:24 btb Exp $ */
+/* $Id: automap.c,v 1.7 2003-02-27 22:07:21 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -75,7 +75,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "switch.h"
 #include "automap.h"
 #include "cntrlcen.h"
-#include "d_delay.h"
 
 #if defined(POLY_ACC)
 #include "poly_acc.h"
index d05e803..b801f59 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: game.c,v 1.16 2002-10-03 03:46:34 btb Exp $ */
+/* $Id: game.c,v 1.17 2003-02-27 22:07:21 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -17,7 +17,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-char game_rcsid[] = "$Id: game.c,v 1.16 2002-10-03 03:46:34 btb Exp $";
+char game_rcsid[] = "$Id: game.c,v 1.17 2003-02-27 22:07:21 btb Exp $";
 #endif
 
 #ifdef WINDOWS
@@ -117,7 +117,6 @@ char game_rcsid[] = "$Id: game.c,v 1.16 2002-10-03 03:46:34 btb Exp $";
 #include "robot.h"
 #include "playsave.h"
 #include "fix.h"
-#include "d_delay.h"
 #include "hudmsg.h"
 
 int VGA_current_mode;
@@ -1210,10 +1209,9 @@ void calc_frame_time()
        do {
            timer_value = timer_get_fixed_seconds();
            FrameTime = timer_value - last_timer_value;
+               Assert(FrameTime > 0);
            if (FrameTime < f1_0/max_fps);
-           {
-               d_delay(1);
-           }
+                       timer_delay(1);
        } while (FrameTime < f1_0/max_fps);
 
        #if defined(TIMER_TEST) && !defined(NDEBUG)
index 2fa8f9b..f32127a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kconfig.c,v 1.16 2003-02-27 04:28:18 btb Exp $ */
+/* $Id: kconfig.c,v 1.17 2003-02-27 22:07:21 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -346,7 +346,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  */
 
 #ifdef RCS
-static char rcsid[] = "$Id: kconfig.c,v 1.16 2003-02-27 04:28:18 btb Exp $";
+static char rcsid[] = "$Id: kconfig.c,v 1.17 2003-02-27 22:07:21 btb Exp $";
 #endif
 
 #ifdef WINDOWS
@@ -398,7 +398,6 @@ static char rcsid[] = "$Id: kconfig.c,v 1.16 2003-02-27 04:28:18 btb Exp $";
 #include "poly_acc.h"
 #endif
 
-#include "d_delay.h"
 #include "collide.h"
 
 #ifdef __unix__
@@ -1672,7 +1671,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
 //             if ( Game_mode & GM_MULTI )
 //                     GameLoop( 0, 0 );                               // Continue
                k = key_inkey();
-               d_delay(10);
+               timer_delay(f0_1/10);
                kc_drawquestion( item );
        
                for (i=0; i<256; i++ )  {
@@ -1741,7 +1740,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
 //             if ( Game_mode & GM_MULTI )
 //                     GameLoop( 0, 0 );                               // Continue
                k = key_inkey();
-               d_delay(10);
+               timer_delay(f0_1/10);
 
                if (k == KEY_PRINT_SCREEN)
                        save_screen_shot(0);
@@ -1830,7 +1829,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
 //             if ( Game_mode & GM_MULTI )
 //                     GameLoop( 0, 0 );                               // Continue
                k = key_inkey();
-               d_delay(10);
+               timer_delay(f0_1/10);
 
                if (k == KEY_PRINT_SCREEN)
                        save_screen_shot(0);
@@ -1907,7 +1906,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
 //             if ( Game_mode & GM_MULTI )
 //                     GameLoop( 0, 0 );                               // Continue
                k = key_inkey();
-               d_delay(10);
+               timer_delay(f0_1/10);
 
                if (k == KEY_PRINT_SCREEN)
                        save_screen_shot(0);
@@ -1995,7 +1994,7 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
 //             if ( Game_mode & GM_MULTI )
 //                     GameLoop( 0, 0 );                               // Continue
                k = key_inkey();
-               d_delay(10);
+               timer_delay(f0_1/10);
 
                if (k == KEY_PRINT_SCREEN)
                        save_screen_shot(0);
index 4944870..218ae1e 100644 (file)
@@ -13,13 +13,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 
 /*
  * $Source: /cvs/cvsroot/d2x/main/multi.c,v $
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
  * $Author: btb $
- * $Date: 2002-12-31 23:19:42 $
+ * $Date: 2003-02-27 22:07:21 $
  *
  * FIXME: put description here
  *
  * $Log: not supported by cvs2svn $
+ * Revision 1.7  2002/12/31 23:19:42  btb
+ * comments/whitespace
+ *
  * Revision 1.6  2002/08/30 01:01:18  btb
  * more networking fixes
  *
@@ -81,7 +84,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "byteswap.h"
 #include "sounds.h"
 #include "args.h"
-#include "d_delay.h"
 #include "cfile.h"
 #include "effects.h"
 
@@ -1063,8 +1065,7 @@ multi_menu_poll(void)
 
        multi_in_menu--;
 
-//     timer_delay(f1_0/10);   changed by allender for portability
-       d_delay(100);                           // delay 100 milliseconds
+       timer_delay(f1_0/10);   // delay 100 milliseconds
                
        if (Endlevel_sequence || (Control_center_destroyed && !was_fuelcen_alive) || (Player_is_dead != player_was_dead) || (Players[Player_num].shields < old_shields))
        {
index 6ca68dc..47a0214 100644 (file)
@@ -84,7 +84,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #include "piggy.h"
 #include "controls.h"
 #include "d_io.h"
-#include "d_delay.h"
+#include "timer.h"
 
 #include "findfile.h"
 
@@ -3329,47 +3329,41 @@ void nd_render_extras (ubyte which,object *obj)
  } 
 
 void DoJasonInterpolate (fix recorded_time)
- {
-  int the_delay;
-  float MyRecFrameTime,ThisFrameTime;
+{
+       fix the_delay;
 
-  JasonPlaybackTotal+=FrameTime;
-         
-  if (!First_time_playback)
-    {
-     // get the difference between the recorded time and the playback time
-     
-          MyRecFrameTime=f2fl(recorded_time); 
-      ThisFrameTime=f2fl(FrameTime);
-  
-          the_delay=((MyRecFrameTime-ThisFrameTime)*1000.0);       
-          //mprintf ((0,"The delay=%d\n",the_delay));
-               if (the_delay>=0)
-                 {
-             stop_time();
-                  d_delay (the_delay);
-                  start_time();
-            }
+       JasonPlaybackTotal+=FrameTime;
+
+       if (!First_time_playback)
+       {
+               // get the difference between the recorded time and the playback time
+               the_delay=(recorded_time - FrameTime);
+               //mprintf ((0,"The delay=%d\n", f2i(the_delay)));
+               if (the_delay >= f0_0)
+               {
+                       stop_time();
+                       timer_delay(the_delay);
+                       start_time();
+               }
                else
-                {
-                       while (JasonPlaybackTotal > nd_recorded_total) 
-                       if (newdemo_read_frame_information() == -1) 
-                        {
-                                        newdemo_stop_playback();
-                                        return;
-                                }
-                               
-               //      the_delay=(f2fl(nd_recorded_total-JasonPlaybackTotal))*1000.0;
-                       //if (delay>0)
-               //              delay (the_delay);
-                }
+               {
+                       while (JasonPlaybackTotal > nd_recorded_total)
+                               if (newdemo_read_frame_information() == -1)
+                               {
+                                       newdemo_stop_playback();
+                                       return;
+                               }
+
+                       //the_delay = nd_recorded_total - JasonPlaybackTotal;
+                       //if (the_delay > f0_0)
+                       //      timer_delay(the_delay);
+               }
+
+       }
+
+       First_time_playback=0;
+}
 
-        }
-  
-  First_time_playback=0;    
- }
-   
 #ifdef MACINTOSH
 #pragma global_optimizer reset
 #endif
index 2664aa3..b3b65db 100644 (file)
@@ -2,7 +2,7 @@ noinst_LIBRARIES = libmisc.a
 INCLUDES = -I $(top_srcdir)/include
 
 libmisc_a_SOURCES = \
-args.c     d_delay.c  error.c    strio.c \
+args.c      error.c    strio.c \
 d_io.c      hash.c     strutil.c  fileutil.c
 
 # checker.c
diff --git a/misc/d_delay.c b/misc/d_delay.c
deleted file mode 100644 (file)
index 56c1f74..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $Id: d_delay.c,v 1.5 2003-02-18 20:35:35 btb Exp $ */
-/*
- * added on 9/2/98 by Matt Mueller
- */
-
-#ifdef HAVE_CONFIG_H
-#include <conf.h>
-#endif
-
-#include "d_delay.h"
-
-#ifndef d_delay
-
-#if defined(__WINDOWS__) || defined(__MINGW32__)
-
-#include <windows.h>
-
-void d_delay (int ms) {
- Sleep(ms);
-}
-
-#else
-
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <time.h>
-
-void d_delay (int ms) {
-#if 0
-       struct timeval tv;
-       tv.tv_sec=ms/1000;
-//edited 02/06/99 Matt Mueller - microseconds, not milliseconds
-        tv.tv_usec=(ms%1000)*1000;
-//end edit -MM
-       select(0,NULL,NULL,NULL,&tv);
-#elif 0
-       struct timespec tv;
-       tv.tv_sec=ms/1000;
-       tv.tv_nsec=(ms%1000)*1000000;//nanoseconds
-       nanosleep(&tv,NULL);
-#else
-       usleep(ms*1000);
-#endif
-}
-
-#endif
-#endif