#include "nexball.qh"
-#ifdef IMPLEMENTATION
#ifdef CSQC
int autocvar_cl_eventchase_nexball = 1;
}
const float ST_NEXBALL_GOALS = 1;
-const float SP_NEXBALL_GOALS = 4;
-const float SP_NEXBALL_FAULTS = 5;
void nb_ScoreRules(int teams)
{
ScoreRules_basics(teams, 0, 0, true);
}
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)
void nb_spawnteam(string teamname, float teamcolor)
{
- LOG_TRACE("^2spawned team ", teamname, "\n");
+ LOG_TRACE("^2spawned team ", teamname);
entity e = new(nexball_team);
e.netname = teamname;
e.cnt = teamcolor;
delete(this);
}
-void W_Nexball_Attack(entity actor, float t)
+void W_Nexball_Attack(entity actor, .entity weaponentity, float t)
{
entity ball;
float mul, mi, ma;
if(!(ball = actor.ballcarried))
return;
- W_SetupShot(actor, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+ W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, NULL);
if(trace_startsolid)
{
vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
-void W_Nexball_Attack2(entity actor)
+void W_Nexball_Attack2(entity actor, .entity weaponentity)
{
if(actor.ballcarried.enemy)
{
entity _ball = actor.ballcarried;
- W_SetupShot(actor, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+ W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
setthink(_ball, W_Nexball_Think);
_ball.nextthink = time;
if(!autocvar_g_nexball_tackling)
return;
- W_SetupShot(actor, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
+ W_SetupShot(actor, weaponentity, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
entity missile = new(ballstealer);
missile.owner = actor;
missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
missile.flags = FL_PROJECTILE;
+ IL_PUSH(g_projectiles, missile);
+ IL_PUSH(g_bot_dodge, missile);
CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
}
}
else
{
- W_Nexball_Attack(actor, -1);
+ W_Nexball_Attack(actor, weaponentity, -1);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
if(fire & 2)
if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
{
- W_Nexball_Attack2(actor);
+ W_Nexball_Attack2(actor, weaponentity);
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
}
if(!(fire & 1) && actor.metertime && actor.ballcarried)
{
- W_Nexball_Attack(actor, time - actor.metertime);
+ W_Nexball_Attack(actor, weaponentity, time - actor.metertime);
// DropBall or stealing will set metertime back to 0
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
}
-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;
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);
+ player.(weaponentity).m_switchweapon = player.m_switchweapon;
+ W_SwitchWeapon(player, player.(weaponentity).m_switchweapon, weaponentity);
player.(weaponentity).weapons = '0 0 0';
}
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);
MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
{
entity player = M_ARGV(0, entity);
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- return PS(player).m_weapon == WEP_NEXBALL;
+ return player.(weaponentity).m_weapon == WEP_NEXBALL;
}
MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
{
entity player = M_ARGV(0, entity);
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- return PS(player).m_weapon == WEP_MORTAR; // TODO: what is this for?
+ return player.(weaponentity).m_weapon == WEP_MORTAR; // TODO: what is this for?
}
MUTATOR_HOOKFUNCTION(nb, FilterItem)
return MUT_ITEMTOUCH_CONTINUE;
}
-MUTATOR_HOOKFUNCTION(nb, GetTeamCount)
+MUTATOR_HOOKFUNCTION(nb, CheckAllowedTeams)
{
M_ARGV(1, string) = "nexball_team";
return true;
}
#endif
-#endif