[Scummvm-git-logs] scummvm master -> f46d21a7069434d298ac77d92557574b5496039d
dreammaster
paulfgilbert at gmail.com
Sat Jun 13 02:00:50 UTC 2020
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:
4b5c81095b GLK: COMPREHEND: Don't allow blank names at start
fa5ebf2fee GLK: COMPREHEND: Extra blank lines in full-screen text mode
99487000f8 GLK: COMPREHEND: Recognise quit to quit the game
18620d247c GLK: COMPREHEND: Fix save and restore savegame slot selection
f46d21a706 GLK: COMPREHEND: Implement loading savegames from launcher
Commit: 4b5c81095b5ccf59528fac2ff226a0c32381a6eb
https://github.com/scummvm/scummvm/commit/4b5c81095b5ccf59528fac2ff226a0c32381a6eb
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T19:00:16-07:00
Commit Message:
GLK: COMPREHEND: Don't allow blank names at start
Changed paths:
engines/glk/comprehend/comprehend.cpp
engines/glk/comprehend/game_tr.cpp
diff --git a/engines/glk/comprehend/comprehend.cpp b/engines/glk/comprehend/comprehend.cpp
index 70f7306c08..59d791fd79 100644
--- a/engines/glk/comprehend/comprehend.cpp
+++ b/engines/glk/comprehend/comprehend.cpp
@@ -214,6 +214,5 @@ void Comprehend::togglePictureVisibility() {
print(_("Picture window toggled\n"));
}
-
} // namespace Comprehend
} // namespace Glk
diff --git a/engines/glk/comprehend/game_tr.cpp b/engines/glk/comprehend/game_tr.cpp
index abda8a34dd..3ce95c35b3 100644
--- a/engines/glk/comprehend/game_tr.cpp
+++ b/engines/glk/comprehend/game_tr.cpp
@@ -153,6 +153,11 @@ void TransylvaniaGame::handleSpecialOpcode(uint8 operand) {
}
}
+#define READ_LINE do { \
+ g_comprehend->readLine(buffer, sizeof(buffer)); \
+ if (g_comprehend->shouldQuit()) return; \
+ } while (strlen(buffer) == 0)
+
void TransylvaniaGame::beforeGame() {
char buffer[128];
@@ -161,14 +166,14 @@ void TransylvaniaGame::beforeGame() {
// Welcome to Transylvania - sign your name
console_println(_strings[0x20].c_str());
- g_comprehend->readLine(buffer, sizeof(buffer));
+ READ_LINE;
// The player's name is stored in word 0
_replaceWords[0] = Common::String(buffer);
// And your next of kin - This isn't stored by the game
console_println(_strings[0x21].c_str());
- g_comprehend->readLine(buffer, sizeof(buffer));
+ READ_LINE;
}
} // namespace Comprehend
Commit: fa5ebf2feed1d0dccebf2c7da4e0d0e1765e8c02
https://github.com/scummvm/scummvm/commit/fa5ebf2feed1d0dccebf2c7da4e0d0e1765e8c02
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T19:00:16-07:00
Commit Message:
GLK: COMPREHEND: Extra blank lines in full-screen text mode
Changed paths:
engines/glk/comprehend/comprehend.h
engines/glk/comprehend/game.cpp
engines/glk/comprehend/game_data.cpp
diff --git a/engines/glk/comprehend/comprehend.h b/engines/glk/comprehend/comprehend.h
index adb4210c1a..d2af626429 100644
--- a/engines/glk/comprehend/comprehend.h
+++ b/engines/glk/comprehend/comprehend.h
@@ -49,13 +49,13 @@ struct GameStrings {
class Comprehend : public GlkAPI {
private:
int _saveSlot; ///< Save slot when loading savegame from launcher
+ bool _graphicsEnabled;
public:
GraphicsWindow *_topWindow;
TextBufferWindow *_bottomWindow;
DrawSurface *_drawSurface;
ComprehendGame *_game;
Pics *_pics;
- bool _graphicsEnabled;
uint _drawFlags;
private:
@@ -156,9 +156,9 @@ public:
void togglePictureVisibility();
/**
- * Returns true if the picture area is visible
+ * Returns true if the graphics area is visible
*/
- bool isPictureVisible() const {
+ bool isGraphicsEnabled() const {
return _graphicsEnabled;
}
};
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index f226fb6710..bc2a756554 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -330,7 +330,7 @@ void ComprehendGame::update_graphics() {
int type;
uint i;
- if (!g_comprehend->_graphicsEnabled)
+ if (!g_comprehend->isGraphicsEnabled())
return;
type = roomIsSpecial(_currentRoom, NULL);
@@ -1176,7 +1176,6 @@ void ComprehendGame::doBeforeTurn() {
}
void ComprehendGame::doAfterTurn() {
- // Do post turn game specific bits
afterTurn();
}
@@ -1185,9 +1184,15 @@ void ComprehendGame::read_input() {
char *line = NULL, buffer[1024];
bool handled;
+
beforePrompt();
doBeforeTurn();
+ // If we're in full screen text, we can afford a blank row between
+ // any game response and the next line of text
+ if (!g_comprehend->isGraphicsEnabled())
+ g_comprehend->print("\n");
+
for (;;) {
g_comprehend->print("> ");
g_comprehend->readLine(buffer, sizeof(buffer));
diff --git a/engines/glk/comprehend/game_data.cpp b/engines/glk/comprehend/game_data.cpp
index d8cc643fb0..0de5ebc00a 100644
--- a/engines/glk/comprehend/game_data.cpp
+++ b/engines/glk/comprehend/game_data.cpp
@@ -960,7 +960,7 @@ void GameData::loadGame() {
/* Load the main game data file */
loadGameData();
- if (g_comprehend->_graphicsEnabled) {
+ if (g_comprehend->isGraphicsEnabled()) {
// Set up the picture archive
g_comprehend->_pics->load(_locationGraphicFiles,
_itemGraphicFiles, _titleGraphicFile);
Commit: 99487000f83710a53ddb66124d6f3f8628c9bc4f
https://github.com/scummvm/scummvm/commit/99487000f83710a53ddb66124d6f3f8628c9bc4f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T19:00:16-07:00
Commit Message:
GLK: COMPREHEND: Recognise quit to quit the game
Changed paths:
engines/glk/comprehend/game.cpp
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index bc2a756554..0120776794 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -34,17 +34,21 @@ namespace Glk {
namespace Comprehend {
struct Sentence {
- Word words[4];
- size_t nr_words;
+ Word _words[4];
+ size_t _nr_words;
Sentence() {
clear();
}
+ bool empty() const {
+ return _nr_words == 0;
+ }
+
void clear() {
for (uint idx = 0; idx < 4; ++idx)
- words[idx].clear();
- nr_words = 0;
+ _words[idx].clear();
+ _nr_words = 0;
}
};
@@ -1068,18 +1072,23 @@ bool ComprehendGame::handle_sentence(Sentence *sentence) {
Action *action;
uint i, j;
- if (sentence->nr_words == 0)
+ if (sentence->empty())
return false;
+ if (sentence->_nr_words == 1 && !strcmp(sentence->_words[0]._word, "quit")) {
+ g_comprehend->quitGame();
+ return true;
+ }
+
/* Find a matching action */
for (i = 0; i < _actions.size(); i++) {
action = &_actions[i];
if (action->type == ACTION_VERB_OPT_NOUN &&
- sentence->nr_words > action->nr_words + 1)
+ sentence->_nr_words > action->nr_words + 1)
continue;
if (action->type != ACTION_VERB_OPT_NOUN &&
- sentence->nr_words != action->nr_words)
+ sentence->_nr_words != action->nr_words)
continue;
/*
@@ -1087,8 +1096,8 @@ bool ComprehendGame::handle_sentence(Sentence *sentence) {
* run that action's function.
*/
for (j = 0; j < action->nr_words; j++) {
- if (sentence->words[j]._index == action->word[j] &&
- (sentence->words[j]._type & action->word_type[j]))
+ if (sentence->_words[j]._index == action->word[j] &&
+ (sentence->_words[j]._type & action->word_type[j]))
continue;
/* Word didn't match */
@@ -1098,7 +1107,7 @@ bool ComprehendGame::handle_sentence(Sentence *sentence) {
/* Match */
func = &_functions[action->function];
eval_function(func,
- &sentence->words[0], &sentence->words[1]);
+ &sentence->_words[0], &sentence->_words[1]);
return true;
}
}
@@ -1136,28 +1145,28 @@ void ComprehendGame::read_sentence(char **line,
/* Find the dictionary word for this */
word = dict_find_word_by_string(this, word_string);
if (!word)
- sentence->words[sentence->nr_words].clear();
+ sentence->_words[sentence->_nr_words].clear();
else
- sentence->words[sentence->nr_words] = *word;
+ sentence->_words[sentence->_nr_words] = *word;
- sentence->nr_words++;
+ sentence->_nr_words++;
- if (sentence->nr_words > 1) {
- index = sentence->nr_words;
+ if (sentence->_nr_words > 1) {
+ index = sentence->_nr_words;
/* See if this word and the previous are a word pair */
- pair = is_word_pair(&sentence->words[index - 2],
- &sentence->words[index - 1]);
+ pair = is_word_pair(&sentence->_words[index - 2],
+ &sentence->_words[index - 1]);
if (pair) {
- sentence->words[index - 2]._index = pair->index;
- sentence->words[index - 2]._type = pair->type;
- strcpy(sentence->words[index - 2]._word,
+ sentence->_words[index - 2]._index = pair->index;
+ sentence->_words[index - 2]._type = pair->type;
+ strcpy(sentence->_words[index - 2]._word,
"[PAIR]");
- sentence->nr_words--;
+ sentence->_nr_words--;
}
}
- if (sentence->nr_words >= ARRAY_SIZE(sentence->words) ||
+ if (sentence->_nr_words >= ARRAY_SIZE(sentence->_words) ||
sentence_end)
break;
}
Commit: 18620d247cb29fe122158a2d87b162c2b0c02e2e
https://github.com/scummvm/scummvm/commit/18620d247cb29fe122158a2d87b162c2b0c02e2e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T19:00:16-07:00
Commit Message:
GLK: COMPREHEND: Fix save and restore savegame slot selection
Changed paths:
engines/glk/comprehend/game.cpp
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 0120776794..3e691eb593 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -141,15 +141,7 @@ Common::String ComprehendGame::instrStringLookup(uint8 index, uint8 table) {
}
int ComprehendGame::console_get_key() {
- int c, dummy;
-
- dummy = c = g_comprehend->readChar();
-
- /* Clear input buffer */
- while (dummy != '\n' && dummy != EOF)
- dummy = g_comprehend->readChar();
-
- return c;
+ return g_comprehend->readChar();
}
void ComprehendGame::console_println(const char *text) {
@@ -254,6 +246,9 @@ void ComprehendGame::game_save() {
console_println(_strings[STRING_SAVE_GAME].c_str());
c = console_get_key();
+ if (g_comprehend->shouldQuit())
+ return;
+
if (c < '1' || c > '3') {
/*
* The original Comprehend games just silently ignore any
@@ -272,6 +267,9 @@ void ComprehendGame::game_restore() {
console_println(_strings[STRING_RESTORE_GAME].c_str());
c = console_get_key();
+ if (g_comprehend->shouldQuit())
+ return;
+
if (c < '1' || c > '3') {
/*
* The original Comprehend games just silently ignore any
Commit: f46d21a7069434d298ac77d92557574b5496039d
https://github.com/scummvm/scummvm/commit/f46d21a7069434d298ac77d92557574b5496039d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-06-12T19:00:16-07:00
Commit Message:
GLK: COMPREHEND: Implement loading savegames from launcher
Changed paths:
engines/glk/comprehend/comprehend.cpp
engines/glk/comprehend/comprehend.h
engines/glk/comprehend/game.cpp
diff --git a/engines/glk/comprehend/comprehend.cpp b/engines/glk/comprehend/comprehend.cpp
index 59d791fd79..e9b8ef6285 100644
--- a/engines/glk/comprehend/comprehend.cpp
+++ b/engines/glk/comprehend/comprehend.cpp
@@ -98,6 +98,9 @@ void Comprehend::initialize() {
_drawSurface = new DrawSurface();
_pics = new Pics();
SearchMan.add("Pics", _pics, 99, true);
+
+ // Check for savegame to load
+ _saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
void Comprehend::deinitialize() {
@@ -180,6 +183,15 @@ Common::Error Comprehend::writeGameData(Common::WriteStream *ws) {
return Common::kNoError;
}
+bool Comprehend::loadLauncherSavegameIfNeeded() {
+ if (_saveSlot != -1) {
+ return loadGameState(_saveSlot).getCode() == Common::kNoError;
+ }
+
+ return false;
+}
+
+
void Comprehend::drawPicture(uint pictureNum) {
if (_topWindow)
glk_image_draw_scaled(_topWindow, pictureNum,
diff --git a/engines/glk/comprehend/comprehend.h b/engines/glk/comprehend/comprehend.h
index d2af626429..7dd01b15e6 100644
--- a/engines/glk/comprehend/comprehend.h
+++ b/engines/glk/comprehend/comprehend.h
@@ -104,6 +104,11 @@ public:
*/
void runGame() override;
+ /**
+ * Handles loading a savegame selected from the launcher
+ */
+ bool loadLauncherSavegameIfNeeded();
+
/**
* Load a savegame from the passed Quetzal file chunk stream
*/
diff --git a/engines/glk/comprehend/game.cpp b/engines/glk/comprehend/game.cpp
index 3e691eb593..7b968f9433 100644
--- a/engines/glk/comprehend/game.cpp
+++ b/engines/glk/comprehend/game.cpp
@@ -1236,7 +1236,8 @@ void ComprehendGame::read_input() {
}
void ComprehendGame::playGame() {
- beforeGame();
+ if (!g_comprehend->loadLauncherSavegameIfNeeded())
+ beforeGame();
_updateFlags = (uint)UPDATE_ALL;
while (!g_comprehend->shouldQuit())
More information about the Scummvm-git-logs
mailing list