aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gui32
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-14 09:28:58 +0000
committerFilippos Karapetis2009-10-14 09:28:58 +0000
commit8570068f584ad48b50d5fd0fa77cafb447e9a302 (patch)
tree663a302cb0c310dfa120bddbac48690143569374 /engines/sci/gui32
parent8c17b257eab6c7b84e0a779ae1a1cb068cc44cce (diff)
downloadscummvm-rg350-8570068f584ad48b50d5fd0fa77cafb447e9a302.tar.gz
scummvm-rg350-8570068f584ad48b50d5fd0fa77cafb447e9a302.tar.bz2
scummvm-rg350-8570068f584ad48b50d5fd0fa77cafb447e9a302.zip
- Moved cel width and height calculation in the GUI
- Merged the engine states of the old and new GUI svn-id: r45057
Diffstat (limited to 'engines/sci/gui32')
-rw-r--r--engines/sci/gui32/gui32.cpp944
-rw-r--r--engines/sci/gui32/gui32.h3
2 files changed, 466 insertions, 481 deletions
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index e6a525dd9b..f7c3449162 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -42,26 +42,6 @@
// This is the real width of a text with a specified width of 0
#define MAX_TEXT_WIDTH_MAGIC_VALUE 192
-#define ADD_TO_CURRENT_PORT(widget) \
- {if (s->port) \
- s->port->add((GfxContainer *)s->port, widget); \
- else \
- s->picture_port->add((GfxContainer *)s->visual, widget);}
-
-#define ADD_TO_CURRENT_PICTURE_PORT(widget) \
- {if (s->port) \
- s->port->add((GfxContainer *)s->port, widget); \
- else \
- s->picture_port->add((GfxContainer *)s->picture_port, widget);}
-
-#define ADD_TO_WINDOW_PORT(widget) \
- s->wm_port->add((GfxContainer *)s->wm_port, widget);
-
-#define FULL_REDRAW()\
- if (s->visual) \
- s->visual->draw(gfxw_point_zero); \
- gfxop_update(s->gfx_state);
-
#define K_DRAWPIC_FLAG_MIRRORED (1 << 14)
namespace Sci {
@@ -72,48 +52,49 @@ namespace Sci {
#define MAX_TEXT_WIDTH_MAGIC_VALUE 192
#define ADD_TO_CURRENT_PORT(widget) \
- {if (s->port) \
- s->port->add((GfxContainer *)s->port, widget); \
+ {if (_s->port) \
+ _s->port->add((GfxContainer *)_s->port, widget); \
else \
- s->picture_port->add((GfxContainer *)s->visual, widget);}
+ _s->picture_port->add((GfxContainer *)_s->visual, widget);}
#define ADD_TO_CURRENT_PICTURE_PORT(widget) \
- {if (s->port) \
- s->port->add((GfxContainer *)s->port, widget); \
+ {if (_s->port) \
+ _s->port->add((GfxContainer *)_s->port, widget); \
else \
- s->picture_port->add((GfxContainer *)s->picture_port, widget);}
+ _s->picture_port->add((GfxContainer *)_s->picture_port, widget);}
#define ADD_TO_WINDOW_PORT(widget) \
- s->wm_port->add((GfxContainer *)s->wm_port, widget);
+ _s->wm_port->add((GfxContainer *)_s->wm_port, widget);
#define FULL_REDRAW()\
- if (s->visual) \
- s->visual->draw(gfxw_point_zero); \
- gfxop_update(s->gfx_state);
+ if (_s->visual) \
+ _s->visual->draw(gfxw_point_zero); \
+ gfxop_update(_s->gfx_state);
#if 0
// Used for debugging
#define FULL_INSPECTION()\
- if (s->visual) \
- s->visual->print(s->visual, 0);
+ if (_s->visual) \
+ _s->visual->print(_s->visual, 0);
#endif
// was static
void assert_primary_widget_lists(EngineState *s) {
+ EngineState *_s = s;
if (!s->dyn_views) {
- rect_t bounds = s->picture_port->_bounds;
+ rect_t bounds = _s->picture_port->_bounds;
s->dyn_views = gfxw_new_list(bounds, GFXW_LIST_SORTED);
s->dyn_views->_flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS;
- ADD_TO_CURRENT_PICTURE_PORT(s->dyn_views);
+ ADD_TO_CURRENT_PICTURE_PORT(_s->dyn_views);
}
if (!s->drop_views) {
- rect_t bounds = s->picture_port->_bounds;
+ rect_t bounds = _s->picture_port->_bounds;
s->drop_views = gfxw_new_list(bounds, GFXW_LIST_SORTED);
s->drop_views->_flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS;
- ADD_TO_CURRENT_PICTURE_PORT(s->drop_views);
+ ADD_TO_CURRENT_PICTURE_PORT(_s->drop_views);
}
}
@@ -130,7 +111,7 @@ void reparentize_primary_widget_lists(EngineState *s, GfxPort *newport) {
}
int _find_view_priority(EngineState *s, int y) {
- /*if (s->version <= SCI_VERSION_LTU_PRIORITY_OB1)
+ /*if (_s->version <= SCI_VERSION_LTU_PRIORITY_OB1)
++y; */
if (s->pic_priority_table) { // SCI01 priority table set?
@@ -172,7 +153,7 @@ int _find_priority_band(EngineState *s, int nr) {
else
retval = SCI0_PRIORITY_BAND_FIRST(nr);
-/* if (s->version <= SCI_VERSION_LTU_PRIORITY_OB1)
+/* if (_s->version <= SCI_VERSION_LTU_PRIORITY_OB1)
--retval; */
return retval;
}
@@ -265,19 +246,19 @@ void _k_redraw_box(EngineState *s, int x1, int y1, int x2, int y2) {
int i;
ViewObject *list = s->dyn_views;
- printf("Reanimating views\n", s->dyn_views_nr);
+ printf("Reanimating views\n", _s->dyn_views_nr);
for (i = 0;i < s->dyn_views_nr;i++) {
- *(list[i].underBitsp) = graph_save_box(s, list[i].nsLeft, list[i].nsTop, list[i].nsRight - list[i].nsLeft,
+ *(list[i].underBitsp) = graph_save_box(_s, list[i].nsLeft, list[i].nsTop, list[i].nsRight - list[i].nsLeft,
list[i].nsBottom - list[i].nsTop, SCI_MAP_VISUAL | SCI_MAP_PRIORITY);
- draw_view0(s->pic, s->ports[0], list[i].nsLeft, list[i].nsTop, list[i].priority, list[i].loop,
+ draw_view0(_s->pic, _s->ports[0], list[i].nsLeft, list[i].nsTop, list[i].priority, list[i].loop,
list[i].cel, 0, list[i].view);
}
- graph_update_box(s, x1, y1, x2 - x1, y2 - y1);
+ graph_update_box(_s, x1, y1, x2 - x1, y2 - y1);
for (i = 0;i < s->dyn_views_nr;i++) {
- graph_restore_box(s, *(list[i].underBitsp));
+ graph_restore_box(_s, *(list[i].underBitsp));
list[i].underBits = 0;
}
#endif
@@ -453,8 +434,10 @@ Common::Rect get_nsrect32(EngineState *s, reg_t object, byte clip) {
// ======================================================================================================
-SciGui32::SciGui32( EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor)
- : s(state) {
+SciGui32::SciGui32( EngineState *state, SciGuiScreen *screen, SciGuiPalette *palette, SciGuiCursor *cursor) {
+ _s = state;
+ _screen = screen;
+ _palette = palette;
_cursor = cursor;
}
@@ -473,16 +456,16 @@ void SciGui32::wait(int16 ticks) {
uint32 time;
time = g_system->getMillis();
- s->r_acc = make_reg(0, ((long)time - (long)s->last_wait_time) * 60 / 1000);
- s->last_wait_time = time;
+ _s->r_acc = make_reg(0, ((long)time - (long)_s->last_wait_time) * 60 / 1000);
+ _s->last_wait_time = time;
ticks *= g_debug_sleeptime_factor;
- gfxop_sleep(s->gfx_state, ticks * 1000 / 60);
+ gfxop_sleep(_s->gfx_state, ticks * 1000 / 60);
// Reset speed throttler: Game is playing along nicely anyway
if (ticks > 0)
- s->speedThrottler->reset();
+ _s->speedThrottler->reset();
}
void SciGui32::setPort(uint16 portPtr) {
@@ -494,17 +477,17 @@ void SciGui32::setPort(uint16 portPtr) {
official semantics) would cut off the lower part of the
icons in an SCI1 icon bar. Instead we have an
iconbar_port that does not exist in SSCI. */
- if (portPtr == 65535) portPtr = s->iconbar_port->_ID;
+ if (portPtr == 65535) portPtr = _s->iconbar_port->_ID;
- new_port = s->visual->getPort(portPtr);
+ new_port = _s->visual->getPort(portPtr);
if (!new_port) {
warning("Invalid port %04x requested", portPtr);
return;
}
- s->port->draw(gfxw_point_zero); // Update the port we're leaving
- s->port = new_port;
+ _s->port->draw(gfxw_point_zero); // Update the port we're leaving
+ _s->port = new_port;
}
void SciGui32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft, bool initPriorityBandsFlag) {
@@ -517,24 +500,24 @@ void SciGui32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft, bool i
port_origin_x = rect.left;
if (rect.top == -10) {
- s->port->draw(gfxw_point_zero); // Update the port we're leaving
- s->port = s->iconbar_port;
+ _s->port->draw(gfxw_point_zero); // Update the port we're leaving
+ _s->port = _s->iconbar_port;
activated_icon_bar = true;
return;
}
// Notify the graphics resource manager that the pic port bounds changed
- s->gfx_state->gfxResMan->changePortBounds(picLeft, picTop, rect.right + picLeft, rect.bottom + picTop);
+ _s->gfx_state->gfxResMan->changePortBounds(picLeft, picTop, rect.right + picLeft, rect.bottom + picTop);
// LSL6 calls kSetPort to extend the screen to draw the Gui. If we free all resources
// here, the background picture is freed too, and this makes everything a big mess.
// FIXME/TODO: This code really needs to be rewritten to conform to the original behavior
- if (s->_gameName != "lsl6") {
- s->gfx_state->pic_port_bounds = gfx_rect(picLeft, picTop, rect.right, rect.bottom);
+ if (_s->_gameName != "lsl6") {
+ _s->gfx_state->pic_port_bounds = gfx_rect(picLeft, picTop, rect.right, rect.bottom);
// FIXME: Should really only invalidate all loaded pic resources here;
// this is overkill
- s->gfx_state->gfxResMan->freeAllResources();
+ _s->gfx_state->gfxResMan->freeAllResources();
} else {
// WORKAROUND for LSL6
warning("SetPort case 6 called in LSL6.");
@@ -542,25 +525,25 @@ void SciGui32::setPortPic(Common::Rect rect, int16 picTop, int16 picLeft, bool i
}
reg_t SciGui32::getPort() {
- return make_reg(0, s->port->_ID);
+ return make_reg(0, _s->port->_ID);
}
void SciGui32::globalToLocal(int16 *x, int16 *y) {
- *x = *x - s->port->zone.x;
- *y = *y - s->port->zone.y;
+ *x = *x - _s->port->zone.x;
+ *y = *y - _s->port->zone.y;
}
void SciGui32::localToGlobal(int16 *x, int16 *y) {
- *x = *x + s->port->zone.x;
- *y = *y + s->port->zone.y;
+ *x = *x + _s->port->zone.x;
+ *y = *y + _s->port->zone.y;
}
int16 SciGui32::coordinateToPriority(int16 y) {
- return _find_view_priority(s, y);
+ return _find_view_priority(_s, y);
}
int16 SciGui32::priorityToCoordinate(int16 priority) {
- return _find_priority_band(s, priority);
+ return _find_priority_band(_s, priority);
}
reg_t SciGui32::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
@@ -576,7 +559,7 @@ reg_t SciGui32::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 st
yl = dims.height();
xl = dims.width();
- y += s->wm_port->_bounds.y;
+ y += _s->wm_port->_bounds.y;
if (x + xl > 319)
x -= ((x + xl) - 319);
@@ -584,10 +567,10 @@ reg_t SciGui32::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 st
bgcolor.mask = 0;
if (colorBack >= 0) {
- if (!s->resMan->isVGA())
- bgcolor.visual = get_pic_color(s, MIN<int>(colorBack, 15));
+ if (!_s->resMan->isVGA())
+ bgcolor.visual = get_pic_color(_s, MIN<int>(colorBack, 15));
else
- bgcolor.visual = get_pic_color(s, colorBack);
+ bgcolor.visual = get_pic_color(_s, colorBack);
bgcolor.mask = GFX_MASK_VISUAL;
} else {
bgcolor.visual = PaletteEntry(0,0,0);
@@ -599,36 +582,37 @@ reg_t SciGui32::newWindow(Common::Rect dims, Common::Rect restoreRect, uint16 st
bgcolor.control = -1;
debugC(2, kDebugLevelGraphics, "New window with params %d, %d, %d, %d\n", dims.top, dims.left, dims.height(), dims.width());
- fgcolor.visual = get_pic_color(s, colorPen);
+ fgcolor.visual = get_pic_color(_s, colorPen);
fgcolor.mask = GFX_MASK_VISUAL;
fgcolor.control = -1;
fgcolor.priority = -1;
fgcolor.alpha = 0;
- black.visual = get_pic_color(s, 0);
+ black.visual = get_pic_color(_s, 0);
black.mask = GFX_MASK_VISUAL;
black.alpha = 0;
black.control = -1;
black.priority = -1;
- lWhite.visual = get_pic_color(s, !s->resMan->isVGA() ? 15 : 255);
+ lWhite.visual = get_pic_color(_s, !_s->resMan->isVGA() ? 15 : 255);
lWhite.mask = GFX_MASK_VISUAL;
lWhite.alpha = 0;
lWhite.priority = -1;
lWhite.control = -1;
- window = sciw_new_window(s, gfx_rect(x, y, xl, yl), s->titlebar_port->_font, fgcolor, bgcolor,
- s->titlebar_port->_font, lWhite, black, title ? s->strSplit(title, NULL).c_str() : NULL, style);
+ window = sciw_new_window(_s, gfx_rect(x, y, xl, yl), _s->titlebar_port->_font, fgcolor, bgcolor,
+ _s->titlebar_port->_font, lWhite, black, title ? _s->strSplit(title, NULL).c_str() : NULL, style);
// PQ3 and SCI1.1 games have the interpreter store underBits implicitly
if (restoreRect.top != 0 && restoreRect.left != 0 && restoreRect.height() != 0 && restoreRect.width() != 0)
- gfxw_port_auto_restore_background(s->visual, window, gfx_rect(restoreRect.left, restoreRect.top + s->wm_port->_bounds.y, restoreRect.width(), restoreRect.height()));
+ gfxw_port_auto_restore_background(_s->visual, window, gfx_rect(restoreRect.left, restoreRect.top + _s->wm_port->_bounds.y,
+ restoreRect.width(), restoreRect.height()));
ADD_TO_WINDOW_PORT(window);
FULL_REDRAW();
window->draw(gfxw_point_zero);
- gfxop_update(s->gfx_state);
+ gfxop_update(_s->gfx_state);
- s->port = window; // Set active port
+ _s->port = window; // Set active port
return make_reg(0, window->_ID);
}
@@ -637,36 +621,36 @@ void SciGui32::disposeWindow(uint16 windowPtr, int16 arg2) {
GfxPort *goner;
GfxPort *pred;
- goner = s->visual->getPort(windowPtr);
+ goner = _s->visual->getPort(windowPtr);
if ((windowPtr < 3) || (goner == NULL)) {
error("Removal of invalid window %04x requested", windowPtr);
return;
}
- if (s->dyn_views && (GfxContainer *)s->dyn_views->_parent == (GfxContainer *)goner) {
- reparentize_primary_widget_lists(s, (GfxPort *) goner->_parent);
+ if (_s->dyn_views && (GfxContainer *)_s->dyn_views->_parent == (GfxContainer *)goner) {
+ reparentize_primary_widget_lists(_s, (GfxPort *) goner->_parent);
}
- if (s->drop_views && (GfxContainer *)s->drop_views->_parent == (GfxContainer *)goner)
- s->drop_views = NULL; // Kill it
+ if (_s->drop_views && (GfxContainer *)_s->drop_views->_parent == (GfxContainer *)goner)
+ _s->drop_views = NULL; // Kill it
- pred = gfxw_remove_port(s->visual, goner);
+ pred = gfxw_remove_port(_s->visual, goner);
- if (goner == s->port) // Did we kill the active port?
- s->port = pred;
+ if (goner == _s->port) // Did we kill the active port?
+ _s->port = pred;
// Find the last port that exists and that isn't marked no-switch
- int id = s->visual->_portRefs.size() - 1;
- while (id > 0 && (!s->visual->_portRefs[id] || (s->visual->_portRefs[id]->_flags & GFXW_FLAG_NO_IMPLICIT_SWITCH)))
+ int id = _s->visual->_portRefs.size() - 1;
+ while (id > 0 && (!_s->visual->_portRefs[id] || (_s->visual->_portRefs[id]->_flags & GFXW_FLAG_NO_IMPLICIT_SWITCH)))
id--;
debugC(2, kDebugLevelGraphics, "Activating port %d after disposing window %d\n", id, windowPtr);
- s->port = (id >= 0) ? s->visual->_portRefs[id] : 0;
+ _s->port = (id >= 0) ? _s->visual->_portRefs[id] : 0;
- if (!s->port)
- s->port = gfxw_find_default_port(s->visual);
+ if (!_s->port)
+ _s->port = gfxw_find_default_port(_s->visual);
- gfxop_update(s->gfx_state);
+ gfxop_update(_s->gfx_state);
}
#define K_DISPLAY_SET_COORDS 100
@@ -685,7 +669,7 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
int temp;
bool save_under = false;
gfx_color_t transparent = { PaletteEntry(), 0, -1, -1, 0 };
- GfxPort *port = (s->port) ? s->port : s->picture_port;
+ GfxPort *port = (_s->port) ? _s->port : _s->picture_port;
bool update_immediately = true;
gfx_color_t color0, *color1, bg_color;
@@ -699,13 +683,13 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
bg_color = port->_bgcolor;
// TODO: in SCI1VGA the default colors for text and background are #0 (black)
// SCI0 case should be checked
- if (s->resMan->isVGA()) {
+ if (_s->resMan->isVGA()) {
// This priority check fixes the colors in the menus in KQ5
// TODO/FIXME: Is this correct?
if (color0.priority >= 0)
- color0.visual = get_pic_color(s, 0);
+ color0.visual = get_pic_color(_s, 0);
if (bg_color.priority >= 0)
- bg_color.visual = get_pic_color(s, 0);
+ bg_color.visual = get_pic_color(_s, 0);
}
while (argpt < argc) {
@@ -728,11 +712,11 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
temp = argv[argpt++].toSint16();
debugC(2, kDebugLevelGraphics, "Display: set_color(%d)\n", temp);
- if (!s->resMan->isVGA() && temp >= 0 && temp <= 15)
- color0 = (s->ega_colors[temp]);
+ if (!_s->resMan->isVGA() && temp >= 0 && temp <= 15)
+ color0 = (_s->ega_colors[temp]);
else
- if (s->resMan->isVGA() && temp >= 0 && temp < 256) {
- color0.visual = get_pic_color(s, temp);
+ if (_s->resMan->isVGA() && temp >= 0 && temp < 256) {
+ color0.visual = get_pic_color(_s, temp);
color0.mask = GFX_MASK_VISUAL;
} else
if (temp == -1)
@@ -745,11 +729,11 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
temp = argv[argpt++].toSint16();
debugC(2, kDebugLevelGraphics, "Display: set_bg_color(%d)\n", temp);
- if (!s->resMan->isVGA() && temp >= 0 && temp <= 15)
- bg_color = s->ega_colors[temp];
+ if (!_s->resMan->isVGA() && temp >= 0 && temp <= 15)
+ bg_color = _s->ega_colors[temp];
else
- if (s->resMan->isVGA() && temp >= 0 && temp <= 256) {
- bg_color.visual = get_pic_color(s, temp);
+ if (_s->resMan->isVGA() && temp >= 0 && temp <= 256) {
+ bg_color.visual = get_pic_color(_s, temp);
bg_color.mask = GFX_MASK_VISUAL;
} else
if (temp == -1)
@@ -789,7 +773,7 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
case K_DISPLAY_RESTORE_UNDER:
debugC(2, kDebugLevelGraphics, "Display: restore_under(%04x)\n", argv[argpt].toUint16());
- graph_restore_box(s, argv[argpt++]);
+ graph_restore_box(_s, argv[argpt++]);
update_immediately = true;
argpt++;
return;
@@ -809,7 +793,7 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
if (halign == ALIGN_LEFT) {
// If the text does not fit on the screen, move it to the left and upwards until it does
- gfxop_get_text_params(s->gfx_state, font_nr, text, area.width, &area.width, &area.height, 0, NULL, NULL, NULL);
+ 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)
@@ -819,11 +803,11 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
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.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)
- 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;
}
if (gray)
@@ -831,9 +815,9 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
else
color1 = &color0;
- assert_primary_widget_lists(s);
+ assert_primary_widget_lists(_s);
- text_handle = gfxw_new_text(s->gfx_state, area, font_nr, s->strSplit(text).c_str(), halign, ALIGN_TOP, color0, *color1, bg_color, 0);
+ text_handle = gfxw_new_text(_s->gfx_state, area, font_nr, _s->strSplit(text).c_str(), halign, ALIGN_TOP, color0, *color1, bg_color, 0);
if (!text_handle) {
error("Display: Failed to create text widget");
@@ -845,10 +829,10 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
save_area.x += port->_bounds.x;
save_area.y += port->_bounds.y;
- s->r_acc = graph_save_box(s, save_area);
+ _s->r_acc = graph_save_box(_s, save_area);
text_handle->_serial++; // This is evil!
- debugC(2, kDebugLevelGraphics, "Saving (%d, %d) size (%d, %d) as %04x:%04x\n", save_area.x, save_area.y, save_area.width, save_area.height, PRINT_REG(s->r_acc));
+ debugC(2, kDebugLevelGraphics, "Saving (%d, %d) size (%d, %d) as %04x:%04x\n", save_area.x, save_area.y, save_area.width, save_area.height, PRINT_REG(_s->r_acc));
}
debugC(2, kDebugLevelGraphics, "Display: Commiting text '%s'\n", text);
@@ -856,7 +840,7 @@ void SciGui32::display(const char *text, int argc, reg_t *argv) {
//ADD_TO_CURRENT_PICTURE_PORT(text_handle);
ADD_TO_CURRENT_PICTURE_PORT(text_handle);
- if ((!s->pic_not_valid) && update_immediately) { // Refresh if drawn to valid picture
+ if ((!_s->pic_not_valid) && update_immediately) { // Refresh if drawn to valid picture
FULL_REDRAW();
debugC(2, kDebugLevelGraphics, "Refreshing display...\n");
}
@@ -866,7 +850,7 @@ void SciGui32::textSize(const char *text, int16 fontId, int16 maxWidth, int16 *t
int width, height;
if (maxWidth < 0)
maxWidth = 0;
- gfxop_get_text_params(s->gfx_state, fontId, text, maxWidth ? maxWidth : MAX_TEXT_WIDTH_MAGIC_VALUE,
+ gfxop_get_text_params(_s->gfx_state, fontId, text, maxWidth ? maxWidth : MAX_TEXT_WIDTH_MAGIC_VALUE,
&width, &height, 0, NULL, NULL, NULL);
*textWidth = width; *textHeight = height;
}
@@ -880,87 +864,87 @@ void SciGui32::textColors(int argc, reg_t *argv) {
}
void SciGui32::drawStatus(const char *text, int16 colorPen, int16 colorBack) {
- s->titlebar_port->_color.visual = get_pic_color(s, colorPen);
- s->titlebar_port->_color.mask = GFX_MASK_VISUAL;
- s->titlebar_port->_bgcolor.visual = get_pic_color(s, colorBack);
- s->titlebar_port->_bgcolor.mask = GFX_MASK_VISUAL;
+ _s->titlebar_port->_color.visual = get_pic_color(_s, colorPen);
+ _s->titlebar_port->_color.mask = GFX_MASK_VISUAL;
+ _s->titlebar_port->_bgcolor.visual = get_pic_color(_s, colorBack);
+ _s->titlebar_port->_bgcolor.mask = GFX_MASK_VISUAL;
- s->status_bar_foreground = colorPen;
- s->status_bar_background = colorBack;
- s->_statusBarText = text;
+ _s->status_bar_foreground = colorPen;
+ _s->status_bar_background = colorBack;
+ _s->_statusBarText = text;
- sciw_set_status_bar(s, s->titlebar_port, s->_statusBarText, colorPen, colorBack);
+ sciw_set_status_bar(_s, _s->titlebar_port, _s->_statusBarText, colorPen, colorBack);
- gfxop_update(s->gfx_state);
+ gfxop_update(_s->gfx_state);
}
void SciGui32::drawMenuBar() {
- sciw_set_menubar(s, s->titlebar_port, s->_menubar, -1);
- s->titlebar_port->draw(Common::Point(0, 0));
- gfxop_update(s->gfx_state);
+ sciw_set_menubar(_s, _s->titlebar_port, _s->_menubar, -1);
+ _s->titlebar_port->draw(Common::Point(0, 0));
+ gfxop_update(_s->gfx_state);
}
void SciGui32::clearMenuBar() {
- sciw_set_status_bar(s, s->titlebar_port, "", 0, 0);
- s->titlebar_port->draw(Common::Point(0, 0));
- gfxop_update(s->gfx_state);
+ sciw_set_status_bar(_s, _s->titlebar_port, "", 0, 0);
+ _s->titlebar_port->draw(Common::Point(0, 0));
+ gfxop_update(_s->gfx_state);
}
void SciGui32::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, int16 EGApaletteNo) {
- gfx_color_t transparent = s->wm_port->_bgcolor;
+ gfx_color_t transparent = _s->wm_port->_bgcolor;
int picFlags = DRAWPIC01_FLAG_FILL_NORMALLY;
int palNo = (EGApaletteNo != -1) ? EGApaletteNo : 0;
if (mirroredFlag)
picFlags |= DRAWPIC1_FLAG_MIRRORED;
- gfxop_disable_dirty_frames(s->gfx_state);
+ gfxop_disable_dirty_frames(_s->gfx_state);
- if (NULL != s->old_screen) {
- gfxop_free_pixmap(s->gfx_state, s->old_screen);
+ if (NULL != _s->old_screen) {
+ gfxop_free_pixmap(_s->gfx_state, _s->old_screen);
}
- s->old_screen = gfxop_grab_pixmap(s->gfx_state, gfx_rect(0, 10, 320, 190));
+ _s->old_screen = gfxop_grab_pixmap(_s->gfx_state, gfx_rect(0, 10, 320, 190));
debugC(2, kDebugLevelGraphics, "Drawing pic.%03d\n", pictureId);
if (addToFlag) {
- gfxop_add_to_pic(s->gfx_state, pictureId, picFlags, palNo);
+ gfxop_add_to_pic(_s->gfx_state, pictureId, picFlags, palNo);
} else {
- gfxop_new_pic(s->gfx_state, pictureId, picFlags, palNo);
+ gfxop_new_pic(_s->gfx_state, pictureId, picFlags, palNo);
}
- delete s->wm_port;
- delete s->picture_port;
- delete s->iconbar_port;
+ delete _s->wm_port;
+ delete _s->picture_port;
+ delete _s->iconbar_port;
- s->wm_port = new GfxPort(s->visual, s->gfx_state->pic_port_bounds, s->ega_colors[0], transparent);
- s->picture_port = new GfxPort(s->visual, s->gfx_state->pic_port_bounds, s->ega_colors[0], transparent);
+ _s->wm_port = new GfxPort(_s->visual, _s->gfx_state->pic_port_bounds, _s->ega_colors[0], transparent);
+ _s->picture_port = new GfxPort(_s->visual, _s->gfx_state->pic_port_bounds, _s->ega_colors[0], transparent);
- s->iconbar_port = new GfxPort(s->visual, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
- s->iconbar_port->_flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
+ _s->iconbar_port = new GfxPort(_s->visual, gfx_rect(0, 0, 320, 200), _s->ega_colors[0], transparent);
+ _s->iconbar_port->_flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
- s->visual->add((GfxContainer *)s->visual, s->picture_port);
- s->visual->add((GfxContainer *)s->visual, s->wm_port);
- s->visual->add((GfxContainer *)s->visual, s->iconbar_port);
+ _s->visual->add((GfxContainer *)_s->visual, _s->picture_port);
+ _s->visual->add((GfxContainer *)_s->visual, _s->wm_port);
+ _s->visual->add((GfxContainer *)_s->visual, _s->iconbar_port);
- s->port = s->picture_port;
+ _s->port = _s->picture_port;
- s->pic_priority_table = gfxop_get_pic_metainfo(s->gfx_state);
+ _s->pic_priority_table = gfxop_get_pic_metainfo(_s->gfx_state);
- s->pic_animate = animationNr; // The animation used during kAnimate() later on
+ _s->pic_animate = animationNr; // The animation used during kAnimate() later on
- s->dyn_views = NULL;
- s->drop_views = NULL;
+ _s->dyn_views = NULL;
+ _s->drop_views = NULL;
- s->priority_first = 42;
+ _s->priority_first = 42;
if (_usesOldGfxFunctions)
- s->priority_last = 200;
+ _s->priority_last = 200;
else
- s->priority_last = 190;
+ _s->priority_last = 190;
- s->pic_not_valid = 1;
- s->pic_is_new = 1;
+ _s->pic_not_valid = 1;
+ _s->pic_is_new = 1;
}
void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo) {
@@ -968,11 +952,11 @@ void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo
int cel = celNo;
GfxView *new_view;
- gfxop_check_cel(s->gfx_state, viewId, &loop, &cel);
+ gfxop_check_cel(_s->gfx_state, viewId, &loop, &cel);
debugC(2, kDebugLevelGraphics, "DrawCel((%d,%d), (view.%d, %d, %d), p=%d)\n", leftPos, topPos, viewId, loop, cel, priority);
- new_view = gfxw_new_view(s->gfx_state, Common::Point(leftPos, topPos), viewId, loop, cel, 0, priority, -1,
+ new_view = gfxw_new_view(_s->gfx_state, Common::Point(leftPos, topPos), viewId, loop, cel, 0, priority, -1,
ALIGN_LEFT, ALIGN_TOP, GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET);
ADD_TO_CURRENT_PICTURE_PORT(new_view);
@@ -982,17 +966,17 @@ void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo
void SciGui32::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) {
rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height());
- ADD_TO_CURRENT_PICTURE_PORT(sciw_new_button_control(s->port, obj, area, text, fontId,
+ ADD_TO_CURRENT_PICTURE_PORT(sciw_new_button_control(_s->port, obj, area, text, fontId,
(int8)(style & kControlStateFramed), (int8)hilite, (int8)(style & kControlStateDisabled)));
- if (!s->pic_not_valid) FULL_REDRAW();
+ if (!_s->pic_not_valid) FULL_REDRAW();
}
void SciGui32::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool hilite) {
rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height());
- ADD_TO_CURRENT_PICTURE_PORT(sciw_new_text_control(s->port, obj, area, text, fontId, (gfx_alignment_t) mode,
+ ADD_TO_CURRENT_PICTURE_PORT(sciw_new_text_control(_s->port, obj, area, text, fontId, (gfx_alignment_t) mode,
(int8)(!!(style & kControlStateDitherFramed)), (int8)hilite));
- if (!s->pic_not_valid) FULL_REDRAW();
+ if (!_s->pic_not_valid) FULL_REDRAW();
}
void SciGui32::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, int16 cursorPos, int16 maxChars, bool hilite) {
@@ -1003,24 +987,24 @@ void SciGui32::drawControlTextEdit(Common::Rect rect, reg_t obj, const char *tex
cursorPos = textLength;
// update_cursor_limits(&s->save_dir_edit_offset, &cursor, max); FIXME: get rid of this?
- ADD_TO_CURRENT_PICTURE_PORT(sciw_new_edit_control(s->port, obj, area, text, fontId, (unsigned)cursorPos, (int8)hilite));
- if (!s->pic_not_valid) FULL_REDRAW();
+ ADD_TO_CURRENT_PICTURE_PORT(sciw_new_edit_control(_s->port, obj, area, text, fontId, (unsigned)cursorPos, (int8)hilite));
+ if (!_s->pic_not_valid) FULL_REDRAW();
}
void SciGui32::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo cellNo, int16 style, bool hilite) {
rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height());
- ADD_TO_CURRENT_PICTURE_PORT(sciw_new_icon_control(s->port, obj, area, viewId, loopNo, cellNo,
+ ADD_TO_CURRENT_PICTURE_PORT(sciw_new_icon_control(_s->port, obj, area, viewId, loopNo, cellNo,
(int8)(style & kControlStateFramed), (int8)hilite));
- if (!s->pic_not_valid) FULL_REDRAW();
+ if (!_s->pic_not_valid) FULL_REDRAW();
}
void SciGui32::drawControlList(Common::Rect rect, reg_t obj, int16 maxChars, int16 count, const char **entries, GuiResourceId fontId, int16 style, int16 upperPos, int16 cursorPos, bool isAlias, bool hilite) {
rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height());
- ADD_TO_CURRENT_PICTURE_PORT(sciw_new_list_control(s->port, obj, area, fontId, entries, count, upperPos, cursorPos, (int8)hilite));
- if (!s->pic_not_valid) FULL_REDRAW();
+ ADD_TO_CURRENT_PICTURE_PORT(sciw_new_list_control(_s->port, obj, area, fontId, entries, count, upperPos, cursorPos, (int8)hilite));
+ if (!_s->pic_not_valid) FULL_REDRAW();
}
@@ -1067,7 +1051,7 @@ static inline int sign_extend_byte(int value) {
}
void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
- SegManager *segMan = s->_segMan;
+ SegManager *segMan = _s->_segMan;
uint16 ct_type = GET_SEL32V(controlObject, type);
switch (ct_type) {
@@ -1085,13 +1069,13 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
reg_t text_pos = GET_SEL32(controlObject, text);
int display_offset = 0;
- Common::String text = s->_segMan->getString(text_pos);
+ Common::String text = _s->_segMan->getString(text_pos);
int textlen;
#if 0
if (!text) {
warning("Could not draw control: %04x:%04x does not reference text", PRINT_REG(text_pos));
- return s->r_acc;
+ return _s->r_acc;
}
#endif
@@ -1214,10 +1198,10 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
}
PUT_SEL32V(controlObject, cursor, cursor); // Write back cursor position
- s->_segMan->strcpy(text_pos, text.c_str()); // Write back string
+ _s->_segMan->strcpy(text_pos, text.c_str()); // Write back string
}
if (eventObject.segment) PUT_SEL32V(eventObject, claimed, 1);
- _k_GenericDrawControl(s, controlObject, false);
+ _k_GenericDrawControl(_s, controlObject, false);
return;
case K_CONTROL_ICON:
@@ -1228,7 +1212,7 @@ void SciGui32::editControl(reg_t controlObject, reg_t eventObject) {
case K_CONTROL_TEXT: {
int state = GET_SEL32V(controlObject, state);
PUT_SEL32V(controlObject, state, state | kControlStateDitherFramed);
- _k_GenericDrawControl(s, controlObject, false);
+ _k_GenericDrawControl(_s, controlObject, false);
PUT_SEL32V(controlObject, state, state);
}
break;
@@ -1279,21 +1263,21 @@ void _k_graph_rebuild_port_with_color(EngineState *s, gfx_color_t newbgcolor) {
}
void SciGui32::graphFillBoxForeground(Common::Rect rect) {
- _k_graph_rebuild_port_with_color(s, s->port->_color);
+ _k_graph_rebuild_port_with_color(_s, _s->port->_color);
//port = _s->port;
FULL_REDRAW();
}
void SciGui32::graphFillBoxBackground(Common::Rect rect) {
- _k_graph_rebuild_port_with_color(s, s->port->_bgcolor);
+ _k_graph_rebuild_port_with_color(_s, _s->port->_bgcolor);
//port = _s->port;
FULL_REDRAW();
}
void SciGui32::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, int16 priority, int16 control) {
- gfx_color_t fillColor = graph_map_color(s, color, priority, control);
+ gfx_color_t fillColor = graph_map_color(_s, color, priority, control);
fillColor.mask = (byte)colorMask;
rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height());
@@ -1301,16 +1285,16 @@ void SciGui32::graphFillBox(Common::Rect rect, uint16 colorMask, int16 color, in
// argv[2].toSint16(), argv[1].toSint16(), argv[4].toSint16(), argv[3].toSint16(), argv[6].toSint16(), priority, control, argv[5].toUint16());
// FIXME/TODO: this is not right, as some of the dialogs are drawn *behind* some widgets. But at least it works for now
- //ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT)); // old code
+ //ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_box(_s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT)); // old code
- // FillBox seems to be meant again s->port instead of s->picture_port, at least in QfG3
+ // FillBox seems to be meant again _s->port instead of _s->picture_port, at least in QfG3
// warning("Fillbox");
-// ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT));
- s->picture_port->add((GfxContainer *)s->picture_port, gfxw_new_box(s->gfx_state, area, fillColor, fillColor, GFX_BOX_SHADE_FLAT));
+// ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_box(_s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT));
+ _s->picture_port->add((GfxContainer *)_s->picture_port, gfxw_new_box(_s->gfx_state, area, fillColor, fillColor, GFX_BOX_SHADE_FLAT));
}
void SciGui32::graphDrawLine(Common::Point startPoint, Common::Point endPoint, int16 color, int16 priority, int16 control) {
- gfx_color_t gfxcolor = graph_map_color(s, color, priority, control);
+ gfx_color_t gfxcolor = graph_map_color(_s, color, priority, control);
debugC(2, kDebugLevelGraphics, "draw_line((%d, %d), (%d, %d), col=%d, p=%d, c=%d, mask=%d)\n",
startPoint.x, startPoint.y, endPoint.x, endPoint.y, color, priority, control, gfxcolor.mask);
@@ -1322,44 +1306,44 @@ void SciGui32::graphDrawLine(Common::Point startPoint, Common::Point endPoint, i
reg_t SciGui32::graphSaveBox(Common::Rect rect, uint16 flags) {
rect_t area;
- area.x = rect.left + s->port->zone.x + port_origin_x;
- area.y = rect.top + s->port->zone.y + port_origin_y;
+ area.x = rect.left + _s->port->zone.x + port_origin_x;
+ area.y = rect.top + _s->port->zone.y + port_origin_y;
area.width = rect.width() - port_origin_x;
area.height = rect.height() - port_origin_y;
- return graph_save_box(s, area);
+ return graph_save_box(_s, area);
}
void SciGui32::graphRestoreBox(reg_t handle) {
- graph_restore_box(s, handle);
+ graph_restore_box(_s, handle);
}
void SciGui32::graphUpdateBox(Common::Rect rect) {
rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height());
- area.x += s->port->zone.x;
- area.y += s->port->zone.y;
+ area.x += _s->port->zone.x;
+ area.y += _s->port->zone.y;
- gfxop_update_box(s->gfx_state, area);
+ gfxop_update_box(_s->gfx_state, area);
}
void SciGui32::graphRedrawBox(Common::Rect rect) {
rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height());
- area.x += s->port->zone.x;
- area.y += s->port->zone.y;
+ area.x += _s->port->zone.x;
+ area.y += _s->port->zone.y;
- if (s->dyn_views && s->dyn_views->_parent == (GfxContainer *)s->port)
- s->dyn_views->draw(Common::Point(0, 0));
+ if (_s->dyn_views && _s->dyn_views->_parent == (GfxContainer *)_s->port)
+ _s->dyn_views->draw(Common::Point(0, 0));
- gfxop_update_box(s->gfx_state, area);
+ gfxop_update_box(_s->gfx_state, area);
}
int16 SciGui32::picNotValid(int16 newPicNotValid) {
- int16 oldPicNotValid = s->pic_not_valid;
+ int16 oldPicNotValid = _s->pic_not_valid;
if (newPicNotValid != -1)
- s->pic_not_valid = newPicNotValid;
+ _s->pic_not_valid = newPicNotValid;
return oldPicNotValid;
}
@@ -1371,10 +1355,10 @@ void SciGui32::paletteSet(int resourceNo, int flags) {
int16 SciGui32::paletteFind(int r, int g, int b) {
int i, delta, bestindex = -1, bestdelta = 200000;
- for (i = 0; i < s->gfx_state->gfxResMan->getColorCount(); i++) {
- int dr = abs(s->gfx_state->gfxResMan->getColor(i).r - r);
- int dg = abs(s->gfx_state->gfxResMan->getColor(i).g - g);
- int db = abs(s->gfx_state->gfxResMan->getColor(i).b - b);
+ for (i = 0; i < _s->gfx_state->gfxResMan->getColorCount(); i++) {
+ int dr = abs(_s->gfx_state->gfxResMan->getColor(i).r - r);
+ int dg = abs(_s->gfx_state->gfxResMan->getColor(i).g - g);
+ int db = abs(_s->gfx_state->gfxResMan->getColor(i).b - b);
delta = dr * dr + dg * dg + db * db;
@@ -1390,7 +1374,7 @@ int16 SciGui32::paletteFind(int r, int g, int b) {
void SciGui32::paletteSetIntensity(int fromColor, int toColor, int intensity, bool setPalette) {
#if 0
- s->gfx_state->gfxResMan->setPaletteIntensity(fromColor, toColor, intensity);
+ _s->gfx_state->gfxResMan->setPaletteIntensity(fromColor, toColor, intensity);
#endif
}
@@ -1402,44 +1386,44 @@ void SciGui32::paletteAnimate(int fromColor, int toColor, int speed) {
#define SHAKE_RIGHT 2
void SciGui32::shakeScreen(uint16 shakeCount, uint16 directions) {
- gfx_pixmap_t *screen = gfxop_grab_pixmap(s->gfx_state, gfx_rect(0, 0, 320, 200));
+ gfx_pixmap_t *screen = gfxop_grab_pixmap(_s->gfx_state, gfx_rect(0, 0, 320, 200));
int i;
if (directions & ~3)
debugC(2, kDebugLevelGraphics, "ShakeScreen(): Direction bits are %x (unknown)\n", directions);
- gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
+ gfxop_set_clip_zone(_s->gfx_state, gfx_rect_fullscreen);
for (i = 0; i < shakeCount; i++) {
int shake_down = (directions & SHAKE_DOWN) ? 10 : 0;
int shake_right = (directions & SHAKE_RIGHT) ? 10 : 0;
if (directions & SHAKE_DOWN)
- gfxop_draw_box(s->gfx_state, gfx_rect(0, 0, 320, 10), s->ega_colors[0], s->ega_colors[0], GFX_BOX_SHADE_FLAT);
+ gfxop_draw_box(_s->gfx_state, gfx_rect(0, 0, 320, 10), _s->ega_colors[0], _s->ega_colors[0], GFX_BOX_SHADE_FLAT);
if (directions & SHAKE_RIGHT)
- gfxop_draw_box(s->gfx_state, gfx_rect(0, 0, 10, 200), s->ega_colors[0], s->ega_colors[0], GFX_BOX_SHADE_FLAT);
+ gfxop_draw_box(_s->gfx_state, gfx_rect(0, 0, 10, 200), _s->ega_colors[0], _s->ega_colors[0], GFX_BOX_SHADE_FLAT);
- gfxop_draw_pixmap(s->gfx_state, screen, gfx_rect(0, 0, 320 - shake_right, 200 - shake_down),
+ gfxop_draw_pixmap(_s->gfx_state, screen, gfx_rect(0, 0, 320 - shake_right, 200 - shake_down),
Common::Point(shake_right, shake_down));
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, 50);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, 50);
- gfxop_draw_pixmap(s->gfx_state, screen, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, 50);
+ gfxop_draw_pixmap(_s->gfx_state, screen, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, 50);
}
- gfxop_free_pixmap(s->gfx_state, screen);
- gfxop_update(s->gfx_state);
+ gfxop_free_pixmap(_s->gfx_state, screen);
+ gfxop_update(_s->gfx_state);
}
uint16 SciGui32::onControl(byte screenMask, Common::Rect rect) {
gfx_map_mask_t map = (gfx_map_mask_t)screenMask;
rect_t gfxrect = gfx_rect(rect.left, rect.top + 10, rect.width(), rect.height());
- return gfxop_scan_bitmask(s->gfx_state, gfxrect, map);
+ return gfxop_scan_bitmask(_s->gfx_state, gfxrect, map);
// old code, just for reference
// int xstart, ystart;
// int xlen = 1, ylen = 1;
@@ -1459,7 +1443,7 @@ uint16 SciGui32::onControl(byte screenMask, Common::Rect rect) {
// xlen = argv[arg + 2].toSint16() - xstart;
// }
//
-// return make_reg(0, gfxop_scan_bitmask(s->gfx_state, gfx_rect(xstart, ystart + 10, xlen, ylen), map));
+// return make_reg(0, gfxop_scan_bitmask(_s->gfx_state, gfx_rect(xstart, ystart + 10, xlen, ylen), map));
}
enum {
@@ -1469,7 +1453,7 @@ enum {
};
GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int argc, reg_t *argv) {
- SegManager *segMan = s->_segMan;
+ SegManager *segMan = _s->_segMan;
short oldloop, oldcel;
int cel, loop, view_nr = (int16)GET_SEL32V(obj, view);
int palette;
@@ -1494,13 +1478,13 @@ GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int ar
loop = oldloop = sign_extend_byte(GET_SEL32V(obj, loop));
cel = oldcel = sign_extend_byte(GET_SEL32V(obj, cel));
- if (s->_kernel->_selectorCache.palette)
+ if (_s->_kernel->_selectorCache.palette)
palette = GET_SEL32V(obj, palette);
else
palette = 0;
// Clip loop and cel, write back if neccessary
- gfxop_check_cel(s->gfx_state, view_nr, &loop, &cel);
+ gfxop_check_cel(_s->gfx_state, view_nr, &loop, &cel);
if (loop != oldloop)
loop = 0;
@@ -1515,24 +1499,24 @@ GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int ar
}
ObjVarRef under_bitsp;
- if (lookup_selector(s->_segMan, obj, s->_kernel->_selectorCache.underBits, &(under_bitsp), NULL) != kSelectorVariable) {
+ if (lookup_selector(_s->_segMan, obj, _s->_kernel->_selectorCache.underBits, &(under_bitsp), NULL) != kSelectorVariable) {
under_bitsp.obj = NULL_REG;
under_bits = NULL_REG;
debugC(2, kDebugLevelGraphics, "Object at %04x:%04x has no underBits\n", PRINT_REG(obj));
} else
- under_bits = *under_bitsp.getPointer(s->_segMan);
+ under_bits = *under_bitsp.getPointer(_s->_segMan);
ObjVarRef signalp;
- if (lookup_selector(s->_segMan, obj, s->_kernel->_selectorCache.signal, &(signalp), NULL) != kSelectorVariable) {
+ if (lookup_selector(_s->_segMan, obj, _s->_kernel->_selectorCache.signal, &(signalp), NULL) != kSelectorVariable) {
signalp.obj = NULL_REG;
signal = 0;
debugC(2, kDebugLevelGraphics, "Object at %04x:%04x has no signal selector\n", PRINT_REG(obj));
} else {
- signal = signalp.getPointer(s->_segMan)->offset;
+ signal = signalp.getPointer(_s->_segMan)->offset;
debugC(2, kDebugLevelGraphics, " with signal = %04x\n", signal);
}
- widget = gfxw_new_dyn_view(s->gfx_state, pos, z, view_nr, loop, cel, palette, -1, -1, ALIGN_CENTER, ALIGN_BOTTOM, nr);
+ widget = gfxw_new_dyn_view(_s->gfx_state, pos, z, view_nr, loop, cel, palette, -1, -1, ALIGN_CENTER, ALIGN_BOTTOM, nr);
if (widget) {
widget = (GfxDynView *) gfxw_set_id(widget, obj.segment, obj.offset);
@@ -1551,7 +1535,8 @@ void SciGui32::_k_make_view_list(GfxList **widget_list, List *list, int options,
** number of list entries in *list_nr. Calls doit for each entry if cycle is set.
** argc, argv should be the same as in the calling kernel function.
*/
- SegManager *segMan = s->_segMan;
+ EngineState *s = _s;
+ SegManager *segMan = _s->_segMan;
Node *node;
int sequence_nr = 0;
GfxDynView *widget;
@@ -1560,7 +1545,7 @@ void SciGui32::_k_make_view_list(GfxList **widget_list, List *list, int options,
error("make_view_list with widget_list == ()");
};
- assert_primary_widget_lists(s);
+ assert_primary_widget_lists(_s);
// In case one of the views' doit() does a DrawPic...
// Yes, this _does_ happen!
@@ -1569,7 +1554,7 @@ void SciGui32::_k_make_view_list(GfxList **widget_list, List *list, int options,
}
reg_t next_node = list->first;
- node = s->_segMan->lookupNode(next_node);
+ node = _s->_segMan->lookupNode(next_node);
while (node) {
reg_t obj = node->value; // The object we're using
GfxDynView *tempWidget;
@@ -1585,7 +1570,7 @@ void SciGui32::_k_make_view_list(GfxList **widget_list, List *list, int options,
// Lookup node again, since the NodeTable it was in may
// have been re-allocated.
- node = s->_segMan->lookupNode(next_node);
+ node = _s->_segMan->lookupNode(next_node);
}
}
@@ -1598,13 +1583,13 @@ void SciGui32::_k_make_view_list(GfxList **widget_list, List *list, int options,
if (tempWidget)
(*widget_list)->add((GfxContainer *)(*widget_list), tempWidget);
- node = s->_segMan->lookupNode(next_node); // Next node
+ node = _s->_segMan->lookupNode(next_node); // Next node
}
widget = (GfxDynView *)(*widget_list)->_contents;
while (widget) { // Read back widget values
- reg_t *sp = widget->signalp.getPointer(s->_segMan);
+ reg_t *sp = widget->signalp.getPointer(_s->_segMan);
if (sp)
widget->signal = sp->offset;
@@ -1616,14 +1601,14 @@ void SciGui32::draw_rect_to_control_map(Common::Rect abs_zone) {
GfxBox *box;
gfx_color_t color;
- gfxop_set_color(s->gfx_state, &color, -1, -1, -1, -1, -1, 0xf);
+ gfxop_set_color(_s->gfx_state, &color, -1, -1, -1, -1, -1, 0xf);
debugC(2, kDebugLevelGraphics, " adding control block (%d,%d)to(%d,%d)\n", abs_zone.left, abs_zone.top, abs_zone.right, abs_zone.bottom);
- box = gfxw_new_box(s->gfx_state, gfx_rect(abs_zone.left, abs_zone.top, abs_zone.width(),
+ box = gfxw_new_box(_s->gfx_state, gfx_rect(abs_zone.left, abs_zone.top, abs_zone.width(),
abs_zone.height()), color, color, GFX_BOX_SHADE_FLAT);
- assert_primary_widget_lists(s);
+ assert_primary_widget_lists(_s);
ADD_TO_CURRENT_PICTURE_PORT(box);
}
@@ -1631,12 +1616,12 @@ void SciGui32::draw_rect_to_control_map(Common::Rect abs_zone) {
void SciGui32::draw_obj_to_control_map(GfxDynView *view) {
reg_t obj = make_reg(view->_ID, view->_subID);
- if (!s->_segMan->isObject(obj))
+ if (!_s->_segMan->isObject(obj))
warning("View %d does not contain valid object reference %04x:%04x", view->_ID, PRINT_REG(obj));
- reg_t* sp = view->signalp.getPointer(s->_segMan);
+ reg_t* sp = view->signalp.getPointer(_s->_segMan);
if (!(sp && (sp->offset & _K_VIEW_SIG_FLAG_IGNORE_ACTOR))) {
- Common::Rect abs_zone = get_nsrect32(s, make_reg(view->_ID, view->_subID), 1);
+ Common::Rect abs_zone = get_nsrect32(_s, make_reg(view->_ID, view->_subID), 1);
draw_rect_to_control_map(abs_zone);
}
}
@@ -1646,7 +1631,8 @@ int SciGui32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc
// returns non-zero IFF views were dropped
int signal;
int dropped = 0;
- SegManager *segMan = s->_segMan;
+ EngineState *s = _s;
+ SegManager *segMan = _s->_segMan;
_k_animate_ran = false;
@@ -1664,7 +1650,7 @@ int SciGui32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc
reg_t obj = make_reg(widget->_ID, widget->_subID);
reg_t under_bits = NULL_REG;
- if (!s->_segMan->isObject(obj)) {
+ if (!_s->_segMan->isObject(obj)) {
error("Non-object %04x:%04x present in view list during delete time", PRINT_REG(obj));
obj = NULL_REG;
} else {
@@ -1673,7 +1659,7 @@ int SciGui32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc
reg_t mem_handle = *ubp;
if (mem_handle.segment) {
- if (!kfree(s->_segMan, mem_handle)) {
+ if (!kfree(_s->_segMan, mem_handle)) {
*ubp = make_reg(0, widget->under_bits = 0);
} else {
warning("Treating viewobj %04x:%04x as no longer present", PRINT_REG(obj));
@@ -1696,7 +1682,7 @@ int SciGui32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc
if (under_bits.segment) {
*ubp = make_reg(0, 0);
- graph_restore_box(s, under_bits);
+ graph_restore_box(_s, under_bits);
}
debugC(2, kDebugLevelGraphics, "Freeing %04x:%04x with signal=%04x\n", PRINT_REG(obj), signal);
@@ -1729,10 +1715,10 @@ int SciGui32::_k_view_list_dispose_loop(List *list, GfxDynView *widget, int argc
}
void SciGui32::_k_set_now_seen(reg_t object) {
- SegManager *segMan = s->_segMan;
- Common::Rect absrect = get_nsrect32(s, object, 0);
+ SegManager *segMan = _s->_segMan;
+ Common::Rect absrect = get_nsrect32(_s, object, 0);
- if (lookup_selector(s->_segMan, object, s->_kernel->_selectorCache.nsTop, NULL, NULL) != kSelectorVariable) {
+ if (lookup_selector(_s->_segMan, object, _s->_kernel->_selectorCache.nsTop, NULL, NULL) != kSelectorVariable) {
return;
} // This isn't fatal
@@ -1743,17 +1729,17 @@ void SciGui32::_k_set_now_seen(reg_t object) {
}
void SciGui32::_k_prepare_view_list(GfxList *list, int options) {
- SegManager *segMan = s->_segMan;
+ SegManager *segMan = _s->_segMan;
GfxDynView *view = (GfxDynView *) list->_contents;
while (view) {
reg_t obj = make_reg(view->_ID, view->_subID);
int priority, _priority;
- int has_nsrect = (view->_ID <= 0) ? 0 : lookup_selector(s->_segMan, obj, s->_kernel->_selectorCache.nsBottom, NULL, NULL) == kSelectorVariable;
+ int has_nsrect = (view->_ID <= 0) ? 0 : lookup_selector(_s->_segMan, obj, _s->_kernel->_selectorCache.nsBottom, NULL, NULL) == kSelectorVariable;
int oldsignal = view->signal;
_k_set_now_seen(obj);
_priority = /*GET_SELECTOR(obj, y); */((view->_pos.y));
- _priority = _find_view_priority(s, _priority - 1);
+ _priority = _find_view_priority(_s, _priority - 1);
if (options & _K_MAKE_VIEW_LIST_DRAW_TO_CONTROL_MAP) { // Picview
priority = (int16)GET_SEL32V(obj, priority);
@@ -1794,7 +1780,7 @@ void SciGui32::_k_prepare_view_list(GfxList *list, int options) {
|| ((view->signal & (_K_VIEW_SIG_FLAG_HIDDEN | _K_VIEW_SIG_FLAG_REMOVE)) == _K_VIEW_SIG_FLAG_REMOVE) // 9.1.1.2
|| ((view->signal & (_K_VIEW_SIG_FLAG_HIDDEN | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_ALWAYS_UPDATE)) == _K_VIEW_SIG_FLAG_ALWAYS_UPDATE) // 9.1.1.3
|| ((view->signal & (_K_VIEW_SIG_FLAG_HIDDEN | _K_VIEW_SIG_FLAG_ALWAYS_UPDATE)) == (_K_VIEW_SIG_FLAG_HIDDEN | _K_VIEW_SIG_FLAG_ALWAYS_UPDATE))) { // 9.1.1.4
- s->pic_not_valid++;
+ _s->pic_not_valid++;
view->signal &= ~_K_VIEW_SIG_FLAG_STOP_UPDATE;
}
@@ -1806,11 +1792,11 @@ void SciGui32::_k_prepare_view_list(GfxList *list, int options) {
}
} else {
if (view->signal & _K_VIEW_SIG_FLAG_STOP_UPDATE) {
- s->pic_not_valid++;
+ _s->pic_not_valid++;
view->signal &= ~_K_VIEW_SIG_FLAG_FORCE_UPDATE;
} else { // if not STOP_UPDATE
if (view->signal & _K_VIEW_SIG_FLAG_ALWAYS_UPDATE)
- s->pic_not_valid++;
+ _s->pic_not_valid++;
view->signal &= ~_K_VIEW_SIG_FLAG_FORCE_UPDATE;
}
}
@@ -1820,7 +1806,7 @@ void SciGui32::_k_prepare_view_list(GfxList *list, int options) {
// Never happens
/* if (view->signal & 0) {
view->signal &= ~_K_VIEW_SIG_FLAG_STOPUPD;
- fprintf(stderr, "Unsetting magic StopUpd for view %04x:%04x\n", PRINT_REG(obj));
+ fprintf(_stderr, "Unsetting magic StopUpd for view %04x:%04x\n", PRINT_REG(obj));
} */
view = (GfxDynView *)view->_next;
@@ -1955,7 +1941,7 @@ void SciGui32::_k_draw_view_list(GfxList *list, int flags) {
// Draws list_nr members of list to s->pic.
GfxDynView *widget = (GfxDynView *) list->_contents;
- if ((GfxContainer *)s->port != (GfxContainer *)s->dyn_views->_parent)
+ if ((GfxContainer *)_s->port != (GfxContainer *)_s->dyn_views->_parent)
return; // Return if the pictures are meant for a different port
while (widget) {
@@ -1963,7 +1949,7 @@ void SciGui32::_k_draw_view_list(GfxList *list, int flags) {
widget = gfxw_picviewize_dynview(widget);
if (GFXW_IS_DYN_VIEW(widget) && widget->_ID) {
- uint16 signal = (flags & _K_DRAW_VIEW_LIST_USE_SIGNAL) ? widget->signalp.getPointer(s->_segMan)->offset : 0;
+ uint16 signal = (flags & _K_DRAW_VIEW_LIST_USE_SIGNAL) ? widget->signalp.getPointer(_s->_segMan)->offset : 0;
if (signal & _K_VIEW_SIG_FLAG_HIDDEN)
gfxw_hide_widget(widget);
@@ -1983,7 +1969,7 @@ void SciGui32::_k_draw_view_list(GfxList *list, int flags) {
else
gfxw_show_widget(widget);
- *widget->signalp.getPointer(s->_segMan) = make_reg(0, signal); // Write the changes back
+ *widget->signalp.getPointer(_s->_segMan) = make_reg(0, signal); // Write the changes back
};
} // ...if we're drawing disposeables and this one is disposeable, or if we're drawing non-
@@ -1995,7 +1981,7 @@ void SciGui32::_k_draw_view_list(GfxList *list, int flags) {
}
void SciGui32::_k_view_list_do_postdraw(GfxList *list) {
- SegManager *segMan = s->_segMan;
+ SegManager *segMan = _s->_segMan;
GfxDynView *widget = (GfxDynView *) list->_contents;
while (widget) {
@@ -2008,7 +1994,7 @@ void SciGui32::_k_view_list_do_postdraw(GfxList *list) {
* if ((widget->signal & (_K_VIEW_SIG_FLAG_PRIVATE | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == _K_VIEW_SIG_FLAG_PRIVATE) {
*/
if ((widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)) == 0) {
- int has_nsrect = lookup_selector(s->_segMan, obj, s->_kernel->_selectorCache.nsBottom, NULL, NULL) == kSelectorVariable;
+ int has_nsrect = lookup_selector(_s->_segMan, obj, _s->_kernel->_selectorCache.nsBottom, NULL, NULL) == kSelectorVariable;
if (has_nsrect) {
int temp;
@@ -2025,22 +2011,22 @@ void SciGui32::_k_view_list_do_postdraw(GfxList *list) {
temp = GET_SEL32V(obj, nsBottom);
PUT_SEL32V(obj, lsBottom, temp);
#ifdef DEBUG_LSRECT
- fprintf(stderr, "lsRected %04x:%04x\n", PRINT_REG(obj));
+ fprintf(_stderr, "lsRected %04x:%04x\n", PRINT_REG(obj));
#endif
}
#ifdef DEBUG_LSRECT
else
- fprintf(stderr, "Not lsRecting %04x:%04x because %d\n", PRINT_REG(obj), lookup_selector(s->_segMan, obj, s->_kernel->_selectorCache.nsBottom, NULL, NULL));
+ fprintf(_stderr, "Not lsRecting %04x:%04x because %d\n", PRINT_REG(obj), lookup_selector(_s->_segMan, obj, _s->_kernel->_selectorCache.nsBottom, NULL, NULL));
#endif
if (widget->signal & _K_VIEW_SIG_FLAG_HIDDEN)
widget->signal |= _K_VIEW_SIG_FLAG_REMOVE;
}
#ifdef DEBUG_LSRECT
- fprintf(stderr, "obj %04x:%04x has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)));
+ fprintf(_stderr, "obj %04x:%04x has pflags %x\n", PRINT_REG(obj), (widget->signal & (_K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_NO_UPDATE)));
#endif
- reg_t* sp = widget->signalp.getPointer(s->_segMan);
+ reg_t* sp = widget->signalp.getPointer(_s->_segMan);
if (sp) {
*sp = make_reg(0, widget->signal & 0xffff); /* Write back signal */
}
@@ -2075,10 +2061,10 @@ void SciGui32::_k_view_list_do_postdraw(GfxList *list) {
#define K_ANIMATE_SCROLL_DOWN 0x2a
#define K_ANIMATE_SCROLL_UP 0x2b
-#define GRAPH_BLANK_BOX(s, x, y, xl, yl, color) gfxop_fill_box(s->gfx_state, \
- gfx_rect(x, (((y) < 10)? 10 : (y)), xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), s->ega_colors[color]);
+#define GRAPH_BLANK_BOX(_s, x, y, xl, yl, color) gfxop_fill_box(_s->gfx_state, \
+ gfx_rect(x, (((y) < 10)? 10 : (y)), xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), _s->ega_colors[color]);
-#define GRAPH_UPDATE_BOX(s, x, y, xl, yl) gfxop_draw_pixmap(s->gfx_state, newscreen, \
+#define GRAPH_UPDATE_BOX(_s, x, y, xl, yl) gfxop_draw_pixmap(_s->gfx_state, newscreen, \
gfx_rect(x, (((y) < 10)? 10 : (y)) - 10, xl, (((y) < 10)? ((y) - 10) : 0) + (yl)), Common::Point(x, ((y) < 10)? 10 : (y) ));
void SciGui32::animate_do_animation(int argc, reg_t *argv) {
@@ -2092,48 +2078,48 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
int granularity2 = animation_granularity >> 2;
int granularity3 = animation_granularity >> 4;
char checkers[32 * 19];
- gfx_pixmap_t *newscreen = gfxop_grab_pixmap(s->gfx_state, gfx_rect(0, 10, 320, 190));
+ gfx_pixmap_t *newscreen = gfxop_grab_pixmap(_s->gfx_state, gfx_rect(0, 10, 320, 190));
if (!granularity2)
granularity2 = 1;
if (!granularity3)
granularity3 = 1;
- gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
+ gfxop_set_clip_zone(_s->gfx_state, gfx_rect_fullscreen);
if (!newscreen) {
error("Failed to allocate 'newscreen'");
return;
}
- gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(0, 0, 320, 190), Common::Point(0, 10));
- gfxop_update_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
+ gfxop_draw_pixmap(_s->gfx_state, _s->old_screen, gfx_rect(0, 0, 320, 190), Common::Point(0, 10));
+ gfxop_update_box(_s->gfx_state, gfx_rect(0, 0, 320, 200));
- //debugC(2, kDebugLevelGraphics, "Animating pic opening type %x\n", s->pic_animate);
+ //debugC(2, kDebugLevelGraphics, "Animating pic opening type %x\n", _s->pic_animate);
- gfxop_enable_dirty_frames(s->gfx_state);
+ gfxop_enable_dirty_frames(_s->gfx_state);
- switch (s->pic_animate) {
+ switch (_s->pic_animate) {
case K_ANIMATE_BORDER_CLOSE_H_CENTER_OPEN_H :
for (i = 0; i < 159 + granularity1; i += granularity1) {
- GRAPH_BLANK_BOX(s, i, 10, granularity1, 190, 0);
- gfxop_update(s->gfx_state);
- GRAPH_BLANK_BOX(s, 319 - i, 10, granularity1, 190, 0);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_BLANK_BOX(_s, i, 10, granularity1, 190, 0);
+ gfxop_update(_s->gfx_state);
+ GRAPH_BLANK_BOX(_s, 319 - i, 10, granularity1, 190, 0);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 1000);
+ process_sound_events(_s);
}
- GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
+ GRAPH_BLANK_BOX(_s, 0, 10, 320, 190, 0);
case K_ANIMATE_CENTER_OPEN_H :
for (i = 159; i >= 1 - granularity1; i -= granularity1) {
- GRAPH_UPDATE_BOX(s, i, 10, granularity1, 190);
- gfxop_update(s->gfx_state);
- GRAPH_UPDATE_BOX(s, 319 - i, 10, granularity1, 190);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_UPDATE_BOX(_s, i, 10, granularity1, 190);
+ gfxop_update(_s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, 319 - i, 10, granularity1, 190);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 1000);
+ process_sound_events(_s);
}
break;
@@ -2141,24 +2127,24 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
case K_ANIMATE_BORDER_CLOSE_V_CENTER_OPEN_V :
for (i = 0; i < 94 + granularity2; i += granularity2) {
- GRAPH_BLANK_BOX(s, 0, i + 10, 320, granularity2, 0);
- gfxop_update(s->gfx_state);
- GRAPH_BLANK_BOX(s, 0, 199 - i, 320, granularity2, 0);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, 2 * animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_BLANK_BOX(_s, 0, i + 10, 320, granularity2, 0);
+ gfxop_update(_s->gfx_state);
+ GRAPH_BLANK_BOX(_s, 0, 199 - i, 320, granularity2, 0);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, 2 * animation_delay / 1000);
+ process_sound_events(_s);
}
- GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
+ GRAPH_BLANK_BOX(_s, 0, 10, 320, 190, 0);
case K_ANIMATE_CENTER_OPEN_V :
for (i = 94; i >= 1 - granularity2; i -= granularity2) {
- GRAPH_UPDATE_BOX(s, 0, i + 10, 320, granularity2);
- gfxop_update(s->gfx_state);
- GRAPH_UPDATE_BOX(s, 0, 199 - i, 320, granularity2);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, 2 * animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_UPDATE_BOX(_s, 0, i + 10, 320, granularity2);
+ gfxop_update(_s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, 0, 199 - i, 320, granularity2);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, 2 * animation_delay / 1000);
+ process_sound_events(_s);
}
break;
@@ -2166,19 +2152,19 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
case K_ANIMATE_LEFT_CLOSE_RIGHT_OPEN :
for (i = 0; i < 319 + granularity0; i += granularity0) {
- GRAPH_BLANK_BOX(s, i, 10, granularity0, 190, 0);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 2 / 1000);
- process_sound_events(s);
+ GRAPH_BLANK_BOX(_s, i, 10, granularity0, 190, 0);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 2 / 1000);
+ process_sound_events(_s);
}
- GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
+ GRAPH_BLANK_BOX(_s, 0, 10, 320, 190, 0);
case K_ANIMATE_RIGHT_OPEN :
for (i = 319; i >= 1 - granularity0; i -= granularity0) {
- GRAPH_UPDATE_BOX(s, i, 10, granularity0, 190);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 2 / 1000);
- process_sound_events(s);
+ GRAPH_UPDATE_BOX(_s, i, 10, granularity0, 190);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 2 / 1000);
+ process_sound_events(_s);
}
break;
@@ -2186,20 +2172,20 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
case K_ANIMATE_RIGHT_CLOSE_LEFT_OPEN :
for (i = 319; i >= 1 - granularity0; i -= granularity0) {
- GRAPH_BLANK_BOX(s, i, 10, granularity0, 190, 0);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 2 / 1000);
- process_sound_events(s);
+ GRAPH_BLANK_BOX(_s, i, 10, granularity0, 190, 0);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 2 / 1000);
+ process_sound_events(_s);
}
- GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
+ GRAPH_BLANK_BOX(_s, 0, 10, 320, 190, 0);
case K_ANIMATE_LEFT_OPEN :
for (i = 0; i < 319 + granularity0; i += granularity0) {
- GRAPH_UPDATE_BOX(s, i, 10, granularity0, 190);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 2 / 1000);
- process_sound_events(s);
+ GRAPH_UPDATE_BOX(_s, i, 10, granularity0, 190);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 2 / 1000);
+ process_sound_events(_s);
}
break;
@@ -2207,20 +2193,20 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
case K_ANIMATE_TOP_CLOSE_BOTTOM_OPEN :
for (i = 10; i < 199 + granularity1; i += granularity1) {
- GRAPH_BLANK_BOX(s, 0, i, 320, granularity1, 0);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_BLANK_BOX(_s, 0, i, 320, granularity1, 0);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 1000);
+ process_sound_events(_s);
}
- GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
+ GRAPH_BLANK_BOX(_s, 0, 10, 320, 190, 0);
case K_ANIMATE_BOTTOM_OPEN :
for (i = 199; i >= 11 - granularity1; i -= granularity1) {
- GRAPH_UPDATE_BOX(s, 0, i, 320, granularity1);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_UPDATE_BOX(_s, 0, i, 320, granularity1);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 1000);
+ process_sound_events(_s);
}
break;
@@ -2228,20 +2214,20 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
case K_ANIMATE_BOTTOM_CLOSE_TOP_OPEN :
for (i = 199; i >= 11 - granularity1; i -= granularity1) {
- GRAPH_BLANK_BOX(s, 0, i, 320, granularity1, 0);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_BLANK_BOX(_s, 0, i, 320, granularity1, 0);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 1000);
+ process_sound_events(_s);
}
- GRAPH_BLANK_BOX(s, 0, 10, 320, 190, 0);
+ GRAPH_BLANK_BOX(_s, 0, 10, 320, 190, 0);
case K_ANIMATE_TOP_OPEN :
for (i = 10; i < 199 + granularity1; i += granularity1) {
- GRAPH_UPDATE_BOX(s, 0, i, 320, granularity1);
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, animation_delay / 1000);
- process_sound_events(s);
+ GRAPH_UPDATE_BOX(_s, 0, i, 320, granularity1);
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, animation_delay / 1000);
+ process_sound_events(_s);
}
break;
@@ -2255,18 +2241,18 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
int height = real_i * 3;
int width = real_i * 5;
- GRAPH_BLANK_BOX(s, width, 10 + height, width_l, 190 - 2 * height, 0);
- gfxop_update(s->gfx_state);
- GRAPH_BLANK_BOX(s, 320 - width_l - width, 10 + height, width_l, 190 - 2 * height, 0);
- gfxop_update(s->gfx_state);
+ GRAPH_BLANK_BOX(_s, width, 10 + height, width_l, 190 - 2 * height, 0);
+ gfxop_update(_s->gfx_state);
+ GRAPH_BLANK_BOX(_s, 320 - width_l - width, 10 + height, width_l, 190 - 2 * height, 0);
+ gfxop_update(_s->gfx_state);
- GRAPH_BLANK_BOX(s, width, 10 + height, 320 - 2 * width, height_l, 0);
- gfxop_update(s->gfx_state);
- GRAPH_BLANK_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l, 0);
- gfxop_update(s->gfx_state);
+ GRAPH_BLANK_BOX(_s, width, 10 + height, 320 - 2 * width, height_l, 0);
+ gfxop_update(_s->gfx_state);
+ GRAPH_BLANK_BOX(_s, width, 200 - height_l - height, 320 - 2 * width, height_l, 0);
+ gfxop_update(_s->gfx_state);
- gfxop_sleep(s->gfx_state, 4 * animation_delay / 1000);
- process_sound_events(s);
+ gfxop_sleep(_s->gfx_state, 4 * animation_delay / 1000);
+ process_sound_events(_s);
}
case K_ANIMATE_BORDER_OPEN_F :
@@ -2278,18 +2264,18 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
int height = real_i * 3;
int width = real_i * 5;
- GRAPH_UPDATE_BOX(s, width, 10 + height, width_l, 190 - 2 * height);
- gfxop_update(s->gfx_state);
- GRAPH_UPDATE_BOX(s, 320 - width_l - width, 10 + height, width_l, 190 - 2 * height);
- gfxop_update(s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, width, 10 + height, width_l, 190 - 2 * height);
+ gfxop_update(_s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, 320 - width_l - width, 10 + height, width_l, 190 - 2 * height);
+ gfxop_update(_s->gfx_state);
- GRAPH_UPDATE_BOX(s, width, 10 + height, 320 - 2 * width, height_l);
- gfxop_update(s->gfx_state);
- GRAPH_UPDATE_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l);
- gfxop_update(s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, width, 10 + height, 320 - 2 * width, height_l);
+ gfxop_update(_s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, width, 200 - height_l - height, 320 - 2 * width, height_l);
+ gfxop_update(_s->gfx_state);
- gfxop_sleep(s->gfx_state, 4 * animation_delay / 1000);
- process_sound_events(s);
+ gfxop_sleep(_s->gfx_state, 4 * animation_delay / 1000);
+ process_sound_events(_s);
}
break;
@@ -2303,18 +2289,18 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
int height = real_i * 3;
int width = real_i * 5;
- GRAPH_BLANK_BOX(s, width, 10 + height, width_l, 190 - 2 * height, 0);
- gfxop_update(s->gfx_state);
- GRAPH_BLANK_BOX(s, 320 - width_l - width, 10 + height, width_l, 190 - 2 * height, 0);
- gfxop_update(s->gfx_state);
+ GRAPH_BLANK_BOX(_s, width, 10 + height, width_l, 190 - 2 * height, 0);
+ gfxop_update(_s->gfx_state);
+ GRAPH_BLANK_BOX(_s, 320 - width_l - width, 10 + height, width_l, 190 - 2 * height, 0);
+ gfxop_update(_s->gfx_state);
- GRAPH_BLANK_BOX(s, width, 10 + height, 320 - 2 * width, height_l, 0);
- gfxop_update(s->gfx_state);
- GRAPH_BLANK_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l, 0);
- gfxop_update(s->gfx_state);
+ GRAPH_BLANK_BOX(_s, width, 10 + height, 320 - 2 * width, height_l, 0);
+ gfxop_update(_s->gfx_state);
+ GRAPH_BLANK_BOX(_s, width, 200 - height_l - height, 320 - 2 * width, height_l, 0);
+ gfxop_update(_s->gfx_state);
- gfxop_sleep(s->gfx_state, 7 * animation_delay / 1000);
- process_sound_events(s);
+ gfxop_sleep(_s->gfx_state, 7 * animation_delay / 1000);
+ process_sound_events(_s);
}
case K_ANIMATE_CENTER_OPEN_F :
@@ -2326,24 +2312,24 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
int height = real_i * 3;
int width = real_i * 5;
- GRAPH_UPDATE_BOX(s, width, 10 + height, width_l, 190 - 2 * height);
- gfxop_update(s->gfx_state);
- GRAPH_UPDATE_BOX(s, 320 - width_l - width, 10 + height, width_l, 190 - 2*height);
- gfxop_update(s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, width, 10 + height, width_l, 190 - 2 * height);
+ gfxop_update(_s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, 320 - width_l - width, 10 + height, width_l, 190 - 2*height);
+ gfxop_update(_s->gfx_state);
- GRAPH_UPDATE_BOX(s, width, 10 + height, 320 - 2 * width, height_l);
- gfxop_update(s->gfx_state);
- GRAPH_UPDATE_BOX(s, width, 200 - height_l - height, 320 - 2 * width, height_l);
- gfxop_update(s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, width, 10 + height, 320 - 2 * width, height_l);
+ gfxop_update(_s->gfx_state);
+ GRAPH_UPDATE_BOX(_s, width, 200 - height_l - height, 320 - 2 * width, height_l);
+ gfxop_update(_s->gfx_state);
- gfxop_sleep(s->gfx_state, 7 * animation_delay / 1000);
- process_sound_events(s);
+ gfxop_sleep(_s->gfx_state, 7 * animation_delay / 1000);
+ process_sound_events(_s);
}
break;
case K_ANIMATE_PALETTE_FADEOUT_FADEIN:
warning("TODO: Palette fadeout/fadein");
- GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
+ GRAPH_UPDATE_BOX(_s, 0, 10, 320, 190);
break;
case K_ANIMATE_CLOSE_CHECKERS_OPEN_CHECKERS :
@@ -2364,18 +2350,18 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
x = i % 32;
y = i / 32;
- GRAPH_BLANK_BOX(s, x * 10, 10 + y * 10, 10, 10, 0);
+ GRAPH_BLANK_BOX(_s, x * 10, 10 + y * 10, 10, 10, 0);
if (!(update_counter--) || (remaining_checkers == 1)) {
- gfxop_update(s->gfx_state);
+ gfxop_update(_s->gfx_state);
update_counter = granularity1;
}
if (remaining_checkers & 1) {
- gfxop_sleep(s->gfx_state, animation_delay / 4 / 1000);
+ gfxop_sleep(_s->gfx_state, animation_delay / 4 / 1000);
}
--remaining_checkers;
- process_sound_events(s);
+ process_sound_events(_s);
}
case K_ANIMATE_OPEN_CHECKERS :
@@ -2395,19 +2381,19 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
x = i % 32;
y = i / 32;
- GRAPH_UPDATE_BOX(s, x * 10, 10 + y * 10, 10, 10);
+ GRAPH_UPDATE_BOX(_s, x * 10, 10 + y * 10, 10, 10);
if (!(update_counter--) || (remaining_checkers == 1)) {
- gfxop_update(s->gfx_state);
+ gfxop_update(_s->gfx_state);
update_counter = granularity1;
}
if (remaining_checkers & 1) {
- gfxop_sleep(s->gfx_state, animation_delay / 4 / 1000);
+ gfxop_sleep(_s->gfx_state, animation_delay / 4 / 1000);
}
--remaining_checkers;
- process_sound_events(s);
+ process_sound_events(_s);
}
break;
@@ -2415,56 +2401,56 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
case K_ANIMATE_SCROLL_LEFT :
for (i = 0; i < 319; i += granularity0) {
- gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(320 - i, 0, i, 190), Common::Point(0, 10));
- gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(0, 0, 320 - i, 190), Common::Point(i, 10));
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, (animation_delay >> 3) / 1000);
+ gfxop_draw_pixmap(_s->gfx_state, newscreen, gfx_rect(320 - i, 0, i, 190), Common::Point(0, 10));
+ gfxop_draw_pixmap(_s->gfx_state, _s->old_screen, gfx_rect(0, 0, 320 - i, 190), Common::Point(i, 10));
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, (animation_delay >> 3) / 1000);
}
- GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
+ GRAPH_UPDATE_BOX(_s, 0, 10, 320, 190);
break;
case K_ANIMATE_SCROLL_RIGHT :
for (i = 0; i < 319; i += granularity0) {
- gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(0, 0, i, 190), Common::Point(319 - i, 10));
- gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(i, 0, 320 - i, 190), Common::Point(0, 10));
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, (animation_delay >> 3) / 1000);
+ gfxop_draw_pixmap(_s->gfx_state, newscreen, gfx_rect(0, 0, i, 190), Common::Point(319 - i, 10));
+ gfxop_draw_pixmap(_s->gfx_state, _s->old_screen, gfx_rect(i, 0, 320 - i, 190), Common::Point(0, 10));
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, (animation_delay >> 3) / 1000);
}
- GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
+ GRAPH_UPDATE_BOX(_s, 0, 10, 320, 190);
break;
case K_ANIMATE_SCROLL_UP :
for (i = 0; i < 189; i += granularity0) {
- gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(0, 190 - i, 320, i), Common::Point(0, 10));
- gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(0, 0, 320, 190 - i), Common::Point(0, 10 + i));
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, (animation_delay >> 3) / 1000);
+ gfxop_draw_pixmap(_s->gfx_state, newscreen, gfx_rect(0, 190 - i, 320, i), Common::Point(0, 10));
+ gfxop_draw_pixmap(_s->gfx_state, _s->old_screen, gfx_rect(0, 0, 320, 190 - i), Common::Point(0, 10 + i));
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, (animation_delay >> 3) / 1000);
}
- GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
+ GRAPH_UPDATE_BOX(_s, 0, 10, 320, 190);
break;
case K_ANIMATE_SCROLL_DOWN :
for (i = 0; i < 189; i += granularity0) {
- gfxop_draw_pixmap(s->gfx_state, newscreen, gfx_rect(0, 0, 320, i), Common::Point(0, 200 - i));
- gfxop_draw_pixmap(s->gfx_state, s->old_screen, gfx_rect(0, i, 320, 190 - i), Common::Point(0, 10));
- gfxop_update(s->gfx_state);
- gfxop_sleep(s->gfx_state, (animation_delay >> 3) / 1000);
+ gfxop_draw_pixmap(_s->gfx_state, newscreen, gfx_rect(0, 0, 320, i), Common::Point(0, 200 - i));
+ gfxop_draw_pixmap(_s->gfx_state, _s->old_screen, gfx_rect(0, i, 320, 190 - i), Common::Point(0, 10));
+ gfxop_update(_s->gfx_state);
+ gfxop_sleep(_s->gfx_state, (animation_delay >> 3) / 1000);
}
- GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
+ GRAPH_UPDATE_BOX(_s, 0, 10, 320, 190);
break;
default:
- warning("Unknown opening animation 0x%02x", s->pic_animate);
- GRAPH_UPDATE_BOX(s, 0, 10, 320, 190);
+ warning("Unknown opening animation 0x%02x", _s->pic_animate);
+ GRAPH_UPDATE_BOX(_s, 0, 10, 320, 190);
}
- gfxop_free_pixmap(s->gfx_state, s->old_screen);
- gfxop_free_pixmap(s->gfx_state, newscreen);
- s->old_screen = NULL;
+ gfxop_free_pixmap(_s->gfx_state, _s->old_screen);
+ gfxop_free_pixmap(_s->gfx_state, newscreen);
+ _s->old_screen = NULL;
}
void SciGui32::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
@@ -2476,37 +2462,37 @@ void SciGui32::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
// after all, damage the cast list
if (listReference.segment) {
- cast_list = s->_segMan->lookupList(listReference);
+ cast_list = _s->_segMan->lookupList(listReference);
if (!cast_list)
return;
}
- open_animation = (s->pic_is_new) && (s->pic_not_valid);
- s->pic_is_new = 0;
+ open_animation = (_s->pic_is_new) && (_s->pic_not_valid);
+ _s->pic_is_new = 0;
- assert_primary_widget_lists(s);
+ assert_primary_widget_lists(_s);
- if (!s->dyn_views->_contents // Only reparentize empty dynview list
- && (((GfxContainer *)s->port != (GfxContainer *)s->dyn_views->_parent) // If dynviews are on other port...
- || (s->dyn_views->_next))) // ... or not on top of the view list
- reparentize_primary_widget_lists(s, s->port);
+ if (!_s->dyn_views->_contents // Only reparentize empty dynview list
+ && (((GfxContainer *)_s->port != (GfxContainer *)_s->dyn_views->_parent) // If dynviews are on other port...
+ || (_s->dyn_views->_next))) // ... or not on top of the view list
+ reparentize_primary_widget_lists(_s, _s->port);
if (cast_list) {
- GfxList *templist = gfxw_new_list(s->dyn_views->_bounds, 0);
+ GfxList *templist = gfxw_new_list(_s->dyn_views->_bounds, 0);
_k_make_view_list(&(templist), cast_list, (cycle ? _K_MAKE_VIEW_LIST_CYCLE : 0)
| _K_MAKE_VIEW_LIST_CALC_PRIORITY, argc, (reg_t *)argv);
// Make sure that none of the doits() did something evil
- assert_primary_widget_lists(s);
+ assert_primary_widget_lists(_s);
- if (!s->dyn_views->_contents // Only reparentize empty dynview list
- && (((GfxContainer *)s->port != (GfxContainer *)s->dyn_views->_parent) // If dynviews are on other port...
- || (s->dyn_views->_next))) // ... or not on top of the view list
- reparentize_primary_widget_lists(s, s->port);
+ if (!_s->dyn_views->_contents // Only reparentize empty dynview list
+ && (((GfxContainer *)_s->port != (GfxContainer *)_s->dyn_views->_parent) // If dynviews are on other port...
+ || (_s->dyn_views->_next))) // ... or not on top of the view list
+ reparentize_primary_widget_lists(_s, _s->port);
// End of doit() recovery code
- if (s->pic_is_new) { // Happens if DrawPic() is executed by a dynview (yes, that happens)
+ if (_s->pic_is_new) { // Happens if DrawPic() is executed by a dynview (yes, that happens)
animate(listReference, cycle, argc, argv); /* Tail-recurse */
return;
}
@@ -2514,23 +2500,23 @@ void SciGui32::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
debugC(2, kDebugLevelGraphics, "Handling Dynviews (..step 9 inclusive):\n");
_k_prepare_view_list(templist, _K_MAKE_VIEW_LIST_CALC_PRIORITY);
- if (s->pic_not_valid) {
- debugC(2, kDebugLevelGraphics, "PicNotValid=%d -> Subalgorithm:\n", s->pic_not_valid);
+ if (_s->pic_not_valid) {
+ debugC(2, kDebugLevelGraphics, "PicNotValid=%d -> Subalgorithm:\n", _s->pic_not_valid);
_k_redraw_view_list(templist);
}
- _k_update_signals_in_view_list(s->dyn_views, templist);
- s->dyn_views->tag();
+ _k_update_signals_in_view_list(_s->dyn_views, templist);
+ _s->dyn_views->tag();
- _k_raise_topmost_in_view_list(s->dyn_views, (GfxDynView *)templist->_contents);
+ _k_raise_topmost_in_view_list(_s->dyn_views, (GfxDynView *)templist->_contents);
delete templist;
- s->dyn_views->free_tagged((GfxContainer *)s->dyn_views); // Free obsolete dynviews
+ _s->dyn_views->free_tagged((GfxContainer *)_s->dyn_views); // Free obsolete dynviews
} // if (cast_list)
if (open_animation) {
- gfxop_clear_box(s->gfx_state, gfx_rect(0, 10, 320, 190)); // Propagate pic
- s->visual->add_dirty_abs((GfxContainer *)s->visual, gfx_rect_fullscreen, 0);
+ gfxop_clear_box(_s->gfx_state, gfx_rect(0, 10, 320, 190)); // Propagate pic
+ _s->visual->add_dirty_abs((GfxContainer *)_s->visual, gfx_rect_fullscreen, 0);
// Mark screen as dirty so picviews will be drawn correctly
FULL_REDRAW();
@@ -2541,30 +2527,30 @@ void SciGui32::animate(reg_t listReference, bool cycle, int argc, reg_t *argv) {
int retval;
int reparentize = 0;
- s->pic_not_valid = 0;
+ _s->pic_not_valid = 0;
- _k_view_list_do_postdraw(s->dyn_views);
+ _k_view_list_do_postdraw(_s->dyn_views);
// _k_view_list_dispose_loop() returns -1 if it requested a re-start, so we do just that.
- while ((retval = _k_view_list_dispose_loop(cast_list, (GfxDynView *) s->dyn_views->_contents, argc, (reg_t *)argv) < 0))
+ while ((retval = _k_view_list_dispose_loop(cast_list, (GfxDynView *) _s->dyn_views->_contents, argc, (reg_t *)argv) < 0))
reparentize = 1;
- if (s->drop_views->_contents) {
- s->drop_views = gfxw_new_list(s->dyn_views->_bounds, GFXW_LIST_SORTED);
- s->drop_views->_flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS;
- ADD_TO_CURRENT_PICTURE_PORT(s->drop_views);
+ if (_s->drop_views->_contents) {
+ _s->drop_views = gfxw_new_list(_s->dyn_views->_bounds, GFXW_LIST_SORTED);
+ _s->drop_views->_flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS;
+ ADD_TO_CURRENT_PICTURE_PORT(_s->drop_views);
} else {
- assert(s->drop_views);
- gfxw_remove_widget_from_container(s->drop_views->_parent, s->drop_views);
- ADD_TO_CURRENT_PICTURE_PORT(s->drop_views);
+ assert(_s->drop_views);
+ gfxw_remove_widget_from_container(_s->drop_views->_parent, _s->drop_views);
+ ADD_TO_CURRENT_PICTURE_PORT(_s->drop_views);
}
if ((reparentize | retval)
- && ((GfxContainer *)s->port == (GfxContainer *)s->dyn_views->_parent) // If dynviews are on the same port...
- && (s->dyn_views->_next)) // ... and not on top of the view list...
- reparentize_primary_widget_lists(s, s->port); // ...then reparentize.
+ && ((GfxContainer *)_s->port == (GfxContainer *)_s->dyn_views->_parent) // If dynviews are on the same port...
+ && (_s->dyn_views->_next)) // ... and not on top of the view list...
+ reparentize_primary_widget_lists(_s, _s->port); // ...then reparentize.
- _k_view_list_kryptonize(s->dyn_views->_contents);
+ _k_view_list_kryptonize(_s->dyn_views->_contents);
}
FULL_REDRAW();
@@ -2574,16 +2560,16 @@ void SciGui32::addToPicList(reg_t listReference, int argc, reg_t *argv) {
List *list;
GfxList *pic_views;
- assert_primary_widget_lists(s);
+ assert_primary_widget_lists(_s);
if (!listReference.segment) {
warning("Attempt to AddToPic single non-list: %04x:%04x", PRINT_REG(listReference));
return;
}
- list = s->_segMan->lookupList(listReference);
+ list = _s->_segMan->lookupList(listReference);
- pic_views = gfxw_new_list(s->picture_port->_bounds, 1);
+ pic_views = gfxw_new_list(_s->picture_port->_bounds, 1);
debugC(2, kDebugLevelGraphics, "Preparing picview list...\n");
_k_make_view_list(&pic_views, list, 0, argc, argv);
@@ -2596,24 +2582,24 @@ void SciGui32::addToPicList(reg_t listReference, int argc, reg_t *argv) {
// Draw relative to the bottom center
debugC(2, kDebugLevelGraphics, "Returning.\n");
- reparentize_primary_widget_lists(s, s->port);
+ reparentize_primary_widget_lists(_s, _s->port);
}
void SciGui32::addToPicView(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 leftPos, int16 topPos, int16 priority, int16 control) {
- assert_primary_widget_lists(s);
+ assert_primary_widget_lists(_s);
GfxWidget *widget;
topPos++; // magic +1
- widget = gfxw_new_dyn_view(s->gfx_state, Common::Point(leftPos, topPos), 0, viewId, loopNo, celNo, 0, priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0);
+ widget = gfxw_new_dyn_view(_s->gfx_state, Common::Point(leftPos, topPos), 0, viewId, loopNo, celNo, 0, priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0);
if (!widget) {
error("Attempt to single-add invalid picview (%d/%d/%d)", viewId, loopNo, celNo);
} else {
widget->_ID = -1;
if (control >= 0) {
- Common::Rect abs_zone = nsrect_clip(s, topPos, calculate_nsrect(s, leftPos, topPos, viewId, loopNo, celNo), priority);
+ Common::Rect abs_zone = nsrect_clip(_s, topPos, calculate_nsrect(_s, leftPos, topPos, viewId, loopNo, celNo), priority);
draw_rect_to_control_map(abs_zone);
}
ADD_TO_CURRENT_PICTURE_PORT(gfxw_picviewize_dynview((GfxDynView *) widget));
@@ -2669,9 +2655,9 @@ static int collides_with(EngineState *s, Common::Rect area, reg_t other_obj, int
#define GASEOUS_VIEW_MASK_PASSIVE (_K_VIEW_SIG_FLAG_NO_UPDATE | _K_VIEW_SIG_FLAG_REMOVE | _K_VIEW_SIG_FLAG_IGNORE_ACTOR)
bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
- SegManager *segMan = s->_segMan;
+ SegManager *segMan = _s->_segMan;
List *cliplist = NULL;
- GfxPort *port = s->picture_port;
+ GfxPort *port = _s->picture_port;
uint16 signal;
bool retval;
@@ -2694,7 +2680,7 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
illegal_bits = GET_SEL32V(curObject, illegalBits);
- retval = !(illegal_bits & (edgehit = gfxop_scan_bitmask(s->gfx_state, zone, GFX_MASK_CONTROL)));
+ retval = !(illegal_bits & (edgehit = gfxop_scan_bitmask(_s->gfx_state, zone, GFX_MASK_CONTROL)));
debugC(2, kDebugLevelBresen, "edgehit = %04x (illegalBits %04x)\n", edgehit, illegal_bits);
if (!retval) {
@@ -2705,16 +2691,16 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
retval = false;
if ((illegal_bits & 0x8000) // If we are vulnerable to those views at all...
- && s->dyn_views) { // ...check against all stop-updated dynviews
- GfxDynView *widget = (GfxDynView *)s->dyn_views->_contents;
+ && _s->dyn_views) { // ...check against all stop-updated dynviews
+ GfxDynView *widget = (GfxDynView *)_s->dyn_views->_contents;
debugC(2, kDebugLevelBresen, "Checking vs dynviews:\n");
while (widget) {
if (widget->_ID && (widget->signal & _K_VIEW_SIG_FLAG_STOPUPD)
&& ((widget->_ID != curObject.segment) || (widget->_subID != curObject.offset))
- && s->_segMan->isObject(make_reg(widget->_ID, widget->_subID)))
- if (collides_with(s, abs_zone, make_reg(widget->_ID, widget->_subID), 1, GASEOUS_VIEW_MASK_ACTIVE))
+ && _s->_segMan->isObject(make_reg(widget->_ID, widget->_subID)))
+ if (collides_with(_s, abs_zone, make_reg(widget->_ID, widget->_subID), 1, GASEOUS_VIEW_MASK_ACTIVE))
return false;
widget = (GfxDynView *)widget->_next;
@@ -2728,10 +2714,10 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
}
if (listReference.segment)
- cliplist = s->_segMan->lookupList(listReference);
+ cliplist = _s->_segMan->lookupList(listReference);
if (cliplist) {
- Node *node = s->_segMan->lookupNode(cliplist->first);
+ Node *node = _s->_segMan->lookupNode(cliplist->first);
retval = false; // Assume that we Can'tBeHere...
@@ -2739,17 +2725,17 @@ bool SciGui32::canBeHere(reg_t curObject, reg_t listReference) {
reg_t other_obj = node->value;
debugC(2, kDebugLevelBresen, " comparing against %04x:%04x\n", PRINT_REG(other_obj));
- if (!s->_segMan->isObject(other_obj)) {
+ if (!_s->_segMan->isObject(other_obj)) {
warning("CanBeHere() cliplist contains non-object %04x:%04x", PRINT_REG(other_obj));
} else if (other_obj != curObject) { // Clipping against yourself is not recommended
- if (collides_with(s, abs_zone, other_obj, 0, GASEOUS_VIEW_MASK_PASSIVE)) {
+ if (collides_with(_s, abs_zone, other_obj, 0, GASEOUS_VIEW_MASK_PASSIVE)) {
debugC(2, kDebugLevelBresen, " -> %04x\n", retval);
return false;
}
} // if (other_obj != obj)
- node = s->_segMan->lookupNode(node->succ); // move on
+ node = _s->_segMan->lookupNode(node->succ); // move on
}
}
@@ -2776,19 +2762,19 @@ void SciGui32::setCursorView(GuiResourceId viewNum, int loopNum, int cellNum, Co
}
void SciGui32::setCursorPos(Common::Point pos) {
- pos.y += s->port->_bounds.y;
- pos.x += s->port->_bounds.x;
+ pos.y += _s->port->_bounds.y;
+ pos.x += _s->port->_bounds.x;
moveCursor(pos);
}
void SciGui32::moveCursor(Common::Point pos) {
- pos.y += s->port->zone.y;
- pos.x += s->port->zone.x;
+ pos.y += _s->port->zone.y;
+ pos.x += _s->port->zone.x;
- if (pos.x > s->port->zone.x + s->port->zone.width)
- pos.x = s->port->zone.x + s->port->zone.width;
- if (pos.y > s->port->zone.y + s->port->zone.height)
- pos.y = s->port->zone.y + s->port->zone.height;
+ if (pos.x > _s->port->zone.x + _s->port->zone.width)
+ pos.x = _s->port->zone.x + _s->port->zone.width;
+ if (pos.y > _s->port->zone.y + _s->port->zone.height)
+ pos.y = _s->port->zone.y + _s->port->zone.height;
if (pos.x < 0) pos.x = 0;
if (pos.y < 0) pos.y = 0;
@@ -2802,7 +2788,7 @@ void SciGui32::moveCursor(Common::Point pos) {
// Trigger event reading to make sure the mouse coordinates will
// actually have changed the next time we read them.
- gfxop_get_event(s->gfx_state, SCI_EVT_PEEK);
+ gfxop_get_event(_s->gfx_state, SCI_EVT_PEEK);
}
bool SciGui32::debugUndither(bool flag) {
@@ -2810,26 +2796,26 @@ bool SciGui32::debugUndither(bool flag) {
}
bool SciGui32::debugShowMap(int mapNo) {
- gfxop_set_clip_zone(s->gfx_state, gfx_rect_fullscreen);
+ gfxop_set_clip_zone(_s->gfx_state, gfx_rect_fullscreen);
switch (mapNo) {
case 0:
- s->visual->add_dirty_abs((GfxContainer *)s->visual, gfx_rect(0, 0, 320, 200), 0);
- s->visual->draw(Common::Point(0, 0));
+ _s->visual->add_dirty_abs((GfxContainer *)_s->visual, gfx_rect(0, 0, 320, 200), 0);
+ _s->visual->draw(Common::Point(0, 0));
break;
case 1:
- gfx_xlate_pixmap(s->gfx_state->pic->priority_map, s->gfx_state->driver->getMode());
- gfxop_draw_pixmap(s->gfx_state, s->gfx_state->pic->priority_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
+ gfx_xlate_pixmap(_s->gfx_state->pic->priority_map, _s->gfx_state->driver->getMode());
+ gfxop_draw_pixmap(_s->gfx_state, _s->gfx_state->pic->priority_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
break;
case 2:
- gfx_xlate_pixmap(s->gfx_state->control_map, s->gfx_state->driver->getMode());
- gfxop_draw_pixmap(s->gfx_state, s->gfx_state->control_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
+ gfx_xlate_pixmap(_s->gfx_state->control_map, _s->gfx_state->driver->getMode());
+ gfxop_draw_pixmap(_s->gfx_state, _s->gfx_state->control_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
break;
}
- gfxop_update(s->gfx_state);
+ gfxop_update(_s->gfx_state);
return false;
}
diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h
index 34a33aff57..6d6c520600 100644
--- a/engines/sci/gui32/gui32.h
+++ b/engines/sci/gui32/gui32.h
@@ -103,10 +103,9 @@ public:
bool debugShowMap(int mapNo);
// FIXME: Don't store EngineState
- virtual void resetEngineState(EngineState *newState) { s = newState; }
+ virtual void resetEngineState(EngineState *newState) { _s = newState; }
private:
- EngineState *s;
bool _usesOldGfxFunctions;
GfxDynView *_k_make_dynview_obj(reg_t obj, int options, int nr, int argc, reg_t *argv);