Fixed LOADS of networking guff.

This commit is contained in:
Marco Cawthorne 2017-04-19 23:06:41 +02:00
parent 286d873fba
commit 4007c5111b
21 changed files with 96 additions and 61 deletions

View file

@ -89,3 +89,7 @@ void View_PlayAnimation( int iSequence );
// This actually belongs in Builtins.h since its an undocumented global
vector pmove_vel;
.float weapon;
void Animation_ShootWeapon( void );
void Animation_ReloadWeapon( void )

View file

@ -48,6 +48,7 @@ void CSQC_Ent_Update( float flIsNew ) {
self.velocity_y = readshort();
self.velocity_z = readshort();
self.flags = readfloat();
self.weapon = readbyte();
if ( self.flags & FL_CROUCHING ) {
setsize( self, VEC_CHULL_MIN, VEC_CHULL_MAX );

0
Source/Client/Event.c Normal file → Executable file
View file

4
Source/Client/HUDCrosshair.c Normal file → Executable file
View file

@ -56,10 +56,10 @@ void HUD_DrawCrosshair( void ) {
fCrosshairDistance = min( 15, fCrosshairDistance + fDeltaDistance );
} else if ( fCrosshairDistance > fDistance ) {
// Slowly decrease the distance again, 0.02 seems to be the magic number here.
fCrosshairDistance -= frametime + ( fCrosshairDistance * 0.02 );
fCrosshairDistance -= ( fCrosshairDistance * frametime );
if ( ( iShotMultiplier > 0 ) && ( fDecreaseShotTime < time ) ) {
fDecreaseShotTime = time + 0.02;
fDecreaseShotTime = time + 0.2;
iShotMultiplier--;
}
}

View file

@ -20,6 +20,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
float Player_PreDraw( void ) {
if ( self.entnum == player_localentnum ) {
// Don't predict if we're frozen/paused
if ( serverkey( SERVERKEY_PAUSESTATE ) == "1" || ( ( getstati( STAT_GAMESTATE ) == GAME_FREEZE ) && ( getstati( STAT_HEALTH ) > 0 ) ) ) {
vPlayerOrigin = self.origin;
vPlayerVelocity = '0 0 0';
addentity( self );
return PREDRAW_NEXT;
}
vector vOldOrigin = self.origin;
vector vOldVelocity = self.velocity;
float fOldPMoveFlags = self.pmove_flags;
@ -59,6 +67,9 @@ float Player_PreDraw( void ) {
self.renderflags = RF_EXTERNALMODEL;
} else {
Animation_PlayerUpdate();
self.baseframe1time += frametime;
self.frame1time += frametime;
addentity( self );
}
return PREDRAW_NEXT;

2
Source/Client/VGUISpectator.c Normal file → Executable file
View file

@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "VGUI.h"
void VGUI_DrawSpectatorHUD( void ) {
vHUDColor = autocvar_con_color * ( 1 / 255 );
// Draw the borders
drawfill( [ 0, 0 ], [ vVideoResolution_x, 40 ], '0 0 0', 1 );
drawfill( [ 0, vVideoResolution_y - 40], [ vVideoResolution_x, 40 ], '0 0 0', 1 );

View file

@ -10,6 +10,7 @@
../Math.h
Defs.h
../Shared/WeaponAK47.c
../Shared/WeaponAUG.c
../Shared/WeaponAWP.c
@ -42,7 +43,7 @@ Defs.h
../Shared/Effects.c
../Shared/Radio.c
../Shared/Equipment.c
../Shared/Animations.c
../Server/AmbientSound.c
Player.c

View file

@ -63,6 +63,7 @@ enum {
STAT_PROGRESS,
STAT_TEAM,
STAT_GAMETIME,
STAT_GAMESTATE,
STAT_WON_T,
STAT_WON_CT
};
@ -281,6 +282,7 @@ enum {
#define FL_USERELEASED 8192
#define FL_CROUCHING 16384
#define FL_SEMI_TOGGLED 32768
#define FL_FROZEN 131072
float clamp(float d, float imin, float imax) {
float t;

View file

@ -49,7 +49,7 @@ Run every frame on every spectator
=================
*/
void SpectatorThink( void ) {
self.SendFlags = 1;
}
/*
@ -121,7 +121,6 @@ Funtion that can interrupt client commands before physics are run
=================
*/
void SV_RunClientCommand( void ) {
// The individual zones will just override this behavior
self.fInBombZone = FALSE;
self.fInBuyZone = FALSE;
@ -148,9 +147,8 @@ void Client_SendEvent( entity eClient, float fEVType ) {
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
WriteByte( MSG_MULTICAST, fEVType );
msg_entity = eClient;
multicast( '0 0 0', MULTICAST_ALL );
multicast( '0 0 0', MULTICAST_ONE );
}
/*
@ -162,18 +160,14 @@ Switches the player camera to a different position for a specific time
*/
void Client_TriggerCamera( entity eTarget, vector vPos, vector vEndPos, float fResetTime ) {
WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
WriteByte( MSG_MULTICAST, EV_CAMERATRIGGER );
WriteCoord( MSG_MULTICAST, vPos_x );
WriteCoord( MSG_MULTICAST, vPos_y );
WriteCoord( MSG_MULTICAST, vPos_z );
WriteCoord( MSG_MULTICAST, vEndPos_x );
WriteCoord( MSG_MULTICAST, vEndPos_y );
WriteCoord( MSG_MULTICAST, vEndPos_z );
WriteFloat( MSG_MULTICAST, fResetTime );
msg_entity = eTarget;
multicast( '0 0 0', MULTICAST_ALL );
multicast( '0 0 0', MULTICAST_ONE );
}

2
Source/Server/EntHostage.c Normal file → Executable file
View file

@ -134,7 +134,7 @@ void hostage_physics( void ) {
vector vEndAngle = vectoangles( self.eTargetPoint.origin - self.origin );
// Slowly turn towards target
float fTurn = Math_LerpAngle( self.angles_y, vEndAngle_y, 0.2 );
float fTurn = Math_LerpAngle( self.angles_y, vEndAngle_y, frametime );
self.angles_y += fTurn;
// Is the waypoint close? if so, remove and go set the next one!

11
Source/Server/FuncButton.c Normal file → Executable file
View file

@ -45,7 +45,7 @@ enum {
.float state;
.vector pos1, pos2;
// Not all that customizable...
// Not all that customizable... but better than QUAKE.
.float movesnd;
.float stopsnd;
@ -55,11 +55,12 @@ FuncButton_PrecacheSounds
====================
*/
void FuncButton_PrecacheSounds( void ) {
string sSample = "buttons/button9.wav";
string sSample = "buttons/button9.wav"; // Default sample?
switch( self.sounds ) {
case 0:
sSample = "common/null.wav";
// if you ever wondered why a silent button sounded a bit noisey... it's because this one kinda blows
sSample = "common/null.wav";
break;
case 1:
sSample = "buttons/button1.wav";
@ -119,6 +120,7 @@ void FuncButton_PrecacheSounds( void ) {
sSample = "buttons/lever5.wav";
break;
}
precache_sound( sSample );
self.noise = sSample;
}
@ -236,7 +238,7 @@ FuncButton_Blocked
====================
*/
void FuncButton_Blocked( void ) {
if( self.dmg ) {
if ( self.dmg ) {
Damage_Apply( other, self, self.dmg, other.origin );
}
@ -277,7 +279,6 @@ void func_button( void ) {
}
self.iUsable = TRUE;
self.pos1 = self.origin;
if ( self.spawnflags & SF_BTT_NOMOVE ) {

28
Source/Server/FuncDoorRotating.c Normal file → Executable file
View file

@ -24,14 +24,16 @@ func_door_rotating Spawnflags
=================
*/
#define SF_ROT_OPEN 1
#define SF_ROT_REVERSE 2
#define SF_ROT_UNLINK 4
#define SF_ROT_ONEWAY 16
#define SF_ROT_TOGGLE 32
#define SF_ROT_XAXIS 64
#define SF_ROT_YAXIS 128
#define SF_ROT_USE 256
enumflags {
SF_ROT_OPEN,
SF_ROT_REVERSE,
SF_ROT_UNLINK,
SF_ROT_ONEWAY,
SF_ROT_TOGGLE,
SF_ROT_XAXIS,
SF_ROT_YAXIS,
SF_ROT_USE
};
void FuncDoorRotate_RotateAway( void );
void FuncDoorRotate_RotateBack( void );
@ -84,7 +86,7 @@ FuncDoorRotate_RotateBack
*/
void FuncDoorRotate_RotateBack( void ) {
if( self.movesnd > 0 && self.movesnd <= 10 ) {
if ( self.movesnd > 0 && self.movesnd <= 10 ) {
sound( self, CHAN_VOICE, sprintf( "doors/doormove%d.wav", self.movesnd ), 1.0, ATTN_NORM );
} else {
sound( self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM );
@ -110,7 +112,7 @@ void FuncDoorRotate_RotateAway( void ) {
return;
}
if( self.movesnd > 0 && self.movesnd <= 10 ) {
if ( self.movesnd > 0 && self.movesnd <= 10 ) {
sound( self, CHAN_VOICE, sprintf( "doors/doormove%d.wav", self.movesnd ), 1.0, ATTN_NORM );
} else {
sound( self, CHAN_VOICE, "common/null.wav", 1.0, ATTN_NORM );
@ -175,7 +177,7 @@ void FuncDoorRotate_Touch( void ) {
eActivator = other;
FuncDoorRotate_Trigger();
if( !( self.spawnflags & SF_ROT_USE ) ) {
if ( !( self.spawnflags & SF_ROT_USE ) ) {
self.touch = __NULL__;
}
}
@ -187,7 +189,7 @@ FuncDoorRotate_Blocked
=================
*/
void FuncDoorRotate_Blocked( void ) {
if( self.dmg ) {
if ( self.dmg ) {
Damage_Apply( other, self, self.dmg, other.origin );
}
@ -225,7 +227,7 @@ void func_door_rotating( void ) {
self.speed = 100;
}
if( self.wait == 0 ) {
if ( self.wait == 0 ) {
self.wait = 4;
}

17
Source/Server/FuncLadder.c Normal file → Executable file
View file

@ -18,6 +18,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Uncomment this once FTEs engine ladder is fixed?
//#define FTE_LADDER
/*
=================
func_ladder_sound
@ -28,7 +31,7 @@ void func_ladder_sound( entity target ) {
return;
}
float vStep = target.velocity_z;
float vStep = target.velocity_z;
if ( vStep < 0 ) {
vStep *= -1.0;
@ -57,12 +60,12 @@ func_ladder_touch
=================
*/
void func_ladder_touch( void ) {
vector vPlayerVector;
if ( other.classname != "player" ) {
return;
}
#ifndef FTE_LADDER
vector vPlayerVector;
makevectors( other.v_angle );
vPlayerVector = v_forward;
vPlayerVector = ( vPlayerVector * 240 );
@ -72,7 +75,8 @@ void func_ladder_touch( void ) {
} else {
other.velocity = '0 0 0';
}
#endif
func_ladder_sound( other );
}
@ -94,6 +98,11 @@ void func_ladder( void ) {
self.solid = SOLID_TRIGGER;
setmodel( self, self.model );
self.model = 0;
#ifdef FTE_LADDER
self.skin = CONTENT_LADDER;
self.alpha = 0.001;
#endif
self.touch = func_ladder_touch;
}

4
Source/Server/Input.c Normal file → Executable file
View file

@ -26,6 +26,10 @@ Handles impulse and whatnot
=================
*/
void Input_Handle( void ) {
if ( self.health <= 0 ) {
return;
}
// TODO: Make this fast switch only
if ( self.impulse == 3 ) {
Weapon_Switch( SLOT_MELEE );

1
Source/Server/Main.c Normal file → Executable file
View file

@ -375,6 +375,7 @@ void worldspawn( void ) {
clientstat( STAT_PROGRESS, EV_FLOAT, fProgressBar );
clientstat( STAT_FLAGS, EV_FLOAT, flags );
pointerstat( STAT_GAMETIME, EV_FLOAT, &fGameTime );
pointerstat( STAT_GAMESTATE, EV_FLOAT, &fGameState );
pointerstat( STAT_WON_T, EV_INTEGER, &iWon_T );
pointerstat( STAT_WON_CT, EV_INTEGER, &iWon_CT );

View file

@ -35,6 +35,7 @@ float Player_SendEntity( entity ePEnt, float fChanged ) {
WriteShort( MSG_ENTITY, self.velocity_y );
WriteShort( MSG_ENTITY, self.velocity_z );
WriteFloat( MSG_ENTITY, self.flags );
WriteByte( MSG_ENTITY, self.weapon );
return TRUE;
}

View file

@ -9,7 +9,7 @@
Defs.h
Money.c
Animations.c
../Shared/Animations.c
PhysicsMove.c
../Shared/Radio.c

52
Source/Shared/Weapons.c Normal file → Executable file
View file

@ -125,7 +125,8 @@ void Weapon_PrimaryAttack( float fWeapon ) {
if ( !( self.flags & FL_SEMI_TOGGLED ) )
return;
#endif
Animation_ShootWeapon();
wpnFuncTable[ fWeapon ].vPrimary();
}
@ -155,33 +156,11 @@ void Weapon_Reload( float fWeapon ) {
return;
}
#endif
Animation_ReloadWeapon();
wpnFuncTable[ fWeapon ].vReload();
}
#ifdef SSQC
/*
=================
Weapon_Release
Called when letting go one of the weapon firing buttons
=================
*/
void Weapon_Release( void ) {
self.flags = self.flags | FL_SEMI_TOGGLED;
}
/*
=================
Weapon_GetSlot
Returns which slot a weapon belongs to
=================
*/
int Weapon_GetSlot( float fWeapon ) {
return wptTable[ fWeapon ].iSlot;
}
/*
=================
Weapon_GetAnimType
@ -215,6 +194,29 @@ float Weapon_GetReloadTime( float fWeapon ) {
return wptTable[ fWeapon ].fReloadFinished;
}
#ifdef SSQC
/*
=================
Weapon_Release
Called when letting go one of the weapon firing buttons
=================
*/
void Weapon_Release( void ) {
self.flags = self.flags | FL_SEMI_TOGGLED;
}
/*
=================
Weapon_GetSlot
Returns which slot a weapon belongs to
=================
*/
int Weapon_GetSlot( float fWeapon ) {
return wptTable[ fWeapon ].iSlot;
}
/*
=================
Weapon_AlreadyExists

Binary file not shown.

Binary file not shown.