bot: switch look/body angles updates to thread worker
build: msvc projects now again targets msvc by default
This commit is contained in:
parent
52bfac2b09
commit
5ce2032acd
8 changed files with 59 additions and 35 deletions
|
|
@ -337,7 +337,18 @@ void Bot::updateBodyAngles () {
|
|||
}
|
||||
|
||||
void Bot::updateLookAngles () {
|
||||
const float delta = cr::clamp (game.time () - m_lookUpdateTime, cr::kFloatEqualEpsilon, 1.0f / 30.0f);
|
||||
worker.enqueue ([this] () {
|
||||
syncUpdateLookAngles ();
|
||||
});
|
||||
}
|
||||
|
||||
void Bot::syncUpdateLookAngles () {
|
||||
if (!m_lookAnglesLock.tryLock ()) {
|
||||
return; // allow only single instance of syncUpdateLookAngles per-bot
|
||||
}
|
||||
ScopedUnlock <Mutex> unlock (m_lookAnglesLock);
|
||||
|
||||
const float delta = cr::clamp (game.time () - m_lookUpdateTime, cr::kFloatEqualEpsilon, kViewFrameUpdate);
|
||||
m_lookUpdateTime = game.time ();
|
||||
|
||||
// adjust all body and view angles to face an absolute vector
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue