[Scummvm-git-logs] scummvm master -> 0572cbac165e3b590ccad9396f3499f9a25e471c
mgerhardy
noreply at scummvm.org
Tue Feb 15 06:27:04 UTC 2022
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ff014dfc65 TWINE: fixed kcCONE_VIEW opcode
26f48a6f4e TWINE: reversed logic
679d1c1479 TWINE: guard macro definition
580c3250e8 TWINE: added support for --boot-param
0572cbac16 TWINE: support --dump-scripts
Commit: ff014dfc65c69af6121b3b091b1fc84b8a3eaa7b
https://github.com/scummvm/scummvm/commit/ff014dfc65c69af6121b3b091b1fc84b8a3eaa7b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-02-15T07:24:26+01:00
Commit Message:
TWINE: fixed kcCONE_VIEW opcode
... for the case that the actor is the hero and the hero is in discrete mode
Changed paths:
engines/twine/script/script_life_v1.cpp
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index cdee1f99831..fc3e8267cdf 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -219,39 +219,40 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
conditionValueSize = 2;
- if (!targetActor->_dynamicFlags.bIsDead) {
- if (ABS(targetActor->_pos.y - ctx.actor->_pos.y) < 1500) {
- newAngle = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->pos(), targetActor->pos());
- if (ABS(engine->_movements->_targetActorDistance) > MAX_TARGET_ACTOR_DISTANCE) {
- engine->_movements->_targetActorDistance = MAX_TARGET_ACTOR_DISTANCE;
- }
- } else {
+ if (targetActor->_dynamicFlags.bIsDead) {
+ engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
+ break;
+ }
+
+ if (ABS(targetActor->_pos.y - ctx.actor->_pos.y) < 1500) {
+ newAngle = engine->_movements->getAngleAndSetTargetActorDistance(ctx.actor->pos(), targetActor->pos());
+ if (ABS(engine->_movements->_targetActorDistance) > MAX_TARGET_ACTOR_DISTANCE) {
engine->_movements->_targetActorDistance = MAX_TARGET_ACTOR_DISTANCE;
}
+ } else {
+ engine->_movements->_targetActorDistance = MAX_TARGET_ACTOR_DISTANCE;
+ }
- if (IS_HERO(targetActorIdx)) {
+ if (IS_HERO(targetActorIdx)) {
+ if (engine->_actor->_heroBehaviour == HeroBehaviourType::kDiscrete) {
int32 heroAngle = ClampAngle(ctx.actor->_angle + ANGLE_360 + ANGLE_45 - newAngle + ANGLE_360);
- if (ABS(heroAngle) > ANGLE_90) {
- engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
- } else {
+ if (ABS(heroAngle) <= ANGLE_90) {
engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
- }
- } else {
- if (engine->_actor->_heroBehaviour == HeroBehaviourType::kDiscrete) {
- int32 heroAngle = ClampAngle(ctx.actor->_angle + ANGLE_360 + ANGLE_45 - newAngle + ANGLE_360);
-
- if (ABS(heroAngle) > ANGLE_90) {
- engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
- } else {
- engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
- }
} else {
- engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
+ engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
}
+ } else {
+ engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
}
} else {
- engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
+ int32 heroAngle = ClampAngle(ctx.actor->_angle + ANGLE_360 + ANGLE_45 - newAngle + ANGLE_360);
+
+ if (ABS(heroAngle) <= ANGLE_90) {
+ engine->_scene->_currentScriptValue = engine->_movements->_targetActorDistance;
+ } else {
+ engine->_scene->_currentScriptValue = MAX_TARGET_ACTOR_DISTANCE;
+ }
}
break;
}
Commit: 26f48a6f4e8a2cf8cae64c2c669b6b746dc54bf3
https://github.com/scummvm/scummvm/commit/26f48a6f4e8a2cf8cae64c2c669b6b746dc54bf3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-02-15T07:24:51+01:00
Commit Message:
TWINE: reversed logic
Changed paths:
engines/twine/script/script_life_v1.cpp
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index fc3e8267cdf..eca445a9caa 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -329,7 +329,9 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
case kcUSE_INVENTORY: {
int32 item = ctx.stream.readByte();
- if (!engine->_gameState->inventoryDisabled()) {
+ if (engine->_gameState->inventoryDisabled()) {
+ engine->_scene->_currentScriptValue = 0;
+ } else {
if (item == engine->_loopInventoryItem) {
engine->_scene->_currentScriptValue = 1;
} else {
@@ -343,8 +345,6 @@ static int32 processLifeConditions(TwinEEngine *engine, LifeScriptContext &ctx)
if (engine->_scene->_currentScriptValue == 1) {
engine->_redraw->addOverlay(OverlayType::koInventoryItem, item, 0, 0, 0, OverlayPosType::koNormal, 3);
}
- } else {
- engine->_scene->_currentScriptValue = 0;
}
break;
}
Commit: 679d1c147988403d2fdeb1f92e213435484a4f36
https://github.com/scummvm/scummvm/commit/679d1c147988403d2fdeb1f92e213435484a4f36
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-02-15T07:25:29+01:00
Commit Message:
TWINE: guard macro definition
Changed paths:
engines/twine/shared.h
diff --git a/engines/twine/shared.h b/engines/twine/shared.h
index b4d21af2b65..9499ce4828b 100644
--- a/engines/twine/shared.h
+++ b/engines/twine/shared.h
@@ -78,7 +78,7 @@
#define GAMEFLAG_VIDEO_EXPLODE2 219
#define OWN_ACTOR_SCENE_INDEX 0
-#define IS_HERO(x) (x) == OWN_ACTOR_SCENE_INDEX
+#define IS_HERO(x) ((x) == OWN_ACTOR_SCENE_INDEX)
namespace TwinE {
Commit: 580c3250e8be2b4e1e61542f6b11fd3ecaa00b6c
https://github.com/scummvm/scummvm/commit/580c3250e8be2b4e1e61542f6b11fd3ecaa00b6c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-02-15T07:25:40+01:00
Commit Message:
TWINE: added support for --boot-param
Changed paths:
engines/twine/twine.cpp
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index dc2d5083248..226a8c7f396 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -278,6 +278,22 @@ Common::Error TwinEEngine::run() {
}
}
}
+ if (ConfMan.hasKey("boot_param")) {
+ const int sceneIndex = ConfMan.getInt("boot_param");
+ if (sceneIndex < 0 || sceneIndex >= LBA1SceneId::SceneIdMax) {
+ warning("Scene index out of bounds\n");
+ } else {
+ debug("Boot parameter: %i\n", sceneIndex);
+ _gameState->initEngineVars();
+ _text->textClipSmall();
+ _text->_drawTextBoxBackground = true;
+ _text->_renderTextTriangle = false;
+ _scene->_needChangeScene = sceneIndex;
+ _scene->_heroPositionType = ScenePositionType::kScene;
+ _state = EngineState::GameLoop;
+ }
+ }
+
bool quitGame = false;
while (!quitGame && !shouldQuit()) {
readKeys();
@@ -308,8 +324,8 @@ Common::Error TwinEEngine::run() {
// this will enter the game and execute the commands in the file "debug"
_gameState->initEngineVars();
_text->textClipSmall();
- _text->drawTextBoxBackground = true;
- _text->renderTextTriangle = false;
+ _text->_drawTextBoxBackground = true;
+ _text->_renderTextTriangle = false;
if (!((TwinEConsole*)getDebugger())->exec("debug")) {
debug("Failed to execute debug file before entering the scene");
}
Commit: 0572cbac165e3b590ccad9396f3499f9a25e471c
https://github.com/scummvm/scummvm/commit/0572cbac165e3b590ccad9396f3499f9a25e471c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2022-02-15T07:26:10+01:00
Commit Message:
TWINE: support --dump-scripts
Changed paths:
engines/twine/scene/scene.cpp
engines/twine/scene/scene.h
diff --git a/engines/twine/scene/scene.cpp b/engines/twine/scene/scene.cpp
index 7fe14f977ab..f3bb08d028f 100644
--- a/engines/twine/scene/scene.cpp
+++ b/engines/twine/scene/scene.cpp
@@ -20,6 +20,7 @@
*/
#include "twine/scene/scene.h"
+#include "common/file.h"
#include "common/memstream.h"
#include "common/stream.h"
#include "common/util.h"
@@ -460,6 +461,26 @@ void Scene::reloadCurrentScene() {
_needChangeScene = _currentSceneIdx;
}
+void Scene::dumpSceneScript(const char *type, int actorIdx, const uint8* script, int size) const {
+ Common::String fname = Common::String::format("./dumps/%i-%i.%s", _currentSceneIdx, actorIdx, type);
+ Common::DumpFile out;
+ if (!out.open(fname.c_str(), true)) {
+ warning("Scene::dumpSceneScript(): Can not open dump file %s", fname.c_str());
+ } else {
+ out.write(script, size);
+ out.flush();
+ out.close();
+ }
+}
+
+void Scene::dumpSceneScripts() const {
+ for (int32 a = 0; a < _sceneNumActors; ++a) {
+ const ActorStruct &actor = _sceneActors[a];
+ dumpSceneScript("life", a, actor._lifeScript, actor._lifeScriptSize);
+ dumpSceneScript("move", a, actor._moveScript, actor._moveScriptSize);
+ }
+}
+
void Scene::changeScene() {
if (_engine->isLBA1()) {
if (_useScenePatches) {
@@ -518,6 +539,9 @@ void Scene::changeScene() {
_sceneHero->_labelIdx = -1;
initScene(_needChangeScene);
+ if (ConfMan.getBool("dump_scripts")) {
+ dumpSceneScripts();
+ }
if (_holomapTrajectory != -1) {
_engine->_holomap->drawHolomapTrajectory(_holomapTrajectory);
diff --git a/engines/twine/scene/scene.h b/engines/twine/scene/scene.h
index ede7fa01ced..f5ee0e2cffd 100644
--- a/engines/twine/scene/scene.h
+++ b/engines/twine/scene/scene.h
@@ -160,7 +160,8 @@ private:
int32 _currentGameOverScene = 0;
uint8 *_currentScene = nullptr;
-
+ void dumpSceneScripts() const;
+ void dumpSceneScript(const char *type, int actorIdx, const uint8* script, int size) const;
public:
Scene(TwinEEngine *engine) : _engine(engine) {}
~Scene();
More information about the Scummvm-git-logs
mailing list