Basic Player Animations

Added a dynamic crosshair
Updated weapon selection system
Updated the view to do our own bobbing
Fixed a few logic issues with the round/timer loop
Added some new sound events and some overall polish
This commit is contained in:
Marco Hladik 2016-12-13 20:15:09 +01:00
parent 49ec1c6f34
commit 122fbe10ef
47 changed files with 714 additions and 161 deletions

View file

@ -42,9 +42,11 @@ vector vMousePos;
.float fVolume;
// Camera Fields
//entity ePlayerEnt;
vector vCameraPos;
vector vCameraAngle;
float fCameraTime;
void View_PlayAnimation( int iSequence );
void Sound_Delayed( string sSample, float fVol, float fDelay );

View file

@ -54,7 +54,6 @@ void CSQC_Parse_Print(string sMessage, float fLevel ) {
}
}
/*
=================
CSQC_DrawChat
@ -73,10 +72,73 @@ void CSQC_DrawChat( void ) {
}
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 );
drawstring( vChatPos + '1 1', sMSGBuffer[ i ], '8 8 0', '0 0 0', VGUI_WINDOW_FGALPHA, 0 );
drawstring( vChatPos, sMSGBuffer[ i ], '8 8 0', VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, 0 );
vChatPos_y += 12;
}
}
/*
=================
CSQC_DrawCenterprint
Read centerprints from a buffer and display them with alpha and whatnot
=================
*/
float fCenterPrintAlpha;
float fCenterPrintTime;
float fCenterPrintLines;
string sCenterPrintBuffer[ 18 ];
void CSQC_DrawCenterprint( void ) {
if ( fCenterPrintAlpha <= 0 ) {
return;
}
vector vCenterPrintPos;
if ( fCenterPrintTime > time ) {
fCenterPrintAlpha = 1;
} else {
fCenterPrintAlpha -= frametime;
if ( fCenterPrintAlpha < 0 ) {
fCenterPrintAlpha = 0;
}
}
vCenterPrintPos_y = ( vVideoResolution_y / 2 ) - ( fCenterPrintLines - 4 );
for ( int i = 0; i < ( fCenterPrintLines ); i++ ) {
vCenterPrintPos_x = ( vVideoResolution_x / 2 ) - ( stringwidth( sCenterPrintBuffer[ i ], FALSE ) / 2 );
drawstring( vCenterPrintPos + '1 1', sCenterPrintBuffer[ i ], '8 8 0', '0 0 0', fCenterPrintAlpha, 0 );
drawstring( vCenterPrintPos, sCenterPrintBuffer[ i ], '8 8 0', VGUI_WINDOW_FGCOLOR, fCenterPrintAlpha, 0 );
vCenterPrintPos_y += 8;
}
}
/*
=================
CSQC_Parse_CenterPrint
Catches every centerprint call and allows us to tinker with it.
That's how we are able to add color, alpha and whatnot.
Keep in mind that newlines need to be tokenized
=================
*/
float CSQC_Parse_CenterPrint( string sMessage ) {
fCenterPrintLines = tokenizebyseparator( sMessage, "\n" );
for( int i = 0; i < ( fCenterPrintLines ); i++ ) {
sCenterPrintBuffer[ i ] = argv( i );
}
fCenterPrintAlpha = 1;
fCenterPrintTime = time + 3;
return TRUE;
}
/*
=================
CSQC_UpdateView
@ -99,6 +161,8 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
setproperty( VF_ORIGIN, vCameraPos) ;
setproperty( VF_ANGLES, vCameraAngle );
} else {
//setproperty( VF_ORIGIN, ePlayerEnt.origin + [ 0, 0, getstatf( STAT_VIEWHEIGHT ) ] );
//setproperty( VF_ANGLES, input_angles );
View_DrawViewModel();
}
renderscene();
@ -109,7 +173,8 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
if ( iShowScores == TRUE ) {
VGUI_Scores_Show();
} else {
} else {
CSQC_DrawCenterprint();
CSQC_VGUI_Draw();
}
}

View file

@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
=================
CSQC_Ent_Update
@ -28,7 +29,34 @@ Called whenever an entity is sent manually via .SendFlags and so on
void CSQC_Ent_Update( float fIsNew ) {
float fEntType = readbyte();
if ( fEntType == ENT_AMBIENTSOUND ) {
/*if( fEntType == ENT_PLAYER ) {
if ( self.entnum == player_localentnum ) {
ePlayerEnt = self;
}
if ( fIsNew == TRUE ) {
self.predraw = CSQC_PlayerUpdate;
//self.drawmask = MASK_ENGINE;
}
float fFlags = readbyte();
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();
self.angles_x = readcoord();
self.angles_y = readcoord();
self.angles_z = readcoord();
self.modelindex = readbyte();
if ( fFlags & PLAYER_SENDFLAG_INGAME ) {
self.velocity_x = readcoord();
self.velocity_y = readcoord();
self.velocity_z = readcoord();
self.flags = readfloat();
}
setorigin( self, self.origin );
} else */if ( fEntType == ENT_AMBIENTSOUND ) {
self.origin_x = readcoord();
self.origin_y = readcoord();
self.origin_z = readcoord();

View file

@ -316,14 +316,14 @@ HUD_DrawAmmo
Draws the current clip, the amount of ammo for the caliber and a matching caliber icon
=================
*/
float fOldClip, fOldCal;
float fOldMag, fOldCal;
float fAmmoAlpha;
void HUD_DrawAmmo( void ) {
if ( getstatf( STAT_ACTIVEWEAPON ) == WEAPON_KNIFE || getstatf( STAT_ACTIVEWEAPON ) == WEAPON_C4BOMB ) {
return;
}
if ( getstatf( STAT_CURRENT_CLIP ) != fOldClip || getstatf( STAT_CURRENT_CALIBER ) != fOldCal ) {
if ( getstatf( STAT_CURRENT_MAG ) != fOldMag || getstatf( STAT_CURRENT_CALIBER ) != fOldCal ) {
fAmmoAlpha = 1.0;
}
@ -333,8 +333,8 @@ void HUD_DrawAmmo( void ) {
fAmmoAlpha = HUD_ALPHA;
}
vector vAmmoClipPos = [ vVideoResolution_x - 142, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_CLIP ), vAmmoClipPos, fAmmoAlpha, VGUI_WINDOW_FGCOLOR );
vector vAmmoMagPos = [ vVideoResolution_x - 142, vVideoResolution_y - 42 ];
HUD_DrawNums( getstatf( STAT_CURRENT_MAG ), vAmmoMagPos, fAmmoAlpha, VGUI_WINDOW_FGCOLOR );
drawsubpic( [vVideoResolution_x - 118, vVideoResolution_y - 42], '3 25 0', HUD_NUMFILE_LAYER, [0.9375, 0], [ 0.01171875, 0.09765625 ], VGUI_WINDOW_FGCOLOR, fAmmoAlpha, DRAWFLAG_ADDITIVE );
@ -343,7 +343,7 @@ void HUD_DrawAmmo( void ) {
// Caliber icon
drawsubpic( vVideoResolution - '42 42 0', '24 24 0', HUD_NUMFILE_LAYER, vHUDCalPos[ wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCaliber ], [ NUMSIZE_X, NUMSIZE_X ], VGUI_WINDOW_FGCOLOR, fAmmoAlpha, DRAWFLAG_ADDITIVE );
fOldClip = getstatf( STAT_CURRENT_CLIP );
fOldMag = getstatf( STAT_CURRENT_MAG );
fOldCal = getstatf( STAT_CURRENT_CALIBER );
}
@ -401,4 +401,5 @@ void HUD_Draw( void ) {
HUD_DrawOrbituaries();
HUD_DrawProgressBar();
HUD_DrawWeaponSelect();
HUD_DrawCrosshair();
}

View file

@ -0,0 +1,91 @@
/*
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.
*/
/*
=================
HUD_DrawCrosshair
Draws the cursor every frame, unless spectator
=================
*/
void HUD_DrawCrosshair( void ) {
static int iOldShotMultiplier;
static float fCrosshairDistance;
static float fDecreaseShotTime;
int iCrosshairDistance;
int iLineLength;
// Weapon Info Tables have got Mins and Deltas they are willing to share
float fDistance = wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCrosshairMinDistance;
float fDeltaDistance = wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCrosshairDeltaDistance;
if ( !( getstatf( STAT_FLAGS ) & FL_ONGROUND) ) { // If we are in the air...
fDistance = fDistance * 2;
} else if ( getstatf( STAT_FLAGS ) & FL_CROUCHING ) { // Crouching...
fDistance = fDistance * 0.5;
} else if ( vlen( pmove_vel ) > 120 ) { // Running, not walking
fDistance = fDistance * 1.5;
}
// The amount of shots that we've shot totally does affect our accuracy!
if ( iShotMultiplier > iOldShotMultiplier ) {
fCrosshairDistance = Math_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 );
if ( ( iShotMultiplier > 0 ) && ( fDecreaseShotTime < time ) ) {
fDecreaseShotTime = time + 0.02;
iShotMultiplier--;
}
}
iOldShotMultiplier = iShotMultiplier;
if ( fCrosshairDistance < fDistance ) {
fCrosshairDistance = fDistance;
}
iCrosshairDistance = ceil( fCrosshairDistance );
iLineLength = ( ( iCrosshairDistance - fDistance ) / 2 ) + 5;
iLineLength = Math_Max( 1, iLineLength );
// Line positions
vector vVer1, vVer2, vHor1, vHor2;
// Vertical Lines
vVer1_x = ( vVideoResolution_x / 2 );
vVer1_y = ( vVideoResolution_y / 2 ) - ( iCrosshairDistance + iLineLength );
vVer2_x = ( vVideoResolution_x / 2 );
vVer2_y = ( vVideoResolution_y / 2 ) + iCrosshairDistance + 1;
// Horizontal Lines
vHor1_x = ( vVideoResolution_x / 2 ) - ( iCrosshairDistance + iLineLength );
vHor1_y = ( vVideoResolution_y / 2 );
vHor2_x = ( vVideoResolution_x / 2 ) + iCrosshairDistance + 1;
vHor2_y = ( vVideoResolution_y / 2 );
drawfill( vVer1, [ 1, iLineLength ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
drawfill( vVer2, [ 1, iLineLength ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
drawfill( vHor1, [ iLineLength, 1 ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
drawfill( vHor2, [ iLineLength, 1 ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
}

View file

@ -48,7 +48,7 @@ weaponsymbolinfo_t wpSymbolTable[ CS_WEAPON_COUNT ] = {
{ "sprites/640hud2.spr_0.tga", '0 0.703125' }, //WEAPON_G3SG1
{ "sprites/640hud14.spr_0.tga", '0 0.703125' }, //WEAPON_SG550
{ "sprites/640hud3.spr_0.tga", '0 0' }, //WEAPON_PARA
{ "sprites/640hud3.spr_1.tga", '0 0' } //WEAPON_C4BOMB
{ "sprites/640hud1.spr_0.tga", '0 0' } //WEAPON_C4BOMB
};
vector vHUDSlotNumPos[ 4 ] = {

View file

@ -48,13 +48,13 @@ vguiweaponobject_t vguiWeaponTable[ CS_WEAPON_COUNT ] = {
};
vguiequipobject_t vguiEquipmentTable[ 7 ] = {
{ EQUIPMENT_KEVLAR, "Kevlar", "gfx/vgui/kevlar" },
{ EQUIPMENT_HELMET, "Kevlar & Helmet", "gfx/vgui/kevlar_helmet" },
{ EQUIPMENT_KEVLAR, "Kevlar", "gfx/vgui/640_kevlar" },
{ EQUIPMENT_HELMET, "Kevlar & Helmet", "gfx/vgui/640_kevlar_helmet" },
{ EQUIPMENT_FLASHBANG, "Flashband", "gfx/vgui/640_flashbang" },
{ EQUIPMENT_HEGRENADE, "HE Grenade", "gfx/vgui/640_hegrenade" },
{ EQUIPMENT_SMOKEGRENADE, "Smoke Grenade", "gfx/vgui/640_smokegrenade" },
{ EQUIPMENT_DEFUSALKIT, "Defusal Kit", "gfx/vgui/defuser" },
{ EQUIPMENT_NIGHTVISION, "NightVision", "gfx/vgui/nightvision" },
{ EQUIPMENT_DEFUSALKIT, "Defusal Kit", "gfx/vgui/640_defuser" },
{ EQUIPMENT_NIGHTVISION, "NightVision", "gfx/vgui/640_nightvision" },
};
// TODO: Clean this up

View file

@ -46,21 +46,67 @@ string sViewModels[ CS_WEAPON_COUNT ] = {
"models/v_c4.mdl"
};
/*
====================
View_CalcBob
====================
*/
vector pmove_vel;
float V_CalcBob( void ) {
static float fBobTime;
static float fBob;
float fCycle;
vector vVelocity;
if ( self.flags & FL_ONGROUND == -1 ) {
return fBob;
}
fBobTime += frametime;
fCycle = fBobTime - (int)( fBobTime / cvar( "cl_bobcycle" ) ) * cvar( "cl_bobcycle" );
fCycle /= cvar( "cl_bobcycle" );
if ( fCycle < cvar( "cl_bobup" ) ) {
fCycle = MATH_PI * fCycle / cvar( "cl_bobup" );
} else {
fCycle = MATH_PI + MATH_PI * ( fCycle - cvar( "cl_bobup" ) )/( 1.0 - cvar( "cl_bobup" ) );
}
vVelocity = pmove_vel; //ePlayerEnt.velocity;
vVelocity_z = 0;
fBob = sqrt( vVelocity_x * vVelocity_x + vVelocity_y * vVelocity_y ) * cvar( "cl_bob" );
fBob = fBob * 0.3 + fBob * 0.7 * sin(fCycle);
fBob = Math_Min( fBob, 4 );
fBob = Math_Max( fBob, -7 );
return fBob * 0.5;
}
entity eViewModel;
void View_DrawViewModel( void ) {
static float fLastTime;
if( !eViewModel ) {
eViewModel = spawn();
eViewModel.renderflags = RF_DEPTHHACK | RF_VIEWMODEL;
eViewModel.renderflags = RF_DEPTHHACK;
}
eViewModel.origin = '0 0 -1';
if ( time != fLastTime ) {
makevectors( getproperty( VF_ANGLES ) );
eViewModel.origin = getproperty( VF_ORIGIN ) + '0 0 -1' + ( v_forward * V_CalcBob() );
eViewModel.angles = getproperty( VF_ANGLES );
if( getstatf( STAT_ACTIVEWEAPON ) < CS_WEAPON_COUNT ) {
setmodel( eViewModel, sViewModels[ getstatf( STAT_ACTIVEWEAPON ) ] );
}
if( getstatf( STAT_ACTIVEWEAPON ) < CS_WEAPON_COUNT ) {
setmodel( eViewModel, sViewModels[ getstatf( STAT_ACTIVEWEAPON ) ] );
eViewModel.frame1time += frametime;
}
fLastTime = time;
addentity( eViewModel );
eViewModel.frame1time += frametime;
}
void View_PlayAnimation( int iSequence ) {

View file

@ -7,6 +7,7 @@
#includelist
../Builtins.h
../Globals.h
../Math.h
Defs.h
../Shared/WeaponAK47.c
@ -48,6 +49,7 @@ VGUIMOTD.c
VGUIBuyMenu.c
VGUITeamSelect.c
VGUI.c
HUDCrosshair.c
HUDWeaponSelect.c
HUDOrbituaries.c
HUD.c

View file

@ -18,6 +18,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define PLAYER_SENDFLAG_UPDATE 1
#define PLAYER_SENDFLAG_INGAME 2
// Stuff that applies to all codebases
enum {
TEAM_SPECTATOR,
@ -31,21 +35,23 @@ enum {
STAT_HOSTAGEZONE,
STAT_BOMBZONE,
STAT_MONEY,
STAT_GAMETIME,
STAT_FLAGS,
STAT_SLOT_MELEE,
STAT_SLOT_PRIMARY,
STAT_SLOT_SECONDARY,
STAT_SLOT_GRENADE,
STAT_CURRENT_CLIP,
STAT_CURRENT_MAG,
STAT_CURRENT_CALIBER,
STAT_PROGRESS,
STAT_TEAM,
STAT_GAMETIME,
STAT_WON_T,
STAT_WON_CT
};
enum {
ENT_AMBIENTSOUND = 1,
ENT_PLAYER = 1,
ENT_AMBIENTSOUND,
ENT_SPRITE
};
@ -142,7 +148,7 @@ typedef struct {
float fSpeedM;
int iBullets; // How many bullets does it shoot?
int iClipSize; // How big is the clip/magazine?
int iMagSize; // How big is the clip/magazine?
int iDamage; // How much damage is done by a single bullet?
int iPenetration; // Penetration multiplier
@ -155,11 +161,14 @@ typedef struct {
float fReloadFinished; // When is the gone done firing
.int iCaliberfld; // Pointer towards the caliberfield of the gun
.int iClipfld; // Pointer towards the clip of the gun
.int iMagfld; // Pointer towards the clip of the gun
float fAccuracyDivisor;
float fAccuracyOffset;
float fMaxInaccuracy;
int iCrosshairMinDistance;
int iCrosshairDeltaDistance;
} weaponinfo_t;
typedef struct {
@ -214,6 +223,9 @@ enum {
#define INPUT_BUTTON5 16
#define INPUT_BUTTON6 32
#define FL_USERELEASED 8192
#define FL_CROUCHING 16384
float clamp(float d, float imin, float imax) {
float t;
@ -229,3 +241,4 @@ float clamp(float d, float imin, float imax) {
}
void Empty( void ) { }
void OpenCSGunBase_ShotMultiplierHandle( float fShots );

View file

@ -18,6 +18,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define MATH_PI 3.1415926
float Math_LerpAngle( float fStart, float fEnd, float fAmount ) {
float shortest_angle = ( ( ( ( fEnd - fStart ) % 360 ) + 540 ) % 360 ) - 180;
return shortest_angle * fAmount;
@ -26,3 +28,19 @@ float Math_LerpAngle( float fStart, float fEnd, float fAmount ) {
float Math_CRandom( void ) {
return 2 * ( random() - 0.5 );
}
float Math_Min( float fA, float fB ) {
if ( fA < fB ) {
return fA;
} else {
return fB;
}
}
float Math_Max( float fA, float fB ) {
if ( fA > fB ) {
return fA;
} else {
return fB;
}
}

View file

@ -0,0 +1,147 @@
/*
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.
*/
enum {
ANIM_DUMMY1,
ANIM_IDLE,
ANIM_IDLE_CROUCH,
ANIM_WALK,
ANIM_RUN,
ANIM_RUN_CROUCH,
ANIM_JUMP,
ANIM_LONGJUMP,
ANIM_SWIM,
ANIM_TREADWATER,
ANIM_CROUCH_AIM_CARBINE,
ANIM_CROUCH_SHOOT_CARBINE,
ANIM_CROUCH_RELOAD_CARBINE,
ANIM_AIM_CARBINE,
ANIM_SHOOT_CARBINE,
ANIM_RELOAD_CARBINE,
ANIM_CROUCH_AIM_ONEHAND,
ANIM_CROUCH_SHOOT_ONEHAND,
ANIM_CROUCH_RELOAD_ONEHAND,
ANIM_AIM_ONEHAND,
ANIM_SHOOT_ONEHAND,
ANIM_RELOAD_ONEHAND,
ANIM_CROUCH_AIM_DUALPISTOLS,
ANIM_CROUCH_SHOOT_DUALPISTOLS,
ANIM_CROUCH_SHOOT2_DUALPISTOLS,
ANIM_CROUCH_RELOAD_DUALPISTOLS,
ANIM_AIM_DUALPISTOLS,
ANIM_SHOOT_DUALPISTOLS,
ANIM_SHOOT2_DUALPISTOLS,
ANIM_RELOAD_DUALPISTOLS,
ANIM_CROUCH_AIM_RIFLE,
ANIM_CROUCH_SHOOT_RIFLE,
ANIM_CROUCH_RELOAD_RIFLE,
ANIM_AIM_RIFLE,
ANIM_SHOOT_RIFLE,
ANIM_RELOAD_RIFLE,
ANIM_CROUCH_AIM_MP5,
ANIM_CROUCH_SHOOT_MP5,
ANIM_CROUCH_RELOAD_MP5,
ANIM_AIM_MP5,
ANIM_SHOOT_MP5,
ANIM_RELOAD_MP5,
ANIM_CROUCH_AIM_SHOTGUN,
ANIM_CROUCH_SHOOT_SHOTGUN,
ANIM_CROUCH_RELOAD_SHOTGUN,
ANIM_AIM_SHOTGUN,
ANIM_SHOOT_SHOTGUN,
ANIM_RELOAD_SHOTGUN,
ANIM_CROUCH_AIM_PARA,
ANIM_CROUCH_SHOOT_PARA,
ANIM_CROUCH_RELOAD_PARA,
ANIM_AIM_PARA,
ANIM_SHOOT_PARA,
ANIM_RELOAD_PARA,
ANIM_DUMMY2,
ANIM_DUMMY3,
ANIM_AIM_GRENADE,
ANIM_SHOOT_GRENADE,
ANIM_CROUCH_AIM_GRENADE,
ANIM_CROUCH_SHOOT_GRENADE,
ANIM_CROUCH_AIM_C4,
ANIM_CROUCH_SHOOT_C4,
ANIM_AIM_C4,
ANIM_SHOOT_C4,
ANIM_RELOAD_C4,
ANIM_DUPLICATE1,
ANIM_DUPLICATE2,
ANIM_DUPLICATE3,
ANIM_DUPLICATE4,
ANIM_DUPLICATE5,
ANIM_DUPLICATE6,
ANIM_DUPLICATE7,
ANIM_DUPLICATE8,
ANIM_AIM_KNIFE9,
ANIM_CROUCH_SHOOT_KNIFE,
ANIM_AIM_KNIFE,
ANIM_SHOOT_KNIFE,
ANIM_CROUCH_AIM_AK47,
ANIM_CROUCH_SHOOT_AK47,
ANIM_CROUCH_RELOAD_AK47,
ANIM_AIM_AK47,
ANIM_SHOOT_AK47,
ANIM_RELOAD_AK47,
ANIM_GUT_FLINCH,
ANIM_HEAD_FLINCH,
ANIM_DEATH1,
ANIM_DEATH2,
ANIM_DEATH3,
ANIM_DIE_HEAD,
ANIM_DIE_GUT,
ANIM_DIE_LEFT,
ANIM_DIE_BACK,
ANIM_DIE_RIGHT,
ANIM_DIE_FORWARD,
ANIM_CROUCH_DIE
};
void Animation_PlayerUpdate( void ) {
// self.basebone = 40;
// self.baseframe = ANIM_AIM_SHOTGUN;
if ( vlen( self.velocity ) == 0 ) {
if ( self.flags & FL_CROUCHING ) {
self.frame = ANIM_IDLE_CROUCH;
} else {
self.frame = ANIM_IDLE;
}
} else if ( vlen( self.velocity ) < 150 ) {
if ( self.flags & FL_CROUCHING ) {
self.frame = ANIM_RUN_CROUCH;
} else {
self.frame = ANIM_WALK;
}
} else if ( vlen( self.velocity ) > 150 ) {
if ( self.flags & FL_CROUCHING ) {
self.frame = ANIM_RUN_CROUCH;
} else {
self.frame = ANIM_RUN;
}
}
if ( !( self.flags & FL_ONGROUND ) ) {
self.frame = ANIM_JUMP;
}
}

View file

@ -54,10 +54,11 @@ void ClientDisconnect( void ) {
void PlayerPreThink( void ) {
Input_Handle();
OpenCSGunBase_ShotMultiplierUpdate();
}
void PlayerPostThink( void ) {
Animation_PlayerUpdate();
}
void PutClientInServer( void ) {
@ -65,6 +66,7 @@ void PutClientInServer( void ) {
Spawn_MakeSpectator();
Spawn_ObserverCam();
//self.SendEntity = Player_SendEntity;
// Because we don't want to reset these when we die
Money_AddMoney( self, cvar( "mp_startmoney" ) );
@ -84,7 +86,14 @@ void SV_RunClientCommand( void ) {
input_impulse = 0;
}
if ( self.team && self.health > 0 ) {
self.SendFlags |= PLAYER_SENDFLAG_INGAME;
} else {
self.SendFlags |= PLAYER_SENDFLAG_UPDATE;
}
Footsteps_Update();
runstandardplayerphysics( self );
}

View file

@ -39,7 +39,6 @@ float EFFECT_BLOOD;
.float fStepTime;
.int iInGame;
.float fCharModel;
.int iCrouching;
.int iCrouchAttempt;
.int iHasBomb;
.float fDeaths;
@ -47,19 +46,17 @@ float EFFECT_BLOOD;
.float armor;
.float fProgressBar;
#define FL_USERELEASED 8192
// Match specific fields
int iWon_T;
int iWon_CT;
int iAlivePlayers_T;
int iAlivePlayers_CT;
int fOldInGamePlayers;
float fGameState;
float fGameTime;
// Weapon specific fields
.int iCurrentClip;
.int iCurrentMag;
.int iCurrentCaliber;
.float fSlotMelee, fSlotPrimary, fSlotSecondary, fSlotGrenade;
.float fAttackFinished;

View file

@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.entity eTargetPoint;
.entity eLastCreated;
.int iHasBeenUsed;
enum {
HOSTAGE_IDLE,
HOSTAGE_WALK,

View file

@ -32,7 +32,7 @@ void Input_Handle( void ) {
if ( self.button3 ) {
Player_CrouchDown();
} else if ( self.iCrouching == TRUE ) {
} else if ( self.flags & FL_CROUCHING ) {
Player_CrouchUp();
}

View file

@ -37,28 +37,27 @@ void StartFrame( void ) {
Game_CreateBuyZones();
}
int iInGamePlayers;
// Sigh, check if clients are in the game
if ( find( world, classname , "player" ) != world ) {
iInGamePlayers = 100;
} else {
iInGamePlayers = 0;
}
// See if the player count has changed
if ( iInGamePlayers > fOldInGamePlayers ) {
bprint( "Game commencing...\n" );
Timer_Begin( 2, GAME_COMMENCING );
fOldInGamePlayers = iInGamePlayers;
} else {
// No players? Don't bother updating the Timer
if ( iInGamePlayers == 0 ) {
// TODO: Optimise this
if ( ( iAlivePlayers_T + iAlivePlayers_CT ) == 0 ) {
int iInGamePlayers = 0;
static int iOldInGamePlayers;
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
iInGamePlayers++;
}
if ( iInGamePlayers > iOldInGamePlayers ) {
bprint( "Game commencing...\n" );
Timer_Begin( 2, GAME_COMMENCING );
iOldInGamePlayers = iInGamePlayers;
} else if ( iInGamePlayers == 0 ) {
fGameState = GAME_INACTIVE;
fGameTime = 0;
fOldInGamePlayers = 0;
iOldInGamePlayers = 0;
} else {
Timer_Update();
Timer_Update(); // Timer that happens once players have started joining
}
} else {
Timer_Update(); // Normal gameplay timer
}
}
@ -277,10 +276,11 @@ void worldspawn( void ) {
clientstat( STAT_SLOT_PRIMARY, EV_FLOAT, fSlotPrimary );
clientstat( STAT_SLOT_SECONDARY, EV_FLOAT, fSlotSecondary );
clientstat( STAT_SLOT_GRENADE, EV_FLOAT, fSlotGrenade );
clientstat( STAT_CURRENT_CLIP, EV_INTEGER, iCurrentClip );
clientstat( STAT_CURRENT_MAG, EV_INTEGER, iCurrentMag );
clientstat( STAT_CURRENT_CALIBER, EV_INTEGER, iCurrentCaliber );
clientstat( STAT_TEAM, EV_INTEGER, team );
clientstat( STAT_PROGRESS, EV_FLOAT, fProgressBar );
clientstat( STAT_FLAGS, EV_FLOAT, flags );
pointerstat( STAT_GAMETIME, EV_FLOAT, &fGameTime );
pointerstat( STAT_WON_T, EV_INTEGER, &iWon_T );
pointerstat( STAT_WON_CT, EV_INTEGER, &iWon_CT );

View file

@ -18,6 +18,26 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*float Player_SendEntity( entity ePEnt, float fChanged ) {
WriteByte( MSG_ENTITY, ENT_PLAYER );
WriteByte( MSG_ENTITY, fChanged );
WriteCoord( MSG_ENTITY, self.origin_x );
WriteCoord( MSG_ENTITY, self.origin_y );
WriteCoord( MSG_ENTITY, self.origin_z );
WriteCoord( MSG_ENTITY, self.angles_x );
WriteCoord( MSG_ENTITY, self.angles_y );
WriteCoord( MSG_ENTITY, self.angles_z );
WriteByte( MSG_ENTITY, self.modelindex );
if ( fChanged & PLAYER_SENDFLAG_INGAME ) {
WriteCoord( MSG_ENTITY, self.velocity_x );
WriteCoord( MSG_ENTITY, self.velocity_y );
WriteCoord( MSG_ENTITY, self.velocity_z );
WriteFloat( MSG_ENTITY, self.flags );
}
return TRUE;
}*/
void Player_Pain( void ) {
}
@ -58,7 +78,7 @@ void Player_Death( void ) {
}
float Player_GetMaxSpeed( float fWeapon ) {
if ( self.iCrouching == TRUE ) {
if ( self.flags & FL_CROUCHING ) {
return (cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM) * 0.5;
} else {
return cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM;
@ -93,9 +113,9 @@ void Player_CrouchDown( void ) {
return;
}
if( !self.iCrouching ) {
if( !( self.flags & FL_CROUCHING ) ) {
setsize( self, VEC_CHULL_MIN, VEC_CHULL_MAX );
self.iCrouching = TRUE;
self.flags = self.flags | FL_CROUCHING;
self.view_ofs = VEC_PLAYER_CVIEWPOS;
self.velocity_z = self.velocity_z + 50;
self.maxspeed = Player_GetMaxSpeed( self.weapon );
@ -116,13 +136,13 @@ void Player_CrouchUp( void ) {
return;
}
if ( self.iCrouching && ( !self.velocity_z ) && ( Player_CrouchCheck( self ) ) ) {
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
if ( ( self.flags & FL_CROUCHING ) && ( !self.velocity_z ) && ( Player_CrouchCheck( self ) ) ) {
setsize( self, VEC_HULL_MIN, VEC_HULL_MAX );
setorigin( self, self.origin + '0 0 18');
self.velocity_z = self.velocity_z + 16;
self.view_ofs = VEC_PLAYER_VIEWPOS;
self.iCrouching = FALSE;
self.flags = ( self.flags - FL_CROUCHING );
self.iCrouchAttempt = FALSE;
self.maxspeed = Player_GetMaxSpeed( self.weapon );
return;
@ -149,9 +169,9 @@ void Player_UseDown( void ) {
traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self);
if ( trace_ent.iUsable ) {
sound( self, CHAN_WEAPON, "common/wpn_select.wav", 0.25, ATTN_IDLE );
if ( trace_ent.classname != "c4bomb" ) {
self.flags = ( self.flags - FL_USERELEASED );
sound( self, CHAN_WEAPON, "common/wpn_select.wav", 0.25, ATTN_IDLE );
}
eActivator = self;

View file

@ -166,7 +166,7 @@ void Spawn_MakeSpectator( void ) {
// Clear all the ammo stuff
for ( int i = 0; i < CS_WEAPON_COUNT; i++ ) {
self.(wptTable[ i ].iClipfld) = 0;
self.(wptTable[ i ].iMagfld) = 0;
self.(wptTable[ i ].iCaliberfld) = 0;
}

View file

@ -24,7 +24,7 @@ void TraceAttack_FireBullets( int iShots ) {
makevectors(self.v_angle);
vSrc = self.origin + self.view_ofs;
while ( iShots > 0) {
vDir = aim( self, 100000 ) + Math_CRandom()*self.fAccuracy*v_right + Math_CRandom()*self.fAccuracy*v_up;

View file

@ -61,6 +61,7 @@ FuncDoor.c
FuncDoorRotating.c
AmbientSound.c
Animations.c
Light.c
Main.c
Player.c

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_AK47;
.int iMag_AK47;
// Weapon Info
weaponinfo_t wptAK47 = {
@ -37,10 +37,12 @@ weaponinfo_t wptAK47 = {
0.1, // Attack-Delay
2.4, // Reload-Delay
iAmmo_762MM, // Caliber Pointer
iClip_AK47, // Clip Pointer
iMag_AK47, // Clip Pointer
200, // Accuracy Divisor
0.35, // Accuracy Offset
1.25 // Max Inaccuracy
1.25, // Max Inaccuracy
4,
4
};
// Anim Table
@ -80,6 +82,8 @@ void WeaponAK47_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_AK47_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_AUG;
.int iMag_AUG;
// Weapon Info
weaponinfo_t wptAUG = {
@ -37,10 +37,12 @@ weaponinfo_t wptAUG = {
0.09, // Attack-Delay
3.3, // Reload-Delay
iAmmo_762MM, // Caliber Pointer
iClip_AUG, // Clip Pointer
iMag_AUG, // Clip Pointer
215, // Accuracy Divisor
0.3, // Accuracy Offset
1.0 // Max Inaccuracy
1.0, // Max Inaccuracy
3,
3
};
// Anim Table
@ -76,6 +78,8 @@ void WeaponAUG_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_AUG_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_AWP;
.int iMag_AWP;
// Weapon Info
weaponinfo_t wptAWP = {
@ -37,10 +37,12 @@ weaponinfo_t wptAWP = {
1.2, // Attack-Delay
2.9, // Reload-Delay
iAmmo_338MAG, // Caliber Pointer
iClip_AWP, // Clip Pointer
iMag_AWP, // Clip Pointer
-1, // Accuracy Divisor
0, // Accuracy Offset
0 // Max Inaccuracy
0, // Max Inaccuracy
8,
3
};
// Anim Table
@ -78,6 +80,7 @@ void WeaponAWP_PrimaryFire( void ) {
View_PlayAnimation( ANIM_AWP_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
Sound_Delayed( "weapons/awp_deploy.wav", 1.0, 0.4 );
#endif
}

View file

@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// Because padding...
weaponinfo_t wptDEFAULT = { 0, 0, 0, 0, 240, 0, 0, 0, 0, 0.0, 0.0, 0, 0.0, 0.0, iAmmo_9MM, iAmmo_9MM, 0.0, 0.0, 0.0 };
weaponinfo_t wptDEFAULT = { 0, 0, 0, 0, 240, 0, 0, 0, 0, 0.0, 0.0, 0, 0.0, 0.0, iAmmo_9MM, iAmmo_9MM, 0.0, 0.0, 0.0, 0, 0 };
weaponinfo_t wptTable[ CS_WEAPON_COUNT ] = {
wptDEFAULT,
@ -50,29 +50,63 @@ weaponinfo_t wptTable[ CS_WEAPON_COUNT ] = {
};
#ifdef SSQC
.int iShotMultiplier;
.float fDecreaseShotTime;
.int iOldShotMultiplier;
#else
int iShotMultiplier;
#endif
void OpenCSGunBase_ShotMultiplierHandle( float fShots ) {
#ifdef SSQC
if ( self.iShotMultiplier > 12 ) {
self.iShotMultiplier = 12;
} else {
self.iShotMultiplier += fShots;
}
self.fDecreaseShotTime = time + 0.2;
#else
if ( iShotMultiplier > 12 ) {
iShotMultiplier = 12;
} else {
iShotMultiplier += fShots;
}
#endif
}
#ifdef SSQC
// This is being triggered in PlayerPreThink after the input
void OpenCSGunBase_ShotMultiplierUpdate( void ) {
if ( ( self.iShotMultiplier > 0 ) && ( self.fDecreaseShotTime < time ) ) {
self.fDecreaseShotTime = time + 0.1;
self.iShotMultiplier--;
}
}
void OpenCSGunBase_Draw( void ) {
self.iCurrentClip = self.(wptTable[ self.weapon ].iClipfld);
self.iCurrentMag = self.(wptTable[ self.weapon ].iMagfld);
self.iCurrentCaliber = self.(wptTable[ self.weapon ].iCaliberfld);
Client_SendEvent( self, EV_WEAPON_DRAW );
}
void OpenCSGunBase_AccuracyCalc( void ) {
self.fAccuracy = 3 / wptTable[ self.weapon ].fAccuracyDivisor;
self.fAccuracy = self.iShotMultiplier / wptTable[ self.weapon ].fAccuracyDivisor;
}
// Returns whether or not to play an animation
float OpenCSGunBase_PrimaryFire( void ) {
// Nothing in the clip anymore? Don't even attempt
if ( ( self.(wptTable[ self.weapon ].iClipfld) - 1 ) < 0 ) {
if ( ( self.(wptTable[ self.weapon ].iMagfld) - 1 ) < 0 ) {
return FALSE;
}
OpenCSGunBase_AccuracyCalc();
TraceAttack_FireBullets( wptTable[ self.weapon ].iBullets );
self.(wptTable[ self.weapon ].iClipfld) -= 1;
self.(wptTable[ self.weapon ].iMagfld) -= 1;
self.fAttackFinished = time + wptTable[ self.weapon ].fAttackFinished;
OpenCSGunBase_ShotMultiplierHandle( 1 );
Client_SendEvent( self, EV_WEAPON_PRIMARYATTACK );
self.effects = self.effects | EF_MUZZLEFLASH;
return TRUE;
@ -81,19 +115,19 @@ float OpenCSGunBase_PrimaryFire( void ) {
float OpenCSGunBase_Reload( void ) {
static void OpenCSGunBase_FinishReload( void ) {
// What if we've got less in our caliberfield than we need
if ( self.(wptTable[ self.weapon ].iCaliberfld) < wptTable[ self.weapon ].iClipSize ) {
self.(wptTable[ self.weapon ].iClipfld) = self.(wptTable[ self.weapon ].iCaliberfld);
if ( self.(wptTable[ self.weapon ].iCaliberfld) < wptTable[ self.weapon ].iMagSize ) {
self.(wptTable[ self.weapon ].iMagfld) = self.(wptTable[ self.weapon ].iCaliberfld);
self.(wptTable[ self.weapon ].iCaliberfld) = 0;
} else {
self.(wptTable[ self.weapon ].iCaliberfld) -= ( wptTable[ self.weapon ].iClipSize - self.(wptTable[ self.weapon ].iClipfld) );
self.(wptTable[ self.weapon ].iClipfld) = wptTable[ self.weapon ].iClipSize;
self.(wptTable[ self.weapon ].iCaliberfld) -= ( wptTable[ self.weapon ].iMagSize - self.(wptTable[ self.weapon ].iMagfld) );
self.(wptTable[ self.weapon ].iMagfld) = wptTable[ self.weapon ].iMagSize;
}
Weapon_UpdateCurrents();
}
// Don't bother reloading the gun when full
if ( self.(wptTable[ self.weapon ].iClipfld) == wptTable[ self.weapon ].iClipSize ) {
if ( self.(wptTable[ self.weapon ].iMagfld) == wptTable[ self.weapon ].iMagSize ) {
return FALSE;
}

View file

@ -44,7 +44,9 @@ weaponinfo_t wptC4BOMB = {
iAmmo_9MM, // Clip Pointer
1, // Accuracy Divisor
1, // Accuracy Offset
1 // Max Inaccuracy
1, // Max Inaccuracy
8,
4
};
// Anim Table

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_DEAGLE;
.int iMag_DEAGLE;
// Weapon Info
weaponinfo_t wptDEAGLE = {
@ -37,10 +37,12 @@ weaponinfo_t wptDEAGLE = {
0.15, // Attack-Delay
2.1, // Reload-Delay
iAmmo_50AE, // Caliber Pointer
iClip_DEAGLE, // Clip Pointer
iMag_DEAGLE, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
8,
3
};
// Anim Table
@ -71,7 +73,7 @@ void WeaponDEAGLE_PrimaryFire( void ) {
}
}
#else
if ( getstatf( STAT_CURRENT_CLIP ) == 0 ) {
if ( getstatf( STAT_CURRENT_MAG ) == 0 ) {
View_PlayAnimation( ANIM_DEAGLE_SHOOT_EMPTY );
} else {
if ( random() <= 0.5 ) {
@ -81,6 +83,7 @@ void WeaponDEAGLE_PrimaryFire( void ) {
}
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_ELITES;
.int iMag_ELITES;
#ifdef SSQC
.int iMode_ELITES;
@ -43,10 +43,12 @@ weaponinfo_t wptELITES = {
0.15, // Attack-Delay
4.6, // Reload-Delay
iAmmo_9MM, // Caliber Pointer
iClip_ELITES, // Clip Pointer
iMag_ELITES, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
4,
3
};
// Anim Table
@ -87,7 +89,7 @@ void WeaponELITES_PrimaryFire( void ) {
#else
int iRand = (int)floor( random( 1, 4 ) );
if ( iWeaponMode_ELITES == 0 ) {
if ( getstatf( STAT_CURRENT_CLIP ) == 1 ) {
if ( getstatf( STAT_CURRENT_MAG ) == 1 ) {
View_PlayAnimation( ANIM_ELITES_SHOOT_LEFTLAST );
} else {
if ( iRand == 1 ) {
@ -103,7 +105,7 @@ void WeaponELITES_PrimaryFire( void ) {
}
}
} else {
if ( getstatf( STAT_CURRENT_CLIP ) == 0 ) {
if ( getstatf( STAT_CURRENT_MAG ) == 0 ) {
View_PlayAnimation( ANIM_ELITES_SHOOT_RIGHTLAST );
} else {
if ( iRand == 1 ) {
@ -120,6 +122,7 @@ void WeaponELITES_PrimaryFire( void ) {
}
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
iWeaponMode_ELITES = 1 - iWeaponMode_ELITES;
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_FIVESEVEN;
.int iMag_FIVESEVEN;
// Weapon Info
weaponinfo_t wptFIVESEVEN = {
@ -37,10 +37,12 @@ weaponinfo_t wptFIVESEVEN = {
0.15, // Attack-Delay
3.1, // Reload-Delay
iAmmo_57MM, // Caliber Pointer
iClip_FIVESEVEN, // Clip Pointer
iMag_FIVESEVEN, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
8,
3
};
// Anim Table
@ -69,7 +71,7 @@ void WeaponFIVESEVEN_PrimaryFire( void ) {
sound( self, CHAN_WEAPON, "weapons/fiveseven-1.wav", 1, ATTN_NORM );
}
#else
if ( getstatf( STAT_CURRENT_CLIP ) == 0 ) {
if ( getstatf( STAT_CURRENT_MAG ) == 0 ) {
View_PlayAnimation( ANIM_FIVESEVEN_SHOOT_EMPTY );
} else {
if ( random() <= 0.5 ) {
@ -78,7 +80,7 @@ void WeaponFIVESEVEN_PrimaryFire( void ) {
View_PlayAnimation( ANIM_FIVESEVEN_SHOOT2 );
}
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_G3SG1;
.int iMag_G3SG1;
// Weapon Info
weaponinfo_t wptG3SG1 = {
@ -37,10 +37,12 @@ weaponinfo_t wptG3SG1 = {
0.25, // Attack-Delay
4.6, // Reload-Delay
iAmmo_762MM, // Caliber Pointer
iClip_G3SG1, // Clip Pointer
iMag_G3SG1, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
6,
4
};
// Anim Table
@ -75,6 +77,7 @@ void WeaponG3SG1_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_G3SG1_SHOOT2 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_GLOCK18;
.int iMag_GLOCK18;
#ifdef SSQC
.int iMode_GLOCK18;
@ -43,10 +43,12 @@ weaponinfo_t wptGLOCK18 = {
0.15, // Attack-Delay
2.1, // Reload-Delay
iAmmo_9MM, // Caliber Pointer
iClip_GLOCK18, // Clip Pointer
iMag_GLOCK18, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracyy
1.4, // Max Inaccuracyy
8,
3
};
// Anim Table
@ -86,31 +88,34 @@ void WeaponGLOCK18_PrimaryFire( void ) {
sound( self, CHAN_WEAPON, "weapons/glock18-2.wav", 1, ATTN_NORM );
}
} else {
if ( (self.iClip_GLOCK18 - 3 ) < 0 ) {
if ( (self.iMag_GLOCK18 - 3 ) < 0 ) {
return FALSE;
}
OpenCSGunBase_AccuracyCalc();
TraceAttack_FireBullets( 3 );
self.iClip_GLOCK18 -= 3;
self.iMag_GLOCK18 -= 3;
self.fAttackFinished = time + 0.5;
sound( self, CHAN_WEAPON, "weapons/glock18-1.wav", 1, ATTN_NORM );
Client_SendEvent( self, EV_WEAPON_PRIMARYATTACK );
OpenCSGunBase_ShotMultiplierHandle( 3 );
}
#else
if ( iWeaponMode_GLOCK18 == FALSE ) {
if ( getstatf( STAT_CURRENT_CLIP ) == 0 ) {
if ( getstatf( STAT_CURRENT_MAG ) == 0 ) {
View_PlayAnimation( ANIM_GLOCK_SHOOT_EMPTY );
} else {
View_PlayAnimation( ANIM_GLOCK_SHOOT );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
} else {
if ( random() <= 0.5 ) {
View_PlayAnimation( ANIM_GLOCK_SHOOT_BURST1 );
} else {
View_PlayAnimation( ANIM_GLOCK_SHOOT_BURST2 );
}
OpenCSGunBase_ShotMultiplierHandle( 3 );
}
#endif
}

View file

@ -35,10 +35,12 @@ weaponinfo_t wptKNIFE = {
0.15, // Attack-Delay
1.0, // Reload-Delay
iAmmo_9MM, // Caliber Pointer
iClip_GLOCK18, // Clip Pointer
iMag_GLOCK18, // Clip Pointer
1, // Accuracy Divisor
1.0, // Accuracy Offset
1.0 // Max Inaccuracyy
1.0, // Max Inaccuracy
7,
3
};
// Anim Table
@ -56,7 +58,7 @@ enum {
void WeaponKNIFE_Draw( void ) {
#ifdef SSQC
Client_SendEvent( self, EV_WEAPON_DRAW );
self.iCurrentClip = 0;
self.iCurrentMag = 0;
self.iCurrentCaliber = 0;
#else
View_PlayAnimation( ANIM_KNIFE_DRAW );

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_M3;
.int iMag_M3;
#ifdef SSQC
.int iMode_M3;
@ -43,10 +43,12 @@ weaponinfo_t wptM3 = {
1.0, // Attack-Delay
3.0, // Reload-Delay
iAmmo_BUCKSHOT, // Caliber Pointer
iClip_M3, // Clip Pointer
iMag_M3, // Clip Pointer
200, // Accuracy Divisor
0.35, // Accuracy Offset
1.25 // Max Inaccuracy
1.25, // Max Inaccuracy
8,
6
};
// Anim Table
@ -90,6 +92,7 @@ void WeaponM3_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_M3_SHOOT2 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}
@ -97,7 +100,7 @@ void WeaponM3_Reload( void);
void WeaponM3_Secondary( void ) {
#ifdef SSQC
// If it's full or no ammo is left...
if ( (self.(wptM3.iClipfld) == wptM3.iClipSize) || ( self.(wptM3.iCaliberfld) <= 0 ) ) {
if ( (self.(wptM3.iMagfld) == wptM3.iMagSize) || ( self.(wptM3.iCaliberfld) <= 0 ) ) {
self.iMode_M3 = 0;
Client_SendEvent( self, EV_WEAPON_RELOAD );
self.think = WeaponM3_ReloadNULL;
@ -105,7 +108,7 @@ void WeaponM3_Secondary( void ) {
return;
}
self.(wptM3.iClipfld) += 1;
self.(wptM3.iMagfld) += 1;
self.(wptM3.iCaliberfld) -= 1;
Client_SendEvent( self, EV_WEAPON_SECONDARYATTACK );
@ -121,7 +124,7 @@ void WeaponM3_Secondary( void ) {
void WeaponM3_Reload( void ) {
#ifdef SSQC
// Can we reload the gun even if we wanted to?
if ( ( self.(wptM3.iClipfld) != wptM3.iClipSize ) && ( self.(wptM3.iCaliberfld) > 0 ) ) {
if ( ( self.(wptM3.iMagfld) != wptM3.iMagSize ) && ( self.(wptM3.iCaliberfld) > 0 ) ) {
self.iMode_M3 = 1 - self.iMode_M3;
if ( self.iMode_M3 == TRUE ) {

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_M4A1;
.int iMag_M4A1;
#ifdef SSQC
.int iMode_M4A1;
@ -43,10 +43,12 @@ weaponinfo_t wptM4A1 = {
0.09, // Attack-Delay
3.1, // Reload-Delay
iAmmo_556MM, // Caliber Pointer
iClip_M4A1, // Clip Pointer
iMag_M4A1, // Clip Pointer
220, // Accuracy Divisor
0.3, // Accuracy Offset
1.0 // Max Inaccuracy
1.0, // Max Inaccuracy
4,
3
};
enum {
@ -115,6 +117,7 @@ void WeaponM4A1_PrimaryFire( void ) {
View_PlayAnimation( ANIM_M4A1_SHOOT3 );
}
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_MP5;
.int iMag_MP5;
// Weapon Info
weaponinfo_t wptMP5 = {
@ -37,10 +37,12 @@ weaponinfo_t wptMP5 = {
0.08, // Attack-Delay
2.6, // Reload-Delay
iAmmo_9MM, // Caliber Pointer
iClip_MP5, // Clip Pointer
iMag_MP5, // Clip Pointer
220, // Accuracy Divisor
0.45, // Accuracy Offset
0.75 // Max Inaccuracy
0.75, // Max Inaccuracy
6,
2
};
// Anim Table
@ -80,6 +82,7 @@ void WeaponMP5_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_MP5_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_MAC10;
.int iMag_MAC10;
// Weapon Info
weaponinfo_t wptMAC10 = {
@ -37,10 +37,12 @@ weaponinfo_t wptMAC10 = {
0.075, // Attack-Delay
3.2, // Reload-Delay
iAmmo_45ACP, // Caliber Pointer
iClip_MAC10, // Clip Pointer
iMag_MAC10, // Clip Pointer
200, // Accuracy Divisor
0.6, // Accuracy Offset
1.65 // Max Inaccuracy
1.65, // Max Inaccuracy
9,
3
};
// Anim Table
@ -76,6 +78,7 @@ void WeaponMAC10_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_MAC10_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_P228;
.int iMag_P228;
// Weapon Info
weaponinfo_t wptP228 = {
@ -37,10 +37,12 @@ weaponinfo_t wptP228 = {
0.15, // Attack-Delay
2.7, // Reload-Delay
iAmmo_357SIG, // Caliber Pointer
iClip_P228, // Clip Pointer
iMag_P228, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
8,
3
};
// Anim Table
@ -70,7 +72,7 @@ void WeaponP228_PrimaryFire( void ) {
sound( self, CHAN_WEAPON, "weapons/p228-1.wav", 1, ATTN_NORM );
}
#else
if ( getstatf( STAT_CURRENT_CLIP ) == 0 ) {
if ( getstatf( STAT_CURRENT_MAG ) == 0 ) {
View_PlayAnimation( ANIM_P228_SHOOT_EMPTY );
} else {
@ -84,6 +86,7 @@ void WeaponP228_PrimaryFire( void ) {
View_PlayAnimation( ANIM_P228_SHOOT3 );
}
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_P90;
.int iMag_P90;
// Weapon Info
weaponinfo_t wptP90 = {
@ -37,10 +37,12 @@ weaponinfo_t wptP90 = {
0.07, // Attack-Delay
3.3, // Reload-Delay
iAmmo_57MM, // Caliber Pointer
iClip_P90, // Clip Pointer
iMag_P90, // Clip Pointer
175, // Accuracy Divisor
0.45, // Accuracy Offset
1.0 // Max Inaccuracy
1.0, // Max Inaccuracy
7,
3
};
// Anim Table
@ -77,6 +79,7 @@ void WeaponP90_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_P90_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_PARA;
.int iMag_PARA;
// Weapon Info
weaponinfo_t wptPARA = {
@ -37,10 +37,12 @@ weaponinfo_t wptPARA = {
0.08, // Attack-Delay
3.0, // Reload-Delay
iAmmo_556MMBOX, // Caliber Pointer
iClip_PARA, // Clip Pointer
iMag_PARA, // Clip Pointer
175, // Accuracy Divisor
0.4, // Accuracy Offset
0.9 // Max Inaccuracy
0.9, // Max Inaccuracy
6,
3
};
// Anim Table
@ -75,6 +77,7 @@ void WeaponPARA_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_PARA_SHOOT2 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_SG550;
.int iMag_SG550;
// Weapon Info
weaponinfo_t wptSG550 = {
@ -37,10 +37,12 @@ weaponinfo_t wptSG550 = {
0.25, // Attack-Delay
3.8, // Reload-Delay
iAmmo_556MM, // Caliber Pointer
iClip_SG550, // Clip Pointer
iMag_SG550, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
5,
3
};
// Anim Table
@ -72,6 +74,7 @@ void WeaponSG550_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_SG550_SHOOT2 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_SG552;
.int iMag_SG552;
// Weapon Info
weaponinfo_t wptSG552 = {
@ -37,10 +37,12 @@ weaponinfo_t wptSG552 = {
0.09, // Attack-Delay
3.2, // Reload-Delay
iAmmo_556MM, // Caliber Pointer
iClip_SG552, // Clip Pointer
iMag_SG552, // Clip Pointer
220, // Accuracy Divisor
0.3, // Accuracy Offset
1.0 // Max Inaccuracy
1.0, // Max Inaccuracy
5,
3
};
// Anim Table
@ -80,6 +82,8 @@ void WeaponSG552_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_SG552_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_SCOUT;
.int iMag_SCOUT;
// Weapon Info
weaponinfo_t wptSCOUT = {
@ -37,10 +37,12 @@ weaponinfo_t wptSCOUT = {
1.25, // Attack-Delay
2.0, // Reload-Delay
iAmmo_762MM, // Caliber Pointer
iClip_SCOUT, // Clip Pointer
iMag_SCOUT, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
5,
3
};
// Anim Table
@ -73,6 +75,7 @@ void WeaponSCOUT_PrimaryFire( void ) {
View_PlayAnimation( ANIM_SCOUT_SHOOT2 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
Sound_Delayed( "weapons/scout_bolt.wav", 1.0, 0.5 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_TMP;
.int iMag_TMP;
// Weapon Info
weaponinfo_t wptTMP = {
@ -37,10 +37,12 @@ weaponinfo_t wptTMP = {
0.07, // Attack-Delay
2.1, // Reload-Delay
iAmmo_9MM, // Caliber Pointer
iClip_TMP, // Clip Pointer
iMag_TMP, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
7,
3
};
// Anim Table
@ -79,6 +81,8 @@ void WeaponTMP_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_TMP_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_UMP45;
.int iMag_UMP45;
// Weapon Info
weaponinfo_t wptUMP45 = {
@ -37,10 +37,12 @@ weaponinfo_t wptUMP45 = {
0.105, // Attack-Delay
3.5, // Reload-Delay
iAmmo_45ACP, // Caliber Pointer
iClip_UMP45, // Clip Pointer
iMag_UMP45, // Clip Pointer
210, // Accuracy Divisor
0.5, // Accuracy Offset
1 // Max Inaccuracy
1, // Max Inaccuracy
6,
3
};
// Anim Table
@ -77,6 +79,8 @@ void WeaponUMP45_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_UMP45_SHOOT3 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_USP45;
.int iMag_USP45;
#ifdef SSQC
.int iMode_USP45;
@ -43,10 +43,12 @@ weaponinfo_t wptUSP45 = {
0.15, // Attack-Delay
2.5, // Reload-Delay
iAmmo_45ACP, // Caliber Pointer
iClip_USP45, // Clip Pointer
iMag_USP45, // Clip Pointer
200, // Accuracy Divisor
0.55, // Accuracy Offset
1.4 // Max Inaccuracy
1.4, // Max Inaccuracy
8,
3
};
enum {
@ -96,7 +98,7 @@ void WeaponUSP45_PrimaryFire( void ) {
}
}
#else
if ( getstatf( STAT_CURRENT_CLIP ) == 0 ) {
if ( getstatf( STAT_CURRENT_MAG ) == 0 ) {
if ( iWeaponMode_USP45 == TRUE ) {
View_PlayAnimation( ANIM_USP45_SILENCER_SHOOTLAST );
} else {
@ -125,6 +127,8 @@ void WeaponUSP45_PrimaryFire( void ) {
}
}
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}

View file

@ -18,7 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
.int iClip_XM1014;
.int iMag_XM1014;
#ifdef SSQC
.int iMode_XM1014;
@ -43,10 +43,12 @@ weaponinfo_t wptXM1014 = {
0.25, // Attack-Delay
3.0, // Reload-Delay
iAmmo_BUCKSHOT, // Caliber Pointer
iClip_XM1014, // Clip Pointer
iMag_XM1014, // Clip Pointer
200, // Accuracy Divisor
0.35, // Accuracy Offset
1.25 // Max Inaccuracy
1.25, // Max Inaccuracy
9,
4
};
// Anim Table
@ -89,6 +91,8 @@ void WeaponXM1014_PrimaryFire( void ) {
} else {
View_PlayAnimation( ANIM_XM1014_SHOOT2 );
}
OpenCSGunBase_ShotMultiplierHandle( 1 );
#endif
}
@ -96,7 +100,7 @@ void WeaponXM1014_Reload( void);
void WeaponXM1014_Secondary( void ) {
#ifdef SSQC
// If it's full or no ammo is left...
if ( (self.(wptXM1014.iClipfld) == wptXM1014.iClipSize) || ( self.(wptXM1014.iCaliberfld) <= 0 ) ) {
if ( (self.(wptXM1014.iMagfld) == wptXM1014.iMagSize) || ( self.(wptXM1014.iCaliberfld) <= 0 ) ) {
self.iMode_XM1014 = 0;
Client_SendEvent( self, EV_WEAPON_RELOAD );
self.think = WeaponXM1014_ReloadNULL;
@ -104,7 +108,7 @@ void WeaponXM1014_Secondary( void ) {
return;
}
self.(wptXM1014.iClipfld) += 1;
self.(wptXM1014.iMagfld) += 1;
self.(wptXM1014.iCaliberfld) -= 1;
Client_SendEvent( self, EV_WEAPON_SECONDARYATTACK );
@ -120,7 +124,7 @@ void WeaponXM1014_Secondary( void ) {
void WeaponXM1014_Reload( void ) {
#ifdef SSQC
// Can we reload the gun even if we wanted to?
if ( ( self.(wptXM1014.iClipfld) != wptXM1014.iClipSize ) && ( self.(wptXM1014.iCaliberfld) > 0 ) ) {
if ( ( self.(wptXM1014.iMagfld) != wptXM1014.iMagSize ) && ( self.(wptXM1014.iCaliberfld) > 0 ) ) {
self.iMode_XM1014 = 1 - self.iMode_XM1014;
if ( self.iMode_XM1014 == TRUE ) {

View file

@ -58,12 +58,12 @@ void Weapon_Draw( float fWeapon ) {
return;
}
// In case reloading logic is still going on
self.think = Empty;
wpnFuncTable[ fWeapon ].vDraw();
#ifdef SSQC
// In case reloading logic is still going on
self.think = Empty;
self.maxspeed = Player_GetMaxSpeed( fWeapon );
self.fAttackFinished = time + 1.0;
#endif
@ -126,7 +126,7 @@ void Weapon_Switch( int iSlot ) {
}
void Weapon_UpdateCurrents( void ) {
self.iCurrentClip = self.(wptTable[ self.weapon ].iClipfld);
self.iCurrentMag = self.(wptTable[ self.weapon ].iMagfld);
self.iCurrentCaliber = self.(wptTable[ self.weapon ].iCaliberfld);
}
@ -149,7 +149,7 @@ void Weapon_AddItem( float fWeapon ) {
self.weapon = fWeapon;
// Make sure we've got at least one full clip
self.(wptTable[ self.weapon ].iClipfld) = wptTable[ fWeapon ].iClipSize;
self.(wptTable[ self.weapon ].iMagfld) = wptTable[ fWeapon ].iMagSize;
}
void Weapon_GiveAmmo( float fWeapon, float fAmount ) {