mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-05 17:20:30 +00:00
EMI: Always reposition from original coordinates
This commit is contained in:
parent
faa0c3430a
commit
14b485569b
@ -174,8 +174,8 @@ void Lua_V1::BlastText() {
|
||||
}
|
||||
|
||||
void Lua_V1::SetOffscreenTextPos() {
|
||||
// called with (0,0) on dialog entry, (nil, nil) on dialog exit
|
||||
warning("Lua_V1::SetOffscreenTextPos: implement opcode");
|
||||
// this sets where we shouldn't put dialog maybe?
|
||||
}
|
||||
|
||||
void Lua_V1::TextFileGetLine() {
|
||||
|
@ -146,24 +146,20 @@ void TextObject::destroy() {
|
||||
}
|
||||
|
||||
void TextObject::reposition() {
|
||||
// In EMI most stuff seems to be relative to the center,
|
||||
// but sometimes it is not so I catch that with _x being over 320.
|
||||
// This is probably not the corrent way to do it though.
|
||||
if (!_positioned && g_grim->getGameType() == GType_MONKEY4) {
|
||||
_positioned = true;
|
||||
if (_x == 0) {
|
||||
_x += 320;
|
||||
if (_y < 0) {
|
||||
_y = -_y;
|
||||
} else {
|
||||
_y = 240 - _y;
|
||||
}
|
||||
} else if (_x > 320) {
|
||||
_y = -_y;
|
||||
if (_positioned)
|
||||
return;
|
||||
|
||||
_positioned = true;
|
||||
_posX = _x;
|
||||
_posY = _y;
|
||||
if (g_grim->getGameType() == GType_MONKEY4) {
|
||||
if (_isSpeech) {
|
||||
_posY = 480 - _y;
|
||||
} else {
|
||||
_x += 320;
|
||||
_y = 240 - _y;
|
||||
_posX = _x + 320;
|
||||
_posY = - _y;
|
||||
}
|
||||
Debug::debug(Debug::TextObjects, "Repositioning (%d, %d) -> (%d, %d)", _x, _y, _posX, _posY);
|
||||
}
|
||||
}
|
||||
|
||||
@ -196,10 +192,10 @@ void TextObject::setupText() {
|
||||
// If the speaker is too close to the edge of the screen we have to make
|
||||
// some room for the subtitles.
|
||||
if (_isSpeech){
|
||||
if (_x < SCREEN_MARGIN) {
|
||||
_x = SCREEN_MARGIN;
|
||||
} else if (SCREEN_WIDTH - _x < SCREEN_MARGIN) {
|
||||
_x = SCREEN_WIDTH - SCREEN_MARGIN;
|
||||
if (_posX < SCREEN_MARGIN) {
|
||||
_posX = SCREEN_MARGIN;
|
||||
} else if (SCREEN_WIDTH - _posX < SCREEN_MARGIN) {
|
||||
_posX = SCREEN_WIDTH - SCREEN_MARGIN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,11 +204,11 @@ void TextObject::setupText() {
|
||||
// with GrimE.
|
||||
int maxWidth = 0;
|
||||
if (_justify == CENTER) {
|
||||
maxWidth = 2 * MIN(_x, SCREEN_WIDTH - _x);
|
||||
maxWidth = 2 * MIN(_posX, SCREEN_WIDTH - _posX);
|
||||
} else if (_justify == LJUSTIFY) {
|
||||
maxWidth = SCREEN_WIDTH - _x;
|
||||
maxWidth = SCREEN_WIDTH - _posX;
|
||||
} else if (_justify == RJUSTIFY) {
|
||||
maxWidth = _x;
|
||||
maxWidth = _posX;
|
||||
}
|
||||
|
||||
// We break the message to lines not longer than maxWidth
|
||||
@ -269,9 +265,9 @@ void TextObject::setupText() {
|
||||
// printed further down the screen.
|
||||
const int SCREEN_TOP_MARGIN = 16;
|
||||
if (_isSpeech) {
|
||||
_y -= _numberLines * _font->getHeight();
|
||||
if (_y < SCREEN_TOP_MARGIN) {
|
||||
_y = SCREEN_TOP_MARGIN;
|
||||
_posY -= _numberLines * _font->getHeight();
|
||||
if (_posY < SCREEN_TOP_MARGIN) {
|
||||
_posY = SCREEN_TOP_MARGIN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,11 +295,11 @@ void TextObject::setupText() {
|
||||
}
|
||||
|
||||
int TextObject::getLineX(int line) {
|
||||
int x = _x;
|
||||
int x = _posX;
|
||||
if (_justify == CENTER)
|
||||
x = _x - (_font->getStringLength(_lines[line]) / 2);
|
||||
x = _posX - (_font->getStringLength(_lines[line]) / 2);
|
||||
else if (_justify == RJUSTIFY)
|
||||
x = _x - getBitmapWidth();
|
||||
x = _posX - getBitmapWidth();
|
||||
|
||||
if (x < 0)
|
||||
x = 0;
|
||||
@ -311,20 +307,20 @@ int TextObject::getLineX(int line) {
|
||||
}
|
||||
|
||||
int TextObject::getLineY(int line) {
|
||||
int y = _y;
|
||||
int y = _posY;
|
||||
if (_blastDraw)
|
||||
y = _y + 5;
|
||||
y = _posY + 5;
|
||||
else {
|
||||
if (_font->getHeight() == 21) // talk_font,verb_font
|
||||
y = _y - 6;
|
||||
y = _posY - 6;
|
||||
else if (_font->getHeight() == 26) // special_font
|
||||
y = _y - 12;
|
||||
y = _posY - 12;
|
||||
else if (_font->getHeight() == 13) // computer_font
|
||||
y = _y - 6;
|
||||
y = _posY - 6;
|
||||
else if (_font->getHeight() == 19) // pt_font
|
||||
y = _y - 9;
|
||||
y = _posY - 9;
|
||||
else
|
||||
y = _y;
|
||||
y = _posY;
|
||||
}
|
||||
if (y < 0)
|
||||
y = 0;
|
||||
|
@ -62,6 +62,7 @@ protected:
|
||||
|
||||
Color _fgColor;
|
||||
int _x, _y;
|
||||
int _posX, _posY;
|
||||
int _width, _height;
|
||||
int _justify;
|
||||
Font *_font;
|
||||
|
Loading…
Reference in New Issue
Block a user