foxygit / doom Log in
commit 059c2fc6bbf2957b98fb20fbee2cc14a26f443f6
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Feb 9 19:17:19 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Feb 9 19:17:19 2008 +0000

    Remove some unneeded functions from i_system.c. Make I_Error exit using
    exit() rather than abort(). Display a message box with the error on
    Windows.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 1065
---
 src/g_game.c   |  8 ++-----
 src/i_system.c | 71 +++++++++++++++++++++++++++++-----------------------------
 src/v_video.c  |  6 ++++-
 3 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/src/g_game.c b/src/g_game.c
index d2daebf6..90f707ef 100644
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -389,15 +389,11 @@ void G_BuildTiccmd (ticcmd_t* cmd)
     int		tspeed;
     int		forward;
     int		side;
-
-    ticcmd_t*	base;

-    base = I_BaseTiccmd ();		// empty, or external driver
-    memcpy (cmd,base,sizeof(*cmd));
-
+    memset(cmd, 0, sizeof(ticcmd_t));
+
     cmd->consistancy =
 	consistancy[consoleplayer][maketic%BACKUPTICS];
-

     strafe = gamekeydown[key_strafe] || mousebuttons[mousebstrafe]
 	|| joybuttons[joybstrafe];
diff --git a/src/i_system.c b/src/i_system.c
index 13a68ee0..0f2841c9 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -31,6 +31,10 @@

 #include <stdarg.h>

+#ifdef _WIN32
+#include <windows.h>
+#endif
+
 #include "deh_main.h"
 #include "doomdef.h"
 #include "doomstat.h"
@@ -51,27 +55,15 @@
 #include "w_wad.h"
 #include "z_zone.h"

+int mb_used = 16;
+int show_endoom = 1;

-int	mb_used = 16;
-int     show_endoom = 1;
-
-void
-I_Tactile
-( int	on,
-  int	off,
-  int	total )
-{
-  // UNUSED.
-  on = off = total = 0;
-}
+// Tactile feedback function, probably used for the Logitech Cyberman

-ticcmd_t	emptycmd;
-ticcmd_t*	I_BaseTiccmd(void)
+void I_Tactile(int on, int off, int total)
 {
-    return &emptycmd;
 }

-
 int  I_GetHeapSize (void)
 {
     int p;
@@ -107,7 +99,6 @@ byte *I_ZoneBase (int *size)
 }


-
 //
 // I_Init
 //
@@ -165,6 +156,7 @@ void I_Endoom(void)
 //
 // I_Quit
 //
+
 void I_Quit (void)
 {
     D_QuitNetGame ();
@@ -191,16 +183,6 @@ void I_WaitVBL(int count)
     I_Sleep((count * 1000) / 70);
 }

-byte*	I_AllocLow(int length)
-{
-    byte*	mem;
-
-    mem = (byte *)malloc (length);
-    memset (mem,0,length);
-    return mem;
-}
-
-
 //
 // I_Error
 //
@@ -223,21 +205,40 @@ void I_Error (char *error, ...)
     }

     // Message first.
-    va_start (argptr,error);
-    fprintf (stderr, "Error: ");
-    vfprintf (stderr,error,argptr);
-    fprintf (stderr, "\n");
-    va_end (argptr);
-
-    fflush( stderr );
+    va_start(argptr, error);
+    fprintf(stderr, "Error: ");
+    vfprintf(stderr, error, argptr);
+    fprintf(stderr, "\n");
+    va_end(argptr);
+    fflush(stderr);

     // Shutdown. Here might be other errors.
+
     if (demorecording)
+    {
 	G_CheckDemoStatus();
+    }

     D_QuitNetGame ();
     I_ShutdownGraphics();
+    S_Shutdown();

-    abort();
+#ifdef _WIN32
+    // On Windows, pop up a dialog box with the error message.
+    {
+        char msgbuf[512];
+
+        va_start(argptr, error);
+        memset(msgbuf, 0, sizeof(msgbuf));
+        vsnprintf(msgbuf, sizeof(msgbuf) - 1, error, argptr);
+        va_end(argptr);
+
+        MessageBox(NULL, msgbuf, "Error", MB_OK);
+    }
+#endif
+
+    // abort();
+
+    exit(-1);
 }

diff --git a/src/v_video.c b/src/v_video.c
index 3c6a2311..a4a556bf 100644
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -40,6 +40,7 @@

 #include "v_video.h"

+#include "z_zone.h"

 // Each screen is [SCREENWIDTH*SCREENHEIGHT];
 byte*				screens[5];
@@ -484,8 +485,11 @@ void V_Init (void)

     // stick these in low dos memory on PCs

-    base = I_AllocLow (SCREENWIDTH*SCREENHEIGHT*4);
+    base = Z_Malloc(SCREENWIDTH * SCREENHEIGHT * 4, PU_STATIC, NULL);

     for (i=0 ; i<4 ; i++)
+    {
 	screens[i] = base + i*SCREENWIDTH*SCREENHEIGHT;
+    }
 }
+