Make CFsm a template
The context doesn't have to be converted to void* and back.
Differential Revision: https://code.wildfiregames.com/D5253