Import the weapon_base* files that were once in base/, but have since then been deleted.
This commit is contained in:
parent
3e47775ccb
commit
f290161fbd
6 changed files with 337 additions and 5 deletions
|
@ -19,11 +19,11 @@ pmove.qc
|
|||
../../../valve/src/shared/fx_impact.qc
|
||||
../../../base/src/shared/fx_corpse.qc
|
||||
|
||||
../../../base/src/shared/weapon_basesemi.qc
|
||||
../../../base/src/shared/weapon_basemelee.qc
|
||||
../../../base/src/shared/weapon_baseshotgun.qc
|
||||
../../../base/src/shared/weapon_baseprojectile.qc
|
||||
../../../base/src/shared/weapon_baseautomatic.qc
|
||||
weapon_basesemi.qc
|
||||
weapon_basemelee.qc
|
||||
weapon_baseshotgun.qc
|
||||
weapon_baseprojectile.qc
|
||||
weapon_baseautomatic.qc
|
||||
|
||||
w_asscan.qc
|
||||
w_autorifle.qc
|
||||
|
|
51
src/shared/weapon_baseautomatic.qc
Normal file
51
src/shared/weapon_baseautomatic.qc
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
AUTO_FIRE_FAILED,
|
||||
AUTO_FIRED,
|
||||
AUTO_LAST,
|
||||
AUTO_EMPTY
|
||||
};
|
||||
|
||||
int
|
||||
w_baseauto_fire(int w, .int mag, int d, vector bs)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return (AUTO_FIRE_FAILED);
|
||||
}
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return (AUTO_FIRE_FAILED);
|
||||
}
|
||||
if (pl.(mag) <= 0) {
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return (AUTO_EMPTY);
|
||||
}
|
||||
|
||||
pl.(mag)--;
|
||||
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, d, bs, w);
|
||||
#endif
|
||||
|
||||
if (pl.(mag) == 0)
|
||||
return (AUTO_LAST);
|
||||
else
|
||||
return (AUTO_FIRED);
|
||||
}
|
59
src/shared/weapon_basemelee.qc
Normal file
59
src/shared/weapon_basemelee.qc
Normal file
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
MELEE_FAILED,
|
||||
MELEE_MISS,
|
||||
MELEE_HIT,
|
||||
MELEE_HITBODY
|
||||
};
|
||||
|
||||
int
|
||||
w_basemelee_fire(int d, int w)
|
||||
{
|
||||
int anim = 0;
|
||||
vector src;
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return (MELEE_FAILED);
|
||||
}
|
||||
|
||||
Weapons_MakeVectors(pl);
|
||||
src = pl.origin + pl.view_ofs;
|
||||
|
||||
/* make sure we can gib corpses */
|
||||
int oldhitcontents = self.hitcontentsmaski;
|
||||
self.hitcontentsmaski = CONTENTBITS_POINTSOLID | CONTENTBIT_CORPSE;
|
||||
traceline(src, src + (v_forward * 32), FALSE, pl);
|
||||
self.hitcontentsmaski = oldhitcontents;
|
||||
|
||||
pl.w_attack_next = 0.5f;
|
||||
pl.w_idle_next = 2.5f;
|
||||
|
||||
if (trace_fraction >= 1.0) {
|
||||
return (MELEE_MISS);
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
if (trace_ent.takedamage) {
|
||||
Damage_Apply(trace_ent, pl, d, w, DMG_BLUNT);
|
||||
}
|
||||
#endif
|
||||
|
||||
return (MELEE_HIT);
|
||||
}
|
48
src/shared/weapon_baseprojectile.qc
Normal file
48
src/shared/weapon_baseprojectile.qc
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SEMI_FIRE_FAILED,
|
||||
SEMI_FIRED,
|
||||
SEMI_LAST,
|
||||
SEMI_EMPTY
|
||||
};
|
||||
|
||||
int
|
||||
w_baseprojectile_fire(player pl, int w, .int mag, void(player) spawnfunc)
|
||||
{
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return (SEMI_FIRE_FAILED);
|
||||
}
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return (SEMI_FIRE_FAILED);
|
||||
}
|
||||
if (pl.(mag) <= 0) {
|
||||
return (SEMI_EMPTY);
|
||||
}
|
||||
|
||||
pl.(mag)--;
|
||||
|
||||
#ifdef SERVER
|
||||
spawnfunc(pl);
|
||||
#endif
|
||||
|
||||
if (pl.(mag) == 0)
|
||||
return (SEMI_LAST);
|
||||
else
|
||||
return (SEMI_FIRED);
|
||||
}
|
53
src/shared/weapon_basesemi.qc
Normal file
53
src/shared/weapon_basesemi.qc
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SEMI_FIRE_FAILED,
|
||||
SEMI_FIRED,
|
||||
SEMI_LAST,
|
||||
SEMI_EMPTY
|
||||
};
|
||||
|
||||
int
|
||||
w_basesemi_fire(int w, .int mag, int d, vector bs)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return (SEMI_FIRE_FAILED);
|
||||
}
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return (SEMI_FIRE_FAILED);
|
||||
}
|
||||
if (pl.(mag) <= 0) {
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return (SEMI_EMPTY);
|
||||
}
|
||||
|
||||
pl.(mag)--;
|
||||
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, d, bs, w);
|
||||
#endif
|
||||
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
|
||||
if (pl.(mag) == 0)
|
||||
return (SEMI_LAST);
|
||||
else
|
||||
return (SEMI_FIRED);
|
||||
}
|
121
src/shared/weapon_baseshotgun.qc
Normal file
121
src/shared/weapon_baseshotgun.qc
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2022 Vera Visions LLC.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
SHOTGUN_FIRE_FAILED,
|
||||
SHOTGUN_FIRED,
|
||||
SHOTGUN_LAST,
|
||||
SHOTGUN_EMPTY
|
||||
};
|
||||
|
||||
int
|
||||
w_baseshotgun_fire(int w, .int mag, int c, int d, vector bs)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_attack_next > 0.0) {
|
||||
return (SHOTGUN_FIRE_FAILED);
|
||||
}
|
||||
if (pl.gflags & GF_SEMI_TOGGLED) {
|
||||
return (SHOTGUN_FIRE_FAILED);
|
||||
}
|
||||
if (pl.(mag) <= 0) {
|
||||
pl.gflags |= GF_SEMI_TOGGLED;
|
||||
return (SHOTGUN_EMPTY);
|
||||
}
|
||||
|
||||
pl.(mag)--;
|
||||
|
||||
#ifdef SERVER
|
||||
TraceAttack_FireBullets(c, pl.origin + pl.view_ofs, d, bs, w);
|
||||
#endif
|
||||
|
||||
if (pl.(mag) == 0)
|
||||
return (SHOTGUN_LAST);
|
||||
else
|
||||
return (SHOTGUN_FIRED);
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
SHOTTY_IDLE,
|
||||
SHOTTY_RELOAD_START,
|
||||
SHOTTY_RELOAD,
|
||||
SHOTTY_RELOAD_END,
|
||||
SHOTTY_COCKSOUND
|
||||
};
|
||||
|
||||
void
|
||||
w_baseshotgun_reload(.int mag, .int ammo, int max)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.(mag) >= max) {
|
||||
return;
|
||||
}
|
||||
if (pl.(ammo) <= 0) {
|
||||
return;
|
||||
}
|
||||
if (pl.mode_tempstate > SHOTTY_IDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_START;
|
||||
pl.w_idle_next = 0.0f;
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
SHOTGUN_IDLE,
|
||||
SHOTGUN_BUSY,
|
||||
SHOTGUN_START_RELOAD,
|
||||
SHOTGUN_RELOAD,
|
||||
SHOTGUN_END_RELOAD
|
||||
};
|
||||
|
||||
int
|
||||
w_baseshotgun_release(.int mag, .int ammo, int max)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
return (SHOTGUN_BUSY);
|
||||
}
|
||||
|
||||
if (pl.mode_tempstate == SHOTTY_RELOAD_START) {
|
||||
pl.mode_tempstate = SHOTTY_RELOAD;
|
||||
pl.w_idle_next = 0.65f;
|
||||
return (SHOTGUN_START_RELOAD);
|
||||
} else if (pl.mode_tempstate == SHOTTY_RELOAD) {
|
||||
pl.(mag)++;
|
||||
pl.(ammo)--;
|
||||
|
||||
if (pl.(ammo) <= 0 || pl.(mag) >= max) {
|
||||
pl.mode_tempstate = SHOTTY_RELOAD_END;
|
||||
}
|
||||
Weapons_UpdateAmmo(pl, pl.(mag), pl.(ammo), pl.mode_tempstate);
|
||||
pl.w_idle_next = 0.5f;
|
||||
return (SHOTGUN_RELOAD);
|
||||
} else if (pl.mode_tempstate == SHOTTY_RELOAD_END) {
|
||||
pl.mode_tempstate = SHOTTY_IDLE;
|
||||
pl.w_idle_next = 10.0f;
|
||||
pl.w_attack_next = 0.5f;
|
||||
return (SHOTGUN_END_RELOAD);
|
||||
}
|
||||
|
||||
return (SHOTGUN_IDLE);
|
||||
}
|
Loading…
Reference in a new issue