GLK: FROTZ: Fix drawing position of pillars in Zork Zero
This commit is contained in:
parent
e07b5670f2
commit
75aaf5eb82
4 changed files with 29 additions and 12 deletions
|
@ -106,6 +106,7 @@ void GlkInterface::initialize() {
|
||||||
_wp._lower = glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
|
_wp._lower = glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
|
||||||
glk_window_get_size(_wp._lower, &width, &height);
|
glk_window_get_size(_wp._lower, &width, &height);
|
||||||
glk_window_close(_wp._lower, nullptr);
|
glk_window_close(_wp._lower, nullptr);
|
||||||
|
_wp._lower = nullptr;
|
||||||
|
|
||||||
gos_channel = nullptr;
|
gos_channel = nullptr;
|
||||||
|
|
||||||
|
@ -289,12 +290,14 @@ bool GlkInterface::os_picture_data(int picture, uint *height, uint *width) {
|
||||||
*height = _pics->size();
|
*height = _pics->size();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
bool result = glk_image_get_info(picture, width, height);
|
uint fullWidth, fullHeight;
|
||||||
|
bool result = glk_image_get_info(picture, &fullWidth, &fullHeight);
|
||||||
|
|
||||||
int cellW = g_conf->_monoInfo._cellW;
|
int x_scale = g_system->getWidth();
|
||||||
int cellH = g_conf->_monoInfo._cellH;
|
int y_scale = g_system->getHeight();
|
||||||
*width = (*width + cellW - 1) / cellW;
|
|
||||||
*height = (*height + cellH - 1) / cellH;
|
*width = roundDiv(fullWidth * h_screen_cols, x_scale);
|
||||||
|
*height = roundDiv(fullHeight * h_screen_rows, y_scale);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -392,8 +395,7 @@ void GlkInterface::split_window(zword lines) {
|
||||||
curr_status_ht = lines;
|
curr_status_ht = lines;
|
||||||
}
|
}
|
||||||
mach_status_ht = lines;
|
mach_status_ht = lines;
|
||||||
if (cury > lines)
|
if (cury > lines) {
|
||||||
{
|
|
||||||
glk_window_move_cursor(_wp._upper, 0, 0);
|
glk_window_move_cursor(_wp._upper, 0, 0);
|
||||||
curx = cury = 1;
|
curx = cury = 1;
|
||||||
}
|
}
|
||||||
|
@ -611,5 +613,14 @@ zchar GlkInterface::os_read_line(int max, zchar *buf, int timeout, int width, in
|
||||||
return ZC_RETURN;
|
return ZC_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint GlkInterface::roundDiv(uint x, uint y) {
|
||||||
|
uint quotient = x / y;
|
||||||
|
uint dblremain = (x % y) << 1;
|
||||||
|
|
||||||
|
if ((dblremain > y) || ((dblremain == y) && (quotient & 1)))
|
||||||
|
quotient++;
|
||||||
|
return quotient;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Frotz
|
} // End of namespace Frotz
|
||||||
} // End of namespace Glk
|
} // End of namespace Glk
|
||||||
|
|
|
@ -109,6 +109,11 @@ private:
|
||||||
* Add any Sound subfolder or sound zip file for access
|
* Add any Sound subfolder or sound zip file for access
|
||||||
*/
|
*/
|
||||||
void addSound();
|
void addSound();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do a rounding division, rounding to even if fraction part is 1/2.
|
||||||
|
*/
|
||||||
|
uint roundDiv(uint x, uint y);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Return the length of the character in screen units.
|
* Return the length of the character in screen units.
|
||||||
|
|
|
@ -50,14 +50,15 @@ void Windows::setup(bool isVersion6) {
|
||||||
_background = g_vm->glk_window_open(0, 0, 0, wintype_Graphics, 0);
|
_background = g_vm->glk_window_open(0, 0, 0, wintype_Graphics, 0);
|
||||||
_background->setBackgroundColor(0xffffff);
|
_background->setBackgroundColor(0xffffff);
|
||||||
|
|
||||||
|
MonoFontInfo &fi = g_vm->_conf->_monoInfo;
|
||||||
_lower = g_vm->glk_window_open(g_vm->glk_window_get_root(),
|
_lower = g_vm->glk_window_open(g_vm->glk_window_get_root(),
|
||||||
winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextBuffer, 0);
|
winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextBuffer, 0);
|
||||||
_upper = g_vm->glk_window_open(g_vm->glk_window_get_root(),
|
_upper = g_vm->glk_window_open(g_vm->glk_window_get_root(),
|
||||||
winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextGrid, 0);
|
winmethod_Arbitrary | winmethod_Fixed, 0, wintype_TextGrid, 0);
|
||||||
_upper.setPosition(Point(0, 0));
|
_upper.setPosition(Point(1, 1));
|
||||||
_upper.setSize(Point(320, 8));
|
_upper.setSize(Point(g_system->getWidth() / fi._cellW, 1));
|
||||||
_lower.setPosition(Point(0, 8));
|
_lower.setPosition(Point(1, 2));
|
||||||
_lower.setSize(Point(320, 200 - 8));
|
_lower.setSize(Point(g_system->getWidth() / fi._cellW, g_system->getHeight() / fi._cellH - 1));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_lower = g_vm->glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
|
_lower = g_vm->glk_window_open(0, 0, 0, wintype_TextBuffer, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue