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

Method Init

ogsr_engine/xrGame/Car.cpp:866–984  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

864}
865
866void CCar::Init()
867{
868 CPHCollisionDamageReceiver::Init();
869
870 // get reference wheel radius
871 IKinematics* pKinematics = smart_cast<IKinematics*>(Visual());
872 CInifile* ini = pKinematics->LL_UserData();
873 R_ASSERT2(ini, "Car has no description !!! See ActorEditor Object - UserData");
874 /// SWheel& ref_wheel=m_wheels_map.find(pKinematics->LL_BoneID(ini->r_string("car_definition","reference_wheel")))->second;
875
876 if (ini->section_exist("air_resistance"))
877 {
878 PPhysicsShell()->SetAirResistance(default_k_l * ini->r_float("air_resistance", "linear_factor"), default_k_w * ini->r_float("air_resistance", "angular_factor"));
879 }
880 if (ini->line_exist("car_definition", "steer"))
881 {
882 m_bone_steer = pKinematics->LL_BoneID(ini->r_string("car_definition", "steer"));
883 VERIFY2(fsimilar(DET(pKinematics->LL_GetTransform(m_bone_steer)), 1.f, EPS_L), "BBADD MTX");
884 pKinematics->LL_GetBoneInstance(m_bone_steer).set_callback(bctCustom, cb_Steer, this);
885 }
886 m_steer_angle = 0.f;
887 // ref_wheel.Init();
888 m_ref_radius = ini->r_float("car_definition", "reference_radius"); // ref_wheel.radius;
889 b_exploded = false;
890 b_engine_on = false;
891 b_clutch = false;
892 b_starting = false;
893 b_stalling = false;
894 b_transmission_switching = false;
895 m_root_transform.set(bone_map.find(pKinematics->LL_GetBoneRoot())->second.element->mXFORM);
896 m_current_transmission_num = 0;
897 m_pPhysicsShell->set_DynamicScales(1.f, 1.f);
898 CDamagableItem::Init(GetfHealth(), 3);
899 float l_time_to_explosion = READ_IF_EXISTS(ini, r_float, "car_definition", "time_to_explosion", 120.f);
900 CDelayedActionFuse::Initialize(l_time_to_explosion, CDamagableItem::DamageLevelToHealth(2));
901 {
902 xr_map<u16, SWheel>::iterator i, e;
903 i = m_wheels_map.begin();
904 e = m_wheels_map.end();
905 for (; i != e; ++i)
906 {
907 i->second.Init();
908 i->second.CDamagableHealthItem::Init(100.f, 2);
909 }
910 }
911
912 {
913 xr_vector<SWheelDrive>::iterator i, e;
914 i = m_driving_wheels.begin();
915 e = m_driving_wheels.end();
916 for (; i != e; ++i)
917 i->Init();
918 }
919
920 {
921 xr_vector<SWheelBreak>::iterator i, e;
922 i = m_breaking_wheels.begin();
923 e = m_breaking_wheels.end();

Callers 15

InitZoomParamsMethod · 0.45
OnZoomInMethod · 0.45
OnScreenRatioChangedMethod · 0.45
ParseFileMethod · 0.45
InitMMShniagaMethod · 0.45
InitializeClientGameMethod · 0.45
create_force_progressFunction · 0.45
createGameUIMethod · 0.45
ParseDefinitionsMethod · 0.45
DbgCreatePlotsMethod · 0.45
CPHObjectMethod · 0.45

Calls 15

VisualFunction · 0.85
fsimilarFunction · 0.85
GetfHealthFunction · 0.85
reloadFunction · 0.85
LL_UserDataMethod · 0.80
section_existMethod · 0.80
line_existMethod · 0.80
LL_BoneIDMethod · 0.80
set_callbackMethod · 0.80
LL_GetBoneRootMethod · 0.80
DETFunction · 0.70
SetAirResistanceMethod · 0.45

Tested by

no test coverage detected