View Issue Details

IDProjectCategoryView StatusLast Update
0002611FSSCPSEXPspublic2012-02-29 06:07
Reporterkarajorma Assigned Tokarajorma  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.2 
Target Version3.7.2 
Summary0002611: Ignore-Key SEXP doesn't work for joysticks or mouse
DescriptionYou currently can get around the restictions of the ignore-key SEXP by simply assigning the ignored key to a joystick or mouse button. This patch should fix that.
TagsNo tags attached.

Activities

karajorma

2012-02-23 05:13

administrator  

Improved-Ignore-Key.patch (881 bytes)   
Index: controlsconfig.cpp
===================================================================
--- controlsconfig.cpp	(revision 8529)
+++ controlsconfig.cpp	(working copy)
@@ -2100,7 +2100,7 @@
 	Control_check_count = 0;
 }
 
-int check_control(int id, int key)
+int check_control_used(int id, int key)
 {
 	int z, mask;
 	static int last_key = 0;
@@ -2171,6 +2171,24 @@
 	return 0;
 }
 
+/**
+* Wrapper for check_control_used. Allows the game to ignore the key if told to do so by the ignore-key SEXP.
+*/
+int check_control(int id, int key) 
+{
+	if (check_control_used(id, key)) {
+		if (Ignored_keys[id]) {
+			if (Ignored_keys[id] > 0) {
+				Ignored_keys[id]--;
+			}
+			return 0;
+		}
+		return 1;
+	}
+
+	return 0;
+}
+
 // get heading, pitch, bank, throttle abs. and throttle rel. values.
 void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr)
 {
Improved-Ignore-Key.patch (881 bytes)   

Issue History

Date Modified Username Field Change
2012-02-23 05:13 karajorma New Issue
2012-02-23 05:13 karajorma Status new => assigned
2012-02-23 05:13 karajorma Assigned To => karajorma
2012-02-23 05:13 karajorma File Added: Improved-Ignore-Key.patch
2012-02-23 05:14 karajorma Status assigned => code review
2012-02-29 06:07 karajorma Status code review => resolved
2012-02-29 06:07 karajorma Resolution open => fixed