[Scummvm-git-logs] scummvm master -> 3322bc44db112d0f35118d80e835b27f6b76668b

antoniou79 antoniou at cti.gr
Thu May 23 01:37:46 CEST 2019


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:
e4b8c0f4e3 BLADERUNNER: Debugger health command
3322bc44db BLADERUNNER: Fix mouse in KIA after moonbus massacre ending


Commit: e4b8c0f4e3911062bbbb4829d85b11be80a0e8ae
    https://github.com/scummvm/scummvm/commit/e4b8c0f4e3911062bbbb4829d85b11be80a0e8ae
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-05-23T02:16:50+03:00

Commit Message:
BLADERUNNER: Debugger health command

Needed mostly to heal McCoy, or un-retire some actors

Changed paths:
    engines/bladerunner/debugger.cpp
    engines/bladerunner/debugger.h


diff --git a/engines/bladerunner/debugger.cpp b/engines/bladerunner/debugger.cpp
index de7c22f..b19dd54 100644
--- a/engines/bladerunner/debugger.cpp
+++ b/engines/bladerunner/debugger.cpp
@@ -108,6 +108,7 @@ Debugger::Debugger(BladeRunnerEngine *vm) : GUI::Debugger() {
 	_showMazeScore = false;
 
 	registerCmd("anim", WRAP_METHOD(Debugger, cmdAnimation));
+	registerCmd("health", WRAP_METHOD(Debugger, cmdHealth));
 	registerCmd("draw", WRAP_METHOD(Debugger, cmdDraw));
 	registerCmd("list", WRAP_METHOD(Debugger, cmdList));
 	registerCmd("flag", WRAP_METHOD(Debugger, cmdFlag));
@@ -173,6 +174,41 @@ bool Debugger::cmdAnimation(int argc, const char **argv) {
 	return true;
 }
 
+bool Debugger::cmdHealth(int argc, const char **argv) {
+	if (argc != 2 && argc != 4) {
+		debugPrintf("Get or set health for the actor.\n");
+		debugPrintf("Usage: %s <actorId> [<health> <max health>]\n", argv[0]);
+		return true;
+	}
+
+	int actorId = atoi(argv[1]);
+
+	Actor *actor = nullptr;
+	if (actorId >= 0 && actorId < (int)_vm->_gameInfo->getActorCount()) {
+		actor = _vm->_actors[actorId];
+	}
+
+	if (actor == nullptr) {
+		debugPrintf("Unknown actor %i\n", actorId);
+		return true;
+	}
+
+	if (argc == 4) {
+		int currHealth = atoi(argv[2]);
+		int maxHealth = atoi(argv[3]);
+		currHealth = CLIP(currHealth, 0, 100);
+		maxHealth = CLIP(maxHealth, 0, 100);
+		if (currHealth > maxHealth) {
+			debugPrintf("Actor's current health cannot be greater than their max health\n");
+			return true;
+		}
+		actor->setHealth(currHealth, maxHealth);
+	}
+
+	debugPrintf("actor health(%i) = %i, max: %i\n", actorId, actor->getCurrentHP(), actor->getMaxHP());
+	return true;
+}
+
 bool Debugger::cmdDraw(int argc, const char **argv) {
 	bool invalidSyntax = false;
 
diff --git a/engines/bladerunner/debugger.h b/engines/bladerunner/debugger.h
index 5368286..a1737de 100644
--- a/engines/bladerunner/debugger.h
+++ b/engines/bladerunner/debugger.h
@@ -90,6 +90,7 @@ public:
 	~Debugger();
 
 	bool cmdAnimation(int argc, const char **argv);
+	bool cmdHealth(int argc, const char **argv);
 	bool cmdChapter(int argc, const char **argv);
 	bool cmdDraw(int argc, const char **argv);
 	bool cmdFlag(int argc, const char **argv);


Commit: 3322bc44db112d0f35118d80e835b27f6b76668b
    https://github.com/scummvm/scummvm/commit/3322bc44db112d0f35118d80e835b27f6b76668b
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-05-23T02:17:56+03:00

Commit Message:
BLADERUNNER: Fix mouse in KIA after moonbus massacre ending

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/bladerunner.h


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index cd8cbbe..c0f2544 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -323,6 +323,10 @@ Common::Error BladeRunnerEngine::run() {
 			// additional code for gracefully handling end-game after _endCredits->show()
 			_gameOver = false;
 			_gameIsRunning = true;
+			if (!playerHasControl()) {
+				// force a player gains control
+				playerGainsControl(true);
+			}
 			if (_mouse->isDisabled()) {
 				// force a mouse enable here since otherwise, after end-game,
 				// we need extra call(s) to mouse->enable to get the _disabledCounter to 0
@@ -1861,16 +1865,21 @@ void BladeRunnerEngine::playerLosesControl() {
 	}
 }
 
-void BladeRunnerEngine::playerGainsControl() {
-	if (_playerLosesControlCounter == 0) {
+void BladeRunnerEngine::playerGainsControl(bool force) {
+	if (!force && _playerLosesControlCounter == 0) {
 		warning("Unbalanced call to BladeRunnerEngine::playerGainsControl");
 	}
 
-	if (_playerLosesControlCounter > 0)
-		--_playerLosesControlCounter;
-
-	if (_playerLosesControlCounter == 0) {
-		_mouse->enable();
+	if (force) {
+		_playerLosesControlCounter = 0;
+		_mouse->enable(force);
+	} else {
+		if (_playerLosesControlCounter > 0) {
+			--_playerLosesControlCounter;
+		}
+		if (_playerLosesControlCounter == 0) {
+			_mouse->enable();
+		}
 	}
 }
 
diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h
index 33ab032..2c1aec4 100644
--- a/engines/bladerunner/bladerunner.h
+++ b/engines/bladerunner/bladerunner.h
@@ -296,7 +296,7 @@ public:
 
 	bool playerHasControl();
 	void playerLosesControl();
-	void playerGainsControl();
+	void playerGainsControl(bool force = false);
 	void playerDied();
 
 	bool saveGame(Common::WriteStream &stream, Graphics::Surface &thumbnail);





More information about the Scummvm-git-logs mailing list