Original Post
Hi everyone, I'm not sure this is the right forum but here it is:
I'm creating a little OpenGl game and I programmed the whole model loading module from scratch.
I could load up my own .smd models(half-life models before they are compiled to .mdl ones) perfectly but when i tried to load original counter-strike models i got access violation errors!
I debugged my app and found that the problem was this:
Model file:
...
0 "Bip01" -1 // JointID JointName ParentJoint
1 "Bip01 Pelvis" 0
...
Loading code:
...
fgets(StrBuf, 100, File);
...
sscanf(StrBuf, "%d %s %d", &pSkel.ID, &pSkel[i].Name, &pSkel[i].ParentID);
...
- The 1st line would get parsed ok but when it got to the second line (1 "Bip01 Pelvis" 0) the sscanf would get:
pSkel[i].ID = 1
pSkel[i].Name = "Bip01
(int!)pSkel[i].ParentID = Pelvis"
Did you understand? The space in the joint's name is messing the .ParentID so when i load up its Parent Joint i would get an access violation!
Does anyone knows how can I fix this? Hoh can I assign to the JointName everything thats in ""? Is fgets and sscanf a good way of parsing a model file (it's a text based model)?
If anyone has a clue please post it here. Thanx in advance for your help! help! Heeeeelp!
[edited by - RaptorZero on May 4, 2004 9:35:09 AM]