1 /* 2 Copyright (C) 1997-2001 Id Software, Inc. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 -------------------------------------------------------------- 19 The ACE Bot is a product of Steve Yeager, and is available from 20 the ACE Bot homepage, at http://www.axionfx.com/ace. 21 22 This program is a modification of the ACE Bot, and is therefore 23 in NO WAY supported by Steve Yeager. 24 */ 25 26 //jabot092 27 #include "AStar.h" 28 29 // declaration of botedict for the game 30 //---------------------------------------------------------- 31 #define MAX_BOT_ROAMS 128 32 33 typedef struct 34 { 35 qboolean jumpadReached; 36 qboolean TeleportReached; 37 38 float inventoryWeights[MAX_ITEMS]; 39 float playersWeights[MAX_EDICTS]; 40 float broam_timeouts[MAX_BOT_ROAMS]; //revisit bot roams 41 42 } ai_status_t; 43 44 typedef struct 45 { 46 char *netname; 47 int skillLevel; // Affects AIM and fire rate 48 int moveTypesMask; // bot can perform these moves, to check against required moves for a given path 49 50 float inventoryWeights[MAX_ITEMS]; 51 52 //class based functions 53 void (*UpdateStatus)(edict_t *ent); 54 void (*RunFrame)(edict_t *ent); 55 void (*bloquedTimeout)(edict_t *ent); 56 void (*deadFrame)(edict_t *ent); 57 58 } ai_pers_t; 59 60 61 62 typedef struct 63 { 64 ai_pers_t pers; //persistant definition (class?) 65 ai_status_t status; //player (bot, NPC) status for AI frame 66 67 qboolean is_bot; //used for fakeclient classname determination 68 69 //NPC state 70 int state; // Bot State (WANDER, MOVE, etc) 71 float state_combat_timeout; 72 73 // movement 74 vec3_t move_vector; 75 float next_move_time; 76 float wander_timeout; 77 float bloqued_timeout; 78 float changeweapon_timeout; 79 80 // nodes 81 int current_node; 82 int goal_node; 83 int next_node; 84 int node_timeout; 85 86 int tries; 87 88 struct astarpath_s path; //jabot092 89 90 int nearest_node_tries; //for increasing radius of search with each try 91 92 } ai_handle_t; 93 94 95 // bot_cmds.c 96 qboolean BOT_Commands(edict_t *ent); 97 qboolean BOT_ServerCommand (void); 98 99 // ai_main.c 100 void AI_Init(void); 101 void AI_NewMap(void); 102 void G_FreeAI( edict_t *ent ); 103 void G_SpawnAI( edict_t *ent ); 104 105 // ai_items.c 106 void AI_EnemyAdded(edict_t *ent); 107 void AI_EnemyRemoved(edict_t *ent); 108 109 // bot_spawn.c 110 void BOT_SpawnBot (char *team, char *name, char *skin, char *userinfo); 111 void BOT_RemoveBot(char *name); 112 void BOT_Respawn (edict_t *self); 113 114 //bot_misc.c 115 //void AI_BotObituary (edict_t *self, edict_t *inflictor, edict_t *attacker); 116 117 // ai_tools.c 118 void AIDebug_ToogleBotDebug(void); 119 120 void AITools_Frame(void); 121 void AITools_DropNodes(edict_t *ent); 122 123 // safe **cough** prints 124 void debug_printf(char *fmt, ...); 125 void safe_cprintf (edict_t *ent, int printlevel, char *fmt, ...); 126 void safe_centerprintf (edict_t *ent, char *fmt, ...); 127 void safe_bprintf (int printlevel, char *fmt, ...); 128