Move dynamic resource code. Clean up some references to cResourceDef.