GOB: Change the NOCD workaround for Urban Runner a bit

Seems like the game does close the CD1.ITK too, so we just
open all ITKs right at the start, lest it might blow up when
it wants to close the top ITK and that's actually CD4.

svn-id: r55461
This commit is contained in:
Sven Hesse 2011-01-23 11:00:57 +00:00
parent 191d85f174
commit 411d41d3d0
3 changed files with 17 additions and 26 deletions

View File

@ -28,6 +28,7 @@
#include "gob/gob.h"
#include "gob/init.h"
#include "gob/global.h"
#include "gob/dataio.h"
namespace Gob {
@ -40,9 +41,22 @@ Init_v6::~Init_v6() {
void Init_v6::initGame() {
_vm->_global->_noCd = false;
if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") &&
Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) {
_vm->_global->_noCd = true;
if (_vm->getGameType() == kGameTypeUrban) {
if (Common::File::exists("cd1.itk") && Common::File::exists("cd2.itk") &&
Common::File::exists("cd3.itk") && Common::File::exists("cd4.itk")) {
_vm->_global->_noCd = true;
// WORKAROUND: The CD number detection in Urban Runner is quite daft
// (it checks CD1.ITK - CD4.ITK and the first that's found determines
// the CD number), while its NO_CD modus wants everything in CD1.ITK.
// So we just open the other ITKs, too.
_vm->_dataIO->openArchive("CD1.ITK", false);
_vm->_dataIO->openArchive("CD2.ITK", false);
_vm->_dataIO->openArchive("CD3.ITK", false);
_vm->_dataIO->openArchive("CD4.ITK", false);
}
}
Init::initGame();

View File

@ -550,7 +550,6 @@ protected:
void o6_totSub();
void o6_playVmdOrMusic();
void o6_openItk();
bool o6_loadCursor(OpFuncParams &params);
bool o6_assign(OpFuncParams &params);

View File

@ -57,7 +57,6 @@ void Inter_v6::setupOpcodesDraw() {
OPCODEDRAW(0x40, o6_totSub);
OPCODEDRAW(0x83, o6_playVmdOrMusic);
OPCODEDRAW(0x85, o6_openItk);
}
void Inter_v6::setupOpcodesFunc() {
@ -199,27 +198,6 @@ void Inter_v6::o6_playVmdOrMusic() {
}
void Inter_v6::o6_openItk() {
char fileName[32];
_vm->_game->_script->evalExpr(0);
Common::strlcpy(fileName, _vm->_game->_script->getResultStr(), 28);
if (!strchr(fileName, '.'))
strcat(fileName, ".ITK");
_vm->_dataIO->openArchive(fileName, false);
// WORKAROUND: The CD number detection in Urban Runner is quite daft
// (it checks CD1.ITK - CD4.ITK and the first that's found determines
// the CD number), while its NO_CD modus wants everything in CD1.ITK.
// So we just open the other ITKs, too.
if (_vm->_global->_noCd && !scumm_stricmp(fileName, "CD1.ITK")) {
_vm->_dataIO->openArchive("CD2.ITK", false);
_vm->_dataIO->openArchive("CD3.ITK", false);
_vm->_dataIO->openArchive("CD4.ITK", false);
}
}
bool Inter_v6::o6_loadCursor(OpFuncParams &params) {
int16 id = _vm->_game->_script->readInt16();