void CPlayerRotation::Process() { //FUNCTION_PROFILER(GetISystem(), PROFILE_GAME); // float forceLookLen2(m_player.m_stats.forceLookVector.len2()); if (forceLookLen2>0.001f && !g_vr->initialized()) // no forced look in VR please { float forceLookLen(cry_sqrtf(forceLookLen2)); Vec3 forceLook(m_player.m_stats.forceLookVector); forceLook *= 1.0f/forceLookLen; forceLook = m_player.m_viewQuatFinal.GetInverted() * forceLook; float smoothSpeed(6.6f * forceLookLen); m_deltaAngles.x += asin(forceLook.z) * min(1.0f,m_frameTime*smoothSpeed); m_deltaAngles.z += cry_atan2f(-forceLook.x,forceLook.y) * min(1.0f,m_frameTime*smoothSpeed); CHECKQNAN_VEC(m_deltaAngles); } ProcessAngularImpulses(); ProcessLean(); if (m_stats.inAir && m_stats.inZeroG) ProcessFlyingZeroG(); else if (m_stats.inFreefall.Value()==1) ProcessFreeFall(); else if (m_stats.inFreefall.Value()==2) ProcessParachute(); else { if(!g_vr->initialized()) { ProcessNormalRoll(); ClampAngles(); } ProcessNormal(); } //CHECKQNAN_MAT33(m_viewMtx); //update freelook when linked to an entity SLinkStats *pLinkStats = &m_player.m_linkStats; if (pLinkStats->linkID) { IEntity *pLinked = pLinkStats->GetLinked(); if (pLinked) { //at this point m_baseQuat and m_viewQuat contain the previous frame rotation, I'm using them to calculate the delta rotation. m_baseQuatLinked *= m_player.m_baseQuat.GetInverted() * m_baseQuat; m_viewQuatLinked *= m_player.m_viewQuat.GetInverted() * m_viewQuat; m_baseQuat = pLinked->GetRotation() * m_baseQuatLinked; m_viewQuat = pLinked->GetRotation() * m_viewQuatLinked; } } // m_viewQuatFinal = m_viewQuat; //TEST: * Quat::CreateRotationXYZ(m_player.m_viewAnglesOffset); }
int32_t WebRtcAec_Process(void* aecInst, const int16_t* nearend, const int16_t* nearendH, int16_t* out, int16_t* outH, int16_t nrOfSamples, int16_t msInSndCardBuf, int32_t skew) { aecpc_t* aecpc = aecInst; int32_t retVal = 0; if (nearend == NULL) { aecpc->lastError = AEC_NULL_POINTER_ERROR; return -1; } if (out == NULL) { aecpc->lastError = AEC_NULL_POINTER_ERROR; return -1; } if (aecpc->initFlag != initCheck) { aecpc->lastError = AEC_UNINITIALIZED_ERROR; return -1; } // number of samples == 160 for SWB input if (nrOfSamples != 80 && nrOfSamples != 160) { aecpc->lastError = AEC_BAD_PARAMETER_ERROR; return -1; } // Check for valid pointers based on sampling rate if (aecpc->sampFreq == 32000 && nearendH == NULL) { aecpc->lastError = AEC_NULL_POINTER_ERROR; return -1; } if (msInSndCardBuf < 0) { msInSndCardBuf = 0; aecpc->lastError = AEC_BAD_PARAMETER_WARNING; retVal = -1; } else if (msInSndCardBuf > kMaxTrustedDelayMs) { // The clamping is now done in ProcessExtended/Normal(). aecpc->lastError = AEC_BAD_PARAMETER_WARNING; retVal = -1; } // This returns the value of aec->extended_filter_enabled. if (WebRtcAec_delay_correction_enabled(aecpc->aec)) { ProcessExtended( aecpc, nearend, nearendH, out, outH, nrOfSamples, msInSndCardBuf, skew); } else { if (ProcessNormal(aecpc, nearend, nearendH, out, outH, nrOfSamples, msInSndCardBuf, skew) != 0) { retVal = -1; } } #ifdef WEBRTC_AEC_DEBUG_DUMP { int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / (sampMsNb * aecpc->rate_factor)); OpenDebugFiles(aecpc, &webrtc_aec_instance_count); if (aecpc->bufFile) { (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); (void)fwrite( &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); } } #endif return retVal; }
void CPlayerRotation::Process(IItem* pCurrentItem, const SActorFrameMovementParams& movement, const SAimAccelerationParams& verticalAcceleration, float frameTime) { FUNCTION_PROFILER(GetISystem(), PROFILE_GAME); // reset to the new impulse. m_angularImpulseDelta = m_angularImpulse; m_deltaAngles = movement.deltaAngles; PR_CHECKQNAN_FLT(m_deltaAngles); // Store the previous rotation to get the correct rotation for linked actors. const Quat previousBaseQuat = m_baseQuat; const Quat previousViewQuat = m_viewQuat; ProcessForcedLookDirection(m_viewQuatFinal, frameTime); ProcessAngularImpulses( frameTime ); ProcessLeanAndPeek( movement ); ProcessNormalRoll( frameTime ); bool shouldProcessTargetAssistance = ShouldProcessTargetAssistance(); if (shouldProcessTargetAssistance) { ProcessTargetAssistance( pCurrentItem ); } #if TALOS if(stricmp(g_pGameCVars->pl_talos->GetString(), m_player.GetEntity()->GetName()) == 0) { IMovementController* pMovementController = m_player.GetMovementController(); CRY_ASSERT(pMovementController); SMovementState moveState; pMovementController->GetMovementState(moveState); Vec3 playerView[4] = { m_viewQuat.GetColumn0(), // Right m_viewQuat.GetColumn1(), // Forward m_viewQuat.GetColumn2(), // Up moveState.eyePosition // Pos }; GetTalosInput(this, m_player, m_deltaAngles.x, m_deltaAngles.z, playerView, frameTime); } #endif float minAngle,maxAngle; GetStanceAngleLimits(verticalAcceleration, pCurrentItem, minAngle, maxAngle); ClampAngles( minAngle, maxAngle ); ProcessNormal( frameTime ); if(shouldProcessTargetAssistance) { IVehicle* pVehicle = m_player.GetLinkedVehicle(); if (pVehicle && GetCurrentItem(true)) { if (m_deltaAngles.x!=0.f) pVehicle->OnAction(eVAI_RotatePitchAimAssist, eAAM_Always, m_deltaAngles.x, m_player.GetEntity()->GetId()); if (m_deltaAngles.z!=0.f) pVehicle->OnAction(eVAI_RotateYawAimAssist, eAAM_Always, m_deltaAngles.z, m_player.GetEntity()->GetId()); } } //update freelook when linked to an entity ProcessLinkedState(m_player.m_linkStats, previousBaseQuat, previousViewQuat); //Recoil/Zoom sway offset for local player ProcessFinalViewEffects( minAngle, maxAngle ); m_frameViewAnglesOffset.Set(0.0f, 0.0f, 0.0f); m_forceLookVector.zero(); m_externalAngles.Set(0.f, 0.f, 0.f); NormalizeQuats(); }
int __cdecl main (int argc, char* argv[]) { g_temporary_stuff = &trivial_encryptor::decode; g_dummy_stuff = &trivial_encryptor::encode; Core._initialize("xrCompress",0,FALSE); printf ("\n\n"); LPCSTR params = GetCommandLine(); #ifndef MOD_COMPRESS if(strstr(params,"-store")) { bStoreFiles = TRUE; }; { LPCSTR temp = strstr(params,"-max_size"); if (temp) { u64 test = u64(1024*1024)*u64(atoi(temp+9)); if (u64(test) >= u64(u32(1) << 31)) printf ("! too large max_size (%I64u), restoring previous (%I64u)\n",test,u64(XRP_MAX_SIZE)); else XRP_MAX_SIZE = u32(test); }; } #else bStoreFiles = TRUE; #endif #ifndef MOD_COMPRESS if(strstr(params,"-diff")) { ProcessDifference (); }else #endif { #ifndef MOD_COMPRESS if (argc<2) { printf("ERROR: u must pass folder name as parameter.\n"); printf("-diff /? option to get information about creating difference.\n"); printf("-fast - fast compression.\n"); printf("-store - store files. No compression.\n"); printf("-ltx <file_name.ltx> - pathes to compress.\n"); printf("\n"); printf("LTX format:\n"); printf(" [config]\n"); printf(" ;<path> = <recurse>\n"); printf(" .\\ = false\n"); printf(" textures = true\n"); Core._destroy(); return 3; } #endif string_path folder; strconcat (sizeof(folder),folder,argv[1],"\\"); _strlwr_s (folder,sizeof(folder)); printf ("\nCompressing files (%s)...\n\n",folder); FS._initialize (CLocatorAPI::flTargetFolderOnly|CLocatorAPI::flScanAppRoot,folder); BOOL bFast = 0!=strstr(params,"-fast"); LPCSTR p = strstr(params,"-ltx"); #ifndef MOD_COMPRESS if(0!=p) { ProcessLTX (argv[1],p+4,bFast); }else{ ProcessNormal (argv[1],bFast); } #else R_ASSERT2 (p, "wrong params passed. -ltx option needed"); ProcessLTX (argv[1],p+4,bFast); #endif } Core._destroy (); return 0; }
int32_t WebRtcAec_Process(void* aecInst, const float* const* nearend, size_t num_bands, float* const* out, size_t nrOfSamples, int16_t msInSndCardBuf, int32_t skew) { Aec* aecpc = aecInst; int32_t retVal = 0; if (out == NULL) { return AEC_NULL_POINTER_ERROR; } if (aecpc->initFlag != initCheck) { return AEC_UNINITIALIZED_ERROR; } // number of samples == 160 for SWB input if (nrOfSamples != 80 && nrOfSamples != 160) { return AEC_BAD_PARAMETER_ERROR; } if (msInSndCardBuf < 0) { msInSndCardBuf = 0; retVal = AEC_BAD_PARAMETER_WARNING; } else if (msInSndCardBuf > kMaxTrustedDelayMs) { // The clamping is now done in ProcessExtended/Normal(). retVal = AEC_BAD_PARAMETER_WARNING; } // This returns the value of aec->extended_filter_enabled. if (WebRtcAec_extended_filter_enabled(aecpc->aec)) { ProcessExtended(aecpc, nearend, num_bands, out, nrOfSamples, msInSndCardBuf, skew); } else { retVal = ProcessNormal(aecpc, nearend, num_bands, out, nrOfSamples, msInSndCardBuf, skew); } #ifdef WEBRTC_AEC_DEBUG_DUMP { int16_t far_buf_size_ms = (int16_t)(WebRtcAec_system_delay(aecpc->aec) / (sampMsNb * aecpc->rate_factor)); OpenDebugFiles(aecpc, &webrtc_aec_instance_count); if (aecpc->bufFile) { (void)fwrite(&far_buf_size_ms, 2, 1, aecpc->bufFile); (void)fwrite( &aecpc->knownDelay, sizeof(aecpc->knownDelay), 1, aecpc->delayFile); } } #endif return retVal; }