ScummVM API documentation
adl_v4.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ADL_ADL_V4_H
23 #define ADL_ADL_V4_H
24 
25 #include "adl/adl_v3.h"
26 
27 namespace Adl {
28 
29 // Base track/sector for a region
31  byte track;
32  byte sector;
33 };
34 
35 // Location of the 7 initial data blocks, relative to RegionLocation
37  byte track;
38  byte sector;
39  byte offset;
40  byte volume;
41 };
42 
43 class AdlEngine_v4 : public AdlEngine_v3 {
44 public:
45  ~AdlEngine_v4() override;
46 
47 protected:
48  AdlEngine_v4(OSystem *syst, const AdlGameDescription *gd);
49 
50  // AdlEngine
51  void setupOpcodeTables() override;
52  void gameLoop() override;
53  void loadState(Common::ReadStream &stream) override;
54  void saveState(Common::WriteStream &stream) override;
55  Common::String loadMessage(uint idx) const override;
56  Common::String getItemDescription(const Item &item) const override;
57  void switchRegion(byte region) override;
58  void switchRoom(byte roomNr) override;
59 
60  // AdlEngine_v2
61  void adjustDataBlockPtr(byte &track, byte &sector, byte &offset, byte &size) const override;
62 
63  enum RegionChunkType {
64  kRegionChunkUnknown,
65  kRegionChunkMessages,
66  kRegionChunkGlobalPics,
67  kRegionChunkVerbs,
68  kRegionChunkNouns,
69  kRegionChunkRooms,
70  kRegionChunkRoomCmds,
71  kRegionChunkGlobalCmds
72  };
73 
74  void loadRegionLocations(Common::ReadStream &stream, uint regions);
75  void loadRegionInitDataOffsets(Common::ReadStream &stream, uint regions);
76  void initRegions(const byte *roomsPerRegion, uint regions);
77  void fixupDiskOffset(byte &track, byte &sector) const;
78  virtual RegionChunkType getRegionChunkType(const uint16 addr) const;
79  void loadRegion(byte region);
80  void loadItemPicIndex(Common::ReadStream &stream, uint items);
81  void backupRoomState(byte room);
82  virtual void initRoomState(RoomState &roomState) const;
83  virtual byte restoreRoomState(byte room);
84  void backupVars();
85  void restoreVars();
86 
87  int o_isItemInRoom(ScriptEnv &e) override;
88  virtual int o_isVarGT(ScriptEnv &e);
89  int o_moveItem(ScriptEnv &e) override;
90  virtual int o_setRegionToPrev(ScriptEnv &e);
91  int o_moveAllItems(ScriptEnv &e) override;
92  virtual int o_setRegion(ScriptEnv &e);
93  int o_save(ScriptEnv &e) override;
94  int o_restore(ScriptEnv &e) override;
95  int o_restart(ScriptEnv &e) override;
96  virtual int o_setRegionRoom(ScriptEnv &e);
97  int o_setRoomPic(ScriptEnv &e) override;
98 
99  Common::Array<RegionLocation> _regionLocations;
100  Common::Array<RegionInitDataOffset> _regionInitDataOffsets;
101  Common::SeekableReadStream *_itemPicIndex;
102 };
103 
104 } // End of namespace Adl
105 
106 #endif
Definition: adl.h:191
Definition: str.h:59
Definition: stream.h:77
Definition: adl_v4.h:36
Definition: array.h:52
Definition: adl.h:55
Definition: detection.h:71
Definition: stream.h:745
Definition: adl_v4.h:43
Definition: adl.h:127
Definition: adl_v4.h:30
Definition: adl.h:169
Definition: adl_v3.h:29
Definition: stream.h:385
Definition: system.h:161