diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/picture.cpp | 22 | ||||
-rw-r--r-- | engines/agi/picture.h | 6 | ||||
-rw-r--r-- | engines/agi/preagi_mickey.cpp | 114 |
3 files changed, 82 insertions, 60 deletions
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp index 3c129af034..3ba861f44e 100644 --- a/engines/agi/picture.cpp +++ b/engines/agi/picture.cpp @@ -39,14 +39,19 @@ PictureMgr::PictureMgr(AgiBase *agi, GfxMgr *gfx) { _flen = _foffs = 0; _patCode = _patNum = _priOn = _scrOn = _scrColor = _priColor = 0; + _xOffset = _yOffset = 0; _pictureType = AGIPIC_V2; _minCommand = 0xf0; + _flags = 0; } void PictureMgr::putVirtPixel(int x, int y) { uint8 *p; + x += _xOffset; + y += _yOffset; + if (x < 0 || y < 0 || x >= _width || y >= _height) return; @@ -536,6 +541,7 @@ void PictureMgr::plotBrush() { void PictureMgr::drawPicture() { uint8 act; int drawing; + int storedXOffset = 0, storedYOffset = 0; _patCode = 0; _patNum = 0; @@ -685,6 +691,21 @@ void PictureMgr::drawPicture() { default: warning("Unknown v2 picture opcode (%x)", act); } + if (_flags == kPicFStep && _vm->getGameType() == GType_PreAGI) { + // FIXME: This is used by Mickey for the crystal animation, but + // currently it's very very very slow + /* + storedXOffset = _xOffset; + storedYOffset = _yOffset; + // FIXME: picture coordinates are correct for Mickey only + showPic(10, 0, _width, _height); + _gfx->doUpdate(); + g_system->updateScreen(); + _xOffset = storedXOffset; + _yOffset = storedYOffset; + g_system->delayMillis(25); + */ + } } } @@ -753,7 +774,6 @@ int PictureMgr::decodePicture(int n, int clear, bool agi256, int pic_width, int _data = _vm->_game.pictures[n].rdata; _flen = _vm->_game.dirPic[n].len; _foffs = 0; - _flags = 0; _width = pic_width; _height = pic_height; diff --git a/engines/agi/picture.h b/engines/agi/picture.h index c49fad6e13..13f09e0bf9 100644 --- a/engines/agi/picture.h +++ b/engines/agi/picture.h @@ -97,6 +97,11 @@ public: void setPictureFlags(int flags) { _flags = flags; } + void setOffset(int offX, int offY) { + _xOffset = offX; + _yOffset = offY; + } + private: uint8 *_data; uint32 _flen; @@ -113,6 +118,7 @@ private: int _pictureType; int _width, _height; + int _xOffset, _yOffset; int _flags; }; diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 999325ce62..7997a384b9 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -158,6 +158,9 @@ void Mickey::readOfsData(int offset, int iItem, uint8 *buffer, long buflen) { bool Mickey::chooseY_N(int ofsPrompt, bool fErrorMsg) { printExeStr(ofsPrompt); + _vm->_gfx->doUpdate(); + _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + int a = _vm->getSelection(0); for (;;) { switch (a) { @@ -177,6 +180,9 @@ bool Mickey::chooseY_N(int ofsPrompt, bool fErrorMsg) { int Mickey::choose1to9(int ofsPrompt) { printExeStr(ofsPrompt); + _vm->_gfx->doUpdate(); + _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + int a = _vm->getSelection(1); for (;;) { if (a == 10) { @@ -213,9 +219,8 @@ void Mickey::printExeStr(int ofs) { readExe(ofs, buffer, sizeof(buffer)); printStr((char *)buffer); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop - + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop } void Mickey::printExeMsg(int ofs) { @@ -236,8 +241,8 @@ void Mickey::printDesc(int iRoom) { char *buffer = (char *)malloc(256); readDesc(iRoom, buffer, 256); printStr(buffer); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop free(buffer); } @@ -582,8 +587,8 @@ void Mickey::printDatString(int iStr) { void Mickey::printDatMessage(int iStr) { printDatString(iStr); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKeyAnim(); } @@ -677,29 +682,15 @@ void Mickey::debug() { // Graphics void Mickey::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) { - // FIXME: objects are rendered incorrectly - - // FIXME: Not sure about object dimensions - int objWidth = 44; - int objHeight = 44; _vm->preAgiLoadResource(rVIEW, iObj); if (iObj == IDI_MSA_OBJECT_CRYSTAL) - _vm->_picture->setPictureFlags(kPicFCircle); + _vm->_picture->setPictureFlags(kPicFStep); - _vm->_picture->decodePicture(iObj, false, false, objWidth, objHeight); - _vm->_picture->showPic(x0, y0, objWidth, objHeight); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop - - // TrollVM code - /* - if (iObj == IDI_MSA_OBJECT_CRYSTAL) { - AGI_DrawPic(IDI_MSA_PIC_X0 + x0, IDI_MSA_PIC_Y0 + y0, IDF_AGI_PIC_V2 | IDF_AGI_STEP, buffer); - } else { - AGI_DrawPic(IDI_MSA_PIC_X0 + x0, IDI_MSA_PIC_Y0 + y0, IDF_AGI_PIC_V2, buffer); - } - */ + _vm->_picture->setOffset(x0, y0); + _vm->_picture->decodePicture(iObj, false, false, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); + _vm->_picture->setOffset(0, 0); + _vm->_picture->showPic(10, 0, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); } void Mickey::drawPic(int iPic) { @@ -707,8 +698,8 @@ void Mickey::drawPic(int iPic) { // Note that decodePicture clears the screen _vm->_picture->decodePicture(iPic, true, false, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); _vm->_picture->showPic(10, 0, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop } void Mickey::drawRoomPicture() { @@ -866,8 +857,8 @@ void Mickey::drawLogo() { #if 0 drawPictureBCG(buffer); // TODO #endif - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop delete [] buffer; } @@ -984,8 +975,8 @@ void Mickey::printStory() { _vm->drawStr(iRow, 0, IDA_DEFAULT, szLine); pBuf += strlen(szLine) + 1; } - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); _vm->clearScreen(IDA_DEFAULT); @@ -994,18 +985,18 @@ void Mickey::printStory() { _vm->drawStr(iRow, 0, IDA_DEFAULT, szLine); pBuf += strlen(szLine) + 1; } - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); //Set back to black _vm->_gfx->clearScreen(0); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop drawRoom(); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop game.fStoryShown = true; } @@ -1016,8 +1007,8 @@ void Mickey::hidden() { printExeMsg(IDO_MSA_HIDDEN_MSG[i]); } _vm->clearTextArea(); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); } } @@ -1059,8 +1050,8 @@ void Mickey::pressOB(int iButton) { // print pressed buttons printExeStr(IDO_MSA_MICKEY_HAS_PRESSED); _vm->drawStr(IDI_MSA_ROW_BUTTONS, IDI_MSA_COL_BUTTONS, IDA_DEFAULT, szButtons); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); } @@ -1085,8 +1076,8 @@ void Mickey::checkAirSupply(bool fSuit, int *iSupply) { void Mickey::insertDisk(int iDisk) { _vm->clearTextArea(); _vm->drawStr(IDI_MSA_ROW_INSERT_DISK, IDI_MSA_COL_INSERT_DISK, IDA_DEFAULT, (const char *)IDS_MSA_INSERT_DISK[iDisk]); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); } @@ -1119,8 +1110,8 @@ void Mickey::flipSwitch() { game.fAnimXL30 = true; _vm->clearTextArea(); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop playSound(IDI_MSA_SND_XL30); printExeMsg(IDO_MSA_XL30_SPEAKING); @@ -1178,8 +1169,8 @@ void Mickey::inventory() { } } - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); _vm->clearScreen(IDA_DEFAULT); @@ -1552,8 +1543,8 @@ bool Mickey::parse(int cmd, int arg) { if (game.iRmPic[game.iRoom] == IDI_MSA_PIC_VENUS_PROBE_1) { _vm->clearRow(22); } - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); break; case IDI_MSA_ACTION_GET_XTAL_VENUS: @@ -1888,8 +1879,8 @@ bool Mickey::parse(int cmd, int arg) { (const char *)IDS_MSA_TEMP_C[game.iPlanet]); _vm->drawStr(IDI_MSA_ROW_TEMPERATURE, IDI_MSA_COL_TEMPERATURE_F, IDA_DEFAULT, (const char *)IDS_MSA_TEMP_F[game.iPlanet]); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); break; case IDI_MSA_ACTION_PRESS_ORANGE: @@ -1922,8 +1913,8 @@ bool Mickey::parse(int cmd, int arg) { printDatString(22); _vm->drawStr(IDI_MSA_ROW_PLANET, IDI_MSA_COL_PLANET, IDA_DEFAULT, (const char *)IDS_MSA_PLANETS[game.iPlanet]); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKeyAnim(); showPlanetInfo(); } else { @@ -2029,7 +2020,12 @@ void Mickey::waitAnyKeyAnim() { void Mickey::waitAnyKey(bool anim) { Common::Event event; - + + if (!anim) { + _vm->_gfx->doUpdate(); + _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + } + for (;;) { while (_vm->_system->getEventManager()->pollEvent(event)) { switch(event.type) { @@ -2064,8 +2060,8 @@ void Mickey::debug_DrawObjs() { sprintf(szTitle, "Object %d", iObj); _vm->drawStrMiddle(22, IDA_DEFAULT, szTitle); _vm->drawStrMiddle(23, IDA_DEFAULT, (const char *)IDS_MSA_NAME_OBJ[iObj]); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); } } @@ -2079,8 +2075,8 @@ void Mickey::debug_DrawPics(){ _vm->clearTextArea(); sprintf(szTitle, "Picture %d", iPic); _vm->drawStrMiddle(22, IDA_DEFAULT, szTitle); - _vm->_gfx->doUpdate(); - _vm->_system->updateScreen(); // TODO: this should go in the game's main loop + //_vm->_gfx->doUpdate(); + //_vm->_system->updateScreen(); // TODO: this should go in the game's main loop waitAnyKey(); } } |