1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef PETKA_QMANAGER_H 24 #define PETKA_QMANAGER_H 25 26 #include "common/hashmap.h" 27 28 namespace Common { 29 class SeekableReadStream; 30 } 31 32 namespace Graphics { 33 struct Surface; 34 } 35 36 namespace Petka { 37 38 class PetkaEngine; 39 40 class FlicDecoder; 41 42 class QManager { 43 public: 44 explicit QManager(PetkaEngine &vm); 45 46 bool init(); 47 48 Common::String findResourceName(uint32 id) const; 49 Common::String findSoundName(uint32 id) const; 50 51 Graphics::Surface *getSurface(uint32 id, uint16 w, uint16 h); 52 Graphics::Surface *getSurface(uint32 id); 53 FlicDecoder *getFlic(uint32 id); 54 55 void removeResource(uint32 id); 56 void clearUnneeded(); 57 void clear(); 58 59 private: 60 struct QResource { 61 union { 62 Graphics::Surface *surface; 63 FlicDecoder *flcDecoder; 64 }; 65 enum ResType { 66 kSurface, 67 kFlic 68 } type; 69 70 ~QResource(); 71 }; 72 73 Common::SeekableReadStream *loadFileStream(uint32 id) const; 74 75 static Graphics::Surface *loadBitmapSurface(Common::SeekableReadStream &stream); 76 77 private: 78 PetkaEngine &_vm; 79 Common::HashMap<uint32, QResource> _resourceMap; 80 Common::HashMap<uint32, Common::String> _nameMap; 81 Common::HashMap<uint32, bool> _isAlwaysNeededMap; 82 }; 83 84 } // End of namespace Petka 85 86 #endif 87