Here is how you can simulate it. Basically you create pure abstract classes to act kind of like interfaces for the different types of callbacks. Then derive the classes you want to have these from that interface. Then you define one normal C function for each callback type and just cast the first entity to that interface type and if it's not null call the virtual method.
This isn't tested code, just doing some stuff from memory, but it gives you the general idea.
void _stdcall EntityCollisionCallback( TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed )
{
Collider* b = (Collider*)GetEntityUserData(entity0);
if(b != NULL)
{
b->OnCollide(entity1, position, normal, force, speed);
}
}
class Collider
{
public:
virtual void OnCollide(TEntity ent, byte* position, byte* normal, byte* force, flt speed)=0;
};
class MyBody : public Collider
{
private:
TEntity body;
public:
MyBody()
{
body = CreateBodyBox();
SetEntityUserData(body, (byte*)this);
SetEntityCallback(body,(byte*)EntityCollisionCallback,ENTITYCALLBACK_COLLISION);
}
void OnCollide(TEntity ent, byte* position, byte* normal, byte* force, flt speed)
{
}
};