1 /* 2 =========================================================================== 3 Copyright (C) 1999 - 2005, Id Software, Inc. 4 Copyright (C) 2000 - 2013, Raven Software, Inc. 5 Copyright (C) 2001 - 2013, Activision, Inc. 6 Copyright (C) 2013 - 2015, OpenJK contributors 7 8 This file is part of the OpenJK source code. 9 10 OpenJK is free software; you can redistribute it and/or modify it 11 under the terms of the GNU General Public License version 2 as 12 published by the Free Software Foundation. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, see <http://www.gnu.org/licenses/>. 21 =========================================================================== 22 */ 23 24 // g_public.h -- game module information visible to server 25 26 #pragma once 27 28 #include "qcommon/q_shared.h" 29 30 #define Q3_INFINITE 16777216 31 32 #define GAME_API_VERSION 1 33 34 // entity->svFlags 35 // the server does not know how to interpret most of the values 36 // in entityStates (level eType), so the game must explicitly flag 37 // special server behaviors 38 #define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects 39 #define SVF_BROADCASTCLIENTS 0x00000002 // only broadcast to clients specified in r.broadcastClients[clientNum/32] 40 #define SVF_BOT 0x00000008 // set if the entity is a bot 41 #define SVF_PLAYER_USABLE 0x00000010 // player can use this with the use button 42 #define SVF_BROADCAST 0x00000020 // send to all connected clients 43 #define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots 44 #define SVF_USE_CURRENT_ORIGIN 0x00000080 // entity->r.currentOrigin instead of entity->s.origin 45 // for link position (missiles and movers) 46 #define SVF_SINGLECLIENT 0x00000100 // only send to a single client (entityShared_t->singleClient) 47 #define SVF_NOSERVERINFO 0x00000200 // don't send CS_SERVERINFO updates to this client 48 // so that it can be updated for ping tools without 49 // lagging clients 50 #define SVF_CAPSULE 0x00000400 // use capsule for collision detection instead of bbox 51 #define SVF_NOTSINGLECLIENT 0x00000800 // send entity to everyone but one client 52 // (entityShared_t->singleClient) 53 54 #define SVF_OWNERNOTSHARED 0x00001000 // If it's owned by something and another thing owned by that something 55 // hits it, it will still touch 56 57 #define SVF_ICARUS_FREEZE 0x00008000 // NPCs are frozen, ents don't execute ICARUS commands 58 59 #define SVF_GLASS_BRUSH 0x08000000 // Ent is a glass brush 60 61 #define SVF_NO_BASIC_SOUNDS 0x10000000 // No basic sounds 62 #define SVF_NO_COMBAT_SOUNDS 0x20000000 // No combat sounds 63 #define SVF_NO_EXTRA_SOUNDS 0x40000000 // No extra or jedi sounds 64 65 //rww - ghoul2 trace flags 66 #define G2TRFLAG_DOGHOULTRACE 0x00000001 //do the ghoul2 trace 67 #define G2TRFLAG_HITCORPSES 0x00000002 //will try g2 collision on the ent even if it's EF_DEAD 68 #define G2TRFLAG_GETSURFINDEX 0x00000004 //will replace surfaceFlags with the ghoul2 surface index that was hit, if any. 69 #define G2TRFLAG_THICK 0x00000008 //assures that the trace radius will be significantly large regardless of the trace box size. 70 71 //=============================================================== 72 73 //this structure is shared by gameside and in-engine NPC nav routines. 74 typedef struct failedEdge_e 75 { 76 int startID; 77 int endID; 78 int checkTime; 79 int entID; 80 } failedEdge_t; 81 82 typedef struct entityShared_s { 83 qboolean linked; // qfalse if not in any good cluster 84 int linkcount; 85 86 int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc 87 int singleClient; // only send to this client when SVF_SINGLECLIENT is set 88 89 qboolean bmodel; // if false, assume an explicit mins / maxs bounding box 90 // only set by trap_SetBrushModel 91 vec3_t mins, maxs; 92 int contents; // CONTENTS_TRIGGER, CONTENTS_SOLID, CONTENTS_BODY, etc 93 // a non-solid entity should set to 0 94 95 vec3_t absmin, absmax; // derived from mins/maxs and origin + rotation 96 97 // currentOrigin will be used for all collision detection and world linking. 98 // it will not necessarily be the same as the trajectory evaluation for the current 99 // time, because each entity must be moved one at a time after time is advanced 100 // to avoid simultanious collision issues 101 vec3_t currentOrigin; 102 vec3_t currentAngles; 103 qboolean mIsRoffing; // set to qtrue when the entity is being roffed 104 105 // when a trace call is made and passEntityNum != ENTITYNUM_NONE, 106 // an ent will be excluded from testing if: 107 // ent->s.number == passEntityNum (don't interact with self) 108 // ent->s.ownerNum = passEntityNum (don't interact with your own missiles) 109 // entity[ent->s.ownerNum].ownerNum = passEntityNum (don't interact with other missiles from owner) 110 int ownerNum; 111 112 // mask of clients that this entity should be broadcast to 113 // the first 32 clients are represented by the first array index and the latter 32 clients are represented by the 114 // second array index. 115 uint32_t broadcastClients[2]; 116 } entityShared_t; 117 118 //bstate.h 119 typedef enum //# bState_e 120 {//These take over only if script allows them to be autonomous 121 BS_DEFAULT = 0,//# default behavior for that NPC 122 BS_ADVANCE_FIGHT,//# Advance to captureGoal and shoot enemies if you can 123 BS_SLEEP,//# Play awake script when startled by sound 124 BS_FOLLOW_LEADER,//# Follow your leader and shoot any enemies you come across 125 BS_JUMP,//# Face navgoal and jump to it. 126 BS_SEARCH,//# Using current waypoint as a base, search the immediate branches of waypoints for enemies 127 BS_WANDER,//# Wander down random waypoint paths 128 BS_NOCLIP,//# Moves through walls, etc. 129 BS_REMOVE,//# Waits for player to leave PVS then removes itself 130 BS_CINEMATIC,//# Does nothing but face it's angles and move to a goal if it has one 131 //# #eol 132 //internal bStates only 133 BS_WAIT,//# Does nothing but face it's angles 134 BS_STAND_GUARD, 135 BS_PATROL, 136 BS_INVESTIGATE,//# head towards temp goal and look for enemies and listen for sounds 137 BS_STAND_AND_SHOOT, 138 BS_HUNT_AND_KILL, 139 BS_FLEE,//# Run away! 140 NUM_BSTATES 141 } bState_t; 142 143 enum 144 { 145 EDGE_NORMAL, 146 EDGE_PATH, 147 EDGE_BLOCKED, 148 EDGE_FAILED, 149 EDGE_MOVEDIR 150 }; 151 152 enum 153 { 154 NODE_NORMAL, 155 NODE_START, 156 NODE_GOAL, 157 NODE_NAVGOAL, 158 }; 159 160 typedef enum //# taskID_e 161 { 162 TID_CHAN_VOICE = 0, // Waiting for a voice sound to complete 163 TID_ANIM_UPPER, // Waiting to finish a lower anim holdtime 164 TID_ANIM_LOWER, // Waiting to finish a lower anim holdtime 165 TID_ANIM_BOTH, // Waiting to finish lower and upper anim holdtimes or normal md3 animating 166 TID_MOVE_NAV, // Trying to get to a navgoal or For ET_MOVERS 167 TID_ANGLE_FACE, // Turning to an angle or facing 168 TID_BSTATE, // Waiting for a certain bState to finish 169 TID_LOCATION, // Waiting for ent to enter a specific trigger_location 170 // TID_MISSIONSTATUS, // Waiting for player to finish reading MISSION STATUS SCREEN 171 TID_RESIZE, // Waiting for clear bbox to inflate size 172 TID_SHOOT, // Waiting for fire event 173 NUM_TIDS, // for def of taskID array 174 } taskID_t; 175 176 typedef enum //# bSet_e 177 {//This should check to matching a behavior state name first, then look for a script 178 BSET_INVALID = -1, 179 BSET_FIRST = 0, 180 BSET_SPAWN = 0,//# script to use when first spawned 181 BSET_USE,//# script to use when used 182 BSET_AWAKE,//# script to use when awoken/startled 183 BSET_ANGER,//# script to use when aquire an enemy 184 BSET_ATTACK,//# script to run when you attack 185 BSET_VICTORY,//# script to run when you kill someone 186 BSET_LOSTENEMY,//# script to run when you can't find your enemy 187 BSET_PAIN,//# script to use when take pain 188 BSET_FLEE,//# script to use when take pain below 50% of health 189 BSET_DEATH,//# script to use when killed 190 BSET_DELAYED,//# script to run when self->delayScriptTime is reached 191 BSET_BLOCKED,//# script to run when blocked by a friendly NPC or player 192 BSET_BUMPED,//# script to run when bumped into a friendly NPC or player (can set bumpRadius) 193 BSET_STUCK,//# script to run when blocked by a wall 194 BSET_FFIRE,//# script to run when player shoots their own teammates 195 BSET_FFDEATH,//# script to run when player kills a teammate 196 BSET_MINDTRICK,//# script to run when player does a mind trick on this NPC 197 198 NUM_BSETS 199 } bSet_t; 200 201 #define MAX_PARMS 16 202 #define MAX_PARM_STRING_LENGTH MAX_QPATH//was 16, had to lengthen it so they could take a valid file path 203 typedef struct parms_s { 204 char parm[MAX_PARMS][MAX_PARM_STRING_LENGTH]; 205 } parms_t; 206 207 #define MAX_FAILED_NODES 8 208 209 #if (!defined(MACOS_X) && !defined(__GCC__) && !defined(__GNUC__)) 210 typedef struct Vehicle_s Vehicle_t; 211 #endif 212 213 // the server looks at a sharedEntity, which is the start of the game's gentity_t structure 214 //mod authors should not touch this struct 215 typedef struct sharedEntity_s { 216 entityState_t s; // communicated by server to clients 217 playerState_t *playerState; //needs to be in the gentity for bg entity access 218 //if you want to actually see the contents I guess 219 //you will have to be sure to VMA it first. 220 #if (!defined(MACOS_X) && !defined(__GCC__) && !defined(__GNUC__)) 221 Vehicle_t *m_pVehicle; //vehicle data 222 #else 223 struct Vehicle_s *m_pVehicle; //vehicle data 224 #endif 225 void *ghoul2; //g2 instance 226 int localAnimIndex; //index locally (game/cgame) to anim data for this skel 227 vec3_t modelScale; //needed for g2 collision 228 229 //from here up must also be unified with bgEntity/centity 230 231 entityShared_t r; // shared by both the server system and game 232 233 //Script/ICARUS-related fields 234 int taskID[NUM_TIDS]; 235 parms_t *parms; 236 char *behaviorSet[NUM_BSETS]; 237 char *script_targetname; 238 int delayScriptTime; 239 char *fullName; 240 241 //rww - targetname and classname are now shared as well. ICARUS needs access to them. 242 char *targetname; 243 char *classname; // set in QuakeEd 244 245 //rww - and yet more things to share. This is because the nav code is in the exe because it's all C++. 246 int waypoint; //Set once per frame, if you've moved, and if someone asks 247 int lastWaypoint; //To make sure you don't double-back 248 int lastValidWaypoint; //ALWAYS valid -used for tracking someone you lost 249 int noWaypointTime; //Debouncer - so don't keep checking every waypoint in existance every frame that you can't find one 250 int combatPoint; 251 int failedWaypoints[MAX_FAILED_NODES]; 252 int failedWaypointCheckTime; 253 254 int next_roff_time; //rww - npc's need to know when they're getting roff'd 255 } sharedEntity_t; 256 257 #if !defined(_GAME) && defined(__cplusplus) 258 class CSequencer; 259 class CTaskManager; 260 261 //I suppose this could be in another in-engine header or something. But we never want to 262 //include an icarus file before sharedentity_t is declared. 263 extern CSequencer *gSequencers[MAX_GENTITIES]; 264 extern CTaskManager *gTaskManagers[MAX_GENTITIES]; 265 266 #include "icarus/icarus.h" 267 #include "icarus/sequencer.h" 268 #include "icarus/taskmanager.h" 269 #endif 270 271 typedef struct T_G_ICARUS_PLAYSOUND_s { 272 int taskID; 273 int entID; 274 char name[2048]; 275 char channel[2048]; 276 } T_G_ICARUS_PLAYSOUND; 277 278 279 typedef struct T_G_ICARUS_SET_s { 280 int taskID; 281 int entID; 282 char type_name[2048]; 283 char data[2048]; 284 } T_G_ICARUS_SET; 285 286 typedef struct T_G_ICARUS_LERP2POS_s { 287 int taskID; 288 int entID; 289 vec3_t origin; 290 vec3_t angles; 291 float duration; 292 qboolean nullAngles; //special case 293 } T_G_ICARUS_LERP2POS; 294 295 typedef struct T_G_ICARUS_LERP2ORIGIN_s { 296 int taskID; 297 int entID; 298 vec3_t origin; 299 float duration; 300 } T_G_ICARUS_LERP2ORIGIN; 301 302 typedef struct T_G_ICARUS_LERP2ANGLES_s { 303 int taskID; 304 int entID; 305 vec3_t angles; 306 float duration; 307 } T_G_ICARUS_LERP2ANGLES; 308 309 typedef struct T_G_ICARUS_GETTAG_s { 310 int entID; 311 char name[2048]; 312 int lookup; 313 vec3_t info; 314 } T_G_ICARUS_GETTAG; 315 316 typedef struct T_G_ICARUS_LERP2START_s { 317 int entID; 318 int taskID; 319 float duration; 320 } T_G_ICARUS_LERP2START; 321 322 typedef struct T_G_ICARUS_LERP2END_s { 323 int entID; 324 int taskID; 325 float duration; 326 } T_G_ICARUS_LERP2END; 327 328 typedef struct T_G_ICARUS_USE_s { 329 int entID; 330 char target[2048]; 331 } T_G_ICARUS_USE; 332 333 typedef struct T_G_ICARUS_KILL_s { 334 int entID; 335 char name[2048]; 336 } T_G_ICARUS_KILL; 337 338 typedef struct T_G_ICARUS_REMOVE_s { 339 int entID; 340 char name[2048]; 341 } T_G_ICARUS_REMOVE; 342 343 typedef struct T_G_ICARUS_PLAY_s { 344 int taskID; 345 int entID; 346 char type[2048]; 347 char name[2048]; 348 } T_G_ICARUS_PLAY; 349 350 typedef struct T_G_ICARUS_GETFLOAT_s { 351 int entID; 352 int type; 353 char name[2048]; 354 float value; 355 } T_G_ICARUS_GETFLOAT; 356 357 typedef struct T_G_ICARUS_GETVECTOR_s { 358 int entID; 359 int type; 360 char name[2048]; 361 vec3_t value; 362 } T_G_ICARUS_GETVECTOR; 363 364 typedef struct T_G_ICARUS_GETSTRING_s { 365 int entID; 366 int type; 367 char name[2048]; 368 char value[2048]; 369 } T_G_ICARUS_GETSTRING; 370 371 typedef struct T_G_ICARUS_SOUNDINDEX_s { 372 char filename[2048]; 373 } T_G_ICARUS_SOUNDINDEX; 374 typedef struct T_G_ICARUS_GETSETIDFORSTRING_s { 375 char string[2048]; 376 } T_G_ICARUS_GETSETIDFORSTRING; 377 378 typedef enum gameImportLegacy_e { 379 G_PRINT, 380 G_ERROR, 381 G_MILLISECONDS, 382 G_PRECISIONTIMER_START, 383 G_PRECISIONTIMER_END, 384 G_CVAR_REGISTER, 385 G_CVAR_UPDATE, 386 G_CVAR_SET, 387 G_CVAR_VARIABLE_INTEGER_VALUE, 388 G_CVAR_VARIABLE_STRING_BUFFER, 389 G_ARGC, 390 G_ARGV, 391 G_FS_FOPEN_FILE, 392 G_FS_READ, 393 G_FS_WRITE, 394 G_FS_FCLOSE_FILE, 395 G_SEND_CONSOLE_COMMAND, 396 G_LOCATE_GAME_DATA, 397 G_DROP_CLIENT, 398 G_SEND_SERVER_COMMAND, 399 G_SET_CONFIGSTRING, 400 G_GET_CONFIGSTRING, 401 G_GET_USERINFO, 402 G_SET_USERINFO, 403 G_GET_SERVERINFO, 404 G_SET_SERVER_CULL, 405 G_SET_BRUSH_MODEL, 406 G_TRACE, 407 G_G2TRACE, 408 G_POINT_CONTENTS, 409 G_IN_PVS, 410 G_IN_PVS_IGNORE_PORTALS, 411 G_ADJUST_AREA_PORTAL_STATE, 412 G_AREAS_CONNECTED, 413 G_LINKENTITY, 414 G_UNLINKENTITY, 415 G_ENTITIES_IN_BOX, 416 G_ENTITY_CONTACT, 417 G_BOT_ALLOCATE_CLIENT, 418 G_BOT_FREE_CLIENT, 419 G_GET_USERCMD, 420 G_GET_ENTITY_TOKEN, 421 G_SIEGEPERSSET, 422 G_SIEGEPERSGET, 423 G_FS_GETFILELIST, 424 G_DEBUG_POLYGON_CREATE, 425 G_DEBUG_POLYGON_DELETE, 426 G_REAL_TIME, 427 G_SNAPVECTOR, 428 G_TRACECAPSULE, 429 G_ENTITY_CONTACTCAPSULE, 430 SP_GETSTRINGTEXTSTRING, 431 G_ROFF_CLEAN, 432 G_ROFF_UPDATE_ENTITIES, 433 G_ROFF_CACHE, 434 G_ROFF_PLAY, 435 G_ROFF_PURGE_ENT, 436 G_TRUEMALLOC, 437 G_TRUEFREE, 438 G_ICARUS_RUNSCRIPT, 439 G_ICARUS_REGISTERSCRIPT, 440 G_ICARUS_INIT, 441 G_ICARUS_VALIDENT, 442 G_ICARUS_ISINITIALIZED, 443 G_ICARUS_MAINTAINTASKMANAGER, 444 G_ICARUS_ISRUNNING, 445 G_ICARUS_TASKIDPENDING, 446 G_ICARUS_INITENT, 447 G_ICARUS_FREEENT, 448 G_ICARUS_ASSOCIATEENT, 449 G_ICARUS_SHUTDOWN, 450 G_ICARUS_TASKIDSET, 451 G_ICARUS_TASKIDCOMPLETE, 452 G_ICARUS_SETVAR, 453 G_ICARUS_VARIABLEDECLARED, 454 G_ICARUS_GETFLOATVARIABLE, 455 G_ICARUS_GETSTRINGVARIABLE, 456 G_ICARUS_GETVECTORVARIABLE, 457 G_SET_SHARED_BUFFER, 458 459 G_MEMSET = 100, 460 G_MEMCPY, 461 G_STRNCPY, 462 G_SIN, 463 G_COS, 464 G_ATAN2, 465 G_SQRT, 466 G_MATRIXMULTIPLY, 467 G_ANGLEVECTORS, 468 G_PERPENDICULARVECTOR, 469 G_FLOOR, 470 G_CEIL, 471 G_TESTPRINTINT, 472 G_TESTPRINTFLOAT, 473 G_ACOS, 474 G_ASIN, 475 476 G_NAV_INIT = 200, 477 G_NAV_FREE, 478 G_NAV_LOAD, 479 G_NAV_SAVE, 480 G_NAV_ADDRAWPOINT, 481 G_NAV_CALCULATEPATHS, 482 G_NAV_HARDCONNECT, 483 G_NAV_SHOWNODES, 484 G_NAV_SHOWEDGES, 485 G_NAV_SHOWPATH, 486 G_NAV_GETNEARESTNODE, 487 G_NAV_GETBESTNODE, 488 G_NAV_GETNODEPOSITION, 489 G_NAV_GETNODENUMEDGES, 490 G_NAV_GETNODEEDGE, 491 G_NAV_GETNUMNODES, 492 G_NAV_CONNECTED, 493 G_NAV_GETPATHCOST, 494 G_NAV_GETEDGECOST, 495 G_NAV_GETPROJECTEDNODE, 496 G_NAV_CHECKFAILEDNODES, 497 G_NAV_ADDFAILEDNODE, 498 G_NAV_NODEFAILED, 499 G_NAV_NODESARENEIGHBORS, 500 G_NAV_CLEARFAILEDEDGE, 501 G_NAV_CLEARALLFAILEDEDGES, 502 G_NAV_EDGEFAILED, 503 G_NAV_ADDFAILEDEDGE, 504 G_NAV_CHECKFAILEDEDGE, 505 G_NAV_CHECKALLFAILEDEDGES, 506 G_NAV_ROUTEBLOCKED, 507 G_NAV_GETBESTNODEALTROUTE, 508 G_NAV_GETBESTNODEALT2, 509 G_NAV_GETBESTPATHBETWEENENTS, 510 G_NAV_GETNODERADIUS, 511 G_NAV_CHECKBLOCKEDEDGES, 512 G_NAV_CLEARCHECKEDNODES, 513 G_NAV_CHECKEDNODE, 514 G_NAV_SETCHECKEDNODE, 515 G_NAV_FLAGALLNODES, 516 G_NAV_GETPATHSCALCULATED, 517 G_NAV_SETPATHSCALCULATED, 518 519 BOTLIB_SETUP = 250, 520 BOTLIB_SHUTDOWN, 521 BOTLIB_LIBVAR_SET, 522 BOTLIB_LIBVAR_GET, 523 BOTLIB_PC_ADD_GLOBAL_DEFINE, 524 BOTLIB_START_FRAME, 525 BOTLIB_LOAD_MAP, 526 BOTLIB_UPDATENTITY, 527 BOTLIB_TEST, 528 BOTLIB_GET_SNAPSHOT_ENTITY, 529 BOTLIB_GET_CONSOLE_MESSAGE, 530 BOTLIB_USER_COMMAND, 531 532 BOTLIB_AAS_ENABLE_ROUTING_AREA = 300, 533 BOTLIB_AAS_BBOX_AREAS, 534 BOTLIB_AAS_AREA_INFO, 535 BOTLIB_AAS_ENTITY_INFO, 536 BOTLIB_AAS_INITIALIZED, 537 BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX, 538 BOTLIB_AAS_TIME, 539 BOTLIB_AAS_POINT_AREA_NUM, 540 BOTLIB_AAS_TRACE_AREAS, 541 BOTLIB_AAS_POINT_CONTENTS, 542 BOTLIB_AAS_NEXT_BSP_ENTITY, 543 BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY, 544 BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY, 545 BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY, 546 BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY, 547 BOTLIB_AAS_AREA_REACHABILITY, 548 BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA, 549 BOTLIB_AAS_SWIMMING, 550 BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT, 551 552 BOTLIB_EA_SAY = 400, 553 BOTLIB_EA_SAY_TEAM, 554 BOTLIB_EA_COMMAND, 555 BOTLIB_EA_ACTION, 556 BOTLIB_EA_GESTURE, 557 BOTLIB_EA_TALK, 558 BOTLIB_EA_ATTACK, 559 BOTLIB_EA_ALT_ATTACK, 560 BOTLIB_EA_FORCEPOWER, 561 BOTLIB_EA_USE, 562 BOTLIB_EA_RESPAWN, 563 BOTLIB_EA_CROUCH, 564 BOTLIB_EA_MOVE_UP, 565 BOTLIB_EA_MOVE_DOWN, 566 BOTLIB_EA_MOVE_FORWARD, 567 BOTLIB_EA_MOVE_BACK, 568 BOTLIB_EA_MOVE_LEFT, 569 BOTLIB_EA_MOVE_RIGHT, 570 BOTLIB_EA_SELECT_WEAPON, 571 BOTLIB_EA_JUMP, 572 BOTLIB_EA_DELAYED_JUMP, 573 BOTLIB_EA_MOVE, 574 BOTLIB_EA_VIEW, 575 BOTLIB_EA_END_REGULAR, 576 BOTLIB_EA_GET_INPUT, 577 BOTLIB_EA_RESET_INPUT, 578 579 BOTLIB_AI_LOAD_CHARACTER = 500, 580 BOTLIB_AI_FREE_CHARACTER, 581 BOTLIB_AI_CHARACTERISTIC_FLOAT, 582 BOTLIB_AI_CHARACTERISTIC_BFLOAT, 583 BOTLIB_AI_CHARACTERISTIC_INTEGER, 584 BOTLIB_AI_CHARACTERISTIC_BINTEGER, 585 BOTLIB_AI_CHARACTERISTIC_STRING, 586 BOTLIB_AI_ALLOC_CHAT_STATE, 587 BOTLIB_AI_FREE_CHAT_STATE, 588 BOTLIB_AI_QUEUE_CONSOLE_MESSAGE, 589 BOTLIB_AI_REMOVE_CONSOLE_MESSAGE, 590 BOTLIB_AI_NEXT_CONSOLE_MESSAGE, 591 BOTLIB_AI_NUM_CONSOLE_MESSAGE, 592 BOTLIB_AI_INITIAL_CHAT, 593 BOTLIB_AI_REPLY_CHAT, 594 BOTLIB_AI_CHAT_LENGTH, 595 BOTLIB_AI_ENTER_CHAT, 596 BOTLIB_AI_STRING_CONTAINS, 597 BOTLIB_AI_FIND_MATCH, 598 BOTLIB_AI_MATCH_VARIABLE, 599 BOTLIB_AI_UNIFY_WHITE_SPACES, 600 BOTLIB_AI_REPLACE_SYNONYMS, 601 BOTLIB_AI_LOAD_CHAT_FILE, 602 BOTLIB_AI_SET_CHAT_GENDER, 603 BOTLIB_AI_SET_CHAT_NAME, 604 BOTLIB_AI_RESET_GOAL_STATE, 605 BOTLIB_AI_RESET_AVOID_GOALS, 606 BOTLIB_AI_PUSH_GOAL, 607 BOTLIB_AI_POP_GOAL, 608 BOTLIB_AI_EMPTY_GOAL_STACK, 609 BOTLIB_AI_DUMP_AVOID_GOALS, 610 BOTLIB_AI_DUMP_GOAL_STACK, 611 BOTLIB_AI_GOAL_NAME, 612 BOTLIB_AI_GET_TOP_GOAL, 613 BOTLIB_AI_GET_SECOND_GOAL, 614 BOTLIB_AI_CHOOSE_LTG_ITEM, 615 BOTLIB_AI_CHOOSE_NBG_ITEM, 616 BOTLIB_AI_TOUCHING_GOAL, 617 BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE, 618 BOTLIB_AI_GET_LEVEL_ITEM_GOAL, 619 BOTLIB_AI_AVOID_GOAL_TIME, 620 BOTLIB_AI_INIT_LEVEL_ITEMS, 621 BOTLIB_AI_UPDATE_ENTITY_ITEMS, 622 BOTLIB_AI_LOAD_ITEM_WEIGHTS, 623 BOTLIB_AI_FREE_ITEM_WEIGHTS, 624 BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC, 625 BOTLIB_AI_ALLOC_GOAL_STATE, 626 BOTLIB_AI_FREE_GOAL_STATE, 627 BOTLIB_AI_RESET_MOVE_STATE, 628 BOTLIB_AI_MOVE_TO_GOAL, 629 BOTLIB_AI_MOVE_IN_DIRECTION, 630 BOTLIB_AI_RESET_AVOID_REACH, 631 BOTLIB_AI_RESET_LAST_AVOID_REACH, 632 BOTLIB_AI_REACHABILITY_AREA, 633 BOTLIB_AI_MOVEMENT_VIEW_TARGET, 634 BOTLIB_AI_ALLOC_MOVE_STATE, 635 BOTLIB_AI_FREE_MOVE_STATE, 636 BOTLIB_AI_INIT_MOVE_STATE, 637 BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON, 638 BOTLIB_AI_GET_WEAPON_INFO, 639 BOTLIB_AI_LOAD_WEAPON_WEIGHTS, 640 BOTLIB_AI_ALLOC_WEAPON_STATE, 641 BOTLIB_AI_FREE_WEAPON_STATE, 642 BOTLIB_AI_RESET_WEAPON_STATE, 643 BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION, 644 BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC, 645 BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC, 646 BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL, 647 BOTLIB_AI_GET_MAP_LOCATION_GOAL, 648 BOTLIB_AI_NUM_INITIAL_CHATS, 649 BOTLIB_AI_GET_CHAT_MESSAGE, 650 BOTLIB_AI_REMOVE_FROM_AVOID_GOALS, 651 BOTLIB_AI_PREDICT_VISIBLE_POSITION, 652 BOTLIB_AI_SET_AVOID_GOAL_TIME, 653 BOTLIB_AI_ADD_AVOID_SPOT, 654 BOTLIB_AAS_ALTERNATIVE_ROUTE_GOAL, 655 BOTLIB_AAS_PREDICT_ROUTE, 656 BOTLIB_AAS_POINT_REACHABILITY_AREA_INDEX, 657 BOTLIB_PC_LOAD_SOURCE, 658 BOTLIB_PC_FREE_SOURCE, 659 BOTLIB_PC_READ_TOKEN, 660 BOTLIB_PC_SOURCE_FILE_AND_LINE, 661 662 G_R_REGISTERSKIN, 663 G_G2_LISTBONES, 664 G_G2_LISTSURFACES, 665 G_G2_HAVEWEGHOULMODELS, 666 G_G2_SETMODELS, 667 G_G2_GETBOLT, 668 G_G2_GETBOLT_NOREC, 669 G_G2_GETBOLT_NOREC_NOROT, 670 G_G2_INITGHOUL2MODEL, 671 G_G2_SETSKIN, 672 G_G2_SIZE, 673 G_G2_ADDBOLT, 674 G_G2_SETBOLTINFO, 675 G_G2_ANGLEOVERRIDE, 676 G_G2_PLAYANIM, 677 G_G2_GETBONEANIM, 678 G_G2_GETGLANAME, 679 G_G2_COPYGHOUL2INSTANCE, 680 G_G2_COPYSPECIFICGHOUL2MODEL, 681 G_G2_DUPLICATEGHOUL2INSTANCE, 682 G_G2_HASGHOUL2MODELONINDEX, 683 G_G2_REMOVEGHOUL2MODEL, 684 G_G2_REMOVEGHOUL2MODELS, 685 G_G2_CLEANMODELS, 686 G_G2_COLLISIONDETECT, 687 G_G2_COLLISIONDETECTCACHE, 688 G_G2_SETROOTSURFACE, 689 G_G2_SETSURFACEONOFF, 690 G_G2_SETNEWORIGIN, 691 G_G2_DOESBONEEXIST, 692 G_G2_GETSURFACERENDERSTATUS, 693 G_G2_ABSURDSMOOTHING, 694 G_G2_SETRAGDOLL, 695 G_G2_ANIMATEG2MODELS, 696 G_G2_RAGPCJCONSTRAINT, 697 G_G2_RAGPCJGRADIENTSPEED, 698 G_G2_RAGEFFECTORGOAL, 699 G_G2_GETRAGBONEPOS, 700 G_G2_RAGEFFECTORKICK, 701 G_G2_RAGFORCESOLVE, 702 G_G2_SETBONEIKSTATE, 703 G_G2_IKMOVE, 704 G_G2_REMOVEBONE, 705 G_G2_ATTACHINSTANCETOENTNUM, 706 G_G2_CLEARATTACHEDINSTANCE, 707 G_G2_CLEANENTATTACHMENTS, 708 G_G2_OVERRIDESERVER, 709 G_G2_GETSURFACENAME, 710 G_SET_ACTIVE_SUBBSP, 711 G_CM_REGISTER_TERRAIN, 712 G_RMG_INIT, 713 G_BOT_UPDATEWAYPOINTS, 714 G_BOT_CALCULATEPATHS 715 } gameImportLegacy_t; 716 717 typedef enum gameExportLegacy_e { 718 GAME_INIT, 719 GAME_SHUTDOWN, 720 GAME_CLIENT_CONNECT, 721 GAME_CLIENT_BEGIN, 722 GAME_CLIENT_USERINFO_CHANGED, 723 GAME_CLIENT_DISCONNECT, 724 GAME_CLIENT_COMMAND, 725 GAME_CLIENT_THINK, 726 GAME_RUN_FRAME, 727 GAME_CONSOLE_COMMAND, 728 BOTAI_START_FRAME, 729 GAME_ROFF_NOTETRACK_CALLBACK, 730 GAME_SPAWN_RMG_ENTITY, 731 GAME_ICARUS_PLAYSOUND, 732 GAME_ICARUS_SET, 733 GAME_ICARUS_LERP2POS, 734 GAME_ICARUS_LERP2ORIGIN, 735 GAME_ICARUS_LERP2ANGLES, 736 GAME_ICARUS_GETTAG, 737 GAME_ICARUS_LERP2START, 738 GAME_ICARUS_LERP2END, 739 GAME_ICARUS_USE, 740 GAME_ICARUS_KILL, 741 GAME_ICARUS_REMOVE, 742 GAME_ICARUS_PLAY, 743 GAME_ICARUS_GETFLOAT, 744 GAME_ICARUS_GETVECTOR, 745 GAME_ICARUS_GETSTRING, 746 GAME_ICARUS_SOUNDINDEX, 747 GAME_ICARUS_GETSETIDFORSTRING, 748 GAME_NAV_CLEARPATHTOPOINT, 749 GAME_NAV_CLEARLOS, 750 GAME_NAV_CLEARPATHBETWEENPOINTS, 751 GAME_NAV_CHECKNODEFAILEDFORENT, 752 GAME_NAV_ENTISUNLOCKEDDOOR, 753 GAME_NAV_ENTISDOOR, 754 GAME_NAV_ENTISBREAKABLE, 755 GAME_NAV_ENTISREMOVABLEUSABLE, 756 GAME_NAV_FINDCOMBATPOINTWAYPOINTS, 757 GAME_GETITEMINDEXBYTAG 758 } gameExportLegacy_t; 759 760 typedef struct gameImport_s { 761 // misc 762 void (*Print) ( const char *msg, ... ); 763 NORETURN_PTR void (*Error)( int level, const char *fmt, ... ); 764 int (*Milliseconds) ( void ); 765 void (*PrecisionTimerStart) ( void **timer ); 766 int (*PrecisionTimerEnd) ( void *timer ); 767 void (*SV_RegisterSharedMemory) ( char *memory ); 768 int (*RealTime) ( qtime_t *qtime ); 769 void (*TrueMalloc) ( void **ptr, int size ); 770 void (*TrueFree) ( void **ptr ); 771 void (*SnapVector) ( float *v ); 772 773 // cvar 774 void (*Cvar_Register) ( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, uint32_t flags ); 775 void (*Cvar_Set) ( const char *var_name, const char *value ); 776 void (*Cvar_Update) ( vmCvar_t *vmCvar ); 777 int (*Cvar_VariableIntegerValue) ( const char *var_name ); 778 void (*Cvar_VariableStringBuffer) ( const char *var_name, char *buffer, int bufsize ); 779 780 // cmd 781 int (*Argc) ( void ); 782 void (*Argv) ( int n, char *buffer, int bufferLength ); 783 784 // filesystem 785 void (*FS_Close) ( fileHandle_t f ); 786 int (*FS_GetFileList) ( const char *path, const char *extension, char *listbuf, int bufsize ); 787 int (*FS_Open) ( const char *qpath, fileHandle_t *f, fsMode_t mode ); 788 int (*FS_Read) ( void *buffer, int len, fileHandle_t f ); 789 int (*FS_Write) ( const void *buffer, int len, fileHandle_t f ); 790 791 // server 792 void (*AdjustAreaPortalState) ( sharedEntity_t *ent, qboolean open ); 793 qboolean (*AreasConnected) ( int area1, int area2 ); 794 int (*DebugPolygonCreate) ( int color, int numPoints, vec3_t *points ); 795 void (*DebugPolygonDelete) ( int id ); 796 void (*DropClient) ( int clientNum, const char *reason ); 797 int (*EntitiesInBox) ( const vec3_t mins, const vec3_t maxs, int *list, int maxcount ); 798 qboolean (*EntityContact) ( const vec3_t mins, const vec3_t maxs, const sharedEntity_t *ent, int capsule ); 799 void (*GetConfigstring) ( int num, char *buffer, int bufferSize ); 800 qboolean (*GetEntityToken) ( char *buffer, int bufferSize ); 801 void (*GetServerinfo) ( char *buffer, int bufferSize ); 802 void (*GetUsercmd) ( int clientNum, usercmd_t *cmd ); 803 void (*GetUserinfo) ( int num, char *buffer, int bufferSize ); 804 qboolean (*InPVS) ( const vec3_t p1, const vec3_t p2 ); 805 qboolean (*InPVSIgnorePortals) ( const vec3_t p1, const vec3_t p2 ); 806 void (*LinkEntity) ( sharedEntity_t *ent ); 807 void (*LocateGameData) ( sharedEntity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *clients, int sizeofGClient ); 808 int (*PointContents) ( const vec3_t point, int passEntityNum ); 809 void (*SendConsoleCommand) ( int exec_when, const char *text ); 810 void (*SendServerCommand) ( int clientNum, const char *text ); 811 void (*SetBrushModel) ( sharedEntity_t *ent, const char *name ); 812 void (*SetConfigstring) ( int num, const char *string ); 813 void (*SetServerCull) ( float cullDistance ); 814 void (*SetUserinfo) ( int num, const char *buffer ); 815 void (*SiegePersSet) ( siegePers_t *pers ); 816 void (*SiegePersGet) ( siegePers_t *pers ); 817 void (*Trace) ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask, int capsule, int traceFlags, int useLod ); 818 void (*UnlinkEntity) ( sharedEntity_t *ent ); 819 820 // ROFF 821 qboolean (*ROFF_Clean) ( void ); 822 void (*ROFF_UpdateEntities) ( void ); 823 int (*ROFF_Cache) ( char *file ); 824 qboolean (*ROFF_Play) ( int entID, int roffID, qboolean doTranslation ); 825 qboolean (*ROFF_Purge_Ent) ( int entID ); 826 827 // ICARUS 828 int (*ICARUS_RunScript) ( sharedEntity_t *ent, const char *name ); 829 qboolean (*ICARUS_RegisterScript) ( const char *name, qboolean bCalledDuringInterrogate ); 830 void (*ICARUS_Init) ( void ); 831 qboolean (*ICARUS_ValidEnt) ( sharedEntity_t *ent ); 832 qboolean (*ICARUS_IsInitialized) ( int entID ); 833 qboolean (*ICARUS_MaintainTaskManager) ( int entID ); 834 qboolean (*ICARUS_IsRunning) ( int entID ); 835 qboolean (*ICARUS_TaskIDPending) ( sharedEntity_t *ent, int taskID ); 836 void (*ICARUS_InitEnt) ( sharedEntity_t *ent ); 837 void (*ICARUS_FreeEnt) ( sharedEntity_t *ent ); 838 void (*ICARUS_AssociateEnt) ( sharedEntity_t *ent ); 839 void (*ICARUS_Shutdown) ( void ); 840 void (*ICARUS_TaskIDSet) ( sharedEntity_t *ent, int taskType, int taskID ); 841 void (*ICARUS_TaskIDComplete) ( sharedEntity_t *ent, int taskType ); 842 void (*ICARUS_SetVar) ( int taskID, int entID, const char *type_name, const char *data ); 843 int (*ICARUS_VariableDeclared) ( const char *type_name ); 844 int (*ICARUS_GetFloatVariable) ( const char *name, float *value ); 845 int (*ICARUS_GetStringVariable) ( const char *name, const char *value ); 846 int (*ICARUS_GetVectorVariable) ( const char *name, const vec3_t value ); 847 848 // navigation 849 void (*Nav_Init) ( void ); 850 void (*Nav_Free) ( void ); 851 qboolean (*Nav_Load) ( const char *filename, int checksum ); 852 qboolean (*Nav_Save) ( const char *filename, int checksum ); 853 int (*Nav_AddRawPoint) ( vec3_t point, int flags, int radius ); 854 void (*Nav_CalculatePaths) ( qboolean recalc ); 855 void (*Nav_HardConnect) ( int first, int second ); 856 void (*Nav_ShowNodes) ( void ); 857 void (*Nav_ShowEdges) ( void ); 858 void (*Nav_ShowPath) ( int start, int end ); 859 int (*Nav_GetNearestNode) ( sharedEntity_t *ent, int lastID, int flags, int targetID ); 860 int (*Nav_GetBestNode) ( int startID, int endID, int rejectID ); 861 int (*Nav_GetNodePosition) ( int nodeID, vec3_t out ); 862 int (*Nav_GetNodeNumEdges) ( int nodeID ); 863 int (*Nav_GetNodeEdge) ( int nodeID, int edge ); 864 int (*Nav_GetNumNodes) ( void ); 865 qboolean (*Nav_Connected) ( int startID, int endID ); 866 int (*Nav_GetPathCost) ( int startID, int endID ); 867 int (*Nav_GetEdgeCost) ( int startID, int endID ); 868 int (*Nav_GetProjectedNode) ( vec3_t origin, int nodeID ); 869 void (*Nav_CheckFailedNodes) ( sharedEntity_t *ent ); 870 void (*Nav_AddFailedNode) ( sharedEntity_t *ent, int nodeID ); 871 qboolean (*Nav_NodeFailed) ( sharedEntity_t *ent, int nodeID ); 872 qboolean (*Nav_NodesAreNeighbors) ( int startID, int endID ); 873 void (*Nav_ClearFailedEdge) ( failedEdge_t *failedEdge ); 874 void (*Nav_ClearAllFailedEdges) ( void ); 875 int (*Nav_EdgeFailed) ( int startID, int endID ); 876 void (*Nav_AddFailedEdge) ( int entID, int startID, int endID ); 877 qboolean (*Nav_CheckFailedEdge) ( failedEdge_t *failedEdge ); 878 void (*Nav_CheckAllFailedEdges) ( void ); 879 qboolean (*Nav_RouteBlocked) ( int startID, int testEdgeID, int endID, int rejectRank ); 880 int (*Nav_GetBestNodeAltRoute) ( int startID, int endID, int *pathCost, int rejectID ); 881 int (*Nav_GetBestNodeAltRoute2) ( int startID, int endID, int rejectID ); 882 int (*Nav_GetBestPathBetweenEnts) ( sharedEntity_t *ent, sharedEntity_t *goal, int flags ); 883 int (*Nav_GetNodeRadius) ( int nodeID ); 884 void (*Nav_CheckBlockedEdges) ( void ); 885 void (*Nav_ClearCheckedNodes) ( void ); 886 int (*Nav_CheckedNode) ( int wayPoint, int ent ); 887 void (*Nav_SetCheckedNode) ( int wayPoint, int ent, int value ); 888 void (*Nav_FlagAllNodes) ( int newFlag ); 889 qboolean (*Nav_GetPathsCalculated) ( void ); 890 void (*Nav_SetPathsCalculated) ( qboolean newVal ); 891 892 // botlib 893 int (*BotAllocateClient) ( void ); 894 void (*BotFreeClient) ( int clientNum ); 895 int (*BotLoadCharacter) ( char *charfile, float skill ); 896 void (*BotFreeCharacter) ( int character ); 897 float (*Characteristic_Float) ( int character, int index ); 898 float (*Characteristic_BFloat) ( int character, int index, float min, float max ); 899 int (*Characteristic_Integer) ( int character, int index ); 900 int (*Characteristic_BInteger) ( int character, int index, int min, int max ); 901 void (*Characteristic_String) ( int character, int index, char *buf, int size ); 902 int (*BotAllocChatState) ( void ); 903 void (*BotFreeChatState) ( int handle ); 904 void (*BotQueueConsoleMessage) ( int chatstate, int type, char *message ); 905 void (*BotRemoveConsoleMessage) ( int chatstate, int handle ); 906 int (*BotNextConsoleMessage) ( int chatstate, void *cm ); 907 int (*BotNumConsoleMessages) ( int chatstate ); 908 void (*BotInitialChat) ( int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 ); 909 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 ); 910 int (*BotChatLength) ( int chatstate ); 911 void (*BotEnterChat) ( int chatstate, int client, int sendto ); 912 int (*StringContains) ( char *str1, char *str2, int casesensitive ); 913 int (*BotFindMatch) ( char *str, void *match, unsigned long int context ); 914 void (*BotMatchVariable) ( void *match, int variable, char *buf, int size ); 915 void (*UnifyWhiteSpaces) ( char *string ); 916 void (*BotReplaceSynonyms) ( char *string, unsigned long int context ); 917 int (*BotLoadChatFile) ( int chatstate, char *chatfile, char *chatname ); 918 void (*BotSetChatGender) ( int chatstate, int gender ); 919 void (*BotSetChatName) ( int chatstate, char *name, int client ); 920 void (*BotResetGoalState) ( int goalstate ); 921 void (*BotResetAvoidGoals) ( int goalstate ); 922 void (*BotPushGoal) ( int goalstate, void *goal ); 923 void (*BotPopGoal) ( int goalstate ); 924 void (*BotEmptyGoalStack) ( int goalstate ); 925 void (*BotDumpAvoidGoals) ( int goalstate ); 926 void (*BotDumpGoalStack) ( int goalstate ); 927 void (*BotGoalName) ( int number, char *name, int size ); 928 int (*BotGetTopGoal) ( int goalstate, void *goal ); 929 int (*BotGetSecondGoal) ( int goalstate, void *goal ); 930 int (*BotChooseLTGItem) ( int goalstate, vec3_t origin, int *inventory, int travelflags ); 931 int (*BotChooseNBGItem) ( int goalstate, vec3_t origin, int *inventory, int travelflags, void *ltg, float maxtime ); 932 int (*BotTouchingGoal) ( vec3_t origin, void *goal ); 933 int (*BotItemGoalInVisButNotVisible) ( int viewer, vec3_t eye, vec3_t viewangles, void *goal ); 934 int (*BotGetLevelItemGoal) ( int index, char *classname, void *goal ); 935 float (*BotAvoidGoalTime) ( int goalstate, int number ); 936 void (*BotInitLevelItems) ( void ); 937 void (*BotUpdateEntityItems) ( void ); 938 int (*BotLoadItemWeights) ( int goalstate, char *filename ); 939 void (*BotFreeItemWeights) ( int goalstate ); 940 void (*BotSaveGoalFuzzyLogic) ( int goalstate, char *filename ); 941 int (*BotAllocGoalState) ( int state ); 942 void (*BotFreeGoalState) ( int handle ); 943 void (*BotResetMoveState) ( int movestate ); 944 void (*BotMoveToGoal) ( void *result, int movestate, void *goal, int travelflags ); 945 int (*BotMoveInDirection) ( int movestate, vec3_t dir, float speed, int type ); 946 void (*BotResetAvoidReach) ( int movestate ); 947 void (*BotResetLastAvoidReach) ( int movestate ); 948 int (*BotReachabilityArea) ( vec3_t origin, int testground ); 949 int (*BotMovementViewTarget) ( int movestate, void *goal, int travelflags, float lookahead, vec3_t target ); 950 int (*BotAllocMoveState) ( void ); 951 void (*BotFreeMoveState) ( int handle ); 952 void (*BotInitMoveState) ( int handle, void *initmove ); 953 int (*BotChooseBestFightWeapon) ( int weaponstate, int *inventory ); 954 void (*BotGetWeaponInfo) ( int weaponstate, int weapon, void *weaponinfo ); 955 int (*BotLoadWeaponWeights) ( int weaponstate, char *filename ); 956 int (*BotAllocWeaponState) ( void ); 957 void (*BotFreeWeaponState) ( int weaponstate ); 958 void (*BotResetWeaponState) ( int weaponstate ); 959 int (*GeneticParentsAndChildSelection) ( int numranks, float *ranks, int *parent1, int *parent2, int *child ); 960 void (*BotInterbreedGoalFuzzyLogic) ( int parent1, int parent2, int child ); 961 void (*BotMutateGoalFuzzyLogic) ( int goalstate, float range ); 962 int (*BotGetNextCampSpotGoal) ( int num, void *goal ); 963 int (*BotGetMapLocationGoal) ( char *name, void *goal ); 964 int (*BotNumInitialChats) ( int chatstate, char *type ); 965 void (*BotGetChatMessage) ( int chatstate, char *buf, int size ); 966 void (*BotRemoveFromAvoidGoals) ( int goalstate, int number ); 967 int (*BotPredictVisiblePosition) ( vec3_t origin, int areanum, void *goal, int travelflags, vec3_t target ); 968 void (*BotSetAvoidGoalTime) ( int goalstate, int number, float avoidtime ); 969 void (*BotAddAvoidSpot) ( int movestate, vec3_t origin, float radius, int type ); 970 int (*BotLibSetup) ( void ); 971 int (*BotLibShutdown) ( void ); 972 int (*BotLibVarSet) ( char *var_name, char *value ); 973 int (*BotLibVarGet) ( char *var_name, char *value, int size ); 974 int (*BotLibDefine) ( char *string ); 975 int (*BotLibStartFrame) ( float time ); 976 int (*BotLibLoadMap) ( const char *mapname ); 977 int (*BotLibUpdateEntity) ( int ent, void *bue ); 978 int (*BotLibTest) ( int parm0, char *parm1, vec3_t parm2, vec3_t parm3 ); 979 int (*BotGetSnapshotEntity) ( int clientNum, int sequence ); 980 int (*BotGetServerCommand) ( int clientNum, char *message, int size ); 981 void (*BotUserCommand) ( int clientNum, usercmd_t *ucmd ); 982 void (*BotUpdateWaypoints) ( int wpnum, wpobject_t **wps ); 983 void (*BotCalculatePaths) ( int rmg ); 984 985 // area awareness system 986 int (*AAS_EnableRoutingArea) ( int areanum, int enable ); 987 int (*AAS_BBoxAreas) ( vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas ); 988 int (*AAS_AreaInfo) ( int areanum, void *info ); 989 void (*AAS_EntityInfo) ( int entnum, void *info ); 990 int (*AAS_Initialized) ( void ); 991 void (*AAS_PresenceTypeBoundingBox) ( int presencetype, vec3_t mins, vec3_t maxs ); 992 float (*AAS_Time) ( void ); 993 int (*AAS_PointAreaNum) ( vec3_t point ); 994 int (*AAS_TraceAreas) ( vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas ); 995 int (*AAS_PointContents) ( vec3_t point ); 996 int (*AAS_NextBSPEntity) ( int ent ); 997 int (*AAS_ValueForBSPEpairKey) ( int ent, char *key, char *value, int size ); 998 int (*AAS_VectorForBSPEpairKey) ( int ent, char *key, vec3_t v ); 999 int (*AAS_FloatForBSPEpairKey) ( int ent, char *key, float *value ); 1000 int (*AAS_IntForBSPEpairKey) ( int ent, char *key, int *value ); 1001 int (*AAS_AreaReachability) ( int areanum ); 1002 int (*AAS_AreaTravelTimeToGoalArea) ( int areanum, vec3_t origin, int goalareanum, int travelflags ); 1003 int (*AAS_Swimming) ( vec3_t origin ); 1004 int (*AAS_PredictClientMovement) ( void *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize ); 1005 int (*AAS_AlternativeRouteGoals) ( vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags, void *altroutegoals, int maxaltroutegoals, int type ); 1006 int (*AAS_PredictRoute) ( void *route, int areanum, vec3_t origin, int goalareanum, int travelflags, int maxareas, int maxtime, int stopevent, int stopcontents, int stoptfl, int stopareanum ); 1007 int (*AAS_PointReachabilityAreaIndex) ( vec3_t point ); 1008 1009 // elementary action 1010 void (*EA_Say) ( int client, char *str ); 1011 void (*EA_SayTeam) ( int client, char *str ); 1012 void (*EA_Command) ( int client, char *command ); 1013 void (*EA_Action) ( int client, int action ); 1014 void (*EA_Gesture) ( int client ); 1015 void (*EA_Talk) ( int client ); 1016 void (*EA_Attack) ( int client ); 1017 void (*EA_Alt_Attack) ( int client ); 1018 void (*EA_ForcePower) ( int client ); 1019 void (*EA_Use) ( int client ); 1020 void (*EA_Respawn) ( int client ); 1021 void (*EA_Crouch) ( int client ); 1022 void (*EA_MoveUp) ( int client ); 1023 void (*EA_MoveDown) ( int client ); 1024 void (*EA_MoveForward) ( int client ); 1025 void (*EA_MoveBack) ( int client ); 1026 void (*EA_MoveLeft) ( int client ); 1027 void (*EA_MoveRight) ( int client ); 1028 void (*EA_SelectWeapon) ( int client, int weapon ); 1029 void (*EA_Jump) ( int client ); 1030 void (*EA_DelayedJump) ( int client ); 1031 void (*EA_Move) ( int client, vec3_t dir, float speed ); 1032 void (*EA_View) ( int client, vec3_t viewangles ); 1033 void (*EA_EndRegular) ( int client, float thinktime ); 1034 void (*EA_GetInput) ( int client, float thinktime, void *input ); 1035 void (*EA_ResetInput) ( int client ); 1036 1037 // botlib preprocessor 1038 int (*PC_LoadSource) ( const char *filename ); 1039 int (*PC_FreeSource) ( int handle ); 1040 int (*PC_ReadToken) ( int handle, pc_token_t *pc_token ); 1041 int (*PC_SourceFileAndLine) ( int handle, char *filename, int *line ); 1042 1043 // renderer, terrain 1044 qhandle_t (*R_RegisterSkin) ( const char *name ); 1045 const char *(*SetActiveSubBSP) ( int index ); 1046 int (*CM_RegisterTerrain) ( const char *config ); 1047 void (*RMG_Init) ( void ); 1048 1049 void (*G2API_ListModelBones) ( void *ghlInfo, int frame ); 1050 void (*G2API_ListModelSurfaces) ( void *ghlInfo ); 1051 qboolean (*G2API_HaveWeGhoul2Models) ( void *ghoul2 ); 1052 void (*G2API_SetGhoul2ModelIndexes) ( void *ghoul2, qhandle_t *modelList, qhandle_t *skinList ); 1053 qboolean (*G2API_GetBoltMatrix) ( void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale ); 1054 qboolean (*G2API_GetBoltMatrix_NoReconstruct) ( void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale ); 1055 qboolean (*G2API_GetBoltMatrix_NoRecNoRot) ( void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix, const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale ); 1056 int (*G2API_InitGhoul2Model) ( void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin, qhandle_t customShader, int modelFlags, int lodBias ); 1057 qboolean (*G2API_SetSkin) ( void *ghoul2, int modelIndex, qhandle_t customSkin, qhandle_t renderSkin ); 1058 int (*G2API_Ghoul2Size) ( void *ghlInfo ); 1059 int (*G2API_AddBolt) ( void *ghoul2, int modelIndex, const char *boneName ); 1060 void (*G2API_SetBoltInfo) ( void *ghoul2, int modelIndex, int boltInfo ); 1061 qboolean (*G2API_SetBoneAngles) ( void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags, const int up, const int right, const int forward, qhandle_t *modelList, int blendTime , int currentTime ); 1062 qboolean (*G2API_SetBoneAnim) ( void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame, const int flags, const float animSpeed, const int currentTime, const float setFrame, const int blendTime ); 1063 qboolean (*G2API_GetBoneAnim) ( void *ghoul2, const char *boneName, const int currentTime, float *currentFrame, int *startFrame, int *endFrame, int *flags, float *animSpeed, int *modelList, const int modelIndex ); 1064 void (*G2API_GetGLAName) ( void *ghoul2, int modelIndex, char *fillBuf ); 1065 int (*G2API_CopyGhoul2Instance) ( void *g2From, void *g2To, int modelIndex ); 1066 void (*G2API_CopySpecificGhoul2Model) ( void *g2From, int modelFrom, void *g2To, int modelTo ); 1067 void (*G2API_DuplicateGhoul2Instance) ( void *g2From, void **g2To ); 1068 qboolean (*G2API_HasGhoul2ModelOnIndex) ( void *ghlInfo, int modelIndex ); 1069 qboolean (*G2API_RemoveGhoul2Model) ( void *ghlInfo, int modelIndex ); 1070 qboolean (*G2API_RemoveGhoul2Models) ( void *ghlInfo ); 1071 void (*G2API_CleanGhoul2Models) ( void **ghoul2Ptr ); 1072 void (*G2API_CollisionDetect) ( CollisionRecord_t *collRecMap, void *ghoul2, const vec3_t angles, const vec3_t position, int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, int traceFlags, int useLod, float fRadius ); 1073 void (*G2API_CollisionDetectCache) ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position, int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, int traceFlags, int useLod, float fRadius ); 1074 qboolean (*G2API_SetRootSurface) ( void *ghoul2, const int modelIndex, const char *surfaceName ); 1075 qboolean (*G2API_SetSurfaceOnOff) ( void *ghoul2, const char *surfaceName, const int flags ); 1076 qboolean (*G2API_SetNewOrigin) ( void *ghoul2, const int boltIndex ); 1077 qboolean (*G2API_DoesBoneExist) ( void *ghoul2, int modelIndex, const char *boneName ); 1078 int (*G2API_GetSurfaceRenderStatus) ( void *ghoul2, const int modelIndex, const char *surfaceName ); 1079 void (*G2API_AbsurdSmoothing) ( void *ghoul2, qboolean status ); 1080 void (*G2API_SetRagDoll) ( void *ghoul2, sharedRagDollParams_t *params ); 1081 void (*G2API_AnimateG2Models) ( void *ghoul2, int time, sharedRagDollUpdateParams_t *params ); 1082 qboolean (*G2API_RagPCJConstraint) ( void *ghoul2, const char *boneName, vec3_t min, vec3_t max ); 1083 qboolean (*G2API_RagPCJGradientSpeed) ( void *ghoul2, const char *boneName, const float speed ); 1084 qboolean (*G2API_RagEffectorGoal) ( void *ghoul2, const char *boneName, vec3_t pos ); 1085 qboolean (*G2API_GetRagBonePos) ( void *ghoul2, const char *boneName, vec3_t pos, vec3_t entAngles, vec3_t entPos, vec3_t entScale ); 1086 qboolean (*G2API_RagEffectorKick) ( void *ghoul2, const char *boneName, vec3_t velocity ); 1087 qboolean (*G2API_RagForceSolve) ( void *ghoul2, qboolean force ); 1088 qboolean (*G2API_SetBoneIKState) ( void *ghoul2, int time, const char *boneName, int ikState, sharedSetBoneIKStateParams_t *params ); 1089 qboolean (*G2API_IKMove) ( void *ghoul2, int time, sharedIKMoveParams_t *params ); 1090 qboolean (*G2API_RemoveBone) ( void *ghoul2, const char *boneName, int modelIndex ); 1091 void (*G2API_AttachInstanceToEntNum) ( void *ghoul2, int entityNum, qboolean server ); 1092 void (*G2API_ClearAttachedInstance) ( int entityNum ); 1093 void (*G2API_CleanEntAttachments) ( void ); 1094 qboolean (*G2API_OverrideServer) ( void *serverInstance ); 1095 void (*G2API_GetSurfaceName) ( void *ghoul2, int surfNumber, int modelIndex, char *fillBuf ); 1096 } gameImport_t; 1097 1098 typedef struct gameExport_s { 1099 void (*InitGame) ( int levelTime, int randomSeed, int restart ); 1100 void (*ShutdownGame) ( int restart ); 1101 char * (*ClientConnect) ( int clientNum, qboolean firstTime, qboolean isBot ); 1102 void (*ClientBegin) ( int clientNum, qboolean allowTeamReset ); 1103 qboolean (*ClientUserinfoChanged) ( int clientNum ); 1104 void (*ClientDisconnect) ( int clientNum ); 1105 void (*ClientCommand) ( int clientNum ); 1106 void (*ClientThink) ( int clientNum, usercmd_t *ucmd ); 1107 void (*RunFrame) ( int levelTime ); 1108 qboolean (*ConsoleCommand) ( void ); 1109 int (*BotAIStartFrame) ( int time ); 1110 void (*ROFF_NotetrackCallback) ( int entID, const char *notetrack ); 1111 void (*SpawnRMGEntity) ( void ); 1112 int (*ICARUS_PlaySound) ( void ); 1113 qboolean (*ICARUS_Set) ( void ); 1114 void (*ICARUS_Lerp2Pos) ( void ); 1115 void (*ICARUS_Lerp2Origin) ( void ); 1116 void (*ICARUS_Lerp2Angles) ( void ); 1117 int (*ICARUS_GetTag) ( void ); 1118 void (*ICARUS_Lerp2Start) ( void ); 1119 void (*ICARUS_Lerp2End) ( void ); 1120 void (*ICARUS_Use) ( void ); 1121 void (*ICARUS_Kill) ( void ); 1122 void (*ICARUS_Remove) ( void ); 1123 void (*ICARUS_Play) ( void ); 1124 int (*ICARUS_GetFloat) ( void ); 1125 int (*ICARUS_GetVector) ( void ); 1126 int (*ICARUS_GetString) ( void ); 1127 void (*ICARUS_SoundIndex) ( void ); 1128 int (*ICARUS_GetSetIDForString) ( void ); 1129 qboolean (*NAV_ClearPathToPoint) ( int entID, vec3_t pmins, vec3_t pmaxs, vec3_t point, int clipmask, int okToHitEnt ); 1130 qboolean (*NPC_ClearLOS2) ( int entID, const vec3_t end ); 1131 int (*NAVNEW_ClearPathBetweenPoints) ( vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, int ignore, int clipmask ); 1132 qboolean (*NAV_CheckNodeFailedForEnt) ( int entID, int nodeNum ); 1133 qboolean (*NAV_EntIsUnlockedDoor) ( int entityNum ); 1134 qboolean (*NAV_EntIsDoor) ( int entityNum ); 1135 qboolean (*NAV_EntIsBreakable) ( int entityNum ); 1136 qboolean (*NAV_EntIsRemovableUsable) ( int entNum ); 1137 void (*NAV_FindCombatPointWaypoints) ( void ); 1138 int (*BG_GetItemIndexByTag) ( int tag, int type ); 1139 } gameExport_t; 1140 1141 1142 //linking of game library 1143 typedef gameExport_t* (QDECL *GetGameAPI_t)( int apiVersion, gameImport_t *import ); 1144