move of some vector functions outside of just game

This commit is contained in:
Bryce Hutchings 2002-08-21 03:42:36 +00:00
parent 507c3a2c4d
commit 6ab9ea3cab
3 changed files with 61 additions and 48 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.18 2002/08/21 03:42:04 niceass
// move of some vector functions outside of just game
//
// Revision 1.17 2002/07/19 04:28:39 niceass
// no end line fix
//
@ -307,54 +310,6 @@ void G_UseTargets(gentity_t * ent, gentity_t * activator)
}
}
/*
=============
TempVector
This is just a convenience function
for making temporary vectors for function calls
=============
*/
float *tv(float x, float y, float z)
{
static int index;
static vec3_t vecs[8];
float *v;
// use an array so that multiple tempvectors won't collide
// for a while
v = vecs[index];
index = (index + 1) & 7;
v[0] = x;
v[1] = y;
v[2] = z;
return v;
}
/*
=============
VectorToString
This is just a convenience function
for printing vectors
=============
*/
char *vtos(const vec3_t v)
{
static int index;
static char str[8][32];
char *s;
// use an array so that multiple vtos won't collide
s = str[index];
index = (index + 1) & 7;
Com_sprintf(s, 32, "(%i %i %i)", (int) v[0], (int) v[1], (int) v[2]);
return s;
}
/*
===============

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.7 2002/08/21 03:42:20 niceass
// move of some vector functions outside of just game
//
// Revision 1.6 2002/06/16 20:06:14 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -899,6 +902,55 @@ char *QDECL va(char *format, ...)
return buf;
}
/*
=============
TempVector
This is just a convenience function
for making temporary vectors for function calls
=============
*/
float *tv(float x, float y, float z)
{
static int index;
static vec3_t vecs[8];
float *v;
// use an array so that multiple tempvectors won't collide
// for a while
v = vecs[index];
index = (index + 1) & 7;
v[0] = x;
v[1] = y;
v[2] = z;
return v;
}
/*
=============
VectorToString
This is just a convenience function
for printing vectors
=============
*/
char *vtos(const vec3_t v)
{
static int index;
static char str[8][32];
char *s;
// use an array so that multiple vtos won't collide
s = str[index];
index = (index + 1) & 7;
Com_sprintf(s, 32, "(%.3f %.3f %.3f)", v[0], v[1], v[2]);
return s;
}
/*
=====================================================================

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.10 2002/08/21 03:42:36 niceass
// move of some vector functions outside of just game
//
// Revision 1.9 2002/06/16 20:06:14 jbravo
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
//
@ -953,6 +956,9 @@ float LittleFloat (const float *l);
void Swap_Init (void);
*/
char *QDECL va(char *format, ...);
float *tv(float x, float y, float z);
char *vtos(const vec3_t v);
//=============================================