Gets the position of a given ball in world coords
| 3392 | |
| 3393 | // Gets the position of a given ball in world coords |
| 3394 | void PlayerGetBallPosition(vector *dest, int slot, int num) { |
| 3395 | matrix rotmat, tempm; |
| 3396 | object *obj = &Objects[Players[slot].objnum]; |
| 3397 | |
| 3398 | // Get position in circle |
| 3399 | float ballspeed = Players[slot].ballspeed * 65536; |
| 3400 | float rot_temp = ballspeed / 65536.0; |
| 3401 | int int_game = Gametime / rot_temp; |
| 3402 | float diff = Gametime - (int_game * rot_temp); |
| 3403 | int rot_angle = (diff * 65536); |
| 3404 | rot_angle = (rot_angle + (num * 5000)) % 65536; |
| 3405 | |
| 3406 | // Get matrix to multiply with |
| 3407 | if (num == 0) |
| 3408 | vm_AnglesToMatrix(&rotmat, 0, 0, rot_angle); |
| 3409 | else if (num == 1) |
| 3410 | vm_AnglesToMatrix(&rotmat, 0, rot_angle, 0); |
| 3411 | else |
| 3412 | vm_AnglesToMatrix(&rotmat, rot_angle, 0, 0); |
| 3413 | |
| 3414 | tempm = obj->orient * rotmat; |
| 3415 | |
| 3416 | // Get world position |
| 3417 | if (num == 1) |
| 3418 | *dest = obj->pos + (tempm.fvec * (obj->size + 1)); |
| 3419 | else |
| 3420 | *dest = obj->pos + (tempm.uvec * (obj->size + 1)); |
| 3421 | } |
| 3422 | |
| 3423 | // Sets a wacky rotating ball around the player ship |
| 3424 | void PlayerSetRotatingBall(int slot, int num, float speed, float *r, float *g, float *b) { |
no test coverage detected