Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
GLK: FROTZ: Hooked up window property reading
  • Loading branch information
dreammaster committed Jan 3, 2019
1 parent df74a20 commit 642efa7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
27 changes: 6 additions & 21 deletions engines/glk/frotz/processor_windows.cpp
Expand Up @@ -178,18 +178,16 @@ void Processor::z_set_margins() {
}

void Processor::z_move_window(void) {
zword win = winarg0();

flush_buffer();

zword win = winarg0();
_wp[win].setPosition(Point(zargs[2], zargs[1]));
}

void Processor::z_window_size() {
zword win = winarg0();

flush_buffer();

zword win = winarg0();
_wp[win].setSize(Point(zargs[2], zargs[1]));
}

Expand Down Expand Up @@ -220,28 +218,15 @@ void Processor::z_window_style() {
}

void Processor::z_get_wind_prop() {
#ifdef TODO
flush_buffer();

if (zargs[1] < 16)
store(((zword *)(wp + winarg0()))[zargs[1]]);

else if (zargs[1] == 16)
store(os_to_true_colour(lo(wp[winarg0()].colour)));

else if (zargs[1] == 17) {

zword bg = hi(wp[winarg0()].colour);

if (bg == TRANSPARENT_COLOUR)
store((zword)-4);
else
store(os_to_true_colour(bg));
zword win = winarg0();
zword prop = zargs[1];

}
if (prop <= TRUE_BG_COLOR)
store(_wp[win][(WindowProperty)prop]);
else
runtimeError(ERR_ILL_WIN_PROP);
#endif
}

void Processor::z_put_wind_prop() {
Expand Down
23 changes: 17 additions & 6 deletions engines/glk/frotz/windows.cpp
Expand Up @@ -46,7 +46,6 @@ Window &Windows::operator[](uint idx) {

Window::Window() : _windows(nullptr), _win(nullptr), _tempVal(0) {}


winid_t Window::getWindow() {
if (!_win) {
// Window doesn't exist, so create it
Expand Down Expand Up @@ -94,24 +93,36 @@ uint16 Window::getProperty(WindowProperty propType) {

switch (propType) {
case Y_POS:
return win->_bbox.top;
return win->_bbox.top / g_conf->_monoInfo._cellH;
case X_POS:
return win->_bbox.left;
return win->_bbox.left / g_conf->_monoInfo._cellW;
case Y_SIZE:
return win->_bbox.height();
return win->_bbox.height() / g_conf->_monoInfo._cellH;
case X_SIZE:
return win->_bbox.width();
return win->_bbox.width() / g_conf->_monoInfo._cellW;
case Y_CURSOR:
return win->getCursor().y;
case X_CURSOR:
return win->getCursor().x;

default:
error("Read of an unimplemented property");
/*
LEFT_MARGIN = 6, RIGHT_MARGIN = 7, NEWLINE_INTERRUPT = 8, INTERRUPT_COUNTDOWN = 9,
TEXT_STYLE = 10, COLOUR_DATA = 11, FONT_NUMBER = 12, FONT_SIZE = 13, ATTRIBUTES = 14,
LINE_COUNT = 15, TRUE_FG_COLOR = 16, TRUE_BG_COLOR = 17
*/
case TRUE_FG_COLOR:
store(os_to_true_colour(lo(wp[winarg0()].colour)));
case TRUE_BG_COLOR:
zword bg = hi(wp[winarg0()].colour);
if (bg == TRANSPARENT_COLOUR)
store((zword)-4);
else
store(os_to_true_colour(bg));
*/
}
}

Expand Down

0 comments on commit 642efa7

Please sign in to comment.