Beispiel #1
0
void SetDefaultKeyDefinitions(int style)
{
   int numkeydefaults;
   char **keydefaultset;
   int i, f, k1, k2;

   if (style) {
      numkeydefaults = sizeof(keydefaults_modern) / sizeof(char *) / 3;
      keydefaultset = keydefaults_modern;
   } else {
      numkeydefaults = sizeof(keydefaults) / sizeof(char *) / 3;
      keydefaultset = keydefaults;
   }

   memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
   for (i=0; i < numkeydefaults; i++) {
      f = CONFIG_FunctionNameToNum( keydefaultset[3*i+0] );
      if (f == -1) continue;
      k1 = KB_StringToScanCode( keydefaultset[3*i+1] );
      k2 = KB_StringToScanCode( keydefaultset[3*i+2] );

      CONTROL_MapKey( i, k1, k2 );

      KeyboardKeys[f][0] = k1;
      KeyboardKeys[f][1] = k2;
   }
}
Beispiel #2
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(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] );
      }
   }
Beispiel #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
   }
Beispiel #4
0
void CONFIG_SetDefaults( void )
{
	int32 i,f;
	byte k1,k2;

	FXDevice = 0;
	MusicDevice = 0;
	NumVoices = 16;
	NumChannels = 2;
	NumBits = 16;
	MixRate = 44100;
	SoundToggle = 1;
	MusicToggle = 1;
	VoiceToggle = 1;
	AmbienceToggle = 1;
	FXVolume = 220;
	MusicVolume = 200;
	ReverseStereo = 0;
	myaimmode = ps[0].aim_mode = 1;
	ud.mouseaiming = 0;
	ud.weaponswitch = 3;	// new+empty
	AutoAim = 0;
	UseJoystick = 0;
	UseMouse = 1;
	ud.mouseflip = 0;
	ud.runkey_mode = 0;
	ud.statusbarscale = 100;
	ud.screen_size = 8;
	ud.screen_tilting = 1;
	ud.shadows = 1;
	ud.detail = 1;
	ud.lockout = 0;
	ud.pwlockout[0] = '\0';
	ud.crosshair = 1;
	ud.m_marker = 1;
	ud.m_ffire = 1;
	ud.levelstats = 0;
	ud.vsync = 1;
	ud.fps_max = 120;
	ShowOpponentWeapons = 0;
	Bstrcpy(ud.rtsname, "DUKE.RTS");
	Bstrcpy(myname, "Duke");

	Bstrcpy(ud.ridecule[0], "An inspiration for birth control.");
	Bstrcpy(ud.ridecule[1], "You're gonna die for that!");
	Bstrcpy(ud.ridecule[2], "It hurts to be you.");
	Bstrcpy(ud.ridecule[3], "Lucky Son of a Bitch.");
	Bstrcpy(ud.ridecule[4], "Hmmm....Payback time.");
	Bstrcpy(ud.ridecule[5], "You bottom dwelling scum sucker.");
	Bstrcpy(ud.ridecule[6], "Damn, you're ugly.");
	Bstrcpy(ud.ridecule[7], "Ha ha ha...Wasted!");
	Bstrcpy(ud.ridecule[8], "You suck!");
	Bstrcpy(ud.ridecule[9], "AARRRGHHHHH!!!");

    #if 0
	memset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
	for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0])); i+=3) {
		f = CONFIG_FunctionNameToNum( keydefaults[i+0] );
		if (f == -1) continue;
		KeyboardKeys[f][0] = KB_StringToScanCode( keydefaults[i+1] );
		KeyboardKeys[f][1] = KB_StringToScanCode( keydefaults[i+2] );

		if (f == gamefunc_Show_Console) OSD_CaptureKey(KeyboardKeys[f][0]);
		else CONTROL_MapKey( f, KeyboardKeys[f][0], KeyboardKeys[f][1] );
	}

	memset(MouseFunctions, -1, sizeof(MouseFunctions));
	for (i=0; i<MAXMOUSEBUTTONS; i++) {
		MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] );
		CONTROL_MapButton( MouseFunctions[i][0], i, 0, controldevice_mouse );
		if (i>=4) continue;

		MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] );
		CONTROL_MapButton( MouseFunctions[i][1], i, 1, controldevice_mouse );
	}

	memset(MouseDigitalFunctions, -1, sizeof(MouseDigitalFunctions));
	for (i=0; i<MAXMOUSEAXES; i++) {
		MouseAnalogueScale[i] = -65536;
		CONTROL_SetAnalogAxisScale( i, MouseAnalogueScale[i], controldevice_mouse );

		MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2] );
		MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( mousedigitaldefaults[i*2+1] );
		CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][0], 0, controldevice_mouse );
		CONTROL_MapDigitalAxis( i, MouseDigitalFunctions[i][1], 1, controldevice_mouse );

		MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum( mouseanalogdefaults[i] );
		CONTROL_MapAnalogAxis( i, MouseAnalogueAxes[i], controldevice_mouse);
	}
	CONTROL_SetMouseSensitivity(32768);

	memset(JoystickFunctions, -1, sizeof(JoystickFunctions));
	for (i=0; i<MAXJOYBUTTONS; i++) {
		JoystickFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdefaults[i] );
		JoystickFunctions[i][1] = CONFIG_FunctionNameToNum( joystickclickeddefaults[i] );
		CONTROL_MapButton( JoystickFunctions[i][0], i, 0, controldevice_joystick );
		CONTROL_MapButton( JoystickFunctions[i][1], i, 1, controldevice_joystick );
	}

	memset(JoystickDigitalFunctions, -1, sizeof(JoystickDigitalFunctions));
	for (i=0; i<MAXJOYAXES; i++) {
		JoystickAnalogueScale[i] = 65536;
		JoystickAnalogueDead[i] = 1000;
		JoystickAnalogueSaturate[i] = 9500;
		CONTROL_SetAnalogAxisScale( i, JoystickAnalogueScale[i], controldevice_joystick );

		JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2] );
		JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum( joystickdigitaldefaults[i*2+1] );
		CONTROL_MapDigitalAxis( i, JoystickDigitalFunctions[i][0], 0, controldevice_joystick );
		CONTROL_MapDigitalAxis( i, JoystickDigitalFunctions[i][1], 1, controldevice_joystick );

		JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum( joystickanalogdefaults[i] );
		CONTROL_MapAnalogAxis(i, JoystickAnalogueAxes[i], controldevice_joystick);
	}
	#endif
    dnResetBindings();
}