Пример #1
0
/* Allows _new_ mappings to be made at runtime */
static bool checkQwertyKeys()
{
	KEY_CODE qKey;
	UDWORD tableEntry;
	bool aquired = false;

	/* Are we trying to make a new map marker? */
	if (keyDown(KEY_LALT))
	{
		/* Did we press a key */
		qKey = getQwertyKey();
		if (qKey)
		{
			tableEntry = asciiKeyCodeToTable(qKey);
			/* We're assigning something to the key */
			debug(LOG_NEVER, "Assigning keymapping to tableEntry: %i", tableEntry);
			if (qwertyKeyMappings[tableEntry].psMapping)
			{
				/* Get rid of the old mapping on this key if there was one */
				keyRemoveMappingPt(qwertyKeyMappings[tableEntry].psMapping);
			}
			/* Now add the new one for this location */
			qwertyKeyMappings[tableEntry].psMapping =
			    keyAddMapping(KEYMAP_ALWAYS, KEY_LSHIFT, qKey, KEYMAP_PRESSED, kf_JumpToMapMarker, "Jump to new map marker");
			aquired = true;

			/* Store away the position and view angle */
			qwertyKeyMappings[tableEntry].xPos = player.p.x;
			qwertyKeyMappings[tableEntry].yPos = player.p.z;
			qwertyKeyMappings[tableEntry].spin = player.r.y;
		}
	}
	return aquired;
}
Пример #2
0
/* Removes a mapping from the list specified by the key codes */
bool	keyRemoveMapping(KEY_CODE metaCode, KEY_CODE subCode)
{
	KEY_MAPPING	*mapping;

	mapping = keyFindMapping(metaCode, subCode);
	return (keyRemoveMappingPt(mapping));
}
Пример #3
0
/* clears the mappings list and frees the memory */
void	keyClearMappings(void)
{
	while (keyMappings)
	{
		keyRemoveMappingPt(keyMappings);
	}
}
Пример #4
0
// ----------------------------------------------------------------------------------
bool	keyReAssignMappingName(char *pName, KEY_CODE newMetaCode, KEY_CODE newSubCode)
{
	KEY_MAPPING	*psMapping;


	psMapping = getKeyMapFromName(pName);
	if (psMapping)
	{
		if (psMapping->status == KEYMAP_ASSIGNABLE)
		{
			(void)keyAddMapping(psMapping->status, newMetaCode,
			                    newSubCode, psMapping->action, psMapping->function, psMapping->pName);
			keyRemoveMappingPt(psMapping);
			return (true);
		}
	}
	return (false);
}