Game Development Community

dev|Pro Game Development Curriculum

DotNetTorque! What's in a C++ Extern?

by Vince Gee · 02/22/2012 (10:59 am) · 13 comments

I figured I'd update everyone on my progress of switching cSharp with TorqueScript inside of T3d. Now, let me clarify things a bit, I'm not REMOVING TorqueScript, instead, much like the pyTorque extends TorqueScript, I'm extending cSharp with Torque.

So, even though you can now almost write a complete game server without messing with TorqueScript syntax, (i.e. if statements, case, etc.) you still must understand how Torque works in general. You must understand how namespaces work, packages work etc. They are the heart of the engine, and I see no reason to do a transplant.

With that said, I'm sure some of you are wondering what it takes to extend cSharp with Torque. Well a lot of typing, and a bit of problem solving. Currently, I have about 220 console functions exposed from the engine. All of the console functions from ShapeBase.cpp and GameConnection.cpp have been exposed. I'm now working through the other objects one at a time, putting in externs for each console function.

So what does it take?
Well first I need to track down the console function, then figure out what each of the parameters are for the call. Write a function that allows me to pass IDs for the object parameters and find the objects. Then, execute what the console command is supposed to do, and return the results.

Wow, that sounds easy!
Well, unfortunately it had a slow start. First MS DotNet is a managed language, meaning that its variables do not live in the unmanaged global memory where Torque lives. (You can shove them there manually, but you better remember to free them.) Second, Torque wasn't designed to be interacted with this way, so it likes freeing pointers for you, so all those strings you send in, get a bad habit of being freed before the function returns the result to you.

After a while, the Marshal Function Decoration in DotNet becomes your friend. You quickly learn that you can decorate the externs and reliably (and most importantly, automatically) broker your data between the managed and unmanaged code. So, as long as you're careful with how you set up your classes, the managed code (and parameters being tossed around therein) are properly cleaned up by DotNet clr.

Right now, I have about 200-220 Externs defined, grouped nicely by the type of object in Torque they are designed to modify. For each Extern, you have to write the C++ code, the cSharp code Extern command, a function helper (to prevent buffer overruns and such) and any other validation you want to occur before calling the Extern. I'm somewhere in the thousands of lines of code, but it isn't that bad. (If you say it real quick).

So, without further ado, here are the externs I've done already!

extern "C" __declspec(dllexport) SimObjectId ShapeBase_getControlObject(SimObjectId object)
extern "C" __declspec(dllexport) U32 clientGroup_getCount()
extern "C" __declspec(dllexport) U32 clientGroup_getObject(U32 index)
extern "C" __declspec(dllexport) S32 SimSet_GetCount(char * simset)
extern "C"  __declspec(dllexport) U32 SimSet_GetObject(char * simset,S32 index)
extern "C"  __declspec(dllexport) bool SimSet_AddObject(char * simset,char * simobject)

/*Vehicle*/
extern "C"  __declspec(dllexport) bool Vehicle_mountObject(char * _Vehicle,char * sceneobject_target,S32 slot,bool hastransform,F32 ex,F32 ey, F32 ez,F32 px,F32 py, F32 pz)
/*Vehicle*/

/*_WheeledVehicle*/
extern "C"  __declspec(dllexport) bool setWheelTire(char * _WheeledVehicle,S32 wheel, char* _tire)
extern "C"  __declspec(dllexport) bool setWheelSteering(char * _WheeledVehicle,S32 wheel, F32 steering)
extern "C"  __declspec(dllexport) bool setWheelSpring(char * _WheeledVehicle,S32 wheel, char* _spring)
extern "C"  __declspec(dllexport) S32 getWheelCount(char * _WheeledVehicle)
/*_WheeledVehicle*/

