mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-14 16:07:39 +00:00
STARK: Implement three more opcodes
This commit is contained in:
parent
6e723d6805
commit
be41491d4e
@ -100,6 +100,8 @@ Command *Command::execute(uint32 callMode, Script *script) {
|
||||
return opRumbleScene(_arguments[1].intValue, _arguments[2].intValue);
|
||||
case kFadeScene:
|
||||
return opFadeScene(_arguments[1].intValue, _arguments[2].intValue, _arguments[3].intValue);
|
||||
case kInventoryOpen:
|
||||
return opInventoryOpen(_arguments[1].intValue);
|
||||
case kItem3DPlaceOn:
|
||||
return opItem3DPlaceOn(_arguments[1].referenceValue, _arguments[2].referenceValue);
|
||||
case kItem3DWalkTo:
|
||||
@ -126,6 +128,8 @@ Command *Command::execute(uint32 callMode, Script *script) {
|
||||
return opKnowledgeSetInteger(_arguments[1].referenceValue, _arguments[2].intValue);
|
||||
case kKnowledgeAddInteger:
|
||||
return opKnowledgeAddInteger(_arguments[1].referenceValue, _arguments[2].intValue);
|
||||
case kKnowledgeSetIntRandom:
|
||||
return opKnowledgeSetIntRandom(_arguments[1].referenceValue, _arguments[2].intValue, _arguments[3].intValue);
|
||||
case kKnowledgeSubValue:
|
||||
return opKnowledgeSubValue(_arguments[1].referenceValue, _arguments[2].referenceValue);
|
||||
case kEnableFloorField:
|
||||
@ -200,6 +204,8 @@ Command *Command::execute(uint32 callMode, Script *script) {
|
||||
return opIsItemActivity(_arguments[2].referenceValue, _arguments[3].intValue);
|
||||
case kIsAnimAtTime:
|
||||
return opIsAnimAtTime(_arguments[2].referenceValue, _arguments[3].intValue);
|
||||
case kIsLocation2D:
|
||||
return opIsLocation2D();
|
||||
default:
|
||||
warning("Unimplemented command %d - %s", _subType, _name.c_str());
|
||||
printData();
|
||||
@ -383,6 +389,12 @@ Math::Vector3d Command::getObjectPosition(const ResourceReference &targetRef, in
|
||||
return position;
|
||||
}
|
||||
|
||||
Command *Command::opInventoryOpen(bool open) {
|
||||
StarkUserInterface->inventoryOpen(open);
|
||||
|
||||
return nextCommand();
|
||||
}
|
||||
|
||||
Command *Command::opItem3DPlaceOn(const ResourceReference &itemRef, const ResourceReference &targetRef) {
|
||||
FloorPositionedItem *item = itemRef.resolve<FloorPositionedItem>();
|
||||
|
||||
@ -579,6 +591,15 @@ Command *Command::opKnowledgeSetInteger(const ResourceReference &knowledgeRef, i
|
||||
return nextCommand();
|
||||
}
|
||||
|
||||
Command *Command::opKnowledgeSetIntRandom(const ResourceReference &knowledgeRef, uint32 min, uint32 max) {
|
||||
Knowledge *knowledge = knowledgeRef.resolve<Knowledge>();
|
||||
|
||||
uint32 value = StarkRandomSource->getRandomNumberRng(min, max);
|
||||
knowledge->setIntegerValue(value);
|
||||
|
||||
return nextCommand();
|
||||
}
|
||||
|
||||
Command *Command::opKnowledgeAddInteger(const ResourceReference &knowledgeRef, int32 increment) {
|
||||
Knowledge *knowledge = knowledgeRef.resolve<Knowledge>();
|
||||
|
||||
@ -986,6 +1007,13 @@ Command *Command::opIsAnimAtTime(const ResourceReference &animRef, int32 time) {
|
||||
return nextCommandIf(condition);
|
||||
}
|
||||
|
||||
Command *Command::opIsLocation2D() {
|
||||
Current *current = StarkGlobal->getCurrent();
|
||||
Location *location = current->getLocation();
|
||||
|
||||
return nextCommandIf(!location->has3DLayer());
|
||||
}
|
||||
|
||||
Command *Command::nextCommand() {
|
||||
assert(!_arguments.empty());
|
||||
assert(_arguments[0].type == Argument::kTypeInteger1);
|
||||
|
@ -77,6 +77,8 @@ public:
|
||||
kRumbleScene = 19,
|
||||
kFadeScene = 20,
|
||||
|
||||
kInventoryOpen = 24,
|
||||
|
||||
kItem3DPlaceOn = 81,
|
||||
kItem3DWalkTo = 82,
|
||||
|
||||
@ -103,6 +105,8 @@ public:
|
||||
kLocationScrollTo = 111,
|
||||
kSoundPlay = 112,
|
||||
|
||||
kKnowledgeSetIntRandom = 115,
|
||||
|
||||
kKnowledgeSubValue = 117,
|
||||
kItemLookDirection = 118,
|
||||
|
||||
@ -147,7 +151,8 @@ public:
|
||||
|
||||
kIsItemNearPlace = 183,
|
||||
|
||||
kIsAnimAtTime = 185
|
||||
kIsAnimAtTime = 185,
|
||||
kIsLocation2D = 186
|
||||
};
|
||||
|
||||
struct Argument {
|
||||
@ -195,6 +200,7 @@ protected:
|
||||
Command *opGoto2DLocation(const Common::String &level, const Common::String &location);
|
||||
Command *opRumbleScene(int32 unknown1, int32 unknown2);
|
||||
Command *opFadeScene(int32 unknown1, int32 unknown2, int32 unknown3);
|
||||
Command *opInventoryOpen(bool open);
|
||||
Command *opItem3DPlaceOn(const ResourceReference &itemRef, const ResourceReference &targetRef);
|
||||
Command *opItem3DWalkTo(Script *script, const ResourceReference &itemRef, const ResourceReference &targetRef, bool suspend);
|
||||
Command *opItemLookAt(Script *script, const ResourceReference &itemRef, const ResourceReference &objRef, bool suspend, int32 unknown);
|
||||
@ -207,6 +213,7 @@ protected:
|
||||
Command *opShowPlay(Script *script, const ResourceReference &ref, int32 suspend);
|
||||
Command *opKnowledgeSetBoolean(const ResourceReference &knowledgeRef, int32 enable);
|
||||
Command *opKnowledgeSetInteger(const ResourceReference &knowledgeRef, int32 value);
|
||||
Command *opKnowledgeSetIntRandom(const ResourceReference &knowledgeRef, uint32 min, uint32 max);
|
||||
Command *opKnowledgeAddInteger(const ResourceReference &knowledgeRef, int32 increment);
|
||||
Command *opKnowledgeSubValue(const ResourceReference &knowledgeRef, const ResourceReference &valueRef);
|
||||
Command *opEnableFloorField(const ResourceReference &floorFieldRef, int32 value);
|
||||
@ -245,6 +252,7 @@ protected:
|
||||
Command *opIsAnimPlaying(const ResourceReference &animRef);
|
||||
Command *opIsItemActivity(const ResourceReference &itemRef, int32 value);
|
||||
Command *opIsAnimAtTime(const ResourceReference &animRef, int32 time);
|
||||
Command *opIsLocation2D();
|
||||
|
||||
Common::Array<Argument> _arguments;
|
||||
};
|
||||
|
@ -123,9 +123,13 @@ void UserInterface::dispatchEvent(WindowHandler handler) {
|
||||
}
|
||||
}
|
||||
|
||||
void UserInterface::notifyShouldOpenInventory() {
|
||||
void UserInterface::inventoryOpen(bool open) {
|
||||
// Make the inventory update its contents.
|
||||
_inventoryWindow->open();
|
||||
if (open) {
|
||||
_inventoryWindow->open();
|
||||
} else {
|
||||
_inventoryWindow->close();
|
||||
}
|
||||
}
|
||||
|
||||
int16 UserInterface::getSelectedInventoryItem() const {
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
void handleRightClick();
|
||||
void handleDoubleClick();
|
||||
void notifyShouldExit() { _exitGame = true; }
|
||||
void notifyShouldOpenInventory();
|
||||
void inventoryOpen(bool open);
|
||||
bool shouldExit() { return _exitGame; }
|
||||
|
||||
/** Start playing a FMV */
|
||||
|
@ -91,7 +91,7 @@ void TopMenu::onClick(const Common::Point &pos) {
|
||||
}
|
||||
|
||||
if (_inventoryButton->containsPoint(pos)) {
|
||||
StarkUserInterface->notifyShouldOpenInventory();
|
||||
StarkUserInterface->inventoryOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user