X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=cl_input.c;h=c940395ae2fb957762ed28847d97acc3b63dd8b4;hb=d79de33fe1787fbf73bee091ef5f3499d7f06396;hp=903b240b4f4c797ad9ee83237b86d34928d57916;hpb=27aa321754fe8ae393a2335adb6e9130364a1268;p=xonotic%2Fdarkplaces.git diff --git a/cl_input.c b/cl_input.c index 903b240b..c940395a 100644 --- a/cl_input.c +++ b/cl_input.c @@ -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; @@ -2114,7 +2114,7 @@ void CL_SendMove(void) // send the reliable message (forwarded commands) if there is one if (buf.cursize || cls.netcon->message.cursize) - NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, max(20*(buf.cursize+40), cl_rate.integer), cl_rate_burstsize.integer, false); + NetConn_SendUnreliableMessage(cls.netcon, &buf, cls.protocol, max(20*(buf.cursize+40), rate.integer), rate_burstsize.integer, false); if (quemove) { @@ -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);