[Scummvm-git-logs] scummvm master -> 01744d778dd9632454c5120a5fcef040d120b26d

Strangerke noreply at scummvm.org
Tue Apr 14 06:04:40 UTC 2026


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

Summary:
01744d778d WAYNESWORLD: Implement demo1 part 2, some refactoring


Commit: 01744d778dd9632454c5120a5fcef040d120b26d
    https://github.com/scummvm/scummvm/commit/01744d778dd9632454c5120a5fcef040d120b26d
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-04-14T08:01:13+02:00

Commit Message:
WAYNESWORLD: Implement demo1 part 2, some refactoring

Changed paths:
    engines/waynesworld/sound.cpp
    engines/waynesworld/sound.h
    engines/waynesworld/wwintro.cpp
    engines/waynesworld/wwintro.h
    engines/waynesworld/wwintro_demo1.cpp
    engines/waynesworld/wwintro_full.cpp


diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index 02acf7789f8..c40dc95a882 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -43,7 +43,7 @@ SoundManager::~SoundManager() {
 	delete _effectsHandle;
 }
 
-void SoundManager::playSound(const char *filename, int flag) {
+void SoundManager::playSound(const char *filename, bool flag) {
 	while (isSFXPlaying())
 		_vm->waitMillis(10);
 
@@ -61,10 +61,6 @@ void SoundManager::playSound(const char *filename, int flag) {
 	Common::SeekableReadStream *rawStream = new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
 	Audio::RewindableAudioStream *audioStream = Audio::makeRawStream(rawStream, 9000, Audio::FLAG_UNSIGNED);
 
-/*
-	if (loop)
-		Audio::LoopingAudioStream *loopingStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::NO));
-*/
 	if (!_mixer->isSoundHandleActive(*_effectsHandle)) {
 		_mixer->playStream(Audio::Mixer::kSFXSoundType, _effectsHandle, audioStream, -1, _mixer->kMaxChannelVolume, 0, DisposeAfterUse::NO);
 	}
diff --git a/engines/waynesworld/sound.h b/engines/waynesworld/sound.h
index b5f8a082026..c7874daac35 100644
--- a/engines/waynesworld/sound.h
+++ b/engines/waynesworld/sound.h
@@ -49,7 +49,7 @@ public:
 	SoundManager(WaynesWorldEngine *vm, Audio::Mixer *mixer);
 	~SoundManager();
 
-	void playSound(const char *filename, int flag);
+	void playSound(const char *filename, bool flag);
 	bool isSFXPlaying();
 
 	void syncVolume();
diff --git a/engines/waynesworld/wwintro.cpp b/engines/waynesworld/wwintro.cpp
index 942f94e00ef..0be495f805c 100644
--- a/engines/waynesworld/wwintro.cpp
+++ b/engines/waynesworld/wwintro.cpp
@@ -102,4 +102,35 @@ void WWIntro::wwEffect(int arg0, int arg1, bool flag) {
 	_vm->waitMillis(200);
 }
 
+void WWIntro::setColor236(int index) {
+	byte newColor[3] = {0, 0, 0};
+	static const byte rArr[] = {9, 9, 9, 9, 43, 43, 53, 63, 63, 63, 63, 63, 63, 63, 45, 28, 9, 9, 9};
+	static const byte gArr[] = {33, 33, 40, 47, 47, 47, 47, 47, 35, 23, 0, 0, 0, 0, 0, 0, 0, 33, 33};
+	static const byte bArr[] = {29, 20, 20, 20, 20, 0, 0, 0, 0, 0, 0, 23, 37, 50, 50, 50, 50, 50, 40};
+
+	newColor[0] = rArr[index] * 4;
+	newColor[1] = gArr[index] * 4;
+	newColor[2] = bArr[index] * 4;
+
+	g_system->getPaletteManager()->setPalette((const byte *)&newColor, 236, 1);
+}
+
+void WWIntro::introPt3_init() {
+	_backg2Surface = new WWSurface(320, 170);
+	_logoSurface = new WWSurface(226, 134);
+	_outlineSurface = new WWSurface(226, 134);
+
+	_vm->drawImageToSurface(_oanGxl, "backg2.pcx", _backg2Surface, 0, 0);
+	_vm->drawImageToSurface(_oanGxl, "logo.pcx", _logoSurface, 0, 0);
+	_vm->drawImageToSurface(_oanGxl, "outline.pcx", _outlineSurface, 0, 0);
+}
+
+void WWIntro::introPt3_clean() {
+	delete _outlineSurface;
+	delete _logoSurface;
+	delete _backg2Surface;
+
+	_outlineSurface = _logoSurface = _backg2Surface = nullptr;
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/wwintro.h b/engines/waynesworld/wwintro.h
index 150ac2636fe..17e0605fdd6 100644
--- a/engines/waynesworld/wwintro.h
+++ b/engines/waynesworld/wwintro.h
@@ -58,7 +58,10 @@ protected:
 	GxlArchive *_oanGxl = nullptr;
 
 	bool initOanGxl();
-	void wwEffect(int arg0, int arg1, bool flag);
+	void wwEffect(int arg0, int arg1, bool flag = false);
+	void setColor236(int index);
+	void introPt3_init();
+	void introPt3_clean();
 };
 
 class WWIntro_full : public WWIntro {
@@ -89,7 +92,6 @@ private:
 	void sub3009A(int textId);
 	void sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int arg_gBodyIndex, int arg_wHead1Index, int arg_gHead1Index, int arg_TextId);
 
-	void cleanPt3();
 	void introPt4_init();
 	bool introPt4_intro();
 	bool introPt4_displayCallInTime();
@@ -116,6 +118,7 @@ public:
 
 private:
 	bool introPt1();
+	bool introPt2();
 };
 } // End of namespace WaynesWorld
 
diff --git a/engines/waynesworld/wwintro_demo1.cpp b/engines/waynesworld/wwintro_demo1.cpp
index 9e01c32fa66..b8427b9c82d 100644
--- a/engines/waynesworld/wwintro_demo1.cpp
+++ b/engines/waynesworld/wwintro_demo1.cpp
@@ -40,6 +40,9 @@ void WWIntro_demo1::runIntro() {
 
 	if (continueFl)
 		introPt1();
+
+	if (continueFl)
+		introPt2();
 }
 
 bool WWIntro_demo1::introPt1() {
@@ -143,4 +146,45 @@ bool WWIntro_demo1::introPt1() {
 	return true;
 }
 
+bool WWIntro_demo1::introPt2() {
+	// sub1 - Parameter is always 'true' so it has been removed and the code simplified
+	_vm->paletteFadeOut(0, 256, 64);
+	_vm->_screen->clear(0);
+	_vm->loadPalette(_oanGxl, "backg1.pcx");
+	_vm->paletteFadeOut(0, 256, 64);
+	
+	introPt3_init();
+	// End of sub1
+
+	_demoPt2Surface->clear(0);
+	_demoPt2Surface->drawSurface(_logoSurface, 47, 25);
+	wwEffect(1, 0);
+	_vm->paletteFadeIn(0, 256, 6);
+
+	_vm->playSound("theme1.snd", 0);
+
+	wwEffect(1, 1);
+	wwEffect(1, 2);
+	wwEffect(1, 3);
+
+	for (int i = 0; i < 24; ++i) {
+		setColor236(i % 19);
+		wwEffect((i % 8) + 1, 4);
+	}
+
+	wwEffect(1, 3);
+	wwEffect(1, 2);
+	wwEffect(1, 1);
+	wwEffect(1, 0);
+
+	while (_vm->_sound->isSFXPlaying())
+		_vm->waitMillis(30);
+
+	_vm->_sound->playSound("exclnt.snd", false);
+
+	introPt3_clean();
+
+	return true;
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/wwintro_full.cpp b/engines/waynesworld/wwintro_full.cpp
index 3b7053f1add..ab3cbb55c40 100644
--- a/engines/waynesworld/wwintro_full.cpp
+++ b/engines/waynesworld/wwintro_full.cpp
@@ -189,22 +189,8 @@ bool WWIntro_full::introPt1() {
 	return true;
 }
 
-void WWIntro_full::cleanPt3() {
-	delete _outlineSurface;
-	delete _logoSurface;
-	delete _backg2Surface;
-}
-
 bool WWIntro_full::introPt3(bool flag) {
-	// sub1
-	_backg2Surface = new WWSurface(320, 170);
-	_logoSurface = new WWSurface(226, 134);
-	_outlineSurface = new WWSurface(226, 134);
-
-	_vm->drawImageToSurface(_oanGxl, "backg2.pcx", _backg2Surface, 0, 0);
-	_vm->drawImageToSurface(_oanGxl, "logo.pcx", _logoSurface, 0, 0);
-	_vm->drawImageToSurface(_oanGxl, "outline.pcx", _outlineSurface, 0, 0);
-	// End of sub1
+	introPt3_init();
 
 	wwEffect(1, 0, flag);
 
@@ -212,7 +198,7 @@ bool WWIntro_full::introPt3(bool flag) {
 		_vm->waitSeconds(1);
 
 	if (_vm->_escPressed) {
-		cleanPt3();
+		introPt3_clean();
 		return false;
 	}
 
@@ -221,26 +207,16 @@ bool WWIntro_full::introPt3(bool flag) {
 	wwEffect(1, 2, flag);
 	wwEffect(1, 3, flag);
 	if (_vm->_escPressed) {
-		cleanPt3();
+		introPt3_clean();
 		return false;
 	}
 
-	byte newColor[3] = {0, 0, 0};
-	static const byte rArr[] = { 9,  9,  9,  9, 43, 43, 53, 63, 63, 63, 63, 63, 63, 63, 45, 28,  9,  9,  9};
-	static const byte gArr[] = {33, 33, 40, 47, 47, 47, 47, 47, 35, 23,  0,  0,  0,  0,  0,  0,  0, 33, 33};
-	static const byte bArr[] = {29, 20, 20, 20, 20,  0,  0,  0,  0,  0,  0, 23, 37, 50, 50, 50, 50, 50, 40};
-
 	for (int i = 0; i < 32; ++i) {
-		const int index = (i % 19);
-		newColor[0] = rArr[index] * 4;
-		newColor[1] = gArr[index] * 4;
-		newColor[2] = bArr[index] * 4;
-
-		g_system->getPaletteManager()->setPalette((const byte *)&newColor, 236, 1);
+		setColor236(i % 19);
 		wwEffect((i % 8) + 1, 4, flag);
 
 		if (_vm->_escPressed) {
-			cleanPt3();
+			introPt3_clean();
 			return false;
 		}
 	}
@@ -250,7 +226,7 @@ bool WWIntro_full::introPt3(bool flag) {
 	wwEffect(1, 1, flag);
 	wwEffect(1, 0, flag);
 	if (_vm->_escPressed) {
-		cleanPt3();
+		introPt3_clean();
 		return false;
 	}
 
@@ -262,7 +238,7 @@ bool WWIntro_full::introPt3(bool flag) {
 	_vm->waitSeconds(1);
 	_vm->paletteFadeOut(0, 256, 4);
 
-	cleanPt3();
+	introPt3_clean();
 
 	if (_vm->_escPressed) {
 		return false;
@@ -581,7 +557,7 @@ bool WWIntro_full::introPt4_caller1() {
 		++_startOawPos;
 	}
 
-	_vm->_sound->playSound("sv33.snd", 0);
+	_vm->_sound->playSound("sv33.snd", false);
 	for (int j = 0; j < 10; ++j) {
 		sub2FEFB(1, 0, 1, _vm->getRandom(3), 9, 0);
 		if (_vm->_escPressed) {
@@ -598,7 +574,7 @@ bool WWIntro_full::introPt4_caller1() {
 		}
 	}
 
-	_vm->_sound->playSound("sv38.snd", 0);
+	_vm->_sound->playSound("sv38.snd", false);
 
 	for (int j = 0; j < 10; ++j) {
 		sub2FEFB(1, 0, 1, _vm->getRandom(3), 9, 0);
@@ -623,7 +599,7 @@ bool WWIntro_full::introPt4_caller1() {
 		}
 	}
 	++_startOagPos;
-	_vm->_sound->playSound("sv31.snd", 0);
+	_vm->_sound->playSound("sv31.snd", false);
 
 	for (int i = 0; i < 3; ++i) {
 		sub2FEFB(1, 0, 1, _vm->getRandom(3), _vm->getRandom(11), 2);
@@ -642,7 +618,7 @@ bool WWIntro_full::introPt4_caller1() {
 		}
 		++_startOawPos;
 	}
-	_vm->_sound->playSound("sv28.snd", 0);
+	_vm->_sound->playSound("sv28.snd", false);
 
 	for (int j = 0; j < 5; ++j) {
 		sub2FEFB(1, 0, 1, _vm->getRandom(3), 9, 0);
@@ -651,7 +627,7 @@ bool WWIntro_full::introPt4_caller1() {
 		}
 	}
 	++_startOawPos;
-	_vm->_sound->playSound("sv21.snd", 0);
+	_vm->_sound->playSound("sv21.snd", false);
 
 	for (int i = 0; i < 3; ++i) {
 		sub2FEFB(1, 0, 1, _vm->getRandom(3), _vm->getRandom(11), 2);
@@ -825,7 +801,9 @@ bool WWIntro_full::introPt4_caller3() {
 	}
 	++_startOawPos;
 	++_startOagPos;
-	_vm->_sound->playSound("sv46.snd", true);
+	_vm->_sound->playSound("sv46.snd", false);
+	while (_vm->_sound->isSFXPlaying())
+		_vm->waitMillis(30);
 
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
@@ -915,8 +893,14 @@ bool WWIntro_full::introPt4_caller4() {
 		++_startOagPos;
 	}
 
-	_vm->_sound->playSound("sv37.snd", true);
-	_vm->_sound->playSound("sv24.snd", true);
+	_vm->_sound->playSound("sv37.snd", false);
+	while (_vm->_sound->isSFXPlaying())
+		_vm->waitMillis(30);
+	
+	_vm->_sound->playSound("sv24.snd", false);
+	
+	while (_vm->_sound->isSFXPlaying())
+		_vm->waitMillis(30);
 
 	for (int i = 0; i < 15; ++i) {
 		sub2FEFB(1, 0, 1, _vm->getRandom(3), 9, 0);
@@ -1001,7 +985,9 @@ bool WWIntro_full::introPt4_caller4() {
 		}
 	}
 
-	_vm->_sound->playSound("sv45.snd", true);
+	_vm->_sound->playSound("sv45.snd", false);
+	while (_vm->_sound->isSFXPlaying())
+		_vm->waitMillis(30);
 
 	for (int j = 0; j < 3; ++j) {
 		for (int i = 0; i < 8; ++i) {




More information about the Scummvm-git-logs mailing list