/*SceneObject*/
extern "C"  __declspec(dllexport) void SceneObject_getInverseTransform(char * sceneobject,char * ret)
extern "C"  __declspec(dllexport) bool SceneObject_mountObject(char * sceneobject_source,char * sceneobject_target,S32 slot,bool hastransform,F32 ex,F32 ey, F32 ez,F32 px,F32 py, F32 pz)
}
extern "C"  __declspec(dllexport) void SceneObject_unmount(char* _SceneObject)
extern "C" __declspec(dllexport) U32 SceneObject_getMountNodeObject(char* sceneobject, S32 node)
extern "C" __declspec(dllexport) bool SceneObject_isMounted(char* sceneobject)
extern "C" __declspec(dllexport) U32 SceneObject_getTypeMask(char* sceneobject)
extern "C" __declspec(dllexport) void SceneObject_getWorldBoxCenter(char* sceneobject,char* ret)
extern "C" __declspec(dllexport) void SceneObject_initContainerRadiusSearch(F32 x,F32 y,F32 z, F32 radius,U32 mask,bool useClientContainer,U32 results[500],F32 distresults[500])
extern "C" __declspec(dllexport) F32 calcExplosionCoverage(F32 x,F32 y,F32 z,U32 id,U32 covMask)
/*SceneObject*/

