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