-rw-r--r-- | noncore/games/sfcave/helpwindow.cpp | 77 | ||||
-rw-r--r-- | noncore/games/sfcave/helpwindow.h | 4 | ||||
-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 7 |
3 files changed, 42 insertions, 46 deletions
diff --git a/noncore/games/sfcave/helpwindow.cpp b/noncore/games/sfcave/helpwindow.cpp index 8a5d034..bd6035a 100644 --- a/noncore/games/sfcave/helpwindow.cpp +++ b/noncore/games/sfcave/helpwindow.cpp | |||
@@ -1,79 +1,76 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | helpwindow.cpp - description | 2 | helpwindow.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Sun Sep 8 2002 | 4 | begin : Sun Sep 8 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <qlayout.h> | 18 | #include <qlayout.h> |
19 | #include <qtextview.h> | 19 | #include <qtextview.h> |
20 | 20 | ||
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | 22 | ||
23 | #include "helpwindow.h" | 23 | #include "helpwindow.h" |
24 | 24 | ||
25 | 25 | ||
26 | #define HELP_TEXT \ | 26 | static QString HELP_TEXT() { |
27 | "<qt><h1>SFCave Help</h1><p> " \ | 27 | return QObject::tr("<qt><h1>SFCave Help</h1><p> " |
28 | "SFCave is a flying game for the Zaurus.<br><br> " \ | 28 | "SFCave is a flying game for the Zaurus.<br><br> " |
29 | "The aim is to stay alive for as long as possible and get the highest score " \ | 29 | "The aim is to stay alive for as long as possible and get the highest score " |
30 | "you can.<br><br>" \ | 30 | "you can.<br><br>" |
31 | "There are three game types currently - SFCave, Gates, and Fly.<br>" \ | 31 | "There are three game types currently - SFCave, Gates, and Fly.<br>" |
32 | "<b>SFCave</b> is a remake of the classic SFCave game - fly through the " \ | 32 | "<b>SFCave</b> is a remake of the classic SFCave game - fly through the " |
33 | "cavern avoiding all the blocks that just happen to be hanging in " \ | 33 | "cavern avoiding all the blocks that just happen to be hanging in " |
34 | "midair<br><br>" \ | 34 | "midair<br><br>" |
35 | "<b>Gates</b> is similar to SFCave but instead you must fly through the " \ | 35 | "<b>Gates</b> is similar to SFCave but instead you must fly through the " |
36 | "without crashing.<br><br>" \ | 36 | "without crashing.<br><br>" |
37 | "<b>Fly</b> is somewhat different to SFCave and above. Instead, you have " \ | 37 | "<b>Fly</b> is somewhat different to SFCave and above. Instead, you have " |
38 | "are flying in the open air above a scrolling landscape, and the aim is to " \ | 38 | "are flying in the open air above a scrolling landscape, and the aim is to " |
39 | "hug the ground - the closer to the land you fly the more points " \ | 39 | "hug the ground - the closer to the land you fly the more points " |
40 | "scored.<br><br><br>" \ | 40 | "scored.<br><br><br>" |
41 | "Basic instruction - Press <b>Up</B> or <b>Down</b> on the circle pad to " \ | 41 | "Basic instruction - Press <b>Up</B> or <b>Down</b> on the circle pad to " |
42 | "start a new game, press the middle of the pad to apply thrust (makes you " \ | 42 | "start a new game, press the middle of the pad to apply thrust (makes you " |
43 | "go up), and release the pad to remove thrust and drop down.<br><br>" \ | 43 | "go up), and release the pad to remove thrust and drop down.<br><br>" |
44 | "Also, if playing the Fly game, you can press z to toggle the display " \ | 44 | "Also, if playing the Fly game, you can press z to toggle the display " |
45 | "of the scoring zones. This will display 4 red lines at varying heights " \ | 45 | "of the scoring zones. This will display 4 red lines at varying heights " |
46 | "above the landscape - if your ship falls into this zone, point are scored. " \ | 46 | "above the landscape - if your ship falls into this zone, point are scored. " |
47 | "The closer to the landscape you get the more points you get.<br><br>" \ | 47 | "The closer to the landscape you get the more points you get.<br><br>" |
48 | "In addition, SFCave has replays - save and load too so you can show off to all " \ | 48 | "In addition, SFCave has replays - save and load too so you can show off to all " |
49 | "your friends (or vice versa). Currently, this is in its infancy but will improve.<br>" \ | 49 | "your friends (or vice versa). Currently, this is in its infancy but will improve.<br>" |
50 | "To use, once you have crashed, press 'r' to replay the last game.<br>" \ | 50 | "To use, once you have crashed, press 'r' to replay the last game.<br>" |
51 | "To save the replay press 's'.<br>" \ | 51 | "To save the replay press 's'.<br>" |
52 | "To load a saved replay press 'l' (after you've crashed at least once).<br><br>" \ | 52 | "To load a saved replay press 'l' (after you've crashed at least once).<br><br>" |
53 | "Replays are currently saved to your home directory in a file called sfcave.replay." \ | 53 | "Replays are currently saved to your home directory in a file called sfcave.replay." |
54 | "This file can be copied and given to others as long as it it put in their home directory.<br><br>" \ | 54 | "This file can be copied and given to others as long as it it put in their home directory.<br><br>" |
55 | "Have lots of fun.<br>" \ | 55 | "Have lots of fun.<br>" |
56 | "Andy" \ | 56 | "Andy" |
57 | "</p></qt>" | 57 | "</p></qt>"); |
58 | } | ||
58 | 59 | ||
59 | 60 | ||
60 | HelpWindow::HelpWindow( QWidget *parent, const char *name, bool modal, WFlags flags ) | 61 | HelpWindow::HelpWindow( QWidget *parent, const char *name) |
61 | : QDialog( parent, name, modal, flags ) | 62 | : QWidget( parent, name, WDestructiveClose ) |
62 | { | 63 | { |
63 | // resize( 230, 280 ); | 64 | setCaption( tr("Help for SFCave") ); |
64 | |||
65 | setCaption( "Help for SFCave" ); | ||
66 | 65 | ||
67 | QVBoxLayout *layout = new QVBoxLayout( this ); | 66 | QVBoxLayout *layout = new QVBoxLayout( this ); |
68 | QString text = HELP_TEXT;; | 67 | QString text = HELP_TEXT();; |
69 | QTextView *view = new QTextView( text, 0, this, "view" ); | 68 | QTextView *view = new QTextView( text, 0, this, "view" ); |
70 | layout->insertSpacing( -1, 5 ); | 69 | layout->insertSpacing( -1, 5 ); |
71 | layout->insertWidget( -1, view ); | 70 | layout->insertWidget( -1, view ); |
72 | layout->insertSpacing( -1, 5 ); | 71 | layout->insertSpacing( -1, 5 ); |
73 | |||
74 | QPEApplication::showDialog( this ); | ||
75 | } | 72 | } |
76 | 73 | ||
77 | HelpWindow::~HelpWindow() | 74 | HelpWindow::~HelpWindow() |
78 | { | 75 | { |
79 | } | 76 | } |
diff --git a/noncore/games/sfcave/helpwindow.h b/noncore/games/sfcave/helpwindow.h index edc1b6e..0aaba7e 100644 --- a/noncore/games/sfcave/helpwindow.h +++ b/noncore/games/sfcave/helpwindow.h | |||
@@ -1,34 +1,34 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | helpwindow.h - description | 2 | helpwindow.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Sun Sep 8 2002 | 4 | begin : Sun Sep 8 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef HELPWINDOW_H | 18 | #ifndef HELPWINDOW_H |
19 | #define HELPWINDOW_H | 19 | #define HELPWINDOW_H |
20 | 20 | ||
21 | #include <qdialog.h> | 21 | #include <qdialog.h> |
22 | 22 | ||
23 | /** | 23 | /** |
24 | *@author Andy Qua | 24 | *@author Andy Qua |
25 | */ | 25 | */ |
26 | 26 | ||
27 | class HelpWindow : public QDialog | 27 | class HelpWindow : public QWidget |
28 | { | 28 | { |
29 | public: | 29 | public: |
30 | HelpWindow( QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags flags = 0 ); | 30 | HelpWindow( QWidget *parent = 0, const char *name = 0); |
31 | ~HelpWindow(); | 31 | ~HelpWindow(); |
32 | }; | 32 | }; |
33 | 33 | ||
34 | #endif | 34 | #endif |
diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index d5aa38a..a6c92a0 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp | |||
@@ -1,106 +1,106 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <math.h> | 3 | #include <math.h> |
4 | #include <time.h> | 4 | #include <time.h> |
5 | 5 | ||
6 | #include <opie2/oapplicationfactory.h> | 6 | #include <opie2/oapplicationfactory.h> |
7 | #include <qpe/qpeapplication.h> | ||
7 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
8 | #include <qpe/global.h> | 9 | #include <qpe/global.h> |
9 | 10 | ||
10 | #include <qapplication.h> | ||
11 | #include <qdir.h> | 11 | #include <qdir.h> |
12 | 12 | ||
13 | #include "helpwindow.h" | 13 | #include "helpwindow.h" |
14 | #include "sfcave.h" | 14 | #include "sfcave.h" |
15 | 15 | ||
16 | #define CAPTION "SFCave 1.13 by AndyQ" | 16 | #define CAPTION "SFCave 1.13 by AndyQ" |
17 | 17 | ||
18 | #define UP_THRUST 0.6 | 18 | #define UP_THRUST 0.6 |
19 | #define NO_THRUST 0.8 | 19 | #define NO_THRUST 0.8 |
20 | #define MAX_DOWN_THRUST 4.0 | 20 | #define MAX_DOWN_THRUST 4.0 |
21 | #define MAX_UP_THRUST -3.5 | 21 | #define MAX_UP_THRUST -3.5 |
22 | 22 | ||
23 | // States | 23 | // States |
24 | #define STATE_BOSS 0 | 24 | #define STATE_BOSS 0 |
25 | #define STATE_RUNNING 1 | 25 | #define STATE_RUNNING 1 |
26 | #define STATE_CRASHING 2 | 26 | #define STATE_CRASHING 2 |
27 | #define STATE_CRASHED 3 | 27 | #define STATE_CRASHED 3 |
28 | #define STATE_NEWGAME 4 | 28 | #define STATE_NEWGAME 4 |
29 | #define STATE_MENU 5 | 29 | #define STATE_MENU 5 |
30 | #define STATE_REPLAY 6 | 30 | #define STATE_REPLAY 6 |
31 | 31 | ||
32 | // Menus | 32 | // Menus |
33 | #define MENU_MAIN_MENU 0 | 33 | #define MENU_MAIN_MENU 0 |
34 | #define MENU_OPTIONS_MENU 1 | 34 | #define MENU_OPTIONS_MENU 1 |
35 | #define MENU_REPLAY_MENU 2 | 35 | #define MENU_REPLAY_MENU 2 |
36 | 36 | ||
37 | // Main Menu Options | 37 | // Main Menu Options |
38 | #define MENU_START_GAME 0 | 38 | #define MENU_START_GAME 0 |
39 | #define MENU_REPLAY 1 | 39 | #define MENU_REPLAY 1 |
40 | #define MENU_OPTIONS 2 | 40 | #define MENU_OPTIONS 2 |
41 | #define MENU_HELP 3 | 41 | #define MENU_HELP 3 |
42 | #define MENU_QUIT 4 | 42 | #define MENU_QUIT 4 |
43 | 43 | ||
44 | // Option Menu Options | 44 | // Option Menu Options |
45 | #define MENU_GAME_TYPE 0 | 45 | #define MENU_GAME_TYPE 0 |
46 | #define MENU_GAME_DIFFICULTY 1 | 46 | #define MENU_GAME_DIFFICULTY 1 |
47 | #define MENU_CLEAR_HIGHSCORES 2 | 47 | #define MENU_CLEAR_HIGHSCORES 2 |
48 | #define MENU_BACK 3 | 48 | #define MENU_BACK 3 |
49 | 49 | ||
50 | // Replay Menu Options | 50 | // Replay Menu Options |
51 | #define MENU_REPLAY_START 0 | 51 | #define MENU_REPLAY_START 0 |
52 | #define MENU_REPLAY_LOAD 1 | 52 | #define MENU_REPLAY_LOAD 1 |
53 | #define MENU_REPLAY_SAVE 2 | 53 | #define MENU_REPLAY_SAVE 2 |
54 | #define MENU_REPLAY_BACK 3 | 54 | #define MENU_REPLAY_BACK 3 |
55 | 55 | ||
56 | 56 | ||
57 | #define NR_GAME_DIFFICULTIES 3 | 57 | #define NR_GAME_DIFFICULTIES 3 |
58 | #define NR_GAME_TYPES 3 | 58 | #define NR_GAME_TYPES 3 |
59 | 59 | ||
60 | #define DIFICULTY_EASY 0 | 60 | #define DIFICULTY_EASY 0 |
61 | #define DIFICULTY_NORMAL 1 | 61 | #define DIFICULTY_NORMAL 1 |
62 | #define DIFICULTY_HARD 2 | 62 | #define DIFICULTY_HARD 2 |
63 | #define EASY "Easy" | 63 | #define EASY "Easy" |
64 | #define NORMAL "Normal" | 64 | #define NORMAL "Normal" |
65 | #define HARD "Hard" | 65 | #define HARD "Hard" |
66 | 66 | ||
67 | #define SFCAVE_GAME_TYPE 0 | 67 | #define SFCAVE_GAME_TYPE 0 |
68 | #define GATES_GAME_TYPE 1 | 68 | #define GATES_GAME_TYPE 1 |
69 | #define FLY_GAME_TYPE 2 | 69 | #define FLY_GAME_TYPE 2 |
70 | #define SFCAVE_GAME "SFCave" | 70 | #define SFCAVE_GAME "SFCave" |
71 | #define GATES_GAME "Gates" | 71 | #define GATES_GAME "Gates" |
72 | #define FLY_GAME "Fly" | 72 | #define FLY_GAME "Fly" |
73 | #define CURRENT_GAME_TYPE gameTypes[currentGameType] | 73 | #define CURRENT_GAME_TYPE gameTypes[currentGameType] |
74 | #define CURRENT_GAME_DIFFICULTY difficultyOption[currentGameDifficulty]; | 74 | #define CURRENT_GAME_DIFFICULTY difficultyOption[currentGameDifficulty]; |
75 | 75 | ||
76 | QString SFCave::dificultyOption[] = { EASY, NORMAL, HARD }; | 76 | QString SFCave::dificultyOption[] = { EASY, NORMAL, HARD }; |
77 | QString SFCave::gameTypes[] = { SFCAVE_GAME, GATES_GAME, FLY_GAME }; | 77 | QString SFCave::gameTypes[] = { SFCAVE_GAME, GATES_GAME, FLY_GAME }; |
78 | 78 | ||
79 | QString SFCave::menuOptions[NR_MENUS][MAX_MENU_OPTIONS] = { { "Start Game", "Replays", "Options", "Help", "Quit", "", "", "" }, | 79 | QString SFCave::menuOptions[NR_MENUS][MAX_MENU_OPTIONS] = { { "Start Game", "Replays", "Options", "Help", "Quit", "", "", "" }, |
80 | { "Game Type - %s", "Game Difficulty - %s", "Clear High Scores for this game", "Back", "", "", "", "" }, | 80 | { "Game Type - %s", "Game Difficulty - %s", "Clear High Scores for this game", "Back", "", "", "", "" }, |
81 | { "Play Reply", "Load Replay", "Save Replay", "Back", "", "", "", "" } }; | 81 | { "Play Reply", "Load Replay", "Save Replay", "Back", "", "", "", "" } }; |
82 | 82 | ||
83 | int SFCave::nrMenuOptions[NR_MENUS] = { 5, 4, 4 }; | 83 | int SFCave::nrMenuOptions[NR_MENUS] = { 5, 4, 4 }; |
84 | int SFCave ::currentMenuOption[NR_MENUS] = { 0, 0, 0 }; | 84 | int SFCave ::currentMenuOption[NR_MENUS] = { 0, 0, 0 }; |
85 | 85 | ||
86 | #define UP_THRUST 0.6 | 86 | #define UP_THRUST 0.6 |
87 | #define NO_THRUST 0.8 | 87 | #define NO_THRUST 0.8 |
88 | #define MAX_DOWN_THRUST 4.0 | 88 | #define MAX_DOWN_THRUST 4.0 |
89 | #define MAX_UP_THRUST -3.5 | 89 | #define MAX_UP_THRUST -3.5 |
90 | double SFCave::UpThrustVals[3][3] = {{ 0.6, 0.6, 0.6 }, // SFCave | 90 | double SFCave::UpThrustVals[3][3] = {{ 0.6, 0.6, 0.6 }, // SFCave |
91 | { 0.6, 0.6, 0.8 }, // Gates | 91 | { 0.6, 0.6, 0.8 }, // Gates |
92 | { 0.4, 0.7, 1.0 } }; // Fly | 92 | { 0.4, 0.7, 1.0 } }; // Fly |
93 | 93 | ||
94 | double SFCave::DownThrustVals[3][3] = {{ 0.8, 0.8, 0.8 }, // SFCave | 94 | double SFCave::DownThrustVals[3][3] = {{ 0.8, 0.8, 0.8 }, // SFCave |
95 | { 0.8, 0.8, 1.0 }, // Gates | 95 | { 0.8, 0.8, 1.0 }, // Gates |
96 | { 0.4, 0.7, 1.0 } }; // Fly | 96 | { 0.4, 0.7, 1.0 } }; // Fly |
97 | 97 | ||
98 | double SFCave::MaxUpThrustVals[3][3] = {{ -3.5, -3.5, -3.5 }, // SFCave | 98 | double SFCave::MaxUpThrustVals[3][3] = {{ -3.5, -3.5, -3.5 }, // SFCave |
99 | { -3.5, -4.0, -5.0 }, // Gates | 99 | { -3.5, -4.0, -5.0 }, // Gates |
100 | { -3.5, -4.0, -5.0 } }; // Fly | 100 | { -3.5, -4.0, -5.0 } }; // Fly |
101 | 101 | ||
102 | double SFCave::MaxDownThrustVals[3][3] = {{ 4.0, 4.0, 4.0 }, // SFCave | 102 | double SFCave::MaxDownThrustVals[3][3] = {{ 4.0, 4.0, 4.0 }, // SFCave |
103 | { 4.0, 5.0, 5.5 }, // Gates | 103 | { 4.0, 5.0, 5.5 }, // Gates |
104 | { 3.5, 4.0, 5.0 } }; // Fly | 104 | { 3.5, 4.0, 5.0 } }; // Fly |
105 | 105 | ||
106 | int SFCave::flyEasyScores[7][3] = { { 0, 10, 5 }, | 106 | int SFCave::flyEasyScores[7][3] = { { 0, 10, 5 }, |
@@ -1046,167 +1046,166 @@ void SFCave :: handleMenuKeys( QKeyEvent *e ) | |||
1046 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) | 1046 | if ( currentMenuOption[currentMenuNr] == MENU_GAME_TYPE ) |
1047 | { | 1047 | { |
1048 | currentGameType ++; | 1048 | currentGameType ++; |
1049 | if ( currentGameType == NR_GAME_TYPES ) | 1049 | if ( currentGameType == NR_GAME_TYPES ) |
1050 | currentGameType = 0; | 1050 | currentGameType = 0; |
1051 | } | 1051 | } |
1052 | else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY ) | 1052 | else if ( currentMenuOption[currentMenuNr] == MENU_GAME_DIFFICULTY ) |
1053 | { | 1053 | { |
1054 | currentGameDifficulty ++; | 1054 | currentGameDifficulty ++; |
1055 | if ( currentGameDifficulty == NR_GAME_DIFFICULTIES ) | 1055 | if ( currentGameDifficulty == NR_GAME_DIFFICULTIES ) |
1056 | currentGameDifficulty = 0; | 1056 | currentGameDifficulty = 0; |
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | break; | 1059 | break; |
1060 | 1060 | ||
1061 | case Qt::Key_Space: | 1061 | case Qt::Key_Space: |
1062 | case Qt::Key_Return: | 1062 | case Qt::Key_Return: |
1063 | case Qt::Key_Enter: | 1063 | case Qt::Key_Enter: |
1064 | dealWithMenuSelection(); | 1064 | dealWithMenuSelection(); |
1065 | break; | 1065 | break; |
1066 | } | 1066 | } |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | void SFCave :: displayMenu() | 1069 | void SFCave :: displayMenu() |
1070 | { | 1070 | { |
1071 | offscreen->fill( Qt::black ); | 1071 | offscreen->fill( Qt::black ); |
1072 | 1072 | ||
1073 | QPainter p( offscreen ); | 1073 | QPainter p( offscreen ); |
1074 | p.setPen( Qt::white ); | 1074 | p.setPen( Qt::white ); |
1075 | 1075 | ||
1076 | QFont f( "Helvetica", 16 ); | 1076 | QFont f( "Helvetica", 16 ); |
1077 | p.setFont( f ); | 1077 | p.setFont( f ); |
1078 | 1078 | ||
1079 | QFontMetrics fm = p.fontMetrics(); | 1079 | QFontMetrics fm = p.fontMetrics(); |
1080 | 1080 | ||
1081 | QString text = "SFCave"; | 1081 | QString text = "SFCave"; |
1082 | p.drawText( (sWidth/2) - (fm.width( text )/2), 60, text ); | 1082 | p.drawText( (sWidth/2) - (fm.width( text )/2), 60, text ); |
1083 | 1083 | ||
1084 | text = "Written by Andy Qua"; | 1084 | text = "Written by Andy Qua"; |
1085 | p.drawText( (sWidth/2) - (fm.width( text )/2), 85, text ); | 1085 | p.drawText( (sWidth/2) - (fm.width( text )/2), 85, text ); |
1086 | 1086 | ||
1087 | // Draw options | 1087 | // Draw options |
1088 | int pos = 140; | 1088 | int pos = 140; |
1089 | for ( int i = 0 ; menuOptions[currentMenuNr][i] != "" ; ++i, pos += 25 ) | 1089 | for ( int i = 0 ; menuOptions[currentMenuNr][i] != "" ; ++i, pos += 25 ) |
1090 | { | 1090 | { |
1091 | if ( currentMenuOption[currentMenuNr] == i ) | 1091 | if ( currentMenuOption[currentMenuNr] == i ) |
1092 | p.setPen( Qt::yellow ); | 1092 | p.setPen( Qt::yellow ); |
1093 | else | 1093 | else |
1094 | p.setPen( Qt::white ); | 1094 | p.setPen( Qt::white ); |
1095 | 1095 | ||
1096 | QString text; | 1096 | QString text; |
1097 | if ( menuOptions[currentMenuNr][i].find( "%s" ) != -1 ) | 1097 | if ( menuOptions[currentMenuNr][i].find( "%s" ) != -1 ) |
1098 | { | 1098 | { |
1099 | QString val; | 1099 | QString val; |
1100 | if ( i == MENU_GAME_TYPE ) | 1100 | if ( i == MENU_GAME_TYPE ) |
1101 | val = gameTypes[currentGameType]; | 1101 | val = gameTypes[currentGameType]; |
1102 | else | 1102 | else |
1103 | val = dificultyOption[currentGameDifficulty]; | 1103 | val = dificultyOption[currentGameDifficulty]; |
1104 | 1104 | ||
1105 | text.sprintf( (const char *)menuOptions[currentMenuNr][i], (const char *)val ); | 1105 | text.sprintf( (const char *)menuOptions[currentMenuNr][i], (const char *)val ); |
1106 | } | 1106 | } |
1107 | else | 1107 | else |
1108 | text = menuOptions[currentMenuNr][i]; | 1108 | text = menuOptions[currentMenuNr][i]; |
1109 | 1109 | ||
1110 | p.drawText( (sWidth/2) - (fm.width( text )/2), pos, text ); | 1110 | p.drawText( (sWidth/2) - (fm.width( text )/2), pos, text ); |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | p.end(); | 1113 | p.end(); |
1114 | bitBlt( this, 0, 0, offscreen, 0, 0, sWidth, sHeight, Qt::CopyROP, true ); | 1114 | bitBlt( this, 0, 0, offscreen, 0, 0, sWidth, sHeight, Qt::CopyROP, true ); |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | void SFCave :: dealWithMenuSelection() | 1117 | void SFCave :: dealWithMenuSelection() |
1118 | { | 1118 | { |
1119 | switch( currentMenuNr ) | 1119 | switch( currentMenuNr ) |
1120 | { | 1120 | { |
1121 | case MENU_MAIN_MENU: | 1121 | case MENU_MAIN_MENU: |
1122 | { | 1122 | { |
1123 | switch( currentMenuOption[currentMenuNr] ) | 1123 | switch( currentMenuOption[currentMenuNr] ) |
1124 | { | 1124 | { |
1125 | case MENU_START_GAME: | 1125 | case MENU_START_GAME: |
1126 | state = STATE_NEWGAME; | 1126 | state = STATE_NEWGAME; |
1127 | break; | 1127 | break; |
1128 | 1128 | ||
1129 | case MENU_REPLAY: | 1129 | case MENU_REPLAY: |
1130 | currentMenuNr = MENU_REPLAY_MENU; | 1130 | currentMenuNr = MENU_REPLAY_MENU; |
1131 | currentMenuOption[currentMenuNr] = 0; | 1131 | currentMenuOption[currentMenuNr] = 0; |
1132 | break; | 1132 | break; |
1133 | 1133 | ||
1134 | case MENU_OPTIONS: | 1134 | case MENU_OPTIONS: |
1135 | currentMenuNr = MENU_OPTIONS_MENU; | 1135 | currentMenuNr = MENU_OPTIONS_MENU; |
1136 | currentMenuOption[currentMenuNr] = 0; | 1136 | currentMenuOption[currentMenuNr] = 0; |
1137 | break; | 1137 | break; |
1138 | 1138 | ||
1139 | case MENU_HELP: | 1139 | case MENU_HELP: |
1140 | { | 1140 | { |
1141 | // Display Help Menu | 1141 | // Display Help Menu |
1142 | HelpWindow *dlg = new HelpWindow( this ); | 1142 | HelpWindow *win = new HelpWindow( ); |
1143 | dlg->exec(); | 1143 | QPEApplication::showWidget( win ); |
1144 | delete dlg; | ||
1145 | break; | 1144 | break; |
1146 | } | 1145 | } |
1147 | 1146 | ||
1148 | case MENU_QUIT: | 1147 | case MENU_QUIT: |
1149 | QApplication::exit(); | 1148 | QApplication::exit(); |
1150 | break; | 1149 | break; |
1151 | } | 1150 | } |
1152 | 1151 | ||
1153 | break; | 1152 | break; |
1154 | } | 1153 | } |
1155 | 1154 | ||
1156 | case MENU_OPTIONS_MENU: | 1155 | case MENU_OPTIONS_MENU: |
1157 | { | 1156 | { |
1158 | switch( currentMenuOption[currentMenuNr] ) | 1157 | switch( currentMenuOption[currentMenuNr] ) |
1159 | { | 1158 | { |
1160 | case MENU_GAME_TYPE: | 1159 | case MENU_GAME_TYPE: |
1161 | break; | 1160 | break; |
1162 | 1161 | ||
1163 | case MENU_GAME_DIFFICULTY: | 1162 | case MENU_GAME_DIFFICULTY: |
1164 | break; | 1163 | break; |
1165 | 1164 | ||
1166 | case MENU_CLEAR_HIGHSCORES: | 1165 | case MENU_CLEAR_HIGHSCORES: |
1167 | for ( int i = 0 ; i < 3 ; ++i ) | 1166 | for ( int i = 0 ; i < 3 ; ++i ) |
1168 | highestScore[currentGameType][i] = 0; | 1167 | highestScore[currentGameType][i] = 0; |
1169 | break; | 1168 | break; |
1170 | 1169 | ||
1171 | case MENU_BACK: | 1170 | case MENU_BACK: |
1172 | currentMenuNr = MENU_MAIN_MENU; | 1171 | currentMenuNr = MENU_MAIN_MENU; |
1173 | 1172 | ||
1174 | #ifdef QWS | 1173 | #ifdef QWS |
1175 | Config cfg( "sfcave" ); | 1174 | Config cfg( "sfcave" ); |
1176 | cfg.setGroup( "settings" ); | 1175 | cfg.setGroup( "settings" ); |
1177 | cfg.writeEntry( "difficulty", currentGameDifficulty ); | 1176 | cfg.writeEntry( "difficulty", currentGameDifficulty ); |
1178 | cfg.writeEntry( "gameType", currentGameType ); | 1177 | cfg.writeEntry( "gameType", currentGameType ); |
1179 | #endif | 1178 | #endif |
1180 | break; | 1179 | break; |
1181 | } | 1180 | } |
1182 | 1181 | ||
1183 | break; | 1182 | break; |
1184 | } | 1183 | } |
1185 | 1184 | ||
1186 | case MENU_REPLAY_MENU: | 1185 | case MENU_REPLAY_MENU: |
1187 | { | 1186 | { |
1188 | switch( currentMenuOption[currentMenuNr] ) | 1187 | switch( currentMenuOption[currentMenuNr] ) |
1189 | { | 1188 | { |
1190 | case MENU_REPLAY_START: | 1189 | case MENU_REPLAY_START: |
1191 | if ( currentSeed != 0 ) | 1190 | if ( currentSeed != 0 ) |
1192 | state = STATE_REPLAY; | 1191 | state = STATE_REPLAY; |
1193 | // Display No Replay | 1192 | // Display No Replay |
1194 | break; | 1193 | break; |
1195 | 1194 | ||
1196 | case MENU_REPLAY_LOAD: | 1195 | case MENU_REPLAY_LOAD: |
1197 | loadReplay(); | 1196 | loadReplay(); |
1198 | break; | 1197 | break; |
1199 | 1198 | ||
1200 | case MENU_REPLAY_SAVE: | 1199 | case MENU_REPLAY_SAVE: |
1201 | saveReplay(); | 1200 | saveReplay(); |
1202 | break; | 1201 | break; |
1203 | 1202 | ||
1204 | case MENU_REPLAY_BACK: | 1203 | case MENU_REPLAY_BACK: |
1205 | currentMenuNr = MENU_MAIN_MENU; | 1204 | currentMenuNr = MENU_MAIN_MENU; |
1206 | break; | 1205 | break; |
1207 | 1206 | ||
1208 | } | 1207 | } |
1209 | } | 1208 | } |
1210 | } | 1209 | } |
1211 | } | 1210 | } |
1212 | 1211 | ||