[Scummvm-git-logs] scummvm master -> 38a162db61f882bba14c1361dfc8c263c5a3ec49

elasota noreply at scummvm.org
Sat Feb 25 16:09:26 UTC 2023


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
db03708f6a VCRUISE: Put animation def packing in its own function
38a162db61 VCRUISE: Fix wrong iterator type


Commit: db03708f6ab9838cb4467f4f17871efd62f8e4b5
    https://github.com/scummvm/scummvm/commit/db03708f6ab9838cb4467f4f17871efd62f8e4b5
Author: elasota (ejlasota at gmail.com)
Date: 2023-02-25T11:05:35-05:00

Commit Message:
VCRUISE: Put animation def packing in its own function

Changed paths:
    engines/vcruise/runtime.cpp
    engines/vcruise/runtime.h


diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 31e15b3c17f..454b030a93e 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -1051,6 +1051,16 @@ AnimationDef Runtime::stackArgsToAnimDef(const StackValue_t *args) const {
 	return def;
 }
 
+void Runtime::pushAnimDef(const AnimationDef &animDef) {
+	// Going from Schizm's scripts it looks like this IS pushed on to the stack, but encoded as:
+	// Bits 0..11:  Last frame
+	// Bits 12..23: First frame
+	// Bits 24..31: Number
+	_scriptStack.push_back(animDef.animNum);
+	_scriptStack.push_back(animDef.firstFrame);
+	_scriptStack.push_back(animDef.lastFrame);
+}
+
 void Runtime::activateScript(const Common::SharedPtr<Script> &script, const ScriptEnvironmentVars &envVars) {
 	if (script->instrs.size() == 0)
 		return;
@@ -1362,7 +1372,12 @@ void Runtime::scriptOpRotate(ScriptArg_t arg) {
 	_havePanAnimations = true;
 }
 
-OPCODE_STUB(Angle)
+void Runtime::scriptOpAngle(ScriptArg_t arg) {
+	TAKE_STACK(1);
+
+	_scriptStack.push_back((stackArgs[0] == static_cast<StackValue_t>(_direction)) ? 1 : 0);
+}
+
 OPCODE_STUB(AngleGGet)
 
 void Runtime::scriptOpSpeed(ScriptArg_t arg) {
@@ -1814,7 +1829,6 @@ OPCODE_STUB(EscGet)
 OPCODE_STUB(BackStart)
 
 void Runtime::scriptOpAnimName(ScriptArg_t arg) {
-	// I doubt this is actually how it works internally but whatever
 	if (_roomNumber >= _roomDefs.size())
 		error("Can't resolve animation for room, room number was invalid");
 
@@ -1827,13 +1841,9 @@ void Runtime::scriptOpAnimName(ScriptArg_t arg) {
 	if (it == roomDef->animations.end())
 		error("Can't resolve animation for room, couldn't find animation '%s'", _scriptSet->strings[arg].c_str());
 
-	_scriptStack.push_back(it->_value.animNum);
-	_scriptStack.push_back(it->_value.firstFrame);
-	_scriptStack.push_back(it->_value.lastFrame);
+	pushAnimDef(it->_value);
 }
 
-
-
 void Runtime::scriptOpValueName(ScriptArg_t arg) {
 	if (_roomNumber >= _roomDefs.size())
 		error("Invalid room number for var name op");
diff --git a/engines/vcruise/runtime.h b/engines/vcruise/runtime.h
index 6570b73eb95..4f38d8ca169 100644
--- a/engines/vcruise/runtime.h
+++ b/engines/vcruise/runtime.h
@@ -244,6 +244,7 @@ private:
 	void changeAnimation(const AnimationDef &animDef, uint initialFrame, bool consumeFPSOverride);
 
 	AnimationDef stackArgsToAnimDef(const StackValue_t *args) const;
+	void pushAnimDef(const AnimationDef &animDef);
 
 	void activateScript(const Common::SharedPtr<Script> &script, const ScriptEnvironmentVars &envVars);
 


Commit: 38a162db61f882bba14c1361dfc8c263c5a3ec49
    https://github.com/scummvm/scummvm/commit/38a162db61f882bba14c1361dfc8c263c5a3ec49
Author: elasota (ejlasota at gmail.com)
Date: 2023-02-25T11:08:34-05:00

Commit Message:
VCRUISE: Fix wrong iterator type

Changed paths:
    engines/vcruise/runtime.cpp


diff --git a/engines/vcruise/runtime.cpp b/engines/vcruise/runtime.cpp
index 454b030a93e..f4e30fb0b04 100644
--- a/engines/vcruise/runtime.cpp
+++ b/engines/vcruise/runtime.cpp
@@ -1854,7 +1854,7 @@ void Runtime::scriptOpValueName(ScriptArg_t arg) {
 
 	const Common::String &varName = _scriptSet->strings[arg];
 
-	Common::HashMap<Common::String, StackValue_t>::const_iterator it = roomDef->values.find(varName);
+	Common::HashMap<Common::String, int>::const_iterator it = roomDef->values.find(varName);
 	if (it == roomDef->values.end())
 		error("Value '%s' doesn't exist in room %i", varName.c_str(), static_cast<int>(_roomNumber));
 




More information about the Scummvm-git-logs mailing list