[Scummvm-git-logs] scummvm master -> 974575fce377be7f01e22cc8a4730fec164d433c

neuromancer neuromancer at users.noreply.github.com
Sun Nov 7 21:05:51 UTC 2021


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

Summary:
df6739b5e1 HYPNO: removed debug prints in the parsers
974575fce3 HYPNO: fixed deadlock issue in conversations and support for default option


Commit: df6739b5e139d506da748d4b5d437e1cb9833ae7
    https://github.com/scummvm/scummvm/commit/df6739b5e139d506da748d4b5d437e1cb9833ae7
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-11-07T22:05:37+01:00

Commit Message:
HYPNO: removed debug prints in the parsers

Changed paths:
    engines/hypno/grammar_mis.cpp
    engines/hypno/grammar_mis.y
    engines/hypno/lexer_arc.cpp
    engines/hypno/lexer_arc.l
    engines/hypno/lexer_mis.cpp
    engines/hypno/lexer_mis.l


diff --git a/engines/hypno/grammar_mis.cpp b/engines/hypno/grammar_mis.cpp
index 4a5cf3c45b..132ecfc687 100644
--- a/engines/hypno/grammar_mis.cpp
+++ b/engines/hypno/grammar_mis.cpp
@@ -1582,7 +1582,7 @@ yyreduce:
 
   case 23:
 #line 206 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
-    { debug("implicit END"); }
+    { debugC(1, kHypnoDebugParser, "implicit END"); }
 #line 1587 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
diff --git a/engines/hypno/grammar_mis.y b/engines/hypno/grammar_mis.y
index 83cc64ab85..9786e7efaa 100644
--- a/engines/hypno/grammar_mis.y
+++ b/engines/hypno/grammar_mis.y
@@ -203,7 +203,7 @@ line: MENUTOK mflag mflag  {
 		stack->pop_back();
 		smenu_idx->pop_back();
 	}
