Пример #1
0
/*
================
BotMatch_Subteam
================
*/
qboolean BotMatch_Subteam(bot_state_t *bs, bot_match_t *match, gentity_t *sender)
{
	// Check information and simple request messages
	switch (match->type)
	{
		case MSG_JOINSUBTEAM:		BotMatch_JoinSubteam(bs, match, sender);	break;
		case MSG_LEAVESUBTEAM:		BotMatch_LeaveSubteam(bs, match, sender);	break;
		case MSG_WHICHTEAM:			BotMatch_WhichTeam(bs, match);				break;
		case MSG_FORMATIONSPACE:	BotMatch_FormationSpace(bs, match);			break;

		case MSG_DOFORMATION:
		case MSG_WAIT:															break;

		case MSG_CREATENEWFORMATION:
		case MSG_FORMATIONPOSITION:
			trap_EA_SayTeam(bs->client, "The part of my brain to create formations has been damaged");
			break;

		default:					return qfalse;
	}

	return qtrue;
}
Пример #2
0
/*
=======================================================================================================================================
BotMatchMessage
=======================================================================================================================================
*/
int BotMatchMessage(bot_state_t *bs, char *message) {
	bot_match_t match;

	match.type = 0;
	// if it is an unknown message
	if (!trap_BotFindMatch(message, &match, MTCONTEXT_ENTERGAME
							|MTCONTEXT_INITIALTEAMCHAT
							|MTCONTEXT_CTF)) {
		return qfalse;
	}
	// react to the found message
	switch (match.type) {
	case MSG_HELP:                     // someone calling for help
	case MSG_ACCOMPANY:                // someone calling for company
	{
		BotMatch_HelpAccompany(bs, &match);
		break;
	}

	case MSG_DEFENDKEYAREA:            // teamplay defend a key area
	{
		BotMatch_DefendKeyArea(bs, &match);
		break;
	}

	case MSG_CAMP:                     // camp somewhere
	{
		BotMatch_Camp(bs, &match);
		break;
	}

	case MSG_PATROL:                   // patrol between several key areas
	{
		BotMatch_Patrol(bs, &match);
		break;
	}
#ifdef CTF
	case MSG_GETFLAG:                  // ctf get the enemy flag
	{
		BotMatch_GetFlag(bs, &match);
		break;
	}

	case MSG_RUSHBASE:                 // ctf rush to the base
	{
		BotMatch_RushBase(bs, &match);
		break;
	}

	case MSG_RETURNFLAG:
	{
		BotMatch_ReturnFlag(bs, &match);
		break;
	}
#endif // CTF
	case MSG_GETITEM:
	{
		BotMatch_GetItem(bs, &match);
		break;
	}

	case MSG_JOINSUBTEAM:              // join a sub team
	{
		BotMatch_JoinSubteam(bs, &match);
		break;
	}

	case MSG_LEAVESUBTEAM:             // leave a sub team
	{
		BotMatch_LeaveSubteam(bs, &match);
		break;
	}

	case MSG_WHICHTEAM:
	{
		BotMatch_WhichTeam(bs, &match);
		break;
	}

	case MSG_CHECKPOINT:               // remember a check point
	{
		BotMatch_CheckPoint(bs, &match);
		break;
	}

	case MSG_CREATENEWFORMATION:       // start the creation of a new formation
	{
		trap_EA_SayTeam(bs->client, "the part of my brain to create formations has been damaged");
		break;
	}

	case MSG_FORMATIONPOSITION:        // tell someone his / her position in the formation
	{
		trap_EA_SayTeam(bs->client, "the part of my brain to create formations has been damaged");
		break;
	}

	case MSG_FORMATIONSPACE:           // set the formation space
	{
		BotMatch_FormationSpace(bs, &match);
		break;
	}

	case MSG_DOFORMATION:              // form a certain formation
	{
		break;
	}

	case MSG_DISMISS:                  // dismiss someone
	{
		BotMatch_Dismiss(bs, &match);
		break;
	}

	case MSG_STARTTEAMLEADERSHIP:      // someone will become the team leader
	{
		BotMatch_StartTeamLeaderShip(bs, &match);
		break;
	}

	case MSG_STOPTEAMLEADERSHIP:       // someone will stop being the team leader
	{
		BotMatch_StopTeamLeaderShip(bs, &match);
		break;
	}

	case MSG_WHOISTEAMLAEDER:
	{
		BotMatch_WhoIsTeamLeader(bs, &match);
		break;
	}

	case MSG_WHATAREYOUDOING:          // ask a bot what he / she is doing
	{
		BotMatch_WhatAreYouDoing(bs, &match);
		break;
	}

	case MSG_WHATISMYCOMMAND:
	{
		BotMatch_WhatIsMyCommand(bs, &match);
		break;
	}

	case MSG_WHEREAREYOU:
	{
		BotMatch_WhereAreYou(bs, &match);
		break;
	}

	case MSG_LEADTHEWAY:
	{
		BotMatch_LeadTheWay(bs, &match);
		break;
	}

	case MSG_KILL:
	{
		BotMatch_Kill(bs, &match);
		break;
	}

	case MSG_ENTERGAME:                // someone entered the game
	{
		// NOTE: eliza chats will catch this
		// BotMatchVariable(&match, NETNAME, netname);
		// Com_sprintf(buf, sizeof(buf), "heya %s", netname);
		// EA_Say(bs->client, buf);
		break;
	}

	case MSG_CTF:
	{
		BotMatch_CTF(bs, &match);
		break;
	}

	case MSG_WAIT:
	{
		break;
	}

	default:
	{
		BotAI_Print(PRT_MESSAGE, "unknown match type\n");
		break;
	}
	}

	return qtrue;
}