[Scummvm-git-logs] scummvm master -> 82f22fe4588a7b88be6776bc3f4dcfa49bcf28b7

bluegr noreply at scummvm.org
Sat Mar 5 23:10:21 UTC 2022


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

Summary:
6ea0b5cd52 CHEWY: Cleanup
0c543715ab CHEWY: Handle mouse button up events, instead of button down
82f22fe458 CHEWY: Allow skipping speech with left mouse click


Commit: 6ea0b5cd5201291a55be663a8286d31b2e948dff
    https://github.com/scummvm/scummvm/commit/6ea0b5cd5201291a55be663a8286d31b2e948dff
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-03-06T01:07:48+02:00

Commit Message:
CHEWY: Cleanup

Changed paths:
    engines/chewy/globals.h
    engines/chewy/inits.cpp
    engines/chewy/sound_player.cpp
    engines/chewy/sound_player.h


diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h
index 26c4aa3c1ee..75778b6bea6 100644
--- a/engines/chewy/globals.h
+++ b/engines/chewy/globals.h
@@ -161,7 +161,6 @@ public:
 
 	int16 _talk_start_ani = -1;
 	int16 _talk_hide_static = -1;
-	int16 _frequenz = 0;
 	int16 _currentSong = -1;
 	bool _savegameFlag = false;
 	Common::Stream *_music_handle = nullptr;
@@ -387,7 +386,6 @@ void var_init();
 
 void new_game();
 void sound_init();
-void sound_exit();
 void show_intro();
 void register_cutscene(int cutsceneNum);
 void getCutscenes(Common::Array<int> &cutscenes);
diff --git a/engines/chewy/inits.cpp b/engines/chewy/inits.cpp
index 1baf976e837..08e50913e04 100644
--- a/engines/chewy/inits.cpp
+++ b/engines/chewy/inits.cpp
@@ -276,7 +276,6 @@ void init_load() {
 }
 
 void tidy() {
-	sound_exit();
 	free_buffers();
 	_G(obj)->free_inv_spr(&_G(inv_spr)[0]);
 
@@ -315,13 +314,9 @@ void tidy() {
 	_G(mem) = nullptr;
 }
 
-#define GRAVIS 8
-#define RAP10 9
-
 void sound_init() {
 	_G(spieler).SoundSwitch = false;
 	_G(spieler).MusicSwitch = false;
-	_G(frequenz) = 22050;
 
 	_G(sndPlayer)->initMixMode();
 	_G(spieler).MusicVol = 63;
@@ -350,10 +345,6 @@ void sound_init() {
 	_G(spieler).SpeechSwitch = true;
 }
 
-void sound_exit() {
-	_G(sndPlayer)->exitMixMode();
-}
-
 void show_intro() {
 	if (!ConfMan.getBool("shown_intro")) {
 		ConfMan.setBool("shown_intro", true);
diff --git a/engines/chewy/sound_player.cpp b/engines/chewy/sound_player.cpp
index 848d6113053..bab185618ed 100644
--- a/engines/chewy/sound_player.cpp
+++ b/engines/chewy/sound_player.cpp
@@ -182,19 +182,6 @@ void SoundPlayer::initMixMode() {
 	StereoPos[3] = 90;
 }
 
-void SoundPlayer::exitMixMode() {
-	warning("STUB: ailclass::exitMixMode()");
-
-#if 0
-	if (SoundEnable) {
-		if (TimerEnabled) {
-			AIL_stop_timer(TimerHandle);
-			AIL_release_timer_handle(TimerHandle);
-		}
-	}
-#endif
-}
-
 void SoundPlayer::playMod(TmfHeader *th) {
 	char *tmp;
 	int16 i;
@@ -301,7 +288,6 @@ void mod_irq() {
 	if (!InInterrupt) {
 		++InInterrupt;
 		if (MusicStatus == ON) {
-			checkSampleEnd();
 			if (PatternCount <= 0) {
 				PatternCount = CurrentTempo;
 				DecodePatternLine();
@@ -341,31 +327,6 @@ void mod_irq() {
 	--InInterrupt;
 }
 
-void checkSampleEnd() {
-	warning("STUB: ailclass::checkSampleEnd()");
-
-#if 0
-	int16 i;
-	for (i = 0; i < 4; i++) {
-		if (AIL_sample_status(smp[i]) != SMP_PLAYING) {
-			if (Instrument[i].replen >= 10) {
-				AIL_init_sample(smp[i]);
-				AIL_set_sample_type(smp[i], DIG_F_MONO_8, 0);
-				AIL_set_sample_address(smp[i], Sample[i] +
-				                       Instrument[i].repstart,
-				                       Instrument[i].replen);
-				AIL_set_sample_playback_rate(smp[i], InsFreq[i]);
-				if ((byte)Instrument[i].insvol > (byte)(MusicMasterVol))
-					Instrument[i].insvol = (byte)MusicMasterVol;
-				AIL_set_sample_volume(smp[i], Instrument[i].insvol);
-				AIL_set_sample_pan(smp[i], StereoPos[i]);
-				AIL_start_sample(smp[i]);
-			}
-		}
-	}
-#endif
-}
-
 void DecodePatternLine() {
 	DecodeChannel(0);
 	DecodeChannel(1);
diff --git a/engines/chewy/sound_player.h b/engines/chewy/sound_player.h
index f2e36d7aaad..f3b4dcef5f5 100644
--- a/engines/chewy/sound_player.h
+++ b/engines/chewy/sound_player.h
@@ -28,7 +28,6 @@
 namespace Chewy {
 
 void mod_irq();
-void checkSampleEnd();
 void DecodePatternLine();
 void DecodeChannel(int16 ch);
 
@@ -42,7 +41,6 @@ public:
 
 	void initNoteTable(uint16 sfreq);
 	void initMixMode();
-	void exitMixMode();
 	void playMod(TmfHeader *th);
 	void stopMod();
 	void continueMusic();


Commit: 0c543715abb76eea7a7bc36fc39b1b57022fbed3
    https://github.com/scummvm/scummvm/commit/0c543715abb76eea7a7bc36fc39b1b57022fbed3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-03-06T01:07:49+02:00

Commit Message:
CHEWY: Handle mouse button up events, instead of button down

This helps avoid processing the same mouse button down event in a row
and is in line with how we process mouse events in other engines

Changed paths:
    engines/chewy/dialogs/cinema.cpp
    engines/chewy/dialogs/inventory.cpp
    engines/chewy/events.cpp
    engines/chewy/events.h
    engines/chewy/events_base.cpp
    engines/chewy/events_base.h


diff --git a/engines/chewy/dialogs/cinema.cpp b/engines/chewy/dialogs/cinema.cpp
index 98b3b3d0b06..30e934c863e 100644
--- a/engines/chewy/dialogs/cinema.cpp
+++ b/engines/chewy/dialogs/cinema.cpp
@@ -120,7 +120,7 @@ void Cinema::execute() {
 			flag = false;
 			delay = 0;
 		} else if (flag) {
-			g_events->update(true);
+			g_events->update();
 			if (--delay <= 0)
 				flag = false;
 		}
@@ -192,7 +192,7 @@ void Cinema::execute() {
 			}
 		}
 
-		g_events->update(true);
+		g_events->update();
 		SHOULD_QUIT_RETURN;
 	}
 
diff --git a/engines/chewy/dialogs/inventory.cpp b/engines/chewy/dialogs/inventory.cpp
index a3e5772bfa1..33bc9879a7d 100644
--- a/engines/chewy/dialogs/inventory.cpp
+++ b/engines/chewy/dialogs/inventory.cpp
@@ -367,6 +367,8 @@ void Inventory::menu() {
 	_G(cur)->move(_G(maus_old_x), _G(maus_old_y));
 	_G(minfo).x = _G(maus_old_x);
 	_G(minfo).y = _G(maus_old_y);
+	_G(minfo)._button = 0;
+
 	while (_G(in)->getSwitchCode() == Common::KEYCODE_ESCAPE && !SHOULD_QUIT) {
 		setupScreen(NO_SETUP);
 		_G(cur)->plot_cur();
diff --git a/engines/chewy/events.cpp b/engines/chewy/events.cpp
index d1d46910295..86564e53508 100644
--- a/engines/chewy/events.cpp
+++ b/engines/chewy/events.cpp
@@ -50,14 +50,14 @@ void EventsManager::timer_handler() {
 		++_G(timer_count);
 }
 
-void EventsManager::handleEvent(const Common::Event &event, bool updateOnButtonUp) {
+void EventsManager::handleEvent(const Common::Event &event) {
 	if (event.type >= Common::EVENT_MOUSEMOVE && event.type <= Common::EVENT_MBUTTONUP)
-		handleMouseEvent(event, updateOnButtonUp);
+		handleMouseEvent(event);
 	else if (event.type == Common::EVENT_KEYDOWN || event.type == Common::EVENT_KEYUP)
 		handleKbdEvent(event);
 }
 
-void EventsManager::handleMouseEvent(const Common::Event &event, bool updateOnButtonUp) {
+void EventsManager::handleMouseEvent(const Common::Event &event) {
 	_mousePos = event.mouse;
 	bool isWheelEnabled = !_G(menu_display) && !_G(flags).InventMenu &&
 		g_engine->canSaveAutosaveCurrently() &&
@@ -68,20 +68,12 @@ void EventsManager::handleMouseEvent(const Common::Event &event, bool updateOnBu
 		_G(minfo)._button = 0;
 
 	switch (event.type) {
-	case Common::EVENT_LBUTTONDOWN:
 	case Common::EVENT_LBUTTONUP:
-		if (updateOnButtonUp && event.type == Common::EVENT_LBUTTONUP)
-			_G(minfo)._button = 1;
-		if (!updateOnButtonUp && event.type == Common::EVENT_LBUTTONDOWN)
-			_G(minfo)._button = 1;
+		_G(minfo)._button = 1;
 		break;
 
-	case Common::EVENT_RBUTTONDOWN:
 	case Common::EVENT_RBUTTONUP:
-		if (updateOnButtonUp && event.type == Common::EVENT_RBUTTONUP)
-			_G(minfo)._button = 2;
-		if (!updateOnButtonUp && event.type == Common::EVENT_RBUTTONDOWN)
-			_G(minfo)._button = 2;
+		_G(minfo)._button = 2;
 		break;
 
 	case Common::EVENT_WHEELUP:
diff --git a/engines/chewy/events.h b/engines/chewy/events.h
index 1eada761abb..be5b3f3e955 100644
--- a/engines/chewy/events.h
+++ b/engines/chewy/events.h
@@ -33,10 +33,10 @@ private:
 	void init_timer_handler();
 	static void timer_handler();
 
-	void handleMouseEvent(const Common::Event &event, bool updateOnButtonUp);
+	void handleMouseEvent(const Common::Event &event);
 	void handleKbdEvent(const Common::Event &event);
 protected:
-	void handleEvent(const Common::Event &event, bool updateOnButtonUp) override;
+	void handleEvent(const Common::Event &event) override;
 public:
 	KbdInfo *_kbInfo = nullptr;
 	Common::Point _mousePos;
diff --git a/engines/chewy/events_base.cpp b/engines/chewy/events_base.cpp
index 3d0ee796b70..35dfff63ffb 100644
--- a/engines/chewy/events_base.cpp
+++ b/engines/chewy/events_base.cpp
@@ -59,7 +59,7 @@ void EventsBase::updateScreen() {
 		g_system->updateScreen();
 }
 
-void EventsBase::update(bool updateOnButtonUp) {
+void EventsBase::update() {
 	// Brief pause to prevent 100% CPU usage
 	g_system->delayMillis(10);
 
@@ -72,11 +72,11 @@ void EventsBase::update(bool updateOnButtonUp) {
 
 #define MOUSE_MOVE \
 	if (moveEvent.type != Common::EVENT_INVALID) { \
-		handleEvent(moveEvent, updateOnButtonUp); \
+		handleEvent(moveEvent); \
 		moveEvent.type = Common::EVENT_INVALID; \
 	}
 
-void EventsBase::processEvents(bool updateOnButtonUp) {
+void EventsBase::processEvents() {
 	Common::Event e;
 	Common::Event moveEvent;
 
@@ -89,7 +89,7 @@ void EventsBase::processEvents(bool updateOnButtonUp) {
 		case Common::EVENT_KEYDOWN:
 		case Common::EVENT_KEYUP:
 			MOUSE_MOVE;
-			handleEvent(e, updateOnButtonUp);
+			handleEvent(e);
 			break;
 
 		default:
@@ -99,7 +99,7 @@ void EventsBase::processEvents(bool updateOnButtonUp) {
 				moveEvent = e;
 			} else {
 				MOUSE_MOVE;
-				handleEvent(e, updateOnButtonUp);
+				handleEvent(e);
 				return;
 			}
 			break;
@@ -111,7 +111,7 @@ void EventsBase::processEvents(bool updateOnButtonUp) {
 
 #undef MOUSE_MOVE
 
-void EventsBase::handleEvent(const Common::Event &event, bool updateOnButtonUp) {
+void EventsBase::handleEvent(const Common::Event &event) {
 	if (event.type == Common::EVENT_KEYDOWN) {
 		_pendingKeyEvents.push(event);
 	} else {
diff --git a/engines/chewy/events_base.h b/engines/chewy/events_base.h
index a52adfd100b..c9ea0cce621 100644
--- a/engines/chewy/events_base.h
+++ b/engines/chewy/events_base.h
@@ -67,12 +67,12 @@ protected:
 	/**
 	 * Process any pending events
 	 */
-	void processEvents(bool updateOnButtonUp = false);
+	void processEvents();
 
 	/**
 	 * Handles pending event
 	 */
-	virtual void handleEvent(const Common::Event &event, bool updateOnButtonUp);
+	virtual void handleEvent(const Common::Event &event);
 
 public:
 	Graphics::Screen *_screen;
@@ -89,7 +89,7 @@ public:
 	 * Handles doing a brief delay, checking for timer updates,
 	 * and polling events
 	 */
-	void update(bool updateOnButtonUp = false);
+	void update();
 
 	/**
 	 * Returns true if any unprocessed keyboard events are pending


Commit: 82f22fe4588a7b88be6776bc3f4dcfa49bcf28b7
    https://github.com/scummvm/scummvm/commit/82f22fe4588a7b88be6776bc3f4dcfa49bcf28b7
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-03-06T01:07:49+02:00

Commit Message:
CHEWY: Allow skipping speech with left mouse click

Changed paths:
    engines/chewy/sprite.cpp


diff --git a/engines/chewy/sprite.cpp b/engines/chewy/sprite.cpp
index ec7da61afac..cab6ae43558 100644
--- a/engines/chewy/sprite.cpp
+++ b/engines/chewy/sprite.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "chewy/defines.h"
+#include "chewy/events.h"
 #include "chewy/globals.h"
 #include "chewy/sound.h"
 #include "chewy/detail.h"
@@ -451,6 +452,7 @@ void startAniBlock(int16 nr, const AniBlock *ab) {
 void startAadWait(int16 diaNr) {
 	const int16 oldMouseLeftClick = _G(mouseLeftClick);
 	_G(mouseLeftClick) = false;
+	_G(minfo)._button = 0;
 	_G(talk_start_ani) = -1;
 	_G(talk_hide_static) = -1;
 	setSsiPos();
@@ -460,6 +462,10 @@ void startAadWait(int16 diaNr) {
 		_G(atds)->aadGetStatus() != -1 ||
 		g_engine->_sound->isSpeechActive()
 		)) {
+
+		if (_G(minfo)._button && _G(atds)->aadGetStatus() == -1)
+			g_engine->_sound->stopSpeech();
+
 		setupScreen(DO_SETUP);
 	}
 
@@ -481,6 +487,7 @@ bool startAtsWait(int16 txtNr, int16 txtMode, int16 col, int16 mode) {
 
 	const int16 oldMouseLeftClick = _G(mouseLeftClick);
 	_G(mouseLeftClick) = false;
+	_G(minfo)._button = 0;
 
 	if (!_G(flags).AtsText) {
 		_G(flags).AtsText = true;
@@ -510,6 +517,9 @@ bool startAtsWait(int16 txtNr, int16 txtMode, int16 col, int16 mode) {
 							DISPLAY_TXT : DISPLAY_NONE;
 					}
 
+					if (_G(minfo)._button)
+						g_engine->_sound->stopSpeech();
+
 					setupScreen(DO_SETUP);
 				}
 			}




More information about the Scummvm-git-logs mailing list