]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
declare vars explicitly
authorMartin Taibr <taibr.martin@gmail.com>
Mon, 1 Jul 2019 19:47:34 +0000 (21:47 +0200)
committerMartin Taibr <taibr.martin@gmail.com>
Mon, 1 Jul 2019 19:47:34 +0000 (21:47 +0200)
16 files changed:
qcsrc/client/teamradar.qc
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/damagetext/cl_damagetext.qc
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/ecs/systems/physics.qc
qcsrc/lib/csqcmodel/interpolate.qc
qcsrc/lib/deglobalization.qh
qcsrc/lib/warpzone/anglestransform.qc
qcsrc/lib/warpzone/anglestransform.qh
qcsrc/lib/warpzone/common.qc
qcsrc/lib/warpzone/server.qc
qcsrc/lib/warpzone/util_server.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/weaponsystem.qc

index b21e52ab42c2cd6f7bd32d746a6218d6c8c1ac79..c565651d4a3a0b49daee81ae6a76649b60889d66 100644 (file)
@@ -93,7 +93,8 @@ void draw_teamradar_player(vector coord3d, vector pangles, vector rgb)
 
        coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(coord3d));
 
-       MAKE_VECTORS_NEW(pangles - '0 1 0' * teamradar_angle, forward, right, up);
+       vector forward, right, up;
+       MAKE_VECTORS(pangles - '0 1 0' * teamradar_angle, forward, right, up);
        if(v_flipped)
        {
                forward.x = -forward.x;
index 13c766f471640512e478205e4f123b7d8714e4a0..b5a5e8ad02df5e2ee0a6520e42b3455adafe881c 100644 (file)
@@ -133,7 +133,8 @@ void calc_followmodel_ofs(entity view)
                vel = view.velocity;
        else
        {
-               MAKE_VECTORS_NEW(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;
@@ -158,7 +159,8 @@ void calc_followmodel_ofs(entity view)
        if (autocvar_cl_followmodel_velocity_absolute)
        {
                vector fixed_gunorg;
-               MAKE_VECTORS_NEW(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;
@@ -415,7 +417,8 @@ void Porto_Draw(entity this)
 
                vector pos = view_origin;
                vector dir = view_forward;
-               MAKE_VECTORS_NEW(autocvar_chase_active ? warpzone_save_view_angles : view_angles, forward, right, up);
+               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;
 
@@ -569,7 +572,8 @@ vector GetCurrentFov(float fov)
                        curspeed = 0;
                else
                {
-                       MAKE_VECTORS_NEW(view_angles, forward, right, up);
+                       vector forward, right, up;
+                       MAKE_VECTORS(view_angles, forward, right, up);
                        v = pmove_vel;
                        if(csqcplayer)
                                v = csqcplayer.velocity;
@@ -1808,7 +1812,8 @@ void CSQC_UpdateView(entity this, float w, float h)
                        else if(eventchase_current_distance != chase_distance)
                                eventchase_current_distance = chase_distance;
 
-                       MAKE_VECTORS_NEW(view_angles, forward, right, up);
+                       vector forward, right, up;
+                       MAKE_VECTORS(view_angles, forward, right, up);
 
                        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);
@@ -2497,7 +2502,8 @@ void CSQC_UpdateView(entity this, float w, float h)
                setproperty(VF_ORIGIN, '0 0 0');
                setproperty(VF_ANGLES, '0 0 0');
                setproperty(VF_PERSPECTIVE, 1);
-               MAKE_VECTORS_NEW('0 0 0', forward, right, up);
+               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");
index c2fdb6229185720994c4db2687dd031c93077b84..899c6d63c1284fce107e2a348ab482d731d620ab 100644 (file)
@@ -74,7 +74,8 @@ CLASS(DamageText, Object)
         if (this.m_screen_coords) {
             screen_pos = this.origin + since_hit * autocvar_cl_damagetext_2d_velocity;
         } else {
-            MAKE_VECTORS_NEW(view_angles, forward, right, up);
+            vector forward, right, up;
+            MAKE_VECTORS(view_angles, forward, right, up);
             vector world_offset = since_hit * autocvar_cl_damagetext_velocity_world + autocvar_cl_damagetext_offset_world;
             vector world_pos = this.origin + world_offset.x * forward + world_offset.y * right + world_offset.z * up;
             screen_pos = project_3d_to_2d(world_pos) + since_hit * autocvar_cl_damagetext_velocity_screen + autocvar_cl_damagetext_offset_screen;
index 6d645cc43209f4355b907c7b1df4ad2ab76e363e..652f7a2b7b8e9aa7c4a19d7f5832cd769224aed2 100644 (file)
@@ -180,7 +180,8 @@ bool PM_dodging_checkpressedkeys(entity this)
        if ((time - this.last_dodging_time) < PHYS_DODGING_DELAY)
                return false;
 
-       MAKE_VECTORS_NEW(this.angles, forward, right, up);
+       vector forward, right, up;
+       MAKE_VECTORS(this.angles, forward, right, up);
 
        bool can_dodge = (is_close_to_ground(this, PHYS_DODGING_HEIGHT_THRESHOLD, up) && (PHYS_DODGING_MAXSPEED == 0 || vdist(this.velocity, <, PHYS_DODGING_MAXSPEED)));
        bool can_wall_dodge = (PHYS_DODGING_WALL && is_close_to_wall(this, PHYS_DODGING_DISTANCE_THRESHOLD, forward, right));
@@ -221,7 +222,7 @@ void PM_dodging(entity this)
                return;
        }
 
-       vector forward = '0 0 0', right = '0 0 0', up = '0 0 0';
+       vector forward, right, up;
        if(PHYS_DODGING_AIR)
                MAKE_VECTORS(this.v_angle, forward, right, up);
        else
index 8fe3a4866e941f66e4abd5ac0aac183f25fc7151..9b1dd6c0b8536b31029d7c87771d4806a6a9ee3b 100644 (file)
@@ -663,7 +663,8 @@ void Draw_Shockwave(entity this)
        // WEAPONTODO: trace to find what we actually hit
        vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
 
-       VECTOR_VECTORS_NEW(this.sw_shotdir, _forward, right, up);
+       vector _forward, right, up;
+       VECTOR_VECTORS(this.sw_shotdir, _forward, right, up);
 
        // WEAPONTODO: combine and simplify these calculations
        vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
index 2fbb9d9d02862d1fe86712700987b759b96c8ae3..f73ade3d12ea58ea6f5652554909505c0a335f79 100644 (file)
@@ -193,7 +193,8 @@ void sys_phys_simulate(entity this, float dt)
                // this mimics quakeworld code
                if (this.com_in_jump && this.waterlevel == WATERLEVEL_SWIMMING && this.velocity_z >= -180 && !this.viewloc) {
                        vector yawangles = '0 1 0' * this.v_angle.y;
-                       MAKE_VECTORS_NEW(yawangles, forward, right, up);
+                       vector forward, right, up;
+                       MAKE_VECTORS(yawangles, forward, right, up);
                        vector spot = this.origin + 24 * forward;
                        spot_z += 8;
                        traceline(spot, spot, MOVE_NOMONSTERS, this);
@@ -210,7 +211,8 @@ void sys_phys_simulate(entity this, float dt)
                }
        }
 
-       MAKE_VECTORS_NEW(vmul(this.v_angle, (this.com_phys_vel_2d ? '0 1 0' : '1 1 1')), forward, right, up);
+       vector forward, right, up;
+       MAKE_VECTORS(vmul(this.v_angle, (this.com_phys_vel_2d ? '0 1 0' : '1 1 1')), forward, right, up);
        // wishvel = forward * PHYS_CS(this).movement.x + right * PHYS_CS(this).movement.y + up * PHYS_CS(this).movement.z;
        vector wishvel = forward * PHYS_CS(this).movement.x
            + right * PHYS_CS(this).movement.y
index b58158fbfeae2870f2fb84329e0dcc606ffc6047..7600fdde606f5d7a5c6733c0f2822b448140d806 100644 (file)
@@ -58,7 +58,8 @@ void InterpolateOrigin_Note(entity this)
 
        if (this.iflags & IFLAG_ANGLES)
        {
-               FIXED_MAKE_VECTORS_NEW(this.angles, forward, right, up);
+               vector forward, right, up;
+               FIXED_MAKE_VECTORS(this.angles, forward, right, up);
                if (f0 & IFLAG_VALID)
                {
                        this.iforward1 = this.iforward2;
@@ -75,7 +76,8 @@ void InterpolateOrigin_Note(entity this)
 
        if (this.iflags & IFLAG_V_ANGLE)
        {
-               FIXED_MAKE_VECTORS_NEW(this.v_angle, forward, right, up);
+               vector forward, right, up;
+               FIXED_MAKE_VECTORS(this.v_angle, forward, right, up);
                if (f0 & IFLAG_VALID)
                {
                        this.ivforward1 = this.ivforward2;
index 55dbbe525d14127bb868840d42fdc42036aa894e..3d7f82067440137e64db91a8bc7c78cf53c5ca37 100644 (file)
@@ -40,11 +40,6 @@ STATIC_INIT(globals) {
        CLEAR_V_GLOBALS(); \
 MACRO_END
 
-/// Same as `MAKE_VECTORS` but also creates the locals for convenience.
-#define MAKE_VECTORS_NEW(angles, forward, right, up) \
-       vector forward = '0 0 0', right = '0 0 0', up = '0 0 0'; \
-       MAKE_VECTORS(angles, forward, right, up);
-
 /// Returns all 4 vectors by assigning to them (instead of returning a value) for consistency (and sanity)
 #define SKEL_GET_BONE_ABS(skel, bonenum, forward, right, up, origin) MACRO_BEGIN \
        origin = _skel_get_boneabs_hidden(skel, bonenum) \
@@ -52,10 +47,6 @@ MACRO_END
        CLEAR_V_GLOBALS(); \
 MACRO_END
 
-#define SKEL_GET_BONE_ABS_NEW(skel, bonenum, forward, right, up, origin) \
-       vector forward = '0 0 0', right = '0 0 0', up = '0 0 0', origin = '0 0 0'; \
-       SKEL_GET_BONE_ABS(skel, bonenum, forward, right, up, origin)
-
 #define SKEL_SET_BONE(skel, bonenum, org, forward, right, up) MACRO_BEGIN \
        SET_V_GLOBALS(forward, right, up); \
        _skel_set_bone_hidden(skel, bonenum, org); \
@@ -74,17 +65,9 @@ MACRO_END
        CLEAR_V_GLOBALS(); \
 MACRO_END
 
-#define VECTOR_VECTORS_NEW(forward_in, forward, right, up) \
-       vector forward = '0 0 0', right = '0 0 0', up = '0 0 0'; \
-       VECTOR_VECTORS(forward_in, forward, right, up);
-
 /// Note that this only avoids the v_* globals, not the gettaginfo_* ones
 #define GET_TAG_INFO(ent, tagindex, forward, right, up, origin) MACRO_BEGIN \
        origin = _gettaginfo_hidden(ent, tagindex); \
        GET_V_GLOBALS(forward, right, up); \
        CLEAR_V_GLOBALS(); \
 MACRO_END
-
-#define GET_TAG_INFO_NEW(ent, tagindex, forward, right, up, origin) \
-       vector forward = '0 0 0', right = '0 0 0', up = '0 0 0', origin = '0 0 0'; \
-       GET_TAG_INFO(ent, tagindex, forward, right, up, origin);
index f5ec6730a82bb0289914578666bbedc57b97e5a1..76e8d37f9a668c92bdb4e1b7ea79e010973b5e39 100644 (file)
@@ -4,13 +4,15 @@
 // angles in fixedmakevectors/fixedvectoangles space
 vector AnglesTransform_Apply(vector transform, vector v)
 {
-       FIXED_MAKE_VECTORS_NEW(transform, forward, right, up);
+       vector forward, right, up;
+       FIXED_MAKE_VECTORS(transform, forward, right, up);
        return forward * v.x + right * (-v.y) + up * v.z;
 }
 
 vector AnglesTransform_Multiply(vector t1, vector t2)
 {
-       FIXED_MAKE_VECTORS_NEW(t2, forward, right, up);
+       vector forward, right, up;
+       FIXED_MAKE_VECTORS(t2, forward, right, up);
        forward = AnglesTransform_Apply(t1, forward);
        up = AnglesTransform_Apply(t1, up);
        return fixedvectoangles2(forward, up);
@@ -19,7 +21,8 @@ vector AnglesTransform_Multiply(vector t1, vector t2)
 vector AnglesTransform_Invert(vector transform)
 {
        vector i_forward, i_up;
-       FIXED_MAKE_VECTORS_NEW(transform, forward, right, up);
+       vector forward, right, up;
+       FIXED_MAKE_VECTORS(transform, forward, right, up);
        // we want angles that turn forward into '1 0 0', right into '0 1 0' and up into '0 0 1'
        // but these are orthogonal unit vectors!
        // so to invert, we can simply fixedvectoangles the TRANSPOSED matrix
index c11a63185f8090d3348d1cc7e720f30751cc2d4e..92362f982fee1590b31c6340b7d576d4bcd7f68e 100644 (file)
@@ -7,7 +7,6 @@
 #if POSITIVE_PITCH_IS_DOWN
     #define fixedmakevectors makevectors
     #define FIXED_MAKE_VECTORS MAKE_VECTORS
-    #define FIXED_MAKE_VECTORS_NEW MAKE_VECTORS_NEW
     noref vector _fixedvectoangles;
     #define fixedvectoangles(a) (_fixedvectoangles = vectoangles(a), _fixedvectoangles.x *= -1, _fixedvectoangles)
     noref vector _fixedvectoangles2;
@@ -24,9 +23,6 @@
         GET_V_GLOBALS(forward, right, up); \
         CLEAR_V_GLOBALS(); \
     MACRO_END
-    #define FIXED_MAKE_VECTORS_NEW(angles, forward, right, up) \
-        VECS_NEW(forward, right, up); \
-        FIXED_MAKE_VECTORS(angles, forward, right, up);
     #define fixedvectoangles2 vectoangles2
     #define fixedvectoangles vectoangles
 #endif
index a787e6f93750390566835b6139423dfbdb96975a..25206fca863d3b6f19f17cccddb58e6e44182da8 100644 (file)
@@ -71,7 +71,8 @@ void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, ve
        e.warpzone_targetorigin = other_org;
        e.warpzone_angles = my_ang;
        e.warpzone_targetangles = other_ang;
-       FIXED_MAKE_VECTORS_NEW(my_ang, forward, right, up);
+       vector forward, right, up;
+       FIXED_MAKE_VECTORS(my_ang, forward, right, up);
        e.warpzone_forward = forward;
        FIXED_MAKE_VECTORS(other_ang, forward, right, up);
        e.warpzone_targetforward = forward;
index 780968375e4851bb661225060227104f0de362f2..0244b40a9d724c33713d95e4b694cce4b6f84849 100644 (file)
@@ -602,7 +602,8 @@ void WarpZone_InitStep_UpdateTransform(entity this)
                if(area > 0)
                {
                        org = org - ((org - point) * norm) * norm; // project to plane
-                       MAKE_VECTORS_NEW(ang, forward, right, up);
+                       vector forward, right, up;
+                       MAKE_VECTORS(ang, forward, right, up);
                        if(norm * forward < 0)
                        {
                                LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.");
index f09fecc3370d79cb2e69d8fbfc630b7530ae559f..658716052f6e9d0f2865a12808328b4bb2e74870 100644 (file)
@@ -15,7 +15,8 @@ void WarpZoneLib_ExactTrigger_Init(entity this)
        if (this.movedir == '0 0 0')
        if (this.angles != '0 0 0')
        {
-               MAKE_VECTORS_NEW(this.angles, forward, _r, _u);
+               vector forward, _r, _u;
+               MAKE_VECTORS(this.angles, forward, _r, _u);
                this.movedir = forward;
        }
        if(this.model == "")
index 3b5161a68eff40564bba4060204f67d6a3b8cc0e..9e2565144b3499e89f710c36ded6451b5725bcec 100644 (file)
@@ -118,7 +118,8 @@ void relocate_spawnpoint(entity this)
     if (autocvar_r_showbboxes)
     {
         // show where spawnpoints point at too
-        MAKE_VECTORS_NEW(this.angles, forward, right, up);
+        vector forward, right, up;
+        MAKE_VECTORS(this.angles, forward, right, up);
         entity e = new(info_player_foo);
         setorigin(e, this.origin + forward * 24);
         setsize(e, '-8 -8 -8', '8 8 8');
index 9de0045cf6f4fe887780f46d86789cde0e089e88..36a804b1d4a3504e87d504a22827ca48c245e15a 100644 (file)
@@ -51,7 +51,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect
                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 forward = '0 0 0', right = '0 0 0', up = '0 0 0';
+       vector forward, right, up;
        forward = v_forward;
        right = v_right;
        up = v_up;
index 936b64f2ba71b50743739c9afbfa52c1db92fb5b..5702c2e3c1bcef94c7b5ecd5ad95c30341dfdb38 100644 (file)
@@ -499,7 +499,8 @@ void W_WeaponFrame(Player actor, .entity weaponentity)
                return;
        }
 
-       MAKE_VECTORS_NEW(actor.v_angle, fo, ri, up);
+       vector fo, ri, up;
+       MAKE_VECTORS(actor.v_angle, fo, ri, up);
 
        // Change weapon
        if (this.m_weapon != this.m_switchweapon)