diff options
author | Paul Gilbert | 2014-04-21 20:50:05 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-04-21 20:50:05 -0400 |
commit | 692af23f6f0a698e9089fcef0592fcb20e56efa6 (patch) | |
tree | 101e3135a7e22f1e97d40893897b253fbf16d8f1 /engines/mads/user_interface.cpp | |
parent | ff70186855bec22fe77043d89917b189218ff856 (diff) | |
download | scummvm-rg350-692af23f6f0a698e9089fcef0592fcb20e56efa6.tar.gz scummvm-rg350-692af23f6f0a698e9089fcef0592fcb20e56efa6.tar.bz2 scummvm-rg350-692af23f6f0a698e9089fcef0592fcb20e56efa6.zip |
MADS: Create a Globals base class that the games will derive from
Diffstat (limited to 'engines/mads/user_interface.cpp')
-rw-r--r-- | engines/mads/user_interface.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index f775e459b5..346ad2d688 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -231,18 +231,14 @@ void Conversation::setup(int globalId, ...) { if (quoteId < 0) { // For an ending value of -1, also initial the bitflags for the global // associated with the conversation entry, which enables all the quote Ids - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - game->_globals[globalId] = (int16)0xffff; + _vm->_game->globals()[globalId] = (int16)0xffff; } _globalId = globalId; } void Conversation::set(int quoteId, ...) { - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - game->_globals[_globalId] = 0; + _vm->_game->globals()[_globalId] = 0; va_list va; va_start(va, quoteId); @@ -252,7 +248,7 @@ void Conversation::set(int quoteId, ...) { for (uint idx = 0; idx < _quotes.size(); ++idx) { if (_quotes[idx] == quoteId) { // Found index, so set that bit in the global keeping track of conversation state - game->_globals[_globalId] |= 1 << idx; + _vm->_game->globals()[_globalId] |= 1 << idx; break; } } @@ -263,18 +259,15 @@ void Conversation::set(int quoteId, ...) { } void Conversation::write(int quoteId, bool flag) { - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - for (uint idx = 0; idx < _quotes.size(); ++idx) { if (_quotes[idx] == quoteId) { // Found index, so set or clear the flag if (flag) { // Set bit - game->_globals[_globalId] |= 1 << idx; + _vm->_game->globals()[_globalId] |= 1 << idx; } else { // Clear bit - game->_globals[_globalId] &= ~(1 << idx); + _vm->_game->globals()[_globalId] &= ~(1 << idx); } return; } @@ -282,17 +275,15 @@ void Conversation::write(int quoteId, bool flag) { } void Conversation::start() { - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - UserInterface &userInterface = game->_scene._userInterface; + UserInterface &userInterface = _vm->_game->_scene._userInterface; userInterface.emptyConversationList(); // Loop through each of the quotes loaded into the conversation for (uint idx = 0; idx < _quotes.size(); ++idx) { // Check whether the given quote is enabled or not - if (game->_globals[_globalId] & (1 << idx)) { + if (_vm->_game->globals()[_globalId] & (1 << idx)) { // Quote enabled, so add it to the list of talk selections - Common::String msg = game->getQuote(_quotes[idx]); + Common::String msg = _vm->_game->getQuote(_quotes[idx]); userInterface.addConversationMessage(_quotes[idx], msg); } } |