Advertisement

Don't think I'm handling objects properly...

Started by February 06, 2014 01:51 AM
13 comments, last by WitchLord 10 years, 8 months ago

Hmm. Wrappers might work.

I've done some further testing on different platforms, and I think it would be fairly safe for you to use the trick presented above until I can implement true support for array types.

That way you wouldn't have to implement wrappers, and it would be less work to remove the work around once AngelScript has the support.

I think I should be able to get this working in version 2.29.0, maybe even earlier.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

When you say I wouldn't have to implement wrappers, are you referring to changing the type of vec3_t to a struct? (not really feasible, it's used literally everywhere) I can probably handle it being passed by reference and treated as a struct as far as AS is concerned.

No, I meant to trick AngelScript into thinking the function is taking the value by reference even though in the C++ side your function is taking it by value. You will not have to change anything in your C++ code, except for where you bind the function with AngelScript.

// C++ function
void CalcMuzzlePoint( gentity_t *, vec3_t, vec3_t, vec3_t, vec3_t, float );
 
// Register it as
engine->RegisterGlobalFunction("void CalcMuzzlePoint( gentity_t@ ent, const vec3_t &in wpFwd, const vec3_t &in right, const vec3_t &in wpUp, const vec3_t &in muzzlePoint, float lead_in )", asFUNCTION(CalcMuzzlePoint), asCALL_CDECL);

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've implemented support for the flag asOBJ_APP_ARRAY in revision 1879, so that AngelScript can understand how to properly pass the vec3_t type by value to functions.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement