[Scummvm-git-logs] scummvm branch-2-6 -> b0565aaaef77c227bfd905f01b2fe78a354b08db

bluegr noreply at scummvm.org
Sun Jul 10 12:26:49 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:
29d982a707 CHEWY: Renaming
4dd9497d20 CHEWY: Fix exiting book closeup - bug #13667
4c75759985 CHEWY: Fix invalid dynamic text assignments - bug #13669
1da0357ca7 CHEWY: Handle more cases where an item is held in hand - bug #13653
b0565aaaef CHEWY: Properly handle video series with embedded music - bug #13672


Commit: 29d982a7074492c5e89c878fe51691141b855a66
    https://github.com/scummvm/scummvm/commit/29d982a7074492c5e89c878fe51691141b855a66
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-10T15:26:18+03:00

Commit Message:
CHEWY: Renaming

Changed paths:
    engines/chewy/defines.h
    engines/chewy/globals.h
    engines/chewy/main.cpp
    engines/chewy/rooms/room28.cpp
    engines/chewy/rooms/room39.cpp
    engines/chewy/rooms/room40.cpp
    engines/chewy/rooms/room41.cpp
    engines/chewy/rooms/room42.cpp
    engines/chewy/rooms/room56.cpp
    engines/chewy/t_event.cpp
    engines/chewy/types.h
    engines/chewy/video/video_player.cpp


diff --git a/engines/chewy/defines.h b/engines/chewy/defines.h
index 21139c90b7a..e22ab6c68be 100644
--- a/engines/chewy/defines.h
+++ b/engines/chewy/defines.h
@@ -319,7 +319,7 @@ enum SetupScreenMode {
 #define CYB_KRONE_INV 29
 #define SCHLAUCH_INV 30
 #define TRICHTER_INV 31
-#define ANGEL_INV 32
+#define FISHINGROD_INV 32
 #define MILCH_INV 33
 #define KNIFE_INV 34
 #define PUMPE_INV 35
@@ -327,14 +327,14 @@ enum SetupScreenMode {
 #define ANGEL2_INV 37
 #define GEBISS_INV 38
 #define H_FUTTER_INV 39
-#define KUERBIS1_INV 40
+#define PUMPKIN_INV 40
 #define K_MASKE_INV 41
 #define K_FLEISCH_INV 42
 #define K_KERNE_INV 43
 #define EIER_INV 44
 #define KAFFEE_INV 45
 #define PUTENKEULE_INV 46
-#define KNOCHEN_INV 47
+#define BONE_INV 47
 #define MANUSKRIPT_INV 48
 #define RECORDER_INV 49
 #define ZAPPER_INV 50
@@ -342,11 +342,11 @@ enum SetupScreenMode {
 #define MILCH_LEER_INV 52
 #define MILCH_WAS_INV 53
 #define PAPIER_INV 54
-#define BRIEF_INV 55
+#define LETTER_INV 55
 #define TICKET_INV 56
 #define ZEITUNG_INV 57
 #define BMARKE_INV 58
-#define BRIEF2_INV 59
+#define STAMPEDLETTER_INV 59
 #define DUENGER_INV 60
 #define LIKOER_INV 61
 #define LIKOER2_INV 62
@@ -354,12 +354,12 @@ enum SetupScreenMode {
 #define CASSETTE_INV 64
 #define HOTEL_INV 65
 #define KAPPE_INV 66
-#define FLASCHE_INV 67
+#define BOTTLE_INV 67
 #define GUM_INV 68
 #define CIGAR_INV 69
 #define KEY_INV 70
 #define BURGER_INV 71
-#define WOLLE_INV 72
+#define WOOL_INV 72
 #define UHR_INV 73
 #define RING_INV 74
 #define SACKGELD_INV 75
diff --git a/engines/chewy/globals.h b/engines/chewy/globals.h
index 9baf0d52ea5..0cca3566dd9 100644
--- a/engines/chewy/globals.h
+++ b/engines/chewy/globals.h
@@ -446,7 +446,7 @@ void endDialogCloseup(int16 diaNr, int16 blkNr, int16 strEndNr);
 
 void atdsStringStart(int16 diaNr, int16 strNr, int16 personNr,
                        int16 mode);
-void calc_inv_use_txt(int16 test_nr);
+void useItemWithInvItem(int16 itemId);
 bool calc_inv_no_use(int16 test_nr, int16 mode);
 int16 calc_person_txt(int16 p_nr);
 int16 calc_person_click(int16 p_nr);
diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index 7bcc51baec8..0dd14979569 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -977,7 +977,7 @@ void evaluateObj(int16 objectId, int16 mode) {
 	case OBJECT_1:
 	case OBJECT_2:
 		if (mode == INVENTORY_NORMAL)
-			calc_inv_use_txt(objectId);
+			useItemWithInvItem(objectId);
 		break;
 
 	case NO_ACTION:
diff --git a/engines/chewy/rooms/room28.cpp b/engines/chewy/rooms/room28.cpp
index 5163688532d..86c0d56dd9f 100644
--- a/engines/chewy/rooms/room28.cpp
+++ b/engines/chewy/rooms/room28.cpp
@@ -39,7 +39,7 @@ void Room28::entry(int16 eib_nr) {
 	if (_G(gameState).R28RKuerbis)
 		_G(det)->showStaticSpr(6);
 
-	if (_G(gameState).R28Briefkasten) {
+	if (_G(gameState).R28LetterBox) {
 		_G(det)->showStaticSpr(8);
 		_G(det)->showStaticSpr(9);
 	} else {
@@ -318,10 +318,10 @@ void Room28::get_pump() {
 int16 Room28::use_breifkasten() {
 	int16 action_flag = false;
 
-	if (_G(gameState).R28Briefkasten && !_G(cur)->usingInventoryCursor()) {
+	if (_G(gameState).R28LetterBox && !_G(cur)->usingInventoryCursor()) {
 		action_flag = true;
 		hideCur();
-		_G(gameState).R28Briefkasten = false;
+		_G(gameState).R28LetterBox = false;
 		autoMove(7, P_CHEWY);
 		start_spz_wait(CH_LGET_O, 1, false, P_CHEWY);
 		_G(det)->hideStaticSpr(8);
diff --git a/engines/chewy/rooms/room39.cpp b/engines/chewy/rooms/room39.cpp
index f919445f834..5bbc266894f 100644
--- a/engines/chewy/rooms/room39.cpp
+++ b/engines/chewy/rooms/room39.cpp
@@ -156,7 +156,7 @@ void Room39::ok() {
 	_G(obj)->show_sib(SIB_ZEITUNG_R27);
 	_G(obj)->calc_rsi_flip_flop(SIB_SURIMY_R27);
 	_G(obj)->calc_rsi_flip_flop(SIB_ZEITUNG_R27);
-	invent_2_slot(BRIEF_INV);
+	invent_2_slot(LETTER_INV);
 
 	switchRoom(27);
 	startAadWait(192);
diff --git a/engines/chewy/rooms/room40.cpp b/engines/chewy/rooms/room40.cpp
index 1fa63514dee..04186d8888a 100644
--- a/engines/chewy/rooms/room40.cpp
+++ b/engines/chewy/rooms/room40.cpp
@@ -108,7 +108,7 @@ void Room40::xit(int16 eib_nr) {
 			_G(gameState)._personRoomNr[P_HOWARD] = 28;
 
 		} else if (eib_nr == 72) {
-			if ((_G(obj)->checkInventory(HOTEL_INV) && _G(obj)->checkInventory(TICKET_INV) && _G(gameState).R42BriefOk && _G(gameState).R28Manuskript)
+			if ((_G(obj)->checkInventory(HOTEL_INV) && _G(obj)->checkInventory(TICKET_INV) && _G(gameState).R42LetterOk && _G(gameState).R28Manuskript)
 				|| _G(gameState).R40TrainOk) {
 				_G(gameState).R40TrainOk = true;
 				_G(gameState)._personRoomNr[P_HOWARD] = 45;
diff --git a/engines/chewy/rooms/room41.cpp b/engines/chewy/rooms/room41.cpp
index 3854dc7d407..a08c5700f42 100644
--- a/engines/chewy/rooms/room41.cpp
+++ b/engines/chewy/rooms/room41.cpp
@@ -214,14 +214,14 @@ int16 Room41::use_brief() {
 	int16 action_flag = false;
 	hideCur();
 
-	if (isCurInventory(BRIEF_INV)) {
+	if (isCurInventory(LETTER_INV)) {
 		action_flag = true;
 		stop_hoggy();
 		autoMove(6, P_CHEWY);
 		startAadWait(126);
 		start_hoggy();
 
-	} else if (isCurInventory(BRIEF2_INV)) {
+	} else if (isCurInventory(STAMPEDLETTER_INV)) {
 		action_flag = true;
 		autoMove(6, P_CHEWY);
 		delInventory(_G(cur)->getInventoryCursor());
@@ -229,10 +229,10 @@ int16 Room41::use_brief() {
 		startAadWait(186);
 		start_hoggy();
 		_G(atds)->set_ats_str(206, 1, ATS_DATA);
-		_G(gameState).R28Briefkasten = true;
+		_G(gameState).R28LetterBox = true;
 		_G(gameState).R40TrainMove = true;
 		_G(gameState).R28PostCar = true;
-		_G(gameState).R42BriefOk = true;
+		_G(gameState).R42LetterOk = true;
 	}
 
 	showCur();
diff --git a/engines/chewy/rooms/room42.cpp b/engines/chewy/rooms/room42.cpp
index d9573b2af72..7570eecadc7 100644
--- a/engines/chewy/rooms/room42.cpp
+++ b/engines/chewy/rooms/room42.cpp
@@ -32,7 +32,7 @@ namespace Chewy {
 namespace Rooms {
 
 void Room42::entry() {
-	if (!_G(gameState).R42BeamterWach) {
+	if (!_G(gameState).R42StationEmployeeAway) {
 		_G(det)->playSound(0, 0);
 		_G(det)->startDetail(0, 255, ANI_FRONT);
 	}
@@ -44,7 +44,7 @@ void Room42::entry() {
 			_G(det)->stopDetail(0);
 			_G(timer_nr)[0] = _G(room)->set_timer(8, 5);
 			_G(det)->set_static_ani(8, -1);
-			_G(gameState).R42BeamterWach = true;
+			_G(gameState).R42StationEmployeeAway = true;
 			_G(det)->stopSound(0);
 
 			_G(SetUpScreenFunc) = setup_func;
@@ -54,10 +54,10 @@ void Room42::entry() {
 			_G(atds)->set_ats_str(264, 1, ATS_DATA);
 		}
 
-		if (_G(obj)->checkInventory(HOTEL_INV) && _G(obj)->checkInventory(TICKET_INV) && !_G(gameState).R42BriefOk)
+		if (_G(obj)->checkInventory(HOTEL_INV) && _G(obj)->checkInventory(TICKET_INV) && !_G(gameState).R42LetterOk)
 			startAadWait(302);
 
-		if (_G(obj)->checkInventory(HOTEL_INV) && _G(obj)->checkInventory(TICKET_INV) && _G(gameState).R42BriefOk)
+		if (_G(obj)->checkInventory(HOTEL_INV) && _G(obj)->checkInventory(TICKET_INV) && _G(gameState).R42LetterOk)
 			startAadWait(301);
 	}
 }
@@ -98,10 +98,10 @@ int16 Room42::useMailBag() {
 		return action_flag;
 
 	hideCur();
-	if (!_G(gameState).R42BeamterWach && !_G(cur)->usingInventoryCursor()) {
+	if (!_G(gameState).R42StationEmployeeAway && !_G(cur)->usingInventoryCursor()) {
 		action_flag = true;
 		getPumpkin(136);
-	} else if (_G(gameState).R42HoToBeamter && !_G(cur)->usingInventoryCursor() && !_G(gameState).R42MarkeOk) {
+	} else if (_G(gameState).R42HoToBeamter && !_G(cur)->usingInventoryCursor() && !_G(gameState).R42StampOk) {
 		action_flag = true;
 		autoMove(3, P_CHEWY);
 		_G(gameState)._personHide[P_CHEWY] = true;
@@ -113,11 +113,11 @@ int16 Room42::useMailBag() {
 		_G(gameState)._personHide[P_CHEWY] = false;
 		new_invent_2_cur(BMARKE_INV);
 		startAadWait(181);
-		_G(gameState).R42MarkeOk = true;
+		_G(gameState).R42StampOk = true;
 		autoMove(4, P_CHEWY);
 		startAadWait(185);
 		_G(gameState).R42HoToBeamter = false;
-	} else if (isCurInventory(BRIEF2_INV)) {
+	} else if (isCurInventory(STAMPEDLETTER_INV)) {
 		action_flag = true;
 		autoMove(3, P_CHEWY);
 		_G(gameState)._personHide[P_CHEWY] = true;
@@ -127,12 +127,11 @@ int16 Room42::useMailBag() {
 		startAadWait(183);
 		_G(obj)->calc_rsi_flip_flop(SIB_BKASTEN_R28);
 		_G(atds)->set_ats_str(206, 1, ATS_DATA);
-		_G(gameState).R28Briefkasten = true;
+		_G(gameState).R28LetterBox = true;
 		_G(gameState).R40TrainMove = true;
 		_G(gameState).R28PostCar = true;
-		_G(gameState).R42BriefOk = true;
-
-	} else if (isCurInventory(BRIEF_INV)) {
+		_G(gameState).R42LetterOk = true;
+	} else if (isCurInventory(LETTER_INV)) {
 		action_flag = true;
 		startAadWait(182);
 	}
@@ -165,9 +164,9 @@ void Room42::talkToStationEmployee() {
 	int16 dia_nr;
 	autoMove(1, P_CHEWY);
 
-	if (!_G(gameState).R42BeamterWach) {
+	if (!_G(gameState).R42StationEmployeeAway) {
 		dia_nr = 10;
-	} else if (!_G(gameState).R42MarkeOk) {
+	} else if (!_G(gameState).R42StampOk) {
 		dia_nr = 13;
 	} else {
 		dia_nr = 14;
diff --git a/engines/chewy/rooms/room56.cpp b/engines/chewy/rooms/room56.cpp
index 9376e2299eb..c850494fa2f 100644
--- a/engines/chewy/rooms/room56.cpp
+++ b/engines/chewy/rooms/room56.cpp
@@ -248,7 +248,7 @@ void Room56::talk_man() {
 
 int16 Room56::use_man() {
 	int16 action_ret = false;
-	if (_G(gameState).flags32_10 || !isCurInventory(FLASCHE_INV))
+	if (_G(gameState).flags32_10 || !isCurInventory(BOTTLE_INV))
 		return action_ret;
 	
 	action_ret = true;
diff --git a/engines/chewy/t_event.cpp b/engines/chewy/t_event.cpp
index 82fbc0ed00c..7522d9e83c4 100644
--- a/engines/chewy/t_event.cpp
+++ b/engines/chewy/t_event.cpp
@@ -2155,11 +2155,11 @@ void atdsStringStart(int16 diaNr, int16 strNr, int16 personNr, int16 mode) {
 #undef START_STOP
 #undef START_STOP_TMP
 
-void calc_inv_use_txt(int16 test_nr) {
+void useItemWithInvItem(int16 itemId) {
 	int scrollx, scrolly;
 	int16 ret;
 
-	switch (test_nr) {
+	switch (itemId) {
 	case NOTEBOOK_OPEN_INV:
 	case MONOCLE_INV:
 		scrollx = _G(gameState).scrollx;
@@ -2176,6 +2176,7 @@ void calc_inv_use_txt(int16 test_nr) {
 			g_events->update();
 			SHOULD_QUIT_RETURN;
 		}
+
 		while (g_events->getSwitchCode() != Common::KEYCODE_INVALID) {
 			g_events->update();
 			SHOULD_QUIT_RETURN;
@@ -2187,20 +2188,20 @@ void calc_inv_use_txt(int16 test_nr) {
 		_G(gameState).scrolly = scrolly;
 		break;
 
-	case ANGEL_INV:
-	case KNOCHEN_INV:
+	case FISHINGROD_INV:
+	case BONE_INV:
 		delInventory(_G(cur)->getInventoryCursor());
 		_G(menu_item) = CUR_USE;
 		cursorChoice(_G(menu_item));
-		ret = del_invent_slot(test_nr);
+		ret = del_invent_slot(itemId);
 		_G(gameState).InventSlot[ret] = ANGEL2_INV;
-		_G(obj)->changeInventory(test_nr, ANGEL2_INV, &_G(room_blk));
+		_G(obj)->changeInventory(itemId, ANGEL2_INV, &_G(room_blk));
 		break;
 
-	case KUERBIS1_INV:
-		ret = del_invent_slot(KUERBIS1_INV);
+	case PUMPKIN_INV:
+		ret = del_invent_slot(PUMPKIN_INV);
 		_G(gameState).InventSlot[ret] = K_MASKE_INV;
-		_G(obj)->changeInventory(KUERBIS1_INV, K_MASKE_INV, &_G(room_blk));
+		_G(obj)->changeInventory(PUMPKIN_INV, K_MASKE_INV, &_G(room_blk));
 		invent_2_slot(K_FLEISCH_INV);
 		invent_2_slot(K_KERNE_INV);
 		break;
@@ -2219,25 +2220,25 @@ void calc_inv_use_txt(int16 test_nr) {
 		}
 		break;
 
-	case BRIEF_INV:
+	case LETTER_INV:
 		delInventory(_G(cur)->getInventoryCursor());
 		_G(menu_item) = CUR_USE;
 		cursorChoice(_G(menu_item));
-		_G(gameState).R42BriefMarke = true;
-		ret = del_invent_slot(BRIEF_INV);
-		_G(gameState).InventSlot[ret] = BRIEF2_INV;
-		_G(obj)->changeInventory(BRIEF_INV, BRIEF2_INV, &_G(room_blk));
+		_G(gameState).R42LetterStamped = true;
+		ret = del_invent_slot(LETTER_INV);
+		_G(gameState).InventSlot[ret] = STAMPEDLETTER_INV;
+		_G(obj)->changeInventory(LETTER_INV, STAMPEDLETTER_INV, &_G(room_blk));
 		break;
 
-	case FLASCHE_INV:
+	case BOTTLE_INV:
 		delInventory(_G(cur)->getInventoryCursor());
 		_G(menu_item) = CUR_USE;
 		cursorChoice(_G(menu_item));
 		// fall through
 
-	case WOLLE_INV:
-		remove_inventory(WOLLE_INV);
-		_G(atds)->set_ats_str(FLASCHE_INV, 1, INV_ATS_DATA);
+	case WOOL_INV:
+		remove_inventory(WOOL_INV);
+		_G(atds)->set_ats_str(BOTTLE_INV, 1, INV_ATS_DATA);
 		_G(gameState).R56WhiskyMix = true;
 		break;
 
@@ -2246,9 +2247,9 @@ void calc_inv_use_txt(int16 test_nr) {
 		delInventory(_G(cur)->getInventoryCursor());
 		_G(menu_item) = CUR_USE;
 		cursorChoice(_G(menu_item));
-		ret = del_invent_slot(test_nr);
+		ret = del_invent_slot(itemId);
 		_G(gameState).InventSlot[ret] = B_MARY2_INV;
-		_G(obj)->changeInventory(test_nr, B_MARY2_INV, &_G(room_blk));
+		_G(obj)->changeInventory(itemId, B_MARY2_INV, &_G(room_blk));
 		break;
 
 	case 13:
@@ -2272,7 +2273,7 @@ void calc_inv_use_txt(int16 test_nr) {
 		_G(menu_item) = CUR_USE;
 		cursorChoice(CUR_USE);
 
-		ret = del_invent_slot(test_nr);
+		ret = del_invent_slot(itemId);
 		_G(gameState).InventSlot[ret] = 110;
 		_G(obj)->changeInventory(104, 110, &_G(room_blk));
 		break;
@@ -2406,7 +2407,7 @@ int16 calc_person_txt(int16 p_nr) {
 				break;
 
 			case 42:
-				if (!_G(gameState).R42MarkeOk && !_G(gameState).R42HoToBeamter) {
+				if (!_G(gameState).R42StampOk && !_G(gameState).R42HoToBeamter) {
 					_G(menu_item) = CUR_HOWARD;
 					cursorChoice(_G(menu_item));
 					txt_nr = 30000;
diff --git a/engines/chewy/types.h b/engines/chewy/types.h
index 3d90a9b1b45..0815781cdf2 100644
--- a/engines/chewy/types.h
+++ b/engines/chewy/types.h
@@ -135,7 +135,7 @@ struct GameFlags {
 	bool R27SurimyOk : 1;
 	bool R28SurimyCar : 1;
 	bool R28ChewyPump : 1;
-	bool R28Briefkasten : 1;
+	bool R28LetterBox : 1;
 	bool R28EntryHaus : 1;
 	bool R28Manuskript : 1;
 
@@ -199,12 +199,12 @@ struct GameFlags {
 	bool R41RepairInfo : 1;
 	bool R41HowardDiaOK : 1;
 	bool R42FirstEntry : 1;
-	bool R42BriefOk : 1;
+	bool R42LetterOk : 1;
 	bool R42HoToBeamter : 1;
 
-	bool R42MarkeOk : 1;
-	bool R42BriefMarke : 1;
-	bool R42BeamterWach : 1;
+	bool R42StampOk : 1;
+	bool R42LetterStamped : 1;
+	bool R42StationEmployeeAway : 1;
 	bool R43GetPgLady : 1;
 	bool R45TaxiOk : 1;
 	bool R45MagOk : 1;
diff --git a/engines/chewy/video/video_player.cpp b/engines/chewy/video/video_player.cpp
index abae8c96f51..84171968199 100644
--- a/engines/chewy/video/video_player.cpp
+++ b/engines/chewy/video/video_player.cpp
@@ -228,7 +228,7 @@ bool VideoPlayer::handleCustom(uint num, uint frame, CfoDecoder *cfoDecoder) {
 		// Room28::cut_serv2 (FCUT_055)
 		if (num != FCUT_055 || frame < 23) {
 			// Room28::cut_serv1 (FCUT_056 / FCUT_064)
-			if (_G(gameState).R28Briefkasten)
+			if (_G(gameState).R28LetterBox)
 				_G(det)->plot_static_details(0, 0, 8, 9);
 			else
 				_G(det)->plot_static_details(0, 0, 7, 7);


Commit: 4dd9497d2044a3ca8fdf3155b284655fbf51cb19
    https://github.com/scummvm/scummvm/commit/4dd9497d2044a3ca8fdf3155b284655fbf51cb19
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-10T15:26:18+03:00

Commit Message:
CHEWY: Fix exiting book closeup - bug #13667

Changed paths:
    engines/chewy/t_event.cpp


diff --git a/engines/chewy/t_event.cpp b/engines/chewy/t_event.cpp
index 7522d9e83c4..61462565d29 100644
--- a/engines/chewy/t_event.cpp
+++ b/engines/chewy/t_event.cpp
@@ -2177,10 +2177,10 @@ void useItemWithInvItem(int16 itemId) {
 			SHOULD_QUIT_RETURN;
 		}
 
-		while (g_events->getSwitchCode() != Common::KEYCODE_INVALID) {
-			g_events->update();
-			SHOULD_QUIT_RETURN;
-		}
+		EVENTS_CLEAR;
+		g_events->_kbInfo._scanCode = Common::KEYCODE_INVALID;
+		g_events->_kbInfo._keyCode = '\0';
+		_G(minfo).button = 0;
 
 		_G(room)->load_tgp(_G(gameState)._personRoomNr[P_CHEWY], &_G(room_blk), EPISODE1_TGP, true, EPISODE1);
 


Commit: 4c75759985f862f1932c25181d5d746dffe4de58
    https://github.com/scummvm/scummvm/commit/4c75759985f862f1932c25181d5d746dffe4de58
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-10T15:26:18+03:00

Commit Message:
CHEWY: Fix invalid dynamic text assignments - bug #13669

Changed paths:
    engines/chewy/r_event.cpp
    engines/chewy/rooms/room12.cpp
    engines/chewy/rooms/room18.cpp
    engines/chewy/types.h


diff --git a/engines/chewy/r_event.cpp b/engines/chewy/r_event.cpp
index 63114ad06da..b4aa5844ec3 100644
--- a/engines/chewy/r_event.cpp
+++ b/engines/chewy/r_event.cpp
@@ -1045,9 +1045,9 @@ int16 sib_event_no_inv(int16 sib_nr) {
 
 	case SIB_CART_FACH_R18:
 		start_spz_wait(CH_LGET_O, 1, false, P_CHEWY);
-		_G(gameState).R18CartFach = 0;
+		_G(gameState).R18CartridgeInSlot = false;
 		cur_2_inventory();
-		_G(atds)->set_ats_str(157, 1, AAD_DATA);
+		_G(atds)->set_ats_str(157, TXT_MARK_LOOK, 0, ATS_DATA);
 		break;
 
 	case SIB_SCHLAUCH_R26:
@@ -1265,7 +1265,7 @@ void sib_event_inv(int16 sib_nr) {
 
 	case SIB_CART_FACH_R18:
 		start_spz_wait(CH_LGET_O, 1, false, P_CHEWY);
-		_G(gameState).R18CartFach = true;
+		_G(gameState).R18CartridgeInSlot = true;
 		delInventory(_G(cur)->getInventoryCursor());
 		_G(det)->showStaticSpr(7);
 		_G(atds)->set_ats_str(157, TXT_MARK_LOOK, 1, ATS_DATA);
diff --git a/engines/chewy/rooms/room12.cpp b/engines/chewy/rooms/room12.cpp
index fe2c8bf1ebb..02a28369cfe 100644
--- a/engines/chewy/rooms/room12.cpp
+++ b/engines/chewy/rooms/room12.cpp
@@ -272,7 +272,7 @@ int16 Room12::useTransformerTube() {
 		if (_G(gameState).R12ChainLeft) {
 			_G(gameState).R12ChainLeft = false;
 			_G(uhr)->enableTimer();
-			_G(atds)->set_ats_str(117, 1, AAD_DATA);
+			_G(atds)->set_ats_str(117, TXT_MARK_LOOK, 0, ATS_DATA);
 		} else {
 			autoMove(7, P_CHEWY);
 			startAadWait(29);
diff --git a/engines/chewy/rooms/room18.cpp b/engines/chewy/rooms/room18.cpp
index 9b174ebdc53..3146499e9ab 100644
--- a/engines/chewy/rooms/room18.cpp
+++ b/engines/chewy/rooms/room18.cpp
@@ -362,7 +362,7 @@ short Room18::use_cart_moni() {
 			startSetAILWait(20, 1, ANI_FRONT);
 			_G(det)->showStaticSpr(23);
 
-			if (_G(gameState).R18CartFach) {
+			if (_G(gameState).R18CartridgeInSlot) {
 				_G(gameState).R18CartSave = true;
 				_G(atds)->set_ats_str(CARTRIDGE_INV, TXT_MARK_LOOK, 1, INV_ATS_DATA);
 				startAadWait(120);
diff --git a/engines/chewy/types.h b/engines/chewy/types.h
index 0815781cdf2..8821700d23a 100644
--- a/engines/chewy/types.h
+++ b/engines/chewy/types.h
@@ -99,7 +99,7 @@ struct GameFlags {
 	bool R17EnergieOut : 1;
 	bool R17DoorKommand : 1;
 	bool R18DoorBruecke : 1;
-	bool R18CartFach : 1;
+	bool R18CartridgeInSlot : 1;
 	bool R18CartTerminal : 1;
 	bool R18CartSave : 1;
 


Commit: 1da0357ca7787035a10015543abfe1c4e53d0479
    https://github.com/scummvm/scummvm/commit/1da0357ca7787035a10015543abfe1c4e53d0479
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-10T15:26:18+03:00

Commit Message:
CHEWY: Handle more cases where an item is held in hand - bug #13653

Changed paths:
    engines/chewy/main.cpp


diff --git a/engines/chewy/main.cpp b/engines/chewy/main.cpp
index 0dd14979569..4c492aa0092 100644
--- a/engines/chewy/main.cpp
+++ b/engines/chewy/main.cpp
@@ -197,6 +197,8 @@ bool mainLoop(int16 mode) {
 	if (_G(flags).MainInput) {
 		switch (g_events->_kbInfo._scanCode) {
 		case Common::KEYCODE_F1:
+			if (_G(cur)->usingInventoryCursor())
+				invent_2_slot(_G(cur)->getInventoryCursor());
 			_G(cur)->setInventoryCursor(-1);
 			_G(menu_item) = CUR_WALK;
 			_G(cur)->showCursor();
@@ -206,6 +208,8 @@ bool mainLoop(int16 mode) {
 			break;
 
 		case Common::KEYCODE_F2:
+			if (_G(cur)->usingInventoryCursor())
+				invent_2_slot(_G(cur)->getInventoryCursor());
 			_G(cur)->setInventoryCursor(-1);
 			_G(menu_item) = CUR_USE;
 			_G(cur)->showCursor();
@@ -215,6 +219,8 @@ bool mainLoop(int16 mode) {
 			break;
 
 		case Common::KEYCODE_F3:
+			if (_G(cur)->usingInventoryCursor())
+				invent_2_slot(_G(cur)->getInventoryCursor());
 			_G(cur)->setInventoryCursor(-1);
 			_G(menu_item) = CUR_LOOK;
 			_G(cur)->showCursor();
@@ -224,6 +230,8 @@ bool mainLoop(int16 mode) {
 			break;
 
 		case Common::KEYCODE_F4:
+			if (_G(cur)->usingInventoryCursor())
+				invent_2_slot(_G(cur)->getInventoryCursor());
 			_G(cur)->setInventoryCursor(-1);
 			_G(menu_item) = CUR_TALK;
 			_G(cur)->showCursor();
@@ -261,6 +269,9 @@ bool mainLoop(int16 mode) {
 
 			_G(out)->setPointer((byte *)g_screen->getPixels());
 			_G(fontMgr)->setFont(_G(font6));
+			if (_G(cur)->usingInventoryCursor())
+				invent_2_slot(_G(cur)->getInventoryCursor());
+			_G(cur)->setInventoryCursor(-1);
 			cursorChoice(CUR_SAVE);
 			if (Dialogs::Files::execute(true) == 1) {
 				retValue = true;
@@ -321,6 +332,8 @@ bool mainLoop(int16 mode) {
 				_G(fontMgr)->setFont(_G(font6));
 
 				_G(out)->setPointer((byte *)g_screen->getPixels());
+				if (_G(cur)->usingInventoryCursor())
+					invent_2_slot(_G(cur)->getInventoryCursor());
 				cursorChoice(CUR_SAVE);
 				bool ret = Dialogs::Files::execute(true);
 				if (ret) {


Commit: b0565aaaef77c227bfd905f01b2fe78a354b08db
    https://github.com/scummvm/scummvm/commit/b0565aaaef77c227bfd905f01b2fe78a354b08db
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-07-10T15:26:19+03:00

Commit Message:
CHEWY: Properly handle video series with embedded music - bug #13672

Changed paths:
    engines/chewy/r_event.cpp
    engines/chewy/sound.cpp
    engines/chewy/sound.h
    engines/chewy/video/cfo_decoder.cpp
    engines/chewy/video/cfo_decoder.h
    engines/chewy/video/video_player.cpp
    engines/chewy/video/video_player.h


diff --git a/engines/chewy/r_event.cpp b/engines/chewy/r_event.cpp
index b4aa5844ec3..e8f8adc3204 100644
--- a/engines/chewy/r_event.cpp
+++ b/engines/chewy/r_event.cpp
@@ -714,16 +714,18 @@ void flic_cut(int16 nr) {
 
 	switch (nr) {
 	case FCUT_SPACECHASE_18:
-		// _G(sndPlayer)->setLoopMode(1)
+		// Play the space chase video, after escaping F5.
+		// The music is placed in the first video of the
+		// series, so we need to keep a copy of it and
+		// dispose it after the series of videos ends.
 		for (i = 0; i < 11 && keepPlaying; i++) {
-			keepPlaying = g_engine->_video->playVideo(FCUT_SPACECHASE_18 + i);
+			keepPlaying = g_engine->_video->playVideo(FCUT_SPACECHASE_18 + i, false, false);
 		}
 
-		// TODO: Reimplement
-		//_G(sndPlayer)->fadeOut(0);
+		g_engine->_sound->stopMusic();
+		g_engine->_sound->disposeMusicBuffer();
 		_G(out)->fadeOut();
 		_G(out)->cls();
-		//while (_G(sndPlayer)->musicPlaying()) {}
 		break;
 
 	case FCUT_058:
diff --git a/engines/chewy/sound.cpp b/engines/chewy/sound.cpp
index 45ccf2d05ae..d5541772710 100644
--- a/engines/chewy/sound.cpp
+++ b/engines/chewy/sound.cpp
@@ -44,6 +44,7 @@ Sound::Sound(Audio::Mixer *mixer) {
 Sound::~Sound() {
 	delete _soundRes;
 	delete _speechRes;
+	delete _overridenMusicBuffer;
 }
 
 void Sound::playSound(int num, uint channel, uint16 loops, uint16 volume, uint16 balance) {
@@ -129,7 +130,13 @@ void Sound::playMusic(int16 num, bool loop) {
 	delete[] data;
 }
 
-void Sound::playMusic(uint8 *data, uint32 size, uint8 volume) {
+void Sound::playMusic(uint8 *data, uint32 size, uint8 volume, bool handleBuffer) {
+	if (handleBuffer) {
+		_overridenMusicBuffer = new uint8[size];
+		memcpy(_overridenMusicBuffer, data, size);
+		data = _overridenMusicBuffer;
+	}
+		
 	TMFStream *stream = new TMFStream(new Common::MemoryReadStream(data, size), 0);
 	_curMusic = -1;
 
@@ -149,6 +156,11 @@ void Sound::stopMusic() {
 	_mixer->stopHandle(_musicHandle);
 }
 
+void Sound::disposeMusicBuffer() {
+	delete[] _overridenMusicBuffer;
+	_overridenMusicBuffer = nullptr;
+}
+
 bool Sound::isMusicActive() const {
 	return _mixer->isSoundHandleActive(_musicHandle);
 }
diff --git a/engines/chewy/sound.h b/engines/chewy/sound.h
index 17cfcc0ab93..cecb0e7b2ca 100644
--- a/engines/chewy/sound.h
+++ b/engines/chewy/sound.h
@@ -60,10 +60,11 @@ public:
 	void setSoundChannelBalance(uint channel, int8 balance);
 
 	void playMusic(int16 num, bool loop = false);
-	void playMusic(uint8 *data, uint32 size, uint8 volume = 63);
+	void playMusic(uint8 *data, uint32 size, uint8 volume = 63, bool handleBuffer = false);
 	void pauseMusic();
 	void resumeMusic();
 	void stopMusic();
+	void disposeMusicBuffer();
 	bool isMusicActive() const;
 	void setUserMusicVolume(uint volume);
 	int getUserMusicVolume() const;
@@ -120,6 +121,7 @@ private:
 
 	SoundResource *_speechRes;
 	SoundResource *_soundRes;
+	uint8 *_overridenMusicBuffer = nullptr;
 };
 
 } // End of namespace Chewy
diff --git a/engines/chewy/video/cfo_decoder.cpp b/engines/chewy/video/cfo_decoder.cpp
index db995614d1a..57d1175dded 100644
--- a/engines/chewy/video/cfo_decoder.cpp
+++ b/engines/chewy/video/cfo_decoder.cpp
@@ -68,12 +68,12 @@ bool CfoDecoder::loadStream(Common::SeekableReadStream *stream) {
 	uint16 width = stream->readUint16LE();
 	uint16 height = stream->readUint16LE();
 
-	addTrack(new CfoVideoTrack(stream, frameCount, width, height, _sound));
+	addTrack(new CfoVideoTrack(stream, frameCount, width, height, _sound, _disposeMusic));
 	return true;
 }
 
-CfoDecoder::CfoVideoTrack::CfoVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, Sound *sound) :
-	Video::FlicDecoder::FlicVideoTrack(stream, frameCount, width, height, true), _sound(sound) {
+CfoDecoder::CfoVideoTrack::CfoVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, Sound *sound, bool disposeMusic) :
+	Video::FlicDecoder::FlicVideoTrack(stream, frameCount, width, height, true), _sound(sound), _disposeMusic(disposeMusic) {
 	readHeader();
 
 	for (int i = 0; i < MAX_SOUND_EFFECTS; i++) {
@@ -99,7 +99,8 @@ CfoDecoder::CfoVideoTrack::~CfoVideoTrack() {
 
 	// Only stop music if it is included in the video data.
 	if (_musicData) {
-		_sound->stopMusic();
+		if (_disposeMusic)
+			_sound->stopMusic();
 		delete[] _musicData;
 		_musicData = nullptr;
 	}
diff --git a/engines/chewy/video/cfo_decoder.h b/engines/chewy/video/cfo_decoder.h
index 41c7864bf4d..e243be51cb9 100644
--- a/engines/chewy/video/cfo_decoder.h
+++ b/engines/chewy/video/cfo_decoder.h
@@ -34,17 +34,18 @@ class Sound;
 // A FLIC decoder, with a modified header and additional custom frames
 class CfoDecoder : public Video::FlicDecoder {
 public:
-	CfoDecoder(Sound *sound) : Video::FlicDecoder(), _sound(sound) {}
+	CfoDecoder(Sound *sound, bool disposeMusic) : Video::FlicDecoder(), _sound(sound), _disposeMusic(disposeMusic) {}
 	~CfoDecoder() override {}
 
 	bool loadStream(Common::SeekableReadStream *stream) override;
 
 private:
 	Sound *_sound;
+	bool _disposeMusic;
 
 	class CfoVideoTrack : public Video::FlicDecoder::FlicVideoTrack {
 	public:
-		CfoVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, Sound *sound);
+		CfoVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, Sound *sound, bool disposeMusic);
 		~CfoVideoTrack() override;
 
 		void readHeader() override;
@@ -57,6 +58,7 @@ private:
 		void fadeOut();
 
 		Sound *_sound;
+		bool _disposeMusic;
 
 		uint8 *_soundEffects[MAX_SOUND_EFFECTS];
 		uint32 _soundEffectSize[MAX_SOUND_EFFECTS];
diff --git a/engines/chewy/video/video_player.cpp b/engines/chewy/video/video_player.cpp
index 84171968199..00c7b0c6729 100644
--- a/engines/chewy/video/video_player.cpp
+++ b/engines/chewy/video/video_player.cpp
@@ -31,8 +31,8 @@
 
 namespace Chewy {
 
-bool VideoPlayer::playVideo(uint num, bool stopMusic) {
-	CfoDecoder *cfoDecoder = new CfoDecoder(g_engine->_sound);
+bool VideoPlayer::playVideo(uint num, bool stopMusic, bool disposeMusic) {
+	CfoDecoder *cfoDecoder = new CfoDecoder(g_engine->_sound, disposeMusic);
 	VideoResource *videoResource = new VideoResource("cut.tap");
 	Common::SeekableReadStream *videoStream = videoResource->getVideoStream(num);
 	_playCount = 0;
diff --git a/engines/chewy/video/video_player.h b/engines/chewy/video/video_player.h
index 28d467568b5..aa12c3d9c7d 100644
--- a/engines/chewy/video/video_player.h
+++ b/engines/chewy/video/video_player.h
@@ -34,9 +34,10 @@ public:
 	 * @Plays a video file
 	 * @param num - the video file number
 	 * @param stopMusic - stop music before starting the video
+	 * @param disposeMusic - dispose music after stopping the video
 	 * @return - true if played, false if skipped
 	*/
-	bool playVideo(uint num, bool stopMusic = true);
+	bool playVideo(uint num, bool stopMusic = true, bool disposeMusic = true);
 
 private:
 	bool handleCustom(uint num, uint frame, CfoDecoder *cfoDecoder);




More information about the Scummvm-git-logs mailing list