diff options
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/game.cpp | 8 | ||||
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 27 | ||||
-rw-r--r-- | engines/sci/engine/state.cpp | 4 | ||||
-rw-r--r-- | engines/sci/engine/state.h | 4 |
4 files changed, 13 insertions, 30 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 1ebb68f81e..905ed878f7 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -174,7 +174,7 @@ int _reset_graphics_input(EngineState *s) { // but this is correct s->picture_port = gfxw_new_port(s->visual, NULL, s->gfx_state->pic_port_bounds, s->ega_colors[0], transparent); - s->pics_drawn_nr = 0; + s->_pics.clear(); s->visual->add(GFXWC(s->visual), s->wm_port); s->visual->add(GFXWC(s->visual), s->titlebar_port); @@ -214,8 +214,7 @@ static void _free_graphics_input(EngineState *s) { s->dyn_views = NULL; s->port = NULL; - free(s->pics); - s->pics = NULL; + s->_pics.clear(); } int game_init_sound(EngineState *s, int sound_flags) { @@ -469,8 +468,7 @@ int script_init_engine(EngineState *s, sci_version_t version) { sciprintf("Engine initialized\n"); s->pic_priority_table = NULL; - s->pics = NULL; - s->pics_nr = 0; + s->_pics.clear(); return 0; } diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 9c7da403ac..9d1b1c88ca 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -975,13 +975,15 @@ void _k_view_list_free_backgrounds(EngineState *s, ViewObject *list, int list_nr int sci01_priority_table_flags = 0; reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { - int pic_nr = SKPV(0); + drawn_pic_t dp; int add_to_pic = 1; - int palette = SKPV_OR_ALT(3, 0); gfx_color_t transparent = s->wm_port->_bgcolor; CHECK_THIS_KERNEL_FUNCTION; + dp.nr = SKPV(0); + dp.palette = SKPV_OR_ALT(3, 0); + if (s->version < SCI_VERSION_FTU_NEWER_DRAWPIC_PARAMETERS) { if (!SKPV_OR_ALT(2, 0)) add_to_pic = 0; @@ -1000,24 +1002,13 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) { SCIkdebug(SCIkGRAPHICS, "Drawing pic.%03d\n", SKPV(0)); - if (!s->pics) { - s->pics = (drawn_pic_t*)sci_malloc(sizeof(drawn_pic_t) * (s->pics_nr = 8)); - s->pics_drawn_nr = 0; - } - if (add_to_pic) { - if (s->pics_nr == s->pics_drawn_nr) { - s->pics_nr += 4; - s->pics = (drawn_pic_t*)sci_realloc(s->pics, sizeof(drawn_pic_t) * s->pics_nr); - } - s->pics[s->pics_drawn_nr].palette = palette; - s->pics[s->pics_drawn_nr++].nr = pic_nr; - GFX_ASSERT(gfxop_add_to_pic(s->gfx_state, pic_nr, 1, palette)); + s->_pics.push_back(dp); + GFX_ASSERT(gfxop_add_to_pic(s->gfx_state, dp.nr, 1, dp.palette)); } else { - s->pics_drawn_nr = 1; - s->pics[0].nr = pic_nr; - s->pics[0].palette = palette; - GFX_ASSERT(gfxop_new_pic(s->gfx_state, pic_nr, 1, palette)); + s->_pics.clear(); + s->_pics.push_back(dp); + GFX_ASSERT(gfxop_new_pic(s->gfx_state, dp.nr, 1, dp.palette)); } delete s->wm_port; diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp index 21f0452aee..4661abeeda 100644 --- a/engines/sci/engine/state.cpp +++ b/engines/sci/engine/state.cpp @@ -96,10 +96,6 @@ EngineState::EngineState() : _dirseeker(this) { priority_first = 0; priority_last = 0; - pics_drawn_nr = 0; - pics_nr = 0; - pics = 0; - last_wait_time = 0; version_lock_flag = 0; diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 070db99823..3d83671e83 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -188,9 +188,7 @@ public: int priority_first; /**< The line where priority zone 0 ends */ int priority_last; /**< The line where the highest priority zone starts */ - int pics_drawn_nr; - int pics_nr; - drawn_pic_t *pics; + Common::Array<drawn_pic_t> _pics; uint32 game_start_time; /**< The time at which the interpreter was started */ uint32 last_wait_time; /**< The last time the game invoked Wait() */ |