aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-22 15:12:54 +0000
committerFilippos Karapetis2009-10-22 15:12:54 +0000
commit42068f58537c988173d4c1e018ea9a7819f13db4 (patch)
tree378688589afb38e0a82ac5c6b9dc03ef99b78268
parent161f49ac481d380660b2aef4d8d92e72d63ea902 (diff)
downloadscummvm-rg350-42068f58537c988173d4c1e018ea9a7819f13db4.tar.gz
scummvm-rg350-42068f58537c988173d4c1e018ea9a7819f13db4.tar.bz2
scummvm-rg350-42068f58537c988173d4c1e018ea9a7819f13db4.zip
Cleanup
svn-id: r45337
-rw-r--r--engines/sci/engine/kgraphics.cpp2
-rw-r--r--engines/sci/engine/savegame.cpp2
-rw-r--r--engines/sci/gfx/gfx_gui.cpp4
-rw-r--r--engines/sci/gfx/gfx_widgets.cpp2
-rw-r--r--engines/sci/gfx/operations.cpp30
-rw-r--r--engines/sci/gfx/operations.h48
-rw-r--r--engines/sci/gui32/gui32.cpp15
7 files changed, 12 insertions, 91 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 3faaef6364..e950bb509a 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -432,7 +432,7 @@ reg_t kNumCels(EngineState *s, int argc, reg_t *argv) {
int view = GET_SEL32V(segMan, obj, view);
int cel = 0xffff;
- gfxop_check_cel(s->gfx_state, view, &loop, &cel);
+ s->gfx_state->gfxResMan->getView(view, &loop, &cel, 0);
debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d\n", view, loop, cel + 1);
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 3ce6032ce8..297c1462a9 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -781,7 +781,7 @@ EngineState *gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
retval->bp_list = s->bp_list;
retval->successor = NULL;
- retval->pic_priority_table = (int *)gfxop_get_pic_metainfo(retval->gfx_state);
+ retval->pic_priority_table = (int *)(retval->gfx_state->pic) ? retval->gfx_state->pic->priorityTable : NULL;
retval->_gameName = s->_gameName;
retval->_sound._it = NULL;
diff --git a/engines/sci/gfx/gfx_gui.cpp b/engines/sci/gfx/gfx_gui.cpp
index 49ba3f24c3..fa4106d613 100644
--- a/engines/sci/gfx/gfx_gui.cpp
+++ b/engines/sci/gfx/gfx_gui.cpp
@@ -345,7 +345,7 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, const char
GfxText *text_handle;
GfxList *list;
- int cursor_height = gfxop_get_font_height(port->_visual->_gfxState, font);
+ int cursor_height = port->_visual->_gfxState->gfxResMan->getFont(font)->line_height;
zone.x--;
zone.y--;
@@ -453,7 +453,7 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr
list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0);
- font_height = gfxop_get_font_height(port->_visual->_gfxState, font_nr);
+ font_height = port->_visual->_gfxState->gfxResMan->getFont(font_nr)->line_height;
columns = (zone.height - 20);
columns /= font_height;
diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp
index b208eee4b6..f667381fdc 100644
--- a/engines/sci/gfx/gfx_widgets.cpp
+++ b/engines/sci/gfx/gfx_widgets.cpp
@@ -776,7 +776,7 @@ GfxText::~GfxText() {
if (!state) {
error("Attempt to free text without supplying mode to free it from!\n");
} else {
- gfxop_free_text(state, _textHandle);
+ delete _textHandle;
_textHandle = NULL;
}
}
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 2f9930fc68..1d914ac1c2 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -1316,13 +1316,6 @@ int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop) {
return view->loops[real_loop].cels_nr;
}
-void gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel) {
- gfxr_view_t *testView = state->gfxResMan->getView(nr, loop, cel, 0);
-
- if (!testView)
- error("[GFX] Attempt to verify loop/cel values for invalid view %d", nr);
-}
-
void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
gfxr_view_t *view = NULL;
gfx_pixmap_t *pxm = NULL;
@@ -1409,10 +1402,6 @@ static void _gfxop_set_pic(GfxState *state) {
state->driver->setStaticBuffer(state->pic->visual_map, state->pic->priority_map);
}
-int *gfxop_get_pic_metainfo(GfxState *state) {
- return (state->pic) ? state->pic->priorityTable : NULL;
-}
-
void gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette) {
state->gfxResMan->tagResources();
state->tag_mode = 1;
@@ -1460,17 +1449,6 @@ void gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette) {
// Text operations
-// FIXME: only the resstate member of state is used -- inline the reference by:
-// replacing GfxState* state parameter with gfx_resstate_t* gfxResourceState and adjust callers accordingly
-int gfxop_get_font_height(GfxState *state, int font_nr) {
- gfx_bitmap_font_t *font = state->gfxResMan->getFont(font_nr);
-
- if (!font)
- error("gfxop_get_font_height(): Font number %d not found", font_nr);
-
- return font->line_height;
-}
-
void gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int maxwidth, int *width, int *height, int text_flags,
int *lines_nr, int *lineheight, int *lastline_width) {
Common::Array<TextFragment> fragments;
@@ -1566,10 +1544,6 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t
return handle;
}
-void gfxop_free_text(GfxState *state, TextHandle *handle) {
- delete handle;
-}
-
TextHandle::TextHandle() {
line_height = 0;
font = 0;
@@ -1686,8 +1660,4 @@ void gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone, Common::
200*state->driver->getMode()->scaleFactor), 0, NULL, NULL);
}
-void gfxop_free_pixmap(GfxState *state, gfx_pixmap_t *pxm) {
- gfx_free_pixmap(pxm);
-}
-
} // End of namespace Sci
diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h
index 6359985731..4850d31669 100644
--- a/engines/sci/gfx/operations.h
+++ b/engines/sci/gfx/operations.h
@@ -371,19 +371,6 @@ sci_event_t gfxop_get_event(GfxState *state, unsigned int mask);
int gfxop_lookup_view_get_cels(GfxState *state, int nr, int loop);
/**
- * Clips the view/loop/cel position of a cel.
- *
- * *loop is clipped first, then *cel. The resulting setup will be a valid view
- * configuration.
- *
- * @param[in] state The state to use
- * @param[in] nr Number of the view to use
- * @param[in] loop Pointer to the variable storing the loop number to verify
- * @param[in] cel Pointer to the variable storing the cel number to check
- */
-void gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel);
-
-/**
* Retrieves the width and height of a cel.
*
* @param[in] state The state to use
@@ -465,16 +452,6 @@ void gfxop_draw_cel_static_clipped(GfxState *state, int nr, int loop, int cel,
void gfxop_new_pic(GfxState *state, int nr, int flags, int default_palette);
/**
- * Retrieves all meta-information assigned to the current pic.
- *
- * @param[in] state The state affected
- * @return NULL if the pic doesn't exist or has no meta-information,
- * the meta-info otherwise. This meta-information is referred
- * to as 'internal data' in the pic code
- */
-int *gfxop_get_pic_metainfo(GfxState *state);
-
-/**
* Adds a pic to the static buffer.
*
* @param[in] state The state affected
@@ -487,16 +464,6 @@ void gfxop_add_to_pic(GfxState *state, int nr, int flags, int default_palette);
/** @name Text operations */
-/** @{ */
-
-/**
- * Returns the fixed line height for one specified font.
- *
- * @param[in] state The state to work on
- * @param[in] font_nr Number of the font to inspect
- * @return The font line height
- */
-int gfxop_get_font_height(GfxState *state, int font_nr);
/**
* Calculates the width and height of a specified text in a specified
@@ -546,14 +513,6 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr,
gfx_color_t bg_color, int flags);
/**
- * Frees a previously allocated text handle and all related resources.
- *
- * @param[in] state The state to use
- * @param[in] handle The handle to free
- */
-void gfxop_free_text(GfxState *state, TextHandle *handle);
-
-/**
* Draws text stored in a text handle.
*
* @param[in] state The target state
@@ -591,13 +550,6 @@ gfx_pixmap_t *gfxop_grab_pixmap(GfxState *state, rect_t area);
void gfxop_draw_pixmap(GfxState *state, gfx_pixmap_t *pxm, rect_t zone,
Common::Point pos);
-/**
- * Frees a pixmap returned by gfxop_grab_pixmap().
- *
- * @param[in] state The affected state
- * @param[in] pxm The pixmap to free
- */
-void gfxop_free_pixmap(GfxState *state, gfx_pixmap_t *pxm);
/** @} */
diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp
index 790a43c9f9..ae493708cf 100644
--- a/engines/sci/gui32/gui32.cpp
+++ b/engines/sci/gui32/gui32.cpp
@@ -896,7 +896,7 @@ void SciGui32::drawPicture(GuiResourceId pictureId, int16 animationNr, bool anim
gfxop_disable_dirty_frames(_s->gfx_state);
if (NULL != _s->old_screen) {
- gfxop_free_pixmap(_s->gfx_state, _s->old_screen);
+ gfx_free_pixmap(_s->old_screen);
}
_s->old_screen = gfxop_grab_pixmap(_s->gfx_state, gfx_rect(0, 10, 320, 190));
@@ -924,7 +924,7 @@ void SciGui32::drawPicture(GuiResourceId pictureId, int16 animationNr, bool anim
_s->port = _s->picture_port;
- _s->pic_priority_table = gfxop_get_pic_metainfo(_s->gfx_state);
+ _s->pic_priority_table = (_s->gfx_state->pic) ? _s->gfx_state->pic->priorityTable : NULL;
_s->pic_animate = animationNr; // The animation used during kAnimate() later on
@@ -947,8 +947,7 @@ void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo
int cel = celNo;
GfxView *new_view;
- gfxop_check_cel(_s->gfx_state, viewId, &loop, &cel);
-
+ _s->gfx_state->gfxResMan->getView(viewId, &loop, &cel, 0);
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,
@@ -1416,7 +1415,7 @@ void SciGui32::shakeScreen(uint16 shakeCount, uint16 directions) {
gfxop_sleep(_s->gfx_state, 50);
}
- gfxop_free_pixmap(_s->gfx_state, screen);
+ gfx_free_pixmap(screen);
gfxop_update(_s->gfx_state);
}
@@ -1485,7 +1484,7 @@ GfxDynView *SciGui32::_k_make_dynview_obj(reg_t obj, int options, int nr, int ar
palette = 0;
// Clip loop and cel, write back if neccessary
- gfxop_check_cel(_s->gfx_state, view_nr, &loop, &cel);
+ _s->gfx_state->gfxResMan->getView(view_nr, &loop, &cel, 0);
if (loop != oldloop)
loop = 0;
@@ -2449,8 +2448,8 @@ void SciGui32::animate_do_animation(int argc, reg_t *argv) {
}
- gfxop_free_pixmap(_s->gfx_state, _s->old_screen);
- gfxop_free_pixmap(_s->gfx_state, newscreen);
+ gfx_free_pixmap(_s->old_screen);
+ gfx_free_pixmap(newscreen);
_s->old_screen = NULL;
}