revert game interface class, i'm just too lazy to do it now...

This commit is contained in:
jeefo 2016-03-05 21:22:29 +03:00
commit 6136bace18
8 changed files with 36 additions and 83 deletions

View file

@ -1503,7 +1503,6 @@ public:
};
#include <engine.h>
#include <gamestate.h>
// expose bot super-globals
extern NetworkMsg netmsg;
@ -1511,7 +1510,6 @@ extern Localizer locale;
extern Waypoint waypoints;
extern BotManager bots;
extern Engine engine;
extern Game game;
// prototypes of bot functions...
extern int GetWeaponReturn (bool isString, const char *weaponAlias, int weaponIndex = -1);

View file

@ -11,7 +11,31 @@
#pragma once
//
// netmessage handler class
class NetworkMsg
{
private:
Bot *m_bot;
int m_state;
int m_message;
int m_registerdMessages[NETMSG_NUM];
public:
NetworkMsg (void);
~NetworkMsg (void) { };
void Execute (void *p);
inline void Reset (void) { m_message = NETMSG_UNDEFINED; m_state = 0; m_bot = NULL; };
void HandleMessageIfRequired (int messageType, int requiredType);
inline void SetMessage (int message) { m_message = message; }
inline void SetBot (Bot *bot) { m_bot = bot; }
inline int GetId (int messageType) { return m_registerdMessages[messageType]; }
inline void SetId (int messageType, int messsageIdentifier) { m_registerdMessages[messageType] = messsageIdentifier; }
};
// game events
class IGameEvents
{
public:

View file

@ -27,7 +27,6 @@
<ClInclude Include="..\include\engine\progdefs.h" />
<ClInclude Include="..\include\engine\sdk_util.h" />
<ClInclude Include="..\include\engine\util.h" />
<ClInclude Include="..\include\gamestate.h" />
<ClInclude Include="..\include\globals.h" />
<ClInclude Include="..\include\platform.h" />
<ClInclude Include="..\include\resource.h" />
@ -36,13 +35,12 @@
<ClCompile Include="..\source\basecode.cpp" />
<ClCompile Include="..\source\combat.cpp" />
<ClCompile Include="..\source\engine.cpp" />
<ClCompile Include="..\source\gamestate.cpp" />
<ClCompile Include="..\source\netmsg.cpp" />
<ClCompile Include="..\source\manager.cpp" />
<ClCompile Include="..\source\chatlib.cpp" />
<ClCompile Include="..\source\globals.cpp" />
<ClCompile Include="..\source\interface.cpp" />
<ClCompile Include="..\source\navigate.cpp" />
<ClCompile Include="..\source\netmsg.cpp" />
<ClCompile Include="..\source\support.cpp" />
<ClCompile Include="..\source\waypoint.cpp" />
</ItemGroup>

View file

@ -72,9 +72,6 @@
<ClInclude Include="..\include\engine.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\gamestate.h">
<Filter>include</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\source\chatlib.cpp">
@ -89,9 +86,6 @@
<ClCompile Include="..\source\navigate.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="..\source\netmsg.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="..\source\support.cpp">
<Filter>source</Filter>
</ClCompile>
@ -110,7 +104,7 @@
<ClCompile Include="..\source\engine.cpp">
<Filter>source</Filter>
</ClCompile>
<ClCompile Include="..\source\gamestate.cpp">
<ClCompile Include="..\source\netmsg.cpp">
<Filter>source</Filter>
</ClCompile>
</ItemGroup>

View file

@ -1,10 +0,0 @@
//
// 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
//
#include <core.h>

View file

@ -15,7 +15,6 @@ Localizer locale;
Waypoint waypoints;
BotManager bots;
Engine engine;
Game game;
bool g_canSayBombPlanted = true;
bool g_isMetamod = false;

View file

@ -457,14 +457,6 @@ void CommandHandler (void)
engine.Printf ("Unknown command: %s", CMD_ARGV (1));
}
class GameEvents : public IGameEvents
{
virtual void OnNewRound (void)
{
RoundInit ();
}
} g_botEventListener;
void ParseVoiceEvent (const String &base, int type, float timeToRepeat)
{
// this function does common work of parsing single line of voice chatter
@ -926,9 +918,6 @@ void GameDLLInit (void)
// server is enabled. Here is a good place to do our own game session initialization, and
// to register by the engine side the server commands we need to administrate our bots.
// register bot event listner
game.RegisterEventListener (&g_botEventListener);
DetectCSVersion ();
{
// print game detection info
@ -1025,7 +1014,7 @@ int Spawn (edict_t *ent)
PRECACHE_SOUND (ENGINE_STR ("common/wpn_moveselect.wav")); // path add/delete cancel
PRECACHE_SOUND (ENGINE_STR ("common/wpn_denyselect.wav")); // path add/delete error
events->OnNewRound ();
RoundInit ();
g_mapType = NULL; // reset map type as worldspawn is the first entity spawned
// detect official csbots here, as they causing crash in linkent code when active for some reason
@ -2344,7 +2333,7 @@ edict_t *pfnFindEntityByString (edict_t *edictStartSearchAfter, const char *fiel
{
// round starts in counter-strike 1.5
if (strcmp (value, "info_map_parameters") == 0)
events->OnNewRound ();
RoundInit ();
if (g_isMetamod)
RETURN_META_VALUE (MRES_IGNORED, 0);
@ -2947,39 +2936,9 @@ export int Meta_Query (char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_t *p
// is for metamod to retrieve basic information about the plugin, such as its meta-interface
// version, for ensuring compatibility with the current version of the running metamod.
// keep track of the pointers to metamod function tables metamod gives us
gpMetaUtilFuncs = pMetaUtilFuncs;
*pPlugInfo = &Plugin_info;
// check for interface version compatibility
if (strcmp (ifvers, Plugin_info.ifvers) != 0)
{
int metaMajor = 0, metaMinor = 0, pluginMajor = 0, pluginMinor = 0;
LOG_CONSOLE (PLID, "%s: meta-interface version mismatch (metamod: %s, %s: %s)", Plugin_info.name, ifvers, Plugin_info.name, Plugin_info.ifvers);
LOG_MESSAGE (PLID, "%s: meta-interface version mismatch (metamod: %s, %s: %s)", Plugin_info.name, ifvers, Plugin_info.name, Plugin_info.ifvers);
// if plugin has later interface version, it's incompatible (update metamod)
sscanf (ifvers, "%d:%d", &metaMajor, &metaMinor);
sscanf (META_INTERFACE_VERSION, "%d:%d", &pluginMajor, &pluginMinor);
if (pluginMajor > metaMajor || (pluginMajor == metaMajor && pluginMinor > metaMinor))
{
LOG_CONSOLE (PLID, "metamod version is too old for this plugin; update metamod");
LOG_MMERROR (PLID, "metamod version is too old for this plugin; update metamod");
return FALSE;
}
// if plugin has older major interface version, it's incompatible (update plugin)
else if (pluginMajor < metaMajor)
{
LOG_CONSOLE (PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");
LOG_MMERROR (PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");
return FALSE;
}
}
return TRUE; // tell metamod this plugin looks safe
}
@ -2989,15 +2948,6 @@ export int Meta_Attach (PLUG_LOADTIME now, metamod_funcs_t *functionTable, meta_
// where we can tell if the plugin will be allowed to run or not, we wait until here to make
// our initialization stuff, like registering CVARs and dedicated server commands.
// are we allowed to load this plugin now ?
if (now > Plugin_info.loadable)
{
LOG_CONSOLE (PLID, "%s: plugin NOT attaching (can't load plugin right now)", Plugin_info.name);
LOG_MMERROR (PLID, "%s: plugin NOT attaching (can't load plugin right now)", Plugin_info.name);
return FALSE; // returning false prevents metamod from attaching this plugin
}
// keep track of the pointers to engine function tables metamod gives us
gpMetaGlobals = pMGlobals;
memcpy (functionTable, &gMetaFunctionTable, sizeof (metamod_funcs_t));

View file

@ -11,12 +11,12 @@
NetworkMsg::NetworkMsg (void)
{
m_message = NETMSG_UNDEFINED;
m_state = 0;
m_bot = NULL;
m_message = NETMSG_UNDEFINED;
m_state = 0;
m_bot = NULL;
for (int i = 0; i < NETMSG_NUM; i++)
m_registerdMessages[i] = -1;
for (int i = 0; i < NETMSG_NUM; i++)
m_registerdMessages[i] = -1;
}
void NetworkMsg::HandleMessageIfRequired (int messageType, int requiredType)
@ -30,7 +30,7 @@ void NetworkMsg::Execute (void *p)
if (m_message == NETMSG_UNDEFINED)
return; // no message or not for bot, return
// some needed variables
// some needed variables
static byte r, g, b;
static byte enabled;
@ -430,7 +430,7 @@ void NetworkMsg::Execute (void *p)
g_bombPlanted = g_bombSayString = true;
g_timeBombPlanted = engine.Time ();
for (int i = 0; i < engine.MaxClients (); i++)
{
Bot *bot = bots.GetBot (i);