ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dragon_arcade_ttm.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 DGDS_MINIGAMES_DRAGON_ARCADE_TTM_H
23 #define DGDS_MINIGAMES_DRAGON_ARCADE_TTM_H
24 
25 #include "common/ptr.h"
26 
27 #include "dgds/image.h"
28 #include "dgds/ttm.h"
29 
30 namespace Dgds {
31 
35 class ArcadeFloor {
36 public:
37  ArcadeFloor() : x(0), width(0), yval(0), flag(false) {}
38  int16 x;
39  int16 width;
40  byte yval;
41  bool flag;
42 
43  Common::String dump() const;
44 };
45 
46 
54 class Brush {
55 public:
56  Brush() : _frame(0) {}
57  Brush(const Common::SharedPtr<Image> &shape, int16 frame) : _shape(shape), _frame(frame) {}
58 
59  void reset() {
60  _shape.reset();
61  _frame = 0;
62  }
63  bool isValid() const { return _shape && _shape->loadedFrameCount() > _frame; }
64  const Common::SharedPtr<Image> &getShape() const { return _shape; }
65  int16 getFrame() const { return _frame; }
66 private:
68  int16 _frame;
69 };
70 
71 class ArcadeNPCState;
72 
76 public:
78  void clearDataPtrs();
79  int16 load(const char *filename);
80  void finishTTMParse(int16 envNum);
81  int16 runNextPage(int16 pageNum);
82  void freePages(uint16 num);
83  void freeShapes();
84  void runPagesForEachNPC(int16 xScrollOffset);
85  const Common::Array<ArcadeFloor> &getFloorData() { return _floorData; }
86 
87  uint16 _currentTTMNum;
88  int16 _currentNPCRunningTTM;
89  int16 _drawXOffset;
90  int16 _drawYOffset;
91  int16 _startYOffset;
92  bool _doingInit;
93 
94 private:
95  int16 runScriptPage(int16 pageNum);
96  int16 handleOperation(TTMEnviro &env, int16 page, uint16 op, byte count, const int16 *ivals, const Common::String &sval);
97 
98  int16 _shapes3[6];
99  Common::SharedPtr<Image> _shapes[6];
100  Common::SharedPtr<Image> _shapes2[6];
101  Common::SharedPtr<Image> _allShapes[30];
102  Brush _brushes[6];
103 
104  byte _drawColFG;
105  byte _drawColBG;
106  ArcadeNPCState *_npcState;
107  // int16 _numA1x4OpsInInit; // implicit by count of items in _floorData
108  Common::Array<ArcadeFloor> _floorData;
109 
110  // Note: only a subset of the enviro members get used, but
111  // use the same structure for simplicity.
112  TTMEnviro _ttmEnvs[5];
113 
114 };
115 
116 } // end namespace Dgds
117 
118 #endif // DGDS_MINIGAMES_DRAGON_ARCADE_TTM_H
Definition: str.h:59
Definition: ttm.h:40
Definition: dragon_arcade_ttm.h:75
Definition: array.h:52
Definition: ads.h:28
Definition: dragon_arcade_ttm.h:54
Definition: dragon_arcade_ttm.h:35
Definition: ptr.h:159
Definition: dragon_arcade.h:45