Added invlast, added buyammo1 and buyammo2 commands.

This commit is contained in:
Marco Cawthorne 2017-12-28 19:16:30 -08:00
parent acd61228d1
commit 6f682653b1
6 changed files with 89 additions and 7 deletions

View file

@ -26,6 +26,17 @@ Init all the cmds in one place
=================
*/
void CSQC_ConsoleCommand_Init( void ) {
registercommand( "slot1" );
registercommand( "slot2" );
registercommand( "slot3" );
registercommand( "slot4" );
registercommand( "slot5" );
registercommand( "slot6" );
registercommand( "slot7" );
registercommand( "slot8" );
registercommand( "slot9" );
registercommand( "slot10" );
registercommand( "dev_testorbituary" );
registercommand( "minimap" );
registercommand( "overview_test" );
@ -41,6 +52,7 @@ void CSQC_ConsoleCommand_Init( void ) {
registercommand( "buy" );
registercommand( "chooseteam" );
registercommand( "lastinv" );
registercommand( "invnext" );
registercommand( "invprev" );
registercommand( "+showscores" );
@ -76,7 +88,9 @@ void CSQC_ConsoleCommand_Init( void ) {
registercommand( "m249" );
registercommand( "primammo" );
registercommand( "buyammo1" );
registercommand( "secammo" );
registercommand( "buyammo2" );
registercommand( "vest" );
registercommand( "vesthelm" );
@ -123,6 +137,50 @@ float CSQC_ConsoleCommand( string sCMD ) {
tokenize( sCMD );
switch ( argv( 0 ) ) {
case "lastinv":
HUD_DrawWeaponSelect_Last();
return TRUE;
break;
case "slot1":
localcmd( "impulse 1\n" );
return TRUE;
break;
case "slot2":
localcmd( "impulse 2\n" );
return TRUE;
break;
case "slot3":
localcmd( "impulse 3\n" );
return TRUE;
break;
case "slot4":
localcmd( "impulse 4\n" );
return TRUE;
break;
case "slot5":
localcmd( "impulse 5\n" );
return TRUE;
break;
case "slot6":
localcmd( "impulse 6\n" );
return TRUE;
break;
case "slot7":
localcmd( "impulse 7\n" );
return TRUE;
break;
case "slot8":
localcmd( "impulse 8\n" );
return TRUE;
break;
case "slot9":
localcmd( "impulse 9\n" );
return TRUE;
break;
case "slot10":
localcmd( "impulse 10\n" );
return TRUE;
break;
case "dev_testorbituary":
HUD_AddOrbituaries( player_localnum, TEAM_T, player_localnum, TEAM_CT, floor( random( 1, CS_WEAPON_COUNT ) ), FALSE );
return TRUE;
@ -293,10 +351,12 @@ float CSQC_ConsoleCommand( string sCMD ) {
sendevent( "PlayerBuyWeapon", "f", WEAPON_PARA );
return TRUE;
break;
case "buyammo1":
case "primammo":
sendevent( "GamePlayerBuyAmmo", "f", 0 );
return TRUE;
break;
case "buyammo2":
case "secammo":
sendevent( "GamePlayerBuyAmmo", "f", 1 );
return TRUE;

View file

@ -370,16 +370,31 @@ void HUD_DrawWeaponSelect( void ) {
}
}
var float fHUDWeaponLast;
/*
=================
HUD_DrawWeaponSelect
HUD_DrawWeaponSelect_Trigger
Called by CSQC_Input_Frame when conditions are met
=================
*/
void HUD_DrawWeaponSelect_Trigger( void ) {
fHUDWeaponLast = getstatf( STAT_ACTIVEWEAPON );
sendevent( "PlayerSwitchWeapon", "f", pSeat->fHUDWeaponSelected );
sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.5, ATTN_NONE );
pSeat->fHUDWeaponSelectTime = 0;
pSeat->fHUDWeaponSelected = 0;
}
/*
=================
HUD_DrawWeaponSelect_Last
Returns the last weapon we've used
=================
*/
void HUD_DrawWeaponSelect_Last( void ) {
sendevent( "PlayerSwitchWeapon", "f", fHUDWeaponLast );
fHUDWeaponLast = getstatf( STAT_ACTIVEWEAPON );
}

View file

@ -524,6 +524,9 @@ Client-HUD call that switches to a specific weapon
=================
*/
void CSEv_PlayerSwitchWeapon_f( float fWeapon ) {
if ( Weapon_AlreadyExists( fWeapon ) == FALSE && fWeapon != WEAPON_KNIFE ) {
return;
}
if ( fWeapon != self.weapon ) {
Weapon_Draw( fWeapon );
}
@ -539,5 +542,4 @@ Client call that tells us to drop the currently equipped weapon
void CSEv_WeaponDrop( void ) {
Weapon_DropWeapon( wptTable[ self.weapon ].iSlot );
}
#endif

Binary file not shown.

View file

@ -2,6 +2,16 @@ bind w +forward
bind s +back
bind a +moveleft
bind d +moveright
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"
bind "9" "slot9"
bind "UPARROW" "+forward"
bind "DOWNARROW" "+back"
bind "LEFTARROW" "+left"
@ -20,11 +30,6 @@ bind x radio2
bind z radio1
bind t messagemode
bind 1 "impulse 1"
bind 2 "impulse 2"
bind 3 "impulse 3"
bind 4 "impulse 4"
bind SPACE +jump
bind CTRL +duck
bind SHIFT +speed

Binary file not shown.