Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 8550 → Rev 8549

/source/mact/include/_control.h
144,8 → 144,8
 
typedef struct
{
kb_scancode keyPrimary;
kb_scancode keySecondary;
kb_scancode key1;
kb_scancode key2;
} controlkeymaptype;
 
typedef struct
/source/mact/src/control.cpp
140,36 → 140,33
 
int32_t CONTROL_KeyboardFunctionPressed(int32_t which)
{
if (CONTROL_CheckRange(which) || !CONTROL_Flags[which].used)
return FALSE;
int32_t key1 = 0, key2 = 0;
 
int r = 0;
auto &mapped = CONTROL_KeyMapping[which];
if (CONTROL_CheckRange(which)) return FALSE;
 
if (mapped.keyPrimary != KEYUNDEFINED && !CONTROL_KeyBinds[mapped.keyPrimary].cmdstr)
r = !!KB_KeyDown[mapped.keyPrimary];
if (!CONTROL_Flags[which].used) return FALSE;
 
if (mapped.keySecondary != KEYUNDEFINED && !CONTROL_KeyBinds[mapped.keySecondary].cmdstr)
r |= !!KB_KeyDown[mapped.keySecondary];
if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !CONTROL_KeyBinds[CONTROL_KeyMapping[which].key1].cmdstr)
key1 = KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] ? TRUE : FALSE;
 
return r;
if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !CONTROL_KeyBinds[CONTROL_KeyMapping[which].key2].cmdstr)
key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? TRUE : FALSE;
 
return key1 | key2;
}
 
#if 0
void CONTROL_ClearKeyboardFunction(int32_t which)
{
if (CONTROL_CheckRange(which) || !CONTROL_Flags[which].used)
return;
if (CONTROL_CheckRange(which)) return;
 
auto &mapped = CONTROL_KeyMapping[which];
if (!CONTROL_Flags[which].used) return;
 
if (mapped.key1 != KEYUNDEFINED)
KB_KeyDown[mapped.key1] = 0;
if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED)
KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] = 0;
 
if (mapped.key2 != KEYUNDEFINED)
KB_KeyDown[mapped.key2] = 0;
if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED)
KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] = 0;
}
#endif
 
void CONTROL_DefineFlag(int which, int toggle)
{
195,8 → 192,8
{
if (CONTROL_CheckRange(which)) return;
 
CONTROL_KeyMapping[which].keyPrimary = key1 ? key1 : KEYUNDEFINED;
CONTROL_KeyMapping[which].keySecondary = key2 ? key2 : KEYUNDEFINED;
CONTROL_KeyMapping[which].key1 = key1 ? key1 : KEYUNDEFINED;
CONTROL_KeyMapping[which].key2 = key2 ? key2 : KEYUNDEFINED;
}
 
#if 0