Remove the need for a UTIL_Remove call.
Remove the need for a UTIL_Remove call.
1.1 --- a/cssdm_utils.cpp Thu Jan 23 21:19:45 2014 -0500
1.2 +++ b/cssdm_utils.cpp Sat Feb 08 18:38:34 2014 -0500
1.3 @@ -35,7 +35,6 @@
1.4
1.5 List<ICallWrapper *> g_CallWrappers;
1.6 ICallWrapper *g_pRoundRespawn = NULL;
1.7 -ICallWrapper *g_pRemoveEntity = NULL;
1.8 ICallWrapper *g_pWeaponGetSlot = NULL;
1.9 ICallWrapper *g_pDropWeapon = NULL;
1.10 ICallWrapper *g_pRemoveAllItems = NULL;
1.11 @@ -109,9 +108,44 @@
1.12 g_pRoundRespawn->Execute(&pEntity, NULL);
1.13 }
1.14
1.15 +class variant_t
1.16 +{
1.17 +public:
1.18 + union
1.19 + {
1.20 + bool bVal;
1.21 + string_t iszVal;
1.22 + int iVal;
1.23 + float flVal;
1.24 + float vecVal[3];
1.25 + color32 rgbaVal;
1.26 + };
1.27 + CBaseHandle eVal; // this can't be in the union because it has a constructor.
1.28 + fieldtype_t fieldType;
1.29 +};
1.30 +
1.31 +struct inputdata_t
1.32 +{
1.33 + CBaseEntity *pActivator; // The entity that initially caused this chain of output events.
1.34 + CBaseEntity *pCaller; // The entity that fired this particular output.
1.35 + variant_t value; // The data parameter for this output.
1.36 + int nOutputID; // The unique ID of the output that was fired.
1.37 +};
1.38 +
1.39 void DM_RemoveEntity(CBaseEntity *pEntity)
1.40 {
1.41 - g_pRemoveEntity->Execute(&pEntity, NULL);
1.42 + datamap_t *pMap = gamehelpers->GetDataMap(pEntity);
1.43 +
1.44 + if(!pMap)
1.45 + return;
1.46 +
1.47 + typedescription_t *pDesc = gamehelpers->FindInDataMap(pMap, "InputKill");
1.48 +
1.49 + if(!pDesc)
1.50 + return;
1.51 +
1.52 + inputdata_t data;
1.53 + (pEntity->*pDesc->inputFunc)(data);
1.54 }
1.55
1.56 bool DM_IsPlayerAlive(int client)
1.57 @@ -290,14 +324,6 @@
1.58 g_pDmConf->GetMemSig("RoundRespawn", &addr);
1.59 g_pRoundRespawn = bintools->CreateCall(addr, CallConv_ThisCall, NULL, NULL, 0);
1.60 g_CallWrappers.push_back(g_pRoundRespawn);
1.61 -
1.62 - /** UTIL_REMOVE */
1.63 - g_pDmConf->GetMemSig("UTIL_Remove", &addr);
1.64 - pass[0].flags = PASSFLAG_BYVAL;
1.65 - pass[0].size = sizeof(CBaseEntity *);
1.66 - pass[0].type = PassType_Basic;
1.67 - g_pRemoveEntity = bintools->CreateCall(addr, CallConv_Cdecl, NULL, pass, 1);
1.68 - g_CallWrappers.push_back(g_pRemoveEntity);
1.69
1.70 /** WEAPON_GETSLOT */
1.71 g_pDmConf->GetOffset("Weapon_GetSlot", &offset);