Skip to content

Commit

Permalink
Merge branch 'scummvm:master' into fix-deleting-all-characters
Browse files Browse the repository at this point in the history
  • Loading branch information
yarolig committed May 21, 2023
2 parents ed09b75 + 9b5c571 commit c7e7898
Show file tree
Hide file tree
Showing 117 changed files with 749 additions and 344 deletions.
38 changes: 27 additions & 11 deletions devtools/create_mm/files/mm1/strings_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ maps:
face4: "Inset in the wall, a stone face\nproclaims: \"Okrim is watching.\nHe studies your weaknesses!\""
ringing: "A strange ringing sound startles\nthe party. You are teleported!"
emap38:
message4: "Etched in gold, message 4 reads:\n"Of-be-has-true-knowledge-plane-\na-level-to-reality-it\""
message4: "Etched in gold, message 4 reads:\nOf-be-has-true-knowledge-plane-\na-level-to-reality-it"

map39:
message6: "Etched in gold, message 6 reads:\nbook-done.-a-self-that-from-key-you-\nbe-to-seems"
Expand All @@ -1587,7 +1587,7 @@ maps:
door_glows: "A silver door, your silver key glows!"
stairs_up: "Stairs to surface, take them (Y/N)?"
emap39:
message6: "Etched in gold, message 6 reads:\n\"Book-done.-A-self-that-from-\nkey-you-be-to-seems\""
message6: "Etched in gold, message 6 reads:\nBook-done.-A-self-that-from-\nkey-you-be-to-seems"
title: "Ruby"
ruby1: "In the center of the room, a huge hexagonal ruby stands glowing atop a pedestal. You hear: Glass that glitters, rubies that glow when i twinkle, I cast a rainbow.\nWhat am i?"

Expand All @@ -1604,7 +1604,7 @@ maps:
test4: "The fourth test"
conveyor_belt: "Conveyor belt..."
emap40:
message2: "Etched in gold, message 2 reads:\n\"One,-riddles-value-you-you-\n5-card-must-claimed.-Dreams,-...\""
message2: "Etched in gold, message 2 reads:\nOne,-riddles-value-you-you-\n5-card-must-claimed.-Dreams,-..."
boulder: "A boulder says: \"There should be 5 tests\""
title: "Lord Archer"
archer: "\"I am Lord Archer, the Raven.\nI take from those who have and give to those who have not! Submit (Y/N)?\""
Expand All @@ -1621,7 +1621,7 @@ maps:
tapestry1: "A tapestry on the wall depicts a gray\nminotaur stomping on a group of knights."
tapestry2: "A tapestry on the wall depicts\na kingdom ruled by minotaurs"
emap41:
message3: "Etched in gold, message 3 reads:\n\"For-tasks-and-rating.-Be-from-\n6th-frustrations!-The-to-in\""
message3: "Etched in gold, message 3 reads:\nFor-tasks-and-rating.-Be-from-\n6th-frustrations!-The-to-in"
stairs_up: "Spiralling stairs go up, take them (Y/N)?"

map42:
Expand All @@ -1633,7 +1633,7 @@ maps:
statue3: "Desecrate it (Y/N)?"
emap42:
title: "Dog Statue"
message9: "Etched in gold, message 9 reads:\n\"Successful-that-training,-the-\nworthy-the-visit-yet-inner-\nreality,-order,\""
message9: "Etched in gold, message 9 reads:\nSuccessful-that-training,-the-\nworthy-the-visit-yet-inner-\nreality,-order,"

map43:
exit: "Exit castle, (Y/N)?"
Expand Down Expand Up @@ -1697,7 +1697,7 @@ maps:
painting: "On the right wall is a painting of a\nbox,on the left a painting of a curtain."
door_number: "Door number %c"
emap47:
message5: "Etched in gold, message 5 reads:\n\"Scoop:-the-discoveries-your-to-\nreturn-the-your-for-dreams-is\""
message5: "Etched in gold, message 5 reads:\nScoop:-the-discoveries-your-to-\nreturn-the-your-for-dreams-is"
painting: "On the right wall is a painting of a box, on the left a painting of a curtain."

