ADL: Add ADL_v3 class for hires4

This commit is contained in:
Walter van Niftrik 2016-08-26 13:27:14 +02:00
parent 1ca15d76d3
commit 92cea7ab35
5 changed files with 107 additions and 3 deletions

58
engines/adl/adl_v3.cpp Normal file
View File

@ -0,0 +1,58 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "adl/adl_v3.h"
namespace Adl {
AdlEngine_v3::AdlEngine_v3(OSystem *syst, const AdlGameDescription *gd) :
AdlEngine_v2(syst, gd) {
}
typedef Common::Functor1Mem<ScriptEnv &, int, AdlEngine_v3> OpcodeV3;
void AdlEngine_v3::setupOpcodeTables() {
AdlEngine_v2::setupOpcodeTables();
delete _condOpcodes[0x04];
_condOpcodes[0x04] = new OpcodeV3(this, &AdlEngine_v3::o3_isNounNotInRoom);
}
int AdlEngine_v3::o3_isNounNotInRoom(ScriptEnv &e) {
OP_DEBUG_1("\t&& NO_SUCH_ITEMS_IN_ROOM(%s)", itemRoomStr(e.arg(1)).c_str());
Common::List<Item>::const_iterator item;
bool isAnItem = false;
for (item = _state.items.begin(); item != _state.items.end(); ++item) {
if (item->noun == e.getNoun()) {
isAnItem = true;
if (item->room == roomArg(e.arg(1)))
return -1;
}
}
return (isAnItem ? 1 : -1);
}
} // End of namespace Adl

45
engines/adl/adl_v3.h Normal file
View File

@ -0,0 +1,45 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef ADL_ADL_V3_H
#define ADL_ADL_V3_H
#include "adl/adl_v2.h"
namespace Adl {
class AdlEngine_v3 : public AdlEngine_v2 {
public:
virtual ~AdlEngine_v3() { }
protected:
AdlEngine_v3(OSystem *syst, const AdlGameDescription *gd);
// AdlEngine
virtual void setupOpcodeTables();
int o3_isNounNotInRoom(ScriptEnv &e);
};
} // End of namespace Adl
#endif

View File

@ -30,7 +30,7 @@
namespace Adl {
AdlEngine_v4::AdlEngine_v4(OSystem *syst, const AdlGameDescription *gd) :
AdlEngine_v2(syst, gd),
AdlEngine_v3(syst, gd),
_curDisk(0) {
}

View File

@ -23,7 +23,7 @@
#ifndef ADL_ADL_V4_H
#define ADL_ADL_V4_H
#include "adl/adl_v2.h"
#include "adl/adl_v3.h"
namespace Common {
class RandomSource;
@ -36,7 +36,7 @@ struct DiskOffset {
namespace Adl {
class AdlEngine_v4 : public AdlEngine_v2 {
class AdlEngine_v4 : public AdlEngine_v3 {
public:
virtual ~AdlEngine_v4() { }

View File

@ -3,6 +3,7 @@ MODULE := engines/adl
MODULE_OBJS := \
adl.o \
adl_v2.o \
adl_v3.o \
adl_v4.o \
console.o \
detection.o \