3 * ===============================================================
4 * CS:S DM, Copyright (C) 2004-2007 AlliedModders LLC.
5 * By David "BAILOPAN" Anderson
7 * ===============================================================
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or (at
12 * your option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; see the file COPYING; if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
27 #ifndef _INCLUDE_CSSDM_UTILS_H_
28 #define _INCLUDE_CSSDM_UTILS_H_
30 #include "smsdk_ext.h"
32 #if defined PLATFORM_POSIX
33 #define EXTRA_VTBL_OFFSET 1
34 #elif defined PLATFORM_WINDOWS
35 #define EXTRA_VTBL_OFFSET 0
48 unsigned char patch[20];
52 /** "Safe" functions */
53 CBaseEntity *DM_GetBaseEntity(int index);
54 void DM_RespawnPlayer(int client);
55 void DM_RemoveEntity(CBaseEntity *pEntity);
56 bool DM_IsPlayerAlive(int client);
57 bool DM_CheckSerial(edict_t *pEdict, int serial);
58 size_t DM_StringToBytes(const char *str, unsigned char buffer[], size_t maxlength);
59 void DM_ApplyPatch(void *address, int offset, const dmpatch_t *patch, dmpatch_t *restore);
60 CBaseEntity *DM_GetWeaponFromSlot(CBaseEntity *pEntity, int slot);
61 void DM_DropWeapon(CBaseEntity *pEntity, CBaseEntity *pWeapon);
62 void DM_RemoveAllItems(CBaseEntity *pEntity, bool removeSuit);
63 void DM_SetMemPatchable(void *address, size_t size);
64 void DM_SetDefuseKit(CBaseEntity *pEntity, bool defuseKit);
65 int DM_GiveAmmo(CBaseEntity *pEntity, int type, int count, bool noSound);
67 /** "Internal" functions */
68 CBaseEntity *DM_GetAndClearRagdoll(CBaseEntity *pEntity, int &serial);
71 bool InitializeUtils(char *error, size_t maxlength);
74 #endif //_INCLUDE_CSSDM_UTILS_H_