2018-04-13 18:23:45 +02:00
|
|
|
/*
|
|
|
|
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"
|
2020-02-10 11:07:06 +01:00
|
|
|
#include "xash3d_mathlib.h"
|
2018-04-13 18:23:45 +02:00
|
|
|
#include "pm_local.h"
|
2019-11-24 01:52:08 +01:00
|
|
|
#if !XASH_DEDICATED
|
2019-03-15 19:23:59 +01:00
|
|
|
#include "client.h" // CL_Particle
|
|
|
|
#endif
|
2018-04-13 18:23:45 +02:00
|
|
|
|
|
|
|
// expand debugging BBOX particle hulls by this many units.
|
2021-01-03 02:28:45 +01:00
|
|
|
#define BOX_GAP 0.0f
|
2018-04-13 18:23:45 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
===============
|
|
|
|
PM_ParticleLine
|
|
|
|
|
|
|
|
draw line from particles
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel )
|
|
|
|
{
|
2019-11-24 01:52:08 +01:00
|
|
|
#if !XASH_DEDICATED
|
2018-04-13 18:23:45 +02:00
|
|
|
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 );
|
2019-03-15 19:23:59 +01:00
|
|
|
CL_Particle( pos, pcolor, life, 0, zvel );
|
2018-04-13 18:23:45 +02:00
|
|
|
curdist += 2.0f;
|
|
|
|
}
|
2018-04-18 17:32:30 +02:00
|
|
|
#endif // XASH_DEDICATED
|
2018-04-13 18:23:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
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 )
|
|
|
|
{
|
2019-11-24 01:52:08 +01:00
|
|
|
#if !XASH_DEDICATED
|
2018-04-13 18:23:45 +02:00
|
|
|
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 );
|
|
|
|
}
|
2018-04-18 17:32:30 +02:00
|
|
|
#endif // XASH_DEDICATED
|
2019-02-18 19:25:26 +01:00
|
|
|
}
|