[Scummvm-git-logs] scummvm master -> 53b100dd94797206f9e2bc15279633c5d0debae7

neuromancer noreply at scummvm.org
Thu Apr 21 11:26:34 UTC 2022


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

Summary:
07222b9d3b HYPNO: first attempt to redo the controls for c33 in wet
39ad73789d HYPNO: improving calculations when selected directions in several wet levels
313091ee6a HYPNO: improved c40 wet level handling and use specific frames for the player
53b100dd94 HYPNO: avoid using invalid coordinates when checking for targets


Commit: 07222b9d3b096f1b01ebcbc8c6698836292c70a6
    https://github.com/scummvm/scummvm/commit/07222b9d3b096f1b01ebcbc8c6698836292c70a6
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-04-21T13:24:33+02:00

Commit Message:
HYPNO: first attempt to redo the controls for c33 in wet

Changed paths:
    engines/hypno/arcade.cpp
    engines/hypno/hypno.h
    engines/hypno/wet/arcade.cpp


diff --git a/engines/hypno/arcade.cpp b/engines/hypno/arcade.cpp
index cfee71cb38e..eeea739c91f 100644
--- a/engines/hypno/arcade.cpp
+++ b/engines/hypno/arcade.cpp
@@ -243,7 +243,8 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
 	while (!shouldQuit()) {
 		needsUpdate = _background->decoder->needsUpdate();
 		while (g_system->getEventManager()->pollEvent(event)) {
-			mousePos = g_system->getEventManager()->getMousePos();
+			mousePos = getPlayerPosition(false);
+
 			// Events
 			switch (event.type) {
 
@@ -273,24 +274,20 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
 				drawCursorArcade(mousePos);
 				if (mousePos.x >= arc->mouseBox.right-1) {
 					g_system->warpMouse(arc->mouseBox.right-1, mousePos.y);
-					needsUpdate = true;
 				} else if (mousePos.y >= arc->mouseBox.bottom-1) {
 					g_system->warpMouse(mousePos.x, arc->mouseBox.bottom-1);
-					needsUpdate = true;
 				} else if (mousePos.x <= 100 && offset.x < 0) {
 					for (Shoots::iterator it = _shoots.begin(); it != _shoots.end(); ++it) {
 						if (it->video && it->video->decoder)
 							it->video->position.x = it->video->position.x + 1;
 					}
 					offset.x = offset.x + 1;
-					needsUpdate = true;
 				} else if (mousePos.x >= 300 && offset.x > 320 - _background->decoder->getWidth()) {
 					for (Shoots::iterator it = _shoots.begin(); it != _shoots.end(); ++it) {
 						if (it->video && it->video->decoder)
 							it->video->position.x = it->video->position.x - 1;
 					}
 					offset.x = offset.x - 1;
-					needsUpdate = true;
 				}
 				_background->position = offset;
 				break;
@@ -301,6 +298,7 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
 		}
 
 		if (needsUpdate) {
+			getPlayerPosition(true);
 			drawScreen();
 			updateScreen(*_background);
 			if (!arc->maskVideo.empty() && _masks->decoder->needsUpdate())
@@ -582,6 +580,10 @@ Common::Point HypnoEngine::computeTargetPosition(const Common::Point &mousePos)
 	return mousePos;
 }
 
+Common::Point HypnoEngine::getPlayerPosition(bool needsUpdate) {
+	return g_system->getEventManager()->getMousePos();
+}
+
 int HypnoEngine::detectTarget(const Common::Point &mousePos) {
 	int i = -1;
 	Common::Point target = computeTargetPosition(mousePos);
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index 169ddccfef9..9ea0afd0a7e 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -240,6 +240,7 @@ public:
 	// Arcade
 	Common::String _arcadeMode;
 	MVideo *_background;
+	virtual Common::Point getPlayerPosition(bool needsUpdate);
 	virtual Common::Point computeTargetPosition(const Common::Point &mousePos);
 	virtual int detectTarget(const Common::Point &mousePos);
 	virtual void pressedKey(const int keycode);
@@ -394,6 +395,7 @@ public:
 	void saveProfile(const Common::String &name, int levelId);
 
 	// Arcade
+	Common::Point getPlayerPosition(bool needsUpdate) override;
 	void pressedKey(const int keycode) override;
 	void runBeforeArcade(ArcadeShooting *arc) override;
 	void runAfterArcade(ArcadeShooting *arc) override;
@@ -409,6 +411,8 @@ private:
 	void showDemoScore();
 	uint32 findPaletteIndexZones(uint32 id);
 
+	Common::Point _c33PlayerPosition;
+
 	Common::BitArray _font05;
 	Common::BitArray _font08;
 	Common::Array<uint32> _c40SegmentPath;
diff --git a/engines/hypno/wet/arcade.cpp b/engines/hypno/wet/arcade.cpp
index 3eee8b6cebb..4d9e5ff9853 100644
--- a/engines/hypno/wet/arcade.cpp
+++ b/engines/hypno/wet/arcade.cpp
@@ -467,6 +467,7 @@ void WetEngine::runBeforeArcade(ArcadeShooting *arc) {
 
 	_ammo = 150;
 	_maxAmmo = 150;
+	_c33PlayerPosition = Common::Point(_screenW/2, _screenH/2);
 }
 
 void WetEngine::pressedKey(const int keycode) {
@@ -489,10 +490,24 @@ void WetEngine::pressedKey(const int keycode) {
 	}
 }
 
+Common::Point WetEngine::getPlayerPosition(bool needsUpdate) {
+	Common::Point mousePos = g_system->getEventManager()->getMousePos();
+	if (_arcadeMode == "YT") {
+		if (needsUpdate) {
+			Common::Point diff = mousePos - _c33PlayerPosition;
+			if (diff.x > 1 || diff.y > 1)
+				diff = diff / 10;
+			_c33PlayerPosition = _c33PlayerPosition + diff;
+		}
+		return _c33PlayerPosition;
+	}
+	return mousePos;
+}
+
 void WetEngine::drawCursorArcade(const Common::Point &mousePos) {
 	int i = detectTarget(mousePos);
 	if (_arcadeMode == "YT") {
-		changeCursor("c33/c33i2.smk", 12);
+		changeCursor("arcade");
 		return;
 	}
 
@@ -650,6 +665,11 @@ void WetEngine::drawPlayer() {
 		offset = 2;
 
 	drawImage(*_playerFrames[_playerFrameIdx], 0, 200 - _playerFrames[_playerFrameIdx]->h + offset, true);
+	if (_arcadeMode == "YT") {
+		Graphics::Surface *cursor = decodeFrame("c33/c33i2.smk", 12, nullptr);
+		drawImage(*cursor, _c33PlayerPosition.x, _c33PlayerPosition.y, true);
+	}
+
 }
 
 void WetEngine::drawHealth() {


Commit: 39ad73789d2209f09ae96a6b5983fa05931e1370
    https://github.com/scummvm/scummvm/commit/39ad73789d2209f09ae96a6b5983fa05931e1370
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-04-21T13:24:33+02:00

Commit Message:
HYPNO: improving calculations when selected directions in several wet levels

Changed paths:
    engines/hypno/wet/arcade.cpp


diff --git a/engines/hypno/wet/arcade.cpp b/engines/hypno/wet/arcade.cpp
index 4d9e5ff9853..727f650eff1 100644
--- a/engines/hypno/wet/arcade.cpp
+++ b/engines/hypno/wet/arcade.cpp
@@ -124,25 +124,25 @@ void WetEngine::findNextSegment(ArcadeShooting *arc) {
 
 		} else if (segments[_segmentIdx].type == 0xc5) {
 			if (_arcadeMode == "Y1") {
-				if (mousePos.x <= 100)
+				if (mousePos.x <= 106)
 					_segmentIdx = _segmentIdx + 1;
-				else if (mousePos.x >= 300)
+				else if (mousePos.x >= 213)
 					_segmentIdx = _segmentIdx + 3;
 				else
 					_segmentIdx = _segmentIdx + 2;
 			} else if (_arcadeMode == "Y4") {
-				if (mousePos.x <= 100)
+				if (mousePos.x <= 106)
 					_segmentIdx = _segmentIdx + 2;
-				else if (mousePos.x >= 300)
+				else if (mousePos.x >= 213)
 					_segmentIdx = _segmentIdx + 3;
 				else
 					_segmentIdx = _segmentIdx + 1;
 
 			} else if (_arcadeMode == "Y5") {
-				if (mousePos.x <= 100) {
+				if (mousePos.x <= 106) {
 					_segmentIdx = _segmentIdx + 2;
 					_c50LeftTurns++;
-				} else if (mousePos.x >= 300) {
+				} else if (mousePos.x >= 213) {
 					_segmentIdx = _segmentIdx + 3;
 					_c50RigthTurns++;
 				} else


Commit: 313091ee6ab15fb32f01d5d24adb7beee2b5fb75
    https://github.com/scummvm/scummvm/commit/313091ee6ab15fb32f01d5d24adb7beee2b5fb75
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-04-21T13:24:34+02:00

Commit Message:
HYPNO: improved c40 wet level handling and use specific frames for the player

Changed paths:
    engines/hypno/wet/arcade.cpp


diff --git a/engines/hypno/wet/arcade.cpp b/engines/hypno/wet/arcade.cpp
index 727f650eff1..547c3e7274f 100644
--- a/engines/hypno/wet/arcade.cpp
+++ b/engines/hypno/wet/arcade.cpp
@@ -37,6 +37,9 @@ void WetEngine::initSegment(ArcadeShooting *arc) {
 		_segmentShootSequenceMax = 7;
 	} else if (_arcadeMode == "Y4") {
 		_c40SegmentNext.clear();
+		_c40SegmentNext.push_back(2);
+		_c40SegmentPath.push_back(3);
+
 		_c40SegmentNext.push_back(2);
 		_c40SegmentPath.push_back(5);
 
@@ -613,6 +616,12 @@ void WetEngine::drawShoot(const Common::Point &mousePos) {
 		_compositeSurface->drawLine(mousePos.x, mousePos.y - 20, mousePos.x, mousePos.y + 1, c);
 		_compositeSurface->drawLine(mousePos.x, mousePos.y - 20, mousePos.x, mousePos.y, c);
 		_compositeSurface->drawLine(mousePos.x, mousePos.y - 20, mousePos.x, mousePos.y - 1, c);
+	} else if (_arcadeMode == "Y4") {
+		_compositeSurface->drawLine(_screenW/2 - 50, _screenH, mousePos.x, mousePos.y, c);
+		_compositeSurface->drawLine(_screenW/2 - 50, _screenH, mousePos.x - 1, mousePos.y, c);
+
+		_compositeSurface->drawLine(_screenW/2 + 50, _screenH, mousePos.x, mousePos.y, c);
+		_compositeSurface->drawLine(_screenW/2 + 50, _screenH, mousePos.x - 1, mousePos.y, c);
 	} else {
 		_compositeSurface->drawLine(0, _screenH, mousePos.x, mousePos.y, c);
 		_compositeSurface->drawLine(0, _screenH, mousePos.x - 1, mousePos.y, c);
@@ -624,6 +633,21 @@ void WetEngine::drawShoot(const Common::Point &mousePos) {
 	}
 
 	playSound(_soundPath + _shootSound, 1);
+
+	if (_arcadeMode == "Y4") {
+		if (mousePos.x <= 25)
+			_playerFrameIdx = 10;
+		else if (mousePos.x <= 50)
+			_playerFrameIdx = 12;
+		else if (mousePos.x >= 295)
+			_playerFrameIdx = 18;
+		else if (mousePos.x >= 270)
+			_playerFrameIdx = 16;
+		else
+			_playerFrameIdx = 14;
+
+		drawImage(*_playerFrames[_playerFrameIdx], 0, 200 - _playerFrames[_playerFrameIdx]->h, true);
+	}
 }
 
 void WetEngine::drawPlayer() {
@@ -654,8 +678,19 @@ void WetEngine::drawPlayer() {
 
 	if (_arcadeMode == "Y5")
 		_playerFrameIdx = 1;
-	else if (_arcadeMode == "Y4")
-		_playerFrameIdx = 2;
+	else if (_arcadeMode == "Y4") {
+		if (mousePos.x <= 25)
+			_playerFrameIdx = 0;
+		else if (mousePos.x <= 50)
+			_playerFrameIdx = 2;
+		else if (mousePos.x >= 295)
+			_playerFrameIdx = 8;
+		else if (mousePos.x >= 270)
+			_playerFrameIdx = 6;
+		else
+			_playerFrameIdx = 4;
+	}
+
 
 	int offset = 0;
 	// Ugly, but seems to be necessary


Commit: 53b100dd94797206f9e2bc15279633c5d0debae7
    https://github.com/scummvm/scummvm/commit/53b100dd94797206f9e2bc15279633c5d0debae7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-04-21T13:24:34+02:00

Commit Message:
HYPNO: avoid using invalid coordinates when checking for targets

Changed paths:
    engines/hypno/arcade.cpp


diff --git a/engines/hypno/arcade.cpp b/engines/hypno/arcade.cpp
index eeea739c91f..acff7ef2cad 100644
--- a/engines/hypno/arcade.cpp
+++ b/engines/hypno/arcade.cpp
@@ -587,6 +587,12 @@ Common::Point HypnoEngine::getPlayerPosition(bool needsUpdate) {
 int HypnoEngine::detectTarget(const Common::Point &mousePos) {
 	int i = -1;
 	Common::Point target = computeTargetPosition(mousePos);
+	if (target.x >= _compositeSurface->w || target.y >= _compositeSurface->h)
+		return -1;
+
+	if (target.x < 0 || target.y < 0)
+		return -1;
+
 	for (Shoots::iterator it = _shoots.begin(); it != _shoots.end(); ++it) {
 		i++;
 		if (it->destroyed)




More information about the Scummvm-git-logs mailing list