-	|	RETTOK { debug("implicit END"); }
+	|	RETTOK { debugC(1, kHypnoDebugParser, "implicit END"); }
 	;
 
 alloctalk: { 
diff --git a/engines/hypno/lexer_arc.cpp b/engines/hypno/lexer_arc.cpp
index 3c9cb5e67f..e9c5106850 100644
--- a/engines/hypno/lexer_arc.cpp
+++ b/engines/hypno/lexer_arc.cpp
@@ -1307,7 +1307,7 @@ YY_RULE_SETUP
 case 40:
 YY_RULE_SETUP
 #line 83 "engines/hypno/lexer_arc.l"
-debug("notparsed: 0x%d",*yytext); return *yytext;
+debugC(1, Hypno::kHypnoDebugParser, "<no match: %c>", *yytext); return *yytext;
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
@@ -2297,7 +2297,6 @@ void yyfree (void * ptr )
 namespace Hypno {
 
 int parse_arc(const char *code) {
-	//debug("to parse:\n%s\n END", code);
 	YY_BUFFER_STATE bp;
 	yy_delete_buffer(YY_CURRENT_BUFFER);
 	bp = yy_scan_string(code);
diff --git a/engines/hypno/lexer_arc.l b/engines/hypno/lexer_arc.l
index 1081776755..27003be1a9 100644
--- a/engines/hypno/lexer_arc.l
+++ b/engines/hypno/lexer_arc.l
@@ -80,13 +80,12 @@ Y[A-Z0-9]					HYPNO_ARC_lval.s = scumm_strdup(HYPNO_ARC_text); return YXTOK;
 \x02						return C02TOK;
 \;.+\r						/* ignore comment */
 [ \t]+						/* ignore whitespace */;
-.							debug("notparsed: 0x%d",*yytext); return *yytext;
+.							debugC(1, Hypno::kHypnoDebugParser, "<no match: %c>", *yytext); return *yytext;
 %%
 
 namespace Hypno {
 
 int parse_arc(const char *code) {
-	//debug("to parse:\n%s\n END", code);
 	YY_BUFFER_STATE bp;
 	yy_delete_buffer(YY_CURRENT_BUFFER);
 	bp = yy_scan_string(code);
diff --git a/engines/hypno/lexer_mis.cpp b/engines/hypno/lexer_mis.cpp
index a47782d0ab..d1e0072b4a 100644
--- a/engines/hypno/lexer_mis.cpp
+++ b/engines/hypno/lexer_mis.cpp
@@ -1383,7 +1383,7 @@ YY_RULE_SETUP
 case 45:
 YY_RULE_SETUP
 #line 87 "engines/hypno/lexer_mis.l"
-debug("<no match: %c>", *yytext); return *yytext;
+debugC(1, Hypno::kHypnoDebugParser, "<no match: %c>", *yytext); return *yytext;
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
diff --git a/engines/hypno/lexer_mis.l b/engines/hypno/lexer_mis.l
index 7d33487966..5e584a73ea 100644
--- a/engines/hypno/lexer_mis.l
+++ b/engines/hypno/lexer_mis.l
@@ -84,7 +84,7 @@ GS_[A-Z_0-9]+				HYPNO_MIS_lval.s = scumm_strdup(HYPNO_MIS_text); return GSSWITC
 [\-]?[0-9]+					HYPNO_MIS_lval.i = atoi(HYPNO_MIS_text); return NUM;
 [\n|\r\n]					return RETTOK;
 [ \t]+						/* ignore whitespace */;
-.							debug("<no match: %c>", *yytext); return *yytext;
+.							debugC(1, Hypno::kHypnoDebugParser, "<no match: %c>", *yytext); return *yytext;
 %%
 
 namespace Hypno {


Commit: 974575fce377be7f01e22cc8a4730fec164d433c
    https://github.com/scummvm/scummvm/commit/974575fce377be7f01e22cc8a4730fec164d433c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2021-11-07T22:05:37+01:00

Commit Message:
HYPNO: fixed deadlock issue in conversations and support for default option

Changed paths:
    engines/hypno/grammar_mis.cpp
    engines/hypno/grammar_mis.y
    engines/hypno/scene.cpp
    engines/hypno/spider/talk.cpp


diff --git a/engines/hypno/grammar_mis.cpp b/engines/hypno/grammar_mis.cpp
index 132ecfc687..3802673ca7 100644
--- a/engines/hypno/grammar_mis.cpp
+++ b/engines/hypno/grammar_mis.cpp
@@ -524,8 +524,8 @@ static const yytype_uint16 yyrline[] =
        0,    74,    74,    77,    84,    85,    89,   101,   107,   122,
      128,   129,   136,   143,   149,   155,   161,   168,   175,   182,
      188,   194,   200,   206,   209,   216,   219,   220,   224,   225,
-     228,   232,   233,   234,   240,   241,   247,   253,   259,   266,
-     273,   279,   284,   285,   288,   289,   292,   293,   296,   297
+     228,   232,   233,   238,   244,   245,   251,   257,   263,   270,
+     277,   283,   288,   289,   292,   293,   296,   297,   300,   301
 };
 #endif
 
@@ -1651,62 +1651,66 @@ yyreduce:
 
   case 32:
 #line 233 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
-    { debugC(1, kHypnoDebugParser, "DEFAULT %s %d %d", (yyvsp[-2].s), (yyvsp[-1].i), (yyvsp[0].i)); }
-#line 1656 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+    { 
+		// Unsure how this is different from second
+		talk_action->second = (yyvsp[-2].s);
+		talk_action->secondPos = Common::Point((yyvsp[-1].i), (yyvsp[0].i));
+		debugC(1, kHypnoDebugParser, "DEFAULT %s %d %d", (yyvsp[-2].s), (yyvsp[-1].i), (yyvsp[0].i)); }
+#line 1660 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 33:
-#line 234 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 238 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "G";
 		talk_cmd.path = (yyvsp[-1].s)+2;
 		talk_action->commands.push_back(talk_cmd); 
 		debugC(1, kHypnoDebugParser, "%s", (yyvsp[-1].s)); }
-#line 1667 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1671 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 34:
-#line 240 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 244 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { debugC(1, kHypnoDebugParser, "%s", (yyvsp[-1].s)); }
-#line 1673 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1677 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 35:
-#line 241 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 245 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "F";
 		talk_cmd.num = atoi((yyvsp[-1].s)+2)-1;
 		talk_action->commands.push_back(talk_cmd); 
 		debugC(1, kHypnoDebugParser, "%s", (yyvsp[-1].s)); }
-#line 1684 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1688 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 36:
-#line 247 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 251 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "A";
 		talk_cmd.num = atoi((yyvsp[-1].s)+2)-1;
 		talk_action->commands.push_back(talk_cmd); 
 		debugC(1, kHypnoDebugParser, "|A%d", talk_cmd.num); }
-#line 1695 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1699 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 37:
-#line 253 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 257 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "D";
 		talk_cmd.num = atoi((yyvsp[-1].s)+2)-1;
 		talk_action->commands.push_back(talk_cmd); 
 		debugC(1, kHypnoDebugParser, "%s", (yyvsp[-1].s)); }
