//////////////////////////////////////////////////////////////////////////////// // // Module: ctrls.cpp // Author: Tom Hicks // Creation: 09-01-2003 // LastEdit: 10-20-2003 // Editors: Tom Hicks // // Purpose: // To implement a system for managing a bindable control scheme. // // Summary of Methods: // ControlSchemeClass // void LoadDefaultControlScheme(); // -Loads the default control scheme // void ClearControlScheme(); // -Clears the control scheme // void Unbind(uint8 key); // -Removes key from all control lists. // // Summary of Properties: // ControlSchemeClass // -list forward; // A list of the VKeys associated with forward. // -list backward; // A list of the VKeys associated with backward. // -list lookLeft; // A list of the VKeys associated with turning left. // -list lookRight; // A list of the VKeys associated with turning right. // -list lookUp; // A list of the VKeys associated with looking up. // -list lookDown; // A list of the VKeys associated with looking down. // -list moveLeft; // A list of the VKeys associated with strafing left. // -list moveRight; // A list of the VKeys associated with strafing right. // -list moveUp; // A list of the VKeys associated with jumping. // -list moveDown; // A list of the VKeys associated with crouching. // -list firePrimary; // A list of the VKeys associated with activating the primary ability of the active item. // -list fireSecondary; // A list of the VKeys associated with activating the secondary ablilty of the active item. // -list weaponNext; // A list of the VKeys associated with switching to the next item. // -list weaponPrev; // A list of the VKeys associated with switching to the previous item. // -list toggleLights; // A list of the VKeys associated with turning lighting on and off. // -list toggleFPS; // A list of the VKeys associated with turning the FPS display on and off. // -list toggleConsole; // A list of the VKeys associated with toggling the display of the console. // -list toggleMouseLook; // A list of the VKeys associated with toggling mouse look. // -list quickMouseLook; // A list of the VKeys associated with temporarily switching the mouse look mode. // -list rollLeft; // A list of the VKeys associated with rolling left. // -list rollRight; // A list of the VKeys associated with rolling right. // //////////////////////////////////////////////////////////////////////////////// #include "../include/ctrls.h" void ControlSchemeClass::LoadDefaultControlScheme() { forward.Insert(VK_LBUTTON); backward.Insert(VK_RBUTTON); lookLeft.Insert(VK_LEFT); lookRight.Insert(VK_RIGHT); lookUp.Insert(VK_UP); lookDown.Insert(VK_DOWN); moveLeft.Insert('S'); moveRight.Insert('D'); moveUp.Insert(VK_SPACE); moveDown.Insert('A'); firePrimary.Insert('F'); fireSecondary.Insert('G'); weaponNext.Insert('T'); weaponPrev.Insert('R'); toggleLights.Insert('L'); toggleFPS.Insert('P'); toggleConsole.Insert('~'); toggleMouseLook.Insert('M'); quickMouseLook.Insert('Q'); rollLeft.Insert('W'); rollRight.Insert('E'); } void ControlSchemeClass::ClearControlScheme() { backward.Clear(); firePrimary.Clear(); fireSecondary.Clear(); forward.Clear(); lookDown.Clear(); lookUp.Clear(); lookRight.Clear(); lookLeft.Clear(); moveDown.Clear(); moveUp.Clear(); moveLeft.Clear(); moveRight.Clear(); quickMouseLook.Clear(); toggleConsole.Clear(); toggleFPS.Clear(); toggleLights.Clear(); toggleMouseLook.Clear(); weaponNext.Clear(); weaponPrev.Clear(); } void ControlSchemeClass::Unbind(uint8 key) { backward.Remove(key); firePrimary.Remove(key); fireSecondary.Remove(key); forward.Remove(key); lookDown.Remove(key); lookUp.Remove(key); lookRight.Remove(key); lookLeft.Remove(key); moveDown.Remove(key); moveUp.Remove(key); moveRight.Remove(key); quickMouseLook.Remove(key); toggleConsole.Remove(key); toggleFPS.Remove(key); toggleLights.Remove(key); toggleMouseLook.Remove(key); weaponNext.Remove(key); weaponPrev.Remove(key); }