refactor: un-magic #define INVUL_RADIUS 42

This commit is contained in:
WofWca authored and Tim Angus committed 2025-11-18 14:06:59 +00:00
1 parent db533030ea
commit e3881a4d70
4 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -1252,8 +1252,8 @@ static void PM_CheckDuck (void)
if ( pm->ps->powerups[PW_INVULNERABILITY] ) {
if ( pm->ps->pm_flags & PMF_INVULEXPAND ) {
// invulnerability sphere has a 42 units radius
VectorSet( pm->mins, -42, -42, -42 );
VectorSet( pm->maxs, 42, 42, 42 );
VectorSet( pm->mins, -INVUL_RADIUS, -INVUL_RADIUS, -INVUL_RADIUS );
VectorSet( pm->maxs, INVUL_RADIUS, INVUL_RADIUS, INVUL_RADIUS );
}
else {
VectorSet( pm->mins, -PLAYER_WIDTH, -PLAYER_WIDTH, MINS_Z );
+1
View File
@@ -54,6 +54,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define CROUCH_VIEWHEIGHT 12
#define DEAD_HEIGHT -8
#define DEAD_VIEWHEIGHT -16
#define INVUL_RADIUS 42
//
// config strings are a general means of communicating variable length strings
+2 -2
View File
@@ -879,8 +879,8 @@ void ClientThink_real( gentity_t *ent ) {
// check for invulnerability expansion before doing the Pmove
if (client->ps.powerups[PW_INVULNERABILITY] ) {
if ( !(client->ps.pm_flags & PMF_INVULEXPAND) ) {
vec3_t mins = { -42, -42, -42 };
vec3_t maxs = { 42, 42, 42 };
vec3_t mins = { -INVUL_RADIUS, -INVUL_RADIUS, -INVUL_RADIUS };
vec3_t maxs = { INVUL_RADIUS, INVUL_RADIUS, INVUL_RADIUS };
vec3_t oldmins, oldmaxs;
VectorCopy (ent->r.mins, oldmins);
+1 -2
View File
@@ -753,8 +753,7 @@ int G_InvulnerabilityEffect( gentity_t *targ, vec3_t dir, vec3_t point, vec3_t i
}
VectorCopy(dir, vec);
VectorInverse(vec);
// sphere model radius = 42 units
n = RaySphereIntersections( targ->client->ps.origin, 42, point, vec, intersections);
n = RaySphereIntersections( targ->client->ps.origin, INVUL_RADIUS, point, vec, intersections);
if (n > 0) {
impact = G_TempEntity( targ->client->ps.origin, EV_INVUL_IMPACT );
VectorSubtract(intersections[0], targ->client->ps.origin, vec);