More changes/comments

Brian Hook hook_l at
Sun Mar 2 19:15:43 EST 2003

The duplication of q_shared.c in game and ctf is really, really 
bothering me.  It basically has to be updated between the two 
constantly, and they're not quite in sync.  I'd really like to see 
the various q_shared.h/.c merged and placed into qcommon unless 
there's a technical reason not to.

Obviously you would think that there was a really good reason to put 
q_shared.c in there instead of in qcommon/, but I can't think of a 
reason right now.  Comments?

Also, I went ahead and added an snprintf #define so we don't have to 
roll one from scratch.  This sits next to the vsnprintf define 
someone else did.

I've made the codebase mostly const correct.  Everything is 
functionally the same, but in the process I think I found some bugs.  
vec3_origin is supposed to always be (0,0,0), but some routines were 
accepting it as a parameter and then calling VecNormalize() on it, 
which would/could modify it (VectorNormalize() however catches the 
special case of length==0, so it never manifested).

Of course, there's a reasonable chance I may have introduced some as 
well =)

A lot of the #ifdef _WIN32 stuff should probably be made into #ifdef 
_MSC_VER, but that's not a pressing issue by any means.

Right now my changes are so massive that I'm not sure a patch is 
really even relevant.  I'm willing to make a patch file if someone 
wants to tell me how they'd like that done, alternatively I can just 
ZIP up what I have and someone can do a merge from hell.

Other potentially cool things to do:

- integrate PhysicsFS so we can switch to using ZIP files for mods.  
This makes modding more convenient since you can just use zip instead 
of having to find a special Quake2 pak utility.

- removing the IPX code just to clean things up?  Is this used at all 
by anyone?

- refactoring the existing files so that they're not so huge, and 
possibly a bit more focused?  e.g. making a q_net.h, q_cvar.h, 
g_com.h, etc. instead of just having everything parked into qcommon.h 
and qshared.h.  This will help reduce compile time dependencies and 
will also allow easier modifications by multiple parties.  It 
actually used to be this way but Carmack got irritable about having 
too many files/dependency issues and just shoved 'em all together.  
For the record, I was opposed to that move. =)

- making it 64-bit clean (*cough* Ryan *cough*)

- making sure all strcpy and (v)sprintf calls are buffer safe

- start using asserts()


More information about the quake2 mailing list