X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=cl_input.c;h=8ccd3477dc24cc14c307d4243c624270ceeb3b66;hb=refs%2Fheads%2Fterencehill%2Fbuiltin_fixes;hp=ed7c44c3c99cfff78fa7d01ba6976891f0440312;hpb=e2cbba9125f88e89b18c920bfb3343cf074ae6eb;p=xonotic%2Fdarkplaces.git diff --git a/cl_input.c b/cl_input.c index ed7c44c3..8ccd3477 100644 --- a/cl_input.c +++ b/cl_input.c @@ -1470,7 +1470,7 @@ static void CL_ClientMovement_PlayerMove(cl_clientmovement_state_t *s) CL_ClientMovement_Physics_Walk(s); } -extern cvar_t slowmo; +extern cvar_t host_timescale; void CL_UpdateMoveVars(void) { if (cls.protocol == PROTOCOL_QUAKEWORLD) @@ -1517,8 +1517,8 @@ void CL_UpdateMoveVars(void) else { cl.moveflags = 0; - cl.movevars_ticrate = (cls.demoplayback ? 1.0f : slowmo.value) / bound(1.0f, cl_netfps.value, 1000.0f); - cl.movevars_timescale = (cls.demoplayback ? 1.0f : slowmo.value); + cl.movevars_ticrate = (cls.demoplayback ? 1.0f : host_timescale.value) / bound(1.0f, cl_netfps.value, 1000.0f); + cl.movevars_timescale = (cls.demoplayback ? 1.0f : host_timescale.value); cl.movevars_gravity = sv_gravity.value; cl.movevars_stopspeed = cl_movement_stopspeed.value; cl.movevars_maxspeed = cl_movement_maxspeed.value; @@ -1766,7 +1766,7 @@ void CL_SendMove(void) return; // we don't que moves during a lag spike (potential network timeout) - quemove = realtime - cl.last_received_message < cl_movement_nettimeout.value; + quemove = host.realtime - cl.last_received_message < cl_movement_nettimeout.value; // we build up cl.cmd and then decide whether to send or not // we store this into cl.movecmd[0] for prediction each frame even if we @@ -1870,7 +1870,7 @@ void CL_SendMove(void) cl.movecmd[0] = cl.cmd; // don't predict more than 200fps - if (realtime >= cl.lastpackettime + 0.005) + if (host.realtime >= cl.lastpackettime + 0.005) cl.movement_replay = true; // redo the prediction // now decide whether to actually send this move @@ -1892,7 +1892,7 @@ void CL_SendMove(void) // even if it violates the rate limit! important = (cl.cmd.impulse || (cl_netimmediatebuttons.integer && cl.cmd.buttons != cl.movecmd[1].buttons)); // don't send too often (cl_netfps) - if (!important && realtime < cl.lastpackettime + packettime) + if (!important && host.realtime < cl.lastpackettime + packettime) return; // don't choke the connection with packets (obey rate limit) // it is important that this check be last, because it adds a new @@ -1904,9 +1904,9 @@ void CL_SendMove(void) // try to round off the lastpackettime to a multiple of the packet interval // (this causes it to emit packets at a steady beat) if (packettime > 0) - cl.lastpackettime = floor(realtime / packettime) * packettime; + cl.lastpackettime = floor(host.realtime / packettime) * packettime; else - cl.lastpackettime = realtime; + cl.lastpackettime = host.realtime; buf.maxsize = sizeof(data); buf.cursize = 0; @@ -2152,7 +2152,7 @@ void CL_SendMove(void) Con_Print("CL_SendMove: lost server connection\n"); CL_Disconnect(); SV_LockThreadMutex(); - Host_ShutdownServer(); + SV_Shutdown(); SV_UnlockThreadMutex(); } } @@ -2164,75 +2164,75 @@ CL_InitInput */ void CL_InitInput (void) { - Cmd_AddCommand(&cmd_client, "+moveup",IN_UpDown, "swim upward"); - Cmd_AddCommand(&cmd_client, "-moveup",IN_UpUp, "stop swimming upward"); - Cmd_AddCommand(&cmd_client, "+movedown",IN_DownDown, "swim downward"); - Cmd_AddCommand(&cmd_client, "-movedown",IN_DownUp, "stop swimming downward"); - Cmd_AddCommand(&cmd_client, "+left",IN_LeftDown, "turn left"); - Cmd_AddCommand(&cmd_client, "-left",IN_LeftUp, "stop turning left"); - Cmd_AddCommand(&cmd_client, "+right",IN_RightDown, "turn right"); - Cmd_AddCommand(&cmd_client, "-right",IN_RightUp, "stop turning right"); - Cmd_AddCommand(&cmd_client, "+forward",IN_ForwardDown, "move forward"); - Cmd_AddCommand(&cmd_client, "-forward",IN_ForwardUp, "stop moving forward"); - Cmd_AddCommand(&cmd_client, "+back",IN_BackDown, "move backward"); - Cmd_AddCommand(&cmd_client, "-back",IN_BackUp, "stop moving backward"); - Cmd_AddCommand(&cmd_client, "+lookup", IN_LookupDown, "look upward"); - Cmd_AddCommand(&cmd_client, "-lookup", IN_LookupUp, "stop looking upward"); - Cmd_AddCommand(&cmd_client, "+lookdown", IN_LookdownDown, "look downward"); - Cmd_AddCommand(&cmd_client, "-lookdown", IN_LookdownUp, "stop looking downward"); - Cmd_AddCommand(&cmd_client, "+strafe", IN_StrafeDown, "activate strafing mode (move instead of turn)"); - Cmd_AddCommand(&cmd_client, "-strafe", IN_StrafeUp, "deactivate strafing mode"); - Cmd_AddCommand(&cmd_client, "+moveleft", IN_MoveleftDown, "strafe left"); - Cmd_AddCommand(&cmd_client, "-moveleft", IN_MoveleftUp, "stop strafing left"); - Cmd_AddCommand(&cmd_client, "+moveright", IN_MoverightDown, "strafe right"); - Cmd_AddCommand(&cmd_client, "-moveright", IN_MoverightUp, "stop strafing right"); - Cmd_AddCommand(&cmd_client, "+speed", IN_SpeedDown, "activate run mode (faster movement and turning)"); - Cmd_AddCommand(&cmd_client, "-speed", IN_SpeedUp, "deactivate run mode"); - Cmd_AddCommand(&cmd_client, "+attack", IN_AttackDown, "begin firing"); - Cmd_AddCommand(&cmd_client, "-attack", IN_AttackUp, "stop firing"); - Cmd_AddCommand(&cmd_client, "+jump", IN_JumpDown, "jump"); - Cmd_AddCommand(&cmd_client, "-jump", IN_JumpUp, "end jump (so you can jump again)"); - Cmd_AddCommand(&cmd_client, "impulse", IN_Impulse, "send an impulse number to server (select weapon, use item, etc)"); - Cmd_AddCommand(&cmd_client, "+klook", IN_KLookDown, "activate keyboard looking mode, do not recenter view"); - Cmd_AddCommand(&cmd_client, "-klook", IN_KLookUp, "deactivate keyboard looking mode"); - Cmd_AddCommand(&cmd_client, "+mlook", IN_MLookDown, "activate mouse looking mode, do not recenter view"); - Cmd_AddCommand(&cmd_client, "-mlook", IN_MLookUp, "deactivate mouse looking mode"); + Cmd_AddCommand(CMD_CLIENT, "+moveup",IN_UpDown, "swim upward"); + Cmd_AddCommand(CMD_CLIENT, "-moveup",IN_UpUp, "stop swimming upward"); + Cmd_AddCommand(CMD_CLIENT, "+movedown",IN_DownDown, "swim downward"); + Cmd_AddCommand(CMD_CLIENT, "-movedown",IN_DownUp, "stop swimming downward"); + Cmd_AddCommand(CMD_CLIENT, "+left",IN_LeftDown, "turn left"); + Cmd_AddCommand(CMD_CLIENT, "-left",IN_LeftUp, "stop turning left"); + Cmd_AddCommand(CMD_CLIENT, "+right",IN_RightDown, "turn right"); + Cmd_AddCommand(CMD_CLIENT, "-right",IN_RightUp, "stop turning right"); + Cmd_AddCommand(CMD_CLIENT, "+forward",IN_ForwardDown, "move forward"); + Cmd_AddCommand(CMD_CLIENT, "-forward",IN_ForwardUp, "stop moving forward"); + Cmd_AddCommand(CMD_CLIENT, "+back",IN_BackDown, "move backward"); + Cmd_AddCommand(CMD_CLIENT, "-back",IN_BackUp, "stop moving backward"); + Cmd_AddCommand(CMD_CLIENT, "+lookup", IN_LookupDown, "look upward"); + Cmd_AddCommand(CMD_CLIENT, "-lookup", IN_LookupUp, "stop looking upward"); + Cmd_AddCommand(CMD_CLIENT, "+lookdown", IN_LookdownDown, "look downward"); + Cmd_AddCommand(CMD_CLIENT, "-lookdown", IN_LookdownUp, "stop looking downward"); + Cmd_AddCommand(CMD_CLIENT, "+strafe", IN_StrafeDown, "activate strafing mode (move instead of turn)"); + Cmd_AddCommand(CMD_CLIENT, "-strafe", IN_StrafeUp, "deactivate strafing mode"); + Cmd_AddCommand(CMD_CLIENT, "+moveleft", IN_MoveleftDown, "strafe left"); + Cmd_AddCommand(CMD_CLIENT, "-moveleft", IN_MoveleftUp, "stop strafing left"); + Cmd_AddCommand(CMD_CLIENT, "+moveright", IN_MoverightDown, "strafe right"); + Cmd_AddCommand(CMD_CLIENT, "-moveright", IN_MoverightUp, "stop strafing right"); + Cmd_AddCommand(CMD_CLIENT, "+speed", IN_SpeedDown, "activate run mode (faster movement and turning)"); + Cmd_AddCommand(CMD_CLIENT, "-speed", IN_SpeedUp, "deactivate run mode"); + Cmd_AddCommand(CMD_CLIENT, "+attack", IN_AttackDown, "begin firing"); + Cmd_AddCommand(CMD_CLIENT, "-attack", IN_AttackUp, "stop firing"); + Cmd_AddCommand(CMD_CLIENT, "+jump", IN_JumpDown, "jump"); + Cmd_AddCommand(CMD_CLIENT, "-jump", IN_JumpUp, "end jump (so you can jump again)"); + Cmd_AddCommand(CMD_CLIENT, "impulse", IN_Impulse, "send an impulse number to server (select weapon, use item, etc)"); + Cmd_AddCommand(CMD_CLIENT, "+klook", IN_KLookDown, "activate keyboard looking mode, do not recenter view"); + Cmd_AddCommand(CMD_CLIENT, "-klook", IN_KLookUp, "deactivate keyboard looking mode"); + Cmd_AddCommand(CMD_CLIENT, "+mlook", IN_MLookDown, "activate mouse looking mode, do not recenter view"); + Cmd_AddCommand(CMD_CLIENT, "-mlook", IN_MLookUp, "deactivate mouse looking mode"); // LadyHavoc: added lots of buttons - Cmd_AddCommand(&cmd_client, "+use", IN_UseDown, "use something (may be used by some mods)"); - Cmd_AddCommand(&cmd_client, "-use", IN_UseUp, "stop using something"); - Cmd_AddCommand(&cmd_client, "+button3", IN_Button3Down, "activate button3 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button3", IN_Button3Up, "deactivate button3"); - Cmd_AddCommand(&cmd_client, "+button4", IN_Button4Down, "activate button4 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button4", IN_Button4Up, "deactivate button4"); - Cmd_AddCommand(&cmd_client, "+button5", IN_Button5Down, "activate button5 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button5", IN_Button5Up, "deactivate button5"); - Cmd_AddCommand(&cmd_client, "+button6", IN_Button6Down, "activate button6 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button6", IN_Button6Up, "deactivate button6"); - Cmd_AddCommand(&cmd_client, "+button7", IN_Button7Down, "activate button7 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button7", IN_Button7Up, "deactivate button7"); - Cmd_AddCommand(&cmd_client, "+button8", IN_Button8Down, "activate button8 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button8", IN_Button8Up, "deactivate button8"); - Cmd_AddCommand(&cmd_client, "+button9", IN_Button9Down, "activate button9 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button9", IN_Button9Up, "deactivate button9"); - Cmd_AddCommand(&cmd_client, "+button10", IN_Button10Down, "activate button10 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button10", IN_Button10Up, "deactivate button10"); - Cmd_AddCommand(&cmd_client, "+button11", IN_Button11Down, "activate button11 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button11", IN_Button11Up, "deactivate button11"); - Cmd_AddCommand(&cmd_client, "+button12", IN_Button12Down, "activate button12 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button12", IN_Button12Up, "deactivate button12"); - Cmd_AddCommand(&cmd_client, "+button13", IN_Button13Down, "activate button13 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button13", IN_Button13Up, "deactivate button13"); - Cmd_AddCommand(&cmd_client, "+button14", IN_Button14Down, "activate button14 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button14", IN_Button14Up, "deactivate button14"); - Cmd_AddCommand(&cmd_client, "+button15", IN_Button15Down, "activate button15 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button15", IN_Button15Up, "deactivate button15"); - Cmd_AddCommand(&cmd_client, "+button16", IN_Button16Down, "activate button16 (behavior depends on mod)"); - Cmd_AddCommand(&cmd_client, "-button16", IN_Button16Up, "deactivate button16"); + Cmd_AddCommand(CMD_CLIENT, "+use", IN_UseDown, "use something (may be used by some mods)"); + Cmd_AddCommand(CMD_CLIENT, "-use", IN_UseUp, "stop using something"); + Cmd_AddCommand(CMD_CLIENT, "+button3", IN_Button3Down, "activate button3 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button3", IN_Button3Up, "deactivate button3"); + Cmd_AddCommand(CMD_CLIENT, "+button4", IN_Button4Down, "activate button4 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button4", IN_Button4Up, "deactivate button4"); + Cmd_AddCommand(CMD_CLIENT, "+button5", IN_Button5Down, "activate button5 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button5", IN_Button5Up, "deactivate button5"); + Cmd_AddCommand(CMD_CLIENT, "+button6", IN_Button6Down, "activate button6 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button6", IN_Button6Up, "deactivate button6"); + Cmd_AddCommand(CMD_CLIENT, "+button7", IN_Button7Down, "activate button7 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button7", IN_Button7Up, "deactivate button7"); + Cmd_AddCommand(CMD_CLIENT, "+button8", IN_Button8Down, "activate button8 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button8", IN_Button8Up, "deactivate button8"); + Cmd_AddCommand(CMD_CLIENT, "+button9", IN_Button9Down, "activate button9 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button9", IN_Button9Up, "deactivate button9"); + Cmd_AddCommand(CMD_CLIENT, "+button10", IN_Button10Down, "activate button10 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button10", IN_Button10Up, "deactivate button10"); + Cmd_AddCommand(CMD_CLIENT, "+button11", IN_Button11Down, "activate button11 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button11", IN_Button11Up, "deactivate button11"); + Cmd_AddCommand(CMD_CLIENT, "+button12", IN_Button12Down, "activate button12 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button12", IN_Button12Up, "deactivate button12"); + Cmd_AddCommand(CMD_CLIENT, "+button13", IN_Button13Down, "activate button13 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button13", IN_Button13Up, "deactivate button13"); + Cmd_AddCommand(CMD_CLIENT, "+button14", IN_Button14Down, "activate button14 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button14", IN_Button14Up, "deactivate button14"); + Cmd_AddCommand(CMD_CLIENT, "+button15", IN_Button15Down, "activate button15 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button15", IN_Button15Up, "deactivate button15"); + Cmd_AddCommand(CMD_CLIENT, "+button16", IN_Button16Down, "activate button16 (behavior depends on mod)"); + Cmd_AddCommand(CMD_CLIENT, "-button16", IN_Button16Up, "deactivate button16"); // LadyHavoc: added bestweapon command - Cmd_AddCommand(&cmd_client, "bestweapon", IN_BestWeapon_f, "send an impulse number to server to select the first usable weapon out of several (example: 8 7 6 5 4 3 2 1)"); - Cmd_AddCommand(&cmd_client, "register_bestweapon", IN_BestWeapon_Register_f, "(for QC usage only) change weapon parameters to be used by bestweapon; stuffcmd this in ClientConnect"); + Cmd_AddCommand(CMD_CLIENT, "bestweapon", IN_BestWeapon_f, "send an impulse number to server to select the first usable weapon out of several (example: 8 7 6 5 4 3 2 1)"); + Cmd_AddCommand(CMD_CLIENT, "register_bestweapon", IN_BestWeapon_Register_f, "(for QC usage only) change weapon parameters to be used by bestweapon; stuffcmd this in ClientConnect"); Cvar_RegisterVariable(&cl_movecliptokeyboard); Cvar_RegisterVariable(&cl_movement);