engine: move pm_debug particle functions to client, as they are never used on server

This commit is contained in:
Alibek Omarov 2024-10-14 19:11:26 +03:00
parent fdf82e5270
commit bf8b709372
3 changed files with 70 additions and 101 deletions

View file

@ -32,6 +32,9 @@ static particle_t *cl_particles = NULL; // particle pool
static vec3_t cl_avelocities[NUMVERTEXNORMALS]; static vec3_t cl_avelocities[NUMVERTEXNORMALS];
static float cl_lasttimewarn = 0.0f; static float cl_lasttimewarn = 0.0f;
// expand debugging BBOX particle hulls by this many units.
#define BOX_GAP 0.0f
/* /*
================ ================
R_LookupColor R_LookupColor
@ -1601,6 +1604,73 @@ void GAME_EXPORT R_RocketTrail( vec3_t start, vec3_t end, int type )
} }
} }
/*
===============
PM_ParticleLine
draw line from particles
================
*/
static void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel )
{
float len, curdist;
vec3_t diff, pos;
// determine distance
VectorSubtract( end, start, diff );
len = VectorNormalizeLength( diff );
curdist = 0;
while( curdist <= len )
{
VectorMA( start, curdist, diff, pos );
CL_Particle( pos, pcolor, life, 0, zvel );
curdist += 2.0f;
}
}
/*
================
PM_DrawRectangle
================
*/
static void PM_DrawRectangle( const vec3_t tl, const vec3_t bl, const vec3_t tr, const vec3_t br, int pcolor, float life )
{
PM_ParticleLine( tl, bl, pcolor, life, 0 );
PM_ParticleLine( bl, br, pcolor, life, 0 );
PM_ParticleLine( br, tr, pcolor, life, 0 );
PM_ParticleLine( tr, tl, pcolor, life, 0 );
}
/*
================
PM_DrawBBox
================
*/
static void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life )
{
vec3_t p[8], tmp;
float gap = BOX_GAP;
int i;
for( i = 0; i < 8; i++ )
{
tmp[0] = (i & 1) ? mins[0] - gap : maxs[0] + gap;
tmp[1] = (i & 2) ? mins[1] - gap : maxs[1] + gap ;
tmp[2] = (i & 4) ? mins[2] - gap : maxs[2] + gap ;
VectorAdd( tmp, origin, tmp );
VectorCopy( tmp, p[i] );
}
for( i = 0; i < 6; i++ )
{
PM_DrawRectangle( p[boxpnt[i][1]], p[boxpnt[i][0]], p[boxpnt[i][2]], p[boxpnt[i][3]], pcolor, life );
}
}
/* /*
================ ================
R_ParticleLine R_ParticleLine

View file

@ -1,95 +0,0 @@
/*
pm_debug.c - player move debugging code
Copyright (C) 2017 Uncle Mike
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include "common.h"
#include "xash3d_mathlib.h"
#include "pm_local.h"
#if !XASH_DEDICATED
#include "client.h" // CL_Particle
#endif
// expand debugging BBOX particle hulls by this many units.
#define BOX_GAP 0.0f
/*
===============
PM_ParticleLine
draw line from particles
================
*/
void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel )
{
#if !XASH_DEDICATED
float len, curdist;
vec3_t diff, pos;
// determine distance
VectorSubtract( end, start, diff );
len = VectorNormalizeLength( diff );
curdist = 0;
while( curdist <= len )
{
VectorMA( start, curdist, diff, pos );
CL_Particle( pos, pcolor, life, 0, zvel );
curdist += 2.0f;
}
#endif // XASH_DEDICATED
}
/*
================
PM_DrawRectangle
================
*/
static void PM_DrawRectangle( const vec3_t tl, const vec3_t bl, const vec3_t tr, const vec3_t br, int pcolor, float life )
{
PM_ParticleLine( tl, bl, pcolor, life, 0 );
PM_ParticleLine( bl, br, pcolor, life, 0 );
PM_ParticleLine( br, tr, pcolor, life, 0 );
PM_ParticleLine( tr, tl, pcolor, life, 0 );
}
/*
================
PM_DrawBBox
================
*/
void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life )
{
#if !XASH_DEDICATED
vec3_t p[8], tmp;
float gap = BOX_GAP;
int i;
for( i = 0; i < 8; i++ )
{
tmp[0] = (i & 1) ? mins[0] - gap : maxs[0] + gap;
tmp[1] = (i & 2) ? mins[1] - gap : maxs[1] + gap ;
tmp[2] = (i & 4) ? mins[2] - gap : maxs[2] + gap ;
VectorAdd( tmp, origin, tmp );
VectorCopy( tmp, p[i] );
}
for( i = 0; i < 6; i++ )
{
PM_DrawRectangle( p[boxpnt[i][1]], p[boxpnt[i][0]], p[boxpnt[i][2]], p[boxpnt[i][3]], pcolor, life );
}
#endif // XASH_DEDICATED
}

View file

@ -20,12 +20,6 @@ GNU General Public License for more details.
typedef int (*pfnIgnore)( physent_t *pe ); // custom trace filter typedef int (*pfnIgnore)( physent_t *pe ); // custom trace filter
//
// pm_debug.c
//
void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel );
void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life );
// //
// pm_trace.c // pm_trace.c
// //