/*ShapeBase*/
extern "C" __declspec(dllexport) bool ShapeBase_setControlObject(char * shapebase, char * toshapebase)
extern "C" __declspec(dllexport) bool doDismount(char * playerDataBlock)
extern "C" __declspec(dllexport) bool SimObject_isField(char * simobject,char * fieldname)
extern "C" __declspec(dllexport) bool Player_setArmThread(char* player,char * name)
extern "C" __declspec(dllexport) bool Player_setActionThread(char* shapebase,char * name, bool hold, bool fsp)
extern "C" __declspec(dllexport) void ParentCall(char* sim_object,char* function,S32 namespacedepth,char* ret,S32 argc,char ** _argv,bool debug)
extern "C" __declspec(dllexport) void ShapeBase_setHidden(char* shapebase,bool show)
extern "C" __declspec(dllexport) bool ShapeBase_isHidden(char* shapebase)
extern "C" __declspec(dllexport) bool ShapeBase_playAudio(char* shapebase,S32 slot,char* sfxtrack)
extern "C" __declspec(dllexport) bool ShapeBase_stopAudio(char* shapebase,S32 slot)
extern "C" __declspec(dllexport) bool ShapeBase_playThread(char* shapebase,S32 slot,char * _name)
extern "C" __declspec(dllexport) bool ShapeBase_setThreadDir(char* shapebase,S32 slot,bool fwd)
extern "C" __declspec(dllexport) bool ShapeBase_setThreadTimeScale(char* shapebase,S32 slot,F32 scale)
extern "C" __declspec(dllexport) bool ShapeBase_setThreadPosition(char* shapebase,S32 slot,F32 pos)
extern "C" __declspec(dllexport) bool ShapeBase_stopThread(char* shapebase,S32 slot)
extern "C" __declspec(dllexport) bool ShapeBase_destroyThread(char* shapebase,S32 slot)
extern "C" __declspec(dllexport) bool ShapeBase_pauseThread(char* shapebase,S32 slot)
extern "C" __declspec(dllexport) bool ShapeBase_mountImage(char * player_id,char * shapebaseimagedata,   S32 slot, bool loaded, char* _skinTag )
extern "C" __declspec(dllexport) bool ShapeBase_unmountImage(char * simobj_id,S32 slot)
extern "C" __declspec(dllexport) U32 ShapeBase_getMountedImage(char* simobj_id,S32 slot)
extern "C" __declspec(dllexport) U32 ShapeBase_getPendingImage(char * simobj_id,S32 slot)
extern "C" __declspec(dllexport) bool ShapeBase_isImageFiring(char * shapebase,S32 slot)
extern "C" __declspec(dllexport) bool ShapeBase_isImageMounted(char * shapebase,char * _image)
extern "C" __declspec(dllexport) S32 ShapeBase_getMountSlot(char * shapebase,char* shapebaseimagedata)
extern "C" __declspec(dllexport) S32 ShapeBase_getImageSkinTag(char * shapebase,S32 slot)
extern "C" __declspec(dllexport) void ShapeBase_getImageState(char * shapebase,S32 slot,char * ret)
extern "C" __declspec(dllexport) bool ShapeBase_hasImageState(char* shapebase,S32 slot,char* _state)
extern "C" __declspec(dllexport) bool ShapeBase_getImageTrigger(char * shapebase,S32 slot)
extern "C"  __declspec(dllexport) bool ShapeBase_setImageTrigger(char * shapebase,S32 mslot,bool mstate)
extern "C"  __declspec(dllexport) bool ShapeBase_getImageGenericTrigger(char* shapebase,S32 slot,S32 trigger)
extern "C" __declspec(dllexport) S32 ShapeBase_setImageGenericTrigger (char * _shapebase, S32 slot, S32 trigger, bool state)
extern "C" __declspec(dllexport) bool ShapeBase_getImageAltTrigger(char * shapebase, S32 slot)
extern "C"  __declspec(dllexport) bool ShapeBase_setImageAltTrigger(char * shapebase,S32 slot,bool state)
extern "C" __declspec(dllexport) bool ShapeBase_getImageAmmo(char* shapebase,S32 slot)
extern "C"  __declspec(dllexport) bool ShapeBase_setImageAmmo(char * shapebase,S32 slot,bool state)
extern "C"  __declspec(dllexport) bool ShapeBase_getImageLoaded(char * shapebase,S32 slot)
extern "C"  __declspec(dllexport) bool ShapeBase_setImageLoaded(char * shapebase,S32 slot,bool state)
extern "C"  __declspec(dllexport) bool ShapeBase_getImageTarget(char * shapebase,S32 slot)
extern "C"  __declspec(dllexport) bool ShapeBase_setImageTarget(char * shapebase,S32 slot,bool state)
extern "C"  __declspec(dllexport) void ShapeBase_getImageScriptAnimPrefix(char * shapebase,S32 slot,char* ret)
extern "C"  __declspec(dllexport) void ShapeBase_setImageScriptAnimPrefix(char * shapebase,S32 slot,char* _prefix)
extern "C" __declspec(dllexport) void ShapeBase_getMuzzleVector(char* shapebase,S32 slot,char* ret)
extern "C" __declspec(dllexport) void ShapeBase_getMuzzlePoint(char* shapebase,S32 slot,char* ret)
extern "C" __declspec(dllexport) void ShapeBase_getSlotTransform(char* shapebase,S32 slot,char* ret)
extern "C" __declspec(dllexport) void ShapeBase_getAIRepairPoint(char* shapebase,char* ret)
extern "C" __declspec(dllexport) void ShapeBase_getVelocity(char * shapebase, F32 x,F32 y,F32 z)
extern "C" __declspec(dllexport) bool ShapeBase_setVelocity(char* shapebase,F32 x,F32 y,F32 z)
extern "C" __declspec(dllexport) bool ShapeBase_applyImpulse(char * shapebase, F32 x,F32 y,F32 z, F32 vx,F32 vy,F32 vz)
extern "C" __declspec(dllexport) void ShapeBase_getEyeTransform(char * shapebase,char * ret)
extern "C" __declspec(dllexport) void ShapeBase_getEyeVector(char * shapebase,char * ret)
extern "C" __declspec(dllexport) void ShapeBase_getEyePoint(char * shapebase,char * ret)
extern "C" __declspec(dllexport) void ShapeBase_getLookAtPoint(char * shapebase,F32 distance,U32 typeMask,char* ret)
extern "C" __declspec(dllexport) void ShapeBase_setEnergyLevel (char * shapebase, F32 level)
extern "C" __declspec(dllexport) F32 ShapeBase_getEnergyLevel (char * shapebase)
extern "C" __declspec(dllexport) F32 ShapeBase_getEnergyPercent (char * shapebase)
extern "C" __declspec(dllexport) void ShapeBase_setDamageLevel(char * shapebase,F32 level)
extern "C" __declspec(dllexport) F32 ShapeBase_getDamageLevel(char* shapebase)
extern "C" __declspec(dllexport) F32 ShapeBase_getDamagePercent(char* shapebase)
extern "C" __declspec(dllexport) bool ShapeBase_setDamageState(char* shapebase,char* _state)
extern "C" __declspec(dllexport) void ShapeBase_getDamageState(char * shapebase, char * ret)
extern "C" __declspec(dllexport) bool ShapeBase_isDestroyed(char * shapebase)
extern "C" __declspec(dllexport) bool ShapeBase_isDisabled(char * shapebase)
extern "C" __declspec(dllexport) bool ShapeBase_isEnabled(char * shapebase)
extern "C" __declspec(dllexport) void ShapeBase_applyDamage (char* simobject,F32 amount)
extern "C" __declspec(dllexport) void ShapeBase_applyRepair (char* simobject,F32 amount)
extern "C" __declspec(dllexport) void ShapeBase_setRepairRate (char * shapebase, F32 rate)
extern "C" __declspec(dllexport) F32 ShapeBase_getRepairRate(char* simobject)
extern "C" __declspec(dllexport) void ShapeBase_setRechargeRate (char * shapebase, F32 rate)
extern "C" __declspec(dllexport) F32 ShapeBase_getRechargeRate(char* simobject)
extern "C" __declspec(dllexport) U32 ShapeBase_getControllingClient(SimObjectId object)
extern "C" __declspec(dllexport) U32 ShapeBase_getControllingObject(char* object)
extern "C" __declspec(dllexport) void ShapeBase_setCloaked(char* simobject,bool cloak)
extern "C" __declspec(dllexport) bool Shapebase_isCloaked(char* simobject)
extern "C" __declspec(dllexport) bool Shapebase_setDamageFlash(char * simobject,F32 level)
extern "C" __declspec(dllexport) F32 ShapeBase_getDamageFlash(char * simobject)
extern "C" __declspec(dllexport) void ShapeBase_setWhiteOut(char * simobject, F32 level)
extern "C" __declspec(dllexport) F32 ShapeBase_getWhiteOut(char * simobject)
extern "C" __declspec(dllexport) F32 ShapeBase_getDefaultCameraFov(char * simobject)
extern "C" __declspec(dllexport) F32 ShapeBase_getCameraFov(char * simobject)
extern "C" __declspec(dllexport) void ShapeBase_setCameraFov(char * simobject, F32 fov)
extern "C" __declspec(dllexport) void ShapeBase_startFade(char * shapebase, S32 time,S32 delay,bool fadeOut)
extern "C" __declspec(dllexport) void ShapeBase_setDamageVector(char * shapebase,F32 x,F32 y,F32 z)
extern "C" __declspec(dllexport) void ShapeBase_setShapeName(char * simobj_id,char* name)
extern "C" __declspec(dllexport) void ShapeBase_getShapeName(char * shapebase,char* ret)
extern "C" __declspec(dllexport) void ShapeBase_setSkinName(char * shapebase,char* _name)
extern "C" __declspec(dllexport) void ShapeBase_getSkinName(char * shapebase,char* ret)
extern "C" __declspec(dllexport) void ShapeBase_setAllMeshesHidden(char * shapebase,bool hide)
extern "C" __declspec(dllexport) void ShapeBase_setMeshHidden(char * shapebase,char * _name,bool hide)
extern "C" __declspec(dllexport) void ShapeBase_dumpMeshVisibility(char * shapebase)
extern "C" __declspec(dllexport) void ShapeBase_getTargetName(char * shapebase,S32 index ,char * ret)
extern "C" __declspec(dllexport) S32 ShapeBase_getTargetCount(char * shapebase)
extern "C" __declspec(dllexport) void ShapeBase_changeMaterial(char * shapebase,char * _mapTo,char * _oldMat,char * _newMat)
extern "C" __declspec(dllexport) void ShapeBase_getModelFile(char * shapebase,char * ret)

