I did not test the functions, but the math should be correct.
Code: Select all
bool fireWorldWepAt(char const * flagType,
float lifetime,
float wepPos[3],
float targetPos[3],
int shotID,
float dt)
{
float x = *targetPos - *wepPos;
float y = *(targetPos + 1) - *(wepPos + 1);
float z = *(targetPos + 2) - *(wepPos + 2);
float theta = std::atan2(y, x);
float phi = std::asin(z/std::sqrt(x*x + y*y + z*z));
return bz_fireWorldWep(flagType, lifetime, wepPos, phi, theta, shotID, dt);
}
Code: Select all
int fireWorldGMAt(int target,
float lifetime,
float wepPos[3],
float targetPos[3],
float dt)
{
float x = *targetPos - *wepPos;
float y = *(targetPos + 1) - *(wepPos + 1);
float z = *(targetPos + 2) - *(wepPos + 2);
float theta = std::atan2(y, x);
float phi = std::asin(z/std::sqrt(x*x + y*y + z*z));
return bz_fireWorldGM(target, lifetime, wepPos, phi, theta, dt);
}