STARK: Add an opcode to check if the inventory is open

This commit is contained in:
Bastien Bouclet 2015-12-20 19:23:07 +01:00
parent d936bc11fc
commit 6bcdff8b17
4 changed files with 18 additions and 1 deletions

View File

@ -221,6 +221,8 @@ Command *Command::execute(uint32 callMode, Script *script) {
return opIsAnimAtTime(_arguments[2].referenceValue, _arguments[3].intValue);
case kIsLocation2D:
return opIsLocation2D();
case kIsInventoryOpen:
return opIsInventoryOpen();
default:
warning("Unimplemented command %d - %s", _subType, _name.c_str());
printData();
@ -1104,6 +1106,12 @@ Command *Command::opIsLocation2D() {
return nextCommandIf(!location->has3DLayer());
}
Command *Command::opIsInventoryOpen() {
bool invOpen = StarkUserInterface->isInventoryOpen();
return nextCommandIf(invOpen);
}
Command *Command::nextCommand() {
assert(!_arguments.empty());
assert(_arguments[0].type == Argument::kTypeInteger1);

View File

@ -157,7 +157,8 @@ public:
kIsItemNearPlace = 183,
kIsAnimAtTime = 185,
kIsLocation2D = 186
kIsLocation2D = 186,
kIsInventoryOpen = 187
};
struct Argument {
@ -263,6 +264,7 @@ protected:
Command *opIsItemActivity(const ResourceReference &itemRef, int32 value);
Command *opIsAnimAtTime(const ResourceReference &animRef, int32 time);
Command *opIsLocation2D();
Command *opIsInventoryOpen();
Common::Array<Argument> _arguments;
};

View File

@ -164,6 +164,10 @@ bool UserInterface::isInGameScreen() const {
return _currentScreen == kScreenGame;
}
bool UserInterface::isInventoryOpen() const {
return _inventoryWindow->isVisible();
}
void UserInterface::skipFMV() {
if (_currentScreen == kScreenFMV) {
_fmvPlayer->stop();

View File

@ -82,6 +82,9 @@ public:
/** Is the game screen currently displayed? */
bool isInGameScreen() const;
/** Is the inventory panel being displayed? */
bool isInventoryOpen() const;
/** Can the player interact with the game world? */
bool isInteractive() const;