summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2005-10-15 15:59:14 +0000
committerSimon Howard2005-10-15 15:59:14 +0000
commit02a491c087794f1e170adc3eadcc9375c8d7be29 (patch)
tree661a297437ac7ee09098bf7d9456a60068bc441d
parent506138915bb4655caa2f87ba3e3316aba5a37ef7 (diff)
downloadchocolate-doom-02a491c087794f1e170adc3eadcc9375c8d7be29.tar.gz
chocolate-doom-02a491c087794f1e170adc3eadcc9375c8d7be29.tar.bz2
chocolate-doom-02a491c087794f1e170adc3eadcc9375c8d7be29.zip
Map mouse buttons correctly.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 195
-rw-r--r--NEWS1
-rw-r--r--src/i_video.c15
2 files changed, 12 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index f6acd648..d7e1d769 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@
* Doom 1 skies always using Episode 1 sky
* Crash when switching applications while running fullscreen
* Lost soul bounce logic (do not bounce in Registered/Shareware)
+ * Mouse buttons mapped incorrectly (button 1 is right, 2 is middle)
0.1.0 (2005-10-09):
Dehacked support
diff --git a/src/i_video.c b/src/i_video.c
index 62e9c4f2..d6acc879 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: i_video.c 193 2005-10-15 15:45:03Z fraggle $
+// $Id: i_video.c 195 2005-10-15 15:59:14Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
// 02111-1307, USA.
//
// $Log$
+// Revision 1.37 2005/10/15 15:59:14 fraggle
+// Map mouse buttons correctly.
+//
// Revision 1.36 2005/10/15 15:45:03 fraggle
// Check the return code from SDL_LockSurface to ensure a surface has been
// properly locked. Fixes crash when switching applications while running
@@ -152,7 +155,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: i_video.c 193 2005-10-15 15:45:03Z fraggle $";
+rcsid[] = "$Id: i_video.c 195 2005-10-15 15:59:14Z fraggle $";
#include <SDL.h>
#include <ctype.h>
@@ -406,11 +409,15 @@ static int MouseButtonState(void)
Uint8 state = SDL_GetMouseState(NULL, NULL);
int result = 0;
+ // Note: button "0" is left, button "1" is right,
+ // button "2" is middle for Doom. This is different
+ // to how SDL sees things.
+
if (state & SDL_BUTTON(1))
result |= 1;
- if (state & SDL_BUTTON(2))
- result |= 2;
if (state & SDL_BUTTON(3))
+ result |= 2;
+ if (state & SDL_BUTTON(2))
result |= 4;
return result;