This is largely (or entirely) based on a concept by voogru - http://voogru.com/
The virtual function hooking is powered by the SourceHook library by Pavol "PM OnoTo" Marko.
Contains code contributed by Brett "Brutal" Powell.
Contains code contributed by Asher "asherkin" Baker.
About
CEntity is (and its derived classes are) designed to emulate the CBaseEntity class from the HL2 SDK.
Valve code (like entire class definitions and CBaseEntity functions) from the SDK should almost just work when copied into this.
References to CBaseEntity need to be changed to CEntity.
Sendprops and datamaps are pointers to the actual values so references to these need to be dereferenced.
Code that uses unexposed data members won't work - Though you could reimplement these manually.
Virtual functions handle identically to ones in a real derived class.
Calls from valve code to a virtual in CEntity (with no derived versions) fall back directly to the valve code.
Calls from valve code to a virtual (with a derived version) will call that code, and the valve code can be optionally run using BaseClass::Function().
Calls from your code to a virtual in CEntity (with no derived versions) will make a call to the valve code.
Calls from your code to a virtual (with a derived version) will call that code, and that derived handler can run the valve code optionally using BaseClass::Function().
Notes
If you inherit Init() or Destroy() in a derived class, I would highly recommend calling the BaseClass equivalent.
TODO (in no particular order)
Add handling of custom keyvalues commands
Add datamapping to class values so keyvalues can parse to them
Include more CEntity virtuals and props/datamaps
Create more derived classes
Include more Think/Touch etc handlers
Valve code now has lists of thinks, can we access this?
Forcibly deleting entities? - Implemented AcceptInput("Kill"...), UTIL_Remove sig scan would be cleaner.
Support mods other than TF2 (CPlayer should only contain CBasePlayer sdk stuff and create optional CTFPlayer/CCSPlayer derives)
Change log
1.0
Initial import of basic CEntity and CPlayer
2.x
Improved LINK_ENTITY_TO_CLASS to use DLL Classnames. tf_projectile_rocket changed to CTFProjectile_Rocket for example.
Added the ability to handle entity Inputs/Outputs.
Cleaned up Macros used for almost everything.
Added many new hooks and props for CEntity and CPlayer.
Support for custom classnames with LINK_ENTITY_TO_CUSTOM_CLASS.
Added support for detours, needs CDetours folder in the parent directory.
Added a helpers class that makes common functions easy (from CrimsonGT).
CScriptCreatedItem and CScriptCreatedAttribute (from TF2Items).
A new 'tracker', designed to get a generic pointer from a sig in a gamedata file.
A lot of CPlayer defines, including PLAYERCONDs, WEAPONSLOTs and LOADOUTSLOTs.
Added CAnimating with StudioFrameAdvance and Dissolve.