aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins
diff options
context:
space:
mode:
authorStrangerke2013-09-08 14:49:34 +0200
committerStrangerke2013-09-08 14:49:34 +0200
commit599d2eeb06c937a4479cc751f4f9f5e94795c43b (patch)
tree6efd0f887d7a1fd5082209a585d609983031c92d /engines/hopkins
parent7df4c94aeb6c1408d26d6ada58d728b6eac17717 (diff)
parent03bf56ea82c0b89f4e61e5e0787a36473f999efa (diff)
downloadscummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.tar.gz
scummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.tar.bz2
scummvm-rg350-599d2eeb06c937a4479cc751f4f9f5e94795c43b.zip
Merge branch 'master' into avalanche
Diffstat (limited to 'engines/hopkins')
-rw-r--r--engines/hopkins/computer.cpp53
-rw-r--r--engines/hopkins/computer.h2
-rw-r--r--engines/hopkins/detection.cpp4
-rw-r--r--engines/hopkins/dialogs.cpp4
-rw-r--r--engines/hopkins/globals.cpp2
-rw-r--r--engines/hopkins/graphics.cpp12
-rw-r--r--engines/hopkins/graphics.h2
-rw-r--r--engines/hopkins/hopkins.cpp43
-rw-r--r--engines/hopkins/hopkins.h4
-rw-r--r--engines/hopkins/saveload.cpp61
-rw-r--r--engines/hopkins/saveload.h6
-rw-r--r--engines/hopkins/script.cpp13
12 files changed, 116 insertions, 90 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp
index f7b923badf..c09d748b97 100644
--- a/engines/hopkins/computer.cpp
+++ b/engines/hopkins/computer.cpp
@@ -58,7 +58,7 @@ ComputerManager::ComputerManager(HopkinsEngine *vm) {
_minBreakoutMoveSpeed = 0;
_maxBreakoutMoveSpeed = 0;
_lastBreakoutMoveSpeed = 0;
- _breakoutHiscore = 0;
+ _lowestHiScore = 0;
}
/**
@@ -579,26 +579,32 @@ void ComputerManager::displayGamesSubMenu() {
*/
void ComputerManager::loadHiscore() {
byte *ptr = _vm->_globals->allocMemory(100);
- _vm->_saveLoad->load("HISCORE.DAT", ptr);
+ memset(ptr, 0, 100);
+
+ if (_vm->_saveLoad->saveExists(_vm->getTargetName() + "-highscore.dat"))
+ _vm->_saveLoad->load(_vm->getTargetName() + "-highscore.dat", ptr);
for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) {
- for (int i = 0; i < 5; ++i) {
+ _score[scoreIndex]._name = " ";
+ _score[scoreIndex]._score = " ";
+
+ for (int i = 0; i < 6; ++i) {
char nextChar = ptr[(16 * scoreIndex) + i];
if (!nextChar)
nextChar = ' ';
- _score[scoreIndex]._name += nextChar;
+ _score[scoreIndex]._name.setChar(nextChar, i);
}
for (int i = 0; i < 9; ++i) {
char nextChar = ptr[(scoreIndex * 16) + 6 + i];
if (!nextChar)
nextChar = '0';
- _score[scoreIndex]._score += nextChar;
+ _score[scoreIndex]._score.setChar(nextChar, i);
}
}
+ _lowestHiScore = atol(_score[5]._score.c_str());
_vm->_globals->freeMemory(ptr);
- _breakoutHiscore = atol(_score[5]._score.c_str());
}
/**
@@ -779,7 +785,7 @@ void ComputerManager::playBreakout() {
_vm->_events->mouseOn();
_vm->_objectsMan->removeSprite(0);
_vm->_objectsMan->removeSprite(1);
- if (_breakoutScore > _breakoutHiscore)
+ if (_breakoutScore > _lowestHiScore)
getScoreName();
if (displayHiscores() != 1)
break;
@@ -823,11 +829,11 @@ int ComputerManager::displayHiscores() {
yp += 46;
// Display the characters of the name
- for (int i = 0; i <= 5; i++)
+ for (int i = 0; i < 6; i++)
displayHiscoreLine(ptr, 9 * i + 69, yp, _score[scoreIndex]._name[i]);
// Display the digits of the score
- for (int i = 0; i <= 8; i++)
+ for (int i = 0; i < 9; i++)
displayHiscoreLine(ptr, 9 * i + 199, yp, _score[scoreIndex]._score[i]);
}
@@ -864,6 +870,19 @@ void ComputerManager::getScoreName() {
_vm->_graphicsMan->setColorPercentage(254, 0, 0, 0);
byte *ptr = _vm->_fileIO->loadFile("ALPHA.SPR");
_vm->_graphicsMan->fadeInBreakout();
+
+ // Figure out the line to put the new high score on
+ int scoreLine = 0;
+ while (scoreLine < 5 && _breakoutScore < atol(_score[scoreLine]._score.c_str()))
+ ++scoreLine;
+
+ // If it's not the lasat line, move the lines down
+ for (int line = 5; line > scoreLine; --line) {
+ _score[line]._name = _score[line - 1]._name;
+ _score[line]._score = _score[line - 1]._score;
+ }
+
+ // Get the name for the new high score
for (int strPos = 0; strPos <= 4; strPos++) {
displayHiscoreLine(ptr, 9 * strPos + 140, 78, 1);
@@ -873,13 +892,15 @@ void ComputerManager::getScoreName() {
if ((curChar > '9') && (curChar < 'A'))
curChar = ' ';
- _score[5]._name.setChar(curChar, strPos);
+ _score[scoreLine]._name.setChar(curChar, strPos);
displayHiscoreLine(ptr, 9 * strPos + 140, 78, curChar);
for (int idx = 0; idx < 12; ++idx)
_vm->_events->refreshScreenAndEvents();
}
- _score[5]._score = " ";
+
+ // Set up the new score
+ _score[scoreLine]._score = " ";
char score[16];
sprintf(score, "%d", _breakoutScore);
@@ -888,8 +909,8 @@ void ComputerManager::getScoreName() {
++scoreLen;
while (score[scoreLen]);
- for (int i = scoreLen, scorePos = 8; i >= 0; i--) {
- _score[5]._score.setChar(score[i], scorePos--);
+ for (int i = scoreLen - 1, scorePos = 8; i >= 0; i--) {
+ _score[scoreLine]._score.setChar(score[i], scorePos--);
}
_vm->_graphicsMan->fadeOutBreakout();
_vm->_globals->freeMemory(ptr);
@@ -970,10 +991,10 @@ void ComputerManager::saveScore() {
}
byte *ptr = _vm->_globals->allocMemory(100);
- memset(ptr, 0, 99);
+ memset(ptr, 0, 100);
for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) {
int curBufPtr = 16 * scorePlaceIdx;
- for (int namePos = 0; namePos <= 4; namePos++) {
+ for (int namePos = 0; namePos < 6; namePos++) {
char curChar = _score[scorePlace[scorePlaceIdx]]._name[namePos];
if (!curChar)
curChar = ' ';
@@ -991,7 +1012,7 @@ void ComputerManager::saveScore() {
ptr[curBufPtr + 15] = 0;
}
- _vm->_saveLoad->saveFile("HISCORE.DAT", ptr, 100);
+ _vm->_saveLoad->saveFile(_vm->getTargetName() + "-highscore.dat", ptr, 100);
_vm->_globals->freeMemory(ptr);
}
diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h
index cdd653f793..1771bba7d6 100644
--- a/engines/hopkins/computer.h
+++ b/engines/hopkins/computer.h
@@ -63,7 +63,7 @@ private:
bool _ballUpFl;
int _breakoutLevelNbr;
int _padPositionX;
- int _breakoutHiscore;
+ int _lowestHiScore;
int _minBreakoutMoveSpeed;
int _maxBreakoutMoveSpeed;
int _lastBreakoutMoveSpeed;
diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp
index 9d16b0ab51..c617a5aacf 100644
--- a/engines/hopkins/detection.cpp
+++ b/engines/hopkins/detection.cpp
@@ -56,6 +56,10 @@ bool HopkinsEngine::getIsDemo() const {
return _gameDescription->desc.flags & ADGF_DEMO;
}
+const Common::String &HopkinsEngine::getTargetName() const {
+ return _targetName;
+}
+
} // End of namespace Hopkins
static const PlainGameDescriptor hopkinsGames[] = {
diff --git a/engines/hopkins/dialogs.cpp b/engines/hopkins/dialogs.cpp
index 6cdfbf47d1..3b8fedf0ee 100644
--- a/engines/hopkins/dialogs.cpp
+++ b/engines/hopkins/dialogs.cpp
@@ -505,7 +505,7 @@ void DialogsManager::inventAnim() {
return;
if (_vm->_objectsMan->_eraseVisibleCounter && !_vm->_objectsMan->_visibleFl) {
- _vm->_graphicsMan->copySurface(_vm->_graphicsMan->_backBuffer, _oldInventX, 27, 48, 38,
+ _vm->_graphicsMan->copySurface(_vm->_graphicsMan->_backBuffer, _oldInventX, 27, 48, 38,
_vm->_graphicsMan->_frontBuffer, _oldInventX, 27);
_vm->_graphicsMan->addDirtyRect(_oldInventX, 27, _oldInventX + 48, 65);
--_vm->_objectsMan->_eraseVisibleCounter;
@@ -691,7 +691,7 @@ void DialogsManager::showSaveLoad(SaveLoadMode mode) {
Graphics::Surface thumb8;
_vm->_saveLoad->convertThumb16To8(header._thumbnail, &thumb8);
- byte *thumb = (byte *)thumb8.pixels;
+ byte *thumb = (byte *)thumb8.getPixels();
int16 startPosX_ = _vm->_events->_startPos.x;
switch (slotNumber) {
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index 28f22ed99e..a9a0a81f08 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -134,7 +134,7 @@ Globals::~Globals() {
void Globals::setConfig() {
// CHECKME: Should be in Globals() but it doesn't work
// The Polish version is a translation of the English version. The filenames are the same.
- // The Russian version looks like a translation of the English version, based on the filenames.
+ // The Russian version looks like a translation of the English version, based on the filenames.
switch (_vm->getLanguage()) {
case Common::EN_ANY:
case Common::PL_POL:
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index ebc5cfa8da..de9f043763 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -325,7 +325,7 @@ void GraphicsManager::loadPCX640(byte *surface, const Common::String &file, byte
// Copy out the dimensions and pixels of the decoded surface
_largeScreenFl = s->w > SCREEN_WIDTH;
- Common::copy((byte *)s->pixels, (byte *)s->pixels + (s->pitch * s->h), surface);
+ Common::copy((const byte *)s->getPixels(), (const byte *)s->getBasePtr(0, s->h), surface);
// Copy out the palette
const byte *palSrc = pcxDecoder.getPalette();
@@ -1179,7 +1179,7 @@ void GraphicsManager::displayZones() {
Common::Rect r(_vm->_objectsMan->_bob[bobId]._oldX, _vm->_objectsMan->_bob[bobId]._oldY,
_vm->_objectsMan->_bob[bobId]._oldX + _vm->_objectsMan->_bob[bobId]._oldWidth,
_vm->_objectsMan->_bob[bobId]._oldY + _vm->_objectsMan->_bob[bobId]._oldHeight);
-
+
displayDebugRect(screenSurface, r, 0xff0000);
}
}
@@ -1202,15 +1202,13 @@ void GraphicsManager::displayZones() {
void GraphicsManager::displayLines() {
Graphics::Surface *screenSurface = g_system->lockScreen();
- uint16* pixels = (uint16*)screenSurface->pixels;
-
- for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) {
+ for (int lineIndex = 0; lineIndex < _vm->_linesMan->_linesNumb; lineIndex++) {
int i = 0;
do {
int x = _vm->_linesMan->_lineItem[lineIndex]._lineData[i] - _scrollPosX;
int y = _vm->_linesMan->_lineItem[lineIndex]._lineData[i+1];
if (x >= 0 && x < SCREEN_WIDTH && y >= 0 && y < SCREEN_HEIGHT) {
- pixels[ y * screenSurface->w + x ] = 0xffff;
+ WRITE_UINT16(screenSurface->getBasePtr(x, y), 0xffff);
}
i += 2;
}
@@ -1230,7 +1228,7 @@ void GraphicsManager::displayDebugRect(Graphics::Surface *surface, const Common:
r.top = MAX(r.top, (int16)0);
r.right = MIN(r.right, (int16)SCREEN_WIDTH);
r.bottom = MIN(r.bottom, (int16)SCREEN_HEIGHT);
-
+
// If there's an on-screen portion, display it
if (r.isValidRect())
surface->frameRect(r, color);
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 268db7fc2b..8767f5ec4d 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -125,7 +125,7 @@ public:
public:
GraphicsManager(HopkinsEngine *vm);
~GraphicsManager();
-
+
void clearPalette();
void clearScreen();
void clearVesaScreen();
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 407f264116..96131f2968 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -35,12 +35,9 @@
namespace Hopkins {
-HopkinsEngine *g_vm;
-
HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Hopkins") {
DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level");
- g_vm = this;
_animMan = new AnimationManager(this);
_computer = new ComputerManager(this);
_dialog = new DialogsManager(this);
@@ -95,7 +92,7 @@ bool HopkinsEngine::canLoadGameStateCurrently() {
* Returns true if it is currently okay to save the game
*/
bool HopkinsEngine::canSaveGameStateCurrently() {
- return !_globals->_exitId && !_globals->_cityMapEnabledFl && _events->_mouseFl
+ return !_globals->_exitId && !_globals->_cityMapEnabledFl && _events->_mouseFl
&& _globals->_curRoomNum != 0 && !isUnderwaterSubScene();
}
@@ -114,8 +111,6 @@ Common::Error HopkinsEngine::saveGameState(int slot, const Common::String &desc)
}
Common::Error HopkinsEngine::run() {
- _saveLoad->initSaves();
-
_globals->setConfig();
_fileIO->initCensorship();
initializeSystem();
@@ -164,7 +159,7 @@ bool HopkinsEngine::runWin95Demo() {
_globals->_speed = 3;
if (_startGameSlot == -1)
- _graphicsMan->fadeOutLong();
+ _graphicsMan->fadeOutShort();
_globals->_eventMode = EVENTMODE_IGNORE;
_globals->_characterSpriteBuf = _fileIO->loadFile("PERSO.SPR");
@@ -201,12 +196,15 @@ bool HopkinsEngine::runWin95Demo() {
switch (_globals->_exitId) {
case 1:
+ // Handles room: Apartment
_linesMan->setMaxLineIdx(40);
_globals->_characterMaxPosY = 435;
_objectsMan->sceneControl2("IM01", "IM01", "ANIM01", "IM01", 2, true);
break;
case 3:
+ // - Displays bank attack when leaving the apartment
+ // - Handles room: bottom of the apartment
if (!_globals->_saveData->_data[svBankAttackAnimPlayedFl]) {
_soundMan->playSound(3);
if (getPlatform() == Common::kPlatformOS2 || getPlatform() == Common::kPlatformBeOS)
@@ -235,7 +233,7 @@ bool HopkinsEngine::runWin95Demo() {
_soundMan->removeSample(2);
_soundMan->removeSample(3);
_soundMan->removeSample(4);
- _graphicsMan->fadeOutLong();
+ _graphicsMan->fadeOutShort();
_globals->_saveData->_data[svBankAttackAnimPlayedFl] = 1;
}
_linesMan->setMaxLineIdx(5);
@@ -244,12 +242,14 @@ bool HopkinsEngine::runWin95Demo() {
break;
case 4:
+ // Handle room: City map
_globals->_disableInventFl = true;
_objectsMan->handleCityMap();
_globals->_disableInventFl = false;
break;
case 5:
+ // Handle room: Outside the bank
_linesMan->setMaxLineIdx(5);
_globals->_characterMaxPosY = 455;
@@ -793,14 +793,14 @@ bool HopkinsEngine::runFull() {
if (_startGameSlot == -1) {
if (getPlatform() == Common::kPlatformLinux) {
- _graphicsMan->loadImage("H2");
- _graphicsMan->fadeInLong();
- _events->delay(500);
- _graphicsMan->fadeOutLong();
- _globals->_speed = 2;
- _globals->_eventMode = EVENTMODE_IGNORE;
- _graphicsMan->_fadingFl = true;
- _animMan->playAnim("MP.ANM", "MP.ANM", 10, 16, 200);
+ _graphicsMan->loadImage("H2");
+ _graphicsMan->fadeInLong();
+ _events->delay(500);
+ _graphicsMan->fadeOutLong();
+ _globals->_speed = 2;
+ _globals->_eventMode = EVENTMODE_IGNORE;
+ _graphicsMan->_fadingFl = true;
+ _animMan->playAnim("MP.ANM", "MP.ANM", 10, 16, 200);
} else {
_animMan->playAnim("MP.ANM", "MP.ANM", 10, 16, 200);
_graphicsMan->fadeOutLong();
@@ -1133,12 +1133,14 @@ bool HopkinsEngine::runFull() {
break;
case 30:
+ // Shooting
_linesMan->setMaxLineIdx(15);
_globals->_characterMaxPosY = 440;
_objectsMan->sceneControl2("IM30", "IM30", "ANIM30", "IM30", 24, false);
break;
case 31:
+ // Shooting target
_objectsMan->sceneControl("IM31", "IM31", "ANIM31", "IM31", 10, true);
break;
@@ -1153,6 +1155,7 @@ bool HopkinsEngine::runFull() {
break;
case 34:
+ // In the airport, before the flight cut-scene
_objectsMan->sceneControl("IM34", "IM34", "ANIM34", "IM34", 2, false);
break;
@@ -1183,6 +1186,7 @@ bool HopkinsEngine::runFull() {
}
case 50:
+ // Flight cut scene
playPlaneCutscene();
_globals->_exitId = 51;
break;
@@ -1904,10 +1908,7 @@ void HopkinsEngine::bombExplosion() {
}
void HopkinsEngine::restoreSystem() {
- // If the game isn't alerady trying to quit, flag that quitting is needed
- if (!shouldQuit())
- quitGame();
-
+ quitGame();
_events->refreshEvents();
}
@@ -2232,6 +2233,8 @@ void HopkinsEngine::playPlaneCutscene() {
if (!_events->_escKeyFl) {
_graphicsMan->_fadingFl = true;
_animMan->playAnim("PARA00A.ANM", "PARA00.ANM", 9, 9, 9);
+ } else {
+ _graphicsMan->fadeOutShort();
}
_events->_escKeyFl = false;
diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h
index 777fd1c335..d8c30e5004 100644
--- a/engines/hopkins/hopkins.h
+++ b/engines/hopkins/hopkins.h
@@ -164,6 +164,7 @@ public:
Common::Platform getPlatform() const;
uint16 getVersion() const;
bool getIsDemo() const;
+ const Common::String &getTargetName() const;
int getRandomNumber(int maxNumber);
Common::String generateSaveName(int slotNumber);
@@ -183,9 +184,6 @@ public:
virtual void syncSoundSettings();
};
-// Global reference to the HopkinsEngine object
-extern HopkinsEngine *g_vm;
-
} // End of namespace Hopkins
#endif /* HOPKINS_HOPKINS_H */
diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp
index 45b4885c90..b0dea7e6d1 100644
--- a/engines/hopkins/saveload.cpp
+++ b/engines/hopkins/saveload.cpp
@@ -43,39 +43,38 @@ SaveLoadManager::SaveLoadManager(HopkinsEngine *vm) {
}
bool SaveLoadManager::save(const Common::String &file, const void *buf, size_t n) {
- Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(file);
+ Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(file);
- if (f) {
- size_t bytesWritten = f->write(buf, n);
- f->finalize();
- delete f;
+ if (savefile) {
+ size_t bytesWritten = savefile->write(buf, n);
+ savefile->finalize();
+ delete savefile;
return bytesWritten == n;
} else
return false;
}
+bool SaveLoadManager::saveExists(const Common::String &file) {
+ Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(file);
+ bool result = savefile != NULL;
+ delete savefile;
+ return result;
+}
+
// Save File
bool SaveLoadManager::saveFile(const Common::String &file, const void *buf, size_t n) {
return save(file, buf, n);
}
-void SaveLoadManager::initSaves() {
- Common::String dataFilename = "HISCORE.DAT";
- byte data[100];
- Common::fill(&data[0], &data[100], 0);
-
- saveFile(dataFilename, data, 100);
-}
-
void SaveLoadManager::load(const Common::String &file, byte *buf) {
- Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(file);
- if (f == NULL)
- error("Error openinig file - %s", file.c_str());
+ Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(file);
+ if (savefile == NULL)
+ error("Error opening file - %s", file.c_str());
- int32 filesize = f->size();
- f->read(buf, filesize);
- delete f;
+ int32 filesize = savefile->size();
+ savefile->read(buf, filesize);
+ delete savefile;
}
bool SaveLoadManager::readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header) {
@@ -215,13 +214,13 @@ Common::Error SaveLoadManager::loadGame(int slot) {
bool SaveLoadManager::readSavegameHeader(int slot, hopkinsSavegameHeader &header) {
// Try and open the save file for reading
- Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(
- g_vm->generateSaveName(slot));
- if (!saveFile)
+ Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(
+ _vm->generateSaveName(slot));
+ if (!savefile)
return false;
- bool result = readSavegameHeader(saveFile, header);
- delete saveFile;
+ bool result = readSavegameHeader(savefile, header);
+ delete savefile;
return result;
}
@@ -234,14 +233,14 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) {
Graphics::Surface thumb8;
thumb8.create(w, h, Graphics::PixelFormat::createFormatCLUT8());
- _vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.pixels,
+ _vm->_graphicsMan->reduceScreenPart(_vm->_graphicsMan->_frontBuffer, (byte *)thumb8.getPixels(),
_vm->_events->_startPos.x, 20, SCREEN_WIDTH, SCREEN_HEIGHT - 40, 80);
// Convert the 8-bit pixel to 16 bit surface
s->create(w, h, Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0));
- const byte *srcP = (const byte *)thumb8.pixels;
- uint16 *destP = (uint16 *)s->pixels;
+ const byte *srcP = (const byte *)thumb8.getPixels();
+ uint16 *destP = (uint16 *)s->getPixels();
for (int yp = 0; yp < h; ++yp) {
// Copy over the line, using the source pixels as lookups into the pixels palette
@@ -259,6 +258,10 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) {
}
void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) {
+ // The brief version 3 had the highscores embedded. They're in a separate file now, so skip
+ if (version == 3 && s.isLoading())
+ s.skip(100);
+
s.syncBytes(&_vm->_globals->_saveData->_data[0], 2050);
syncCharacterLocation(s, _vm->_globals->_saveData->_cloneHopkins);
syncCharacterLocation(s, _vm->_globals->_saveData->_realHopkins);
@@ -296,8 +299,8 @@ void SaveLoadManager::convertThumb16To8(Graphics::Surface *thumb16, Graphics::Su
pixelFormat16.colorToRGB(p, paletteR[palIndex], paletteG[palIndex], paletteB[palIndex]);
}
- const uint16 *srcP = (const uint16 *)thumb16->pixels;
- byte *destP = (byte *)thumb8->pixels;
+ const uint16 *srcP = (const uint16 *)thumb16->getPixels();
+ byte *destP = (byte *)thumb8->getPixels();
for (int yp = 0; yp < thumb16->h; ++yp) {
const uint16 *lineSrcP = srcP;
diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h
index 221a445fd2..5b77c11f12 100644
--- a/engines/hopkins/saveload.h
+++ b/engines/hopkins/saveload.h
@@ -35,7 +35,7 @@ namespace Hopkins {
class HopkinsEngine;
-#define HOPKINS_SAVEGAME_VERSION 2
+#define HOPKINS_SAVEGAME_VERSION 4
struct hopkinsSavegameHeader {
uint8 _version;
@@ -56,14 +56,14 @@ private:
public:
SaveLoadManager(HopkinsEngine *vm);
- void initSaves();
+ bool saveExists(const Common::String &file);
bool save(const Common::String &file, const void *buf, size_t n);
bool saveFile(const Common::String &file, const void *buf, size_t n);
void load(const Common::String &file, byte *buf);
static bool readSavegameHeader(Common::InSaveFile *in, hopkinsSavegameHeader &header);
void writeSavegameHeader(Common::OutSaveFile *out, hopkinsSavegameHeader &header);
- static bool readSavegameHeader(int slot, hopkinsSavegameHeader &header);
+ bool readSavegameHeader(int slot, hopkinsSavegameHeader &header);
Common::Error saveGame(int slot, const Common::String &saveName);
Common::Error loadGame(int slot);
diff --git a/engines/hopkins/script.cpp b/engines/hopkins/script.cpp
index c39273203d..7e150624b8 100644
--- a/engines/hopkins/script.cpp
+++ b/engines/hopkins/script.cpp
@@ -536,6 +536,7 @@ int ScriptManager::handleOpcode(const byte *dataP) {
break;
case 12:
+ // Bank - negotiations between Hopkins and one of the killers
_vm->_fontMan->hideText(9);
_vm->_events->refreshScreenAndEvents();
_vm->_events->refreshScreenAndEvents();
@@ -543,6 +544,7 @@ int ScriptManager::handleOpcode(const byte *dataP) {
break;
case 13:
+ // Bank - after negotiations, Hopkins enters the bank
_vm->_events->_mouseButton = _vm->_events->_curMouseButton;
_vm->_globals->_disableInventFl = true;
_vm->_graphicsMan->fadeOutLong();
@@ -553,9 +555,7 @@ int ScriptManager::handleOpcode(const byte *dataP) {
_vm->_graphicsMan->endDisplayBob();
_vm->_objectsMan->clearScreen();
- if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo()) {
- _vm->_graphicsMan->fadeOutLong();
- } else {
+ if ((_vm->getPlatform() != Common::kPlatformWindows) || !_vm->getIsDemo()) {
_vm->_soundMan->playSoundFile("SOUND17.WAV");
_vm->_graphicsMan->_fadingFl = true;
_vm->_animMan->playSequence2("HELICO.SEQ", 10, 4, 10);
@@ -615,10 +615,6 @@ int ScriptManager::handleOpcode(const byte *dataP) {
_vm->_graphicsMan->_fadingFl = true;
_vm->_animMan->playSequence2("ASSOM.SEQ", 10, 4, 500);
_vm->_soundMan->_specialSoundNum = 0;
-
- if ((_vm->getPlatform() == Common::kPlatformWindows) && _vm->getIsDemo())
- _vm->_graphicsMan->fadeOutLong();
-
_vm->_globals->_disableInventFl = false;
_vm->_objectsMan->_helicopterFl = true;
break;
@@ -1221,6 +1217,7 @@ int ScriptManager::handleOpcode(const byte *dataP) {
break;
case 88:
+ // Shooting target - Shooting at target
if (_vm->_globals->_saveData->_data[svField183] == 1) {
_vm->_objectsMan->setBobAnimDataIdx(1, 0);
_vm->_objectsMan->setBobAnimDataIdx(2, 0);
@@ -1298,6 +1295,7 @@ int ScriptManager::handleOpcode(const byte *dataP) {
break;
case 90:
+ // Shooting target - Using the level
_vm->_soundMan->playSoundFile("SOUND52.WAV");
if (!_vm->_globals->_saveData->_data[svField186]) {
_vm->_animMan->playSequence("CIB5A.SEQ", 1, 12, 1, false, false);
@@ -1984,6 +1982,7 @@ int ScriptManager::handleOpcode(const byte *dataP) {
break;
case 216:
+ // Discuss with pilot just before Flight cutscene
_vm->_globals->_introSpeechOffFl = true;
_vm->_talkMan->startAnimatedCharacterDialogue("aviat1.pe2");
_vm->_globals->_introSpeechOffFl = false;