当前位置: 首页>>代码示例>>C++>>正文


C++ AngleMod函数代码示例

本文整理汇总了C++中AngleMod函数的典型用法代码示例。如果您正苦于以下问题:C++ AngleMod函数的具体用法?C++ AngleMod怎么用?C++ AngleMod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AngleMod函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BotUpdateInput

/*
==============
BotUpdateInput
==============
*/
void BotUpdateInput(bot_state_t *bs, int time, int elapsed_time)
{
    bot_input_t bi;
    int j;

    //add the delta angles to the bot's current view angles
    for (j = 0; j < 3; j++)
    {
        bs->viewangles[j] = AngleMod(bs->viewangles[j] + SHORT2ANGLE(bs->cur_ps.delta_angles[j]));
    }
    //change the bot view angles
    BotChangeViewAngles(bs, (float) elapsed_time / 1000);
    //retrieve the bot input
    botlib_export->ea.EA_GetInput(bs->client, (float) time / 1000, &bi);
    //respawn hack
    if (bi.actionflags & ACTION_RESPAWN)
    {
        if (bs->lastucmd.buttons & BUTTON_ATTACK) bi.actionflags &= ~(ACTION_RESPAWN|ACTION_ATTACK);
    }
    //convert the bot input to a usercmd
    BotInputToUserCommand(&bi, &bs->lastucmd, bs->cur_ps.delta_angles, time);
    //subtract the delta angles
    for (j = 0; j < 3; j++)
    {
        bs->viewangles[j] = AngleMod(bs->viewangles[j] - SHORT2ANGLE(bs->cur_ps.delta_angles[j]));
    }
}
开发者ID:zturtleman,项目名称:recoil,代码行数:32,代码来源:ai_main.c

示例2: BotChangeViewAngle

