Raised This Month: $ Target: $400
 0% 

[FRAMEWORK] CEntity


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
pRED*
Join Date: Dec 2006
Old 03-12-2009 , 20:45   [FRAMEWORK] CEntity
Reply With Quote #1

CEntity Entity Handling Framework version 2.x by Matt 'pRED*' Woodrow

This is a framework for C++ developers and requires a decent understanding of C++ and the SDK to be of use.

Source Code

Example Usage
SideWinder (CEntity 1.x)
TFDodgeball (CEntity 2.x)

Credits
  • 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.
    • Changed CPlayer to inherit from CAnimating.

Last edited by asherkin; 01-24-2011 at 05:45.
pRED* is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode