mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-10 12:55:24 +00:00
STARK: Add an opcode to know if an anim script has been reached
This commit is contained in:
parent
7cb2e72f41
commit
022e28bec7
@ -158,6 +158,11 @@ uint32 AnimScript::getDurationStartingWithItem(AnimScriptItem *startItem) {
|
||||
return duration;
|
||||
}
|
||||
|
||||
bool AnimScript::hasReached(AnimScriptItem *item) {
|
||||
int32 index = findItemIndex(item);
|
||||
return _nextItemIndex >= index;
|
||||
}
|
||||
|
||||
int32 AnimScript::findItemIndex(AnimScriptItem *item) {
|
||||
if (!item) {
|
||||
return 0;
|
||||
|
@ -69,6 +69,9 @@ public:
|
||||
*/
|
||||
uint32 getDurationStartingWithItem(AnimScriptItem *startItem);
|
||||
|
||||
/** Is the current script item later in the script when compared to the specified one? */
|
||||
bool hasReached(AnimScriptItem *item);
|
||||
|
||||
protected:
|
||||
void goToNextItem();
|
||||
int32 findItemIndex(AnimScriptItem *item);
|
||||
|
@ -203,6 +203,8 @@ Command *Command::execute(uint32 callMode, Script *script) {
|
||||
return opIsScriptActive(_arguments[2].referenceValue);
|
||||
case kIsRandom:
|
||||
return opIsRandom(_arguments[2].intValue);
|
||||
case kIsAnimScriptItemReached:
|
||||
return opIsAnimScriptItemReached(_arguments[2].referenceValue);
|
||||
case kIsItemOnPlace:
|
||||
return opIsItemOnPlace(_arguments[2].referenceValue, _arguments[3].referenceValue);
|
||||
case kIsItemNearPlace:
|
||||
@ -1016,6 +1018,13 @@ Command *Command::opIsRandom(int32 chance) {
|
||||
return nextCommandIf(value < chance);
|
||||
}
|
||||
|
||||
Command *Command::opIsAnimScriptItemReached(const ResourceReference &animScriptItemRef) {
|
||||
AnimScriptItem *animScriptItem = animScriptItemRef.resolve<AnimScriptItem>();
|
||||
AnimScript *animScript = animScriptItem->findParent<AnimScript>();
|
||||
|
||||
return nextCommandIf(animScript->hasReached(animScriptItem));
|
||||
}
|
||||
|
||||
Command *Command::opIsItemOnPlace(const ResourceReference &itemRef, const ResourceReference &positionRef) {
|
||||
FloorPositionedItem *item = itemRef.resolve<FloorPositionedItem>();
|
||||
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
kIsKnowledgeIntegerLower = 173,
|
||||
kIsScriptActive = 174,
|
||||
kIsRandom = 175,
|
||||
|
||||
kIsAnimScriptItemReached = 176,
|
||||
kIsItemOnPlace = 177,
|
||||
|
||||
kIsAnimPlaying = 179,
|
||||
@ -252,6 +252,7 @@ protected:
|
||||
Command *opIsKnowledgeIntegerLower(const ResourceReference &knowledgeRef, int32 value);
|
||||
Command *opIsScriptActive(const ResourceReference &scriptRef);
|
||||
Command *opIsRandom(int32 chance);
|
||||
Command *opIsAnimScriptItemReached(const ResourceReference &animScriptItemRef);
|
||||
Command *opIsItemNearPlace(const ResourceReference &itemRef, const ResourceReference &positionRef, int32 testDistance);
|
||||
Command *opIsItemOnPlace(const ResourceReference &itemRef, const ResourceReference &positionRef);
|
||||
Command *opIsAnimPlaying(const ResourceReference &animRef);
|
||||
|
Loading…
x
Reference in New Issue
Block a user