From bcd62c06699f3240aaa79eeb4bb31f23dbe2bd56 Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Tue, 2 Jul 2019 09:06:47 +0200 Subject: SUPERNOVA: Code refactoring Add constant for inverting sections (number 128) Move some initialization in initState from derived classes to base class. Simpilfy AxacussCorridor4::onEntrance --- engines/supernova/game-manager.cpp | 35 +++- engines/supernova/msn_def.h | 2 + engines/supernova/room.cpp | 2 +- engines/supernova/screen.cpp | 4 +- engines/supernova/supernova.cpp | 5 +- engines/supernova/supernova1/rooms.cpp | 190 +++++++++++----------- engines/supernova/supernova1/state.cpp | 42 +---- engines/supernova/supernova2/rooms.cpp | 288 ++++++++++++++++----------------- engines/supernova/supernova2/state.cpp | 39 +---- 9 files changed, 288 insertions(+), 319 deletions(-) (limited to 'engines') diff --git a/engines/supernova/game-manager.cpp b/engines/supernova/game-manager.cpp index 2d003741b2..5cf54d4b09 100644 --- a/engines/supernova/game-manager.cpp +++ b/engines/supernova/game-manager.cpp @@ -165,6 +165,35 @@ void GameManager::destroyRooms() { } void GameManager::initState() { + _currentInputObject = &_nullObject; + _inputObject[0] = &_nullObject; + _inputObject[1] = &_nullObject; + _inputVerb = ACTION_WALK; + _processInput = false; + _guiEnabled = true; + _animationEnabled = true; + _roomBrightness = 255; + _mouseClicked = false; + _keyPressed = false; + _mouseX = -1; + _mouseY = -1; + _mouseField = -1; + _inventoryScroll = 0; + _oldTime = g_system->getMillis(); + _timerPaused = 0; + _timePaused = false; + _messageDuration = 0; + _animationTimer = 0; + _currentSentence = -1; + for (int i = 0 ; i < 6 ; ++i) { + _sentenceNumber[i] = -1; + _texts[i] = kNoString; + _rows[i] = 0; + _rowsStart[i] = 0; + } + + _prevImgId = 0; + _dead = false; } void GameManager::initRooms() { @@ -926,10 +955,10 @@ void GameManager::dead(int messageId) { } int GameManager::invertSection(int section) { - if (section < 128) - section += 128; + if (section < kSectionInvert) + section += kSectionInvert; else - section -= 128; + section -= kSectionInvert; return section; } diff --git a/engines/supernova/msn_def.h b/engines/supernova/msn_def.h index 293af6c873..6c5dcc0321 100644 --- a/engines/supernova/msn_def.h +++ b/engines/supernova/msn_def.h @@ -40,6 +40,8 @@ const int kSleepAutosaveSlot = 999; const byte kShownFalse = 0; const byte kShownTrue = 1; +const byte kSectionInvert = 128; + enum MessagePosition { kMessageNormal, kMessageLeft, diff --git a/engines/supernova/room.cpp b/engines/supernova/room.cpp index 404ad02474..47b67fbd54 100644 --- a/engines/supernova/room.cpp +++ b/engines/supernova/room.cpp @@ -130,7 +130,7 @@ void Room::setSectionVisible(uint section, bool visible) { if (section < kMaxSection) _shown[section] = visible ? kShownTrue : kShownFalse; else - _shown[section - 128] = visible ? kShownFalse : kShownTrue; + _shown[section - kSectionInvert] = visible ? kShownFalse : kShownTrue; } bool Room::isSectionVisible(uint index) const { diff --git a/engines/supernova/screen.cpp b/engines/supernova/screen.cpp index 6a76daca92..7dc04b0c82 100644 --- a/engines/supernova/screen.cpp +++ b/engines/supernova/screen.cpp @@ -422,9 +422,9 @@ void Screen::renderImage(ImageId id, bool removeImage) { void Screen::renderImage(int section) { bool removeImage = false; - if (section > 128) { + if (section > kSectionInvert) { removeImage = true; - section -= 128; + section -= kSectionInvert; } if (!_currentImage || section >= kMaxSection) diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index c225c7cd58..07d91285e8 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -287,10 +287,7 @@ void SupernovaEngine::playSound(MusicId index) { } void SupernovaEngine::renderImage(int section) { - if (section > 128) - _gm->_currentRoom->setSectionVisible(section - 128, false); - else - _gm->_currentRoom->setSectionVisible(section, true); + _gm->_currentRoom->setSectionVisible(section, true); _screen->renderImage(section); } diff --git a/engines/supernova/supernova1/rooms.cpp b/engines/supernova/supernova1/rooms.cpp index 6d2fdd5316..af86450fb8 100644 --- a/engines/supernova/supernova1/rooms.cpp +++ b/engines/supernova/supernova1/rooms.cpp @@ -875,8 +875,8 @@ ShipCabinL1::ShipCabinL1(SupernovaEngine *vm, GameManager1 *gm) { _objectState[2] = Object(_id, kStringImage, kStringGenericDescription3, NULLOBJECT, UNNECESSARY, 7, 7, 0, NULLROOM, 0); _objectState[3] = Object(_id, kStringMagnete, kStringMagneteDescription, NULLOBJECT, UNNECESSARY, 8, 8, 0, NULLROOM, 0); _objectState[4] = Object(_id, kStringImage, kStringGenericDescription4, NULLOBJECT, UNNECESSARY, 9, 9, 0); - _objectState[5] = Object(_id, kStringPen, kStringPenDescription, PEN, TAKE | COMBINABLE, 10, 10, 5 | 128); - _objectState[6] = Object(_id, kStringHatch, kStringDefaultDescription, NULLOBJECT, OPENABLE | OPENED | EXIT, 3, 3, 24 | 128, CORRIDOR_ROOM, 9); + _objectState[5] = Object(_id, kStringPen, kStringPenDescription, PEN, TAKE | COMBINABLE, 10, 10, 5 | kSectionInvert); + _objectState[6] = Object(_id, kStringHatch, kStringDefaultDescription, NULLOBJECT, OPENABLE | OPENED | EXIT, 3, 3, 24 | kSectionInvert, CORRIDOR_ROOM, 9); _objectState[7] = Object(_id, kStringSlot, kStringSlotDescription, NULLOBJECT, COMBINABLE, 0, 0, 0); _objectState[8] = Object(_id, kStringShelf, kStringDefaultDescription, NULLOBJECT, OPENABLE | CLOSED, 1, 1, 0); _objectState[9] = Object(_id, kStringCompartment, kStringDefaultDescription, NULLOBJECT, OPENABLE | CLOSED, 2, 2, 0); @@ -912,7 +912,7 @@ ShipCabinL2::ShipCabinL2(SupernovaEngine *vm, GameManager1 *gm) { _objectState[16] = Object(_id, kStringJunk,kStringJunkDescription,NULLOBJECT,UNNECESSARY,38,38,0); _objectState[17] = Object(_id, kStringMagnete,kStringMagneteDescription,NULLOBJECT,UNNECESSARY,23,23,0); _objectState[18] = Object(_id, kStringToilet,kStringDefaultDescription,BATHROOM_DOOR,EXIT,255,255,0,BATHROOM,22); - _objectState[19] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,24 | 128,CORRIDOR_ROOM,9); + _objectState[19] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,24 | kSectionInvert,CORRIDOR_ROOM,9); _objectState[20] = Object(_id, kStringSlot,kStringSlotDescription,NULLOBJECT,COMBINABLE,0,0,0); _objectState[21] = Object(_id, kStringShelf,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,1,1,0); _objectState[22] = Object(_id, kStringCompartment,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,2,2,0); @@ -979,14 +979,14 @@ ShipCabinL3::ShipCabinL3(SupernovaEngine *vm, GameManager1 *gm) { _objectState[1] = Object(_id, kStringPoster,kStringPosterDescription2,NULLOBJECT,UNNECESSARY,12,12,0); _objectState[2] = Object(_id, kStringSpeaker,kStringDefaultDescription,NULLOBJECT,NULLTYPE,13,13,0); _objectState[3] = Object(_id, kStringMagnete,kStringMagneteDescription,NULLOBJECT,UNNECESSARY,14,14,0); - _objectState[4] = Object(_id, kStringRecord,kStringRecordDescription,RECORD,TAKE | COMBINABLE,15,15,8 | 128); + _objectState[4] = Object(_id, kStringRecord,kStringRecordDescription,RECORD,TAKE | COMBINABLE,15,15,8 | kSectionInvert); _objectState[5] = Object(_id, kStringRecordStand,kStringRecordStandDescription,NULLOBJECT,UNNECESSARY,16,16,0); _objectState[6] = Object(_id, kStringButton,kStringDefaultDescription,TURNTABLE_BUTTON,PRESS,22,22,0); _objectState[7] = Object(_id, kStringTurntable,kStringTurntableDescription,TURNTABLE,UNNECESSARY | COMBINABLE,17,17,0); _objectState[8] = Object(_id, kStringWire,kStringDefaultDescription,WIRE,COMBINABLE,18,18,0); _objectState[9] = Object(_id, kStringWire,kStringDefaultDescription,WIRE2,COMBINABLE,19,19,0); _objectState[10] = Object(_id, kStringPlug,kStringDefaultDescription,PLUG,COMBINABLE,20,20,0); - _objectState[11] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,24 | 128,CORRIDOR_ROOM,9); + _objectState[11] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,24 | kSectionInvert,CORRIDOR_ROOM,9); _objectState[12] = Object(_id, kStringSlot,kStringSlotDescription,NULLOBJECT,COMBINABLE,0,0,0); _objectState[13] = Object(_id, kStringShelf,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,1,1,0); _objectState[14] = Object(_id, kStringCompartment,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,2,2,0); @@ -1088,7 +1088,7 @@ ShipCabinR1::ShipCabinR1(SupernovaEngine *vm, GameManager1 *gm) { _objectState[0] = Object(_id, kStringImage,kStringImageDescription1,NULLOBJECT,UNNECESSARY,5,5,0); _objectState[1] = Object(_id, kStringDrawingInstruments,kStringDrawingInstrumentsDescription,NULLOBJECT,UNNECESSARY,6,6,0); _objectState[2] = Object(_id, kStringMagnete,kStringMagneteDescription,NULLOBJECT,UNNECESSARY,7,7,0); - _objectState[3] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,15 | 128,CORRIDOR_ROOM,5); + _objectState[3] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,15 | kSectionInvert,CORRIDOR_ROOM,5); _objectState[4] = Object(_id, kStringSlot,kStringSlotDescription,NULLOBJECT,COMBINABLE,0,0,0); _objectState[5] = Object(_id, kStringShelf,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,1,1,0); _objectState[6] = Object(_id, kStringCompartment,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,2,2,0); @@ -1110,7 +1110,7 @@ ShipCabinR2::ShipCabinR2(SupernovaEngine *vm, GameManager1 *gm) { _objectState[0] = Object(_id, kStringChessGame,kStringChessGameDescription1,NULLOBJECT,UNNECESSARY,11,11,0); _objectState[1] = Object(_id, kStringTennisRacket,kStringTennisRacketDescription,NULLOBJECT,UNNECESSARY,8,8,0); _objectState[2] = Object(_id, kStringTennisBall,kStringGenericDescription2,NULLOBJECT,UNNECESSARY,9,9,0); - _objectState[3] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,15 | 128,CORRIDOR_ROOM,5); + _objectState[3] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | OPENED | EXIT,3,3,15 | kSectionInvert,CORRIDOR_ROOM,5); _objectState[4] = Object(_id, kStringSlot,kStringSlotDescription,NULLOBJECT,COMBINABLE,0,0,0); _objectState[5] = Object(_id, kStringShelf,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,1,1,0); _objectState[6] = Object(_id, kStringCompartment,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,2,2,0); @@ -1129,7 +1129,7 @@ ShipCabinR3::ShipCabinR3(SupernovaEngine *vm, GameManager1 *gm) { _shown[8] = kShownTrue; _shown[15] = kShownTrue; - _objectState[0] = Object(_id, kStringChessGame,kStringChessGameDescription2,CHESS,TAKE | COMBINABLE,12,12,7 | 128); + _objectState[0] = Object(_id, kStringChessGame,kStringChessGameDescription2,CHESS,TAKE | COMBINABLE,12,12,7 | kSectionInvert); _objectState[1] = Object(_id, kStringBed,kStringBedDescription,NULLOBJECT,NULLTYPE,13,13,0); _objectState[2] = Object(_id, kStringSlot,kStringSlotDescription,SLOT_K1,COMBINABLE,27,27,0); _objectState[3] = Object(_id, kStringSlot,kStringSlotDescription,SLOT_K2,COMBINABLE,28,28,0); @@ -1147,7 +1147,7 @@ ShipCabinR3::ShipCabinR3(SupernovaEngine *vm, GameManager1 *gm) { _objectState[15] = Object(_id, kStringCompartment,kStringCompartmentDescription,SHELF4,OPENABLE | CLOSED,24,25,13); _objectState[16] = Object(_id, kStringBook,kStringBookHitchhiker,BOOK,TAKE,26,26,14); _objectState[17] = Object(_id, kStringDiscman,kStringDiscmanDescription,DISCMAN,TAKE | COMBINABLE,33,33,16); - _objectState[18] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | EXIT,3,3,15 | 128,CORRIDOR_ROOM,5); + _objectState[18] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | EXIT,3,3,15 | kSectionInvert,CORRIDOR_ROOM,5); _objectState[19] = Object(_id, kStringSlot,kStringSlotDescription,NULLOBJECT,COMBINABLE,0,0,0); _objectState[20] = Object(_id, kStringShelf,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,1,1,0); _objectState[21] = Object(_id, kStringCompartment,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,2,2,0); @@ -1453,7 +1453,7 @@ ShipLandingModule::ShipLandingModule(SupernovaEngine *vm, GameManager1 *gm) { _objectState[2] = Object(_id, kStringMonitor,kStringDefaultDescription,LANDINGMOD_MONITOR,NULLTYPE,3,3,0); _objectState[3] = Object(_id, kStringKeyboard,kStringDefaultDescription,KEYBOARD,NULLTYPE,4,4,0); _objectState[4] = Object(_id, kNoString,kStringDefaultDescription,LANDINGMOD_WIRE,COMBINABLE,255,255,0); - _objectState[5] = Object(_id, kStringHatch,kStringDefaultDescription,LANDINGMOD_HATCH,EXIT | OPENABLE | OPENED | COMBINABLE, 0,0,1 | 128,HOLD,10); + _objectState[5] = Object(_id, kStringHatch,kStringDefaultDescription,LANDINGMOD_HATCH,EXIT | OPENABLE | OPENED | COMBINABLE, 0,0,1 | kSectionInvert,HOLD,10); } bool ShipLandingModule::interact(Action verb, Object &obj1, Object &obj2) { @@ -1565,7 +1565,7 @@ ShipGenerator::ShipGenerator(SupernovaEngine *vm, GameManager1 *gm) { _objectState[0] = Object(_id, kStringGeneratorWire,kStringDefaultDescription,GENERATOR_WIRE,COMBINABLE,255,255,0); _objectState[1] = Object(_id, kStringEmptySpool,kStringDefaultDescription,NULLOBJECT,UNNECESSARY,255,255,0); - _objectState[2] = Object(_id, kStringKeycard2,kStringKeycard2Description,KEYCARD2,COMBINABLE | TAKE,12,12,5 | 128); + _objectState[2] = Object(_id, kStringKeycard2,kStringKeycard2Description,KEYCARD2,COMBINABLE | TAKE,12,12,5 | kSectionInvert); _objectState[3] = Object(_id, kStringRope,kStringDefaultDescription,GENERATOR_ROPE,COMBINABLE,255,255,0); _objectState[4] = Object(_id, kStringHatch,kStringHatchDescription3,OUTERHATCH,EXIT | OPENABLE,1,2,1,OUTSIDE,22); _objectState[5] = Object(_id, kStringHatch,kStringDefaultDescription,NULLOBJECT,OPENABLE | CLOSED,3,3,0); @@ -1883,11 +1883,11 @@ ArsanoEntrance::ArsanoEntrance(SupernovaEngine *vm, GameManager1 *gm) { _objectState[0] = Object(_id, kStringPorter,kStringPorterDescription,PORTER,TALK,0,0,0); _objectState[1] = Object(_id, kStringDoor,kStringDefaultDescription,NULLOBJECT,EXIT | OPENABLE | CLOSED,1,1,0,NULLROOM,5); _objectState[2] = Object(_id, kStringSign,kStringSignDescription,KITCHEN_SIGN,NULLTYPE,2,2,0); - _objectState[3] = Object(_id, kStringChewingGum,kStringDefaultDescription,SCHNUCK,TAKE,255,255,10+128); - _objectState[4] = Object(_id, kStringGummyBears,kStringDefaultDescription,SCHNUCK,TAKE,255,255,11+128); - _objectState[5] = Object(_id, kStringChocolateBall,kStringDefaultDescription,SCHNUCK,TAKE,255,255,12+128); - _objectState[6] = Object(_id, kStringEgg,kStringDefaultDescription,EGG,TAKE,255,255,13+128); - _objectState[7] = Object(_id, kStringLiquorice,kStringDefaultDescription,SCHNUCK,TAKE,255,255,14+128); + _objectState[3] = Object(_id, kStringChewingGum,kStringDefaultDescription,SCHNUCK,TAKE,255,255,10+kSectionInvert); + _objectState[4] = Object(_id, kStringGummyBears,kStringDefaultDescription,SCHNUCK,TAKE,255,255,11+kSectionInvert); + _objectState[5] = Object(_id, kStringChocolateBall,kStringDefaultDescription,SCHNUCK,TAKE,255,255,12+kSectionInvert); + _objectState[6] = Object(_id, kStringEgg,kStringDefaultDescription,EGG,TAKE,255,255,13+kSectionInvert); + _objectState[7] = Object(_id, kStringLiquorice,kStringDefaultDescription,SCHNUCK,TAKE,255,255,14+kSectionInvert); _objectState[8] = Object(_id, kStringPill,kStringPillDescription,PILL,TAKE,255,255,0); _objectState[9] = Object(_id, kStringSlot,kStringDefaultDescription,CAR_SLOT,COMBINABLE,6,6,0); _objectState[10] = Object(_id, kStringVendingMachine,kStringVendingMachineDescription,NULLOBJECT,NULLTYPE,5,5,0); @@ -2020,16 +2020,16 @@ bool ArsanoEntrance::interact(Action verb, Object &obj1, Object &obj2) { while ((e < 3) && (!allSentencesRemoved(4, 1))) { switch (e = _gm->dialog(5, row1, _dialog1, 1)) { case 0: - _gm->reply(kStringArsanoEntrance15, 1, 1 + 128); + _gm->reply(kStringArsanoEntrance15, 1, 1 + kSectionInvert); break; case 1: - _gm->reply(kStringArsanoEntrance3, 1, 1 + 128); - _gm->reply(kStringArsanoEntrance4, 1, 1 + 128); - _gm->reply(kStringArsanoEntrance5, 1, 1 + 128); + _gm->reply(kStringArsanoEntrance3, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoEntrance4, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoEntrance5, 1, 1 + kSectionInvert); removeSentence(0, 2); break; case 2: - _gm->reply(kStringArsanoEntrance7, 1, 1 + 128); + _gm->reply(kStringArsanoEntrance7, 1, 1 + kSectionInvert); _gm->_state._shoes = 2; break; case 3: @@ -2037,7 +2037,7 @@ bool ArsanoEntrance::interact(Action verb, Object &obj1, Object &obj2) { _gm->wait(2); _vm->renderImage(4); setSectionVisible(3, false); - _gm->reply(kStringArsanoEntrance16, 1, 1 + 128); + _gm->reply(kStringArsanoEntrance16, 1, 1 + kSectionInvert); _vm->renderImage(3); setSectionVisible(4, false); _gm->wait(2); @@ -2048,7 +2048,7 @@ bool ArsanoEntrance::interact(Action verb, Object &obj1, Object &obj2) { } } else { _gm->dialog(2, row3, _dialog3, 0); - _gm->reply(kStringArsanoEntrance10, 1, 1 + 128); + _gm->reply(kStringArsanoEntrance10, 1, 1 + kSectionInvert); } } } else if ((verb == ACTION_PRESS) && (obj1._id == BATHROOM_BUTTON)) { @@ -2349,7 +2349,7 @@ ArsanoRoger::ArsanoRoger(SupernovaEngine *vm, GameManager1 *gm) { void ArsanoRoger::onEntrance() { if (!sentenceRemoved(0, 2)) { _gm->say(kStringArsanoRoger1); - _gm->reply(kStringArsanoRoger2, 2, 2 + 128); + _gm->reply(kStringArsanoRoger2, 2, 2 + kSectionInvert); removeSentence(0, 2); } } @@ -2387,7 +2387,7 @@ bool ArsanoRoger::interact(Action verb, Object &obj1, Object &obj2) { _gm->great(0); return false; } - _gm->reply(kStringArsanoRoger3, 2, 2 + 128); + _gm->reply(kStringArsanoRoger3, 2, 2 + kSectionInvert); } else if ((verb == ACTION_USE) && (obj1._id == CUP)) _vm->renderMessage(kStringArsanoRoger4); else if ((verb == ACTION_TALK) && (obj1._id == ROGER_W)) { @@ -2396,40 +2396,40 @@ bool ArsanoRoger::interact(Action verb, Object &obj1, Object &obj2) { else { switch (_gm->dialog(4, row1, _dialog1, 1)) { case 0: - _gm->reply(kStringArsanoRoger6, 2, 2 + 128); - _gm->reply(kStringArsanoRoger7, 2, 2 + 128); + _gm->reply(kStringArsanoRoger6, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoRoger7, 2, 2 + kSectionInvert); break; case 1: - _gm->reply(kStringArsanoRoger8, 2, 2 + 128); - _gm->reply(kStringArsanoRoger9, 2, 2 + 128); + _gm->reply(kStringArsanoRoger8, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoRoger9, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger10); break; case 2: - _gm->reply(kStringArsanoRoger11, 2, 2 + 128); + _gm->reply(kStringArsanoRoger11, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger12); - _gm->reply(kStringArsanoRoger13, 2, 2 + 128); + _gm->reply(kStringArsanoRoger13, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger14); - _gm->reply(kStringArsanoRoger15, 2, 2 + 128); - _gm->reply(kStringArsanoRoger16, 2, 2 + 128); + _gm->reply(kStringArsanoRoger15, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoRoger16, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger17); _gm->say(kStringArsanoRoger18); - _gm->reply(kStringArsanoRoger19, 2, 2 + 128); + _gm->reply(kStringArsanoRoger19, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger20); _gm->say(kStringArsanoRoger21); - _gm->reply(kStringArsanoRoger22, 2, 2 + 128); + _gm->reply(kStringArsanoRoger22, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger23); - _gm->reply(kStringArsanoRoger24, 2, 2 + 128); - _gm->reply(kStringArsanoRoger25, 2, 2 + 128); + _gm->reply(kStringArsanoRoger24, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoRoger25, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger26); - _gm->reply(kStringArsanoRoger27, 2, 2 + 128); - _gm->reply(kStringArsanoRoger28, 2, 2 + 128); + _gm->reply(kStringArsanoRoger27, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoRoger28, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger29); - _gm->reply(kStringArsanoRoger30, 2, 2 + 128); - _gm->reply(kStringArsanoRoger31, 2, 2 + 128); + _gm->reply(kStringArsanoRoger30, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoRoger31, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger32); - _gm->reply(kStringArsanoRoger33, 2, 2 + 128); + _gm->reply(kStringArsanoRoger33, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger34); - _gm->reply(kStringArsanoRoger35, 2, 2 + 128); + _gm->reply(kStringArsanoRoger35, 2, 2 + kSectionInvert); } } } else if (((verb == ACTION_USE) && Object::combine(obj1, obj2, CHESS, ROGER_W)) || @@ -2437,7 +2437,7 @@ bool ArsanoRoger::interact(Action verb, Object &obj1, Object &obj2) { _vm->renderImage(11); _gm->great(0); _gm->say(kStringArsanoRoger36); - _gm->reply(kStringArsanoRoger37, 2, 2 + 128); + _gm->reply(kStringArsanoRoger37, 2, 2 + kSectionInvert); _gm->say(kStringArsanoRoger38); _vm->paletteFadeOut(); _gm->_inventory.remove(*_gm->_rooms[CABIN_R3]->getObject(0)); // Chess board @@ -2621,13 +2621,13 @@ bool ArsanoMeetup2::interact(Action verb, Object &obj1, Object &obj2) { _vm->paletteBrightness(); bool found; if (sentenceRemoved(0, 2) || sentenceRemoved(1, 2)) { - _gm->reply(kStringArsanoMeetup2_3, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup2_3, 1, 1 + kSectionInvert); found = !_gm->dialog(2, row4, _dialog4, 0); if (!(found)) - _gm->reply(kStringArsanoMeetup2_4, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup2_4, 1, 1 + kSectionInvert); } else { - _gm->reply(kStringArsanoMeetup2_5, 1, 1 + 128); - _gm->reply(kStringArsanoMeetup2_6, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup2_5, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoMeetup2_6, 1, 1 + kSectionInvert); found = !_gm->dialog(2, row1, _dialog1, 0); removeSentence(0, 2); } @@ -2635,15 +2635,15 @@ bool ArsanoMeetup2::interact(Action verb, Object &obj1, Object &obj2) { _gm->_inventory.remove(*_gm->_rooms[ROGER]->getObject(3)); _gm->_inventory.remove(*_gm->_rooms[ROGER]->getObject(7)); _gm->_inventory.remove(*_gm->_rooms[ROGER]->getObject(8)); - _gm->reply(kStringArsanoMeetup2_7, 1, 1 + 128); - _gm->reply(kStringArsanoMeetup2_8, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup2_7, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoMeetup2_8, 1, 1 + kSectionInvert); bool flight = _gm->dialog(2, row2, _dialog2, 0); if (flight) { - _gm->reply(kStringArsanoMeetup2_9, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup2_9, 1, 1 + kSectionInvert); _gm->dialog(4, row3, _dialog3, 0); - _gm->reply(kStringArsanoMeetup2_10, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup2_10, 1, 1 + kSectionInvert); } else - _gm->reply(kStringArsanoMeetup2_11, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup2_11, 1, 1 + kSectionInvert); _gm->changeRoom(MEETUP2); _gm->_rooms[MEETUP2]->setSectionVisible(12, false); @@ -2716,13 +2716,13 @@ void ArsanoMeetup2::shipStart() { _gm->wait(12); for (int i = 2; i <= 11; ++i) { if (i >= 9) - _vm->renderImage(i - 1 + 128); + _vm->renderImage(i - 1 + kSectionInvert); else setSectionVisible(i - 1, false); _vm->renderImage(i); _gm->wait(2); } - _vm->renderImage(11 + 128); + _vm->renderImage(11 + kSectionInvert); } ArsanoMeetup3::ArsanoMeetup3(SupernovaEngine *vm, GameManager1 *gm) { @@ -2792,55 +2792,55 @@ bool ArsanoMeetup3::interact(Action verb, Object &obj1, Object &obj2) { _vm->renderImage(0); _vm->paletteFadeIn(); _gm->wait(18); - _gm->reply(kStringArsanoMeetup3_1, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_1, 2, 2 + kSectionInvert); _gm->wait(10); - _gm->reply(kStringArsanoMeetup3_2, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup3_2, 1, 1 + kSectionInvert); do { int i = _gm->dialog(4, row2, _dialog2, 2); switch (i) { case 0: - _gm->reply(kStringArsanoMeetup3_3, 1, 1 + 128); - _gm->reply(kStringArsanoMeetup3_4, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup3_3, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_4, 1, 1 + kSectionInvert); break; case 1: - _gm->reply(kStringArsanoMeetup3_5, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_5, 2, 2 + kSectionInvert); _gm->say(kStringArsanoMeetup3_6); - _gm->reply(kStringArsanoMeetup3_7, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_8, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_9, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_10, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_11, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_7, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_8, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_9, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_10, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_11, 2, 2 + kSectionInvert); if (_gm->dialog(2, row3, _dialog3, 0)) { - _gm->reply(kStringArsanoMeetup3_12, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_12, 2, 2 + kSectionInvert); _gm->say(kStringArsanoMeetup3_13); } - _gm->reply(kStringArsanoMeetup3_14, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_15, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_16, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_17, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_14, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_15, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_16, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_17, 2, 2 + kSectionInvert); if (_gm->dialog(2, row3, _dialog3, 0)) { - _gm->reply(kStringArsanoMeetup3_12, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_12, 2, 2 + kSectionInvert); _gm->say(kStringArsanoMeetup3_13); } - _gm->reply(kStringArsanoMeetup3_18, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_18, 2, 2 + kSectionInvert); break; case 2: - _gm->reply(kStringArsanoMeetup3_19, 2, 2 + 128); - _gm->reply(kStringArsanoMeetup3_20, 2, 2 + 128); + _gm->reply(kStringArsanoMeetup3_19, 2, 2 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_20, 2, 2 + kSectionInvert); break; case 3: - _gm->reply(kStringArsanoMeetup3_21, 1, 1 + 128); - _gm->reply(kStringArsanoMeetup3_22, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup3_21, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_22, 1, 1 + kSectionInvert); _gm->say(kStringArsanoMeetup3_23); - _gm->reply(kStringArsanoMeetup3_24, 1, 1 + 128); - _gm->reply(kStringArsanoMeetup3_25, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup3_24, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_25, 1, 1 + kSectionInvert); } removeSentence(2, 2); } while (!allSentencesRemoved(4, 2)); _gm->say(kStringArsanoMeetup3_26); - _gm->reply(kStringArsanoMeetup3_27, 1, 1 + 128); - _gm->reply(kStringArsanoMeetup3_28, 1, 1 + 128); + _gm->reply(kStringArsanoMeetup3_27, 1, 1 + kSectionInvert); + _gm->reply(kStringArsanoMeetup3_28, 1, 1 + kSectionInvert); _vm->paletteFadeOut(); // Remove all objects from the inventory except the Knife, Watch and Discman bool has_knife = _gm->_rooms[INTRO1]->getObject(1)->hasProperty(CARRIED); @@ -2874,7 +2874,7 @@ AxacussCell::AxacussCell(SupernovaEngine *vm, GameManager1 *gm) { _shown[31] = kShownTrue; _objectState[0] = Object(_id, kStringButton,kStringDefaultDescription,CELL_BUTTON,PRESS,1,1,0); - _objectState[1] = Object(_id, kStringDoor,kStringDefaultDescription,CELL_DOOR,EXIT|OPENABLE|CLOSED,0,0,31+128,CORRIDOR4,1); + _objectState[1] = Object(_id, kStringDoor,kStringDefaultDescription,CELL_DOOR,EXIT|OPENABLE|CLOSED,0,0,31+kSectionInvert,CORRIDOR4,1); _objectState[2] = Object(_id, kStringTray,kStringTrayDescription,TRAY,UNNECESSARY,255,255,0); _objectState[3] = Object(_id, kStringLamp,kStringLampDescription,NULLOBJECT,COMBINABLE,3,3,0); _objectState[4] = Object(_id, kStringEyes,kStringEyesDescription,NULLOBJECT,NULLTYPE,4,4,0); @@ -2919,7 +2919,7 @@ void AxacussCell::animation() { getObject(0)->_click = 255; getObject(1)->resetProperty(EXIT | OPENABLE | OPENED | CLOSED); } else if ((_gm->_state._timeRobot >= 601) && (_gm->_state._timeRobot <= 620)) { - _vm->renderImage(_gm->_state._timeRobot - 593 + 128); + _vm->renderImage(_gm->_state._timeRobot - 593 + kSectionInvert); _vm->renderImage(_gm->_state._timeRobot - 592); } else if (_gm->_state._timeRobot == 621) { _vm->renderImage(31); @@ -2929,7 +2929,7 @@ void AxacussCell::animation() { } else if (_gm->_state._timeRobot == 700) _gm->_state._timeRobot = 0; else if (_gm->_state._timeRobot == 10002) { - _vm->renderImage(18 + 128); + _vm->renderImage(18 + kSectionInvert); _vm->renderImage(29); _vm->renderImage(7); getObject(2)->_click = 13; @@ -3127,9 +3127,7 @@ void AxacussCorridor3::onEntrance() { void AxacussCorridor4::onEntrance() { _gm->great(4); - if (_gm->_state._corridorSearch) - _gm->busted(0); - else if (_gm->_rooms[GUARD]->isSectionVisible(1)) + if (_gm->_state._corridorSearch || _gm->_rooms[GUARD]->isSectionVisible(1)) _gm->busted(0); } @@ -3229,7 +3227,7 @@ void AxacussCorridor5::onEntrance() { bool AxacussCorridor5::handleMoneyDialog() { if (_gm->dialog(2, _rows, _dialog2, 0) == 0) { - _gm->reply(kStringAxacussCorridor5_5, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_5, 1, 1 + kSectionInvert); addAllSentences(2); if (_gm->_state._money == 0) { removeSentence(2, 2); @@ -3257,14 +3255,14 @@ bool AxacussCorridor5::handleMoneyDialog() { stopInteract(_gm->_state._money - 200); return true; } - _gm->reply(kStringAxacussCorridor5_6, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_6, 1, 1 + kSectionInvert); break; case 3: if (_gm->_state._money >= 900) { stopInteract(_gm->_state._money); return true; } - _gm->reply(kStringAxacussCorridor5_6, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_6, 1, 1 + kSectionInvert); break; } } @@ -3272,7 +3270,7 @@ bool AxacussCorridor5::handleMoneyDialog() { } void AxacussCorridor5::stopInteract(int sum) { - _gm->reply(kStringAxacussCorridor5_7, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_7, 1, 1 + kSectionInvert); _gm->great(0); _gm->changeRoom(ELEVATOR); _gm->takeMoney(-sum); @@ -3285,16 +3283,16 @@ bool AxacussCorridor5::interact(Action verb, Object &obj1, Object &obj2) { _vm->renderImage(0); _vm->paletteBrightness(); if (_gm->_guiEnabled) { - _gm->reply(kStringAxacussCorridor5_1, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_1, 1, 1 + kSectionInvert); if (handleMoneyDialog()) return true; } else { _gm->_guiEnabled = true; - _gm->reply(kStringAxacussCorridor5_2, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_2, 1, 1 + kSectionInvert); if (_gm->dialog(2, _rows, _dialog1, 0)) - _gm->reply(kStringAxacussCorridor5_3, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_3, 1, 1 + kSectionInvert); else { - _gm->reply(kStringAxacussCorridor5_4, 1, 1 + 128); + _gm->reply(kStringAxacussCorridor5_4, 1, 1 + kSectionInvert); if (handleMoneyDialog()) return true; } @@ -3648,7 +3646,7 @@ bool AxacussExit::interact(Action verb, Object &obj1, Object &obj2) { if (i == 11) _vm->playSound(kAudioSmash); // 046/4020 _gm->wait(1); - _vm->renderImage(i + 128); + _vm->renderImage(i + kSectionInvert); } _gm->_state._powerOff = true; _objectState[5]._click = 255; @@ -3958,7 +3956,7 @@ bool AxacussElevator::interact(Action verb, Object &obj1, Object &obj2) { _vm->setCurrentImage(41); _vm->renderImage(0); _vm->paletteBrightness(); - _gm->reply(kStringAxacussElevator_1, 1, 1 + 128); + _gm->reply(kStringAxacussElevator_1, 1, 1 + kSectionInvert); _gm->say(kStringAxacussElevator_2); g_system->fillScreen(kColorBlack); } else if ((verb == ACTION_PRESS) && (obj1._id == BUTTON1)) { diff --git a/engines/supernova/supernova1/state.cpp b/engines/supernova/supernova1/state.cpp index 2dd2a1d08e..443053dadc 100644 --- a/engines/supernova/supernova1/state.cpp +++ b/engines/supernova/supernova1/state.cpp @@ -243,34 +243,7 @@ void GameManager1::destroyRooms() { } void GameManager1::initState() { - _currentInputObject = &_nullObject; - _inputObject[0] = &_nullObject; - _inputObject[1] = &_nullObject; - _inputVerb = ACTION_WALK; - _processInput = false; - _guiEnabled = true; - _animationEnabled = true; - _roomBrightness = 255; - _mouseClicked = false; - _keyPressed = false; - _mouseX = -1; - _mouseY = -1; - _mouseField = -1; - _inventoryScroll = 0; - _oldTime = g_system->getMillis(); - _timerPaused = 0; - _timePaused = false; - _messageDuration = 0; - _animationTimer = 0; - - _currentSentence = -1; - for (int i = 0 ; i < 6 ; ++i) { - _sentenceNumber[i] = -1; - _texts[i] = kNoString; - _rows[i] = 0; - _rowsStart[i] = 0; - } - + GameManager::initState(); _time = ticksToMsec(916364); // 2 pm _state._timeSleep = 0; _state._timeAlarm = ticksToMsec(458182); // 7 am @@ -294,9 +267,6 @@ void GameManager1::initState() { _state._cableConnected = false; _state._powerOff = false; _state._dream = false; - - _prevImgId = 0; - _dead = false; } void GameManager1::initRooms() { @@ -811,7 +781,7 @@ void GameManager1::guardReturnedEvent() { void GameManager1::walk(int imgId) { if (_prevImgId) - _vm->renderImage(_prevImgId + 128); + _vm->renderImage(_prevImgId + kSectionInvert); _vm->renderImage(imgId); _prevImgId = imgId; wait(3); @@ -852,7 +822,7 @@ void GameManager1::guardWalkEvent() { _vm->renderImage(imgId); if (!behind) { wait(3); - _vm->renderImage(_prevImgId + 128); + _vm->renderImage(_prevImgId + kSectionInvert); _sound->play(kAudioDoorClose); } @@ -916,14 +886,14 @@ void GameManager1::guardWalkEvent() { _vm->renderImage(_state._destination + 1); _sound->play(kAudioDoorOpen); wait(3); - _vm->renderImage(_prevImgId + 128); + _vm->renderImage(_prevImgId + kSectionInvert); wait(3); - _vm->renderImage(_state._destination + 1 + 128); + _vm->renderImage(_state._destination + 1 + kSectionInvert); _sound->play(kAudioDoorClose); _rooms[BCORRIDOR]->getObject(_state._destination + 4)->setProperty(OCCUPIED); _state._destination = 255; } else if (_rooms[BCORRIDOR]->isSectionVisible(_state._destination + 1)) { - _vm->renderImage(_prevImgId + 128); + _vm->renderImage(_prevImgId + kSectionInvert); _rooms[BCORRIDOR]->getObject(_state._destination + 4)->setProperty(OCCUPIED); SWAP(_state._origin, _state._destination); _state._eventTime = _time + ticksToMsec(60); diff --git a/engines/supernova/supernova2/rooms.cpp b/engines/supernova/supernova2/rooms.cpp index edfc3897e7..38d83b5fdb 100644 --- a/engines/supernova/supernova2/rooms.cpp +++ b/engines/supernova/supernova2/rooms.cpp @@ -224,7 +224,7 @@ bool Intro2::tvDialogue() { _vm->setCurrentImage(42); _vm->renderImage(0); - if(!_gm->talk(1, 1+128, 0, kMessageLeft, kStringIntroTV1)) + if(!_gm->talk(1, 1 + kSectionInvert, 0, kMessageLeft, kStringIntroTV1)) return false; _vm->renderImage(4); @@ -248,7 +248,7 @@ bool Intro2::tvDialogue() { if(!_gm->talk(8, 6, 0, kMessageLeft, kStringIntroTV4)) return false; - _vm->renderImage(10 + 128); + _vm->renderImage(10 + kSectionInvert); _gm->wait(3); _vm->renderImage(5); _gm->wait(3); @@ -263,19 +263,19 @@ bool Intro2::tvDialogue() { if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV7)) return false; - if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV8)) + if(!_gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringIntroTV8)) return false; - if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV9)) + if(!_gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringIntroTV9)) return false; if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV10)) return false; - if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV11)) + if(!_gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringIntroTV11)) return false; - if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV12)) + if(!_gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringIntroTV12)) return false; if(!_gm->talk(9, 7, 8, kMessageCenter, kStringIntroTV13)) @@ -286,7 +286,7 @@ bool Intro2::tvDialogue() { if(!_gm->talkRest(9, 7, 1)) return false; - _vm->renderImage(4 + 128); + _vm->renderImage(4 + kSectionInvert); if(!_gm->talkRest(9, 7, 3)) return false; @@ -303,10 +303,10 @@ bool Intro2::tvDialogue() { _vm->removeMessage(); - if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV14)) + if(!_gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringIntroTV14)) return false; - if(!_gm->talk(3, 3 + 128, 0, kMessageRight, kStringIntroTV15)) + if(!_gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringIntroTV15)) return false; if(!_gm->talk(9, 7, 0, kMessageCenter, kStringIntroTV16)) @@ -348,7 +348,7 @@ TaxiStand::TaxiStand(SupernovaEngine *vm, GameManager2 *gm) { _objectState[0] = Object(_id, kStringVehicle, kStringVehicleDescription, TAXI, NULLTYPE, 2, 2, 0, NULLROOM, 11); _objectState[1] = Object(_id, kStringVehicle, kStringVehicleDescription, NULLOBJECT, NULLTYPE, 1, 1, 0); _objectState[2] = Object(_id, kStringEntrance, kStringEntranceDescription, DOOR, EXIT | OPENABLE | CLOSED, 3, 3, 0, NULLROOM, 1); - _objectState[3] = Object(_id, kStringWallet, kStringWalletDescription, WALLET, TAKE, 0, 0, 7 + 128); + _objectState[3] = Object(_id, kStringWallet, kStringWalletDescription, WALLET, TAKE, 0, 0, 7 + kSectionInvert); _objectState[4] = Object(_id, kStringDevice, kStringDeviceDescription, TRANSMITTER, TAKE | PRESS, 255, 255, 0); _objectState[5] = Object(_id, kStringIdCard, kStringIdCardDescription, ID_CARD, TAKE | COMBINABLE, 255, 255, 0); _objectState[6] = Object(_id, kStringAirport, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, AIRPORT, 22); @@ -409,10 +409,10 @@ void Street::onEntrance() { void Street::animation() { static int ltab[36] = { - 8, 9 + 128, 10, 11 + 128, 6, 12, 13 + 128, 9, 14, 15 + 128, 19, - 16, 17 + 128, 9 + 128, 18, 19 + 128, 6 + 128, 20, 21 + 128, - 8 + 128, 9, 10 + 128, 11, 6, 12 + 128, 13, 14 + 128, 15, 19, - 16 + 128, 17, 18 + 128, 19 + 128, 6 + 128, 20 + 128, 21 + 8, 9 + kSectionInvert, 10, 11 + kSectionInvert, 6, 12, 13 + kSectionInvert, 9, 14, 15 + kSectionInvert, 19, + 16, 17 + kSectionInvert, 9 + kSectionInvert, 18, 19 + kSectionInvert, 6 + kSectionInvert, 20, 21 + kSectionInvert, + 8 + kSectionInvert, 9, 10 + kSectionInvert, 11, 6, 12 + kSectionInvert, 13, 14 + kSectionInvert, 15, 19, + 16 + kSectionInvert, 17, 18 + kSectionInvert, 19 + kSectionInvert, 6 + kSectionInvert, 20 + kSectionInvert, 21 }; static int i, banks, light; @@ -532,7 +532,7 @@ Cabin2::Cabin2(SupernovaEngine *vm, GameManager2 *gm) { _objectState[0] = Object(_id, kStringExit, kStringDefaultDescription, NULLOBJECT, EXIT, 255, 255, 0, GAMES, 22); _objectState[1] = Object(_id, kStringHood, kStringHoodDescription, NULLOBJECT, NULLTYPE, 0, 0, 0); _objectState[2] = Object(_id, kString400Xa, kStringDefaultDescription, PRIZE, TAKE, 255, 255, 2 + 180); - _objectState[3] = Object(_id, kString10Xa, kStringDefaultDescription, BACK_MONEY, TAKE, 255, 255, 2 + 128); + _objectState[3] = Object(_id, kString10Xa, kStringDefaultDescription, BACK_MONEY, TAKE, 255, 255, 2 + kSectionInvert); _objectState[4] = Object(_id, kStringSlot, kStringSlotDescription1, SLOT1, COMBINABLE, 2, 2, 0); _objectState[5] = Object(_id, kStringSlot, kStringSlotDescription2, NULLOBJECT, COMBINABLE, 3, 3, 0); _objectState[6] = Object(_id, kStringChair, kStringChairDescription, CHAIR, NULLTYPE, 4, 4, 0); @@ -549,7 +549,7 @@ void Cabin2::onEntrance() { void Cabin2::animation() { if (_shown[kMaxSection - 1]) { if (isSectionVisible(1)) - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); else _vm->renderImage(1); } @@ -606,11 +606,11 @@ bool Cabin2::interact(Action verb, Object &obj1, Object &obj2) { } else _vm->renderMessage(kStringRest); } else if (verb == ACTION_TAKE && obj1._id == PRIZE) { - _vm->renderImage(2 + 128); + _vm->renderImage(2 + kSectionInvert); obj1._click = 255; _gm->takeMoney(400); } else if (verb == ACTION_TAKE && obj1._id == BACK_MONEY) { - _vm->renderImage(2 + 128); + _vm->renderImage(2 + kSectionInvert); obj1._click = 255; _gm->takeMoney(10); } else if (verb == ACTION_LOOK && obj1._id == SCRIBBLE1) { @@ -655,13 +655,13 @@ Kiosk::Kiosk(SupernovaEngine *vm, GameManager2 *gm) { _objectState[1] = Object(_id, kStringBooks, kStringDefaultDescription, BOOKS, UNNECESSARY, 0, 0, 0); _objectState[2] = Object(_id, kStringDictionary, kStringDefaultDescription, LEXICON, UNNECESSARY, 1, 1, 0); _objectState[3] = Object(_id, kStringPlant, kStringDefaultDescription, PLANT, UNNECESSARY, 2, 2, 0); - _objectState[4] = Object(_id, kStringMask, kStringDefaultDescription, BMASK, UNNECESSARY, 4, 4, 2 + 128); + _objectState[4] = Object(_id, kStringMask, kStringDefaultDescription, BMASK, UNNECESSARY, 4, 4, 2 + kSectionInvert); _objectState[5] = Object(_id, kStringSnake, kStringDefaultDescription, SNAKE, UNNECESSARY, 3, 3, 0); _objectState[6] = Object(_id, kStringCup, kStringDefaultDescription, CUP, UNNECESSARY, 5, 5, 0); _objectState[7] = Object(_id, kStringJoystick, kStringDefaultDescription, JOYSTICK, UNNECESSARY, 6, 6, 0); - _objectState[8] = Object(_id, kStringToothbrush, kStringToothbrushDescription, TOOTHBRUSH, TAKE, 7, 7, 5 + 128); - _objectState[9] = Object(_id, kStringMusic, kStringMusicDescription, PLAYER, TAKE | COMBINABLE, 8, 8, 4 + 128); - _objectState[10] = Object(_id, kStringBottle, kStringBottleDescription, BOTTLE, TAKE, 9, 9, 3 + 128); + _objectState[8] = Object(_id, kStringToothbrush, kStringToothbrushDescription, TOOTHBRUSH, TAKE, 7, 7, 5 + kSectionInvert); + _objectState[9] = Object(_id, kStringMusic, kStringMusicDescription, PLAYER, TAKE | COMBINABLE, 8, 8, 4 + kSectionInvert); + _objectState[10] = Object(_id, kStringBottle, kStringBottleDescription, BOTTLE, TAKE, 9, 9, 3 + kSectionInvert); _objectState[11] = Object(_id, kStringBottle, kStringDefaultDescription, BOTTLE1, UNNECESSARY, 10, 10, 0); _objectState[12] = Object(_id, kStringBottle, kStringDefaultDescription, BOTTLE2, UNNECESSARY, 11, 11, 0); _objectState[13] = Object(_id, kStringBottle, kStringDefaultDescription, BOTTLE3, UNNECESSARY, 12, 12, 0); @@ -682,21 +682,21 @@ void Kiosk::onEntrance() { _vm->renderImage(6); _vm->playSound(kAudioKiosk); _gm->wait(8); - _vm->renderImage(6 + 128); - _gm->reply(kStringScaredMe, 1, 1 +128); + _vm->renderImage(6 + kSectionInvert); + _gm->reply(kStringScaredMe, 1, 1 + kSectionInvert); _gm->say(kStringHowSo); - _gm->reply(kStringDisguise, 1, 1 +128); + _gm->reply(kStringDisguise, 1, 1 + kSectionInvert); _gm->say(kStringWhatDisguise); - _gm->reply(kStringStopPretending, 1, 1 +128); - _gm->reply(kStringYouDisguised, 1, 1 +128); + _gm->reply(kStringStopPretending, 1, 1 + kSectionInvert); + _gm->reply(kStringYouDisguised, 1, 1 + kSectionInvert); _gm->say(kStringIAmHorstHummel); - _gm->reply(kStringGiveItUp, 1, 1 +128); - _gm->reply(kStringGestures, 1, 1 +128); - _gm->reply(kStringMovesDifferently, 1, 1 +128); + _gm->reply(kStringGiveItUp, 1, 1 + kSectionInvert); + _gm->reply(kStringGestures, 1, 1 + kSectionInvert); + _gm->reply(kStringMovesDifferently, 1, 1 + kSectionInvert); _gm->say(kStringHeIsRobot); - _gm->reply(kStringYouAreCrazy, 1, 1 +128); + _gm->reply(kStringYouAreCrazy, 1, 1 + kSectionInvert); _gm->say(kStringYouIdiot); - _gm->reply(kStringShutUp, 1, 1 +128); + _gm->reply(kStringShutUp, 1, 1 + kSectionInvert); _gm->drawGUI(); setRoomSeen(true); } @@ -753,7 +753,7 @@ bool Kiosk::interact(Action verb, Object &obj1, Object &obj2) { Common::String format = _vm->getGameString(kStringThatCosts); Common::String cost = Common::String::format(format.c_str(), price); _vm->renderMessage(cost, kMessageTop); - _gm->reply(cost.c_str(), 1, 1 +128); + _gm->reply(cost.c_str(), 1, 1 + kSectionInvert); if (_gm->_state._money < price) _gm->say(dialPrice[1]); @@ -764,7 +764,7 @@ bool Kiosk::interact(Action verb, Object &obj1, Object &obj2) { _gm->drawGUI(); } else if (verb == ACTION_LOOK && obj1._id >= BMASK && obj1._id <= FACES) { for(int i = 0; i < 3; i++) { - _gm->reply(dialSeller[obj1._id - BMASK][i], 1, 1 + 128); + _gm->reply(dialSeller[obj1._id - BMASK][i], 1, 1 + kSectionInvert); } } else if (verb == ACTION_TALK && obj1._id >= SELLER) { int i = 2; @@ -772,13 +772,13 @@ bool Kiosk::interact(Action verb, Object &obj1, Object &obj2) { i++; switch (_gm->dialog(i, _gm->_dials, dialSay, 0)) { case 0: - _gm->reply(kStringTakeALook, 1, 1 + 128); + _gm->reply(kStringTakeALook, 1, 1 + kSectionInvert); break; case 1: - _gm->reply(kStringNonsense, 1, 1 + 128); + _gm->reply(kStringNonsense, 1, 1 + kSectionInvert); break; case 2: - _gm->reply(kStringImSorry, 1, 1 + 128); + _gm->reply(kStringImSorry, 1, 1 + kSectionInvert); break; } _gm->drawGUI(); @@ -828,7 +828,7 @@ void CulturePalace::animation() { void CulturePalace::notEnoughMoney() { _gm->reply(kStringWhat, 2, 1); _gm->reply(kStringNotInformed, 2, 1); - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); setSectionVisible(2, kShownFalse); } @@ -897,7 +897,7 @@ bool CulturePalace::interact(Action verb, Object &obj1, Object &obj2) { break; } } - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); setSectionVisible(2, kShownFalse); _gm->drawGUI(); } @@ -916,7 +916,7 @@ bool CulturePalace::interact(Action verb, Object &obj1, Object &obj2) { else _gm->takeMoney(-10000); _gm->takeObject(*getObject(4)); - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); setSectionVisible(2, false); _gm->reply(kStringIdiot, 0, 0); _shown[kMaxSection - 2] = false; @@ -951,11 +951,11 @@ Checkout::Checkout(SupernovaEngine *vm, GameManager2 *gm) { void Checkout::onEntrance() { if (!_shown[kMaxSection - 3]) { _shown[kMaxSection - 3] = true; - _gm->reply(kStringAtMusicContest, 1, 1 + 128); + _gm->reply(kStringAtMusicContest, 1, 1 + kSectionInvert); _gm->say(kStringNoImitation); - _gm->reply(kStringGoodJoke, 1, 1 + 128); + _gm->reply(kStringGoodJoke, 1, 1 + kSectionInvert); _gm->say(kStringIAmHorstHummel); - _gm->reply(kStringCommon, 1, 1 + 128); + _gm->reply(kStringCommon, 1, 1 + kSectionInvert); _gm->say(kStringIWillProof); _gm->say(kStringIWillPerform); _gm->drawGUI(); @@ -998,11 +998,11 @@ bool Checkout::interact(Action verb, Object &obj1, Object &obj2) { if (_shown[kMaxSection - 4]) { _vm->renderImage(2); _gm->reply(kStringCheckout14, 0, 0); - _vm->renderImage(2 + 128); + _vm->renderImage(2 + kSectionInvert); } else if (_shown[kMaxSection - 2] == 0) { _vm->renderImage(2); _gm->reply(kStringCheckout15, 0, 0); - _vm->renderImage(2 + 128); + _vm->renderImage(2 + kSectionInvert); if (_gm->_rooms[CULTURE_PALACE]->getObject(4)->_type & CARRIED) { _gm->say(kStringCheckout16); _gm->reply(kStringCheckout17, 0, 0); @@ -1010,7 +1010,7 @@ bool Checkout::interact(Action verb, Object &obj1, Object &obj2) { _gm->say(kStringCheckout18); _gm->drawGUI(); } else if (_shown[kMaxSection - 2] == 1) { - _gm->reply(kStringCheckout19, 1, 1 + 128); + _gm->reply(kStringCheckout19, 1, 1 + kSectionInvert); } else { if (_gm->_state._tipsy) { _vm->setCurrentImage(22); @@ -1089,25 +1089,25 @@ bool Checkout::interact(Action verb, Object &obj1, Object &obj2) { _shown[kMaxSection - 2] == 1) { _gm->_inventory.remove(obj1); _shown[kMaxSection - 5] = true; - _gm->reply(kStringCheckout37, 1, 1 + 128); + _gm->reply(kStringCheckout37, 1, 1 + kSectionInvert); _shown[kMaxSection - 2] = 2; _gm->drawGUI(); } else if (verb == ACTION_GIVE && obj1._id == CARD && obj2._id == AXACUSSER) { _gm->_inventory.remove(*_gm->_rooms[CULTURE_PALACE]->getObject(4)); - _gm->reply(kStringCheckout34, 1, 1 + 128); - _gm->reply(kStringCheckout35, 1, 1 + 128); + _gm->reply(kStringCheckout34, 1, 1 + kSectionInvert); + _gm->reply(kStringCheckout35, 1, 1 + kSectionInvert); if (_gm->dialog(2, _gm->_dials, dialCheckout2, 0) == 1) { - _gm->reply(kStringCheckout36, 1, 1 + 128); + _gm->reply(kStringCheckout36, 1, 1 + kSectionInvert); _shown[kMaxSection - 2] = 1; } else { - _gm->reply(kStringCheckout37, 1, 1 + 128); + _gm->reply(kStringCheckout37, 1, 1 + kSectionInvert); _shown[kMaxSection - 2] = 2; } _gm->drawGUI(); } else if (verb == ACTION_TALK && obj1._id == AXACUSSER) { if (_shown[kMaxSection - 4]) { _gm->say(kStringCheckout38); - _gm->reply(kStringCheckout39, 1, 1 + 128); + _gm->reply(kStringCheckout39, 1, 1 + kSectionInvert); _gm->drawGUI(); } else { switch (_shown[kMaxSection - 2]) { @@ -1115,13 +1115,13 @@ bool Checkout::interact(Action verb, Object &obj1, Object &obj2) { addSentence(2, 1); switch (_gm->dialog(3, _gm->_dials, dialCheckout1, 1)) { case 0: - _gm->reply(kStringCheckout40, 1, 1 + 128); + _gm->reply(kStringCheckout40, 1, 1 + kSectionInvert); _gm->say(kStringNo2); - _gm->reply(kStringCheckout41, 1, 1 + 128); + _gm->reply(kStringCheckout41, 1, 1 + kSectionInvert); _gm->say(kStringCheckout42); break; case 1: - _gm->reply(kStringCheckout43, 1, 1 + 128); + _gm->reply(kStringCheckout43, 1, 1 + kSectionInvert); if (_gm->_rooms[CULTURE_PALACE]->getObject(4)->_type & CARRIED) { _gm->say(kStringCheckout44); return interact(ACTION_GIVE, @@ -1129,21 +1129,21 @@ bool Checkout::interact(Action verb, Object &obj1, Object &obj2) { *_gm->_rooms[CHECKOUT]->getObject(2)); } else { _gm->say(kStringNo2); - _gm->reply(kStringCheckout45, 1, 1 + 128); + _gm->reply(kStringCheckout45, 1, 1 + kSectionInvert); _gm->say(kStringCheckout46); } break; case 2: - _gm->reply(kStringCheckout47, 1, 1 + 128); + _gm->reply(kStringCheckout47, 1, 1 + kSectionInvert); break; } _gm->drawGUI(); break; case 1: - _gm->reply(kStringCheckout48, 1, 1 + 128); + _gm->reply(kStringCheckout48, 1, 1 + kSectionInvert); break; case 2: - _gm->reply(kStringCheckout49, 1, 1 + 128); + _gm->reply(kStringCheckout49, 1, 1 + kSectionInvert); break; } } @@ -1278,38 +1278,38 @@ void Checkout::appearance() { _vm->setCurrentImage(42); _vm->renderImage(0); _vm->renderImage(11); - _gm->talk(1, 1 + 128, 0, kMessageLeft, kStringAppearance1); - _gm->talk(1, 1 + 128, 0, kMessageLeft, kStringAppearance2); + _gm->talk(1, 1 + kSectionInvert, 0, kMessageLeft, kStringAppearance1); + _gm->talk(1, 1 + kSectionInvert, 0, kMessageLeft, kStringAppearance2); _vm->renderImage(4); _gm->wait(3); _vm->renderImage(6); _gm->talk(8, 6, 0, kMessageLeft, kStringAppearance3); _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance4); _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance5); - _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance6); + _gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringAppearance6); _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance7); _gm->talk(8, 6, 0, kMessageLeft, kStringAppearance8); _gm->talk(12, 13, 4, kMessageCenter, kStringAppearance9); _vm->renderImage(4); _gm->talkRest(12, 13, 1); - _vm->renderImage(4 + 128); + _vm->renderImage(4 + kSectionInvert); _gm->talkRest(12, 13, 4); _vm->renderImage(4); _gm->talkRest(12, 13, 1); _vm->renderImage(6); _gm->talkRest(12, 13, _gm->_restTime + 6); _vm->removeMessage(); - _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance10); + _gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringAppearance10); _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance11); _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance12); - _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance13); + _gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringAppearance13); _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance14); _gm->talk(12, 13, 0, kMessageCenter, kStringAppearance15); - _gm->talk(3, 3 + 128, 0, kMessageRight, kStringAppearance16); + _gm->talk(3, 3 + kSectionInvert, 0, kMessageRight, kStringAppearance16); _gm->talk(12, 13, 2, kMessageCenter, kStringAppearance17); _vm->renderImage(4); _gm->talkRest(12, 13, 1); - _vm->renderImage(4 + 128); + _vm->renderImage(4 + kSectionInvert); _gm->talkRest(12, 13, 4); _vm->renderImage(4); _gm->talkRest(12, 13, 1); @@ -1320,7 +1320,7 @@ void Checkout::appearance() { _gm->talk(12, 13, 1, kMessageCenter, kStringAppearance19); _vm->renderImage(4); _gm->talkRest(12, 13, 1); - _vm->renderImage(4 + 128); + _vm->renderImage(4 + kSectionInvert); _gm->talkRest(12, 13, 4); _vm->renderImage(4); _gm->talkRest(12, 13, 1); @@ -1340,31 +1340,31 @@ void Checkout::appearance() { _vm->renderImage(21); _vm->renderImage(19); _gm->wait(1); - _vm->renderImage(21+128); + _vm->renderImage(21 + kSectionInvert); _vm->renderImage(22); _vm->renderImage(18); _gm->wait(1); - _vm->renderImage(22+128); + _vm->renderImage(22 + kSectionInvert); _vm->renderImage(23); _gm->wait(1); - _vm->renderImage(23+128); + _vm->renderImage(23 + kSectionInvert); _vm->renderImage(24); _vm->renderImage(17); _gm->wait(1); - _vm->renderImage(24+128); + _vm->renderImage(24 + kSectionInvert); _vm->renderImage(25); _gm->wait(1); - _vm->renderImage(25+128); + _vm->renderImage(25 + kSectionInvert); _vm->renderImage(32); _vm->renderImage(11); _vm->renderImage(26); _vm->playSound(kAudioAppearance3); _gm->wait(2); - _vm->renderImage(32+128); + _vm->renderImage(32 + kSectionInvert); _vm->renderImage(33); _vm->renderImage(27); _gm->wait(2); - _vm->renderImage(33+128); + _vm->renderImage(33 + kSectionInvert); _vm->renderImage(34); _vm->renderImage(28); _gm->wait(2); @@ -1412,7 +1412,7 @@ void Checkout::appearance() { do { _vm->renderImage(1); _gm->wait(1); - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); image->_section[1].x1 += xp; image->_section[1].x2 += xp; image->_section[1].y1 -= 2; @@ -1579,7 +1579,7 @@ bool Elevator2::interact(Action verb, Object &obj1, Object &obj2) { _vm->playSound(kAudioElevatorBell); while(_vm->_sound->isPlaying()) _gm->wait(1); - _vm->renderImage(8 + 128); + _vm->renderImage(8 + kSectionInvert); if (_gm->_state._elevatorNumber == 4 && _gm->_state._elevatorE == 4 && !_gm->_state._toMuseum) { _gm->wait(18); _vm->renderImage(1); @@ -1599,7 +1599,7 @@ bool Elevator2::interact(Action verb, Object &obj1, Object &obj2) { _vm->renderImage(1); setSectionVisible(2, kShownFalse); _gm->wait(3); - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); _vm->renderMessage(kStringElevator12); _gm->waitOnInput(_gm->_messageDuration); _vm->removeMessage(); @@ -1623,23 +1623,23 @@ bool Elevator2::interact(Action verb, Object &obj1, Object &obj2) { _vm->setCurrentImage(26); _vm->renderImage(0); _vm->paletteFadeIn(); - _gm->reply(kStringElevator15, 1, 1 + 128); + _gm->reply(kStringElevator15, 1, 1 + kSectionInvert); _gm->say(kStringYes2); - _gm->reply(kStringElevator16, 1, 1 + 128); - _gm->reply(kStringElevator17, 1, 1 + 128); + _gm->reply(kStringElevator16, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator17, 1, 1 + kSectionInvert); if (_gm->dialog(2, _gm->_dials, dialBoss1, 0)) { - _gm->reply(kStringElevator18, 1, 1 + 128); - _gm->reply(kStringElevator19, 1, 1 + 128); + _gm->reply(kStringElevator18, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator19, 1, 1 + kSectionInvert); _gm->say(kStringElevator20); } - _gm->reply(kStringElevator21, 1, 1 + 128); - _gm->reply(kStringElevator22, 1, 1 + 128); - _gm->reply(kStringElevator23, 1, 1 + 128); - _gm->reply(kStringElevator24, 1, 1 + 128); - _gm->reply(kStringElevator25, 1, 1 + 128); - _gm->reply(kStringElevator26, 1, 1 + 128); - _gm->reply(kStringElevator27, 1, 1 + 128); - _gm->reply(kStringElevator28, 1, 1 + 128); + _gm->reply(kStringElevator21, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator22, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator23, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator24, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator25, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator26, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator27, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator28, 1, 1 + kSectionInvert); jobDescription(); return true; case 1: @@ -1650,7 +1650,7 @@ bool Elevator2::interact(Action verb, Object &obj1, Object &obj2) { _gm->wait(3); _vm->renderImage(1); setSectionVisible(2, kShownFalse); - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); break; case 2: _gm->reply(kStringElevator60, 4, 3); @@ -1660,7 +1660,7 @@ bool Elevator2::interact(Action verb, Object &obj1, Object &obj2) { _gm->wait(3); _vm->renderImage(1); setSectionVisible(2, kShownFalse); - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); break; } _gm->drawGUI(); @@ -1685,7 +1685,7 @@ bool Elevator2::interact(Action verb, Object &obj1, Object &obj2) { _vm->renderMessage(kStringElevator63); else if (number != _gm->_state._elevatorE) { if (isSectionVisible(6)) { - _vm->renderImage(6 + 128); + _vm->renderImage(6 + kSectionInvert); _objectState[4]._type &= ~OPENED; _vm->playSound(kAudioElevator1); } @@ -1717,10 +1717,10 @@ void Elevator2::jobDescription() { }; byte dialsBoss2[4] = {1,1,1,1}; - _gm->reply(kStringElevator29, 1, 1 + 128); - _gm->reply(kStringElevator30, 1, 1 + 128); - _gm->reply(kStringElevator31, 1, 1 + 128); - _gm->reply(kStringElevator32, 1, 1 + 128); + _gm->reply(kStringElevator29, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator30, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator31, 1, 1 + kSectionInvert); + _gm->reply(kStringElevator32, 1, 1 + kSectionInvert); _vm->setCurrentImage(30); _vm->renderImage(0); _gm->waitOnInput(72); @@ -1743,26 +1743,26 @@ void Elevator2::jobDescription() { _vm->setCurrentImage(26); _vm->_system->fillScreen(kColorBlack); _vm->renderImage(0); - _gm->reply(kStringElevator49, 1, 1 + 128); + _gm->reply(kStringElevator49, 1, 1 + kSectionInvert); int e; do { addSentence(0, 2); switch (e = _gm->dialog(4, dialsBoss2, dialBoss2, 2)) { case 0: - _gm->reply(kStringElevator50, 1, 1 + 128); + _gm->reply(kStringElevator50, 1, 1 + kSectionInvert); jobDescription(); return; case 1: - _gm->reply(kStringElevator51, 1, 1 + 128); + _gm->reply(kStringElevator51, 1, 1 + kSectionInvert); break; case 2: - _gm->reply(kStringElevator52, 1, 1 + 128); + _gm->reply(kStringElevator52, 1, 1 + kSectionInvert); break; } if (e == 1 || e == 2) - _gm->reply(kStringElevator53, 1, 1 + 128); + _gm->reply(kStringElevator53, 1, 1 + kSectionInvert); } while (e != 3); - _gm->reply(kStringElevator54, 1, 1 + 128); + _gm->reply(kStringElevator54, 1, 1 + kSectionInvert); _vm->paletteFadeOut(); _vm->_system->fillScreen(kColorBlack); _vm->_screen->setViewportBrightness(255); @@ -1810,7 +1810,7 @@ Apartment::Apartment(SupernovaEngine *vm, GameManager2 *gm) { _objectState[3] = Object(_id, kStringMusicSystem, kStringMusicSystemDescription, MUSIC_SYSTEM, COMBINABLE, 4, 4, 0); _objectState[4] = Object(_id, kStringSpeakers, kStringSpeakersDescription, NULLOBJECT, NULLTYPE, 5, 5, 0); _objectState[5] = Object(_id, kStringPencils, kStringPencilsDescription, NULLOBJECT, UNNECESSARY, 6, 6, 0); - _objectState[6] = Object(_id, kStringMetalBlocks, kStringMetalBlocksDescription, MAGNET, TAKE | COMBINABLE, 10, 10, 3 + 128); + _objectState[6] = Object(_id, kStringMetalBlocks, kStringMetalBlocksDescription, MAGNET, TAKE | COMBINABLE, 10, 10, 3 + kSectionInvert); _objectState[7] = Object(_id, kStringImage, kStringImageDescription, NULLOBJECT, UNNECESSARY, 7, 7, 0); _objectState[8] = Object(_id, kStringCabinet, kStringCabinetDescription, CABINET, OPENABLE | CLOSED, 8, 8, 0); _objectState[9] = Object(_id, kStringChair, kStringDefaultDescription, NULLOBJECT, NULLTYPE, 9, 9, 0); @@ -1854,7 +1854,7 @@ bool Apartment::interact(Action verb, Object &obj1, Object &obj2) { } } } else if (verb == ACTION_CLOSE && obj1._id == HATCH && obj1._type & OPENED) { - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); setSectionVisible(2, false); _vm->playSound(kAudioElevator1); obj1._type &= ~OPENED; @@ -1890,7 +1890,7 @@ Ship::Ship(SupernovaEngine *vm, GameManager2 *gm) { _objectState[3] = Object(_id, kStringSwitch, kStringDefaultDescription, DOOR_SWITCH, PRESS | COMBINABLE, 255, 255, 0); _objectState[4] = Object(_id, kStringSpaceSuit, kStringSpaceSuitDescription, SUIT, TAKE, 255, 255, 1); _objectState[5] = Object(_id, kStringCable, kStringCableDescription1, RCABLE, COMBINABLE, 255, 255, 0); - _objectState[6] = Object(_id, kStringCable, kStringCableDescription2, CABLE, TAKE | COMBINABLE, 255, 255, 8 + 128); + _objectState[6] = Object(_id, kStringCable, kStringCableDescription2, CABLE, TAKE | COMBINABLE, 255, 255, 8 + kSectionInvert); _outroText = _vm->getGameString(kStringIntro1) + '\0' + @@ -1945,7 +1945,7 @@ bool Ship::interact(Action verb, Object &obj1, Object &obj2) { _vm->playSound(kAudioShip1); while (_vm->_sound->isPlaying() && !_vm->shouldQuit()) _gm->wait(1); - _vm->renderImage(6 + 128); + _vm->renderImage(6 + kSectionInvert); _vm->renderImage(7); _objectState[3]._description = kStringShip1; _objectState[2]._description = kStringShip2; @@ -1969,13 +1969,13 @@ bool Ship::interact(Action verb, Object &obj1, Object &obj2) { } else if (verb == ACTION_USE && Object::combine(obj1, obj2, CABLE, RCABLE)) { _objectState[6]._description = kStringDefaultDescription; if (_objectState[6]._click == 5) - _vm->renderImage(8 + 128); + _vm->renderImage(8 + kSectionInvert); if (_objectState[6]._type & CARRIED) _gm->_inventory.remove(_objectState[6]); if (isSectionVisible(11) || isSectionVisible(10)) _vm->renderMessage(kStringShip5); else if (isSectionVisible(9)) { - _vm->renderImage(9 + 128); + _vm->renderImage(9 + kSectionInvert); _vm->renderImage(11); if (!_shown[kMaxSection - 1]) { kill(); @@ -2000,13 +2000,13 @@ bool Ship::interact(Action verb, Object &obj1, Object &obj2) { } else if (verb == ACTION_USE && Object::combine(obj1, obj2, CABLE, DOOR_SWITCH) && isSectionVisible(7)) { _objectState[6]._description = kStringDefaultDescription; if (_objectState[6]._click == 5) - _vm->renderImage(8 + 128); + _vm->renderImage(8 + kSectionInvert); if (_objectState[6]._type & CARRIED) _gm->_inventory.remove(_objectState[6]); if (isSectionVisible(11) || isSectionVisible(9)) _vm->renderMessage(kStringShip5); else if (isSectionVisible(10)) { - _vm->renderImage(10 + 128); + _vm->renderImage(10 + kSectionInvert); _vm->renderImage(11); if (!_shown[kMaxSection - 1]) { kill(); @@ -2037,27 +2037,27 @@ bool Ship::interact(Action verb, Object &obj1, Object &obj2) { _vm->renderMessage(kStringShip7, kMessageRight); _gm->waitOnInput(_gm->_messageDuration); _vm->removeMessage(); - _gm->reply(kStringShip8, 1, 1 + 128); + _gm->reply(kStringShip8, 1, 1 + kSectionInvert); _vm->renderMessage(kStringShip9, kMessageRight); _gm->waitOnInput(_gm->_messageDuration); _vm->removeMessage(); - _gm->reply(kStringShip10, 1, 1 + 128); - _gm->reply(kStringShip11, 1, 1 + 128); - _gm->reply(kStringShip12, 1, 1 + 128); - _gm->reply(kStringShip13, 1, 1 + 128); + _gm->reply(kStringShip10, 1, 1 + kSectionInvert); + _gm->reply(kStringShip11, 1, 1 + kSectionInvert); + _gm->reply(kStringShip12, 1, 1 + kSectionInvert); + _gm->reply(kStringShip13, 1, 1 + kSectionInvert); _vm->renderMessage(kStringShip14, kMessageRight); _gm->waitOnInput(_gm->_messageDuration); _vm->removeMessage(); - _gm->reply(kStringShip15, 1, 1 + 128); + _gm->reply(kStringShip15, 1, 1 + kSectionInvert); _vm->renderMessage(kStringShip16, kMessageRight); _gm->waitOnInput(_gm->_messageDuration); _vm->removeMessage(); - _gm->reply(kStringAha, 1, 1 + 128); - _gm->reply(kStringShip17, 1, 1 + 128); + _gm->reply(kStringAha, 1, 1 + kSectionInvert); + _gm->reply(kStringShip17, 1, 1 + kSectionInvert); _vm->renderMessage(kStringShip18, kMessageRight); _gm->waitOnInput(_gm->_messageDuration); _vm->removeMessage(); - _gm->reply(kStringShip19, 1, 1 + 128); + _gm->reply(kStringShip19, 1, 1 + kSectionInvert); _gm->wait(16); CursorMan.showMouse(false); _vm->renderImage(2); @@ -2066,7 +2066,7 @@ bool Ship::interact(Action verb, Object &obj1, Object &obj2) { if (i == 9) _vm->playSound(kAudioShip3); _gm->wait(2); - _vm->renderImage(i + 128); + _vm->renderImage(i + kSectionInvert); } _vm->renderImage(12); _gm->wait(18); @@ -2142,7 +2142,7 @@ Pyramid::Pyramid(SupernovaEngine *vm, GameManager2 *gm) { _id = PYRAMID; _shown[0] = kShownTrue; - _objectState[0] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, TAKE | COMBINABLE, 255, 255, 1 + 128); + _objectState[0] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, TAKE | COMBINABLE, 255, 255, 1 + kSectionInvert); _objectState[1] = Object(_id, kStringSign, kStringSignDescription, SIGN, COMBINABLE, 25, 25, 0); _objectState[2] = Object(_id, kStringEntrance, kStringEntrance1Description, PYRA_ENTRANCE, EXIT, 27, 27, 0, PYR_ENTRANCE, 7); _objectState[3] = Object(_id, kStringPyramid, kStringPyramidDescription, NULLOBJECT, NULLTYPE, 26, 26, 0); @@ -2216,7 +2216,7 @@ bool Pyramid::interact(Action verb, Object &obj1, Object &obj2) { int number = hole->_id - HOLE1; int start = number / 5 * 5 + 2; for (int i = 1; i <= 26; i++) - _vm->renderImage(i + 128); + _vm->renderImage(i + kSectionInvert); for (int i = start; i <= start + number % 5; i++) _vm->renderImage(i); _objectState[0]._click = 30; @@ -2233,7 +2233,7 @@ bool Pyramid::interact(Action verb, Object &obj1, Object &obj2) { } else if (verb == ACTION_PULL && rope != nullptr && !(rope->_type & CARRIED) && !isSectionVisible(1)) { for (int i = 2; i <= 26; i++) - _vm->renderImage(i + 128); + _vm->renderImage(i + kSectionInvert); _vm->renderImage(1); _objectState[0]._click = 29; _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse); @@ -2241,7 +2241,7 @@ bool Pyramid::interact(Action verb, Object &obj1, Object &obj2) { _gm->_rooms[HOLE_ROOM]->getObject(3)->_type = NULLTYPE; } else if (verb == ACTION_TAKE && rope != nullptr && !(rope->_type & CARRIED)) { for (int i = 2; i <= 26; i++) - _vm->renderImage(i + 128); + _vm->renderImage(i + kSectionInvert); _gm->takeObject(*rope); _gm->_rooms[HOLE_ROOM]->setSectionVisible(16, kShownFalse); _gm->_rooms[HOLE_ROOM]->getObject(2)->_click = 255; @@ -2745,7 +2745,7 @@ bool PuzzleFront::interact(Action verb, Object &obj1, Object &obj2) { return true; } int a = _gm->_puzzleField[pos] + 1; - _vm->renderImage(a + 128); + _vm->renderImage(a + kSectionInvert); image->_section[a].x1 = 95 + (newPos % 4) * 33; image->_section[a].x2 = image->_section[a].x1 + 31; image->_section[a].y1 = 24 + (newPos / 4) * 25; @@ -3366,7 +3366,7 @@ InHole::InHole(SupernovaEngine *vm, GameManager2 *gm) { _shown[0] = kShownTrue; _objectState[0] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, EXIT, 0, 0, 0, HOLE_ROOM, 2); - _objectState[1] = Object(_id, kStringNote, kStringNoteDescription1, NULLOBJECT, TAKE, 255, 255, 1 + 128); + _objectState[1] = Object(_id, kStringNote, kStringNoteDescription1, NULLOBJECT, TAKE, 255, 255, 1 + kSectionInvert); _objectState[2] = Object(_id, kStringSlot, kStringSlotDescription3, SLOT, COMBINABLE, 1, 1, 0); } @@ -3408,7 +3408,7 @@ Floordoor::Floordoor(SupernovaEngine *vm, GameManager2 *gm) { _objectState[0] = Object(_id, kStringRight, kStringDefaultDescription, G_RIGHT, EXIT, 12, 12, 0, PYR_ENTRANCE, 14); _objectState[1] = Object(_id, kStringLeft, kStringDefaultDescription, G_LEFT, EXIT, 11, 11, 0, PYR_ENTRANCE, 10); _objectState[2] = Object(_id, kStringKnife1, kStringDefaultDescription, TKNIFE, TAKE | COMBINABLE, 255, 255, 9); - _objectState[3] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, TAKE, 255, 255, 11+128); + _objectState[3] = Object(_id, kStringRope, kStringDefaultDescription, ROPE, TAKE, 255, 255, 11 + kSectionInvert); _objectState[4] = Object(_id, kStringOpening, kStringOpeningDescription3, HOLE, EXIT, 4, 4, 0, FLOORDOOR_U, 12); _objectState[5] = Object(_id, kStringStones, kStringDefaultDescription, STONES, COMBINABLE, 5, 5, 0); } @@ -3578,7 +3578,7 @@ bool BstDoor::interact(Action verb, Object &obj1, Object &obj2) { && obj1._id >= BST1 && obj1._id <= BST16) { int number = obj1._id - (BST1 - 1); if (isSectionVisible(number)) - _vm->renderImage(number + 128); + _vm->renderImage(number + kSectionInvert); else _vm->renderImage(number); _vm->playSound(kAudioTaxiOpen); @@ -3728,9 +3728,9 @@ bool Mask::interact(Action verb, Object &obj1, Object &obj2) { else _vm->renderImage(obj1._id - EYE1 + 1); if (isSectionVisible(1) && isSectionVisible(2)) { - _gm->reply(kStringPyramid17, 3, 3 + 128); - _gm->reply(kStringPyramid18, 3, 3 + 128); - _gm->reply(kStringPyramid19, 3, 3 + 128); + _gm->reply(kStringPyramid17, 3, 3 + kSectionInvert); + _gm->reply(kStringPyramid18, 3, 3 + kSectionInvert); + _gm->reply(kStringPyramid19, 3, 3 + kSectionInvert); _vm->playSound(kAudioAppearance1); while(_vm->_sound->isPlaying()) _gm->wait(1); @@ -3791,14 +3791,14 @@ void Museum::onEntrance() { _vm->renderImage(0); _vm->paletteFadeIn(); if (hasDinosaurHead) { - _gm->reply(kStringMuseum3, 1, 1 + 128); - _gm->reply(kStringMuseum4, 1, 1 + 128); + _gm->reply(kStringMuseum3, 1, 1 + kSectionInvert); + _gm->reply(kStringMuseum4, 1, 1 + kSectionInvert); _gm->takeMoney(30000); _vm->playSound(kAudioAppearance1); } else { - _gm->reply(kStringMuseum5, 1, 1 + 128); + _gm->reply(kStringMuseum5, 1, 1 + kSectionInvert); _gm->say(kStringMuseum23); - _gm->reply(kStringMuseum24, 1, 1 + 128); + _gm->reply(kStringMuseum24, 1, 1 + kSectionInvert); } _vm->paletteFadeOut(); _gm->changeRoom(CITY2); @@ -3860,7 +3860,7 @@ bool Museum::interact(Action verb, Object &obj1, Object &obj2) { _vm->playSound(kAudioTaxiOpen); } } else if (verb == ACTION_CLOSE && obj1._id == DOOR && (obj1._type & OPENED)) { - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); _objectState[2]._type = EXIT | OPENABLE | CLOSED; _vm->playSound(kAudioElevator1); } else if (verb == ACTION_USE && @@ -3910,7 +3910,7 @@ bool MusEntrance::interact(Action verb, Object &obj1, Object &obj2) { return true; } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR && (obj1._type & OPENED)) { - _vm->renderImage(2 + 128); + _vm->renderImage(2 + kSectionInvert); _objectState[0]._type = EXIT | OPENABLE | CLOSED; _vm->playSound(kAudioElevator1); return true; @@ -4088,7 +4088,7 @@ bool Mus5::interact(Action verb, Object &obj1, Object &obj2) { } } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR && (obj1._type & OPENED)) { - _vm->renderImage(8 + 128); + _vm->renderImage(8 + kSectionInvert); _objectState[1]._type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS6]->getObject(0)->_type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS6]->setSectionVisible(7, kShownFalse); @@ -4138,7 +4138,7 @@ bool Mus6::interact(Action verb, Object &obj1, Object &obj2) { } } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR && (obj1._type & OPENED)) { - _vm->renderImage(7 + 128); + _vm->renderImage(7 + kSectionInvert); _objectState[0]._type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS5]->getObject(1)->_type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS5]->setSectionVisible(8, kShownFalse); @@ -4219,7 +4219,7 @@ bool Mus8::interact(Action verb, Object &obj1, Object &obj2) { } } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR && (obj1._type & OPENED)) { - _vm->renderImage(2 + 128); + _vm->renderImage(2 + kSectionInvert); _objectState[1]._type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS9]->getObject(0)->_type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS9]->setSectionVisible(1, kShownFalse); @@ -4266,7 +4266,7 @@ bool Mus9::interact(Action verb, Object &obj1, Object &obj2) { } } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR && (obj1._type & OPENED)) { - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); _objectState[0]._type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS8]->getObject(1)->_type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS8]->setSectionVisible(2, kShownFalse); @@ -4401,7 +4401,7 @@ bool MusRound::interact(Action verb, Object &obj1, Object &obj2) { } } else if (verb == ACTION_CLOSE && obj1._id == ENCRYPTED_DOOR && (obj1._type & OPENED)) { - _vm->renderImage(1 + 128); + _vm->renderImage(1 + kSectionInvert); _objectState[0]._type = EXIT | OPENABLE | CLOSED; _gm->_rooms[MUS9]->getObject(2)->_type = EXIT | OPENABLE | CLOSED; _vm->playSound(kAudioElevator1); diff --git a/engines/supernova/supernova2/state.cpp b/engines/supernova/supernova2/state.cpp index 2b227dcee7..8f6b8d6c41 100644 --- a/engines/supernova/supernova2/state.cpp +++ b/engines/supernova/supernova2/state.cpp @@ -230,26 +230,7 @@ void GameManager2::destroyRooms() { } void GameManager2::initState() { - _currentInputObject = &_nullObject; - _inputObject[0] = &_nullObject; - _inputObject[1] = &_nullObject; - _inputVerb = ACTION_WALK; - _processInput = false; - _guiEnabled = true; - _animationEnabled = true; - _roomBrightness = 255; - _mouseClicked = false; - _keyPressed = false; - _mouseX = -1; - _mouseY = -1; - _mouseField = -1; - _inventoryScroll = 0; - _restTime = 0; - _oldTime = g_system->getMillis(); - _timerPaused = 0; - _timePaused = false; - _messageDuration = 0; - _animationTimer = 0; + GameManager::initState(); _mapOn = false; _steps = false; _cracking = false; @@ -258,17 +239,6 @@ void GameManager2::initState() { for (int i = 0; i < 10; i++) _securityTab[i] = startSecurityTab[i]; - _currentSentence = -1; - for (int i = 0 ; i < 6 ; ++i) { - _sentenceNumber[i] = -1; - _texts[i] = kNoString; - _rows[i] = 0; - _rowsStart[i] = 0; - _dials[i] = 1; - } - - _prevImgId = 0; - _state._money = 20; _state._startTime = 0; _state._addressKnown = false; @@ -296,7 +266,10 @@ void GameManager2::initState() { int16 startPuzzleTab[15] = {12, 3, 14, 1, 11, 0, 2, 13, 9, 5, 4, 10, 7, 6, 8}; for (int i = 0; i < 15; i++) _state._puzzleTab[i] = startPuzzleTab[i]; - _dead = false; + + for (int i = 0 ; i < 6 ; ++i) { + _dials[i] = 1; + } } void GameManager2::initRooms() { @@ -542,7 +515,7 @@ bool GameManager2::genericInteract(Action verb, Object &obj1, Object &obj2) { if (!(o1->_type & CARRIED)) { _vm->renderImage(1); - _vm->renderImage(2 + 128); + _vm->renderImage(2 + kSectionInvert); _currentRoom->getObject(0)->_click = 255; } else _inventory.remove(*o1); -- cgit v1.2.3