Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool can_hit ( void )
- {
- angle_t viewangles = cheat::game::engine::get_viewangles ();
- viewangles = viewangles + (playerLocal.get_punch_angle () * 2.0f);
- for ( int i = 1; i <= global_vars_base.maxClients; i++ )
- {
- if ( !playerEntity[i].get_health () )
- continue;
- if ( playerEntity[i].is_dead () )
- continue;
- if ( playerEntity[i].is_dormant () )
- continue;
- if ( playerEntity[i].get_team () == playerLocal.get_team () )
- continue;
- for ( int j = 0; j < 19; j++ )
- {
- vector_t hitbox = playerEntity[i].get_hitbox ( j );
- if ( hitbox.is_zero () )
- continue;
- float distance = playerLocal.get_eye_position ().dist_to ( hitbox );
- vector_t end;
- angle_vectors ( viewangles, &end );
- end = end * distance + playerLocal.get_eye_position ();
- vector_t boxmin, boxmax;
- playerEntity[i].get_hitbox_bound ( j, boxmin, boxmax );
- if (( min(boxmax.x, boxmin.x) <= end.x )
- && ( min(boxmax.y, boxmin.y) <= end.y )
- && ( min(boxmax.z, boxmin.z) <= end.z )
- && ( max(boxmax.x, boxmin.x) >= end.x )
- && ( max(boxmax.y, boxmin.y) >= end.y )
- && ( max(boxmax.z, boxmin.z) >= end.z ))
- return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement