]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into martin-t/globals
authorMartin Taibr <taibr.martin@gmail.com>
Sun, 28 Jul 2019 00:59:01 +0000 (02:59 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Sun, 28 Jul 2019 00:59:01 +0000 (02:59 +0200)
1  2 
qcsrc/client/view.qc
qcsrc/server/weapons/tracing.qc

diff --combined qcsrc/client/view.qc
index b5a5e8ad02df5e2ee0a6520e42b3455adafe881c,60ae3f18a2b355592671f31b29179fe8c51fa9fb..70111b397fb12d020e2eb737b811e225699c5b2b
@@@ -133,8 -133,8 +133,8 @@@ void calc_followmodel_ofs(entity view
                vel = view.velocity;
        else
        {
 -              vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
 -              MAKEVECTORS(makevectors, view_angles, forward, right, up);
 +              vector forward, right, up;
 +              MAKE_VECTORS(view_angles, forward, right, up);
                vel.x = view.velocity * forward;
                vel.y = view.velocity * right * -1;
                vel.z = view.velocity * up;
        if (autocvar_cl_followmodel_velocity_absolute)
        {
                vector fixed_gunorg;
 -              vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
 -              MAKEVECTORS(makevectors, view_angles, forward, right, up);
 +              vector forward, right, up;
 +              MAKE_VECTORS(view_angles, forward, right, up);
                fixed_gunorg.x = gunorg * forward;
                fixed_gunorg.y = gunorg * right * -1;
                fixed_gunorg.z = gunorg * up;
@@@ -392,87 -392,6 +392,6 @@@ STATIC_INIT(fpscounter_init
        showfps_prevfps_time = currentTime; // we must initialize it to avoid an instant low frame sending
  }
  
- STATIC_INIT(Porto)
- {
-       entity e = new_pure(porto);
-       e.draw = Porto_Draw;
-       IL_PUSH(g_drawables, e);
-       e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
- }
- const int polyline_length = 16;
- .vector polyline[polyline_length];
- void Porto_Draw(entity this)
- {
-       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
-       {
-               entity wepent = viewmodels[slot];
-               if (wepent.activeweapon != WEP_PORTO) continue;
-               if (spectatee_status) continue;
-               if (WEP_CVAR(porto, secondary)) continue;
-               if (intermission == 1) continue;
-               if (intermission == 2) continue;
-               if (STAT(HEALTH) <= 0) continue;
-               vector pos = view_origin;
-               vector dir = view_forward;
-               vector forward, right, up;
-               MAKE_VECTORS(autocvar_chase_active ? warpzone_save_view_angles : view_angles, forward, right, up);
-               pos += right * -wepent.movedir.y
-                       +  up * wepent.movedir.z;
-               if (wepent.angles_held_status)
-               {
-                       MAKE_VECTORS(wepent.angles_held, forward, right, up);
-                       dir = forward;
-               }
-               wepent.polyline[0] = pos;
-               int portal_number = 0, portal1_idx = 1, portal_max = 2;
-               int n = 1 + 2;  // 2 lines == 3 points
-               for (int idx = 0; idx < n && idx < polyline_length - 1; )
-               {
-                       traceline(pos, pos + 65536 * dir, true, this);
-                       dir = reflect(dir, trace_plane_normal);
-                       pos = trace_endpos;
-                       wepent.polyline[++idx] = pos;
-                       if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SLICK || trace_dphitcontents & DPCONTENTS_PLAYERCLIP)
-                       {
-                               n += 1;
-                               continue;
-                       }
-                       if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
-                       {
-                               n = max(2, idx);
-                               break;
-                       }
-                       // check size
-                       {
-                               vector ang = vectoangles2(trace_plane_normal, dir);
-                               ang.x = -ang.x;
-                               MAKE_VECTORS(ang, forward, right, up);
-                               if (!CheckWireframeBox(this, pos - 48 * right - 48 * up + 16 * forward, 96 * right, 96 * up, 96 * forward))
-                               {
-                                       n = max(2, idx);
-                                       break;
-                               }
-                       }
-                       portal_number += 1;
-                       if (portal_number >= portal_max) break;
-                       if (portal_number == 1) portal1_idx = idx;
-               }
-               for (int idx = 0; idx < n - 1; ++idx)
-               {
-                       vector p = wepent.polyline[idx], q = wepent.polyline[idx + 1];
-                       if (idx == 0) p -= view_up * 16;  // line from player
-                       vector rgb = (idx < portal1_idx) ? '1 0 0' : '0 0 1';
-                       Draw_CylindricLine(p, q, 4, "", 1, 0, rgb, 0.5, DRAWFLAG_NORMAL, view_origin);
-               }
-       }
- }
  float drawtime;
  float avgspeed;
  vector GetCurrentFov(float fov)
                        curspeed = 0;
                else
                {
 -                      makevectors(view_angles);
 +                      vector forward, right, up;
 +                      MAKE_VECTORS(view_angles, forward, right, up);
                        v = pmove_vel;
                        if(csqcplayer)
                                v = csqcplayer.velocity;
  
                        switch(autocvar_cl_velocityzoom_type)
                        {
 -                              case 3: curspeed = max(0, v_forward * v); break;
 -                              case 2: curspeed = (v_forward * v); break;
 +                              case 3: curspeed = max(0, forward * v); break;
 +                              case 2: curspeed = (forward * v); break;
                                case 1: default: curspeed = vlen(v); break;
                        }
                }
@@@ -681,6 -599,9 +600,9 @@@ float EnemyHitCheck(
  
  float TrueAimCheck(entity wepent)
  {
+       if(wepent.activeweapon.spawnflags & WEP_FLAG_NOTRUEAIM)
+               return SHOTTYPE_HITWORLD;
+       
        float nudge = 1; // added to traceline target and subtracted from result TOOD(divVerent): do we still need this? Doesn't the engine do this now for us?
        vector vecs, trueaimpoint, w_shotorg;
        vector mi, ma, dv;
  
        switch(wepent.activeweapon) // WEAPONTODO
        {
-               case WEP_TUBA: // no aim
-               case WEP_PORTO: // shoots from eye
-               case WEP_NEXBALL: // shoots from eye
-               case WEP_HOOK: // no trueaim
-               case WEP_MORTAR: // toss curve
-                       return SHOTTYPE_HITWORLD;
                case WEP_VORTEX:
                case WEP_OVERKILL_NEX:
                case WEP_VAPORIZER:
@@@ -1812,19 -1727,18 +1728,19 @@@ void CSQC_UpdateView(entity this, floa
                        else if(eventchase_current_distance != chase_distance)
                                eventchase_current_distance = chase_distance;
  
 -                      makevectors(view_angles);
 +                      vector forward, right, up;
 +                      MAKE_VECTORS(view_angles, forward, right, up);
  
 -                      vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
 +                      vector eventchase_target_origin = (current_view_origin - (forward * eventchase_current_distance));
                        WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, this);
  
                        // If the boxtrace fails, revert back to line tracing.
                        if(!local_player.viewloc)
                        if(trace_startsolid)
                        {
 -                              eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
 +                              eventchase_target_origin = (current_view_origin - (forward * eventchase_current_distance));
                                WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
 -                              setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z)));
 +                              setproperty(VF_ORIGIN, (trace_endpos - (forward * autocvar_cl_eventchase_mins.z)));
                        }
                        else { setproperty(VF_ORIGIN, trace_endpos); }
  
        // Render the Scene
        view_origin = getpropertyvec(VF_ORIGIN);
        view_angles = getpropertyvec(VF_ANGLES);
 -      MAKEVECTORS(makevectors, view_angles, view_forward, view_right, view_up);
 +      MAKE_VECTORS(view_angles, view_forward, view_right, view_up);
  
  #ifdef BLURTEST
        if(time > blurtest_time0 && time < blurtest_time1)
                setproperty(VF_ORIGIN, '0 0 0');
                setproperty(VF_ANGLES, '0 0 0');
                setproperty(VF_PERSPECTIVE, 1);
 -              makevectors('0 0 0');
 +              vector forward, right, up;
 +              MAKE_VECTORS('0 0 0', forward, right, up);
                vector v1, v2;
                cvar_set("vid_conwidth", "800");
                cvar_set("vid_conheight", "600");
 -              v1 = cs_project(v_forward);
 +              v1 = cs_project(forward);
                cvar_set("vid_conwidth", "640");
                cvar_set("vid_conheight", "480");
 -              v2 = cs_project(v_forward);
 +              v2 = cs_project(forward);
                if(v1 == v2)
                        cs_project_is_b0rked = 1;
                else
index 36a804b1d4a3504e87d504a22827ca48c245e15a,74420b3335b2f5513ff9ac045b626412ddb62d2d..4f50165080601983f2e7da63552539a220b6e74d
@@@ -51,14 -51,14 +51,14 @@@ void W_SetupShot_Dir_ProjectileSize_Ran
                WarpZone_TraceLine(ent.origin + ent.view_ofs, ent.origin + ent.view_ofs + s_forward * range, MOVE_NOMONSTERS, ent);
        ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
  
 -      vector vf, vr, vu;
 -      vf = v_forward;
 -      vr = v_right;
 -      vu = v_up;
 +      vector forward, right, up;
 +      forward = v_forward;
 +      right = v_right;
 +      up = v_up;
        w_shotend = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); // warpzone support
 -      v_forward = vf;
 -      v_right = vr;
 -      v_up = vu;
 +      v_forward = forward;
 +      v_right = right;
 +      v_up = up;
  
        // un-adjust trueaim if shotend is too close
        if(vdist(w_shotend - (ent.origin + ent.view_ofs), <, autocvar_g_trueaim_minrange))
                accuracy_add(ent, wep, maxdamage, 0);
  
        if(IS_PLAYER(ent))
 -              W_HitPlotAnalysis(ent, wep, v_forward, v_right, v_up);
 +              W_HitPlotAnalysis(ent, wep, forward, right, up);
  
        vector md = ent.(weaponentity).movedir;
        vector vecs = ((md.x > 0) ? md : '0 0 0');
  
        // TODO this is broken - see 637056bea7bf7f5c9c0fc6113e94731a2767476 for an attempted fix
        // which fixes issue #1957 but causes #2129
 -      vector dv = v_right * -vecs.y + v_up * vecs.z;
 +      vector dv = right * -vecs.y + up * vecs.z;
        w_shotorg = ent.origin + ent.view_ofs + dv;
  
        // now move the shotorg forward as much as requested if possible
        if(antilag)
        {
                if(CS(ent).antilag_debug)
 -                      tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent, CS(ent).antilag_debug);
 +                      tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent, CS(ent).antilag_debug);
                else
 -                      tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
 +                      tracebox_antilag(ent, w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
        }
        else
 -              tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent);
 -      w_shotorg = trace_endpos - v_forward * nudge;
 +              tracebox(w_shotorg, mi, ma, w_shotorg + forward * (vecs.x + nudge), MOVE_NORMAL, ent);
 +      w_shotorg = trace_endpos - forward * nudge;
        // calculate the shotdir from the chosen shotorg
        if(W_DualWielding(ent))
                w_shotdir = s_forward;
