nuclide/Source/Client/Draw.c
Marco Hladik b1b81e8728 Added env_sprite (non-looping)
Added fixes to the VIP selection algorithm
Particle fixes and tweaks
Change how ModelGib calls are broadcast due to PVS issues on maps like cs_militia
Fixed scoreboard coloring
Fixed the random-number generation in some occasions
Added gibmodels being able to have a random selection of submodels
Added monetary rewards
Added penalties for injuring/killing hostages
Misc fixes to func_door and func_button in terms of triggering events
2016-12-10 15:25:16 +01:00

127 lines
3 KiB
C

/*
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;
} else {
print( sMessage );
}
}
/*
=================
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 ) {
}