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

location.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 STARK_RESOURCES_LOCATION_H
00024 #define STARK_RESOURCES_LOCATION_H
00025 
00026 #include "common/hashmap.h"
00027 #include "common/rect.h"
00028 #include "common/str.h"
00029 
00030 #include "engines/stark/gfx/renderentry.h"
00031 #include "engines/stark/resources/object.h"
00032 
00033 namespace Stark {
00034 
00035 namespace Formats {
00036 class XRCReadStream;
00037 }
00038 
00039 namespace Resources {
00040 
00041 class ItemVisual;
00042 class Layer;
00043 class ModelItem;
00044 class Sound;
00045 
00052 class Location : public Object {
00053 public:
00054     static const Type::ResourceType TYPE = Type::kLocation;
00055 
00056     Location(Object *parent, byte subType, uint16 index, const Common::String &name);
00057     virtual ~Location();
00058 
00059     // Resource API
00060     void onAllLoaded() override;
00061     void onEnterLocation() override;
00062     void onGameLoop() override;
00063     void saveLoadCurrent(ResourceSerializer *serializer) override;
00064 
00066     bool has3DLayer();
00067 
00069     Gfx::RenderEntryArray listRenderEntries();
00070 
00072     Gfx::LightEntryArray listLightEntries();
00073 
00075     void initScroll(const Common::Point &maxScroll);
00076 
00078     Common::Point getScrollPosition() const;
00079 
00081     void setScrollPosition(const Common::Point &position);
00082 
00084     bool scrollToCoordinateSmooth(uint32 coordinate);
00085 
00087     void scrollToCharacterImmediate();
00088 
00090     void goToLayer(Layer *layer);
00091 
00097     void setHasActiveScroll();
00098 
00102     void stopAllScrolls();
00103 
00105     void startFollowingCharacter();
00106 
00108     void stopFollowingCharacter();
00109 
00110     void scrollToCoordinateImmediate(uint32 coordinate);
00111 
00113     ItemVisual *getCharacterItem(int32 character) const;
00114 
00116     void registerCharacterItem(int32 character, ItemVisual *item);
00117 
00119     const Common::Array<ModelItem *> &listModelItems() const;
00120 
00122     void resetAnimationBlending();
00123 
00125     Sound *findStockSound(uint32 stockSoundType) const;
00126 
00128     void startRumble(int32 rumbleDurationRemaining);
00129 
00131     void fadeInInit(int32 fadeDuration);
00132     void fadeOutInit(int32 fadeDuration);
00133 
00135     void swayScene(int32 periodMs, const Math::Angle &angle, float amplitude, float offset);
00136 
00138     void floatScene(int32 periodMs, float amplitude, float offset);
00139 
00141     Layer *getLayerByName(const Common::String &name);
00142 
00144     Gfx::RenderEntry *getRenderEntryByName(const Common::String &name);
00145 
00147     Common::Array<Layer *> listLayers() { return _layers; }
00148 
00150     Common::Array<Common::Point> listExitPositions();
00151 
00152 protected:
00153     void printData() override;
00154 
00155 private:
00156     bool scrollToSmooth(const Common::Point &position, bool followCharacter);
00157     bool scrollToCharacter(ModelItem *item);
00158     Common::Point getCharacterScrollPosition(ModelItem *item);
00159     uint getScrollStepFollow();
00160     Common::Point getScrollPointFromCoordinate(uint32 coordinate) const;
00161 
00162     Sound *findStockSound(const Object *parent, uint32 stockSoundType) const;
00163 
00164     Common::Array<Layer *> _layers;
00165     Layer *_currentLayer;
00166 
00167     bool _canScroll;
00168     bool _hasActiveScroll;
00169     bool _scrollFollowCharacter;
00170     Common::Point _scroll;
00171     Common::Point _maxScroll;
00172 
00173     uint getScrollStep();
00174 
00175     typedef Common::HashMap<int32, ItemVisual *> CharacterMap;
00176     CharacterMap _characterItemMap;
00177 
00178     Common::Array<ModelItem *> _modelItems;
00179 
00180     int32 _rumbleDurationRemaining;
00181 
00182     bool _fadeOut;
00183     int32 _fadeDuration;
00184     float _fadePosition;
00185 
00186     int32 _swayPeriodMs;
00187     Math::Angle _swayAngle;
00188     float _swayAmplitude;
00189     float _swayOffset;
00190     float _swayPosition;
00191 
00192     int32 _idleActionWaitMs;
00193 
00194     int32 _floatPeriodMs;
00195     float _floatAmplitude;
00196     float _floatPosition;
00197 };
00198 
00199 } // End of namespace Resources
00200 } // End of namespace Stark
00201 
00202 #endif // STARK_RESOURCES_LOCATION_H


Generated on Sat Oct 19 2019 05:01:10 for ResidualVM by doxygen 1.7.1
curved edge   curved edge