/*Console*/
extern "C" __declspec(dllexport) void getTransform(char * simobj_id,char* returnval)
extern "C" __declspec(dllexport) void setTransform(char * simobj_id,F32 x,F32 y,F32 z,F32 ang,F32 ax,F32 ay,F32 az)
extern "C" __declspec(dllexport) bool NameSpace_isMethod(char * _sns,char* _method)
extern "C" __declspec(dllexport) bool NameSpace_isInNamespaceHierarchy(char* shapebase, char* name)
extern "C" __declspec(dllexport) S32 Console_getSimTime()
extern "C" __declspec(dllexport) bool isObject(char * simobj_id)
extern "C" __declspec(dllexport) void Console_printf(char * message)
extern "C" __declspec(dllexport) void Console_warnf(char * message)
extern "C" __declspec(dllexport) void Console_errorf(char * message)
extern "C" __declspec(dllexport) void ConsoleCall(char * cmd,char * result,bool echo)
extern "C" __declspec(dllexport) void cs_torque_getvariable(const char* name,char* result)
extern "C" __declspec(dllexport) void cs_torque_setvariable(char* name, char* value)
extern "C" __declspec(dllexport) void deleteVariables(char * pattern) 
extern "C" __declspec(dllexport) bool objectHasMethod(char* name,char* method)
extern "C" __declspec(dllexport) U32 GetObjectID(char * simobj_id)
extern "C" __declspec(dllexport) bool isPackage(char * identifier)
extern "C" __declspec(dllexport) void activatePackage(char * identifier)
extern "C" __declspec(dllexport) void deactivatePackage(char * identifier)
extern "C" __declspec(dllexport) bool isFile(char * sfileName)
extern "C" __declspec(dllexport) S32 getFileCRC(char * sfileName)
extern "C" __declspec(dllexport) void pathOnMissionLoadDone()
extern "C" __declspec(dllexport) void clearServerPaths()
extern "C" __declspec(dllexport) void getAddress(char * client,char * _buffer)
extern "C" __declspec(dllexport) void physicsStartSimulation(char * variable)
extern "C" __declspec(dllexport) void physicsStopSimulation(char * variable)
extern "C" __declspec(dllexport) U32 getDataBlock(char * simobject)
extern "C" __declspec(dllexport) bool isFunction(char * functionname)
extern "C" __declspec(dllexport) U32 spawnObject(char * _spawnClass, char * _spawnDataBlock, char * _spawnName, char * _spawnProperties, char* _spawnScript)
extern "C" __declspec(dllexport) bool isMemberOfClass (char * className, char* superClassName)
extern "C" __declspec(dllexport) void addTaggedString (char * inString,char * ret)
extern "C" __declspec(dllexport) S32 nameToID (char * name)
extern "C" __declspec(dllexport) U32 getParent (char* simobject)
extern "C" __declspec(dllexport) void getName (U32 simobject,char * ret)
extern "C" __declspec(dllexport) void getClassName (char* simobject,char * ret)
extern "C" __declspec(dllexport) void containerRayCast(F64 start_x,F64 start_y,F64 start_z,F64 end_x,F64 end_y,F64 end_z,U32 mask,U32 exempt,bool useClientContainer,char* result)
extern "C" __declspec(dllexport) S32 ContainerRadiusSearch(F32 x,F32 y,F32 z,F32 searchRadius, U32 searchMask, bool useClientContainer,U32 foundobjectIds[100])

