diff --git a/Source/client/cstrike/defs.h b/Source/client/cstrike/defs.h index ff0f7923..734af91d 100755 --- a/Source/client/cstrike/defs.h +++ b/Source/client/cstrike/defs.h @@ -110,6 +110,18 @@ struct int iHUDGrenadesSelected; float fHUDWeaponSelectTime; float fHUDWeaponSelected; + +// Input + float fInputKeyCode; + float fInputKeyASCII; + float fInputKeyDown; + + int iInputAttack2; + int iInputReload; + int iInputUse; + int iInputDuck; + + float fInputSendNext; } seats[4], *pSeat; // Sound Stuff diff --git a/Source/client/cstrike/vguiobjects.c b/Source/client/cstrike/vguiobjects.c index 7b212f18..6f7e9dec 100755 --- a/Source/client/cstrike/vguiobjects.c +++ b/Source/client/cstrike/vguiobjects.c @@ -153,9 +153,9 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSi vLabelPos[0] = vPosition[0] + 16; vLabelPos[1] = vPosition[1] + ( ( vSize[1] / 2 ) - 4 ); - if ( ( iVGUIKey == fInputKeyCode ) ) { + if ( ( iVGUIKey == pSeat->fInputKeyCode ) ) { vFunction(); - fInputKeyCode = 0; + pSeat->fInputKeyCode = 0; return TRUE; } diff --git a/Source/client/cstrike/vguiradio.c b/Source/client/cstrike/vguiradio.c index c4d9ba8a..0258fed5 100755 --- a/Source/client/cstrike/vguiradio.c +++ b/Source/client/cstrike/vguiradio.c @@ -52,7 +52,7 @@ Prints and acts as an input check for a single command void VGUI_Radio_DrawCommand( float fIndex, float fMessage, vector vPos ) { VGUI_Text( sprintf( "%d) %s", fIndex + 1, sRadioChat[ fMessage ] ), vPos, '12 12', FONT_CON ); - if ( fInputKeyCode == ( fIndex + 49 ) ) { + if ( pSeat->fInputKeyCode == ( fIndex + 49 ) ) { sendevent( "RadioMessage", "f", fMessage ); pSeat->fVGUI_Display = VGUI_NONE; } @@ -112,7 +112,7 @@ void VGUI_Radio_Draw( void ) { vPos_y += 20; VGUI_Text( sprintf( "0) %s", _("VGUI_BACK") ), vPos, '12 12', FONT_CON ); - if ( fInputKeyCode == 48 ) { + if ( pSeat->fInputKeyCode == 48 ) { pSeat->fVGUI_Display = VGUI_NONE; } } diff --git a/Source/client/defs.h b/Source/client/defs.h index 817d1565..a8c7f07e 100644 --- a/Source/client/defs.h +++ b/Source/client/defs.h @@ -50,21 +50,9 @@ var float DECAL_GLASS; var float SHADER_CULLED; -float fInputSendNext; - vector video_mins; vector video_res; -// Input globals, feel free to use them since they are updated upon input -float fInputKeyCode; -float fInputKeyASCII; -float fInputKeyDown; - -var int iInputAttack2; -var int iInputReload; -var int iInputUse; -var int iInputDuck; - // Input globals for the mouse float fMouseClick; vector mouse_pos; diff --git a/Source/client/entry.c b/Source/client/entry.c index 9b4cf556..b6793243 100644 --- a/Source/client/entry.c +++ b/Source/client/entry.c @@ -236,25 +236,28 @@ Updates all our input related globals for use in other functions float CSQC_InputEvent(float fEventType, float fKey, float fCharacter, float fDeviceID) { + int s = (float)getproperty(VF_ACTIVESEAT); + pSeat = &seats[s]; + switch(fEventType) { case IE_KEYDOWN: if (fKey == K_MOUSE1) { fMouseClick = 1; } else { - fInputKeyDown = 1; + pSeat->fInputKeyDown = 1; } - fInputKeyCode = fKey; - fInputKeyASCII = fCharacter; + pSeat->fInputKeyCode = fKey; + pSeat->fInputKeyASCII = fCharacter; break; case IE_KEYUP: if (fKey == K_MOUSE1) { fMouseClick = 0; } else { - fInputKeyDown = 0; + pSeat->fInputKeyDown = 0; } - fInputKeyCode = 0; - fInputKeyASCII = 0; + pSeat->fInputKeyCode = 0; + pSeat->fInputKeyASCII = 0; break; case IE_MOUSEABS: mouse_pos[0] = fKey; @@ -297,15 +300,15 @@ void CSQC_Input_Frame(void) // If we are inside a VGUI, don't let the client do stuff outside if ((pSeat->fVGUI_Display != VGUI_NONE)) { - fInputSendNext = time + 0.2; + pSeat->fInputSendNext = time + 0.2; } else if ((pSeat->fHUDWeaponSelected) && (input_buttons & INPUT_BUTTON0)) { HUD_DrawWeaponSelect_Trigger(); input_buttons = 0; - fInputSendNext = time + 0.2; + pSeat->fInputSendNext = time + 0.2; } - if (fInputSendNext > time) { + if (pSeat->fInputSendNext > time) { input_impulse = 0; input_buttons = 0; return; @@ -320,19 +323,19 @@ void CSQC_Input_Frame(void) sendevent("Spraylogo", ""); } - if (iInputAttack2 == TRUE) { + if (pSeat->iInputAttack2 == TRUE) { input_buttons |= INPUT_BUTTON3; } - if (iInputReload == TRUE) { + if (pSeat->iInputReload == TRUE) { input_buttons |= INPUT_BUTTON4; } - if (iInputUse == TRUE) { + if (pSeat->iInputUse == TRUE) { input_buttons |= INPUT_BUTTON5; } - if (iInputDuck == TRUE) { + if (pSeat->iInputDuck == TRUE) { input_buttons |= INPUT_BUTTON8; } @@ -445,28 +448,28 @@ float CSQC_ConsoleCommand(string sCMD) Sound_PlayVOX(sCMD); break; case "+attack2": - iInputAttack2 = TRUE; + pSeat->iInputAttack2 = TRUE; break; case "-attack2": - iInputAttack2 = FALSE; + pSeat->iInputAttack2 = FALSE; break; case "+reload": - iInputReload = TRUE; + pSeat->iInputReload = TRUE; break; case "-reload": - iInputReload = FALSE; + pSeat->iInputReload = FALSE; break; case "+use": - iInputUse = TRUE; + pSeat->iInputUse = TRUE; break; case "-use": - iInputUse = FALSE; + pSeat->iInputUse = FALSE; break; case "+duck": - iInputDuck = TRUE; + pSeat->iInputDuck = TRUE; break; case "-duck": - iInputDuck = FALSE; + pSeat->iInputDuck = FALSE; break; case "invnext": HUD_DrawWeaponSelect_Back(); diff --git a/Source/client/valve/defs.h b/Source/client/valve/defs.h index 130b7368..42034d59 100644 --- a/Source/client/valve/defs.h +++ b/Source/client/valve/defs.h @@ -41,6 +41,18 @@ struct // We can only carry one item per slot, so this is hacking around the last one float fHUDWeaponSelected; float fHUDWeaponSelectTime; + +// Input + float fInputKeyCode; + float fInputKeyASCII; + float fInputKeyDown; + + int iInputAttack2; + int iInputReload; + int iInputUse; + int iInputDuck; + + float fInputSendNext; } seats[4], *pSeat; void HUD_DrawAmmo1(void);