From e4c23834dd2972c75f6f698f9f55320c1784218f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 Oct 2009 23:29:00 +0000 Subject: Moved sci_ffs() inside iterator.cpp, the only place where it's actually used, and removed tools.*. Also, removed all the unused includes to tools.h from several places svn-id: r45176 --- engines/sci/engine/grammar.cpp | 1 - engines/sci/engine/message.cpp | 1 - engines/sci/engine/segment.cpp | 1 - engines/sci/gfx/gfx_system.h | 1 - engines/sci/gfx/res_font.cpp | 1 + engines/sci/gfx/res_pic.cpp | 3 +++ engines/sci/gui/gui.cpp | 1 - engines/sci/gui/gui_animate.cpp | 1 - engines/sci/gui/gui_cursor.cpp | 1 - engines/sci/gui/gui_font.cpp | 1 - engines/sci/gui/gui_gfx.cpp | 1 - engines/sci/gui/gui_palette.cpp | 1 - engines/sci/gui/gui_picture.cpp | 1 - engines/sci/gui/gui_screen.cpp | 1 - engines/sci/gui/gui_transitions.cpp | 1 - engines/sci/gui/gui_view.cpp | 1 - engines/sci/gui/gui_windowmgr.cpp | 1 - engines/sci/gui32/gui32.cpp | 1 - engines/sci/module.mk | 1 - engines/sci/resource.cpp | 1 - engines/sci/sci.cpp | 4 +-- engines/sci/sfx/core.cpp | 1 - engines/sci/sfx/iterator.cpp | 16 +++++++++++- engines/sci/sfx/seq/gm.cpp | 1 - engines/sci/sfx/seq/instrument-map.h | 1 - engines/sci/sfx/seq/sequencers.cpp | 1 - engines/sci/sfx/softseq.h | 1 - engines/sci/sfx/softseq/adlib.cpp | 1 - engines/sci/sfx/softseq/amiga.cpp | 1 - engines/sci/sfx/songlib.cpp | 1 - engines/sci/tools.cpp | 48 ------------------------------------ engines/sci/tools.h | 39 ----------------------------- 32 files changed, 21 insertions(+), 116 deletions(-) delete mode 100644 engines/sci/tools.cpp delete mode 100644 engines/sci/tools.h (limited to 'engines/sci') diff --git a/engines/sci/engine/grammar.cpp b/engines/sci/engine/grammar.cpp index 89d550dafc..cdc508d8a4 100644 --- a/engines/sci/engine/grammar.cpp +++ b/engines/sci/engine/grammar.cpp @@ -28,7 +28,6 @@ ** that grammar, writing an appropriate node tree if successful. */ -#include "sci/tools.h" #include "sci/vocabulary.h" #include "sci/console.h" diff --git a/engines/sci/engine/message.cpp b/engines/sci/engine/message.cpp index b7e0c00fbe..8dc893db64 100644 --- a/engines/sci/engine/message.cpp +++ b/engines/sci/engine/message.cpp @@ -26,7 +26,6 @@ #include "sci/engine/message.h" #include "sci/engine/kernel.h" #include "sci/engine/seg_manager.h" -#include "sci/tools.h" namespace Sci { diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 38af3e8b29..b683fd4d8b 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -29,7 +29,6 @@ #include "sci/engine/segment.h" #include "sci/engine/seg_manager.h" #include "sci/engine/state.h" -#include "sci/tools.h" namespace Sci { diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index 37b915f518..7dd779ca01 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -28,7 +28,6 @@ #include "common/scummsys.h" #include "common/rect.h" -#include "sci/tools.h" #include "sci/gfx/palette.h" namespace Sci { diff --git a/engines/sci/gfx/res_font.cpp b/engines/sci/gfx/res_font.cpp index fd2cae08e6..6533558388 100644 --- a/engines/sci/gfx/res_font.cpp +++ b/engines/sci/gfx/res_font.cpp @@ -23,6 +23,7 @@ * */ +#include "common/endian.h" #include "sci/gfx/gfx_system.h" #include "sci/gfx/gfx_resource.h" #include "sci/gfx/gfx_tools.h" diff --git a/engines/sci/gfx/res_pic.cpp b/engines/sci/gfx/res_pic.cpp index 0196ad57a4..4ecec28011 100644 --- a/engines/sci/gfx/res_pic.cpp +++ b/engines/sci/gfx/res_pic.cpp @@ -24,6 +24,9 @@ */ #include // for time() to seed rand() via srand() + +#include "common/endian.h" + #include "sci/gfx/gfx_resource.h" #include "sci/gfx/gfx_tools.h" #include "sci/sci.h" // for kDebugLevelSci0Pic diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index f8e083b2ca..5728ffd2d1 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -29,7 +29,6 @@ #include "sci/sci.h" #include "sci/debug.h" // for g_debug_sleeptime_factor #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui.h" #include "sci/gui/gui_screen.h" #include "sci/gui/gui_palette.h" diff --git a/engines/sci/gui/gui_animate.cpp b/engines/sci/gui/gui_animate.cpp index 19bcc418a0..8f26cfd971 100644 --- a/engines/sci/gui/gui_animate.cpp +++ b/engines/sci/gui/gui_animate.cpp @@ -29,7 +29,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_gfx.h" #include "sci/gui/gui_view.h" #include "sci/gui/gui_screen.h" diff --git a/engines/sci/gui/gui_cursor.cpp b/engines/sci/gui/gui_cursor.cpp index ba55fe75e2..81b390e3b6 100644 --- a/engines/sci/gui/gui_cursor.cpp +++ b/engines/sci/gui/gui_cursor.cpp @@ -29,7 +29,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_palette.h" #include "sci/gui/gui_view.h" #include "sci/gui/gui_cursor.h" diff --git a/engines/sci/gui/gui_font.cpp b/engines/sci/gui/gui_font.cpp index a341bb9dec..d903d18f4c 100644 --- a/engines/sci/gui/gui_font.cpp +++ b/engines/sci/gui/gui_font.cpp @@ -25,7 +25,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_screen.h" #include "sci/gui/gui_font.h" diff --git a/engines/sci/gui/gui_gfx.cpp b/engines/sci/gui/gui_gfx.cpp index 1bdb1bbd8f..b4f2e224b0 100644 --- a/engines/sci/gui/gui_gfx.cpp +++ b/engines/sci/gui/gui_gfx.cpp @@ -29,7 +29,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_gfx.h" #include "sci/gui/gui_animate.h" #include "sci/gui/gui_font.h" diff --git a/engines/sci/gui/gui_palette.cpp b/engines/sci/gui/gui_palette.cpp index bc02f2332e..e5a81406b9 100644 --- a/engines/sci/gui/gui_palette.cpp +++ b/engines/sci/gui/gui_palette.cpp @@ -28,7 +28,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_screen.h" #include "sci/gui/gui_palette.h" diff --git a/engines/sci/gui/gui_picture.cpp b/engines/sci/gui/gui_picture.cpp index 7f4d19555b..6fca4d6542 100644 --- a/engines/sci/gui/gui_picture.cpp +++ b/engines/sci/gui/gui_picture.cpp @@ -26,7 +26,6 @@ #include "common/stack.h" #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_screen.h" #include "sci/gui/gui_palette.h" #include "sci/gui/gui_gfx.h" diff --git a/engines/sci/gui/gui_screen.cpp b/engines/sci/gui/gui_screen.cpp index df5b9831d3..90f7875a9f 100644 --- a/engines/sci/gui/gui_screen.cpp +++ b/engines/sci/gui/gui_screen.cpp @@ -29,7 +29,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_screen.h" namespace Sci { diff --git a/engines/sci/gui/gui_transitions.cpp b/engines/sci/gui/gui_transitions.cpp index da260deb84..09e58e0e71 100644 --- a/engines/sci/gui/gui_transitions.cpp +++ b/engines/sci/gui/gui_transitions.cpp @@ -29,7 +29,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui.h" #include "sci/gui/gui_screen.h" #include "sci/gui/gui_palette.h" diff --git a/engines/sci/gui/gui_view.cpp b/engines/sci/gui/gui_view.cpp index bff2e38e3b..83c80d5f59 100644 --- a/engines/sci/gui/gui_view.cpp +++ b/engines/sci/gui/gui_view.cpp @@ -25,7 +25,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_gfx.h" #include "sci/gui/gui_screen.h" #include "sci/gui/gui_palette.h" diff --git a/engines/sci/gui/gui_windowmgr.cpp b/engines/sci/gui/gui_windowmgr.cpp index 2909a31845..d58d2d677c 100644 --- a/engines/sci/gui/gui_windowmgr.cpp +++ b/engines/sci/gui/gui_windowmgr.cpp @@ -27,7 +27,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/gui/gui_screen.h" #include "sci/gui/gui_gfx.h" #include "sci/gui/gui_animate.h" diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index 66b8bc696a..8cf6d2cfa1 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -28,7 +28,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" -#include "sci/tools.h" #include "sci/debug.h" // for g_debug_sleeptime_factor #include "sci/resource.h" #include "sci/engine/state.h" diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 26962db9c2..8c9ef94cc1 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -7,7 +7,6 @@ MODULE_OBJS = \ resource.o \ sci.o \ seq_decoder.o \ - tools.o \ vocabulary.o \ engine/game.o \ engine/gc.o \ diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 8b741a1228..743ee27165 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -31,7 +31,6 @@ #include "sci/sci.h" #include "sci/engine/state.h" #include "sci/engine/kernel.h" -#include "sci/tools.h" #include "sci/resource.h" #include "sci/vocabulary.h" #include "sci/decompressor.h" diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 3edf76d9eb..e7b06e5e57 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -132,8 +132,8 @@ Common::Error SciEngine::run() { return Common::kUnknownError; // Gui change - //_gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor); // new - _gamestate->_gui = new SciGui32(_gamestate, screen, palette, cursor); // old + _gamestate->_gui = new SciGui(_gamestate, screen, palette, cursor); // new + //_gamestate->_gui = new SciGui32(_gamestate, screen, palette, cursor); // old if (game_init(_gamestate)) { /* Initialize */ warning("Game initialization failed: Aborting..."); diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index f985fef7aa..1831ae14fc 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -25,7 +25,6 @@ /* Sound subsystem core: Event handler, sound player dispatching */ -#include "sci/tools.h" #include "sci/sci.h" #include "sci/sfx/core.h" #include "sci/sfx/iterator.h" diff --git a/engines/sci/sfx/iterator.cpp b/engines/sci/sfx/iterator.cpp index 5c458b4200..12f6850e7f 100644 --- a/engines/sci/sfx/iterator.cpp +++ b/engines/sci/sfx/iterator.cpp @@ -31,7 +31,6 @@ #include "sci/sfx/iterator_internal.h" #include "sci/engine/state.h" // for sfx_player_tell_synth :/ #include "sci/sfx/core.h" // for sfx_player_tell_synth -#include "sci/tools.h" #include "sound/audiostream.h" #include "sound/mixer.h" @@ -46,6 +45,21 @@ static const int MIDI_cmdlen[16] = {0, 0, 0, 0, 0, 0, 0, 0, /*#define DEBUG_DECODING*/ /*#define DEBUG_VERBOSE*/ +/** Find first set bit in bits and return its index. Returns 0 if bits is 0. */ +static int sci_ffs(int bits) { + if (!bits) + return 0; + + int retval = 1; + + while (!(bits & 1)) { + retval++; + bits >>= 1; + } + + return retval; +} + static void print_tabs_id(int nr, songit_id_t id) { while (nr-- > 0) fprintf(stderr, "\t"); diff --git a/engines/sci/sfx/seq/gm.cpp b/engines/sci/sfx/seq/gm.cpp index 40f6a602b8..2fe5675150 100644 --- a/engines/sci/sfx/seq/gm.cpp +++ b/engines/sci/sfx/seq/gm.cpp @@ -25,7 +25,6 @@ #include "common/util.h" -#include "sci/tools.h" #include "sci/sfx/sequencer.h" #include "sci/sfx/device.h" #include "sci/sfx/seq/instrument-map.h" diff --git a/engines/sci/sfx/seq/instrument-map.h b/engines/sci/sfx/seq/instrument-map.h index c223e68a33..1e8a63076b 100644 --- a/engines/sci/sfx/seq/instrument-map.h +++ b/engines/sci/sfx/seq/instrument-map.h @@ -28,7 +28,6 @@ #ifndef SCI_SFX_SEQ_INSTRUMENT_MAP_H #define SCI_SFX_SEQ_INSTRUMENT_MAP_H -#include "sci/tools.h" #include "sci/sfx/device.h" namespace Sci { diff --git a/engines/sci/sfx/seq/sequencers.cpp b/engines/sci/sfx/seq/sequencers.cpp index 1a0cd68c2d..98dde97652 100644 --- a/engines/sci/sfx/seq/sequencers.cpp +++ b/engines/sci/sfx/seq/sequencers.cpp @@ -24,7 +24,6 @@ */ #include "../sequencer.h" -#include "sci/tools.h" namespace Sci { diff --git a/engines/sci/sfx/softseq.h b/engines/sci/sfx/softseq.h index 32ad98f4b9..31741785ae 100644 --- a/engines/sci/sfx/softseq.h +++ b/engines/sci/sfx/softseq.h @@ -29,7 +29,6 @@ #include "common/error.h" #include "sci/sfx/sfx_pcm.h" #include "sci/sfx/sequencer.h" -#include "sci/tools.h" namespace Sci { diff --git a/engines/sci/sfx/softseq/adlib.cpp b/engines/sci/sfx/softseq/adlib.cpp index 7343ba1237..15e1ed9089 100644 --- a/engines/sci/sfx/softseq/adlib.cpp +++ b/engines/sci/sfx/softseq/adlib.cpp @@ -24,7 +24,6 @@ */ #include "sci/sci.h" -#include "sci/tools.h" #include "sci/sfx/iterator.h" #include "sound/fmopl.h" diff --git a/engines/sci/sfx/softseq/amiga.cpp b/engines/sci/sfx/softseq/amiga.cpp index ff4057be3a..6094201169 100644 --- a/engines/sci/sfx/softseq/amiga.cpp +++ b/engines/sci/sfx/softseq/amiga.cpp @@ -23,7 +23,6 @@ * */ -#include "sci/tools.h" #include "sci/sfx/softseq.h" #include "common/file.h" diff --git a/engines/sci/sfx/songlib.cpp b/engines/sci/sfx/songlib.cpp index 0fe6440e7a..7cf26ff453 100644 --- a/engines/sci/sfx/songlib.cpp +++ b/engines/sci/sfx/songlib.cpp @@ -23,7 +23,6 @@ * */ -#include "sci/tools.h" #include "sci/sfx/core.h" #include "sci/sfx/iterator.h" diff --git a/engines/sci/tools.cpp b/engines/sci/tools.cpp deleted file mode 100644 index b35c6ce7b6..0000000000 --- a/engines/sci/tools.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#include "sci/tools.h" -#include "sci/engine/state.h" - -#include "sci/sci.h" // For _console only -#include "sci/console.h" // For _console only - -namespace Sci { - -int sci_ffs(int bits) { - if (!bits) - return 0; - - int retval = 1; - - while (!(bits & 1)) { - retval++; - bits >>= 1; - } - - return retval; -} - -} // End of namespace Sci diff --git a/engines/sci/tools.h b/engines/sci/tools.h deleted file mode 100644 index b0d30aadb7..0000000000 --- a/engines/sci/tools.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef SCI_TOOLS_H -#define SCI_TOOLS_H - -#include "common/scummsys.h" -#include "common/endian.h" - -namespace Sci { - -/** Find first set bit in bits and return its index. Returns 0 if bits is 0. */ -int sci_ffs(int bits); - -} // End of namespace Sci - -#endif // SCI_TOOLS_H -- cgit v1.2.3