aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/preagi_mickey.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/agi/preagi_mickey.cpp')
-rw-r--r--engines/agi/preagi_mickey.cpp304
1 files changed, 151 insertions, 153 deletions
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index 883107a957..0584aab683 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -90,7 +90,7 @@ void MickeyEngine::readOfsData(int offset, int iItem, uint8 *buffer, long buflen
memcpy(ofs, buffer, sizeof(ofs));
for (int i = 0; i < 256; i++)
- ofs[i] = buffer[i*2] + 256 * buffer[i*2+1];
+ ofs[i] = buffer[i * 2] + 256 * buffer[i * 2 + 1];
readExe(ofs[iItem] + IDI_MSA_OFS_EXE, buffer, buflen);
}
@@ -102,8 +102,10 @@ bool MickeyEngine::chooseY_N(int ofsPrompt, bool fErrorMsg) {
while (!shouldQuit()) {
switch (getSelection(kSelYesNo)) {
- case 0: return false;
- case 1: return true;
+ case 0:
+ return false;
+ case 1:
+ return true;
default:
if (fErrorMsg) {
printExeStr(IDO_MSA_PRESS_YES_OR_NO);
@@ -149,7 +151,7 @@ void MickeyEngine::printStr(char *buffer) {
}
// Show the string on screen
- _gfx->doUpdate();
+ _gfx->updateScreen();
}
void MickeyEngine::printLine(const char *buffer) {
@@ -158,7 +160,7 @@ void MickeyEngine::printLine(const char *buffer) {
drawStr(22, 18 - strlen(buffer) / 2, IDA_DEFAULT, buffer);
// Show the string on screen
- _gfx->doUpdate();
+ _gfx->updateScreen();
waitAnyKey(true);
}
@@ -253,7 +255,7 @@ bool MickeyEngine::checkMenu() {
return parse(menu.cmd[iSel0].data[iSel1], menu.arg[iSel0].data[iSel1]);
}
-void MickeyEngine::drawMenu(MSA_MENU menu, int sel0, int sel1) {
+void MickeyEngine::drawMenu(MSA_MENU &menu, int sel0, int sel1) {
int iWord;
int iRow;
int sel;
@@ -276,15 +278,15 @@ void MickeyEngine::drawMenu(MSA_MENU menu, int sel0, int sel1) {
attr = IDA_DEFAULT;
drawStr(IDI_MSA_ROW_MENU_0 + iRow, menu.row[iRow].entry[iWord].x0,
- attr, (char *)menu.row[iRow].entry[iWord].szText);
+ attr, (char *)menu.row[iRow].entry[iWord].szText);
}
}
// Menu created, show it on screen
- _gfx->doUpdate();
+ _gfx->updateScreen();
}
-void MickeyEngine::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow, int x, int y) {
+void MickeyEngine::getMouseMenuSelRow(MSA_MENU &menu, int *sel0, int *sel1, int iRow, int x, int y) {
int iWord;
int *sel = 0;
@@ -303,15 +305,15 @@ void MickeyEngine::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int i
for (iWord = 0; iWord < menu.row[iRow].count; iWord++) {
if ((x >= menu.row[iRow].entry[iWord].x0) &&
- (x < (int)(menu.row[iRow].entry[iWord].x0 +
- strlen((char *)menu.row[iRow].entry[iWord].szText)))) {
- *sel = iWord;
- break;
+ (x < (int)(menu.row[iRow].entry[iWord].x0 +
+ strlen((char *)menu.row[iRow].entry[iWord].szText)))) {
+ *sel = iWord;
+ break;
}
}
}
-bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) {
+bool MickeyEngine::getMenuSelRow(MSA_MENU &menu, int *sel0, int *sel1, int iRow) {
Common::Event event;
int *sel = 0;
int nWords;
@@ -330,24 +332,24 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow)
_clickToMove = false;
for (int i = 0; i <= menu.row[0].count; i++)
- if (menu.row[0].entry[i].szText[0] == 71 && menu.row[0].entry[i].szText[1] == 79) // GO
+ if (menu.row[0].entry[i].szText[0] == 71 && menu.row[0].entry[i].szText[1] == 79) // GO
goIndex = i;
if (goIndex >= 0) {
for (int j = 0; j <= menu.row[1].count; j++) {
if (menu.row[1].entry[j].szText[0] == 78 && menu.row[1].entry[j].szText[1] == 79 &&
- menu.row[1].entry[j].szText[2] == 82 && menu.row[1].entry[j].szText[3] == 84 &&
- menu.row[1].entry[j].szText[4] == 72)
+ menu.row[1].entry[j].szText[2] == 82 && menu.row[1].entry[j].szText[3] == 84 &&
+ menu.row[1].entry[j].szText[4] == 72)
northIndex = j;
if (menu.row[1].entry[j].szText[0] == 83 && menu.row[1].entry[j].szText[1] == 79 &&
- menu.row[1].entry[j].szText[2] == 85 && menu.row[1].entry[j].szText[3] == 84 &&
- menu.row[1].entry[j].szText[4] == 72)
+ menu.row[1].entry[j].szText[2] == 85 && menu.row[1].entry[j].szText[3] == 84 &&
+ menu.row[1].entry[j].szText[4] == 72)
southIndex = j;
if (menu.row[1].entry[j].szText[0] == 69 && menu.row[1].entry[j].szText[1] == 65 &&
- menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84)
+ menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84)
eastIndex = j;
if (menu.row[1].entry[j].szText[0] == 87 && menu.row[1].entry[j].szText[1] == 69 &&
- menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84)
+ menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84)
westIndex = j;
}
}
@@ -372,62 +374,68 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow)
// Change cursor
if (northIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) &&
- (event.mouse.y >= 0 && event.mouse.y <= 10)) {
- _gfx->setCursorPalette(true);
+ (event.mouse.y >= 0 && event.mouse.y <= 10)) {
+ //_gfx->setCursorPalette(true);
+ // TODO:?????
} else if (southIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) &&
- (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) {
- _gfx->setCursorPalette(true);
+ (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) {
+ //_gfx->setCursorPalette(true);
} else if (westIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
- (event.mouse.x >= 20 && event.mouse.x <= 30)) {
- _gfx->setCursorPalette(true);
+ (event.mouse.x >= 20 && event.mouse.x <= 30)) {
+ //_gfx->setCursorPalette(true);
} else if (eastIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
- (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) {
- _gfx->setCursorPalette(true);
+ (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) {
+ //_gfx->setCursorPalette(true);
} else {
- _gfx->setCursorPalette(false);
+ //_gfx->setCursorPalette(false);
}
}
break;
case Common::EVENT_LBUTTONUP:
// Click to move
if (northIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) &&
- (event.mouse.y >= 0 && event.mouse.y <= 10)) {
+ (event.mouse.y >= 0 && event.mouse.y <= 10)) {
*sel0 = goIndex;
*sel1 = northIndex;
drawMenu(menu, *sel0, *sel1);
- _gfx->setCursorPalette(false);
+ //_gfx->setCursorPalette(false);
+ // TODO???
_clickToMove = true;
} else if (southIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) &&
- (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) {
+ (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) {
*sel0 = goIndex;
*sel1 = southIndex;
drawMenu(menu, *sel0, *sel1);
- _gfx->setCursorPalette(false);
+ //_gfx->setCursorPalette(false);
+ // TODO???
_clickToMove = true;
} else if (westIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
- (event.mouse.x >= 20 && event.mouse.x <= 30)) {
+ (event.mouse.x >= 20 && event.mouse.x <= 30)) {
*sel0 = goIndex;
*sel1 = westIndex;
drawMenu(menu, *sel0, *sel1);
- _gfx->setCursorPalette(false);
+ //_gfx->setCursorPalette(false);
+ // TODO???
_clickToMove = true;
} else if (eastIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) &&
- (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) {
+ (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) {
*sel0 = goIndex;
*sel1 = eastIndex;
drawMenu(menu, *sel0, *sel1);
- _gfx->setCursorPalette(false);
+ //_gfx->setCursorPalette(false);
+ // TODO???
_clickToMove = true;
} else {
- _gfx->setCursorPalette(false);
+ //_gfx->setCursorPalette(false);
+ // TODO???
}
return true;
case Common::EVENT_RBUTTONUP:
@@ -486,7 +494,7 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow)
return false;
case Common::KEYCODE_s:
- flipflag(fSoundOn);
+ flipFlag(VM_FLAG_SOUND_ON);
break;
case Common::KEYCODE_c:
inventory();
@@ -594,7 +602,7 @@ void MickeyEngine::centerMenu(MSA_MENU *menu) {
w += strlen((char *)menu->row[iRow].entry[iWord].szText);
}
w += menu->row[iRow].count - 1;
- x = (40 - w) / 2; // FIX
+ x = (40 - w) / 2; // FIX
for (iWord = 0; iWord < menu->row[iRow].count; iWord++) {
menu->row[iRow].entry[iWord].x0 = x;
@@ -625,9 +633,9 @@ void MickeyEngine::patchMenu(MSA_MENU *menu) {
// read patches
readOfsData(
- IDOFS_MSA_MENU_PATCHES,
- _gameStateMickey.nRmMenu[_gameStateMickey.iRoom] + _gameStateMickey.iRmMenu[_gameStateMickey.iRoom] - 1,
- buffer, sizeof(buffer)
+ IDOFS_MSA_MENU_PATCHES,
+ _gameStateMickey.nRmMenu[_gameStateMickey.iRoom] + _gameStateMickey.iRmMenu[_gameStateMickey.iRoom] - 1,
+ buffer, sizeof(buffer)
);
// get number of patches
@@ -659,14 +667,14 @@ void MickeyEngine::printDatMessage(int iStr) {
void MickeyEngine::playNote(MSA_SND_NOTE note) {
if (!note.counter) {
// Pause
- _system->delayMillis((uint) (note.length / IDI_SND_TIMER_RESOLUTION));
+ _system->delayMillis((uint)(note.length / IDI_SND_TIMER_RESOLUTION));
} else {
- PreAgiEngine::playNote(IDI_SND_OSCILLATOR_FREQUENCY / note.counter, (int32) (note.length / IDI_SND_TIMER_RESOLUTION));
+ PreAgiEngine::playNote(IDI_SND_OSCILLATOR_FREQUENCY / note.counter, (int32)(note.length / IDI_SND_TIMER_RESOLUTION));
}
}
void MickeyEngine::playSound(ENUM_MSA_SOUND iSound) {
- if (!getflag(fSoundOn))
+ if (!getFlag(VM_FLAG_SOUND_ON))
return;
Common::Event event;
@@ -727,7 +735,7 @@ void MickeyEngine::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) {
if (!file.open(szFile))
return;
- uint8* buffer = new uint8[4096];
+ uint8 *buffer = new uint8[4096];
uint32 size = file.size();
file.read(buffer, size);
file.close();
@@ -749,13 +757,15 @@ void MickeyEngine::drawPic(int iPic) {
if (!file.open(szFile))
return;
- uint8* buffer = new uint8[4096];
+ uint8 *buffer = new uint8[4096];
uint32 size = file.size();
file.read(buffer, size);
file.close();
// Note that decodePicture clears the screen
+ _picture->setOffset(10, 0);
_picture->decodePicture(buffer, size, true, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT);
+ _picture->setOffset(0, 0);
_picture->showPic(10, 0, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT);
}
@@ -781,36 +791,35 @@ void MickeyEngine::drawRoomAnimation() {
case IDI_MSA_PIC_SHIP_PLUTO:
case IDI_MSA_PIC_SHIP_JUPITER:
case IDI_MSA_PIC_SHIP_MARS:
- case IDI_MSA_PIC_SHIP_URANUS:
- {
- // draw blinking ship lights
+ case IDI_MSA_PIC_SHIP_URANUS: {
+ // draw blinking ship lights
- uint8 iColor = 0;
+ uint8 iColor = 0;
- _picture->setPattern(2, 0);
+ _picture->setPattern(2, 0);
- for (int i = 0; i < 12; i++) {
- iColor = _gameStateMickey.nFrame + i;
- if (iColor > 15)
- iColor -= 15;
+ for (int i = 0; i < 12; i++) {
+ iColor = _gameStateMickey.nFrame + i;
+ if (iColor > 15)
+ iColor -= 15;
- objLight[1] = iColor;
- objLight[4] += 7;
+ objLight[1] = iColor;
+ objLight[4] += 7;
- _picture->setPictureData(objLight);
- _picture->setPictureFlags(kPicFCircle);
- _picture->drawPicture();
- }
- _picture->showPic(10, 0, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT);
+ _picture->setPictureData(objLight);
+ _picture->setPictureFlags(kPicFCircle);
+ _picture->drawPicture();
+ }
+ _picture->showPic(10, 0, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT);
- _gameStateMickey.nFrame--;
- if (_gameStateMickey.nFrame < 0)
- _gameStateMickey.nFrame = 15;
+ _gameStateMickey.nFrame--;
+ if (_gameStateMickey.nFrame < 0)
+ _gameStateMickey.nFrame = 15;
- playSound(IDI_MSA_SND_PRESS_BLUE);
- }
- break;
+ playSound(IDI_MSA_SND_PRESS_BLUE);
+ }
+ break;
case IDI_MSA_PIC_SHIP_CONTROLS:
@@ -836,9 +845,9 @@ void MickeyEngine::drawRoomAnimation() {
break;
default:
drawObj(
- IDI_MSA_OBJECT_CRYSTAL,
- IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][1],
- IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][2]
+ IDI_MSA_OBJECT_CRYSTAL,
+ IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][1],
+ IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][2]
);
break;
}
@@ -878,7 +887,7 @@ void MickeyEngine::drawRoom() {
if (_gameStateMickey.iRmObj[_gameStateMickey.iRoom] != IDI_MSA_OBJECT_NONE) {
readOfsData(IDO_MSA_ROOM_OBJECT_XY_OFFSETS,
- _gameStateMickey.iRmObj[_gameStateMickey.iRoom], buffer, sizeof(buffer));
+ _gameStateMickey.iRmObj[_gameStateMickey.iRoom], buffer, sizeof(buffer));
nObjs = buffer[pBuf++];
@@ -892,75 +901,65 @@ void MickeyEngine::drawRoom() {
drawRoomAnimation();
}
-#if 0
-const uint8 colorBCG[16][2] = {
- { 0x00, 0x00 }, // 0 (black, black)
- { 0, 0 },
- { 0x00, 0x0D }, // 2 (black, purple)
- { 0x00, 0xFF }, // 3 (black, white)
- { 0, 0 },
- { 0, 0 },
- { 0, 0 },
- { 0, 0 },
- { 0x0D, 0x00 }, // 8 (purple, black)
- { 0, 0 },
- { 0x0D, 0x0D }, // A (purple, purple)
- { 0, 0 },
- { 0xFF, 0x00 }, // C (white, black)
- { 0, 0 },
- { 0, 0 },
- { 0xFF, 0xFF } // F (white, white)
+// Straight mapping, CGA colors to CGA
+const byte BCGColorMappingCGAToCGA[4] = {
+ 0, 1, 2, 3
+};
+
+// Mapping table to map CGA colors to EGA
+const byte BCGColorMappingCGAToEGA[4] = {
+ 0, 11, 13, 15
};
-#endif
void MickeyEngine::drawLogo() {
- // TODO: clean this up and make it work properly, the logo is drawn way off to the right
-#if 0
- char szFile[256] = {0};
- uint8 *buffer = new uint8[16384];
- const int w = 150;
- const int h = 80;
- const int xoffset = 30; // FIXME: remove this
- uint8 bitmap[w][h];
- uint8 color, color2, color3, color4;
-
- // read in logos.bcg
- sprintf(szFile, IDS_MSA_PATH_LOGO);
+ const int width = 80;
+ const int height = 85 * 2;
+ byte color1, color2, color3, color4;
+ byte *fileBuffer = nullptr;
+ uint32 fileBufferSize = 0;
+ byte *dataBuffer;
+ byte curByte;
+ const byte *BCGColorMapping = BCGColorMappingCGAToEGA;
+
+ // disable color mapping in case we are in CGA mode
+ if (_renderMode == Common::kRenderCGA)
+ BCGColorMapping = BCGColorMappingCGAToCGA;
+
+ // read logos.bcg
Common::File infile;
- if (!infile.open(szFile))
+ if (!infile.open(IDS_MSA_PATH_LOGO))
return;
- infile.read(buffer, infile.size());
+ fileBufferSize = infile.size();
+ fileBuffer = new byte[fileBufferSize];
+ infile.read(fileBuffer, fileBufferSize);
infile.close();
- // draw logo bitmap
- memcpy(bitmap, buffer, sizeof(bitmap));
-
- _picture->setDimensions(w, h);
+ if (fileBufferSize < (width * height / 4))
+ error("logos.bcg: unexpected end of file");
// Show BCG picture
- for (int y = 0; y < h; y++) {
- for (int x = xoffset; x < w; x++) {
- color = colorBCG[(bitmap[y][x] & 0xf0) / 0x10][0]; // background
- color2 = colorBCG[(bitmap[y][x] & 0xf0) / 0x10][1]; // background
- color3 = colorBCG[ bitmap[y][x] & 0x0f][0]; // foreground
- color4 = colorBCG[ bitmap[y][x] & 0x0f][1]; // foreground
-
- _picture->putPixel(x * 4 - xoffset, y, color);
- _picture->putPixel(x * 4 + 1 - xoffset, y, color2);
- _picture->putPixel(x * 4 + 2 - xoffset, y, color3);
- _picture->putPixel(x * 4 + 3 - xoffset, y, color4);
- _picture->putPixel(x * 4 - xoffset, y + 1, color);
- _picture->putPixel(x * 4 + 1 - xoffset, y + 1, color2);
- _picture->putPixel(x * 4 + 2 - xoffset, y + 1, color3);
- _picture->putPixel(x * 4 + 3 - xoffset, y + 1, color4);
+ // It's basically uncompressed CGA 4-color data (4 pixels per byte)
+ dataBuffer = fileBuffer;
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ curByte = *dataBuffer++;
+
+ color1 = BCGColorMapping[(curByte >> 6) & 0x03];
+ color2 = BCGColorMapping[(curByte >> 4) & 0x03];
+ color3 = BCGColorMapping[(curByte >> 2) & 0x03];
+ color4 = BCGColorMapping[(curByte >> 0) & 0x03];
+
+ _gfx->putPixelOnDisplay(x * 4 + 0, y, color1);
+ _gfx->putPixelOnDisplay(x * 4 + 1, y, color2);
+ _gfx->putPixelOnDisplay(x * 4 + 2, y, color3);
+ _gfx->putPixelOnDisplay(x * 4 + 3, y, color4);
}
}
- _picture->showPic(10, 10, w, h);
+ _gfx->copyDisplayToScreen();
- delete[] buffer;
-#endif
+ delete[] fileBuffer;
}
void MickeyEngine::animate() {
@@ -1000,7 +999,7 @@ bool MickeyEngine::loadGame() {
if (getSelection(kSelAnyKey) == 0)
return false;
} else {
- if (infile->readUint32BE() != MKTAG('M','I','C','K')) {
+ if (infile->readUint32BE() != MKTAG('M', 'I', 'C', 'K')) {
warning("MickeyEngine::loadGame wrong save game format");
return false;
}
@@ -1080,7 +1079,7 @@ bool MickeyEngine::loadGame() {
}
void MickeyEngine::saveGame() {
- Common::OutSaveFile* outfile;
+ Common::OutSaveFile *outfile;
char szFile[256] = {0};
bool diskerror = true;
int sel;
@@ -1117,7 +1116,7 @@ void MickeyEngine::saveGame() {
if (getSelection(kSelAnyKey) == 0)
return;
} else {
- outfile->writeUint32BE(MKTAG('M','I','C','K')); // header
+ outfile->writeUint32BE(MKTAG('M', 'I', 'C', 'K')); // header
outfile->writeByte(MSA_SAVEGAME_VERSION);
outfile->writeByte(_gameStateMickey.iRoom);
@@ -1206,7 +1205,7 @@ void MickeyEngine::printStory() {
clearScreen(IDA_DEFAULT);
for (iRow = 0; iRow < 25; iRow++) {
- strcpy(szLine, buffer + pBuf);
+ Common::strlcpy(szLine, buffer + pBuf, 41);
drawStr(iRow, 0, IDA_DEFAULT, szLine);
pBuf += strlen(szLine) + 1;
}
@@ -1214,15 +1213,15 @@ void MickeyEngine::printStory() {
clearScreen(IDA_DEFAULT);
for (iRow = 0; iRow < 21; iRow++) {
- strcpy(szLine, buffer + pBuf);
+ Common::strlcpy(szLine, buffer + pBuf, 41);
drawStr(iRow, 0, IDA_DEFAULT, szLine);
pBuf += strlen(szLine) + 1;
}
waitAnyKey();
//Set back to black
- _gfx->clearScreen(0);
- _gfx->doUpdate();
+ _gfx->clearDisplay(0);
+ _gfx->updateScreen();
drawRoom();
@@ -1319,11 +1318,11 @@ void MickeyEngine::flipSwitch() {
iPlanet = rnd(IDI_MSA_MAX_PLANET - 2);
} while (planetIsAlreadyAssigned(iPlanet));
} else {
- iPlanet = IDI_MSA_PLANET_URANUS; // Uranus is always last
+ iPlanet = IDI_MSA_PLANET_URANUS; // Uranus is always last
}
_gameStateMickey.iPlanetXtal[i] = iPlanet;
- iHint = rnd(5) - 1; // clues are 0-4
+ iHint = rnd(5) - 1; // clues are 0-4
_gameStateMickey.iClue[i] = IDO_MSA_NEXT_PIECE[iPlanet][iHint];
}
@@ -1399,8 +1398,8 @@ void MickeyEngine::inventory() {
void MickeyEngine::intro() {
// Draw Sierra logo
- //drawLogo(); // Original does not even show this, so we skip it too
- //waitAnyKey(); // Not in the original, but needed so that the logo is visible
+ drawLogo(); // Original does not even show this, so we skip it too
+ waitAnyKey(); // Not in the original, but needed so that the logo is visible
// draw title picture
_gameStateMickey.iRoom = IDI_MSA_PIC_TITLE;
@@ -1448,14 +1447,14 @@ void MickeyEngine::intro() {
playSound(IDI_MSA_SND_PRESS_BLUE);
//Set screen to white
- _gfx->clearScreen(15);
- _gfx->doUpdate();
+ _gfx->clearDisplay(15);
+ _gfx->updateScreen();
_system->delayMillis(IDI_MSA_ANIM_DELAY);
//Set back to black
- _gfx->clearScreen(0);
- _gfx->doUpdate();
+ _gfx->clearDisplay(0);
+ _gfx->updateScreen();
drawRoom();
printDesc(_gameStateMickey.iRoom);
@@ -2032,7 +2031,7 @@ bool MickeyEngine::parse(int cmd, int arg) {
}
break;
case IDI_MSA_ACTION_PRESS_BUTTON:
- if (_gameStateMickey.fShipDoorOpen) { // inner door open
+ if (_gameStateMickey.fShipDoorOpen) { // inner door open
if (_gameStateMickey.iPlanet && !_gameStateMickey.fSuit) {
printDatMessage(arg);
} else {
@@ -2120,7 +2119,7 @@ bool MickeyEngine::parse(int cmd, int arg) {
printDatString(22);
drawStr(IDI_MSA_ROW_PLANET, IDI_MSA_COL_PLANET, IDA_DEFAULT,
- (const char *)IDS_MSA_PLANETS[_gameStateMickey.iPlanet]);
+ (const char *)IDS_MSA_PLANETS[_gameStateMickey.iPlanet]);
waitAnyKey(true);
@@ -2201,7 +2200,7 @@ void MickeyEngine::waitAnyKey(bool anim) {
Common::Event event;
if (!anim)
- _gfx->doUpdate();
+ _gfx->updateScreen();
while (!shouldQuit()) {
while (_system->getEventManager()->pollEvent(event)) {
@@ -2219,10 +2218,9 @@ void MickeyEngine::waitAnyKey(bool anim) {
if (anim) {
animate();
- _gfx->doUpdate();
}
- _system->updateScreen();
+ _gfx->updateScreen();
_system->delayMillis(10);
}
}
@@ -2264,7 +2262,7 @@ void MickeyEngine::init() {
readExe(IDO_MSA_ROOM_TEXT_OFFSETS, buffer, sizeof(buffer));
memcpy(_gameStateMickey.oRmTxt, buffer, sizeof(_gameStateMickey.oRmTxt));
for (int i = 0; i < IDI_MSA_MAX_ROOM; i++)
- _gameStateMickey.oRmTxt[i] = buffer[i*2] + 256 * buffer[i*2+1];
+ _gameStateMickey.oRmTxt[i] = buffer[i * 2] + 256 * buffer[i * 2 + 1];
// read room object indices
//readExe(IDO_MSA_ROOM_OBJECT, buffer, sizeof(buffer));
@@ -2300,7 +2298,7 @@ void MickeyEngine::init() {
#endif
- setflag(fSoundOn, true); // enable sound
+ setFlag(VM_FLAG_SOUND_ON, true); // enable sound
}
Common::Error MickeyEngine::go() {
@@ -2341,7 +2339,7 @@ Common::Error MickeyEngine::go() {
}
}
} else {
- _gameStateMickey.nAir = 50; // max air supply
+ _gameStateMickey.nAir = 50; // max air supply
}
done = checkMenu();