void HiRes1Engine::drawItems() { Common::List<Item>::iterator item; uint dropped = 0; for (item = _state.items.begin(); item != _state.items.end(); ++item) { // Skip items not in this room if (item->room != _state.room) continue; if (item->state == IDI_ITEM_DROPPED) { // Draw dropped item if in normal view if (getCurRoom().picture == getCurRoom().curPicture) drawItem(*item, _itemOffsets[dropped++]); } else { // Draw fixed item if current view is in the pic list Common::Array<byte>::const_iterator pic; for (pic = item->roomPictures.begin(); pic != item->roomPictures.end(); ++pic) { if (*pic == getCurRoom().curPicture) { drawItem(*item, item->position); break; } } } } }
int AdlEngine_v2::o2_isFirstTime(ScriptEnv &e) { OP_DEBUG_0("\t&& IS_FIRST_TIME()"); bool oldFlag = getCurRoom().isFirstTime; getCurRoom().isFirstTime = false; if (!oldFlag) return -1; return 0; }
void HiRes1Engine::showRoom() { _state.curPicture = getCurRoom().curPicture; clearScreen(); loadRoom(_state.room); if (!_state.isDark) { drawPic(getCurRoom().curPicture); drawItems(); } _display->updateHiResScreen(); _messageDelay = false; printString(_roomData.description); _messageDelay = true; }
void AdlEngine_v2::takeItem(byte noun) { Common::List<Item>::iterator item; for (item = _state.items.begin(); item != _state.items.end(); ++item) { if (item->noun != noun || item->room != _state.room) continue; if (item->state == IDI_ITEM_DOESNT_MOVE) { printMessage(_messageIds.itemDoesntMove); return; } if (item->state == IDI_ITEM_DROPPED) { item->room = IDI_ANY; _itemRemoved = true; return; } Common::Array<byte>::const_iterator pic; for (pic = item->roomPictures.begin(); pic != item->roomPictures.end(); ++pic) { if (*pic == getCurRoom().curPicture || *pic == IDI_ANY) { item->room = IDI_ANY; _itemRemoved = true; item->state = IDI_ITEM_DROPPED; return; } } } printMessage(_messageIds.itemNotHere); }
void AdlEngine_v2::showRoom() { bool redrawPic = false; if (_state.room != _roomOnScreen) { loadRoom(_state.room); clearScreen(); if (!_state.isDark) redrawPic = true; } else { if (getCurRoom().curPicture != _picOnScreen || _itemRemoved) redrawPic = true; } if (redrawPic) { _roomOnScreen = _state.room; _picOnScreen = getCurRoom().curPicture; drawPic(getCurRoom().curPicture); _itemRemoved = false; _itemsOnScreen = 0; Common::List<Item>::iterator item; for (item = _state.items.begin(); item != _state.items.end(); ++item) item->isOnScreen = false; } if (!_state.isDark) drawItems(); _display->updateHiResScreen(); printString(_roomData.description); // FIXME: move to main loop? _linesPrinted = 0; }
int AdlEngine_v2::o2_setRoomFromVar(ScriptEnv &e) { OP_DEBUG_1("\tROOM = VAR[%d]", e.arg(1)); getCurRoom().curPicture = getCurRoom().picture; _state.room = getVar(e.arg(1)); return 1; }
int AdlEngine_v2::o2_setPic(ScriptEnv &e) { OP_DEBUG_1("\tSET_PIC(%d)", e.arg(1)); getCurRoom().picture = getCurRoom().curPicture = _state.curPicture = e.arg(1); return 1; }