Exemple #1
0
/*
 * 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] =
			modeuler(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 */
	trap_EA_GetInput(bs->client, (float)time / 1000, &bi);
	/* respawn hack */
	if(bi.actionflags & ACTION_RESPAWN)
		if(bs->lastucmd.buttons & BUTTON_PRIATTACK) 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] =
			modeuler(bs->viewangles[j] -
				SHORT2ANGLE(bs->cur_ps.delta_angles[j]));
}
Exemple #2
0
/*
==============
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] ) );
	}
}
Exemple #3
0
/*
==============
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]));
    }
}