]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Lyberta/PlayerTemplates' into Lyberta/Survival
authorLyberta <lyberta@lyberta.net>
Sun, 21 Jan 2018 03:06:42 +0000 (06:06 +0300)
committerLyberta <lyberta@lyberta.net>
Sun, 21 Jan 2018 03:06:42 +0000 (06:06 +0300)
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/physics/player.qc
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/viewloc.qc
qcsrc/common/weapons/weapon/crylink.qh

index 95a437e926dac488d40dfe96b8e879c5df7bcaf7..6a294d5ad5d35322c4576e063a844bcc0da16a15 100644 (file)
@@ -979,7 +979,7 @@ void HUD_Crosshair(entity this)
        float f, i, j;
        vector v;
        if(!scoreboard_active && !camera_active && intermission != 2 && !STAT(GAME_STOPPED) &&
-               spectatee_status != -1 && !csqcplayer.viewloc && !MUTATOR_CALLHOOK(DrawCrosshair) &&
+               spectatee_status != -1 && (!csqcplayer.viewloc || (!spectatee_status && (csqcplayer.viewloc.spawnflags & VIEWLOC_FREEAIM))) && !MUTATOR_CALLHOOK(DrawCrosshair) &&
                !HUD_MinigameMenu_IsOpened() )
        {
                if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
@@ -1010,7 +1010,10 @@ void HUD_Crosshair(entity this)
                float shottype;
 
                // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
-               wcross_origin = project_3d_to_2d(view_origin + max_shot_distance * view_forward);
+               if(csqcplayer.viewloc && (csqcplayer.viewloc.spawnflags & VIEWLOC_FREEAIM))
+                       wcross_origin = viewloc_mousepos;
+               else
+                       wcross_origin = project_3d_to_2d(view_origin + max_shot_distance * view_forward);
                wcross_origin.z = 0;
                if(autocvar_crosshair_hittest)
                {
@@ -1489,8 +1492,8 @@ void ViewLocation_Mouse()
        viewloc_mousepos.x = bound(0, viewloc_mousepos.x, vid_conwidth);
        viewloc_mousepos.y = bound(0, viewloc_mousepos.y, vid_conheight);
 
-       float cursor_alpha = 1 - autocvar__menu_alpha;
-       draw_cursor(viewloc_mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
+       //float cursor_alpha = 1 - autocvar__menu_alpha;
+       //draw_cursor(viewloc_mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha);
 }
 
 bool ov_enabled;
index 473e36e1057589e689c3f961645f7721126231e1..81384380516bf4eba48cfcd733fc8360adf30dc6 100644 (file)
@@ -387,7 +387,7 @@ void replace_with_insta_cells(entity item)
 {
        entity e = new(item_vaporizer_cells);
        setorigin(e, item.origin);
-       e.noalign = item.noalign;
+       e.noalign = Item_ShouldKeepPosition(item);
        e.cnt = item.cnt;
        e.team = item.team;
        e.spawnfunc_checked = true;
index 92e16b48d22e04bc65a49f33b12dbdacbf17eee3..3dc7e4e0e3e050c4eb7e72d838945492aa552750 100644 (file)
@@ -1273,30 +1273,27 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
                }
        }
 
-       float n = 0;
+       int n = 0;
        entity o = NULL;
        if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
                n = -1;
-       else
+       else if(STAT(FROZEN, player) == 3)
        {
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                n = 0;
                FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
-                       if(!IS_DEAD(it))
-                       if(STAT(FROZEN, it) == 0)
-                       if(SAME_TEAM(it, player))
+                       if(!IS_DEAD(it) && STAT(FROZEN, it) == 0 && SAME_TEAM(it, player))
                        if(boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
                        {
                                if(!o)
                                        o = it;
-                               if(STAT(FROZEN, player) == 1)
-                                       it.reviving = true;
+                               it.reviving = true;
                                ++n;
                        }
                });
        }
 
-       if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
+       if(n > 0 && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
        {
                player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
                SetResourceAmount(player, RESOURCE_HEALTH, max(1, player.revive_progress * start_health));
index 5eef8f2e37b4b49c96bce413c564cf2ebcbf9b28..2b9dcd55074cdbd243be2b0fc4746a47de804b5d 100644 (file)
@@ -189,51 +189,6 @@ MUTATOR_HOOKFUNCTION(ok, PlayerWeaponSelect)
        }
 }
 
