PDA

View Full Version : Important cgame Code Bug


razorace
03-09-2003, 05:26 AM
Just a heads up to everyone but there's a bug in the client side code that screws up a lot of stuff slightly.

Introduction:

cent->turAngles ( for player characters ) is used as a up-to-date data field for your base ghoul2 model orientation (the leg angles) multiple bolt calls depend on this information being correct but it doesn't actually match the true data. This looks like something that Raven missed due to multiple programmer syndrome. :)

The Results:

This causes all the bolt functions that call this to seem to lag/be slightly off when moving around. This issue is easiest to notice with the visual origin of Force Lightning.

The Problem:

turAngles is reporting pitch and roll when the legs are only effected in the yaw axis.

Solution:

The easiest way to fix this without getting involved in worrying about software engineering is to...

1. Open up cg_player.c
2. Go to the CG_G2PlayerAngles function.
3. Move VectorCopy(legsAngles, cent->turAngles); from here....

legsAngles[ROLL] = 0;
torsoAngles[ROLL] = 0;

//here!
VectorCopy(legsAngles, cent->turAngles);

if (cent->isATST)
{
legsAngles[ROLL] = 0;
legsAngles[PITCH] = 0;
}

// pull the angles back out of the hierarchial chain
AnglesSubtract( headAngles, torsoAngles, headAngles );
AnglesSubtract( torsoAngles, legsAngles, torsoAngles );

legsAngles[PITCH] = 0;

AnglesToAxis( legsAngles, legs );
// we assume that model 0 is the player model.

to there...

legsAngles[ROLL] = 0;
torsoAngles[ROLL] = 0;

if (cent->isATST)
{
legsAngles[ROLL] = 0;
legsAngles[PITCH] = 0;
}

// pull the angles back out of the hierarchial chain
AnglesSubtract( headAngles, torsoAngles, headAngles );
AnglesSubtract( torsoAngles, legsAngles, torsoAngles );

legsAngles[PITCH] = 0;

//There!
VectorCopy(legsAngles, cent->turAngles);

AnglesToAxis( legsAngles, legs );
// we assume that model 0 is the player model.


That's it!

This has been a public service announcement by Razor Ace and the Masters of the Force Mod Team.

Wudan
03-09-2003, 09:50 AM
Yay! I was losing so much sleep!

razorace
03-09-2003, 10:01 AM
no kidding. It took me two months of messing with the cgame to figure out what the heck the problem was. (as I was working on other stuff of course. :) The problem is very sutle and the Lerp/Tur origin/angles varibles are very cryptic.

It's big enough deal that I sent it into the Raven boys. They're probably not even going to notice but, hey, I might get some browne points with the big boys over it. :)

btw, the NRGTeam Forum is down. Went over their bandwidth limit.

Wudan
03-09-2003, 11:26 AM
Yeah, I noticed. The NRG Map Pack can still be downloaded elsewhere, but I guess it's back to LF for now.

Not like there's much going on. I'm just stabbing away at this here _humanoid.gla.

razorace
03-09-2003, 06:05 PM
"Die _humanoid.gla! Die!"

What part are you working on now?

Wudan
03-10-2003, 10:13 AM
The complex and tricky part.

razorace
03-13-2003, 07:30 PM
Well, I just contacted a dude at Raven. He confirmed the correct useage of turAngles so my fix is what it's suppose to do.

Another interesting tidbit, he implied that he's still actually working on the code. This would mean another patch, expension, sequel is in the works.

Wudan
03-13-2003, 07:50 PM
If the sequel is based on the same engine, they better give us some damn cool stuff this time around.

razorace
03-14-2003, 12:30 AM
Assuming they upgrade the ghoul2 system slightly, they could do almost whatever they wanted.