Commit 36ba1021 authored by Mario's avatar Mario

Merge branch 'Mario/wepent_experimental' into 'master'

Merge branch Mario/wepent_experimental (XXL merge request)

See merge request !372
parents f0a82d2b f269ed4b
Pipeline #5650448 passed with stages
in 22 minutes and 20 seconds
......@@ -30,7 +30,7 @@ test_sv_game:
- wget -O data/maps/g-23.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.cache
- wget -O data/maps/g-23.waypoints.hardwired https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.hardwired
- make
- EXPECT=c35a668d31d76df2bcbc503c3ac7b0aa
- EXPECT=49ace70f31418e5580127461d853fcef
- HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
| tee /dev/stderr
| grep '^:'
......
......@@ -60,7 +60,7 @@ _cl_playerskin 0
seta cl_reticle 1 "enable zoom reticles"
seta cl_reticle_stretch 0 "stretch reticles so they fit the screen (breaks image proportions)"
seta cl_reticle_normal 1 "draw an aiminig reticle when zooming with the zoom button"
seta cl_reticle_normal 1 "draw an aiming reticle when zooming with the zoom button"
seta cl_reticle_normal_alpha 1 "alpha of the normal reticle"
seta cl_reticle_weapon 1 "draw custom aiming reticle when zooming with certain weapons"
seta cl_reticle_weapon_alpha 1 "alpha of the custom reticle"
......
......@@ -55,22 +55,6 @@ set g_overkill_filter_armormedium 0
set g_overkill_filter_armorbig 0
set g_overkill_filter_armormega 0
set g_overkill_ammo_charge 0
set g_overkill_ammo_charge_notice 1
set g_overkill_ammo_charge_limit 1
set g_overkill_ammo_charge_rate 0.5
set g_overkill_ammo_charge_rate_vortex 0.5
set g_overkill_ammo_charge_rate_machinegun 0.5
set g_overkill_ammo_charge_rate_shotgun 0.5
set g_overkill_ammo_charge_rate_hmg 0.25
set g_overkill_ammo_charge_rate_rpc 1.5
set g_overkill_ammo_decharge 0.1
set g_overkill_ammo_decharge_machinegun 0.025
set g_overkill_ammo_decharge_shotgun 0.15
set g_overkill_ammo_decharge_vortex 0.2
set g_overkill_ammo_decharge_rpc 1
set g_overkill_ammo_decharge_hmg 0.01
// =========
// vampire
......
......@@ -11,5 +11,7 @@
#include "defs.qh"
#include "main.qh"
#include "miscfunctions.qh"
#include "view.qh"
#include <common/ent_cs.qh>
#include <common/wepent.qh>
......@@ -98,10 +98,6 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
.float damageextraradius;
.void(entity this, float thisdmg, int hittype, vector org, vector thisforce) event_damage;
// only for Porto
float angles_held_status;
vector angles_held;
// weapons
.bool silent;
......
......@@ -90,8 +90,8 @@ float complain_weapon_time;
PlayerScoreField ps_primary, ps_secondary;
int ts_primary, ts_secondary;
Weapon last_switchweapon;
Weapon last_activeweapon;
.Weapon last_switchweapon;
.Weapon last_activeweapon;
float weapontime;
float weaponprevtime;
......
......@@ -169,7 +169,9 @@ void HUD_Ammo()
ammo_size.y = newSize;
}
Weapon wep = switchweapon;
entity wepent = viewmodels[0]; // TODO: unhardcode
Weapon wep = wepent.switchweapon;
int i;
bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO);
row = column = 0;
......
......@@ -373,10 +373,12 @@ void HUD_Weapons()
switch_speed = frametime * autocvar_hud_panel_weapons_selection_speed;
vector radius_size = weapon_size * (autocvar_hud_panel_weapons_selection_radius + 1);
if(switchweapon == WEP_Null)
entity wepent = viewmodels[0]; // TODO: unhardcode
if(wepent.switchweapon == WEP_Null)
panel_switchweapon = NULL;
else if(!panel_switchweapon)
panel_switchweapon = switchweapon;
panel_switchweapon = wepent.switchweapon;
// draw background behind currently selected weapon
// do it earlier to make sure bg is drawn behind every weapon icons while it's moving
......
......@@ -494,16 +494,6 @@ NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew)
spectatorbutton_zoom = (f & 4);
if(f & 8)
{
angles_held_status = 1;
angles_held.x = ReadAngle();
angles_held.y = ReadAngle();
angles_held.z = 0;
}
else
angles_held_status = 0;
if(f & 16)
{
num_spectators = ReadByte();
......
......@@ -53,9 +53,6 @@ bool button_zoom;
bool spectatorbutton_zoom;
bool button_attack2;
Weapon activeweapon;
Weapon switchingweapon;
Weapon switchweapon;
float current_viewzoom;
float zoomin_effect;
float warmup_stage;
......
This diff is collapsed.
#pragma once
vector crosshair_getcolor(entity this, float health_stat);
entity viewmodels[MAX_WEAPONSLOTS];
......@@ -5,6 +5,7 @@ noref float autocvar_net_connecttimeout = 30;
#include "animdecide.qc"
#include "ent_cs.qc"
#include "net_notice.qc"
#include "wepent.qc"
#endif
#include "mapinfo.qc"
......
......@@ -11,3 +11,4 @@
#include <common/t_items.qc>
#include <common/util.qc>
#include <common/viewloc.qc>
#include <common/wepent.qc>
......@@ -168,6 +168,7 @@ void GiveBall(entity plyr, entity ball)
ball.teamtime = time + autocvar_g_nexball_basketball_delay_hold_forteam;
ball.owner = ball.pusher = plyr; //"owner" is set to the player carrying, "pusher" to the last player who touched it
ball.weaponentity_fld = weaponentity;
ball.team = plyr.team;
plyr.ballcarried = ball;
ball.nb_dropper = plyr;
......@@ -191,12 +192,12 @@ void GiveBall(entity plyr, entity ball)
}
plyr.(weaponentity).weapons = plyr.weapons;
plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon;
plyr.m_switchweapon = plyr.(weaponentity).m_weapon;
plyr.weapons = WEPSET(NEXBALL);
Weapon w = WEP_NEXBALL;
w.wr_resetplayer(w, plyr);
PS(plyr).m_switchweapon = WEP_NEXBALL;
W_SwitchWeapon(plyr, WEP_NEXBALL);
plyr.(weaponentity).m_switchweapon = WEP_NEXBALL;
W_SwitchWeapon(plyr, WEP_NEXBALL, weaponentity);
}
void DropBall(entity ball, vector org, vector vel)
......@@ -219,7 +220,7 @@ void DropBall(entity ball, vector org, vector vel)
if(ball.owner.metertime)
{
ball.owner.metertime = 0;
.entity weaponentity = weaponentities[0]; // TODO: find ballstealer
.entity weaponentity = ball.weaponentity_fld;
ball.owner.(weaponentity).state = WS_READY;
}
......@@ -903,19 +904,19 @@ METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity we
}
}
METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor))
METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor, .entity weaponentity))
{
TC(BallStealer, this);
//weapon_setup(WEP_PORTO.m_id);
}
METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor))
METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor, .entity weaponentity))
{
TC(BallStealer, this);
return true;
}
METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor))
METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor, .entity weaponentity))
{
TC(BallStealer, this);
return true;
......@@ -998,16 +999,20 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPreThink)
}
else
{
.entity weaponentity = weaponentities[0]; // TODO
if(player.(weaponentity).weapons)
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
player.weapons = player.(weaponentity).weapons;
Weapon w = WEP_NEXBALL;
w.wr_resetplayer(w, player);
PS(player).m_switchweapon = player.(weaponentity).m_switchweapon;
W_SwitchWeapon(player, PS(player).m_switchweapon);
.entity weaponentity = weaponentities[slot];
player.(weaponentity).weapons = '0 0 0';
if(player.(weaponentity).weapons)
{
player.weapons = player.(weaponentity).weapons;
Weapon w = WEP_NEXBALL;
w.wr_resetplayer(w, player);
player.(weaponentity).m_switchweapon = player.m_switchweapon;
W_SwitchWeapon(player, player.(weaponentity).m_switchweapon, weaponentity);
player.(weaponentity).weapons = '0 0 0';
}
}
}
......@@ -1029,8 +1034,11 @@ MUTATOR_HOOKFUNCTION(nb, PlayerSpawn)
entity player = M_ARGV(0, entity);
player.metertime = 0;
.entity weaponentity = weaponentities[0];
player.(weaponentity).weapons = '0 0 0';
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
player.(weaponentity).weapons = '0 0 0';
}
if (nexball_mode & NBM_BASKETBALL)
player.weapons |= WEPSET(NEXBALL);
......@@ -1056,16 +1064,18 @@ MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
{
entity player = M_ARGV(0, entity);
//entity player = M_ARGV(0, entity);
entity wepent = M_ARGV(1, entity);
return PS(player).m_weapon == WEP_NEXBALL;
return wepent.m_weapon == WEP_NEXBALL;
}
MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
{
entity player = M_ARGV(0, entity);
//entity player = M_ARGV(0, entity);
int wep = M_ARGV(1, int);
return PS(player).m_weapon == WEP_MORTAR; // TODO: what is this for?
return wep == WEP_MORTAR.m_id; // TODO: what is this for?
}
MUTATOR_HOOKFUNCTION(nb, FilterItem)
......
......@@ -15,7 +15,7 @@ const int MONSTER_TYPE_PASSIVE = BIT(14); // doesn't target or chase enemies
const int MONSTER_TYPE_UNDEAD = BIT(15); // monster is by most definitions a zombie (doesn't fully die unless gibbed)
// entity properties of monsterinfo:
.bool(int, entity actor, entity targ) monster_attackfunc;
.bool(int, entity actor, entity targ, .entity weaponentity) monster_attackfunc;
// animations
.vector anim_blockend;
......
......@@ -323,9 +323,8 @@ void M_Mage_Defend_Shield(entity this)
this.anim_finished = time + 1;
}
bool M_Mage_Attack(int attack_type, entity actor, entity targ)
bool M_Mage_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
{
.entity weaponentity = weaponentities[0];
switch(attack_type)
{
case MONSTER_ATTACK_MELEE:
......
......@@ -156,7 +156,7 @@ void M_Shambler_Attack_Lightning(entity this)
.int state;
bool M_Shambler_Attack(int attack_type, entity actor, entity targ)
bool M_Shambler_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
{
switch(attack_type)
{
......
......@@ -170,9 +170,8 @@ void M_Spider_Attack_Web(entity this)
CSQCProjectile(proj, true, PROJECTILE_ELECTRO, true);
}
bool M_Spider_Attack(int attack_type, entity actor, entity targ)
bool M_Spider_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
{
.entity weaponentity = weaponentities[0];
switch(attack_type)
{
Weapon wep = WEP_SPIDER_ATTACK;
......
......@@ -46,7 +46,7 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity
}
}
METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this, entity actor)) {
METHOD(WyvernAttack, wr_checkammo1, bool(WyvernAttack this, entity actor, .entity weaponentity)) {
TC(WyvernAttack, this);
return true;
}
......@@ -88,9 +88,8 @@ void M_Wyvern_Attack_Fireball_Touch(entity this, entity toucher)
M_Wyvern_Attack_Fireball_Explode(this);
}
bool M_Wyvern_Attack(int attack_type, entity actor, entity targ)
bool M_Wyvern_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
{
.entity weaponentity = weaponentities[0];
switch(attack_type)
{
case MONSTER_ATTACK_MELEE:
......
......@@ -94,7 +94,7 @@ bool M_Zombie_Defend_Block(entity this)
return true;
}
bool M_Zombie_Attack(int attack_type, entity actor, entity targ)
bool M_Zombie_Attack(int attack_type, entity actor, entity targ, .entity weaponentity)
{
switch(attack_type)
{
......
......@@ -409,16 +409,18 @@ bool Monster_Attack_Leap(entity this, vector anm, void(entity this, entity touch
return true;
}
void Monster_Attack_Check(entity this, entity targ)
void Monster_Attack_Check(entity this, entity targ, .entity weaponentity)
{
int slot = weaponslot(weaponentity);
if((!this || !targ)
|| (!this.monster_attackfunc)
|| (time < this.attack_finished_single[0])
|| (time < this.attack_finished_single[slot])
) { return; }
if(vdist(targ.origin - this.origin, <=, this.attack_range))
{
int attack_success = this.monster_attackfunc(MONSTER_ATTACK_MELEE, this, targ);
int attack_success = this.monster_attackfunc(MONSTER_ATTACK_MELEE, this, targ, weaponentity);
if(attack_success == 1)
Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE);
else if(attack_success > 0)
......@@ -427,7 +429,7 @@ void Monster_Attack_Check(entity this, entity targ)
if(vdist(targ.origin - this.origin, >, this.attack_range))
{
int attack_success = this.monster_attackfunc(MONSTER_ATTACK_RANGED, this, targ);
int attack_success = this.monster_attackfunc(MONSTER_ATTACK_RANGED, this, targ, weaponentity);
if(attack_success == 1)
Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE);
else if(attack_success > 0)
......@@ -888,7 +890,8 @@ void Monster_Move(entity this, float runspeed, float walkspeed, float stpspeed)
this.angles_y += turny;
}
Monster_Attack_Check(this, this.enemy);
.entity weaponentity = weaponentities[0]; // TODO?
Monster_Attack_Check(this, this.enemy, weaponentity);
}
void Monster_Remove(entity this)
......@@ -1029,7 +1032,10 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
mon.mr_death(mon, this);
if(this.candrop && this.weapon)
W_ThrowNewWeapon(this, this.weapon, 0, this.origin, randomvec() * 150 + '0 0 325');
{
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
W_ThrowNewWeapon(this, this.weapon, 0, this.origin, randomvec() * 150 + '0 0 325', weaponentity);
}
}
void Monster_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
......
......@@ -23,7 +23,7 @@ MUTATOR_HOOKFUNCTION(breakablehook, Damage_Calculate)
if(DIFF_TEAM(frag_attacker, frag_target.realowner))
{
Damage (frag_target.realowner, frag_attacker, frag_attacker, 5, WEP_HOOK.m_id | HITTYPE_SPLASH, frag_target.realowner.origin, '0 0 0');
RemoveGrapplingHook(frag_target.realowner);
RemoveHook(frag_target);
return; // dead
}
}
......
......@@ -853,8 +853,14 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
}
if(player.buffs & BUFF_AMMO.m_itemid)
if(player.clip_size)
player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size;
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(player.(weaponentity).clip_size)
player.(weaponentity).clip_load = player.(weaponentity).(weapon_load[player.(weaponentity).m_switchweapon.m_id]) = player.(weaponentity).clip_size;
}
}
if((player.buffs & BUFF_INVISIBLE.m_itemid) && (player.oldbuffs & BUFF_INVISIBLE.m_itemid))
if(player.alpha != autocvar_g_buffs_invisible_alpha)
......@@ -881,9 +887,17 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
player.buff_ammo_prev_infitems = (player.items & IT_UNLIMITED_WEAPON_AMMO);
player.items |= IT_UNLIMITED_WEAPON_AMMO;
if(player.clip_load)
player.buff_ammo_prev_clipload = player.clip_load;
player.clip_load = player.(weapon_load[PS(player).m_switchweapon.m_id]) = player.clip_size;
if(player.buffs & BUFF_AMMO.m_itemid)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(player.(weaponentity).clip_load)
player.(weaponentity).buff_ammo_prev_clipload = player.(weaponentity).clip_load;
if(player.(weaponentity).clip_size)
player.(weaponentity).clip_load = player.(weaponentity).(weapon_load[player.(weaponentity).m_switchweapon.m_id]) = player.(weaponentity).clip_size;
}
}
}
BUFF_ONREM(BUFF_AMMO)
......@@ -893,8 +907,15 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
else
player.items &= ~IT_UNLIMITED_WEAPON_AMMO;
if(player.buff_ammo_prev_clipload)
player.clip_load = player.buff_ammo_prev_clipload;
if(player.buffs & BUFF_AMMO.m_itemid)
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(player.(weaponentity).buff_ammo_prev_clipload)
player.(weaponentity).clip_load = player.(weaponentity).buff_ammo_prev_clipload;
}
}
}
BUFF_ONADD(BUFF_INVISIBLE)
......
......@@ -738,7 +738,7 @@ void nade_boom(entity this)
IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
{
RemoveGrapplingHook(it.realowner);
RemoveHook(it);
});
delete(this);
......@@ -787,7 +787,7 @@ void nade_touch(entity this, entity toucher)
{
IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
{
RemoveGrapplingHook(it.realowner);
RemoveHook(it);
});
delete(this);
return;
......@@ -893,7 +893,7 @@ void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
makevectors(e.v_angle);
// NOTE: always throw from first weapon entity?
W_SetupShot(e, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
W_SetupShot(e, _nade.weaponentity_fld, false, false, SND_Null, CH_WEAPON_A, 0);
Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
......@@ -1036,6 +1036,8 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
if(Nades_from(n.nade_type) == NADE_TYPE_Null)
n.nade_type = NADE_TYPE_NORMAL.m_id;
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
setmodel(n, MDL_PROJECTILE_NADE);
//setattachment(n, player, "bip01 l hand");
n.exteriormodeltoclient = player;
......@@ -1050,10 +1052,10 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
setthink(n, nade_beep);
n.nextthink = max(n.wait - 3, time);
n.projectiledeathtype = DEATH_NADE.m_id;
n.weaponentity_fld = weaponentity;
n.nade_lifetime = ntime;
setmodel(fn, MDL_NADE_VIEW);
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
setattachment(fn, player.(weaponentity), "");
fn.realowner = fn.owner = player;
fn.colormod = Nades_from(n.nade_type).m_color;
......@@ -1061,6 +1063,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
fn.glowmod = player.glowmod;
setthink(fn, SUB_Remove);
fn.nextthink = n.wait;
fn.weaponentity_fld = weaponentity;
player.nade = n;
player.fake_nade = fn;
......
......@@ -63,8 +63,14 @@ REGISTER_MUTATOR(nix, cvar("g_nix") && !cvar("g_instagib") && !cvar("g_overkill"
it.ammo_rockets = start_ammo_rockets;
it.ammo_fuel = start_ammo_fuel;
it.weapons = start_weapons;
if(!client_hasweapon(it, PS(it).m_weapon, true, false))
PS(it).m_switchweapon = w_getbestweapon(it);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(it.(weaponentity).m_weapon == WEP_Null && slot != 0)
continue;
if(!client_hasweapon(it, it.(weaponentity).m_weapon, weaponentity, true, false))
it.(weaponentity).m_switchweapon = w_getbestweapon(it, weaponentity);
}
});
}
......@@ -164,14 +170,24 @@ void NIX_GiveCurrentWeapon(entity this)
// all weapons must be fully loaded when we spawn
if(e.spawnflags & WEP_FLAG_RELOADABLE) // prevent accessing undefined cvars
this.(weapon_load[nix_weapon]) = e.reloading_ammo;
{
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
this.(weaponentity).(weapon_load[nix_weapon]) = e.reloading_ammo;
}
}
// vortex too
if(WEP_CVAR(vortex, charge))
{
if(WEP_CVAR_SEC(vortex, chargepool))
this.vortex_chargepool_ammo = 1;
this.vortex_charge = WEP_CVAR(vortex, charge_start);
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
this.(weaponentity).vortex_charge = WEP_CVAR(vortex, charge_start);
}
}
// set last change info
......@@ -205,12 +221,19 @@ void NIX_GiveCurrentWeapon(entity this)
this.weapons |= e.m_wepset;
Weapon w = Weapons_from(nix_weapon);
if(PS(this).m_switchweapon != w)
if(!client_hasweapon(this, PS(this).m_switchweapon, true, false))
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
.entity weaponentity = weaponentities[slot];
if(this.(weaponentity).m_weapon == WEP_Null && slot != 0)
continue;
if(this.(weaponentity).m_switchweapon != w)
if(!client_hasweapon(this, this.(weaponentity).m_switchweapon, weaponentity, true, false))
{
if(client_hasweapon(this, w, true, false))
W_SwitchWeapon(this, w);
if(client_hasweapon(this, w, weaponentity, true, false))
W_SwitchWeapon(this, w, weaponentity);
}
}
}
MUTATOR_HOOKFUNCTION(nix, ForbidThrowCurrentWeapon)
......
......@@ -20,14 +20,14 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
return;
}
if((!thiswep.wr_checkammo1(thiswep, actor) && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (!(actor.items & IT_SUPERWEAPON) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS)))
if((!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (!(actor.items & IT_SUPERWEAPON) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS)))
{
W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
w_ready(thiswep, actor, weaponentity, fire);
return;
}
W_DecreaseAmmo(WEP_HMG, actor, WEP_CVAR(hmg, ammo));
W_DecreaseAmmo(WEP_HMG, actor, WEP_CVAR(hmg, ammo), weaponentity);
W_SetupShot (actor, weaponentity, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(hmg, damage));
......@@ -37,10 +37,10 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
actor.punchangle_y = random () - 0.5;
}
float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
fireBullet(actor, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR(hmg, spread_max));
fireBullet(actor, weaponentity, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
......@@ -58,45 +58,45 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(hmg, refire), W_HeavyMachineGun_Attack_Auto);
}
METHOD(HeavyMachineGun, wr_aim, void(entity thiswep, entity actor))
METHOD(HeavyMachineGun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
{
if(vdist(actor.origin - actor.enemy.origin, <, 3000 - bound(0, skill, 10) * 200))
PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 0.001, false);
PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
else
PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, 1000000, 0, 0.001, false);
PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
}
METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
if(WEP_CVAR(hmg, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
thiswep.wr_reload(thiswep, actor, weaponentity);
} else
{
if (fire & 1)
if (weapon_prepareattack(thiswep, actor, weaponentity, false, 0))
{
actor.misc_bulletcounter = 0;
actor.(weaponentity).misc_bulletcounter = 0;
W_HeavyMachineGun_Attack_Auto(thiswep, actor, weaponentity, fire);
}
}
}
METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep, entity actor))
METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
{
float ammo_amount = actor.ammo_nails >= WEP_CVAR(hmg, ammo);
if(autocvar_g_balance_hmg_reload_ammo)
ammo_amount += actor.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
return ammo_amount;
}
METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor))
METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
float ammo_amount = actor.ammo_nails >= WEP_CVAR(hmg, ammo);
if(autocvar_g_balance_hmg_reload_ammo)
ammo_amount += actor.(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[WEP_HMG.m_id]) >= WEP_CVAR(hmg, ammo);
return ammo_amount;
}
......
......@@ -68,7 +68,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor, .entity wea
entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(actor);
entity flash = spawn ();
W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo));
W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo), weaponentity);
W_SetupShot_ProjectileSize (actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage));
Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
PROJECTILE_MAKETRIGGER(missile);
......@@ -111,14 +111,14 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor, .entity wea
MUTATOR_CALLHOOK(EditProjectile, actor, missile);
}
METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor))
METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
{
PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
}
METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
if(WEP_CVAR(rpc, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR(rpc, ammo)) {
thiswep.wr_reload(thiswep, actor, weaponentity);
} else
{
......@@ -138,14 +138,14 @@ METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .en
}
}
METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, entity actor))
METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
{
float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
ammo_amount += actor.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
return ammo_amount;
}
METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor))
METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))