author | andyq <andyq> | 2002-12-07 00:30:30 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-12-07 00:30:30 (UTC) |
commit | ad2a10877ae6e50b1a765a9b7cff14494c65e588 (patch) (unidiff) | |
tree | 261d3461be9861235dff59e908dc650fe98cb346 | |
parent | 22b6762b871b64825e1f8e974636c2d27fef8486 (diff) | |
download | opie-ad2a10877ae6e50b1a765a9b7cff14494c65e588.zip opie-ad2a10877ae6e50b1a765a9b7cff14494c65e588.tar.gz opie-ad2a10877ae6e50b1a765a9b7cff14494c65e588.tar.bz2 |
Upgraded to v1.7 - new menu system, new game types (gates (implemented and working) and fly (not implemented yet)). Also, high scores are persistent and different across game types - not difficultiy yet. Game Difficulty levels added but not yet implemented
-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 374 | ||||
-rw-r--r-- | noncore/games/sfcave/sfcave.h | 42 |
2 files changed, 371 insertions, 45 deletions
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index 931f393..8b9c844 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp | |||
@@ -6,2 +6,3 @@ | |||
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | #include <qpe/config.h> | ||
7 | #else | 8 | #else |
@@ -12,5 +13,51 @@ | |||
12 | 13 | ||
13 | #define CAPTION "SFCave 1.6 by AndyQ" | 14 | #define CAPTION "SFCave 1.7 by AndyQ" |
15 | |||
16 | // States | ||
17 | #define STATE_BOSS 0 | ||
18 | #define STATE_RUNNING 1 | ||
19 | #define STATE_CRASHED 2 | ||
20 | #define STATE_NEWGAME 3 | ||
21 | #define STATE_MENU 4 | ||
22 | |||
23 | // Menus | ||
24 | #define MENU_MAIN_MENU 0 | ||
25 | #define MENU_OPTIONS_MENU 1 | ||
26 | |||
27 | // Main Menu Options | ||
28 | #define MENU_START_GAME 0 | ||
29 | #define MENU_OPTIONS 1 | ||
30 | #define MENU_QUIT 2 | ||
31 | |||
32 | // Option Menu Options | ||
33 | #define MENU_GAME_TYPE 0 | ||
34 | #define MENU_GAME_DIFFICULTY 1 | ||
35 | #define MENU_BACK 2 | ||
36 | |||
37 | QString SFCave::menuOptions[2][5] = { { "Start Game", "Options", "Quit", "", "" }, | ||
38 | { "Game Type - %s", "Game Difficulty - %s", "Back", "", "" } }; | ||
39 | |||
40 | |||
41 | #define NR_GAME_DIFFICULTIES 3 | ||
42 | #define NR_GAME_TYPES 3 | ||
43 | |||
44 | #define EASY "Easy" | ||
45 | #define NORMAL "Normal" | ||
46 | #define HARD "Hard" | ||
47 | |||
48 | #define SFCAVE_GAME_TYPE 0 | ||
49 | #define GATES_GAME_TYPE 1 | ||
50 | #define FLY_GAME_TYPE 2 | ||
51 | #define SFCAVE_GAME "SFCave" | ||
52 | #define GATES_GAME "Gates" | ||
53 | #define FLY_GAME "Fly" | ||
54 | QString SFCave::dificultyOption[] = { EASY, NORMAL, HARD }; | ||
55 | QString SFCave::gameTypes[] = { SFCAVE_GAME, GATES_GAME, FLY_GAME }; | ||
56 | |||
57 | #define CURRENT_GAME_TYPE gameTypes[currentGameType] | ||
58 | #define CURRENT_GAME_DIFFICULTY difficultyOption[currentGameDifficulty]; | ||
59 | |||
14 | bool movel; | 60 | bool movel; |
15 | 61 | ||
62 | |||
16 | int main( int argc, char *argv[] ) | 63 | int main( int argc, char *argv[] ) |
@@ -35,3 +82,3 @@ int main( int argc, char *argv[] ) | |||
35 | 82 | ||
36 | Main app( speed ); | 83 | SFCave app( speed ); |
37 | a.setMainWidget( &app ); | 84 | a.setMainWidget( &app ); |
@@ -42,4 +89,5 @@ int main( int argc, char *argv[] ) | |||
42 | 89 | ||
43 | Main :: Main( int spd, QWidget *w, char *name ) | 90 | SFCave :: SFCave( int spd, QWidget *w, char *name ) |
44 | : QMainWindow( w, name ) | 91 | : QMainWindow( w, name ) |
92 | |||
45 | { | 93 | { |
@@ -55,4 +103,9 @@ Main :: Main( int spd, QWidget *w, char *name ) | |||
55 | 103 | ||
56 | //printf( "width %d, height %d\n", sWidth, sHeight ); | 104 | currentMenuNr = 0; |
57 | //printf( "segSize = %d\n", segSize ); | 105 | nrMenuOptions[0] = 3; |
106 | nrMenuOptions[1] = 3; | ||
107 | currentMenuOption[0] = 0; | ||
108 | currentMenuOption[1] = 0; | ||
109 | currentGameType = 0; | ||
110 | currentGameDifficulty = 0; | ||
58 | 111 | ||
@@ -60,3 +113,12 @@ Main :: Main( int spd, QWidget *w, char *name ) | |||
60 | 113 | ||
61 | highestScore = 0; | 114 | #ifdef QWS |
115 | Config cfg( "sfcave" ); | ||
116 | cfg.setGroup( "settings" ); | ||
117 | QString key = "highScore_"; | ||
118 | highestScore[SFCAVE_GAME_TYPE] = cfg.readNumEntry( key + SFCAVE_GAME, 0 ); | ||
119 | highestScore[GATES_GAME_TYPE] = cfg.readNumEntry( key + GATES_GAME, 0 ); | ||
120 | highestScore[FLY_GAME_TYPE] = cfg.readNumEntry( key + FLY_GAME, 0 ); | ||
121 | currentGameType = cfg.readNumEntry( "gameType", 0 ); | ||
122 | currentGameDifficulty = cfg.readNumEntry( "difficulty", 0 ); | ||
123 | #endif | ||
62 | speed = spd; // Change to 2 for PC | 124 | speed = spd; // Change to 2 for PC |
@@ -75,3 +137,3 @@ Main :: Main( int spd, QWidget *w, char *name ) | |||
75 | 137 | ||
76 | Main :: ~Main() | 138 | SFCave :: ~SFCave() |
77 | { | 139 | { |
@@ -79,3 +141,3 @@ Main :: ~Main() | |||
79 | 141 | ||
80 | void Main :: start() | 142 | void SFCave :: start() |
81 | { | 143 | { |
@@ -85,3 +147,3 @@ void Main :: start() | |||
85 | 147 | ||
86 | int Main :: nextInt( int range ) | 148 | int SFCave :: nextInt( int range ) |
87 | { | 149 | { |
@@ -90,6 +152,6 @@ int Main :: nextInt( int range ) | |||
90 | 152 | ||
91 | void Main :: setUp() | 153 | void SFCave :: setUp() |
92 | { | 154 | { |
93 | state = STATE_CRASHED; | 155 | state = STATE_MENU; |
94 | prevState = STATE_CRASHED; | 156 | prevState = STATE_MENU; |
95 | 157 | ||
@@ -107,2 +169,5 @@ void Main :: setUp() | |||
107 | blockHeight = 70; | 169 | blockHeight = 70; |
170 | gapHeight = 125; | ||
171 | gateDistance = 75; | ||
172 | nextGate = nextInt( 50 ) + gateDistance; | ||
108 | 173 | ||
@@ -122,3 +187,3 @@ void Main :: setUp() | |||
122 | 187 | ||
123 | void Main :: run() | 188 | void SFCave :: run() |
124 | { | 189 | { |
@@ -128,2 +193,5 @@ void Main :: run() | |||
128 | { | 193 | { |
194 | case STATE_MENU: | ||
195 | displayMenu(); | ||
196 | break; | ||
129 | case STATE_NEWGAME: | 197 | case STATE_NEWGAME: |
@@ -148,3 +216,7 @@ void Main :: run() | |||
148 | 216 | ||
149 | if ( ++nrFrames % 500 == 0 ) | 217 | // Apply Game rules |
218 | nrFrames ++; | ||
219 | if ( CURRENT_GAME_TYPE == SFCAVE_GAME ) | ||
220 | { | ||
221 | if ( nrFrames % 500 == 0 ) | ||
150 | { | 222 | { |
@@ -162,8 +234,35 @@ void Main :: run() | |||
162 | addBlock(); | 234 | addBlock(); |
235 | } | ||
236 | else if ( CURRENT_GAME_TYPE == GATES_GAME ) | ||
237 | { | ||
238 | // Slightly random gap distance | ||
239 | if ( nrFrames >= nextGate ) | ||
240 | { | ||
241 | nextGate = nrFrames + nextInt( 50 ) + gateDistance; | ||
242 | addGate(); | ||
243 | } | ||
244 | |||
245 | if ( nrFrames % 500 == 0 ) | ||
246 | { | ||
247 | if ( gapHeight > 75 ) | ||
248 | gapHeight -= 5; | ||
249 | } | ||
250 | } | ||
251 | else if ( CURRENT_GAME_TYPE == FLY_GAME ) | ||
252 | { | ||
253 | } | ||
254 | |||
163 | 255 | ||
164 | // if ( false ) | ||
165 | if ( checkCollision() ) | 256 | if ( checkCollision() ) |
166 | { | 257 | { |
167 | if ( score > highestScore ) | 258 | if ( score > highestScore[currentGameType] ) |
168 | highestScore = score; | 259 | highestScore[currentGameType] = score; |
260 | |||
261 | #ifdef QWS | ||
262 | Config cfg( "sfcave" ); | ||
263 | cfg.setGroup( "settings" ); | ||
264 | QString key = "highScore_"; | ||
265 | key += CURRENT_GAME_TYPE; | ||
266 | cfg.writeEntry( key, highestScore[currentGameType] ); | ||
267 | #endif | ||
169 | 268 | ||
@@ -184,3 +283,3 @@ void Main :: run() | |||
184 | 283 | ||
185 | bool Main :: checkCollision() | 284 | bool SFCave :: checkCollision() |
186 | { | 285 | { |
@@ -200,3 +299,3 @@ bool Main :: checkCollision() | |||
200 | 299 | ||
201 | void Main :: moveLandscape() | 300 | void SFCave :: moveLandscape() |
202 | { | 301 | { |
@@ -228,3 +327,3 @@ void Main :: moveLandscape() | |||
228 | 327 | ||
229 | void Main :: addBlock() | 328 | void SFCave :: addBlock() |
230 | { | 329 | { |
@@ -239,5 +338,32 @@ void Main :: addBlock() | |||
239 | blocks[i].setRect( x, y, blockWidth, blockHeight ); | 338 | blocks[i].setRect( x, y, blockWidth, blockHeight ); |
240 | // printf( "Added block @ %d %d\n", x, y ); | ||
241 | // printf( "mapTop = %d, mapBottom = %d", mapTop[50], mapBottom[50] ); | ||
242 | 339 | ||
340 | break; | ||
341 | } | ||
342 | } | ||
343 | } | ||
344 | |||
345 | void SFCave :: addGate() | ||
346 | { | ||
347 | for ( int i = 0 ; i < BLOCKSIZE ; ++i ) | ||
348 | { | ||
349 | if ( blocks[i].y() == -1 ) | ||
350 | { | ||
351 | int x1 = sWidth; | ||
352 | int y1 = mapTop[50]; | ||
353 | int b1Height = nextInt(mapBottom[50] - mapTop[50] - gateDistance); | ||
354 | |||
355 | // See if height between last gate and this one is too big | ||
356 | if ( b1Height - 200 > lastGateBottomY ) | ||
357 | b1Height -= 25; | ||
358 | else if ( b1Height + 200 < lastGateBottomY ) | ||
359 | b1Height += 25; | ||
360 | lastGateBottomY = b1Height; | ||
361 | |||
362 | int x2 = sWidth; | ||
363 | int y2 = y1 + b1Height + gateDistance; | ||
364 | int b2Height = mapBottom[50] - y2; | ||
365 | |||
366 | |||
367 | blocks[i].setRect( x1, y1, blockWidth, b1Height ); | ||
368 | blocks[i+1].setRect( x2, y2, blockWidth, b2Height ); | ||
243 | 369 | ||
@@ -248,3 +374,3 @@ void Main :: addBlock() | |||
248 | 374 | ||
249 | void Main :: setPoint( int point ) | 375 | void SFCave :: setPoint( int point ) |
250 | { | 376 | { |
@@ -269,3 +395,3 @@ void Main :: setPoint( int point ) | |||
269 | 395 | ||
270 | void Main :: drawBoss() | 396 | void SFCave :: drawBoss() |
271 | { | 397 | { |
@@ -276,3 +402,3 @@ void Main :: drawBoss() | |||
276 | 402 | ||
277 | void Main :: draw() | 403 | void SFCave :: draw() |
278 | { | 404 | { |
@@ -282,2 +408,3 @@ void Main :: draw() | |||
282 | QPainter p( offscreen ); | 408 | QPainter p( offscreen ); |
409 | QFontMetrics fm = p.fontMetrics(); | ||
283 | p.setPen( Qt::white ); | 410 | p.setPen( Qt::white ); |
@@ -308,3 +435,3 @@ void Main :: draw() | |||
308 | QString s; | 435 | QString s; |
309 | s.sprintf( "score %06d high score %06d", score, highestScore ); | 436 | s.sprintf( "score %06d high score %06d", score, highestScore[currentGameType] ); |
310 | p.drawText( 5, 10, s ); | 437 | p.drawText( 5, 10, s ); |
@@ -326,3 +453,10 @@ void Main :: draw() | |||
326 | if ( crashLineLength >= 15 || crashLineLength == -1 ) | 453 | if ( crashLineLength >= 15 || crashLineLength == -1 ) |
327 | p.drawText( 70, 140, QString( "Press down to start" ) ); | 454 | { |
455 | QString text = "Press up or down to start"; | ||
456 | p.drawText( (sWidth/2) - (fm.width( text )/2), 140, text ); | ||
457 | |||
458 | text = "or press OK for menu"; | ||
459 | p.drawText( (sWidth/2) - (fm.width( text )/2), 155, text ); | ||
460 | // p.drawText( 70, 140, QString( "Press down to start" ) ); | ||
461 | } | ||
328 | else | 462 | else |
@@ -336,3 +470,3 @@ void Main :: draw() | |||
336 | 470 | ||
337 | void Main :: handleKeys() | 471 | void SFCave :: handleKeys() |
338 | { | 472 | { |
@@ -384,3 +518,63 @@ void Main :: handleKeys() | |||
384 | 518 | ||
385 | void Main :: keyPressEvent( QKeyEvent *e ) | 519 | void SFCave :: keyPressEvent( QKeyEvent *e ) |
520 | { | ||
521 | if ( state == STATE_MENU ) | ||
522 | { | ||
523 | switch( e->key() ) | ||
524 | { | ||
525 | case Qt::Key_Down: | ||
526 | currentMenuOption[currentMenuNr] ++; | ||
527 | if ( menuOptions[currentMenuNr][currentMenuOption[currentMenuNr]] == "" ) | ||
528 | currentMenuOption[currentMenuNr] = 0; | ||
529 | break; | ||
530 | case Qt::Key_Up: | ||
531 | currentMenuOption[currentMenuNr] --; | ||
532 | if ( currentMenuOption[currentMenuNr] < 0 ) | ||
533 | currentMenuOption[currentMenuNr] = nrMenuOptions[currentMenuNr]-1; | ||
534 | break; | ||
535 | |||
536 | case Qt::Key_Left: | ||
537 | if ( currentMenuNr == MENU_OPTIONS_MENU ) | ||
538 | { | ||
539 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) | ||
540 | { | ||
541 | currentGameType --; | ||
542 | if ( currentGameType < 0 ) | ||
543 | currentGameType = NR_GAME_TYPES - 1; | ||
544 | } | ||
545 | else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY ) | ||
546 | { | ||
547 | currentGameDifficulty --; | ||
548 | if ( currentGameDifficulty < 0 ) | ||
549 | currentGameDifficulty = NR_GAME_DIFFICULTIES - 1; | ||
550 | } | ||
551 | } | ||
552 | break; | ||
553 | |||
554 | case Qt::Key_Right: | ||
555 | if ( currentMenuNr == MENU_OPTIONS_MENU ) | ||
556 | { | ||
557 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) | ||
558 | { | ||
559 | currentGameType ++; | ||
560 | if ( currentGameType == NR_GAME_TYPES ) | ||
561 | currentGameType = 0; | ||
562 | } | ||
563 | else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY ) | ||
564 | { | ||
565 | currentGameDifficulty ++; | ||
566 | if ( currentGameDifficulty == NR_GAME_DIFFICULTIES ) | ||
567 | currentGameDifficulty = 0; | ||
568 | } | ||
569 | } | ||
570 | break; | ||
571 | |||
572 | case Qt::Key_Space: | ||
573 | case Qt::Key_Return: | ||
574 | case Qt::Key_Enter: | ||
575 | dealWithMenuSelection(); | ||
576 | break; | ||
577 | } | ||
578 | } | ||
579 | else | ||
386 | { | 580 | { |
@@ -393,2 +587,7 @@ void Main :: keyPressEvent( QKeyEvent *e ) | |||
393 | break; | 587 | break; |
588 | case Qt::Key_M: | ||
589 | case Qt::Key_Return: | ||
590 | case Qt::Key_Enter: | ||
591 | if ( state == STATE_CRASHED && crashLineLength >= 15 || crashLineLength == -1 ) | ||
592 | state = STATE_MENU; | ||
394 | default: | 593 | default: |
@@ -398,4 +597,10 @@ void Main :: keyPressEvent( QKeyEvent *e ) | |||
398 | } | 597 | } |
598 | } | ||
399 | 599 | ||
400 | void Main :: keyReleaseEvent( QKeyEvent *e ) | 600 | void SFCave :: keyReleaseEvent( QKeyEvent *e ) |
601 | { | ||
602 | if ( state == STATE_MENU ) | ||
603 | { | ||
604 | } | ||
605 | else | ||
401 | { | 606 | { |
@@ -403,3 +608,2 @@ void Main :: keyReleaseEvent( QKeyEvent *e ) | |||
403 | { | 608 | { |
404 | case Qt::Key_Up: | ||
405 | case Qt::Key_F9: | 609 | case Qt::Key_F9: |
@@ -408,2 +612,6 @@ void Main :: keyReleaseEvent( QKeyEvent *e ) | |||
408 | break; | 612 | break; |
613 | |||
614 | case Qt::Key_Up: | ||
615 | press = false; | ||
616 | |||
409 | case Qt::Key_R: | 617 | case Qt::Key_R: |
@@ -416,2 +624,4 @@ void Main :: keyReleaseEvent( QKeyEvent *e ) | |||
416 | movel = true; | 624 | movel = true; |
625 | break; | ||
626 | |||
417 | default: | 627 | default: |
@@ -421 +631,103 @@ void Main :: keyReleaseEvent( QKeyEvent *e ) | |||
421 | } | 631 | } |
632 | |||
633 | } | ||
634 | |||
635 | void SFCave :: displayMenu() | ||
636 | { | ||
637 | offscreen->fill( Qt::black ); | ||
638 | |||
639 | QPainter p( offscreen ); | ||
640 | p.setPen( Qt::white ); | ||
641 | |||
642 | QFont f( "Helvetica", 16 ); | ||
643 | p.setFont( f ); | ||
644 | |||
645 | QFontMetrics fm = p.fontMetrics(); | ||
646 | |||
647 | QString text = "SFCave"; | ||
648 | p.drawText( (sWidth/2) - (fm.width( text )/2), 60, text ); | ||
649 | |||
650 | text = "Written by Andy Qua"; | ||
651 | p.drawText( (sWidth/2) - (fm.width( text )/2), 85, text ); | ||
652 | |||
653 | // Draw options | ||
654 | int pos = 170; | ||
655 | for ( int i = 0 ; menuOptions[currentMenuNr][i] != "" ; ++i, pos += 25 ) | ||
656 | { | ||
657 | if ( currentMenuOption[currentMenuNr] == i ) | ||
658 | p.setPen( Qt::yellow ); | ||
659 | else | ||
660 | p.setPen( Qt::white ); | ||
661 | |||
662 | QString text; | ||
663 | if ( menuOptions[currentMenuNr][i].find( "%s" ) != -1 ) | ||
664 | { | ||
665 | QString val; | ||
666 | if ( i == MENU_GAME_TYPE ) | ||
667 | val = gameTypes[currentGameType]; | ||
668 | else | ||
669 | val = dificultyOption[currentGameDifficulty]; | ||
670 | |||
671 | text.sprintf( (const char *)menuOptions[currentMenuNr][i], (const char *)val ); | ||
672 | } | ||
673 | else | ||
674 | text = menuOptions[currentMenuNr][i]; | ||
675 | |||
676 | p.drawText( (sWidth/2) - (fm.width( text )/2), pos, text ); | ||
677 | } | ||
678 | |||
679 | p.end(); | ||
680 | bitBlt( this, 0, 0, offscreen, 0, 0, sWidth, sHeight, Qt::CopyROP, true ); | ||
681 | } | ||
682 | |||
683 | void SFCave :: dealWithMenuSelection() | ||
684 | { | ||
685 | switch( currentMenuNr ) | ||
686 | { | ||
687 | case MENU_MAIN_MENU: | ||
688 | { | ||
689 | switch( currentMenuOption[currentMenuNr] ) | ||
690 | { | ||
691 | case MENU_START_GAME: | ||
692 | state = STATE_NEWGAME; | ||
693 | break; | ||
694 | |||
695 | case MENU_OPTIONS: | ||
696 | currentMenuNr = MENU_OPTIONS_MENU; | ||
697 | currentMenuOption[currentMenuNr] = 0; | ||
698 | break; | ||
699 | |||
700 | case MENU_QUIT: | ||
701 | QApplication::exit(); | ||
702 | break; | ||
703 | } | ||
704 | |||
705 | break; | ||
706 | } | ||
707 | |||
708 | case MENU_OPTIONS_MENU: | ||
709 | { | ||
710 | switch( currentMenuOption[currentMenuNr] ) | ||
711 | { | ||
712 | case MENU_GAME_TYPE: | ||
713 | break; | ||
714 | |||
715 | case MENU_GAME_DIFFICULTY: | ||
716 | break; | ||
717 | |||
718 | case MENU_BACK: | ||
719 | currentMenuNr = MENU_MAIN_MENU; | ||
720 | |||
721 | #ifdef QWS | ||
722 | Config cfg( "sfcave" ); | ||
723 | cfg.setGroup( "settings" ); | ||
724 | cfg.writeEntry( "difficulty", currentGameDifficulty ); | ||
725 | cfg.writeEntry( "gameType", currentGameType ); | ||
726 | #endif | ||
727 | break; | ||
728 | } | ||
729 | |||
730 | break; | ||
731 | } | ||
732 | } | ||
733 | } \ No newline at end of file | ||
diff --git a/noncore/games/sfcave/sfcave.h b/noncore/games/sfcave/sfcave.h index 18eeef9..b19d147 100644 --- a/noncore/games/sfcave/sfcave.h +++ b/noncore/games/sfcave/sfcave.h | |||
@@ -10,11 +10,6 @@ | |||
10 | #define MAPSIZE 52 | 10 | #define MAPSIZE 52 |
11 | #define BLOCKSIZE 5 | 11 | #define BLOCKSIZE 6 |
12 | #define TRAILSIZE 30 | 12 | #define TRAILSIZE 30 |
13 | 13 | ||
14 | #define STATE_BOSS 0 | 14 | class SFCave : public QMainWindow |
15 | #define STATE_RUNNING 1 | ||
16 | #define STATE_CRASHED 2 | ||
17 | #define STATE_NEWGAME 3 | ||
18 | |||
19 | class Main : public QMainWindow | ||
20 | { | 15 | { |
@@ -29,2 +24,3 @@ public: | |||
29 | int blockHeight; | 24 | int blockHeight; |
25 | int gapHeight; | ||
30 | int state; | 26 | int state; |
@@ -34,2 +30,16 @@ public: | |||
34 | 30 | ||
31 | int gateDistance; | ||
32 | int nextGate; | ||
33 | int lastGateBottomY; | ||
34 | |||
35 | static QString menuOptions[2][5]; | ||
36 | int currentMenuNr; | ||
37 | int nrMenuOptions[2]; | ||
38 | int currentMenuOption[2]; | ||
39 | |||
40 | static QString dificultyOption[3]; | ||
41 | static QString gameTypes[3]; | ||
42 | int currentGameType; | ||
43 | int currentGameDifficulty; | ||
44 | |||
35 | QPixmap *offscreen; | 45 | QPixmap *offscreen; |
@@ -38,9 +48,9 @@ public: | |||
38 | int score; | 48 | int score; |
39 | int highestScore; | 49 | int highestScore[3]; |
40 | 50 | ||
41 | int mapTop[52]; | 51 | int mapTop[MAPSIZE]; |
42 | int mapBottom[52]; | 52 | int mapBottom[MAPSIZE]; |
43 | QRect blocks[5]; | 53 | QRect blocks[BLOCKSIZE]; |
44 | QRect user; | 54 | QRect user; |
45 | QPoint trail[30]; | 55 | QPoint trail[TRAILSIZE]; |
46 | 56 | ||
@@ -57,4 +67,4 @@ public: | |||
57 | 67 | ||
58 | Main( int speed = 3, QWidget *p = 0, char *name = 0 ); | 68 | SFCave( int speed = 3, QWidget *p = 0, char *name = 0 ); |
59 | ~Main(); | 69 | ~SFCave(); |
60 | void start(); | 70 | void start(); |
@@ -65,2 +75,3 @@ public: | |||
65 | void addBlock(); | 75 | void addBlock(); |
76 | void addGate(); | ||
66 | void setPoint( int point ); | 77 | void setPoint( int point ); |
@@ -70,2 +81,5 @@ public: | |||
70 | 81 | ||
82 | void displayMenu(); | ||
83 | void dealWithMenuSelection(); | ||
84 | |||
71 | void keyPressEvent( QKeyEvent *e ); | 85 | void keyPressEvent( QKeyEvent *e ); |