Skip to content

Commit

Permalink
KOTOR: Implement clearAllActions
Browse files Browse the repository at this point in the history
  • Loading branch information
vkremianskii committed Jul 16, 2018
1 parent 19052c2 commit b48b2bf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/engines/kotor/script/function_tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const Functions::FunctionPointer Functions::kFunctionPointers[] = {
{ 6, "AssignCommand" , &Functions::assignCommand },
{ 7, "DelayCommand" , &Functions::delayCommand },
{ 8, "ExecuteScript" , 0 },
{ 9, "ClearAllActions" , 0 },
{ 9, "ClearAllActions" , &Functions::clearAllActions },
{ 10, "SetFacing" , 0 },
{ 11, "SwitchPlayerCharacter" , 0 },
{ 12, "SetTime" , 0 },
Expand Down
1 change: 1 addition & 0 deletions src/engines/kotor/script/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class Functions {
void actionOpenDoor(Aurora::NWScript::FunctionContext &ctx);
void actionCloseDoor(Aurora::NWScript::FunctionContext &ctx);
void actionMoveToObject(Aurora::NWScript::FunctionContext &ctx);
void clearAllActions(Aurora::NWScript::FunctionContext &ctx);
// '---

// .--- Sound, functions_sound.cpp
Expand Down
8 changes: 8 additions & 0 deletions src/engines/kotor/script/functions_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ void Functions::actionMoveToObject(Aurora::NWScript::FunctionContext &ctx) {
caller->enqueueAction(action);
}

void Functions::clearAllActions(Aurora::NWScript::FunctionContext &ctx) {
Creature *caller = ObjectContainer::toCreature(ctx.getCaller());
if (!caller)
caller = _game->getModule().getPC();

caller->clearActionQueue();
}

} // End of namespace KotOR

} // End of namespace Engines

0 comments on commit b48b2bf

Please sign in to comment.