From 410d548ac039eb0d071d6b6bd925414622ab3176 Mon Sep 17 00:00:00 2001 From: uruk Date: Sat, 8 Feb 2014 15:41:29 +0100 Subject: AVALANCHE: Implement GhostRoom::doBat(). --- engines/avalanche/ghostroom.cpp | 40 +++++++++++++++++++++++++++++++++++----- engines/avalanche/ghostroom.h | 2 -- 2 files changed, 35 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp index aee8b4f48d..98dd90974a 100644 --- a/engines/avalanche/ghostroom.cpp +++ b/engines/avalanche/ghostroom.cpp @@ -40,8 +40,6 @@ GhostRoom::GhostRoom(AvalancheEngine *vm) { _glerkStage = 0; _aarghCount = 0; - _batX = _batY = 0; - _batCount = 0; _greldetX = _greldetY = 0; _greldetCount = 0; _redGreldet = false; @@ -78,7 +76,39 @@ void GhostRoom::wait(uint16 howLong) { } void GhostRoom::doBat() { - warning("STUB: doBat()"); + static int16 batX = 277; + static int16 batY = 40; + static uint16 batCount = 0; + + batCount++; + + int8 dx, iy; + byte batImage; + if ((batCount % 2) == 1) { + if ((1 <= batCount) && (batCount <= 90)) { + dx = 2; + iy = 1; + batImage = 0; + } else if ((91 <= batCount) && (batCount <= 240)) { + dx = 1; + iy = 1; + batImage = 1; + } else if((241 <= batCount) && (batCount <= 260)) { + dx = 1; + iy = 4; + batImage = 2; + } + + if ((batCount == 91) || (batCount == 241)) // When the bat changes, blank out the old one. + _vm->_graphics->drawFilledRectangle(Common::Rect(batX + _bat[batImage].w, batY, batX + _bat[batImage - 1].w, batY + _bat[batImage - 1].h), kColorBlack); + + _vm->_graphics->drawFilledRectangle(Common::Rect(batX, batY, batX + _bat[batImage].w, batY + iy), kColorBlack); + _vm->_graphics->drawFilledRectangle(Common::Rect(batX + _bat[batImage].w - dx, batY, batX + _bat[batImage].w, batY + _bat[batImage].h), kColorBlack); + + batX -= dx; + batY++; + _vm->_graphics->ghostDrawPicture(_bat[batImage], batX, batY); + } } void GhostRoom::bigGreenEyes(byte how) { @@ -195,10 +225,10 @@ void GhostRoom::run() { _glerkStage++; } - _vm->_graphics->refreshScreen(); - doBat(); + _vm->_graphics->refreshScreen(); + wait(15); } diff --git a/engines/avalanche/ghostroom.h b/engines/avalanche/ghostroom.h index 3779fa0408..72ee8280cc 100644 --- a/engines/avalanche/ghostroom.h +++ b/engines/avalanche/ghostroom.h @@ -69,8 +69,6 @@ private: Graphics::Surface _greldet[6][2]; byte _glerkStage; - int16 _batX, _batY; - uint16 _batCount; int8 _aarghCount; int16 _greldetX, _greldetY; byte _greldetCount; -- cgit v1.2.3