Permalink
Comparing changes
Open a pull request
- 8 commits
- 17 files changed
- 0 commit comments
- 1 contributor
Unified
Split
Showing
with
512 additions
and 126 deletions.
- +5 −3 engines/adl/adl.cpp
- +2 −2 engines/adl/adl.h
- +25 −0 engines/adl/adl_v2.cpp
- +3 −0 engines/adl/adl_v2.h
- +2 −22 engines/adl/adl_v4.cpp
- +0 −3 engines/adl/adl_v4.h
- +2 −1 engines/adl/disk.cpp
- +17 −5 engines/adl/display.cpp
- +5 −0 engines/adl/display.h
- +52 −54 engines/adl/graphics.cpp
- +18 −23 engines/adl/graphics.h
- +1 −1 engines/adl/hires0.cpp
- +9 −8 engines/adl/hires1.cpp
- +1 −1 engines/adl/hires2.cpp
- +365 −1 engines/adl/hires4.cpp
- +1 −1 engines/adl/hires5.cpp
- +4 −1 engines/adl/hires6.cpp
| @@ -139,12 +139,14 @@ Common::String AdlEngine::getItemDescription(const Item &item) const { | ||
| } | ||
|
|
||
| void AdlEngine::delay(uint32 ms) const { | ||
| uint32 start = g_system->getMillis(); | ||
| uint32 now = g_system->getMillis(); | ||
| const uint32 end = now + ms; | ||
|
|
||
| while (!shouldQuit() && g_system->getMillis() - start < ms) { | ||
| while (!shouldQuit() && now < end) { | ||
| Common::Event event; | ||
| pollEvent(event); | ||
| g_system->delayMillis(16); | ||
| g_system->delayMillis(end - now < 16 ? end - now : 16); | ||
| now = g_system->getMillis(); | ||
| } | ||
| } | ||
|
|
||
| @@ -148,14 +148,14 @@ struct Item { | ||
| byte region; | ||
| byte room; | ||
| byte picture; | ||
| bool isLineArt; | ||
| bool isShape; | ||
| Common::Point position; | ||
| int state; | ||
| byte description; | ||
| Common::Array<byte> roomPictures; | ||
| bool isOnScreen; | ||
|
|
||
| Item() : id(0), noun(0), region(0), room(0), picture(0), isLineArt(false), state(0), description(0), isOnScreen(false) { } | ||
| Item() : id(0), noun(0), region(0), room(0), picture(0), isShape(false), state(0), description(0), isOnScreen(false) { } | ||
| }; | ||
|
|
||
| struct Time { | ||
| @@ -26,6 +26,7 @@ | ||
| #include "adl/adl_v2.h" | ||
| #include "adl/display.h" | ||
| #include "adl/graphics.h" | ||
| #include "adl/detection.h" | ||
|
|
||
| namespace Adl { | ||
|
|
||
| @@ -38,13 +39,34 @@ AdlEngine_v2::AdlEngine_v2(OSystem *syst, const AdlGameDescription *gd) : | ||
| AdlEngine(syst, gd), | ||
| _maxLines(4), | ||
| _disk(nullptr), | ||
| _currentVolume(0), | ||
| _itemRemoved(false), | ||
| _roomOnScreen(0), | ||
| _picOnScreen(0), | ||
| _itemsOnScreen(0) { | ||
| _random = new Common::RandomSource("adl"); | ||
| } | ||
|
|
||
| Common::String AdlEngine_v2::getDiskImageName(byte volume) const { | ||
| const ADGameFileDescription *ag; | ||
|
|
||
| for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++) | ||
| if (ag->fileType == volume) | ||
| return ag->fileName; | ||
|
|
||
| error("Disk volume %d not found", volume); | ||
| } | ||
|
|
||
| void AdlEngine_v2::insertDisk(byte volume) { | ||
| delete _disk; | ||
| _disk = new DiskImage(); | ||
|
|
||
| if (!_disk->open(getDiskImageName(volume))) | ||
| error("Failed to open disk volume %d", volume); | ||
|
|
||
| _currentVolume = volume; | ||
| } | ||
|
|
||
| typedef Common::Functor1Mem<ScriptEnv &, int, AdlEngine_v2> OpcodeV2; | ||
| #define SetOpcodeTable(x) table = &x; | ||
| #define Opcode(x) table->push_back(new OpcodeV2(this, &AdlEngine_v2::x)) | ||
| @@ -612,6 +634,9 @@ int AdlEngine_v2::o2_initDisk(ScriptEnv &e) { | ||
| } | ||
|
|
||
| bool AdlEngine_v2::canSaveGameStateCurrently() { | ||
| if (!_canSaveNow) | ||
| return false; | ||
|
|
||
| // Back up first visit flag as it may be changed by this test | ||
| const bool isFirstTime = getCurRoom().isFirstTime; | ||
| const bool retval = AdlEngine::canSaveGameStateCurrently(); | ||
| @@ -54,6 +54,8 @@ class AdlEngine_v2 : public AdlEngine { | ||
| // Engine | ||
| bool canSaveGameStateCurrently(); | ||
|
|
||
| Common::String getDiskImageName(byte volume) const; | ||
| void insertDisk(byte volume); | ||
| virtual DataBlockPtr readDataBlockPtr(Common::ReadStream &f) const; | ||
| virtual void adjustDataBlockPtr(byte &track, byte §or, byte &offset, byte &size) const { } | ||
| void loadItems(Common::ReadStream &stream); | ||
| @@ -91,6 +93,7 @@ class AdlEngine_v2 : public AdlEngine { | ||
|
|
||
| uint _maxLines; | ||
| DiskImage *_disk; | ||
| byte _currentVolume; | ||
| Common::Array<DataBlockPtr> _itemPics; | ||
| bool _itemRemoved; | ||
| byte _roomOnScreen, _picOnScreen, _itemsOnScreen; | ||
| @@ -20,15 +20,15 @@ | ||
| * | ||
| */ | ||
|
|
||
| #include "common/error.h" | ||
|
|
||
| #include "adl/adl_v4.h" | ||
| #include "adl/display.h" | ||
| #include "adl/detection.h" | ||
|
|
||
| namespace Adl { | ||
|
|
||
| AdlEngine_v4::AdlEngine_v4(OSystem *syst, const AdlGameDescription *gd) : | ||
| AdlEngine_v3(syst, gd), | ||
| _currentVolume(0), | ||
| _itemPicIndex(nullptr) { | ||
|
|
||
| } | ||
| @@ -190,26 +190,6 @@ Common::String AdlEngine_v4::getItemDescription(const Item &item) const { | ||
| return _itemDesc[item.id - 1]; | ||
| } | ||
|
|
||
| Common::String AdlEngine_v4::getDiskImageName(byte volume) const { | ||
| const ADGameFileDescription *ag; | ||
|
|
||
| for (ag = _gameDescription->desc.filesDescriptions; ag->fileName; ag++) | ||
| if (ag->fileType == volume) | ||
| return ag->fileName; | ||
|
|
||
| error("Disk volume %d not found", volume); | ||
| } | ||
|
|
||
| void AdlEngine_v4::insertDisk(byte volume) { | ||
| delete _disk; | ||
| _disk = new DiskImage(); | ||
|
|
||
| if (!_disk->open(getDiskImageName(volume))) | ||
| error("Failed to open disk volume %d", volume); | ||
|
|
||
| _currentVolume = volume; | ||
| } | ||
|
|
||
| void AdlEngine_v4::loadRegionLocations(Common::ReadStream &stream, uint regions) { | ||
| for (uint r = 0; r < regions; ++r) { | ||
| RegionLocation loc; | ||
| @@ -71,8 +71,6 @@ class AdlEngine_v4 : public AdlEngine_v3 { | ||
| kRegionChunkGlobalCmds | ||
| }; | ||
|
|
||
| Common::String getDiskImageName(byte volume) const; | ||
| void insertDisk(byte volume); | ||
| void loadRegionLocations(Common::ReadStream &stream, uint regions); | ||
| void loadRegionInitDataOffsets(Common::ReadStream &stream, uint regions); | ||
| void initRegions(const byte *roomsPerRegion, uint regions); | ||
| @@ -98,7 +96,6 @@ class AdlEngine_v4 : public AdlEngine_v3 { | ||
| int o4_setRegionRoom(ScriptEnv &e); | ||
| int o4_setRoomPic(ScriptEnv &e); | ||
|
|
||
| byte _currentVolume; | ||
| Common::Array<RegionLocation> _regionLocations; | ||
| Common::Array<RegionInitDataOffset> _regionInitDataOffsets; | ||
| Common::SeekableReadStream *_itemPicIndex; | ||
| @@ -406,7 +406,8 @@ void Files_DOS33::readVTOC() { | ||
|
|
||
| entry.totalSectors = stream->readUint16BE(); | ||
|
|
||
| if (sectorList.track != 0) { | ||
| // 0 is empty slot, 255 is deleted file | ||
| if (sectorList.track != 0 && sectorList.track != 255) { | ||
| readSectorList(sectorList, entry.sectors); | ||
| _toc[name] = entry; | ||
| } | ||
| @@ -39,9 +39,6 @@ namespace Adl { | ||
|
|
||
| // This implements the Apple II "Hi-Res" display mode | ||
|
|
||
| #define DISPLAY_PITCH (DISPLAY_WIDTH / 7) | ||
| #define DISPLAY_SIZE (DISPLAY_PITCH * DISPLAY_HEIGHT) | ||
|
|
||
| #define TEXT_BUF_SIZE (TEXT_WIDTH * TEXT_HEIGHT) | ||
|
|
||
| #define COLOR_PALETTE_ENTRIES 8 | ||
| @@ -201,8 +198,7 @@ bool Display::saveThumbnail(Common::WriteStream &out) { | ||
| return retval; | ||
| } | ||
|
|
||
| void Display::loadFrameBuffer(Common::ReadStream &stream) { | ||
| byte *dst = _frameBuf; | ||
| void Display::loadFrameBuffer(Common::ReadStream &stream, byte *dst) { | ||
| for (uint j = 0; j < 8; ++j) { | ||
| for (uint i = 0; i < 8; ++i) { | ||
| stream.read(dst, DISPLAY_PITCH); | ||
| @@ -221,6 +217,10 @@ void Display::loadFrameBuffer(Common::ReadStream &stream) { | ||
| error("Failed to read frame buffer"); | ||
| } | ||
|
|
||
| void Display::loadFrameBuffer(Common::ReadStream &stream) { | ||
| loadFrameBuffer(stream, _frameBuf); | ||
| } | ||
|
|
||
| void Display::putPixel(const Common::Point &p, byte color) { | ||
| byte offset = p.x / 7; | ||
| byte mask = 0x80 | (1 << (p.x % 7)); | ||
| @@ -241,6 +241,12 @@ void Display::putPixel(const Common::Point &p, byte color) { | ||
| writeFrameBuffer(p, color, mask); | ||
| } | ||
|
|
||
| void Display::setPixelByte(const Common::Point &p, byte color) { | ||
| assert(p.x >= 0 && p.x < DISPLAY_WIDTH && p.y >= 0 && p.y < DISPLAY_HEIGHT); | ||
|
|
||
| _frameBuf[p.y * DISPLAY_PITCH + p.x / 7] = color; | ||
| } | ||
|
|
||
| void Display::setPixelBit(const Common::Point &p, byte color) { | ||
| writeFrameBuffer(p, color, 1 << (p.x % 7)); | ||
| } | ||
| @@ -249,6 +255,12 @@ void Display::setPixelPalette(const Common::Point &p, byte color) { | ||
| writeFrameBuffer(p, color, 0x80); | ||
| } | ||
|
|
||
| byte Display::getPixelByte(const Common::Point &p) const { | ||
| assert(p.x >= 0 && p.x < DISPLAY_WIDTH && p.y >= 0 && p.y < DISPLAY_HEIGHT); | ||
|
|
||
| return _frameBuf[p.y * DISPLAY_PITCH + p.x / 7]; | ||
| } | ||
|
|
||
| bool Display::getPixelBit(const Common::Point &p) const { | ||
| assert(p.x >= 0 && p.x < DISPLAY_WIDTH && p.y >= 0 && p.y < DISPLAY_HEIGHT); | ||
|
|
||
| @@ -40,6 +40,8 @@ namespace Adl { | ||
|
|
||
| #define DISPLAY_WIDTH 280 | ||
| #define DISPLAY_HEIGHT 192 | ||
| #define DISPLAY_PITCH (DISPLAY_WIDTH / 7) | ||
| #define DISPLAY_SIZE (DISPLAY_PITCH * DISPLAY_HEIGHT) | ||
| #define TEXT_WIDTH 40 | ||
| #define TEXT_HEIGHT 24 | ||
|
|
||
| @@ -62,10 +64,13 @@ class Display { | ||
| bool saveThumbnail(Common::WriteStream &out); | ||
|
|
||
| // Graphics | ||
| static void loadFrameBuffer(Common::ReadStream &stream, byte *dst); | ||
| void loadFrameBuffer(Common::ReadStream &stream); | ||
| void putPixel(const Common::Point &p, byte color); | ||
| void setPixelByte(const Common::Point &p, byte color); | ||
| void setPixelBit(const Common::Point &p, byte color); | ||
| void setPixelPalette(const Common::Point &p, byte color); | ||
| byte getPixelByte(const Common::Point &p) const; | ||
| bool getPixelBit(const Common::Point &p) const; | ||
| void clear(byte color); | ||
|
|
||
Oops, something went wrong.