cl_dll/in_main.cpp
3456789
// Purpose: builds an intended movement command to send to the server
//
// $Workfile: $
// $Date: $
// $NoKeywords: $
//=============================================================================//
3456789
// Purpose: builds an intended movement command to send to the server
//
// $Workfile: $
// $Date: 2005/10/07 13:40:33 $
// $NoKeywords: $
//=============================================================================//
212223242526
#include "hltvcamera.h"
#include // isalnum()
#include
extern ConVar in_joystick;
21222324252627282930
#include "hltvcamera.h"
#include // isalnum()
#include
#include "c_ff_player.h" // |-- Mirv: Needed for ScaleMovements
#include "ff_hud_menu_medengy.h" // |-- Mulch: for g_pMedEngyHudMenu
#include "ff_hud_HintCenter.h" // Jiggles: for g_pHintCenter
#include "mapscreen.h" // Jiggles: for g_pMapScreen
extern ConVar in_joystick;
47484950515253545556
ConVar cl_pitchspeed( "cl_pitchspeed", "225", 0 );
ConVar cl_pitchdown( "cl_pitchdown", "89", FCVAR_CHEAT );
ConVar cl_pitchup( "cl_pitchup", "89", FCVAR_CHEAT );
ConVar cl_sidespeed( "cl_sidespeed", "400", 0 );
ConVar cl_upspeed( "cl_upspeed", "320", FCVAR_ARCHIVE );
ConVar cl_forwardspeed( "cl_forwardspeed", "400", FCVAR_ARCHIVE );
ConVar cl_backspeed( "cl_backspeed", "400", FCVAR_ARCHIVE );
ConVar lookspring( "lookspring", "0", FCVAR_ARCHIVE );
ConVar lookstrafe( "lookstrafe", "0", FCVAR_ARCHIVE );
ConVar in_joystick( "joystick","0", FCVAR_ARCHIVE );
51525354555657585960
ConVar cl_pitchspeed( "cl_pitchspeed", "225", 0 );
ConVar cl_pitchdown( "cl_pitchdown", "89", FCVAR_CHEAT );
ConVar cl_pitchup( "cl_pitchup", "89", FCVAR_CHEAT );
ConVar cl_sidespeed( "cl_sidespeed", "1000", 0 );
ConVar cl_upspeed( "cl_upspeed", "1000", FCVAR_ARCHIVE );
ConVar cl_forwardspeed( "cl_forwardspeed", "1000", FCVAR_ARCHIVE );
ConVar cl_backspeed( "cl_backspeed", "1000", FCVAR_ARCHIVE );
ConVar lookspring( "lookspring", "0", FCVAR_ARCHIVE );
ConVar lookstrafe( "lookstrafe", "0", FCVAR_ARCHIVE );
ConVar in_joystick( "joystick","0", FCVAR_ARCHIVE );
516517518519520521522
}
}
/*
============
KeyEvent
520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
}
}
// BEGIN: Jiggles: For display of the Map Screenshot
void IN_MapShotDown( void )
{
if ( gViewPortInterface )
{
if( g_pMapScreen )
g_pMapScreen->KeyDown();
}
}
void IN_MapShotUp( void )
{
if ( gViewPortInterface )
{
if( g_pMapScreen )
g_pMapScreen->KeyUp();
}
}
// END: Jiggles: For display of the Map Screenshot
// BEG: Added by Mulchman for team change & class change
void IN_ChangeTeam( void )
{
if( gViewPortInterface )
{
IViewPortPanel *pPanel = gViewPortInterface->FindPanelByName( PANEL_TEAM );
if( pPanel )
gViewPortInterface->ShowPanel( PANEL_TEAM, true );
}
}
void IN_ChangeClass( void )
{
// --> Mirv: Select team first bud
C_BasePlayer *player = C_BasePlayer::GetLocalPlayer();
if (player && player->GetTeamNumber() < TEAM_BLUE)
{
IN_ChangeTeam();
return;
}
// <-- Mirv: Select team first bud
if( gViewPortInterface )
{
IViewPortPanel *pPanel = gViewPortInterface->FindPanelByName( PANEL_CLASS );
if( pPanel )
gViewPortInterface->ShowPanel( PANEL_CLASS, true );
}
}
// END: Added by Mulchman for team change & class change
void IN_ServerInfo( void )
{
if( gViewPortInterface )
{
IViewPortPanel *pPanel = gViewPortInterface->FindPanelByName( PANEL_INFO );
if( pPanel )
gViewPortInterface->ShowPanel( PANEL_INFO, true );
}
}
extern void HudContextShowCalls(bool visible);
// BEG: Mulch: For medic & engy hud radial style menu
void IN_MedEngyMenuDown( void )
{
//if( g_pMedEngyHudMenu )
// g_pMedEngyHudMenu->KeyDown();
HudContextShowCalls(true);
}
void IN_MedEngyMenuUp( void )
{
//if( g_pMedEngyHudMenu )
// g_pMedEngyHudMenu->KeyUp();
HudContextShowCalls(false);
}
// END: Mulch: For medic & engy hud radial style menu
// BEGIN: Jiggles: For displaying the Hint Center
void IN_HintCenterDown( void )
{
if( g_pHintCenter )
g_pHintCenter->KeyDown();
}
void IN_HintCenterUp( void )
{
if( g_pHintCenter )
g_pHintCenter->KeyUp();
}
// END: Jiggles: For displaying the Hint Center
extern int HudContextMenuInput(int down, int keynum, const char *pszCurrentBinding);
/*
============
KeyEvent
763764765766767768
}
}
/*
==============================
ScaleMovements
864865866867868869870871872
}
}
extern bool Client_IsIntermission();
extern void ForceScoreboard();
/*
==============================
ScaleMovements
775776777778779780
// clip to maxspeed
// FIXME FIXME: This doesn't work
return;
/*
879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
// clip to maxspeed
// FIXME FIXME: This doesn't work
// --> Mirv: FIXED FIXED
if (Client_IsIntermission())
{
cmd->forwardmove = 0.0f;
cmd->sidemove = 0.0f;
cmd->upmove = 0.0f;
ForceScoreboard();
}
// We have to scale speeds this early on.
// This way we don't tell the server that we're trying to move faster than we
// know we're allowed. This reduces jerkiness when the max speed is changing, since
// if the client maxspeed is temporarily slower than the server, it'll still be
// telling the server to move at its own maxspeed and the client/server movements
// won't diverge.
C_FFPlayer *pPlayer = ToFFPlayer(CBasePlayer::GetLocalPlayer());
if (!pPlayer)
return;
float flSpeed = sqrt((cmd->forwardmove * cmd->forwardmove) +
(cmd->sidemove * cmd->sidemove) +
(cmd->upmove * cmd->upmove));
float flMaxSpeed = pPlayer->MaxSpeed() * pPlayer->m_flSpeedModifier;
// SourceTV clients' maxspeed is set to zero, which made it impossible to move in freelook
// the commented code below (original SDK code?) has this if check -squeek
if (pPlayer->IsHLTV() && flMaxSpeed == 0)
return;
if (flSpeed > flMaxSpeed)
{
float fRatio = flMaxSpeed / flSpeed;
cmd->forwardmove *= fRatio;
cmd->sidemove *= fRatio;
cmd->upmove *= fRatio;
}
// Oh gawd.
// These are transmitted in a way that the decimal part gets lost. This causes the
// client to end up slightly faster sometimes and therefore warp around as the server
// drags it back. Therefore lop off the fraction now.
cmd->forwardmove = (int) cmd->forwardmove;
cmd->sidemove = (int) cmd->sidemove;
// <-- Mirv
return;
/*
132313241325132613271328
static ConCommand endgrenade2( "-grenade2", IN_Grenade2Up );
static ConCommand startgrenade2( "+grenade2", IN_Grenade2Down );
/*
============
Init_All
1477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504
static ConCommand endgrenade2( "-grenade2", IN_Grenade2Up );
static ConCommand startgrenade2( "+grenade2", IN_Grenade2Down );
// BEG: Added by Mulchman for team & class changing
static ConCommand changeteam( "changeteam", IN_ChangeTeam );
static ConCommand changeclass( "changeclass", IN_ChangeClass );
// END: Added by Mulchman for team & class changing
static ConCommand serverinfo( "serverinfo", IN_ServerInfo );
// BEG: Mulch: For medic & engy hud radial style menu
static ConCommand startMedEngyMenu( "+medengymenu", IN_MedEngyMenuDown );
static ConCommand endMedEngymenu( "-medengymenu", IN_MedEngyMenuUp );
// END: Mulch: For medic & engy hud radial style menu
// BEGIN: Jiggles: For display of the Hint Center
static ConCommand startHintCenter( "+hintcenter", IN_HintCenterDown );
static ConCommand endHintCenter( "-hintcenter", IN_HintCenterUp );
// END: Jiggles: For display of the Hint Center
// BEGIN: Jiggles: For display of the Map Screenshot
static ConCommand startMapShot( "+mapshot", IN_MapShotDown );
static ConCommand endMapShot( "-mapshot", IN_MapShotUp );
// END: Jiggles: For display of the Map Screenshot
/*
============
Init_All