/*Console*/

/*Math*/

extern "C" __declspec(dllexport) void Math_MatrixMulVector(F32 x,F32 y,F32 z,F32 ang,F32 ax,F32 ay,F32 az,F32 XX,F32 YY,F32 ZZ,char* retval)
extern "C" __declspec(dllexport) void Math_MatrixCreateFromEuler(F32 x,F32 y,F32 z,char* ret)
extern "C" __declspec(dllexport) void getEulerRotation (char* simobject, F32 x,F32 y, F32 z)

/*Math*/

/*Player*/

extern "C" __declspec(dllexport) bool Player_checkDismountPoint(char* playerobject,F32 oldPos_x,F32 oldPos_y,F32 oldPos_z,F32 pos_x,F32 pos_y,F32 pos_z)
extern "C" __declspec(dllexport) void Player_getState(char* playerobject,char * retbuf)
extern "C" __declspec(dllexport) S32 Player_getNumDeathAnimations(char * playerobject)

/*Player*/

/*GameConnection*/
extern "C" __declspec(dllexport) bool GameConnection_isFirstPerson(char* gameconnection)
extern "C" __declspec(dllexport) bool GameConnection_setFirstPerson(char* gameconnection,bool firstPerson)
extern "C" __declspec(dllexport) void GameConnection_clearCameraObject(char* gameconnection)
extern "C" __declspec(dllexport) U32 GameConnection_getCameraObject(char* gameconnection)
extern "C" __declspec(dllexport) bool GameConnection_setCameraObject(char* gameconnection,char* _camera)
extern "C" __declspec(dllexport) U32 GameConnection_getServerConnection()
extern "C" __declspec(dllexport) bool GameConnection_isDemoRecording(char* gameconnection)
extern "C" __declspec(dllexport) bool GameConnection_isDemoPlaying(char* gameconnection)
extern "C" __declspec(dllexport) bool GameConnection_playDemo(char* gameconnection,char* demoFileName)
extern "C" __declspec(dllexport) void GameConnection_stopRecording(char* gameconnection)
extern "C" __declspec(dllexport) void GameConnection_startRecording(char* gameconnection,char* fileName)
extern "C" __declspec(dllexport) void GameConnection_delete(char* gameconnection, char* reason)
extern "C" __declspec(dllexport) void GameConnection_setMissionCRC(char* gameconnection, S32 CRC)
extern "C" __declspec(dllexport) void GameConnection_setBlackOut(char* gameconnection, bool doFade, S32 timeMS)
extern "C" __declspec(dllexport) F32 GameConnection_getWhiteOut(char* gameconnection)
extern "C" __declspec(dllexport) F32 GameConnection_getDamageFlash(char* gameconnection)
extern "C" __declspec(dllexport) F32 GameConnection_getControlCameraFov(SimObjectId object)
extern "C" __declspec(dllexport) void GameConnection_setControlCameraFov(char* gameconnection, F32 newFOV)
extern "C" __declspec(dllexport) F32  GameConnection_getControlCameraDefaultFov(SimObjectId object)
extern "C" __declspec(dllexport) bool GameConnection_play3D(char* gameconnection, char * sprofile,F32 x,F32 y,F32 z,F32 ax, F32 ay,F32 az,F32 aa)
extern "C" __declspec(dllexport) bool GameConnection_play2D(char* gameconnection, char * sprofile)
extern "C" __declspec(dllexport) bool GameConnection_isControlObjectRotDampedCamera(char* gameconnection)
extern "C" __declspec(dllexport) bool GameConnection_isAIControlled(char* gameconnection)
extern "C" __declspec(dllexport) SimObjectId GameConnection_getControlObject(SimObjectId object)
extern "C" __declspec(dllexport) bool setControlObject(char * gamecon, char * simobject)
extern "C" __declspec(dllexport) void GameConnection_resetGhosting(char* gameconnection)
extern "C" __declspec(dllexport) void GameConnection_activateGhosting(char* gameconnection)
extern "C" __declspec(dllexport) void GameConnection_setJoinPassword(char* gameconnection, char* password)

