[Scummvm-git-logs] scummvm master -> 5d450782014c5c41fbfe95e6fe314b6fbc5a34f7

neuromancer noreply at scummvm.org
Sun Feb 6 12:29:22 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:
8b40ec0d09 HYPNO: added missing intro videos in wet
293942a80d COMMON: extended BitArray to allow setting bits using a byte array
eac4543f9d HYPNO: basic handling of original fonts
f9ef8ad6a0 HYPNO: font fixes for wet demos
5d45078201 HYPNO: additional font fixes for wet demos


Commit: 8b40ec0d09d94008ffd59b0ae01ce31e2ea0142f
    https://github.com/scummvm/scummvm/commit/8b40ec0d09d94008ffd59b0ae01ce31e2ea0142f
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-02-06T13:29:29+01:00

Commit Message:
HYPNO: added missing intro videos in wet

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


diff --git a/engines/hypno/wet/wet.cpp b/engines/hypno/wet/wet.cpp
index cc7bfb6754b..6bc4c8c56c9 100644
--- a/engines/hypno/wet/wet.cpp
+++ b/engines/hypno/wet/wet.cpp
@@ -237,19 +237,22 @@ void WetEngine::loadAssetsFullGame() {
 	Code *menu = new Code();
 	menu->name = "<main_menu>";
 	_levels["<main_menu>"] = menu;
-	_levels["<main_menu>"]->levelIfWin = "c11";
+	_levels["<main_menu>"]->levelIfWin = "<intros>";
+
+	Transition *intros = new Transition("c11");
+	intros->intros.push_back("c_misc/stardate.smk");
+	intros->intros.push_back("c_misc/intros.smk");
+	intros->intros.push_back("c_misc/confs.smk");
+	_levels["<intros>"] = intros;
 
 	loadArcadeLevel("c110.mi_", "c10", "");
 	_levels["c110.mi_"]->levelIfLose = "<quit>";
-	_levels["c110.mi_"]->intros.push_front("c_misc/intros.smk");
 
 	loadArcadeLevel("c111.mi_", "c10", "");
 	_levels["c111.mi_"]->levelIfLose = "<quit>";
-	_levels["c111.mi_"]->intros.push_front("c_misc/intros.smk");
 
 	loadArcadeLevel("c112.mi_", "c10", "");
 	_levels["c112.mi_"]->levelIfLose = "<quit>";
-	_levels["c112.mi_"]->intros.push_front("c_misc/intros.smk");
 
 	loadArcadeLevel("c100.mi_", "c21", "");
 	loadArcadeLevel("c101.mi_", "c21", "");


Commit: 293942a80dc6155d9bc55054a6015bbbb5d3df17
    https://github.com/scummvm/scummvm/commit/293942a80dc6155d9bc55054a6015bbbb5d3df17
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-02-06T13:29:29+01:00

Commit Message:
COMMON: extended BitArray to allow setting bits using a byte array

Changed paths:
    common/bitarray.h


diff --git a/common/bitarray.h b/common/bitarray.h
index 8f164d8c4ef..bf94b9c2794 100644
--- a/common/bitarray.h
+++ b/common/bitarray.h
@@ -48,6 +48,9 @@ public:
 		_bits = (byte*)malloc((bitcount + 7) / 8);
 		clear();
 	}
+	void set_bits(byte *bits) {
+		memcpy(_bits, bits, (_bitcount + 7) / 8);
+	}
 
 	void clear() {
 		memset(_bits, 0, (_bitcount + 7) / 8);


Commit: eac4543f9dd699fb9e541a47f56d2ccdddf44b0a
    https://github.com/scummvm/scummvm/commit/eac4543f9dd699fb9e541a47f56d2ccdddf44b0a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-02-06T13:29:29+01:00

Commit Message:
HYPNO: basic handling of original fonts

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


diff --git a/engines/hypno/arcade.cpp b/engines/hypno/arcade.cpp
index 2f2da778ad5..f2ad9adacc7 100644
--- a/engines/hypno/arcade.cpp
+++ b/engines/hypno/arcade.cpp
@@ -139,7 +139,6 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
 	_levelId = arc->id;
 	_shootSound = arc->shootSound;
 	_hitSound = arc->hitSound;
-	_score = 0;
 	_health = arc->health;
 	_maxHealth = _health;
 	Segments segments = arc->segments;
@@ -264,6 +263,7 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
 			assert(!arc->levelIfLose.empty());
 			_nextLevel = arc->levelIfLose;
 			debugC(1, kHypnoDebugArcade, "Losing level and jumping to %s", _nextLevel.c_str());
+			_lives = _lives - 1;
 			break;
 		}
 
