SHARE
TWEET

Untitled

a guest Jun 27th, 2015 391 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****************************************
  2. //Actor.cpp:
  3. //****************************************
  4. void CActor::OnDifficultyChanged()
  5. {
  6.     // immunities
  7.     VERIFY(g_SingleGameDifficulty >= egdNovice && g_SingleGameDifficulty <= egdMaster);
  8.     LPCSTR diff_name = get_token_name(difficulty_type_token, g_SingleGameDifficulty);
  9.     string128                                           tmp;
  10.     strconcat(sizeof(tmp), tmp, "actor_immunities_", diff_name);
  11.     conditions().LoadImmunities(tmp, pSettings);
  12.     // hit probability
  13.     strconcat(sizeof(tmp), tmp, "hit_probability_", diff_name);
  14.     m_hit_probability = pSettings->r_float(*cNameSect(), tmp);
  15.     // two hits death parameters
  16.     strconcat(sizeof(tmp), tmp, "actor_thd_", diff_name);
  17.     conditions().LoadTwoHitsDeathParams(tmp);
  18. }
  19.  
  20. //****************************************
  21. //Weapon.cpp inside CWeapon:Load():
  22. //****************************************
  23.  
  24.     string256                                           temp;
  25.     for (int i = egdNovice; i < egdCount; ++i)
  26.     {
  27.         strconcat(sizeof(temp), temp, "hit_probability_", get_token_name(difficulty_type_token, i));
  28.         m_hit_probability[i] = READ_IF_EXISTS(pSettings, r_float, section, temp, 1.f);
  29.     }
  30.  
  31. //****************************************
  32. //Weapon.cpp:
  33. //****************************************
  34. const float &CWeapon::hit_probability() const
  35. {
  36.     VERIFY((g_SingleGameDifficulty >= egdNovice) && (g_SingleGameDifficulty <= egdMaster));
  37.     return                                      (m_hit_probability[egdNovice]);
  38. }
  39.  
  40. //****************************************
  41. //Level_bullet_manager_firetrace.cpp:
  42. //****************************************
  43.                                                         float                                   game_difficulty_hit_probability = actor->HitProbability();
  44.                                                         CAI_Stalker                             *stalker = smart_cast<CAI_Stalker*>(initiator);
  45.                                                         if (stalker)
  46.                                                                 hpf                                     = stalker->SpecificCharacter().hit_probability_factor();
  47.  
  48.                                                         float                                   dist_factor = 1.f;
  49.                                                         CObject                                 *weapon_object = Level().Objects.net_Find       (bullet->weapon_id);
  50.                                                         if (weapon_object) {
  51.                                                                 CWeapon                         *weapon = smart_cast<CWeapon*>(weapon_object);
  52.                                                                 if (weapon) {
  53.                                                                         game_difficulty_hit_probability = weapon->hit_probability();
  54.                                                                         float fly_dist  = bullet->fly_dist+dist;
  55.                                                                         dist_factor             = _min(1.f,fly_dist/Level().BulletManager().m_fHPMaxDist);
  56.                                                                 }
  57.                                                         }
  58.  
  59.                                                         ahp                                             = dist_factor*game_difficulty_hit_probability + (1.f-dist_factor)*1.f;
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. OK, I Understand
 
Top