a little cleanup of code save point

This commit is contained in:
jeefo 2016-03-01 13:37:10 +03:00
commit f8344a464e
18 changed files with 1197 additions and 1141 deletions

View file

@ -556,24 +556,6 @@ struct TaskItem
bool resume; // if task can be continued if interrupted
};
// wave structure
struct WavHeader
{
char riffChunkId[4];
unsigned long packageSize;
char chunkID[4];
char formatChunkId[4];
unsigned long formatChunkLength;
unsigned short dummy;
unsigned short channels;
unsigned long sampleRate;
unsigned long bytesPerSecond;
unsigned short bytesPerSample;
unsigned short bitsPerSample;
char dataChunkId[4];
unsigned long dataChunkLength;
};
// botname structure definition
struct BotName
{
@ -1617,11 +1599,7 @@ public:
// prototypes of bot functions...
extern int GetWeaponReturn (bool isString, const char *weaponAlias, int weaponIndex = -1);
extern float GetShootingConeDeviation (edict_t *ent, Vector *position);
extern float GetWaveLength (const char *fileName);
extern bool IsDedicatedServer (void);
extern bool IsVisible (const Vector &origin, edict_t *ent);
extern bool IsAlive (edict_t *ent);
extern bool IsInViewCone (const Vector &origin, edict_t *ent);
@ -1631,41 +1609,22 @@ extern bool IsValidPlayer (edict_t *ent);
extern bool IsPlayerVIP (edict_t *ent);
extern bool OpenConfig (const char *fileName, const char *errorIfNotExists, File *outFile, bool languageDependant = false);
extern bool FindNearestPlayer (void **holder, edict_t *to, float searchDistance = 4096.0, bool sameTeam = false, bool needBot = false, bool needAlive = false, bool needDrawn = false);
extern const char *GetMapName (void);
extern const char *GetWaypointDir (void);
extern const char *GetModName (void);
extern const char *GetField (const char *string, int fieldId, bool endLine = false);
extern const char *FormatBuffer (const char *format, ...);
extern uint16 GenerateBuildNumber (void);
extern Vector GetEntityOrigin (edict_t *ent);
extern void FreeLibraryMemory (void);
extern void RoundInit (void);
extern void FakeClientCommand (edict_t *fakeClient, const char *format, ...);
extern void strtrim (char *string);
extern void CreatePath (char *path);
extern void ServerCommand (const char *format, ...);
extern void RegisterCommand (const char *command, void funcPtr (void));
extern void CheckWelcomeMessage (void);
extern void DetectCSVersion (void);
extern void PlaySound (edict_t *ent, const char *soundName);
extern void ServerPrint (const char *format, ...);
extern void ChartPrint (const char *format, ...);
extern void CenterPrint (const char *format, ...);
extern void ClientPrint (edict_t *ent, int dest, const char *format, ...);
extern void AddLogEntry (bool outputToConsole, int logLevel, const char *format, ...);
extern void TraceLine (const Vector &start, const Vector &end, bool ignoreMonsters, bool ignoreGlass, edict_t *ignoreEntity, TraceResult *ptr);
extern void TraceLine (const Vector &start, const Vector &end, bool ignoreMonsters, edict_t *ignoreEntity, TraceResult *ptr);
extern void TraceHull (const Vector &start, const Vector &end, bool ignoreMonsters, int hullNumber, edict_t *ignoreEntity, TraceResult *ptr);
extern void DrawLine (edict_t *ent, const Vector &start, const Vector &end, int width, int noise, int red, int green, int blue, int brightness, int speed, int life);
extern void DrawArrow (edict_t *ent, const Vector &start, const Vector &end, int width, int noise, int red, int green, int blue, int brightness, int speed, int life);
extern void DisplayMenuToClient (edict_t *ent, MenuText *menu);
extern void DecalTrace (entvars_t *pev, TraceResult *trace, int logotypeIndex);
extern void SoundAttachToClients (edict_t *ent, const char *sample, float volume);
extern void SoundSimulateUpdate (int playerIndex);
extern const char *GetWaypointDir (void);
// very global convars
extern ConVar yb_jasonmode;
@ -1673,6 +1632,7 @@ extern ConVar yb_communication_type;
extern ConVar yb_csdm_mode;
extern ConVar yb_ignore_enemies;
#include <engine.h>
#include <globals.h>
#include <compress.h>
#include <resource.h>

View file

@ -2595,7 +2595,7 @@ public:
holder[j++] = m_bufferPtr[i];
holder[j] = 0;
result.Assign(holder);
result.Assign (holder);
delete [] holder;
return result;

105
include/engine.h Normal file
View file

@ -0,0 +1,105 @@
//
// Yet Another POD-Bot, based on PODBot by Markus Klinge ("CountFloyd").
// Copyright (c) YaPB Development Team.
//
// This software is licensed under the BSD-style license.
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
// http://yapb.jeefo.net/license
//
// Purpose: Engine & Game interfaces.
//
#pragma once
// line draw
enum DrawLineType
{
DRAW_SIMPLE,
DRAW_ARROW,
DRAW_NUM
};
// trace ignore
enum TraceIgnore
{
TRACE_IGNORE_NONE = 0,
TRACE_IGNORE_GLASS = (1 << 0),
TRACE_IGNORE_MONSTERS = (1 << 1),
TRACE_IGNORE_EVERYTHING = TRACE_IGNORE_GLASS | TRACE_IGNORE_MONSTERS
};
// provides utility functions to not call original engine (less call-cost)
class Engine
{
private:
short m_drawModels[DRAW_NUM];
// public functions
public:
// precaches internal stuff
void Precache (void);
// prints data to servers console
void Printf (const char *fmt, ...);
// prints chat message to all players
void ChatPrintf (const char *fmt, ...);
// prints center message to all players
void CenterPrintf (const char *fmt, ...);
// prints message to client console
void ClientPrintf (edict_t *ent, const char *fmt, ...);
// display world line
void DrawLine (edict_t *ent, const Vector &start, const Vector &end, int width, int noise, int red, int green, int blue, int brightness, int speed, int life, DrawLineType type = DRAW_SIMPLE);
// test line
void TestLine (const Vector &start, const Vector &end, int ignoreFlags, edict_t *ignoreEntity, TraceResult *ptr);
// test line
void TestHull (const Vector &start, const Vector &end, int ignoreFlags, int hullNumber, edict_t *ignoreEntity, TraceResult *ptr);
// get's the wave length
float GetWaveLength (const char *fileName);
// we are on dedicated server ?
bool IsDedicatedServer (void);
// get stripped down mod name
const char *GetModName (void);
// get the valid mapname
const char *GetMapName (void);
// get the "any" entity origin
Vector GetAbsOrigin (edict_t *ent);
// send server command
void IssueCmd (const char *fmt, ...);
// registers a server command
void RegisterCmd (const char *command, void func (void));
// play's sound to client
void EmitSound (edict_t *ent, const char *sound);
// public inlines
public:
// get the current time on server
static inline float Time (void)
{
return g_pGlobals->time;
}
// get "maxplayers" limit on server
static inline int MaxClients (void)
{
return g_pGlobals->maxClients;
}
};
// provides quick access to engine instance
extern Engine engine;

View file

@ -207,8 +207,6 @@ typedef struct hudtextparms_s
} hudtextparms_t;
extern Vector GetEntityOrigin (entvars_t *pevBModel);
#define AMBIENT_SOUND_STATIC 0 // medium radius attenuation
#define AMBIENT_SOUND_EVERYWHERE 1
#define AMBIENT_SOUND_SMALLRADIUS 2

View file

@ -55,8 +55,6 @@ extern int g_lastRadio[2];
extern int g_storeAddbotVars[4];
extern int *g_weaponPrefs[];
extern short g_modelIndexLaser;
extern short g_modelIndexArrow;
extern char g_fakeArgv[256];
extern Array <Array <String> > g_chatFactory;
@ -92,16 +90,6 @@ static inline bool IsNullString (const char *input)
return *input == '\0';
}
static inline float GetWorldTime (void)
{
return g_pGlobals->time;
}
static inline int GetMaxClients (void)
{
return g_pGlobals->maxClients;
}
static inline edict_t *EntityOfIndex (const int index)
{
return static_cast <edict_t *> (g_worldEntity + index);