Changes the camera view to look at the killer.
(SubgameEntity self, edict_t inflictor,
edict_t attacker, SubgameEntity world)
| 1312 | * Changes the camera view to look at the killer. |
| 1313 | */ |
| 1314 | public static void LookAtKiller(SubgameEntity self, edict_t inflictor, |
| 1315 | edict_t attacker, SubgameEntity world) { |
| 1316 | float dir[] = { 0, 0, 0 }; |
| 1317 | |
| 1318 | gclient_t client = self.getClient(); |
| 1319 | if (attacker != null && attacker != world && attacker != self) { |
| 1320 | Math3D.VectorSubtract(attacker.s.origin, self.s.origin, dir); |
| 1321 | } else if (inflictor != null && inflictor != world && inflictor != self) { |
| 1322 | Math3D.VectorSubtract(inflictor.s.origin, self.s.origin, dir); |
| 1323 | } else { |
| 1324 | client.killer_yaw = self.s.angles[Defines.YAW]; |
| 1325 | return; |
| 1326 | } |
| 1327 | |
| 1328 | if (dir[0] != 0) |
| 1329 | client.killer_yaw = (float) (180 / Math.PI * Math.atan2( |
| 1330 | dir[1], dir[0])); |
| 1331 | else { |
| 1332 | client.killer_yaw = 0; |
| 1333 | if (dir[1] > 0) |
| 1334 | client.killer_yaw = 90; |
| 1335 | else if (dir[1] < 0) |
| 1336 | client.killer_yaw = -90; |
| 1337 | } |
| 1338 | if (client.killer_yaw < 0) |
| 1339 | client.killer_yaw += 360; |
| 1340 | |
| 1341 | } |
| 1342 | |
| 1343 | |
| 1344 | /** |
no test coverage detected