scummvm/engines/myst3/node.h

150 lines
3.4 KiB
C
Raw Normal View History

2012-01-10 19:41:51 +00:00
/* ResidualVM - A 3D game interpreter
2009-09-15 15:53:36 +00:00
*
2012-01-10 19:41:51 +00:00
* ResidualVM is the legal property of its developers, whose names
2009-09-15 15:53:36 +00:00
* are too numerous to list here. Please refer to the AUTHORS
* file distributed with this source distribution.
*
2012-01-05 09:07:48 +00:00
* 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.
2009-09-15 15:53:36 +00:00
2012-01-05 09:07:48 +00:00
* This program is distributed in the hope that it will be useful,
2009-09-15 15:53:36 +00:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
2012-01-05 09:07:48 +00:00
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
2009-09-15 15:53:36 +00:00
2012-01-05 09:07:48 +00:00
* 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.
2009-09-15 15:53:36 +00:00
*
*/
#ifndef MYST3_ROOM_H
#define MYST3_ROOM_H
#include "engines/myst3/gfx.h"
2012-01-05 12:38:31 +00:00
#include "common/array.h"
2012-01-05 16:19:15 +00:00
#include "common/rect.h"
2009-09-15 15:53:36 +00:00
#include "graphics/surface.h"
namespace Myst3 {
class Texture;
class Myst3Engine;
class Subtitles;
class DirectorySubEntry;
class Face {
public:
Graphics::Surface *_bitmap;
Texture *_texture;
Face(Myst3Engine *vm);
~Face();
void setTextureFromJPEG(const DirectorySubEntry *jpegDesc);
void markTextureDirty() { _textureDirty = true; }
void uploadTexture();
private:
bool _textureDirty;
Myst3Engine *_vm;
};
2011-12-27 14:15:17 +00:00
class SpotItemFace {
public:
SpotItemFace(Face *face, uint16 posX, uint16 posY);
2011-12-27 14:15:17 +00:00
~SpotItemFace();
void initBlack(uint16 width, uint16 height);
void loadData(const DirectorySubEntry *jpegDesc);
void updateData(const Graphics::Surface *surface);
2012-01-13 15:31:43 +00:00
void clear();
2011-12-29 13:39:36 +00:00
void draw();
void undraw();
void fadeDraw();
bool isDrawn() { return _drawn; }
void setDrawn(bool drawn) { _drawn = drawn; }
uint16 getFadeValue() { return _fadeValue; }
void setFadeValue(uint16 value) { _fadeValue = value; }
2011-12-27 14:15:17 +00:00
private:
Face *_face;
2011-12-27 14:15:17 +00:00
bool _drawn;
uint16 _fadeValue;
uint16 _posX;
uint16 _posY;
Graphics::Surface *_bitmap;
Graphics::Surface *_notDrawnBitmap;
void initNotDrawn(uint16 width, uint16 height);
2011-12-27 14:15:17 +00:00
};
class SpotItem {
public:
SpotItem(Myst3Engine *vm);
~SpotItem();
2011-12-27 14:15:17 +00:00
void setCondition(uint16 condition) { _condition = condition; }
void setFade(bool fade) { _enableFade = fade; }
void setFadeVar(uint16 var) { _fadeVar = var; }
void addFace(SpotItemFace *face) { _faces.push_back(face); }
2012-01-06 12:38:22 +00:00
void updateUndraw();
void updateDraw();
2011-12-27 14:15:17 +00:00
private:
Myst3Engine *_vm;
2011-12-27 14:15:17 +00:00
uint16 _condition;
uint16 _fadeVar;
bool _enableFade;
Common::Array<SpotItemFace *> _faces;
};
2012-01-05 16:19:15 +00:00
class SunSpot {
public:
uint16 pitch;
uint16 heading;
float intensity;
uint32 color;
uint16 var;
bool variableIntensity;
float radius;
};
class Node : Drawable {
2011-09-05 18:13:48 +00:00
protected:
Myst3Engine *_vm;
Face *_faces[6];
2011-12-27 14:15:17 +00:00
Common::Array<SpotItem *> _spotItems;
Subtitles *_subtitles;
2011-09-03 13:39:16 +00:00
2009-09-15 15:53:36 +00:00
public:
2012-01-05 12:38:31 +00:00
Node(Myst3Engine *vm, uint16 id);
virtual ~Node();
2011-12-29 13:39:36 +00:00
void update();
2011-09-05 18:13:48 +00:00
virtual void draw() = 0;
void drawOverlay();
2012-01-05 16:19:15 +00:00
2012-01-05 12:38:31 +00:00
void loadSpotItem(uint16 id, uint16 condition, bool fade);
SpotItemFace *loadMenuSpotItem(uint16 condition, const Common::Rect &rect);
void loadSubtitles(uint32 id);
bool hasSubtitlesToDraw();
2012-01-05 12:38:31 +00:00
void dumpFaceMask(uint16 index, int face);
2009-09-15 15:53:36 +00:00
};
} // end of namespace Myst3
#endif