Exemplo n.º 1
0
void CONFIG_ReadKeys ( int32 scripthandle )
{
    int32 i;
    int32 numkeyentries;
    int32 function;
    char keyname1[80];
    char keyname2[80];
    kb_scancode key1, key2;
    
    if ( scripthandle < 0 ) { return; }
    
    numkeyentries = SCRIPT_NumberEntries ( scripthandle, "KeyDefinitions" );
    
    for ( i = 0; i < numkeyentries; i++ )
    {
        function = CONFIG_FunctionNameToNum ( ( char * ) SCRIPT_Entry ( scripthandle, "KeyDefinitions", i ) );
        
        if ( function != -1 )
        {
            memset ( keyname1, 0, sizeof ( keyname1 ) );
            memset ( keyname2, 0, sizeof ( keyname2 ) );
            SCRIPT_GetDoubleString
            (
                scripthandle,
                "KeyDefinitions",
                SCRIPT_Entry ( scripthandle, "KeyDefinitions", i ),
                keyname1,
                keyname2
            );
            key1 = 0xff;
            key2 = 0xff;
            
            if ( keyname1[0] )
            {
                key1 = ( byte ) KB_StringToScanCode ( keyname1 );
            }
            
            if ( keyname2[0] )
            {
                key2 = ( byte ) KB_StringToScanCode ( keyname2 );
            }
            
            KeyboardKeys[function][0] = key1;
            KeyboardKeys[function][1] = key2;
        }
    }
    
    for ( i = 0; i < NUMGAMEFUNCTIONS; i++ )
    {
        if ( i == gamefunc_Show_Console )
        {
            OSD_CaptureKey ( KeyboardKeys[i][0] );
        }
        
        // else
        //    CONTROL_MapKey( i, KeyboardKeys[i][0], KeyboardKeys[i][1] );
    }
}
Exemplo n.º 2
0
void CONFIG_ReadKeys(int32 scripthandle) {
    int32 i;
    int32 numkeyentries;
    int32 function;
    char keyname1[80];
    char keyname2[80];
    dnKey key1, key2;

    if (scripthandle < 0) return;
    
    numkeyentries = SCRIPT_NumberEntries( scripthandle,"KeyDefinitions" );
    for (i=0;i<numkeyentries;i++)
    {
        function = CONFIG_FunctionNameToNum(SCRIPT_Entry(scripthandle,"KeyDefinitions", i ));
        if (function != -1)
        {
            memset(keyname1,0,sizeof(keyname1));
            memset(keyname2,0,sizeof(keyname2));
            SCRIPT_GetDoubleString
            (
             scripthandle,
             "KeyDefinitions",
             SCRIPT_Entry( scripthandle, "KeyDefinitions", i ),
             keyname1,
             keyname2
             );
            key1 = SDLK_UNKNOWN;
            key2 = SDLK_UNKNOWN;
            if (keyname1[0])
            {
                key1 = dnGetKeyByName( keyname1 );
            }
            if (keyname2[0])
            {
                key2 = dnGetKeyByName( keyname2 );
            }
            dnBindFunction(function, 0, key1);
            dnBindFunction(function, 1, key2);
            KeyboardKeys[function][0] = -1;
            KeyboardKeys[function][1] = -1;
        }
    }
    
//    for (i=0; i<NUMGAMEFUNCTIONS; i++)
//    {
//        if (i == gamefunc_Show_Console)
//            OSD_CaptureKey(KeyboardKeys[i][0]);
//        else
//            CONTROL_MapKey( i, KeyboardKeys[i][0], KeyboardKeys[i][1] );
//    }

}
Exemplo n.º 3
0
void CONFIG_ReadKeys( void )
   {
   int32 i;
   int32 numkeyentries;
   int32 function;
   char keyname1[80];
   char keyname2[80];
#if 0
   kb_scancode key1,key2;
#else
   dnKey key1, key2;
#endif

   if (scripthandle < 0) return;

   numkeyentries = SCRIPT_NumberEntries( scripthandle,"KeyDefinitions" );

#if 0
   for (i=0;i<numkeyentries;i++)
      {
      function = CONFIG_FunctionNameToNum(SCRIPT_Entry(scripthandle,"KeyDefinitions", i ));
      if (function != -1)
         {
         memset(keyname1,0,sizeof(keyname1));
         memset(keyname2,0,sizeof(keyname2));
         SCRIPT_GetDoubleString
            (
            scripthandle,
            "KeyDefinitions",
            SCRIPT_Entry( scripthandle, "KeyDefinitions", i ),
            keyname1,
            keyname2
            );
         key1 = -1;
         key2 = -1;
         if (keyname1[0])
            {
            key1 = KB_StringToScanCode( keyname1 );
            }
         if (keyname2[0])
            {
            key2 = KB_StringToScanCode( keyname2 );
            }
         KeyboardKeys[function][0] = key1;
         KeyboardKeys[function][1] = key2;
         }
      }

   for (i=0; i<NUMGAMEFUNCTIONS; i++)
      {
		 if (i == gamefunc_Show_Console)
            OSD_CaptureKey(KeyboardKeys[i][0]);
         else
            CONTROL_MapKey( i, KeyboardKeys[i][0], KeyboardKeys[i][1] );
      }
#else
       for (i=0;i<numkeyentries;i++)
       {
           function = CONFIG_FunctionNameToNum(SCRIPT_Entry(scripthandle,"KeyDefinitions", i ));
           if (function != -1)
           {
               memset(keyname1,0,sizeof(keyname1));
               memset(keyname2,0,sizeof(keyname2));
               SCRIPT_GetDoubleString
               (
                scripthandle,
                "KeyDefinitions",
                SCRIPT_Entry( scripthandle, "KeyDefinitions", i ),
                keyname1,
                keyname2
                );
               key1 = SDLK_UNKNOWN;
               key2 = SDLK_UNKNOWN;
               if (keyname1[0])
               {
                   key1 = dnGetKeyByName( keyname1 );
               }
               if (keyname2[0])
               {
                   key2 = dnGetKeyByName( keyname2 );
               }
               dnBindFunction(function, 0, key1);
               dnBindFunction(function, 1, key2);
               KeyboardKeys[function][0] = -1;
               KeyboardKeys[function][1] = -1;
           }
       }
       
       for (i=0; i<NUMGAMEFUNCTIONS; i++)
       {
           if (i == gamefunc_Show_Console)
               OSD_CaptureKey(KeyboardKeys[i][0]);
           else
               CONTROL_MapKey( i, KeyboardKeys[i][0], KeyboardKeys[i][1] );
       }

#endif
   }