In bg_misc.c I have added a typedef like this:
Code: Select all
wpinfo_t bg_weaponlist[] ={
{ //WP_NONE, //0 Used for misc counts, rounds are for burst count.
"",
{0}, //weapMode
{0}, // numClips ammo that fits in the weapon
{0}, // rounds
""
},
{ //WP_KNIFE, //1
"icons/ammo/kbar",
{0}, //weapMode
{-1},
{5},
"models/weapons2/knife/"
},
{// WP_BERETTA, //2
"icons/ammo/beretta",
{0}, //weapMode
{0}, // numClips ammo that fits in the weapon
{0}, // rounds
"models/weapons2/beretta/"
},
... And so on for the rest of the weapons.
However, when I check the value of numClips from the type above, it gives unreliable data, sometimes telling the truth about how many clips there are, and other times saying 0 for some reason.
So I did a print statement:
Code: Select all
Com_Printf("HEVAL: %i HEs:%i Client: %i\n", WP_HE, bg_weaponlist[WP_HE].numClips[pm->ps->clientNum], pm->ps->clientNum );
What this prints out is:
HEVAL: 15 HEs:2 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:2 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:2 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:2 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:2 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:2 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:2 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:0 Client: 0
HEVAL: 15 HEs:2 Client: 0
and so on.
I put a debug print statement on every place in they code that sets or changes the value of any bg_weaponlist[].numClips[], and none of them are happening to change it to 0 or 2.
You can see that it has a pattern, where it is 0 once, then twice, then 3, 4, 5 times, then back to once.
This is baffling me. Anybody have any idea what's up with it? (I can post the SVN of all the code once I commit some recent stuff)