void KyraEngine_v2::addItemToAnimList(int item) { assert(item >= 0 && item < _itemListSize); restorePage3(); AnimObj *animObj = _animItems + item; animObj->enabled = 1; animObj->needRefresh = 1; int itemId = _itemList[item].id; animObj->xPos2 = animObj->xPos1 = _itemList[item].x; animObj->yPos2 = animObj->yPos1 = _itemList[item].y; animObj->shapePtr = getShapePtr(itemId + _desc.itemShapeStart); animSetupPaletteEntry(animObj); animObj->shapeIndex2 = animObj->shapeIndex1 = itemId + _desc.itemShapeStart; int scaleY, scaleX; scaleY = scaleX = getScale(animObj->xPos1, animObj->yPos1); uint8 *shapePtr = getShapePtr(itemId + _desc.itemShapeStart); animObj->xPos3 = (animObj->xPos2 -= (screen_v2()->getShapeScaledWidth(shapePtr, scaleX) >> 1)); animObj->yPos3 = (animObj->yPos2 -= screen_v2()->getShapeScaledHeight(shapePtr, scaleY)); animObj->width2 = animObj->height2 = 0; _animList = addToAnimListSorted(_animList, animObj); animObj->needRefresh = 1; }
void KyraEngine_HoF::updateItemAnimations() { bool nextFrame = false; if (_itemAnimData[0].itemIndex == -1 || _inventorySaved) return; const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem]; ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; _nextAnimItem = (_nextAnimItem + 1) % _itemAnimDataSize; uint32 ctime = _system->getMillis(); if (ctime < a->nextFrame) return; uint16 shpIdx = s->frames[a->currentFrame].index + 64; if (s->itemIndex == _mouseState && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { nextFrame = true; _screen->setMouseCursor(8, 15, getShapePtr(shpIdx)); } for (int i = 0; i < 10; i++) { if (s->itemIndex == _mainCharacter.inventory[i]) { nextFrame = true; _screen->drawShape(2, getShapePtr(240 + i), 304, 184, 0, 0); _screen->drawShape(2, getShapePtr(shpIdx), 304, 184, 0, 0); _screen->copyRegion(304, 184, _inventoryX[i], _inventoryY[i], 16, 16, 2, 0); } } _screen->updateScreen(); for (int i = 11; i < 40; i++) { AnimObj *animObject = &_animObjects[i]; if (animObject->shapeIndex2 == s->itemIndex + 64) { if (s->itemIndex == 121) { int f = findItem(_mainCharacter.sceneId, 121); int nx = _itemList[f].x - 4; if (nx > 12) { if (lineIsPassable(nx, _itemList[f].y)) { animObject->xPos2 -= 4; _itemList[f].x -= 4; } } } animObject->shapePtr = getShapePtr(shpIdx); animObject->shapeIndex1 = shpIdx; animObject->needRefresh = 1; nextFrame = true; } } if (nextFrame) { a->nextFrame = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength); a->currentFrame = (a->currentFrame + 1) % s->numFrames; } }
void KyraEngine_MR::updateItemAnimations() { bool nextFrame = false; if (_itemAnimData[0].itemIndex == -1) return; const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem]; ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem]; _nextAnimItem = (_nextAnimItem + 1) % 10; uint32 ctime = _system->getMillis(); if (ctime < a->nextFrame) return; uint16 shpIdx = s->frames[a->currentFrame].index + 248; if (s->itemIndex == _mouseState && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { nextFrame = true; _screen->setMouseCursor(12, 19, getShapePtr(shpIdx)); } if (_inventoryState) { for (int i = 0; i < 10; i++) { if (s->itemIndex == _mainCharacter.inventory[i]) { nextFrame = true; _screen->drawShape(2, getShapePtr(422 + i), 9, 0, 0, 0); _screen->drawShape(2, getShapePtr(shpIdx), 9, 0, 0, 0); _screen->hideMouse(); _screen->copyRegion(9, 0, _inventoryX[i], _inventoryY[i], 24, 20, 2, 0, Screen::CR_NO_P_CHECK); _screen->showMouse(); } } } _screen->updateScreen(); for (int i = 17; i < 66; i++) { AnimObj *animObject = &_animObjects[i]; if (animObject->shapeIndex2 == s->itemIndex + 248) { animObject->shapePtr = getShapePtr(shpIdx); animObject->shapeIndex1 = shpIdx; animObject->needRefresh = true; nextFrame = true; } } if (nextFrame) { a->nextFrame = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength); a->currentFrame = (a->currentFrame + 1) % s->numFrames; } }
void KyraEngine_MR::drawCharacterAnimObject(AnimObj *obj, int x, int y, int layer) { if (_drawNoShapeFlag) return; if (_mainCharacter.animFrame < 9) _mainCharacter.animFrame = 87; if (obj->shapeIndex1 == 0xFFFF || _mainCharacter.animFrame == 87) return; _screen->drawShape(2, getShapePtr(421), _mainCharacter.x3, _mainCharacter.y3, 2, obj->flags | 0x304, _paletteOverlay, 3, layer, _charScale, _charScale); uint8 *shape = getShapePtr(_mainCharacter.animFrame); if (shape) _screen->drawShape(2, shape, x, y, 2, obj->flags | 4, layer, _charScale, _charScale); }
int KyraEngine_MR::o3_wipeDownMouseItem(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o3_wipeDownMouseItem(%p) (-, %d, %d)", (const void *)script, stackPos(1), stackPos(2)); _screen->hideMouse(); const int x = stackPos(1) - 12; const int y = stackPos(2) - 19; if (_itemInHand >= 0) { backUpGfxRect32x32(x, y); uint8 *shape = getShapePtr(_itemInHand+248); for (int curY = y, height = 20; height > 0; height -= 2, curY += 2) { restoreGfxRect32x32(x, y); _screen->setNewShapeHeight(shape, height); const uint32 waitTime = _system->getMillis() + _tickLength; _screen->drawShape(0, shape, x, curY, 0, 0); _screen->updateScreen(); delayUntil(waitTime); } restoreGfxRect32x32(x, y); _screen->resetShapeHeight(shape); } _screen->showMouse(); removeHandItem(); return 0; }
void KyraEngine_HoF::drawSceneAnimObject(AnimObj *obj, int x, int y, int layer) { if (obj->type == 1) { if (obj->shapeIndex1 == 0xFFFF) return; int scale = getScale(obj->xPos1, obj->yPos1); _screen->drawShape(2, getShapePtr(obj->shapeIndex1), x, y, 2, obj->flags | 4, layer, scale, scale); return; } if (obj->shapePtr) { _screen->drawShape(2, obj->shapePtr, x, y, 2, obj->flags, layer); } else { if (obj->shapeIndex3 == 0xFFFF || obj->animNum == 0xFFFF) return; int flags = 0x4000; if (obj->flags & 0x800) flags |= 0x8000; if (_sceneAnims[obj->animNum].wsaFlag) { x = y = 0; } else { x = obj->xPos2; y = obj->yPos2; } _sceneAnimMovie[obj->animNum]->displayFrame(obj->shapeIndex3, 2, x, y, int(flags | layer), 0, 0); } }
void KyraEngine_HoF::updateCharacterAnim(int) { Character *c = &_mainCharacter; AnimObj *animState = _animObjects; animState->needRefresh = 1; animState->specialRefresh = 1; if (c->facing >= 1 && c->facing <= 3) animState->flags |= 1; else if (c->facing >= 5 && c->facing <= 7) animState->flags &= ~1; animState->xPos2 = animState->xPos1 = c->x1; animState->yPos2 = animState->yPos1 = c->y1; animState->shapePtr = getShapePtr(c->animFrame); animState->shapeIndex1 = animState->shapeIndex2 = c->animFrame; int xAdd = _shapeDescTable[c->animFrame-9].xAdd; int yAdd = _shapeDescTable[c->animFrame-9].yAdd; _charScale = getScale(c->x1, c->y1); animState->xPos2 += (xAdd * _charScale) >> 8; animState->yPos2 += (yAdd * _charScale) >> 8; animState->width2 = 8; animState->height2 = 10; _animList = deleteAnimListEntry(_animList, animState); if (_animList) _animList = addToAnimListSorted(_animList, animState); else _animList = initAnimList(_animList, animState); updateCharPal(1); }
Common::Error KyraEngine_HoF::init() { _screen = new Screen_HoF(this, _system); assert(_screen); _screen->setResolution(); _debugger = new Debugger_HoF(this); assert(_debugger); KyraEngine_v1::init(); initStaticResource(); _text = new TextDisplayer_HoF(this, _screen); assert(_text); _gui = new GUI_HoF(this); assert(_gui); _gui->initStaticData(); _tim = new TIMInterpreter(this, _screen, _system); assert(_tim); if (_flags.isDemo && !_flags.isTalkie) { _screen->loadFont(_screen->FID_8_FNT, "FONT9P.FNT"); } else { _screen->loadFont(_screen->FID_6_FNT, "6.FNT"); _screen->loadFont(_screen->FID_8_FNT, "8FAT.FNT"); _screen->loadFont(_screen->FID_BOOKFONT_FNT, "BOOKFONT.FNT"); } _screen->loadFont(_screen->FID_GOLDFONT_FNT, "GOLDFONT.FNT"); _screen->setFont(_flags.lang == Common::JA_JPN ? Screen::FID_SJIS_FNT : _screen->FID_8_FNT); _screen->setAnimBlockPtr(3504); _screen->setScreenDim(0); if (!_sound->init()) error("Couldn't init sound"); _abortIntroFlag = false; if (_sequenceStrings) { for (int i = 0; i < MIN(33, _sequenceStringsSize); i++) _sequenceStringsDuration[i] = (int) strlen(_sequenceStrings[i]) * 8; } // No mouse display in demo if (_flags.isDemo && !_flags.isTalkie) return Common::kNoError; _res->exists("PWGMOUSE.SHP", true); uint8 *shapes = _res->fileData("PWGMOUSE.SHP", 0); assert(shapes); for (int i = 0; i < 2; i++) addShapeToPool(shapes, i, i); delete[] shapes; _screen->setMouseCursor(0, 0, getShapePtr(0)); return Common::kNoError; }
void KyraEngine_v2::removeHandItem() { Screen *scr = screen(); scr->hideMouse(); scr->setMouseCursor(0, 0, getShapePtr(0)); _itemInHand = kItemNone; _mouseState = kItemNone; scr->showMouse(); }
void KyraEngine_HoF::redrawInventory(int page) { int pageBackUp = _screen->_curPage; _screen->_curPage = page; const Item *inventory = _mainCharacter.inventory; for (int i = 0; i < 10; ++i) { clearInventorySlot(i, page); if (inventory[i] != kItemNone) { _screen->drawShape(page, getShapePtr(inventory[i]+64), _inventoryX[i], _inventoryY[i], 0, 0); drawInventoryShape(page, inventory[i], i); } } _screen->updateScreen(); _screen->_curPage = pageBackUp; }
void KyraEngine_MR::updateCharacterAnim(int charId) { AnimObj *obj = &_animObjects[0]; obj->needRefresh = true; obj->flags &= ~1; obj->xPos1 = _mainCharacter.x1; obj->yPos1 = _mainCharacter.y1; obj->shapePtr = getShapePtr(_mainCharacter.animFrame); obj->shapeIndex1 = obj->shapeIndex2 = _mainCharacter.animFrame; int shapeOffsetX = 0, shapeOffsetY = 0; if (_mainCharacter.animFrame >= 50 && _mainCharacter.animFrame <= 87) { shapeOffsetX = _malcolmShapeXOffset; shapeOffsetY = _malcolmShapeYOffset; } else { shapeOffsetX = _animShapeXAdd; shapeOffsetY = _animShapeYAdd; } obj->xPos2 = _mainCharacter.x1; obj->yPos2 = _mainCharacter.y1; _charScale = getScale(_mainCharacter.x1, _mainCharacter.y1); obj->xPos2 += (shapeOffsetX * _charScale) >> 8; obj->yPos2 += (shapeOffsetY * _charScale) >> 8; _mainCharacter.x3 = _mainCharacter.x1 - (_charScale >> 4) - 1; _mainCharacter.y3 = _mainCharacter.y1 - (_charScale >> 6) - 1; if (_charBackUpWidth2 == -1) { obj->width2 = 4; obj->height2 = 10; } for (int i = 1; i <= 16; ++i) { if (_animObjects[i].enabled && _animObjects[i].specialRefresh) _animObjects[i].needRefresh = true; } _animList = deleteAnimListEntry(_animList, obj); if (_animList) _animList = addToAnimListSorted(_animList, obj); else _animList = initAnimList(_animList, obj); if (!_loadingState) updateCharPal(1); }
void KyraEngine_MR::drawSceneAnimObject(AnimObj *obj, int x, int y, int layer) { if (obj->type == 1) { if (obj->shapeIndex1 == 0xFFFF) return; int scale = getScale(obj->xPos1, obj->yPos1); _screen->drawShape(2, getShapePtr(obj->shapeIndex1), x, y, 2, obj->flags | 0x104, _paletteOverlay, obj->palette, layer, scale, scale); } else { if (obj->shapePtr) { _screen->drawShape(2, obj->shapePtr, x, y, 2, obj->flags, 7); } else { if (obj->shapeIndex3 == 0xFFFF || obj->animNum == 0xFFFF) return; uint16 flags = 0x4000; if (obj->flags & 0x800) flags |= 0x8000; x = obj->xPos2 - _sceneAnimMovie[obj->animNum]->xAdd(); y = obj->yPos2 - _sceneAnimMovie[obj->animNum]->yAdd(); _sceneAnimMovie[obj->animNum]->displayFrame(obj->shapeIndex3, 2, x, y, flags | layer, 0, 0); } } }
void KyraEngine_HoF::drawInventoryShape(int page, Item item, int slot) { _screen->drawShape(page, getShapePtr(item+64), _inventoryX[slot], _inventoryY[slot], 0, 0); }
void KyraEngine_HoF::drawCharacterAnimObject(AnimObj *obj, int x, int y, int layer) { if (_drawNoShapeFlag || obj->shapeIndex1 == 0xFFFF) return; _screen->drawShape(2, getShapePtr(obj->shapeIndex1), x, y, 2, obj->flags | 4, layer, _charScale, _charScale); }
void KyraEngine_HoF::initSceneAnims(int unk1) { for (int i = 0; i < 41; ++i) _animObjects[i].enabled = 0; bool animInit = false; AnimObj *animState = &_animObjects[0]; if (_mainCharacter.animFrame != 32) _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; animState->enabled = 1; animState->xPos1 = _mainCharacter.x1; animState->yPos1 = _mainCharacter.y1; animState->shapePtr = getShapePtr(_mainCharacter.animFrame); animState->shapeIndex1 = animState->shapeIndex2 = _mainCharacter.animFrame; int frame = _mainCharacter.animFrame - 9; int shapeX = _shapeDescTable[frame].xAdd; int shapeY = _shapeDescTable[frame].yAdd; animState->xPos2 = _mainCharacter.x1; animState->yPos2 = _mainCharacter.y1; _charScale = getScale(_mainCharacter.x1, _mainCharacter.y1); int shapeXScaled = (shapeX * _charScale) >> 8; int shapeYScaled = (shapeY * _charScale) >> 8; animState->xPos2 += shapeXScaled; animState->yPos2 += shapeYScaled; animState->xPos3 = animState->xPos2; animState->yPos3 = animState->yPos2; animState->needRefresh = 1; animState->specialRefresh = 1; _animList = 0; AnimObj *charAnimState = animState; for (int i = 0; i < 10; ++i) { animState = &_animObjects[i+1]; animState->enabled = 0; animState->needRefresh = 0; animState->specialRefresh = 0; if (_sceneAnims[i].flags & 1) { animState->enabled = 1; animState->needRefresh = 1; animState->specialRefresh = 1; } animState->animFlags = _sceneAnims[i].flags & 8; if (_sceneAnims[i].flags & 2) animState->flags = 0x800; else animState->flags = 0; if (_sceneAnims[i].flags & 4) animState->flags |= 1; animState->xPos1 = _sceneAnims[i].x; animState->yPos1 = _sceneAnims[i].y; if (_sceneAnims[i].flags & 0x20) animState->shapePtr = _sceneShapeTable[_sceneAnims[i].shapeIndex]; else animState->shapePtr = 0; if (_sceneAnims[i].flags & 0x40) { animState->shapeIndex3 = _sceneAnims[i].shapeIndex; animState->animNum = i; } else { animState->shapeIndex3 = 0xFFFF; animState->animNum = 0xFFFF; } animState->shapeIndex2 = 0xFFFF; animState->xPos3 = animState->xPos2 = _sceneAnims[i].x2; animState->yPos3 = animState->yPos2 = _sceneAnims[i].y2; animState->width = _sceneAnims[i].width; animState->height = _sceneAnims[i].height; animState->width2 = animState->height2 = _sceneAnims[i].specialSize; if (_sceneAnims[i].flags & 1) { if (animInit) { _animList = addToAnimListSorted(_animList, animState); } else { _animList = initAnimList(_animList, animState); animInit = true; } } } if (animInit) { _animList = addToAnimListSorted(_animList, charAnimState); } else { _animList = initAnimList(_animList, charAnimState); animInit = true; } for (int i = 0; i < 30; ++i) { animState = &_animObjects[i+11]; uint16 shapeIndex = _itemList[i].id; if (shapeIndex == 0xFFFF || _itemList[i].sceneId != _mainCharacter.sceneId) { animState->enabled = 0; animState->needRefresh = 0; animState->specialRefresh = 0; } else { animState->xPos1 = _itemList[i].x; animState->yPos1 = _itemList[i].y; animState->shapePtr = getShapePtr(64+shapeIndex); animState->shapeIndex1 = animState->shapeIndex2 = shapeIndex+64; animState->xPos2 = _itemList[i].x; animState->yPos2 = _itemList[i].y; int objectScale = getScale(animState->xPos2, animState->yPos2); const uint8 *shape = getShapePtr(animState->shapeIndex1); animState->xPos2 -= (_screen->getShapeScaledWidth(shape, objectScale) >> 1); animState->yPos2 -= (_screen->getShapeScaledHeight(shape, objectScale) >> 1); animState->xPos3 = animState->xPos2; animState->yPos3 = animState->yPos2; animState->enabled = 1; animState->needRefresh = 1; animState->specialRefresh = 1; if (animInit) { _animList = addToAnimListSorted(_animList, animState); } else { _animList = initAnimList(_animList, animState); animInit = true; } } } _animObjects[0].specialRefresh = 1; _animObjects[0].needRefresh = 1; for (int i = 1; i < 41; ++i) { if (_animObjects[i].enabled) { _animObjects[i].needRefresh = 1; _animObjects[i].specialRefresh = 1; } } restorePage3(); drawAnimObjects(); _screen->hideMouse(); initSceneScreen(unk1); _screen->showMouse(); refreshAnimObjects(0); }
void KyraEngine_HoF::startup() { _sound->setSoundList(&_soundData[kMusicIngame]); // The track map is exactly the same // for FM-TOWNS and DOS _trackMap = _dosTrackMap; _trackMapSize = _dosTrackMapSize; allocAnimObjects(1, 10, 30); _screen->_curPage = 0; memset(_sceneShapeTable, 0, sizeof(_sceneShapeTable)); _gamePlayBuffer = new uint8[46080]; _unkBuf500Bytes = new uint8[500]; loadMouseShapes(); loadItemShapes(); _screen->setMouseCursor(0, 0, getShapePtr(0)); _screenBuffer = new uint8[64000]; _unkBuf200kByte = new uint8[200000]; loadChapterBuffer(_newChapterFile); loadCCodeBuffer("C_CODE.XXX"); if (_flags.isTalkie) { loadOptionsBuffer("OPTIONS.XXX"); showMessageFromCCode(265, 150, 0); _screen->updateScreen(); openTalkFile(0); _currentTalkFile = 1; openTalkFile(1); } else { _optionsBuffer = _cCodeBuffer; } showMessage(0, 207); _screen->setShapePages(5, 3); _mainCharacter.height = 0x30; _mainCharacter.facing = 4; _mainCharacter.animFrame = 0x12; memset(_sceneAnims, 0, sizeof(_sceneAnims)); for (int i = 0; i < ARRAYSIZE(_sceneAnimMovie); ++i) _sceneAnimMovie[i] = new WSAMovie_v2(this); memset(_wsaSlots, 0, sizeof(_wsaSlots)); for (int i = 0; i < ARRAYSIZE(_wsaSlots); ++i) _wsaSlots[i] = new WSAMovie_v2(this); _screen->_curPage = 0; _talkObjectList = new TalkObject[72]; memset(_talkObjectList, 0, sizeof(TalkObject)*72); _shapeDescTable = new ShapeDesc[55]; memset(_shapeDescTable, 0, sizeof(ShapeDesc)*55); for (int i = 9; i <= 32; ++i) { _shapeDescTable[i-9].width = 30; _shapeDescTable[i-9].height = 55; _shapeDescTable[i-9].xAdd = -15; _shapeDescTable[i-9].yAdd = -50; } for (int i = 19; i <= 24; ++i) { _shapeDescTable[i-9].width = 53; _shapeDescTable[i-9].yAdd = -51; } _gfxBackUpRect = new uint8[_screen->getRectSize(32, 32)]; initItemList(30); loadButtonShapes(); resetItemList(); _characterShapeFile = 1; loadCharacterShapes(_characterShapeFile); initInventoryButtonList(); setupLangButtonShapes(); loadInventoryShapes(); _screen->loadPalette("PALETTE.COL", _screen->getPalette(0)); _screen->loadBitmap("_PLAYFLD.CPS", 3, 3, 0); _screen->copyPage(3, 0); _screen->showMouse(); _screen->hideMouse(); clearAnimObjects(); for (int i = 0; i < 19; ++i) memset(_conversationState[i], -1, sizeof(int8)*14); clearCauldronTable(); memset(_inputColorCode, -1, sizeof(_inputColorCode)); memset(_newSceneDlgState, 0, sizeof(_newSceneDlgState)); for (int i = 0; i < 23; ++i) resetCauldronStateTable(i); _sceneList = new SceneDesc[86]; memset(_sceneList, 0, sizeof(SceneDesc)*86); _sceneListSize = 86; runStartScript(1, 0); loadNPCScript(); if (_gameToLoad == -1) { snd_playWanderScoreViaMap(52, 1); enterNewScene(_mainCharacter.sceneId, _mainCharacter.facing, 0, 0, 1); saveGameStateIntern(0, "New Game", 0); } else { loadGameStateCheck(_gameToLoad); } _screen->showMouse(); if (_menuDirectlyToLoad) (*_inventoryButtons[0].buttonCallback)(&_inventoryButtons[0]); setNextIdleAnimTimer(); setWalkspeed(_configWalkspeed); }
void KyraEngine_MR::initSceneAnims(int unk1) { for (int i = 0; i < 67; ++i) _animObjects[i].enabled = false; AnimObj *obj = &_animObjects[0]; if (_mainCharacter.animFrame != 87 && !unk1) _mainCharacter.animFrame = _characterFrameTable[_mainCharacter.facing]; obj->enabled = true; obj->xPos1 = _mainCharacter.x1; obj->yPos1 = _mainCharacter.y1; obj->shapePtr = getShapePtr(_mainCharacter.animFrame); obj->shapeIndex2 = obj->shapeIndex1 = _mainCharacter.animFrame; obj->xPos2 = _mainCharacter.x1; obj->yPos2 = _mainCharacter.y1; _charScale = getScale(_mainCharacter.x1, _mainCharacter.y1); obj->xPos3 = obj->xPos2 += (_malcolmShapeXOffset * _charScale) >> 8; obj->yPos3 = obj->yPos2 += (_malcolmShapeYOffset * _charScale) >> 8; _mainCharacter.x3 = _mainCharacter.x1 - (_charScale >> 4) - 1; _mainCharacter.y3 = _mainCharacter.y1 - (_charScale >> 6) - 1; obj->needRefresh = true; _animList = 0; for (int i = 0; i < 16; ++i) { const SceneAnim &anim = _sceneAnims[i]; obj = &_animObjects[i+1]; obj->enabled = false; obj->needRefresh = false; if (anim.flags & 1) { obj->enabled = true; obj->needRefresh = true; } obj->specialRefresh = (anim.flags & 0x20) ? 1 : 0; obj->flags = (anim.flags & 0x10) ? 0x800 : 0; if (anim.flags & 2) obj->flags |= 1; obj->xPos1 = anim.x; obj->yPos1 = anim.y; if ((anim.flags & 4) && anim.shapeIndex != -1) obj->shapePtr = _sceneShapes[anim.shapeIndex]; else obj->shapePtr = 0; if (anim.flags & 8) { obj->shapeIndex3 = anim.shapeIndex; obj->animNum = i; } else { obj->shapeIndex3 = 0xFFFF; obj->animNum = 0xFFFF; } obj->xPos3 = obj->xPos2 = anim.x2; obj->yPos3 = obj->yPos2 = anim.y2; obj->width = anim.width; obj->height = anim.height; obj->width2 = obj->height2 = anim.specialSize; if (anim.flags & 1) { if (_animList) _animList = addToAnimListSorted(_animList, obj); else _animList = initAnimList(_animList, obj); } } if (_animList) _animList = addToAnimListSorted(_animList, &_animObjects[0]); else _animList = initAnimList(_animList, &_animObjects[0]); for (int i = 0; i < 50; ++i) { obj = &_animObjects[i+17]; const ItemDefinition &item = _itemList[i]; if (item.id != kItemNone && item.sceneId == _mainCharacter.sceneId) { obj->xPos1 = item.x; obj->yPos1 = item.y; animSetupPaletteEntry(obj); obj->shapePtr = 0; obj->shapeIndex1 = obj->shapeIndex2 = item.id + 248; obj->xPos2 = item.x; obj->yPos2 = item.y; int scale = getScale(obj->xPos1, obj->yPos1); const uint8 *shape = getShapePtr(obj->shapeIndex1); obj->xPos3 = obj->xPos2 -= (_screen->getShapeScaledWidth(shape, scale) >> 1); obj->yPos3 = obj->yPos2 -= _screen->getShapeScaledHeight(shape, scale) - 1; obj->enabled = true; obj->needRefresh = true; if (_animList) _animList = addToAnimListSorted(_animList, obj); else _animList = initAnimList(_animList, obj); } else {
const Shape & Body::getShape() const { return *(getShapePtr()); }
Shape & Body::getShape() { return *(getShapePtr()); }
void KyraEngine_HoF::updateMouse() { int shapeIndex = 0; int type = 0; int xOffset = 0, yOffset = 0; Common::Point mouse = getMousePos(); if (mouse.y <= 145) { if (mouse.x <= 6) { if (_sceneExit4 != 0xFFFF) { type = -3; shapeIndex = 4; xOffset = 1; yOffset = 5; } else { type = -2; } } else if (mouse.x >= 312) { if (_sceneExit2 != 0xFFFF) { type = -5; shapeIndex = 2; xOffset = 7; yOffset = 5; } else { type = -2; } } else if (mouse.y >= 135) { if (_sceneExit3 != 0xFFFF) { type = -4; shapeIndex = 3; xOffset = 5; yOffset = 10; } else { type = -2; } } else if (mouse.y <= 6) { if (_sceneExit1 != 0xFFFF) { type = -6; shapeIndex = 1; xOffset = 5; yOffset = 1; } else { type = -2; } } } for (int i = 0; i < _specialExitCount; ++i) { if (checkSpecialSceneExit(i, mouse.x, mouse.y)) { switch (_specialExitTable[20+i]) { case 0: type = -6; shapeIndex = 1; xOffset = 5; yOffset = 1; break; case 2: type = -5; shapeIndex = 2; xOffset = 7; yOffset = 5; break; case 4: type = -4; shapeIndex = 3; xOffset = 5; yOffset = 7; break; case 6: type = -3; shapeIndex = 4; xOffset = 1; yOffset = 5; break; default: break; } } } if (type == -2) { shapeIndex = 5; xOffset = 5; yOffset = 9; } if (type != 0 && _mouseState != type && _screen->isMouseVisible()) { _mouseState = type; _screen->hideMouse(); _screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex)); _screen->showMouse(); } if (type == 0 && _mouseState != _itemInHand && _screen->isMouseVisible()) { if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) { _mouseState = _itemInHand; _screen->hideMouse(); if (_itemInHand == kItemNone) _screen->setMouseCursor(0, 0, getShapePtr(0)); else _screen->setMouseCursor(8, 15, getShapePtr(_itemInHand+64)); _screen->showMouse(); } } }
void KyraEngine_HoF::clearInventorySlot(int slot, int page) { _screen->drawShape(page, getShapePtr(240+slot), _inventoryX[slot], _inventoryY[slot], 0, 0); }