From a39711e25670b366ed76534cc926ac70ea6c1edd Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 31 Aug 2002 13:29:10 +0000 Subject: fixed compilation on Mac OS X; some cleanup; moved header file scumm/smusH/rect.h to common/rect.h svn-id: r4877 --- scumm/scumm.h | 23 +++------- scumm/scummvm.cpp | 6 +-- scumm/smush/blitter.h | 5 ++- scumm/smush/brenderer.cpp | 2 + scumm/smush/channel.h | 1 + scumm/smush/chunk.cpp | 2 + scumm/smush/codec37.cpp | 2 + scumm/smush/config.h | 2 +- scumm/smush/decoder.h | 4 +- scumm/smush/frenderer.cpp | 2 +- scumm/smush/frenderer.h | 2 +- scumm/smush/player.cpp | 3 +- scumm/smush/player.h | 2 +- scumm/smush/rect.h | 100 ----------------------------------------- scumm/smush/renderer.h | 4 +- scumm/smush/saud_channel.cpp | 1 + scumm/smush/scumm_renderer.cpp | 1 + scumm/string.cpp | 4 +- scumm/sys.cpp | 6 --- 19 files changed, 34 insertions(+), 138 deletions(-) delete mode 100644 scumm/smush/rect.h (limited to 'scumm') diff --git a/scumm/scumm.h b/scumm/scumm.h index ecb3e1f468..b0412d1ac4 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -208,7 +208,7 @@ struct CharsetRenderer { byte *_charPtr; int _width, _height; int _offsX, _offsY; - byte _bitMask, _revBitMask; + byte _bitMask; int _bottom; int _virtScreenHeight; @@ -368,7 +368,7 @@ public: /* Init functions, etc */ byte _fastMode; - char *getGameName(); + const char *getGameName(); /* video buffer */ byte *_videoBuffer; @@ -835,8 +835,9 @@ public: void unkScreenEffect3(); void unkScreenEffect4(); void unkScreenEffect5(int a); - void transitionEffect(int a); // former unkScreenEffect7 - void dissolveEffect(int width, int height); // former unkScreenEffect5(0) and unkScreenEffect6 + void transitionEffect(int a); + void dissolveEffect(int width, int height); + void scrollEffect(int dir); void decompressBomp(byte *dst, byte *src, int w, int h); uint _shakeFrame; @@ -1397,20 +1398,8 @@ public: Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {} }; -extern uint16 _debugLevel; - +// This is a constant lookup table of reverse bit masks extern const byte revBitMask[8]; -//void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h); - -#if defined(__GNUC__) -void CDECL error(const char *s, ...) NORETURN; -#else -void CDECL NORETURN error(const char *s, ...); -#endif - -void CDECL warning(const char *s, ...); -void CDECL debug(int level, const char *s, ...); -void checkHeap(); /* Direction conversion functions (between old dir and new dir format) */ int newDirToOldDir(int dir); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 7352a7ae79..ef3a3c45f1 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -100,7 +100,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) _gui->init(this); _newgui = new NewGui(this); - _bundle = new Bundle(this); + _bundle = new Bundle(); _timer = new Timer(this); _sound = new Sound(this); @@ -1464,7 +1464,7 @@ void Scumm::launch() _maxHeapThreshold = 450000; _minHeapThreshold = 400000; - /* Create a primary virtual screen */ + // Create a primary virtual screen _videoBuffer = (byte *)calloc(328*200, 1); allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0); @@ -1514,8 +1514,6 @@ void Scumm::launch() _sound->setupSound(); runScript(1, 0, 0, &_bootParam); - -// _scummTimer = 0; } void Scumm::go() { diff --git a/scumm/smush/blitter.h b/scumm/smush/blitter.h index 16c07f0296..a59644e777 100644 --- a/scumm/smush/blitter.h +++ b/scumm/smush/blitter.h @@ -34,7 +34,10 @@ # endif #endif -#include "rect.h" +#include "common/rect.h" + +using ScummVM::Point; +using ScummVM::Rect; class Chunk; /*! @brief class for handling blitting on a frame buffer diff --git a/scumm/smush/brenderer.cpp b/scumm/smush/brenderer.cpp index 64f97bb9c5..bba35fd3ad 100644 --- a/scumm/smush/brenderer.cpp +++ b/scumm/smush/brenderer.cpp @@ -22,6 +22,8 @@ #include #include "brenderer.h" +#include "common/engine.h" // for debug, warning, error + #include void BaseRenderer::clean() { diff --git a/scumm/smush/channel.h b/scumm/smush/channel.h index af5a078540..112ca5f1e7 100644 --- a/scumm/smush/channel.h +++ b/scumm/smush/channel.h @@ -23,6 +23,7 @@ #define CHANNEL_H #include "config.h" +#include "common/engine.h" // for debug, warning, error #ifdef DEBUG # ifndef NO_DEBUG_CHANNEL diff --git a/scumm/smush/chunk.cpp b/scumm/smush/chunk.cpp index 76163ebec2..f665c4db36 100644 --- a/scumm/smush/chunk.cpp +++ b/scumm/smush/chunk.cpp @@ -22,6 +22,8 @@ #include #include "chunk.h" +#include "common/engine.h" // for debug, warning, error + #include // for FILE, fopen, fclose, fseek and ftell #include // for memcpy diff --git a/scumm/smush/codec37.cpp b/scumm/smush/codec37.cpp index 16fe44a411..cc796ef48e 100644 --- a/scumm/smush/codec37.cpp +++ b/scumm/smush/codec37.cpp @@ -24,6 +24,8 @@ #include "chunk.h" #include "blitter.h" +#include "common/engine.h" // for debug, warning, error + #include #include diff --git a/scumm/smush/config.h b/scumm/smush/config.h index 112b166e4d..7ad1bcff23 100644 --- a/scumm/smush/config.h +++ b/scumm/smush/config.h @@ -23,7 +23,7 @@ #define SMUSH_CONFIG_H #include -#include +#include #ifndef NDEBUG #define DEBUG diff --git a/scumm/smush/decoder.h b/scumm/smush/decoder.h index cff839214d..8e4e9493f3 100644 --- a/scumm/smush/decoder.h +++ b/scumm/smush/decoder.h @@ -24,8 +24,10 @@ #include "config.h" -#include "rect.h" +#include "common/rect.h" +using ScummVM::Point; +using ScummVM::Rect; class Blitter; class Chunk; diff --git a/scumm/smush/frenderer.cpp b/scumm/smush/frenderer.cpp index 191235fb05..eb75a2bde4 100644 --- a/scumm/smush/frenderer.cpp +++ b/scumm/smush/frenderer.cpp @@ -21,9 +21,9 @@ #include #include "common/util.h" +#include "common/engine.h" // for debug, warning, error #include "frenderer.h" -#include "rect.h" #include #include diff --git a/scumm/smush/frenderer.h b/scumm/smush/frenderer.h index 18d6bf5089..c0210ab4d7 100644 --- a/scumm/smush/frenderer.h +++ b/scumm/smush/frenderer.h @@ -35,7 +35,7 @@ #endif #include "brenderer.h" -#include "rect.h" +#include "common/util.h" #include "blitter.h" /*! @brief ::renderer implementation specifically designed for font files. diff --git a/scumm/smush/player.cpp b/scumm/smush/player.cpp index cbe6aae69d..829d4d9437 100644 --- a/scumm/smush/player.cpp +++ b/scumm/smush/player.cpp @@ -21,6 +21,8 @@ #include #include "common/util.h" +#include "common/engine.h" // for debug, warning, error + #include "player.h" #include "mixer.h" @@ -28,7 +30,6 @@ #include "frenderer.h" #include "channel.h" #include "chunk_type.h" -#include "rect.h" #include "blitter.h" #include diff --git a/scumm/smush/player.h b/scumm/smush/player.h index 79bc7f6874..f9decce7f0 100644 --- a/scumm/smush/player.h +++ b/scumm/smush/player.h @@ -24,7 +24,7 @@ #include "config.h" -#include "rect.h" +#include "common/util.h" #include "chunk.h" #include "palette.h" #include "codec1.h" diff --git a/scumm/smush/rect.h b/scumm/smush/rect.h deleted file mode 100644 index d1f061136f..0000000000 --- a/scumm/smush/rect.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ScummVM - Scumm Interpreter - * Copyright (C) 2001/2002 The ScummVM project - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Header$ - * - */ - -#ifndef SMUSH_RECT_H -#define SMUSH_RECT_H - -#include "config.h" - -/*! @brief simple class for handling both 2D position and size - - This small class is an helper for position and size values. -*/ -class Point { - friend class Rect; -private: - int32 _x; //!< The horizontal part of the point - int32 _y; //!< The vertical part of the point -public: - Point() : _x(0), _y(0) {}; - Point(const Point & p) : _x(p._x), _y(p._y) {}; - explicit Point(int32 x, int32 y) : _x(x), _y(y) {}; - Point & operator=(const Point & p) { _x = p._x; _y = p._y; return *this; }; - bool operator==(const Point & p) const { return _x == p._x && _y == p._y; }; - const int32 & getX() const { return _x; }; - const int32 & getY() const { return _y; }; - int32 & getX() { return _x; }; - int32 & getY() { return _y; }; - Point operator+(const Point & p) const { return Point(_x + p._x, _y+p._y); }; - Point operator-(const Point & p) const { return Point(_x - p._x, _y-p._y); }; - Point & operator+=(const Point & p) { _x += p._x; _y += p._y; return *this; }; - Point & operator-=(const Point & p) { _x -= p._x; _y -= p._y; return *this; }; - bool isOrigin() const { return _x == 0 && _y == 0; }; - void set(int32 x, int32 y) { _x = x; _y = y; } -}; - -/*! @brief simple class for handling a rectangular zone. - - This small class is an helper for rectangles. - It is mostly used by the blitter class. -*/ -class Rect { -private: - Point _topLeft; //!< The point at the top left of the rectangle - Point _bottomRight; //!< The point at the bottom right of the rectangle -public: - Rect() : _topLeft(0, 0), _bottomRight(0,0) {} - Rect(int32 x, int32 y) : _topLeft(0, 0), _bottomRight(x, y) {} - Rect(int32 x1, int32 y1, int32 x2, int32 y2) : _topLeft(x1, y1), _bottomRight(x2, y2) {} - Point size() const { return (_bottomRight - _topLeft); }; - int32 width() const { return size()._x; } - int32 height() const { return size()._y; } - int32 left() const { return _topLeft._x; } - int32 right() const { return _bottomRight._x; } - int32 top() const { return _topLeft._y; } - int32 bottom() const { return _bottomRight._y; } - const Point & topLeft() const { return _topLeft; } - const Point & bottomRight() const { return _bottomRight; } - - /*! @brief check if given position is inside the rectangle - - @param x the horizontal position to check - @param y the vertical position to check - - @return true if the given position is inside the rectangle, false otherwise - */ - bool isInside(int32 x, int32 y) const { - return (_topLeft._x <= x) && (_bottomRight._x > x) && (_topLeft._y <= y) && (_bottomRight._y > y); - } - /*! @brief check if given point is inside the rectangle - - @param p the point to check - - @return true if the given point is inside the rectangle, false otherwise - */ - bool isInside(const Point & p) const { - return (_topLeft._x <= p._x) && (_bottomRight._x > p._x) && (_topLeft._y <= p._y) && (_bottomRight._y > p._y); - } - - bool clip(Rect & r) const; -}; - -#endif diff --git a/scumm/smush/renderer.h b/scumm/smush/renderer.h index 7f8fd7e730..f9ccc04ac1 100644 --- a/scumm/smush/renderer.h +++ b/scumm/smush/renderer.h @@ -25,8 +25,10 @@ #include "config.h" #include "palette.h" -#include "rect.h" +#include "common/rect.h" +using ScummVM::Point; +using ScummVM::Rect; class Mixer; /*! @brief interface for general output (rendering) diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp index c6a6aefd74..6eaa388ae7 100644 --- a/scumm/smush/saud_channel.cpp +++ b/scumm/smush/saud_channel.cpp @@ -20,6 +20,7 @@ */ #include + #include "channel.h" #include "chunk.h" #include "chunk_type.h" diff --git a/scumm/smush/scumm_renderer.cpp b/scumm/smush/scumm_renderer.cpp index 3375d275d9..e652d5a370 100644 --- a/scumm/smush/scumm_renderer.cpp +++ b/scumm/smush/scumm_renderer.cpp @@ -25,6 +25,7 @@ #include "channel.h" #include "mixer.h" #include "sound/mixer.h" +#include "scumm/scumm.h" #include "scumm/sound.h" class scumm_mixer : public Mixer { diff --git a/scumm/string.cpp b/scumm/string.cpp index 1c85f6a7c9..b955cf5dca 100644 --- a/scumm/string.cpp +++ b/scumm/string.cpp @@ -951,8 +951,6 @@ void CharsetRenderer::printChar(int chr) _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + _drawTop * 40 + _left / 8 + _vm->_screenStartStrip; - _revBitMask = revBitMask[_left & 7]; - _virtScreenHeight = vs->height; _charPtr += 4; @@ -992,7 +990,7 @@ void CharsetRenderer::drawBits() y = 0; for (y = 0; y < _height && y + _drawTop < _virtScreenHeight;) { - maskmask = _revBitMask; + maskmask = revBitMask[_left & 7]; maskpos = 0; for (x = 0; x < _width; x++) { diff --git a/scumm/sys.cpp b/scumm/sys.cpp index e8619a331e..ff023e642f 100644 --- a/scumm/sys.cpp +++ b/scumm/sys.cpp @@ -167,12 +167,6 @@ bool Scumm::checkFixedDisk() return true; } - -#ifdef NEED_STRDUP -char *strdup(const char *s); -#endif /* NEED_STRDUP */ - - void *operator new(size_t size) { return calloc(size, 1); } -- cgit v1.2.3