-
Автор темы
- #1
Код:
float evo::weapon_data_t::get_inaccuracy( bool secondary ) {
firing_data crouch, stand, jump, land, ladder, fire, move;
float main_inaccuracy;
auto pawn = _ent_cache->local.player_pawn;
// read duck amm.
float duck_am;
// get move services.
uintptr_t movement_services;
_driver.read( pawn.address + other_data::movement_services, movement_services );
// get duck am
_driver.read( movement_services + other_data::duck_am, duck_am );
// is player on ground
const bool on_ground = ( pawn.flags & ( 1 << 0 ) );
// get movetype.
move_type_t move_type;
_driver.read( pawn.address + other_data::move_type, move_type );
//read landing.
bool landing;
_driver.read( pawn.address + other_data::landing, landing );
// get clipping weapon.
game_data clipping_weapon = 0;
if ( !_driver.read<game_data>( pawn.address + offsets::weapon_data.clipping_weapon, clipping_weapon ) ) {
// we can't get clipping
return 0.f;
}
// read fire sequence
float fire_sequence;
_driver.read( clipping_weapon + other_data::fire_sequence, fire_sequence );
// read everything
// check if we are on ground
if (on_ground) {
if ( pawn.vec_velocity.length_2d() <= 0.1f ) {
// read.
_driver.read( reinterpret_( this ) + weapon_data::inac_stand, stand );
// store data.
main_inaccuracy = stand.data[ secondary ? 10 ];
} else if ( pawn.vec_velocity.length_2d() > 0.1f ) {
// read.
_driver.read( reinterpret_( this ) + weapon_data::inac_move, move );
// store data.
main_inaccuracy = move.data[ secondary ? 10 ];
}
} else { // we're for sure in air
// read.
_driver.read( reinterpret_( this ) + weapon_data::inac_jump, jump );
// store data.
main_inaccuracy = jump.data[ secondary ? 10 ];
}
// player is ducking, override other statements.
// we can duck when we are in the air and when we are standing.
if ( duck_am > 0.f ) {
// read.
_driver.read( reinterpret_( this ) + weapon_data::inac_duck, crouch );
// store data.
main_inaccuracy = crouch.data[ secondary ? 10 ];
}
// pawn is on ladder, force this
else if ( move_type == move_type_t::move_type_ladder ) {
// read.
_driver.read( reinterpret_( this ) + weapon_data::inac_ladder, ladder );
// store data.
main_inaccuracy = ladder.data[ secondary ? 10 ];
}
// player is landing, for this
else if ( landing ) {
// read.
_driver.read( reinterpret_( this ) + weapon_data::inac_landing, land );
// store data.
main_inaccuracy = land.data[ secondary ? 10 ];
}
// player is firing
// store old fire data
static float old_fire_sequence = fire_sequence;
// check if old fire sequence differs from fire_sequence
// if it does the player is shot
if ( old_fire_sequence != fire_sequence ) {
// read fire data.
_driver.read( reinterpret_( this ) + weapon_data::inac_fire, fire );
// write data.
main_inaccuracy = fire.data[ secondary ? 10 ];
old_fire_sequence = fire_sequence;
}
return main_inaccuracy;
}