summaryrefslogtreecommitdiff
authorandyq <andyq>2002-12-11 17:48:40 (UTC)
committer andyq <andyq>2002-12-11 17:48:40 (UTC)
commit483e550c75f935706fde4e0ca29c4486aeca09a0 (patch) (unidiff)
tree6312a2b87905296622cd7464bd0e286924eefaf9
parentd3d49c3022d763157a3c8309ddc5b9ce4ecde61a (diff)
downloadopie-483e550c75f935706fde4e0ca29c4486aeca09a0.zip
opie-483e550c75f935706fde4e0ca29c4486aeca09a0.tar.gz
opie-483e550c75f935706fde4e0ca29c4486aeca09a0.tar.bz2
Added new methods and members for replay loading and saving
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/sfcave/sfcave.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/games/sfcave/sfcave.h b/noncore/games/sfcave/sfcave.h
index 0d9a626..238a615 100644
--- a/noncore/games/sfcave/sfcave.h
+++ b/noncore/games/sfcave/sfcave.h
@@ -1,118 +1,121 @@
1#include <qmainwindow.h> 1#include <qmainwindow.h>
2#include <qpainter.h> 2#include <qpainter.h>
3#include <qpixmap.h> 3#include <qpixmap.h>
4#include <qpoint.h> 4#include <qpoint.h>
5#include <qrect.h> 5#include <qrect.h>
6#include <qtimer.h> 6#include <qtimer.h>
7#include <qlist.h> 7#include <qlist.h>
8 8
9#include "random.h" 9#include "random.h"
10 10
11#define MAPSIZE 52 11#define MAPSIZE 52
12#define BLOCKSIZE 6 12#define BLOCKSIZE 6
13#define TRAILSIZE 30 13#define TRAILSIZE 30
14 14
15 15
16 16
17class SFCave : public QMainWindow 17class SFCave : public QMainWindow
18{ 18{
19Q_OBJECT 19Q_OBJECT
20 20
21public: 21public:
22 int sWidth; 22 int sWidth;
23 int sHeight; 23 int sHeight;
24 int segSize; 24 int segSize;
25 25
26 int currentSeed; 26 int currentSeed;
27 27
28 QList<int> replayList; 28 QList<int> replayList;
29 QListIterator<int> *replayIt; 29 QListIterator<int> *replayIt;
30 bool replay; 30 bool replay;
31 QString replayFile;
31 32
32 int blockWidth; 33 int blockWidth;
33 int blockHeight; 34 int blockHeight;
34 int gapHeight; 35 int gapHeight;
35 int state; 36 int state;
36 int prevState; 37 int prevState;
37 int speed; 38 int speed;
38 int crashLineLength; 39 int crashLineLength;
39 40
40 static double UpThrustVals[3][3]; 41 static double UpThrustVals[3][3];
41 static double DownThrustVals[3][3]; 42 static double DownThrustVals[3][3];
42 static double MaxUpThrustVals[3][3]; 43 static double MaxUpThrustVals[3][3];
43 static double MaxDownThrustVals[3][3]; 44 static double MaxDownThrustVals[3][3];
44 static int initialGateGaps[]; 45 static int initialGateGaps[];
45 46
46 double thrustUp; 47 double thrustUp;
47 double noThrust; 48 double noThrust;
48 double maxUpThrust; 49 double maxUpThrust;
49 double maxDownThrust; 50 double maxDownThrust;
50 51
51 int gateDistance; 52 int gateDistance;
52 int nextGate; 53 int nextGate;
53 int lastGateBottomY; 54 int lastGateBottomY;
54 55
55 static QString menuOptions[2][5]; 56 static QString menuOptions[2][5];
56 int currentMenuNr; 57 int currentMenuNr;
57 static int nrMenuOptions[2]; 58 static int nrMenuOptions[2];
58 static int currentMenuOption[2]; 59 static int currentMenuOption[2];
59 60
60 static QString dificultyOption[3]; 61 static QString dificultyOption[3];
61 static QString gameTypes[3]; 62 static QString gameTypes[3];
62 int currentGameType; 63 int currentGameType;
63 int currentGameDifficulty; 64 int currentGameDifficulty;
64 65
65 QPixmap *offscreen; 66 QPixmap *offscreen;
66 QTimer *gameTimer; 67 QTimer *gameTimer;
67 68
68 int score; 69 int score;
69 int highestScore[3][3]; 70 int highestScore[3][3];
70 71
71 int mapTop[MAPSIZE]; 72 int mapTop[MAPSIZE];
72 int mapBottom[MAPSIZE]; 73 int mapBottom[MAPSIZE];
73 QRect blocks[BLOCKSIZE]; 74 QRect blocks[BLOCKSIZE];
74 QRect user; 75 QRect user;
75 QPoint trail[TRAILSIZE]; 76 QPoint trail[TRAILSIZE];
76 77
77 int offset; 78 int offset;
78 int maxHeight; 79 int maxHeight;
79 int nrFrames; 80 int nrFrames;
80 int dir; 81 int dir;
81 82
82 bool showScoreZones; 83 bool showScoreZones;
83 84
84 bool press; 85 bool press;
85 double thrust; 86 double thrust;
86 bool running; 87 bool running;
87 88
88 SFCave( int speed = 3, QWidget *p = 0, char *name = 0 ); 89 SFCave( int speed = 3, QWidget *p = 0, char *name = 0 );
89 ~SFCave(); 90 ~SFCave();
90 void start(); 91 void start();
91 void setSeed( int seed ); 92 void setSeed( int seed );
92 int nextInt( int range ); 93 int nextInt( int range );
93 void setUp(); 94 void setUp();
94 void handleGameSFCave(); 95 void handleGameSFCave();
95 void handleGameGates(); 96 void handleGameGates();
96 void handleGameFly(); 97 void handleGameFly();
97 bool checkFlyGameCollision(); 98 bool checkFlyGameCollision();
98 void moveFlyGameLandscape(); 99 void moveFlyGameLandscape();
99 void setFlyPoint( int point ); 100 void setFlyPoint( int point );
100 bool checkCollision(); 101 bool checkCollision();
101 void moveLandscape(); 102 void moveLandscape();
102 void addBlock(); 103 void addBlock();
103 void addGate(); 104 void addGate();
104 void setPoint( int point ); 105 void setPoint( int point );
105 void drawBoss(); 106 void drawBoss();
106 void draw(); 107 void draw();
107 void handleKeys(); 108 void handleKeys();
108 109
109 void displayMenu(); 110 void displayMenu();
110 void dealWithMenuSelection(); 111 void dealWithMenuSelection();
111 112
112 void keyPressEvent( QKeyEvent *e ); 113 void keyPressEvent( QKeyEvent *e );
113 void keyReleaseEvent( QKeyEvent *e ); 114 void keyReleaseEvent( QKeyEvent *e );
114 void saveScore(); 115 void saveScore();
116 void saveReplay();
117 void loadReplay();
115 118
116private slots: 119private slots:
117 void run(); 120 void run();
118}; 121};