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

resourceprovider.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_SERVICES_RESOURCE_PROVIDER_H
00024 #define STARK_SERVICES_RESOURCE_PROVIDER_H
00025 
00026 #include "common/list.h"
00027 
00028 #include "engines/stark/resourcereference.h"
00029 
00030 namespace Stark {
00031 
00032 namespace Resources {
00033 class Level;
00034 class Location;
00035 class Object;
00036 }
00037 
00038 class ArchiveLoader;
00039 class Current;
00040 class Global;
00041 class StateProvider;
00042 
00049 class ResourceProvider {
00050 public:
00051     ResourceProvider(ArchiveLoader *archiveLoader, StateProvider *stateProvider, Global *global);
00052 
00054     void initGlobal();
00055 
00057     void requestLocationChange(uint16 level, uint16 location);
00058 
00060     bool hasLocationChangeRequest() const { return _locationChangeRequest; }
00061 
00062     void setShouldRestoreCurrentState() { _restoreCurrentState = true; }
00063 
00064     void pushAndChangeLocation(int16 level, int16 location);
00065     void returnToPushedLocation();
00066 
00068     void readLocationStack(Common::SeekableReadStream *stream, uint32 version);
00069     void writeLocationStack(Common::WriteStream *stream);
00070 
00077     void performLocationChange();
00078 
00080     void setNextLocationPosition(const ResourceReference &bookmark, int32 direction);
00081 
00083     void commitActiveLocationsState();
00084 
00086     void shutdown();
00087 
00089     Resources::Level *getLevel(uint16 level) const;
00090 
00092     Resources::Location *getLocation(uint16 level, uint16 location) const;
00093 
00095     Resources::Level *getLevelFromLocation(Resources::Location *location) const;
00096 
00097 private:
00098     struct PreviousLocation {
00099         uint16 location;
00100         uint16 level;
00101         bool inventoryOpen;
00102     };
00103 
00104     void pushCurrentLocation();
00105     void popCurrentLocation();
00106     void saveLoadLocationStack(ResourceSerializer &serializer);
00107     Common::Array<PreviousLocation> _locationStack;
00108 
00109     typedef Common::List<Current *> CurrentList;
00110 
00111     Current *findLevel(uint16 level) const;
00112     Current *findLocation(uint16 level, uint16 location) const;
00113 
00114     void purgeOldLocations();
00115 
00116     void runLocationChangeScripts(Resources::Object *resource, uint32 scriptCallMode);
00117     void setAprilInitialPosition();
00118     void setScrollInitialPosition();
00119 
00120     Global *_global;
00121     ArchiveLoader *_archiveLoader;
00122     StateProvider *_stateProvider;
00123 
00124     bool _locationChangeRequest;
00125     bool _restoreCurrentState;
00126 
00127     CurrentList _locations;
00128 
00129     ResourceReference _nextPositionBookmarkReference;
00130     int32 _nextDirection;
00131 };
00132 
00133 } // End of namespace Stark
00134 
00135 #endif // STARK_SERVICES_RESOURCE_PROVIDER_H


Generated on Sat Dec 7 2019 05:00:39 for ResidualVM by doxygen 1.7.1
curved edge   curved edge