/*
==============
BotChangeViewAngle
==============
*/
float BotChangeViewAngle( float angle, float ideal_angle, float speed ) {
	float move;

	angle = AngleMod( angle );
	ideal_angle = AngleMod( ideal_angle );
	if ( angle == ideal_angle ) {
		return angle;
	}
	move = ideal_angle - angle;
	if ( ideal_angle > angle ) {
		if ( move > 180.0 ) {
			move -= 360.0;
		}
	} else {
		if ( move < -180.0 ) {
			move += 360.0;
		}
	}
	if ( move > 0 ) {
		if ( move > speed ) {
			move = speed;
		}
	} else {
		if ( move < -speed ) {
			move = -speed;
		}
	}
	return AngleMod( angle + move );
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:34,代码来源:ai_main.c

示例3: BotUpdateInput

/*
==============
BotUpdateInput
==============
*/
void BotUpdateInput( bot_state_t *bs, int time ) {
	bot_input_t bi;
	int j;

	//add the delta angles to the bot's current view angles
	for ( j = 0; j < 3; j++ ) {
		bs->viewangles[j] = AngleMod( bs->viewangles[j] + SHORT2ANGLE( bs->cur_ps.delta_angles[j] ) );
	}
	//
	BotChangeViewAngles( bs, (float) time / 1000 );
	trap_EA_GetInput( bs->client, (float) time / 1000, &bi );
	//respawn hack
	if ( bi.actionflags & ACTION_RESPAWN ) {
		if ( bs->lastucmd.buttons & BUTTON_ATTACK ) {
			bi.actionflags &= ~( ACTION_RESPAWN | ACTION_ATTACK );
		}
	}
	//
	BotInputToUserCommand( &bi, &bs->lastucmd, bs->cur_ps.delta_angles, time );
	bs->lastucmd.serverTime = time;
	//subtract the delta angles
	for ( j = 0; j < 3; j++ ) {
		bs->viewangles[j] = AngleMod( bs->viewangles[j] - SHORT2ANGLE( bs->cur_ps.delta_angles[j] ) );
	}
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:30,代码来源:ai_main.c

示例4: AICast_InFieldOfVision

/*
==============
AICast_InFieldOfVision
==============
*/
qboolean AICast_InFieldOfVision( vec3_t viewangles, float fov, vec3_t angles ) {
	int i;
	float diff, angle;

	for ( i = 0; i < 2; i++ )
	{
		angle = AngleMod( viewangles[i] );
		angles[i] = AngleMod( angles[i] );
		diff = angles[i] - angle;
		if ( angles[i] > angle ) {
			if ( diff > 180.0 ) {
				diff -= 360.0;
			}
		} else
		{
			if ( diff < -180.0 ) {
				diff += 360.0;
			}
		}
		if ( diff > 0 ) {
			if ( diff > fov * 0.5 ) {
				return qfalse;
			}
		} else
		{
			if ( diff < -fov * 0.5 ) {
				return qfalse;
			}
		}
	}
	return qtrue;
}
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:37,代码来源:ai_cast_sight.c

示例5: BotChangeViewAngles

/*
==============
BotChangeViewAngles
==============
*/
void BotChangeViewAngles(bot_state_t *bs, float thinktime)
{
    float diff, factor, maxchange, anglespeed, disired_speed;
    int i;

    if (bs->ideal_viewangles[PITCH] > 180) bs->ideal_viewangles[PITCH] -= 360;
    //
    if (bs->enemy >= 0)
    {
        factor = botlib_export->ai.Characteristic_BFloat(bs->character, CHARACTERISTIC_VIEW_FACTOR, 0.01f, 1);
        maxchange = botlib_export->ai.Characteristic_BFloat(bs->character, CHARACTERISTIC_VIEW_MAXCHANGE, 1, 1800);
    }
    else
    {
        factor = 0.05f;
        maxchange = 360;
    }
    if (maxchange < 240) maxchange = 240;
    maxchange *= thinktime;
    for (i = 0; i < 2; i++)
    {
        //
        if (bot_challenge->integer)
        {
            //smooth slowdown view model
            diff = fabs(AngleDifference(bs->viewangles[i], bs->ideal_viewangles[i]));
            anglespeed = diff * factor;
            if (anglespeed > maxchange) anglespeed = maxchange;
            bs->viewangles[i] = BotChangeViewAngle(bs->viewangles[i],
                                                   bs->ideal_viewangles[i], anglespeed);
        }
        else
        {
            //over reaction view model
            bs->viewangles[i] = AngleMod(bs->viewangles[i]);
            bs->ideal_viewangles[i] = AngleMod(bs->ideal_viewangles[i]);
            diff = AngleDifference(bs->viewangles[i], bs->ideal_viewangles[i]);
            disired_speed = diff * factor;
            bs->viewanglespeed[i] += (bs->viewanglespeed[i] - disired_speed);
            if (bs->viewanglespeed[i] > 180) bs->viewanglespeed[i] = maxchange;
            if (bs->viewanglespeed[i] < -180) bs->viewanglespeed[i] = -maxchange;
            anglespeed = bs->viewanglespeed[i];
            if (anglespeed > maxchange) anglespeed = maxchange;
            if (anglespeed < -maxchange) anglespeed = -maxchange;
            bs->viewangles[i] += anglespeed;
            bs->viewangles[i] = AngleMod(bs->viewangles[i]);
            //demping
            bs->viewanglespeed[i] *= 0.45 * (1 - factor);
        }
        //BotAI_Print(PRT_MESSAGE, "ideal_angles %f %f\n", bs->ideal_viewangles[0], bs->ideal_viewangles[1], bs->ideal_viewangles[2]);`
        //bs->viewangles[i] = bs->ideal_viewangles[i];
    }
    //bs->viewangles[PITCH] = 0;
    if (bs->viewangles[PITCH] > 180) bs->viewangles[PITCH] -= 360;
    //elementary action: view
    botlib_export->ea.EA_View(bs->client, bs->viewangles);
}
开发者ID:zturtleman,项目名称:recoil,代码行数:62,代码来源:ai_main.c

示例6: UI_SwingAngles

/*
==================
UI_SwingAngles
==================
*/
static void UI_SwingAngles( float destination, float swingTolerance, float clampTolerance,
                            float speed, float *angle, qbool *swinging ) {
    float	swing;
    float	move;
    float	scale;

    if ( !*swinging ) {
        // see if a swing should be started
        swing = AngleSubtract( *angle, destination );
        if ( swing > swingTolerance || swing < -swingTolerance ) {
            *swinging = qtrue;
        }
    }

    if ( !*swinging ) {
        return;
    }

    // modify the speed depending on the delta
    // so it doesn't seem so linear
    swing = AngleSubtract( destination, *angle );
    scale = fabs( swing );
    if ( scale < swingTolerance * 0.5 ) {
        scale = 0.5;
    } else if ( scale < swingTolerance ) {
        scale = 1.0;
    } else {
        scale = 2.0;
    }

    // swing towards the destination angle
    if ( swing >= 0 ) {
        move = uiInfo.uiDC.frameTime * scale * speed;
        if ( move >= swing ) {
            move = swing;
            *swinging = qfalse;
        }
        *angle = AngleMod( *angle + move );
    } else if ( swing < 0 ) {
        move = uiInfo.uiDC.frameTime * scale * -speed;
        if ( move <= swing ) {
            move = swing;
            *swinging = qfalse;
        }
        *angle = AngleMod( *angle + move );
    }

    // clamp to no more than tolerance
    swing = AngleSubtract( destination, *angle );
    if ( swing > clampTolerance ) {
        *angle = AngleMod( destination - (clampTolerance - 1) );
    } else if ( swing < -clampTolerance ) {
        *angle = AngleMod( destination + (clampTolerance - 1) );
    }
}
开发者ID:LuckyBro,项目名称:sgfork,代码行数:60,代码来源:ui_players.c

示例7: ME_RotateSelection

void ME_RotateSelection( int delta )
{
	IGME_vehicle_t* veh;
	sbox3_t			box;
	bool		boxinit = false;
	vec3_t			mins = { -1, -1, -1 },
					maxs = { 1, 1, 1 };
	vec3_t			center;
	vec3_t			dir, angles;
	int				i;
	float			dist;

	for( i = 0; i < IGME_MAX_VEHICLES; ++i ) {
		veh = &cgs.IGME.vehicles[i];
		if( !veh->selected ) continue;
		if( !boxinit ) {
			VectorAdd( veh->origin, mins, box.mins );
			VectorAdd( veh->origin, maxs, box.maxs );
			boxinit = true;
		} else {
			AddToBox( &box, veh->origin );		
		}
	}	
	BoxCenter( &box, &center );	

	for( i = 0; i < IGME_MAX_VEHICLES; ++i ) {
		veh = &cgs.IGME.vehicles[i];
		if( !veh->selected ) continue;
		// get direction vector and dist
		VectorSubtract( veh->origin, center, dir );
		dist = VectorNormalize(dir);
		vectoangles( dir, angles );
		// rotate
		veh->angles[1] += delta;
		AngleMod( veh->angles[1] );
		angles[1] += delta;
		AngleMod( angles[1] );
		// move object
		AngleVectors(angles, dir, 0, 0);
		VectorScale(dir, dist, dir);
		VectorAdd(center, dir, veh->origin);
	}

//			if( rotate ) {
//				veh->angles[1] -= x;
//				AngleMod( veh->angles[1] );
//			}

}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:49,代码来源:cg_missioneditor.c

示例8: UI_MachinegunSpinAngle

/*
======================
UI_MachinegunSpinAngle
======================
*/
float	UI_MachinegunSpinAngle( playerInfo_t *pi ) {
    int		delta;
    float	angle;
    float	speed;
    int		torsoAnim;

    delta = dp_realtime - pi->barrelTime;
    if ( pi->barrelSpinning ) {
        angle = pi->barrelAngle + delta * SPIN_SPEED;
    } else {
        if ( delta > COAST_TIME ) {
            delta = COAST_TIME;
        }

        speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
        angle = pi->barrelAngle + delta * speed;
    }

    torsoAnim = pi->torsoAnim  & ~ANIM_TOGGLEBIT;
    if( torsoAnim == TORSO_RIFLE_ATTACK ) {
        torsoAnim = TORSO_PISTOL_ATTACK;
    }
    if ( pi->barrelSpinning == !(torsoAnim == TORSO_PISTOL_ATTACK) ) {
        pi->barrelTime = dp_realtime;
        pi->barrelAngle = AngleMod( angle );
        pi->barrelSpinning = !!(torsoAnim == TORSO_PISTOL_ATTACK);
    }

    return angle;
}
开发者ID:LuckyBro,项目名称:sgfork,代码行数:35,代码来源:ui_players.c

示例9: CG_MachinegunSpinAngle

static float CG_MachinegunSpinAngle( centity_t *cent, qboolean firing )
{
  int   delta;
  float angle;
  float speed;

  delta = cg.time - cent->pe.barrelTime;
  if( cent->pe.barrelSpinning )
    angle = cent->pe.barrelAngle + delta * SPIN_SPEED;
  else
  {
    if( delta > COAST_TIME )
      delta = COAST_TIME;

    speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
    angle = cent->pe.barrelAngle + delta * speed;
  }

  if( cent->pe.barrelSpinning == !firing )
  {
    cent->pe.barrelTime = cg.time;
    cent->pe.barrelAngle = AngleMod( angle );
    cent->pe.barrelSpinning = firing;
  }

  return angle;
}
开发者ID:ztdretcher,项目名称:zt-tremulous,代码行数:27,代码来源:cg_weapons.c

示例10: UI_PlayerAngles

/*
===============
UI_PlayerAngles
===============
*/
static void UI_PlayerAngles( playerInfo_t *pi, vec3_t legs[ 3 ], vec3_t torso[ 3 ], vec3_t head[ 3 ] )
{
	vec3_t legsAngles, torsoAngles, headAngles;
	float  dest;
	float  adjust;

	VectorCopy( pi->viewAngles, headAngles );
	headAngles[ YAW ] = AngleMod( headAngles[ YAW ] );
	VectorClear( legsAngles );
	VectorClear( torsoAngles );

	// --------- yaw -------------

	// allow yaw to drift a bit
	if ( ( pi->legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE || ( pi->torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND )
	{
		// if not standing still, always point all in the same direction
		pi->torso.yawing = qtrue; // always center
		pi->torso.pitching = qtrue; // always center
		pi->legs.yawing = qtrue; // always center
	}

	// adjust legs for movement dir
	adjust = UI_MovedirAdjustment( pi );
	legsAngles[ YAW ] = headAngles[ YAW ] + adjust;
	torsoAngles[ YAW ] = headAngles[ YAW ] + 0.25 * adjust;

	// torso
	UI_SwingAngles( torsoAngles[ YAW ], 25, 90, SWINGSPEED, &pi->torso.yawAngle, &pi->torso.yawing );
	UI_SwingAngles( legsAngles[ YAW ], 40, 90, SWINGSPEED, &pi->legs.yawAngle, &pi->legs.yawing );

	torsoAngles[ YAW ] = pi->torso.yawAngle;
	legsAngles[ YAW ] = pi->legs.yawAngle;

	// --------- pitch -------------

	// only show a fraction of the pitch angle in the torso
	if ( headAngles[ PITCH ] > 180 )
	{
		dest = ( -360 + headAngles[ PITCH ] ) * 0.75;
	}
	else
	{
		dest = headAngles[ PITCH ] * 0.75;
	}

	UI_SwingAngles( dest, 15, 30, 0.1, &pi->torso.pitchAngle, &pi->torso.pitching );
	torsoAngles[ PITCH ] = pi->torso.pitchAngle;

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

	AnglesSubtract( legsAngles, pi->moveAngles, legsAngles );  // NERVE - SMF

	AnglesToAxis( legsAngles, legs );
	AnglesToAxis( torsoAngles, torso );
	AnglesToAxis( headAngles, head );
}
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:64,代码来源:ui_players.c

示例11: AngleMod

int CIntegralRotationDesc::GetFrameIndex (int iAngle) const

//	GetFrameIndex
//
//	Returns the frame index, 0 to m_iCount-1, that corresponds to the given 
//	angle. Remember that frame 0 points straight up and frames rotate clockwise.

	{
	Metric rIndex = AngleMod(90 - iAngle) * m_iCount / 360.0;
	return (int)rIndex;
	}
开发者ID:bmer,项目名称:Mammoth,代码行数:11,代码来源:CIntegralRotationDesc.cpp

示例12: UI_PlayerAngles

static void UI_PlayerAngles( playerInfo_t *pi, matrix3 legs, matrix3 torso, matrix3 head ) {
	vector3		legsAngles, torsoAngles, headAngles;
	float		dest;
	float		adjust;

	VectorCopy( &pi->viewAngles, &headAngles );
	headAngles.yaw = AngleMod( headAngles.yaw );
	VectorClear( &legsAngles );
	VectorClear( &torsoAngles );

	// --------- yaw -------------

	// allow yaw to drift a bit
	if ( ( pi->legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE 
		|| ( pi->torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND  ) {
		// if not standing still, always point all in the same direction
		pi->torso.yawing = qtrue;	// always center
		pi->torso.pitching = qtrue;	// always center
		pi->legs.yawing = qtrue;	// always center
	}

	// adjust legs for movement dir
	adjust = UI_MovedirAdjustment( pi );
	legsAngles.yaw = headAngles.yaw + adjust;
	torsoAngles.yaw = headAngles.yaw + 0.25f * adjust;


	// torso
	UI_SwingAngles( torsoAngles.yaw, 25, 90, SWINGSPEED, &pi->torso.yawAngle, &pi->torso.yawing );
	UI_SwingAngles( legsAngles.yaw, 40, 90, SWINGSPEED, &pi->legs.yawAngle, &pi->legs.yawing );

	torsoAngles.yaw = pi->torso.yawAngle;
	legsAngles.yaw = pi->legs.yawAngle;

	// --------- pitch -------------

	// only show a fraction of the pitch angle in the torso
	if ( headAngles.pitch > 180 ) {
		dest = (-360 + headAngles.pitch) * 0.75f;
	} else {
		dest = headAngles.pitch * 0.75f;
	}
	UI_SwingAngles( dest, 15, 30, 0.1f, &pi->torso.pitchAngle, &pi->torso.pitching );
	torsoAngles.pitch = pi->torso.pitchAngle;

	// pull the angles back out of the hierarchial chain
	AnglesSubtract( &headAngles, &torsoAngles, &headAngles );
	AnglesSubtract( &torsoAngles, &legsAngles, &torsoAngles );
	AnglesToAxis( &legsAngles, legs );
	AnglesToAxis( &torsoAngles, torso );
	AnglesToAxis( &headAngles, head );
}
开发者ID:Razish,项目名称:QtZ,代码行数:52,代码来源:ui_players.c

示例13: BotChangeViewAngles

/*
==============
BotChangeViewAngles
==============
*/
void BotChangeViewAngles(bot_state_t *bs, float thinktime) {
	float diff, factor, maxchange, anglespeed, disired_speed;
	int i;

	if (bs->ideal_viewangles[PITCH] > 180) bs->ideal_viewangles[PITCH] -= 360;
	
	factor = bs->skills.turnspeed;

	if (factor > 1)
	{
		factor = 1;
	}
	if (factor < 0.25)
	{
		factor = 0.25f;
	}
	maxchange = bs->skills.maxturn;

	//if (maxchange < 240) maxchange = 240;
	maxchange *= thinktime;
	for (i = 0; i < 2; i++) {
		bs->viewangles[i] = AngleMod(bs->viewangles[i]);
		bs->ideal_viewangles[i] = AngleMod(bs->ideal_viewangles[i]);
		diff = AngleDifference(bs->viewangles[i], bs->ideal_viewangles[i]);
		disired_speed = diff * factor;
		bs->viewanglespeed[i] += (bs->viewanglespeed[i] - disired_speed);
		if (bs->viewanglespeed[i] > 180) bs->viewanglespeed[i] = maxchange;
		if (bs->viewanglespeed[i] < -180) bs->viewanglespeed[i] = -maxchange;
		anglespeed = bs->viewanglespeed[i];
		if (anglespeed > maxchange) anglespeed = maxchange;
		if (anglespeed < -maxchange) anglespeed = -maxchange;
		bs->viewangles[i] += anglespeed;
		bs->viewangles[i] = AngleMod(bs->viewangles[i]);
		bs->viewanglespeed[i] *= 0.45 * (1 - factor);
	}
	if (bs->viewangles[PITCH] > 180) bs->viewangles[PITCH] -= 360;
	trap_EA_View(bs->client, bs->viewangles);
}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:43,代码来源:ai_main.cpp

示例14: PM_HeloAccelerate

/*
===================
PM_HeloAccelerate

===================
*/
static void PM_HeloAccelerate()
{
    float	throttle = pm->ps->fixed_throttle;
    int		maxthrottle = availableVehicles[pm->vehicle].maxthrottle;
//	int		minthrottle = availableVehicles[pm->vehicle].minthrottle;
	float	maxforwardspeed = availableVehicles[pm->vehicle].maxspeed;
	float	maxrightspeed = availableVehicles[pm->vehicle].turnspeed[YAW];
	float	maxliftspeed = maxforwardspeed*0.00525;
	float	maxspeed = sqrt(maxforwardspeed*maxforwardspeed + 
							maxrightspeed*maxrightspeed + 
							maxliftspeed*maxliftspeed);
	float	stallspeed = static_cast<float>(availableVehicles[pm->vehicle].stallspeed);
	float	curforwardspeed;
	float	curliftspeed;
	float	curliftspeedadjust;
	float	currightspeed;
	float	curspeed;
	float	curspeedadjust;
	float	totalthrottle;
	vec3_t	vehdir;
	
	// Copy Vehicle Direction
	VectorCopy( pm->ps->vehicleAngles, vehdir );
	vehdir[YAW] = AngleMod( vehdir[YAW] );

	curforwardspeed = (vehdir[PITCH]/MAX_HELO_PITCH)*availableVehicles[pm->vehicle].maxspeed;
	currightspeed = (vehdir[ROLL]/MAX_HELO_ROLL)*availableVehicles[pm->vehicle].turnspeed[YAW];
	curliftspeed = throttle > maxthrottle ? -(throttle-maxthrottle)*20 : throttle * 25;	// real vert speed	
	curliftspeedadjust = throttle > maxthrottle ? 0 : throttle * 25;					// adjusted vert speed, don't want down movement to effect fuel usage "more"
	curspeed = sqrt(curforwardspeed*curforwardspeed + currightspeed*currightspeed + curliftspeed*curliftspeed);						// real total speed
	curspeedadjust = sqrt(curforwardspeed*curforwardspeed + currightspeed*currightspeed + curliftspeedadjust*curliftspeedadjust);	// adjusted total speed, dont want down movement to effect throttle more
	totalthrottle = (curspeedadjust/maxspeed)*10;

	// check for fuel 
	if( pm->ps->stats[STAT_FUEL] <= 0 ) { 
		pm->ps->throttle = 0;
	}

	if( (pm->ps->ONOFF & OO_LANDED) && curspeed > stallspeed * 1.5f ) 
		curspeed = stallspeed *1.5f;

    pm->ps->speed = curspeed*10;

	pm->ps->throttle = throttle;

	// fuel flow
	PM_Helo_FuelFlow( totalthrottle );

}
开发者ID:MilitaryForces,项目名称:MilitaryForces,代码行数:55,代码来源:bg_helomove.c

示例15: CG_MachinegunSpinAngle

static float	CG_MachinegunSpinAngle( centity_t *cent ) {
	float angle, speed, delta = (cg.time - cent->pe.barrelTime) + cg.timeFraction;
	if ( cent->pe.barrelSpinning ) {
		angle = cent->pe.barrelAngle + delta * SPIN_SPEED;
	} else {
		if ( delta > COAST_TIME ) {
			delta = COAST_TIME;
		}
		speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
		angle = cent->pe.barrelAngle + delta * speed;
	}
	if ( cent->pe.barrelSpinning == !(cent->currentState.eFlags & EF_FIRING) ) {
		cent->pe.barrelTime = cg.time;
		cent->pe.barrelAngle = AngleMod( angle );
		cent->pe.barrelSpinning = !!(cent->currentState.eFlags & EF_FIRING);
	}
	return angle;
}
开发者ID:entdark,项目名称:q3mme,代码行数:18,代码来源:cg_weapons.c


注:本文中的AngleMod函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。