/* OpenCS Project Copyright (C) 2015 Marco "eukara" Hladik This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define PRINT_LOW 0 #define PRINT_MEDIUM 1 #define PRINT_HIGH 2 #define PRINT_CHAT 3 #define CHAT_LINES 5 #define CHAT_TIME 4 int iLineScroll; float fChatTime; string sMSGBuffer[ CHAT_LINES ]; /* ================= CSQC_Parse_Print Receives a message and sorts it into the chat messagebuffer ================= */ void CSQC_Parse_Print(string sMessage, float fLevel ) { if ( fLevel == PRINT_CHAT ) { if ( iLineScroll < ( CHAT_LINES - 1 ) ) { sMSGBuffer[ iLineScroll + 1 ] = sMessage; iLineScroll++; } else { for ( int i = 0; i < ( CHAT_LINES - 1 ); i++ ) { sMSGBuffer[ i ] = sMSGBuffer[ i + 1 ]; } sMSGBuffer[ CHAT_LINES - 1 ] = sMessage; } fChatTime = time + CHAT_TIME; } } /* ================= CSQC_DrawChat Just prints whatever is in the chat buffer and removes lines after some time. ================= */ void CSQC_DrawChat( void ) { vector vChatPos = [ 16, vVideoResolution_y - 128 ]; // Remove messages after a fChatTime has passed if ( fChatTime < time && iLineScroll >= 0 ) { sMSGBuffer[ iLineScroll ] = ""; iLineScroll--; fChatTime = time + CHAT_TIME; } for ( int i = 0; i < CHAT_LINES; i++ ) { drawstring( vChatPos, sMSGBuffer[ i ], '8 8 0', VGUI_WINDOW_FGCOLOR * 0.8, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE ); vChatPos_y += 12; } } /* ================= CSQC_UpdateView Entry point for drawing on the client ================= */ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) { vVideoResolution_x = fWinWidth; vVideoResolution_y = fWinHeight; clearscene(); setproperty( VF_DRAWENGINESBAR, 0 ); setproperty( VF_DRAWCROSSHAIR, 0 ); addentities( MASK_ENGINE ); // When Cameratime is active, draw on the forced coords instead if ( fCameraTime > time ) { setproperty( VF_ORIGIN, vCameraPos) ; setproperty( VF_ANGLES, vCameraAngle ); } else { View_DrawViewModel(); } renderscene(); if( fGameFocus == TRUE ) { HUD_Draw(); CSQC_DrawChat(); if ( iShowScores == TRUE ) { VGUI_Scores_Show(); } else { CSQC_VGUI_Draw(); } } } /* ================= CSQC_UpdateViewLoading Doesn't really do anything useful yet ================= */ void CSQC_UpdateViewLoading( float fWinWidth, float fWinHeight, float fGameFocus ) { }