Fixed a potential client crash with cl_thirdperson set to 1

Made it so you can at least navigate the UI with the number keys
This commit is contained in:
Marco Cawthorne 2017-11-13 16:52:01 -06:00
parent e4a0a778cc
commit d86ddeff76
13 changed files with 23 additions and 7 deletions

View file

@ -186,6 +186,7 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
HUD_Draw();
}
HUD_DrawOrbituaries();
CSQC_DrawChat();
// Don't even try to draw centerprints and VGUI menus when scores are shown

View file

@ -569,7 +569,6 @@ float CSQC_InputEvent( float fEventType, float fKey, float fCharacter, float fDe
} else {
return FALSE;
}
return FALSE;
}

View file

@ -437,7 +437,7 @@ void HUD_Draw( void ) {
HUD_DrawIcons();
HUD_DrawMoney();
HUD_DrawAmmo();
HUD_DrawOrbituaries();
HUD_DrawProgressBar();
HUD_DrawWeaponSelect();
}

View file

@ -128,7 +128,7 @@ float Player_PreDraw( void ) {
vPlayerVelocity = self.velocity;
if ( autocvar_cl_thirdperson == TRUE ) {
if ( autocvar_cl_thirdperson == TRUE && getstatf( STAT_HEALTH ) > 0 ) {
static vector vStart;
static vector vEnd;

View file

@ -63,6 +63,7 @@ void CSQC_VGUI_Draw( void ) {
vVGUIWindowPos_y = ( vVideoResolution_y / 2 ) - 240;
VGUI_Window( vguiMenus[ fVGUI_Display - 1 ].sTitle, vVGUIWindowPos, '640 480 0' );
iVGUIKey = 48;
// Display the contents of whatever we have selected
vguiMenus[ fVGUI_Display - 1 ].vDraw( vVGUIWindowPos );
}

View file

@ -47,6 +47,8 @@ vector vVGUIButtonPos;
string sMOTDString[25];
string sMapString[35];
var int iVGUIKey;
typedef struct {
string sTitle;
void( vector vPos ) vDraw;

View file

@ -154,6 +154,10 @@ Draws a button, returns whether or not a mouse is hovering over it (for inherita
float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSize ) {
vector vLabelPos;
if ( iVGUIKey < 57 ) {
iVGUIKey++;
}
drawfill( vPosition, [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( [vPosition_x, vPosition_y + vSize_y - 1], [vSize_x, 1], vVGUIColor, VGUI_WINDOW_FGALPHA );
drawfill( vPosition, [1, vSize_y], vVGUIColor, VGUI_WINDOW_FGALPHA );
@ -162,8 +166,14 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSi
// Draw the button label
vLabelPos_x = vPosition_x + 16;
vLabelPos_y = vPosition_y + ( ( vSize_y / 2 ) - 4 );
if( VGUI_CheckMouse( vPosition, vSize ) ) {
if ( ( iVGUIKey == fInputKeyCode ) ) {
vFunction();
fInputKeyCode = 0;
return TRUE;
}
if ( VGUI_CheckMouse( vPosition, vSize ) ) {
if ( fMouseClick == TRUE ) {
vFunction();
fMouseClick = FALSE;
@ -175,7 +185,7 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPosition, vector vSi
} else {
CSQC_DrawText( vLabelPos, sLabel, '8 8', vVGUIColor * 0.8, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE, FONT_DEFAULT );
}
return FALSE;
}

View file

@ -114,5 +114,6 @@
</project>
<workspace version="Crimson Editor 3.60">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Client.c" linenum="15" placement="2:3:-1:-1:-4:-23:22:22:904:454" />
</workspace>

View file

@ -62,5 +62,5 @@ void m_draw( vector vScreenSize ) {
fcsMain[ iMenu ].vMenu();
Header_Draw();
drawstring( '16 16', sprintf( "FreeCS Version %s\n", VERSION ), '8 8', '1 1 1', 1.0f, 0 );
drawstring( '16 16', sprintf( "FreeCS Version: %s\n", __DATE__ ), '8 8', '1 1 1', 1.0f, 0 );
}

View file

@ -169,6 +169,8 @@ void worldspawn( void ) {
localcmd( sprintf( "serverinfo motdlength %i\n", iMOTDLines ) );
fclose( fmMOTD );
localcmd( sprintf( "serverinfo fcs_ver %s\n", __DATE__ ) );
for ( int i = 1; i < CS_WEAPON_COUNT; i++ ) {
precache_model( sWeaponModels[ i ] );
}

Binary file not shown.

Binary file not shown.

Binary file not shown.