diff --git a/source/src/bot/ac_bot.h b/source/src/bot/ac_bot.h index 16d88f23..1aac7cc0 100644 --- a/source/src/bot/ac_bot.h +++ b/source/src/bot/ac_bot.h @@ -1,7 +1,7 @@ // // C++ Implementation: bot // -// Description: +// Description: // // Header specific for AC_CUBE // @@ -24,7 +24,7 @@ public: friend class CWaypointClass; virtual void CheckItemPickup(void); - + // AI Functions virtual bool ChoosePreferredWeapon(void); void Reload(int Gun); @@ -32,12 +32,12 @@ public: float flMaxHeight=JUMP_HEIGHT); virtual bool HeadToTargetEnt(void); virtual bool DoSPStuff(void); - + virtual void Spawn(void); }; -inline void AddScreenText(const char *t, ...) {}; // UNDONE -inline void AddDebugText(const char *t, ...) {}; // UNDONE +inline void AddScreenText(const char *t, ...) {} // UNDONE +inline void AddDebugText(const char *t, ...) {} // UNDONE #endif diff --git a/source/src/bot/bot.h b/source/src/bot/bot.h index 32ce86b2..6aa63fe3 100644 --- a/source/src/bot/bot.h +++ b/source/src/bot/bot.h @@ -1,7 +1,7 @@ // // C++ Interface: bot // -// Description: +// Description: // // Main bot header // @@ -15,7 +15,7 @@ /* TODO list - + -bots that "cover" each other in team matches ? -If a bot gets ammo it should ignore that kind of ammo for the next 10 seconds. ? -bots should ignore players that are too far away ? @@ -60,13 +60,13 @@ extern bool dedserv; extern itemstat itemstats[]; #ifdef RELEASE_BUILD -inline void condebug(const char *s, int a = 0, int b = 0, int c = 0) {}; -inline void debugnav(const char *s, int a = 0, int b = 0, int c = 0) {}; -inline void debugbeam(vec &s, vec &e) { }; +inline void condebug(const char *s, int a = 0, int b = 0, int c = 0) {} +inline void debugnav(const char *s, int a = 0, int b = 0, int c = 0) {} +inline void debugbeam(vec &s, vec &e) { } #else -inline void condebug(const char *s, int a = 0, int b = 0, int c = 0) { /*conoutf(s, a, b, c);*/ }; -inline void debugnav(const char *s, int a = 0, int b = 0, int c = 0) { /*conoutf(s, a, b, c);*/ }; -inline void debugbeam(vec &s, vec &e) { /*if (!dedserv) particle_trail(1, 500, s, e);*/ }; +inline void condebug(const char *s, int a = 0, int b = 0, int c = 0) { /*conoutf(s, a, b, c);*/ } +inline void debugnav(const char *s, int a = 0, int b = 0, int c = 0) { /*conoutf(s, a, b, c);*/ } +inline void debugbeam(vec &s, vec &e) { /*if (!dedserv) particle_trail(1, 500, s, e);*/ } #endif #define JUMP_HEIGHT 4.0f // NOT accurate @@ -89,7 +89,7 @@ enum EBotCommands // For voting of bot commands COMMAND_KICKBOT, COMMAND_BOTSKILL }; - + struct bot_skill_s { float flMinReactionDelay; // Minimal reaction time @@ -136,7 +136,7 @@ struct weaponinfo_s float flMaxFireDistance; short sMinDesiredAmmo; }; - + enum ECurrentBotState { STATE_ENEMY, // Bot has an enemy @@ -150,7 +150,7 @@ struct unreachable_ent_s { entity *ent; int time; - + unreachable_ent_s(entity *e, int t) : ent(e), time(t) { }; }; @@ -159,7 +159,7 @@ class CBot public: botent *m_pMyEnt; int m_iLastBotUpdate; - + // Combat variabels playerent *m_pPrevEnemy; int m_iShootDelay; @@ -170,7 +170,7 @@ public: bool m_bCombatJump; float m_iCombatJumpDelay; bool m_bShootAtFeet; - + // Hunting variabeles int m_iHuntDelay; vec m_vHuntLocation, m_vPrevHuntLocation; @@ -180,7 +180,7 @@ public: int m_iLookAroundDelay, m_iLookAroundTime, m_iLookAroundUpdateTime; float m_fLookAroundYaw; bool m_bLookLeft; - + // Navigation variabeles int m_iCheckEnvDelay; int m_iLastJumpPad; @@ -197,7 +197,7 @@ public: TPriorList m_AStarOpenList[2]; TLinkedList m_AStarClosedList[2]; vec m_vWaterGoal; // Place to go to when underwater - + // Waypoint variabeles TLinkedList m_WaypointList[MAX_MAP_GRIDS][MAX_MAP_GRIDS]; float m_iWaypointTime; @@ -212,7 +212,7 @@ public: // heading to a WP int m_iWaypointHeadPauseTime; // Pause time to give the bot time to aim. bool m_bGoToDebugGoal; - + // Misc stuff ECurrentBotState m_eCurrentBotState; entity *m_pTargetEnt; @@ -225,7 +225,7 @@ public: float m_fYawToTurn, m_fPitchToTurn; bot_skill_s *m_pBotSkill; // Pointer to current bot skill short m_sSkillNr; // Skill number, 0 == best 4 == worst - + void AimToVec(const vec &o); void AimToIdeal(void); float ChangeAngle(float speed, float ideal, float current); @@ -240,7 +240,7 @@ public: void ResetMoveSpeed(void) { m_pMyEnt->move = m_pMyEnt->strafe = 0; }; void SetMoveDir(int iMoveDir, bool add); void ResetCurrentTask(); - + // AI Functions bool FindEnemy(void); void CheckReload(void); @@ -264,7 +264,7 @@ public: bool IsVisible(int Dir, float flDist, bool CheckPlayers) { return IsVisible(m_pMyEnt->o, Dir, flDist, CheckPlayers); }; bool IsInFOV(const vec &o); - bool IsInFOV(playerent *d) { return IsInFOV(d->o); }; + bool IsInFOV(playerent *d) { return IsInFOV(d->o); }; int GetShootDelay(void); virtual bool ChoosePreferredWeapon(void); virtual entity *SearchForEnts(bool bUseWPs, float flRange=9999.0f, @@ -280,7 +280,7 @@ public: bool IsReachable(vec to, float flMaxHeight=JUMP_HEIGHT); bool WaterNav(void); void HearSound(int n, vec *o); - + // Waypoint functions bool HeadToWaypoint(void); bool FindWaypoint(void); @@ -302,17 +302,17 @@ public: waypoint_s *GetNearestTriggerFloodWP(vec v_origin, float flRange); #endif void SyncWaypoints(void); - + friend class CBotManager; friend class CWaypointClass; bool m_bSendC2SInit; - + virtual ~CBot(void); - + virtual void Spawn(void); virtual void Think(void); - void GoToDebugGoal(vec o); + void GoToDebugGoal(vec o); }; class CStoredBot // Used to store bots after mapchange, so that they can be readded @@ -333,7 +333,7 @@ class CBotManager char m_szBotNames[150][16]; // Max 150 bot names with a length of 16 characters short m_sBotNameCount; char m_szBotTeams[20][5]; // Max 100 bot teams co a length of 5 characters - short m_sBotTeamCount; + short m_sBotTeamCount; bool m_bInit; bool m_bBotsShoot; bool m_bIdleBots; @@ -346,7 +346,7 @@ class CBotManager short m_sCurrentTriggerNr; // Current waypoint trigger bots should use TLinkedList m_StoredBots; // List of bots that should be re-added after map change float m_fReAddBotDelay; - + void LoadBotNamesFile(void); const char *GetBotName(void); void LoadBotTeamsFile(void); @@ -354,21 +354,21 @@ class CBotManager void CreateSkillData(void); void InitSkillData(void); void InitBotItems(void); - + friend class CBot; friend class CCubeBot; friend class CACBot; friend class CWaypointClass; - + public: botent *m_pBotToView; // Construction CBotManager(void) { m_bInit = true; m_fReAddBotDelay = -1.0f; }; - + // Destruction ~CBotManager(void); - + void Init(void); void Think(void); void RenderBots(void); @@ -393,11 +393,11 @@ public: void ViewBot(void); void CalculateMaxAStarCount(void); void PickNextTrigger(void); - + void MakeBotFileName(const char *szFileName, const char *szDir1, const char *szDir2, - char *szOutput); + char *szOutput); }; - + #if defined VANILLA_CUBE #include "cube_bot.h" #elif defined AC_CUBE diff --git a/source/src/bot/bot_util.h b/source/src/bot/bot_util.h index 2f4b5d42..2fa362ff 100644 --- a/source/src/bot/bot_util.h +++ b/source/src/bot/bot_util.h @@ -24,9 +24,9 @@ bool IsValidFile(const char *szFileName); bool FileIsOlder(const char *szFileName1, const char *szFileName2); vec PredictPos(vec pos, vec vel, float Time); vec Normalize(vec v); -inline void makevec(vec *v, float x, float y, float z) { v->x=x; v->y=y; v->z=z; }; -inline bool UnderWater(const vec &o) { return hdr.waterlevel>o.z-0.5f; }; -inline bool InWater(const vec &o) { return hdr.waterlevel>=o.z; }; +inline void makevec(vec *v, float x, float y, float z) { v->x=x; v->y=y; v->z=z; } +inline bool UnderWater(const vec &o) { return hdr.waterlevel>o.z-0.5f; } +inline bool InWater(const vec &o) { return hdr.waterlevel>=o.z; } float GetYawDiff(float curyaw, vec v1, vec v2); vec CrossProduct(const vec &a, const vec &b); int GetDirection(const vec &angles, const vec &v1, const vec &v2); @@ -231,7 +231,7 @@ public: pNodeList = pLastNode = NULL; iNodeCount = 0; } - + node_s *SearchNode(C Entry) { node_s *pNode = pNodeList; @@ -254,7 +254,7 @@ public: return Entry; } - node_s *GetFirst(void) { + node_s *GetFirst(void) { return pNodeList; }; node_s *GetLast(void) { return pLastNode; }; @@ -279,7 +279,7 @@ public: // construction/destruction TLinkedList(void) { - pNodeList = NULL; + pNodeList = NULL; pLastNode = NULL; iNodeCount = 0; }; @@ -362,7 +362,7 @@ public: } } } - + C Pop(void) { if (!pHeadNode) @@ -477,7 +477,7 @@ private: // Code of TMultiChoice - Begin // ================================================================== -template class TMultiChoice +template class TMultiChoice { struct SMultiChoice { @@ -495,7 +495,7 @@ public: { pChoiceList = new TLinkedList; }; - + ~TMultiChoice(void) // Destructor { while(pChoiceList->Empty() == false) @@ -516,7 +516,7 @@ public: return; SMultiChoice *pChoiceEntry = new SMultiChoice; - + pChoiceEntry->MinVal = TotalVal; pChoiceEntry->MaxVal = TotalVal + Percent; pChoiceEntry->Choice = Choice; diff --git a/source/src/command.cpp b/source/src/command.cpp index 09051c78..0ce1fd0f 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -846,7 +846,7 @@ int lte(int a, int b) { return (int)(a<=b); } COMMANDN(<=, lte, ARG_2EXP); int gte(int a, int b) { return (int)(a>=b); } COMMANDN(>=, gte, ARG_2EXP); #define COMPAREF(opname, func, op) \ void func(char *a, char *b) { intret((int)(atof(a) op atof(b))); } \ - COMMANDN(opname, func, ARG_2STR); + COMMANDN(opname, func, ARG_2STR) COMPAREF(=f, equalf, ==); COMPAREF(!=f, notequalf, !=); COMPAREF(allowinput && !parent->hotkeys && parent->items.inrange(parent->menusel) && parent->items[parent->menusel]==this; } diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 29730415..50411c8d 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -294,7 +294,7 @@ void resizephysent(physent *pl, int moveres, int curtime, float min, float max) pl->eyeheightvel = 0.0f; break; } - if(pl->eyeheight>max) + if(pl->eyeheight>max) { pl->o.z -= pl->eyeheight - max; pl->eyeheight = max; @@ -389,19 +389,19 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) if(editfly) // just apply velocity { pl->o.add(d); - if(pl->jumpnext) - { - pl->jumpnext = false; - pl->vel.z = 2; + if(pl->jumpnext) + { + pl->jumpnext = false; + pl->vel.z = 2; } } else if(specfly) { rise = speed/moveres/1.2f; - if(pl->jumpnext) - { - pl->jumpnext = false; - pl->vel.z = 2; + if(pl->jumpnext) + { + pl->jumpnext = false; + pl->vel.z = 2; } } else // apply velocity with collisions @@ -512,7 +512,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) } if(pl->type==ENT_PLAYER && hitplayer) { - float dx = hitplayer->o.x-pl->o.x, dy = hitplayer->o.y-pl->o.y, + float dx = hitplayer->o.x-pl->o.x, dy = hitplayer->o.y-pl->o.y, push = (dx*d.x + dy*d.y)/max(dx*dx + dy*dy, 1e-3f), px = push*dx, py = push*dy; pl->o.x -= f*px; @@ -557,9 +557,9 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) else pl->onmoved(oldorigin.sub(pl->o)); if(pl->type==ENT_CAMERA) return; - + if(pl->type!=ENT_BOUNCE && pl==player1) - { + { // automatically apply smooth roll when strafing if(pl->strafe==0) { @@ -600,7 +600,7 @@ void moveplayer(physent *pl, int moveres, bool local, int curtime) else if(pl->inwater && !water) audiomgr.playsound(S_SPLASH1, &pl->o); pl->inwater = water; } - + // store previous locations of all players/bots if(pl->type==ENT_PLAYER || pl->type==ENT_BOT) { @@ -656,7 +656,7 @@ void moveplayer(physent *pl, int moveres, bool local) return; } - if(local) + if(local) { pl->o = pl->newpos; pl->o.z += pl->eyeheight; @@ -682,10 +682,10 @@ void movebounceent(bounceent *p, int moveres, bool local) #define dir(name,v,d,s,os) void name(bool isdown) { player1->s = isdown; player1->v = isdown ? d : (player1->os ? -(d) : 0); player1->lastmove = lastmillis; } -dir(backward, move, -1, k_down, k_up); -dir(forward, move, 1, k_up, k_down); -dir(left, strafe, 1, k_left, k_right); -dir(right, strafe, -1, k_right, k_left); +dir(backward, move, -1, k_down, k_up) +dir(forward, move, 1, k_up, k_down) +dir(left, strafe, 1, k_left, k_right) +dir(right, strafe, -1, k_right, k_left) void attack(bool on) { @@ -718,10 +718,10 @@ void updatecrouch(playerent *p, bool on) if(p==player1) audiomgr.playsoundc(on ? S_CROUCH : S_UNCROUCH); } -void crouch(bool on) -{ +void crouch(bool on) +{ if(player1->isspectating()) return; - player1->trycrouch = on; + player1->trycrouch = on; } COMMAND(backward, ARG_DOWN);