-void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }
-void self_spawnfunc_weapon_rpc(entity this) { spawnfunc_weapon_rpc(this); }
-
-MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
-{
-       entity ent = M_ARGV(0, entity);
-
-       if(autocvar_g_powerups)
-       if(autocvar_g_overkill_powerups_replace)
-       {
-               if(ent.classname == "item_strength")
-               {
-                       entity wep = new(weapon_hmg);
-                       setorigin(wep, ent.origin);
-                       setmodel(wep, MDL_OK_HMG);
-                       wep.ok_item = true;
-                       wep.noalign = Item_ShouldKeepPosition(ent);
-                       wep.cnt = ent.cnt;
-                       wep.team = ent.team;
-                       wep.respawntime = g_pickup_respawntime_superweapon;
-                       wep.pickup_anyway = true;
-                       wep.spawnfunc_checked = true;
-                       setthink(wep, self_spawnfunc_weapon_hmg);
-                       wep.nextthink = time + 0.1;
-                       return true;
-               }
-               else if(ent.classname == "item_shield")
-               {
-                       entity wep = new(weapon_rpc);
-                       setorigin(wep, ent.origin);
-                       setmodel(wep, MDL_OK_RPC);
-                       wep.ok_item = true;
-                       wep.noalign = Item_ShouldKeepPosition(ent);
-                       wep.cnt = ent.cnt;
-                       wep.team = ent.team;
-                       wep.respawntime = g_pickup_respawntime_superweapon;
-                       wep.pickup_anyway = true;
-                       wep.spawnfunc_checked = true;
-                       setthink(wep, self_spawnfunc_weapon_rpc);
-                       wep.nextthink = time + 0.1;
-                       return true;
-               }
-       }
-}
-
 bool ok_HandleItemWaypoints(entity e)
 {
        if(!autocvar_g_overkill_itemwaypoints)
@@ -266,9 +221,42 @@ MUTATOR_HOOKFUNCTION(ok, FilterItem)
 {
        entity item = M_ARGV(0, entity);
 
-       if(item.ok_item)
+       if (item.ok_item)
+       {
                return false;
-
+       }
+       if (!autocvar_g_powerups || !autocvar_g_overkill_powerups_replace)
+       {
+               return true;
+       }
+       if (item.classname == "item_strength")
+       {
+               entity wep = new(weapon_hmg);
+               setorigin(wep, item.origin);
+               wep.ok_item = true;
+               wep.noalign = Item_ShouldKeepPosition(item);
+               wep.cnt = item.cnt;
+               wep.team = item.team;
+               wep.respawntime = g_pickup_respawntime_superweapon;
+               wep.pickup_anyway = true;
+               wep.spawnfunc_checked = true;
+               Item_Initialize(wep, "weapon_hmg");
+               return true;
+       }
+       else if (item.classname == "item_shield")
+       {
+               entity wep = new(weapon_rpc);
+               setorigin(wep, item.origin);
+               wep.ok_item = true;
+               wep.noalign = Item_ShouldKeepPosition(item);
+               wep.cnt = item.cnt;
+               wep.team = item.team;
+               wep.respawntime = g_pickup_respawntime_superweapon;
+               wep.pickup_anyway = true;
+               wep.spawnfunc_checked = true;
+               Item_Initialize(wep, "weapon_rpc");
+               return true;
+       }
        return true;
 }
 
index 20c580a8591b0e371981d671ba208a459229e2b2..7d3cab007b508fa6dafceb84a14585d0fd68f327 100644 (file)
@@ -21,7 +21,7 @@ float Physics_ClientOption(entity this, string option, float defaultval)
                if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
                        return cvar(s);
        }
