Skip to content

Commit 79524d2

Browse files
committed
Attention: This commit will probably break many things as there are still a lot TODOs
- Reworked listener macros - Patched public/eifaces.h for engine 1 - Reworked player_c module - Reworked engine_c (still not finished) - Added new macro NOT_IMPLEMENTED to expose functions and class methods which will raise a NotImplementedError
1 parent 8b587db commit 79524d2

28 files changed

+706
-2814
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,10 @@ Set(SOURCEPYTHON_CVAR_MODULE_SOURCES
135135
# Engine module.
136136
# ------------------------------------------------------------------
137137
Set(SOURCEPYTHON_ENGINE_MODULE_HEADERS
138-
core/modules/engine/eiface_wrap.h
139-
core/modules/engine/eiface_engine_base.h
140-
core/modules/engine/engine${SOURCE_ENGINE}/eiface_engine_implementation.h
138+
core/modules/engine/engine${SOURCE_ENGINE}/eiface_wrap_python.h
141139
)
142140

143141
Set(SOURCEPYTHON_ENGINE_MODULE_SOURCES
144-
core/modules/engine/eiface_wrap.cpp
145-
core/modules/engine/eiface_engine_base.cpp
146-
core/modules/engine/engine${SOURCE_ENGINE}/eiface_engine_implementation.cpp
147142
core/modules/engine/eiface_wrap_python.cpp
148143
)
149144

@@ -235,12 +230,10 @@ Set(SOURCEPYTHON_KEYVALUES_MODULE_SOURCES
235230
# Players module
236231
# ------------------------------------------------------------------
237232
Set(SOURCEPYTHON_PLAYERS_MODULE_HEADERS
238-
core/modules/players/players_wrap.h
239233
core/modules/players/players_generator_wrap.h
240234
)
241235

242236
Set(SOURCEPYTHON_PLAYERS_MODULE_SOURCES
243-
core/modules/players/players_wrap.cpp
244237
core/modules/players/players_wrap_python.cpp
245238
core/modules/players/players_generator_wrap.cpp
246239
)

src/core/addons/sp_addon.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ CAddonManager::~CAddonManager( void )
6767
//---------------------------------------------------------------------------------
6868
void CAddonManager::GameFrame()
6969
{
70-
CALL_LISTENERS(get_tick_listener_manager());
70+
CALL_LISTENERS(Tick);
7171
}
7272

7373
//---------------------------------------------------------------------------------
7474
// Calls network id validated listeners.
7575
//---------------------------------------------------------------------------------
7676
void CAddonManager::NetworkIDValidated( const char *pszUserName, const char *pszNetworkID )
7777
{
78-
CALL_LISTENERS(get_networkid_validated_listener_manager(), pszUserName, pszNetworkID);
78+
CALL_LISTENERS(NetworkidValidated, pszUserName, pszNetworkID);
7979
}
8080

8181
//---------------------------------------------------------------------------------
8282
// Calls level init listeners.
8383
//---------------------------------------------------------------------------------
8484
void CAddonManager::LevelInit( char const *pMapName )
8585
{
86-
CALL_LISTENERS(get_level_init_listener_manager(), pMapName);
86+
CALL_LISTENERS(LevelInit, pMapName);
8787
}
8888

8989
//---------------------------------------------------------------------------------
@@ -93,15 +93,15 @@ void CAddonManager::LevelInit( char const *pMapName )
9393
void CAddonManager::ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
9494
{
9595
CEdict edict = CEdict(pEdictList);
96-
CALL_LISTENERS(get_server_activate_listener_manager(), edict, edictCount, clientMax);
96+
CALL_LISTENERS(ServerActivate, edict, edictCount, clientMax);
9797
}
9898

9999
//---------------------------------------------------------------------------------
100100
// Calls level shutdown listeners.
101101
//---------------------------------------------------------------------------------
102102
void CAddonManager::LevelShutdown( void )
103103
{
104-
CALL_LISTENERS(get_level_shutdown_listener_manager());
104+
CALL_LISTENERS(LevelShutdown);
105105
}
106106

107107
//---------------------------------------------------------------------------------
@@ -110,7 +110,7 @@ void CAddonManager::LevelShutdown( void )
110110
void CAddonManager::ClientActive( edict_t *pEntity )
111111
{
112112
CEdict edict = CEdict(pEntity);
113-
CALL_LISTENERS(get_client_active_listener_manager(), edict);
113+
CALL_LISTENERS(ClientActive, edict);
114114
}
115115

116116
//---------------------------------------------------------------------------------
@@ -119,7 +119,7 @@ void CAddonManager::ClientActive( edict_t *pEntity )
119119
void CAddonManager::ClientDisconnect( edict_t *pEntity )
120120
{
121121
CEdict edict = CEdict(pEntity);
122-
CALL_LISTENERS(get_client_disconnect_listener_manager(), edict);
122+
CALL_LISTENERS(ClientDisconnect, edict);
123123
}
124124

125125
//---------------------------------------------------------------------------------
@@ -128,7 +128,7 @@ void CAddonManager::ClientDisconnect( edict_t *pEntity )
128128
void CAddonManager::ClientPutInServer( edict_t *pEntity, char const *playername )
129129
{
130130
CEdict edict = CEdict(pEntity);
131-
CALL_LISTENERS(get_client_put_in_server_listener_manager(), edict, playername);
131+
CALL_LISTENERS(ClientPutInServer, edict, playername);
132132
}
133133

134134
//---------------------------------------------------------------------------------
@@ -137,7 +137,7 @@ void CAddonManager::ClientPutInServer( edict_t *pEntity, char const *playername
137137
void CAddonManager::ClientSettingsChanged( edict_t *pEdict )
138138
{
139139
CEdict edict = CEdict(pEdict);
140-
CALL_LISTENERS(get_client_settings_changed_listener_manager(), edict);
140+
CALL_LISTENERS(ClientSettingsChanged, edict);
141141
}
142142

143143
//---------------------------------------------------------------------------------
@@ -147,7 +147,7 @@ void CAddonManager::ClientConnect( bool *bAllowConnect, edict_t *pEntity,
147147
const char *pszName, const char *pszAddress, char *reject, int maxrejectlen )
148148
{
149149
CEdict edict = CEdict(pEntity);
150-
CALL_LISTENERS(get_client_connect_listener_manager(), *bAllowConnect, edict, pszName, pszAddress, reject, maxrejectlen);
150+
CALL_LISTENERS(ClientConnect, *bAllowConnect, edict, pszName, pszAddress, reject, maxrejectlen);
151151
}
152152

153153
//---------------------------------------------------------------------------------
@@ -158,7 +158,7 @@ void CAddonManager::OnQueryCvarValueFinished( QueryCvarCookie_t iCookie,
158158
const char *pCvarValue )
159159
{
160160
CEdict edict = CEdict(pPlayerEntity);
161-
CALL_LISTENERS(get_on_query_cvar_value_finished_listener_manager(), (int) iCookie, edict, eStatus, pCvarName, pCvarValue);
161+
CALL_LISTENERS(OnQueryCvarValueFinished, (int) iCookie, edict, eStatus, pCvarName, pCvarValue);
162162
}
163163
//
164164
//
@@ -167,18 +167,18 @@ void CAddonManager::OnQueryCvarValueFinished( QueryCvarCookie_t iCookie,
167167
void CAddonManager::ClientFullyConnect( edict_t *pEntity )
168168
{
169169
CEdict edict = CEdict(pEntity);
170-
CALL_LISTENERS(get_client_fully_connect_listener_manager(), edict);
170+
CALL_LISTENERS(ClientFullyConnect, edict);
171171
}
172172

173173
void CAddonManager::OnEdictAllocated( edict_t *edict )
174174
{
175175
CEdict edict = CEdict(pEntity);
176-
CALL_LISTENERS(get_on_edict_allocated_listener_manager(), edict);
176+
CALL_LISTENERS(OnEdictAllocated, edict);
177177
}
178178

179179
void CAddonManager::OnEdictFreed( const edict_t *edict )
180180
{
181181
CEdict edict = CEdict(pEntity);
182-
CALL_LISTENERS(get_on_edict_freed_listener_manager(), edict);
182+
CALL_LISTENERS(OnEdictFreed, edict);
183183
}
184184
#endif

src/core/modules/commands/client_command_wrap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ PLUGIN_RESULT DispatchClientCommand(edict_t* pEntity, const CCommand &command)
108108
// Get the CEdict instance of the player
109109
CEdict* pEdict = new CEdict(pEntity);
110110

111-
// Get the CPlayerInfo instance of the player
112-
CPlayerInfo* pPlayerInfo = new CPlayerInfo(pEdict);
111+
// Get the IPlayerInfo instance of the player
112+
IPlayerInfo* pPlayerInfo = playerinfomanager->GetPlayerInfo(pEntity);
113113

114114
// Get the CICommand instance of the CCommand
115115
CICommand* ccommand = new CICommand(&command);
@@ -209,7 +209,7 @@ void CClientCommandManager::remove_callback( PyObject* pCallable )
209209
//-----------------------------------------------------------------------------
210210
// Calls all callables for the command when it is called on the client.
211211
//-----------------------------------------------------------------------------
212-
CommandReturn CClientCommandManager::Dispatch( CPlayerInfo* pPlayerInfo, CICommand* ccommand )
212+
CommandReturn CClientCommandManager::Dispatch( IPlayerInfo* pPlayerInfo, CICommand* ccommand )
213213
{
214214
// Loop through all callables registered for the CClientCommandManager instance
215215
for(int i = 0; i < m_vecCallables.Count(); i++)

src/core/modules/commands/client_command_wrap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "convar.h"
3939
#include "command_wrap.h"
4040
#include "modules/entities/entities_wrap.h"
41-
#include "modules/players/players_wrap.h"
4241

4342
//-----------------------------------------------------------------------------
4443
// Client Command Manager class.
@@ -52,7 +51,7 @@ class CClientCommandManager
5251
void add_callback(PyObject* pCallable);
5352
void remove_callback(PyObject* pCallable);
5453

55-
CommandReturn Dispatch(CPlayerInfo* pPlayerInfo, CICommand* ccommand);
54+
CommandReturn Dispatch(IPlayerInfo* pPlayerInfo, CICommand* ccommand);
5655

5756
private:
5857
CUtlVector<object> m_vecCallables;

src/core/modules/commands/say_command_wrap.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ void SayConCommand::Dispatch( const CCommand &command )
220220
// Get the CEdict instance of the player
221221
CEdict* pEdict = new CEdict(iIndex);
222222

223-
// Get the CPlayerInfo instance of the player
224-
CPlayerInfo* pPlayerInfo = new CPlayerInfo(pEdict);
223+
// Get the IPlayerInfo instance of the player
224+
IPlayerInfo* pPlayerInfo = playerinfomanager->GetPlayerInfo(pEdict->get_edict());
225225

226226
// Get whether the command was say or say_team
227227
bool bTeamOnly = command.Arg(0) == "say_team";
@@ -337,7 +337,7 @@ void CSayCommandManager::remove_callback( PyObject* pCallable )
337337
//-----------------------------------------------------------------------------
338338
// Dispatches the say command.
339339
//-----------------------------------------------------------------------------
340-
CommandReturn CSayCommandManager::Dispatch( CPlayerInfo* pPlayerInfo, bool bTeamOnly, CICommand* ccommand )
340+
CommandReturn CSayCommandManager::Dispatch( IPlayerInfo* pPlayerInfo, bool bTeamOnly, CICommand* ccommand )
341341
{
342342
// Loop through all callables registered for the CSayCommandManager instance
343343
for(int i = 0; i < m_vecCallables.Count(); i++)

src/core/modules/commands/say_command_wrap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include "utility/sp_util.h"
3636
#include "utility/wrap_macros.h"
3737
#include "modules/entities/entities_wrap.h"
38-
#include "modules/players/players_wrap.h"
3938

4039
//-----------------------------------------------------------------------------
4140
// Say ConCommand instance class.
@@ -82,7 +81,7 @@ class CSayCommandManager
8281
void add_callback(PyObject* pCallable);
8382
void remove_callback(PyObject* pCallable);
8483

85-
CommandReturn Dispatch(CPlayerInfo* pPlayerInfo, bool bTeamOnly, CICommand* ccommand);
84+
CommandReturn Dispatch(IPlayerInfo* pPlayerInfo, bool bTeamOnly, CICommand* ccommand);
8685

8786
private:
8887
const char* m_Name;

0 commit comments

Comments
 (0)