ScummVM API documentation
bbtennis.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_BBTENNIS_H
23 #define BBVS_MINIGAMES_BBTENNIS_H
24 
25 #include "bbvs/minigames/minigame.h"
26 
27 namespace Bbvs {
28 
29 class MinigameBbTennis : public Minigame {
30 public:
31  MinigameBbTennis(BbvsEngine *vm) : Minigame(vm) {};
32  bool run(bool fromMainGame) override;
33 public:
34 
35  struct Obj {
36  int kind;
37  int x, y;
38  const ObjAnimation *anim;
39  int frameIndex;
40  int ticks;
41  int status;
42  int blinkCtr;
43  float fltStepX;
44  float fltStepY;
45  float fltX;
46  float fltY;
47  int targetX;
48  int targetY;
49  int ballStep;
50  int ballStepCtr;
51  int netPlayDirection;
52  };
53 
54  enum {
55  kMaxObjectsCount = 256
56  };
57 
58  enum {
59  kGSTitleScreen = 0, // Title screen
60  kGSMainGame = 1, // Game when called as part of the main game
61  kGSStandaloneGame = 2, // Game when called as standalone game
62  kGSScoreCountUp = 3 // Score countup and next level text
63  };
64 
65  Obj _objects[kMaxObjectsCount];
66 
67  int _numHearts;
68  int _squirrelDelay;
69  int _tennisPlayerDelay;
70  int _throwerDelay;
71  int _netPlayerDelay;
72  int _playerDecrease;
73  int _delayDecreaseTimer;
74  int _numBalls;
75  int _newBallTimer;
76  int _initBallTimer;
77  int _maxBalls;
78  int _rapidFireBallsCount;
79  int _score, _hiScore;
80  int _hitMissRatio;
81  bool _allHeartsGone;
82  bool _playedThisIsTheCoolest;
83  bool _startSoundPlayed;
84  bool _endSoundPlaying;
85 
86  const ObjAnimation *getAnimation(int animIndex);
87 
88  void buildDrawList(DrawList &drawList);
89  void buildDrawList0(DrawList &drawList);
90  void buildDrawList1(DrawList &drawList);
91  void buildDrawList2(DrawList &drawList);
92 
93  void drawSprites();
94 
95  void initObjs();
96  Obj *getFreeObject();
97  Obj *findTennisBall(int startObjIndex);
98  bool isHit(Obj *obj1, Obj *obj2);
99 
100  void initObjects();
101  void initObjects0();
102  void initObjects1();
103  void initObjects2();
104 
105  void initVars();
106  void initVars0();
107  void initVars1();
108  void initVars2();
109 
110  bool updateStatus(int mouseX, int mouseY, uint mouseButtons);
111  bool updateStatus0(int mouseX, int mouseY, uint mouseButtons);
112  bool updateStatus1(int mouseX, int mouseY, uint mouseButtons);
113  bool updateStatus2(int mouseX, int mouseY, uint mouseButtons);
114 
115  void updateObjs();
116  void updateTennisBall(int objIndex);
117  void updateSquirrel(int objIndex);
118  void updateTennisPlayer(int objIndex);
119  void updateThrower(int objIndex);
120  void updateNetPlayer(int objIndex);
121  void updateEnemyTennisBall(int objIndex);
122  void makeEnemyBall(int x, int y, int frameIndex);
123  void hitSomething();
124 
125  void update();
126 
127  void loadSounds();
128 
129 };
130 
131 } // End of namespace Bbvs
132 
133 #endif // BBVS_MINIGAMES_BBTENNIS_H
Definition: graphics.h:38
Definition: bbtennis.h:35
Definition: bbtennis.h:29
Definition: minigame.h:47
Definition: minigame.h:40
Definition: bbvs.h:42
Definition: bbvs.h:248