mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 19:54:03 +00:00
add Common::Rect::center (handy for ::setFocusRectangle())
svn-id: r29751
This commit is contained in:
parent
0718e41c82
commit
a34df6e72d
@ -200,6 +200,13 @@ struct Rect {
|
||||
void debugPrint(int debuglevel = 0, const char *caption = "Rect:") const {
|
||||
debug(debuglevel, "%s %d, %d, %d, %d", caption, left, top, right, bottom);
|
||||
}
|
||||
|
||||
/*! @brief create a rectangle around the given center */
|
||||
static Rect center(int16 cx, int16 cy, int16 w, int16 h) {
|
||||
w /= 2;
|
||||
h /= 2;
|
||||
return Rect(cx - w, cy - h, cx + w, cy + h);
|
||||
}
|
||||
};
|
||||
|
||||
} // End of namespace Common
|
||||
|
@ -1827,8 +1827,7 @@ void ScummEngine::setTalkingActor(int i) {
|
||||
|
||||
// Set the focus area to the calculated position
|
||||
// TODO: Make the size adjust depending on what it's focusing on.
|
||||
Common::Rect rect(x - 96, y - 64, x + 96, y + 64);
|
||||
_system->setFocusRectangle(rect);
|
||||
_system->setFocusRectangle(Common::Rect::center(x, y, 192, 128));
|
||||
}
|
||||
|
||||
if (_game.id == GID_MANIAC && _game.version <= 1 && !(_game.platform == Common::kPlatformNES))
|
||||
|
@ -2525,8 +2525,7 @@ void Logic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 bas
|
||||
int x = target->xcood - TOP_LEFT_X;
|
||||
int y = target->ycood - TOP_LEFT_Y;
|
||||
// TODO: Make the box size change based on the object that has the focus
|
||||
Common::Rect rect(x - 96, y - 64, x + 96, y + 64);
|
||||
_skyScreen->setFocusRectangle(rect);
|
||||
_skyScreen->setFocusRectangle(Common::Rect::center(x, y, 192, 128));
|
||||
|
||||
|
||||
if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT) || !speechFileFound) {
|
||||
|
@ -925,8 +925,7 @@ int32 Logic::fnISpeak(int32 *params) {
|
||||
// position.
|
||||
|
||||
if (_animId) {
|
||||
Common::Rect rect(_textX - 96, _textY - 64, _textX + 96, _textY + 64);
|
||||
_vm->_system->setFocusRectangle(rect);
|
||||
_vm->_system->setFocusRectangle(Common::Rect::center(_textX, _textY, 192, 128));
|
||||
}
|
||||
|
||||
// Is it to be speech or subtitles or both?
|
||||
|
Loading…
Reference in New Issue
Block a user