mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
SHERLOCK: RT: Implemented drawJournalControls
This commit is contained in:
parent
beb74228be
commit
0a8630ab46
@ -37,10 +37,10 @@ TattooEngine::TattooEngine(OSystem *syst, const SherlockGameDescription *gameDes
|
||||
_runningProlog = false;
|
||||
_fastMode = false;
|
||||
_allowFastMode = true;
|
||||
_transparentMenus = true;
|
||||
}
|
||||
|
||||
TattooEngine::~TattooEngine() {
|
||||
WidgetBase::freeInterfaceImages();
|
||||
}
|
||||
|
||||
void TattooEngine::showOpening() {
|
||||
@ -53,9 +53,6 @@ void TattooEngine::initialize() {
|
||||
// Initialize the base engine
|
||||
SherlockEngine::initialize();
|
||||
|
||||
// Further initialization
|
||||
WidgetBase::setInterfaceImages(new ImageFile("intrface.vgs"));
|
||||
|
||||
// Initialise the global flags
|
||||
_flags.resize(3200);
|
||||
_flags[1] = _flags[4] = _flags[76] = true;
|
||||
|
@ -32,7 +32,8 @@ namespace Tattoo {
|
||||
enum {
|
||||
INFO_TOP = 185,
|
||||
INFO_MIDDLE = 186,
|
||||
INFO_BOTTOM = 188
|
||||
INFO_BOTTOM = 188,
|
||||
MENU_BACKGROUND = 225
|
||||
};
|
||||
|
||||
class TattooEngine : public SherlockEngine {
|
||||
@ -57,6 +58,7 @@ public:
|
||||
bool _creditsActive;
|
||||
bool _runningProlog;
|
||||
bool _fastMode, _allowFastMode;
|
||||
bool _transparentMenus;
|
||||
public:
|
||||
TattooEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
|
||||
virtual ~TattooEngine();
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "sherlock/tattoo/tattoo_journal.h"
|
||||
#include "sherlock/tattoo/tattoo_scene.h"
|
||||
#include "sherlock/tattoo/tattoo_user_interface.h"
|
||||
#include "sherlock/sherlock.h"
|
||||
#include "sherlock/tattoo/tattoo.h"
|
||||
|
||||
namespace Sherlock {
|
||||
|
||||
@ -146,6 +146,96 @@ void TattooJournal::synchronize(Serializer &s) {
|
||||
}
|
||||
|
||||
void TattooJournal::drawJournalControls(int mode) {
|
||||
TattooEngine &vm = *(TattooEngine *)_vm;
|
||||
Screen &screen = *_vm->_screen;
|
||||
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||
ImageFile &images = *ui._interfaceImages;
|
||||
|
||||
Common::Rect r(JOURNAL_BAR_WIDTH, !mode ? (BUTTON_SIZE + screen.fontHeight() + 13) :
|
||||
(screen.fontHeight() + 4) * 2 + 9);
|
||||
r.moveTo((SHERLOCK_SCREEN_WIDTH - r.width()) / 2, !mode ? (SHERLOCK_SCREEN_HEIGHT - r.height()) :
|
||||
(SHERLOCK_SCREEN_HEIGHT - r.height()) / 2);
|
||||
|
||||
Common::Rect inner = r;
|
||||
inner.grow(-3);
|
||||
|
||||
if (vm._transparentMenus)
|
||||
ui.makeBGArea(inner);
|
||||
else
|
||||
screen._backBuffer1.fillRect(inner, MENU_BACKGROUND);
|
||||
|
||||
// Draw the four corners of the info box
|
||||
screen._backBuffer1.transBlitFrom(images[0], Common::Point(r.left, r.top));
|
||||
screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.top));
|
||||
screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.left, r.bottom - images[1]._height));
|
||||
screen._backBuffer1.transBlitFrom(images[1], Common::Point(r.right - images[1]._width, r.bottom - images[1]._height));
|
||||
|
||||
// Draw the top of the info box
|
||||
screen._backBuffer1.hLine(r.left + images[0]._width, r.top, r.right - images[0]._height, INFO_TOP);
|
||||
screen._backBuffer1.hLine(r.left + images[0]._width, r.top + 1, r.right - images[0]._height, INFO_MIDDLE);
|
||||
screen._backBuffer1.hLine(r.left + images[0]._width, r.top + 2, r.right - images[0]._height, INFO_BOTTOM);
|
||||
|
||||
// Draw the bottom of the info box
|
||||
screen._backBuffer1.hLine(r.left + images[0]._width, r.bottom - 3, r.right - images[0]._height, INFO_TOP);
|
||||
screen._backBuffer1.hLine(r.left + images[0]._width, r.bottom - 2, r.right - images[0]._height, INFO_MIDDLE);
|
||||
screen._backBuffer1.hLine(r.left + images[0]._width, r.bottom - 1, r.right - images[0]._height, INFO_BOTTOM);
|
||||
|
||||
// Draw the left side of the info box
|
||||
screen._backBuffer1.vLine(r.left, r.top + images[0]._height, r.bottom - images[2]._height, INFO_TOP);
|
||||
screen._backBuffer1.vLine(r.left + 1, r.top + images[0]._height, r.bottom - images[2]._height, INFO_MIDDLE);
|
||||
screen._backBuffer1.vLine(r.left + 2, r.top + images[0]._height, r.bottom - images[2]._height, INFO_BOTTOM);
|
||||
|
||||
// Draw the right side of the info box
|
||||
screen._backBuffer1.vLine(r.right - 3, r.top + images[0]._height, r.bottom - images[2]._height, INFO_TOP);
|
||||
screen._backBuffer1.vLine(r.right - 2, r.top + images[0]._height, r.bottom - images[2]._height, INFO_MIDDLE);
|
||||
screen._backBuffer1.vLine(r.right - 1, r.top + images[0]._height, r.bottom - images[2]._height, INFO_BOTTOM);
|
||||
|
||||
// Draw the sides of the separator bar above the scroll bar
|
||||
int yp = r.top + screen.fontHeight() + 7;
|
||||
screen._backBuffer1.transBlitFrom(images[4], Common::Point(r.left, yp - 1));
|
||||
screen._backBuffer1.transBlitFrom(images[5], Common::Point(r.right - images[5]._width, yp - 1));
|
||||
|
||||
// Draw the bar above the scroll bar
|
||||
screen._backBuffer1.hLine(r.left + images[4]._width, yp, r.right - images[5]._width, INFO_TOP);
|
||||
screen._backBuffer1.hLine(r.left + images[4]._width, yp + 1, r.right - images[5]._width, INFO_MIDDLE);
|
||||
screen._backBuffer1.hLine(r.left + images[4]._width, yp + 2, r.right - images[5]._width, INFO_BOTTOM);
|
||||
|
||||
if (mode != 2) {
|
||||
// Draw the Bars separating the Journal Commands
|
||||
int xp = r.right / 3;
|
||||
for (int idx = 0; idx < 2; ++idx) {
|
||||
screen._backBuffer1.transBlitFrom(images[6], Common::Point(xp - 2, r.top + 1));
|
||||
screen._backBuffer1.transBlitFrom(images[7], Common::Point(xp - 2, yp - 1));
|
||||
|
||||
screen._backBuffer1.hLine(xp - 1, r.top + 4, yp - 2, INFO_TOP);
|
||||
screen._backBuffer1.hLine(xp, r.top + 4, yp - 2, INFO_MIDDLE);
|
||||
screen._backBuffer1.hLine(xp + 1, r.top + 4, yp - 2, INFO_BOTTOM);
|
||||
xp = r.right / 3 * 2;
|
||||
}
|
||||
}
|
||||
|
||||
int savedSelector = _oldSelector;
|
||||
_oldSelector = 100;
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
highlightJournalControls(false);
|
||||
break;
|
||||
case 1:
|
||||
highlightSearchControls(false);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_oldSelector = savedSelector;
|
||||
}
|
||||
|
||||
void TattooJournal::highlightJournalControls(bool slamIt) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void TattooJournal::highlightSearchControls(bool slamIt) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
|
@ -33,6 +33,7 @@ namespace Tattoo {
|
||||
class TattooJournal : public Journal {
|
||||
private:
|
||||
ImageFile *_journalImages;
|
||||
int _selector, _oldSelector;
|
||||
|
||||
/**
|
||||
* Load the list of journal locations
|
||||
@ -44,6 +45,16 @@ private:
|
||||
* @param mode 0: Normal journal buttons, 1: Search interface
|
||||
*/
|
||||
void drawJournalControls(int mode);
|
||||
|
||||
/**
|
||||
* Draw the journal controls used by the journal
|
||||
*/
|
||||
void highlightJournalControls(bool slamIt);
|
||||
|
||||
/**
|
||||
* Draw the journal controls used in search mode
|
||||
*/
|
||||
void highlightSearchControls(bool slamIt);
|
||||
public:
|
||||
TattooJournal(SherlockEngine *vm);
|
||||
virtual ~TattooJournal() {}
|
||||
|
@ -51,6 +51,12 @@ TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm),
|
||||
_scrollHighlight = 0;
|
||||
_mask = _mask1 = nullptr;
|
||||
_maskCounter = 0;
|
||||
|
||||
_interfaceImages = new ImageFile("intrface.vgs");
|
||||
}
|
||||
|
||||
TattooUserInterface::~TattooUserInterface() {
|
||||
delete _interfaceImages;
|
||||
}
|
||||
|
||||
void TattooUserInterface::initScrollVars() {
|
||||
|
@ -36,6 +36,8 @@ namespace Sherlock {
|
||||
|
||||
namespace Tattoo {
|
||||
|
||||
#define BUTTON_SIZE 15 // Button width/height
|
||||
|
||||
class WidgetBase;
|
||||
|
||||
class TattooUserInterface : public UserInterface {
|
||||
@ -144,9 +146,10 @@ public:
|
||||
ImageFile *_mask, *_mask1;
|
||||
Common::Point _maskOffset;
|
||||
int _maskCounter;
|
||||
ImageFile *_interfaceImages;
|
||||
public:
|
||||
TattooUserInterface(SherlockEngine *vm);
|
||||
virtual ~TattooUserInterface() {}
|
||||
virtual ~TattooUserInterface();
|
||||
|
||||
/**
|
||||
* Handles restoring any areas of the back buffer that were/are covered by UI elements
|
||||
|
@ -29,17 +29,6 @@ namespace Sherlock {
|
||||
|
||||
namespace Tattoo {
|
||||
|
||||
ImageFile *WidgetBase::_interfaceImages;
|
||||
|
||||
void WidgetBase::setInterfaceImages(ImageFile *images) {
|
||||
_interfaceImages = images;
|
||||
}
|
||||
|
||||
void WidgetBase::freeInterfaceImages() {
|
||||
delete _interfaceImages;
|
||||
_interfaceImages = nullptr;
|
||||
}
|
||||
|
||||
WidgetBase::WidgetBase(SherlockEngine *vm) : _vm(vm) {
|
||||
}
|
||||
|
||||
@ -146,7 +135,8 @@ void WidgetBase::checkMenuPosition() {
|
||||
}
|
||||
|
||||
void WidgetBase::makeInfoArea(Surface &s) {
|
||||
ImageFile &images = *_interfaceImages;
|
||||
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||
ImageFile &images = *ui._interfaceImages;
|
||||
|
||||
// Draw the four corners of the Info Box
|
||||
s.transBlitFrom(images[0], Common::Point(0, 0));
|
||||
|
@ -38,8 +38,6 @@ namespace Tattoo {
|
||||
class WidgetBase {
|
||||
private:
|
||||
Common::Rect _oldBounds;
|
||||
protected:
|
||||
static ImageFile *_interfaceImages;
|
||||
protected:
|
||||
SherlockEngine *_vm;
|
||||
Common::Rect _bounds;
|
||||
@ -70,16 +68,6 @@ protected:
|
||||
* Returns the current scroll position
|
||||
*/
|
||||
virtual const Common::Point &getCurrentScroll() const;
|
||||
public:
|
||||
/**
|
||||
* Sets the interface images used for drawing the various types of window elements
|
||||
*/
|
||||
static void setInterfaceImages(ImageFile *images);
|
||||
|
||||
/**
|
||||
* Frees the interface images
|
||||
*/
|
||||
static void freeInterfaceImages();
|
||||
public:
|
||||
WidgetBase(SherlockEngine *vm);
|
||||
virtual ~WidgetBase() {}
|
||||
|
@ -33,7 +33,6 @@ namespace Tattoo {
|
||||
#define INVENTORY_YSIZE 70 // Height of the box that surrounds inventory items
|
||||
#define NUM_INVENTORY_SHOWN 8 // Number of Inventory Items Shown
|
||||
#define MAX_INV_COMMANDS 10 // Maximum elements in dialog
|
||||
#define BUTTON_SIZE 15 // Button width/height
|
||||
|
||||
// TODO: Refactor into FixedText
|
||||
#define S_INV6 "Foolscap"
|
||||
@ -482,7 +481,7 @@ void WidgetInventory::handleEvents() {
|
||||
makeInfoArea(_menuSurface);
|
||||
|
||||
// Draw the Verb commands and the lines separating them
|
||||
ImageFile &images = *_interfaceImages;
|
||||
ImageFile &images = *ui._interfaceImages;
|
||||
for (int idx = 0; idx < (int)_inventCommands.size(); ++idx) {
|
||||
_menuSurface.writeString(_inventCommands[idx], Common::Point((_menuBounds.width() -
|
||||
_menuSurface.stringWidth(_inventCommands[idx])) / 2, (_menuSurface.fontHeight() + 7) * idx + 5), INFO_TOP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user