Added the weapon recoil/viewkick

Added support for newlines in MOTDs
D
Server owners can now specify custom MOTDs with the cvar 'motdfile', e.g. 'motdfile coolmotd.txt'
This commit is contained in:
Marco Cawthorne 2017-11-15 15:36:55 -06:00
parent faa0ddf24a
commit ec5d21b91b
16 changed files with 65 additions and 18 deletions

View file

@ -92,6 +92,9 @@ vector vPlayerOrigin;
vector vPlayerOriginOld;
vector vPlayerVelocity;
vector vPunchAngle;
void View_AddPunchAngle( vector vAdd );
void View_PlayAnimation( int iSequence );
string HUD_GetChatColorHEX( float fTeam );

View file

@ -172,9 +172,12 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
setproperty( VF_ORIGIN, vPlayerOrigin + [ 0, 0, getstatf( STAT_VIEWHEIGHT ) ] );
setproperty( VF_ANGLES, view_angles );
View_DrawViewModel();
}
setproperty( VF_ANGLES, view_angles + vPunchAngle );
renderscene();
View_DropPunchAngle();
Nightvision_PostDraw();

View file

@ -610,4 +610,6 @@ void CSQC_Input_Frame( void ) {
if ( iInputDuck == TRUE ) {
input_buttons |= INPUT_BUTTON6;
}
input_angles += vPunchAngle;
}

View file

