ScummVM API documentation
minigame.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_MINIGAME_H
23 #define BBVS_MINIGAMES_MINIGAME_H
24 
25 #include "bbvs/bbvs.h"
26 #include "bbvs/graphics.h"
27 #include "bbvs/sound.h"
28 #include "bbvs/spritemodule.h"
29 
30 namespace Bbvs {
31 
32 enum {
33  kMinigameBbLoogie = 0,
34  kMinigameBbTennis = 1,
35  kMinigameBbAnt = 2,
36  kMinigameBbAirGuitar = 3,
37  kMinigameCount
38 };
39 
40 struct ObjAnimation {
41  int frameCount;
42  const int *frameIndices;
43  const int16 *frameTicks;
44  const BBRect *frameRects;
45 };
46 
47 class Minigame {
48 public:
49  Minigame(BbvsEngine *vm);
50  virtual ~Minigame();
51  virtual bool run(bool fromMainGame) = 0;
52 protected:
53  BbvsEngine *_vm;
54  SpriteModule *_spriteModule;
55 
56  int _gameState;
57  int _gameTicks;
58  bool _gameResult;
59  bool _gameDone;
60  bool _fromMainGame;
61  int _hiScoreTable[kMinigameCount];
62 
63  int _backgroundSpriteIndex, _titleScreenSpriteIndex;
64 
65  const ObjAnimation *_numbersAnim;
66 
67  int drawNumber(DrawList &drawList, int number, int x, int y);
68 
69  void playSound(uint index, bool loop = false);
70  void stopSound(uint index);
71  bool isSoundPlaying(uint index);
72  bool isAnySoundPlaying(const uint *indices, uint count);
73 
74  void saveHiscore(int minigameNum, int score);
75  int loadHiscore(int minigameNum);
76 
77 };
78 
79 } // End of namespace Bbvs
80 
81 #endif // BBVS_MINIGAMES_MINIGAME_H
Definition: graphics.h:38
Definition: bbvs.h:160
Definition: spritemodule.h:47
Definition: minigame.h:47
Definition: minigame.h:40
Definition: bbvs.h:42
Definition: bbvs.h:248