Diffstat (limited to 'noncore/games/kpacman/referee.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/kpacman/referee.h | 196 |
1 files changed, 196 insertions, 0 deletions
diff --git a/noncore/games/kpacman/referee.h b/noncore/games/kpacman/referee.h new file mode 100644 index 0000000..f812de4 --- a/dev/null +++ b/noncore/games/kpacman/referee.h | |||
@@ -0,0 +1,196 @@ | |||
1 | #ifndef REFEREE_H | ||
2 | #define REFEREE_H | ||
3 | |||
4 | #ifdef HAVE_CONFIG_H | ||
5 | #include <config.h> | ||
6 | #endif | ||
7 | |||
8 | #include "portable.h" | ||
9 | |||
10 | #if defined( KDE2_PORT ) | ||
11 | #include <kapp.h> | ||
12 | #endif | ||
13 | |||
14 | #include <qwidget.h> | ||
15 | #include <qlist.h> | ||
16 | #include <qstrlist.h> | ||
17 | #include <qarray.h> | ||
18 | #include <qbitarry.h> | ||
19 | |||
20 | #include "board.h" | ||
21 | #include "pacman.h" | ||
22 | #include "monster.h" | ||
23 | #include "fruit.h" | ||
24 | #include "energizer.h" | ||
25 | #include "bitfont.h" | ||
26 | #include "painter.h" | ||
27 | |||
28 | enum { Init, Introducing, Playing, Demonstration, Paused, Player, Ready, | ||
29 | Scoring, LevelDone, Dying, GameOver, HallOfFame }; | ||
30 | |||
31 | |||
32 | class Referee : public QWidget | ||
33 | { | ||
34 | Q_OBJECT | ||
35 | public: | ||
36 | Referee (QWidget *parent=0, const char *name=0, int scheme=-1, int mode=-1, Bitfont *font=0); | ||
37 | |||
38 | void setSkill(int); | ||
39 | void setRoom(int); | ||
40 | |||
41 | public slots: | ||
42 | void setScheme(int scheme, int mode, Bitfont *font=0); | ||
43 | |||
44 | void levelUp(); | ||
45 | void levelUpPlay(); | ||
46 | |||
47 | void pause(); | ||
48 | void ready(); | ||
49 | void intro(); | ||
50 | void introPlay(); | ||
51 | void hallOfFame(); | ||
52 | void demo(); | ||
53 | void play(); | ||
54 | void killed(); | ||
55 | void killedPlay(); | ||
56 | void eaten(); | ||
57 | void toggleHallOfFame(); | ||
58 | |||
59 | void setFocusOutPause(bool focusOutPause); | ||
60 | void setFocusInContinue(bool focusInContinue); | ||
61 | void initKeys(); | ||
62 | |||
63 | void repaintFigures(); | ||
64 | |||
65 | private slots: | ||
66 | void start(); | ||
67 | void stop(); | ||
68 | void stopEnergizer(); | ||
69 | |||
70 | signals: | ||
71 | void setScore(int, int); | ||
72 | void setPoints(int); | ||
73 | void setLevel(int); | ||
74 | void setLifes(int); | ||
75 | |||
76 | void toggleNew(); | ||
77 | void togglePaused(); | ||
78 | void forcedHallOfFame(bool); | ||
79 | |||
80 | protected: | ||
81 | void timerEvent(QTimerEvent *); | ||
82 | void paintEvent(QPaintEvent *); | ||
83 | void keyPressEvent(QKeyEvent *); | ||
84 | |||
85 | void focusOutEvent(QFocusEvent *); | ||
86 | void focusInEvent(QFocusEvent *); | ||
87 | |||
88 | void fillArray(QArray<int> &, QString, int); | ||
89 | void fillStrList(QStrList &, QString, int); | ||
90 | void fillMapName(); | ||
91 | |||
92 | void confScheme(); | ||
93 | void confLevels(bool defGroup=TRUE); | ||
94 | void confMisc(bool defGroup=TRUE); | ||
95 | void confTiming(bool defGroup=TRUE); | ||
96 | void confScoring(bool defGroup=TRUE); | ||
97 | |||
98 | private: | ||
99 | QBitArray gameState; | ||
100 | int timerCount; | ||
101 | int maxLevel; | ||
102 | |||
103 | int scheme; | ||
104 | int mode; | ||
105 | |||
106 | QString pixmapDirectory; | ||
107 | QString mapDirectory; | ||
108 | QStrList mapName; | ||
109 | |||
110 | QArray<int> speed; | ||
111 | QArray<int> monsterIQ; | ||
112 | QArray<int> fruitIQ; | ||
113 | QArray<int> fruitIndex; | ||
114 | QArray<int> pacmanTicks; | ||
115 | QArray<int> remTicks; | ||
116 | QArray<int> dangerousTicks; | ||
117 | QArray<int> harmlessTicks; | ||
118 | QArray<int> harmlessDurTicks; | ||
119 | QArray<int> harmlessWarnTicks; | ||
120 | QArray<int> arrestTicks; | ||
121 | QArray<int> arrestDurTicks; | ||
122 | QArray<int> fruitTicks; | ||
123 | QArray<int> fruitAppearsTicks; | ||
124 | QArray<int> fruitDurTicks; | ||
125 | QArray<int> fruitScoreDurTicks; | ||
126 | |||
127 | int monsterScoreDurMS; | ||
128 | int playerDurMS; | ||
129 | int readyDurMS; | ||
130 | int gameOverDurMS; | ||
131 | int afterPauseMS; | ||
132 | int dyingPreAnimationMS; | ||
133 | int dyingAnimationMS; | ||
134 | int dyingPostAnimationMS; | ||
135 | int introAnimationMS; | ||
136 | int introPostAnimationMS; | ||
137 | int levelUpPreAnimationMS; | ||
138 | int levelUpAnimationMS; | ||
139 | int energizerAnimationMS; | ||
140 | |||
141 | int pointScore; | ||
142 | int energizerScore; | ||
143 | QArray<int> fruitScore; | ||
144 | QArray<int> monsterScore; | ||
145 | QArray<int> extraLifeScore; | ||
146 | |||
147 | int extraLifeScoreIndex; | ||
148 | int nextExtraLifeScore; | ||
149 | |||
150 | int monstersEaten; | ||
151 | int points; | ||
152 | int lifes; | ||
153 | int level; | ||
154 | |||
155 | bool focusedPause; | ||
156 | bool focusOutPause; | ||
157 | bool focusInContinue; | ||
158 | |||
159 | Board *board; | ||
160 | Painter *pix; | ||
161 | Pacman *pacman; | ||
162 | Fruit *fruit; | ||
163 | |||
164 | QList<Monster> *monsters; | ||
165 | QList<QRect> *monsterRect; | ||
166 | |||
167 | QList<Energizer> *energizers; | ||
168 | QList<QRect> *energizerRect; | ||
169 | |||
170 | QRect pacmanRect; | ||
171 | QRect fruitRect; | ||
172 | |||
173 | void introMonster(int id); | ||
174 | void introPaint(int t); | ||
175 | |||
176 | void initMonsters(); | ||
177 | void initPacman(); | ||
178 | void initFruit(bool fullInitialization=TRUE); | ||
179 | void initEnergizers(); | ||
180 | |||
181 | void setOnEnergizers(); | ||
182 | |||
183 | int gameTimer; | ||
184 | int energizerTimer; | ||
185 | void start(int); | ||
186 | void init(bool); | ||
187 | |||
188 | void score(int); | ||
189 | |||
190 | uint UpKey; | ||
191 | uint DownKey; | ||
192 | uint RightKey; | ||
193 | uint LeftKey; | ||
194 | }; | ||
195 | |||
196 | #endif // REFEREE_H | ||