]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into TimePath/features/jetpack_jump
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 24 Dec 2014 03:43:49 +0000 (14:43 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 24 Dec 2014 03:43:49 +0000 (14:43 +1100)
Conflicts:
qcsrc/server/cl_physics.qc

1  2 
defaultXonotic.cfg
qcsrc/menu/xonotic/dialog_settings_input.c
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/t_items.qc

diff --combined defaultXonotic.cfg
index c899cbbcfb8ba31d605252323c4692cd187d9d8e,7984a29d63082b767c7f5121c41031035201198d..cbb8014bc0a0983e99e5fb943c746e09d73e76ee
@@@ -34,8 -34,6 +34,8 @@@ seta g_configversion 0        "Configuration f
  // other aliases
  alias +hook +button6
  alias -hook -button6
 +alias +jetpack +button10
 +alias -jetpack -button10
  alias use "impulse 21"
  
  // for backwards compatibility
@@@ -1028,8 -1026,6 +1028,8 @@@ seta cl_clippedspectating 1 "movement c
  
  seta cl_autoscreenshot 1 "Take a screenshot upon the end of a match... 0 = Disable completely, 1 = Allow sv_autoscreenshot to take a screenshot when requested, 2 = Always take an autoscreenshot anyway."
  
 +seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Stop when touching ground, 2 = Enable"
 +
  // must be at the bottom of this file:
  
  set g_bugrigs 0
@@@ -1091,7 -1087,7 +1091,7 @@@ seta cl_gentle_gibs 0           "client side gen
  seta cl_gentle_messages 0     "client side gentle mode (only replaces frag messages/centerprints)"
  seta cl_gentle_damage 0               "client side gentle mode (only replaces damage flash); when set to 1, a white flash replaces the blood image, when set to 2, a randomily colored flash is used instead"
  
 -set g_jetpack 0 "Jetpack mutator (uses the hook's button, can't coexist with the offhand hook, but only with the onhand one)"
 +set g_jetpack 0 "Jetpack mutator"
  
  set g_running_guns 0 "... or wonder, till it drives you mad, what would have followed if you had."
  set g_bastet 0 "don't try"
@@@ -1228,8 -1224,6 +1228,6 @@@ volume 
  // sucks less than the old one
  cl_decals_newsystem 1
  
- seta cl_cubemaps_extra 1
  set sv_q3acompat_machineshotgunswap 0 "shorthand for swapping machinegun and shotgun (for Q3A map compatibility in mapinfo files)"
  
  set g_movement_highspeed 1 "movement speed modification factor (only changes movement when above maxspeed)"
index 12a662cf9ea74df91c918cb67f5cbaaf50b5e52a,8b68c6582f808ba30c036d487cba5c44bdb42d2a..57b6cef630d6e171bb2c31441b26a88338049b02
@@@ -3,7 -3,7 +3,7 @@@ CLASS(XonoticInputSettingsTab) EXTENDS(
        METHOD(XonoticInputSettingsTab, fill, void(entity))
        ATTRIB(XonoticInputSettingsTab, title, string, _("Input"))
        ATTRIB(XonoticInputSettingsTab, intendedWidth, float, 0.9)
-       ATTRIB(XonoticInputSettingsTab, rows, float, 14.5)
+       ATTRIB(XonoticInputSettingsTab, rows, float, 15.5)
        ATTRIB(XonoticInputSettingsTab, columns, float, 6.2) // added extra .2 for center space
  ENDCLASS(XonoticInputSettingsTab)
  entity makeXonoticInputSettingsTab();
@@@ -32,8 -32,8 +32,8 @@@ void XonoticInputSettingsTab_fill(entit
        me.TR(me);
                me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Key Bindings")));
        me.TR(me);
-               me.TD(me, me.rows - 4, 3, kb);
-       me.gotoRC(me, me.rows - 3, 0);
+               me.TD(me, me.rows - 3, 3, kb);
+       me.gotoRC(me, me.rows - 2, 0);
                me.TD(me, 1, 1, e = makeXonoticButton(_("Change key..."), '0 0 0'));
                        e.onClick = KeyBinder_Bind_Change;
                        e.onClickEntity = kb;
                me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
                        e.sendCvars = TRUE;
        me.TR(me);
 +              me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Jetpack on jump:")));
 +              me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_jetpack_jump"));
 +                      e.addValue(e, _("Disabled"), "0");
 +                      e.addValue(e, _("Air only"), "1");
 +                      e.addValue(e, _("All"), "2");
 +                      e.configureXonoticTextSliderValues(e);
 +                      e.sendCvars = TRUE;
        me.TR(me);
                if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
                {
index a933990e858facb02b906da9e21462b8aafe1e83,be379590aadb2fe23792509bdc46ef877d8bc8bc..01092c886fd1fb97fe58ec8bfa716367964315ac
@@@ -1140,10 -1140,6 +1140,10 @@@ void ClientConnect (void
        // Wazat's grappling hook
        SetGrappleHookBindings();
  
 +      // Jetpack binds
 +      stuffcmd(self, "alias +jetpack +button10\n");
 +      stuffcmd(self, "alias -jetpack -button10\n");
 +
        // get version info from player
        stuffcmd(self, "cmd clientversion $gameversion\n");
  
@@@ -1562,7 -1558,7 +1562,7 @@@ void player_regen (void
                mina = autocvar_g_balance_armor_regenstable;
                limith = autocvar_g_balance_health_limit;
                limita = autocvar_g_balance_armor_limit;
-               
                max_mod = regen_mod_max;
                regen_mod = regen_mod_regen;
                rot_mod = regen_mod_rot;
@@@ -1756,7 -1752,6 +1756,6 @@@ float SpectateUpdate(
        return 1;
  }
  
  float SpectateSet()
  {
        if(self.enemy.classname != "player")
@@@ -2627,8 -2622,6 +2626,6 @@@ void PlayerPostThink (void
        }
        */
  
-       //pointparticles(particleeffectnum("machinegun_impact"), self.origin + self.view_ofs + '0 0 7', '0 0 0', 1);
        if(self.waypointsprite_attachedforcarrier)
                WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON));
  
index 34e3e8f5d2791f7705bb70a24eade0e751a2ebaa,08f9dee9562f5c9d91c382236f3f0ea56e84e0bf..900f65bc8ab3dcbbe698f23ab906e7b5320f7601
  PlayerJump
  
  When you press the jump key
 +returns TRUE if handled
  =============
  */
 -void PlayerJump (void)
 +float PlayerJump (void)
  {
        if(self.frozen)
 -              return; // no jumping in freezetag when frozen
 +              return TRUE; // no jumping in freezetag when frozen
  
        if(self.player_blocked)
 -              return; // no jumping while blocked
 +              return TRUE; // no jumping while blocked
  
        float doublejump = FALSE;
        float mjumpheight = autocvar_sv_jumpvelocity;
@@@ -32,7 -31,7 +32,7 @@@
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
        if(MUTATOR_CALLHOOK(PlayerJump))
 -              return;
 +              return TRUE;
  
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
                self.velocity_z = self.stat_sv_maxspeed * 0.7;
 -              return;
 +              return TRUE;
        }
  
        if (!doublejump)
                if (!(self.flags & FL_ONGROUND))
 -                      return;
 +                      return !(self.flags & FL_JUMPRELEASED);
  
        if(self.cvar_cl_movement_track_canjump)
                if (!(self.flags & FL_JUMPRELEASED))
 -                      return;
 +                      return TRUE;
  
        // sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
        // velocity bounds.  Final velocity is bound between (jumpheight *
  
        self.restart_jump = -1; // restart jump anim next time
        // value -1 is used to not use the teleport bit (workaround for tiny hitch when re-jumping)
 +      return TRUE;
  }
  void CheckWaterJump()
  {
                }
        }
  }
 +
 +.float jetpack_stopped;
 +// Hack: shouldn't need to know about this
 +.float multijump_count;
  void CheckPlayerJump()
  {
 -      if (self.BUTTON_JUMP)
 -              PlayerJump ();
 +      float was_flying = self.items & IT_USING_JETPACK;
 +
 +      if (self.cvar_cl_jetpack_jump < 2)
 +              self.items &= ~IT_USING_JETPACK;
 +
 +      if (self.BUTTON_JUMP || self.BUTTON_JETPACK)
 +      {
 +              float air_jump = !PlayerJump() || self.multijump_count > 0; // PlayerJump() has important side effects
 +              float activate = self.cvar_cl_jetpack_jump && air_jump && self.BUTTON_JUMP || self.BUTTON_JETPACK;
 +              float has_fuel = !autocvar_g_jetpack_fuel || self.ammo_fuel || self.items & IT_UNLIMITED_WEAPON_AMMO;
 +              if (self.jetpack_stopped) { }
 +              else if (!has_fuel)
 +              {
-                       if (was_flying)
-                               sprint(self, "You ran out of fuel for the ^2Jetpack\n");
++                      if (was_flying) // TODO: ran out of fuel message
++                              Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
 +                      else
-                               sprint(self, "You don't have any fuel for the ^2Jetpack\n");
++                              Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
 +                      self.jetpack_stopped = TRUE;
 +                      self.items &= ~IT_USING_JETPACK;
 +              }
 +              else if (activate && !self.frozen)
 +                      self.items |= IT_USING_JETPACK;
 +      }
        else
 +      {
 +              self.jetpack_stopped = FALSE;
 +              self.items &= ~IT_USING_JETPACK;
 +      }
 +      if (!self.BUTTON_JUMP)
                self.flags |= FL_JUMPRELEASED;
  
        if (self.waterlevel == WATERLEVEL_SWIMMING)
@@@ -784,6 -752,8 +784,6 @@@ void SV_PlayerPhysics(
                bot_think();
        }
  
 -      self.items &= ~IT_USING_JETPACK;
 -
        if(IS_PLAYER(self))
        {
                if(self.race_penalty)
                        PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
                }
        }
 -      else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.frozen)
 +      else if (self.items & IT_USING_JETPACK)
        {
                //makevectors(self.v_angle_y * '0 1 0');
                makevectors(self.v_angle);
        }
        else if (self.flags & FL_ONGROUND)
        {
+               // we get here if we ran out of ammo
+               if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
+                       Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
                // walking
                makevectors(self.v_angle_y * '0 1 0');
                wishvel = v_forward * self.movement_x + v_right * self.movement_y;
        else
        {
                float wishspeed0;
+               // we get here if we ran out of ammo
+               if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
+                       Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
  
                if(maxspd_mod < 1)
                {
diff --combined qcsrc/server/t_items.qc
index de110cd476c2a8c62fbfc56a91f420e646e26442,8d705b363f8c72c84c20ce3d4a3b81f70608d4bf..4455d3fb46a3128ecf541c8d4558286341eb8a4e
@@@ -599,7 -599,7 +599,7 @@@ float Item_GiveTo(entity item, entity p
        {
                pickedup = TRUE;
                player.items |= it;
-               sprint (player, strcat("You got the ^2", item.netname, "\n"));
+               Send_Notification(NOTIF_ONE, player, MSG_INFO, INFO_ITEM_WEAPON_GOT, item.netname);
        }
  
        if (item.strength_finished)
@@@ -1458,6 -1458,8 +1458,6 @@@ void spawnfunc_item_fuel_regen(void
  
  void spawnfunc_item_jetpack(void)
  {
 -      if(g_grappling_hook)
 -              return; // sorry, but these two can't coexist (same button); spawn fuel instead
        if(!self.ammo_fuel)
                self.ammo_fuel = g_pickup_fuel_jetpack;
        if(start_items & IT_JETPACK)