#include "gamemode.qh"
+float autocvar_g_nexball_basketball_bouncefactor;
+float autocvar_g_nexball_basketball_bouncestop;
+float autocvar_g_nexball_basketball_carrier_highspeed;
+bool autocvar_g_nexball_basketball_meter;
+float autocvar_g_nexball_basketball_meter_maxpower;
+float autocvar_g_nexball_basketball_meter_minpower;
+float autocvar_g_nexball_delay_collect;
+float autocvar_g_nexball_delay_goal;
+float autocvar_g_nexball_delay_start;
+float autocvar_g_nexball_football_bouncefactor;
+float autocvar_g_nexball_football_bouncestop;
+bool autocvar_g_nexball_radar_showallplayers;
+bool autocvar_g_nexball_sound_bounce;
+int autocvar_g_nexball_trail_color;
+
float autocvar_g_nexball_safepass_turnrate;
float autocvar_g_nexball_safepass_maxdist;
float autocvar_g_nexball_safepass_holdtime;
plyr.weaponentity.weapons = plyr.weapons;
plyr.weaponentity.switchweapon = plyr.weapon;
- plyr.weapons = WEPSET_PORTO;
+ plyr.weapons = WEPSET(NEXBALL);
setself(plyr);
- WEP_ACTION(WEP_PORTO, WR_RESETPLAYER);
- plyr.switchweapon = WEP_PORTO.m_id;
- W_SwitchWeapon(WEP_PORTO.m_id);
+ Weapon w = WEP_NEXBALL;
+ w.wr_resetplayer(w);
+ plyr.switchweapon = WEP_NEXBALL.m_id;
+ W_SwitchWeapon(WEP_NEXBALL.m_id);
setself(this);
}
self.teamtime = 0;
self.pusher = world;
self.team = false;
- sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM);
+ _sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM);
WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
LogNB("init", world);
}
{
if(time > self.lastground + 0.1)
{
- sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
+ _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
self.lastground = time;
}
if(vlen(self.velocity) && !self.cnt)
}
else if(other.solid == SOLID_BSP)
{
- sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
+ _sound(self, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NORM);
if(vlen(self.velocity) && !self.cnt)
self.nextthink = min(time + autocvar_g_nexball_delay_idle, self.teamtime);
}
pscore = 1;
}
- sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NONE);
+ _sound(ball, CH_TRIGGER, self.noise, VOL_BASE, ATTEN_NONE);
if(ball.team && pscore)
{
//=======================//
// team ents //
//=======================//
-void spawnfunc_nexball_team(void)
-{SELFPARAM();
+spawnfunc(nexball_team)
+{
if(!g_nexball)
{
remove(self);
if(!autocvar_g_nexball_sound_bounce)
self.noise = "";
else if(self.noise == "")
- self.noise = "sound/nexball/bounce.wav";
+ self.noise = SND(NB_BOUNCE);
//bounce sound placeholder (FIXME)
if(self.noise1 == "")
- self.noise1 = "sound/nexball/drop.wav";
+ self.noise1 = SND(NB_DROP);
//ball drop sound placeholder (FIXME)
if(self.noise2 == "")
- self.noise2 = "sound/nexball/steal.wav";
+ self.noise2 = SND(NB_STEAL);
//stealing sound placeholder (FIXME)
if(self.noise) precache_sound(self.noise);
precache_sound(self.noise1);
self.nextthink = game_starttime + autocvar_g_nexball_delay_start;
}
-void spawnfunc_nexball_basketball(void)
-{SELFPARAM();
+spawnfunc(nexball_basketball)
+{
nexball_mode |= NBM_BASKETBALL;
self.classname = "nexball_basketball";
if (!(balls & BALL_BASKET))
SpawnBall();
}
-void spawnfunc_nexball_football(void)
-{SELFPARAM();
+spawnfunc(nexball_football)
+{
nexball_mode |= NBM_FOOTBALL;
self.classname = "nexball_football";
self.solid = SOLID_TRIGGER;
self.touch = GoalTouch;
}
-void spawnfunc_nexball_redgoal(void)
-{SELFPARAM();
+spawnfunc(nexball_redgoal)
+{
self.team = NUM_TEAM_1;
SpawnGoal();
}
-void spawnfunc_nexball_bluegoal(void)
-{SELFPARAM();
+spawnfunc(nexball_bluegoal)
+{
self.team = NUM_TEAM_2;
SpawnGoal();
}
-void spawnfunc_nexball_yellowgoal(void)
-{SELFPARAM();
+spawnfunc(nexball_yellowgoal)
+{
self.team = NUM_TEAM_3;
SpawnGoal();
}
-void spawnfunc_nexball_pinkgoal(void)
-{SELFPARAM();
+spawnfunc(nexball_pinkgoal)
+{
self.team = NUM_TEAM_4;
SpawnGoal();
}
-void spawnfunc_nexball_fault(void)
-{SELFPARAM();
+spawnfunc(nexball_fault)
+{
self.team = GOAL_FAULT;
if(self.noise == "")
- self.noise = "misc/typehit.wav";
+ self.noise = SND(TYPEHIT);
SpawnGoal();
}
-void spawnfunc_nexball_out(void)
-{SELFPARAM();
+spawnfunc(nexball_out)
+{
self.team = GOAL_OUT;
if(self.noise == "")
- self.noise = "misc/typehit.wav";
+ self.noise = SND(TYPEHIT);
SpawnGoal();
}
//Spawnfuncs preserved for compatibility
//
-void spawnfunc_ball(void)
+spawnfunc(ball)
{
- spawnfunc_nexball_football();
+ spawnfunc_nexball_football(this);
}
-void spawnfunc_ball_football(void)
+spawnfunc(ball_football)
{
- spawnfunc_nexball_football();
+ spawnfunc_nexball_football(this);
}
-void spawnfunc_ball_basketball(void)
+spawnfunc(ball_basketball)
{
- spawnfunc_nexball_basketball();
+ spawnfunc_nexball_basketball(this);
}
// The "red goal" is defended by blue team. A ball in there counts as a point for red.
-void spawnfunc_ball_redgoal(void)
+spawnfunc(ball_redgoal)
{
- spawnfunc_nexball_bluegoal(); // I blame Revenant
+ spawnfunc_nexball_bluegoal(this); // I blame Revenant
}
-void spawnfunc_ball_bluegoal(void)
+spawnfunc(ball_bluegoal)
{
- spawnfunc_nexball_redgoal(); // but he didn't mean to cause trouble :p
+ spawnfunc_nexball_redgoal(this); // but he didn't mean to cause trouble :p
}
-void spawnfunc_ball_fault(void)
+spawnfunc(ball_fault)
{
- spawnfunc_nexball_fault();
+ spawnfunc_nexball_fault(this);
}
-void spawnfunc_ball_bound(void)
+spawnfunc(ball_bound)
{
- spawnfunc_nexball_out();
+ spawnfunc_nexball_out(this);
}
//=======================//
if(!attacker.ballcarried)
{
LogNB("stole", attacker);
- sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
+ _sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
if(SAME_TEAM(attacker, other) && time > attacker.teamkill_complain)
{
if(!(ball = self.ballcarried))
return;
- W_SetupShot(self, false, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
+ W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0);
tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world);
if(trace_startsolid)
{
if(self.ballcarried.enemy)
{
entity _ball = self.ballcarried;
- W_SetupShot(self, false, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0);
+ W_SetupShot(self, false, 4, SND(NB_SHOOT1), CH_WEAPON_A, 0);
DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
_ball.think = W_Nexball_Think;
_ball.nextthink = time;
if(!autocvar_g_nexball_tackling)
return;
- entity missile;
- if(!(balls & BALL_BASKET))
- return;
- W_SetupShot(self, false, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0);
- missile = spawn();
+ W_SetupShot(self, false, 2, SND(NB_SHOOT2), CH_WEAPON_A, 0);
+ entity missile = spawn();
missile.owner = self;
missile.classname = "ballstealer";
return true;
}
-float w_nexball_weapon(float req)
-{SELFPARAM();
- if(req == WR_THINK)
+ METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, bool fire1, bool fire2))
{
- if(self.BUTTON_ATCK)
- if(weapon_prepareattack(0, autocvar_g_balance_nexball_primary_refire))
+ if(fire1)
+ if(weapon_prepareattack(thiswep, actor, false, autocvar_g_balance_nexball_primary_refire))
if(autocvar_g_nexball_basketball_meter)
{
if(self.ballcarried && !self.metertime)
self.metertime = time;
else
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
else
{
W_Nexball_Attack(-1);
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
- if(self.BUTTON_ATCK2)
- if(weapon_prepareattack(1, autocvar_g_balance_nexball_secondary_refire))
+ if(fire2)
+ if(weapon_prepareattack(thiswep, actor, true, autocvar_g_balance_nexball_secondary_refire))
{
W_Nexball_Attack2();
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
}
- if(!self.BUTTON_ATCK && self.metertime && self.ballcarried)
+ if(!fire1 && self.metertime && self.ballcarried)
{
W_Nexball_Attack(time - self.metertime);
// DropBall or stealing will set metertime back to 0
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
}
}
- else if(req == WR_INIT)
+ METHOD(BallStealer, wr_setup, void(BallStealer thiswep))
{
- precache_sound("nexball/shoot1.wav");
- precache_sound("nexball/shoot2.wav");
- precache_sound("misc/typehit.wav");
+ //weapon_setup(WEP_PORTO.m_id);
}
- else if(req == WR_SETUP)
+ METHOD(BallStealer, wr_checkammo1, bool(BallStealer thiswep))
{
- //weapon_setup(WEP_PORTO.m_id);
+ return true;
+ }
+ METHOD(BallStealer, wr_checkammo2, bool(BallStealer thiswep))
+ {
+ return true;
}
- // No need to check WR_CHECKAMMO* or WR_AIM, it should always return true
- return true;
-}
MUTATOR_HOOKFUNCTION(nexball_BallDrop)
{SELFPARAM();
if(self.weaponentity.weapons)
{
self.weapons = self.weaponentity.weapons;
- WEP_ACTION(WEP_PORTO, WR_RESETPLAYER);
+ Weapon w = WEP_NEXBALL;
+ w.wr_resetplayer(w);
self.switchweapon = self.weaponentity.switchweapon;
W_SwitchWeapon(self.switchweapon);
self.weaponentity.weapons = '0 0 0';
if(nexball_mode & NBM_BASKETBALL)
- self.weapons |= WEPSET_PORTO;
+ self.weapons |= WEPSET(NEXBALL);
else
self.weapons = '0 0 0';
return false;
}
-MUTATOR_HOOKFUNCTION(nexball_SetStartItems)
-{
- start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
-
- return false;
-}
-
MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing)
{SELFPARAM();
- if(self.weapon == WEP_MORTAR.m_id)
+ if(self.weapon == WEP_NEXBALL.m_id)
return true;
return false;
MUTATOR_HOOKFUNCTION(nexball_FilterItem)
{SELFPARAM();
if(self.classname == "droppedweapon")
- if(self.weapon == WEP_MORTAR.m_id)
+ if(self.weapon == WEP_NEXBALL.m_id)
return true;
return false;
MUTATOR_HOOK(PlayerSpawn, nexball_PlayerSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerPreThink, nexball_PlayerPreThink, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerPhysics, nexball_PlayerPhysics, CBC_ORDER_ANY);
- MUTATOR_HOOK(SetStartItems, nexball_SetStartItems, CBC_ORDER_ANY);
MUTATOR_HOOK(ForbidThrowCurrentWeapon, nexball_ForbidThrowing, CBC_ORDER_ANY);
MUTATOR_HOOK(FilterItem, nexball_FilterItem, CBC_ORDER_ANY);
radar_showennemies = autocvar_g_nexball_radar_showallplayers;
InitializeEntity(world, nb_delayedinit, INITPRIO_GAMETYPE);
+ WEP_NEXBALL.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
}
MUTATOR_ONROLLBACK_OR_REMOVE
{
+ WEP_NEXBALL.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
// we actually cannot roll back nb_delayedinit here
// BUT: we don't need to! If this gets called, adding always
// succeeds.