aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hdb/gfx.cpp1
-rw-r--r--engines/hdb/gfx.h3
-rw-r--r--engines/hdb/hdb.cpp49
-rw-r--r--engines/hdb/hdb.h19
-rw-r--r--engines/hdb/map.cpp7
5 files changed, 75 insertions, 4 deletions
diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp
index 1000d97694..9ba60400a9 100644
--- a/engines/hdb/gfx.cpp
+++ b/engines/hdb/gfx.cpp
@@ -199,6 +199,7 @@ void Gfx::fillScreen(uint32 color) {
void Gfx::updateVideo() {
updateFade();
+ g_hdb->checkProgress();
debug(9, "STUB: Gfx::updateVideo incomplete");
}
diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h
index a9df0c349e..28ebcbafec 100644
--- a/engines/hdb/gfx.h
+++ b/engines/hdb/gfx.h
@@ -42,7 +42,8 @@ enum {
kAnimFrameDelay = kGameFPS / 30,
kAnimSlowFrames = kAnimFrameDelay * 10,
kAnimMediumFrames = kAnimFrameDelay * 6,
- kAnimFastFrames = kAnimFrameDelay * 2
+ kAnimFastFrames = kAnimFrameDelay * 2,
+ kProgressY = (kScreenHeight - 64)
};
class Tile;
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index d0b4b51e94..f4cc45f439 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -118,6 +118,10 @@ bool HDBGame::init() {
_menu->init();
+ _progressGfx = _gfx->loadPic(PIC_LOADBAR);
+ _progressMarkGfx = _gfx->loadPic(PIC_LOADSTAR);
+ _logoGfx = NULL;
+
_changeLevel = false;
_changeMapname[0] = 0;
_loadInfo.active = _saveInfo.active = false;
@@ -127,6 +131,7 @@ bool HDBGame::init() {
_gameShutdown = false;
_pauseFlag = 0;
_systemInit = true;
+ _loadingScreenGfx = _gfx->loadPic(PIC_LOADSCREEN);
return true;
}
@@ -264,7 +269,17 @@ void HDBGame::paint() {
_gfx->drawPointer();
break;
case GAME_LOADING:
- warning("STUB: Gfx::DrawLoadingScreen required");
+ // clear video, then draw HDB logo
+ drawLoadingScreen();
+
+ // if the graphic has never been loaded, load it now and leave it in memory
+ if (!_logoGfx)
+ _logoGfx = _gfx->loadPic(TITLELOGO);
+ _logoGfx->drawMasked(kScreenWidth / 2 - _logoGfx->_width / 2, 10);
+
+ int x = kScreenWidth / 2 - _progressGfx->_width / 2;
+ int pixels = _progressGfx->_width - _progressMarkGfx->_width;
+ _progressXOffset = (int)(((double)pixels / _progressMax) * (double)_progressCurrent) + x;
break;
}
@@ -670,6 +685,38 @@ void HDBGame::useEntity(AIEntity *e) {
}
}
+void HDBGame::setupProgressBar(int maxCount) {
+ _progressMax = maxCount;
+ _progressCurrent = 0;
+ _progressActive = true;
+}
+
+void HDBGame::drawProgressBar() {
+ if (!_progressActive)
+ return;
+
+ GameState temp = _gameState;
+ _gameState = GAME_LOADING;
+ _gameState = temp;
+}
+
+void HDBGame::checkProgress() {
+ int x, i;
+
+ if (!_progressActive)
+ return;
+
+ x = kScreenWidth / 2 - _progressGfx->_width / 2;
+ _progressGfx->drawMasked(x, kProgressY);
+ for (i = x; i < _progressXOffset; i += _progressMarkGfx->_width)
+ _progressMarkGfx->drawMasked(i, kProgressY);
+ _progressMarkGfx->drawMasked(_progressXOffset, kProgressY);
+}
+
+void HDBGame::drawLoadingScreen() {
+ _loadingScreenGfx->draw(0, 0);
+}
+
struct {
const char *fName, *printName;
} mapNames[] = {
diff --git a/engines/hdb/hdb.h b/engines/hdb/hdb.h
index 9ba967a917..739a00e3f1 100644
--- a/engines/hdb/hdb.h
+++ b/engines/hdb/hdb.h
@@ -200,6 +200,18 @@ public:
void setTargetXY(int x, int y);
void useEntity(AIEntity *e);
+ void setupProgressBar(int maxCount);
+ void drawProgressBar();
+ void makeProgress() {
+ _progressCurrent++;
+ drawProgressBar();
+ }
+ void checkProgress();
+ void stopProgress() {
+ _progressActive = false;
+ }
+ void drawLoadingScreen();
+
int getActionMode() {
return _actionMode;
}
@@ -290,8 +302,15 @@ private:
bool _systemInit;
GameState _gameState;
int _actionMode; // 0 or 1
+
+ // Misc Variables
int _pauseFlag;
+
bool _cheating;
+ Picture *_progressGfx, *_progressMarkGfx;
+ Picture *_loadingScreenGfx, *_logoGfx;
+ bool _progressActive;
+ int _progressCurrent, _progressXOffset, _progressMax;
char _currentMapname[64];
char _lastMapname[64];
diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp
index dd36d03c88..29183c8f16 100644
--- a/engines/hdb/map.cpp
+++ b/engines/hdb/map.cpp
@@ -572,8 +572,11 @@ bool Map::load(Common::SeekableReadStream *stream) {
};
// Scan all icons and init all Entities
- warning("STUB: Map::load: SetupProgressBar");
+ g_hdb->setupProgressBar(_iconNum);
for (int i = 0; i < _iconNum; i++) {
+
+ g_hdb->makeProgress();
+
// Don't spawn Action Mode Entities in Puzzle Mode
if (!g_hdb->getActionMode()) {
switch (aiInfo[_iconList[i].icon].type) {
@@ -587,7 +590,7 @@ bool Map::load(Common::SeekableReadStream *stream) {
case ITEM_SLUGSLINGER:
continue;
default:
- warning("MAP-LOADER: load: Unintended Type");
+ break;
}
}