MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / LoadFireParams

Method LoadFireParams

ogsr_engine/xrGame/ShootingObject.cpp:95–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93void CShootingObject::Light_Destroy() { light_render.destroy(); }
94
95void CShootingObject::LoadFireParams(LPCSTR section, LPCSTR prefix)
96{
97 string256 full_name;
98 string32 buffer;
99 shared_str s_sHitPower;
100 //базовая дисперсия оружия
101 fireDispersionBase = pSettings->r_float(section, "fire_dispersion_base");
102 fireDispersionBase = deg2rad(fireDispersionBase);
103 constDeviation.pitch = READ_IF_EXISTS(pSettings, r_float, section, "const_deviation_pitch", 0);
104 constDeviation.yaw = READ_IF_EXISTS(pSettings, r_float, section, "const_deviation_yaw", 0);
105
106 LPCSTR hit_type = READ_IF_EXISTS(pSettings, r_string, section, "hit_type", "fire_wound");
107 m_eHitType = ALife::g_tfString2HitType(hit_type); // поддержка произвольного хита оружия
108 //сила выстрела и его мощьность
109 s_sHitPower = pSettings->r_string_wb(section, strconcat(sizeof(full_name), full_name, prefix, "hit_power")); //читаем строку силы хита пули оружия
110 fvHitPower[egdMaster] = (float)atof(_GetItem(*s_sHitPower, 0, buffer)); //первый параметр - это хит для уровня игры мастер
111
112 fvHitPower[egdVeteran] = fvHitPower[egdMaster]; //изначально параметры для других уровней
113 fvHitPower[egdStalker] = fvHitPower[egdMaster]; //сложности
114 fvHitPower[egdNovice] = fvHitPower[egdMaster]; //такие же
115
116 int num_game_diff_param = _GetItemCount(*s_sHitPower); //узнаём колличество параметров для хитов
117 if (num_game_diff_param > 1) //если задан второй параметр хита
118 {
119 fvHitPower[egdVeteran] = (float)atof(_GetItem(*s_sHitPower, 1, buffer)); //то вычитываем его для уровня ветерана
120 }
121 if (num_game_diff_param > 2) //если задан третий параметр хита
122 {
123 fvHitPower[egdStalker] = (float)atof(_GetItem(*s_sHitPower, 2, buffer)); //то вычитываем его для уровня сталкера
124 }
125 if (num_game_diff_param > 3) //если задан четвёртый параметр хита
126 {
127 fvHitPower[egdNovice] = (float)atof(_GetItem(*s_sHitPower, 3, buffer)); //то вычитываем его для уровня новичка
128 }
129
130 // fHitPower = pSettings->r_float (section,strconcat(full_name, prefix, "hit_power"));
131 fHitImpulse = pSettings->r_float(section, strconcat(sizeof(full_name), full_name, prefix, "hit_impulse"));
132 //максимальное расстояние полета пули
133 fireDistance = pSettings->r_float(section, strconcat(sizeof(full_name), full_name, prefix, "fire_distance"));
134 //начальная скорость пули
135 m_fStartBulletSpeed = pSettings->r_float(section, strconcat(sizeof(full_name), full_name, prefix, "bullet_speed"));
136 m_bUseAimBullet = pSettings->r_bool(section, strconcat(sizeof(full_name), full_name, prefix, "use_aim_bullet"));
137 if (m_bUseAimBullet)
138 {
139 m_fTimeToAim = pSettings->r_float(section, strconcat(sizeof(full_name), full_name, prefix, "time_to_aim"));
140 }
141}
142
143void CShootingObject::LoadLights(LPCSTR section, LPCSTR prefix)
144{

Callers

nothing calls this directly

Calls 7

deg2radFunction · 0.85
g_tfString2HitTypeFunction · 0.85
_GetItemFunction · 0.85
_GetItemCountFunction · 0.85
r_string_wbMethod · 0.80
r_boolMethod · 0.80
r_floatMethod · 0.45

Tested by

no test coverage detected