aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2013-09-13 08:29:19 +0200
committerStrangerke2013-09-13 08:29:19 +0200
commitf7c34949db4df92aced4a654072ef74bd064c421 (patch)
treef2ce8205df5c856a20d7b7f1740c18e1419641b9
parent8a59c9c1b27cc026ba096c44486f504ba1eb8c5d (diff)
downloadscummvm-rg350-f7c34949db4df92aced4a654072ef74bd064c421.tar.gz
scummvm-rg350-f7c34949db4df92aced4a654072ef74bd064c421.tar.bz2
scummvm-rg350-f7c34949db4df92aced4a654072ef74bd064c421.zip
AVALANCHE: Error out when critical files are missing
-rw-r--r--engines/avalanche/animation.cpp6
-rw-r--r--engines/avalanche/celer2.cpp12
-rw-r--r--engines/avalanche/gyro2.cpp6
-rw-r--r--engines/avalanche/lucerna2.cpp43
-rw-r--r--engines/avalanche/pingo2.cpp6
-rw-r--r--engines/avalanche/scrolls2.cpp45
-rw-r--r--engines/avalanche/visa2.cpp26
7 files changed, 49 insertions, 95 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index 615bf94d40..57353255db 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -55,10 +55,8 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) {
Common::File inf;
Common::String filename = Common::String::format("sprite%d.avd", spritenum);
- if (!inf.open(filename)) {
- warning("AVALANCHE: Trip: File not found: %s", filename.c_str());
- return;
- }
+ if (!inf.open(filename))
+ error("AVALANCHE: Trip: File not found: %s", filename.c_str());
inf.seek(177);
diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp
index 5069a92e0a..acbe5e9ead 100644
--- a/engines/avalanche/celer2.cpp
+++ b/engines/avalanche/celer2.cpp
@@ -267,10 +267,8 @@ void Celer::updateBackgroundSprites() {
void Celer::loadBackgroundSprites(byte number) {
Common::File f;
_filename = _filename.format("chunk%d.avd", number);
- if (!f.open(_filename)) {
- warning("AVALANCHE: Celer: File not found: %s", _filename.c_str());
- return;
- }
+ if (!f.open(_filename))
+ error("AVALANCHE: Celer: File not found: %s", _filename.c_str());
f.seek(44);
_spriteNum = f.readByte();
@@ -336,10 +334,8 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) {
drawSprite(destX, destY, _sprites[which]);
} else {
Common::File f;
- if (!f.open(_filename)) { // Filename was set in loadBackgroundSprites().
- warning("AVALANCHE: Celer: File not found: %s", _filename.c_str());
- return;
- }
+ if (!f.open(_filename)) // Filename was set in loadBackgroundSprites().
+ error("AVALANCHE: Celer: File not found: %s", _filename.c_str());
f.seek(_offsets[which]);
diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp
index 70c2150d1e..ecd1be14b7 100644
--- a/engines/avalanche/gyro2.cpp
+++ b/engines/avalanche/gyro2.cpp
@@ -457,10 +457,8 @@ Common::String Gyro::f5Does() {
void Gyro::loadMouse(byte which) {
Common::File f;
- if (!f.open("mice.avd")) {
- warning("AVALANCHE: Gyro: File not found: mice.avd");
- return;
- }
+ if (!f.open("mice.avd"))
+ error("AVALANCHE: Gyro: File not found: mice.avd");
::Graphics::Surface cursor;
cursor.create(16, 32, ::Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index 71d38d3c0c..784c83ed7d 100644
--- a/engines/avalanche/lucerna2.cpp
+++ b/engines/avalanche/lucerna2.cpp
@@ -218,10 +218,8 @@ void Lucerna::loadAlso(byte num) {
}
Common::String filename;
filename = Common::String::format("also%d.avd", num);
- if (!file.open(filename)) {
- warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str());
- return;
- }
+ if (!file.open(filename))
+ error("AVALANCHE: Lucerna: File not found: %s", filename.c_str());
file.seek(128);
@@ -298,10 +296,8 @@ void Lucerna::loadRoom(byte num) {
_vm->_graphics->fleshColors();
Common::String filename = Common::String::format("place%d.avd", num);
- if (!file.open(filename)) {
- warning("AVALANCHE: Lucerna: File not found: %s", filename.c_str());
- return;
- }
+ if (!file.open(filename))
+ error("AVALANCHE: Lucerna: File not found: %s", filename.c_str());
file.seek(146);
if (!_vm->_gyro->_roomnName.empty())
@@ -851,15 +847,11 @@ void Lucerna::thinkAbout(byte object, bool type) {
_vm->_gyro->setMousePointerWait();
if (type == Gyro::kThing) {
- if (!file.open("thinks.avd")) {
- warning("AVALANCHE: Lucerna: File not found: thinks.avd");
- return;
- }
+ if (!file.open("thinks.avd"))
+ error("AVALANCHE: Lucerna: File not found: thinks.avd");
} else { // Gyro::kPerson
- if (!file.open("folk.avd")) {
- warning("AVALANCHE: Lucerna: File not found: folk.avd");
- return;
- }
+ if (!file.open("folk.avd"))
+ error("AVALANCHE: Lucerna: File not found: folk.avd");
object -= 149;
if (object >= 25)
@@ -869,13 +861,10 @@ void Lucerna::thinkAbout(byte object, bool type) {
}
file.seek(object * picSize + 65);
-
::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file);
-
_vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 205, 170);
picture.free();
-
file.close();
CursorMan.showMouse(false);
@@ -894,10 +883,8 @@ void Lucerna::loadDigits() { // Load the scoring digits & rwlites
const byte digitsize = 134;
const byte rwlitesize = 126;
- if (!file.open("digit.avd")) {
- warning("AVALANCHE: Lucerna: File not found: digit.avd");
- return;
- }
+ if (!file.open("digit.avd"))
+ error("AVALANCHE: Lucerna: File not found: digit.avd");
for (byte i = 0; i < 10; i++) {
file.seek(i * digitsize);
@@ -913,25 +900,19 @@ void Lucerna::loadDigits() { // Load the scoring digits & rwlites
}
void Lucerna::drawToolbar() {
- if (!file.open("useful.avd")) {
- warning("AVALANCHE: Lucerna: File not found: useful.avd");
- return;
- }
+ if (!file.open("useful.avd"))
+ error("AVALANCHE: Lucerna: File not found: useful.avd");
file.seek(40);
CursorMan.showMouse(false);
-
::Graphics::Surface picture = _vm->_graphics->loadPictureGraphic(file);
-
_vm->_graphics->drawPicture(_vm->_graphics->_surface, picture, 5, 169);
picture.free();
-
file.close();
CursorMan.showMouse(true);
-
_vm->_gyro->_oldDirection = 177;
drawDirection();
}
diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp
index 3ebb47ed98..9f99d8c184 100644
--- a/engines/avalanche/pingo2.cpp
+++ b/engines/avalanche/pingo2.cpp
@@ -113,10 +113,8 @@ void Pingo::winningPic() {
Common::File f;
_vm->_lucerna->dusk();
- if (!f.open("finale.avd")) {
- warning("AVALANCHE: Lucerna: File not found: finale.avd");
- return;
- }
+ if (!f.open("finale.avd"))
+ error("AVALANCHE: Lucerna: File not found: finale.avd");
#if 0
for (byte bit = 0; bit <= 3; bit++) {
diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp
index ab7d038540..4e114517ad 100644
--- a/engines/avalanche/scrolls2.cpp
+++ b/engines/avalanche/scrolls2.cpp
@@ -264,10 +264,8 @@ void Scrolls::unDodgem() {
void Scrolls::getIcon(int16 x, int16 y, byte which) {
Common::File file;
- if (!file.open("icons.avd")) {
- warning("AVALANCHE: Scrolls: File not found: icons.avd");
- return;
- }
+ if (!file.open("icons.avd"))
+ error("AVALANCHE: Scrolls: File not found: icons.avd");
which--;
file.seek(which * 426);
@@ -286,10 +284,8 @@ void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) {
Common::File file;
Common::String filename = Common::String::format("%s.avd", fn.c_str());
- if (!file.open(filename)) {
- warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str());
- return;
- }
+ if (!file.open(filename))
+ error("AVALANCHE: Scrolls: File not found: %s", filename.c_str());
#if 0
uint16 st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop);
@@ -730,14 +726,12 @@ void Scrolls::callScrollDriver() {
break;
case 10:
switch (_vm->_gyro->_dna._boxContent) {
- case 0: { // Sixpence.
+ case 0: // Sixpence.
_vm->_visa->displayScrollChain('q', 37); // You find the sixpence.
_vm->_gyro->_dna._money += 6;
_vm->_gyro->_dna._boxContent = _vm->_acci->kNothing;
_vm->_lucerna->incScore(2);
return;
- }
- break;
case Acci::kNothing:
displayText("nothing at all. It's completely empty.");
break;
@@ -759,7 +753,7 @@ void Scrolls::callScrollDriver() {
case kControlNewLine:
_vm->_gyro->_scrollNum++;
break;
- case kControlQuestion: {
+ case kControlQuestion:
if (call_spriterun)
_vm->_lucerna->spriteRun();
call_spriterun = false;
@@ -768,9 +762,7 @@ void Scrolls::callScrollDriver() {
_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] = kControlQuestion;
drawScroll(&Avalanche::Scrolls::scrollModeDialogue);
-
resetScroll();
- }
break;
case kControlRegister:
mouthnext = true;
@@ -779,13 +771,13 @@ void Scrolls::callScrollDriver() {
for (byte j = 0; j < 9; j++)
_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += ' ';
break;
- default: { // Add new char.
+ default: // Add new char.
if (_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1].size() == 50) {
solidify(_vm->_gyro->_scrollNum - 1);
_vm->_gyro->_scrollNum++;
}
_vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] += _vm->_gyro->_buffer[i];
- }
+ break;
}
}
}
@@ -800,26 +792,23 @@ void Scrolls::displayText(Common::String text) { // TODO: REPLACE BUFFER WITH A
void Scrolls::loadFont() {
Common::File file;
- if (!file.open("avalot.fnt")) {
- warning("AVALANCHE: Scrolls: File not found: avalot.fnt");
- return;
- }
+ if (!file.open("avalot.fnt"))
+ error("AVALANCHE: Scrolls: File not found: avalot.fnt");
+
for (int16 i = 0; i < 256; i++)
file.read(_scrollFonts[0][i], 16);
file.close();
- if (!file.open("avitalic.fnt")) {
- warning("AVALANCHE: Scrolls: File not found: avitalic.fnt");
- return;
- }
+ if (!file.open("avitalic.fnt"))
+ error("AVALANCHE: Scrolls: File not found: avitalic.fnt");
+
for (int16 i = 0; i < 256; i++)
file.read(_scrollFonts[1][i], 16);
file.close();
- if (!file.open("ttsmall.fnt")) {
- warning("AVALANCHE: Scrolls: File not found: ttsmall.fnt");
- return;
- }
+ if (!file.open("ttsmall.fnt"))
+ error("AVALANCHE: Scrolls: File not found: ttsmall.fnt");
+
for (int16 i = 0; i < 256; i++)
file.read(_vm->_gyro->_font[i],16);
file.close();
diff --git a/engines/avalanche/visa2.cpp b/engines/avalanche/visa2.cpp
index dfc99d4cd5..2354fe535a 100644
--- a/engines/avalanche/visa2.cpp
+++ b/engines/avalanche/visa2.cpp
@@ -61,10 +61,8 @@ void Visa::doTheBubble() {
*/
void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling) {
Common::File indexfile;
- if (!indexfile.open("avalot.idx")) {
- warning("AVALANCHE: Visa: File not found: avalot.idx");
- return;
- }
+ if (!indexfile.open("avalot.idx"))
+ error("AVALANCHE: Visa: File not found: avalot.idx");
bool error = false;
@@ -91,10 +89,9 @@ void Visa::displayScrollChain(char block, byte point, bool report, bool bubbling
}
Common::File sezfile;
- if (!sezfile.open("avalot.sez")) {
- warning("AVALANCHE: Visa: File not found: avalot.sez");
- return;
- }
+ if (!sezfile.open("avalot.sez"))
+ error("AVALANCHE: Visa: File not found: avalot.sez");
+
sezfile.seek(sez_offset);
_vm->_gyro->_bufSize = sezfile.readUint16LE();
sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize);
@@ -121,10 +118,8 @@ void Visa::speak(byte who, byte subject) {
_noError = false; // Assume that until we know otherwise.
Common::File indexfile;
- if (!indexfile.open("converse.avd")) {
- warning("AVALANCHE: Visa: File not found: converse.avd");
- return;
- }
+ if (!indexfile.open("converse.avd"))
+ error("AVALANCHE: Visa: File not found: converse.avd");
indexfile.seek(who * 2 - 2);
uint16 idx_offset = indexfile.readUint16LE();
@@ -140,10 +135,9 @@ void Visa::speak(byte who, byte subject) {
indexfile.close();
Common::File sezfile;
- if (!sezfile.open("avalot.sez")) {
- warning("AVALANCHE: Visa: File not found: avalot.sez");
- return;
- }
+ if (!sezfile.open("avalot.sez"))
+ error("AVALANCHE: Visa: File not found: avalot.sez");
+
sezfile.seek(sez_offset);
_vm->_gyro->_bufSize = sezfile.readUint16LE();
sezfile.read(_vm->_gyro->_buffer, _vm->_gyro->_bufSize);