-#line 1706 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1710 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 38:
-#line 259 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 263 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "P";
@@ -1714,11 +1718,11 @@ yyreduce:
 		talk_cmd.position = Common::Point((yyvsp[-2].i), (yyvsp[-1].i));
 		talk_action->commands.push_back(talk_cmd);
 		debugC(1, kHypnoDebugParser, "%s %d %d", (yyvsp[-3].s), (yyvsp[-2].i), (yyvsp[-1].i)); }
-#line 1718 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1722 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 39:
-#line 266 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 270 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "I";
@@ -1726,74 +1730,74 @@ yyreduce:
 		talk_cmd.position = Common::Point((yyvsp[-2].i), (yyvsp[-1].i));
 		talk_action->commands.push_back(talk_cmd);		  
 		debugC(1, kHypnoDebugParser, "%s %d %d", (yyvsp[-3].s), (yyvsp[-2].i), (yyvsp[-1].i)); }
-#line 1730 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1734 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 40:
-#line 273 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 277 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "S";
 		talk_cmd.variable = (yyvsp[-1].s)+2;
 		talk_action->commands.push_back(talk_cmd);
 		debugC(1, kHypnoDebugParser, "%s", (yyvsp[-1].s)); }
-#line 1741 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1745 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 41:
-#line 279 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 283 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "L";
 		talk_action->commands.push_back(talk_cmd);
 		debugC(1, kHypnoDebugParser, "|L"); }
-#line 1751 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1755 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 42:
-#line 284 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 288 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { debugC(1, kHypnoDebugParser, "|E"); }
-#line 1757 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1761 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 44:
-#line 288 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 292 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { (yyval.s) = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "name: %s", (yyvsp[0].s)); }
-#line 1763 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1767 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 45:
-#line 289 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 293 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { (yyval.s) = scumm_strdup(""); }
-#line 1769 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1773 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 46:
-#line 292 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 296 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { (yyval.s) = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "flag: %s", (yyvsp[0].s)); }
-#line 1775 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1779 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 47:
-#line 293 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 297 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { (yyval.s) = scumm_strdup(""); }
-#line 1781 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1785 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 48:
-#line 296 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 300 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { (yyval.s) = (yyvsp[0].s); debugC(1, kHypnoDebugParser, "switch %s", (yyvsp[0].s)); }
-#line 1787 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1791 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
   case 49:
-#line 297 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
+#line 301 "engines/hypno/grammar_mis.y" /* yacc.c:1646  */
     { (yyval.s) = scumm_strdup(""); }
-#line 1793 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1797 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
     break;
 
 
-#line 1797 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
+#line 1801 "engines/hypno/grammar_mis.cpp" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
diff --git a/engines/hypno/grammar_mis.y b/engines/hypno/grammar_mis.y
index 9786e7efaa..7032f165b6 100644
--- a/engines/hypno/grammar_mis.y
+++ b/engines/hypno/grammar_mis.y
@@ -230,7 +230,11 @@ talk: INACTOK talk {
 		talk_action->secondPos = Common::Point($3, $4); 
 		debugC(1, kHypnoDebugParser, "SECOND %s %d %d", $2, $3, $4); }
 	| INTROTOK FILENAME NUM NUM { debugC(1, kHypnoDebugParser, "INTRO %s %d %d", $2, $3, $4); }
