From b818c98708541387468d3a18073227f9645a265d Mon Sep 17 00:00:00 2001 From: Kirill Yurkin <47507219+ugozapad@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:32:13 +0300 Subject: [PATCH] Some fixes --- SourceCode/CryAnimation/Controller.cpp | 2 +- SourceCode/CryAnimation/MathUtils.h | 10 +++++++ SourceCode/CrySystem/CMakeLists.txt | 2 +- SourceCode/CrySystem/Log.cpp | 2 ++ SourceCode/CrySystem/System.cpp | 39 +++++++++++++++++++++++++- 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/SourceCode/CryAnimation/Controller.cpp b/SourceCode/CryAnimation/Controller.cpp index 9340a16f..8c4b1a44 100644 --- a/SourceCode/CryAnimation/Controller.cpp +++ b/SourceCode/CryAnimation/Controller.cpp @@ -56,7 +56,7 @@ void IController::PQLog::blendPQ (const PQLog& pqFrom, const PQLog& pqTo, float // builds the matrix out of the position and orientation stored in this PQLog void IController::PQLog::buildMatrix(Matrix44& matDest)const { - CryQuat qRot; + CryQuat qRot(1.f, 0.f, 0.f, 0.f); quaternionExponentOptimized(vRotLog, qRot); //BuildMatrixFromQP(matDest, qRot, vPos); matDest=Matrix44(qRot); diff --git a/SourceCode/CryAnimation/MathUtils.h b/SourceCode/CryAnimation/MathUtils.h index 2836ff7e..ca065d49 100644 --- a/SourceCode/CryAnimation/MathUtils.h +++ b/SourceCode/CryAnimation/MathUtils.h @@ -129,6 +129,7 @@ inline bool isEqual (const CryQuat& q, const CryQuat& p) return true; } +#if 0 __inline void quaternionExponentOptimized(const Vec3& rSrcVector, CryQuat& rDstQuat) { #if DO_ASM && defined (_CPU_X86) @@ -147,6 +148,15 @@ __inline void quaternionExponentOptimized(const Vec3& rSrcVector, CryQuat& rDstQ rDstQuat = exp(tmp); #endif } +#else +__inline void quaternionExponentOptimized(const Vec3& rSrcVector, CryQuat& rDstQuat) +{ + CryQuat tmp; + tmp.v = rSrcVector; + tmp.w = 0; + rDstQuat = exp(tmp); +} +#endif diff --git a/SourceCode/CrySystem/CMakeLists.txt b/SourceCode/CrySystem/CMakeLists.txt index 4a421bf3..c3ededd8 100644 --- a/SourceCode/CrySystem/CMakeLists.txt +++ b/SourceCode/CrySystem/CMakeLists.txt @@ -96,5 +96,5 @@ target_include_directories(${PROJECT_NAME} PRIVATE ) target_link_libraries(${PROJECT_NAME} PRIVATE - ${SYSTEM_DEPS} + ${SYSTEM_DEPS} SDL2 ) diff --git a/SourceCode/CrySystem/Log.cpp b/SourceCode/CrySystem/Log.cpp index 307815f4..3ca50504 100644 --- a/SourceCode/CrySystem/Log.cpp +++ b/SourceCode/CrySystem/Log.cpp @@ -418,6 +418,8 @@ void CLog::LogStringToFile( const char *szString,bool bAdd ) } #endif + OutputDebugStringA(szTemp); + if (bAdd) { FILE *fp=fxopen(m_szFilename,"r+t"); diff --git a/SourceCode/CrySystem/System.cpp b/SourceCode/CrySystem/System.cpp index 456a4322..2a924f16 100644 --- a/SourceCode/CrySystem/System.cpp +++ b/SourceCode/CrySystem/System.cpp @@ -17,6 +17,8 @@ //#include "ini_vars.h" #include "CryLibrary.h" +#include + #ifndef _XBOX #ifdef WIN32 #define WIN32_LEAN_AND_MEAN @@ -761,6 +763,8 @@ void CSystem::UpdateScriptSink() m_pScriptSink->Update(false); // LUA Garbage collection might be called in here } +bool g_bWindowInFocus = false; + // nPauseMode: 0=normal(no pause) // nPauseMode: 1=menu/pause // nPauseMode: 2=cutscene @@ -849,6 +853,7 @@ bool CSystem::Update( int updateFlags, int nPauseMode ) { FRAME_PROFILER( "SysUpdate:PeekMessage",this,PROFILE_SYSTEM ); +#if 0 if (m_hWnd && ::IsWindow((HWND)m_hWnd)) { MSG msg; @@ -858,6 +863,36 @@ bool CSystem::Update( int updateFlags, int nPauseMode ) DispatchMessage(&msg); } } +#else + SDL_Event event; + while (SDL_PollEvent(&event)) + { + switch (event.type) + { + case SDL_QUIT: Quit(); break; + case SDL_WINDOWEVENT: + { + switch (event.window.type) + { + case SDL_WINDOWEVENT_SHOWN: + case SDL_WINDOWEVENT_RESTORED: + case SDL_WINDOWEVENT_MAXIMIZED: + case SDL_WINDOWEVENT_ENTER: + case SDL_WINDOWEVENT_FOCUS_GAINED: + g_bWindowInFocus = true; + break; + + case SDL_WINDOWEVENT_HIDDEN: + case SDL_WINDOWEVENT_MINIMIZED: + case SDL_WINDOWEVENT_LEAVE: + case SDL_WINDOWEVENT_FOCUS_LOST: + g_bWindowInFocus = false; + break; + } + }break; + } + } +#endif } #endif #endif @@ -888,7 +923,9 @@ bool CSystem::Update( int updateFlags, int nPauseMode ) #if defined(_XBOX) || defined(LINUX) m_pIInput->Update(true); #else - bool bFocus = (GetFocus()==m_hWnd) || m_bEditor; + // bool bFocus = (GetFocus()==m_hWnd) || m_bEditor; + //bool bFocus = g_bWindowInFocus; + bool bFocus = true; m_pIInput->Update(bFocus); #endif }