]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/bot_waypoints
authorterencehill <piuntn@gmail.com>
Wed, 3 Jan 2018 15:25:39 +0000 (16:25 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 3 Jan 2018 15:25:39 +0000 (16:25 +0100)
mutators.cfg
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/viewloc.qc
qcsrc/server/weapons/tracing.qc

index 79ac41791ade308fde3b9371f47757b23b2656b0..af0fa9e68477e1b05e3366e6dddb57a1f3547677 100644 (file)
@@ -40,7 +40,7 @@ set g_instagib_ammo_convert_bullets 0 "convert bullet ammo packs to insta cell a
 set g_instagib_ammo_convert_cells 0 "convert normal cell ammo packs to insta cell ammo packs"
 set g_instagib_ammo_convert_rockets 0 "convert rocket ammo packs to insta cell ammo packs"
 set g_instagib_ammo_convert_shells 0 "convert shell ammo packs to insta cell ammo packs"
-set g_instagib_invisibility_time 30 "Time of ivisibility powerup in seconds."
+set g_instagib_invisibility_time 30 "Time of invisibility powerup in seconds."
 set g_instagib_invis_alpha 0.15
 set g_instagib_speed_time 30 "Time of speed powerup in seconds."
 set g_instagib_speed_highspeed 1.5 "speed-multiplier that applies while you carry the invincibility powerup"
index 88fc3b5c651c1e0076a8d490b1a3d3efe245cb4d..95a437e926dac488d40dfe96b8e879c5df7bcaf7 100644 (file)
@@ -1482,6 +1482,9 @@ void HUD_Draw(entity this)
 
 void ViewLocation_Mouse()
 {
+       if(spectatee_status)
+               return; // don't draw it as spectator!
+
        viewloc_mousepos += getmousepos() * autocvar_menu_mouse_speed;
        viewloc_mousepos.x = bound(0, viewloc_mousepos.x, vid_conwidth);
        viewloc_mousepos.y = bound(0, viewloc_mousepos.y, vid_conheight);
index ab6843ed53ea7e358ceed756771c0515d3f07e65..fe0070afcb1589bd8cbcd45af5e6486aa4632430 100644 (file)
@@ -82,7 +82,7 @@ void powerup_invisibility_init(entity item);
 REGISTER_ITEM(Invisibility, Powerup) {
     this.m_canonical_spawnfunc = "item_invisibility";
 #ifdef GAMEQC
-       this.spawnflags = ITEM_FLAG_INSTAGIB;
+       this.spawnflags = ITEM_FLAG_INSTAGIB | ITEM_FLAG_MUTATORBLOCKED;
     this.m_model            =   MDL_Invisibility_ITEM;
     this.m_sound            =   SND_Invisibility;
     this.m_glow             =   true;
@@ -117,7 +117,7 @@ void powerup_speed_init(entity item);
 REGISTER_ITEM(Speed, Powerup) {
     this.m_canonical_spawnfunc = "item_speed";
 #ifdef GAMEQC
-       this.spawnflags = ITEM_FLAG_INSTAGIB;
+       this.spawnflags = ITEM_FLAG_INSTAGIB | ITEM_FLAG_MUTATORBLOCKED;
     this.m_model            =   MDL_Speed_ITEM;
     this.m_sound            =   SND_Speed;
     this.m_glow             =   true;
index c21623f0e5e12d0bb63d96644e4d4e6a22441f1a..473e36e1057589e689c3f961645f7721126231e1 100644 (file)
@@ -19,19 +19,23 @@ float autocvar_g_instagib_speed_highspeed;
 
 REGISTER_MUTATOR(mutator_instagib, autocvar_g_instagib && !g_nexball)
 {
-    MUTATOR_ONADD
-    {
-        ITEM_VaporizerCells.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
-    }
-    MUTATOR_ONROLLBACK_OR_REMOVE
-    {
-        ITEM_VaporizerCells.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
-    }
+       MUTATOR_ONADD
+       {
+               ITEM_VaporizerCells.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+               ITEM_Invisibility.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+               ITEM_Speed.spawnflags &= ~ITEM_FLAG_MUTATORBLOCKED;
+       }
+       MUTATOR_ONROLLBACK_OR_REMOVE
+       {
+               ITEM_VaporizerCells.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+               ITEM_Invisibility.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+               ITEM_Speed.spawnflags |= ITEM_FLAG_MUTATORBLOCKED;
+       }
 }
 
 void instagib_invisibility(entity this)
 {
-       this.strength_finished = autocvar_g_balance_powerup_strength_time;
+       this.strength_finished = autocvar_g_instagib_invisibility_time;
        StartItem(this, ITEM_Invisibility);
 }
 
@@ -42,7 +46,7 @@ void instagib_extralife(entity this)
 
 void instagib_speed(entity this)
 {
-       this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+       this.invincible_finished = autocvar_g_instagib_speed_time;
        StartItem(this, ITEM_Speed);
 }
 
index f4431eed2887f84e812e7bd61bcc46dac87eb6c7..fa6d0f6f313510dd1bc6a8e1a6e921a425d7e1b0 100644 (file)
@@ -533,7 +533,7 @@ void Item_Respawn (entity this)
 
 void Item_RespawnCountdown (entity this)
 {
-       if(this.count >= ITEM_RESPAWN_TICKS)
+       if(this.item_respawncounter >= ITEM_RESPAWN_TICKS)
        {
                if(this.waypointsprite_attached)
                        WaypointSprite_Kill(this.waypointsprite_attached);
@@ -542,8 +542,8 @@ void Item_RespawnCountdown (entity this)
        else
        {
                this.nextthink = time + 1;
-               this.count += 1;
-               if(this.count == 1)
+               this.item_respawncounter += 1;
+               if(this.item_respawncounter == 1)
                {
                        do {
                                {
@@ -584,7 +584,7 @@ void Item_RespawnCountdown (entity this)
                        });
 
                        WaypointSprite_Ping(this.waypointsprite_attached);
-                       //WaypointSprite_UpdateHealth(this.waypointsprite_attached, this.count);
+                       //WaypointSprite_UpdateHealth(this.waypointsprite_attached, this.item_respawncounter);
                }
        }
 }
@@ -607,7 +607,7 @@ void Item_ScheduleRespawnIn(entity e, float t)
                setthink(e, Item_RespawnCountdown);
                e.nextthink = time + max(0, t - ITEM_RESPAWN_TICKS);
                e.scheduledrespawntime = e.nextthink + ITEM_RESPAWN_TICKS;
-               e.count = 0;
+               e.item_respawncounter = 0;
                if(Item_ItemsTime_Allow(e.itemdef) || (e.weapons & WEPSET_SUPERWEAPONS))
                {
                        t = Item_ItemsTime_UpdateTime(e, e.scheduledrespawntime);
index 5ecbe548824bef246be9e2ccf45b5b95882df09d..3740c9a576d5ee045a8d80660fbbbc6170399cc1 100644 (file)
@@ -62,6 +62,8 @@ const float ITEM_RESPAWN_TICKS = 10;
 .float max_armorvalue;
 .float pickup_anyway;
 
+.float item_respawncounter;
+
 void Item_Show (entity e, float mode);
 
 void Item_Respawn (entity this);
index 38a925198a7b59abbecc26f14a8aebd39571ddfb..11dab52a30e6651d99cbf3b4527edebfea00226b 100644 (file)
@@ -41,17 +41,6 @@ void viewloc_PlayerPhysics(entity this)
                                this.angles_y = backward.y;
                        if(PHYS_CS(this).movement_x > 0) // right
                                this.angles_y = forward.y;
-
-                       if(old_movement_x > 0)
-       #ifdef CSQC
-                               input_angles_x =
-       #endif
-                               this.v_angle_x = this.angles_x = -50;
-                       else if(old_movement_x < 0)
-       #ifdef CSQC
-                               input_angles_x =
-       #endif
-                               this.v_angle_x = this.angles_x = 50;
                }
 
                //if(!PHYS_INPUT_BUTTON_CROUCH(this) && !IS_DUCKED(this))
@@ -105,22 +94,14 @@ void viewloc_SetViewLocation()
        if(view.viewloc && !wasfreed(view.viewloc) && view.viewloc.enemy && view.viewloc.goalentity)
        {
                bool have_sidescroll = (view.viewloc.enemy != view.viewloc.goalentity);
-               vector position_a, position_b, camera_position, camera_angle = '0 0 0', forward, backward;
-               //vector scratch;
-
-               position_a = view.viewloc.enemy.origin;
-               position_b = view.viewloc.goalentity.origin;
+               vector position_a = view.viewloc.enemy.origin;
+               vector position_b = view.viewloc.goalentity.origin;
+               vector camera_angle = '0 0 0';
+               vector camera_position;
 
-#if 0
                /*TODO: have the camera only move when a player moves too much from the center of the camera
-                * basically the player can move around in a "box" in the center of th screen with out changing the camera position or angles
-               */
-               if (cvar("cam_box")) {
-                       camera_position = vec_bounds_in(view.origin, position_a, position_b);
-               }
-               else
-#endif
-                       camera_position = vec_bounds_in(view.origin, position_a, position_b);
+                * basically the player would move around in a small "box" in the center of the screen with out changing the camera position or angles */
+               camera_position = vec_bounds_in(view.origin, position_a, position_b);
 
 
                // a tracking camera follows the player when it leaves the world box
@@ -129,13 +110,12 @@ void viewloc_SetViewLocation()
                }
 
                // hard snap changes the angle as soon as it crosses over the nearest 90 degree mark
-               if (autocvar_cam_snap_hard){
+               if (autocvar_cam_snap_hard) {
                        camera_angle = angle_snap_vec(aim_vec(camera_position, view.origin), 90);
                }
 
                // tries to avoid snapping unless it *really* needs to
-               if (autocvar_cam_snap_close){
-
+               if (autocvar_cam_snap_close) {
                        // like hard snap, but don't snap angles yet.
                        camera_angle = aim_vec(camera_position, view.origin);
 
@@ -145,10 +125,11 @@ void viewloc_SetViewLocation()
                         */
                        float camera_angle_diff = max(camera_angle.y, old_camera_angle.y) - min(camera_angle.y, old_camera_angle.y);
 
-                       if ( camera_angle_diff >= 60)
+                       if (60 <= camera_angle_diff) { // use new angles
                                old_camera_angle.y = angle_snap_f(camera_angle.y, 90);
-                       else
+                       } else { // use old angles
                                camera_angle.y = old_camera_angle.y;
+                       }
                }
 
                //unlocking this allows the camera to look up and down. this also allows a top-down view.
@@ -168,28 +149,36 @@ void viewloc_SetViewLocation()
                setproperty(VF_ORIGIN, camera_position);
                setproperty(VF_ANGLES, camera_angle);
 
-               if(have_sidescroll)
-               {
-                       forward = vectoangles(normalize(vec_to_min(position_b, position_a) - vec_to_max(position_b, position_a)));
-                       backward = vectoangles(normalize(vec_to_max(position_b, position_a) - vec_to_min(position_b, position_a)));
-
-                       if(!(view.viewloc.spawnflags & VIEWLOC_FREEAIM))
-                       {
-                               if(input_movevalues_y < 0) // left
-                                       view.angles_y = backward.y;
-                               if(input_movevalues_y > 0) // favour right
-                                       view.angles_y = forward.y;
-
-                               setproperty(VF_CL_VIEWANGLES, view.angles);
-                       }
-                       else
-                       {
-                               //vector fpos = view.origin + view.view_ofs + forward * max_shot_distance;
-                               //vector bpos = view.origin + view.view_ofs + backward * max_shot_distance;
+               if(spectatee_status)
+                       return; // if spectating, don't replace angles or inputs!
+
+               if (have_sidescroll) {
+                       vector view_angle = view.angles;
+                       if (!(view.viewloc.spawnflags & VIEWLOC_FREEAIM)) {
+                               vector avatar_facing_dir;
+                               // get the player's forward-facing direction, based on positions a and b
+                               if (0 == input_movevalues.y) {
+                                       avatar_facing_dir = view_angle; // default to the previous values
+                               } else if (0 > input_movevalues.y) { // left is forward
+                                       avatar_facing_dir = vectoangles(normalize(vec_to_max(position_b, position_a) - vec_to_min(position_b, position_a)));
+                               } else { // right is forward
+                                       avatar_facing_dir = vectoangles(normalize(vec_to_min(position_b, position_a) - vec_to_max(position_b, position_a)));
+                               }
+                               view_angle.y = avatar_facing_dir.y; // snap avatar to look on along the correct axis
+
+                               // if (0 == input_movevalues.x) look straight ahead
+                               if (0 > input_movevalues.x) { // look up
+                                       view_angle.x = 50;
+                               } else if (0 < input_movevalues.x) { // look down
+                                       view_angle.x = -50;
+                               }
+                       } else {
                                vector mpos = CursorToWorldCoord(viewloc_mousepos);
-                               //vector pos_bounds = vec_bounds_in(mpos, fpos, bpos);
-                               setproperty(VF_CL_VIEWANGLES, aim_vec(view.origin + view.view_ofs, vec3(view.origin_x + view.view_ofs_x, mpos.y, mpos.z)));
+                               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.angles_y = view_angle.y;
+                       setproperty(VF_CL_VIEWANGLES, view_angle);
                }
        }
 }
index f09ee828e9354ac311f8b9b1a634e6047f806627..486ae180a2a0c80c3dea73f34dc0f45b36c45322 100644 (file)
@@ -16,6 +16,7 @@
 #include <common/util.qh>
 
 #include <common/weapons/_all.qh>
+#include <common/wepent.qh>
 #include <common/state.qh>
 
 #include <lib/warpzone/common.qh>