/*GameConnection*/


/*Net*/

extern "C" __declspec(dllexport) void commandToServer(S32 argc,char ** _argv)
extern "C" __declspec(dllexport) void commandToClient(S32 argc,char ** _argv)

/*Net*/


/*SimObject*/

extern "C" __declspec(dllexport) void SimObject_Call(char* simobject, S32 argc,char ** _argv,char* ret)

/*SimObject*/

#1
02/22/2012 (12:26 pm)
@Vince

Look at console/engineFunctions.h. The TORQUE_API macro already does the extern and exports every console method to the DLL.
#2
02/22/2012 (12:39 pm)
Hey Vince,

thanks for the update. nice to see.

One question for you, may seem odd but i do have a reason for it.

Using this, can i embed the Running Torque Game inside a Windows Form or WPF Form?

Now like i said, i do have a reason for this. That being, because of the eula for torque i have to develop my own Modding Toolkit for those that wish to mod my game, so i am left with building my own program or Mod IDE. If I can embed Torque inside a 'Windows Form' or a Panel Within that form or W/E that would be awesome and would solve a problem with one of the big features of said mod tools.
#3
02/22/2012 (1:14 pm)
@Tom,
I'll take a look again, but the problem is that I can't pass objects, easily, anyway. (you have to map out the bytes etc for each object type)

