Added mp_fillweapons to allow similar weapon-buying to CS:S
This commit is contained in:
parent
7afac5c6cf
commit
ab42b2c2a8
8 changed files with 90 additions and 39 deletions
|
@ -24,9 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define DRAWFLAG_MODULATE 2
|
||||
#define DRAWFLAG_2XMODULATE 3
|
||||
|
||||
vector autocvar_con_color; // autocvar of "con_color"
|
||||
vector autocvar_vgui_color; // autocvar of "vgui_color"
|
||||
vector autocvar_cross_color; // autocvar of "cross_color"
|
||||
var vector autocvar_con_color; // autocvar of "con_color"
|
||||
var vector autocvar_vgui_color; // autocvar of "vgui_color"
|
||||
var vector autocvar_cross_color; // autocvar of "cross_color"
|
||||
|
||||
vector vHUDColor; // Defined in HUD_Draw (HUD.c)
|
||||
vector vVGUIColor; // Defined in HUD_Draw (VGUI.c)
|
||||
|
|
|
@ -111,7 +111,6 @@ void CSQC_DrawCenterprint( void ) {
|
|||
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', '0.25 0.25 0.25', fCenterPrintAlpha, 0 );
|
||||
drawstring( vCenterPrintPos, sCenterPrintBuffer[ i ], '8 8 0', vHUDColor, fCenterPrintAlpha, DRAWFLAG_ADDITIVE );
|
||||
vCenterPrintPos_y += 8;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,48 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "VGUI.h"
|
||||
|
||||
string sClassInfo[40] = {
|
||||
"Phoenix Connexion", "gfx/vgui/640_terror",
|
||||
"The Phoenix Faction was formed shortly after the breakup of the USSR.",
|
||||
"Having established a reputation for killing anyone that gets in their way,",
|
||||
"the Phoenix Faction is one of the most feared terrorist groups in Eastern Europe.",
|
||||
|
||||
"L337 Krew", "gfx/vgui/640_leet",
|
||||
"Middle Eastern fundamentalist group bent on world domination and various other evil deeds",
|
||||
"",
|
||||
"",
|
||||
|
||||
"Arctic Avengers", "gfx/vgui/640_arctic",
|
||||
"Swedish terrorist faction founded in 1977.",
|
||||
"Famous for their bombing of the Canadian embassy in 1990.",
|
||||
"",
|
||||
|
||||
"Guerilla Warfare", "gfx/vgui/640_guerilla",
|
||||
"A terrorist faction founded in the Middle East, Guerilla Warfare,",
|
||||
"has a reputation for ruthlessness. Their disgust for the American lifestyle was",
|
||||
"demonstrated in their 1982 bombing of a school bus full of Rock and Roll musicians.",
|
||||
|
||||
"Seal Team 6", "gfx/vgui/640_urban",
|
||||
"Seal Team 6 (to be known later as DEVGRU) was founded in 1980 under the command of ",
|
||||
"Lieutenant-Commander Richard Marcincko. ST-6 was placed on permanent alert to ",
|
||||
"respond to terrorist attacks against American targets worldwide.",
|
||||
|
||||
"German GSG9", "gfx/vgui/640_gsg9",
|
||||
"GSG-9 was born out of the tragic events that led to the death of several",
|
||||
"Israeli athletes during the 1972 Olympic games in Munich, Germany.",
|
||||
"",
|
||||
|
||||
"UK SAS", "gfx/vgui/640_sas",
|
||||
"The world-renowned British SAS was founded in the Second World War",
|
||||
"by a man named David Stirling. Their role during WW2 involved gathering intelligence",
|
||||
"behind enemy lines and executing sabotage strikes and assassinations against key targets.",
|
||||
|
||||
"French GIGN", "gfx/vgui/640_gign",
|
||||
"France's elite Counter-Terrorist unit, the GIGN, was designed to be a fast response force ",
|
||||
"that could decisively react to any large-scale terrorist incident. Consisting of no more",
|
||||
"than 100 men, the GIGN has earned its reputation through a history of successful ops."
|
||||
};
|
||||
|
||||
void VGUI_TeamSelect_Main( vector vPos ) {
|
||||
static void TeamSelect_Main_ButtonT( void ) {
|
||||
fVGUI_Display = VGUI_TEAM_T;
|
||||
|
@ -34,6 +76,9 @@ void VGUI_TeamSelect_Main( vector vPos ) {
|
|||
sendevent( "GamePlayerSpawn", "f", 0 );
|
||||
fVGUI_Display = VGUI_NONE;
|
||||
}
|
||||
static void TeamSelect_Main_Exit( void ) {
|
||||
fVGUI_Display = VGUI_NONE;
|
||||
}
|
||||
|
||||
VGUI_Text( sMapString[ 0 ], vPos + '16 64 0', '16 16 0');
|
||||
|
||||
|
@ -48,16 +93,21 @@ void VGUI_TeamSelect_Main( vector vPos ) {
|
|||
|
||||
VGUI_Button( "Auto-Assign", TeamSelect_Main_ButtonAuto, vPos + '16 336 0', '180 24 0' );
|
||||
VGUI_Button( "Spectate", TeamSelect_Main_ButtonSpectate, vPos + '16 368 0', '180 24 0' );
|
||||
|
||||
VGUI_Button( "Exit", TeamSelect_Main_Exit, vPos + '16 440 0', '120 24 0' );
|
||||
}
|
||||
|
||||
void VGUI_TeamSelect_Back( void ) {
|
||||
fVGUI_Display = VGUI_TEAMSELECT;
|
||||
}
|
||||
|
||||
void VGUI_TeamSelect_Button( string sLabel, string sImage, void() vFunc, vector vPos, vector vSize ) {
|
||||
|
||||
if( VGUI_Button( sLabel, vFunc, vPos, vSize ) == TRUE ) {
|
||||
drawpic( vVGUIWindowPos + '355 174', sImage, '128 256', '1 1 1', 1 );
|
||||
void VGUI_TeamSelect_Button( float fNumber, void() vFunc, vector vPos, vector vSize ) {
|
||||
if( VGUI_Button( sClassInfo[ 5 * fNumber ] , vFunc, vPos, vSize ) == TRUE ) {
|
||||
drawpic( vVGUIWindowPos + '355 116', sClassInfo[ 5 * fNumber + 1 ], '128 256', '1 1 1', 1 );
|
||||
|
||||
VGUI_Text( sClassInfo[ 5 * fNumber + 2 ], vVGUIWindowPos + '16 372', '6 8 0' );
|
||||
VGUI_Text( sClassInfo[ 5 * fNumber + 3 ], vVGUIWindowPos + '16 390', '6 8 0' );
|
||||
VGUI_Text( sClassInfo[ 5 * fNumber + 4 ], vVGUIWindowPos + '16 406', '6 8 0' );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,16 +128,11 @@ void VGUI_TeamSelect_T( vector vPos ) {
|
|||
sendevent( "GamePlayerSpawn", "f", 4 );
|
||||
fVGUI_Display = VGUI_NONE;
|
||||
}
|
||||
|
||||
VGUI_Text( "Team Description", vPos + '16 64 0', '16 16 0');
|
||||
|
||||
VGUI_Text( "This describes the object of your current team.", vPos + '16 116 0', '8 8 0' );
|
||||
VGUI_Text( "As a T, you will most likely watch the hostages or plant bombs.", vPos + '16 132 0', '8 8 0' );
|
||||
|
||||
VGUI_TeamSelect_Button( "Phoenix Connexion", "gfx/vgui/640_terror", TeamSelect_T1, vPos + '16 240 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( "L337 Krew", "gfx/vgui/640_leet", TeamSelect_T2, vPos + '16 272 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( "Arctic Avengers", "gfx/vgui/640_arctic", TeamSelect_T3, vPos + '16 306 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( "Guerilla Warfare", "gfx/vgui/640_guerilla", TeamSelect_T4, vPos + '16 336 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 0, TeamSelect_T1, vPos + '16 116 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 1, TeamSelect_T2, vPos + '16 148 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 2, TeamSelect_T3, vPos + '16 180 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 3, TeamSelect_T4, vPos + '16 212 0', '180 24 0' );
|
||||
VGUI_Button( "Back", VGUI_TeamSelect_Back, vPos + '16 440 0', '120 24 0' );
|
||||
}
|
||||
|
||||
|
@ -109,14 +154,9 @@ void VGUI_TeamSelect_CT ( vector vPos ) {
|
|||
fVGUI_Display = VGUI_NONE;
|
||||
}
|
||||
|
||||
VGUI_Text( "Team Description", vPos + '16 64 0', '16 16 0');
|
||||
|
||||
VGUI_Text( "This describes the object of your current team.", vPos + '16 116 0', '8 8 0' );
|
||||
VGUI_Text( "As a CT, you will most likely rescue hostages or defuse bombs.", vPos + '16 132 0', '8 8 0' );
|
||||
|
||||
VGUI_TeamSelect_Button( "Seal Team 6", "gfx/vgui/640_urban", TeamSelect_CT1, vPos + '16 240 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( "German GSG9", "gfx/vgui/640_gsg9", TeamSelect_CT2, vPos + '16 272 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( "UK SAS", "gfx/vgui/640_sas", TeamSelect_CT3, vPos + '16 306 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( "French GIGN", "gfx/vgui/640_gign", TeamSelect_CT4, vPos + '16 336 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 4, TeamSelect_CT1, vPos + '16 116 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 5, TeamSelect_CT2, vPos + '16 148 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 6, TeamSelect_CT3, vPos + '16 180 0', '180 24 0' );
|
||||
VGUI_TeamSelect_Button( 7, TeamSelect_CT4, vPos + '16 212 0', '180 24 0' );
|
||||
VGUI_Button( "Back", VGUI_TeamSelect_Back, vPos + '16 440 0', '120 24 0' );
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ ammoinfo_t ammoTable[11] = {
|
|||
{ 50, 100, 50 } //CALIBER_57MM
|
||||
};
|
||||
|
||||
void Ammo_BuyPrimary( void ) {
|
||||
void Ammo_BuyPrimary( float fFree ) {
|
||||
if ( !self.fSlotPrimary ) {
|
||||
return;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void Ammo_BuyPrimary( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
void Ammo_BuySecondary( void ) {
|
||||
void Ammo_BuySecondary( float fFree ) {
|
||||
if ( !self.fSlotSecondary ) {
|
||||
return;
|
||||
}
|
||||
|
@ -60,12 +60,14 @@ void Ammo_BuySecondary( void ) {
|
|||
float fNew = ceil( ( (float)iRequiredAmmo / (float)ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iSize ) );
|
||||
|
||||
for ( int i = 0; i < fNew; i++ ) {
|
||||
if ( self.fMoney - ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice < 0 ) {
|
||||
break;
|
||||
if ( fFree == FALSE ) {
|
||||
if ( self.fMoney - ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice < 0 ) {
|
||||
break;
|
||||
}
|
||||
Money_AddMoney( self, -ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice );
|
||||
}
|
||||
|
||||
self.(wptTable[ self.fSlotSecondary ].iCaliberfld) += ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iSize;
|
||||
Money_AddMoney( self, -ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice );
|
||||
sound( self, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_IDLE );
|
||||
|
||||
if ( self.(wptTable[ self.fSlotSecondary ].iCaliberfld) > ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iMaxAmount ) {
|
||||
|
@ -80,9 +82,9 @@ void CSEv_GamePlayerBuyAmmo_f( float fType ) {
|
|||
}
|
||||
|
||||
if ( fType == 0 ) {
|
||||
Ammo_BuyPrimary();
|
||||
Ammo_BuyPrimary( FALSE );
|
||||
} else {
|
||||
Ammo_BuySecondary();
|
||||
Ammo_BuySecondary( FALSE );
|
||||
}
|
||||
|
||||
Weapon_UpdateCurrents();
|
||||
|
|
|
@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define VEC_CHULL_MAX '16 16 18'
|
||||
#define VEC_PLAYER_CVIEWPOS '0 0 12'
|
||||
|
||||
|
||||
// Particle Fields
|
||||
float EFFECT_GUNSHOT;
|
||||
float EFFECT_BLOOD;
|
||||
|
@ -127,5 +126,7 @@ void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadi
|
|||
void Entities_InitRespawnable( void() vRespawnFunc );
|
||||
void Entities_Respawn( void );
|
||||
|
||||
void Ammo_BuyPrimary( float fFree );
|
||||
void Ammo_BuySecondary( float fFree );
|
||||
// WIP
|
||||
string __fullspawndata;
|
||||
|
|
|
@ -79,7 +79,7 @@ void Player_Death( void ) {
|
|||
|
||||
float Player_GetMaxSpeed( float fWeapon ) {
|
||||
if ( self.flags & FL_CROUCHING ) {
|
||||
return (cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM) * 0.5;
|
||||
return ( cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM ) * 0.5;
|
||||
} else {
|
||||
return cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM;
|
||||
}
|
||||
|
|
|
@ -101,10 +101,6 @@ void Weapon_Reload( float fWeapon ) {
|
|||
|
||||
#ifdef SSQC
|
||||
void Weapon_Switch( int iSlot ) {
|
||||
if ( self.fAttackFinished > time ) {
|
||||
return;
|
||||
}
|
||||
|
||||
float fWeapon;
|
||||
|
||||
if ( iSlot == SLOT_MELEE ) {
|
||||
|
@ -174,10 +170,22 @@ void CSEv_PlayerBuyWeapon_f( float fWeapon ) {
|
|||
|
||||
if ( ( self.fMoney - wptTable[ fWeapon ].iPrice ) >= 0 ) {
|
||||
Weapon_AddItem( fWeapon );
|
||||
|
||||
// Automatically fill weapons with ammo when you buy them (for free) like in CS:S
|
||||
if ( cvar( "mp_fillweapons" ) == 1 ) {
|
||||
if ( wptTable[ fWeapon ].iSlot == SLOT_PRIMARY ) {
|
||||
Ammo_BuyPrimary( TRUE );
|
||||
} else if ( wptTable[ fWeapon ].iSlot == SLOT_SECONDARY ) {
|
||||
Ammo_BuySecondary( TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
Weapon_Draw( fWeapon );
|
||||
Money_AddMoney( self, -wptTable[ fWeapon ].iPrice );
|
||||
|
||||
sound( self, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_IDLE );
|
||||
}
|
||||
|
||||
self.fAttackFinished = time + 1.0;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ seta mp_buytime 90
|
|||
seta mp_freezetime 6
|
||||
seta mp_c4timer 45
|
||||
seta mp_roundtime 5
|
||||
seta mp_fillweapons 0
|
||||
seta cl_bobcycle 0.8
|
||||
seta cl_bob 0.01
|
||||
seta cl_bobup 0.5
|
||||
|
|
Loading…
Reference in a new issue