1 /* 2 =========================================================================== 3 4 Return to Castle Wolfenstein single player GPL Source Code 5 Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company. 6 7 This file is part of the Return to Castle Wolfenstein single player GPL Source Code (RTCW SP Source Code). 8 9 RTCW SP Source Code is free software: you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation, either version 3 of the License, or 12 (at your option) any later version. 13 14 RTCW SP Source Code 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 RTCW SP Source Code. If not, see <http://www.gnu.org/licenses/>. 21 22 In addition, the RTCW SP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW SP Source Code. If not, please request a copy in writing from id Software at the address below. 23 24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA. 25 26 =========================================================================== 27 */ 28 29 30 /***************************************************************************** 31 * name: be_ai_weight.h 32 * 33 * desc: fuzzy weights 34 * 35 * 36 *****************************************************************************/ 37 38 #define WT_BALANCE 1 39 #define MAX_WEIGHTS 128 40 41 //fuzzy seperator 42 typedef struct fuzzyseperator_s 43 { 44 int index; 45 int value; 46 int type; 47 float weight; 48 float minweight; 49 float maxweight; 50 struct fuzzyseperator_s *child; 51 struct fuzzyseperator_s *next; 52 } fuzzyseperator_t; 53 54 //fuzzy weight 55 typedef struct weight_s 56 { 57 char *name; 58 struct fuzzyseperator_s *firstseperator; 59 } weight_t; 60 61 //weight configuration 62 typedef struct weightconfig_s 63 { 64 int numweights; 65 weight_t weights[MAX_WEIGHTS]; 66 char filename[MAX_QPATH]; 67 } weightconfig_t; 68 69 //reads a weight configuration 70 weightconfig_t *ReadWeightConfig( char *filename ); 71 //free a weight configuration 72 void FreeWeightConfig( weightconfig_t *config ); 73 //writes a weight configuration, returns true if successfull 74 qboolean WriteWeightConfig( char *filename, weightconfig_t *config ); 75 //find the fuzzy weight with the given name 76 int FindFuzzyWeight( weightconfig_t *wc, char *name ); 77 //returns the fuzzy weight for the given inventory and weight 78 float FuzzyWeight( int *inventory, weightconfig_t *wc, int weightnum ); 79 float FuzzyWeightUndecided( int *inventory, weightconfig_t *wc, int weightnum ); 80 //scales the weight with the given name 81 void ScaleWeight( weightconfig_t *config, char *name, float scale ); 82 //scale the balance range 83 void ScaleBalanceRange( weightconfig_t *config, float scale ); 84 //evolves the weight configuration 85 void EvolveWeightConfig( weightconfig_t *config ); 86 //interbreed the weight configurations and stores the interbreeded one in configout 87 void InterbreedWeightConfigs( weightconfig_t *config1, weightconfig_t *config2, weightconfig_t *configout ); 88 //frees cached weight configurations 89 void BotShutdownWeights( void ); 90