map48:
Expand All @@ -1711,9 +1711,9 @@ maps:
map49:
chute: "A chute..."
catapult: "A catapult ejects you from the tower!"
message_e: "Etched in silver, message e reads:\noei/:1-33-1ek5;d-et,"
alamar1: "The omnipotent king alamar speaks,\n\n"
alamar2: "\"Varnlings, i quest thee to find the\nCrypt of Carmenca. away with you...\""
message_e: "Etched in silver, message E reads:\noei/:1-33-1ek5;d-et,"
alamar1: "The omnipotent King Alamar speaks,\n\n"
alamar2: "\"Varnlings, I quest thee to find the\nCrypt of Carmenca. Away with you...\""
alamar3: "\"My saviors, you're always welcome here!\nYou should find the inner sanctum...\nLive long and prosper.\""
alamar4: "\"You've discovered my true identity!\nInto the soul maze you go...\""
guards1: "Castle guards exclaim,\n\"No Merchants Pass! begone peasants.\""
Expand All @@ -1722,22 +1722,31 @@ maps:
trap: "Singe! Acid trap."
explosion: "Boom! A fiery explosion."
throne_room: "Throne room"
emap49:
king_alamar: "King Alamar"
sheltem: "Imposter King Alamar"

map50:
message7: "Etched in gold, message 7 reads:\nThese-and-that-must-can-different-\nshall-have-from-a-jvc"
sign1: "Club dead...\nthe antidote to humanization!"
sign2: "Temple of the old order"
sign1: "Club Dead...\nThe antidote to humanization!"
sign2: "Temple of the Old Order"
sign3: "Glass room"
sign4: "Ruby room"
sign5: "Twinkle room"
sign6: "Rainbow room"
grate: "The crystal grate repels you!"
emap50:
message7: "Etched in gold, message 7 reads:\nThese-and-that-must-can-\ndifferent-shall-have-from-a-jvc"

map51:
substance: "Without experimental substance\nthere is no hope...poof!"
emap51:
substance: "Without experimental substance there is no hope... Poof!"

map52:
summoned: "You have been summoned...poof!"
emap52:
summoned: "You have been summoned... Poof!"

