From d325a439c88154aa1f827bf274cc1b45fa46e5dc Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sat, 1 Dec 2018 01:09:37 +0100 Subject: [PATCH] kill useless semicolons and NEW_VECS --- .../mutators/mutator/dodging/sv_dodging.qc | 2 +- .../sv_spawn_near_teammate.qc | 2 +- qcsrc/lib/deglobalization.qh | 22 ++++++++----------- qcsrc/server/weapons/tracing.qc | 2 +- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc index 0378ed7ed..6d645cc43 100644 --- a/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc +++ b/qcsrc/common/mutators/mutator/dodging/sv_dodging.qc @@ -221,7 +221,7 @@ void PM_dodging(entity this) return; } - NEW_VECS(forward, right, up); + vector forward = '0 0 0', right = '0 0 0', up = '0 0 0'; if(PHYS_DODGING_AIR) MAKE_VECTORS(this.v_angle, forward, right, up); else diff --git a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc index 523254770..8952bd6e5 100644 --- a/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc +++ b/qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc @@ -103,7 +103,7 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn) vector horiz_vel = vec2(it.velocity); // when walking slowly sideways, we assume the player wants a clear shot ahead - spawn behind him according to where he's looking // when running fast, spawn behind him according to his direction of movement to prevent colliding with the newly spawned player - NEW_VECS(forward, right, up); + vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0'; if (vdist(horiz_vel, >, autocvar_sv_maxspeed + 50)) { FIXED_MAKE_VECTORS(vectoangles(horiz_vel), forward, right, up); diff --git a/qcsrc/lib/deglobalization.qh b/qcsrc/lib/deglobalization.qh index fb4512653..bd43ab119 100644 --- a/qcsrc/lib/deglobalization.qh +++ b/qcsrc/lib/deglobalization.qh @@ -11,17 +11,13 @@ // - RF_USEAXIS, addentities, predraw, // - CL_GetEntityMatrix (in engine but is called from other functions so transitively any of them can use the globals - e.g. V_CalcRefdef, maybe others) // - however RF_USEAXIS is only used if MF_ROTATE is used which is only set in one place -// - e.camera_transform / CL_VM_TransformView (in engine +// - e.camera_transform / CL_VM_TransformView (in engine) // - this is the only used function that both sets and gets the globals (aim does too but isn't used in our code) -#define NEW_VECS(...) EVAL(OVERLOAD(NEW_VECS, __VA_ARGS__)) -#define NEW_VECS_3(forward, right, up) vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0' -#define NEW_VECS_4(forward, right, up, origin) NEW_VECS_3(forward, right, up); vector origin = '0 0 0' - -// convenience for deglobalized code - don't use these just to hide that globals are still used -#define CLEAR_V_GLOBALS() v_forward = VEC_NAN; v_right = VEC_NAN; v_up = VEC_NAN; -#define GET_V_GLOBALS(forward, right, up) forward = v_forward; right = v_right; up = v_up; -#define SET_V_GLOBALS(forward, right, up) v_forward = forward; v_right = right; v_up = up; +// convenience for deglobalization code - don't use these just to hide that globals are still used +#define CLEAR_V_GLOBALS() v_forward = VEC_NAN; v_right = VEC_NAN; v_up = VEC_NAN +#define GET_V_GLOBALS(forward, right, up) forward = v_forward; right = v_right; up = v_up +#define SET_V_GLOBALS(forward, right, up) v_forward = forward; v_right = right; v_up = up #ifdef GAMEQC STATIC_INIT(globals) { @@ -46,7 +42,7 @@ STATIC_INIT(globals) { /// Same as `MAKE_VECTORS` but also creates the locals for convenience. #define MAKE_VECTORS_NEW(angles, forward, right, up) \ - NEW_VECS(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) @@ -57,7 +53,7 @@ STATIC_INIT(globals) { } MACRO_END #define SKEL_GET_BONE_ABS_NEW(skel, bonenum, forward, right, up, origin) \ - NEW_VECS(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 { \ @@ -79,7 +75,7 @@ STATIC_INIT(globals) { } MACRO_END #define VECTOR_VECTORS_NEW(forward_in, forward, right, up) \ - NEW_VECS(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 @@ -90,5 +86,5 @@ STATIC_INIT(globals) { } MACRO_END #define GET_TAG_INFO_NEW(ent, tagindex, forward, right, up, origin) \ - NEW_VECS(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); diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index 56aa5abe4..9de0045cf 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -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; - NEW_VECS(forward, right, up); + vector forward = '0 0 0', right = '0 0 0', up = '0 0 0'; forward = v_forward; right = v_right; up = v_up; -- 2.39.2