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

Method ApplyDamage

ogsr_engine/xrGame/CarWheels.cpp:145–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void CCar::SWheel::ApplyDamage(u16 level)
146{
147 inherited::ApplyDamage(level);
148 if (!joint)
149 return;
150 if (level == 0)
151 return;
152 float sf, df;
153 dJointID dj = joint->GetDJoint();
154 switch (level)
155 {
156 case 1:
157 joint->GetJointSDfactors(sf, df);
158 sf /= 20.f;
159 df *= 4.f;
160 joint->SetJointSDfactors(sf, df);
161 car->m_damage_particles.PlayWheel1(car, bone_id);
162 break;
163 case 2:
164
165 dVector3 v;
166
167 dJointGetHinge2Axis2(dj, v);
168 v[0] += 0.1f;
169 v[1] += 0.1f;
170 v[2] += 0.1f;
171 accurate_normalize(v);
172 dJointSetHinge2Axis2(dj, v[0], v[1], v[2]);
173 joint->GetJointSDfactors(sf, df);
174 sf /= 30.f;
175 df *= 8.f;
176 joint->SetJointSDfactors(sf, df);
177 car->m_damage_particles.PlayWheel2(car, bone_id);
178 break;
179 default: NODEFAULT;
180 }
181}
182
183void CCar::SWheel::SaveNetState(NET_Packet& P)
184{

Callers

nothing calls this directly

Calls 8

dJointGetHinge2Axis2Function · 0.85
accurate_normalizeFunction · 0.85
dJointSetHinge2Axis2Function · 0.85
GetDJointMethod · 0.80
GetJointSDfactorsMethod · 0.80
SetJointSDfactorsMethod · 0.80
PlayWheel1Method · 0.80
PlayWheel2Method · 0.80

Tested by

no test coverage detected