ref: 2c23de27d5006e969106fad672399fafe6464845
parent: 729540d2b8555142e18a8b6ddf650f0525a5d009
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sat Jun 29 17:16:43 EDT 2019
Made KeyControl.cpp ASM-accurate Didn't realise this file was so tiny. Anyway, working towards #74.
--- a/msvc2003/devilution/comparer-config.toml
+++ b/msvc2003/devilution/comparer-config.toml
@@ -560,6 +560,10 @@
addr = 0x411390
[[func]]
+name = "GetTrg"
+addr = 0x4122E0
+
+[[func]]
name = "InitMapData2"
addr = 0x413750
--- a/src/KeyControl.cpp
+++ b/src/KeyControl.cpp
@@ -9,8 +9,10 @@
int gKeyArmsRev = KEY_ARMSREV;
int gKeyItem = KEY_ITEM;
int gKeyMap = KEY_MAP;
+
int gKeyOk = KEY_Z;
int gKeyCancel = KEY_X;
+
int gKeyLeft = KEY_LEFT;
int gKeyUp = KEY_UP;
int gKeyRight = KEY_RIGHT;
@@ -19,6 +21,7 @@
void GetTrg()
{
static int key_old;
- gKeyTrg = gKey & (gKey ^ key_old);
+ gKeyTrg = gKey ^ key_old;
+ gKeyTrg = gKey & gKeyTrg;
key_old = gKey;
}
--- a/src/KeyControl.h
+++ b/src/KeyControl.h
@@ -3,35 +3,35 @@
enum KEYBIND
{
//The movement keys go in the order of left, right, up and down
- KEY_LEFT = 0x00000001,
- KEY_RIGHT = 0x00000002,
- KEY_UP = 0x00000004,
- KEY_DOWN = 0x00000008,
+ KEY_LEFT = 0x00000001,
+ KEY_RIGHT = 0x00000002,
+ KEY_UP = 0x00000004,
+ KEY_DOWN = 0x00000008,
//Map key
- KEY_MAP = 0x00000010,
+ KEY_MAP = 0x00000010,
//Okay and cancel / Jump and Shoot keys
- KEY_X = 0x00000020,
- KEY_Z = 0x00000040,
+ KEY_X = 0x00000020,
+ KEY_Z = 0x00000040,
//Left and right weapon switch keys
- KEY_ARMS = 0x00000080,
- KEY_ARMSREV = 0x00000100,
+ KEY_ARMS = 0x00000080,
+ KEY_ARMSREV = 0x00000100,
//Unused?
- KEY_SHIFT = 0x00000200,
+ KEY_SHIFT = 0x00000200,
//Function keys
- KEY_F1 = 0x00000400,
- KEY_F2 = 0x00000800,
+ KEY_F1 = 0x00000400,
+ KEY_F2 = 0x00000800,
//Inventory
- KEY_ITEM = 0x00001000,
+ KEY_ITEM = 0x00001000,
//Escape key
KEY_ESCAPE = 0x00008000,
//The alt movement keys go in the order of left, up, right and down
- KEY_ALT_LEFT = 0x00010000,
- KEY_ALT_DOWN = 0x00020000,
- KEY_ALT_RIGHT = 0x00040000,
- KEY_ALT_UP = 0x00180000,
- //Alt up actually has 2 seperate keys, but they're kind of merged together (and also for some reason the second one is +/=)
- KEY_L = 0x00080000,
- KEY_PLUS = 0x00100000
+ KEY_ALT_LEFT = 0x00010000,
+ KEY_ALT_DOWN = 0x00020000,
+ KEY_ALT_RIGHT = 0x00040000,
+ KEY_ALT_UP = 0x00180000,
+ //Alt up actually has 2 seperate keys, but they're kind of merged together
+ KEY_L = 0x00080000,
+ KEY_PLUS = 0x00100000
};
extern int gKey;
@@ -43,8 +43,10 @@
extern int gKeyArmsRev;
extern int gKeyItem;
extern int gKeyMap;
+
extern int gKeyOk;
extern int gKeyCancel;
+
extern int gKeyLeft;
extern int gKeyUp;
extern int gKeyRight;