@@ -300,6 +300,7 @@ void HypnoEngine::runArcade(ArcadeShooting *arc) {
 					runIntro(video);
 					assert(!arc->levelIfLose.empty());
 					_nextLevel = arc->levelIfLose;
+					_lives = _lives - 1;
 					_arcadeMode = "";
 					debugC(1, kHypnoDebugArcade, "Losing level (objectives) and jumping to %s", _nextLevel.c_str());
 					break;
diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp
index c27f086c8b4..8efe5ede371 100644
--- a/engines/hypno/hypno.cpp
+++ b/engines/hypno/hypno.cpp
@@ -52,7 +52,7 @@ HypnoEngine::HypnoEngine(OSystem *syst, const ADGameDescription *gd)
 	  _nextHotsToAdd(nullptr), _nextHotsToRemove(nullptr), _font(nullptr),
 	  _levelId(0), _skipLevel(false), _health(0), _maxHealth(0),
 	  _playerFrameIdx(0), _playerFrameSep(0), _refreshConversation(false),
-	  _countdown(0), _timerStarted(false), _score(0),
+	  _countdown(0), _timerStarted(false), _score(0), _lives(0),
 	  _defaultCursor(""), _checkpoint(""),
 	  _currentPlayerPosition(kPlayerLeft), _lastPlayerPosition(kPlayerLeft),
 	  _obj1KillsCount(0), _obj1MissesCount(0),
@@ -127,7 +127,6 @@ Common::Error HypnoEngine::run() {
 
 	_compositeSurface = new Graphics::ManagedSurface();
 	_compositeSurface->create(_screenW, _screenH, _pixelFormat);
-	loadFont(""); // TODO
 
 	// Main event loop
 	loadAssets();
@@ -256,19 +255,12 @@ void HypnoEngine::loadGame(const Common::String &nextLevel, int puzzleDifficulty
 	error("Function \"%s\" not implemented", __FUNCTION__);
 }
 
-void HypnoEngine::loadFont(const Filename &name) {
-	// TODO: properly load some font
-	if (_font)
-		error("Font already loaded");
-
-	_font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
+void HypnoEngine::loadFonts() {
+	error("Function \"%s\" not implemented", __FUNCTION__);
 }
 
-void HypnoEngine::drawString(const Common::String &str, int x, int y, int w, uint32 c) {
-	if (!_font)
-		error("No font was loaded");
-
-	_font->drawString(_compositeSurface, str, x, y, w, c);
+void HypnoEngine::drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c) {
+	error("Function \"%s\" not implemented", __FUNCTION__);
 }
 
 void HypnoEngine::loadImage(const Common::String &name, int x, int y, bool transparent, bool palette, int frameNumber) {
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index 7a8d175f665..907e11f4640 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -233,6 +233,7 @@ public:
 	int _health;
 	int _maxHealth;
 	int _score;
+	int _lives;
 	Filename _shootSound;
 	Filename _hitSound;
 	Shoots _shoots;
@@ -244,8 +245,9 @@ public:
 	uint32 _obj1KillsCount;
 	uint32 _obj1MissesCount;
 
-	void loadFont(const Filename &name);
-	void drawString(const Common::String &str, int x, int y, int w, uint32 c);
+	// Fonts
+	virtual void loadFonts();
+	virtual void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c);
 	const Graphics::Font *_font;
 
 	// Conversation
@@ -282,6 +284,9 @@ public:
 	void loadAssetsPCW();
 	void loadAssetsPCG();
 	void loadAssetsFullGame();
+	void loadFonts() override;
+	void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c) override;
+
 	void showCredits() override;
 	bool clickedSecondaryShoot(const Common::Point &mousePos) override;
 	void drawShoot(const Common::Point &target) override;
@@ -294,8 +299,11 @@ public:
 
 	void runBeforeArcade(ArcadeShooting *arc) override;
 private:
-	uint32 _zone;
 	void runMainMenu(Code *code);
+	void runCheckLives(Code *code);
+
+	Common::BitArray _font05;
+	Common::BitArray _font08;
 };
 
 class SpiderEngine : public HypnoEngine {
@@ -318,6 +326,9 @@ public:
 	Common::String findNextLevel(const Common::String &level) override;
 	Common::String findNextLevel(const Transition *trans) override;
 
+	void loadFonts() override;
+	void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c) override;
+
 	void showConversation() override;
 	void rightClickedConversation(const Common::Point &mousePos) override;
 	void leftClickedConversation(const Common::Point &mousePos) override;
@@ -351,6 +362,9 @@ private:
 	Common::Rect _h2Area;
 	Common::Rect _h3Area; 
 
+	Common::BitArray _font05;
+	Common::BitArray _font08;
+
 };
 
 class BoyzEngine : public HypnoEngine {
diff --git a/engines/hypno/scene.cpp b/engines/hypno/scene.cpp
index 6e4c4e39cc4..59e6b469316 100644
--- a/engines/hypno/scene.cpp
+++ b/engines/hypno/scene.cpp
@@ -276,11 +276,11 @@ void HypnoEngine::runScene(Scene *scene) {
 
 			if (lastCountdown == _countdown) {
 			} else if (_countdown > 0) {
-				uint32 c = _pixelFormat.RGBToColor(255, 0, 0);
+				uint32 c = 251; // red
 				runMenu(stack.back());
 				uint32 minutes = _countdown / 60;
 				uint32 seconds = _countdown % 60;
-				drawString(Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
+				drawString("block05.fgx", Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
 				drawScreen();
 			} else {
 				assert(!scene->levelIfLose.empty());
diff --git a/engines/hypno/spider/arcade.cpp b/engines/hypno/spider/arcade.cpp
index 1cfa01add93..a3535a333b5 100644
--- a/engines/hypno/spider/arcade.cpp
+++ b/engines/hypno/spider/arcade.cpp
@@ -198,7 +198,7 @@ void SpiderEngine::drawHealth() {
 	c = 252; // blue
 	_compositeSurface->frameRect(r, c);
 
-	drawString("ENERGY", 248, 180, 38, c);
+	drawString("block05.fgx", "ENERGY", 248, 180, 38, c);
 }
 
 bool SpiderEngine::checkArcadeLevelCompleted(MVideo &background, Segment segment) {
diff --git a/engines/hypno/spider/spider.cpp b/engines/hypno/spider/spider.cpp
index 273323f7025..54eafb2a3b8 100644
--- a/engines/hypno/spider/spider.cpp
+++ b/engines/hypno/spider/spider.cpp
@@ -58,7 +58,9 @@ void SpiderEngine::loadAssetsFullGame() {
 	if (missions == nullptr || missions->listMembers(files) == 0)
 		error("Failed to load any file from missions.lib");
 
-	//loadLib("", "c_misc/fonts.lib", true);
+	loadLib("", "spider/c_misc/fonts.lib", true);
+	loadFonts();
+
 	loadLib("spider/sound.lib/", "spider/c_misc/sound.lib", true);
 
 	_levels["<quit>"]->prefix = prefix;
@@ -1043,6 +1045,58 @@ Common::String SpiderEngine::findNextLevel(const Transition *trans) {
 	return trans->nextLevel;
 }
 
+void SpiderEngine::loadFonts() {
+	Common::File file;
+
+	if (!file.open("block05.fgx"))
+		error("Cannot open font");
+
+	byte *font = (byte *)malloc(file.size());
+	file.read(font, file.size());
+
+	_font05.set_size(file.size()*8);
+	_font05.set_bits((byte *)font);
+
+	file.close();
+	free(font);
+	if (!file.open("scifi08.fgx"))
+		error("Cannot open font");
+
+	font = (byte *)malloc(file.size());
+	file.read(font, file.size());
+
+	_font08.set_size(file.size()*8);
+	_font08.set_bits((byte *)font);
+
+	free(font);
+}
+
+void SpiderEngine::drawString(const Common::String &font, const Common::String &str, int x, int y, int w, uint32 color) {
+	if (font == "block05.fgx") {
+		for (int c = 0; c < str.size(); c++) {
+			for (int i = 0; i < 5; i++) {
+				for (int j = 0; j < 5; j++) {
+					if (!_font05.get(275 + 40*str[c] + j*8 + i))
+						_compositeSurface->setPixel(x + 5 - i + 6*c, y + j, color);
+				}
+			}
+		}
+	} else if (font == "scifi08.fgx") {
+		for (int c = 0; c < str.size(); c++) {
+			if (str[c] == 0)
+				continue;
+			assert(str[c] >= 32);
+			for (int i = 0; i < 6; i++) {
+				for (int j = 0; j < 8; j++) {
+					if (!_font08.get(1554 + 72*(str[c]-32) + j*8 + i))
+						_compositeSurface->setPixel(x + 6 - i + 7*c, y + j, color);
+				}
+			}
+		}
+	} else
+		error("Invalid font: '%s'", font.c_str());
+}
+
 Common::Error SpiderEngine::loadGameStream(Common::SeekableReadStream *stream) {
 	int puzzleDifficulty = stream->readUint32LE();
 	int combatDifficulty = stream->readUint32LE();
diff --git a/engines/hypno/wet/arcade.cpp b/engines/hypno/wet/arcade.cpp
index ebb09d7dcde..759fe81b482 100644
--- a/engines/hypno/wet/arcade.cpp
+++ b/engines/hypno/wet/arcade.cpp
@@ -120,7 +120,7 @@ void WetEngine::drawPlayer() {
 		Common::Point mousePos = g_system->getEventManager()->getMousePos();
 		int i = detectTarget(mousePos);
 		if (i > 0)
-			drawString("TARGET  ACQUIRED", 120, 1, 80, c);
+			drawString("block05.fgx", "TARGET  ACQUIRED", 120, 1, 80, c);
 
 		_playerFrameIdx++;
 		_playerFrameIdx = _playerFrameIdx % _playerFrameSep;
@@ -137,16 +137,16 @@ void WetEngine::drawHealth() {
 	if (_arcadeMode == "Y1")
 		return;
 
-	uint32 c = 253; //_pixelFormat.RGBToColor(252, 252, 0);
+	uint32 c = 253;
 	int p = (100 * _health) / _maxHealth;
 	int s = _score;
 	if (_playerFrameIdx < _playerFrameSep) {
 		const chapterEntry *entry = _chapterTable[_levelId];
 		//uint32 id = _levelId;
-		drawString(Common::String::format("ENERGY   %d%%", p), entry->energyPos[0], entry->energyPos[1], 65, c);
-		drawString(Common::String::format("SCORE    %04d", s), entry->scorePos[0], entry->scorePos[1], 72, c);
+		drawString("block05.fgx", Common::String::format("ENERGY   %d%%", p), entry->energyPos[0], entry->energyPos[1], 65, c);
+		drawString("block05.fgx", Common::String::format("SCORE    %04d", s), entry->scorePos[0], entry->scorePos[1], 72, c);
 		// Objectives are always in the zero in the demo
-		//drawString(Common::String::format("M.O.     0/0"), uiPos[id][2][0], uiPos[id][2][1], 60, c);
+		//drawString("block05.fgx", Common::String::format("M.O.     0/0"), uiPos[id][2][0], uiPos[id][2][1], 60, c);
 	}
 }
 
diff --git a/engines/hypno/wet/wet.cpp b/engines/hypno/wet/wet.cpp
index 6bc4c8c56c9..aa773b96113 100644
--- a/engines/hypno/wet/wet.cpp
+++ b/engines/hypno/wet/wet.cpp
@@ -19,6 +19,7 @@
  *
  */
 
+#include "common/bitarray.h"
 #include "common/events.h"
 #include "common/config-manager.h"
 
@@ -331,6 +332,7 @@ void WetEngine::loadAssetsFullGame() {
 	//loadArcadeLevel("c602.mi_", "???", "");
 
 	loadLib("", "c_misc/fonts.lib", true);
+	loadFonts();
 	loadLib("sound/", "c_misc/sound.lib", true);
 	_nextLevel = "<start>";
 }
@@ -355,6 +357,65 @@ void WetEngine::runCode(Code *code) {
 		error("invalid hardcoded level: %s", code->name.c_str());
 }
 
+void WetEngine::runCheckLives(Code *code) {
+	if (_lives < 0)
+		_nextLevel = "<game_over>";
+	else
+		_nextLevel = _checkpoint;
+}
+
+void WetEngine::loadFonts() {
+	Common::File file;
+
+	if (!file.open("block05.fgx"))
+		error("Cannot open font");
+
+	byte *font = (byte *)malloc(file.size());
+	file.read(font, file.size());
+
+	_font05.set_size(file.size()*8);
+	_font05.set_bits((byte *)font);
+
+	file.close();
+	free(font);
+	if (!file.open("scifi08.fgx"))
+		error("Cannot open font");
+
+	font = (byte *)malloc(file.size());
+	file.read(font, file.size());
+
+	_font08.set_size(file.size()*8);
+	_font08.set_bits((byte *)font);
+
+	free(font);
+}
+
+void WetEngine::drawString(const Common::String &font, const Common::String &str, int x, int y, int w, uint32 color) {
+	if (font == "block05.fgx") {
+		for (int c = 0; c < str.size(); c++) {
+			for (int i = 0; i < 5; i++) {
+				for (int j = 0; j < 5; j++) {
+					if (!_font05.get(275 + 40*str[c] + j*8 + i))
+						_compositeSurface->setPixel(x + 5 - i + 6*c, y + j, color);
+				}
+			}
+		}
+	} else if (font == "scifi08.fgx") {
+		for (int c = 0; c < str.size(); c++) {
+			if (str[c] == 0)
+				continue;
+			assert(str[c] >= 32);
+			for (int i = 0; i < 6; i++) {
+				for (int j = 0; j < 8; j++) {
+					if (!_font08.get(1554 + 72*(str[c]-32) + j*8 + i))
+						_compositeSurface->setPixel(x + 6 - i + 7*c, y + j, color);
+				}
+			}
+		}
+	} else
+		error("Invalid font: '%s'", font.c_str());
+}
+
 void WetEngine::runMainMenu(Code *code) {
 	Common::Event event;
 	uint32 c = 252; // green
@@ -363,7 +424,7 @@ void WetEngine::runMainMenu(Code *code) {
 	loadPalette(palette, 0, 256);
 	Common::String _name = "";
 	drawImage(*frame, 0, 0, false);
-	drawString("ENTER NAME :", 48, 50, 100, c);
+	drawString("scifi08.fgx", "ENTER NAME :", 48, 50, 100, c);
 	while (!shouldQuit()) {
 
 		while (g_system->getEventManager()->pollEvent(event)) {
@@ -386,8 +447,8 @@ void WetEngine::runMainMenu(Code *code) {
 				}
 
 				drawImage(*frame, 0, 0, false);
-				drawString("ENTER NAME :", 48, 50, 100, c);
-				drawString(_name, 140, 50, 170, c);
+				drawString("scifi08.fgx", "ENTER NAME :", 48, 50, 100, c);
+				drawString("scifi08.fgx", _name, 140, 50, 170, c);
 				break;
 
 


Commit: f9ef8ad6a02016696f1a23aae24c2b29a88c35a9
    https://github.com/scummvm/scummvm/commit/f9ef8ad6a02016696f1a23aae24c2b29a88c35a9
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-02-06T13:29:29+01:00

Commit Message:
HYPNO: font fixes for wet demos

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


diff --git a/engines/hypno/wet/arcade.cpp b/engines/hypno/wet/arcade.cpp
index 759fe81b482..88325eaefad 100644
--- a/engines/hypno/wet/arcade.cpp
+++ b/engines/hypno/wet/arcade.cpp
@@ -28,47 +28,49 @@
 namespace Hypno {
 
 void WetEngine::runBeforeArcade(ArcadeShooting *arc) {
-	Common::Event event;
-	uint32 c = 252; // green
-	byte *palette;
-	Graphics::Surface *frame = decodeFrame("c_misc/zones.smk", (arc->id / 10 - 1) * 2, &palette);
-	loadPalette(palette, 0, 256);
-	byte p[3] = {0xff, 0x00, 0x00}; // Always red?
-	loadPalette((byte *) &p, 240 - arc->id % 10, 1);
-	drawImage(*frame, 0, 0, false);
-	bool showedBriefing = false;
-	bool endedBriefing = false;
 	MVideo *video;
-	while (!shouldQuit() && !endedBriefing) {
-
-		while (g_system->getEventManager()->pollEvent(event)) {
-			// Events
-			switch (event.type) {
+	if (!isDemo()) {
+
+		byte *palette;
+		Graphics::Surface *frame = decodeFrame("c_misc/zones.smk", (arc->id / 10 - 1) * 2, &palette);
+		loadPalette(palette, 0, 256);
+		byte p[3] = {0xff, 0x00, 0x00}; // Always red?
+		loadPalette((byte *) &p, 240 - arc->id % 10, 1);
+		drawImage(*frame, 0, 0, false);
+		bool showedBriefing = false;
+		bool endedBriefing = false;
+		Common::Event event;
+		while (!shouldQuit() && !endedBriefing) {
+
+			while (g_system->getEventManager()->pollEvent(event)) {
+				// Events
+				switch (event.type) {
+
+				case Common::EVENT_QUIT:
+				case Common::EVENT_RETURN_TO_LAUNCHER:
+					break;
 
-			case Common::EVENT_QUIT:
-			case Common::EVENT_RETURN_TO_LAUNCHER:
-				break;
+				case Common::EVENT_KEYDOWN:
+					if (showedBriefing) {
+						endedBriefing = true;
+						break;
+					}
+					if (!arc->briefingVideo.empty()) {
+						video = new MVideo(arc->briefingVideo, Common::Point(44, 22), false, false, false);
+						runIntro(*video);
+						delete video;
+					}
+					showedBriefing = true;
+					break;
 
-			case Common::EVENT_KEYDOWN:
-				if (showedBriefing) {
-					endedBriefing = true;
+				default:
 					break;
 				}
-				if (!arc->briefingVideo.empty()) {
-					video = new MVideo(arc->briefingVideo, Common::Point(44, 22), false, false, false);
-					runIntro(*video);
-					delete video;
-				}
-				showedBriefing = true;
-				break;
-
-			default:
-				break;
 			}
-		}
 
-		drawScreen();
-		g_system->delayMillis(10);
+			drawScreen();
+			g_system->delayMillis(10);
+		}
 	}
 
 	if (!arc->beforeVideo.empty()) {
diff --git a/engines/hypno/wet/wet.cpp b/engines/hypno/wet/wet.cpp
index aa773b96113..18fa5eb6f6b 100644
--- a/engines/hypno/wet/wet.cpp
+++ b/engines/hypno/wet/wet.cpp
@@ -169,6 +169,7 @@ void WetEngine::loadAssetsDemoDisc() {
 	_levels["<gameover>"] = over;
 
 	loadLib("", "wetlands/c_misc/fonts.lib", true);
+	loadFonts();
 	loadLib("wetlands/sound/", "wetlands/c_misc/sound.lib", true);
 	_nextLevel = "<start>";
 }
@@ -193,6 +194,8 @@ void WetEngine::loadAssetsPCW() {
 	_levels["<gameover>"] = over;
 
 	loadLib("", "c_misc/sound.lib", false);
+	loadLib("", "c_misc/fonts.lib", true);
+	loadFonts();
 	_nextLevel = "<start>";
 }
 
@@ -219,6 +222,8 @@ void WetEngine::loadAssetsPCG() {
 	_levels["<gameover>"] = over;
 
 	loadLib("sound/", "sound.lib", false);
+	loadLib("", "fonts.lib", true);
+	loadFonts();
 	_nextLevel = "<start>";
 }
 


Commit: 5d450782014c5c41fbfe95e6fe314b6fbc5a34f7
    https://github.com/scummvm/scummvm/commit/5d450782014c5c41fbfe95e6fe314b6fbc5a34f7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2022-02-06T13:29:29+01:00

Commit Message:
HYPNO: additional font fixes for wet demos

Changed paths:
    engines/hypno/hypno.cpp
    engines/hypno/hypno.h
    engines/hypno/scene.cpp
    engines/hypno/spider/spider.cpp
    engines/hypno/wet/wet.cpp


diff --git a/engines/hypno/hypno.cpp b/engines/hypno/hypno.cpp
index 8efe5ede371..3d8088b3a84 100644
--- a/engines/hypno/hypno.cpp
+++ b/engines/hypno/hypno.cpp
@@ -49,7 +49,7 @@ HypnoEngine *g_hypno;
 HypnoEngine::HypnoEngine(OSystem *syst, const ADGameDescription *gd)
 	: Engine(syst), _gameDescription(gd), _image(nullptr),
 	  _compositeSurface(nullptr), _transparentColor(0),
-	  _nextHotsToAdd(nullptr), _nextHotsToRemove(nullptr), _font(nullptr),
+	  _nextHotsToAdd(nullptr), _nextHotsToRemove(nullptr),
 	  _levelId(0), _skipLevel(false), _health(0), _maxHealth(0),
 	  _playerFrameIdx(0), _playerFrameSep(0), _refreshConversation(false),
 	  _countdown(0), _timerStarted(false), _score(0), _lives(0),
diff --git a/engines/hypno/hypno.h b/engines/hypno/hypno.h
index 907e11f4640..f5373c6eb42 100644
--- a/engines/hypno/hypno.h
+++ b/engines/hypno/hypno.h
@@ -248,7 +248,6 @@ public:
 	// Fonts
 	virtual void loadFonts();
 	virtual void drawString(const Filename &name, const Common::String &str, int x, int y, int w, uint32 c);
-	const Graphics::Font *_font;
 
 	// Conversation
 	Actions _conversation;
@@ -364,7 +363,7 @@ private:
 
 	Common::BitArray _font05;
 	Common::BitArray _font08;
-
+	const Graphics::Font *_font;
 };
 
 class BoyzEngine : public HypnoEngine {
diff --git a/engines/hypno/scene.cpp b/engines/hypno/scene.cpp
index 59e6b469316..7d4394fa42f 100644
--- a/engines/hypno/scene.cpp
+++ b/engines/hypno/scene.cpp
@@ -253,7 +253,6 @@ void HypnoEngine::runTransition(Transition *trans) {
 }
 
 void HypnoEngine::runScene(Scene *scene) {
-	_font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
 	_refreshConversation = false;
 	_timerStarted = false;
 	_conversation.clear();
@@ -280,7 +279,7 @@ void HypnoEngine::runScene(Scene *scene) {
 				runMenu(stack.back());
 				uint32 minutes = _countdown / 60;
 				uint32 seconds = _countdown % 60;
-				drawString("block05.fgx", Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
+				drawString("console", Common::String::format("TIME: %d:%d", minutes, seconds), 80, 10, 60, c);
 				drawScreen();
 			} else {
 				assert(!scene->levelIfLose.empty());
diff --git a/engines/hypno/spider/spider.cpp b/engines/hypno/spider/spider.cpp
index 54eafb2a3b8..6f88975cc9f 100644
--- a/engines/hypno/spider/spider.cpp
+++ b/engines/hypno/spider/spider.cpp
@@ -33,6 +33,7 @@ extern const char *sceneVariables[];
 SpiderEngine::SpiderEngine(OSystem *syst, const ADGameDescription *gd) : HypnoEngine(syst, gd) {
 	_screenW = 640;
 	_screenH = 480;
+	_font = nullptr;
 }
 
 void SpiderEngine::loadAssets() {
@@ -987,7 +988,8 @@ void SpiderEngine::loadAssetsDemo() {
 	loadArcadeLevel("c1.mi_", "sixdemo/mis/demo.mis", prefix);
 	_levels["c1.mi_"]->levelIfLose = "sixdemo/mis/demo.mis";
 
-	loadLib("", "c_misc/fonts.lib", true);
+	loadLib("", "sixdemo/c_misc/fonts.lib", true);
+	loadFonts();
 	loadLib("c_misc/sound.lib/", "c_misc/sound.lib", true);
 	loadLib("demo/sound.lib/", "demo/sound.lib", true);
 
@@ -1069,11 +1071,14 @@ void SpiderEngine::loadFonts() {
 	_font08.set_bits((byte *)font);
 
 	free(font);
+
+	// Additional fonts
+	_font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
 }
 
 void SpiderEngine::drawString(const Common::String &font, const Common::String &str, int x, int y, int w, uint32 color) {
 	if (font == "block05.fgx") {
-		for (int c = 0; c < str.size(); c++) {
+		for (uint32 c = 0; c < str.size(); c++) {
 			for (int i = 0; i < 5; i++) {
 				for (int j = 0; j < 5; j++) {
 					if (!_font05.get(275 + 40*str[c] + j*8 + i))
@@ -1082,7 +1087,7 @@ void SpiderEngine::drawString(const Common::String &font, const Common::String &
 			}
 		}
 	} else if (font == "scifi08.fgx") {
-		for (int c = 0; c < str.size(); c++) {
+		for (uint32 c = 0; c < str.size(); c++) {
 			if (str[c] == 0)
 				continue;
 			assert(str[c] >= 32);
@@ -1093,6 +1098,8 @@ void SpiderEngine::drawString(const Common::String &font, const Common::String &
 				}
 			}
 		}
+	} else if (font == "console") {
+		_font->drawString(_compositeSurface, str, x, y, w, color);
 	} else
 		error("Invalid font: '%s'", font.c_str());
 }
diff --git a/engines/hypno/wet/wet.cpp b/engines/hypno/wet/wet.cpp
index 18fa5eb6f6b..8c64f0c71d6 100644
--- a/engines/hypno/wet/wet.cpp
+++ b/engines/hypno/wet/wet.cpp
@@ -397,7 +397,7 @@ void WetEngine::loadFonts() {
 
 void WetEngine::drawString(const Common::String &font, const Common::String &str, int x, int y, int w, uint32 color) {
 	if (font == "block05.fgx") {
-		for (int c = 0; c < str.size(); c++) {
+		for (uint32 c = 0; c < str.size(); c++) {
 			for (int i = 0; i < 5; i++) {
 				for (int j = 0; j < 5; j++) {
 					if (!_font05.get(275 + 40*str[c] + j*8 + i))
@@ -406,7 +406,7 @@ void WetEngine::drawString(const Common::String &font, const Common::String &str
 			}
 		}
 	} else if (font == "scifi08.fgx") {
-		for (int c = 0; c < str.size(); c++) {
+		for (uint32 c = 0; c < str.size(); c++) {
 			if (str[c] == 0)
 				continue;
 			assert(str[c] >= 32);




More information about the Scummvm-git-logs mailing list