shithub: choc

Download patch

ref: 3771126689527293eb4ad658b338d7910bf79012
parent: 42454af827d204444874558ccb340fc6e65f9ac1
author: Simon Howard <[email protected]>
date: Mon Oct 26 15:28:12 EDT 2009

Initial hacks for compiling under SDL 1.3.

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

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -334,7 +334,9 @@
 
       case SDLK_PAUSE:	return KEY_PAUSE;
 
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
       case SDLK_EQUALS: return KEY_EQUALS;
+#endif
 
       case SDLK_MINUS:          return KEY_MINUS;
 
@@ -347,9 +349,11 @@
 	return KEY_RCTRL;
 	
       case SDLK_LALT:
-      case SDLK_LMETA:
       case SDLK_RALT:
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
+      case SDLK_LMETA:
       case SDLK_RMETA:
+#endif
         return KEY_RALT;
 
       case SDLK_CAPSLOCK: return KEY_CAPSLOCK;
@@ -420,9 +424,15 @@
 
 static int MouseButtonState(void)
 {
-    Uint8 state = SDL_GetMouseState(NULL, NULL);
+    Uint8 state;
     int result = 0;
 
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+    state = SDL_GetMouseState(0, NULL, NULL);
+#else
+    state = SDL_GetMouseState(NULL, NULL);
+#endif
+
     // Note: button "0" is left, button "1" is right,
     // button "2" is middle for Doom.  This is different
     // to how SDL sees things.
@@ -585,7 +595,11 @@
     // Clear any relative movement caused by warping
 
     SDL_PumpEvents();
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+    SDL_GetRelativeMouseState(0, NULL, NULL);
+#else
     SDL_GetRelativeMouseState(NULL, NULL);
+#endif
 }
 
 //
@@ -599,7 +613,11 @@
     int x, y;
     event_t ev;
 
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+    SDL_GetRelativeMouseState(0, &x, &y);
+#else
     SDL_GetRelativeMouseState(&x, &y);
+#endif
 
     if (x != 0 || y != 0) 
     {
@@ -1553,7 +1571,9 @@
     // has to be done before the call to SDL_SetVideoMode.
 
     I_SetWindowCaption();
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
     I_SetWindowIcon();
+#endif
 
     // Set the video mode.
 
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -285,7 +285,11 @@
 
 void TXT_GetMousePosition(int *x, int *y)
 {
+#if SDL_VERSION_ATLEAST(1, 3, 0)
+    SDL_GetMouseState(0, x, y);
+#else
     SDL_GetMouseState(x, y);
+#endif
 
     *x /= font->w;
     *y /= font->h;
@@ -324,7 +328,9 @@
 
         case SDLK_PAUSE:       return KEY_PAUSE;
 
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
         case SDLK_EQUALS:      return KEY_EQUALS;
+#endif
 
         case SDLK_LSHIFT:
         case SDLK_RSHIFT:
@@ -335,9 +341,11 @@
                                return KEY_RCTRL;
 
         case SDLK_LALT:
-        case SDLK_LMETA:
         case SDLK_RALT:
+#if !SDL_VERSION_ATLEAST(1, 3, 0)
+        case SDLK_LMETA:
         case SDLK_RMETA:
+#endif
                                return KEY_RALT;
 
         case SDLK_CAPSLOCK:    return KEY_CAPSLOCK;