Now that I think about it, it is a waste of the existing externs, but do the existing externs take C++ objects or string ids?

I understand this mess comming from the c# side, but the C++ side is confusing.

If I could just see the c++ code right before compile w/ the extern markups...
#4
02/22/2012 (1:28 pm)
@Vice - The built in macros export C types... so int, bool, float, const char*. Things like SimObjects are converted to their SimObjectId value as ints.
#5
02/22/2012 (1:35 pm)
Oreeeeallly? so things like Point3F are a string?
#6
02/22/2012 (1:42 pm)
Other question, when it's a function to a class how to I pass the id of the structure I want to call the method on? is it the first param?
#7
02/22/2012 (4:33 pm)
Roland,
What? Are you telling me my end users would not be allowed to "mod" the game to alter the default game play!?
#8
02/22/2012 (6:50 pm)
Frank - the people who buy a game that you sell can mod the game. But you can't distribute the tools that come with Torque as far as I understand it. So, if you wanted to provide an editor for your end users to be able to make their own "levels" and such you'd have to create tools for doing that.

You should probably talk to David Montgomery-Blake for details and clarification on that - my legalese is putrid at best....
#9
02/22/2012 (7:05 pm)
And the blind squirrel has found a nut, THANK YOU TOM!!!!!!!
#10
02/23/2012 (7:46 am)
from the EULA:

1.3. "Game" means software that is intended primarily for non-gambling entertainment purposes only. A Game may include tools and Torque Script specific to that Game that allow users to modify the Game (e.g., add new levels, etc.).

--

this tells me that no, you cannot distribute the in-game editing tools that ship with torque but your free to make and distribute your own.
#11
02/23/2012 (9:46 am)
@Tom,

Hate to burst your bubble but it does not appear to do that. I went and mapped out the cloak extern for shapebase.

[DllImport(dllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
        public static extern void fnShapeBase_setCloaked(IntPtr shapebase, [In] bool cloak);

When I tried it any other way, i.e. instead of passing a shapebase pointer and instead passing a int or uint, it failed. Then when I looked at the code generated after the preprocessor runs in VS I noticed that it had NOT reduced the shapebase paraemeter down to a int or uint.

So, I don't know who wrote the code for exposing the externs, but sadly it appears it doesn't work correctly or as you say.

Cause if it did work correctly, the extern above would not work cause I'm sending in a pointer instead of a native type.

Vince
#12
02/23/2012 (12:51 pm)
Ok,

I can tell you without a doubt that the externs exposed by torque REQUIRE the actualy objects and will not work with ints or whatever ID's of the objects.

So, after digging for quite a while, the only way to use the externs exposed by the engine is to have the the objects used by the externs available to the calling external program.

In the case of cSharp, cSharp has no idea what a TransformF or whatever, thus using a extern that returns such a class will not work. There needs to be a translation layer in the middle to convert it to something usable.

With that said, I think I figured it all out, I'll let ya know.
Vince
#13
02/23/2012 (1:15 pm)
@Vice - That is too bad... it seems like some of that functionality was disabled/ommited when it was brought to T3D.

All i can say is that the new macros are designed to support externs using simple types including struct-like types like Point3F and MatrixF.

It shouldn't be too difficult to fix them with a few small changes within the existing macros.