-       if(autocvar_g_physics_clientselect && autocvar_g_physics_clientselect_default)
+       if(autocvar_g_physics_clientselect && autocvar_g_physics_clientselect_default && autocvar_g_physics_clientselect_default != "")
        {
                string s = strcat("g_physics_", autocvar_g_physics_clientselect_default, "_", option);
                if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
index fa6d0f6f313510dd1bc6a8e1a6e921a425d7e1b0..8469d1e3c27b5ba57007ab60b1ae0852c432af59 100644 (file)
@@ -37,6 +37,7 @@ REGISTER_NET_LINKED(ENT_CLIENT_ITEM)
 #ifdef CSQC
 bool autocvar_cl_ghost_items_vehicle = true;
 .vector item_glowmod;
+.bool item_simple; // probably not really needed, but better safe than sorry
 void Item_SetAlpha(entity this)
 {
        bool veh_hud = (hud && autocvar_cl_ghost_items_vehicle);
@@ -96,14 +97,16 @@ void ItemDraw(entity this)
     {
         if(this.ItemStatus & ITS_ANIMATE1)
         {
-            this.angles += this.avelocity * frametime;
+               if(!this.item_simple)
+               this.angles += this.avelocity * frametime;
             float fade_in = bound(0, time - this.onground_time, 1);
             setorigin(this, this.oldorigin + fade_in * ('0 0 10' + '0 0 8' * sin((time - this.onground_time) * 2)));
         }
 
         if(this.ItemStatus & ITS_ANIMATE2)
         {
-            this.angles += this.avelocity * frametime;
+               if(!this.item_simple)
+               this.angles += this.avelocity * frametime;
             float fade_in = bound(0, time - this.onground_time, 1);
             setorigin(this, this.oldorigin + fade_in * ('0 0 8' + '0 0 4' * sin((time - this.onground_time) * 3)));
         }
@@ -112,19 +115,6 @@ void ItemDraw(entity this)
     Item_SetAlpha(this);
 }
 
-void ItemDrawSimple(entity this)
-{
-    if(this.gravity)
-    {
-        Movetype_Physics_MatchServer(this, false);
-
-        if(IS_ONGROUND(this))
-            this.gravity = 0;
-    }
-
-    Item_SetAlpha(this);
-}
-
 void Item_PreDraw(entity this)
 {
        if(warpzone_warpzones_exist)
@@ -228,11 +218,12 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
 
         this.mdl = "";
         string _fn = ReadString();
+        this.item_simple = false; // reset it!
 
         if(autocvar_cl_simple_items && (this.ItemStatus & ITS_ALLOWSI))
         {
             string _fn2 = substring(_fn, 0 , strlen(_fn) -4);
-            this.draw = ItemDrawSimple;
+            this.item_simple = true;
 
             if(fexists(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".md3")))
                 this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".md3"));
@@ -244,12 +235,12 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew)
                 this.mdl = strzone(strcat(_fn2, autocvar_cl_simpleitems_postfix, ".mdl"));
             else
             {
-                this.draw = ItemDraw;
+                this.item_simple = false;
                 LOG_TRACE("Simple item requested for ", _fn, " but no model exists for it");
             }
         }
 
-        if(this.draw != ItemDrawSimple)
+        if(!this.item_simple)
             this.mdl = strzone(_fn);
 
 
index 3740c9a576d5ee045a8d80660fbbbc6170399cc1..455952dd63801dccc17d5548c4282b2398629254 100644 (file)
@@ -44,7 +44,6 @@ string autocvar_cl_simpleitems_postfix = "_simple";
 .vector colormod;
 
 void ItemDraw(entity this);
-void ItemDrawSimple(entity this);
 
 #endif
 #ifdef SVQC
index 11dab52a30e6651d99cbf3b4527edebfea00226b..fd7937b5208d7f9dbd2f9aa9afcb2f99bacd99ad 100644 (file)
@@ -175,7 +175,7 @@ void viewloc_SetViewLocation()
                        } else {
                                vector mpos = CursorToWorldCoord(viewloc_mousepos);
                                mpos.x = view.origin.x; // replace the cursor's x position with the player's
-                               view_angle = aim_vec(view.origin, mpos); // get new angles
+                               view_angle = aim_vec(view.origin + view.view_ofs, mpos); // get new angles
                        }
                        view.angles_y = view_angle.y;
                        setproperty(VF_CL_VIEWANGLES, view_angle);
index 5ecef08d9f48bed31aa471cafefe95db1b158666..e48bf5fb3481e8db22c4698662997a648adc3db0 100644 (file)
@@ -4,7 +4,7 @@ CLASS(Crylink, Weapon)
 /* spawnfunc */ ATTRIB(Crylink, m_canonical_spawnfunc, string, "weapon_crylink");
 /* ammotype  */ ATTRIB(Crylink, ammo_type, int, RESOURCE_CELLS);
 /* impulse   */ ATTRIB(Crylink, impulse, int, 6);
-/* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB | WEP_FLAG_NODUAL);
+/* flags     */ ATTRIB(Crylink, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_CANCLIMB);
 /* rating    */ ATTRIB(Crylink, bot_pickupbasevalue, float, 6000);
 /* color     */ ATTRIB(Crylink, wpcolor, vector, '1 0.5 1');
 /* modelname */ ATTRIB(Crylink, mdl, string, "crylink");