diff options
-rw-r--r-- | engines/parallaction/callables_ns.cpp | 20 | ||||
-rw-r--r-- | engines/parallaction/debug.cpp | 16 | ||||
-rw-r--r-- | engines/parallaction/detection.cpp | 18 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 132 | ||||
-rw-r--r-- | engines/parallaction/disk_ns.cpp | 32 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 8 | ||||
-rw-r--r-- | engines/parallaction/graphics.cpp | 122 | ||||
-rw-r--r-- | engines/parallaction/gui_ns.cpp | 76 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 10 | ||||
-rw-r--r-- | engines/parallaction/parallaction_ns.cpp | 12 | ||||
-rw-r--r-- | engines/parallaction/parser_ns.cpp | 110 | ||||
-rw-r--r-- | engines/parallaction/saveload.cpp | 198 | ||||
-rw-r--r-- | engines/parallaction/sound.cpp | 18 |
13 files changed, 386 insertions, 386 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index fac5a23ed1..9ecc8b5b07 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -352,7 +352,7 @@ void Parallaction_ns::_c_endComment(void *param) { } waitUntilLeftClick(); - _gfx->freeBalloons(); + _gfx->freeBalloons(); return; } @@ -393,13 +393,13 @@ void Parallaction_ns::_c_finito(void *parm) { const char **v2C = endMsg6; const char **v1C = endMsg7; - setPartComplete(_char); + setPartComplete(_char); cleanInventory(); _gfx->setPalette(_gfx->_palette); - _gfx->setFont(_menuFont); - _gfx->setFontShadow(true); + _gfx->setFont(_menuFont); + _gfx->setFontShadow(true); if (allPartsComplete()) { _gfx->displayCenteredString(70, v4C[_language]); @@ -440,7 +440,7 @@ void Parallaction_ns::_c_testResult(void *parm) { parseLocation("common"); _gfx->setFont(_menuFont); - _gfx->setFontShadow(true); + _gfx->setFontShadow(true); _gfx->displayCenteredString(38, _slideText[0]); _gfx->displayCenteredString(58, _slideText[1]); @@ -626,11 +626,11 @@ void Parallaction_ns::_c_shade(void *parm) { void Parallaction_ns::_c_projector(void*) { static int dword_16032 = 0; - _gfx->setHalfbriteMode(true); + _gfx->setHalfbriteMode(true); // if (dword_16032 != 0) { // keep drawing spotlight in its final place - _gfx->setProjectorPos(110, 25); + _gfx->setProjectorPos(110, 25); return; // } #ifdef HALFBRITE @@ -654,16 +654,16 @@ void Parallaction_ns::_c_projector(void*) { d6 = d1; } - printf("%i, %i, ", d7+20, d6); + printf("%i, %i, ", d7+20, d6); // BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+20, d6, a3->??, a3->??, 0x20, 0x20); } for (d7 = 50; d7 > -10; d7--) { - printf("%i, %i, ", d7+120, d6); + printf("%i, %i, ", d7+120, d6); // BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20); } - printf("%i, %i\n", d7+120, d6); + printf("%i, %i\n", d7+120, d6); // BltBitMap(&bm, 0, 0, &_screen._bitMap, d7+120, d6, a3->??, a3->??, 0x20, 0x20); #endif dword_16032 = 1; diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp index 960dd31584..ecca67bda2 100644 --- a/engines/parallaction/debug.cpp +++ b/engines/parallaction/debug.cpp @@ -61,14 +61,14 @@ Debugger::Debugger(Parallaction *vm) : GUI::Debugger() { _vm = vm; - DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); - DCmd_Register("location", WRAP_METHOD(Debugger, Cmd_Location)); - DCmd_Register("give", WRAP_METHOD(Debugger, Cmd_Give)); - DCmd_Register("jobs", WRAP_METHOD(Debugger, Cmd_Jobs)); - DCmd_Register("zones", WRAP_METHOD(Debugger, Cmd_Zones)); - DCmd_Register("animations", WRAP_METHOD(Debugger, Cmd_Animations)); - DCmd_Register("localflags", WRAP_METHOD(Debugger, Cmd_LocalFlags)); - DCmd_Register("locations", WRAP_METHOD(Debugger, Cmd_Locations)); + DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); + DCmd_Register("location", WRAP_METHOD(Debugger, Cmd_Location)); + DCmd_Register("give", WRAP_METHOD(Debugger, Cmd_Give)); + DCmd_Register("jobs", WRAP_METHOD(Debugger, Cmd_Jobs)); + DCmd_Register("zones", WRAP_METHOD(Debugger, Cmd_Zones)); + DCmd_Register("animations", WRAP_METHOD(Debugger, Cmd_Animations)); + DCmd_Register("localflags", WRAP_METHOD(Debugger, Cmd_LocalFlags)); + DCmd_Register("locations", WRAP_METHOD(Debugger, Cmd_Locations)); } diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp index ba87b6cee0..b2bf878cbe 100644 --- a/engines/parallaction/detection.cpp +++ b/engines/parallaction/detection.cpp @@ -124,12 +124,12 @@ static const PARALLACTIONGameDescription gameDescriptions[] = { "nippon", "", { - {"disk0", 0, "bfee75d8015f1fb97e75dbe08df4bef7", 354304}, - {"disk1", 0, "f339dd108c1a1f5cd4853d9966e5d01f", 901120}, - {"disk2", 0, "2db40bf8198a57d18e4471a6deaab970", 901120}, - {"disk3", 0, "0486972962b2bfc230e789b9f88f9ec8", 901120}, - {"disk4", 0, "6f625e7f05da4a2f57d6b62d57013614", 901120}, - {"it", 0, "746088eb8de2b2713685d243a4e4678f", 185344}, + { "disk0", 0, "bfee75d8015f1fb97e75dbe08df4bef7", 354304}, + { "disk1", 0, "f339dd108c1a1f5cd4853d9966e5d01f", 901120}, + { "disk2", 0, "2db40bf8198a57d18e4471a6deaab970", 901120}, + { "disk3", 0, "0486972962b2bfc230e789b9f88f9ec8", 901120}, + { "disk4", 0, "6f625e7f05da4a2f57d6b62d57013614", 901120}, + { "it", 0, "746088eb8de2b2713685d243a4e4678f", 185344}, { NULL, 0, NULL, 0} }, Common::IT_ITA, @@ -145,9 +145,9 @@ static const PARALLACTIONGameDescription gameDescriptions[] = { "bra", "Multi-lingual", { - {"tbra.bmp", 0, "3174c095a0e1a4eaf05c403445711e9b", 80972 }, - {"russia.fnt", 0, "57f85ff62aeca6334fdcaf718e313b49", 18344 }, - {NULL, 0, NULL, 0 } + { "tbra.bmp", 0, "3174c095a0e1a4eaf05c403445711e9b", 80972 }, + { "russia.fnt", 0, "57f85ff62aeca6334fdcaf718e313b49", 18344 }, + { NULL, 0, NULL, 0} }, Common::UNK_LANG, Common::kPlatformPC, diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index caecf7b0db..9595ec057d 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -54,8 +54,8 @@ class DialogueManager { Question *_q; - uint16 _visAnswers[5]; - int _numVisAnswers; + uint16 _visAnswers[5]; + int _numVisAnswers; public: DialogueManager(Parallaction *vm, SpeakData *data) : _vm(vm), _data(data) { @@ -89,19 +89,19 @@ uint16 DialogueManager::askPassword() { debugC(3, kDebugExec, "checkDialoguePassword()"); uint16 passwordLen = 0; - _password[0] = '\0'; + _password[0] = '\0'; - _vm->_gfx->setDialogueBalloon(_q->_answers[0]->_text, 1, 3); - int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y); - _vm->_gfx->setItemFrame(id, 0); + _vm->_gfx->setDialogueBalloon(_q->_answers[0]->_text, 1, 3); + int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y); + _vm->_gfx->setItemFrame(id, 0); - Common::Event e; - bool changed = true; // force first refresh + Common::Event e; + bool changed = true; // force first refresh while (true) { - e.kbd.ascii = 0; + e.kbd.ascii = 0; - if (g_system->getEventManager()->pollEvent(e)) { + if (g_system->getEventManager()->pollEvent(e)) { if (e.type == Common::EVENT_QUIT) { // TODO: don't quit() here, just have caller routines to check // on kEngineQuit and exit gracefully to allow the engine to shut down @@ -109,41 +109,41 @@ uint16 DialogueManager::askPassword() { g_system->quit(); } - if ((e.type == Common::EVENT_KEYDOWN) && isdigit(e.kbd.ascii)) { - _password[passwordLen] = e.kbd.ascii; - passwordLen++; - _password[passwordLen] = '\0'; - changed = true; - } - } + if ((e.type == Common::EVENT_KEYDOWN) && isdigit(e.kbd.ascii)) { + _password[passwordLen] = e.kbd.ascii; + passwordLen++; + _password[passwordLen] = '\0'; + changed = true; + } + } - if (changed) { - _vm->_gfx->setBalloonText(0, _q->_answers[0]->_text, 3); - _vm->_gfx->updateScreen(); - changed = false; - } + if (changed) { + _vm->_gfx->setBalloonText(0, _q->_answers[0]->_text, 3); + _vm->_gfx->updateScreen(); + changed = false; + } - if ((passwordLen == MAX_PASSWORD_LENGTH) || (e.kbd.ascii == Common::KEYCODE_RETURN)) { + if ((passwordLen == MAX_PASSWORD_LENGTH) || (e.kbd.ascii == Common::KEYCODE_RETURN)) { - if ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && !scumm_strnicmp(_password, "1732461", 7)) || - (!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && !scumm_strnicmp(_password, "1622", 4)) || - (!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && !scumm_strnicmp(_password, "179", 3))) { + if ((!scumm_stricmp(_vm->_char.getBaseName(), _doughName) && !scumm_strnicmp(_password, "1732461", 7)) || + (!scumm_stricmp(_vm->_char.getBaseName(), _donnaName) && !scumm_strnicmp(_password, "1622", 4)) || + (!scumm_stricmp(_vm->_char.getBaseName(), _dinoName) && !scumm_strnicmp(_password, "179", 3))) { - break; + break; - } else { - passwordLen = 0; - _password[0] = '\0'; - changed = true; - } + } else { + passwordLen = 0; + _password[0] = '\0'; + changed = true; + } } - g_system->delayMillis(20); + g_system->delayMillis(20); } - _vm->_gfx->hideDialogueStuff(); + _vm->_gfx->hideDialogueStuff(); return 0; @@ -153,7 +153,7 @@ uint16 DialogueManager::askPassword() { bool DialogueManager::displayAnswer(uint16 i) { - Answer *a = _q->_answers[i]; + Answer *a = _q->_answers[i]; uint32 flags = _vm->_localFlags[_vm->_currentLocationIndex]; if (a->_yesFlags & kFlagsGlobal) @@ -162,12 +162,12 @@ bool DialogueManager::displayAnswer(uint16 i) { // display suitable answers if (((a->_yesFlags & flags) == a->_yesFlags) && ((a->_noFlags & ~flags) == a->_noFlags)) { - uint id = _vm->_gfx->setDialogueBalloon(a->_text, 1, 3); - assert(id >= 0); - _visAnswers[id] = i; + uint id = _vm->_gfx->setDialogueBalloon(a->_text, 1, 3); + assert(id >= 0); + _visAnswers[id] = i; - _askPassword = strstr(a->_text, "%p"); - _numVisAnswers++; + _askPassword = strstr(a->_text, "%p"); + _numVisAnswers++; return true; } @@ -177,7 +177,7 @@ bool DialogueManager::displayAnswer(uint16 i) { bool DialogueManager::displayAnswers() { - _numVisAnswers = 0; + _numVisAnswers = 0; for (int i = 0; i < NUM_ANSWERS && _q->_answers[i]; i++) { displayAnswer(i); @@ -190,13 +190,13 @@ void DialogueManager::displayQuestion() { if (!scumm_stricmp(_q->_text, "NULL")) return; - _vm->_gfx->setSingleBalloon(_q->_text, QUESTION_BALLOON_X, QUESTION_BALLOON_Y, _q->_mood & 0x10, 0); - int id = _vm->_gfx->setItem(_questioner, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y); - _vm->_gfx->setItemFrame(id, _q->_mood & 0xF); + _vm->_gfx->setSingleBalloon(_q->_text, QUESTION_BALLOON_X, QUESTION_BALLOON_Y, _q->_mood & 0x10, 0); + int id = _vm->_gfx->setItem(_questioner, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y); + _vm->_gfx->setItemFrame(id, _q->_mood & 0xF); - _vm->_gfx->updateScreen(); + _vm->_gfx->updateScreen(); waitUntilLeftClick(); - _vm->_gfx->hideDialogueStuff(); + _vm->_gfx->hideDialogueStuff(); return; } @@ -249,46 +249,46 @@ int16 DialogueManager::selectAnswer() { int16 numAvailableAnswers = _numVisAnswers; - int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y); - _vm->_gfx->setItemFrame(id, _q->_answers[0]->_mood & 0xF); + int id = _vm->_gfx->setItem(_answerer, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y); + _vm->_gfx->setItemFrame(id, _q->_answers[0]->_mood & 0xF); if (numAvailableAnswers == 1) { - _vm->_gfx->setBalloonText(0, _q->_answers[0]->_text, 0); + _vm->_gfx->setBalloonText(0, _q->_answers[0]->_text, 0); waitUntilLeftClick(); - _vm->_gfx->hideDialogueStuff(); + _vm->_gfx->hideDialogueStuff(); return 0; } int oldSelection = -1; int selection; - while (true) { + while (true) { _vm->readInput(); selection = _vm->_gfx->hitTestDialogueBalloon(_vm->_mousePos.x, _vm->_mousePos.y); - if (selection != oldSelection) { - if (oldSelection != -1) { - _vm->_gfx->setBalloonText(oldSelection, _q->_answers[_visAnswers[oldSelection]]->_text, 3); - } + if (selection != oldSelection) { + if (oldSelection != -1) { + _vm->_gfx->setBalloonText(oldSelection, _q->_answers[_visAnswers[oldSelection]]->_text, 3); + } - if (selection != -1) { - _vm->_gfx->setBalloonText(selection, _q->_answers[_visAnswers[selection]]->_text, 0); - _vm->_gfx->setItemFrame(0, _q->_answers[_visAnswers[selection]]->_mood & 0xF); - } - } + if (selection != -1) { + _vm->_gfx->setBalloonText(selection, _q->_answers[_visAnswers[selection]]->_text, 0); + _vm->_gfx->setItemFrame(0, _q->_answers[_visAnswers[selection]]->_mood & 0xF); + } + } - if ((selection != -1) && (_mouseButtons == kMouseLeftUp)) { - break; - } + if ((selection != -1) && (_mouseButtons == kMouseLeftUp)) { + break; + } _vm->_gfx->updateScreen(); g_system->delayMillis(20); - oldSelection = selection; - } + oldSelection = selection; + } - _vm->_gfx->hideDialogueStuff(); + _vm->_gfx->hideDialogueStuff(); return _visAnswers[selection]; } diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp index 3654d0a336..24209c411e 100644 --- a/engines/parallaction/disk_ns.cpp +++ b/engines/parallaction/disk_ns.cpp @@ -48,7 +48,7 @@ namespace Parallaction { // When an archive is opened in Amiga multi-lingual version, the header is // checked again NDOS to detect when a smaller archive is used. // -#define SIZEOF_SMALL_ARCHIVE 12778 +#define SIZEOF_SMALL_ARCHIVE 12778 #define ARCHIVE_FILENAMES_OFS 0x16 @@ -669,23 +669,23 @@ Common::ReadStream* DosDisk_ns::loadSound(const char* name) { * placed in the Public Domain on 2003-09-18 by Stuart Caie. */ -#define PP_READ_BITS(nbits, var) do { \ - bit_cnt = (nbits); (var) = 0; \ - while (bits_left < bit_cnt) { \ - if (buf < src) return 0; \ - bit_buffer |= *--buf << bits_left; \ - bits_left += 8; \ - } \ - bits_left -= bit_cnt; \ - while (bit_cnt--) { \ - (var) = ((var) << 1) | (bit_buffer & 1); \ - bit_buffer >>= 1; \ - } \ +#define PP_READ_BITS(nbits, var) do { \ + bit_cnt = (nbits); (var) = 0; \ + while (bits_left < bit_cnt) { \ + if (buf < src) return 0; \ + bit_buffer |= *--buf << bits_left; \ + bits_left += 8; \ + } \ + bits_left -= bit_cnt; \ + while (bit_cnt--) { \ + (var) = ((var) << 1) | (bit_buffer & 1); \ + bit_buffer >>= 1; \ + } \ } while (0) -#define PP_BYTE_OUT(byte) do { \ - if (out <= dest) return 0; \ - *--out = (byte); written++; \ +#define PP_BYTE_OUT(byte) do { \ + if (out <= dest) return 0; \ + *--out = (byte); written++; \ } while (0) diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index ef9d2243b2..18142f9101 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -487,12 +487,12 @@ void Parallaction::displayComment(ExamineData *data) { return; } - int id; + int id; if (data->_filename) { - if (data->_cnv == 0) { - data->_cnv = _disk->loadStatic(data->_filename); - } + if (data->_cnv == 0) { + data->_cnv = _disk->loadStatic(data->_filename); + } _gfx->setHalfbriteMode(true); _gfx->setSingleBalloon(data->_description, 0, 90, 0, 0); diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp index 2acff90de8..69eca0742a 100644 --- a/engines/parallaction/graphics.cpp +++ b/engines/parallaction/graphics.cpp @@ -35,8 +35,8 @@ namespace Parallaction { int16 Gfx::_dialogueBalloonX[5] = { 80, 120, 150, 150, 150 }; void halfbritePixel(int x, int y, int color, void *data) { - byte *buffer = (byte*)data; - buffer[x + y * _vm->_screenWidth] &= ~0x20; + byte *buffer = (byte*)data; + buffer[x + y * _vm->_screenWidth] &= ~0x20; } void drawCircleLine(int xCenter, int yCenter, int x, int y, int color, void (*plotProc)(int, int, int, void *), void *data){ @@ -311,15 +311,15 @@ void Gfx::setHalfbriteMode(bool enable) { _halfbrite = !_halfbrite; if (!enable) { - _hbCircleRadius = 0; + _hbCircleRadius = 0; } } -#define HALFBRITE_CIRCLE_RADIUS 48 +#define HALFBRITE_CIRCLE_RADIUS 48 void Gfx::setProjectorPos(int x, int y) { - _hbCircleRadius = HALFBRITE_CIRCLE_RADIUS; - _hbCirclePos.x = x + _hbCircleRadius; - _hbCirclePos.y = y + _hbCircleRadius; + _hbCircleRadius = HALFBRITE_CIRCLE_RADIUS; + _hbCirclePos.x = x + _hbCircleRadius; + _hbCirclePos.y = y + _hbCircleRadius; } @@ -363,20 +363,20 @@ void Gfx::drawBalloons() { } void Gfx::updateScreen() { - if (_halfbrite) { - Graphics::Surface *surf = g_system->lockScreen(); - byte *src = (byte*)_buffers[kBitFront]->pixels; - byte *dst = (byte*)surf->pixels; - for (int i = 0; i < surf->w*surf->h; i++) { - *dst++ = *src++ | 0x20; - } - if (_hbCircleRadius > 0) { - drawCircle(_hbCirclePos.x, _hbCirclePos.y, _hbCircleRadius, 0, &halfbritePixel, surf->pixels); - } - g_system->unlockScreen(); - } else { - g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight); - } + if (_halfbrite) { + Graphics::Surface *surf = g_system->lockScreen(); + byte *src = (byte*)_buffers[kBitFront]->pixels; + byte *dst = (byte*)surf->pixels; + for (int i = 0; i < surf->w*surf->h; i++) { + *dst++ = *src++ | 0x20; + } + if (_hbCircleRadius > 0) { + drawCircle(_hbCirclePos.x, _hbCirclePos.y, _hbCircleRadius, 0, &halfbritePixel, surf->pixels); + } + g_system->unlockScreen(); + } else { + g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight); + } drawInventory(); @@ -690,9 +690,9 @@ void Gfx::restoreGetBackground(const Common::Rect& r, byte *data) { void Gfx::displayString(uint16 x, uint16 y, const char *text, byte color) { byte *dst = (byte*)_buffers[kBitFront]->getBasePtr(x, y); if (_fontShadow) { - dst = (byte*)_buffers[kBitFront]->getBasePtr(x-2, y+2); - _font->setColor(0); - _font->drawString(dst, _vm->_screenWidth, text); + dst = (byte*)_buffers[kBitFront]->getBasePtr(x-2, y+2); + _font->setColor(0); + _font->drawString(dst, _vm->_screenWidth, text); } dst = (byte*)_buffers[kBitFront]->getBasePtr(x, y); @@ -811,7 +811,7 @@ void Gfx::setFont(Font *font) { } void Gfx::setFontShadow(bool enable) { - _fontShadow = enable && (_vm->getPlatform() == Common::kPlatformAmiga); + _fontShadow = enable && (_vm->getPlatform() == Common::kPlatformAmiga); } void Gfx::restoreBackground(const Common::Rect& r) { @@ -916,7 +916,7 @@ Gfx::Gfx(Parallaction* vm) : memset(_palettefx, 0, sizeof(_palettefx)); _halfbrite = false; - _hbCircleRadius = 0; + _hbCircleRadius = 0; _font = NULL; _fontShadow = false; @@ -980,7 +980,7 @@ int Gfx::setItem(Frames* frames, uint16 x, uint16 y) { _numItems++; - return id; + return id; } void Gfx::setItemFrame(uint item, uint16 f) { @@ -991,37 +991,37 @@ void Gfx::setItemFrame(uint item, uint16 f) { } Gfx::Balloon* Gfx::getBalloon(uint id) { - assert(id < _numBalloons); - return &_balloons[id]; + assert(id < _numBalloons); + return &_balloons[id]; } int Gfx::createBalloon(int16 w, int16 h, int16 winding, uint16 borderThickness) { assert(_numBalloons < 5); - int id = _numBalloons; + int id = _numBalloons; Gfx::Balloon *balloon = &_balloons[id]; - int16 real_h = (winding == -1) ? h : h + 9; + int16 real_h = (winding == -1) ? h : h + 9; balloon->surface.create(w, real_h, 1); balloon->surface.fillRect(Common::Rect(w, real_h), 2); Common::Rect r(w, h); balloon->surface.fillRect(r, 0); - balloon->outerBox = r; + balloon->outerBox = r; r.grow(-borderThickness); balloon->surface.fillRect(r, 1); - balloon->innerBox = r; - - if (winding != -1) { - // draws tail - // TODO: this bitmap tail should only be used for Dos games. Amiga should use a polygon fill. - winding = (winding == 0 ? 1 : 0); - Common::Rect s(BALLOON_TAIL_WIDTH, BALLOON_TAIL_HEIGHT); - s.moveTo(r.width()/2 - 5, r.bottom - 1); - flatBlit(s, _resBalloonTail[winding], &balloon->surface, 2); - } + balloon->innerBox = r; + + if (winding != -1) { + // draws tail + // TODO: this bitmap tail should only be used for Dos games. Amiga should use a polygon fill. + winding = (winding == 0 ? 1 : 0); + Common::Rect s(BALLOON_TAIL_WIDTH, BALLOON_TAIL_HEIGHT); + s.moveTo(r.width()/2 - 5, r.bottom - 1); + flatBlit(s, _resBalloonTail[winding], &balloon->surface, 2); + } _numBalloons++; @@ -1030,7 +1030,7 @@ int Gfx::createBalloon(int16 w, int16 h, int16 winding, uint16 borderThickness) int Gfx::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte textColor) { - int16 w, h; + int16 w, h; setFont(_vm->_dialogueFont); getStringExtent(text, MAX_BALLOON_WIDTH, &w, &h); @@ -1043,12 +1043,12 @@ int Gfx::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte t balloon->x = x; balloon->y = y; - return id; + return id; } int Gfx::setDialogueBalloon(char *text, uint16 winding, byte textColor) { - int16 w, h; + int16 w, h; setFont(_vm->_dialogueFont); getStringExtent(text, MAX_BALLOON_WIDTH, &w, &h); @@ -1058,15 +1058,15 @@ int Gfx::setDialogueBalloon(char *text, uint16 winding, byte textColor) { drawWrappedText(&balloon->surface, text, textColor, MAX_BALLOON_WIDTH); - balloon->x = _dialogueBalloonX[id]; - balloon->y = 10; + balloon->x = _dialogueBalloonX[id]; + balloon->y = 10; - if (id > 0) { - balloon->y += _balloons[id - 1].y + _balloons[id - 1].outerBox.height(); - } + if (id > 0) { + balloon->y += _balloons[id - 1].y + _balloons[id - 1].outerBox.height(); + } - return id; + return id; } void Gfx::setBalloonText(uint id, char *text, byte textColor) { @@ -1078,10 +1078,10 @@ void Gfx::setBalloonText(uint id, char *text, byte textColor) { int Gfx::setLocationBalloon(char *text, bool endGame) { - int16 w, h; + int16 w, h; setFont(_vm->_dialogueFont); - getStringExtent(text, MAX_BALLOON_WIDTH, &w, &h); + getStringExtent(text, MAX_BALLOON_WIDTH, &w, &h); int id = createBalloon(w+(endGame ? 5 : 10), h+5, -1, 2); Gfx::Balloon *balloon = &_balloons[id]; @@ -1095,17 +1095,17 @@ int Gfx::setLocationBalloon(char *text, bool endGame) { int Gfx::hitTestDialogueBalloon(int x, int y) { - Common::Point p; + Common::Point p; - for (uint i = 0; i < _numBalloons; i++) { - p.x = x - _balloons[i].x; - p.y = y - _balloons[i].y; + for (uint i = 0; i < _numBalloons; i++) { + p.x = x - _balloons[i].x; + p.y = y - _balloons[i].y; - if (_balloons[i].innerBox.contains(p)) - return i; - } + if (_balloons[i].innerBox.contains(p)) + return i; + } - return -1; + return -1; } diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp index aa45693886..9f8cfff012 100644 --- a/engines/parallaction/gui_ns.cpp +++ b/engines/parallaction/gui_ns.cpp @@ -87,9 +87,9 @@ const char *loadGameMsg[] = { #define PASSWORD_LEN 6 -#define CHAR_DINO 0 -#define CHAR_DONNA 1 -#define CHAR_DOUGH 2 +#define CHAR_DINO 0 +#define CHAR_DONNA 1 +#define CHAR_DOUGH 2 static const uint16 _amigaKeys[][PASSWORD_LEN] = { { 5, 3, 6, 2, 2, 7 }, // dino @@ -192,8 +192,8 @@ int Parallaction_ns::guiNewGame() { const char **v14 = introMsg3; - _gfx->setFont(_menuFont); - _gfx->setFontShadow(true); + _gfx->setFont(_menuFont); + _gfx->setFontShadow(true); _disk->selectArchive("disk1"); @@ -387,16 +387,16 @@ int Parallaction_ns::guiSelectCharacter() { const uint16 (*keys)[PASSWORD_LEN] = (getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_LANG_MULT)) ? _amigaKeys : _pcKeys; uint16 _di = 0; - byte points[3] = { 0, 0, 0 }; + byte points[3] = { 0, 0, 0 }; - bool fail; + bool fail; while (true) { - points[0] = 0; - points[1] = 0; - points[2] = 0; - fail = false; + points[0] = 0; + points[1] = 0; + points[2] = 0; + fail = false; _gfx->displayString(60, 30, introMsg1[_language], 1); // displays message @@ -410,31 +410,31 @@ int Parallaction_ns::guiSelectCharacter() { _gfx->grabRect((byte*)v14.pixels, codeTrueBlocks[_si], Gfx::kBitFront, BLOCK_WIDTH); _gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitFront); - if (keys[0][_di] == _si) { - points[0]++; - } else - if (keys[1][_di] == _si) { - points[1]++; - } else - if (keys[2][_di] == _si) { - points[2]++; - } else { - fail = true; - } - - // build user preference - points[0] += (keys[0][_di] == _si); - points[1] += (keys[1][_di] == _si); - points[2] += (keys[2][_di] == _si); - - _di++; + if (keys[0][_di] == _si) { + points[0]++; + } else + if (keys[1][_di] == _si) { + points[1]++; + } else + if (keys[2][_di] == _si) { + points[2]++; + } else { + fail = true; + } + + // build user preference + points[0] += (keys[0][_di] == _si); + points[1] += (keys[1][_di] == _si); + points[2] += (keys[2][_di] == _si); + + _di++; } } - if (!fail) { - break; - } + if (!fail) { + break; + } _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); _gfx->displayString(60, 30, introMsg2[_language], 1); @@ -451,22 +451,22 @@ int Parallaction_ns::guiSelectCharacter() { v14.free(); - // actually select character + // actually select character int character = -1; if (points[0] >= points[1] && points[0] >= points[2]) { - character = CHAR_DINO; + character = CHAR_DINO; } else if (points[1] >= points[0] && points[1] >= points[2]) { - character = CHAR_DONNA; + character = CHAR_DONNA; } else if (points[2] >= points[0] && points[2] >= points[1]) { - character = CHAR_DOUGH; + character = CHAR_DOUGH; } else { - error("If you read this, either your CPU or transivity is broken (we believe the former)."); + error("If you read this, either your CPU or transivity is broken (we believe the former)."); } - return character; + return character; } diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 45a1d1631b..59d81f1f93 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -841,7 +841,7 @@ void Parallaction::setBackground(const char* name, const char* mask, const char* } void Parallaction::showLocationComment(const char *text, bool end) { - _gfx->setLocationBalloon(const_cast<char*>(text), end); + _gfx->setLocationBalloon(const_cast<char*>(text), end); } @@ -862,10 +862,10 @@ void Parallaction::doLocationEnterTransition() { return; } - if (_localFlags[_currentLocationIndex] & kFlagsVisited) { - debugC(2, kDebugExec, "skipping location transition"); - return; // visited - } + if (_localFlags[_currentLocationIndex] & kFlagsVisited) { + debugC(2, kDebugExec, "skipping location transition"); + return; // visited + } Palette pal(_gfx->_palette); pal.makeGrayscale(); diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index d65030f355..aa68866711 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -160,7 +160,7 @@ void Parallaction_ns::freeFonts() { delete _dialogueFont; delete _labelFont; delete _menuFont; - delete _introFont; + delete _introFont; } @@ -248,7 +248,7 @@ void Parallaction_ns::callFunction(uint index, void* parm) { int Parallaction_ns::go() { - renameOldSavefiles(); + renameOldSavefiles(); _globalTable = _disk->loadTable("global"); @@ -372,8 +372,8 @@ void Parallaction_ns::changeLocation(char *location) { _gfx->setBlackPalette(); _gfx->updateScreen(); - // BUG #1837503: kEngineChangeLocation flag must be cleared *before* commands - // and acommands are executed, so that it can be set again if needed. + // BUG #1837503: kEngineChangeLocation flag must be cleared *before* commands + // and acommands are executed, so that it can be set again if needed. _engineFlags &= ~kEngineChangeLocation; runCommands(_location._commands); @@ -412,9 +412,9 @@ void Parallaction_ns::changeCharacter(const char *name) { if (!_char.dummy()) { if (getPlatform() == Common::kPlatformAmiga) { _disk->selectArchive("disk0"); - } else { + } else { _disk->selectArchive("disk1"); - } + } _char._head = _disk->loadHead(_char.getBaseName()); _char._talk = _disk->loadTalk(_char.getBaseName()); diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 8fb01a089f..e6950299c1 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -689,14 +689,14 @@ Dialogue *Parallaction_ns::parseDialogue(Script &script) { while (scumm_stricmp(_tokens[0], "enddialogue")) { if (scumm_stricmp(_tokens[0], "Question")) continue; - forwards.addData(_tokens[1]); + forwards.addData(_tokens[1]); - dialogue->_questions[numQuestions++] = parseQuestion(script); + dialogue->_questions[numQuestions++] = parseQuestion(script); script.readLineToken(true); } - resolveDialogueForwards(dialogue, numQuestions, forwards); + resolveDialogueForwards(dialogue, numQuestions, forwards); debugC(7, kDebugParser, "parseDialogue() done"); @@ -705,80 +705,80 @@ Dialogue *Parallaction_ns::parseDialogue(Script &script) { Question *Parallaction_ns::parseQuestion(Script &script) { - Question *question = new Question; - assert(question); + Question *question = new Question; + assert(question); - question->_text = parseDialogueString(script); + question->_text = parseDialogueString(script); - script.readLineToken(true); - question->_mood = atoi(_tokens[0]); + script.readLineToken(true); + question->_mood = atoi(_tokens[0]); - uint16 numAnswers = 0; + uint16 numAnswers = 0; - script.readLineToken(true); - while (scumm_stricmp(_tokens[0], "endquestion")) { // parse answers - question->_answers[numAnswers] = parseAnswer(script); - numAnswers++; - } + script.readLineToken(true); + while (scumm_stricmp(_tokens[0], "endquestion")) { // parse answers + question->_answers[numAnswers] = parseAnswer(script); + numAnswers++; + } - return question; + return question; } Answer *Parallaction_ns::parseAnswer(Script &script) { - Answer *answer = new Answer; - assert(answer); + Answer *answer = new Answer; + assert(answer); - if (_tokens[1][0]) { + if (_tokens[1][0]) { - Table* flagNames; - uint16 token; + Table* flagNames; + uint16 token; - if (!scumm_stricmp(_tokens[1], "global")) { - token = 2; - flagNames = _globalTable; - answer->_yesFlags |= kFlagsGlobal; - } else { - token = 1; - flagNames = _localFlagNames; - } + if (!scumm_stricmp(_tokens[1], "global")) { + token = 2; + flagNames = _globalTable; + answer->_yesFlags |= kFlagsGlobal; + } else { + token = 1; + flagNames = _localFlagNames; + } - do { + do { - if (!scumm_strnicmp(_tokens[token], "no", 2)) { - byte _al = flagNames->lookup(_tokens[token]+2); - answer->_noFlags |= 1 << (_al - 1); - } else { - byte _al = flagNames->lookup(_tokens[token]); - answer->_yesFlags |= 1 << (_al - 1); - } + if (!scumm_strnicmp(_tokens[token], "no", 2)) { + byte _al = flagNames->lookup(_tokens[token]+2); + answer->_noFlags |= 1 << (_al - 1); + } else { + byte _al = flagNames->lookup(_tokens[token]); + answer->_yesFlags |= 1 << (_al - 1); + } - token++; + token++; - } while (!scumm_stricmp(_tokens[token++], "|")); + } while (!scumm_stricmp(_tokens[token++], "|")); - } + } - answer->_text = parseDialogueString(script); + answer->_text = parseDialogueString(script); - script.readLineToken(true); - answer->_mood = atoi(_tokens[0]); - answer->_following._name = parseDialogueString(script); + script.readLineToken(true); + answer->_mood = atoi(_tokens[0]); + answer->_following._name = parseDialogueString(script); - script.readLineToken(true); - if (!scumm_stricmp(_tokens[0], "commands")) { + script.readLineToken(true); + if (!scumm_stricmp(_tokens[0], "commands")) { - parseCommands(script, answer->_commands); - _locParseCtxt.endcommands = false; - do { - script.readLineToken(true); - parseStatement(); - } while (!_locParseCtxt.endcommands); + parseCommands(script, answer->_commands); + _locParseCtxt.endcommands = false; + do { + script.readLineToken(true); + parseStatement(); + } while (!_locParseCtxt.endcommands); - script.readLineToken(true); - } + script.readLineToken(true); + } - return answer; + return answer; } void Parallaction_ns::resolveDialogueForwards(Dialogue *dialogue, uint numQuestions, Table &forwards) { @@ -964,7 +964,7 @@ DECLARE_LOCATION_PARSER(music) { void Parallaction_ns::parseLocation(const char *filename) { - debugC(1, kDebugParser, "parseLocation('%s')", filename); + debugC(1, kDebugParser, "parseLocation('%s')", filename); allocateLocationSlot(filename); // printf("got location slot #%i for %s\n", _currentLocationIndex, filename); diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index 9435f341f0..7c27b9b633 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -39,8 +39,8 @@ * A special savefile named 'nippon.999' holds information on whether the user completed one or more parts of the game. */ -#define NUM_SAVESLOTS 100 -#define SPECIAL_SAVESLOT 999 +#define NUM_SAVESLOTS 100 +#define SPECIAL_SAVESLOT 999 namespace Parallaction { @@ -74,22 +74,22 @@ public: }; Common::String Parallaction_ns::genSaveFileName(uint slot, bool oldStyle) { - assert(slot < NUM_SAVESLOTS || slot == SPECIAL_SAVESLOT); + assert(slot < NUM_SAVESLOTS || slot == SPECIAL_SAVESLOT); - char s[20]; - sprintf(s, (oldStyle ? "game.%i" : "nippon.%.3d"), slot ); + char s[20]; + sprintf(s, (oldStyle ? "game.%i" : "nippon.%.3d"), slot ); - return Common::String(s); + return Common::String(s); } Common::InSaveFile *Parallaction_ns::getInSaveFile(uint slot) { - Common::String name = genSaveFileName(slot); - return _saveFileMan->openForLoading(name.c_str()); + Common::String name = genSaveFileName(slot); + return _saveFileMan->openForLoading(name.c_str()); } Common::OutSaveFile *Parallaction_ns::getOutSaveFile(uint slot) { - Common::String name = genSaveFileName(slot); - return _saveFileMan->openForSaving(name.c_str()); + Common::String name = genSaveFileName(slot); + return _saveFileMan->openForSaving(name.c_str()); } @@ -102,7 +102,7 @@ void Parallaction_ns::doLoadGame(uint16 slot) { _introSarcData3 = 200; _introSarcData2 = 1; - Common::InSaveFile *f = getInSaveFile(slot); + Common::InSaveFile *f = getInSaveFile(slot); if (!f) return; char s[200]; @@ -344,7 +344,7 @@ int Parallaction_ns::buildSaveFileList(Common::StringList& l) { for (int i = 0; i < NUM_SAVESLOTS; i++) { buf[0] = '\0'; - Common::InSaveFile *f = getInSaveFile(i); + Common::InSaveFile *f = getInSaveFile(i); if (f) { f->readLine(buf, 199); delete f; @@ -419,102 +419,102 @@ bool Parallaction_ns::saveGame() { void Parallaction_ns::setPartComplete(const Character& character) { - char buf[30]; - bool alreadyPresent = false; - - memset(buf, 0, sizeof(buf)); - - Common::InSaveFile *inFile = getInSaveFile(SPECIAL_SAVESLOT); - if (inFile) { - inFile->readLine(buf, 29); - delete inFile; - - if (strstr(buf, character.getBaseName())) { - alreadyPresent = true; - } - } - - if (!alreadyPresent) { - Common::OutSaveFile *outFile = getOutSaveFile(SPECIAL_SAVESLOT); - outFile->writeString(buf); - outFile->writeString(character.getBaseName()); - outFile->finalize(); - delete outFile; - } - - return; + char buf[30]; + bool alreadyPresent = false; + + memset(buf, 0, sizeof(buf)); + + Common::InSaveFile *inFile = getInSaveFile(SPECIAL_SAVESLOT); + if (inFile) { + inFile->readLine(buf, 29); + delete inFile; + + if (strstr(buf, character.getBaseName())) { + alreadyPresent = true; + } + } + + if (!alreadyPresent) { + Common::OutSaveFile *outFile = getOutSaveFile(SPECIAL_SAVESLOT); + outFile->writeString(buf); + outFile->writeString(character.getBaseName()); + outFile->finalize(); + delete outFile; + } + + return; } bool Parallaction_ns::allPartsComplete() { - char buf[30]; + char buf[30]; - Common::InSaveFile *inFile = getInSaveFile(SPECIAL_SAVESLOT); - inFile->readLine(buf, 29); - delete inFile; + Common::InSaveFile *inFile = getInSaveFile(SPECIAL_SAVESLOT); + inFile->readLine(buf, 29); + delete inFile; - return strstr(buf, "dino") && strstr(buf, "donna") && strstr(buf, "dough"); + return strstr(buf, "dino") && strstr(buf, "donna") && strstr(buf, "dough"); } void Parallaction_ns::renameOldSavefiles() { - bool exists[NUM_SAVESLOTS]; - uint num = 0; - uint i; - - for (i = 0; i < NUM_SAVESLOTS; i++) { - exists[i] = false; - Common::String name = genSaveFileName(i, true); - Common::InSaveFile *f = _saveFileMan->openForLoading(name.c_str()); - if (f) { - exists[i] = true; - num++; - } - delete f; - } - - if (num == 0) { - // there are no old savefiles: nothing to do - return; - } - - GUI::MessageDialog dialog0( - "ScummVM found that you have old savefiles for Nippon Safes that should be renamed.\n" - "The old names are no longer supported, so you will not be able to load your games if you don't convert them.\n\n" - "Press OK to convert them now, otherwise you will be asked you next time.\n", "OK", "Cancel"); - - int choice = dialog0.runModal(); - if (choice == 0) { - // user pressed cancel - return; - } - - uint success = 0; - for (i = 0; i < NUM_SAVESLOTS; i++) { - if (exists[i]) { - Common::String oldName = genSaveFileName(i, true); - Common::String newName = genSaveFileName(i, false); - if (_saveFileMan->renameSavefile(oldName.c_str(), newName.c_str())) { - success++; - } else { - warning("Error %i (%s) occurred while renaming %s to %s", _saveFileMan->getError(), - _saveFileMan->getErrorDesc().c_str(), oldName.c_str(), newName.c_str()); - } - } - } - - char msg[200]; - if (success == num) { - sprintf(msg, "ScummVM successfully converted all your savefiles."); - } else { - sprintf(msg, - "ScummVM printed some warnings in your console window and can't guarantee all your files have been converted.\n\n" - "Please report to the team."); - } - - GUI::MessageDialog dialog1(msg); - dialog1.runModal(); - - return; + bool exists[NUM_SAVESLOTS]; + uint num = 0; + uint i; + + for (i = 0; i < NUM_SAVESLOTS; i++) { + exists[i] = false; + Common::String name = genSaveFileName(i, true); + Common::InSaveFile *f = _saveFileMan->openForLoading(name.c_str()); + if (f) { + exists[i] = true; + num++; + } + delete f; + } + + if (num == 0) { + // there are no old savefiles: nothing to do + return; + } + + GUI::MessageDialog dialog0( + "ScummVM found that you have old savefiles for Nippon Safes that should be renamed.\n" + "The old names are no longer supported, so you will not be able to load your games if you don't convert them.\n\n" + "Press OK to convert them now, otherwise you will be asked you next time.\n", "OK", "Cancel"); + + int choice = dialog0.runModal(); + if (choice == 0) { + // user pressed cancel + return; + } + + uint success = 0; + for (i = 0; i < NUM_SAVESLOTS; i++) { + if (exists[i]) { + Common::String oldName = genSaveFileName(i, true); + Common::String newName = genSaveFileName(i, false); + if (_saveFileMan->renameSavefile(oldName.c_str(), newName.c_str())) { + success++; + } else { + warning("Error %i (%s) occurred while renaming %s to %s", _saveFileMan->getError(), + _saveFileMan->getErrorDesc().c_str(), oldName.c_str(), newName.c_str()); + } + } + } + + char msg[200]; + if (success == num) { + sprintf(msg, "ScummVM successfully converted all your savefiles."); + } else { + sprintf(msg, + "ScummVM printed some warnings in your console window and can't guarantee all your files have been converted.\n\n" + "Please report to the team."); + } + + GUI::MessageDialog dialog1(msg); + dialog1.runModal(); + + return; } diff --git a/engines/parallaction/sound.cpp b/engines/parallaction/sound.cpp index c6c108c111..dd74e8f7aa 100644 --- a/engines/parallaction/sound.cpp +++ b/engines/parallaction/sound.cpp @@ -305,9 +305,9 @@ void DosSoundMan::playLocationMusic(const char *location) { AmigaSoundMan::AmigaSoundMan(Parallaction *vm) : SoundMan(vm) { _musicStream = 0; _channels[0].data = 0; - _channels[1].data = 0; - _channels[2].data = 0; - _channels[3].data = 0; + _channels[1].data = 0; + _channels[2].data = 0; + _channels[3].data = 0; } AmigaSoundMan::~AmigaSoundMan() { @@ -392,12 +392,12 @@ void AmigaSoundMan::stopSfx(uint channel) { return; } - if (_channels[channel].dispose) { - debugC(1, kDebugAudio, "AmigaSoundMan::stopSfx(%i)", channel); - _mixer->stopHandle(_channels[channel].handle); - free(_channels[channel].data); - _channels[channel].data = 0; - } + if (_channels[channel].dispose) { + debugC(1, kDebugAudio, "AmigaSoundMan::stopSfx(%i)", channel); + _mixer->stopHandle(_channels[channel].handle); + free(_channels[channel].data); + _channels[channel].data = 0; + } } void AmigaSoundMan::playMusic() { |