map53:
sign: "Danger! Dungeon under construction."
Expand All @@ -1755,3 +1764,10 @@ maps:
keeper3: "In a serene voice, the data keeper says,\n\"Welcome to your inner sanctum\nVarnlings! I am very pleased that you've\nmade it this far. You are to be\ncommended. I've been monitoring your\nprogress.\" Turning to the strange\nmechanical device, he inserts a flat\nobject into a slot. Your party's current\nperformance total=%u"
keeper4: "\"You are not yet worthy for transfer. Return after defeating the imposter.\""
keeper5: "Excellent rating! this is a rare occasion, for only a privileged few are given the opportunity for transfer to\nanother V.A.R.N. (Vehicular Astropod\nResearch Nacelle). Return now to the\nInn of Sorpigal for rest and celebration\nthen continue on to your new assignment at the Gates To Another World...\" (+50000 exp for your accomplishment!)\n----------------------------------------\nPlease send your performance total to\nNew World Computing, Inc.\n P. O. Box 2068 Van Nuys, CA 91404"
emap54:
keeper: "Keeper"
keeper2: "In a serene voice, the data keeper says, \"Welcome to your inner sanctum Varnlings! I am very pleased that you've made it this far. You are to be commended. I've been monitoring your\nprogress.\""
keeper3: "Turning to the strange mechanical device, he inserts a flat object into a slot. Your party's current performance total=%u."
keeper4: "\"You are not yet worthy for transfer. Return after defeating the imposter.\""
keeper5: "Excellent rating! this is a rare occasion, for only a privileged few are given the opportunity for transfer to another V.A.R.N. (Vehicular Astropod\nResearch Nacelle)."
keeper6: "Return now to the\nInn of Sorpigal for rest and celebration then continue on to your new assignment at the Gates To Another World...\" (+50000 exp for your accomplishment!)"
3 changes: 2 additions & 1 deletion engines/ags/lib/allegro/surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class BITMAP {
private:
Graphics::ManagedSurface *_owner;
public:
int16 &w, &h, &pitch;
int16 &w, &h;
int32 &pitch;
Graphics::PixelFormat &format;
bool clip;
int ct, cb, cl, cr;
Expand Down
18 changes: 9 additions & 9 deletions engines/bladerunner/bladerunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,12 @@ void BladeRunnerEngine::pauseEngineIntern(bool pause) {

Common::Error BladeRunnerEngine::run() {
Common::Array<Common::String> missingFiles;
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "base");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd1");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd2");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd3");
SearchMan.addSubDirectoryMatching(gameDataDir, "cd4");
if (!_isNonInteractiveDemo && !checkFiles(missingFiles)) {
Common::String missingFileStr = "";
for (uint i = 0; i < missingFiles.size(); ++i) {
Expand Down Expand Up @@ -558,15 +564,9 @@ bool BladeRunnerEngine::checkFiles(Common::Array<Common::String> &missingFiles)
bool hasHdFrames = Common::File::exists("HDFRAMES.DAT");

if (!hasHdFrames) {
requiredFiles.clear();
requiredFiles.push_back("CDFRAMES1.DAT");
requiredFiles.push_back("CDFRAMES2.DAT");
requiredFiles.push_back("CDFRAMES3.DAT");
requiredFiles.push_back("CDFRAMES4.DAT");

for (uint i = 0; i < requiredFiles.size(); ++i) {
if (!Common::File::exists(requiredFiles[i])) {
missingFiles.push_back(requiredFiles[i]);
for (uint i = 1; i <= 4; ++i) {
if (!Common::File::exists(Common::String::format("CDFRAMES%d.DAT", i)) && !Common::File::exists(Common::String::format("CD%d/CDFRAMES.DAT", i))) {
missingFiles.push_back(Common::String::format("CD%d/CDFRAMES.DAT", i));
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions engines/bladerunner/detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ static const PlainGameDescriptor bladeRunnerGames[] = {
{nullptr, nullptr}
};

static const char *const directoryGlobs[] = {
"BASE",
nullptr
};
} // End of namespace BladeRunner

class BladeRunnerMetaEngineDetection : public AdvancedMetaEngineDetection {
Expand All @@ -72,6 +76,8 @@ BladeRunnerMetaEngineDetection::BladeRunnerMetaEngineDetection()
// and expects ScummVM to detect both, offer a choice on which to add,
// and finally launch the proper one depending on which was added.
_flags = kADFlagUseExtraAsHint;
_maxScanDepth = 2;
_directoryGlobs = BladeRunner::directoryGlobs;
}

const char *BladeRunnerMetaEngineDetection::getName() const {
Expand Down
7 changes: 7 additions & 0 deletions engines/bladerunner/slice_animations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ bool SliceAnimations::openFrames(int fileNumber) {
_framesPageFile.close(_framesPageFile._fileNumber);
}
_framesPageFile._fileNumber = fileNumber;

if (_framesPageFile.open(Common::String::format("CD%d/CDFRAMES.DAT", fileNumber), fileNumber)) {
return true;
}

// For Chapter1 we try both CDFRAMES.DAT and CDFRAMES1.DAT
if (fileNumber == 1 && _framesPageFile.open("CDFRAMES.DAT", fileNumber)) {
return true;
Expand All @@ -151,11 +156,13 @@ bool SliceAnimations::openFrames(int fileNumber) {
_framesPageFile.close(i);
if (i == 1
&& (!_framesPageFile.open("CDFRAMES.DAT", i))
&& (!_framesPageFile.open(Common::String::format("CD%d/CDFRAMES.DAT", i), i))
&& (!_framesPageFile.open(Common::String::format("CDFRAMES%d.DAT", i), i))
) {
// For Chapter1 we try both CDFRAMES.DAT and CDFRAMES1.DAT
return false;
} else if (i != 1 &&
(!_framesPageFile.open(Common::String::format("CD%d/CDFRAMES.DAT", i), i)) &&
!_framesPageFile.open(Common::String::format("CDFRAMES%d.DAT", i), i)
) {
return false;
Expand Down
23 changes: 9 additions & 14 deletions engines/freescape/games/castle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ CastleEngine::CastleEngine(OSystem *syst, const ADGameDescription *gd) : Freesca

_playerWidth = 8;
_playerDepth = 8;
_option = nullptr;
}

CastleEngine::~CastleEngine() {
Expand Down Expand Up @@ -290,24 +291,18 @@ void CastleEngine::loadAssetsAmigaDemo() {

loadMessagesVariableSize(&file, 0x8bb2, 164);
load8bitBinary(&file, 0x162a6, 16);
assert(0);
//loadPalettes(&file, 0x0);
loadPalettes(&file, 0x151a6);

//file.close();
//file.open("driller");
//if (!file.isOpen())
// error("Failed to open 'driller' file");
file.seek(0x2be96); // Area 255
_areaMap[255] = load8bitArea(&file, 16);
file.close();

//loadFonts(&file, 0xa30);
//loadMessagesFixedSize(&file, 0x3960, 14, 20);
//loadGlobalObjects(&file, 0x3716, 8);

file.close();
//file.open("soundfx");
//if (!file.isOpen())
// error("Failed to open 'soundfx' executable for Amiga");
_areaMap[2]->_groundColor = 1;
for (auto &it : _areaMap)
it._value->addStructure(_areaMap[255]);

//loadSoundsFx(&file, 0, 25);
_areaMap[2]->addFloor();
}


Expand Down
13 changes: 9 additions & 4 deletions engines/freescape/games/palettes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void FreescapeEngine::loadPalettes(Common::SeekableReadStream *file, int offset)
for (uint i = 0; i < _areaMap.size() + 2; i++) {
int label = readField(file, 8);
auto palette = new byte[16][3];
debugC(1, kFreescapeDebugParser, "Loading palette for area: %d", label);
debugC(1, kFreescapeDebugParser, "Loading palette for area: %d at %lx", label, file->pos());
for (int c = 0; c < 16; c++) {
int v = file->readUint16BE();
r = (v & 0xf00) >> 8;
Expand Down Expand Up @@ -212,9 +212,6 @@ byte kDrillerCGAPaletteRedGreenData[4][3] = {
};

void FreescapeEngine::swapPalette(uint16 levelID) {
if (!_border)
return;

if (isAmiga() || isAtariST()) {
// The following palette was not available in the demo, so we select another one
if (isDemo() && levelID == 32)
Expand All @@ -226,6 +223,9 @@ void FreescapeEngine::swapPalette(uint16 levelID) {
_gfx->_paperColor = _areaMap[levelID]->_paperColor;
_gfx->_underFireBackgroundColor = _areaMap[levelID]->_underFireBackgroundColor;

if (!_border)
return;

byte *palette = (byte *)malloc(sizeof(byte) * 4 * 3);
for (int c = 0; c < 4; c++) {
byte r, g, b;
Expand Down Expand Up @@ -253,9 +253,14 @@ void FreescapeEngine::swapPalette(uint16 levelID) {
}

assert(entry->areaId == levelID);
if (!_border)
return;
_border->setPalette(_gfx->_palette, 0, 4);
processBorder();
} else if (isDOS() && _renderMode == Common::kRenderEGA) {
if (!_border)
return;

_border->setPalette(_gfx->_palette, 0, 4);
processBorder();
}
Expand Down
9 changes: 7 additions & 2 deletions engines/freescape/language/8bitDetokeniser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
2, 1, 1, 2, 1, 1, 2, 1,
1, 2, 2, 1, 2, 0, 0, 0,
1, 1, 0, 1, 1, 1, 1, 1,
2, 2, 1, 1, 0, 0, 0, 0,
2, 2, 1, 1, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 2, 2,
1};

Expand Down Expand Up @@ -115,7 +115,7 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
// check we have enough bytes left to read
if (opcode > 48) {
debugC(1, kFreescapeDebugParser, "%s", detokenisedStream.c_str());
if (opcode != 0x3f && opcode != 0x3b)
if (opcode != 0x3f)
error("ERROR: failed to read opcode: %x", opcode);
break;
}
Expand Down Expand Up @@ -304,6 +304,11 @@ Common::String detokenise8bitCondition(Common::Array<uint8> &tokenisedCondition,
currentInstruction = FCLInstruction(Token::PRINT);
break;

case 37:
detokenisedStream += "STARTANIM (";
currentInstruction = FCLInstruction(Token::STARTANIM);
break;

case 12:
detokenisedStream += "SETBIT (";
currentInstruction = FCLInstruction(Token::SETBIT);
Expand Down
27 changes: 21 additions & 6 deletions engines/freescape/loaders/8bitBinaryLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {
error("Not enough bytes %d to read object %d with type %d", byteSizeOfObject, objectID, objectType);
}

if (objectType > ObjectType::kGroupType && isDemo()) {
// Castle DOS demo has an invalid object, which should not be parsed.
debugC(1, kFreescapeDebugParser, "WARNING: invalid object %d!", objectID);
readArray(file, byteSizeOfObject - 9);
return nullptr;
}

assert(byteSizeOfObject >= 9);
byteSizeOfObject = byteSizeOfObject - 9;
if (objectID == 255 && objectType == ObjectType::kEntranceType) {
Expand All @@ -114,7 +121,7 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {

byteSizeOfObject++;
while(--byteSizeOfObject > 0)
structureArray.push_back(file->readByte());
structureArray.push_back(readField(file, 8));
return new GlobalStructure(structureArray);
} else if (objectID == 254 && objectType == ObjectType::kEntranceType) {
debugC(1, kFreescapeDebugParser, "Found the area connections (objectID: 254 with size %d)", byteSizeOfObject + 6);
Expand Down Expand Up @@ -288,7 +295,7 @@ Object *FreescapeEngine::load8bitObject(Common::SeekableReadStream *file) {

byteSizeOfObject++;
while(--byteSizeOfObject > 0)
groupDataArray.push_back(file->readByte());
groupDataArray.push_back(readField(file, 8));

return new Group(
objectID,
Expand Down Expand Up @@ -484,7 +491,10 @@ Area *FreescapeEngine::load8bitArea(Common::SeekableReadStream *file, uint16 nco
}
} else if (isCastle()) {
byte idx = readField(file, 8);
name = _messagesList[idx + 41];
if (isAmiga())
name = _messagesList[idx + 51];
else
name = _messagesList[idx + 41];
extraColor[0] = readField(file, 8);
extraColor[1] = readField(file, 8);
extraColor[2] = readField(file, 8);
Expand Down Expand Up @@ -516,7 +526,7 @@ Area *FreescapeEngine::load8bitArea(Common::SeekableReadStream *file, uint16 nco
error("WARNING: replacing object id %d", newObject->getObjectID());
(*objectsByID)[newObject->getObjectID()] = newObject;
}
} else
} else if (!(isDemo() && isCastle()))
error("Failed to read an object!");
}
long int endLastObject = file->pos();
Expand Down Expand Up @@ -570,8 +580,13 @@ void FreescapeEngine::load8bitBinary(Common::SeekableReadStream *file, int offse
uint8 numberOfAreas = readField(file, 8);
debugC(1, kFreescapeDebugParser, "Number of areas: %d", numberOfAreas);

if (isDOS() && isCastle()) // Castle Master for DOS has an invalid number of areas
numberOfAreas = isDemo() ? 31 : 104;
// Castle Master seems to have invalid number of areas?
if (isCastle()) {
if (isDOS())
numberOfAreas = isDemo() ? 31 : 104;
else if (isAmiga())
numberOfAreas = isDemo() ? 87 : 104;
}

uint32 dbSize = readField(file, 16);
debugC(1, kFreescapeDebugParser, "Database ends at %x", dbSize);
Expand Down
5 changes: 5 additions & 0 deletions engines/freescape/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ void FreescapeEngine::playMusic(const Common::String filename) {
}

void FreescapeEngine::playSoundFx(int index, bool sync) {
if (_soundsFx.size() == 0) {
debugC(1, kFreescapeDebugMedia, "WARNING: Sounds are not loaded");
return;
}

int size = _soundsFx[index]->size;
int sampleRate = _soundsFx[index]->sampleRate;
byte *data = _soundsFx[index]->data;
Expand Down

0 comments on commit c7e7898

Please sign in to comment.