Fix flag collision in botlib code, thanks Cyrri for reporting (#4886)

This commit is contained in:
Thilo Schulz 2011-02-04 18:23:52 +00:00
parent 387e33a4e3
commit f34b96b586
2 changed files with 22 additions and 54 deletions

View file

@ -40,7 +40,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_USERMOVE 400 #define MAX_USERMOVE 400
#define MAX_COMMANDARGUMENTS 10 #define MAX_COMMANDARGUMENTS 10
#define ACTION_JUMPEDLASTFRAME 128
bot_input_t *botinputs; bot_input_t *botinputs;
@ -416,24 +415,6 @@ void EA_View(int client, vec3_t viewangles)
//=========================================================================== //===========================================================================
void EA_EndRegular(int client, float thinktime) void EA_EndRegular(int client, float thinktime)
{ {
/*
bot_input_t *bi;
int jumped = qfalse;
bi = &botinputs[client];
bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
bi->thinktime = thinktime;
botimport.BotInput(client, bi);
bi->thinktime = 0;
VectorClear(bi->dir);
bi->speed = 0;
jumped = bi->actionflags & ACTION_JUMP;
bi->actionflags = 0;
if (jumped) bi->actionflags |= ACTION_JUMPEDLASTFRAME;
*/
} //end of the function EA_EndRegular } //end of the function EA_EndRegular
//=========================================================================== //===========================================================================
// //
@ -444,23 +425,10 @@ void EA_EndRegular(int client, float thinktime)
void EA_GetInput(int client, float thinktime, bot_input_t *input) void EA_GetInput(int client, float thinktime, bot_input_t *input)
{ {
bot_input_t *bi; bot_input_t *bi;
// int jumped = qfalse;
bi = &botinputs[client]; bi = &botinputs[client];
// bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
bi->thinktime = thinktime; bi->thinktime = thinktime;
Com_Memcpy(input, bi, sizeof(bot_input_t)); Com_Memcpy(input, bi, sizeof(bot_input_t));
/*
bi->thinktime = 0;
VectorClear(bi->dir);
bi->speed = 0;
jumped = bi->actionflags & ACTION_JUMP;
bi->actionflags = 0;
if (jumped) bi->actionflags |= ACTION_JUMPEDLASTFRAME;
*/
} //end of the function EA_GetInput } //end of the function EA_GetInput
//=========================================================================== //===========================================================================
// //
@ -474,7 +442,6 @@ void EA_ResetInput(int client)
int jumped = qfalse; int jumped = qfalse;
bi = &botinputs[client]; bi = &botinputs[client];
bi->actionflags &= ~ACTION_JUMPEDLASTFRAME;
bi->thinktime = 0; bi->thinktime = 0;
VectorClear(bi->dir); VectorClear(bi->dir);

View file

@ -79,27 +79,28 @@ struct weaponinfo_s;
#define BLERR_CANNOTLOADWEAPONCONFIG 12 //cannot load weapon config #define BLERR_CANNOTLOADWEAPONCONFIG 12 //cannot load weapon config
//action flags //action flags
#define ACTION_ATTACK 0x0000001 #define ACTION_ATTACK 0x00000001
#define ACTION_USE 0x0000002 #define ACTION_USE 0x00000002
#define ACTION_RESPAWN 0x0000008 #define ACTION_RESPAWN 0x00000008
#define ACTION_JUMP 0x0000010 #define ACTION_JUMP 0x00000010
#define ACTION_MOVEUP 0x0000020 #define ACTION_MOVEUP 0x00000020
#define ACTION_CROUCH 0x0000080 #define ACTION_CROUCH 0x00000080
#define ACTION_MOVEDOWN 0x0000100 #define ACTION_MOVEDOWN 0x00000100
#define ACTION_MOVEFORWARD 0x0000200 #define ACTION_MOVEFORWARD 0x00000200
#define ACTION_MOVEBACK 0x0000800 #define ACTION_MOVEBACK 0x00000800
#define ACTION_MOVELEFT 0x0001000 #define ACTION_MOVELEFT 0x00001000
#define ACTION_MOVERIGHT 0x0002000 #define ACTION_MOVERIGHT 0x00002000
#define ACTION_DELAYEDJUMP 0x0008000 #define ACTION_DELAYEDJUMP 0x00008000
#define ACTION_TALK 0x0010000 #define ACTION_TALK 0x00010000
#define ACTION_GESTURE 0x0020000 #define ACTION_GESTURE 0x00020000
#define ACTION_WALK 0x0080000 #define ACTION_WALK 0x00080000
#define ACTION_AFFIRMATIVE 0x0100000 #define ACTION_AFFIRMATIVE 0x00100000
#define ACTION_NEGATIVE 0x0200000 #define ACTION_NEGATIVE 0x00200000
#define ACTION_GETFLAG 0x0800000 #define ACTION_GETFLAG 0x00800000
#define ACTION_GUARDBASE 0x1000000 #define ACTION_GUARDBASE 0x01000000
#define ACTION_PATROL 0x2000000 #define ACTION_PATROL 0x02000000
#define ACTION_FOLLOWME 0x8000000 #define ACTION_FOLLOWME 0x08000000
#define ACTION_JUMPEDLASTFRAME 0x10000000
//the bot input, will be converted to an usercmd_t //the bot input, will be converted to an usercmd_t
typedef struct bot_input_s typedef struct bot_input_s