@@@ -216,7 -216,7 +216,7 @@@ void FireRailgunBullet (entity this, .e
        entity pseudoprojectile = NULL;
  
        vector dir = normalize(end - start);
-       float length = vlen(end - start);
+       //float max_length = vlen(end - start);
        vector force = dir * bforce;
  
        // go a little bit into the wall because we need to hit this wall later
        //explosion = spawn();
  
        // Find all non-hit players the beam passed close by
+       float length = vlen(trace_endpos - start);
        if(deathtype == WEP_VAPORIZER.m_id || deathtype == WEP_VORTEX.m_id) // WEAPONTODO
        {
                FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != this, {
-                       if(!it.railgunhit)
-                       if(!(IS_SPEC(it) && it.enemy == this))
+                       if (!it.railgunhit && !(IS_SPEC(it) && it.enemy == this))
                        {
-                               msg_entity = it;
                                // nearest point on the beam
-                               vector beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length);
+                               vector beampos = start + dir * bound(0, (it.origin - start) * dir, length);
  
-                               float f = bound(0, 1 - vlen(beampos - msg_entity.origin) / 512, 1);
+                               float f = bound(0, 1 - vlen(beampos - it.origin) / 512, 1);
                                if(f <= 0)
                                        continue;
  
                                if(!pseudoprojectile)
                                        pseudoprojectile = spawn(); // we need this so the sound uses the "entchannel4" volume
+                               msg_entity = it;
                                soundtoat(MSG_ONE, pseudoprojectile, beampos, CH_SHOTS, SND(NEXWHOOSH_RANDOM()), VOL_BASE * f, ATTEN_NONE);
                        }
                });