From f34b96b5869e0a06623247845a66c47bbce3228e Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Fri, 4 Feb 2011 18:23:52 +0000 Subject: [PATCH] Fix flag collision in botlib code, thanks Cyrri for reporting (#4886) --- code/botlib/be_ea.c | 33 --------------------------------- code/botlib/botlib.h | 43 ++++++++++++++++++++++--------------------- 2 files changed, 22 insertions(+), 54 deletions(-) diff --git a/code/botlib/be_ea.c b/code/botlib/be_ea.c index c357b11b..41653fda 100644 --- a/code/botlib/be_ea.c +++ b/code/botlib/be_ea.c @@ -40,7 +40,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_USERMOVE 400 #define MAX_COMMANDARGUMENTS 10 -#define ACTION_JUMPEDLASTFRAME 128 bot_input_t *botinputs; @@ -416,24 +415,6 @@ void EA_View(int client, vec3_t viewangles) //=========================================================================== 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 //=========================================================================== // @@ -444,23 +425,10 @@ void EA_EndRegular(int client, float thinktime) void EA_GetInput(int client, float thinktime, bot_input_t *input) { bot_input_t *bi; -// int jumped = qfalse; bi = &botinputs[client]; - -// bi->actionflags &= ~ACTION_JUMPEDLASTFRAME; - bi->thinktime = thinktime; 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 //=========================================================================== // @@ -474,7 +442,6 @@ void EA_ResetInput(int client) int jumped = qfalse; bi = &botinputs[client]; - bi->actionflags &= ~ACTION_JUMPEDLASTFRAME; bi->thinktime = 0; VectorClear(bi->dir); diff --git a/code/botlib/botlib.h b/code/botlib/botlib.h index 5fb18554..d36a038d 100644 --- a/code/botlib/botlib.h +++ b/code/botlib/botlib.h @@ -79,27 +79,28 @@ struct weaponinfo_s; #define BLERR_CANNOTLOADWEAPONCONFIG 12 //cannot load weapon config //action flags -#define ACTION_ATTACK 0x0000001 -#define ACTION_USE 0x0000002 -#define ACTION_RESPAWN 0x0000008 -#define ACTION_JUMP 0x0000010 -#define ACTION_MOVEUP 0x0000020 -#define ACTION_CROUCH 0x0000080 -#define ACTION_MOVEDOWN 0x0000100 -#define ACTION_MOVEFORWARD 0x0000200 -#define ACTION_MOVEBACK 0x0000800 -#define ACTION_MOVELEFT 0x0001000 -#define ACTION_MOVERIGHT 0x0002000 -#define ACTION_DELAYEDJUMP 0x0008000 -#define ACTION_TALK 0x0010000 -#define ACTION_GESTURE 0x0020000 -#define ACTION_WALK 0x0080000 -#define ACTION_AFFIRMATIVE 0x0100000 -#define ACTION_NEGATIVE 0x0200000 -#define ACTION_GETFLAG 0x0800000 -#define ACTION_GUARDBASE 0x1000000 -#define ACTION_PATROL 0x2000000 -#define ACTION_FOLLOWME 0x8000000 +#define ACTION_ATTACK 0x00000001 +#define ACTION_USE 0x00000002 +#define ACTION_RESPAWN 0x00000008 +#define ACTION_JUMP 0x00000010 +#define ACTION_MOVEUP 0x00000020 +#define ACTION_CROUCH 0x00000080 +#define ACTION_MOVEDOWN 0x00000100 +#define ACTION_MOVEFORWARD 0x00000200 +#define ACTION_MOVEBACK 0x00000800 +#define ACTION_MOVELEFT 0x00001000 +#define ACTION_MOVERIGHT 0x00002000 +#define ACTION_DELAYEDJUMP 0x00008000 +#define ACTION_TALK 0x00010000 +#define ACTION_GESTURE 0x00020000 +#define ACTION_WALK 0x00080000 +#define ACTION_AFFIRMATIVE 0x00100000 +#define ACTION_NEGATIVE 0x00200000 +#define ACTION_GETFLAG 0x00800000 +#define ACTION_GUARDBASE 0x01000000 +#define ACTION_PATROL 0x02000000 +#define ACTION_FOLLOWME 0x08000000 +#define ACTION_JUMPEDLASTFRAME 0x10000000 //the bot input, will be converted to an usercmd_t typedef struct bot_input_s