AVALANCHE: Reduce verbosity in Background, remove a useless variable

This commit is contained in:
Strangerke 2013-09-25 07:18:08 +02:00
parent b4a81fc2ac
commit 929dcd42f5
9 changed files with 153 additions and 155 deletions

View File

@ -448,59 +448,59 @@ void Animation::catacombMove(byte ped) {
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27);
_vm->_background->draw(-1, -1, 27);
break;
case 0x1: // no connection (wall + shield),
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield.
_vm->_background->draw(-1, -1, 27); // Wall, plus...
_vm->_background->draw(-1, -1, 28); // ...shield.
break;
case 0x2: // wall with door
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door.
_vm->_background->draw(-1, -1, 27); // Wall, plus...
_vm->_background->draw(-1, -1, 29); // ...door.
break;
case 0x3: // wall with door and shield
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 28); // ...shield.
_vm->_background->draw(-1, -1, 27); // Wall, plus...
_vm->_background->draw(-1, -1, 29); // ...door, and...
_vm->_background->draw(-1, -1, 28); // ...shield.
break;
case 0x4: // no connection (wall + window),
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window.
_vm->_background->draw(-1, -1, 27); // Wall, plus...
_vm->_background->draw(-1, -1, 4); // ...window.
break;
case 0x5: // wall with door and window
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 4); // ...window.
_vm->_background->draw(-1, -1, 27); // Wall, plus...
_vm->_background->draw(-1, -1, 29); // ...door, and...
_vm->_background->draw(-1, -1, 4); // ...window.
break;
case 0x6: // no connection (wall + torches),
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicNothing; // No door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches.
_vm->_background->draw(-1, -1, 27); // Wall, plus...
_vm->_background->draw(-1, -1, 6); // ...torches.
break;
case 0x7: // wall with door and torches
_vm->_avalot->_magics[1]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[2]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[4]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 27); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 29); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 6); // ...torches.
_vm->_background->draw(-1, -1, 27); // Wall, plus...
_vm->_background->draw(-1, -1, 29); // ...door, and...
_vm->_background->draw(-1, -1, 6); // ...torches.
break;
case 0xf: // straight-through corridor.
_vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // Sloping wall.
@ -515,44 +515,44 @@ void Animation::catacombMove(byte ped) {
_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18);
_vm->_background->draw(-1, -1, 18);
break;
case 0x1: // no connection (wall + window),
_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 19); // ...window.
_vm->_background->draw(-1, -1, 18); // Wall, plus...
_vm->_background->draw(-1, -1, 19); // ...window.
break;
case 0x2: // wall with door
_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door.
_vm->_background->draw(-1, -1, 18); // Wall, plus...
_vm->_background->draw(-1, -1, 20); // ...door.
break;
case 0x3: // wall with door and window
_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 19); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...window.
_vm->_background->draw(-1, -1, 18); // Wall, plus...
_vm->_background->draw(-1, -1, 19); // ...door, and...
_vm->_background->draw(-1, -1, 20); // ...window.
break;
case 0x6: // no connection (wall + torches),
_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[6]._operation = Avalot::kMagicNothing; // No door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches.
_vm->_background->draw(-1, -1, 18); // Wall, plus...
_vm->_background->draw(-1, -1, 17); // ...torches.
break;
case 0x7: // wall with door and torches
_vm->_avalot->_magics[4]._operation = Avalot::kMagicBounce; // Sloping wall.
_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // Straight wall.
_vm->_avalot->_portals[6]._operation = Avalot::kMagicSpecial; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 18); // Wall, plus...
_vm->_background->drawBackgroundSprite(-1, -1, 20); // ...door, and...
_vm->_background->drawBackgroundSprite(-1, -1, 17); // ...torches.
_vm->_background->draw(-1, -1, 18); // Wall, plus...
_vm->_background->draw(-1, -1, 20); // ...door, and...
_vm->_background->draw(-1, -1, 17); // ...torches.
break;
case 0xf: // straight-through corridor.
_vm->_avalot->_magics[4]._operation = Avalot::kMagicNothing; // Sloping wall.
@ -568,7 +568,7 @@ void Animation::catacombMove(byte ped) {
_vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;
break;
case 0x1:
_vm->_background->drawBackgroundSprite(-1, -1, 21);
_vm->_background->draw(-1, -1, 21);
if ((xy_uint16 == 2051) && (_vm->_avalot->_geidaFollows))
_vm->_avalot->_magics[12]._operation = Avalot::kMagicExclaim;
@ -579,13 +579,13 @@ void Animation::catacombMove(byte ped) {
_vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce;
break;
case 0x2:
_vm->_background->drawBackgroundSprite(-1, -1, 22);
_vm->_background->draw(-1, -1, 22);
_vm->_avalot->_magics[6]._operation = Avalot::kMagicSpecial; // Middle exit south.
_vm->_avalot->_magics[11]._operation = Avalot::kMagicBounce;
_vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;
break;
case 0x3:
_vm->_background->drawBackgroundSprite(-1, -1, 23);
_vm->_background->draw(-1, -1, 23);
_vm->_avalot->_magics[11]._operation = Avalot::kMagicSpecial; // Left exit south.
_vm->_avalot->_magics[6]._operation = Avalot::kMagicBounce;
_vm->_avalot->_magics[12]._operation = Avalot::kMagicBounce;
@ -606,7 +606,7 @@ void Animation::catacombMove(byte ped) {
break;
#endif
case 0x2:
_vm->_background->drawBackgroundSprite(-1, -1, 3);
_vm->_background->draw(-1, -1, 3);
_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north.
_vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.
break;
@ -624,7 +624,7 @@ void Animation::catacombMove(byte ped) {
break;
#endif
case 0x5:
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce; // Middle exit north.
_vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.
break;
@ -639,12 +639,12 @@ void Animation::catacombMove(byte ped) {
case 0x7:
case 0x8:
case 0x9:
_vm->_background->drawBackgroundSprite(-1, -1, 5);
_vm->_background->draw(-1, -1, 5);
if (((here & 0xf000) >> 12) > 0x7)
_vm->_background->drawBackgroundSprite(-1, -1, 30);
_vm->_background->draw(-1, -1, 30);
if (((here & 0xf000) >> 12) == 0x9)
_vm->_background->drawBackgroundSprite(-1, -1, 31);
_vm->_background->draw(-1, -1, 31);
_vm->_avalot->_magics[0]._operation = Avalot::kMagicSpecial; // Middle arch north.
_vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.
@ -653,50 +653,50 @@ void Animation::catacombMove(byte ped) {
case 0xd: // No connection + WINDOW
_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce;
_vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 13);
_vm->_background->draw(-1, -1, 13);
break;
case 0xe: // No connection + TORCH
_vm->_avalot->_magics[0]._operation = Avalot::kMagicBounce;
_vm->_avalot->_portals[3]._operation = Avalot::kMagicNothing; // Door.
_vm->_background->drawBackgroundSprite(-1, -1, 7);
_vm->_background->draw(-1, -1, 7);
break;
// Recessed door:
case 0xf:
_vm->_avalot->_magics[0]._operation = Avalot::kMagicNothing; // Door to Geida's room.
_vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_background->draw(-1, -1, 0);
_vm->_avalot->_portals[3]._operation = Avalot::kMagicSpecial; // Door.
break;
}
switch (xy_uint16) {
case 514:
_vm->_background->drawBackgroundSprite(-1, -1, 16);
_vm->_background->draw(-1, -1, 16);
break; // [2,2] : "Art Gallery" sign over door.
case 264:
_vm->_background->drawBackgroundSprite(-1, -1, 8);
_vm->_background->draw(-1, -1, 8);
break; // [8,1] : "The Wrong Way!" sign.
case 1797:
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
break; // [5,7] : "Ite Mingite" sign.
case 258:
for (int i = 0; i <= 2; i++) { // [2,1] : Art gallery - pictures
_vm->_background->drawBackgroundSprite(130 + i * 120, 70, 14);
_vm->_background->drawBackgroundSprite(184 + i * 120, 78, 15);
_vm->_background->draw(130 + i * 120, 70, 14);
_vm->_background->draw(184 + i * 120, 78, 15);
}
break;
case 1287:
for (int i = 10; i <= 13; i++)
_vm->_background->drawBackgroundSprite(-1, -1, i - 1);
_vm->_background->draw(-1, -1, i - 1);
break; // [7,5] : 4 candles.
case 776:
_vm->_background->drawBackgroundSprite(-1, -1, 9);
_vm->_background->draw(-1, -1, 9);
break; // [8,3] : 1 candle.
case 2049:
_vm->_background->drawBackgroundSprite(-1, -1, 10);
_vm->_background->draw(-1, -1, 10);
break; // [1,8] : another candle.
case 257:
_vm->_background->drawBackgroundSprite(-1, -1, 11);
_vm->_background->drawBackgroundSprite(-1, -1, 12);
_vm->_background->draw(-1, -1, 11);
_vm->_background->draw(-1, -1, 12);
break; // [1,1] : the other two.
}
@ -717,7 +717,7 @@ void Animation::dawnDelay() {
void Animation::callSpecial(uint16 which) {
switch (which) {
case 1: // _vm->_avalot->special 1: Room 22: top of stairs.
_vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_background->draw(-1, -1, 0);
_vm->_avalot->_brummieStairs = 1;
_vm->_avalot->_magics[9]._operation = Avalot::kMagicNothing;
_vm->_timer->addTimer(10, Timer::kProcStairs, Timer::kReasonBrummieStairs);
@ -764,7 +764,7 @@ void Animation::callSpecial(uint16 which) {
_vm->_dialogs->displayScrollChain('q', 35);
_sprites[0].remove();
//tr[1].vanishifstill:=true;
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_dialogs->displayScrollChain('q', 36);
_vm->_avalot->_tiedUp = true;
_vm->_avalot->_friarWillTieYouUp = false;
@ -979,7 +979,7 @@ void Animation::arrowProcs(byte tripnum) {
}
} else { // Arrow has hit the wall!
_sprites[tripnum].remove(); // Deallocate the arrow.
_vm->_background->drawBackgroundSprite(-1, -1, 2); // Show pic of arrow stuck into the door.
_vm->_background->draw(-1, -1, 2); // Show pic of arrow stuck into the door.
_vm->_avalot->_arrowInTheDoor = true; // So that we can pick it up.
}
@ -1189,7 +1189,7 @@ void Animation::hideInCupboard() {
"but dusty, cupboard. Hmmmm... you leave the door slightly open to avoid suffocation.", Dialogs::kControlParagraph);
_vm->_dialogs->displayText(tmpStr);
_vm->_avalot->_avvysInTheCupboard = true;
_vm->_background->drawBackgroundSprite(-1, -1, 7);
_vm->_background->draw(-1, -1, 7);
}
}

View File

@ -416,7 +416,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
_avalot->dawn();
}
_background->forgetBackgroundSprites();
_background->release();
_avalot->minorRedraw();
_menu->setup();
_avalot->setRoom(kPeopleAvalot, _avalot->_room);
@ -426,7 +426,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
_avalot->drawDirection();
_avalot->_onToolbar = false;
_animation->animLink();
_background->updateBackgroundSprites();
_background->update();
Common::String tmpStr = Common::String::format("%cLoaded: %c%s.ASG%c%c%c%s%c%csaved on %s.",
Dialogs::kControlItalic, Dialogs::kControlRoman, description.c_str(), Dialogs::kControlCenter,

View File

@ -404,7 +404,7 @@ void Avalot::runAvalot() {
_clock.update();
_vm->_menu->update();
_vm->_background->updateBackgroundSprites();
_vm->_background->update();
_vm->_animation->animLink();
checkClick();
_vm->_timer->updateTimer();
@ -643,7 +643,7 @@ void Avalot::loadRoom(byte num) {
file.close();
loadAlso(num);
_vm->_background->loadBackgroundSprites(num);
_vm->_background->load(num);
CursorMan.showMouse(true);
}
@ -682,7 +682,7 @@ void Avalot::findPeople(byte room) {
void Avalot::exitRoom(byte x) {
_vm->_sound->stopSound();
_vm->_background->forgetBackgroundSprites();
_vm->_background->release();
_seeScroll = true; // This stops the trippancy system working over the length of this procedure.
switch (x) {
@ -782,7 +782,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
switch (roomId) {
case kRoomYours:
if (_avvyInBed) {
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_vm->_graphics->refreshBackground();
_vm->_timer->addTimer(100, Timer::kProcArkataShouts, Timer::kReasonArkataShouts);
}
@ -880,7 +880,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomBridge:
if (_drawbridgeOpen == 4) { // open
_vm->_background->drawBackgroundSprite(-1, -1, 2); // Position of drawbridge
_vm->_background->draw(-1, -1, 2); // Position of drawbridge
_vm->_graphics->refreshBackground();
_magics[kColorGreen - 1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge.
}
@ -904,10 +904,10 @@ void Avalot::enterRoom(Room roomId, byte ped) {
}
if (_tiedUp)
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
if (!_mushroomGrowing)
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_vm->_graphics->refreshBackground();
break;
@ -979,11 +979,11 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomArgentPub:
if (_wonNim)
_vm->_background->drawBackgroundSprite(-1, -1, 0); // No lute by the settle.
_vm->_background->draw(-1, -1, 0); // No lute by the settle.
_malagauche = 0; // Ready to boot Malagauche
if (_givenBadgeToIby) {
_vm->_background->drawBackgroundSprite(-1, -1, 7);
_vm->_background->drawBackgroundSprite(-1, -1, 8);
_vm->_background->draw(-1, -1, 7);
_vm->_background->draw(-1, -1, 8);
}
_vm->_graphics->refreshBackground();
break;
@ -999,7 +999,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
if (_geidaFollows) {
putGeidaAt(4, ped);
if (_lustieIsAsleep) {
_vm->_background->drawBackgroundSprite(-1, -1, 4);
_vm->_background->draw(-1, -1, 4);
_vm->_graphics->refreshBackground();
}
}
@ -1008,14 +1008,14 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomMusicRoom:
if (_jacquesState > 0) {
_jacquesState = 5;
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_graphics->refreshBackground();
_vm->_background->drawBackgroundSprite(-1, -1, 3);
_vm->_background->draw(-1, -1, 3);
_magics[kColorBrown - 1]._operation = Avalot::kMagicNothing;
_whereIs[kPeopleJacques - 150] = kRoomNowhere;
}
if (ped != 0) {
_vm->_background->drawBackgroundSprite(-1, -1, 5);
_vm->_background->draw(-1, -1, 5);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(6);
_vm->_sequence->thenShow(5);
@ -1026,7 +1026,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomOutsideNottsPub:
if (ped == 2) {
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(3);
_vm->_sequence->thenShow(2);
@ -1038,7 +1038,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomOutsideArgentPub:
if (ped == 2) {
_vm->_background->drawBackgroundSprite(-1, -1, 5);
_vm->_background->draw(-1, -1, 5);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(6);
_vm->_sequence->thenShow(5);
@ -1066,7 +1066,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomInsideCardiffCastle:
if (ped > 0) {
_vm->_animation->_sprites[1].init(10, false, _vm->_animation); // Define the dart.
_vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_background->draw(-1, -1, 0);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(1);
if (_arrowInTheDoor)
@ -1075,22 +1075,22 @@ void Avalot::enterRoom(Room roomId, byte ped) {
_vm->_sequence->thenShow(2);
if (_takenPen)
_vm->_background->drawBackgroundSprite(-1, -1, 3);
_vm->_background->draw(-1, -1, 3);
_vm->_sequence->startToClose();
} else {
_vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_background->draw(-1, -1, 0);
if (_arrowInTheDoor)
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
else
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_graphics->refreshBackground();
}
break;
case kRoomAvvysGarden:
if (ped == 1) {
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(2);
_vm->_sequence->thenShow(1);
@ -1111,7 +1111,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
_vm->_sequence->start_to_close();
#endif
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(2);
_vm->_sequence->thenShow(1);
@ -1122,7 +1122,7 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomAylesOffice:
if (_aylesIsAwake)
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_graphics->refreshBackground();
break; // Ayles awake.
@ -1143,14 +1143,14 @@ void Avalot::enterRoom(Room roomId, byte ped) {
case kRoomNottsPub:
if (_sittingInPub)
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_npcFacing = 1; // Port.
break;
case kRoomOutsideDucks:
if (ped == 2) {
// Shut the door
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_vm->_graphics->refreshBackground();
_vm->_sequence->firstShow(3);
_vm->_sequence->firstShow(2);

View File

@ -43,32 +43,32 @@ Background::Background(AvalancheEngine *vm) {
}
Background::~Background() {
forgetBackgroundSprites();
release();
}
/**
* @remarks Originally called 'pics_link'
*/
void Background::updateBackgroundSprites() {
void Background::update() {
if (_vm->_menu->isActive())
return; // No animation when the menus are up.
switch (_vm->_avalot->_room) {
case kRoomOutsideArgentPub:
if ((_vm->_avalot->_roomTime % 12) == 0)
drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 4);
draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 4);
break;
case kRoomBrummieRoad:
if ((_vm->_avalot->_roomTime % 2) == 0)
drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 2) % 4);
draw(-1, -1, (_vm->_avalot->_roomTime / 2) % 4);
break;
case kRoomBridge:
if ((_vm->_avalot->_roomTime % 2) == 0)
drawBackgroundSprite(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4);
draw(-1, -1, 3 + (_vm->_avalot->_roomTime / 2) % 4);
break;
case kRoomYours:
if ((!_vm->_avalot->_avvyIsAwake) && ((_vm->_avalot->_roomTime % 4) == 0))
drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 12) % 2);
draw(-1, -1, (_vm->_avalot->_roomTime / 12) % 2);
break;
case kRoomArgentPub:
if (((_vm->_avalot->_roomTime % 7) == 1) && (_vm->_avalot->_malagauche != 177)) {
@ -78,16 +78,16 @@ void Background::updateBackgroundSprites() {
case 1:
case 11:
case 21:
drawBackgroundSprite(-1, -1, 11); // Looks forwards.
draw(-1, -1, 11); // Looks forwards.
break;
case 8:
case 18:
case 28:
case 32:
drawBackgroundSprite(-1, -1, 10); // Looks at you.
draw(-1, -1, 10); // Looks at you.
break;
case 30:
drawBackgroundSprite(-1, -1, 12); // Winks.
draw(-1, -1, 12); // Winks.
break;
case 33:
_vm->_avalot->_malagauche = 0;
@ -98,14 +98,14 @@ void Background::updateBackgroundSprites() {
switch (_vm->_avalot->_roomTime % 200) {
case 179:
case 197:
drawBackgroundSprite(-1, -1, 4); // Dogfood's drinking cycle.
draw(-1, -1, 4); // Dogfood's drinking cycle.
break;
case 182:
case 194:
drawBackgroundSprite(-1, -1, 5);
draw(-1, -1, 5);
break;
case 185:
drawBackgroundSprite(-1, -1, 6);
draw(-1, -1, 6);
break;
case 199:
_vm->_avalot->_npcFacing = 177; // Impossible value for this.
@ -123,7 +123,7 @@ void Background::updateBackgroundSprites() {
direction = 4;
if (direction != _vm->_avalot->_npcFacing) { // Dogfood.
drawBackgroundSprite(-1, -1, direction - 1);
draw(-1, -1, direction - 1);
_vm->_avalot->_npcFacing = direction;
}
}
@ -132,16 +132,16 @@ void Background::updateBackgroundSprites() {
if ((_vm->_avalot->_roomTime % 3) == 0) {
switch ((_vm->_avalot->_roomTime / int32(3)) % int32(6)) {
case 4:
drawBackgroundSprite(-1, -1, 0);
draw(-1, -1, 0);
break;
case 1:
case 3:
case 5:
drawBackgroundSprite(-1, -1, 1);
draw(-1, -1, 1);
break;
case 0:
case 2:
drawBackgroundSprite(-1, -1, 2);
draw(-1, -1, 2);
break;
}
}
@ -161,7 +161,7 @@ void Background::updateBackgroundSprites() {
direction = 3; // Right.
if (direction != _vm->_avalot->_npcFacing) { // du Lustie.
drawBackgroundSprite(-1, -1, direction - 1);
draw(-1, -1, direction - 1);
_vm->_avalot->_npcFacing = direction;
}
}
@ -170,10 +170,10 @@ void Background::updateBackgroundSprites() {
if ((!_vm->_avalot->_aylesIsAwake) && (_vm->_avalot->_roomTime % 14 == 0)) {
switch ((_vm->_avalot->_roomTime / 14) % 2) {
case 0:
drawBackgroundSprite(-1, -1, 0); // Frame 2: EGA.
draw(-1, -1, 0); // Frame 2: EGA.
break;
case 1:
drawBackgroundSprite(-1, -1, 2); // Frame 1: Natural.
draw(-1, -1, 2); // Frame 1: Natural.
break;
}
}
@ -182,10 +182,10 @@ void Background::updateBackgroundSprites() {
if (_vm->_avalot->_tiedUp) {
switch (_vm->_avalot->_roomTime % 54) {
case 20:
drawBackgroundSprite(-1, -1, 3); // Frame 4: Avalot blinks.
draw(-1, -1, 3); // Frame 4: Avalot blinks.
break;
case 23:
drawBackgroundSprite(-1, -1, 1); // Frame 1: Back to normal.
draw(-1, -1, 1); // Frame 1: Back to normal.
break;
}
}
@ -205,23 +205,23 @@ void Background::updateBackgroundSprites() {
direction--; // Blinks.
if (direction != _vm->_avalot->_npcFacing) { // Port.
drawBackgroundSprite(-1, -1, direction - 1);
draw(-1, -1, direction - 1);
_vm->_avalot->_npcFacing = direction;
}
switch (_vm->_avalot->_roomTime % 50) {
case 45 :
drawBackgroundSprite(-1, -1, 8); // Spurge blinks.
draw(-1, -1, 8); // Spurge blinks.
break;
case 49 :
drawBackgroundSprite(-1, -1, 9);
draw(-1, -1, 9);
break;
}
break;
}
case kRoomDucks: {
if ((_vm->_avalot->_roomTime % 3) == 0) // The fire flickers.
drawBackgroundSprite(-1, -1, (_vm->_avalot->_roomTime / 3) % 3);
draw(-1, -1, (_vm->_avalot->_roomTime / 3) % 3);
// Bearing of Avvy from Duck.
byte direction = 0;
@ -237,7 +237,7 @@ void Background::updateBackgroundSprites() {
direction++; // Duck blinks.
if (direction != _vm->_avalot->_npcFacing) { // Duck.
drawBackgroundSprite(-1, -1, direction - 1);
draw(-1, -1, direction - 1);
_vm->_avalot->_npcFacing = direction;
}
break;
@ -261,7 +261,7 @@ void Background::updateBackgroundSprites() {
}
}
void Background::loadBackgroundSprites(byte number) {
void Background::load(byte number) {
Common::File f;
_filename = _filename.format("chunk%d.avd", number);
if (!f.open(_filename))
@ -276,7 +276,7 @@ void Background::loadBackgroundSprites(byte number) {
f.seek(_offsets[i]);
SpriteType sprite;
sprite._type = PictureType(f.readByte());
sprite._type = (PictureType)(f.readByte());
sprite._x = f.readSint16LE();
sprite._y = f.readSint16LE();
sprite._xl = f.readSint16LE();
@ -311,7 +311,7 @@ void Background::loadBackgroundSprites(byte number) {
f.close();
}
void Background::forgetBackgroundSprites() {
void Background::release() {
for (int i = 0; i < _spriteNum; i++) {
if (_sprites[i]._x > kOnDisk)
_sprites[i]._picture.free();
@ -322,7 +322,7 @@ void Background::forgetBackgroundSprites() {
* Draw background animation
* @remarks Originally called 'show_one'
*/
void Background::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) {
void Background::draw(int16 destX, int16 destY, byte sprId) {
if (_sprites[sprId]._x > kOnDisk) {
if (destX < 0) {
destX = _sprites[sprId]._x * 8;
@ -337,13 +337,13 @@ void Background::drawBackgroundSprite(int16 destX, int16 destY, byte sprId) {
f.seek(_offsets[sprId]);
SpriteType sprite;
sprite._type = PictureType(f.readByte());
sprite._type = (PictureType)(f.readByte());
sprite._x = f.readSint16LE();
sprite._y = f.readSint16LE();
sprite._xl = f.readSint16LE();
sprite._yl = f.readSint16LE();
sprite._size = f.readSint32LE();
f.skip(2); // For the now not existing natural and memorize data members of the SpriteType (called chunkblocktype in the original).
f.skip(2); // Natural and Memorize are used in Load()
sprite._picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1);
if (destX < 0) {

View File

@ -44,14 +44,14 @@ public:
Background(AvalancheEngine *vm);
~Background();
void updateBackgroundSprites();
void loadBackgroundSprites(byte number);
void forgetBackgroundSprites();
void update();
void load(byte number);
void release();
// Setting the destination to negative coordinates means the picture should be drawn to it's original position.
// If you give it positive values, the picture will be plotted to the desired coordinates on the screen.
// By that we get rid of show_one_at(), which would be almost identical and cause a lot of code duplication.
void drawBackgroundSprite(int16 destX, int16 destY, byte sprId);
void draw(int16 destX, int16 destY, byte sprId);
private:
enum PictureType {kEga, kBgi, kNaturalImage};

View File

@ -46,7 +46,6 @@ Parser::Parser(AvalancheEngine *vm) {
}
void Parser::init() {
_leftMargin = 0;
if (!_inputText.empty())
_inputText.clear();
_inputTextPos = 0;
@ -396,7 +395,7 @@ void Parser::handleBackspace() {
if (_vm->_menu->_activeMenuItem._activeNow)
return;
if (_inputTextPos > _leftMargin) {
if (_inputTextPos > 0) {
_inputTextPos--;
if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`'))
_quote = !_quote;
@ -990,17 +989,17 @@ bool Parser::isHolding() {
void Parser::openBox(bool isOpening) {
if ((_vm->_avalot->_room == kRoomYours) && (_thing == 54)) {
_vm->_background->drawBackgroundSprite(-1, -1, 4);
_vm->_background->draw(-1, -1, 4);
_vm->_background->updateBackgroundSprites();
_vm->_background->update();
_vm->_animation->animLink();
_vm->_graphics->refreshScreen();
_vm->_system->delayMillis(55);
if (!isOpening) {
_vm->_background->drawBackgroundSprite(-1, -1, 5);
_vm->_background->updateBackgroundSprites();
_vm->_background->draw(-1, -1, 5);
_vm->_background->update();
_vm->_animation->animLink();
_vm->_graphics->refreshScreen();
}
@ -1432,7 +1431,7 @@ void Parser::standUp() {
_vm->_avalot->_userMovesAvvy = true;
_vm->_animation->appearPed(0, 1);
_vm->_animation->setDirection(kDirLeft);
_vm->_background->drawBackgroundSprite(-1, -1, 3); // Picture of empty pillow.
_vm->_background->draw(-1, -1, 3); // Picture of empty pillow.
_vm->_avalot->incScore(1);
_vm->_avalot->_avvyInBed = false;
_vm->_timer->loseTimer(Timer::kReasonArkataShouts);
@ -1446,7 +1445,7 @@ void Parser::standUp() {
case kRoomNottsPub:
if (_vm->_avalot->_sittingInPub) {
_vm->_background->drawBackgroundSprite(-1, -1, 3); // Not sitting down.
_vm->_background->draw(-1, -1, 3); // Not sitting down.
_vm->_animation->_sprites[0]._visible = true; // But standing up.
_vm->_animation->appearPed(0, 3); // And walking away.
_vm->_avalot->_sittingInPub = false; // Really not sitting down.
@ -1464,12 +1463,12 @@ void Parser::getProc(char thing) {
case kRoomYours:
if (_vm->_animation->inField(1)) {
if (_vm->_avalot->_boxContent == thing) {
_vm->_background->drawBackgroundSprite(-1, -1, 4);
_vm->_background->draw(-1, -1, 4);
_vm->_dialogs->displayText("OK, I've got it.");
_vm->_avalot->_objects[thing - 1] = true;
_vm->_avalot->refreshObjectList();
_vm->_avalot->_boxContent = kNothing;
_vm->_background->drawBackgroundSprite(-1, -1, 5);
_vm->_background->draw(-1, -1, 5);
} else {
Common::String tmpStr = Common::String::format("I can't see %s in the box.", _vm->_avalot->getItem(thing).c_str());
_vm->_dialogs->displayText(tmpStr);
@ -1485,7 +1484,7 @@ void Parser::getProc(char thing) {
_vm->_dialogs->displayText("It's not there, Avvy.");
else {
// OK: we're taking the pen, and it's there.
_vm->_background->drawBackgroundSprite(-1, -1, 3); // No pen there now.
_vm->_background->draw(-1, -1, 3); // No pen there now.
_vm->_animation->callSpecial(3); // Zap!
_vm->_avalot->_takenPen = true;
_vm->_avalot->_objects[kObjectPen - 1] = true;
@ -1506,7 +1505,7 @@ void Parser::getProc(char thing) {
break;
case kRoomRobins:
if ((thing == kObjectMushroom) & (_vm->_animation->inField(0)) & (_vm->_avalot->_mushroomGrowing)) {
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_vm->_dialogs->displayText("Got it!");
_vm->_avalot->_mushroomGrowing = false;
_vm->_avalot->_takenMushroom = true;
@ -1726,8 +1725,8 @@ void Parser::doThat() {
_vm->_avalot->_objects[kObjectBadge - 1] = false;
_vm->_avalot->_objects[kObjectHabit - 1] = true;
_vm->_avalot->_givenBadgeToIby = true;
_vm->_background->drawBackgroundSprite(-1, -1, 7);
_vm->_background->drawBackgroundSprite(-1, -1, 8);
_vm->_background->draw(-1, -1, 7);
_vm->_background->draw(-1, -1, 8);
} else
heyThanks();
break;
@ -1909,7 +1908,7 @@ void Parser::doThat() {
_vm->_avalot->_objects[kObjectLute - 1] = true;
_vm->_avalot->refreshObjectList();
_vm->_avalot->_wonNim = true;
_vm->_background->drawBackgroundSprite(-1, -1, 0); // Show the settle with no lute on it.
_vm->_background->draw(-1, -1, 0); // Show the settle with no lute on it.
_vm->_avalot->incScore(7); // 7 points for winning!
if (_playedNim == 1)
@ -2070,11 +2069,11 @@ void Parser::doThat() {
if (_alcoholLevel == 0)
_vm->_avalot->incScore(3);
_vm->_background->drawBackgroundSprite(-1, -1, 11);
_vm->_background->draw(-1, -1, 11);
_vm->_dialogs->displayText(booze[_thing - 51] + ", please." + Dialogs::kControlRegister + '1' + Dialogs::kControlSpeechBubble);
_vm->_avalot->_drinking = _thing;
_vm->_background->drawBackgroundSprite(-1, -1, 9);
_vm->_background->draw(-1, -1, 9);
_vm->_avalot->_malagauche = 177;
_vm->_timer->addTimer(27, Timer::kProcBuyDrinks, Timer::kReasonDrinks);
break;
@ -2095,12 +2094,12 @@ void Parser::doThat() {
return;
}
_vm->_background->drawBackgroundSprite(-1, -1, 11);
_vm->_background->draw(-1, -1, 11);
Common::String tmpStr = Common::String::format("Wine, please.%c1%c", Dialogs::kControlRegister, Dialogs::kControlSpeechBubble);
_vm->_dialogs->displayText(tmpStr);
if (_alcoholLevel == 0)
_vm->_avalot->incScore(3);
_vm->_background->drawBackgroundSprite(-1, -1, 9);
_vm->_background->draw(-1, -1, 9);
_vm->_avalot->_malagauche = 177;
_vm->_timer->addTimer(27, Timer::kProcBuyWine, Timer::kReasonDrinks);
@ -2270,7 +2269,7 @@ void Parser::doThat() {
_vm->_avalot->_avvyIsAwake = true;
_vm->_avalot->incScore(1);
_vm->_avalot->_avvyInBed = true;
_vm->_background->drawBackgroundSprite(-1, -1, 2); // Picture of Avvy, awake in bed.
_vm->_background->draw(-1, -1, 2); // Picture of Avvy, awake in bed.
if (_vm->_avalot->_teetotal)
_vm->_dialogs->displayScrollChain('d', 13);
} else

View File

@ -68,7 +68,6 @@ public:
Common::String _inputTextBackup;
byte _inputTextPos; // Original name: curpos
bool _quote; // 66 or 99 next?
byte _leftMargin;
bool _cursorState;
byte _wearing; // what you're wearing

View File

@ -97,7 +97,7 @@ void Sequence::callSequencer() {
}
if (curSeq <= 176) { // Show a frame.
_vm->_background->drawBackgroundSprite(-1, -1, curSeq - 1);
_vm->_background->draw(-1, -1, curSeq - 1);
shoveLeft();
}

View File

@ -229,7 +229,7 @@ void Timer::loseTimer(byte which) {
void Timer::openDrawbridge() {
_vm->_avalot->_drawbridgeOpen++;
_vm->_background->drawBackgroundSprite(-1, -1, _vm->_avalot->_drawbridgeOpen - 2);
_vm->_background->draw(-1, -1, _vm->_avalot->_drawbridgeOpen - 2);
if (_vm->_avalot->_drawbridgeOpen == 4)
_vm->_avalot->_magics[1]._operation = Avalot::kMagicNothing; // You may enter the drawbridge.
@ -271,7 +271,7 @@ void Timer::bang2() {
void Timer::stairs() {
_vm->_sound->blip();
_vm->_animation->_sprites[0].walkTo(3);
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_avalot->_brummieStairs = 2;
_vm->_avalot->_magics[10]._operation = Avalot::kMagicSpecial;
_vm->_avalot->_magics[10]._data = 2; // Reached the bottom of the stairs.
@ -389,17 +389,17 @@ void Timer::jacquesWakesUp() {
switch (_vm->_avalot->_jacquesState) { // Additional pictures.
case 1 :
_vm->_background->drawBackgroundSprite(-1, -1, 0); // Eyes open.
_vm->_background->draw(-1, -1, 0); // Eyes open.
_vm->_dialogs->displayScrollChain('Q', 45);
break;
case 2 : // Going through the door.
_vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor.
_vm->_background->drawBackgroundSprite(-1, -1, 2); // But going through the door.
_vm->_background->draw(-1, -1, 1); // Not on the floor.
_vm->_background->draw(-1, -1, 2); // But going through the door.
_vm->_avalot->_magics[5]._operation = Avalot::kMagicNothing; // You can't wake him up now.
break;
case 3 : // Gone through the door.
_vm->_background->drawBackgroundSprite(-1, -1, 1); // Not on the floor, either.
_vm->_background->drawBackgroundSprite(-1, -1, 3); // He's gone... so the door's open.
_vm->_background->draw(-1, -1, 1); // Not on the floor, either.
_vm->_background->draw(-1, -1, 3); // He's gone... so the door's open.
_vm->_avalot->setRoom(kPeopleJacques, kRoomNowhere); // Gone!
break;
}
@ -429,7 +429,7 @@ void Timer::naughtyDuke() { // This is when the Duke comes in and takes your mon
spr->walkTo(2); // He walks over to you.
// Let's get the door opening.
_vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_background->draw(-1, -1, 0);
_vm->_sequence->firstShow(2);
_vm->_sequence->startToClose();
@ -445,7 +445,7 @@ void Timer::naughtyDuke2() {
}
void Timer::naughtyDuke3() {
_vm->_background->drawBackgroundSprite(-1, -1, 0);
_vm->_background->draw(-1, -1, 0);
_vm->_sequence->firstShow(2);
_vm->_sequence->startToClose();
}
@ -487,7 +487,7 @@ void Timer::jump() {
if (_vm->_avalot->_carryNum >= kCarryLimit)
_vm->_dialogs->displayText("You fail to grab it, because your hands are full.");
else {
_vm->_background->drawBackgroundSprite(-1, -1, 1);
_vm->_background->draw(-1, -1, 1);
_vm->_avalot->_arrowInTheDoor = false; // You've got it.
_vm->_avalot->_objects[kObjectBolt - 1] = true;
_vm->_avalot->refreshObjectList();
@ -503,7 +503,7 @@ void Timer::crapulusSaysSpludOut() {
}
void Timer::buyDrinks() {
_vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again.
_vm->_background->draw(-1, -1, 10); // Malagauche gets up again.
_vm->_avalot->_malagauche = 0;
_vm->_dialogs->displayScrollChain('D', _vm->_avalot->_drinking); // Display message about it.
@ -515,7 +515,7 @@ void Timer::buyDrinks() {
}
void Timer::buyWine() {
_vm->_background->drawBackgroundSprite(-1, -1, 10); // Malagauche gets up again.
_vm->_background->draw(-1, -1, 10); // Malagauche gets up again.
_vm->_avalot->_malagauche = 0;
_vm->_dialogs->displayScrollChain('D', 50); // You buy the wine.
@ -625,7 +625,7 @@ void Timer::avvySitDown() {
if (avvy->_homing) // Still walking.
addTimer(1, kProcAvvySitDown, kReasonSittingDown);
else {
_vm->_background->drawBackgroundSprite(-1, -1, 2);
_vm->_background->draw(-1, -1, 2);
_vm->_avalot->_sittingInPub = true;
_vm->_avalot->_userMovesAvvy = false;
avvy->_visible = false;