[Scummvm-git-logs] scummvm master -> e9b99223f052efb33cf122e76a3499474ba1397c
dreammaster
dreammaster at scummvm.org
Wed Dec 16 05:04:49 UTC 2020
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:
9a018de617 GLK: COMPREHEND: Implementing Talisman's line/prompt redo
e9b99223f0 GLK: COMPREHEND: Fix bowing to king in Talisman
Commit: 9a018de6178d199a9dce33c76623b21aa33e4924
https://github.com/scummvm/scummvm/commit/9a018de6178d199a9dce33c76623b21aa33e4924
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-12-15T21:04:37-08:00
Commit Message:
GLK: COMPREHEND: Implementing Talisman's line/prompt redo
Changed paths:
engines/glk/comprehend/game.cpp
engines/glk/comprehend/game.h
engines/glk/comprehend/game_oo.cpp
engines/glk/comprehend/game_oo.h
engines/glk/comprehend/game_tm.cpp
engines/glk/comprehend/game_tm.h
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 50928229ef..0556eabf12 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -117,7 +117,7 @@ void Sentence::format() {
ComprehendGame::ComprehendGame() : _gameStrings(nullptr), _ended(false),
_functionNum(0), _specialOpcode(0), _nounState(NOUNSTATE_INITIAL),
- _inputLineIndex(0), _currentRoomCopy(-1) {
+ _inputLineIndex(0), _currentRoomCopy(-1), _redoLine(REDO_NONE) {
Common::fill(&_inputLine[0], &_inputLine[INPUT_LINE_SIZE], 0);
}
@@ -159,6 +159,8 @@ void ComprehendGame::synchronizeSave(Common::Serializer &s) {
for (i = 0; i < _items.size(); ++i)
_items[i].synchronize(s);
+
+ _redoLine = REDO_NONE;
}
Common::String ComprehendGame::stringLookup(uint16 index) {
@@ -833,6 +835,7 @@ void ComprehendGame::read_input() {
Sentence tempSentence;
bool handled;
+turn:
doBeforeTurn();
if (_ended)
return;
@@ -842,9 +845,10 @@ void ComprehendGame::read_input() {
if (!g_comprehend->isGraphicsEnabled())
g_comprehend->print("\n");
- for (;;) {
- beforePrompt();
+ beforePrompt();
+ for (;;) {
+ _redoLine = REDO_NONE;
g_comprehend->print("> ");
g_comprehend->readLine(_inputLine, INPUT_LINE_SIZE);
if (g_comprehend->shouldQuit())
@@ -862,8 +866,12 @@ void ComprehendGame::read_input() {
continue;
}
- if (afterPrompt())
+ afterPrompt();
+
+ if (_redoLine == REDO_NONE)
break;
+ else if (_redoLine == REDO_TURN)
+ goto turn;
}
for (;;) {
diff --git a/engines/glk/comprehend/game.h b/engines/glk/comprehend/game.h
index db58562b5b..98c8db9838 100644
--- a/engines/glk/comprehend/game.h
+++ b/engines/glk/comprehend/game.h
@@ -37,6 +37,8 @@ namespace Comprehend {
enum NounState { NOUNSTATE_STANDARD = 0, NOUNSTATE_QUERY = 1, NOUNSTATE_INITIAL = 2 };
+enum RedoLine { REDO_NONE, REDO_PROMPT, REDO_TURN };
+
struct GameStrings;
struct Sentence;
@@ -82,6 +84,7 @@ protected:
int _currentRoomCopy;
int _functionNum;
int _specialOpcode;
+ RedoLine _redoLine;
public:
const GameStrings *_gameStrings;
@@ -151,9 +154,8 @@ public:
/**
* Called after input has been entered.
- * @returns If false, causes input to be repeated
*/
- virtual bool afterPrompt() { return true; }
+ virtual void afterPrompt() {}
/**
* Called before the start of a game turn
diff --git a/engines/glk/comprehend/game_oo.cpp b/engines/glk/comprehend/game_oo.cpp
index 8db755a3c9..e8e08dab89 100644
--- a/engines/glk/comprehend/game_oo.cpp
+++ b/engines/glk/comprehend/game_oo.cpp
@@ -172,7 +172,7 @@ void OOToposGame::beforePrompt() {
computerConsole();
}
-bool OOToposGame::afterPrompt() {
+void OOToposGame::afterPrompt() {
ComprehendGameV2::afterPrompt();
// WORKAROUND: Allow for the Apple 2 password in the DOS version
@@ -182,8 +182,6 @@ bool OOToposGame::afterPrompt() {
if (_currentRoom != _currentRoomCopy)
_updateFlags |= UPDATE_GRAPHICS;
_currentRoom = _currentRoomCopy;
-
- return true;
}
void OOToposGame::handleSpecialOpcode() {
diff --git a/engines/glk/comprehend/game_oo.h b/engines/glk/comprehend/game_oo.h
index 0c20e4aaf3..788762d9c1 100644
--- a/engines/glk/comprehend/game_oo.h
+++ b/engines/glk/comprehend/game_oo.h
@@ -81,7 +81,7 @@ public:
void beforeGame() override;
void beforeTurn() override;
void beforePrompt() override;
- bool afterPrompt() override;
+ void afterPrompt() override;
int roomIsSpecial(unsigned room_index, unsigned *room_desc_string) override;
void handleSpecialOpcode() override;
bool handle_restart() override;
diff --git a/engines/glk/comprehend/game_tm.cpp b/engines/glk/comprehend/game_tm.cpp
index 85fe7ee169..1933a959aa 100644
--- a/engines/glk/comprehend/game_tm.cpp
+++ b/engines/glk/comprehend/game_tm.cpp
@@ -130,15 +130,15 @@ void TalismanGame::beforePrompt() {
}
}
-bool TalismanGame::afterPrompt() {
+void TalismanGame::afterPrompt() {
if (_savedAction.empty()) {
_functionNum = 19;
handleAction(nullptr);
- return !_flags[3];
+ if (_flags[3])
+ _redoLine = REDO_PROMPT;
} else {
strcpy(_inputLine, _savedAction.c_str());
_savedAction.clear();
- return true;
}
}
@@ -162,6 +162,7 @@ void TalismanGame::handleSpecialOpcode() {
_functionNum = 19;
handleAction(nullptr);
+ _redoLine = REDO_TURN;
break;
case 17:
@@ -171,6 +172,7 @@ void TalismanGame::handleSpecialOpcode() {
_updateFlags |= UPDATE_ALL;
update();
+ _redoLine = REDO_TURN;
break;
default:
diff --git a/engines/glk/comprehend/game_tm.h b/engines/glk/comprehend/game_tm.h
index a69da175db..7a696be773 100644
--- a/engines/glk/comprehend/game_tm.h
+++ b/engines/glk/comprehend/game_tm.h
@@ -43,7 +43,7 @@ public:
void beforeGame() override;
void beforeTurn() override;
void beforePrompt() override;
- bool afterPrompt() override;
+ void afterPrompt() override;
void handleAction(Sentence *sentence) override;
void handleSpecialOpcode() override;
};
Commit: e9b99223f052efb33cf122e76a3499474ba1397c
https://github.com/scummvm/scummvm/commit/e9b99223f052efb33cf122e76a3499474ba1397c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-12-15T21:04:37-08:00
Commit Message:
GLK: COMPREHEND: Fix bowing to king in Talisman
Changed paths:
engines/glk/comprehend/game.cpp
engines/glk/comprehend/game_tm.cpp
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 0556eabf12..9369a58300 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -848,7 +848,7 @@ turn:
beforePrompt();
for (;;) {
- _redoLine = REDO_NONE;
+ _redoLine = REDO_NONE;
g_comprehend->print("> ");
g_comprehend->readLine(_inputLine, INPUT_LINE_SIZE);
if (g_comprehend->shouldQuit())
diff --git a/engines/glk/comprehend/game_tm.cpp b/engines/glk/comprehend/game_tm.cpp
index 1933a959aa..891d4ef26f 100644
--- a/engines/glk/comprehend/game_tm.cpp
+++ b/engines/glk/comprehend/game_tm.cpp
@@ -124,17 +124,15 @@ void TalismanGame::beforeTurn() {
}
void TalismanGame::beforePrompt() {
- if (_nounState == NOUNSTATE_INITIAL) {
- _functionNum = 14;
- handleAction(nullptr);
- }
+ _functionNum = 14;
+ handleAction(nullptr);
}
void TalismanGame::afterPrompt() {
if (_savedAction.empty()) {
_functionNum = 19;
handleAction(nullptr);
- if (_flags[3])
+ if (_redoLine == REDO_NONE && _flags[3])
_redoLine = REDO_PROMPT;
} else {
strcpy(_inputLine, _savedAction.c_str());
More information about the Scummvm-git-logs
mailing list