Base: Doing more cleanup work here, more to be done for sure. Specifically finish a working NSWeapon class example.
This commit is contained in:
parent
1069468be1
commit
fa8e335564
36 changed files with 47 additions and 1151 deletions
|
@ -19,17 +19,5 @@ vector g_hudres;
|
|||
|
||||
struct
|
||||
{
|
||||
/* hud.c */
|
||||
int m_iHealthOld;
|
||||
float m_flHealthAlpha;
|
||||
int m_iArmorOld;
|
||||
float m_flArmorAlpha;
|
||||
int m_iAmmo1Old;
|
||||
float m_flAmmo1Alpha;
|
||||
int m_iAmmo2Old;
|
||||
float m_flAmmo2Alpha;
|
||||
int m_iAmmo3Old;
|
||||
float m_flAmmo3Alpha;
|
||||
int m_iPickupWeapon;
|
||||
float m_flPickupAlpha;
|
||||
float temp;
|
||||
} g_seatslocal[4], *pSeatLocal;
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
Player_PreDraw(NSClientPlayer pl, int thirdperson)
|
||||
{
|
||||
/* Handle the flashlights... */
|
||||
if (pl.gflags & GF_FLASHLIGHT) {
|
||||
vector src;
|
||||
vector ang;
|
||||
|
||||
if (pl.entnum != player_localentnum) {
|
||||
src = pl.origin + pl.view_ofs;
|
||||
ang = pl.v_angle;
|
||||
} else {
|
||||
src = pSeat->m_vecPredictedOrigin + [0,0,-8];
|
||||
ang = view_angles;
|
||||
}
|
||||
|
||||
makevectors(ang);
|
||||
traceline(src, src + (v_forward * 8096), MOVE_NORMAL, pl);
|
||||
|
||||
if (serverkeyfloat("*bspversion") == BSPVER_HL) {
|
||||
dynamiclight_add(trace_endpos + (v_forward * -2), 128, [1,1,1]);
|
||||
} else {
|
||||
float p = dynamiclight_add(src, 512, [1,1,1], 0, "textures/flashlight");
|
||||
dynamiclight_set(p, LFIELD_ANGLES, ang);
|
||||
dynamiclight_set(p, LFIELD_FLAGS, 3);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,17 +26,16 @@ defs.h
|
|||
../shared/include.src
|
||||
../../../base/src/client/draw.qc
|
||||
init.qc
|
||||
player.qc
|
||||
entities.qc
|
||||
camera.qc
|
||||
cmds.qc
|
||||
game_event.qc
|
||||
camera.qc
|
||||
modelevent.qc
|
||||
viewmodel.qc
|
||||
view.qc
|
||||
hud.qc
|
||||
hud_weaponselect.qc
|
||||
scoreboard.qc
|
||||
modelevent.qc
|
||||
|
||||
/* global client/shared code */
|
||||
../../../src/client/include.src
|
||||
|
|
|
@ -84,7 +84,7 @@ Viewmodel_CalcBob(void)
|
|||
pViewBob->m_flBob2 = bound(-7, flBob, 4);
|
||||
|
||||
/* make sure it's adjusted for scale */
|
||||
pViewBob->m_flBob *= autocvar_r_cg_viewmodelScale;
|
||||
pViewBob->m_flBob *= autocvar_cg_viewmodelScale;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* called every input frame */
|
||||
void
|
||||
Game_RunClientCommand(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
pl.Physics_Run();
|
||||
}
|
||||
|
||||
/* client cmd overrides happen here */
|
||||
void
|
||||
Game_ParseClientCommand(string cmd)
|
||||
{
|
||||
tokenize(cmd);
|
||||
|
||||
clientcommand(self, cmd);
|
||||
}
|
|
@ -13,27 +13,3 @@
|
|||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* generic function that applies damage, pain and suffering */
|
||||
void
|
||||
Damage_Apply(entity t, entity c, float dmg, int w, damageType_t type)
|
||||
{
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
rules.DamageApply(t, c, dmg, w, type);
|
||||
}
|
||||
|
||||
/* physical check of whether or not we can trace important parts of an ent */
|
||||
float
|
||||
Damage_CheckTrace(entity t, vector vecHitPos)
|
||||
{
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
return rules.DamageCheckTrace(t, vecHitPos);
|
||||
}
|
||||
|
||||
/* even more pain and suffering, mostly used for explosives */
|
||||
void
|
||||
Damage_Radius(vector org, entity attacker, float dmg, float r, int check, int w)
|
||||
{
|
||||
CGameRules rules = (CGameRules)g_grMode;
|
||||
rules.DamageRadius(org, attacker, dmg, r, check, w);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,3 @@
|
|||
*/
|
||||
|
||||
#include "gamerules.h"
|
||||
#include "items.h"
|
||||
#include "flashlight.h"
|
||||
#include "player.h"
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void Flashlight_Toggle(void);
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
Flashlight_Toggle(void)
|
||||
{
|
||||
if (cvar("sv_playerslots") != 1) {
|
||||
if (cvar("mp_flashlight") != 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.health <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.gflags & GF_FLASHLIGHT) {
|
||||
self.gflags &= ~GF_FLASHLIGHT;
|
||||
} else {
|
||||
self.gflags |= GF_FLASHLIGHT;
|
||||
}
|
||||
}
|
|
@ -99,5 +99,11 @@ GameRules::PlayerDisconnect(NSClientPlayer pl)
|
|||
void
|
||||
GameRules::PlayerKill(NSClientPlayer pl)
|
||||
{
|
||||
Damage_Apply(pl, pl, pl.health, WEAPON_NONE, DMG_SKIP_ARMOR);
|
||||
Damage_Apply(pl, pl, pl.health, 0, DMG_SKIP_ARMOR);
|
||||
}
|
||||
|
||||
void
|
||||
Game_Worldspawn(void)
|
||||
{
|
||||
|
||||
}
|
|
@ -53,7 +53,6 @@ MultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
|||
pl.SetSolid(SOLID_NOT);
|
||||
pl.SetModelindex(0);
|
||||
pl.takedamage = DAMAGE_NO;
|
||||
pl.gflags &= ~GF_FLASHLIGHT;
|
||||
pl.armor = pl.activeweapon = pl.g_items = 0;
|
||||
|
||||
pl.think = PutClientInServer;
|
||||
|
@ -113,3 +112,9 @@ MultiplayerRules::ConsoleCommand(NSClientPlayer pp, string cmd)
|
|||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
Game_InitRules(void)
|
||||
{
|
||||
g_grMode = spawn(MultiplayerRules);
|
||||
}
|
|
@ -20,7 +20,6 @@ SingleplayerRules::PlayerDeath(NSClientPlayer pl)
|
|||
pl.movetype = MOVETYPE_NONE;
|
||||
pl.solid = SOLID_NOT;
|
||||
pl.takedamage = DAMAGE_NO;
|
||||
pl.gflags &= ~GF_FLASHLIGHT;
|
||||
pl.armor = pl.activeweapon = pl.g_items = pl.weapon = 0;
|
||||
pl.health = 0;
|
||||
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* PICKUP ITEMS */
|
||||
class item_pickup:NSRenderableEntity
|
||||
{
|
||||
int m_bFloating;
|
||||
int m_iClip;
|
||||
int m_iWasDropped;
|
||||
int id;
|
||||
void(void) item_pickup;
|
||||
|
||||
virtual void(void) Spawned;
|
||||
virtual void(entity) Touch;
|
||||
virtual void(int i) SetItem;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(int) SetFloating;
|
||||
};
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
item_pickup::Touch(entity eToucher)
|
||||
{
|
||||
player pl = (player)eToucher;
|
||||
|
||||
if (eToucher.classname != "player") {
|
||||
return;
|
||||
}
|
||||
|
||||
/* don't allow players inside vehicles to pick anything up by accident */
|
||||
if (eToucher.flags & FL_INVEHICLE || pl.vehicle) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* don't remove if AddItem fails */
|
||||
if (Weapons_AddItem((NSClientPlayer)eToucher, id, m_iClip) == FALSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
Logging_Pickup(eToucher, this, __NULL__);
|
||||
UseTargets(eToucher, TRIG_TOGGLE, m_flDelay);
|
||||
|
||||
#ifdef WASTES
|
||||
Sound_Play(eToucher, CHAN_ITEM, "item_weapon.pickup");
|
||||
#endif
|
||||
|
||||
if (real_owner || m_iWasDropped == 1 || cvar("sv_playerslots") == 1) {
|
||||
Destroy();
|
||||
} else {
|
||||
Disappear();
|
||||
ScheduleThink(Respawn, 30.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_pickup::SetItem(int i)
|
||||
{
|
||||
id = i;
|
||||
m_oldModel = Weapons_GetWorldmodel(id);
|
||||
Respawn();
|
||||
}
|
||||
|
||||
void
|
||||
item_pickup::SetFloating(int i)
|
||||
{
|
||||
m_bFloating = rint(bound(0, m_bFloating, 1));
|
||||
}
|
||||
|
||||
void
|
||||
item_pickup::Respawn(void)
|
||||
{
|
||||
SetSolid(SOLID_TRIGGER);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
|
||||
/* At some points, the item id might not yet be set */
|
||||
if (m_oldModel) {
|
||||
SetModel(m_oldModel);
|
||||
}
|
||||
|
||||
SetSize([-16,-16,0], [16,16,16]);
|
||||
ReleaseThink();
|
||||
|
||||
if (!m_iWasDropped) {
|
||||
m_iClip = -1;
|
||||
} else {
|
||||
if (time > 30.0f)
|
||||
Sound_Play(this, CHAN_ITEM, "item.respawn");
|
||||
}
|
||||
|
||||
if (!m_bFloating) {
|
||||
DropToFloor();
|
||||
SetMovetype(MOVETYPE_TOSS);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
item_pickup::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
#ifdef WASTES
|
||||
Sound_Precache("item_weapon.pickup");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
item_pickup::item_pickup(void)
|
||||
{
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void Player_UseDown(void);
|
||||
void Player_UseUp(void);
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
====================
|
||||
UseWorkaround
|
||||
====================
|
||||
*/
|
||||
void
|
||||
UseWorkaround(entity eTarget)
|
||||
{
|
||||
eActivator = self;
|
||||
entity eOldSelf = self;
|
||||
self = eTarget;
|
||||
self.PlayerUse();
|
||||
self = eOldSelf;
|
||||
}
|
||||
|
||||
void
|
||||
UnUseWorkaround(entity eTarget)
|
||||
{
|
||||
eActivator = self;
|
||||
entity eOldSelf = self;
|
||||
self = eTarget;
|
||||
if (self.PlayerUseUnpressed)
|
||||
self.PlayerUseUnpressed();
|
||||
self = eOldSelf;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Player_UseDown
|
||||
====================
|
||||
*/
|
||||
void
|
||||
Player_UseDown(void)
|
||||
{
|
||||
vector vecSrc;
|
||||
player pl = (player)self;
|
||||
|
||||
if (self.health <= 0) {
|
||||
return;
|
||||
} else if (!(self.flags & FL_USE_RELEASED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
makevectors(self.v_angle);
|
||||
vecSrc = self.origin + self.view_ofs;
|
||||
|
||||
int oldmask = self.hitcontentsmaski;
|
||||
self.hitcontentsmaski = CONTENTBITS_POINTSOLID;
|
||||
traceline(vecSrc, vecSrc + (v_forward * 64), MOVE_HITMODEL, self);
|
||||
self.hitcontentsmaski = oldmask;
|
||||
|
||||
|
||||
if (trace_ent.PlayerUse) {
|
||||
self.flags &= ~FL_USE_RELEASED;
|
||||
|
||||
UseWorkaround(trace_ent);
|
||||
pl.last_used = trace_ent;
|
||||
|
||||
/* Some entities want to support Use spamming */
|
||||
if (!(self.flags & FL_USE_RELEASED)) {
|
||||
Sound_Play(self, CHAN_ITEM, "player.use");
|
||||
}
|
||||
} else {
|
||||
Sound_Play(self, CHAN_ITEM, "player.use_denied");
|
||||
self.flags &= ~FL_USE_RELEASED;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
Player_UseUp
|
||||
====================
|
||||
*/
|
||||
void
|
||||
Player_UseUp(void) {
|
||||
player pl = (player)self;
|
||||
if (!(self.flags & FL_USE_RELEASED)) {
|
||||
UnUseWorkaround(pl.last_used);
|
||||
pl.last_used = world;
|
||||
self.flags |= FL_USE_RELEASED;
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_Draw(NSClientPlayer);
|
||||
|
||||
void
|
||||
CSEv_PlayerSwitchWeapon_i(int w)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
#ifdef WASTES
|
||||
if (pl.gflags & GF_IS_HEALING)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (pl.activeweapon != w) {
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw(pl);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Player_Precache(void)
|
||||
{
|
||||
searchhandle pm;
|
||||
pm = search_begin("models/player/*/*.mdl", TRUE, TRUE);
|
||||
for (int i = 0; i < search_getsize(pm); i++) {
|
||||
precache_model(search_getfilename(pm, i));
|
||||
}
|
||||
search_end(pm);
|
||||
}
|
|
@ -23,18 +23,10 @@ defs.h
|
|||
../../../src/botlib/include.src
|
||||
|
||||
/* mod specific functions */
|
||||
player.qc
|
||||
spectator.qc
|
||||
gamerules.qc
|
||||
gamerules_singleplayer.qc
|
||||
gamerules_multiplayer.qc
|
||||
client.qc
|
||||
server.qc
|
||||
damage.qc
|
||||
items.qc
|
||||
flashlight.qc
|
||||
modelevent.qc
|
||||
spawn.qc
|
||||
|
||||
/* global server/shared code */
|
||||
../../../src/server/include.src
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
Game_InitRules(void)
|
||||
{
|
||||
if (cvar("sv_playerslots") == 1 || cvar("coop") == 1) {
|
||||
g_grMode = spawn(SingleplayerRules);
|
||||
} else {
|
||||
g_grMode = spawn(MultiplayerRules);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Game_Worldspawn(void)
|
||||
{
|
||||
Sound_Precache("player.use");
|
||||
Sound_Precache("player.use_denied");
|
||||
precache_model("models/player.mdl");
|
||||
Weapons_Init();
|
||||
Player_Precache();
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
info_player_start(void)
|
||||
{
|
||||
self.solid = SOLID_TRIGGER;
|
||||
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
|
||||
void
|
||||
info_player_deathmatch(void)
|
||||
{
|
||||
self.solid = SOLID_TRIGGER;
|
||||
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
}
|
||||
|
||||
void
|
||||
info_player_team1(void)
|
||||
{
|
||||
self.classname = "info_player_deathmatch";
|
||||
}
|
||||
|
||||
void
|
||||
info_player_team2(void)
|
||||
{
|
||||
self.classname = "info_player_deathmatch";
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
Game_SpectatorThink(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Game_SpectatorConnect(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
Game_SpectatorDisconnect(void)
|
||||
{
|
||||
|
||||
}
|
22
base/src/shared/TestWeapon.qc
Normal file
22
base/src/shared/TestWeapon.qc
Normal file
|
@ -0,0 +1,22 @@
|
|||
class
|
||||
TestWeapon:NSWeapon
|
||||
{
|
||||
public:
|
||||
void TestWeapon(void);
|
||||
|
||||
virtual string GetWorldModel(void);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
void
|
||||
TestWeapon::TestWeapon(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
string
|
||||
TestWeapon::GetWorldModel(void)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
void
|
||||
Animation_TimerUpdate(player pl, float ftime)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Animation_PlayerUpdate
|
||||
|
||||
Called every frame to update the animation sequences
|
||||
depending on what the player is doing
|
||||
=================
|
||||
*/
|
||||
void
|
||||
Animation_PlayerUpdate(player pl)
|
||||
{
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* game flags */
|
||||
#define GF_SEMI_TOGGLED (1<<0)
|
||||
#define GF_FLASHLIGHT (1<<1)
|
||||
#define GF_UNUSED3 (1<<2)
|
||||
#define GF_UNUSED4 (1<<3)
|
||||
#define GF_UNUSED5 (1<<4)
|
||||
#define GF_UNUSED6 (1<<5)
|
||||
#define GF_UNUSED7 (1<<6)
|
||||
#define GF_UNUSED8 (1<<7)
|
||||
#define GF_UNUSED9 (1<<8)
|
||||
#define GF_UNUSED10 (1<<9)
|
||||
#define GF_UNUSED11 (1<<10)
|
||||
#define GF_UNUSED12 (1<<11)
|
||||
#define GF_UNUSED13 (1<<12)
|
||||
#define GF_UNUSED14 (1<<14)
|
||||
#define GF_UNUSED15 (1<<16)
|
||||
#define GF_UNUSED16 (1<<13)
|
||||
#define GF_UNUSED17 (1<<17)
|
||||
#define GF_UNUSED18 (1<<18)
|
||||
#define GF_UNUSED19 (1<<19)
|
||||
#define GF_UNUSED20 (1<<20)
|
||||
#define GF_UNUSED21 (1<<21)
|
||||
#define GF_UNUSED22 (1<<22)
|
||||
#define GF_UNUSED23 (1<<23)
|
|
@ -49,13 +49,13 @@ FX_Corpse_Spawn(player pl, float anim)
|
|||
{
|
||||
NSRenderableEntity body_next = (NSRenderableEntity)FX_Corpse_Next();
|
||||
setorigin(body_next, pl.origin + [0,0,32]);
|
||||
body_next.SetMovetype(MOVETYPE_TOSS);
|
||||
body_next.SetSolid(SOLID_CORPSE);
|
||||
setmodel(body_next, pl.model);
|
||||
setsize(body_next, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
body_next.SetMovetype(MOVETYPE_TOSS);
|
||||
body_next.SetSolid(SOLID_TRIGGER);
|
||||
body_next.SetModelindex(pl.modelindex);
|
||||
body_next.SetAngles(pl.angles);
|
||||
body_next.velocity = (pl.velocity);
|
||||
body_next.velocity = (pl.velocity) + [0,0,120];
|
||||
body_next.colormap = pl.colormap;
|
||||
body_next.SetFrame(anim);
|
||||
return (entity)body_next;
|
||||
|
|
|
@ -1,27 +1,11 @@
|
|||
#includelist
|
||||
flags.h
|
||||
player.qc
|
||||
weapon_common.h
|
||||
animations.h
|
||||
animations.qc
|
||||
pmove.qc
|
||||
|
||||
input.qc
|
||||
fx_explosion.qc
|
||||
fx_spark.qc
|
||||
fx_blood.qc
|
||||
fx_breakmodel.qc
|
||||
fx_explosion.qc
|
||||
fx_gibhuman.qc
|
||||
fx_spark.qc
|
||||
fx_impact.qc
|
||||
fx_corpse.qc
|
||||
|
||||
items.h
|
||||
weapons.h
|
||||
|
||||
weapon_basesemi.qc
|
||||
weapon_baseshotgun.qc
|
||||
weapon_baseautomatic.qc
|
||||
|
||||
weapons.qc
|
||||
weapon_common.qc
|
||||
input.qc
|
||||
fx_gibhuman.qc
|
||||
fx_impact.qc
|
||||
#endlist
|
||||
|
|
|
@ -30,9 +30,6 @@ Game_Input(player pl)
|
|||
else
|
||||
pl.InputUse_Up();
|
||||
|
||||
if (pl.impulse == 100)
|
||||
Flashlight_Toggle();
|
||||
|
||||
pl.impulse = 0;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#define PHY_JUMP_CHAINWINDOW 0.5
|
||||
#define PHY_JUMP_CHAIN 100
|
||||
#define PHY_JUMP_CHAINDECAY 50
|
||||
|
||||
.float waterlevel;
|
||||
.float watertype;
|
||||
|
||||
float
|
||||
GamePMove_Maxspeed(player target)
|
||||
{
|
||||
return ((target.flags & FL_CROUCHING) ? 135 : 270);
|
||||
}
|
||||
|
||||
void
|
||||
GamePMove_Fall(player target, float impactspeed)
|
||||
{
|
||||
if (impactspeed > 580) {
|
||||
#ifdef SERVER
|
||||
float fFallDamage = (impactspeed - 580) * (100 / (1024 - 580));
|
||||
Damage_Apply(target, world, fFallDamage, 0, DMG_FALL);
|
||||
Sound_Play(target, CHAN_VOICE, "player.fall");
|
||||
#endif
|
||||
target.punchangle += [15,0,(input_sequence & 1) ? 15 : -15];
|
||||
} else if (impactspeed > 400) {
|
||||
target.punchangle += [15,0,0];
|
||||
#ifdef SERVER
|
||||
Sound_Play(target, CHAN_VOICE, "player.lightfall");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GamePMove_Jump(player target)
|
||||
{
|
||||
float flJumptimeDelta;
|
||||
float flChainBonus;
|
||||
|
||||
if (target.waterlevel >= 2) {
|
||||
if (target.watertype == CONTENT_WATER) {
|
||||
target.velocity[2] = 100;
|
||||
} else if (target.watertype == CONTENT_SLIME) {
|
||||
target.velocity[2] = 80;
|
||||
} else {
|
||||
target.velocity[2] = 50;
|
||||
}
|
||||
} else {
|
||||
target.velocity[2] += 240;
|
||||
}
|
||||
|
||||
if (target.jumptime > 0) {
|
||||
flJumptimeDelta = 0 - (target.jumptime - PHY_JUMP_CHAINWINDOW);
|
||||
flChainBonus = PHY_JUMP_CHAIN - (((PHY_JUMP_CHAINWINDOW - (PHY_JUMP_CHAINWINDOW - flJumptimeDelta)) * 2) * PHY_JUMP_CHAINDECAY);
|
||||
target.velocity[2] += flChainBonus;
|
||||
}
|
||||
target.jumptime = PHY_JUMP_CHAINWINDOW;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* 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);
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* weapon Indices for the weapon table */
|
||||
enum
|
||||
{
|
||||
WEAPON_NONE
|
||||
};
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef NEW_INVENTORY
|
||||
weapon_t w_null = {};
|
||||
weapon_t g_weapons[] = {
|
||||
w_null
|
||||
};
|
||||
#endif
|
Loading…
Reference in a new issue