- //****************************************
- //Actor.cpp:
- //****************************************
- void CActor::OnDifficultyChanged()
- {
- // immunities
- VERIFY(g_SingleGameDifficulty >= egdNovice && g_SingleGameDifficulty <= egdMaster);
- LPCSTR diff_name = get_token_name(difficulty_type_token, g_SingleGameDifficulty);
- string128 tmp;
- strconcat(sizeof(tmp), tmp, "actor_immunities_", diff_name);
- conditions().LoadImmunities(tmp, pSettings);
- // hit probability
- strconcat(sizeof(tmp), tmp, "hit_probability_", diff_name);
- m_hit_probability = pSettings->r_float(*cNameSect(), tmp);
- // two hits death parameters
- strconcat(sizeof(tmp), tmp, "actor_thd_", diff_name);
- conditions().LoadTwoHitsDeathParams(tmp);
- }
- //****************************************
- //Weapon.cpp inside CWeapon:Load():
- //****************************************
- string256 temp;
- for (int i = egdNovice; i < egdCount; ++i)
- {
- strconcat(sizeof(temp), temp, "hit_probability_", get_token_name(difficulty_type_token, i));
- m_hit_probability[i] = READ_IF_EXISTS(pSettings, r_float, section, temp, 1.f);
- }
- //****************************************
- //Weapon.cpp:
- //****************************************
- const float &CWeapon::hit_probability() const
- {
- VERIFY((g_SingleGameDifficulty >= egdNovice) && (g_SingleGameDifficulty <= egdMaster));
- return (m_hit_probability[egdNovice]);
- }
- //****************************************
- //Level_bullet_manager_firetrace.cpp:
- //****************************************
- float game_difficulty_hit_probability = actor->HitProbability();
- CAI_Stalker *stalker = smart_cast<CAI_Stalker*>(initiator);
- if (stalker)
- hpf = stalker->SpecificCharacter().hit_probability_factor();
- float dist_factor = 1.f;
- CObject *weapon_object = Level().Objects.net_Find (bullet->weapon_id);
- if (weapon_object) {
- CWeapon *weapon = smart_cast<CWeapon*>(weapon_object);
- if (weapon) {
- game_difficulty_hit_probability = weapon->hit_probability();
- float fly_dist = bullet->fly_dist+dist;
- dist_factor = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
- }
- }
- ahp = dist_factor*game_difficulty_hit_probability + (1.f-dist_factor)*1.f;
SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.