MADS: In progress text draw methods for user interface

This commit is contained in:
Paul Gilbert 2014-03-16 17:50:47 -04:00
parent 4dd057edd9
commit 39a36064ac
4 changed files with 69 additions and 10 deletions

View File

@ -393,7 +393,7 @@ void Scene::doFrame() {
// Write any text needed by the interface
if (_vm->_game->_abortTimers2)
_userInterface.writeText();
_userInterface.drawTextElements();
// Draw any elements
drawElements((ScreenTransition)_vm->_game->_abortTimers2, _vm->_game->_abortTimers2);

View File

@ -45,7 +45,6 @@ ScreenObjects::ScreenObjects(MADSEngine *vm): _vm(vm) {
_v7FECA = 0;
_v7FED6 = 0;
_v8332A = 0;
_selectedObject = 0;
_category = CAT_NONE;
_objectIndex = 0;
_released = false;
@ -70,10 +69,10 @@ void ScreenObjects::check(bool scanFlag) {
_v7FECA = false;
if ((_vm->_events->_vD6 || _v8332A || _yp || _v8333C) && scanFlag) {
_selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI);
if (_selectedObject > 0) {
_category = (ScrCategory)((*this)[_selectedObject - 1]._category & 7);
_objectIndex = (*this)[_selectedObject - 1]._descId;
scene._userInterface._selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI);
if (scene._userInterface._selectedObject > 0) {
_category = (ScrCategory)((*this)[scene._userInterface._selectedObject - 1]._category & 7);
_objectIndex = (*this)[scene._userInterface._selectedObject - 1]._descId;
}
// Handling for easy mouse

View File

@ -41,6 +41,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) {
_screenObjectsCount = 0;
_inventoryTopIndex = 0;
_objectY = 0;
_selectedObject = -1;
byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT);
setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT);
@ -106,7 +107,7 @@ void UserInterface::setup(int id) {
scene._imageInterEntries.call(0, 0);
scene._action.clear();
writeText();
drawTextElements();
loadElements();
scene._dynamicHotspots.refresh();
}
@ -115,10 +116,38 @@ void UserInterface::elementHighlighted() {
warning("TODO: UserInterface::elementHighlighted");
}
void UserInterface::writeText() {
warning("TODO: UserInterface::writeText");
void UserInterface::drawTextElements() {
Scene &scene = _vm->_game->_scene;
if (scene._screenObjects._v832EC) {
drawTalkList();
} else {
// Draw the actions
drawActions();
drawInventoryList();
drawItemVocabList();
}
}
void UserInterface::drawActions() {
for (int idx = 0; idx < 10; ++idx) {
drawVocab(CAT_ACTION, idx);
}
}
void UserInterface::drawInventoryList() {
int endIndex = MIN((int)_vm->_game->_objects._inventoryList.size(), _inventoryTopIndex + 5);
for (int idx = _inventoryTopIndex; idx < endIndex; ++idx) {
drawVocab(CAT_INV_LIST, idx);
}
}
void UserInterface::drawItemVocabList() {
}
void UserInterface::drawVocab(ScrCategory category, int id) {
}
void UserInterface::setBounds(const Common::Rect &r) {
_bounds = r;
@ -273,4 +302,9 @@ void UserInterface::moveRect(Common::Rect &bounds) {
bounds.translate(0, MADS_SCENE_HEIGHT);
}
void UserInterface::drawTalkList() {
warning("TODO: drawTalkList");
}
} // End of namespace MADS

View File

@ -54,6 +54,31 @@ private:
* Reposition a bounding rectangle to physical co-ordinates
*/
void moveRect(Common::Rect &bounds);
/**
* Draw options during a conversation.
*/
void drawTalkList();
/**
* Draw the action list
*/
void drawActions();
/**
* Draw the inventory list
*/
void drawInventoryList();
/**
* Draw the inventory item vocab list
*/
void drawItemVocabList();
/**
* Draw a vocab text entry
*/
void drawVocab(ScrCategory category, int id);
public:
ScrCategory _category;
int _screenObjectsCount;
@ -62,6 +87,7 @@ public:
MSurface _surface;
int _inventoryTopIndex;
int _objectY;
int _selectedObject;
public:
/**
* Constructor
@ -80,7 +106,7 @@ public:
void elementHighlighted();
void writeText();
void drawTextElements();
void setBounds(const Common::Rect &r);
};