Minor fixes to VGUI objects and Nightvision

This commit is contained in:
Marco Hladik 2016-12-24 01:23:33 +01:00
parent cb9fa0b183
commit 234b38bb44
5 changed files with 17 additions and 11 deletions

View file

@ -31,6 +31,7 @@ var vector autocvar_cross_color = '0 255 0'; // autocvar of "cross_color"
var float autocvar_cl_bob = 0.01;
var float autocvar_cl_bobcycle = 0.8;
var float autocvar_cl_bobup = 0.5;
var float autocvar_cl_bobclassic = 0;
vector vHUDColor; // Defined in HUD_Draw (HUD.c)
vector vVGUIColor; // Defined in HUD_Draw (VGUI.c)

View file

@ -59,7 +59,7 @@ void Nightvision_PreDraw( void ) {
}
if ( iNightVision == TRUE ) {
dynamiclight_add( getproperty( VF_ORIGIN ), 500, '0 0.75 0');
dynamiclight_add( getproperty( VF_ORIGIN ), 500, '0 0.45 0');
}
}

View file

@ -135,8 +135,6 @@ void VGUI_FakeButton( string sLabel, vector vPos, vector vSize ) {
// Draw the button label
v4_x = vPos_x + 16;
v4_y = vPos_y + ( ( vSize_y / 2 ) - 4 );
drawstring( v4, sLabel, '8 8 0', vVGUIColor * 0.5, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
}

View file

@ -76,26 +76,24 @@ float View_CalcBob( void ) {
vVelocity_z = 0;
fBob = sqrt( vVelocity_x * vVelocity_x + vVelocity_y * vVelocity_y ) * autocvar_cl_bob;
fBob = fBob * 0.3 + fBob * 0.7 * sin(fCycle);
fBob = fBob * 0.3 + fBob * 0.7 * sin( fCycle );
fBob = min( fBob, 4 );
fBob = max( fBob, -7 );
return fBob * 0.5;
return fBob;
}
entity eViewModel;
void View_DrawViewModel( void ) {
static float fLastTime;
static float fBob;
if( !eViewModel ) {
eViewModel = spawn();
eViewModel.renderflags = RF_DEPTHHACK;
}
if ( time != fLastTime ) {
makevectors( getproperty( VF_ANGLES ) );
eViewModel.origin = getproperty( VF_ORIGIN ) + '0 0 -1' + ( v_forward * View_CalcBob() );
eViewModel.angles = getproperty( VF_ANGLES );
fBob = View_CalcBob();
if( getstatf( STAT_ACTIVEWEAPON ) < CS_WEAPON_COUNT ) {
setmodel( eViewModel, sViewModels[ getstatf( STAT_ACTIVEWEAPON ) ] );
@ -104,6 +102,15 @@ void View_DrawViewModel( void ) {
eViewModel.frame1time += frametime;
}
makevectors( getproperty( VF_ANGLES ) );
eViewModel.origin = getproperty( VF_ORIGIN ) + '0 0 -1' + ( v_forward * ( fBob * 0.4 ) );
eViewModel.angles = getproperty( VF_ANGLES );
// Give the gun a tilt effect like in old HL/CS versions
if ( autocvar_cl_bobclassic == 1 ) {
eViewModel.angles_z = -fBob;
}
fLastTime = time;
addentity( eViewModel );
}

View file

@ -161,8 +161,8 @@ typedef struct {
float fRangeModifier; // ???
float fWeaponType;
float fAttackFinished; // When is the gone done firing
float fReloadFinished; // When is the gone done firing
float fAttackFinished;
float fReloadFinished;
.int iCaliberfld; // Pointer towards the caliberfield of the gun
.int iMagfld; // Pointer towards the clip of the gun