Actionscript to C++ Conversion

Miscellaneous Forums/General Discussion/Actionscript to C++ Conversion

Hi,

I'm trying to convert Robert Penner's actionscript easing equations to C++ ( MinGW to be precise, since it's a BMax module I'm writing ) but I'm having trouble.

These are the actionscript lines in the trouble function :

t /= d/2;
if (t < 1) return c/2*t*t + b;
t--;
return -c/2 * (t*(t-2) - 1) + b;


I've converted that to:

extern "C" __cdecl float quad_easeinout(float t,float b , float c, float d) {
	if ((t/=d/2) < 1) return ((c/2)*(t*t)) + b;
	return (-c/2*((--t)*(t-2)-1)+b);
}

It's quite wrong though. I know nothing about actionscript and none of these languages seem to be consistent. Java, C++, ActionScript, they all seem to handle pre-increment and post-increment their own way, let alone order of calculation. It may even be a VC++/MinGW variation for all I know.