ScummVM API documentation
bbairguitar.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 BBVS_MINIGAMES_BBAIRGUITAR_H
23 #define BBVS_MINIGAMES_BBAIRGUITAR_H
24 
25 #include "bbvs/minigames/minigame.h"
26 
27 namespace Bbvs {
28 
29 class MinigameBbAirGuitar : public Minigame {
30 public:
32  bool run(bool fromMainGame) override;
33 public:
34 
35  struct Obj {
36  int kind;
37  int x, y;
38  int xIncr, yIncr;
39  const ObjAnimation *anim;
40  int frameIndex;
41  int ticks;
42  int status;
43  int16 frameIndexAdd;
44  int16 unk2;
45  };
46 
47  enum {
48  kMaxObjectsCount = 256,
49  kMaxTracks = 2048
50  };
51 
52  struct PianoKeyInfo {
53  int x, y;
54  int frameIndex;
55  };
56 
57  struct TrackEvt {
58  int8 noteNum;
59  int16 ticks;
60  };
61 
62  Obj _objects[kMaxObjectsCount];
63 
64  int _playerMode;
65 
66  bool _modified;
67 
68  TrackEvt _track[kMaxTracks];
69  int _trackIndex, _trackCount;
70 
71  int _noteStartTime;
72 
73  int _vuMeterLeft1, _vuMeterLeft2;
74  int _vuMeterRight1, _vuMeterRight2;
75 
76  bool _resetAnims;
77  bool _rockTunePlaying;
78 
79  int _currButtonNum;
80  int _buttonClickTicks;
81 
82  int *_currFrameIndex;
83  int _btn3KindToggle;
84 
85  const BBPolygon *_currPianoKeyArea;
86  const Rect *_currPlayerButtonRect;
87 
88  bool _movingTrackBar;
89  int _trackBarMouseX;
90  int _trackBarX;
91  Rect _trackBarThumbRect;
92 
93  int _currTrackPos, _totalTrackLength;
94  int _ticksDelta;
95 
96  int _actionStartTrackPos, _actionTrackPos;
97  int _actionStartTime;
98 
99  int _currNoteNum;
100  int _currPatchNum;
101 
102  const ObjAnimation *getAnimation(int animIndex);
103  bool ptInRect(const Rect *r, int x, int y);
104  bool ptInPoly(const BBPolygon *poly, int x, int y);
105 
106  void buildDrawList(DrawList &drawList);
107  void buildDrawList0(DrawList &drawList);
108  void buildDrawList1(DrawList &drawList);
109 
110  void drawSprites();
111 
112  void initObjs();
113  Obj *getFreeObject();
114 
115  void initObjects();
116  void initObjects0();
117  void initObjects1();
118 
119  bool updateStatus(int mouseX, int mouseY, uint mouseButtons);
120  bool updateStatus0(int mouseX, int mouseY, uint mouseButtons);
121  bool updateStatus1(int mouseX, int mouseY, uint mouseButtons);
122 
123  void updateObjs();
124 
125  void update();
126 
127  void play();
128  void record();
129  void setPlayerMode3();
130  void stop();
131  void changePatch(int patchNum);
132  void afterButtonReleased();
133  void calcTotalTicks2();
134  void calcTotalTicks1();
135  void noteOn(int noteNum);
136  void noteOff(int noteNum);
137  void resetObjs();
138 
139  void loadSounds();
140  void playNote(int noteNum);
141  void stopNote(int noteNum);
142 
143  bool getLoadFilename(Common::String &filename);
144  bool getSaveFilename(Common::String &filename);
145  bool querySaveModifiedDialog();
146  bool querySaveModifiedTracks();
147  bool loadTracks();
148  bool saveTracks();
149  bool loadFromStream(Common::ReadStream *stream);
150  void saveToStream(Common::WriteStream *stream);
151 
152 };
153 
154 } // End of namespace Bbvs
155 
156 #endif // BBVS_MINIGAMES_BBAIRGUITAR_H
Definition: str.h:59
Definition: graphics.h:38
Definition: stream.h:77
Definition: minigame.h:47
Definition: bbairguitar.h:57
Definition: minigame.h:40
Definition: bbvs.h:169
Definition: bbvs.h:164
Definition: bbvs.h:42
Definition: bbairguitar.h:35
Definition: bbairguitar.h:29
Definition: stream.h:385
Definition: bbvs.h:248
Definition: bbairguitar.h:52