blob: 65e5ae409746c78b6a9c422211c21d0558c7a0d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#include <qmainwindow.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qpoint.h>
#include <qrect.h>
#include <qtimer.h>
#include <qlist.h>
#include "random.h"
#define MAPSIZE 52
#define BLOCKSIZE 6
#define TRAILSIZE 30
#define NR_MENUS 3
#define MAX_MENU_OPTIONS 8
class SFCave : public QMainWindow
{
Q_OBJECT
public:
int sWidth;
int sHeight;
int segSize;
int currentSeed;
QList<int> replayList;
QListIterator<int> *replayIt;
bool replay;
QString replayFile;
int blockWidth;
int blockHeight;
int gapHeight;
int state;
int prevState;
int speed;
int crashLineLength;
static double UpThrustVals[3][3];
static double DownThrustVals[3][3];
static double MaxUpThrustVals[3][3];
static double MaxDownThrustVals[3][3];
static int initialGateGaps[];
double thrustUp;
double noThrust;
double maxUpThrust;
double maxDownThrust;
int gateDistance;
int nextGate;
int lastGateBottomY;
static QString menuOptions[NR_MENUS][MAX_MENU_OPTIONS];
int currentMenuNr;
static int nrMenuOptions[NR_MENUS];
static int currentMenuOption[NR_MENUS];
static QString dificultyOption[3];
static QString gameTypes[3];
int currentGameType;
int currentGameDifficulty;
QPixmap *offscreen;
QTimer *gameTimer;
int score;
int highestScore[3][3];
int mapTop[MAPSIZE];
int mapBottom[MAPSIZE];
QRect blocks[BLOCKSIZE];
QRect user;
QPoint trail[TRAILSIZE];
int offset;
int maxHeight;
int nrFrames;
int dir;
bool showScoreZones;
bool press;
double thrust;
bool running;
SFCave( int speed = 3, QWidget *p = 0, char *name = 0 );
~SFCave();
void start();
void setSeed( int seed );
int nextInt( int range );
void setUp();
void handleGameSFCave();
void handleGameGates();
void handleGameFly();
bool checkFlyGameCollision();
void moveFlyGameLandscape();
void setFlyPoint( int point );
bool checkCollision();
void moveLandscape();
void addBlock();
void addGate();
void setPoint( int point );
void drawBoss();
void draw();
void handleKeys();
void handleMenuKeys( QKeyEvent * e );
void displayMenu();
void dealWithMenuSelection();
void keyPressEvent( QKeyEvent *e );
void keyReleaseEvent( QKeyEvent *e );
void saveScore();
void saveReplay();
void loadReplay();
private slots:
void run();
};
|