]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option to always show 3rd person view in nexball while not carrying weapons...
authorMario <mario.mario@y7mail.com>
Wed, 7 May 2014 17:40:42 +0000 (03:40 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 7 May 2014 17:40:42 +0000 (03:40 +1000)
defaultXonotic.cfg
qcsrc/client/View.qc
qcsrc/client/autocvars.qh
qcsrc/client/waypointsprites.qc
qcsrc/server/cl_physics.qc
qcsrc/server/mutators/gamemode_nexball.qc

index 747e0c4192e9a77e434719bbeaf6cc4d0268ccdf..e549ca62a11658c6fb8588bc3b966a28b14f5aba 100644 (file)
@@ -224,6 +224,7 @@ seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy"
 set cl_hitsound_antispam_time 0.05 "don't play the hitsound more often than this"
 
 seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead"
+seta cl_eventchase_nexball 1 "camera goes into 3rd person mode when in nexball game-mode"
 seta cl_eventchase_distance 140 "final camera distance"
 seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"
 seta cl_eventchase_maxs "12 12 8" "max size of eventchase camera bbox"
index 85dfe547c15518ca455ff455bdd2dfe4cade9904..2a41ba13c673c601f9134052a5f4cba68425a5ee 100644 (file)
@@ -492,7 +492,8 @@ void CSQC_UpdateView(float w, float h)
        // event chase camera
        if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
        {
-               if(((spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead)) || intermission) && !autocvar_cl_orthoview)
+               WepSet weapons_stat = WepSet_GetFromStat();
+               if(((spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead)) || intermission) && !autocvar_cl_orthoview || (autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(weapons_stat & WepSet_FromWeapon(WEP_PORTO))))
                {
                        // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
                        vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
index 5ba321ae17d89456f3411c36eff91d8144fcdf65..67a03259382feba3d5e14adf53087c834eac6491 100644 (file)
@@ -410,6 +410,7 @@ float autocvar_viewsize;
 float autocvar_cl_hitsound;
 float autocvar_cl_hitsound_antispam_time;
 var float autocvar_cl_eventchase_death = 1;
+var float autocvar_cl_eventchase_nexball = 1;
 var float autocvar_cl_eventchase_distance = 140;
 var float autocvar_cl_eventchase_speed = 1.3;
 var vector autocvar_cl_eventchase_maxs = '12 12 8';
index dd7ae36b91fc09897bacb967633819e7cc61db34..1367501a8a3743ab17b2c2fa5dbb02c9a7870911 100644 (file)
@@ -277,6 +277,7 @@ string spritelookuptext(string s)
                case "race-finish": return _("Finish");
                case "race-start": return _("Start");
                case "race-start-finish": return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
+               case "goal": return _("Goal");
                case "nb-ball": return _("Ball");
                case "ka-ball": return _("Ball");
                case "ka-ballcarrier": return _("Ball carrier");
index 0098561373abb930bb7d869d71ac88f0bffeac33..0d0dd3138aa9600e06e0aef3fb152d6410d30987 100644 (file)
@@ -636,9 +636,7 @@ void SV_PlayerPhysics()
 
        maxspd_mod = 1;
        if(self.ballcarried)
-               if(g_nexball)
-                       maxspd_mod *= autocvar_g_nexball_basketball_carrier_highspeed;
-               else if(g_keepaway)
+               if(g_keepaway)
                        maxspd_mod *= autocvar_g_keepaway_ballcarrier_highspeed;
 
        maxspd_mod *= autocvar_g_movement_highspeed;
index 2d2c857e90dbff166c673e53f05488bb6970e878..014d37ec20169fd6497b6f3b50764b51deb1d91c 100644 (file)
@@ -457,11 +457,21 @@ void nb_spawnteams(void)
        }
 }
 
+// scoreboard setup
+void nb_ScoreRules(float teams)
+{
+       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);
+       ScoreRules_basics_end();
+}
+
 void nb_delayedinit(void)
 {
        if(find(world, classname, "nexball_team") == world)
                nb_spawnteams();
-       ScoreRules_nexball(nb_teams);
+       nb_ScoreRules(nb_teams);
 }
 
 
@@ -471,11 +481,7 @@ void nb_delayedinit(void)
 
 void SpawnBall(void)
 {
-       if(!g_nexball)
-       {
-               remove(self);
-               return;
-       }
+       if(!g_nexball) { remove(self); return; }
 
 //     balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine
 
@@ -559,14 +565,28 @@ void spawnfunc_nexball_football(void)
        SpawnBall();
 }
 
