157 lines
4.1 KiB
C
Executable file
157 lines
4.1 KiB
C
Executable file
/*
|
|
Copyright 2016-2018 Marco "eukara" Hladik
|
|
|
|
MIT LICENSE
|
|
|
|
Permission is hereby granted, free of charge, to any person
|
|
obtaining a copy of this software and associated documentation
|
|
files (the "Software"), to deal in the Software without
|
|
restriction, including without limitation the rights to use,
|
|
copy, modify, merge, publish, distribute, sublicense, and/or
|
|
sell copies of the Software, and to permit persons to whom the
|
|
Software is furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be
|
|
included in all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
.int iMag_XM1014;
|
|
|
|
#ifdef SSQC
|
|
.int iMode_XM1014;
|
|
#else
|
|
int iWeaponMode_XM1014;
|
|
#endif
|
|
|
|
// Weapon Info
|
|
weaponinfo_t wptXM1014 = {
|
|
WEAPON_XM1014, // Identifier
|
|
SLOT_PRIMARY, // Slot
|
|
3000, // Price
|
|
CALIBER_BUCKSHOT, // Caliber ID
|
|
0.96, // Max Player Speed
|
|
6, // Bullets Per Shot
|
|
7, // Clip/MagSize
|
|
22, // Damage Per Bullet
|
|
1, // Penetration Multiplier
|
|
3000, // Bullet Range
|
|
0.7, // Range Modifier
|
|
TYPE_AUTO, // Firing Type
|
|
0.25, // Attack-Delay
|
|
3.0, // Reload-Delay
|
|
iAmmo_BUCKSHOT, // Caliber Pointer
|
|
iMag_XM1014, // Clip Pointer
|
|
200, // Accuracy Divisor
|
|
0.35, // Accuracy Offset
|
|
1.25, // Max Inaccuracy
|
|
9, // Minimum Crosshair Distance
|
|
4, // Crosshair Movement Delta
|
|
1.0, // Armor penetration ratio
|
|
ATYPE_SHOTGUN, // Animation Type
|
|
SHELL_SHOTGUN
|
|
};
|
|
|
|
// Anim Table
|
|
enum {
|
|
ANIM_XM1014_IDLE,
|
|
ANIM_XM1014_SHOOT1,
|
|
ANIM_XM1014_SHOOT2,
|
|
ANIM_XM1014_INSERT,
|
|
ANIM_XM1014_RELOAD_END,
|
|
ANIM_XM1014_RELOAD_START,
|
|
ANIM_XM1014_DRAW
|
|
};
|
|
|
|
void WeaponXM1014_Draw( void ) {
|
|
#ifdef SSQC
|
|
BaseGun_Draw();
|
|
#else
|
|
View_PlayAnimation( ANIM_XM1014_DRAW );
|
|
#endif
|
|
}
|
|
|
|
void WeaponXM1014_ReloadNULL( void ) { }
|
|
|
|
void WeaponXM1014_PrimaryFire( void ) {
|
|
#ifdef SSQC
|
|
if ( self.iMode_XM1014 == TRUE ) {
|
|
self.iMode_XM1014 = 0;
|
|
Client_SendEvent( self, EV_WEAPON_RELOAD );
|
|
self.think = WeaponXM1014_ReloadNULL;
|
|
self.fAttackFinished = time + 0.5;
|
|
return;
|
|
}
|
|
|
|
if ( BaseGun_PrimaryFire() == TRUE ) {
|
|
sound( self, CHAN_WEAPON, "weapons/xm1014-1.wav", 1, ATTN_NORM );
|
|
}
|
|
#else
|
|
if ( random() <= 0.5 ) {
|
|
View_PlayAnimation( ANIM_XM1014_SHOOT1 );
|
|
} else {
|
|
View_PlayAnimation( ANIM_XM1014_SHOOT2 );
|
|
}
|
|
|
|
BaseGun_ShotMultiplierHandle( 1 );
|
|
#endif
|
|
}
|
|
|
|
void WeaponXM1014_Reload( void);
|
|
void WeaponXM1014_Secondary( void ) {
|
|
#ifdef SSQC
|
|
// If it's full or no ammo is left...
|
|
if ( (self.(wptXM1014.iMagfld) == wptXM1014.iMagSize) || ( self.(wptXM1014.iCaliberfld) <= 0 ) ) {
|
|
self.iMode_XM1014 = 0;
|
|
Client_SendEvent( self, EV_WEAPON_RELOAD );
|
|
self.think = WeaponXM1014_ReloadNULL;
|
|
self.fAttackFinished = time + 0.5;
|
|
return;
|
|
}
|
|
|
|
self.(wptXM1014.iMagfld) += 1;
|
|
self.(wptXM1014.iCaliberfld) -= 1;
|
|
|
|
Client_SendEvent( self, EV_WEAPON_SECONDARYATTACK );
|
|
|
|
self.think = WeaponXM1014_Secondary;
|
|
self.nextthink = time + 0.5;
|
|
#else
|
|
View_PlayAnimation( ANIM_XM1014_INSERT );
|
|
#endif
|
|
}
|
|
|
|
void WeaponXM1014_Reload( void ) {
|
|
#ifdef SSQC
|
|
// Can we reload the gun even if we wanted to?
|
|
if ( ( self.(wptXM1014.iMagfld) != wptXM1014.iMagSize ) && ( self.(wptXM1014.iCaliberfld) > 0 ) ) {
|
|
self.iMode_XM1014 = 1 - self.iMode_XM1014;
|
|
|
|
if ( self.iMode_XM1014 == TRUE ) {
|
|
self.think = WeaponXM1014_Secondary;
|
|
self.nextthink = time + 0.8;
|
|
} else {
|
|
self.think = WeaponXM1014_ReloadNULL;
|
|
}
|
|
|
|
Client_SendEvent( self, EV_WEAPON_RELOAD );
|
|
self.fAttackFinished = time + 0.5;
|
|
}
|
|
#else
|
|
iWeaponMode_XM1014 = 1 - iWeaponMode_XM1014;
|
|
|
|
if ( iWeaponMode_XM1014 == TRUE ) {
|
|
View_PlayAnimation( ANIM_XM1014_RELOAD_START );
|
|
} else {
|
|
View_PlayAnimation( ANIM_XM1014_RELOAD_END );
|
|
}
|
|
#endif
|
|
}
|