Message of the day is now actually being networked. Hurray for infokeys.

This commit is contained in:
Marco Cawthorne 2017-11-12 18:43:16 -06:00
parent d0f0322fc5
commit cbe9b42d93
7 changed files with 47 additions and 30 deletions

View file

@ -76,30 +76,28 @@ Initialize all there is
*/
void CSQC_VGUI_Init( void ) {
string sTemp;
int iMOTDLength;
filestream fmMapDescr;
// First load the MESSAGE OF THE DAY
// TODO: Move this to the server and put strings into infokeys
filestream fmMOTD = fopen( "motd.txt", FILE_READ );
for ( int i = 0; i < 25; i++ ) {
sTemp = fgets( fmMOTD );
if not ( sTemp ) {
break;
}
sMOTDString[ i ] = sTemp;
iMOTDLength = stof( serverkey( "motdlength" ) );
for ( int i = 0; i < iMOTDLength; i++ ) {
sMOTDString[ i ] = serverkey( sprintf( "motdline%i", i ) );
}
fclose( fmMOTD );
// Now load the MAP DESCRIPTION
fmMOTD = fopen( sprintf( "maps/%s.txt", mapname ), FILE_READ );
if ( fmMOTD != -1 ) {
fmMapDescr = fopen( sprintf( "maps/%s.txt", mapname ), FILE_READ );
if ( fmMapDescr != -1 ) {
for ( int i = 0; i < 35; i++ ) {
sTemp = fgets( fmMOTD );
sTemp = fgets( fmMapDescr );
if not ( sTemp ) {
break;
}
sMapString[ i ] = sTemp;
}
fclose( fmMOTD );
fclose( fmMapDescr );
}
// We start on the MOTD, always

View file

@ -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,7 +72,7 @@
<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="yes">
<category name="Shared" expanded="no">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Animations.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\BaseMelee.c" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\Effects.c" />
@ -114,18 +114,19 @@
</project>
<workspace version="Crimson Editor 3.60">
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuConfiguration.c" linenum="255" placement="0:1:-1:-1:-4:-23:198:198:1080:630" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Globals.h" linenum="1" placement="0:1:-1:-1:-4:-23:0:0:886:436" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Defs.h" linenum="189" placement="0:1:-1:-1:-4:-23:22:22:908:458" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Defs.h" linenum="37" placement="0:1:-1:-1:-4:-23:44:44:930:480" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Objects.c" linenum="237" placement="0:1:-1:-1:-4:-23:66:66:952:502" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Builtins.h" linenum="2214" placement="0:1:-1:-1:-4:-23:88:88:974:524" />
<localfile path="C:\cygwin\home\User\FreeCS\freecs\menu.dat.en.po" linenum="49" placement="0:1:-1:-1:-4:-23:110:110:996:546" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Player.c" linenum="264" placement="0:1:-1:-1:-4:-23:132:132:1018:568" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\PhysicsMove.c" linenum="266" placement="0:1:-1:-1:-4:-23:154:154:1040:590" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Client.c" linenum="138" placement="0:1:-1:-1:-4:-23:176:176:1062:612" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Shared\WeaponC4Bomb.c" linenum="89" placement="0:1:-1:-1:-4:-23:198:198:1084:634" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Rules.c" linenum="101" placement="0:1:-1:-1:-4:-23:0:0:886:436" />
<localfile path="C:\cygwin\home\User\FreeCS\freecs\menu.dat.de.po" linenum="48" placement="2:3:-1:-1:-4:-23:22:22:908:458" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuConfiguration.c" linenum="51" placement="0:1:-1:-1:-4:-23:22:22:904:454" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Player.c" linenum="107" placement="0:1:-1:-1:-4:-23:44:44:930:480" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\PhysicsMove.c" linenum="158" placement="0:1:-1:-1:-4:-23:66:66:952:502" />
<localfile path="C:\cygwin\home\User\FreeCS\freecs\default.cfg" linenum="70" placement="2:3:-1:-1:-4:-23:88:88:974:524" />
<localfile path="C:\cygwin\home\User\FreeCS\freecs\ftesrv.cfg" linenum="11" placement="0:1:-1:-1:-4:-23:110:110:996:546" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Client.c" linenum="20" placement="0:1:-1:-1:-4:-23:132:132:1018:568" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Main.c" linenum="154" placement="0:1:-1:-1:-4:-23:154:154:1040:590" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUITeamSelect.c" linenum="1" placement="0:1:-1:-1:-4:-23:22:22:908:458" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUIBuyMenu.c" linenum="145" placement="0:1:-1:-1:-4:-23:44:44:930:480" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUI.c" linenum="81" placement="0:1:-1:-1:-4:-23:66:66:952:502" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Defs.h" linenum="21" placement="0:1:-1:-1:-4:-23:88:88:974:524" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUI.h" linenum="47" placement="0:1:-1:-1:-4:-23:110:110:996:546" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Builtins.h" linenum="2395" placement="0:1:-1:-1:-4:-23:198:198:1084:634" />
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Footsteps.c" linenum="41" placement="0:1:-1:-1:-4:-23:0:0:886:436" />
</workspace>

View file

@ -36,11 +36,15 @@ void Footsteps_Update( void ) {
return;
}
if ( self.movement_x < 200 || self.flags & FL_CROUCHING ) {
return;
}
vStep_x = fabs( self.velocity_x );
vStep_y = fabs( self.velocity_y );
fForce = ( vStep_x + vStep_y );
fDelay = clamp( 0.1, 1 / ( fForce / 100 ), 1 );
fDelay = clamp( 0.1, 1 / ( fForce / 90 ), 1 );
traceline( self.origin + self.view_ofs, self.origin + '0 0 -48', FALSE, self );

View file

@ -52,7 +52,7 @@ void SV_ParseClientCommand( string sCommand ) {
}
return;
} else if ( argv( 0 ) == "say_team" ) {
localcmd( sprintf( "echo %s: %s\n", self.netname, argv( 1 ) ) );
localcmd( sprintf( "echo [TEAM %d] %s: %s\n", self.team, self.netname, argv( 1 ) ) );
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
if ( eFind.team == self.team ) {
SV_SendChat( self, argv( 1 ), eFind, 1 );
@ -125,6 +125,7 @@ It's the map entity, literally
=================
*/
void worldspawn( void ) {
int iMOTDLines = 0;
// Let's load materials.txt because someone thought this was the best idea
string sTemp;
filestream fileMaterial = fopen( "sound/materials.txt", FILE_READ );
@ -140,6 +141,19 @@ void worldspawn( void ) {
fclose( fileMaterial );
}
// The message of the day.
filestream fmMOTD = fopen( "motd.txt", 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 ) );
iMOTDLines++;
}
localcmd( sprintf( "serverinfo motdlength %i\n", iMOTDLines ) );
fclose( fmMOTD );
for ( int i = 1; i < CS_WEAPON_COUNT; i++ ) {
precache_model( sWeaponModels[ i ] );
}

View file

@ -324,7 +324,7 @@ void PlayerPostThink( void ) {
}
if ( self.fFallVelocity > 200 ) {
self.velocity = '0 0 0';
self.velocity *= 0.25;
}
self.fFallVelocity = 0;
}

Binary file not shown.

Binary file not shown.