-	| DEFAULTTOK FILENAME NUM NUM { debugC(1, kHypnoDebugParser, "DEFAULT %s %d %d", $2, $3, $4); }
+	| DEFAULTTOK FILENAME NUM NUM { 
+		// Unsure how this is different from second
+		talk_action->second = $2;
+		talk_action->secondPos = Common::Point($3, $4);
+		debugC(1, kHypnoDebugParser, "DEFAULT %s %d %d", $2, $3, $4); }
 	| PG talk { 
 		TalkCommand talk_cmd;
 		talk_cmd.command = "G";
diff --git a/engines/hypno/scene.cpp b/engines/hypno/scene.cpp
index 18f570f5f0..75b6e66c77 100644
--- a/engines/hypno/scene.cpp
+++ b/engines/hypno/scene.cpp
@@ -264,12 +264,8 @@ void HypnoEngine::runScene(Scene *scene) {
 					}
 					_videosPlaying.clear();
 
-					if (!_conversation.empty()) {
+					if (!_conversation.empty())
 						_refreshConversation = true;
-					} else if (!stack.empty()) {
-						runMenu(*stack.back());
-						drawScreen();
-					}
 				}
 
 				break;
@@ -355,6 +351,11 @@ void HypnoEngine::runScene(Scene *scene) {
 						delete it->decoder;
 						it->decoder = nullptr;
 						videosToRemove.push_back(i);
+						if (it->scaled) {
+							runMenu(*stack.back());
+							drawScreen();
+						}
+
 					}
 
 				} else if (it->decoder->needsUpdate()) {
@@ -369,15 +370,11 @@ void HypnoEngine::runScene(Scene *scene) {
 				debugC(1, kHypnoDebugScene, "removing %d from %d size", *it, _videosPlaying.size());
 				_videosPlaying.remove_at(*it);
 			}
-
+			debug("Something to play: %d", _videosPlaying.size());
 			// Nothing else to play
-			if (_videosPlaying.empty() && _nextSequentialVideoToPlay.empty()) {
+			if (_videosPlaying.empty() && _nextSequentialVideoToPlay.empty() && !checkSceneCompleted()) {
 				if (!_conversation.empty())
 					_refreshConversation = true;
-				else if (!stack.empty()) {
-					runMenu(*stack.back());
-					drawScreen();
-				}
 			}
 		}
 
@@ -390,6 +387,7 @@ void HypnoEngine::runScene(Scene *scene) {
 				_nextParallelVideoToPlay.empty()) {
 				debugC(1, kHypnoDebugScene, "Wining level and jumping to %s", scene->levelIfWin.c_str());
 				_nextLevel = scene->levelIfWin;
+				continue;
 			}
 		}
 
diff --git a/engines/hypno/spider/talk.cpp b/engines/hypno/spider/talk.cpp
index 3da007a1ec..9aa806ab92 100644
--- a/engines/hypno/spider/talk.cpp
+++ b/engines/hypno/spider/talk.cpp
@@ -59,10 +59,13 @@ void SpiderEngine::showConversation() {
 		}
 	}
 	if (!activeFound) {
+		debugC(1, kHypnoDebugScene, "No active item was found in the current conversation");
 		for (Actions::const_iterator it = _conversation.begin(); it != _conversation.end(); ++it) {
 			Talk *a = (Talk *)*it;
-			if (!a->second.empty())
+			if (!a->second.empty()) {
+				debugC(1, kHypnoDebugScene, "Adding %s to play after the conversation ends", a->second.c_str());
 				_nextParallelVideoToPlay.push_back(MVideo(a->second, a->secondPos, false, false, false));
+			}
 			if (a->escape) {
 				_nextSequentialVideoToPlay = _escapeSequentialVideoToPlay;
 				_escapeSequentialVideoToPlay.clear();
@@ -70,7 +73,7 @@ void SpiderEngine::showConversation() {
 		}
 		debugC(1, kHypnoDebugScene, "Clearing conversation");
 		_conversation.clear();
-		runMenu(*stack.back());
+		//runMenu(*stack.back());
 		drawScreen();
 	} 
 	speaker->free();
@@ -97,6 +100,7 @@ void SpiderEngine::leftClickedConversation(const Common::Point &mousePos) {
 				} else if (it->command == "P") {
 					debugC(1, kHypnoDebugScene, "Playing %s", it->path.c_str());
 					_nextParallelVideoToPlay.push_back(MVideo(it->path, it->position, false, false, false));
+					_refreshConversation = true;
 				} else if (it->command == "S") {
 					debugC(1, kHypnoDebugScene, "Enabling variable %s", it->variable.c_str());
 					_sceneState[it->variable] = 1;




More information about the Scummvm-git-logs mailing list