ScummVM API documentation
diskimage.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MEDIASTATION_ACTORS_DISKIMAGE_H
23 #define MEDIASTATION_ACTORS_DISKIMAGE_H
24 
25 #include "mediastation/actor.h"
26 #include "mediastation/bitmap.h"
27 #include "mediastation/datafile.h"
28 #include "mediastation/clients.h"
29 #include "mediastation/mediascript/scriptvalue.h"
30 #include "mediastation/mediascript/scriptconstants.h"
31 
32 namespace MediaStation {
33 
34 struct StripInfoNode {
35  bool isLoaded = false;
36  bool isLoadScheduled = false;
37  Common::Rect rect;
38  uint streamId = 0;
39  uint lengthInBytes = 0;
40 };
41 
43  bool isLoaded = false;
44  PixMapImage *image = nullptr;
45  uint lastDrawTime = 0;
46 };
47 
48 // Despite the name from the original, this is not a "disk image" but
49 // a set of graphics (like a large background) that are streamed from
50 // disk in a very particular way.
51 class DiskImageActor : public SpatialEntity, public ChannelClient, public ImtDeviceUser {
52 public:
53  DiskImageActor() : SpatialEntity(kActorTypeDiskImage) {};
54  ~DiskImageActor();
55 
56  virtual void readParameter(Chunk &chunk, ActorHeaderSectionType paramType) override;
57  virtual ScriptValue callMethod(BuiltInMethod methodId, Common::Array<ScriptValue> &args) override;
58  virtual bool giveUpDevice() override { return false; }
59 
60  virtual void onEvent(const ActorEvent &event) override;
61  virtual void timerEvent(const TimerEvent &event) override;
62 
63  virtual void readChunk(Chunk &chunk) override;
64  virtual void draw(DisplayContext &displayContext) override;
65  virtual void preload(const Common::Rect &rect, bool fireStepEvent = true) override;
66  virtual bool isReadyToDraw(DisplayContext &displayContext) override;
67  virtual bool isRectInMemory(const Common::Rect &rectToCheck) override;
68  virtual void setAdjustedBounds(CylindricalWrapMode wrapMode) override;
69 
70 private:
71  void setStripInfo(Chunk &chunk);
72  void setStripsToLoad(const Common::Rect &rectToLoad);
73  int getStripToLoad();
74  void startStripLoad(uint stripIndex);
75 
76  void purge();
77  void stopLoad();
78  void unloadLeastRecentlyDrawnStrip();
79  void debugPrintNodes();
80 
83 
84  Common::Rect _rectToLoad;
85  bool _shouldDecompressInPlace = false;
86  bool _isLoading = false;
87  bool _isLoadingStrips = false;
88  bool _firePreloadEvent = false;
89  uint _maxStripsInMemory = 0;
90  int16 _stripThickness = 0;
91  uint _maxImagesInMemory = 0;
92  bool _useVerticalStrips = false;
93 };
94 
95 } // End of namespace MediaStation
96 
97 #endif
Definition: diskimage.h:34
Definition: actor.h:278
Definition: actor.h:34
Definition: datafile.h:99
Definition: datafile.h:160
Definition: rect.h:536
Definition: diskimage.h:42
Definition: diskimage.h:51
Definition: graphics.h:122
Definition: events.h:103
Definition: events.h:94
Definition: hashmap.h:85
Definition: bitmap.h:52
Definition: clients.h:52
Definition: scriptvalue.h:35