diff options
author | Nicola Mettifogo | 2007-04-07 16:40:27 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2007-04-07 16:40:27 +0000 |
commit | 5a8b8ca92dc95ced8df2a7f6a46412c04ebfe757 (patch) | |
tree | 4ff4467f10558869c1e525737980c3d19a9c942a /engines/parallaction | |
parent | 2f6f857eaf25dd78ac860d9c490041f4968884c2 (diff) | |
download | scummvm-rg350-5a8b8ca92dc95ced8df2a7f6a46412c04ebfe757.tar.gz scummvm-rg350-5a8b8ca92dc95ced8df2a7f6a46412c04ebfe757.tar.bz2 scummvm-rg350-5a8b8ca92dc95ced8df2a7f6a46412c04ebfe757.zip |
cleanup
svn-id: r26409
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/animation.cpp | 9 | ||||
-rw-r--r-- | engines/parallaction/commands.cpp | 22 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 88 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 16 | ||||
-rw-r--r-- | engines/parallaction/inventory.cpp | 16 | ||||
-rw-r--r-- | engines/parallaction/location.cpp | 97 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 2 | ||||
-rw-r--r-- | engines/parallaction/parallaction.h | 256 | ||||
-rw-r--r-- | engines/parallaction/saveload.cpp | 36 | ||||
-rw-r--r-- | engines/parallaction/zone.cpp | 52 |
10 files changed, 288 insertions, 306 deletions
diff --git a/engines/parallaction/animation.cpp b/engines/parallaction/animation.cpp index 5ef51d170c..f59dcbdd3d 100644 --- a/engines/parallaction/animation.cpp +++ b/engines/parallaction/animation.cpp @@ -56,7 +56,6 @@ namespace Parallaction { void wrapLocalVar(LocalVariable *local); -LValue getLValue(Instruction *inst, char *str, LocalVariable *locals, Animation *a); uint16 _numLocals = 0; @@ -108,7 +107,7 @@ Animation *Parallaction::parseAnimation(Script& script, Node *list, char *name) } } if (!scumm_stricmp(_tokens[0], "label")) { - _vm->_gfx->makeCnvFromString(&vD0->_label._cnv, _tokens[1]); + _gfx->makeCnvFromString(&vD0->_label._cnv, _tokens[1]); } if (!scumm_stricmp(_tokens[0], "flags")) { uint16 _si = 1; @@ -414,7 +413,7 @@ void Parallaction::parseScriptLine(Instruction *inst, Animation *a, LocalVariabl return; } -LValue getLValue(Instruction *inst, char *str, LocalVariable *locals, Animation *a) { +LValue Parallaction::getLValue(Instruction *inst, char *str, LocalVariable *locals, Animation *a) { LValue v; @@ -434,7 +433,7 @@ LValue getLValue(Instruction *inst, char *str, LocalVariable *locals, Animation } if (str[1] == '.') { - a = _vm->findAnimation(&str[2]); + a = findAnimation(&str[2]); } if (str[0] == 'X') { @@ -634,7 +633,7 @@ void Parallaction::sortAnimations() { Node v14; memset(&v14, 0, sizeof(Node)); - _vm->_char._ani._z = _vm->_char._ani.height() + _vm->_char._ani._top; + _char._ani._z = _char._ani.height() + _char._ani._top; Animation *vC = (Animation*)_animations._next; Node *v8; diff --git a/engines/parallaction/commands.cpp b/engines/parallaction/commands.cpp index a9918133b5..50fbeb20da 100644 --- a/engines/parallaction/commands.cpp +++ b/engines/parallaction/commands.cpp @@ -85,7 +85,7 @@ void Parallaction::parseCommands(Script &script, CommandList& list) { case CMD_START: // start case CMD_STOP: // stop - cmd->u._animation = _vm->findAnimation(_tokens[_si]); + cmd->u._animation = findAnimation(_tokens[_si]); _si++; if (cmd->u._animation == NULL) { strcpy(_forwardedAnimationNames[_numForwards], _tokens[_si-1]); @@ -100,7 +100,7 @@ void Parallaction::parseCommands(Script &script, CommandList& list) { case CMD_CLOSE: // close case CMD_ON: // on case CMD_OFF: // off - cmd->u._zone = _vm->findZone(_tokens[_si]); + cmd->u._zone = findZone(_tokens[_si]); _si++; break; @@ -213,7 +213,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { Command *cmd = *it; CommandData *u = &cmd->u; - uint32 v8 = _localFlags[_vm->_currentLocationIndex]; + uint32 v8 = _localFlags[_currentLocationIndex]; if (_engineFlags & kEngineQuit) break; @@ -234,7 +234,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { cmd->u._flags &= ~kFlagsGlobal; _commandFlags |= cmd->u._flags; } else { - _localFlags[_vm->_currentLocationIndex] |= cmd->u._flags; + _localFlags[_currentLocationIndex] |= cmd->u._flags; } break; @@ -243,7 +243,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { cmd->u._flags &= ~kFlagsGlobal; _commandFlags &= ~cmd->u._flags; } else { - _localFlags[_vm->_currentLocationIndex] &= ~cmd->u._flags; + _localFlags[_currentLocationIndex] &= ~cmd->u._flags; } break; @@ -252,7 +252,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { cmd->u._flags &= ~kFlagsGlobal; _commandFlags ^= cmd->u._flags; } else { - _localFlags[_vm->_currentLocationIndex] ^= cmd->u._flags; + _localFlags[_currentLocationIndex] ^= cmd->u._flags; } break; @@ -282,7 +282,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { case CMD_OPEN: // open u->_zone->_flags &= ~kFlagsClosed; if (u->_zone->u.door->_cnv) { - _vm->addJob(&jobToggleDoor, (void*)u->_zone, kPriority18 ); + addJob(&jobToggleDoor, (void*)u->_zone, kPriority18 ); } break; @@ -301,7 +301,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { u->_zone->_flags &= ~kFlagsRemove; u->_zone->_flags |= kFlagsActive; if ((u->_zone->_type & 0xFFFF) == kZoneGet) { - _vm->addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 ); + addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 ); } } break; @@ -311,7 +311,7 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { break; case CMD_LOCATION: // location - strcpy(_vm->_location._name, u->_string); + strcpy(_location._name, u->_string); _engineFlags |= kEngineChangeLocation; break; @@ -324,13 +324,13 @@ void Parallaction::runCommands(CommandList& list, Zone *z) { break; case CMD_MOVE: { // move - if ((_vm->_char._ani._flags & kFlagsRemove) || (_vm->_char._ani._flags & kFlagsActive) == 0) { + if ((_char._ani._flags & kFlagsRemove) || (_char._ani._flags & kFlagsActive) == 0) { continue; } WalkNode *vC = buildWalkPath(u->_move._x, u->_move._y); - _vm->addJob(&jobWalk, vC, kPriority19 ); + addJob(&jobWalk, vC, kPriority19 ); _engineFlags |= kEngineWalking; } break; diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index bc1ab90b23..e6526db9f0 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -193,7 +193,7 @@ char *Parallaction::parseDialogueString(Script &script) { return vCC; } -uint16 askDialoguePassword(Dialogue *q, StaticCnv *face) { +uint16 Parallaction::askDialoguePassword(Dialogue *q, StaticCnv *face) { debugC(1, kDebugDialogue, "checkDialoguePassword()"); char password[100]; @@ -201,15 +201,15 @@ uint16 askDialoguePassword(Dialogue *q, StaticCnv *face) { while (true) { strcpy(password, "......."); - _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); + _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); Common::Rect r(_answerBalloonW[0], _answerBalloonH[0]); r.moveTo(_answerBalloonX[0], _answerBalloonY[0]); - _vm->_gfx->drawBalloon(r, 1); - _vm->_gfx->displayWrappedString(q->_answers[0]->_text, _answerBalloonX[0], _answerBalloonY[0], MAX_BALLOON_WIDTH, 3); - _vm->_gfx->flatBlitCnv(face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); - _vm->_gfx->displayBalloonString(_answerBalloonX[0] + 5, _answerBalloonY[0] + _answerBalloonH[0] - 15, "> ", 0); + _gfx->drawBalloon(r, 1); + _gfx->displayWrappedString(q->_answers[0]->_text, _answerBalloonX[0], _answerBalloonY[0], MAX_BALLOON_WIDTH, 3); + _gfx->flatBlitCnv(face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); + _gfx->displayBalloonString(_answerBalloonX[0] + 5, _answerBalloonY[0] + _answerBalloonH[0] - 15, "> ", 0); Common::Event e; while (e.kbd.ascii != 0xD && passwordLen < MAX_PASSWORD_LENGTH) { @@ -224,14 +224,14 @@ uint16 askDialoguePassword(Dialogue *q, StaticCnv *face) { passwordLen++; password[passwordLen] = '\0'; - _vm->_gfx->displayBalloonString(_answerBalloonX[0] + 5, _answerBalloonY[0] + _answerBalloonH[0] - 15, password, 0); + _gfx->displayBalloonString(_answerBalloonX[0] + 5, _answerBalloonY[0] + _answerBalloonH[0] - 15, password, 0); g_system->delayMillis(20); } - if ((!scumm_stricmp(_vm->_characterName, _doughName) && !scumm_strnicmp(password, "1732461", 7)) || - (!scumm_stricmp(_vm->_characterName, _donnaName) && !scumm_strnicmp(password, "1622", 4)) || - (!scumm_stricmp(_vm->_characterName, _dinoName) && !scumm_strnicmp(password, "179", 3))) { + if ((!scumm_stricmp(_characterName, _doughName) && !scumm_strnicmp(password, "1732461", 7)) || + (!scumm_stricmp(_characterName, _donnaName) && !scumm_strnicmp(password, "1622", 4)) || + (!scumm_stricmp(_characterName, _dinoName) && !scumm_strnicmp(password, "179", 3))) { break; @@ -245,24 +245,24 @@ uint16 askDialoguePassword(Dialogue *q, StaticCnv *face) { bool _askPassword; -bool displayAnswer(Dialogue *q, uint16 i) { +bool Parallaction::displayAnswer(Dialogue *q, uint16 i) { - uint32 v28 = _localFlags[_vm->_currentLocationIndex]; + uint32 v28 = _localFlags[_currentLocationIndex]; if (q->_answers[i]->_yesFlags & kFlagsGlobal) v28 = _commandFlags | kFlagsGlobal; // display suitable answers if (((q->_answers[i]->_yesFlags & v28) == q->_answers[i]->_yesFlags) && ((q->_answers[i]->_noFlags & ~v28) == q->_answers[i]->_noFlags)) { - _vm->_gfx->getStringExtent(q->_answers[i]->_text, MAX_BALLOON_WIDTH, &_answerBalloonW[i], &_answerBalloonH[i]); + _gfx->getStringExtent(q->_answers[i]->_text, MAX_BALLOON_WIDTH, &_answerBalloonW[i], &_answerBalloonH[i]); Common::Rect r(_answerBalloonW[i], _answerBalloonH[i]); r.moveTo(_answerBalloonX[i], _answerBalloonY[i]); - _vm->_gfx->drawBalloon(r, 1); + _gfx->drawBalloon(r, 1); _answerBalloonY[i+1] = 10 + _answerBalloonY[i] + _answerBalloonH[i]; - _askPassword = _vm->_gfx->displayWrappedString(q->_answers[i]->_text, _answerBalloonX[i], _answerBalloonY[i], MAX_BALLOON_WIDTH, 3); + _askPassword = _gfx->displayWrappedString(q->_answers[i]->_text, _answerBalloonX[i], _answerBalloonY[i], MAX_BALLOON_WIDTH, 3); return true; } @@ -271,7 +271,7 @@ bool displayAnswer(Dialogue *q, uint16 i) { } -bool displayAnswers(Dialogue *q) { +bool Parallaction::displayAnswers(Dialogue *q) { bool displayed = false; @@ -290,7 +290,7 @@ bool displayAnswers(Dialogue *q) { return displayed; } -void displayQuestion(Dialogue *q, Cnv *cnv) { +void Parallaction::displayQuestion(Dialogue *q, Cnv *cnv) { int16 w = 0, h = 0; @@ -302,23 +302,23 @@ void displayQuestion(Dialogue *q, Cnv *cnv) { face._data0 = cnv->getFramePtr(q->_mood & 0xF); face._data1 = NULL; // cnv->field_8[v60->_mood & 0xF]; - _vm->_gfx->flatBlitCnv(&face, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y, Gfx::kBitFront); - _vm->_gfx->getStringExtent(q->_text, MAX_BALLOON_WIDTH, &w, &h); + _gfx->flatBlitCnv(&face, QUESTION_CHARACTER_X, QUESTION_CHARACTER_Y, Gfx::kBitFront); + _gfx->getStringExtent(q->_text, MAX_BALLOON_WIDTH, &w, &h); Common::Rect r(w, h); r.moveTo(QUESTION_BALLOON_X, QUESTION_BALLOON_Y); - _vm->_gfx->drawBalloon(r, q->_mood & 0x10); - _vm->_gfx->displayWrappedString(q->_text, QUESTION_BALLOON_X, QUESTION_BALLOON_Y, MAX_BALLOON_WIDTH, 0); + _gfx->drawBalloon(r, q->_mood & 0x10); + _gfx->displayWrappedString(q->_text, QUESTION_BALLOON_X, QUESTION_BALLOON_Y, MAX_BALLOON_WIDTH, 0); waitUntilLeftClick(); - _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); + _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); return; } -uint16 getDialogueAnswer(Dialogue *q, Cnv *cnv) { +uint16 Parallaction::getDialogueAnswer(Dialogue *q, Cnv *cnv) { uint16 answer = 0; @@ -328,7 +328,7 @@ uint16 getDialogueAnswer(Dialogue *q, Cnv *cnv) { face._data0 = cnv->getFramePtr(0); face._data1 = NULL; // cnv->field_8[0]; - _vm->_gfx->flatBlitCnv(&face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); + _gfx->flatBlitCnv(&face, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); if (_askPassword == false) { answer = selectAnswer(q, &face); @@ -336,7 +336,7 @@ uint16 getDialogueAnswer(Dialogue *q, Cnv *cnv) { answer = askDialoguePassword(q, &face); } - _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); // erase answer screen + _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); // erase answer screen debugC(1, kDebugDialogue, "runDialogue: user selected answer #%i", answer); @@ -348,10 +348,10 @@ void Parallaction::runDialogue(SpeakData *data) { enterDialogue(); - _vm->_gfx->setFont("comic"); + _gfx->setFont("comic"); bool isNpc = scumm_stricmp(data->_name, "yourself") && data->_name[0] != '\0'; - Cnv *face = isNpc ? _vm->_disk->loadTalk(data->_name) : _vm->_char._talk; + Cnv *face = isNpc ? _disk->loadTalk(data->_name) : _char._talk; _askPassword = false; uint16 answer = 0; @@ -368,7 +368,7 @@ void Parallaction::runDialogue(SpeakData *data) { if (scumm_stricmp(q->_answers[0]->_text, "NULL")) { if (!displayAnswers(q)) break; - answer = getDialogueAnswer(q, _vm->_char._talk); + answer = getDialogueAnswer(q, _char._talk); cmdlist = &q->_answers[answer]->_commands; } @@ -377,7 +377,7 @@ void Parallaction::runDialogue(SpeakData *data) { debugC(1, kDebugDialogue, "runDialogue: out of dialogue loop"); - _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); + _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); if (isNpc) { delete face; @@ -391,7 +391,7 @@ void Parallaction::runDialogue(SpeakData *data) { } -int16 selectAnswer(Question *q, StaticCnv *cnv) { +int16 Parallaction::selectAnswer(Question *q, StaticCnv *cnv) { int16 numAvailableAnswers = 0; int16 _si = 0; @@ -407,10 +407,10 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) { _answerBalloonY[i] = 2000; if (numAvailableAnswers == 1) { - _vm->_gfx->displayWrappedString(q->_answers[_di]->_text, _answerBalloonX[_di], _answerBalloonY[_di], MAX_BALLOON_WIDTH, 0); - cnv->_data0 = _vm->_char._talk->getFramePtr(q->_answers[_di]->_mood & 0xF); -// cnv->_data1 = _vm->_char._talk->field_8[q->_answers[_di]->_mood & 0xF]; - _vm->_gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); + _gfx->displayWrappedString(q->_answers[_di]->_text, _answerBalloonX[_di], _answerBalloonY[_di], MAX_BALLOON_WIDTH, 0); + cnv->_data0 = _char._talk->getFramePtr(q->_answers[_di]->_mood & 0xF); +// cnv->_data1 = _char._talk->field_8[q->_answers[_di]->_mood & 0xF]; + _gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); waitUntilLeftClick(); return _di; } @@ -420,17 +420,17 @@ int16 selectAnswer(Question *q, StaticCnv *cnv) { _mouseButtons = kMouseNone; while (_mouseButtons != kMouseLeftUp) { - _vm->updateInput(); - _si = getHoverAnswer(_vm->_mousePos.x, _vm->_mousePos.y, q); + updateInput(); + _si = getHoverAnswer(_mousePos.x, _mousePos.y, q); if (_si != v2) { if (v2 != -1) - _vm->_gfx->displayWrappedString(q->_answers[v2]->_text, _answerBalloonX[v2], _answerBalloonY[v2], MAX_BALLOON_WIDTH, 3); + _gfx->displayWrappedString(q->_answers[v2]->_text, _answerBalloonX[v2], _answerBalloonY[v2], MAX_BALLOON_WIDTH, 3); - _vm->_gfx->displayWrappedString(q->_answers[_si]->_text, _answerBalloonX[_si], _answerBalloonY[_si], MAX_BALLOON_WIDTH, 0); - cnv->_data0 = _vm->_char._talk->getFramePtr(q->_answers[_si]->_mood & 0xF); -// cnv->_data1 = _vm->_char._talk->field_8[q->_answers[_si]->_mood & 0xF]; - _vm->_gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); + _gfx->displayWrappedString(q->_answers[_si]->_text, _answerBalloonX[_si], _answerBalloonY[_si], MAX_BALLOON_WIDTH, 0); + cnv->_data0 = _char._talk->getFramePtr(q->_answers[_si]->_mood & 0xF); +// cnv->_data1 = _char._talk->field_8[q->_answers[_si]->_mood & 0xF]; + _gfx->flatBlitCnv(cnv, ANSWER_CHARACTER_X, ANSWER_CHARACTER_Y, Gfx::kBitFront); } g_system->delayMillis(30); @@ -471,16 +471,16 @@ int16 getHoverAnswer(int16 x, int16 y, Question *q) { } -void enterDialogue() { +void Parallaction::enterDialogue() { return; } // rebuilds inventory // -void exitDialogue() { +void Parallaction::exitDialogue() { - refreshInventory(_vm->_characterName); + refreshInventory(_characterName); return; } diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index ddee2f22df..893946ecc2 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -110,7 +110,7 @@ public: }; -#define NUM_BUFFERS 6 +#define NUM_BUFFERS 4 class Parallaction; @@ -194,37 +194,23 @@ public: public: Common::Point _labelPosition[2]; static bool _proportionalFont; - uint16 _bgLayers[4]; PaletteFxRange _palettefx[6]; Palette _palette; protected: Parallaction* _vm; - static byte * _buffers[NUM_BUFFERS]; - static byte _mouseArrow[256]; StaticCnv *_mouseComposedArrow; - Cnv *_font; - protected: - - // - // maps a character for representation - // byte mapChar(byte c); - void flatBlit(const Common::Rect& r, byte *data, Gfx::Buffers buffer); void blit(const Common::Rect& r, uint16 z, byte *data, Gfx::Buffers buffer); - - void initBuffers(); void initMouse(uint16 arg_0); - - }; diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 9fca713482..ca326c90ce 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -115,7 +115,7 @@ int16 Parallaction::getHoverInventoryItem(int16 x, int16 y) { } -int16 pickupItem(Zone *z) { +int16 Parallaction::pickupItem(Zone *z) { uint16 _si; for (_si = 0; _inventory[_si]._id != 0; _si++) ; @@ -125,17 +125,17 @@ int16 pickupItem(Zone *z) { _inventory[_si]._id = MAKE_INVENTORY_ID(z->u.get->_icon); _inventory[_si]._index = z->u.get->_icon; - _vm->addJob(&jobRemovePickedItem, z, kPriority17 ); + addJob(&jobRemovePickedItem, z, kPriority17 ); if (_inventory[_si]._id == 0) return 0; - refreshInventoryItem(_vm->_characterName, _si); + refreshInventoryItem(_characterName, _si); return 0; } -void addInventoryItem(uint16 item) { +void Parallaction::addInventoryItem(uint16 item) { uint16 _si = 0; while (_inventory[_si]._id != 0) _si++; @@ -143,13 +143,13 @@ void addInventoryItem(uint16 item) { _inventory[_si]._id = MAKE_INVENTORY_ID(item); _inventory[_si]._index = item; - refreshInventoryItem(_vm->_characterName, _si); + refreshInventoryItem(_characterName, _si); return; } -void dropItem(uint16 v) { +void Parallaction::dropItem(uint16 v) { uint16 _di = 0; for (uint16 _si = 0; _si < INVENTORY_MAX_ITEMS - 1; _si++) { @@ -163,13 +163,13 @@ void dropItem(uint16 v) { memcpy(&_inventory[_si], &_inventory[_si+1], sizeof(InventoryItem)); } - refreshInventory(_vm->_characterName); + refreshInventory(_characterName); return; } -int16 isItemInInventory(int32 v) { +int16 Parallaction::isItemInInventory(int32 v) { for (uint16 _si = 0; _si < INVENTORY_MAX_ITEMS; _si++) { if (_inventory[_si]._id == (uint)v) diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index 445d084528..5540d79785 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -43,10 +43,10 @@ void Parallaction::parseLocation(const char *filename) { debugC(1, kDebugLocation, "parseLocation('%s')", filename); uint16 _si = 1; - _vm->_gfx->_proportionalFont = false; - _vm->_gfx->setFont("topaz"); + _gfx->_proportionalFont = false; + _gfx->setFont("topaz"); - _locationScript = _disk->loadLocation(filename); + Script *_locationScript = _disk->loadLocation(filename); fillBuffers(*_locationScript, true); while (scumm_stricmp(_tokens[0], "ENDLOCATION")) { @@ -93,12 +93,12 @@ void Parallaction::parseLocation(const char *filename) { switchBackground(_location._name, mask); if (_tokens[2][0] != '\0') { - _vm->_char._ani._left = atoi(_tokens[2]); - _vm->_char._ani._top = atoi(_tokens[3]); + _char._ani._left = atoi(_tokens[2]); + _char._ani._top = atoi(_tokens[3]); } if (_tokens[4][0] != '\0') { - _vm->_char._ani._frame = atoi(_tokens[4]); + _char._ani._frame = atoi(_tokens[4]); } } if (!scumm_stricmp(_tokens[0], "DISK")) { @@ -112,7 +112,7 @@ void Parallaction::parseLocation(const char *filename) { } } if (!scumm_stricmp(_tokens[0], "COMMANDS")) { - parseCommands(*_locationScript, _location._commands); + parseCommands(*_locationScript, _location._commands); } if (!scumm_stricmp(_tokens[0], "ACOMMANDS")) { parseCommands(*_locationScript, _location._aCommands); @@ -157,17 +157,16 @@ void Parallaction::parseLocation(const char *filename) { resolveLocationForwards(); delete _locationScript; - _locationScript = NULL; return; } -void resolveLocationForwards() { +void Parallaction::resolveLocationForwards() { // printf("resolveLocationForwards()"); // printf("# forwards: %i", _numForwards); for (uint16 _si = 0; _forwardedCommands[_si]; _si++) { - _forwardedCommands[_si]->u._animation = _vm->findAnimation(_forwardedAnimationNames[_si]); + _forwardedCommands[_si]->u._animation = findAnimation(_forwardedAnimationNames[_si]); _forwardedCommands[_si] = NULL; } @@ -187,15 +186,15 @@ void Parallaction::freeLocation() { debugC(7, kDebugLocation, "freeLocation: localflags names freed"); // TODO (LIST): this should be replaced by a call to _location._walkNodes.clear() - freeNodeList(_vm->_location._walkNodes._next); - _vm->_location._walkNodes._next = NULL; + freeNodeList(_location._walkNodes._next); + _location._walkNodes._next = NULL; debugC(7, kDebugLocation, "freeLocation: walk nodes freed"); // TODO (LIST): helperNode should be rendered useless by the use of a Common::List<> // to store Zones and Animations. Right now, it holds a list of Zones to be preserved // but that'll pretty meaningless with a single list approach. helperNode._prev = helperNode._next = NULL; - _vm->freeZones(_zones._next); + freeZones(_zones._next); freeNodeList(_zones._next); _zones._next = helperNode._next; _zones._prev = helperNode._prev; @@ -206,25 +205,25 @@ void Parallaction::freeLocation() { // to store Zones and Animations. Right now, it holds a list of Zones to be preserved // but that'll pretty meaningless with a single list approach. helperNode._prev = helperNode._next = NULL; - _vm->freeZones(_animations._next); - _vm->freeAnimations(); + freeZones(_animations._next); + freeAnimations(); freeNodeList(_animations._next); _animations._next = helperNode._next; _animations._prev = helperNode._prev; // memcpy(&_animations, &helperNode, sizeof(Node)); debugC(7, kDebugLocation, "freeLocation: animations freed"); - if (_vm->_location._comment) { - free(_vm->_location._comment); + if (_location._comment) { + free(_location._comment); } - _vm->_location._comment = NULL; + _location._comment = NULL; debugC(7, kDebugLocation, "freeLocation: comments freed"); // TODO (LIST): this should be _location._commands.clear(); - freeCommands(_vm->_location._commands); + freeCommands(_location._commands); debugC(7, kDebugLocation, "freeLocation: commands freed"); - freeCommands(_vm->_location._aCommands); + freeCommands(_location._aCommands); debugC(7, kDebugLocation, "freeLocation: acommands freed"); return; @@ -232,7 +231,7 @@ void Parallaction::freeLocation() { -void parseWalkNodes(Script& script, Node *list) { +void Parallaction::parseWalkNodes(Script& script, Node *list) { fillBuffers(script, true); while (scumm_stricmp(_tokens[0], "ENDNODES")) { @@ -240,8 +239,8 @@ void parseWalkNodes(Script& script, Node *list) { if (!scumm_stricmp(_tokens[0], "COORD")) { WalkNode *v4 = new WalkNode( - atoi(_tokens[1]) - _vm->_char._ani.width()/2, - atoi(_tokens[2]) - _vm->_char._ani.height() + atoi(_tokens[1]) - _char._ani.width()/2, + atoi(_tokens[2]) - _char._ani.height() ); addNode(list, v4); @@ -255,14 +254,14 @@ void parseWalkNodes(Script& script, Node *list) { } -void switchBackground(const char* background, const char* mask) { +void Parallaction::switchBackground(const char* background, const char* mask) { // printf("switchBackground(%s)", name); Gfx::Palette pal; uint16 v2 = 0; if (!scumm_stricmp(background, "final")) { - _vm->_gfx->clearScreen(Gfx::kBitBack); + _gfx->clearScreen(Gfx::kBitBack); for (uint16 _si = 0; _si <= 93; ) { pal[_si] = v2; pal[_si+1] = v2; @@ -271,10 +270,10 @@ void switchBackground(const char* background, const char* mask) { _si += 3; } - _vm->_gfx->extendPalette(pal); + _gfx->extendPalette(pal); } - _vm->_disk->loadScenery(background, mask); + _disk->loadScenery(background, mask); return; } @@ -286,7 +285,7 @@ extern Job *_jEraseLabel; void Parallaction::showSlide(const char *name) { _disk->loadSlide(name); - _gfx->extendPalette(_vm->_gfx->_palette); + _gfx->extendPalette(_gfx->_palette); _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); debugC(1, kDebugLocation, "changeLocation: new background set"); @@ -346,7 +345,7 @@ void Parallaction::changeLocation(char *location) { debugC(2, kDebugLocation, "changeLocation: changed cursor"); } - removeNode(&_vm->_char._ani); + removeNode(&_char._ani); debugC(2, kDebugLocation, "changeLocation: removed character from the animation list"); freeLocation(); @@ -379,7 +378,7 @@ void Parallaction::changeLocation(char *location) { } } - addNode(&_animations, &_vm->_char._ani); + addNode(&_animations, &_char._ani); debugC(2, kDebugLocation, "changeLocation: new character added to the animation list"); strcpy(_saveData1, list[0].c_str()); @@ -388,14 +387,14 @@ void Parallaction::changeLocation(char *location) { _gfx->copyScreen(Gfx::kBitBack, Gfx::kBit2); debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1); - _vm->_char._ani._oldPos.x = -1000; - _vm->_char._ani._oldPos.y = -1000; + _char._ani._oldPos.x = -1000; + _char._ani._oldPos.y = -1000; - _vm->_char._ani.field_50 = 0; + _char._ani.field_50 = 0; if (_location._startPosition.x != -1000) { - _vm->_char._ani._left = _location._startPosition.x; - _vm->_char._ani._top = _location._startPosition.y; - _vm->_char._ani._frame = _location._startFrame; + _char._ani._left = _location._startPosition.x; + _char._ani._top = _location._startPosition.y; + _char._ani._frame = _location._startFrame; _location._startPosition.y = -1000; _location._startPosition.x = -1000; @@ -423,7 +422,7 @@ void Parallaction::changeLocation(char *location) { runJobs(); _gfx->swapBuffers(); - _gfx->extendPalette(_vm->_gfx->_palette); + _gfx->extendPalette(_gfx->_palette); if (_location._aCommands.size() > 0) { runCommands(_location._aCommands); debugC(1, kDebugLocation, "changeLocation: location acommands run"); @@ -450,26 +449,26 @@ void Parallaction::doLocationEnterTransition() { if (_localFlags[_currentLocationIndex] & kFlagsVisited) return; // visited byte pal[PALETTE_SIZE]; - _vm->_gfx->buildBWPalette(pal); - _vm->_gfx->setPalette(pal, FIRST_BASE_COLOR, BASE_PALETTE_COLORS); + _gfx->buildBWPalette(pal); + _gfx->setPalette(pal, FIRST_BASE_COLOR, BASE_PALETTE_COLORS); jobRunScripts(NULL, NULL); jobEraseAnimations(NULL, NULL); jobDisplayAnimations(NULL, NULL); - _vm->_gfx->setFont("comic"); - _vm->_gfx->swapBuffers(); - _vm->_gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack); + _gfx->setFont("comic"); + _gfx->swapBuffers(); + _gfx->copyScreen(Gfx::kBitFront, Gfx::kBitBack); int16 v7C, v7A; - _vm->_gfx->getStringExtent(_vm->_location._comment, 130, &v7C, &v7A); + _gfx->getStringExtent(_location._comment, 130, &v7C, &v7A); Common::Rect r(10 + v7C, 5 + v7A); r.moveTo(5, 5); - _vm->_gfx->floodFill(Gfx::kBitFront, r, 0); + _gfx->floodFill(Gfx::kBitFront, r, 0); r.grow(-1); - _vm->_gfx->floodFill(Gfx::kBitFront, r, 1); - _vm->_gfx->displayWrappedString(_vm->_location._comment, 3, 5, 130, 0); + _gfx->floodFill(Gfx::kBitFront, r, 1); + _gfx->displayWrappedString(_location._comment, 3, 5, 130, 0); // FIXME: ??? #if 0 @@ -480,13 +479,13 @@ void Parallaction::doLocationEnterTransition() { waitUntilLeftClick(); - _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront ); + _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront ); // fades maximum intensity palette towards approximation of main palette for (uint16 _si = 0; _si<6; _si++) { waitTime( 1 ); - _vm->_gfx->quickFadePalette(pal); - _vm->_gfx->setPalette(pal); + _gfx->quickFadePalette(pal); + _gfx->setPalette(pal); } debugC(1, kDebugLocation, "doLocationEnterTransition completed"); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 4feee8e47b..3e3b06a693 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -163,8 +163,6 @@ int Parallaction::init() { _activeItem._id = 0; _procCurrentHoverItem = -1; - _locationScript = NULL; - _musicData1 = 0; strcpy(_characterName1, "null"); diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index bc1205cc2f..3dafbd4e74 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -91,6 +91,34 @@ enum { kMouseRightDown = 4 }; +enum EngineFlags { + kEngineQuit = (1 << 0), + kEnginePauseJobs = (1 << 1), + kEngineInventory = (1 << 2), + kEngineWalking = (1 << 3), + kEngineChangeLocation = (1 << 4), + kEngineMouse = (1 << 5), + kEngineDragging = (1 << 6), + kEngineTransformedDonna = (1 << 7) +}; + +enum { + kEvNone = 0, + kEvEnterZone = 1, + kEvExitZone = 2, + kEvAction = 3, + kEvOpenInventory = 4, + kEvCloseInventory = 5, + kEvHoverInventory = 6, + kEvWalk = 7, + kEvQuitGame = 1000, + kEvSaveGame = 2000, + kEvLoadGame = 4000 +}; + +enum { + kCursorArrow = -1 +}; enum ParallactionGameType { GType_Nippon = 1, @@ -99,6 +127,8 @@ enum ParallactionGameType { struct PARALLACTIONGameDescription; + + struct Job; typedef void (*JobFn)(void*, Job*); @@ -121,40 +151,33 @@ struct Credit { typedef void (*callable)(void*); -extern uint16 _mouseButtons; - -extern uint16 _score; -extern uint16 _language; -extern Zone *_activeZone; -extern uint32 _engineFlags; -extern callable _callables[]; - -extern Node _zones; -extern Node _animations; -extern uint32 _localFlags[]; -extern Command *_forwardedCommands[]; -extern char _forwardedAnimationNames[][20]; -extern uint16 _numForwards; -extern char _soundFile[]; -extern char _slideText[][40]; -extern uint16 _introSarcData3; // sarcophagus stuff to be saved -extern uint16 _introSarcData2; // sarcophagus stuff to be saved - -extern char _saveData1[]; -extern byte _mouseHidden; -extern uint32 _commandFlags; - -extern const char *_instructionNamesRes[]; -extern const char *_commandsNamesRes[]; - -extern const char *_dinoName; -extern const char *_donnaName; -extern const char *_doughName; -extern const char *_drkiName; -extern const char *_minidinoName; -extern const char *_minidonnaName; -extern const char *_minidoughName; -extern const char *_minidrkiName; +extern uint16 _mouseButtons; +extern uint16 _score; +extern uint16 _language; +extern Zone *_activeZone; +extern uint32 _engineFlags; +extern callable _callables[]; +extern uint32 _localFlags[]; +extern Command *_forwardedCommands[]; +extern char _forwardedAnimationNames[][20]; +extern uint16 _numForwards; +extern char _soundFile[]; +extern char _slideText[][40]; +extern uint16 _introSarcData3; // sarcophagus stuff to be saved +extern uint16 _introSarcData2; // sarcophagus stuff to be saved +extern char _saveData1[]; +extern byte _mouseHidden; +extern uint32 _commandFlags; +extern const char *_instructionNamesRes[]; +extern const char *_commandsNamesRes[]; +extern const char *_dinoName; +extern const char *_donnaName; +extern const char *_doughName; +extern const char *_drkiName; +extern const char *_minidinoName; +extern const char *_minidonnaName; +extern const char *_minidoughName; +extern const char *_minidrkiName; // Various ways of detecting character modes used to exist // inside the engine, so they have been unified in the two @@ -191,36 +214,6 @@ void jobHideInventory(void *parm, Job *j); void jobEraseLabel(void *parm, Job *j); -enum EngineFlags { - kEngineQuit = (1 << 0), - kEnginePauseJobs = (1 << 1), - kEngineInventory = (1 << 2), - kEngineWalking = (1 << 3), - kEngineChangeLocation = (1 << 4), - kEngineMouse = (1 << 5), - kEngineDragging = (1 << 6), - kEngineTransformedDonna = (1 << 7) -}; - -enum { - kEvNone = 0, - kEvEnterZone = 1, - kEvExitZone = 2, - kEvAction = 3, - kEvOpenInventory = 4, - kEvCloseInventory = 5, - kEvHoverInventory = 6, - kEvWalk = 7, - kEvQuitGame = 1000, - kEvSaveGame = 2000, - kEvLoadGame = 4000 -}; - -enum { - kCursorArrow = -1 -}; - - class Gfx; class Menu; @@ -250,18 +243,8 @@ struct Character { Character() { _talk = NULL; -// ._width = 0; -// _talk._height = 0; -// _talk._count = 0; - _head = NULL; -// _head._width = 0; -// _head._height = 0; -// _head._data0 = NULL; -// _head._data1 = NULL; - _objs = NULL; -// _objs._count = 0; _ani._left = 150; _ani._top = 100; @@ -305,35 +288,42 @@ public: ~Parallaction(); int init(); - int go(); - void loadGame(); void saveGame(); - uint16 updateInput(); + uint16 updateInput(); - void waitTime(uint32 t); + void waitTime(uint32 t); -// static void initTable(const char *path, char **table); -// static void freeTable(char** table); -// static int16 searchTable(const char *s, const char **table); - void freeCommands(CommandList& list); + void parseLocation(const char *filename); + void changeCursor(int32 index); + void changeCharacter(const char *name); - void parseLocation(const char *filename); - void changeCursor(int32 index); - void changeCharacter(const char *name); + char *parseComment(Script &script); + char *parseDialogueString(Script &script); + Dialogue *parseDialogue(Script &script); - char *parseComment(Script &script); - char *parseDialogueString(Script &script); - Dialogue *parseDialogue(Script &script); + Job *addJob(JobFn fn, void *parm, uint16 tag); + void removeJob(Job *j); + void pauseJobs(); + void resumeJobs(); + void runJobs(); - Job *addJob(JobFn fn, void *parm, uint16 tag); - void removeJob(Job *j); - void pauseJobs(); - void resumeJobs(); - void runJobs(); + Zone *findZone(const char *name); + Zone *hitZone(uint32 type, uint16 x, uint16 y); + uint16 runZone(Zone*); + void freeZones(Node *list); + + void runDialogue(SpeakData*); + + void runCommands(CommandList& list, Zone *z = NULL); + void freeCommands(CommandList& list); // to be phased out soon + + Animation *findAnimation(const char *name); + void sortAnimations(); + void freeAnimations(); Table *_globalTable; Table *_objectsNames; @@ -344,17 +334,7 @@ public: Table *_instructionNames; Table *_localFlagNames; - void freeZones(Node *list); - Animation *findAnimation(const char *name); - Zone *findZone(const char *name); - Zone *hitZone(uint32 type, uint16 x, uint16 y); - void freeAnimations(); - void sortAnimations(); - void freeLocation(); - uint16 runZone(Zone*); - void runDialogue(SpeakData*); - void runCommands(CommandList& list, Zone *z = NULL); public: int getGameType() const; @@ -369,22 +349,20 @@ public: MidiPlayer *_midiPlayer; - Gfx* _gfx; - Menu* _menu; - char _characterName[30]; - Disk* _disk; + Gfx* _gfx; + Menu* _menu; + Disk* _disk; - char _locationNames[120][32]; - int16 _currentLocationIndex; - uint16 _numLocations; + Character _char; + char _characterName[30]; - Character _char; - Location _location; + char _locationNames[120][32]; + int16 _currentLocationIndex; + uint16 _numLocations; + Location _location; InventoryItem _activeItem; - Script *_locationScript; - Common::Point _mousePos; Node _zones; @@ -393,12 +371,11 @@ public: protected: // data struct InputData { - uint16 _event; - Common::Point _mousePos; - - int16 _inventoryIndex; - Zone* _zone; - Label* _label; + uint16 _event; + Common::Point _mousePos; + int16 _inventoryIndex; + Zone* _zone; + Label* _label; }; bool _skipMenu; @@ -414,14 +391,14 @@ protected: // data uint32 _baseTime; - uint16 _musicData1; // only used in changeLocation + uint16 _musicData1; // only used in changeLocation char _characterName1[50]; // only used in changeCharacter int16 _keyDown; Job _jobs; - Node helperNode; // used for freeZones + Node helperNode; // used for freeZones: to be removed protected: // members bool detectGame(void); @@ -436,7 +413,8 @@ protected: // members void doSaveGame(uint16 slot, const char* name); void runGame(); - InputData * translateInput(); + + InputData *translateInput(); void processInput(InputData*); int16 getHoverInventoryItem(int16 x, int16 y); @@ -445,23 +423,45 @@ protected: // members void resetTimer(); void doLocationEnterTransition(); + void changeLocation(char *location); + void showSlide(const char *name); + void resolveLocationForwards(); + void switchBackground(const char* background, const char* mask); + void freeLocation(); + void parseZone(Script &script, Node *list, char *name); + void parseZoneTypeBlock(Script &script, Zone *z); + void parseWalkNodes(Script& script, Node *list); + void displayCharacterComment(ExamineData *data); + void displayItemComment(ExamineData *data); + Animation * parseAnimation(Script &script, Node *list, char *name); void parseScriptLine(Instruction *inst, Animation *a, LocalVariable *locals); - void parseZoneTypeBlock(Script &script, Zone *z); void loadProgram(Animation *a, char *filename); - void changeLocation(char *location); - void showSlide(const char *name); + LValue getLValue(Instruction *inst, char *str, LocalVariable *locals, Animation *a); + + void parseCommands(Script &script, CommandList&); void pickMusic(const char *location); void selectCharacterMusic(const char *name); - void parseCommands(Script &script, CommandList&); void freeCharacter(); - void initResources(); + uint16 askDialoguePassword(Dialogue *q, StaticCnv *face); + bool displayAnswer(Dialogue *q, uint16 i); + bool displayAnswers(Dialogue *q); + void displayQuestion(Dialogue *q, Cnv *cnv); + uint16 getDialogueAnswer(Dialogue *q, Cnv *cnv); + int16 selectAnswer(Question *q, StaticCnv *cnv); + void enterDialogue(); + void exitDialogue(); + + void addInventoryItem(uint16 item); + void dropItem(uint16 item); + int16 pickupItem(Zone *z); + int16 isItemInInventory(int32 v); }; // FIXME: remove global diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index a518e76a24..3514488093 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -62,10 +62,10 @@ void Parallaction::doLoadGame(uint16 slot) { f->readLine(s, 29); - f->readLine(_vm->_characterName, 15); - f->readLine(_vm->_location._name, 15); + f->readLine(_characterName, 15); + f->readLine(_location._name, 15); - strcat(_vm->_location._name, "."); + strcat(_location._name, "."); f->readLine(s, 15); _location._startPosition.x = atoi(s); @@ -116,19 +116,19 @@ void Parallaction::doLoadGame(uint16 slot) { delete f; _engineFlags &= ~kEngineTransformedDonna; - if (!scumm_stricmp(_vm->_characterName, "donnatras")) { + if (!scumm_stricmp(_characterName, "donnatras")) { _engineFlags |= kEngineTransformedDonna; - strcpy(_vm->_characterName, "donna"); + strcpy(_characterName, "donna"); } - if (!scumm_stricmp(_vm->_characterName, "minidonnatras")) { + if (!scumm_stricmp(_characterName, "minidonnatras")) { _engineFlags |= kEngineTransformedDonna; - strcpy(_vm->_characterName, _minidonnaName); + strcpy(_characterName, _minidonnaName); } - if (IS_MINI_CHARACTER(_vm->_characterName)) { - strcpy(filename, _vm->_characterName+4); + if (IS_MINI_CHARACTER(_characterName)) { + strcpy(filename, _characterName+4); } else { - strcpy(filename, _vm->_characterName); + strcpy(filename, _characterName); } // strcat(filename, ".tab"); // freeTable(_objectsNames); @@ -142,7 +142,7 @@ void Parallaction::doLoadGame(uint16 slot) { // bugs, but it's a good maneuver anyway strcpy(_characterName1, "null"); - strcat(_vm->_location._name, _vm->_characterName); + strcat(_location._name, _characterName); _engineFlags |= kEngineChangeLocation; return; @@ -175,17 +175,17 @@ void Parallaction::doSaveGame(uint16 slot, const char* name) { f->writeString("\n"); if (_engineFlags & kEngineTransformedDonna) { - sprintf(s, "%stras\n", _vm->_characterName); + sprintf(s, "%stras\n", _characterName); } else { - sprintf(s, "%s\n", _vm->_characterName); + sprintf(s, "%s\n", _characterName); } f->writeString(s); sprintf(s, "%s\n", _saveData1); f->writeString(s); - sprintf(s, "%d\n", _vm->_char._ani._left); + sprintf(s, "%d\n", _char._ani._left); f->writeString(s); - sprintf(s, "%d\n", _vm->_char._ani._top); + sprintf(s, "%d\n", _char._ani._top); f->writeString(s); sprintf(s, "%d\n", _score); f->writeString(s); @@ -206,7 +206,7 @@ void Parallaction::doSaveGame(uint16 slot, const char* name) { delete f; - refreshInventory(_vm->_characterName); + refreshInventory(_characterName); return; @@ -343,7 +343,7 @@ int Parallaction::buildSaveFileList(Common::StringList& l) { int Parallaction::selectSaveFile(uint16 arg_0, const char* caption, const char* button) { - SaveLoadChooser* slc = new SaveLoadChooser(caption, button, _vm); + SaveLoadChooser* slc = new SaveLoadChooser(caption, button, this); Common::StringList l; @@ -382,7 +382,7 @@ void Parallaction::loadGame() { void Parallaction::saveGame() { - if (!scumm_stricmp(_vm->_location._name, "caveau")) + if (!scumm_stricmp(_location._name, "caveau")) return; int slot = selectSaveFile( 1, "Save file", "Save" ); diff --git a/engines/parallaction/zone.cpp b/engines/parallaction/zone.cpp index 378c7fde01..10eacbb803 100644 --- a/engines/parallaction/zone.cpp +++ b/engines/parallaction/zone.cpp @@ -94,7 +94,7 @@ void Parallaction::parseZone(Script &script, Node *list, char *name) { } if (!scumm_stricmp(_tokens[0], "label")) { // printf("label: %s", _tokens[1]); - _vm->_gfx->makeCnvFromString(&z->_label._cnv, _tokens[1]); + _gfx->makeCnvFromString(&z->_label._cnv, _tokens[1]); } if (!scumm_stricmp(_tokens[0], "flags")) { uint16 _si = 1; @@ -302,28 +302,28 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) { // // works on the frontbuffer // -void displayCharacterComment(ExamineData *data) { +void Parallaction::displayCharacterComment(ExamineData *data) { if (data->_description == NULL) return; StaticCnv v3C; - v3C._width = _vm->_char._talk->_width; - v3C._height = _vm->_char._talk->_height; - v3C._data0 = _vm->_char._talk->getFramePtr(0); + v3C._width = _char._talk->_width; + v3C._height = _char._talk->_height; + v3C._data0 = _char._talk->getFramePtr(0); v3C._data1 = NULL; //_talk->field_8[0]; - _vm->_gfx->setFont("comic"); - _vm->_gfx->flatBlitCnv(&v3C, 190, 80, Gfx::kBitFront); + _gfx->setFont("comic"); + _gfx->flatBlitCnv(&v3C, 190, 80, Gfx::kBitFront); int16 v26, v28; - _vm->_gfx->getStringExtent(data->_description, 130, &v28, &v26); + _gfx->getStringExtent(data->_description, 130, &v28, &v26); Common::Rect r(v28, v26); r.moveTo(140, 10); - _vm->_gfx->drawBalloon(r, 0); - _vm->_gfx->displayWrappedString(data->_description, 140, 10, 130, 0); + _gfx->drawBalloon(r, 0); + _gfx->displayWrappedString(data->_description, 140, 10, 130, 0); waitUntilLeftClick(); - _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); + _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); return; } @@ -337,32 +337,32 @@ void displayCharacterComment(ExamineData *data) { // works on the frontbuffer // -void displayItemComment(ExamineData *data) { +void Parallaction::displayItemComment(ExamineData *data) { if (data->_description == NULL) return; char v68[PATH_LEN]; strcpy(v68, data->_filename); - data->_cnv = _vm->_disk->loadStatic(v68); - _vm->_gfx->flatBlitCnv(data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv->_height)/2, Gfx::kBitFront); - _vm->_gfx->freeStaticCnv(data->_cnv); + data->_cnv = _disk->loadStatic(v68); + _gfx->flatBlitCnv(data->_cnv, 140, (SCREEN_HEIGHT - data->_cnv->_height)/2, Gfx::kBitFront); + _gfx->freeStaticCnv(data->_cnv); delete data->_cnv; int16 v6A = 0, v6C = 0; - _vm->_gfx->setFont("comic"); - _vm->_gfx->getStringExtent(data->_description, 130, &v6C, &v6A); + _gfx->setFont("comic"); + _gfx->getStringExtent(data->_description, 130, &v6C, &v6A); Common::Rect r(v6C, v6A); r.moveTo(0, 90); - _vm->_gfx->drawBalloon(r, 0); - _vm->_gfx->flatBlitCnv(_vm->_char._head, 100, 152, Gfx::kBitFront); - _vm->_gfx->displayWrappedString(data->_description, 0, 90, 130, 0); + _gfx->drawBalloon(r, 0); + _gfx->flatBlitCnv(_vm->_char._head, 100, 152, Gfx::kBitFront); + _gfx->displayWrappedString(data->_description, 0, 90, 130, 0); jobEraseAnimations((void*)1, NULL); waitUntilLeftClick(); - _vm->_gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); + _gfx->copyScreen(Gfx::kBitBack, Gfx::kBitFront); return; } @@ -397,7 +397,7 @@ uint16 Parallaction::runZone(Zone *z) { if (z->_flags & kFlagsLocked) break; z->_flags ^= kFlagsClosed; if (z->u.door->_cnv == NULL) break; - _vm->addJob(&jobToggleDoor, z, kPriority18 ); + addJob(&jobToggleDoor, z, kPriority18 ); break; case kZoneHear: @@ -552,13 +552,13 @@ Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) { if (z->_left != -1) continue; - if (_si < _vm->_char._ani._left) + if (_si < _char._ani._left) continue; - if (_si > (_vm->_char._ani._left + _vm->_char._ani.width())) + if (_si > (_char._ani._left + _char._ani.width())) continue; - if (_di < _vm->_char._ani._top) + if (_di < _char._ani._top) continue; - if (_di > (_vm->_char._ani._top + _vm->_char._ani.height())) + if (_di > (_char._ani._top + _char._ani.height())) continue; } |