3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_
16 #define _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_
19 #include <IUserMessages.h>
20 #include "sourcemm_api.h"
22 #include "CellRecipientFilter.h"
24 using namespace SourceHook;
25 using namespace SourceMod;
27 #define INVALID_MESSAGE_ID -1
31 IUserMessageListener *Callback;
36 typedef List<ListenerInfo *> MsgList;
37 typedef List<ListenerInfo *>::iterator MsgIter;
46 public: //SMGlobalClass
47 void OnSourceModStartup(bool late);
48 void OnSourceModAllInitialized();
49 void OnSourceModAllShutdown();
50 public: //IUserMessages
51 int GetMessageIndex(const char *msg);
52 bool GetMessageName(int msgid, char *buffer, size_t maxlength) const;
53 bool HookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
54 bool UnhookUserMessage(int msg_id, IUserMessageListener *pListener, bool intercept=false);
55 bf_write *StartMessage(int msg_id, cell_t players[], unsigned int playersNum, int flags);
58 bf_write *OnStartMessage_Pre(IRecipientFilter *filter, int msg_type);
59 bf_write *OnStartMessage_Post(IRecipientFilter *filter, int msg_type);
60 void OnMessageEnd_Pre();
61 void OnMessageEnd_Post();
63 void _DecRefCounter();
65 List<ListenerInfo *> m_msgHooks[255];
66 List<ListenerInfo *> m_msgIntercepts[255];
67 CStack<ListenerInfo *> m_FreeListeners;
68 unsigned char m_pBase[2500];
69 IRecipientFilter *m_CurRecFilter;
70 bf_write m_InterceptBuffer;
71 bf_write *m_OrigBuffer;
76 bool m_FallbackSearch;
79 CellRecipientFilter m_CellRecFilter;
85 extern UserMessages g_UserMsgs;
87 #endif //_INCLUDE_SOURCEMOD_CUSERMESSAGES_H_