ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

node.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef MYST3_ROOM_H
00024 #define MYST3_ROOM_H
00025 
00026 #include "engines/myst3/gfx.h"
00027 #include "engines/myst3/directorysubentry.h"
00028 
00029 #include "common/array.h"
00030 #include "common/rect.h"
00031 
00032 #include "graphics/surface.h"
00033 
00034 namespace Myst3 {
00035 
00036 class Texture;
00037 class Myst3Engine;
00038 class Subtitles;
00039 class Effect;
00040 
00041 class Face {
00042 public:
00043     Graphics::Surface *_bitmap;
00044     Graphics::Surface *_finalBitmap;
00045     Texture *_texture;
00046 
00047     Face(Myst3Engine *vm);
00048     ~Face();
00049 
00050     void setTextureFromJPEG(const DirectorySubEntry *jpegDesc);
00051 
00052     void addTextureDirtyRect(const Common::Rect &rect);
00053     bool isTextureDirty() { return _textureDirty; }
00054 
00055     void uploadTexture();
00056 
00057 private:
00058     bool _textureDirty;
00059     Common::Rect _textureDirtyRect;
00060 
00061     Myst3Engine *_vm;
00062 };
00063 
00064 class SpotItemFace {
00065 public:
00066     SpotItemFace(Face *face, uint16 posX, uint16 posY);
00067     ~SpotItemFace();
00068 
00069     void initBlack(uint16 width, uint16 height);
00070     void loadData(const DirectorySubEntry *jpegDesc);
00071     void updateData(const Graphics::Surface *surface);
00072     void clear();
00073 
00074     void draw();
00075     void undraw();
00076     void fadeDraw();
00077 
00078     bool isDrawn() { return _drawn; }
00079     void setDrawn(bool drawn) { _drawn = drawn; }
00080     uint16 getFadeValue() { return _fadeValue; }
00081     void setFadeValue(uint16 value) { _fadeValue = value; }
00082 
00083     Common::Rect getFaceRect() const;
00084 
00085 private:
00086     Face *_face;
00087     bool _drawn;
00088     uint16 _fadeValue;
00089     uint16 _posX;
00090     uint16 _posY;
00091 
00092     Graphics::Surface *_bitmap;
00093     Graphics::Surface *_notDrawnBitmap;
00094 
00095     void initNotDrawn(uint16 width, uint16 height);
00096 };
00097 
00098 class SpotItem {
00099 public:
00100     SpotItem(Myst3Engine *vm);
00101     ~SpotItem();
00102 
00103     void setCondition(int16 condition) { _condition = condition; }
00104     void setFade(bool fade) { _enableFade = fade; }
00105     void setFadeVar(uint16 var) { _fadeVar = var; }
00106     void addFace(SpotItemFace *face) { _faces.push_back(face); }
00107 
00108     void updateUndraw();
00109     void updateDraw();
00110 private:
00111     Myst3Engine *_vm;
00112 
00113     int16 _condition;
00114     uint16 _fadeVar;
00115     bool _enableFade;
00116 
00117     Common::Array<SpotItemFace *> _faces;
00118 };
00119 
00120 class SunSpot {
00121 public:
00122     uint16 pitch;
00123     uint16 heading;
00124     float intensity;
00125     uint32 color;
00126     uint16 var;
00127     bool variableIntensity;
00128     float radius;
00129 };
00130 
00131 class Node : public Drawable {
00132 public:
00133     Node(Myst3Engine *vm, uint16 id);
00134     ~Node() override;
00135 
00136     void initEffects();
00137     void resetEffects();
00138 
00139     void update();
00140     void drawOverlay() override;
00141 
00142     void loadSpotItem(uint16 id, int16 condition, bool fade);
00143     SpotItemFace *loadMenuSpotItem(int16 condition, const Common::Rect &rect);
00144 
00145     void loadSubtitles(uint32 id);
00146     bool hasSubtitlesToDraw();
00147 
00148 protected:
00149     virtual bool isFaceVisible(uint faceId) = 0;
00150 
00151     Myst3Engine *_vm;
00152     uint16 _id;
00153     Face *_faces[6];
00154     Common::Array<SpotItem *> _spotItems;
00155     Subtitles *_subtitles;
00156     Common::Array<Effect *> _effects;
00157 };
00158 
00159 } // end of namespace Myst3
00160 
00161 #endif


Generated on Sat Dec 14 2019 05:00:41 for ResidualVM by doxygen 1.7.1
curved edge   curved edge