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

Method g_cl_CheckControls

ogsr_engine/xrGame/Actor_Movement.cpp:173–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171static bool crouch_stop = false;
172
173void CActor::g_cl_CheckControls(u32 mstate_wf, Fvector& vControlAccel, float& Jump, float dt)
174{
175 float cam_eff_factor = 0.0f;
176 mstate_old = mstate_real;
177 vControlAccel.set(0, 0, 0);
178
179 if (!(mstate_real & mcFall) && (character_physics_support()->movement()->Environment() == CPHMovementControl::peInAir))
180 {
181 m_fFallTime -= dt;
182 if (m_fFallTime <= 0.f)
183 {
184 m_fFallTime = s_fFallTime;
185 mstate_real |= mcFall;
186 mstate_real &= ~mcJump;
187 }
188 }
189
190 if (!CanMove())
191 {
192 if (mstate_wf & mcAnyMove)
193 {
194 StopAnyMove();
195 mstate_wf &= ~mcAnyMove;
196 mstate_wf &= ~mcJump;
197 }
198 // character_physics_support()->movement()->EnableCharacter();
199 // return;
200 }
201
202 // update player accel
203 if (mstate_wf & mcFwd)
204 vControlAccel.z += 1;
205 if (mstate_wf & mcBack)
206 vControlAccel.z += -1;
207 if (mstate_wf & mcLStrafe)
208 vControlAccel.x += -1;
209 if (mstate_wf & mcRStrafe)
210 vControlAccel.x += 1;
211
212 if (character_physics_support()->movement()->Environment() == CPHMovementControl::peOnGround ||
213 character_physics_support()->movement()->Environment() == CPHMovementControl::peAtWall)
214 {
215 // crouch
216 if ((mstate_real & mcCrouch) == 0 && (mstate_wf & mcCrouch))
217 {
218 if (mstate_real & mcClimb)
219 {
220 mstate_wf &= ~mcCrouch;
221 }
222 else
223 {
224 character_physics_support()->movement()->EnableCharacter();
225 bool Crouched = false;
226 if (isActorAccelerated(mstate_wf, IsZoomAimingMode()))
227 Crouched = character_physics_support()->movement()->ActivateBoxDynamic((mstate_wf & mcAnyMove) ? 3 : 1);
228 else
229 Crouched = character_physics_support()->movement()->ActivateBoxDynamic((mstate_wf & mcAnyMove) ? 4 : 2);
230 if (Crouched)

Callers

nothing calls this directly

Calls 15

isActorAcceleratedFunction · 0.85
GodModeFunction · 0.85
xr_strconcatFunction · 0.85
EnvironmentMethod · 0.80
movementMethod · 0.80
EnableCharacterMethod · 0.80
ActivateBoxDynamicMethod · 0.80
TotalWeightMethod · 0.80
lua_game_objectMethod · 0.80
ConditionJumpMethod · 0.80
CurrentControlEntityMethod · 0.80

Tested by

no test coverage detected