cleaning & fixing the code + compiling with linux


(talkingc) #1

Hiyah!

I’m new to q3 based engines - but anyways I was doing tweaks & screwing around with the ET source - I’ve done already pretty cool things already (remade the whole artillery thing – no more gay smoke puff … only sound of distant cannons fireing away which are in sync with the explosions ofcourse :wink: I’ll put it out for test in a couple of days …

But when I decided to make the panzer flightpath more realistic (so that it drops slightly over distance etc.) - I came across this bit of code:


bg_misc.c

void BG_EvaluateTrajectory( const trajectory_t *tr, int atTime, vec3_t result, qboolean isAngle, int splinePath )

...

	case TR_GRAVITY_LOW:
		deltaTime = ( atTime - tr->trTime ) * 0.001;	// milliseconds to seconds
		VectorMA( tr->trBase, deltaTime, tr->trDelta, result );
		result[2] -= 0.5 * (DEFAULT_GRAVITY * 0.3) * deltaTime * deltaTime;		// FIXME: local gravity...
		break;

...


the FIXME bit is annoying me - DEFAULT_GRAVITY - I’d like to have the servers gravity setting affect the trajectories (it was some cvar) so I tried to use the g_gravity.value (if I remember the name correctly) variable with no avail (link fails coz the .c / .obj file where its physically lies aint associated with the project) then i tried the getcvar routine - which again results in a link failure of the same type as above … any ideas guys??

And finally what do I need to get this thing compiled under linux - i couldnt find any make files :???:

happy codin’

-tcm


(digibob) #2

the bg_* files are generally shared between cgame and game, and because of this, you can’t just directly used g_gravity, or anything like that.

To do something like that, have a variable inside the bg_files, and a function to set that variable. For example:


int bg_gravity = 0;

void BG_SetGravity( int value ) {
bg_gravity = value;
}

Then just make that available in one of the bg_ headers, and have both game and cgame call that with the appropriate value when gravity changes ( it’ll be up to you to send it across the network however you wish ).

Generally it’s a good idea with the bg stuff to treat it as a closed system, and use functions to setup stuff inside it, rather than trying to access anything from the cgame/game modules from it.


(MindLink) #3

Have a look at this thread : http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=6510 for some information about compiling the source using linux.


(Chruker) #4

If I understand you correctly, you hear the artillery fireing at the same moment that the shell hits the ground. That wouldn’t be correct since the shell has to travel for a while.


(talkingc) #5

If I understand you correctly, you hear the artillery fireing at the same moment that the shell hits the ground. That wouldn’t be correct since the shell has to travel for a while.[/quote]Yeah - it takes few seconds for them to fly … Its actually really freaky coz ya never know where they’re landing - and u know they’re coming … just either pray or run for ur life hehehe

– except if ur on the same side – then you’ll get a message with the coordinates.

trying to get the void BG_SetGravity to work - thanks for the tips!

  • tcm