+float nb_Goal_Customize()
+{
+       entity e, wp_owner;
+       e = WaypointSprite_getviewentity(other);
+       wp_owner = self.owner;
+       if(SAME_TEAM(e, wp_owner)) { return FALSE; }
+
+       return TRUE;
+}
+
 void SpawnGoal(void)
 {
-       if(!g_nexball)
+       if(!g_nexball) { remove(self); return; }
+
+       EXACTTRIGGER_INIT;
+
+       if(self.team != GOAL_OUT && Team_TeamToNumber(self.team) != -1)
        {
-               remove(self);
-               return;
+               WaypointSprite_SpawnFixed("goal", (self.absmin + self.absmax) * 0.5, self, sprite, RADARICON_NONE, ((self.team) ? Team_ColorRGB(self.team) : '1 0.5 0'));
+               self.sprite.customizeentityforclient = nb_Goal_Customize;
        }
-       EXACTTRIGGER_INIT;
+
        self.classname = "nexball_goal";
        if(self.noise == "")
                self.noise = "ctf/respawn.wav";
@@ -674,7 +694,7 @@ void W_Nexball_Touch(void)
 
        PROJECTILE_TOUCH;
        if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
-               if((ball = other.ballcarried) && (IS_PLAYER(attacker)))
+               if((ball = other.ballcarried) && !other.deadflag && (IS_PLAYER(attacker)))
                {
                        other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
                        other.flags &= ~FL_ONGROUND;
@@ -683,7 +703,7 @@ void W_Nexball_Touch(void)
                                LogNB("stole", attacker);
                                sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
 
-                               if(attacker.team == other.team && time > attacker.teamkill_complain)
+                               if(SAME_TEAM(attacker, other) && time > attacker.teamkill_complain)
                                {
                                        attacker.teamkill_complain = time + 5;
                                        attacker.teamkill_soundtime = time + 0.4;
@@ -760,7 +780,7 @@ void W_Nexball_Attack2(void)
        missile.movetype = MOVETYPE_FLY;
        PROJECTILE_MAKETRIGGER(missile);
 
-       setmodel(missile, "models/elaser.mdl");  // precision set below
+       //setmodel(missile, "models/elaser.mdl");  // precision set below
        setsize(missile, '0 0 0', '0 0 0');
        setorigin(missile, w_shotorg);
 
@@ -772,6 +792,8 @@ void W_Nexball_Attack2(void)
 
        missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
        missile.flags = FL_PROJECTILE;
+
+       CSQCProjectile(missile, TRUE, PROJECTILE_ELECTRO, TRUE);
 }
 
 float ball_customize()
@@ -859,18 +881,6 @@ MUTATOR_HOOKFUNCTION(nexball_BallDrop)
        return 0;
 }
 
-MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsString)
-{
-       ret_string = strcat(ret_string, ":NB");
-       return 0;
-}
-
-MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsPrettyString)
-{
-       ret_string = strcat(ret_string, ", NexBall");
-       return 0;
-}
-
 MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
 {
        makevectors(self.v_angle);
@@ -947,6 +957,16 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics)
+{
+       if(self.ballcarried)
+       {
+               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
+               self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
+       }
+       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
@@ -954,16 +974,34 @@ MUTATOR_HOOKFUNCTION(nexball_SetStartItems)
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing)
+{
+       if(self.weapon == WEP_GRENADE_LAUNCHER)
+               return TRUE;
+
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(nexball_FilterItem)
+{
+       if(self.classname == "droppedweapon")
+       if(self.weapon == WEP_GRENADE_LAUNCHER)
+               return TRUE;
+
+       return FALSE;
+}
+
 MUTATOR_DEFINITION(gamemode_nexball)
 {
        MUTATOR_HOOK(PlayerDies, nexball_BallDrop, CBC_ORDER_ANY);
        MUTATOR_HOOK(MakePlayerObserver, nexball_BallDrop, CBC_ORDER_ANY);
        MUTATOR_HOOK(ClientDisconnect, nexball_BallDrop, CBC_ORDER_ANY);
-       MUTATOR_HOOK(BuildMutatorsPrettyString, nexball_BuildMutatorsPrettyString, CBC_ORDER_ANY);
-       MUTATOR_HOOK(BuildMutatorsString, nexball_BuildMutatorsString, CBC_ORDER_ANY);
        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);
 
        MUTATOR_ONADD
        {
@@ -973,6 +1011,8 @@ MUTATOR_DEFINITION(gamemode_nexball)
                g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32
                addstat(STAT_NB_METERSTART, AS_FLOAT, metertime);
 
+               w_porto(WR_PRECACHE); // abuse
+
                // General settings
                /*
                CVTOV(g_nexball_football_boost_forward);   //100