Jump to content

Home

Important cgame Code Bug


razorace

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...