aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2013-10-09 00:39:16 +0200
committerStrangerke2013-10-09 06:45:51 +0200
commitb0255c9406d2e90b076e7f9c5f42049e4e0ba2d4 (patch)
treed9b4c96a639e270fa0543323b35652e415d34ef5 /engines
parentcf36706b98ccc73ec50dd338a473f0672d0dff17 (diff)
downloadscummvm-rg350-b0255c9406d2e90b076e7f9c5f42049e4e0ba2d4.tar.gz
scummvm-rg350-b0255c9406d2e90b076e7f9c5f42049e4e0ba2d4.tar.bz2
scummvm-rg350-b0255c9406d2e90b076e7f9c5f42049e4e0ba2d4.zip
AVALANCHE: Implement fadeIn and fadeOut (dusk and dawn)
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/animation.cpp10
-rw-r--r--engines/avalanche/avalanche.cpp4
-rw-r--r--engines/avalanche/avalanche.h10
-rw-r--r--engines/avalanche/avalot.cpp93
-rw-r--r--engines/avalanche/graphics.cpp2
-rw-r--r--engines/avalanche/parser.cpp14
-rw-r--r--engines/avalanche/pingo.cpp4
-rw-r--r--engines/avalanche/timer.cpp2
8 files changed, 94 insertions, 45 deletions
diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index 6a7bad17f3..08fe32085f 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -769,7 +769,7 @@ void Animation::callSpecial(uint16 which) {
}
break;
case 4: // This is the ghost room link.
- _vm->dusk();
+ _vm->fadeOut();
_sprites[0].turn(kDirRight); // you'll see this after we get back from bootstrap
_vm->_timer->addTimer(1, Timer::kProcGhostRoomPhew, Timer::kReasonGhostRoomPhew);
//_vm->_enid->backToBootstrap(3); TODO: Replace it with proper ScummVM-friendly function(s)! Do not remove until then!
@@ -837,7 +837,7 @@ void Animation::callSpecial(uint16 which) {
return;
}
}
- _vm->dusk();
+ _vm->fadeOut();
_vm->_catacombY--;
catacombMove(4);
if (_vm->_room != kRoomCatacombs)
@@ -855,7 +855,7 @@ void Animation::callSpecial(uint16 which) {
dawnDelay();
break;
case 11: // _vm->special 11: transfer east in catacombs.
- _vm->dusk();
+ _vm->fadeOut();
_vm->_catacombX++;
catacombMove(1);
if (_vm->_room != kRoomCatacombs)
@@ -864,7 +864,7 @@ void Animation::callSpecial(uint16 which) {
dawnDelay();
break;
case 12: // _vm->special 12: transfer south in catacombs.
- _vm->dusk();
+ _vm->fadeOut();
_vm->_catacombY++;
catacombMove(2);
if (_vm->_room != kRoomCatacombs)
@@ -873,7 +873,7 @@ void Animation::callSpecial(uint16 which) {
dawnDelay();
break;
case 13: // _vm->special 13: transfer west in catacombs.
- _vm->dusk();
+ _vm->fadeOut();
_vm->_catacombX--;
catacombMove(3);
if (_vm->_room != kRoomCatacombs)
diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp
index 43943f2632..3e0bdb0507 100644
--- a/engines/avalanche/avalanche.cpp
+++ b/engines/avalanche/avalanche.cpp
@@ -50,6 +50,8 @@ AvalancheEngine::AvalancheEngine(OSystem *syst, const AvalancheGameDescription *
_totalTime = 0;
_showDebugLines = false;
+
+ memset(_fxPal, 0, 16 * 16 * 3);
}
AvalancheEngine::~AvalancheEngine() {
@@ -359,7 +361,7 @@ bool AvalancheEngine::loadGame(const int16 slot) {
if (_holdTheDawn) {
_holdTheDawn = false;
- dawn();
+ fadeIn();
}
_background->release();
diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h
index 1ef5d5014e..e9d2b1e116 100644
--- a/engines/avalanche/avalanche.h
+++ b/engines/avalanche/avalanche.h
@@ -274,8 +274,8 @@ public:
void fxToggle();
void refreshObjectList();
void errorLed();
- void dusk();
- void dawn();
+ void fadeOut();
+ void fadeIn();
void drawDirection(); // Draws the little icon at the left end of the text input field.
void gameOver();
uint16 bearing(byte whichPed); // Returns the bearing from ped 'whichped' to Avvy, in degrees.
@@ -306,6 +306,8 @@ private:
// Will be used in dusk() and dawn().
bool _fxHidden;
+ byte _fxPal[16][16][3];
+
bool _spludwickAtHome; // Is Spludwick at home?
bool _passedCwytalotInHerts; // Have you passed Cwytalot in Herts?
bool _holdTheDawn; // If this is true, calling Dawn will do nothing. It's used, for example, at the start, to stop Load from dawning.
@@ -328,8 +330,6 @@ private:
void findPeople(byte room);
void putGeidaAt(byte whichPed, byte ped);
void guideAvvy(Common::Point cursorPos);
- void fadeOut(byte n);
- void fadeIn(byte n);
void enterRoom(Room room, byte ped);
void exitRoom(byte x);
void drawToolbar();
@@ -339,8 +339,6 @@ private:
void fixFlashers();
void loadAlso(byte num);
void resetVariables();
-
- int8 fades(int8 x);
};
} // End of namespace Avalanche
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index 8e70d7b2aa..2da1aeaa2d 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -28,8 +28,11 @@
/* AVALOT The kernel of the program. */
#include "avalanche/avalanche.h"
+
#include "common/random.h"
+#include "common/system.h"
#include "common/config-manager.h"
+#include "graphics/palette.h"
namespace Avalanche {
@@ -297,7 +300,7 @@ void AvalancheEngine::setup() {
init();
_dialogs->reset();
- dusk();
+ fadeOut();
_graphics->loadDigits();
_parser->_inputTextPos = 0;
@@ -308,7 +311,7 @@ void AvalancheEngine::setup() {
drawToolbar();
_dialogs->setReadyLight(2);
- dawn();
+ fadeIn();
_parser->_cursorState = false;
_parser->cursorOn();
_animation->_sprites[0]._speedX = kWalk;
@@ -376,7 +379,6 @@ void AvalancheEngine::init() {
#endif
_letMeOut = false;
- _holdTheDawn = true;
_currentMouse = 177;
_dropsOk = true;
_mouseText = "";
@@ -837,7 +839,7 @@ void AvalancheEngine::enterRoom(Room roomId, byte ped) {
case kRoomMap:
// You're entering the map.
- dawn();
+ fadeIn();
if (ped > 0)
_graphics->zoomOut(_peds[ped]._x, _peds[ped]._y);
@@ -1294,25 +1296,72 @@ void AvalancheEngine::errorLed() {
warning("STUB: errorled()");
}
-int8 AvalancheEngine::fades(int8 x) {
- warning("STUB: fades()");
- return 0;
-}
+/**
+ * Displays a fade out, full screen.
+ * This version is different to the one in the original, which was fading in 3 steps.
+ * @remarks Originally called 'dusk'
+ */
+void AvalancheEngine::fadeOut() {
+ byte pal[3], tmpPal[3];
-void AvalancheEngine::fadeOut(byte n) {
- warning("STUB: fadeOut()");
-}
+ _graphics->setBackgroundColor(kColorBlack);
+ if (_fxHidden)
+ return;
+ _fxHidden = true;
+
+ for (int i = 0; i < 16; i++) {
+ for (int j = 0; j < 16; j++) {
+ g_system->getPaletteManager()->grabPalette((byte *)tmpPal, j, 1);
+ _fxPal[i][j][0] = tmpPal[0];
+ _fxPal[i][j][1] = tmpPal[1];
+ _fxPal[i][j][2] = tmpPal[2];
+ if (tmpPal[0] >= 16)
+ pal[0] = tmpPal[0] - 16;
+ else
+ pal[0] = 0;
-void AvalancheEngine::dusk() {
- warning("STUB: dusk()");
-}
+ if (tmpPal[1] >= 16)
+ pal[1] = tmpPal[1] - 16;
+ else
+ pal[1] = 0;
-void AvalancheEngine::fadeIn(byte n) {
- warning("STUB: fadeIn()");
+ if (tmpPal[2] >= 16)
+ pal[2] = tmpPal[2] - 16;
+ else
+ pal[2] = 0;
+
+ g_system->getPaletteManager()->setPalette(pal, j, 1);
+ }
+ _system->delayMillis(10);
+ _graphics->refreshScreen();
+ }
}
-void AvalancheEngine::dawn() {
- warning("STUB: dawn()");
+/**
+ * Displays a fade in, full screen.
+ * This version is different to the one in the original, which was fading in 3 steps.
+ * @remarks Originally called 'dawn'
+ */
+void AvalancheEngine::fadeIn() {
+ if (_holdTheDawn || !_fxHidden)
+ return;
+
+ _fxHidden = false;
+
+ byte pal[3];
+ for (int i = 15; i >= 0; i--) {
+ for (int j = 0; j < 16; j++) {
+ pal[0] = _fxPal[i][j][0];
+ pal[1] = _fxPal[i][j][1];
+ pal[2] = _fxPal[i][j][2];
+ g_system->getPaletteManager()->setPalette(pal, j, 1);
+ }
+ _system->delayMillis(10);
+ _graphics->refreshScreen();
+ }
+
+ if ((_room == kRoomYours) && _avvyInBed && _teetotal)
+ _graphics->setBackgroundColor(kColorYellow);
}
void AvalancheEngine::drawDirection() { // It's data is loaded in load_digits().
@@ -1344,7 +1393,7 @@ void AvalancheEngine::gameOver() {
}
void AvalancheEngine::minorRedraw() {
- dusk();
+ fadeOut();
enterRoom(_room, 0); // Ped unknown or non-existant.
@@ -1352,7 +1401,7 @@ void AvalancheEngine::minorRedraw() {
_scoreToDisplay[i] = -1; // impossible digits
drawScore();
- dawn();
+ fadeIn();
}
void AvalancheEngine::majorRedraw() {
@@ -1652,7 +1701,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) {
}
exitRoom(_room);
- dusk();
+ fadeOut();
for (int16 i = 1; i < _animation->kSpriteNumbMax; i++) {
if (_animation->_sprites[i]._quick)
@@ -1669,7 +1718,7 @@ void AvalancheEngine::flipRoom(Room room, byte ped) {
_animation->setDirection(_animation->_sprites[0]._facingDir);
drawDirection();
- dawn();
+ fadeIn();
}
/**
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index bfeb72737d..0414bf5333 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -748,7 +748,7 @@ void GraphicManager::setDialogColor(Color bg, Color text) {
// Original name background()
void GraphicManager::setBackgroundColor(Color x) {
- warning("STUB: setBackgroundColor(%d)", x);
+ warning("STUB: setBackgroundColor()");
}
} // End of namespace Avalanche
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index 48000a9730..ca97d4d1e8 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -1421,7 +1421,7 @@ void Parser::drink() {
_vm->_avvyIsAwake = false;
_vm->_avvyInBed = true;
_vm->refreshObjectList();
- _vm->dusk();
+ _vm->fadeOut();
_vm->flipRoom(kRoomYours, 1);
_vm->_graphics->setBackgroundColor(kColorYellow);
_vm->_animation->_sprites[0]._visible = false;
@@ -2348,17 +2348,17 @@ void Parser::doThat() {
_vm->_timer->addTimer(1, Timer::kProcAvvySitDown, Timer::kReasonSittingDown);
}
} else { // Default doodah.
- _vm->dusk();
- _vm->dawn();
+ _vm->fadeOut();
+ _vm->fadeIn();
Common::String tmpStr = Common::String::format("A few hours later...%cnothing much has happened...", kControlParagraph);
_vm->_dialogs->displayText(tmpStr);
}
break;
case kVerbCodeRestart:
if (_vm->_dialogs->displayQuestion("Restart game and lose changes?")) {
- _vm->dusk();
+ _vm->fadeOut();
_vm->newGame();
- _vm->dawn();
+ _vm->fadeIn();
}
break;
case kVerbCodePardon:
@@ -2383,12 +2383,12 @@ void Parser::doThat() {
}
void Parser::verbOpt(byte verb, Common::String &answer, char &ansKey) {
+ // kVerbCodegive isn't dealt with by this procedure, but by ddm__with.
switch (verb) {
case kVerbCodeExam:
answer = "Examine";
ansKey = 'x';
- break; // The ubiquitous one.
- // kVerbCodegive isn't dealt with by this procedure, but by ddm__with.
+ break;
case kVerbCodeDrink:
answer = "Drink";
ansKey = 'D';
diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp
index 7b45397183..433924f594 100644
--- a/engines/avalanche/pingo.cpp
+++ b/engines/avalanche/pingo.cpp
@@ -70,7 +70,7 @@ void Pingo::zonk() {
void Pingo::winningPic() {
Common::File f;
- _vm->dusk();
+ _vm->fadeOut();
if (!f.open("finale.avd"))
error("AVALANCHE: File not found: finale.avd");
@@ -89,7 +89,7 @@ void Pingo::winningPic() {
warning("STUB: Pingo::winningPic()");
- _vm->dawn();
+ _vm->fadeIn();
#if 0
do {
diff --git a/engines/avalanche/timer.cpp b/engines/avalanche/timer.cpp
index 28cdc3b54c..b4ba028242 100644
--- a/engines/avalanche/timer.cpp
+++ b/engines/avalanche/timer.cpp
@@ -149,7 +149,7 @@ void Timer::updateTimer() {
crapulusSaysSpludOut();
break;
case kProcDawnDelay:
- _vm->dawn();
+ _vm->fadeIn();
break;
case kProcBuyDrinks:
buyDrinks();