2
===========================================================================
3
Copyright (C) 1999-2005 Id Software, Inc.
5
This file is part of Quake III Arena source code.
7
Quake III Arena source code is free software; you can redistribute it
8
and/or modify it under the terms of the GNU General Public License as
9
published by the Free Software Foundation; either version 2 of the License,
10
or (at your option) any later version.
12
Quake III Arena source code is distributed in the hope that it will be
13
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with Quake III Arena source code; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
===========================================================================
23
/*****************************************************************************
28
* $Archive: /source/code/botlib/be_ai_chat.h $
30
*****************************************************************************/
32
#define MAX_MESSAGE_SIZE 256
33
#define MAX_CHATTYPE_NAME 32
34
#define MAX_MATCHVARIABLES 8
36
#define CHAT_GENDERLESS 0
37
#define CHAT_GENDERFEMALE 1
38
#define CHAT_GENDERMALE 2
45
typedef struct bot_consolemessage_s
48
float time; //message time
49
int type; //message type
50
char message[MAX_MESSAGE_SIZE]; //message
51
struct bot_consolemessage_s *prev, *next; //prev and next in list
52
} bot_consolemessage_t;
55
typedef struct bot_matchvariable_s
59
} bot_matchvariable_t;
60
//returned to AI when a match is found
61
typedef struct bot_match_s
63
char string[MAX_MESSAGE_SIZE];
66
bot_matchvariable_t variables[MAX_MATCHVARIABLES];
70
int BotSetupChatAI(void);
71
//shutdown the chat AI
72
void BotShutdownChatAI(void);
73
//returns the handle to a newly allocated chat state
74
int BotAllocChatState(void);
76
void BotFreeChatState(int handle);
77
//adds a console message to the chat state
78
void BotQueueConsoleMessage(int chatstate, int type, char *message);
79
//removes the console message from the chat state
80
void BotRemoveConsoleMessage(int chatstate, int handle);
81
//returns the next console message from the state
82
int BotNextConsoleMessage(int chatstate, bot_consolemessage_t *cm);
83
//returns the number of console messages currently stored in the state
84
int BotNumConsoleMessages(int chatstate);
85
//selects a chat message of the given type
86
void BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
87
//returns the number of initial chat messages of the given type
88
int BotNumInitialChats(int chatstate, char *type);
89
//find and select a reply for the given message
90
int BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
91
//returns the length of the currently selected chat message
92
int BotChatLength(int chatstate);
93
//enters the selected chat message
94
void BotEnterChat(int chatstate, int clientto, int sendto);
95
//get the chat message ready to be output
96
void BotGetChatMessage(int chatstate, char *buf, int size);
97
//checks if the first string contains the second one, returns index into first string or -1 if not found
98
int StringContains(char *str1, char *str2, int casesensitive);
99
//finds a match for the given string using the match templates
100
int BotFindMatch(char *str, bot_match_t *match, unsigned long int context);
101
//returns a variable from a match
102
void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size);
103
//unify all the white spaces in the string
104
void UnifyWhiteSpaces(char *string);
105
//replace all the context related synonyms in the string
106
void BotReplaceSynonyms(char *string, unsigned long int context);
107
//loads a chat file for the chat state
108
int BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
109
//store the gender of the bot in the chat state
110
void BotSetChatGender(int chatstate, int gender);
111
//store the bot name in the chat state
112
void BotSetChatName(int chatstate, char *name, int client);