| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 414eb91 commit caad960
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,6 +100,7 @@ extern PLUGIN_RESULT DispatchClientCommand(edict_t *pEntity, const CCommand &com | |||
| 100 | 100 | //--------------------------------------------------------------------------------- | |
| 101 | 101 | CSourcePython g_SourcePythonPlugin; | |
| 102 | 102 | EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CSourcePython, IServerPluginCallbacks, INTERFACEVERSION_ISERVERPLUGINCALLBACKS, g_SourcePythonPlugin ); | |
| 103 | + IServerPluginCallbacks *pPlugin; | ||
| 103 | 104 | ||
| 104 | 105 | //--------------------------------------------------------------------------------- | |
| 105 | 106 | // Helper console variable to tell scripters what engine version we are running | |
@@ -196,6 +197,8 @@ bool CSourcePython::Load( CreateInterfaceFn interfaceFactory, CreateInterfaceFn | |||
| 196 | 197 | ConnectTier2Libraries( &interfaceFactory, 2 ); | |
| 197 | 198 | #endif | |
| 198 | 199 | ||
| 200 | + pPlugin = this; | ||
| 201 | + | ||
| 199 | 202 | // Get all engine interfaces. | |
| 200 | 203 | if( !GetInterfaces(gEngineInterfaces, interfaceFactory) ) { | |
| 201 | 204 | return false; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,8 +24,22 @@ | |||
| 24 | 24 | * Development Team grants this exception to all derivative works. | |
| 25 | 25 | */ | |
| 26 | 26 | ||
| 27 | + //----------------------------------------------------------------------------- | ||
| 28 | + // Includes. | ||
| 29 | + //----------------------------------------------------------------------------- | ||
| 27 | 30 | #include "usermessage.h" | |
| 28 | - | ||
| 31 | + #include "public/engine/iserverplugin.h" | ||
| 32 | + #include "core/sp_main.h" | ||
| 33 | + | ||
| 34 | + //----------------------------------------------------------------------------- | ||
| 35 | + // Externals. | ||
| 36 | + //----------------------------------------------------------------------------- | ||
| 37 | + extern IServerPluginHelpers *helpers; | ||
| 38 | + extern IServerPluginCallbacks *pPlugin; | ||
| 39 | + | ||
| 40 | + //----------------------------------------------------------------------------- | ||
| 41 | + // CUserMessage implementation. | ||
| 42 | + //----------------------------------------------------------------------------- | ||
| 29 | 43 | CUserMessage::CUserMessage(const MRecipientFilter &recipient_filter, const char *message_name ) : | |
| 30 | 44 | CUserMessageImplementation(recipient_filter, message_name), | |
| 31 | 45 | m_sent(false) | |
@@ -105,3 +119,11 @@ void CUserMessage::set_string( const char *field_name, const char *field_value, | |||
| 105 | 119 | { | |
| 106 | 120 | CUserMessageImplementation::set_string(field_name, field_value, index); | |
| 107 | 121 | } | |
| 122 | + | ||
| 123 | + //----------------------------------------------------------------------------- | ||
| 124 | + // Functions. | ||
| 125 | + //----------------------------------------------------------------------------- | ||
| 126 | + void CreateMessage( edict_t *pEdict, DIALOG_TYPE type, KeyValues *data ) | ||
| 127 | + { | ||
| 128 | + helpers->CreateMessage(pEdict, type, data, pPlugin); | ||
| 129 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,12 +27,17 @@ | |||
| 27 | 27 | #ifndef _USERMESSAGE_H_ | |
| 28 | 28 | #define _USERMESSAGE_H_ | |
| 29 | 29 | ||
| 30 | + //----------------------------------------------------------------------------- | ||
| 31 | + // Includes. | ||
| 32 | + //----------------------------------------------------------------------------- | ||
| 30 | 33 | #include "irecipientfilter.h" | |
| 31 | - | ||
| 32 | 34 | #include "utility/wrap_macros.h" | |
| 33 | - | ||
| 34 | 35 | #include GAME_INCLUDE_PATH(usermessage_implementation.h) | |
| 36 | + #include "public/engine/iserverplugin.h" | ||
| 35 | 37 | ||
| 38 | + //----------------------------------------------------------------------------- | ||
| 39 | + // CUserMessage. | ||
| 40 | + //----------------------------------------------------------------------------- | ||
| 36 | 41 | class CUserMessage : public CUserMessageImplementation | |
| 37 | 42 | { | |
| 38 | 43 | public: | |
@@ -64,4 +69,9 @@ class CUserMessage : public CUserMessageImplementation | |||
| 64 | 69 | bool m_sent; | |
| 65 | 70 | }; | |
| 66 | 71 | ||
| 67 | - #endif | ||
| 72 | + //----------------------------------------------------------------------------- | ||
| 73 | + // Functions. | ||
| 74 | + //----------------------------------------------------------------------------- | ||
| 75 | + void CreateMessage( edict_t *pEdict, DIALOG_TYPE type, KeyValues *data ); | ||
| 76 | + | ||
| 77 | + #endif // _USERMESSAGE_H_ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,22 +24,27 @@ | |||
| 24 | 24 | * Development Team grants this exception to all derivative works. | |
| 25 | 25 | */ | |
| 26 | 26 | ||
| 27 | + //----------------------------------------------------------------------------- | ||
| 28 | + // Includes. | ||
| 29 | + //----------------------------------------------------------------------------- | ||
| 27 | 30 | #include "modules/export_main.h" | |
| 28 | 31 | #include "usermessage.h" | |
| 29 | 32 | ||
| 30 | - //--------------------------------------------------------------------------------- | ||
| 33 | + //----------------------------------------------------------------------------- | ||
| 31 | 34 | // Namespaces to use | |
| 32 | - //--------------------------------------------------------------------------------- | ||
| 35 | + //----------------------------------------------------------------------------- | ||
| 33 | 36 | using namespace boost::python; | |
| 34 | 37 | ||
| 35 | - //--------------------------------------------------------------------------------- | ||
| 38 | + //----------------------------------------------------------------------------- | ||
| 36 | 39 | // Exposer functions. | |
| 37 | - //--------------------------------------------------------------------------------- | ||
| 40 | + //----------------------------------------------------------------------------- | ||
| 38 | 41 | void export_usermessage_interface(); | |
| 42 | + void export_message_functions(); | ||
| 43 | + void export_dialog_enum(); | ||
| 39 | 44 | ||
| 40 | - //--------------------------------------------------------------------------------- | ||
| 45 | + //----------------------------------------------------------------------------- | ||
| 41 | 46 | // Method overloads | |
| 42 | - //--------------------------------------------------------------------------------- | ||
| 47 | + //----------------------------------------------------------------------------- | ||
| 43 | 48 | DECLARE_CLASS_METHOD_OVERLOAD(CUserMessage, set_char, 2, 3); | |
| 44 | 49 | DECLARE_CLASS_METHOD_OVERLOAD(CUserMessage, set_byte, 2, 3); | |
| 45 | 50 | DECLARE_CLASS_METHOD_OVERLOAD(CUserMessage, set_short, 2, 3); | |
@@ -49,12 +54,14 @@ DECLARE_CLASS_METHOD_OVERLOAD(CUserMessage, set_bool, 2, 3); | |||
| 49 | 54 | DECLARE_CLASS_METHOD_OVERLOAD(CUserMessage, set_string, 2, 3); | |
| 50 | 55 | DECLARE_CLASS_METHOD_OVERLOAD(CUserMessage, set_buffer, 3, 4); | |
| 51 | 56 | ||
| 52 | - //--------------------------------------------------------------------------------- | ||
| 57 | + //----------------------------------------------------------------------------- | ||
| 53 | 58 | // Exposes the engine module. | |
| 54 | - //--------------------------------------------------------------------------------- | ||
| 59 | + //----------------------------------------------------------------------------- | ||
| 55 | 60 | DECLARE_SP_MODULE(usermessage_c) | |
| 56 | 61 | { | |
| 57 | 62 | export_usermessage_interface(); | |
| 63 | + export_message_functions(); | ||
| 64 | + export_dialog_enum(); | ||
| 58 | 65 | } | |
| 59 | 66 | ||
| 60 | 67 | void export_usermessage_interface() | |
@@ -139,4 +146,23 @@ void export_usermessage_interface() | |||
| 139 | 146 | ) | |
| 140 | 147 | ||
| 141 | 148 | BOOST_END_CLASS() | |
| 142 | - } | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + void export_message_functions() | ||
| 152 | + { | ||
| 153 | + def("create_message", | ||
| 154 | + CreateMessage, | ||
| 155 | + "Creates an onscreen menu with various option buttons" | ||
| 156 | + ); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + void export_dialog_enum() | ||
| 160 | + { | ||
| 161 | + enum_<DIALOG_TYPE>("DialogType") | ||
| 162 | + ENUM_VALUE("MSG", DIALOG_MSG) | ||
| 163 | + ENUM_VALUE("MENU", DIALOG_MENU) | ||
| 164 | + ENUM_VALUE("TEXT", DIALOG_TEXT) | ||
| 165 | + ENUM_VALUE("ENTRY", DIALOG_ENTRY) | ||
| 166 | + ENUM_VALUE("ASKCONNECT", DIALOG_ASKCONNECT) | ||
| 167 | + BOOST_END_CLASS() | ||
| 168 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments