FREESCAPE: removed hardcoded castle font and load the proper one in the dos release

This commit is contained in:
neuromancer 2024-07-10 20:16:59 +02:00
parent 4a2bf42189
commit b5d035c9cb
4 changed files with 29 additions and 78 deletions

View File

@ -57,68 +57,6 @@ CastleEngine::~CastleEngine() {
}
}
byte kFreescapeCastleFont[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1c, 0x1c, 0x1c, 0x18, 0x18, 0x00, 0x18, 0x18,
0x66, 0x66, 0x44, 0x22, 0x00, 0x00, 0x00, 0x00,
0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00,
0x10, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x10, 0x00,
0x3c, 0x42, 0x9d, 0xb1, 0xb1, 0x9d, 0x42, 0x3c,
0x78, 0xcc, 0xcc, 0x78, 0xdb, 0xcf, 0xce, 0x7b,
0x30, 0x30, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00,
0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x20, 0x10,
0x10, 0x08, 0x04, 0x04, 0x04, 0x04, 0x08, 0x10,
0x10, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x10, 0x00,
0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x08, 0x10,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
0x18, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x18,
0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
0x9e, 0x61, 0x01, 0x7e, 0xe0, 0xc6, 0xe3, 0xfe,
0xee, 0x73, 0x03, 0x3e, 0x03, 0x01, 0x7f, 0xe6,
0x0e, 0x1c, 0x38, 0x71, 0xfd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d8, 0x70, 0x60, 0x60, 0x66, 0x61, 0xf3, 0x7e,
0xc3, 0x66, 0x6e, 0x76, 0x56, 0x46, 0x46, 0xef,
0x87, 0x62, 0x72, 0x7a, 0x5e, 0x4e, 0x46, 0xe1,
0x18, 0x66, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x18,
0xec, 0x72, 0x63, 0x63, 0x72, 0x6c, 0x60, 0xf0,
0x3c, 0x66, 0xc3, 0xc3, 0x66, 0x3c, 0x31, 0x1e,
0xec, 0x72, 0x63, 0x63, 0x76, 0x6c, 0x66, 0xf1,
0x79, 0x86, 0x80, 0x7e, 0x07, 0x63, 0xc7, 0x7c,
0x01, 0x7f, 0xfe, 0x98, 0x58, 0x18, 0x18, 0x3c,
0xf7, 0x62, 0x62, 0x62, 0x62, 0x62, 0xf2, 0x3c,
0xf3, 0x61, 0x72, 0x72, 0x32, 0x32, 0x1c, 0x3e,
0xc3, 0x62, 0x62, 0x6a, 0x6e, 0x76, 0x66, 0xc3,
0xf3, 0x72, 0x3c, 0x38, 0x1c, 0x3c, 0x4e, 0xcf,
0xe3, 0x72, 0x34, 0x38, 0x18, 0x18, 0x18, 0x3c,
0x7f, 0x87, 0x0e, 0x1c, 0x38, 0x71, 0xfd, 0xe6,
};
void CastleEngine::gotoArea(uint16 areaID, int entranceID) {
debugC(1, kFreescapeDebugMove, "Jumping to area: %d, entrance: %d", areaID, entranceID);

View File

@ -55,6 +55,7 @@ public:
private:
Common::SeekableReadStream *decryptFile(const Common::Path &filename);
void loadRiddles(Common::SeekableReadStream *file, int offset, int number);
void loadDOSFonts(Common::SeekableReadStream *file, int pos);
void drawFullscreenRiddleAndWait(uint16 riddle);
void drawRiddle(uint16 riddle, uint32 front, uint32 back, Graphics::Surface *surface);
void addGhosts();

View File

@ -51,6 +51,27 @@ Common::SeekableReadStream *CastleEngine::decryptFile(const Common::Path &filena
extern byte kEGADefaultPalette[16][3];
extern Common::MemoryReadStream *unpackEXE(Common::File &ms);
void CastleEngine::loadDOSFonts(Common::SeekableReadStream *file, int pos) {
file->seek(pos);
byte *buffer = (byte *)malloc(sizeof(byte) * 59 * 8);
for (int i = 0; i < 59 * 8; i++) {
//debug("%lx", file->pos());
for (int j = 0; j < 4; j++) {
uint16 c = readField(file, 16);
if (j == 3) {
//debugN("0x%x, ", c);
assert(c < 256);
buffer[i] = c;
}
}
//debugN("\n");
}
debug("%lx", file->pos());
loadFonts(buffer, 59);
free(buffer);
}
void CastleEngine::loadAssetsDOSFullGame() {
Common::File file;
Common::SeekableReadStream *stream = nullptr;
@ -62,6 +83,7 @@ void CastleEngine::loadAssetsDOSFullGame() {
stream = unpackEXE(file);
if (stream) {
loadSpeakerFxDOS(stream, 0x636d + 0x200, 0x63ed + 0x200);
loadDOSFonts(stream, 0x29696);
}
delete stream;
@ -103,7 +125,6 @@ void CastleEngine::loadAssetsDOSFullGame() {
error("Invalid or unsupported language: %x", _language);
}
loadFonts(kFreescapeCastleFont, 59);
delete stream;
stream = decryptFile("CMEDF");
@ -140,6 +161,7 @@ void CastleEngine::loadAssetsDOSDemo() {
stream = unpackEXE(file);
if (stream) {
loadSpeakerFxDOS(stream, 0x636d + 0x200, 0x63ed + 0x200);
loadDOSFonts(stream, 0x29696);
}
delete stream;
@ -161,18 +183,8 @@ void CastleEngine::loadAssetsDOSDemo() {
file.close();
stream = decryptFile("CMLD"); // Only english
loadFonts(kFreescapeCastleFont, 59);
loadMessagesVariableSize(stream, 0x11, 164);
loadRiddles(stream, 0xaae, 10);
/*for (int i = 0; i < 16; i++) {
debug("%lx", stream->pos());
for (int j = 0; j < 16; j++) {
byte c = stream->readByte();
debugN("%x/%c", c, c);
}
debugN("\n");
}*/
delete stream;
stream = decryptFile("CDEDF");
@ -183,9 +195,9 @@ void CastleEngine::loadAssetsDOSDemo() {
_areaMap[1]->addFloor();
_areaMap[2]->addFloor();
delete stream;
_background = loadBundledImage("background");
assert(_background);
_background->convertToInPlace(_gfx->_texturePixelFormat);
//_background = loadBundledImage("background");
//assert(_background);
//_background->convertToInPlace(_gfx->_texturePixelFormat);
} else
error("Not implemented yet");
}

View File

@ -53,8 +53,8 @@ void CastleEngine::loadAssetsZXFullGame() {
error("Failed to open castlemaster.zx.data");
//loadMessagesFixedSize(&file, 0x4bc + 1, 16, 27);
loadFonts(kFreescapeCastleFont, 59);
loadMessagesVariableSize(&file, 0x4bd, 71);
loadFonts(&file, 0x1219, _font);
loadMessagesVariableSize(&file, 0x4bd, 71);
load8bitBinary(&file, 0x6a3b, 16);
loadSpeakerFxZX(&file, 0xc91, 0xccd);