當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。