mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 15:45:35 +00:00
Merge branch 'juststrummingmylute' into 'master'
Attempt to select an AI action directly instead of waiting for the next frame Closes #7973 See merge request OpenMW/openmw!4244
This commit is contained in:
commit
ecb64eab8e
1 changed files with 28 additions and 18 deletions
|
@ -455,27 +455,37 @@ namespace MWMechanics
|
|||
void AiWander::doPerFrameActionsForState(const MWWorld::Ptr& actor, float duration,
|
||||
MWWorld::MovementDirectionFlags supportedMovementDirections, AiWanderStorage& storage)
|
||||
{
|
||||
switch (storage.mState)
|
||||
// Attempt to fast forward to the next state instead of remaining in an intermediate state for a frame
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
case AiWanderStorage::Wander_IdleNow:
|
||||
onIdleStatePerFrameActions(actor, duration, storage);
|
||||
break;
|
||||
switch (storage.mState)
|
||||
{
|
||||
case AiWanderStorage::Wander_IdleNow:
|
||||
{
|
||||
onIdleStatePerFrameActions(actor, duration, storage);
|
||||
if (storage.mState != AiWanderStorage::Wander_ChooseAction)
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
case AiWanderStorage::Wander_Walking:
|
||||
onWalkingStatePerFrameActions(actor, duration, supportedMovementDirections, storage);
|
||||
return;
|
||||
|
||||
case AiWanderStorage::Wander_Walking:
|
||||
onWalkingStatePerFrameActions(actor, duration, supportedMovementDirections, storage);
|
||||
break;
|
||||
case AiWanderStorage::Wander_ChooseAction:
|
||||
{
|
||||
onChooseActionStatePerFrameActions(actor, storage);
|
||||
if (storage.mState != AiWanderStorage::Wander_IdleNow)
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
case AiWanderStorage::Wander_MoveNow:
|
||||
return; // nothing to do
|
||||
|
||||
case AiWanderStorage::Wander_ChooseAction:
|
||||
onChooseActionStatePerFrameActions(actor, storage);
|
||||
break;
|
||||
|
||||
case AiWanderStorage::Wander_MoveNow:
|
||||
break; // nothing to do
|
||||
|
||||
default:
|
||||
// should never get here
|
||||
assert(false);
|
||||
break;
|
||||
default:
|
||||
// should never get here
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue