From 04eba089f6af536b311c51753700a65d09fc9fb7 Mon Sep 17 00:00:00 2001 From: Gregory Montoir Date: Sat, 18 Jun 2005 15:44:40 +0000 Subject: fix compilation with DISABLE_SCUMM_7_8 defined svn-id: r18409 --- scumm/charset.cpp | 2 ++ scumm/charset.h | 2 ++ scumm/module.mk | 2 +- scumm/nut_renderer.cpp | 11 ++++------- scumm/nut_renderer.h | 5 ++--- scumm/scumm.cpp | 2 ++ 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/scumm/charset.cpp b/scumm/charset.cpp index 8ff53a2b51..875b2fcf07 100644 --- a/scumm/charset.cpp +++ b/scumm/charset.cpp @@ -1603,6 +1603,7 @@ void CharsetRendererCommon::drawBits1(const Graphics::Surface &s, byte *dst, con } } +#ifndef DISABLE_SCUMM_7_8 CharsetRendererNut::CharsetRendererNut(ScummEngine *vm) : CharsetRenderer(vm) { _current = 0; @@ -1712,6 +1713,7 @@ void CharsetRendererNut::printChar(int chr) { if (_str.bottom < shadow.bottom) _str.bottom = shadow.bottom; } +#endif void CharsetRendererNES::printChar(int chr) { int width, height, origWidth, origHeight; diff --git a/scumm/charset.h b/scumm/charset.h index 98e8752c53..932423c1ec 100644 --- a/scumm/charset.h +++ b/scumm/charset.h @@ -187,6 +187,7 @@ public: int getCharWidth(byte chr) { return 8; } }; +#ifndef DISABLE_SCUMM_7_8 class CharsetRendererNut : public CharsetRenderer { protected: NutRenderer *_fr[5]; @@ -204,6 +205,7 @@ public: int getCharHeight(byte chr); int getCharWidth(byte chr); }; +#endif } // End of namespace Scumm diff --git a/scumm/module.mk b/scumm/module.mk index 8072edc8d0..9e3165ddce 100644 --- a/scumm/module.mk +++ b/scumm/module.mk @@ -20,7 +20,6 @@ MODULE_OBJS := \ scumm/help.o \ scumm/midiparser_ro.o \ scumm/midiparser_eup.o \ - scumm/nut_renderer.o \ scumm/object.o \ scumm/palette.o \ scumm/player_mod.o \ @@ -52,6 +51,7 @@ MODULE_OBJS := \ ifndef DISABLE_SCUMM_7_8 MODULE_OBJS += \ + scumm/nut_renderer.o \ scumm/script_v8.o \ scumm/imuse_digi/dimuse.o \ scumm/imuse_digi/dimuse_bndmgr.o \ diff --git a/scumm/nut_renderer.cpp b/scumm/nut_renderer.cpp index ad534f0894..6c9a5c976b 100644 --- a/scumm/nut_renderer.cpp +++ b/scumm/nut_renderer.cpp @@ -29,18 +29,14 @@ namespace Scumm { NutRenderer::NutRenderer(ScummEngine *vm) : _vm(vm), - _initialized(false), _loaded(false), _numChars(0) { - - for (int i = 0; i < 256; i++) - _chars[i].src = NULL; + memset(_chars, 0, sizeof(_chars)); } NutRenderer::~NutRenderer() { for (int i = 0; i < _numChars; i++) { - if (_chars[i].src) - delete []_chars[i].src; + delete []_chars[i].src; } } @@ -104,6 +100,7 @@ bool NutRenderer::loadFont(const char *filename) { } _numChars = READ_LE_UINT16(dataSrc + 10); + assert(_numChars <= ARRAYSIZE(_chars)); uint32 offset = 0; for (int l = 0; l < _numChars; l++) { offset += READ_BE_UINT32(dataSrc + offset + 4) + 8; @@ -127,7 +124,7 @@ bool NutRenderer::loadFont(const char *filename) { // so there may appear some garbage. That's why we have to fill it // with zeroes first. memset(_chars[l].src, 0, srcSize); - + const uint8 *fobjptr = dataSrc + offset + 22; switch (codec) { case 1: diff --git a/scumm/nut_renderer.h b/scumm/nut_renderer.h index 5c47e7edb2..87f38b853b 100644 --- a/scumm/nut_renderer.h +++ b/scumm/nut_renderer.h @@ -18,7 +18,7 @@ * $Header$ */ -#ifndef NUT_RENDERER_H +#if !defined(NUT_RENDERER_H) && !defined(DISABLE_SCUMM_7_8) #define NUT_RENDERER_H #include "common/file.h" @@ -31,7 +31,6 @@ class ScummEngine; class NutRenderer { protected: ScummEngine *_vm; - bool _initialized; bool _loaded; int _numChars; struct { @@ -48,7 +47,7 @@ protected: public: NutRenderer(ScummEngine *vm); virtual ~NutRenderer(); - int getNumChars() { return _numChars; } + int getNumChars() const { return _numChars; } bool loadFont(const char *filename); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 2b05c35fbe..6a5461a4c1 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1492,8 +1492,10 @@ int ScummEngine::init(GameDetector &detector) { _charset = new CharsetRendererV2(this, _language); else if (_version == 3) _charset = new CharsetRendererV3(this); +#ifndef DISABLE_SCUMM_7_8 else if (_version == 8) _charset = new CharsetRendererNut(this); +#endif else _charset = new CharsetRendererClassic(this); -- cgit v1.2.3