TINSEL: Implement WhichInventoryOpen for Noir.

This commit is contained in:
Einar Johan Trøan Sømåen 2022-05-07 21:14:25 +02:00
parent 492651b03a
commit 58fa9fa6da
No known key found for this signature in database
GPG Key ID: 0DFF2FB496CF9F93
4 changed files with 12 additions and 3 deletions

View File

@ -57,6 +57,7 @@
#include "tinsel/tinlib.h"
#include "tinsel/tinsel.h" // For engine access
#include "tinsel/token.h"
#include "tinsel/noir/notebook.h"
#include "tinsel/noir/sysreel.h"
#include "common/textconsole.h"
@ -1182,10 +1183,14 @@ bool Dialogs::InventoryActive() {
}
int Dialogs::WhichInventoryOpen() {
if (TinselVersion == 3 && _vm->_notebook->IsOpen()) {
return INV_NOTEBOOK;
}
if (_inventoryState != ACTIVE_INV)
return 0;
else
else {
return _activeInv;
}
}
/**************************************************************************/

View File

@ -64,4 +64,8 @@ void Notebook::Show(bool isOpen) {
error("TODO: Implement Notebook::Show()");
}
bool Notebook::IsOpen() const {
return _state != BOOKSTATE::CLOSED;
}
} // End of namespace Tinsel

View File

@ -64,6 +64,7 @@ public:
void EventToNotebook(PLR_EVENT event, bool p2, bool p3);
// Called from OPENNOTEBOOK
void Show(bool isOpen);
bool IsOpen() const;
private:
const static uint32 MAX_ENTRIES = 100;
const static uint32 MAX_PAGES = 0x15;

View File

@ -5198,8 +5198,7 @@ NoirMapping translateNoirLibCode(int libCode, int32 *pp) {
mapping = NoirMapping{"WHICHCD", WHICHCD, 0};
debug(7, "%s()", mapping.name);
break;
case 208: // WhichInventory is implemented differently in v3, checking notebookstate
warning("TODO: Implement WHICHINVENTORY v3");
case 208:
mapping = NoirMapping{"WHICHINVENTORY", WHICHINVENTORY, 0};
debug(7, "%s()", mapping.name);
break;