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/mediascript/scriptvalue.h"
29 #include "mediastation/mediascript/scriptconstants.h"
30 
31 namespace MediaStation {
32 
33 struct StripInfoNode {
34  bool isLoaded = false;
35  bool isLoadScheduled = false;
36  Common::Rect rect;
37  uint streamId = 0;
38  uint lengthInBytes = 0;
39 };
40 
42  bool isLoaded = false;
43  PixMapImage *image = nullptr;
44  uint lastDrawTime = 0;
45 };
46 
47 // Despite the name from the original, this is not a "disk image" but
48 // a set of graphics (like a large background) that are streamed from
49 // disk in a very particular way.
50 class DiskImageActor : public SpatialEntity, public ChannelClient {
51 public:
52  DiskImageActor() : SpatialEntity(kActorTypeDiskImage) {};
53  ~DiskImageActor();
54 
55  virtual void readParameter(Chunk &chunk, ActorHeaderSectionType paramType) override;
56  virtual ScriptValue callMethod(BuiltInMethod methodId, Common::Array<ScriptValue> &args) override;
57 
58  virtual void onEvent(const ActorEvent &event) override;
59  virtual void timerEvent(const TimerEvent &event) override;
60 
61  virtual void readChunk(Chunk &chunk) override;
62  virtual void draw(DisplayContext &displayContext) override;
63  virtual void preload(const Common::Rect &rect, bool fireStepEvent = true) override;
64  virtual bool isReadyToDraw(DisplayContext &displayContext) override;
65  virtual bool isRectInMemory(const Common::Rect &rectToCheck) override;
66  virtual void setAdjustedBounds(CylindricalWrapMode wrapMode) override;
67 
68 private:
69  void setStripInfo(Chunk &chunk);
70  void setStripsToLoad(const Common::Rect &rectToLoad);
71  int getStripToLoad();
72  void startStripLoad(uint stripIndex);
73 
74  void purge();
75  void stopLoad();
76  void unloadLeastRecentlyDrawnStrip();
77  void debugPrintNodes();
78 
81 
82  Common::Rect _rectToLoad;
83  bool _shouldDecompressInPlace = false;
84  bool _isLoading = false;
85  bool _isLoadingStrips = false;
86  bool _firePreloadEvent = false;
87  uint _maxStripsInMemory = 0;
88  int16 _stripThickness = 0;
89  uint _maxImagesInMemory = 0;
90  bool _useVerticalStrips = false;
91 };
92 
93 } // End of namespace MediaStation
94 
95 #endif
Definition: diskimage.h:33
Definition: actor.h:252
Definition: actor.h:34
Definition: datafile.h:99
Definition: datafile.h:160
Definition: rect.h:524
Definition: diskimage.h:41
Definition: diskimage.h:50
Definition: graphics.h:101
Definition: events.h:103
Definition: events.h:94
Definition: hashmap.h:85
Definition: bitmap.h:52
Definition: scriptvalue.h:35