Initial commit
This commit is contained in:
170
engines/freescape/games/dark/amiga.cpp
Normal file
170
engines/freescape/games/dark/amiga.cpp
Normal file
@@ -0,0 +1,170 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "common/file.h"
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/games/dark/dark.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
void DarkEngine::loadAssetsAmigaFullGame() {
|
||||
Common::File file;
|
||||
file.open("0.drk");
|
||||
_title = loadAndConvertNeoImage(&file, 0x9930);
|
||||
file.close();
|
||||
|
||||
Common::SeekableReadStream *stream = decryptFileAmigaAtari("1.drk", "0.drk", 798);
|
||||
parseAmigaAtariHeader(stream);
|
||||
|
||||
_border = loadAndConvertNeoImage(stream, 0x1b762);
|
||||
load8bitBinary(stream, 0x2e96a, 16);
|
||||
loadPalettes(stream, 0x2e528);
|
||||
loadGlobalObjects(stream, 0x30f0 - 50, 24);
|
||||
loadMessagesVariableSize(stream, 0x3d37, 66);
|
||||
loadSoundsFx(stream, 0x34738 + 2, 11);
|
||||
|
||||
Common::Array<Graphics::ManagedSurface *> chars;
|
||||
chars = getCharsAmigaAtariInternal(8, 8, - 7 - 8, 16, 16, stream, 0x1b0bc, 85);
|
||||
_fontBig = Font(chars);
|
||||
|
||||
chars = getCharsAmigaAtariInternal(8, 8, 0, 10, 8, stream, 0x1b0bc + 0x430, 85);
|
||||
_fontMedium = Font(chars);
|
||||
|
||||
chars = getCharsAmigaAtariInternal(8, 5, - 7 - 8, 10, 16, stream, 0x1b0bc + 0x430, 85);
|
||||
_fontSmall = Font(chars);
|
||||
_fontSmall.setCharWidth(4);
|
||||
|
||||
_fontLoaded = true;
|
||||
|
||||
GeometricObject *obj = nullptr;
|
||||
obj = (GeometricObject *)_areaMap[15]->objectWithID(18);
|
||||
assert(obj);
|
||||
obj->_cyclingColors = true;
|
||||
|
||||
obj = (GeometricObject *)_areaMap[15]->objectWithID(26);
|
||||
assert(obj);
|
||||
obj->_cyclingColors = true;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int16 id = 227 + i * 6 - 2;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
//debugC(1, kFreescapeDebugParser, "Restoring object %d to from ECD %d", id, index);
|
||||
obj = (GeometricObject *)_areaMap[255]->objectWithID(id);
|
||||
assert(obj);
|
||||
obj->_cyclingColors = true;
|
||||
id--;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &area : _areaMap) {
|
||||
// Center and pad each area name so we do not have to do it at each frame
|
||||
area._value->_name = centerAndPadString(area._value->_name, 26);
|
||||
}
|
||||
}
|
||||
|
||||
void DarkEngine::drawAmigaAtariSTUI(Graphics::Surface *surface) {
|
||||
uint32 white = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
uint32 yellow = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0xCC, 0x00);
|
||||
uint32 orange = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0x88, 0x00);
|
||||
uint32 red = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xEE, 0x00, 0x00);
|
||||
uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
|
||||
uint32 transparent = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
|
||||
uint32 grey = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x60, 0x60, 0x60);
|
||||
|
||||
uint32 grey8 = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x88, 0x88, 0x88);
|
||||
uint32 greyA = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xAA, 0xAA, 0xAA);
|
||||
|
||||
int score = _gameStateVars[k8bitVariableScore];
|
||||
int ecds = _gameStateVars[kVariableActiveECDs];
|
||||
drawString(kDarkFontSmall, Common::String::format("%04d", int(2 * _position.x())), 19, 178, red, red, black, surface);
|
||||
drawString(kDarkFontSmall, Common::String::format("%04d", int(2 * _position.z())), 19, 184, red, red, black, surface);
|
||||
drawString(kDarkFontSmall, Common::String::format("%04d", int(2 * _position.y())), 19, 190, red, red, black, surface);
|
||||
|
||||
drawString(kDarkFontBig, Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 73, 178, red, red, black, surface);
|
||||
drawString(kDarkFontBig, Common::String::format("%3d", _playerSteps[_playerStepIndex]), 73, 186, red, red, black, surface);
|
||||
drawString(kDarkFontBig, Common::String::format("%07d", score), 93, 16, orange, yellow, black, surface);
|
||||
drawString(kDarkFontBig, Common::String::format("%3d%%", ecds), 181, 16, orange, yellow, black, surface);
|
||||
|
||||
Common::String message;
|
||||
int deadline;
|
||||
getLatestMessages(message, deadline);
|
||||
if (deadline <= _countdown) {
|
||||
drawString(kDarkFontSmall, message, 32, 157, grey8, greyA, transparent, surface);
|
||||
_temporaryMessages.push_back(message);
|
||||
_temporaryMessageDeadlines.push_back(deadline);
|
||||
}
|
||||
|
||||
drawString(kDarkFontSmall, _currentArea->_name, 32, 151, grey8, greyA, transparent, surface);
|
||||
drawBinaryClock(surface, 6, 110, white, grey);
|
||||
|
||||
int x = 229;
|
||||
int y = 180;
|
||||
for (int i = 0; i < _maxShield / 2; i++) {
|
||||
if (i < _gameStateVars[k8bitVariableShield] / 2) {
|
||||
surface->drawLine(x, y, x, y + 3, orange);
|
||||
surface->drawLine(x, y + 1, x, y + 2, yellow);
|
||||
} else
|
||||
surface->drawLine(x, y, x, y + 3, red);
|
||||
x += 2;
|
||||
}
|
||||
|
||||
x = 229;
|
||||
y = 188;
|
||||
for (int i = 0; i < _maxEnergy / 2; i++) {
|
||||
if (i < _gameStateVars[k8bitVariableEnergy] / 2) {
|
||||
surface->drawLine(x, y, x, y + 3, orange);
|
||||
surface->drawLine(x, y + 1, x, y + 2, yellow);
|
||||
} else
|
||||
surface->drawLine(x, y, x, y + 3, red);
|
||||
x += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void DarkEngine::initAmigaAtari() {
|
||||
_viewArea = Common::Rect(32, 33, 287, 130);
|
||||
}
|
||||
|
||||
void DarkEngine::drawString(const DarkFontSize size, const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface) {
|
||||
if (!_fontLoaded)
|
||||
return;
|
||||
|
||||
Font *font = nullptr;
|
||||
|
||||
if (size == kDarkFontBig) {
|
||||
font = &_fontBig;
|
||||
} else if (size == kDarkFontMedium) {
|
||||
font = &_fontMedium;
|
||||
} else if (size == kDarkFontSmall) {
|
||||
font = &_fontSmall;
|
||||
} else {
|
||||
error("Invalid font size %d", size);
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String ustr = str;
|
||||
ustr.toUppercase();
|
||||
font->setBackground(backColor);
|
||||
font->setSecondaryColor(secondaryColor);
|
||||
font->drawString(surface, ustr, x, y, _screenW, primaryColor);
|
||||
}
|
||||
|
||||
} // End of namespace Freescape
|
||||
84
engines/freescape/games/dark/atari.cpp
Normal file
84
engines/freescape/games/dark/atari.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "common/file.h"
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/games/dark/dark.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
void DarkEngine::loadAssetsAtariFullGame() {
|
||||
Common::File file;
|
||||
file.open("0.drk");
|
||||
_title = loadAndConvertNeoImage(&file, 0x13ec);
|
||||
file.close();
|
||||
|
||||
Common::SeekableReadStream *stream = decryptFileAmigaAtari("1.drk", "0.drk", 840);
|
||||
parseAmigaAtariHeader(stream);
|
||||
|
||||
_border = loadAndConvertNeoImage(stream, 0xd710);
|
||||
|
||||
Common::Array<Graphics::ManagedSurface *> chars;
|
||||
chars = getCharsAmigaAtariInternal(8, 8, - 7 - 8, 16, 16, stream, 0xd06a, 85);
|
||||
_fontBig = Font(chars);
|
||||
|
||||
chars = getCharsAmigaAtariInternal(8, 8, 0, 10, 8, stream, 0xd49a, 85);
|
||||
_fontMedium = Font(chars);
|
||||
|
||||
chars = getCharsAmigaAtariInternal(8, 5, - 7 - 8, 10, 16, stream, 0xd49a, 85);
|
||||
_fontSmall = Font(chars);
|
||||
_fontSmall.setCharWidth(4);
|
||||
|
||||
_fontLoaded = true;
|
||||
load8bitBinary(stream, 0x20918, 16);
|
||||
loadMessagesVariableSize(stream, 0x3f6f, 66);
|
||||
loadPalettes(stream, 0x204d6);
|
||||
loadGlobalObjects(stream, 0x32f6, 24);
|
||||
loadSoundsFx(stream, 0x266e8, 11);
|
||||
|
||||
GeometricObject *obj = nullptr;
|
||||
obj = (GeometricObject *)_areaMap[15]->objectWithID(18);
|
||||
assert(obj);
|
||||
obj->_cyclingColors = true;
|
||||
|
||||
obj = (GeometricObject *)_areaMap[15]->objectWithID(26);
|
||||
assert(obj);
|
||||
obj->_cyclingColors = true;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int16 id = 227 + i * 6 - 2;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
//debugC(1, kFreescapeDebugParser, "Restoring object %d to from ECD %d", id, index);
|
||||
obj = (GeometricObject *)_areaMap[255]->objectWithID(id);
|
||||
assert(obj);
|
||||
obj->_cyclingColors = true;
|
||||
id--;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &area : _areaMap) {
|
||||
// Center and pad each area name so we do not have to do it at each frame
|
||||
area._value->_name = centerAndPadString(area._value->_name, 26);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Freescape
|
||||
249
engines/freescape/games/dark/c64.cpp
Normal file
249
engines/freescape/games/dark/c64.cpp
Normal file
@@ -0,0 +1,249 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/memstream.h"
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/games/dark/dark.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
void DarkEngine::initC64() {
|
||||
_viewArea = Common::Rect(32, 24, 288, 127);
|
||||
}
|
||||
|
||||
extern byte kC64Palette[16][3];
|
||||
|
||||
void DarkEngine::loadAssetsC64FullGame() {
|
||||
Common::File file;
|
||||
file.open("darkside.c64.data");
|
||||
|
||||
if (_variant & GF_C64_TAPE) {
|
||||
int size = file.size();
|
||||
|
||||
byte *buffer = (byte *)malloc(size * sizeof(byte));
|
||||
file.read(buffer, file.size());
|
||||
|
||||
_extraBuffer = decompressC64RLE(buffer, &size, 0xdf);
|
||||
// size should be the size of the decompressed data
|
||||
Common::MemoryReadStream dfile(_extraBuffer, size, DisposeAfterUse::NO);
|
||||
|
||||
loadMessagesFixedSize(&dfile, 0x1edf, 16, 27);
|
||||
loadFonts(&dfile, 0xc3e);
|
||||
loadGlobalObjects(&dfile, 0x20bd, 23);
|
||||
load8bitBinary(&dfile, 0x9b3e, 16);
|
||||
} else if (_variant & GF_C64_DISC) {
|
||||
loadMessagesFixedSize(&file, 0x16a3, 16, 27);
|
||||
loadFonts(&file, 0x402);
|
||||
|
||||
// It is unclear why this C64 has this byte changed at 0x1881
|
||||
// Once the game is loaded, it will be set to 0x66
|
||||
// and the game will work
|
||||
file.seek(0x1881);
|
||||
_extraBuffer = (byte *)malloc(0x300 * sizeof(byte));
|
||||
file.read(_extraBuffer, 0x300);
|
||||
_extraBuffer[0] = 0x66;
|
||||
Common::MemoryReadStream stream(_extraBuffer, 0x300, DisposeAfterUse::NO);
|
||||
loadGlobalObjects(&stream, 0x0, 23);
|
||||
load8bitBinary(&file, 0x8914, 16);
|
||||
} else
|
||||
error("Unknown C64 variant %x", _variant);
|
||||
|
||||
// The color map from the data is not correct,
|
||||
// so we'll just hardcode the one that we found in the executable
|
||||
|
||||
for (int i = 0; i < 15; i++) {
|
||||
_colorMap[i][0] = 0;
|
||||
_colorMap[i][1] = 0;
|
||||
_colorMap[i][2] = 0;
|
||||
_colorMap[i][3] = 0;
|
||||
}
|
||||
|
||||
_colorMap[1][0] = 0x55;
|
||||
_colorMap[1][1] = 0x55;
|
||||
_colorMap[1][2] = 0x55;
|
||||
_colorMap[1][3] = 0x55;
|
||||
|
||||
_colorMap[2][0] = 0xaa;
|
||||
_colorMap[2][1] = 0xaa;
|
||||
_colorMap[2][2] = 0xaa;
|
||||
_colorMap[2][3] = 0xaa;
|
||||
|
||||
_colorMap[3][0] = 0xff;
|
||||
_colorMap[3][1] = 0xff;
|
||||
_colorMap[3][2] = 0xff;
|
||||
_colorMap[3][3] = 0xff;
|
||||
|
||||
_colorMap[4][0] = 0x44;
|
||||
_colorMap[4][1] = 0x11;
|
||||
_colorMap[4][2] = 0x44;
|
||||
_colorMap[4][3] = 0x11;
|
||||
|
||||
_colorMap[5][0] = 0x88;
|
||||
_colorMap[5][1] = 0x22;
|
||||
_colorMap[5][2] = 0x88;
|
||||
_colorMap[5][3] = 0x22;
|
||||
|
||||
_colorMap[6][0] = 0xcc;
|
||||
_colorMap[6][1] = 0x33;
|
||||
_colorMap[6][2] = 0xcc;
|
||||
_colorMap[6][3] = 0x33;
|
||||
|
||||
_colorMap[7][0] = 0x66;
|
||||
_colorMap[7][1] = 0x99;
|
||||
_colorMap[7][2] = 0x66;
|
||||
_colorMap[7][3] = 0x99;
|
||||
|
||||
_colorMap[8][0] = 0x77;
|
||||
_colorMap[8][1] = 0xdd;
|
||||
_colorMap[8][2] = 0x77;
|
||||
_colorMap[8][3] = 0xdd;
|
||||
|
||||
_colorMap[9][0] = 0xbb;
|
||||
_colorMap[9][1] = 0xee;
|
||||
_colorMap[9][2] = 0xbb;
|
||||
_colorMap[9][3] = 0xee;
|
||||
|
||||
_colorMap[10][0] = 0x5a;
|
||||
_colorMap[10][1] = 0xa5;
|
||||
_colorMap[10][2] = 0x5a;
|
||||
_colorMap[10][3] = 0xa5;
|
||||
|
||||
// TODO
|
||||
_colorMap[12][0] = 0x00;
|
||||
_colorMap[12][1] = 0x00;
|
||||
_colorMap[12][2] = 0x00;
|
||||
_colorMap[12][3] = 0x00;
|
||||
|
||||
_colorMap[13][0] = 0x77;
|
||||
_colorMap[13][1] = 0xdd;
|
||||
_colorMap[13][2] = 0x77;
|
||||
_colorMap[13][3] = 0xdd;
|
||||
|
||||
// TODO
|
||||
_colorMap[14][0] = 0xcc;
|
||||
_colorMap[14][1] = 0xcc;
|
||||
_colorMap[14][2] = 0xcc;
|
||||
_colorMap[14][3] = 0xcc;
|
||||
|
||||
Graphics::Surface *surf = loadBundledImage("dark_border");
|
||||
surf->convertToInPlace(_gfx->_texturePixelFormat);
|
||||
_border = new Graphics::ManagedSurface();
|
||||
_border->copyFrom(*surf);
|
||||
surf->free();
|
||||
delete surf;
|
||||
|
||||
file.close();
|
||||
file.open("darkside.c64.title.bitmap");
|
||||
|
||||
Common::File colorFile1;
|
||||
colorFile1.open("darkside.c64.title.colors1");
|
||||
Common::File colorFile2;
|
||||
colorFile2.open("darkside.c64.title.colors2");
|
||||
|
||||
_title = loadAndConvertDoodleImage(&file, &colorFile1, &colorFile2, (byte *)&kC64Palette);
|
||||
}
|
||||
|
||||
|
||||
void DarkEngine::drawC64UI(Graphics::Surface *surface) {
|
||||
uint8 r, g, b;
|
||||
uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xAA, 0xAA, 0xAA);
|
||||
|
||||
uint32 color = _currentArea->_usualBackgroundColor;
|
||||
if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
|
||||
color = (*_gfx->_colorRemaps)[color];
|
||||
}
|
||||
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
int score = _gameStateVars[k8bitVariableScore];
|
||||
int ecds = _gameStateVars[kVariableActiveECDs];
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 206, 137 + 8, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 206, 145 + 8, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 206, 153 + 8, front, back, surface);
|
||||
|
||||
drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 68 + 5 + 5, 168 + 9, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 70, 177 + 8, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%07d", score), 86, 8, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%3d%%", ecds), 198, 8, front, back, surface);
|
||||
|
||||
int seconds, minutes, hours;
|
||||
getTimeFromCountdown(seconds, minutes, hours);
|
||||
|
||||
Common::String message;
|
||||
int deadline;
|
||||
getLatestMessages(message, deadline);
|
||||
if (deadline <= _countdown) {
|
||||
drawStringInSurface(message, 120, 185, back, front, surface);
|
||||
_temporaryMessages.push_back(message);
|
||||
_temporaryMessageDeadlines.push_back(deadline);
|
||||
} else
|
||||
drawStringInSurface(_currentArea->_name, 120, 185, front, back, surface);
|
||||
|
||||
int energy = _gameStateVars[k8bitVariableEnergy]; // called fuel in this game
|
||||
int shield = _gameStateVars[k8bitVariableShield];
|
||||
|
||||
_gfx->readFromPalette(6, r, g, b); // Violet Blue
|
||||
uint32 outBarColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
_gfx->readFromPalette(14, r, g, b); // Violet
|
||||
uint32 inBarColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
_gfx->readFromPalette(3, r, g, b); // Light Blue
|
||||
uint32 lineColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
Common::Rect coverBar;
|
||||
coverBar = Common::Rect(64, 144, 135, 151);
|
||||
surface->fillRect(coverBar, back);
|
||||
|
||||
if (shield >= 0) {
|
||||
Common::Rect shieldBar;
|
||||
|
||||
shieldBar = Common::Rect(64, 144, 127 - (_maxShield - shield), 151);
|
||||
surface->fillRect(shieldBar, outBarColor);
|
||||
|
||||
shieldBar = Common::Rect(64, 146, 127 - (_maxShield - shield), 149);
|
||||
surface->fillRect(shieldBar, inBarColor);
|
||||
if (shield >= 1)
|
||||
surface->drawLine(64, 147, 127 - (_maxShield - shield) - 1, 147, lineColor);
|
||||
}
|
||||
|
||||
coverBar = Common::Rect(64, 144 + 8, 127, 159);
|
||||
surface->fillRect(coverBar, back);
|
||||
|
||||
if (energy >= 0) {
|
||||
Common::Rect energyBar;
|
||||
energyBar = Common::Rect(64, 144 + 8, 127 - (_maxEnergy - energy), 159);
|
||||
surface->fillRect(energyBar, outBarColor);
|
||||
|
||||
energyBar = Common::Rect(64, 146 + 8, 127 - (_maxEnergy - energy), 157);
|
||||
surface->fillRect(energyBar, inBarColor);
|
||||
if (energy >= 1)
|
||||
surface->drawLine(64, 147 + 8, 127 - (_maxEnergy - energy) - 1, 155, lineColor);
|
||||
}
|
||||
drawBinaryClock(surface, 304, 124, front, back);
|
||||
drawVerticalCompass(surface, 17, 77, _pitch, front);
|
||||
}
|
||||
|
||||
} // End of namespace Freescape
|
||||
171
engines/freescape/games/dark/cpc.cpp
Normal file
171
engines/freescape/games/dark/cpc.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/memstream.h"
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/games/dark/dark.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
void DarkEngine::initCPC() {
|
||||
_viewArea = Common::Rect(36, 24, 284, 125);
|
||||
_soundIndexShoot = 0xa;
|
||||
_soundIndexStart = 0x17;
|
||||
_soundIndexAreaChange = 0x1c;
|
||||
_soundIndexDestroyECD = 0x1b;
|
||||
_soundIndexRestoreECD = 8;
|
||||
}
|
||||
|
||||
extern byte kCPCPaletteTitleData[4][3];
|
||||
extern byte kCPCPaletteBorderData[4][3];
|
||||
|
||||
byte kCPCPaletteDarkTitle[16][3] = {
|
||||
{0x00, 0x00, 0x00}, // 0: X
|
||||
{0xff, 0xff, 0xff}, // 1: ?
|
||||
{0x80, 0x80, 0x80}, // 2: X
|
||||
{0xff, 0x00, 0xff}, // 3: X
|
||||
{0x80, 0x80, 0x80}, // 4: X
|
||||
{0xff, 0xff, 0x00}, // 5: X
|
||||
{0x80, 0x00, 0x00}, // 6: X
|
||||
{0xff, 0x00, 0x00}, // 7: X
|
||||
{0x00, 0x80, 0x80}, // 8: X
|
||||
{0xff, 0x00, 0x80}, // 9: X
|
||||
{0xff, 0x80, 0x00}, // 10: X
|
||||
{0xff, 0x80, 0x80}, // 11: X
|
||||
{0x00, 0xff, 0x00}, // 12: X
|
||||
{0x00, 0x00, 0x80}, // 13: X
|
||||
{0x00, 0x00, 0xff}, // 14: X
|
||||
{0x00, 0x80, 0x00}, // 15: X
|
||||
};
|
||||
|
||||
extern Graphics::ManagedSurface *readCPCImage(Common::SeekableReadStream *file, bool mode0);
|
||||
|
||||
void DarkEngine::loadAssetsCPCFullGame() {
|
||||
Common::File file;
|
||||
|
||||
file.open("DARK1.SCR");
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DARK1.SCR");
|
||||
|
||||
_title = readCPCImage(&file, false);
|
||||
_title->setPalette((byte*)&kCPCPaletteDarkTitle, 0, 16);
|
||||
|
||||
file.close();
|
||||
file.open("DARK2.SCR");
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DARK2.SCR");
|
||||
|
||||
_border = readCPCImage(&file, true);
|
||||
_border->setPalette((byte*)&kCPCPaletteBorderData, 0, 4);
|
||||
|
||||
file.close();
|
||||
file.open("DARKCODE.BIN");
|
||||
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DARKCODE.BIN");
|
||||
|
||||
loadMessagesFixedSize(&file, 0x5d9, 16, 27);
|
||||
loadFonts(&file, 0x60f3);
|
||||
loadGlobalObjects(&file, 0x9a, 23);
|
||||
load8bitBinary(&file, 0x6255, 16);
|
||||
_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_walk_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_jet_indicator"));
|
||||
|
||||
for (auto &it : _indicators)
|
||||
it->convertToInPlace(_gfx->_texturePixelFormat);
|
||||
}
|
||||
|
||||
void DarkEngine::drawCPCUI(Graphics::Surface *surface) {
|
||||
uint32 color = _currentArea->_underFireBackgroundColor;
|
||||
uint8 r, g, b;
|
||||
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
color = _currentArea->_usualBackgroundColor;
|
||||
if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
|
||||
color = (*_gfx->_colorRemaps)[color];
|
||||
}
|
||||
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
// Drawing the horizontal compass should be done first, so that the background is properly filled
|
||||
drawHorizontalCompass(200, 143, _yaw, front, back, surface);
|
||||
|
||||
int score = _gameStateVars[k8bitVariableScore];
|
||||
int ecds = _gameStateVars[kVariableActiveECDs];
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 200, 137, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 200, 145, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 200, 153, front, back, surface);
|
||||
|
||||
drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 72, 168, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 72, 177, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%07d", score), 95, 8, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%3d%%", ecds), 191, 8, front, back, surface);
|
||||
|
||||
int seconds, minutes, hours;
|
||||
getTimeFromCountdown(seconds, minutes, hours);
|
||||
|
||||
Common::String message;
|
||||
int deadline;
|
||||
getLatestMessages(message, deadline);
|
||||
if (deadline <= _countdown) {
|
||||
drawStringInSurface(message, 111, 173 + 4, back, front, surface);
|
||||
_temporaryMessages.push_back(message);
|
||||
_temporaryMessageDeadlines.push_back(deadline);
|
||||
} else
|
||||
drawStringInSurface(_currentArea->_name, 111, 173 + 4, front, back, surface);
|
||||
|
||||
int energy = _gameStateVars[k8bitVariableEnergy]; // called fuel in this game
|
||||
int shield = _gameStateVars[k8bitVariableShield];
|
||||
|
||||
_gfx->readFromPalette(_gfx->_inkColor, r, g, b);
|
||||
uint32 inkColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
if (shield >= 0) {
|
||||
Common::Rect shieldBar;
|
||||
shieldBar = Common::Rect(72, 141 - 1, 143 - (_maxShield - shield), 146);
|
||||
surface->fillRect(shieldBar, inkColor);
|
||||
|
||||
shieldBar = Common::Rect(72, 143 - 1, 143 - (_maxShield - shield), 144);
|
||||
surface->fillRect(shieldBar, front);
|
||||
}
|
||||
|
||||
if (energy >= 0) {
|
||||
Common::Rect energyBar;
|
||||
energyBar = Common::Rect(72, 147 + 1, 143 - (_maxEnergy - energy), 155 - 1);
|
||||
surface->fillRect(energyBar, inkColor);
|
||||
|
||||
energyBar = Common::Rect(72, 148 + 2, 143 - (_maxEnergy - energy), 154 - 2);
|
||||
surface->fillRect(energyBar, front);
|
||||
}
|
||||
drawBinaryClock(surface, 300, 124, front, back);
|
||||
drawIndicator(surface, 160, 136);
|
||||
drawVerticalCompass(surface, 24, 76, _pitch, front);
|
||||
}
|
||||
|
||||
} // End of namespace Freescape
|
||||
1024
engines/freescape/games/dark/dark.cpp
Normal file
1024
engines/freescape/games/dark/dark.cpp
Normal file
File diff suppressed because it is too large
Load Diff
125
engines/freescape/games/dark/dark.h
Normal file
125
engines/freescape/games/dark/dark.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "audio/mixer.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
enum {
|
||||
kVariableDarkEnding = 28,
|
||||
kVariableDarkECD = 29,
|
||||
kVariableActiveECDs = 60,
|
||||
};
|
||||
|
||||
enum {
|
||||
kDarkEndingEvathDestroyed = 1,
|
||||
kDarkEndingECDsDestroyed = 2,
|
||||
};
|
||||
|
||||
struct ECD {
|
||||
uint16 _area;
|
||||
int _id;
|
||||
};
|
||||
|
||||
enum DarkFontSize {
|
||||
kDarkFontSmall,
|
||||
kDarkFontMedium,
|
||||
kDarkFontBig,
|
||||
};
|
||||
|
||||
class DarkEngine : public FreescapeEngine {
|
||||
public:
|
||||
DarkEngine(OSystem *syst, const ADGameDescription *gd);
|
||||
|
||||
uint32 _initialEnergy;
|
||||
uint32 _initialShield;
|
||||
uint32 _jetFuelSeconds;
|
||||
void addSkanner(Area *area);
|
||||
|
||||
void initKeymaps(Common::Keymap *engineKeyMap, Common::Keymap *infoScreenKeyMap, const char *target) override;
|
||||
void initGameState() override;
|
||||
void borderScreen() override;
|
||||
bool checkIfGameEnded() override;
|
||||
void endGame() override;
|
||||
|
||||
void gotoArea(uint16 areaID, int entranceID) override;
|
||||
void pressedKey(const int keycode) override;
|
||||
void executePrint(FCLInstruction &instruction) override;
|
||||
|
||||
void initDOS();
|
||||
void initC64();
|
||||
void initAmigaAtari();
|
||||
void initZX();
|
||||
void initCPC();
|
||||
|
||||
void loadAssets() override;
|
||||
void loadAssetsDOSFullGame() override;
|
||||
void loadAssetsDOSDemo() override;
|
||||
void loadAssetsC64FullGame() override;
|
||||
void loadAssetsAmigaFullGame() override;
|
||||
void loadAssetsAtariFullGame() override;
|
||||
|
||||
void loadAssetsCPCFullGame() override;
|
||||
|
||||
void loadAssetsZXDemo() override;
|
||||
void loadAssetsZXFullGame() override;
|
||||
void loadMessagesVariableSize(Common::SeekableReadStream *file, int offset, int number) override;
|
||||
|
||||
int _lastTenSeconds;
|
||||
int _lastSecond;
|
||||
void updateTimeVariables() override;
|
||||
|
||||
void drawBinaryClock(Graphics::Surface *surface, int xPosition, int yPosition, uint32 front, uint32 back);
|
||||
void drawIndicator(Graphics::Surface *surface, int xPosition, int yPosition);
|
||||
|
||||
void drawSensorShoot(Sensor *sensor) override;
|
||||
void drawDOSUI(Graphics::Surface *surface) override;
|
||||
void drawC64UI(Graphics::Surface *surface) override;
|
||||
void drawZXUI(Graphics::Surface *surface) override;
|
||||
void drawCPCUI(Graphics::Surface *surface) override;
|
||||
void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
|
||||
|
||||
Font _fontBig;
|
||||
Font _fontMedium;
|
||||
Font _fontSmall;
|
||||
int _soundIndexRestoreECD;
|
||||
int _soundIndexDestroyECD;
|
||||
Audio::SoundHandle _soundFxHandleJetpack;
|
||||
|
||||
void drawString(const DarkFontSize size, const Common::String &str, int x, int y, uint32 primaryColor, uint32 secondaryColor, uint32 backColor, Graphics::Surface *surface);
|
||||
void drawInfoMenu() override;
|
||||
|
||||
Common::Error saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave = false) override;
|
||||
Common::Error loadGameStreamExtended(Common::SeekableReadStream *stream) override;
|
||||
|
||||
private:
|
||||
void addECDs(Area *area);
|
||||
void addECD(Area *area, const Math::Vector3d position, int index);
|
||||
void restoreECD(Area &area, int index);
|
||||
bool checkECD(uint16 areaID, int index);
|
||||
bool tryDestroyECD(int index);
|
||||
bool tryDestroyECDFullGame(int index);
|
||||
void addWalls(Area *area);
|
||||
void drawVerticalCompass(Graphics::Surface *surface, int x, int y, float angle, uint32 color);
|
||||
void drawHorizontalCompass(int x, int y, float angle, uint32 front, uint32 back, Graphics::Surface *surface);
|
||||
};
|
||||
|
||||
}
|
||||
250
engines/freescape/games/dark/dos.cpp
Normal file
250
engines/freescape/games/dark/dos.cpp
Normal file
@@ -0,0 +1,250 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/games/dark/dark.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
extern byte kEGADefaultPalette[16][3];
|
||||
|
||||
byte kDarkCGAPalettePinkBlue[4][3] = {
|
||||
{0x00, 0x00, 0x00},
|
||||
{0x00, 0xaa, 0xaa},
|
||||
{0xaa, 0x00, 0xaa},
|
||||
{0xaa, 0xaa, 0xaa},
|
||||
};
|
||||
|
||||
byte kDarkCGAPaletteRedGreen[4][3] = {
|
||||
{0x00, 0x00, 0x00},
|
||||
{0x00, 0xaa, 0x00},
|
||||
{0xaa, 0x00, 0x00},
|
||||
{0xaa, 0x55, 0x00},
|
||||
};
|
||||
|
||||
void DarkEngine::initDOS() {
|
||||
if (_renderMode == Common::kRenderEGA)
|
||||
_viewArea = Common::Rect(40, 24, 280, 125);
|
||||
else if (_renderMode == Common::kRenderCGA)
|
||||
_viewArea = Common::Rect(40, 24, 280, 125);
|
||||
else
|
||||
error("Invalid or unknown render mode");
|
||||
|
||||
_maxEnergy = 79;
|
||||
_maxShield = 79;
|
||||
}
|
||||
|
||||
void DarkEngine::loadAssetsDOSDemo() {
|
||||
Common::File file;
|
||||
if (_renderMode == Common::kRenderEGA) {
|
||||
file.open("SCN1E.DAT");
|
||||
if (file.isOpen()) {
|
||||
_title = load8bitBinImage(&file, 0x0);
|
||||
_title->setPalette((byte *)&kEGADefaultPalette, 0, 16);
|
||||
}
|
||||
file.close();
|
||||
file.open("DSIDEE.EXE");
|
||||
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DSIDEE.EXE");
|
||||
|
||||
loadSpeakerFxDOS(&file, 0x4837 + 0x200, 0x46e8 + 0x200, 20);
|
||||
loadMessagesFixedSize(&file, 0x4525, 16, 27);
|
||||
loadMessagesFixedSize(&file, 0x993f - 2, 308, 5);
|
||||
loadFonts(&file, 0xa598);
|
||||
loadGlobalObjects(&file, 0x3d04, 23);
|
||||
load8bitBinary(&file, 0xa700, 16);
|
||||
_border = load8bitBinImage(&file, 0x210);
|
||||
_border->setPalette((byte *)&kEGADefaultPalette, 0, 16);
|
||||
|
||||
_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_walk_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_jet_indicator"));
|
||||
|
||||
for (auto &it : _indicators)
|
||||
it->convertToInPlace(_gfx->_texturePixelFormat);
|
||||
|
||||
} else if (_renderMode == Common::kRenderCGA) {
|
||||
file.open("SCN1C.DAT");
|
||||
if (file.isOpen()) {
|
||||
_title = load8bitBinImage(&file, 0x0);
|
||||
_title->setPalette((byte *)&kDarkCGAPalettePinkBlue, 0, 4);
|
||||
}
|
||||
file.close();
|
||||
file.open("DSIDEC.EXE");
|
||||
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DSIDEC.EXE");
|
||||
|
||||
loadSpeakerFxDOS(&file, 0x3077 + 0x200, 0x2f28 + 0x200, 20);
|
||||
loadFonts(&file, 0x8907);
|
||||
loadMessagesFixedSize(&file, 0x2d65, 16, 27);
|
||||
loadMessagesFixedSize(&file, 0x7c3a, 308, 5);
|
||||
loadGlobalObjects(&file, 0x2554, 23);
|
||||
load8bitBinary(&file, 0x8a70, 4);
|
||||
_border = load8bitBinImage(&file, 0x210);
|
||||
_border->setPalette((byte *)&kDarkCGAPalettePinkBlue, 0, 4);
|
||||
|
||||
swapPalette(1);
|
||||
} else
|
||||
error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
|
||||
}
|
||||
|
||||
void DarkEngine::loadAssetsDOSFullGame() {
|
||||
Common::File file;
|
||||
if (_renderMode == Common::kRenderEGA) {
|
||||
file.open("SCN1E.DAT");
|
||||
if (file.isOpen()) {
|
||||
_title = load8bitBinImage(&file, 0x0);
|
||||
_title->setPalette((byte *)&kEGADefaultPalette, 0, 16);
|
||||
}
|
||||
file.close();
|
||||
file.open("DSIDEE.EXE");
|
||||
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DSIDEE.EXE");
|
||||
|
||||
loadSpeakerFxDOS(&file, 0x4837 + 0x200, 0x46e8 + 0x200, 20);
|
||||
loadFonts(&file, 0xa113);
|
||||
loadMessagesFixedSize(&file, 0x4525, 16, 27);
|
||||
loadGlobalObjects(&file, 0x3d04, 23);
|
||||
load8bitBinary(&file, 0xa280, 16);
|
||||
_border = load8bitBinImage(&file, 0x210);
|
||||
_border->setPalette((byte *)&kEGADefaultPalette, 0, 16);
|
||||
|
||||
_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_walk_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_jet_indicator"));
|
||||
|
||||
for (auto &it : _indicators)
|
||||
it->convertToInPlace(_gfx->_texturePixelFormat);
|
||||
|
||||
} else if (_renderMode == Common::kRenderCGA) {
|
||||
file.open("SCN1C.DAT");
|
||||
if (file.isOpen()) {
|
||||
_title = load8bitBinImage(&file, 0x0);
|
||||
_title->setPalette((byte *)&kDarkCGAPalettePinkBlue, 0, 4);
|
||||
}
|
||||
file.close();
|
||||
file.open("DSIDEC.EXE");
|
||||
|
||||
if (!file.isOpen())
|
||||
error("Failed to open DSIDEC.EXE");
|
||||
|
||||
loadSpeakerFxDOS(&file, 0x3077 + 0x200, 0x2f28 + 0x200, 20);
|
||||
loadFonts(&file, 0x8497);
|
||||
loadMessagesFixedSize(&file, 0x2d65, 16, 27);
|
||||
loadGlobalObjects(&file, 0x2554, 23);
|
||||
load8bitBinary(&file, 0x8600, 16);
|
||||
_border = load8bitBinImage(&file, 0x210);
|
||||
_border->setPalette((byte *)&kDarkCGAPalettePinkBlue, 0, 4);
|
||||
|
||||
swapPalette(1);
|
||||
} else
|
||||
error("Invalid or unsupported render mode %s for Dark Side", Common::getRenderModeDescription(_renderMode));
|
||||
}
|
||||
|
||||
void DarkEngine::drawDOSUI(Graphics::Surface *surface) {
|
||||
uint32 color = _renderMode == Common::kRenderCGA ? 3 : 14;
|
||||
uint8 r, g, b;
|
||||
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
color = _currentArea->_usualBackgroundColor;
|
||||
if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
|
||||
color = (*_gfx->_colorRemaps)[color];
|
||||
}
|
||||
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
// Drawing the horizontal compass should be done first, so that the background is properly filled
|
||||
drawHorizontalCompass(200, 143, _yaw, front, back, surface);
|
||||
Common::Rect stepBackgroundRect = Common::Rect(69, 177, 98, 185);
|
||||
surface->fillRect(stepBackgroundRect, back);
|
||||
|
||||
Common::Rect positionBackgroundRect = Common::Rect(199, 135, 232, 160);
|
||||
surface->fillRect(positionBackgroundRect, back);
|
||||
|
||||
int score = _gameStateVars[k8bitVariableScore];
|
||||
int ecds = _gameStateVars[kVariableActiveECDs];
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 199, 137, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 199, 145, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 199, 153, front, back, surface);
|
||||
|
||||
drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 71, 168, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 71, 177, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%07d", score), 95, 8, front, back, surface);
|
||||
drawStringInSurface(Common::String::format("%3d%%", ecds), 192, 8, front, back, surface);
|
||||
|
||||
int seconds, minutes, hours;
|
||||
getTimeFromCountdown(seconds, minutes, hours);
|
||||
|
||||
Common::String message;
|
||||
int deadline;
|
||||
getLatestMessages(message, deadline);
|
||||
if (deadline <= _countdown) {
|
||||
drawStringInSurface(message, 112, 177, back, front, surface);
|
||||
_temporaryMessages.push_back(message);
|
||||
_temporaryMessageDeadlines.push_back(deadline);
|
||||
} else
|
||||
drawStringInSurface(_currentArea->_name, 112, 177, front, back, surface);
|
||||
|
||||
int energy = _gameStateVars[k8bitVariableEnergy]; // called fuel in this game
|
||||
int shield = _gameStateVars[k8bitVariableShield];
|
||||
|
||||
_gfx->readFromPalette(_renderMode == Common::kRenderCGA ? 1 : 9, r, g, b);
|
||||
uint32 blue = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
if (shield >= 0) {
|
||||
Common::Rect shieldBar;
|
||||
shieldBar = Common::Rect(72, 140, 151 - (_maxShield - shield), 141); // Upper outer shieldBar
|
||||
surface->fillRect(shieldBar, front);
|
||||
shieldBar = Common::Rect(72, 145, 151 - (_maxShield - shield), 146); // Lower outer shieldBar
|
||||
surface->fillRect(shieldBar, front);
|
||||
|
||||
shieldBar = Common::Rect(72, 142, 151 - (_maxShield - shield), 144); // Inner shieldBar
|
||||
surface->fillRect(shieldBar, blue);
|
||||
}
|
||||
|
||||
if (energy >= 0) {
|
||||
Common::Rect energyBar;
|
||||
energyBar = Common::Rect(72, 148, 151 - (_maxEnergy - energy), 149); // Upper outer energyBar
|
||||
surface->fillRect(energyBar, front);
|
||||
energyBar = Common::Rect(72, 153, 151 - (_maxEnergy - energy), 154); // Lower outer energyBar
|
||||
surface->fillRect(energyBar, front);
|
||||
|
||||
energyBar = Common::Rect(72, 150, 151 - (_maxEnergy - energy), 152); // Inner energyBar
|
||||
surface->fillRect(energyBar, blue);
|
||||
}
|
||||
uint32 clockColor = _renderMode == Common::kRenderCGA ? front : _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0xFF, 0xFF);
|
||||
drawBinaryClock(surface, 300, 124, clockColor, back);
|
||||
drawIndicator(surface, 160, 136);
|
||||
drawVerticalCompass(surface, 24, 76, _pitch, blue);
|
||||
}
|
||||
|
||||
} // End of namespace Freescape
|
||||
206
engines/freescape/games/dark/zx.cpp
Normal file
206
engines/freescape/games/dark/zx.cpp
Normal file
@@ -0,0 +1,206 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
|
||||
#include "freescape/freescape.h"
|
||||
#include "freescape/games/dark/dark.h"
|
||||
#include "freescape/language/8bitDetokeniser.h"
|
||||
|
||||
namespace Freescape {
|
||||
|
||||
void DarkEngine::initZX() {
|
||||
_viewArea = Common::Rect(56, 28, 265, 132);
|
||||
_maxEnergy = 63;
|
||||
_maxShield = 63;
|
||||
|
||||
_soundIndexShoot = 1;
|
||||
_soundIndexCollide = -1; // Scripted
|
||||
_soundIndexStepDown = 3;
|
||||
_soundIndexStepUp = 4;
|
||||
_soundIndexMenu = 25;
|
||||
_soundIndexStart = 11;
|
||||
_soundIndexAreaChange = 0x1c;
|
||||
_soundIndexRestoreECD = 30;
|
||||
|
||||
_soundIndexNoShield = 14;
|
||||
_soundIndexNoEnergy = 14;
|
||||
_soundIndexFallen = 7;
|
||||
_soundIndexTimeout = 14;
|
||||
_soundIndexForceEndGame = 14;
|
||||
_soundIndexCrushed = 25;
|
||||
_soundIndexMissionComplete = 8;
|
||||
}
|
||||
|
||||
void DarkEngine::loadAssetsZXFullGame() {
|
||||
Common::File file;
|
||||
|
||||
file.open("darkside.zx.title");
|
||||
if (file.isOpen()) {
|
||||
_title = loadAndConvertScrImage(&file);
|
||||
} else
|
||||
error("Unable to find darkside.zx.title");
|
||||
|
||||
file.close();
|
||||
file.open("darkside.zx.border");
|
||||
if (file.isOpen()) {
|
||||
_border = loadAndConvertScrImage(&file);
|
||||
} else
|
||||
error("Unable to find driller.zx.border");
|
||||
file.close();
|
||||
|
||||
file.open("darkside.zx.data");
|
||||
if (!file.isOpen())
|
||||
error("Failed to open darksize.zx.data");
|
||||
|
||||
loadMessagesFixedSize(&file, 0x56b - 6, 16, 27);
|
||||
|
||||
loadFonts(&file, 0x5d60 - 6);
|
||||
loadGlobalObjects(&file, 0x1a, 23);
|
||||
load8bitBinary(&file, 0x5ec0 - 4, 4);
|
||||
loadSpeakerFxZX(&file, 0x9c1, 0xa55);
|
||||
|
||||
_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_walk_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_jet_indicator"));
|
||||
|
||||
for (auto &it : _indicators)
|
||||
it->convertToInPlace(_gfx->_texturePixelFormat);
|
||||
}
|
||||
|
||||
void DarkEngine::loadAssetsZXDemo() {
|
||||
Common::File file;
|
||||
|
||||
file.open("darkside.zx.title");
|
||||
if (file.isOpen()) {
|
||||
_title = loadAndConvertScrImage(&file);
|
||||
} else
|
||||
error("Unable to find darkside.zx.title");
|
||||
|
||||
file.close();
|
||||
file.open("darkside.zx.border");
|
||||
if (file.isOpen()) {
|
||||
_border = loadAndConvertScrImage(&file);
|
||||
} else
|
||||
error("Unable to find driller.zx.border");
|
||||
file.close();
|
||||
|
||||
file.open("darkside.zx.data");
|
||||
if (!file.isOpen())
|
||||
error("Failed to open darksize.zx.data");
|
||||
|
||||
loadMessagesFixedSize(&file, 0x56b, 16, 27);
|
||||
loadMessagesFixedSize(&file, 0x5761, 264, 5);
|
||||
loadSpeakerFxZX(&file, 0x9c7, 0xa5b);
|
||||
|
||||
loadFonts(&file, 0x6164);
|
||||
loadGlobalObjects(&file, 0x20, 23);
|
||||
load8bitBinary(&file, 0x62c6, 4);
|
||||
_indicators.push_back(loadBundledImage("dark_fallen_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_crouch_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_walk_indicator"));
|
||||
_indicators.push_back(loadBundledImage("dark_jet_indicator"));
|
||||
|
||||
for (auto &it : _indicators)
|
||||
it->convertToInPlace(_gfx->_texturePixelFormat);
|
||||
}
|
||||
|
||||
void DarkEngine::drawZXUI(Graphics::Surface *surface) {
|
||||
uint32 color = 7;
|
||||
uint8 r, g, b;
|
||||
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
|
||||
color = _currentArea->_usualBackgroundColor;
|
||||
if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
|
||||
color = (*_gfx->_colorRemaps)[color];
|
||||
}
|
||||
|
||||
_gfx->readFromPalette(color, r, g, b);
|
||||
uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
|
||||
uint32 transparent = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
|
||||
|
||||
// Drawing the horizontal compass should be done first, so that the background is properly filled
|
||||
drawHorizontalCompass(192, 141, _yaw, front, back, surface);
|
||||
|
||||
int score = _gameStateVars[k8bitVariableScore];
|
||||
int ecds = _gameStateVars[kVariableActiveECDs];
|
||||
surface->fillRect(Common::Rect(193, 140, 223, 163), back);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 191, 141, front, transparent, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 191, 149, front, transparent, surface);
|
||||
drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 191, 157, front, transparent, surface);
|
||||
|
||||
surface->fillRect(Common::Rect(80, 165, 95, 172), back);
|
||||
surface->fillRect(Common::Rect(80, 172, 102, 179), back);
|
||||
drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 79, 165, front, transparent, surface);
|
||||
drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 79, 173, front, transparent, surface);
|
||||
surface->fillRect(Common::Rect(96, 12, 151, 19), back);
|
||||
drawStringInSurface(Common::String::format("%07d", score), 95, 13, front, transparent, surface);
|
||||
drawStringInSurface(Common::String::format("%3d%%", ecds), 191, 13, front, back, surface);
|
||||
|
||||
int seconds, minutes, hours;
|
||||
getTimeFromCountdown(seconds, minutes, hours);
|
||||
|
||||
Common::String message;
|
||||
int deadline;
|
||||
getLatestMessages(message, deadline);
|
||||
if (deadline <= _countdown) {
|
||||
drawStringInSurface(message, 112, 173, back, front, surface);
|
||||
_temporaryMessages.push_back(message);
|
||||
_temporaryMessageDeadlines.push_back(deadline);
|
||||
} else
|
||||
drawStringInSurface(_currentArea->_name, 112, 173, front, back, surface);
|
||||
|
||||
int energy = _gameStateVars[k8bitVariableEnergy]; // called fuel in this game
|
||||
int shield = _gameStateVars[k8bitVariableShield];
|
||||
|
||||
if (shield >= 0) {
|
||||
Common::Rect shieldBar;
|
||||
shieldBar = Common::Rect(80, 141, 143 - (_maxShield - shield), 148);
|
||||
surface->fillRect(shieldBar, back);
|
||||
|
||||
shieldBar = Common::Rect(80, 142, 143 - (_maxShield - shield), 147);
|
||||
surface->fillRect(shieldBar, front);
|
||||
|
||||
shieldBar = Common::Rect(80, 144, 143 - (_maxShield - shield), 145);
|
||||
surface->fillRect(shieldBar, back);
|
||||
}
|
||||
|
||||
if (energy >= 0) {
|
||||
Common::Rect energyBar;
|
||||
energyBar = Common::Rect(80, 148, 143 - (_maxEnergy - energy), 155);
|
||||
surface->fillRect(energyBar, back);
|
||||
|
||||
energyBar = Common::Rect(80, 149, 143 - (_maxEnergy - energy), 154);
|
||||
surface->fillRect(energyBar, front);
|
||||
|
||||
energyBar = Common::Rect(80, 151, 143 - (_maxEnergy - energy), 152);
|
||||
surface->fillRect(energyBar, back);
|
||||
}
|
||||
uint32 clockColor = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0xFF, 0x00, 0x00);
|
||||
drawBinaryClock(surface, 273, 128, clockColor, back);
|
||||
drawIndicator(surface, 152, 140);
|
||||
drawVerticalCompass(surface, 47, 79, _pitch, front);
|
||||
}
|
||||
|
||||
} // End of namespace Freescape
|
||||
Reference in New Issue
Block a user