shithub: choc

Download patch

ref: 24c1bf494f6dad82a55ea41d75fa99b48ff04f4e
parent: e4ee3ece6a3297a1a6c6d4b74ec8538ad473f05a
author: Simon Howard <fraggle@gmail.com>
date: Wed Aug 10 04:45:35 EDT 2005

Remove "if (french)" stuff, FRENCH define, detect french wad automatically

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 51

--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: hu_stuff.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: hu_stuff.c 51 2005-08-10 08:45:35Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.3  2005/08/10 08:45:35  fraggle
+// Remove "if (french)" stuff, FRENCH define, detect french wad automatically
+//
 // Revision 1.2  2005/07/23 16:44:55  fraggle
 // Update copyright to GNU GPL
 //
@@ -34,7 +37,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: hu_stuff.c 8 2005-07-23 16:44:57Z fraggle $";
+rcsid[] = "$Id: hu_stuff.c 51 2005-08-10 08:45:35Z fraggle $";
 
 #include <ctype.h>
 
@@ -296,112 +299,6 @@
 };
 
 
-const char*	shiftxform;
-
-const char french_shiftxform[] =
-{
-    0,
-    1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
-    11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
-    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
-    31,
-    ' ', '!', '"', '#', '$', '%', '&',
-    '"', // shift-'
-    '(', ')', '*', '+',
-    '?', // shift-,
-    '_', // shift--
-    '>', // shift-.
-    '?', // shift-/
-    '0', // shift-0
-    '1', // shift-1
-    '2', // shift-2
-    '3', // shift-3
-    '4', // shift-4
-    '5', // shift-5
-    '6', // shift-6
-    '7', // shift-7
-    '8', // shift-8
-    '9', // shift-9
-    '/',
-    '.', // shift-;
-    '<',
-    '+', // shift-=
-    '>', '?', '@',
-    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
-    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-    '[', // shift-[
-    '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
-    ']', // shift-]
-    '"', '_',
-    '\'', // shift-`
-    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
-    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-    '{', '|', '}', '~', 127
-
-};
-
-const char english_shiftxform[] =
-{
-
-    0,
-    1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
-    11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
-    21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
-    31,
-    ' ', '!', '"', '#', '$', '%', '&',
-    '"', // shift-'
-    '(', ')', '*', '+',
-    '<', // shift-,
-    '_', // shift--
-    '>', // shift-.
-    '?', // shift-/
-    ')', // shift-0
-    '!', // shift-1
-    '@', // shift-2
-    '#', // shift-3
-    '$', // shift-4
-    '%', // shift-5
-    '^', // shift-6
-    '&', // shift-7
-    '*', // shift-8
-    '(', // shift-9
-    ':',
-    ':', // shift-;
-    '<',
-    '+', // shift-=
-    '>', '?', '@',
-    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
-    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-    '[', // shift-[
-    '!', // shift-backslash - OH MY GOD DOES WATCOM SUCK
-    ']', // shift-]
-    '"', '_',
-    '\'', // shift-`
-    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
-    'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
-    '{', '|', '}', '~', 127
-};
-
-char frenchKeyMap[128]=
-{
-    0,
-    1,2,3,4,5,6,7,8,9,10,
-    11,12,13,14,15,16,17,18,19,20,
-    21,22,23,24,25,26,27,28,29,30,
-    31,
-    ' ','!','"','#','$','%','&','%','(',')','*','+',';','-',':','!',
-    '0','1','2','3','4','5','6','7','8','9',':','M','<','=','>','?',
-    '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
-    'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^','_',
-    '@','Q','B','C','D','E','F','G','H','I','J','K','L',',','N','O',
-    'P','A','R','S','T','U','V','Z','X','Y','W','^','\\','$','^',127
-};
-
-char ForeignTranslation(unsigned char ch)
-{
-    return ch < 128 ? frenchKeyMap[ch] : ch;
-}
-
 void HU_Init(void)
 {
 
@@ -409,11 +306,6 @@
     int		j;
     char	buffer[9];
 
-    if (french)
-	shiftxform = french_shiftxform;
-    else
-	shiftxform = english_shiftxform;
-
     // load the heads-up font
     j = HU_FONTSTART;
     for (i=0;i<HU_FONTSIZE;i++)
@@ -559,8 +451,6 @@
 		    chat_dest[i] = c;
 		else
 		{
-		    if (c >= 'a' && c <= 'z')
-			c = (char) shiftxform[(unsigned char) c];
 		    rc = HUlib_keyInIText(&w_inputbuffer[i], c);
 		    if (rc && c == KEY_ENTER)
 		    {
@@ -714,7 +604,7 @@
     }
     else
     {
-	c = ev->data1;
+	c = ev->data2;
 	// send a macro
 	if (altdown)
 	{
@@ -740,10 +630,6 @@
 	}
 	else
 	{
-	    if (french)
-		c = ForeignTranslation(c);
-	    if (shiftdown || (c >= 'a' && c <= 'z'))
-		c = shiftxform[c];
 	    eatkey = HUlib_keyInIText(&w_chat, c);
 	    if (eatkey)
 	    {
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 49 2005-08-07 20:01:00Z fraggle $
+// $Id: i_video.c 51 2005-08-10 08:45:35Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.18  2005/08/10 08:45:35  fraggle
+// Remove "if (french)" stuff, FRENCH define, detect french wad automatically
+//
 // Revision 1.17  2005/08/07 20:01:00  fraggle
 // Clear the screen on startup
 //
@@ -84,7 +87,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 49 2005-08-07 20:01:00Z fraggle $";
+rcsid[] = "$Id: i_video.c 51 2005-08-10 08:45:35Z fraggle $";
 
 #include <ctype.h>
 #include <SDL.h>
@@ -330,6 +333,7 @@
             case SDL_KEYDOWN:
                 event.type = ev_keydown;
                 event.data1 = xlatekey(&sdlevent.key.keysym);
+		event.data2 = sdlevent.key.keysym.unicode;
                 D_PostEvent(&event);
                 break;
             case SDL_KEYUP:
@@ -681,15 +685,17 @@
         I_Error("Error setting video mode: %s\n", SDL_GetError());
     }
 
+    SDL_ShowCursor(0);
+    SDL_WM_GrabInput(SDL_GRAB_ON);
+
     if (multiply == 1)
 	screens[0] = (unsigned char *) (screen->pixels);
     else
 	screens[0] = (unsigned char *) Z_Malloc (SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
 
-    SDL_ShowCursor(0);
-    SDL_WM_GrabInput(SDL_GRAB_ON);
-
     LoadDiskImage();
+
+    SDL_EnableUNICODE(1);
 
     // start with a clear black screen
 
--- a/src/wi_stuff.c
+++ b/src/wi_stuff.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: wi_stuff.c 8 2005-07-23 16:44:57Z fraggle $
+// $Id: wi_stuff.c 51 2005-08-10 08:45:35Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.3  2005/08/10 08:45:35  fraggle
+// Remove "if (french)" stuff, FRENCH define, detect french wad automatically
+//
 // Revision 1.2  2005/07/23 16:44:57  fraggle
 // Update copyright to GNU GPL
 //
@@ -35,7 +38,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: wi_stuff.c 8 2005-07-23 16:44:57Z fraggle $";
+rcsid[] = "$Id: wi_stuff.c 51 2005-08-10 08:45:35Z fraggle $";
 
 #include <stdio.h>
 
@@ -1664,16 +1667,17 @@
      // "secret"
     sp_secret = W_CacheLumpName("WISCRT2", PU_STATIC);
 
-    // Yuck. 
-    if (french)
+    // french wad uses WIOBJ (?)
+    if (W_CheckNumForName("WIOBJ") >= 0)
     {
-	// "items"
-	if (netgame && !deathmatch)
-	    items = W_CacheLumpName("WIOBJ", PU_STATIC);    
-  	else
-	    items = W_CacheLumpName("WIOSTI", PU_STATIC);
-    } else
+    	// "items"
+    	if (netgame && !deathmatch)
+            items = W_CacheLumpName("WIOBJ", PU_STATIC);    
+    	else
+            items = W_CacheLumpName("WIOSTI", PU_STATIC);
+    } else {
 	items = W_CacheLumpName("WIOSTI", PU_STATIC);
+    }
 
     // "frgs"
     frags = W_CacheLumpName("WIFRGS", PU_STATIC);