Skip to content

Commit

Permalink
KOTORBASE: Fix stuck animations when switching party leader
Browse files Browse the repository at this point in the history
  • Loading branch information
vkremianskii committed Jun 22, 2019
1 parent 6af0a51 commit 5d5b7ec
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/engines/kotorbase/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ void Module::handleDelayedInteractions() {

void Module::openContainer(Placeable *placeable) {
_cameraController.stopMovement();
_partyLeaderController.clearUserInput();
_partyLeaderController.stopMovement();

_ingame->hideSelection();
Expand Down Expand Up @@ -1043,6 +1044,7 @@ void Module::startConversation(const Common::UString &name, Aurora::NWScript::Ob

if (_dialog->isConversationActive()) {
_cameraController.stopMovement();
_partyLeaderController.clearUserInput();
_partyLeaderController.stopMovement();

_ingame->hide();
Expand Down Expand Up @@ -1116,6 +1118,7 @@ void Module::addItemToActiveObject(const Common::UString &item, int count) {
}

void Module::notifyPartyLeaderChanged() {
_partyLeaderController.stopMovement();
_cameraController.updateTarget();
updateMinimap();
updateCurrentPartyGUI();
Expand Down
2 changes: 1 addition & 1 deletion src/engines/kotorbase/partycontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ void PartyController::setPartyLeaderByIndex(int index) {
std::pair<int, Creature *> nextLeader = _party[0];

prevLeader.second->setUsable(true);
prevLeader.second->playDefaultAnimation();

nextLeader.second->setUsable(false);
nextLeader.second->clearAllActions();
nextLeader.second->playDefaultAnimation();

_module->notifyPartyLeaderChanged();
}
Expand Down
5 changes: 4 additions & 1 deletion src/engines/kotorbase/partyleader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@ PartyLeaderController::PartyLeaderController(Module *module) :
_moving(false) {
}

void PartyLeaderController::stopMovement() {
void PartyLeaderController::clearUserInput() {
_forwardMovementWanted = false;
_backwardMovementWanted = false;
}

void PartyLeaderController::stopMovement() {
_module->getPartyLeader()->playDefaultAnimation();
_moving = false;
}
Expand Down
1 change: 1 addition & 0 deletions src/engines/kotorbase/partyleader.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PartyLeaderController {
public:
PartyLeaderController(Module *module);

void clearUserInput();
void stopMovement();
bool handleEvent(const Events::Event &e);
bool processMovement(float frameTime);
Expand Down

0 comments on commit 5d5b7ec

Please sign in to comment.