Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

be_ai_chat.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 //
00023 /*****************************************************************************
00024  * name:        be_ai_chat.h
00025  *
00026  * desc:        char AI
00027  *
00028  * $Archive: /source/code/botlib/be_ai_chat.h $
00029  *
00030  *****************************************************************************/
00031 
00032 #define MAX_MESSAGE_SIZE        256
00033 #define MAX_CHATTYPE_NAME       32
00034 #define MAX_MATCHVARIABLES      8
00035 
00036 #define CHAT_GENDERLESS         0
00037 #define CHAT_GENDERFEMALE       1
00038 #define CHAT_GENDERMALE         2
00039 
00040 #define CHAT_ALL                    0
00041 #define CHAT_TEAM                   1
00042 #define CHAT_TELL                   2
00043 
00044 //a console message
00045 typedef struct bot_consolemessage_s
00046 {
00047     int handle;
00048     float time;                                 //message time
00049     int type;                                   //message type
00050     char message[MAX_MESSAGE_SIZE];             //message
00051     struct bot_consolemessage_s *prev, *next;   //prev and next in list
00052 } bot_consolemessage_t;
00053 
00054 //match variable
00055 typedef struct bot_matchvariable_s
00056 {
00057     char offset;
00058     int length;
00059 } bot_matchvariable_t;
00060 //returned to AI when a match is found
00061 typedef struct bot_match_s
00062 {
00063     char string[MAX_MESSAGE_SIZE];
00064     int type;
00065     int subtype;
00066     bot_matchvariable_t variables[MAX_MATCHVARIABLES];
00067 } bot_match_t;
00068 
00069 //setup the chat AI
00070 int BotSetupChatAI(void);
00071 //shutdown the chat AI
00072 void BotShutdownChatAI(void);
00073 //returns the handle to a newly allocated chat state
00074 int BotAllocChatState(void);
00075 //frees the chatstate
00076 void BotFreeChatState(int handle);
00077 //adds a console message to the chat state
00078 void BotQueueConsoleMessage(int chatstate, int type, char *message);
00079 //removes the console message from the chat state
00080 void BotRemoveConsoleMessage(int chatstate, int handle);
00081 //returns the next console message from the state
00082 int BotNextConsoleMessage(int chatstate, bot_consolemessage_t *cm);
00083 //returns the number of console messages currently stored in the state
00084 int BotNumConsoleMessages(int chatstate);
00085 //selects a chat message of the given type
00086 void BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7);
00087 //returns the number of initial chat messages of the given type
00088 int BotNumInitialChats(int chatstate, char *type);
00089 //find and select a reply for the given message
00090 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);
00091 //returns the length of the currently selected chat message
00092 int BotChatLength(int chatstate);
00093 //enters the selected chat message
00094 void BotEnterChat(int chatstate, int clientto, int sendto);
00095 //get the chat message ready to be output
00096 void BotGetChatMessage(int chatstate, char *buf, int size);
00097 //checks if the first string contains the second one, returns index into first string or -1 if not found
00098 int StringContains(char *str1, char *str2, int casesensitive);
00099 //finds a match for the given string using the match templates
00100 int BotFindMatch(char *str, bot_match_t *match, unsigned long int context);
00101 //returns a variable from a match
00102 void BotMatchVariable(bot_match_t *match, int variable, char *buf, int size);
00103 //unify all the white spaces in the string
00104 void UnifyWhiteSpaces(char *string);
00105 //replace all the context related synonyms in the string
00106 void BotReplaceSynonyms(char *string, unsigned long int context);
00107 //loads a chat file for the chat state
00108 int BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
00109 //store the gender of the bot in the chat state
00110 void BotSetChatGender(int chatstate, int gender);
00111 //store the bot name in the chat state
00112 void BotSetChatName(int chatstate, char *name, int client);
00113 

Generated on Thu Aug 25 12:37:30 2005 for Quake III Arena by  doxygen 1.3.9.1