FreeHL weapon updates related to ammo and numerous warnings by the compiler about things that don't really mean anything but I really like the 0% warnings count kthxbai
This commit is contained in:
parent
2081fa790a
commit
101c3601d3
30 changed files with 1033 additions and 815 deletions
|
@ -17,7 +17,6 @@ var float PARTICLE_SMOKEGRENADE;
|
|||
.float flUpAngle;
|
||||
|
||||
vector vHUDColor; // Defined in HUD_Draw (HUD.c)
|
||||
vector vVGUIColor; // Defined in HUD_Draw (VGUI.c)
|
||||
vector vCrossColor; // Defined in HUD_Draw (HUDCrosshair.c)
|
||||
|
||||
string sShellModel [ 4 ] = {
|
||||
|
|
|
@ -103,7 +103,7 @@ void player::draw(void)
|
|||
this.subblendfrac =
|
||||
this.subblend2frac = this.pitch / 90;
|
||||
|
||||
#warning "FIXME: Clean this mess up"
|
||||
#warning "FIXME: This ifdef needs to go in the future"
|
||||
#ifdef VALVE
|
||||
if (playertype == PLAYERTYPE_HL) {
|
||||
/* Only bother updating the model if the weapon has changed */
|
||||
|
@ -136,6 +136,7 @@ void player::draw(void)
|
|||
#else
|
||||
Animation_PlayerUpdate();
|
||||
#endif
|
||||
|
||||
/*makevectors([0, this.angles[1], 0]);
|
||||
float fDirection = dotproduct(this.velocity, v_forward);
|
||||
|
||||
|
@ -247,7 +248,7 @@ float player::predraw(void)
|
|||
return PREDRAW_NEXT;
|
||||
}
|
||||
|
||||
float player::postdraw(void)
|
||||
void player::postdraw(void)
|
||||
{
|
||||
#ifdef VALVE
|
||||
/* Correct offsets */
|
||||
|
@ -266,8 +267,8 @@ void player::set_model(void)
|
|||
{
|
||||
#ifdef VALVE
|
||||
string modelout;
|
||||
string skinpath;
|
||||
string skinout;
|
||||
string skinpath = "";
|
||||
string skinout = "";
|
||||
int i;
|
||||
|
||||
i = tokenizebyseparator(getplayerkeyvalue(entnum-1, "model"), "/");
|
||||
|
@ -296,8 +297,9 @@ void player::set_model(void)
|
|||
setcustomskin(this, skinpath, sprintf("replace \"\" \"%s\"", skinout));
|
||||
}
|
||||
} else {
|
||||
setmodel(this, "models/player.mdl");
|
||||
modelout = "models/player.mdl";
|
||||
setmodel(this, modelout);
|
||||
playertype = PLAYERTYPE_HL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -255,9 +255,9 @@ void HUD_DrawAmmo3(void)
|
|||
pos = video_mins + [video_res[0] - 48, video_res[1] - 42];
|
||||
|
||||
/* Special */
|
||||
if (pl.a_ammo3) {
|
||||
//if (pl.a_ammo3) {
|
||||
HUD_DrawNums(pl.a_ammo3, pos + [0, -32], ammo3_alpha, g_hud_color);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void HUD_DrawFlashlight(void)
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
../gs-entbase/server/trigger_camera.cpp
|
||||
../gs-entbase/server/trigger_hurt.cpp
|
||||
../gs-entbase/server/trigger_changelevel.cpp
|
||||
../gs-entbase/server/trigger_gravity.cpp
|
||||
../gs-entbase/server/trigger_once.cpp
|
||||
../gs-entbase/server/trigger_multiple.cpp
|
||||
../gs-entbase/server/trigger_push.cpp
|
||||
|
|
|
@ -22,9 +22,19 @@ enumflags
|
|||
void Effect_CreateSpark(vector pos, vector ang);
|
||||
void Effect_BreakModel(int count, vector mins, vector maxs,vector vel, float mat);
|
||||
|
||||
/* This is required because people who use Hammer do awful things
|
||||
to get their models to update. We get a multitude of juicy
|
||||
hacks and symbols that Half-Life's engine strips and now we have to
|
||||
replicate this behaviour. Be thankful this is not done in-engine for
|
||||
every game/mod ever.
|
||||
*/
|
||||
string Util_FixModel(string mdl)
|
||||
{
|
||||
int c = tokenizebyseparator(mdl, "/", "\\ ");
|
||||
if (!mdl) {
|
||||
return "";
|
||||
}
|
||||
|
||||
int c = tokenizebyseparator(mdl, "/", "\\ ", "!");
|
||||
string newpath = "";
|
||||
|
||||
for (int i = 0; i < c; i++) {
|
||||
|
@ -33,5 +43,15 @@ string Util_FixModel(string mdl)
|
|||
|
||||
// Kill the first /
|
||||
newpath = substring(newpath, 1, strlen(newpath)-1);
|
||||
return newpath;
|
||||
|
||||
/* Now we need to fix \/ because I hate people */
|
||||
c = tokenizebyseparator(newpath, "\\/");
|
||||
mdl = "";
|
||||
for (int i = 0; i < c; i++) {
|
||||
mdl = sprintf("%s/%s", mdl, argv(i));
|
||||
}
|
||||
// Kill the first / again
|
||||
mdl = substring(mdl, 1, strlen(mdl)-1);
|
||||
|
||||
return mdl;
|
||||
}
|
||||
|
|
|
@ -13,16 +13,16 @@ void Plugin_Init(void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Plugin_RunClientCommand
|
||||
|
||||
Funtion that can interrupt client commands before physics are run
|
||||
=================
|
||||
*/
|
||||
/*
|
||||
=================
|
||||
Plugin_RunClientCommand
|
||||
|
||||
Funtion that can interrupt client commands before physics are run
|
||||
=================
|
||||
*/
|
||||
int Plugin_RunClientCommand(void)
|
||||
{
|
||||
int(void) vFunc = externvalue( -2, "FMX_RunClientCommand" );
|
||||
int(void) vFunc = externvalue(-2, "FMX_RunClientCommand");
|
||||
|
||||
if (vFunc || g_plugins_enabled == 0) {
|
||||
return vFunc();
|
||||
|
@ -31,21 +31,21 @@ int Plugin_RunClientCommand(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Plugin_ParseClientCommand
|
||||
|
||||
Intercepts 'cmd' calls. We use it to intercept
|
||||
chat messages and handle distribution ourselves.
|
||||
=================
|
||||
*/
|
||||
/*
|
||||
=================
|
||||
Plugin_ParseClientCommand
|
||||
|
||||
Intercepts 'cmd' calls. We use it to intercept
|
||||
chat messages and handle distribution ourselves.
|
||||
=================
|
||||
*/
|
||||
int Plugin_ParseClientCommand(string msg)
|
||||
{
|
||||
int(void) vFunc = externvalue( -2, "FMX_ParseClientCommand" );
|
||||
int(string msg) vFunc = externvalue(-2, "FMX_ParseClientCommand");
|
||||
|
||||
if (vFunc || g_plugins_enabled == 0) {
|
||||
return vFunc(msg);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,10 @@ void SHData_GetItems(void)
|
|||
/* TODO: Parse the config files */
|
||||
pl.ammo_9mm = 68;
|
||||
pl.ammo_buckshot = 34;
|
||||
pl.ammo_bolt = 50;
|
||||
pl.ammo_357 = 36;
|
||||
pl.ammo_m203_grenade = 3;
|
||||
pl.ammo_rocket = 5;
|
||||
Weapons_AddItem(pl, WEAPON_CROWBAR);
|
||||
Weapons_AddItem(pl, WEAPON_GLOCK);
|
||||
Weapons_AddItem(pl, WEAPON_PYTHON);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -56,6 +56,7 @@ class player
|
|||
virtual void() gun_offset;
|
||||
virtual void() draw;
|
||||
virtual float() predraw;
|
||||
virtual void() postdraw;
|
||||
#else
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
|
|
|
@ -195,9 +195,7 @@ void w_cannon_crosshair(void)
|
|||
|
||||
float w_cannon_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_cannon_hudpic(int s, vector pos)
|
||||
|
|
|
@ -66,6 +66,7 @@ void w_chainsaw_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
pl.a_ammo3 = 1;
|
||||
#ifdef CSQC
|
||||
if (pSeat->eViewModel.frame == CHAINSAW_STARTFIRE || pSeat->eViewModel.frame == CHAINSAW_CONTINUEFIRE) {
|
||||
Weapons_ViewAnimation(CHAINSAW_CONTINUEFIRE);
|
||||
|
@ -111,20 +112,20 @@ void w_chainsaw_reload(void)
|
|||
}
|
||||
void w_chainsaw_release(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_idle_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pSeat->eViewModel.frame == CHAINSAW_CONTINUEFIRE) {
|
||||
Weapons_ViewAnimation(CHAINSAW_STOPFIRE);
|
||||
if (pl.a_ammo3 == 1) {
|
||||
pl.a_ammo3 = 0;
|
||||
pl.w_idle_next = 1.0f;
|
||||
} else {
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
int r = floor(random(0,2));
|
||||
switch (r) {
|
||||
case 0:
|
||||
|
@ -139,9 +140,7 @@ void w_chainsaw_release(void)
|
|||
|
||||
float w_chainsaw_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_chainsaw_hudpic(int s, vector pos)
|
||||
|
|
|
@ -208,9 +208,7 @@ void w_hammer_release(void)
|
|||
|
||||
float w_hammer_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_hammer_hudpic(int s, vector pos)
|
||||
|
|
|
@ -83,6 +83,7 @@ int Weapons_IsPresent(player pl, int w);
|
|||
#ifdef SSQC
|
||||
void Weapons_InitItem(int w);
|
||||
void Weapons_AddItem(player pl, int w);
|
||||
void Weapons_RemoveItem(player pl, int w);
|
||||
string Weapons_GetWorldmodel(int id);
|
||||
void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3);
|
||||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max);
|
||||
|
|
|
@ -55,7 +55,7 @@ class player
|
|||
virtual void() gun_offset;
|
||||
virtual void() draw;
|
||||
virtual float() predraw;
|
||||
virtual float() postdraw;
|
||||
virtual void() postdraw;
|
||||
#else
|
||||
int ammo_9mm;
|
||||
int ammo_357;
|
||||
|
|
|
@ -50,7 +50,6 @@ string w_crossbow_deathmsg(void)
|
|||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
void w_crossbow_pickup(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
|
@ -58,7 +57,6 @@ void w_crossbow_pickup(void)
|
|||
pl.crossbow_mag = bound(0, pl.crossbow_mag + 5, 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_crossbow_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
@ -107,6 +105,11 @@ void w_crossbow_primary(void)
|
|||
}
|
||||
remove(self);
|
||||
}
|
||||
|
||||
if (!pl.crossbow_mag) {
|
||||
return;
|
||||
}
|
||||
|
||||
Weapons_MakeVectors();
|
||||
entity bolt = spawn();
|
||||
setmodel(bolt, "models/crossbow_bolt.mdl");
|
||||
|
@ -126,6 +129,8 @@ void w_crossbow_primary(void)
|
|||
Weapons_PlaySound(pl, CHAN_ITEM, "weapons/xbow_reload1.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
pl.crossbow_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, __NULL__);
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/xbow_fire1.wav", 1, ATTN_NORM);
|
||||
#else
|
||||
if (pl.a_ammo1) {
|
||||
|
@ -159,8 +164,27 @@ void w_crossbow_reload(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef SSQC
|
||||
if (pl.ammo_bolt <= 0) {
|
||||
return;
|
||||
}
|
||||
if (pl.crossbow_mag >= 5) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.a_ammo1 >= 5) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CSQC
|
||||
#ifdef SSQC
|
||||
Weapons_ReloadWeapon(pl, player::crossbow_mag, player::ammo_bolt, 5);
|
||||
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, __NULL__);
|
||||
#else
|
||||
Weapons_PlaySound(pl, CHAN_ITEM, "weapons/xbow_reload1.wav", 1, ATTN_NORM);
|
||||
Weapons_ViewAnimation(CROSSBOW_RELOAD);
|
||||
#endif
|
||||
|
@ -206,9 +230,7 @@ void w_crossbow_crosshair(void)
|
|||
|
||||
float w_crossbow_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMBOW : ANIM_AIMBOW;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_crossbow_hudpic(int s, vector pos)
|
||||
|
|
|
@ -160,11 +160,8 @@ void w_crowbar_release(void)
|
|||
|
||||
float w_crowbar_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_crowbar_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
|
|
|
@ -116,9 +116,7 @@ void w_egon_crosshair(void)
|
|||
|
||||
float w_egon_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMEGON : ANIM_AIMEGON;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_egon_hudpic(int s, vector pos)
|
||||
|
|
|
@ -24,10 +24,11 @@ void w_gauss_precache(void)
|
|||
precache_model("models/v_gauss.mdl");
|
||||
precache_model("models/w_gauss.mdl");
|
||||
precache_model("models/p_gauss.mdl");
|
||||
precache_sound("weapons/gauss2.wav");
|
||||
precache_sound("weapons/electro4.wav");
|
||||
precache_sound("weapons/electro5.wav");
|
||||
precache_sound("weapons/electro6.wav");
|
||||
precache_sound("weapons/gauss2.wav");
|
||||
precache_model("sprites/yelflare1.spr");
|
||||
precache_sound("weapons/electro4.wav");
|
||||
precache_sound("weapons/electro5.wav");
|
||||
precache_sound("weapons/electro6.wav");
|
||||
precache_sound("ambience/pulsemachine.wav");
|
||||
}
|
||||
string w_gauss_vmodel(void)
|
||||
|
@ -68,6 +69,7 @@ void w_gauss_placeorbs(vector org)
|
|||
static float glow_think(void) {
|
||||
if (self.alpha <= 0.0f) {
|
||||
remove(self);
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
self.alpha -= (clframetime * 0.25);
|
||||
addentity(self);
|
||||
|
@ -94,7 +96,7 @@ void w_gauss_placeimpact(vector org)
|
|||
static float glow_think(void) {
|
||||
if (self.alpha <= 0.0f) {
|
||||
remove(self);
|
||||
return;
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
self.alpha -= (clframetime * 0.5);
|
||||
dynamiclight_add(self.origin, 256 * self.alpha, self.colormod);
|
||||
|
@ -120,7 +122,6 @@ void w_gauss_fire(int one)
|
|||
{
|
||||
player pl = (player)self;
|
||||
int iLoop = 10;
|
||||
int iDamage;
|
||||
|
||||
Weapons_MakeVectors();
|
||||
vector src = Weapons_GetCameraPos();
|
||||
|
@ -128,7 +129,7 @@ void w_gauss_fire(int one)
|
|||
traceline(src, endpos, FALSE, pl);
|
||||
#ifdef SSQC
|
||||
sound(pl, CHAN_WEAPON, "weapons/gauss2.wav", 1, ATTN_NORM);
|
||||
iDamage = one ? 20 : 200;
|
||||
int iDamage = one ? 20 : 200;
|
||||
|
||||
if (getsurfacetexture(trace_ent, getsurfacenearpoint(trace_ent, trace_endpos)) == "sky") {
|
||||
return;
|
||||
|
@ -214,8 +215,6 @@ void w_gauss_secondary(void)
|
|||
player pl = (player)self;
|
||||
|
||||
#ifdef CSQC
|
||||
print(sprintf("%i\n", pl.a_ammo2));
|
||||
|
||||
if (pl.a_ammo3)
|
||||
soundupdate(pl, CHAN_WEAPON, "", 2, ATTN_NORM, 100 + (200 * (pl.a_ammo2/255)), 0, 0);
|
||||
#endif
|
||||
|
@ -307,9 +306,7 @@ void w_gauss_crosshair(void)
|
|||
|
||||
float w_gauss_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMGAUSS : ANIM_AIMGAUSS;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_gauss_hudpic(int s, vector pos)
|
||||
|
|
|
@ -209,9 +209,7 @@ void w_glock_release(void)
|
|||
|
||||
float w_glock_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIM1HAND : ANIM_AIM1HAND;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_glock_hud(void)
|
||||
|
|
|
@ -20,6 +20,7 @@ enum
|
|||
|
||||
void w_handgrenade_precache(void)
|
||||
{
|
||||
precache_sound("weapons/grenade/land.wav");
|
||||
precache_model("models/v_grenade.mdl");
|
||||
precache_model("models/w_grenade.mdl");
|
||||
precache_model("models/p_grenade.mdl");
|
||||
|
@ -153,9 +154,7 @@ void w_handgrenade_release(void)
|
|||
}
|
||||
float w_handgrenade_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMCROWBAR : ANIM_AIMCROWBAR;
|
||||
#endif
|
||||
}
|
||||
void w_handgrenade_hudpic(int s, vector pos)
|
||||
{
|
||||
|
|
|
@ -131,30 +131,30 @@ void w_hornetgun_reload(void)
|
|||
}
|
||||
void w_hornetgun_release(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
int r;
|
||||
player pl = (player)self;
|
||||
if (pl.w_idle_next > 0.0) {
|
||||
|
||||
if (pl.w_idle_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
int r;
|
||||
|
||||
r = floor(random(0,3));
|
||||
|
||||
switch (r) {
|
||||
case 0:
|
||||
Weapons_ViewAnimation(HORNETGUN_IDLE);
|
||||
pl.w_idle_next = 0.95f;
|
||||
break;
|
||||
case 1:
|
||||
Weapons_ViewAnimation(HORNETGUN_FIDGET1);
|
||||
pl.w_idle_next = 2.5f;
|
||||
break;
|
||||
default:
|
||||
Weapons_ViewAnimation(HORNETGUN_FIDGET2);
|
||||
pl.w_idle_next = 2.2f;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
pl.w_idle_next = 2.5f;
|
||||
}
|
||||
void w_hornetgun_crosshair(void)
|
||||
{
|
||||
|
@ -167,9 +167,7 @@ void w_hornetgun_crosshair(void)
|
|||
|
||||
float w_hornetgun_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMHIVE : ANIM_AIMHIVE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_hornetgun_hudpic(int s, vector pos)
|
||||
|
|
|
@ -79,6 +79,18 @@ void w_mp5_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.mp5_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Actual firing */
|
||||
#ifdef CSQC
|
||||
if (random() < 0.5) {
|
||||
Weapons_ViewAnimation(MP5_FIRE1);
|
||||
|
@ -86,6 +98,7 @@ void w_mp5_primary(void)
|
|||
Weapons_ViewAnimation(MP5_FIRE2);
|
||||
}
|
||||
|
||||
pl.a_ammo1--;
|
||||
Weapons_ViewPunchAngle([random(-2, 2),0,0]);
|
||||
#else
|
||||
/* Singleplayer is more accurate */
|
||||
|
@ -100,6 +113,9 @@ void w_mp5_primary(void)
|
|||
} else {
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/hks2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
pl.mp5_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, pl.ammo_m203_grenade);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.1f;
|
||||
|
@ -115,8 +131,12 @@ void w_mp5_secondary(void)
|
|||
}
|
||||
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo3 <= 0) {
|
||||
return;
|
||||
}
|
||||
Weapons_ViewAnimation(MP5_GRENADE);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
pl.a_ammo3--;
|
||||
#else
|
||||
|
||||
static void Grenade_ExplodeTouch(void) {
|
||||
|
@ -125,6 +145,11 @@ void w_mp5_secondary(void)
|
|||
sound( self, CHAN_WEAPON, sprintf( "weapons/explode%d.wav", floor( random() * 2 ) + 3 ), 1, ATTN_NORM );
|
||||
remove(self);
|
||||
}
|
||||
|
||||
if (pl.ammo_m203_grenade <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
makevectors(self.v_angle);
|
||||
entity gren = spawn();
|
||||
setmodel(gren, "models/grenade.mdl");
|
||||
|
@ -138,8 +163,9 @@ void w_mp5_secondary(void)
|
|||
gren.solid = SOLID_BBOX;
|
||||
setsize(gren, [0,0,0], [0,0,0]);
|
||||
gren.touch = Grenade_ExplodeTouch;
|
||||
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/glauncher.wav", 1, ATTN_NORM);
|
||||
pl.ammo_m203_grenade--;
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, pl.ammo_m203_grenade);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
|
@ -153,10 +179,28 @@ void w_mp5_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 >= 50) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.mp5_mag >= 50) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_9mm <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(MP5_RELOAD);
|
||||
#else
|
||||
|
||||
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 50);
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, pl.ammo_m203_grenade);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.5f;
|
||||
|
@ -195,11 +239,8 @@ void w_mp5_crosshair(void)
|
|||
|
||||
float w_mp5_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & ANIM_CR_AIMMP5 ? ANIM_CR_AIMCROWBAR : ANIM_AIMMP5;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_mp5_hudpic(int s, vector pos)
|
||||
{
|
||||
#ifdef CSQC
|
||||
|
|
|
@ -73,6 +73,18 @@ void w_python_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.python_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Actual firing */
|
||||
#ifdef SSQC
|
||||
TraceAttack_FireBullets(1, pl.origin + pl.view_ofs, 40, [0.00873, 0.00873]);
|
||||
|
||||
|
@ -81,7 +93,10 @@ void w_python_primary(void)
|
|||
} else {
|
||||
Weapons_PlaySound(pl, CHAN_WEAPON, "weapons/357_shot2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
pl.python_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.python_mag, pl.ammo_357, __NULL__);
|
||||
#else
|
||||
pl.a_ammo1--;
|
||||
Weapons_ViewAnimation(PYTHON_FIRE1);
|
||||
Weapons_ViewPunchAngle([-10,0,0]);
|
||||
#endif
|
||||
|
@ -110,8 +125,29 @@ void w_python_reload(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 >= 6) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.python_mag >= 6) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_357 <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Audio-Visual bit */
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(PYTHON_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::python_mag, player::ammo_357, 6);
|
||||
Weapons_UpdateAmmo(pl, pl.python_mag, pl.ammo_357, __NULL__);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 3.25f;
|
||||
|
@ -155,9 +191,7 @@ void w_python_crosshair(void)
|
|||
|
||||
float w_python_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMPYTHON : ANIM_AIMPYTHON;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_python_hudpic(int s, vector pos)
|
||||
|
|
|
@ -46,6 +46,14 @@ string w_rpg_deathmsg(void)
|
|||
return "";
|
||||
}
|
||||
|
||||
void w_rpg_pickup(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
pl.rpg_mag = bound(0, pl.rpg_mag + 1, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_rpg_draw(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
|
@ -67,8 +75,20 @@ void w_rpg_primary(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.rpg_mag <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(RPG_FIRE2);
|
||||
pl.a_ammo1--;
|
||||
#else
|
||||
static void Rocket_Touch(void) {
|
||||
Effect_CreateExplosion(self.origin);
|
||||
|
@ -105,6 +125,8 @@ void w_rpg_primary(void)
|
|||
rocket.nextthink = time + 0.15f;
|
||||
setsize(rocket, [0,0,0], [0,0,0]);
|
||||
sound(self, CHAN_WEAPON, "weapons/rocketfire1.wav", 1, ATTN_NORM);
|
||||
pl.rpg_mag--;
|
||||
Weapons_UpdateAmmo(pl, pl.rpg_mag, pl.ammo_rocket, __NULL__);
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 1.0f;
|
||||
|
@ -116,7 +138,41 @@ void w_rpg_secondary(void)
|
|||
}
|
||||
void w_rpg_reload(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
||||
|
||||
if (pl.w_attack_next > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ammo check */
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 >= 1) {
|
||||
return;
|
||||
}
|
||||
if (pl.a_ammo2 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.rpg_mag >= 1) {
|
||||
return;
|
||||
}
|
||||
if (pl.ammo_rocket <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Audio-Visual Bit */
|
||||
#ifdef CSQC
|
||||
Weapons_ViewAnimation(RPG_RELOAD);
|
||||
#else
|
||||
Weapons_ReloadWeapon(pl, player::rpg_mag, player::ammo_rocket, 1);
|
||||
Weapons_UpdateAmmo(pl, pl.rpg_mag, pl.ammo_rocket, __NULL__);
|
||||
#endif
|
||||
|
||||
|
||||
pl.w_attack_next = 2.25f;
|
||||
pl.w_idle_next = 10.0f;
|
||||
}
|
||||
void w_rpg_release(void)
|
||||
{
|
||||
|
@ -125,9 +181,7 @@ void w_rpg_release(void)
|
|||
|
||||
float w_rpg_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMRPG : ANIM_AIMRPG;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_rpg_hudpic(int s, vector pos)
|
||||
|
@ -165,6 +219,8 @@ void w_rpg_laser(void)
|
|||
vector lasersize = [8,8] * (1-trace_fraction);
|
||||
cross_pos = (video_res / 2) - (lasersize/2);
|
||||
drawpic(cross_pos, "sprites/laserdot.spr_0.tga", lasersize, [1,1,1], 1.0f, DRAWFLAG_ADDITIVE);
|
||||
HUD_DrawAmmo1();
|
||||
HUD_DrawAmmo2();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -181,7 +237,7 @@ weapon_t w_rpg =
|
|||
w_rpg_release,
|
||||
w_rpg_laser,
|
||||
w_rpg_precache,
|
||||
__NULL__,
|
||||
w_rpg_pickup,
|
||||
w_rpg_vmodel,
|
||||
w_rpg_wmodel,
|
||||
w_rpg_pmodel,
|
||||
|
|
|
@ -166,9 +166,7 @@ void w_satchel_release(void)
|
|||
|
||||
float w_satchel_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -113,12 +113,13 @@ void w_shotgun_reload(void)
|
|||
}
|
||||
void w_shotgun_release(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
player pl = (player)self;
|
||||
|
||||
if (pl.w_idle_next) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CSQC
|
||||
int r = floor(random(0,3));
|
||||
switch (r) {
|
||||
case 0:
|
||||
|
@ -131,9 +132,8 @@ void w_shotgun_release(void)
|
|||
Weapons_ViewAnimation(SHOTGUN_IDLE3);
|
||||
break;
|
||||
}
|
||||
|
||||
pl.w_idle_next = 15.0f;
|
||||
#endif
|
||||
pl.w_idle_next = 15.0f;
|
||||
}
|
||||
void w_shotgun_crosshair(void)
|
||||
{
|
||||
|
@ -148,9 +148,7 @@ void w_shotgun_crosshair(void)
|
|||
|
||||
float w_shotgun_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSHOTGUN : ANIM_AIMSHOTGUN;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_shotgun_hudpic(int s, vector pos)
|
||||
|
|
|
@ -91,9 +91,7 @@ string w_snark_deathmsg(void)
|
|||
|
||||
float w_snark_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMSQUEAK : ANIM_AIMSQUEAK;
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_snark_hudpic(int s, vector pos)
|
||||
|
|
|
@ -43,6 +43,13 @@ string w_tripmine_deathmsg(void)
|
|||
{
|
||||
return "";
|
||||
}
|
||||
void w_tripmine_pickup(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
pl.ammo_tripmine = bound(0, pl.ammo_tripmine + 1, 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_tripmine_draw(void)
|
||||
{
|
||||
|
@ -123,7 +130,7 @@ float w_tripmine_predraw(void)
|
|||
addentity(self);
|
||||
return PREDRAW_NEXT;
|
||||
}
|
||||
float w_tripmine_parse(void)
|
||||
void w_tripmine_parse(void)
|
||||
{
|
||||
self.origin[0] = readcoord();
|
||||
self.origin[1] = readcoord();
|
||||
|
@ -150,7 +157,17 @@ void w_tripmine_primary(void)
|
|||
if (pl.w_attack_next > 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef CSQC
|
||||
if (pl.a_ammo1 <= 0) {
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (pl.ammo_tripmine <= 0) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Weapons_MakeVectors();
|
||||
traceline(Weapons_GetCameraPos(), Weapons_GetCameraPos() + v_forward * 64, FALSE, pl);
|
||||
|
||||
|
@ -173,6 +190,14 @@ void w_tripmine_primary(void)
|
|||
//mine.owner = pl;
|
||||
sound(mine, CHAN_WEAPON, "weapons/mine_charge.wav", 1, ATTN_NORM);
|
||||
sound(self, CHAN_WEAPON, "weapons/mine_deploy.wav", 1, ATTN_NORM);
|
||||
|
||||
pl.ammo_tripmine--;
|
||||
if (pl.ammo_tripmine <= 0) {
|
||||
Weapons_RemoveItem(pl, WEAPON_TRIPMINE);
|
||||
} else {
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_tripmine, __NULL__);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
pl.w_attack_next = 0.5f;
|
||||
|
@ -214,8 +239,13 @@ void w_tripmine_release(void)
|
|||
|
||||
float w_tripmine_aimanim(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
return self.flags & FL_CROUCHING ? ANIM_CR_AIMTRIPMINE : ANIM_AIMTRIPMINE;
|
||||
}
|
||||
|
||||
void w_tripmine_hud(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
HUD_DrawAmmo2();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -241,9 +271,9 @@ weapon_t w_tripmine =
|
|||
w_tripmine_secondary,
|
||||
w_tripmine_reload,
|
||||
w_tripmine_release,
|
||||
__NULL__,
|
||||
w_tripmine_hud,
|
||||
w_tripmine_precache,
|
||||
__NULL__,
|
||||
w_tripmine_pickup,
|
||||
w_tripmine_vmodel,
|
||||
w_tripmine_wmodel,
|
||||
w_tripmine_pmodel,
|
||||
|
|
|
@ -207,6 +207,21 @@ int Weapons_IsPresent(player pl, int w)
|
|||
}
|
||||
|
||||
#ifdef SSQC
|
||||
|
||||
void Weapons_SwitchBest(player pl)
|
||||
{
|
||||
entity oldself = self;
|
||||
self = pl;
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (pl.g_items & g_weapons[i].id) {
|
||||
pl.activeweapon = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Weapons_Draw();
|
||||
self = oldself;
|
||||
}
|
||||
|
||||
void Weapons_AddItem(player pl, int w)
|
||||
{
|
||||
entity oldself = self;
|
||||
|
@ -222,6 +237,12 @@ void Weapons_AddItem(player pl, int w)
|
|||
self = oldself;
|
||||
}
|
||||
|
||||
void Weapons_RemoveItem(player pl, int w)
|
||||
{
|
||||
pl.g_items &= ~g_weapons[w].id;
|
||||
Weapons_SwitchBest(pl);
|
||||
}
|
||||
|
||||
void Weapons_InitItem(int w)
|
||||
{
|
||||
item_pickup it = (item_pickup)self;
|
||||
|
@ -250,4 +271,4 @@ void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max)
|
|||
pl.(ammo) -= iNeed;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -81,6 +81,7 @@ int Weapons_IsPresent(player pl, int w);
|
|||
void Weapons_InitItem(int w);
|
||||
float Weapons_GetAim(int w);
|
||||
void Weapons_AddItem(player pl, int w);
|
||||
void Weapons_RemoveItem(player pl, int w);
|
||||
string Weapons_GetWorldmodel(int id);
|
||||
void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3);
|
||||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max);
|
||||
|
|
Loading…
Reference in a new issue