MADS: Completed UserInterface::loadElements

This commit is contained in:
Paul Gilbert 2014-03-15 21:33:15 -04:00
parent c4ed42e6d5
commit 630679a5c8
8 changed files with 63 additions and 9 deletions

View File

@ -265,6 +265,10 @@ void Game::initSection(int sectionNumber) {
_vm->_palette->resetGamePalette(18, 10);
_vm->_palette->setLowRange();
if (_scene._layer == LAYER_GUI)
_vm->_palette->setPalette(_vm->_palette->_mainPalette, 0, 4);
_vm->_events->loadCursors("*CURSOR.SS");
assert(_vm->_events->_cursorSprites);

View File

@ -129,7 +129,8 @@ void DynamicHotspots::refresh() {
switch (_vm->_game->_scene._screenObjects._v832EC) {
case 0:
case 2:
_vm->_game->_scene._screenObjects.add(dh._bounds, CAT_12, dh._descId);
_vm->_game->_scene._screenObjects.add(dh._bounds, _vm->_game->_scene._layer,
CAT_12, dh._descId);
_vm->_game->_scene._screenObjects._v8333C = true;
break;
default:

View File

@ -51,6 +51,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm),
_activeAnimation = nullptr;
_textSpacing = -1;
_frameStartTime = 0;
_layer = LAYER_GUI;
_verbList.push_back(VerbInit(VERB_LOOK, 2, 0));
_verbList.push_back(VerbInit(VERB_TAKE, 2, 0));

View File

@ -127,6 +127,7 @@ public:
int _destFacing;
Common::Point _posAdjust;
uint32 _frameStartTime;
Layer _layer;
/**
* Constructor

View File

@ -51,14 +51,14 @@ ScreenObjects::ScreenObjects(MADSEngine *vm): _vm(vm) {
_released = false;
}
void ScreenObjects::add(const Common::Rect &bounds, ScrCategory category, int descId) {
void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) {
assert(size() < 100);
ScreenObject so;
so._bounds = bounds;
so._category = category;
so._descId = descId;
so._layer = 0x1413;
so._layer = layer;
push_back(so);
}
@ -119,7 +119,7 @@ void ScreenObjects::check(bool scanFlag) {
scene._action.refresh();
// Loop through image inter list
warning("TODO: iimageInterList loop");
warning("TODO: imageInterList loop");
}
int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) {

View File

@ -102,7 +102,7 @@ public:
/**
* Add a new item to the list
*/
void add(const Common::Rect &bounds, ScrCategory category, int descId);
void add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId);
/**
*/

View File

@ -130,9 +130,56 @@ void UserInterface::loadElements() {
scene._screenObjects.clear();
if (!scene._screenObjects._v832EC) {
// Set up screen objects for the inventory scroller
for (int idx = 1; idx <= 3; ++idx) {
getBounds(CAT_INV_SCROLLER, idx, bounds);
// TODO
moveRect(bounds);
scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_SCROLLER, idx);
}
// Set up actions
for (int idx = 0; idx < 10; ++idx) {
getBounds(CAT_ACTION, idx, bounds);
moveRect(bounds);
scene._screenObjects.add(bounds, LAYER_GUI, CAT_ACTION, idx);
}
// Set up inventory list
for (int idx = 0; idx < 5; ++idx) {
getBounds(CAT_INV_LIST, idx, bounds);
moveRect(bounds);
scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_LIST, idx);
}
// Set up the inventory vocab list
for (int idx = 0; idx < 5; ++idx) {
getBounds(CAT_INV_VOCAB, idx, bounds);
moveRect(bounds);
scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_VOCAB, idx);
}
// Set up the inventory item picture
scene._screenObjects.add(Common::Rect(160, 159, 231, 194), LAYER_GUI,
CAT_INV_ANIM, 0);
}
if (!scene._screenObjects._v832EC || scene._screenObjects._v832EC == 2) {
for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) {
Hotspot &hs = scene._hotspots[hotspotIdx];
scene._screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx);
}
}
if (scene._screenObjects._v832EC == 1) {
for (int idx = 0; idx < 5; ++idx) {
getBounds(CAT_6, idx, bounds);
moveRect(bounds);
scene._screenObjects.add(bounds, LAYER_GUI, CAT_6, idx);
}
}
}
@ -222,8 +269,8 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds)
return true;
}
void UserInterface::extendRect(Common::Rect &bounds) {
void UserInterface::moveRect(Common::Rect &bounds) {
bounds.translate(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT);
}
} // End of namespace MADS

View File

@ -53,7 +53,7 @@ private:
/**
* Reposition a bounding rectangle to physical co-ordinates
*/
void extendRect(Common::Rect &bounds);
void moveRect(Common::Rect &bounds);
public:
ScrCategory _category;
int _screenObjectsCount;