From: Mario Date: Tue, 5 May 2015 11:04:44 +0000 (+1000) Subject: Add constants for player hitbox, for use in a couple of places where varying size... X-Git-Tag: xonotic-v0.8.1~38^2~9 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=39e61941c1b22f4cd10cef4a65c83a8a16163d30 Add constants for player hitbox, for use in a couple of places where varying size can break things --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index a3527366d5..121438e29f 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -667,7 +667,7 @@ void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint if(is_new) { self.origin = spn_origin; - setsize(self, '-16 -16 -24', '16 16 45'); + setsize(self, PL_MIN_CONST, PL_MAX_CONST); droptofloor(); /*if(autocvar_cl_spawn_point_model) // needs a model first diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index d7e89fac29..680746c631 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -312,7 +312,7 @@ const int SERVERFLAG_ALLOW_FULLBRIGHT = 1; const int SERVERFLAG_TEAMPLAY = 2; const int SERVERFLAG_PLAYERSTATS = 4; -// FIXME/EXPLAINME: why? +// FIXME/EXPLAINME: why? Mario: because vector autocvar_sv_player_maxs = '16 16 45'; vector autocvar_sv_player_mins = '-16 -16 -24'; vector autocvar_sv_player_viewoffset = '0 0 20'; @@ -322,6 +322,7 @@ vector autocvar_sv_player_crouch_viewoffset = '0 0 20'; vector autocvar_sv_player_headsize = '24 24 12'; +// not so constant #ifdef SVQC #define PL_VIEW_OFS autocvar_sv_player_viewoffset #define PL_MIN autocvar_sv_player_mins @@ -339,6 +340,10 @@ vector autocvar_sv_player_headsize = '24 24 12'; #define PL_CROUCH_MAX vec3(getstatf(STAT_PL_CROUCH_MAX1), getstatf(STAT_PL_CROUCH_MAX2), getstatf(STAT_PL_CROUCH_MAX3)) #endif +// a bit more constant +const vector PL_MAX_CONST = '16 16 45'; +const vector PL_MIN_CONST = '-16 -16 -24'; + // spawnpoint prios const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200; const int SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100; diff --git a/qcsrc/server/mutators/gamemode_ctf.qh b/qcsrc/server/mutators/gamemode_ctf.qh index a22846c40b..faf12a4fe7 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qh +++ b/qcsrc/server/mutators/gamemode_ctf.qh @@ -16,8 +16,8 @@ const int SP_CTF_FCKILLS = 8; const int SP_CTF_RETURNS = 9; // flag constants // for most of these, there is just one question to be asked: WHYYYYY? -#define FLAG_MIN ('-16 -16 -24' + '0 0 -13') -#define FLAG_MAX ('16 16 45' + '0 0 -13') +#define FLAG_MIN (PL_MIN_CONST + '0 0 -13') +#define FLAG_MAX (PL_MAX_CONST + '0 0 -13') const float FLAG_SCALE = 0.6; @@ -27,7 +27,7 @@ const float WPFE_THINKRATE = 0.5; const vector FLAG_DROP_OFFSET = ('0 0 32'); const vector FLAG_CARRY_OFFSET = ('-16 0 8'); -#define FLAG_SPAWN_OFFSET ('0 0 1' * (45 - 13)) +#define FLAG_SPAWN_OFFSET ('0 0 1' * (PL_MAX_CONST.z - 13)) const vector FLAG_WAYPOINT_OFFSET = ('0 0 64'); const vector FLAG_FLOAT_OFFSET = ('0 0 32'); const vector FLAG_PASS_ARC_OFFSET = ('0 0 -10'); diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 637945608d..089e80a894 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -68,13 +68,13 @@ void relocate_spawnpoint() // nudge off the floor setorigin(self, self.origin + '0 0 1'); - tracebox(self.origin, PL_MIN, PL_MAX, self.origin, true, self); + tracebox(self.origin, PL_MIN_CONST, PL_MAX_CONST, self.origin, true, self); if (trace_startsolid) { vector o; o = self.origin; - self.mins = PL_MIN; - self.maxs = PL_MAX; + self.mins = PL_MIN_CONST; + self.maxs = PL_MAX_CONST; if (!move_out_of_solid(self)) objerror("could not get out of solid at all!"); print("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1'));