X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fgamemode_nexball.qc;h=3e5c19523c342caf2844bea7a7dbdd72933b3d65;hb=6f37a8f8076a572097afb13de2c367a72717c927;hp=346ae1eee4493eed30b0649d18a2747d8d824e23;hpb=2ff5923b5d3acdd9ed21ee37481c69586a6a7bf4;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 346ae1eee..3e5c19523 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -1,3 +1,10 @@ +#include "gamemode_nexball.qh" +#include "../_.qh" + +#include "gamemode.qh" + +#include "../t_jumppads.qh" + float autocvar_g_nexball_safepass_turnrate; float autocvar_g_nexball_safepass_maxdist; float autocvar_g_nexball_safepass_holdtime; @@ -8,9 +15,9 @@ vector autocvar_g_nexball_viewmodel_offset; void basketball_touch(); void football_touch(); void ResetBall(); -#define NBM_NONE 0 -#define NBM_FOOTBALL 2 -#define NBM_BASKETBALL 4 +const float NBM_NONE = 0; +const float NBM_FOOTBALL = 2; +const float NBM_BASKETBALL = 4; float nexball_mode; float OtherTeam(float t) //works only if there are two teams on the map! @@ -22,12 +29,12 @@ float OtherTeam(float t) //works only if there are two teams on the map! return e.team; } -#define ST_NEXBALL_GOALS 1 -#define SP_NEXBALL_GOALS 4 -#define SP_NEXBALL_FAULTS 5 +const float ST_NEXBALL_GOALS = 1; +const float SP_NEXBALL_GOALS = 4; +const float SP_NEXBALL_FAULTS = 5; void nb_ScoreRules(float teams) { - ScoreRules_basics(teams, 0, 0, TRUE); + ScoreRules_basics(teams, 0, 0, true); ScoreInfo_SetLabel_TeamScore( ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY); ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY); ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER); @@ -74,7 +81,7 @@ void nexball_setstatus(void) void relocate_nexball(void) { - tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, TRUE, self); + tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, true, self); if(trace_startsolid) { vector o; @@ -82,9 +89,9 @@ void relocate_nexball(void) if(!move_out_of_solid(self)) objerror("could not get out of solid at all!"); print("^1NOTE: this map needs FIXING. ", self.classname, " at ", vtos(o - '0 0 1')); - print(" needs to be moved out of solid, e.g. by '", ftos(self.origin_x - o_x)); - print(" ", ftos(self.origin_y - o_y)); - print(" ", ftos(self.origin_z - o_z), "'\n"); + print(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x)); + print(" ", ftos(self.origin.y - o.y)); + print(" ", ftos(self.origin.z - o.z), "'\n"); self.origin = o; } } @@ -94,7 +101,7 @@ void DropOwner(void) entity ownr; ownr = self.owner; DropBall(self, ownr.origin, ownr.velocity); - makevectors(ownr.v_angle_y * '0 1 0'); + makevectors(ownr.v_angle.y * '0 1 0'); ownr.velocity += ('0 0 0.75' - v_forward) * 1000; ownr.flags &= ~FL_ONGROUND; } @@ -183,7 +190,7 @@ void DropBall(entity ball, vector org, vector vel) } WaypointSprite_Kill(ball.owner.waypointsprite_attachedforcarrier); - WaypointSprite_Spawn("nb-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // no health bar please + WaypointSprite_Spawn("nb-ball", 0, 0, ball, '0 0 64', world, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER, BALL_SPRITECOLOR); // no health bar please WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT); ball.owner.ballcarried = world; @@ -204,7 +211,7 @@ void InitBall(void) self.nextthink = time + autocvar_g_nexball_delay_idle + 3; self.teamtime = 0; self.pusher = world; - self.team = FALSE; + self.team = false; sound(self, CH_TRIGGER, self.noise1, VOL_BASE, ATTEN_NORM); WaypointSprite_Ping(self.waypointsprite_attachedforcarrier); LogNB("init", world); @@ -281,7 +288,7 @@ void football_touch(void) } else if(autocvar_g_nexball_football_physics == 2) // 2nd mod try: totally independant. Really playable! { - makevectors(other.v_angle_y * '0 1 0'); + makevectors(other.v_angle.y * '0 1 0'); self.velocity = other.velocity + v_forward * autocvar_g_nexball_football_boost_forward + v_up * autocvar_g_nexball_football_boost_up; } else // Revenant's original style (from the original mod's disassembly, acknowledged by Revenant) @@ -430,38 +437,38 @@ void nb_spawnteam(string teamname, float teamcolor) void nb_spawnteams(void) { - float t_r = 0, t_b = 0, t_y = 0, t_p = 0; + bool t_red = false, t_blue = false, t_yellow = false, t_pink = false; entity e; for(e = world; (e = find(e, classname, "nexball_goal"));) { switch(e.team) { case NUM_TEAM_1: - if(!t_r) + if(!t_red) { nb_spawnteam("Red", e.team-1) ; - t_r = 1; + t_red = true; } break; case NUM_TEAM_2: - if(!t_b) + if(!t_blue) { nb_spawnteam("Blue", e.team-1) ; - t_b = 1; + t_blue = true; } break; case NUM_TEAM_3: - if(!t_y) + if(!t_yellow) { nb_spawnteam("Yellow", e.team-1); - t_y = 1; + t_yellow = true; } break; case NUM_TEAM_4: - if(!t_p) + if(!t_pink) { nb_spawnteam("Pink", e.team-1) ; - t_p = 1; + t_pink = true; } break; } @@ -505,7 +512,7 @@ void SpawnBall(void) if(cvar(strcat("g_", self.classname, "_trail"))) //nexball_basketball :p { self.glow_color = autocvar_g_nexball_trail_color; - self.glow_trail = TRUE; + self.glow_trail = true; } self.movetype = MOVETYPE_FLY; @@ -571,9 +578,9 @@ float nb_Goal_Customize() entity e, wp_owner; e = WaypointSprite_getviewentity(other); wp_owner = self.owner; - if(SAME_TEAM(e, wp_owner)) { return FALSE; } + if(SAME_TEAM(e, wp_owner)) { return false; } - return TRUE; + return true; } void SpawnGoal(void) @@ -724,7 +731,7 @@ void W_Nexball_Attack(float t) if(!(ball = self.ballcarried)) return; - W_SetupShot(self, FALSE, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0); + W_SetupShot(self, false, 4, "nexball/shoot1.wav", CH_WEAPON_A, 0); tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, world); if(trace_startsolid) { @@ -747,7 +754,7 @@ void W_Nexball_Attack(float t) mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power } - DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, FALSE)); + DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false)); //TODO: use the speed_up cvar too ?? @@ -758,7 +765,7 @@ void W_Nexball_Attack2(void) 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, "nexball/shoot1.wav", CH_WEAPON_A, 0); DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32)); _ball.think = W_Nexball_Think; _ball.nextthink = time; @@ -771,7 +778,7 @@ void W_Nexball_Attack2(void) entity missile; if(!(balls & BALL_BASKET)) return; - W_SetupShot(self, FALSE, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0); + W_SetupShot(self, false, 2, "nexball/shoot2.wav", CH_WEAPON_A, 0); // pointparticles(particleeffectnum("grenadelauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1); missile = spawn(); @@ -794,7 +801,7 @@ void W_Nexball_Attack2(void) missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION; missile.flags = FL_PROJECTILE; - CSQCProjectile(missile, TRUE, PROJECTILE_ELECTRO, TRUE); + CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true); } float ball_customize() @@ -804,7 +811,7 @@ float ball_customize() self.effects &= ~EF_FLAME; self.scale = 1; self.customizeentityforclient = func_null; - return TRUE; + return true; } if(other == self.owner) @@ -821,7 +828,7 @@ float ball_customize() self.scale = 1; } - return TRUE; + return true; } float w_nexball_weapon(float req) @@ -870,8 +877,8 @@ float w_nexball_weapon(float req) { //weapon_setup(WEP_PORTO); } - // No need to check WR_CHECKAMMO* or WR_AIM, it should always return TRUE - return TRUE; + // No need to check WR_CHECKAMMO* or WR_AIM, it should always return true + return true; } MUTATOR_HOOKFUNCTION(nexball_BallDrop) @@ -894,9 +901,9 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) self.ballcarried.customizeentityforclient = ball_customize; setorigin(self.ballcarried, self.origin + self.view_ofs + - v_forward * autocvar_g_nexball_viewmodel_offset_x + - v_right * autocvar_g_nexball_viewmodel_offset_y + - v_up * autocvar_g_nexball_viewmodel_offset_z); + v_forward * autocvar_g_nexball_viewmodel_offset.x + + v_right * autocvar_g_nexball_viewmodel_offset.y + + v_up * autocvar_g_nexball_viewmodel_offset.z); // 'safe passing' if(autocvar_g_nexball_safepass_maxdist) @@ -943,7 +950,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) nexball_setstatus(); - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn) @@ -955,7 +962,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn) else self.weapons = '0 0 0'; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics) @@ -965,31 +972,31 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics) self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed; self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed; } - return FALSE; + 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; + return false; } MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) { if(self.weapon == WEP_MORTAR) - return TRUE; + return true; - return FALSE; + return false; } MUTATOR_HOOKFUNCTION(nexball_FilterItem) { if(self.classname == "droppedweapon") if(self.weapon == WEP_MORTAR) - return TRUE; + return true; - return FALSE; + return false; } MUTATOR_DEFINITION(gamemode_nexball)