@ -73,6 +73,7 @@ void Player_Draw( void ) {
self.baseframe2time += frametime;
self.frame2time += frametime;
}
/*
=================
Player_PreDraw

View file

@ -42,7 +42,9 @@ void VGUI_MessageOfTheDay( vector vPos ) {
vector vTextPos = vPos + '16 116 0';
for ( int i = 0; i < 25; i++ ) {
VGUI_Text( sMOTDString[ i ], vTextPos, '8 8', FONT_DEFAULT );
if ( sMOTDString[ i ] != "/" ) {
VGUI_Text( sMOTDString[ i ], vTextPos, '8 8', FONT_DEFAULT );
}
vTextPos_y += 10;
}

View file

@ -89,6 +89,16 @@ float View_CalcBob( void ) {
return fBob;
}
void View_DropPunchAngle( void ) {
float fLerp;
fLerp = 1.0f - ( frametime * 4 );
vPunchAngle *= fLerp;
}
void View_AddPunchAngle( vector vAdd ) {
vPunchAngle += vAdd;
}
/*
====================
View_ProcessEvent

View file

@ -1,5 +1,5 @@
<project version="Crimson Editor 3.60">
<category name="Client" expanded="no">
<category name="Client" expanded="yes">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Defs.h" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Draw.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Entities.c" />
@ -25,7 +25,7 @@
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUITeamSelect.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\View.c" />
</category>
<category name="Server" expanded="no">
<category name="Server" expanded="yes">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\AmbientSound.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Ammo.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\ArmouryEntity.c" />
@ -60,7 +60,7 @@
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\TraceAttack.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Triggers.c" />
</category>
<category name="Menu" expanded="yes">
<category name="Menu" expanded="no">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Defs.h" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Draw.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Header.c" />
@ -72,8 +72,9 @@
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Objects.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\progs.src" />
</category>
<category name="Shared" expanded="no">
<category name="Shared" expanded="yes">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Animations.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\BaseGun.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\BaseMelee.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Effects.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Equipment.c" />
@ -114,13 +115,5 @@
</project>
<workspace version="Crimson Editor 3.60">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\HUD.c" linenum="12" placement="0:1:-1:-1:-4:-23:0:0:882:432" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuMultiplayer.c" linenum="256" placement="2:3:-1:-1:-4:-23:22:22:908:458" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Init.c" linenum="20" placement="0:1:-1:-1:-4:-23:44:44:930:480" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Builtins.h" linenum="2487" placement="0:1:-1:-1:-4:-23:66:66:952:502" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Defs.h" linenum="66" placement="0:1:-1:-1:-4:-23:88:88:974:524" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Draw.c" linenum="64" placement="0:1:-1:-1:-4:-23:132:132:1018:568" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Objects.c" linenum="103" placement="0:1:-1:-1:-4:-23:154:154:1040:590" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Header.c" linenum="21" placement="0:1:-1:-1:-4:-23:176:176:1062:612" />
</workspace>

View file

@ -29,6 +29,28 @@ float Math_Lerp( float fA, float fB, float fPercent ) {
return ( fA * ( 1 - fPercent ) ) + ( fB * fPercent );
}
float Math_VectorNormalize( vector v ) {
float length, ilength;
length = v_x*v_x + v_y*v_y + v_z*v_z;
length = sqrt( length ); // FIXME
if ( length ) {
ilength = 1 / length;
v[0] *= ilength;
v[1] *= ilength;
v[2] *= ilength;
}
return length;
}
void Math_VectorScale( vector in, float scale, __inout vector out ) {
out_x = in_x * scale;
out_y = in_y * scale;
out_z = in_z * scale;
}
float Math_FixDelta( float fDelta ) {
if ( fDelta >= 180 ) {
fDelta -= 360;

View file

@ -134,10 +134,10 @@ void Menu_Multiplayer( void ) {
//sethostcachemaskstring( 0, gethostcacheindexforkey( "gamedir" ), "freecs", SLIST_TEST_EQUAL );
sethostcachesort( gethostcacheindexforkey( "ping" ), FALSE );
refreshhostcache();
resorthostcache();
iSelectedServer = -2;
}
resorthostcache();
fldName = gethostcacheindexforkey("name");
fldAddress = gethostcacheindexforkey("cname");
fldPing = gethostcacheindexforkey("ping");

View file

@ -28,6 +28,7 @@ var float autocvar_mp_freezetime = 6;
var float autocvar_mp_c4timer = 45;
var float autocvar_mp_roundtime = 5;
var float autocvar_mp_fillweapons = 0;
var string autocvar_motdfile = "motd.txt";
// Hit Group standards
enum {

View file

@ -157,13 +157,18 @@ void worldspawn( void ) {
}
// The message of the day.
filestream fmMOTD = fopen( "motd.txt", FILE_READ );
filestream fmMOTD = fopen( autocvar_motdfile, FILE_READ );
for ( int i = 0; i < 25; i++ ) {
sTemp = fgets( fmMOTD );
if not ( sTemp ) {
break;
}
localcmd( sprintf( "serverinfo motdline%i %s\n", iMOTDLines, sTemp ) );
if ( sTemp == __NULL__ ) {
localcmd( sprintf( "serverinfo motdline%i /\n", iMOTDLines ) );
} else {
localcmd( sprintf( "serverinfo motdline%i %s\n", iMOTDLines, sTemp ) );
}
iMOTDLines++;
}
localcmd( sprintf( "serverinfo motdlength %i\n", iMOTDLines ) );

View file

@ -71,11 +71,16 @@ void BaseGun_ShotMultiplierHandle( float fShots ) {
}
self.fDecreaseShotTime = time + 0.2;
#else
vector vPunch;
if ( iShotMultiplier > 12 ) {
iShotMultiplier = 12;
} else {
iShotMultiplier += fShots;
}
vPunch_x = -2 * ( iShotMultiplier / 6 );
vPunch_y = random( -1, 1 );
View_AddPunchAngle( vPunch );
#endif
}

Binary file not shown.

View file

@ -9,6 +9,7 @@ seta mp_freezetime 6
seta mp_c4timer 45
seta mp_roundtime 5
seta mp_fillweapons 0
seta motdfile "motd.txt" // In case you want to use a different Message Of The Day
// Physics
seta pm_bunnyspeedcap "1"
@ -18,7 +19,6 @@ seta sv_maxspeed 240
// Misc
seta com_nogamedirnativecode "0"
// for now, because people don't seem to be able to install things properly
seta allow_download_maps "0"
seta allow_download_models "0"

Binary file not shown.

Binary file not shown.