ScummVM API documentation
bibble_window.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_SPACEBAR_BIBBLE_WINDOW_H
24 #define BAGEL_SPACEBAR_BIBBLE_WINDOW_H
25 
26 #include "bagel/baglib/storage_dev_win.h"
27 #include "bagel/boflib/gui/text_box.h"
28 #include "bagel/boflib/gui/button.h"
29 #include "bagel/boflib/gfx/sprite.h"
30 #include "bagel/boflib/sound.h"
31 
32 namespace Bagel {
33 namespace SpaceBar {
34 
35 #define BIBBLE_NUM_BUTTONS 12
36 #define BIBBLE_NUM_BIBBLES 3
37 #define BIBBLE_NUM_SHOUTS 4
38 #define BIBBLE_NUM_PAYOFFS 16
39 #define BIBBLE_NUM_BET_AREAS 24
40 
41 struct ST_PAYOFFS {
42  int _nPay1;
43  int _nPay2;
44 };
45 
46 struct CBetAreaDef {
47  int _nBet;
48  int _left;
49  int _top;
50  int _right;
51  int _bottom;
52  int _nPayOff1;
53  int _nPayOff2;
54  const char *_cAudioFile;
55  const char *_cPayFile;
56 };
57 
58 class CBetArea : public CBofObject {
59 public:
60  CBetArea() {}
61  CBetArea(const CBetAreaDef &def);
62 
63  // Data members
64  CBofRect _cRect;
65  int _nBet = 0;
66  int _nPayOff1 = 0;
67  int _nPayOff2 = 0;
68  bool _bWon = false;
69  CBofString _cAudioFile;
70  CBofString _cPayFile;
71 };
72 
73 extern CBetAreaDef BET_AREAS[BIBBLE_NUM_BET_AREAS];
74 extern const ST_PAYOFFS PAY_OFFS[BIBBLE_NUM_PAYOFFS];
75 
76 
78 public:
79  CBibbleWindow();
80 
81  virtual ErrorCode attach();
82  virtual ErrorCode detach();
83 
84  virtual void onBofButton(CBofObject *pButton, int nState);
85  virtual void onClose();
86 
87 protected:
88  ErrorCode playGame();
89  ErrorCode bonkBibble(int nBibble, int nShout);
90 
91  void calcOutcome();
92  ErrorCode displayCredits();
93 
94  ErrorCode highlight(CBetArea *pArea, byte nColor);
95  ErrorCode unHighlight(CBetArea *pArea);
96 
97  virtual void onLButtonDown(uint32 nFlags, CBofPoint *pPoint, void * = nullptr);
98  virtual void onLButtonUp(uint32 nFlags, CBofPoint *pPoint, void * = nullptr);
99  virtual void onLButtonDblClk(uint32 nFlags, CBofPoint *pPoint);
100  virtual void onKeyHit(uint32 lKey, uint32 lRepCount);
101 
102  virtual void onPaint(CBofRect *pRect);
103  virtual void onMainLoop();
104  virtual void onTimer(uint32 /*nTimerID*/) {
105  // Do nothing
106  }
107 
108  // Data
109  CBofSound *_pBkgSnd;
110  CBofBmpButton *_pButtons[BIBBLE_NUM_BUTTONS];
111  CBofText *_pCreditsText;
112  CBofSprite *_pMasterBibble;
113  CBofSprite *_pBibble[BIBBLE_NUM_BIBBLES];
114  CBofSprite *_pBall;
115  CBofSprite *_pArch1;
116  CBofSprite *_pArch2;
117  CBofSprite *_pArch3;
118  CBofSound *_pShouts[BIBBLE_NUM_SHOUTS];
119  uint32 _nNumCredits;
120 
121  int _nBall1; // Which Bibble hit by ball 1
122  int _nBall2; // Which Bibble hit by ball 2
123  int _nBall3; // Which Bibble hit by ball 3
124 
125  int _nBall1Said;
126  int _nBall2Said;
127  int _nBall3Said;
128 
129  int _nNumShout1;
130  int _nNumShout2;
131  int _nNumShout3;
132  int _nNumShout4;
133 
134  int _nNumTopBonks;
135  int _nNumMidBonks;
136  int _nNumBotBonks;
137  CBetArea *_pSelected;
138 };
139 
140 } // namespace SpaceBar
141 } // namespace Bagel
142 
143 #endif
Definition: storage_dev_win.h:406
Definition: bibble_window.h:41
Definition: object.h:28
Definition: bibble_window.h:58
Definition: sprite.h:38
Definition: rect.h:36
Definition: sound.h:73
Definition: button.h:109
Definition: string.h:38
Definition: bibble_window.h:46
Definition: bagel.h:31
Definition: point.h:34
Definition: text.h:122
Definition: bibble_window.h:77