예제 #1
0
        public static void initialize()
        {
            if ("moveMap".isObject())
                "moveMap".delete();

            ActionMap moveMap = new ObjectCreator("ActionMap", "moveMap").Create();
            ActionMap GlobalActionMap = "GlobalActionMap";

            moveMap.bindCmd("keyboard", "escape", "", "handleEscape();");
            moveMap.bind("keyboard", "F2", "showPlayerList");
            moveMap.bind("keyboard", "ctrl h", "hideHUDs");
            moveMap.bind("keyboard", "alt p", "doScreenShotHudless");

            moveMap.bind("keyboard", "a", "moveleft");
            moveMap.bind("keyboard", "d", "moveright");
            moveMap.bind("keyboard", "left", "moveleft");
            moveMap.bind("keyboard", "right", "moveright");

            moveMap.bind("keyboard", "w", "moveforward");
            moveMap.bind("keyboard", "s", "movebackward");
            moveMap.bind("keyboard", "up", "moveforward");
            moveMap.bind("keyboard", "down", "movebackward");

            moveMap.bind("keyboard", "e", "moveup");
            moveMap.bind("keyboard", "c", "movedown");

            moveMap.bind("keyboard", "space", "jump");
            moveMap.bind("mouse", "xaxis", "yaw");
            moveMap.bind("mouse", "yaxis", "pitch");

            moveMap.bind("gamepad", "thumbrx", "D", "-0.23 0.23", "gamepadYaw");
            moveMap.bind("gamepad", "thumbry", "D", "-0.23 0.23", "gamepadPitch");
            moveMap.bind("gamepad", "thumblx", "D", "-0.23 0.23", "gamePadMoveX");
            moveMap.bind("gamepad", "thumbly", "D", "-0.23 0.23", "gamePadMoveY");

            moveMap.bind("gamepad", "btn_a", "jump");
            moveMap.bindCmd("gamepad", "btn_back", "disconnect();", "");

            moveMap.bindCmd("gamepad", "dpadl", "toggleLightColorViz();", "");
            moveMap.bindCmd("gamepad", "dpadr", "metrics(fps);", "");
            //moveMap.bindCmd("gamepad", "dpadu", "toggleDepthViz();", "");
            GlobalActionMap.bind("gamepad", "dpadu", "toggleConsole");
            moveMap.bindCmd("gamepad", "dpadd", "toggleNormalsViz();", "");
            //moveMap.bindCmd("gamepad", "dpadr", "toggleLightSpecularViz();", "");

            moveMap.bind("keyboard", "lcontrol", "doCrouch");
            moveMap.bind("gamepad", "btn_b", "doCrouch");

            moveMap.bind("keyboard", "lshift", "doSprint");
            moveMap.bind("gamepad", "btn_lt", "doSprint"); //Analog_LT Click

            moveMap.bind("mouse", "button0", "mouseFire");

            moveMap.bind("gamepad", "triggerr", "gamepadFire");
            moveMap.bind("gamepad", "triggerl", "gamepadAltTrigger");

            if (omni.sGlobal["$Player::CurrentFOV"] == "")
                omni.iGlobal["$Player::CurrentFOV"] = omni.iGlobal["$pref::Player::DefaultFOV"]/2;

            moveMap.bind("keyboard", "f", "setZoomFOV"); // f for field of view
            moveMap.bind("keyboard", "z", "toggleZoom"); // z for zoom
            moveMap.bind("mouse", "button1", "mouseButtonZoom");
            moveMap.bind("gamepad", "btn_rt", "toggleZoom");

            moveMap.bind("keyboard", "v", "toggleFreeLook"); // v for vanity
            moveMap.bind("keyboard", "tab", "toggleFirstPerson");
            moveMap.bind("keyboard", "alt c", "toggleCamera");

            moveMap.bind("gamepad", "btn_start", "toggleCamera");
            moveMap.bind("gamepad", "btn_y", "toggleFirstPerson");
            moveMap.bindCmd("gamepad", "btn_x", "commandToServer('reloadWeapon');", ""); //Button_X

            // ----------------------------------------------------------------------------
            // Misc. Player stuff
            // ----------------------------------------------------------------------------

            // Gideon does not have these animations, so the player does not need access to
            // them.  Commenting instead of removing so as to retain an example for those
            // who will want to use a player model that has these animations and wishes to
            // use them.

            //moveMap.bindCmd(keyboard, "ctrl w", "commandToServer('playCel',\"wave\");", "");
            //moveMap.bindCmd(keyboard, "ctrl s", "commandToServer('playCel',\"salute\");", "");

            moveMap.bindCmd("keyboard", "ctrl k", "commandToServer('suicide');", "");

            //------------------------------------------------------------------------------
            // Item manipulation
            //------------------------------------------------------------------------------
            moveMap.bindCmd("keyboard", "1", "commandToServer('use',\"Ryder\");", "");
            moveMap.bindCmd("keyboard", "2", "commandToServer('use',\"Lurker\");", "");
            moveMap.bindCmd("keyboard", "3", "commandToServer('use',\"LurkerGrenadeLauncher\");", "");
            moveMap.bindCmd("keyboard", "4", "commandToServer('use',\"ProxMine\");", "");
            moveMap.bindCmd("keyboard", "5", "commandToServer('use',\"DeployableTurret\");", "");

            moveMap.bindCmd("keyboard", "r", "commandToServer('reloadWeapon');", "");

            moveMap.bind("keyboard", "0", "unmountWeapon");

            moveMap.bind("keyboard", "alt w", "throwWeapon");
            moveMap.bind("keyboard", "alt a", "tossAmmo");

            moveMap.bind("keyboard", "q", "nextWeapon");
            moveMap.bind("keyboard", "ctrl q", "prevWeapon");
            moveMap.bind("mouse", "zaxis", "mouseWheelWeaponCycle");

            moveMap.bind("gamepad", "btn_l", "prevWeapon");
            moveMap.bind("gamepad", "btn_r", "nextWeapon");

            moveMap.bind("keyboard", "u", "toggleMessageHud");
            //moveMap.bind(keyboard, y, teamMessageHud );
            moveMap.bind("keyboard", "pageUp", "pageMessageHudUp");
            moveMap.bind("keyboard", "pageDown", "pageMessageHudDown");
            moveMap.bind("keyboard", "p", "resizeMessageHud");

            moveMap.bind("keyboard", "F3", "startRecordingDemo");
            moveMap.bind("keyboard", "F4", "stopRecordingDemo");

            moveMap.bind("keyboard", "F8", "dropCameraAtPlayer");
            moveMap.bind("keyboard", "F7", "dropPlayerAtCamera");

            //ActionMap GlobalActionMap = "GlobalActionMap";

            GlobalActionMap.bind("keyboard", "ctrl o", "bringUpOptions");

            GlobalActionMap.bind("keyboard", "ctrl F3", "doProfile");

            //------------------------------------------------------------------------------
            // Misc.
            //------------------------------------------------------------------------------

            GlobalActionMap.bind("keyboard", "tilde", "toggleConsole");
            GlobalActionMap.bind("keyboard", "alt tilde", "ShowNewTools");
            GlobalActionMap.bindCmd("keyboard", "alt k", "cls();", "");
            GlobalActionMap.bindCmd("keyboard", "alt enter", "", "Canvas.attemptFullscreenToggle();");
            GlobalActionMap.bindCmd("keyboard", "F1", "", "contextHelp();");
            moveMap.bindCmd("keyboard", "n", "toggleNetGraph();", "");

            // Bind the keys to the carjack command
            moveMap.bindCmd("keyboard", "ctrl z", "carjack();", "");

            if ("vehicleMap".isObject())
                "vehicleMap".delete();

            ActionMap vehicleMap = new ObjectCreator("ActionMap", "vehicleMap").Create();

            // The key command for flipping the car
            vehicleMap.bindCmd("keyboard", "ctrl x", "commandToServer(\'flipCar\');", "");

            vehicleMap.bind("keyboard", "w", "moveforward");
            vehicleMap.bind("keyboard", "s", "movebackward");
            vehicleMap.bind("keyboard", "up", "moveforward");
            vehicleMap.bind("keyboard", "down", "movebackward");
            vehicleMap.bind("mouse", "xaxis", "yaw");
            vehicleMap.bind("mouse", "yaxis", "pitch");
            vehicleMap.bind("mouse", "button0", "mouseFire");
            vehicleMap.bind("mouse", "button1", "altTrigger");
            vehicleMap.bindCmd("keyboard", "ctrl f", "getout();", "");
            vehicleMap.bind("keyboard", "space", "brake");
            vehicleMap.bindCmd("keyboard", "l", "brakeLights();", "");
            vehicleMap.bindCmd("keyboard", "escape", "", "handleEscape();");
            vehicleMap.bind("keyboard", "v", "toggleFreeLook"); // v for vanity
            //vehicleMap.bind(keyboard, tab, toggleFirstPerson );
            vehicleMap.bind("keyboard", "alt c", "toggleCamera");

            //Vehicle Gamepad
            vehicleMap.bind("gamepad", "triggerr", "moveforward"); //Trigger_RT
            vehicleMap.bind("gamepad", "triggerl", "movebackward"); //Trigger_RT

            //Uncomment below for right thumb, forward-backwards
            //vehicleMap.bind(gamepad, "thumbry", gamePadMoveY);                    //Analog_RT axis_Y
            vehicleMap.bind("gamepad", "thumblx", "gamepadYaw"); //Analog_LT axis_X
            vehicleMap.bindCmd("gamepad", "btn_y", "getout();", ""); //Button_Y
            vehicleMap.bind("gamepad", "btn_b", "brake"); //Button_B
            vehicleMap.bind("gamepad", "btn_x", "mouseFire"); //Button_X
            moveMap.bindCmd("gamepad", "connect", "echo(\"Pressed Xbox Button\");", ""); //Button_Xbox
        }