From 5f7847d88d2c0a98d778ddd42a2f53df39b6a6fc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 25 May 2009 16:30:39 +0000 Subject: Re-enabled the code for correct text positioning - it should work correctly now svn-id: r40891 --- engines/sci/engine/kgraphics.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'engines') diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 3aefbe4c8d..884ac346db 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -3267,32 +3267,24 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { } } - // FIXME: This code places texts incorrectly on screen. Apparently, it was used for latter SCI1 games - // (1.000.510 onwards), like Eco Quest 1. It has been replaced with clipping code instead -#if 0 - // If the text does not fit on the screen, move it to the left and upwards until it does - if (halign == ALIGN_LEFT) + if (halign == ALIGN_LEFT) { + // If the text does not fit on the screen, move it to the left and upwards until it does GFX_ASSERT(gfxop_get_text_params(s->gfx_state, font_nr, text, area.width, &area.width, &area.height, 0, NULL, NULL, NULL)); - // Make the text fit on the screen - if (area.x + area.width > 320) - area.x += 320 - area.x - area.width; // Plus negative number = subtraction + // Make the text fit on the screen + if (area.x + area.width > 320) + area.x += 320 - area.x - area.width; // Plus negative number = subtraction - if (area.y + area.height > 200) - area.y += 200 - area.y - area.height; // Plus negative number = subtraction -#else - // If the text does not fit on the screen, clip it till it does - if (area.x + area.width > s->gfx_state->pic_port_bounds.width) { - warning("Text does not fit on screen width, clipping it"); - area.width = s->gfx_state->pic_port_bounds.width - area.x; - } + if (area.y + area.height > 200) + area.y += 200 - area.y - area.height; // Plus negative number = subtraction + } else { + // If the text does not fit on the screen, clip it till it does + if (area.x + area.width > s->gfx_state->pic_port_bounds.width) + area.width = s->gfx_state->pic_port_bounds.width - area.x; - if (area.y + area.height > s->gfx_state->pic_port_bounds.height) { - warning("Text does not fit on screen height, clipping it"); - area.height = s->gfx_state->pic_port_bounds.height - area.y; + if (area.y + area.height > s->gfx_state->pic_port_bounds.height) + area.height = s->gfx_state->pic_port_bounds.height - area.y; } -#endif - if (gray) color1 = &bg_color; -- cgit v1.2.3