Skip to content

Commit c0561af

Browse files
committed
Update actionMap.cpp
1 parent e8a9368 commit c0561af

1 file changed

Lines changed: 42 additions & 10 deletions

File tree

Engine/source/sim/actionMap.cpp

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,47 @@ bool ActionMap::createEventDescriptor(const char* pEventString, EventDescriptor*
521521
//
522522
AssertFatal(dStrlen(pObjectString) != 0, "Error, no key was specified!");
523523

524+
// rebuild normalized modifier string from parsed flags
525+
String newString;
526+
527+
#if defined(TORQUE_OS_MAC)
528+
529+
if (pDescriptor->flags & SI_ALT)
530+
newString += "Cmd";
531+
532+
if (pDescriptor->flags & SI_MAC_OPT)
533+
{
534+
if (newString.length()) newString += "-";
535+
newString += "Opt";
536+
}
537+
538+
#else
539+
540+
if (pDescriptor->flags & SI_CTRL)
541+
newString += "Ctrl";
542+
543+
if (pDescriptor->flags & SI_ALT)
544+
{
545+
if (newString.length()) newString += "-";
546+
newString += "Alt";
547+
}
548+
549+
#endif
550+
551+
if (pDescriptor->flags & SI_SHIFT)
552+
{
553+
if (newString.length()) newString += "-";
554+
newString += "Shift";
555+
}
556+
557+
// rebuild full event string
558+
if (newString.length())
559+
newString = String::ToString("%s %s", newString.c_str(), pObjectString).c_str();
560+
else
561+
newString = String::ToString("%s", pObjectString).c_str();
562+
563+
dStrcpy(const_cast<char*>(pEventString), newString.c_str(), newString.length()+1);
564+
524565
if (dStrlen(pObjectString) == 1)
525566
{
526567
if (dIsDecentChar(*pObjectString)) // includes foreign chars
@@ -573,16 +614,7 @@ bool ActionMap::createEventDescriptor(const char* pEventString, EventDescriptor*
573614
}
574615
}
575616
}
576-
// Didn't find an ascii match. Check the virtual map table
577-
//for (U32 j = 0; gVirtualMap[j].code != 0xFFFFFFFF; j++)
578-
//{
579-
// if (dStricmp(pObjectString, gVirtualMap[j].pDescription) == 0)
580-
// {
581-
// pDescriptor->eventType = gVirtualMap[j].type;
582-
// pDescriptor->eventCode = gVirtualMap[j].code;
583-
// return true;
584-
// }
585-
//}
617+
586618
InputEventManager::VirtualMapData* data = INPUTMGR->findVirtualMap(pObjectString);
587619
if(data)
588620
{

0 commit comments

Comments
 (0)