Merge pull request #108 from klusark/includes

Cleaned up dependencies between files.
This commit is contained in:
Pawel Kolodziejski 2011-05-13 23:00:56 -07:00
commit 0e24524395
44 changed files with 197 additions and 99 deletions

View file

@ -39,6 +39,8 @@
#include "engines/grim/smush/video.h" #include "engines/grim/smush/video.h"
#include "engines/grim/imuse/imuse.h" #include "engines/grim/imuse/imuse.h"
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/resource.h"
#include "engines/grim/savegame.h"
namespace Grim { namespace Grim {

View file

@ -27,15 +27,16 @@
#define GRIM_ACTOR_H #define GRIM_ACTOR_H
#include "engines/grim/object.h" #include "engines/grim/object.h"
#include "engines/grim/color.h"
#include "engines/grim/resource.h"
#include "engines/grim/savegame.h"
#include "graphics/vector3d.h" #include "graphics/vector3d.h"
namespace Grim { namespace Grim {
class TextObject; class TextObject;
class Sector; class Sector;
class Costume;
class LipSync;
class Font;
class Color;
typedef Common::List<Sector *> SectorListType; typedef Common::List<Sector *> SectorListType;
@ -192,7 +193,7 @@ private:
float _scale; float _scale;
bool _lookingMode; bool _lookingMode;
Common::String _talkSoundName; Common::String _talkSoundName;
LipSyncPtr _lipSync; ObjectPtr<LipSync> _lipSync;
Common::List<Costume *> _costumeStack; Common::List<Costume *> _costumeStack;
// Variables for gradual turning // Variables for gradual turning
@ -228,7 +229,7 @@ private:
Shadow *_shadowArray; Shadow *_shadowArray;
int _activeShadowSlot; int _activeShadowSlot;
static FontPtr _sayLineFont; static ObjectPtr<Font> _sayLineFont;
TextObject *_sayLineText; TextObject *_sayLineText;
// Validate a yaw angle then set it appropriately // Validate a yaw angle then set it appropriately

View file

@ -26,7 +26,6 @@
#ifndef GRIM_BITMAP_H #ifndef GRIM_BITMAP_H
#define GRIM_BITMAP_H #define GRIM_BITMAP_H
#include "engines/grim/resource.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {

View file

@ -27,7 +27,6 @@
#define GRIM_COLOR_H #define GRIM_COLOR_H
#include "common/scummsys.h" #include "common/scummsys.h"
#include "engines/grim/savegame.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {

55
engines/grim/colormap.cpp Normal file
View file

@ -0,0 +1,55 @@
/* Residual - A 3D game interpreter
*
* Residual 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 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
* $URL$
* $Id$
*
*/
#include "engines/grim/colormap.h"
#include "engines/grim/resource.h"
namespace Grim {
// Load a colormap from the given data.
CMap::CMap(const char *fileName, const char *data, int len) :
Object() {
_fname = fileName;
if (len < 4 || READ_BE_UINT32(data) != MKTAG('C','M','P',' '))
error("Invalid magic loading colormap");
memcpy(_colors, data + 64, sizeof(_colors));
}
CMap::CMap() : Object() {}
CMap::~CMap() {
if (g_resourceloader)
g_resourceloader->uncacheColormap(this);
}
bool CMap::operator==(const CMap &c) const {
if (_fname != c._fname) {
return false;
}
return true;
}
} // end of namespace Grim

View file

@ -26,9 +26,6 @@
#ifndef GRIM_COLORMAP_H #ifndef GRIM_COLORMAP_H
#define GRIM_COLORMAP_H #define GRIM_COLORMAP_H
#include "common/endian.h"
#include "engines/grim/resource.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {
@ -36,31 +33,16 @@ namespace Grim {
class CMap : public Object { class CMap : public Object {
public: public:
// Load a colormap from the given data. // Load a colormap from the given data.
CMap(const char *fileName, const char *data, int len) : CMap(const char *fileName, const char *data, int len);
Object() { CMap();
_fname = fileName; ~CMap();
if (len < 4 || READ_BE_UINT32(data) != MKTAG('C','M','P',' '))
error("Invalid magic loading colormap");
memcpy(_colors, data + 64, sizeof(_colors));
}
CMap() : Object() {}
~CMap() {
if (g_resourceloader)
g_resourceloader->uncacheColormap(this);
}
const char *getFilename() const { return _fname.c_str(); } const char *getFilename() const { return _fname.c_str(); }
// The color data, in RGB format // The color data, in RGB format
char _colors[256 * 3]; char _colors[256 * 3];
Common::String _fname; Common::String _fname;
bool operator==(const CMap &c) const { bool operator==(const CMap &c) const;
if (_fname != c._fname) {
return false;
}
return true;
}
}; };
} // end of namespace Grim } // end of namespace Grim

View file

@ -36,6 +36,8 @@
#include "engines/grim/material.h" #include "engines/grim/material.h"
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/resource.h"
#include "engines/grim/savegame.h"
#include "engines/grim/imuse/imuse.h" #include "engines/grim/imuse/imuse.h"
@ -149,7 +151,7 @@ public:
protected: protected:
Common::String _filename; Common::String _filename;
ModelPtr _obj; ObjectPtr<Model> _obj;
Model::HierNode *_hier; Model::HierNode *_hier;
Graphics::Matrix4 _matrix; Graphics::Matrix4 _matrix;
}; };

View file

@ -28,9 +28,8 @@
#include "common/memstream.h" #include "common/memstream.h"
#include "engines/grim/model.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
#include "engines/grim/colormap.h" #include "engines/grim/model.h"
namespace Grim { namespace Grim {
@ -38,6 +37,8 @@ namespace Grim {
typedef uint32 tag32; typedef uint32 tag32;
class TextSplitter;
class Costume : public Object { class Costume : public Object {
public: public:
Costume(const char *filename, const char *data, int len, Costume *prevCost); Costume(const char *filename, const char *data, int len, Costume *prevCost);
@ -101,7 +102,7 @@ public:
virtual ~Component() { } virtual ~Component() { }
protected: protected:
CMapPtr _cmap, _previousCmap; ObjectPtr<CMap> _cmap, _previousCmap;
tag32 _tag; tag32 _tag;
int _parentID; int _parentID;
bool _visible; bool _visible;
@ -183,7 +184,7 @@ private:
friend class Costume; friend class Costume;
}; };
CMapPtr _cmap; ObjectPtr<CMap> _cmap;
int _numChores; int _numChores;
Chore *_chores; Chore *_chores;
Graphics::Matrix4 _matrix; Graphics::Matrix4 _matrix;

View file

@ -30,6 +30,7 @@
#include "engines/grim/font.h" #include "engines/grim/font.h"
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/resource.h"
namespace Grim { namespace Grim {

View file

@ -26,7 +26,6 @@
#ifndef GRIM_FONT_H #ifndef GRIM_FONT_H
#define GRIM_FONT_H #define GRIM_FONT_H
#include "engines/grim/resource.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {

View file

@ -25,6 +25,7 @@
#include "engines/grim/gfx_base.h" #include "engines/grim/gfx_base.h"
#include "engines/grim/savegame.h" #include "engines/grim/savegame.h"
#include "engines/grim/colormap.h"
namespace Grim { namespace Grim {

View file

@ -26,15 +26,15 @@
#ifndef GRIM_GFX_BASE_H #ifndef GRIM_GFX_BASE_H
#define GRIM_GFX_BASE_H #define GRIM_GFX_BASE_H
#include "engines/grim/colormap.h"
#include "engines/grim/model.h" #include "engines/grim/model.h"
#include "engines/grim/scene.h" #include "engines/grim/scene.h"
#include "engines/grim/primitives.h"
namespace Grim { namespace Grim {
struct Shadow; struct Shadow;
class SaveGame; class SaveGame;
class BitmapData;
class PrimitiveObject;
class GfxBase { class GfxBase {
public: public:

View file

@ -39,6 +39,8 @@
#include "engines/grim/gfx_opengl.h" #include "engines/grim/gfx_opengl.h"
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/bitmap.h"
#include "engines/grim/primitives.h"
#ifdef USE_OPENGL #ifdef USE_OPENGL

View file

@ -33,6 +33,8 @@
#include "engines/grim/gfx_tinygl.h" #include "engines/grim/gfx_tinygl.h"
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/bitmap.h"
#include "engines/grim/primitives.h"
namespace Grim { namespace Grim {

View file

@ -61,6 +61,10 @@
#include "engines/grim/costume.h" #include "engines/grim/costume.h"
#include "engines/grim/material.h" #include "engines/grim/material.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/lab.h"
#include "engines/grim/bitmap.h"
#include "engines/grim/font.h"
#include "engines/grim/primitives.h"
#include "engines/grim/lua/lualib.h" #include "engines/grim/lua/lualib.h"

View file

@ -28,12 +28,22 @@
#include "engines/engine.h" #include "engines/engine.h"
#include "common/str-array.h"
#include "common/hashmap.h"
#include "engines/grim/textobject.h" #include "engines/grim/textobject.h"
namespace Grim { namespace Grim {
class Actor; class Actor;
class SaveGame; class SaveGame;
class Bitmap;
class Font;
class Color;
class ObjectState;
class Scene;
class TextObject;
class PrimitiveObject;
enum enDebugLevels { enum enDebugLevels {
DEBUG_NONE, DEBUG_NORMAL, DEBUG_WARN, DEBUG_ERROR, DEBUG_LUA, DEBUG_BITMAPS, DEBUG_MODEL, DEBUG_STUB, DEBUG_NONE, DEBUG_NORMAL, DEBUG_WARN, DEBUG_ERROR, DEBUG_LUA, DEBUG_BITMAPS, DEBUG_MODEL, DEBUG_STUB,
@ -236,9 +246,7 @@ public:
Common::StringArray _listFiles; Common::StringArray _listFiles;
Common::StringArray::const_iterator _listFilesIter; Common::StringArray::const_iterator _listFilesIter;
TextObjectDefaults _sayLineDefaults; TextObjectDefaults _sayLineDefaults, _printLineDefaults, _blastTextDefaults;
TextObjectDefaults _printLineDefaults;
TextObjectDefaults _blastTextDefaults;
private: private:

View file

@ -27,6 +27,7 @@
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/resource.h"
#include "engines/grim/imuse/imuse_mcmp_mgr.h" #include "engines/grim/imuse/imuse_mcmp_mgr.h"

View file

@ -27,6 +27,7 @@
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/resource.h" #include "engines/grim/resource.h"
#include "engines/grim/lab.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/imuse/imuse_sndmgr.h" #include "engines/grim/imuse/imuse_sndmgr.h"

View file

@ -31,6 +31,7 @@
#include "engines/grim/keyframe.h" #include "engines/grim/keyframe.h"
#include "engines/grim/textsplit.h" #include "engines/grim/textsplit.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/resource.h"
namespace Grim { namespace Grim {

View file

@ -26,7 +26,6 @@
#ifndef GRIM_KEYFRAME_H #ifndef GRIM_KEYFRAME_H
#define GRIM_KEYFRAME_H #define GRIM_KEYFRAME_H
#include "engines/grim/model.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {

View file

@ -26,6 +26,7 @@
#include "common/endian.h" #include "common/endian.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/resource.h"
namespace Grim { namespace Grim {

View file

@ -26,7 +26,6 @@
#ifndef GRIM_LIPSYNC_H #ifndef GRIM_LIPSYNC_H
#define GRIM_LIPSYNC_H #define GRIM_LIPSYNC_H
#include "engines/grim/resource.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {

View file

@ -37,6 +37,9 @@
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/savegame.h" #include "engines/grim/savegame.h"
#include "engines/grim/resource.h"
#include "engines/grim/bitmap.h"
#include "engines/grim/font.h"
#include "engines/grim/lua/lauxlib.h" #include "engines/grim/lua/lauxlib.h"
#include "engines/grim/lua/luadebug.h" #include "engines/grim/lua/luadebug.h"

View file

@ -30,6 +30,10 @@
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/resource.h"
#include "engines/grim/colormap.h"
#include "engines/grim/bitmap.h"
#include "engines/grim/primitives.h"
#include "engines/grim/smush/video.h" #include "engines/grim/smush/video.h"

View file

@ -27,6 +27,8 @@
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/actor.h" #include "engines/grim/actor.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/savegame.h"
#include "engines/grim/colormap.h"
#include "engines/grim/imuse/imuse.h" #include "engines/grim/imuse/imuse.h"

View file

@ -31,6 +31,8 @@
#include "engines/grim/localize.h" #include "engines/grim/localize.h"
#include "engines/grim/actor.h" #include "engines/grim/actor.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/savegame.h"
#include "engines/grim/colormap.h"
#include "engines/grim/imuse/imuse.h" #include "engines/grim/imuse/imuse.h"

View file

@ -28,6 +28,7 @@
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/material.h" #include "engines/grim/material.h"
#include "engines/grim/gfx_base.h" #include "engines/grim/gfx_base.h"
#include "engines/grim/resource.h"
namespace Grim { namespace Grim {

View file

@ -26,12 +26,12 @@
#ifndef GRIM_MATERIAL_H #ifndef GRIM_MATERIAL_H
#define GRIM_MATERIAL_H #define GRIM_MATERIAL_H
#include "engines/grim/resource.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
#include "engines/grim/colormap.h"
namespace Grim { namespace Grim {
class CMAp;
class Material : public Object { class Material : public Object {
public: public:
Material() { _width = 0; } Material() { _width = 0; }
@ -52,7 +52,7 @@ public:
Common::String _fname; Common::String _fname;
const CMapPtr _cmap; const ObjectPtr<CMap> _cmap;
int _numImages, _currImage; int _numImages, _currImage;
int _width, _height; int _width, _height;
void *_textures; void *_textures;

View file

@ -32,6 +32,7 @@
#include "engines/grim/textsplit.h" #include "engines/grim/textsplit.h"
#include "engines/grim/gfx_base.h" #include "engines/grim/gfx_base.h"
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/resource.h"
namespace Grim { namespace Grim {

View file

@ -27,14 +27,14 @@
#define GRIM_MODEL_H #define GRIM_MODEL_H
#include "common/memstream.h" #include "common/memstream.h"
#include "engines/grim/resource.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
#include "graphics/matrix4.h" #include "graphics/matrix4.h"
namespace Grim { namespace Grim {
class TextSplitter; class TextSplitter;
class Material;
class CMap;
class Model : public Object { class Model : public Object {
public: public:
@ -49,7 +49,7 @@ public:
~Model(); ~Model();
Common::String _fname; Common::String _fname;
CMapPtr _cmap; ObjectPtr<CMap> _cmap;
struct Geoset; struct Geoset;
struct Mesh; struct Mesh;
@ -139,7 +139,7 @@ public:
int _numMaterials; int _numMaterials;
char (*_materialNames)[32]; char (*_materialNames)[32];
MaterialPtr *_materials; ObjectPtr<Material> *_materials;
Graphics::Vector3d _insertOffset; Graphics::Vector3d _insertOffset;
int _numGeosets; int _numGeosets;
Geoset *_geosets; Geoset *_geosets;

View file

@ -41,6 +41,7 @@ MODULE_OBJS := \
actor.o \ actor.o \
bitmap.o \ bitmap.o \
costume.o \ costume.o \
colormap.o \
detection.o \ detection.o \
font.o \ font.o \
gfx_base.o \ gfx_base.o \

View file

@ -85,8 +85,9 @@ public:
ObjectPtr(T *obj) : ObjectPtr(T *obj) :
_obj(obj) { _obj(obj) {
if (obj) { if (obj) {
_obj->reference(); Object *o = (Object *)_obj;
addPointer(obj); o->reference();
addPointer(o);
} }
} }
ObjectPtr(const ObjectPtr<T> &ptr) : Pointer() { ObjectPtr(const ObjectPtr<T> &ptr) : Pointer() {
@ -95,8 +96,9 @@ public:
} }
~ObjectPtr() { ~ObjectPtr() {
if (_obj) { if (_obj) {
rmPointer(_obj); Object *o = (Object *)_obj;
_obj->dereference(); rmPointer(o);
o->dereference();
} }
} }

View file

@ -28,6 +28,8 @@
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/resource.h"
#include "engines/grim/bitmap.h"
namespace Grim { namespace Grim {
@ -55,6 +57,29 @@ ObjectState::~ObjectState() {
delete _zbitmap; delete _zbitmap;
} }
const char *ObjectState::getBitmapFilename() const {
return _bitmap->getFilename();
}
void ObjectState::setNumber(int val) {
if (val) {
assert(_bitmap);
_bitmap->setNumber(val);
if (_zbitmap)
_zbitmap->setNumber(val);
}
_visibility = val != 0;
}
void ObjectState::draw() {
if (!_visibility)
return;
assert(_bitmap);
_bitmap->draw();
if (_zbitmap)
_zbitmap->draw();
}
void ObjectState::saveState(SaveGame *savedState) const { void ObjectState::saveState(SaveGame *savedState) const {
savedState->writeLESint32(_visibility); savedState->writeLESint32(_visibility);
savedState->writeLEUint32(_setupID); savedState->writeLEUint32(_setupID);

View file

@ -26,12 +26,12 @@
#ifndef GRIM_OSTATE_H #ifndef GRIM_OSTATE_H
#define GRIM_OSTATE_H #define GRIM_OSTATE_H
#include "engines/grim/bitmap.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {
class SaveGame; class SaveGame;
class Bitmap;
class ObjectState : public Object { class ObjectState : public Object {
public: public:
@ -53,28 +53,10 @@ public:
Position getPos() const { return _pos; } Position getPos() const { return _pos; }
void setPos(Position position) { _pos = position; } void setPos(Position position) { _pos = position; }
const char *getBitmapFilename() const { const char *getBitmapFilename() const;
return _bitmap->getFilename();
}
void setNumber(int val) { void setNumber(int val);
if (val) { void draw();
assert(_bitmap);
_bitmap->setNumber(val);
if (_zbitmap)
_zbitmap->setNumber(val);
}
_visibility = val != 0;
}
void draw() {
if (!_visibility)
return;
assert(_bitmap);
_bitmap->draw();
if (_zbitmap)
_zbitmap->draw();
}
private: private:

View file

@ -29,6 +29,7 @@
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/bitmap.h"
namespace Grim { namespace Grim {
@ -42,7 +43,7 @@ PrimitiveObject::PrimitiveObject() :
PrimitiveObject::~PrimitiveObject() { PrimitiveObject::~PrimitiveObject() {
if (_bitmap && _type == 2) if (_bitmap && _type == 2)
delete _bitmap.object(); delete _bitmap;
} }
void PrimitiveObject::saveState(SaveGame *savedState) const { void PrimitiveObject::saveState(SaveGame *savedState) const {
@ -127,7 +128,7 @@ void PrimitiveObject::draw() {
if (_type == RECTANGLE) if (_type == RECTANGLE)
g_driver->drawRectangle(this); g_driver->drawRectangle(this);
else if (_type == BITMAP) else if (_type == BITMAP)
g_driver->drawBitmap(_bitmap.object()); g_driver->drawBitmap(_bitmap);
else if (_type == LINE) else if (_type == LINE)
g_driver->drawLine(this); g_driver->drawLine(this);
else if (_type == POLYGON) else if (_type == POLYGON)

View file

@ -28,11 +28,10 @@
#include "common/rect.h" #include "common/rect.h"
#include "engines/grim/color.h"
namespace Grim { namespace Grim {
class SaveGame; class SaveGame;
class Bitmap;
class PrimitiveObject : public Object { class PrimitiveObject : public Object {
public: public:
@ -60,7 +59,7 @@ public:
bool isFilled() { return _filled; } bool isFilled() { return _filled; }
void draw(); void draw();
bool isBitmap() { return _type == BITMAP; } bool isBitmap() { return _type == BITMAP; }
Bitmap *getBitmapHandle() { assert(_bitmap); return _bitmap.object(); } Bitmap *getBitmapHandle() { assert(_bitmap); return _bitmap; }
void saveState(SaveGame *state) const; void saveState(SaveGame *state) const;
bool restoreState(SaveGame *state); bool restoreState(SaveGame *state);
@ -69,7 +68,7 @@ private:
Color *_color; Color *_color;
bool _filled; bool _filled;
int _type; int _type;
BitmapPtr _bitmap; Bitmap *_bitmap;
friend class GrimEngine; friend class GrimEngine;
}; };

View file

@ -32,7 +32,9 @@
#include "engines/grim/lipsync.h" #include "engines/grim/lipsync.h"
#include "engines/grim/savegame.h" #include "engines/grim/savegame.h"
#include "engines/grim/actor.h" #include "engines/grim/actor.h"
#include "engines/grim/lab.h"
#include "engines/grim/bitmap.h"
#include "engines/grim/font.h"
namespace Grim { namespace Grim {

View file

@ -27,8 +27,8 @@
#define GRIM_RESOURCE_H #define GRIM_RESOURCE_H
#include "common/archive.h" #include "common/archive.h"
#include "common/file.h"
#include "engines/grim/lab.h"
#include "engines/grim/object.h" #include "engines/grim/object.h"
namespace Grim { namespace Grim {
@ -43,6 +43,9 @@ class Model;
class LipSync; class LipSync;
class TrackedObject; class TrackedObject;
class SaveGame; class SaveGame;
class Block;
class LuaFile;
class Lab;
typedef ObjectPtr<Material> MaterialPtr; typedef ObjectPtr<Material> MaterialPtr;
typedef ObjectPtr<Bitmap> BitmapPtr; typedef ObjectPtr<Bitmap> BitmapPtr;

View file

@ -33,6 +33,8 @@
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/savegame.h" #include "engines/grim/savegame.h"
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/resource.h"
#include "engines/grim/bitmap.h"
#include "engines/grim/imuse/imuse.h" #include "engines/grim/imuse/imuse.h"
@ -83,7 +85,7 @@ void Scene::loadText(TextSplitter &ts){
ts.expectString("section: colormaps"); ts.expectString("section: colormaps");
ts.scanString(" numcolormaps %d", 1, &_numCmaps); ts.scanString(" numcolormaps %d", 1, &_numCmaps);
_cmaps = new CMapPtr[_numCmaps]; _cmaps = new ObjectPtr<CMap>[_numCmaps];
char cmap_name[256]; char cmap_name[256];
for (int i = 0; i < _numCmaps; i++) { for (int i = 0; i < _numCmaps; i++) {
ts.scanString(" colormap %256s", 1, cmap_name); ts.scanString(" colormap %256s", 1, cmap_name);

View file

@ -36,6 +36,7 @@ namespace Common {
namespace Grim { namespace Grim {
class SaveGame; class SaveGame;
class CMap;
class Scene { class Scene {
public: public:
@ -130,7 +131,7 @@ private:
Common::String _name; Common::String _name;
int _numCmaps; int _numCmaps;
CMapPtr *_cmaps; ObjectPtr<CMap> *_cmaps;
int _numSetups, _numLights, _numSectors, _numObjectStates; int _numSetups, _numLights, _numSectors, _numObjectStates;
bool _enableLights; bool _enableLights;
Sector **_sectors; Sector **_sectors;

View file

@ -43,6 +43,8 @@
#include "engines/grim/grim.h" #include "engines/grim/grim.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/resource.h"
#include "engines/grim/savegame.h"
namespace Grim { namespace Grim {

View file

@ -28,6 +28,7 @@
#include "engines/grim/savegame.h" #include "engines/grim/savegame.h"
#include "engines/grim/lua.h" #include "engines/grim/lua.h"
#include "engines/grim/colormap.h" #include "engines/grim/colormap.h"
#include "engines/grim/font.h"
namespace Grim { namespace Grim {
@ -301,6 +302,20 @@ void TextObject::createBitmap() {
_created = true; _created = true;
} }
void TextObject::subBaseOffsetY() {
if (_font)
_y -= _font->getBaseOffsetY();
else
_y -= 5;
}
int TextObject::getBaseOffsetY() {
if (_font)
return _font->getBaseOffsetY();
else
return 5;
}
void TextObject::destroyBitmap() { void TextObject::destroyBitmap() {
_created = false; _created = false;
if (_textObjectHandle) { if (_textObjectHandle) {

View file

@ -26,12 +26,12 @@
#ifndef GRIM_TEXTOBJECT_H #ifndef GRIM_TEXTOBJECT_H
#define GRIM_TEXTOBJECT_H #define GRIM_TEXTOBJECT_H
#include "engines/grim/font.h"
#include "engines/grim/gfx_base.h" #include "engines/grim/gfx_base.h"
namespace Grim { namespace Grim {
class SaveGame; class SaveGame;
class Font;
struct TextObjectDefaults { struct TextObjectDefaults {
Color *fgColor; Color *fgColor;
@ -55,18 +55,8 @@ public:
void setText(const char *text); void setText(const char *text);
void setX(int x) { _x = x; } void setX(int x) { _x = x; }
void setY(int y) { _y = y; } void setY(int y) { _y = y; }
void subBaseOffsetY() { void subBaseOffsetY();
if (_font) int getBaseOffsetY();
_y -= _font->getBaseOffsetY();
else
_y -= 5;
}
int getBaseOffsetY() {
if (_font)
return _font->getBaseOffsetY();
else
return 5;
}
void setWidth(int width) { _width = width; } void setWidth(int width) { _width = width; }
void setHeight(int height) { _height = height; } void setHeight(int height) { _height = height; }
void setFGColor(Color *fgColor) { _fgColor = fgColor; } void setFGColor(Color *fgColor) { _fgColor = fgColor; }