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 onGameLoop() override;
00062     void saveLoadCurrent(ResourceSerializer *serializer) override;
00063 
00065     bool has3DLayer();
00066 
00068     Gfx::RenderEntryArray listRenderEntries();
00069 
00071     Gfx::LightEntryArray listLightEntries();
00072 
00074     void initScroll(const Common::Point &maxScroll);
00075 
00077     Common::Point getScrollPosition() const;
00078 
00080     void setScrollPosition(const Common::Point &position);
00081 
00083     bool scrollToCoordinateSmooth(uint32 coordinate);
00084 
00086     void scrollToCharacterImmediate();
00087 
00089     void goToLayer(Layer *layer);
00090 
00096     void setHasActiveScroll();
00097 
00101     void stopAllScrolls();
00102 
00104     void startFollowingCharacter();
00105 
00107     void stopFollowingCharacter();
00108 
00109     void scrollToCoordinateImmediate(uint32 coordinate);
00110 
00112     ItemVisual *getCharacterItem(int32 character) const;
00113 
00115     void registerCharacterItem(int32 character, ItemVisual *item);
00116 
00118     Common::Array<ItemVisual *> listCharacters() const;
00119 
00121     void resetAnimationBlending();
00122 
00124     Sound *findStockSound(uint32 stockSoundType) const;
00125 
00127     void startRumble(int32 rumbleDurationRemaining);
00128 
00130     void fadeInInit(int32 fadeDuration);
00131     void fadeOutInit(int32 fadeDuration);
00132 
00134     void swayScene(int32 periodMs, const Math::Angle &angle, float amplitude, float offset);
00135 
00137     void floatScene(int32 periodMs, float amplitude, float offset);
00138 
00140     Layer *getLayerByName(const Common::String &name);
00141 
00143     Gfx::RenderEntry *getRenderEntryByName(const Common::String &name);
00144 
00146     Common::Array<Layer *> listLayers() { return _layers; }
00147 
00149     Common::Array<Common::Point> listExitPositions();
00150 
00151 protected:
00152     void printData() override;
00153 
00154 private:
00155     bool scrollToSmooth(const Common::Point &position, bool followCharacter);
00156     bool scrollToCharacter(ModelItem *item);
00157     Common::Point getCharacterScrollPosition(ModelItem *item);
00158     uint getScrollStepFollow();
00159     Common::Point getScrollPointFromCoordinate(uint32 coordinate) const;
00160 
00161     Sound *findStockSound(const Object *parent, uint32 stockSoundType) const;
00162 
00163     Common::Array<Layer *> _layers;
00164     Layer *_currentLayer;
00165 
00166     bool _canScroll;
00167     bool _hasActiveScroll;
00168     bool _scrollFollowCharacter;
00169     Common::Point _scroll;
00170     Common::Point _maxScroll;
00171 
00172     uint getScrollStep();
00173 
00174     typedef Common::HashMap<int32, ItemVisual *> CharacterMap;
00175     CharacterMap _characterItemMap;
00176 
00177     int32 _rumbleDurationRemaining;
00178 
00179     bool _fadeOut;
00180     int32 _fadeDuration;
00181     float _fadePosition;
00182 
00183     int32 _swayPeriodMs;
00184     Math::Angle _swayAngle;
00185     float _swayAmplitude;
00186     float _swayOffset;
00187     float _swayPosition;
00188 
00189     int32 _idleActionWaitMs;
00190 
00191     int32 _floatPeriodMs;
00192     float _floatAmplitude;
00193     float _floatPosition;
00194 };
00195 
00196 } // End of namespace Resources
00197 } // End of namespace Stark
00198 
00199 #endif // STARK_RESOURCES_LOCATION_H


Generated on Sat Feb 16 2019 05:00:55 for ResidualVM by doxygen 1.7.1
curved edge   curved edge