Esempio n. 1
0
//-----------------------------------------------------------------
// update character object (call once per frame)
//-----------------------------------------------------------------
void characterUpdate( character* b )
//-----------------------------------------------------------------
{
	/** Evita que la nave se salga por los laterales */
	if( b->x >= 0 && b->x <= 61000 ){
		// add X velocity to X position
		b->x += (b->xvel>>4);

		// apply air friction to X velocity
		b->xvel = (b->xvel * (256-c_air_friction)) >> 8;
	
		// clamp X velocity to the limits
		b->xvel = clampint( b->xvel, -max_xvel, max_xvel );
	}
Esempio n. 2
0
void Conf_SaveConfig()
{
	configfile = fopen("config.txt", "w");

	fprintf(configfile,"useTraceFunc :: %s\r\n", btos(useTraceFunc));
	fprintf(configfile,"useBrushFunc :: %s\r\n", btos(useBrushFunc));
	fprintf(configfile,"tickRate :: %d\r\n", tickRate);
	fprintf(configfile,"quakeDir :: %s\r\n", quakeDir);
	fprintf(configfile,"ttAverageFreq :: %d\r\n", ttAverageFreq);
	fprintf(configfile,"ttFileName :: %s\r\n", ttFileName);

	fclose(configfile);

	// clamp values here.
	clampint(&tickRate, MIN_TICKRATE, MAX_TICKRATE);
}
Esempio n. 3
0
}

//-----------------------------------------------------------------
// update ball object (call once per frame)
//-----------------------------------------------------------------
void ballUpdate( ball* b )
//-----------------------------------------------------------------
{
	// add X velocity to X position
	b->x += (b->xvel>>4);

	// apply air friction to X velocity
	b->xvel = (b->xvel * (256-c_air_friction)) >> 8;
	
	// clamp X velocity to the limits
	b->xvel = clampint( b->xvel, -max_xvel, max_xvel );

	// add gravity to Y velocity
	b->yvel += c_gravity;
	b->y += (b->yvel);

	if( b->y >= c_platform_level )
	{
		// apply ground friction to X velocity
		// (yes this may be done multiple times)
		b->xvel = (b->xvel * (256-c_ground_friction)) >> 8;
		
		// check if the ball has been squished to minimum height
		if( b->y > c_platform_level )
		{
			// mount Y on platform