shithub: choc

Download patch

ref: 059c2fc6bbf2957b98fb20fbee2cc14a26f443f6
parent: 57eeaf1d3a8a0fd090e2ccfc37d05131222ec37c
author: Simon Howard <[email protected]>
date: Sat Feb 9 14:17:19 EST 2008

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

--- a/src/g_game.c
+++ b/src/g_game.c
@@ -389,15 +389,11 @@
     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]; 
--- 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;
+// Tactile feedback function, probably used for the Logitech Cyberman
 
-void
-I_Tactile
-( int	on,
-  int	off,
-  int	total )
+void I_Tactile(int on, int off, int total)
 {
-  // UNUSED.
-  on = off = total = 0;
 }
 
-ticcmd_t	emptycmd;
-ticcmd_t*	I_BaseTiccmd(void)
-{
-    return &emptycmd;
-}
-
-
 int  I_GetHeapSize (void)
 {
     int p;
@@ -107,7 +99,6 @@
 }
 
 
-
 //
 // I_Init
 //
@@ -165,6 +156,7 @@
 //
 // I_Quit
 //
+
 void I_Quit (void)
 {
     D_QuitNetGame ();
@@ -191,16 +183,6 @@
     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 @@
     }
     
     // Message first.
-    va_start (argptr,error);
-    fprintf (stderr, "Error: ");
-    vfprintf (stderr,error,argptr);
-    fprintf (stderr, "\n");
-    va_end (argptr);
+    va_start(argptr, error);
+    fprintf(stderr, "Error: ");
+    vfprintf(stderr, error, argptr);
+    fprintf(stderr, "\n");
+    va_end(argptr);
+    fflush(stderr);
 
-    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);
 }
 
--- 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 @@
 		
     // 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;
+    }
 }
+