author | sudonix <sudonix> | 2004-02-26 02:25:15 (UTC) |
---|---|---|
committer | sudonix <sudonix> | 2004-02-26 02:25:15 (UTC) |
commit | b339031e14a607ff18e404e0395b1c2782b92fdc (patch) (unidiff) | |
tree | ecd65299976322166ee5dfb2c30f045dd542c1e1 /noncore/games | |
parent | cb72ff620022306e493421006b024b971449f864 (diff) | |
download | opie-b339031e14a607ff18e404e0395b1c2782b92fdc.zip opie-b339031e14a607ff18e404e0395b1c2782b92fdc.tar.gz opie-b339031e14a607ff18e404e0395b1c2782b92fdc.tar.bz2 |
SDL includes corrected, CRs in some files removed, just for consistency :)
32 files changed, 35 insertions, 36 deletions
diff --git a/noncore/games/sfcave-sdl/animatedimage.cpp b/noncore/games/sfcave-sdl/animatedimage.cpp index 441c647..680b603 100644 --- a/noncore/games/sfcave-sdl/animatedimage.cpp +++ b/noncore/games/sfcave-sdl/animatedimage.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | #include "SDL.h" | 1 | #include <SDL/SDL.h> |
2 | #include "SDL_image.h" | 2 | #include <SDL/SDL_image.h> |
3 | 3 | ||
4 | #include "constants.h" | 4 | #include "constants.h" |
5 | #include "animatedimage.h" | 5 | #include "animatedimage.h" |
6 | 6 | ||
7 | AnimatedImage :: AnimatedImage( string file, int nFrames ) | 7 | AnimatedImage :: AnimatedImage( string file, int nFrames ) |
8 | { | 8 | { |
9 | nrFrames = nFrames; | 9 | nrFrames = nFrames; |
10 | currentFrame = 0; | 10 | currentFrame = 0; |
11 | 11 | ||
12 | // Load image | 12 | // Load image |
13 | image = IMG_Load( (const char *)file.c_str() ); | 13 | image = IMG_Load( (const char *)file.c_str() ); |
14 | if ( !image ) | 14 | if ( !image ) |
15 | { | 15 | { |
16 | nrFrames = 0; | 16 | nrFrames = 0; |
17 | image = 0; | 17 | image = 0; |
18 | return; | 18 | return; |
19 | } | 19 | } |
20 | 20 | ||
21 | SDL_SetColorKey(image, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB( image->format, 0, 0, 0 ) ); | 21 | SDL_SetColorKey(image, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB( image->format, 0, 0, 0 ) ); |
22 | frameWidth = image->w/nrFrames; | 22 | frameWidth = image->w/nrFrames; |
23 | frameHeight = image->h; | 23 | frameHeight = image->h; |
24 | } | 24 | } |
25 | 25 | ||
26 | AnimatedImage :: ~AnimatedImage() | 26 | AnimatedImage :: ~AnimatedImage() |
diff --git a/noncore/games/sfcave-sdl/animatedimage.h b/noncore/games/sfcave-sdl/animatedimage.h index 3c03f52..ecebf03 100644 --- a/noncore/games/sfcave-sdl/animatedimage.h +++ b/noncore/games/sfcave-sdl/animatedimage.h | |||
@@ -1,25 +1,25 @@ | |||
1 | #ifndef __ANIMATED_IMAGE_H | 1 | #ifndef __ANIMATED_IMAGE_H |
2 | #define __ANIMATED_IMAGE_H | 2 | #define __ANIMATED_IMAGE_H |
3 | 3 | ||
4 | #include "SDL.h" | 4 | #include <SDL/SDL.h> |
5 | 5 | ||
6 | class AnimatedImage | 6 | class AnimatedImage |
7 | { | 7 | { |
8 | public: | 8 | public: |
9 | AnimatedImage( string file, int nFrames ); | 9 | AnimatedImage( string file, int nFrames ); |
10 | ~AnimatedImage(); | 10 | ~AnimatedImage(); |
11 | 11 | ||
12 | bool nextFrame(); | 12 | bool nextFrame(); |
13 | void draw( SDL_Surface *screen, int x, int y ); | 13 | void draw( SDL_Surface *screen, int x, int y ); |
14 | bool AtEnd(); | 14 | bool AtEnd(); |
15 | void reset() { currentFrame = 0; } | 15 | void reset() { currentFrame = 0; } |
16 | private: | 16 | private: |
17 | 17 | ||
18 | SDL_Surface *image; | 18 | SDL_Surface *image; |
19 | int nrFrames; | 19 | int nrFrames; |
20 | int currentFrame; | 20 | int currentFrame; |
21 | 21 | ||
22 | int frameWidth; | 22 | int frameWidth; |
23 | int frameHeight; | 23 | int frameHeight; |
24 | }; | 24 | }; |
25 | #endif | 25 | #endif |
diff --git a/noncore/games/sfcave-sdl/bfont.cpp b/noncore/games/sfcave-sdl/bfont.cpp index 7dec8f5..3ba0f4f 100644 --- a/noncore/games/sfcave-sdl/bfont.cpp +++ b/noncore/games/sfcave-sdl/bfont.cpp | |||
@@ -1,36 +1,36 @@ | |||
1 | /***********************************************************/ | 1 | /***********************************************************/ |
2 | /* */ | 2 | /* */ |
3 | /* BFONT.c v. 1.0.2 - Billi Font Library by Diego Billi */ | 3 | /* BFONT.c v. 1.0.2 - Billi Font Library by Diego Billi */ |
4 | /* BFONT++ C++ port by Gianluigi Davassi */ | 4 | /* BFONT++ C++ port by Gianluigi Davassi */ |
5 | /***********************************************************/ | 5 | /***********************************************************/ |
6 | #include "iostream" | 6 | #include "iostream" |
7 | using namespace std; | 7 | using namespace std; |
8 | #include "string.h" | 8 | #include "string.h" |
9 | #include "stdlib.h" | 9 | #include "stdlib.h" |
10 | #include "stdarg.h" | 10 | #include "stdarg.h" |
11 | 11 | ||
12 | #include "SDL_image.h" | 12 | #include <SDL/SDL_image.h> |
13 | #include "bfont.h" | 13 | #include "bfont.h" |
14 | 14 | ||
15 | void BFont::InitFont() | 15 | void BFont::InitFont() |
16 | { | 16 | { |
17 | int x = 0, i = '!'; | 17 | int x = 0, i = '!'; |
18 | Uint32 sentry = GetPixel(0,0); | 18 | Uint32 sentry = GetPixel(0,0); |
19 | 19 | ||
20 | if (SDL_MUSTLOCK(Surface)) | 20 | if (SDL_MUSTLOCK(Surface)) |
21 | SDL_LockSurface(Surface); | 21 | SDL_LockSurface(Surface); |
22 | 22 | ||
23 | while ( x < (Surface->w-1)) | 23 | while ( x < (Surface->w-1)) |
24 | { | 24 | { |
25 | if(GetPixel(x,0) != sentry) | 25 | if(GetPixel(x,0) != sentry) |
26 | { | 26 | { |
27 | Chars[i].x = x; | 27 | Chars[i].x = x; |
28 | Chars[i].y = 1; | 28 | Chars[i].y = 1; |
29 | Chars[i].h = Surface->h; | 29 | Chars[i].h = Surface->h; |
30 | for (; GetPixel(x, 0) != sentry && x < (Surface->w); ++x) ; | 30 | for (; GetPixel(x, 0) != sentry && x < (Surface->w); ++x) ; |
31 | Chars[i].w = (x - Chars[i].x); | 31 | Chars[i].w = (x - Chars[i].x); |
32 | i++; | 32 | i++; |
33 | } else | 33 | } else |
34 | { x++; } | 34 | { x++; } |
35 | } | 35 | } |
36 | Chars[' '].x = 0; | 36 | Chars[' '].x = 0; |
diff --git a/noncore/games/sfcave-sdl/bfont.h b/noncore/games/sfcave-sdl/bfont.h index dee97f1..5c2d7e7 100644 --- a/noncore/games/sfcave-sdl/bfont.h +++ b/noncore/games/sfcave-sdl/bfont.h | |||
@@ -1,36 +1,36 @@ | |||
1 | 1 | ||
2 | /************************************************************ | 2 | /************************************************************ |
3 | 3 | ||
4 | BFONT v. 1.0.2 - Billi Font Library by Diego Billi | 4 | BFONT v. 1.0.2 - Billi Font Library by Diego Billi |
5 | BFONT++ C++ port by Gianluigi Davassi | 5 | BFONT++ C++ port by Gianluigi Davassi |
6 | ************************************************************/ | 6 | ************************************************************/ |
7 | 7 | ||
8 | #ifndef __BFONT_HEADER_H__ | 8 | #ifndef __BFONT_HEADER_H__ |
9 | #define __BFONT_HEADER_H__ | 9 | #define __BFONT_HEADER_H__ |
10 | 10 | ||
11 | #include <iostream> | 11 | #include <iostream> |
12 | #include "SDL.h" | 12 | #include <SDL/SDL.h> |
13 | 13 | ||
14 | class BFont | 14 | class BFont |
15 | { | 15 | { |
16 | int h; // font height | 16 | int h; // font height |
17 | SDL_Surface *Surface; // font surface | 17 | SDL_Surface *Surface; // font surface |
18 | SDL_Rect Chars[256]; // characters width | 18 | SDL_Rect Chars[256]; // characters width |
19 | const char* name; // font name | 19 | const char* name; // font name |
20 | 20 | ||
21 | BFont(const BFont&); | 21 | BFont(const BFont&); |
22 | 22 | ||
23 | void InitFont(); | 23 | void InitFont(); |
24 | int count(const char *text); | 24 | int count(const char *text); |
25 | public: | 25 | public: |
26 | 26 | ||
27 | BFont(const char *__filename) // generator bill | 27 | BFont(const char *__filename) // generator bill |
28 | : name(__filename) | 28 | : name(__filename) |
29 | { LoadFont(__filename); } | 29 | { LoadFont(__filename); } |
30 | 30 | ||
31 | ~BFont() | 31 | ~BFont() |
32 | { SDL_FreeSurface(Surface); } // screen must be free by application | 32 | { SDL_FreeSurface(Surface); } // screen must be free by application |
33 | 33 | ||
34 | int FontHeight () // Returns the font height | 34 | int FontHeight () // Returns the font height |
35 | { return h; } | 35 | { return h; } |
36 | 36 | ||
diff --git a/noncore/games/sfcave-sdl/fly_game.cpp b/noncore/games/sfcave-sdl/fly_game.cpp index 8b05d8f..69413ba 100644 --- a/noncore/games/sfcave-sdl/fly_game.cpp +++ b/noncore/games/sfcave-sdl/fly_game.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | #include "SDL_gfxPrimitives.h" | 1 | #include <SDL/SDL_gfxPrimitives.h> |
2 | 2 | ||
3 | #include "constants.h" | 3 | #include "constants.h" |
4 | #include "fly_game.h" | 4 | #include "fly_game.h" |
5 | #include "random.h" | 5 | #include "random.h" |
6 | 6 | ||
7 | FlyGame :: FlyGame( SFCave *p, int w, int h, int diff ) | 7 | FlyGame :: FlyGame( SFCave *p, int w, int h, int diff ) |
8 | : Game( p, w, h, diff ) | 8 | : Game( p, w, h, diff ) |
9 | { | 9 | { |
10 | gameName = "Fly"; | 10 | gameName = "Fly"; |
11 | difficulty = MENU_DIFFICULTY_EASY; | 11 | difficulty = MENU_DIFFICULTY_EASY; |
12 | 12 | ||
13 | terrain = new FlyTerrain( w, h ); | 13 | terrain = new FlyTerrain( w, h ); |
14 | player = new Player( w, h ); | 14 | player = new Player( w, h ); |
15 | highScore = 0; | 15 | highScore = 0; |
16 | } | 16 | } |
17 | 17 | ||
18 | FlyGame :: ~FlyGame() | 18 | FlyGame :: ~FlyGame() |
19 | { | 19 | { |
20 | // terrain and player get deleted by parent class | 20 | // terrain and player get deleted by parent class |
21 | } | 21 | } |
22 | 22 | ||
23 | void FlyGame :: init() | 23 | void FlyGame :: init() |
24 | { | 24 | { |
25 | switch( difficulty ) | 25 | switch( difficulty ) |
diff --git a/noncore/games/sfcave-sdl/fly_game.h b/noncore/games/sfcave-sdl/fly_game.h index 1ab081a..f648deb 100644 --- a/noncore/games/sfcave-sdl/fly_game.h +++ b/noncore/games/sfcave-sdl/fly_game.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __FLY_GAME_H | 1 | #ifndef __FLY_GAME_H |
2 | #define __FLY_GAME_H | 2 | #define __FLY_GAME_H |
3 | 3 | ||
4 | #include "sfcave.h" | 4 | #include "sfcave.h" |
5 | #include "flyterrain.h" | 5 | #include "flyterrain.h" |
6 | #include "player.h" | 6 | #include "player.h" |
7 | #include "game.h" | 7 | #include "game.h" |
8 | #include "SDL.h" | 8 | #include <SDL/SDL.h> |
9 | 9 | ||
10 | class FlyGame : public Game | 10 | class FlyGame : public Game |
11 | { | 11 | { |
12 | public: | 12 | public: |
13 | FlyGame( SFCave *p, int w, int h, int diff ); | 13 | FlyGame( SFCave *p, int w, int h, int diff ); |
14 | ~FlyGame(); | 14 | ~FlyGame(); |
15 | 15 | ||
16 | void init(); | 16 | void init(); |
17 | void update( int state ); | 17 | void update( int state ); |
18 | void draw( SDL_Surface *screen ); | 18 | void draw( SDL_Surface *screen ); |
19 | 19 | ||
20 | private: | 20 | private: |
21 | 21 | ||
22 | //int movePlayer; | 22 | //int movePlayer; |
23 | bool startScoring; | 23 | bool startScoring; |
24 | 24 | ||
25 | bool checkCollisions(); | 25 | bool checkCollisions(); |
26 | }; | 26 | }; |
27 | 27 | ||
28 | #endif | 28 | #endif |
diff --git a/noncore/games/sfcave-sdl/flyterrain.cpp b/noncore/games/sfcave-sdl/flyterrain.cpp index b1b8db5..bffe5c9 100644 --- a/noncore/games/sfcave-sdl/flyterrain.cpp +++ b/noncore/games/sfcave-sdl/flyterrain.cpp | |||
@@ -1,26 +1,25 @@ | |||
1 | 1 | #include <SDL/SDL_gfxPrimitives.h> | |
2 | #include "SDL_gfxPrimitives.h" | ||
3 | 2 | ||
4 | #include "constants.h" | 3 | #include "constants.h" |
5 | #include "flyterrain.h" | 4 | #include "flyterrain.h" |
6 | #include "random.h" | 5 | #include "random.h" |
7 | 6 | ||
8 | 7 | ||
9 | int FlyTerrain :: flyScoreZones[][3] = { { 0, 20, 5 }, | 8 | int FlyTerrain :: flyScoreZones[][3] = { { 0, 20, 5 }, |
10 | { 20, 30, 2 }, | 9 | { 20, 30, 2 }, |
11 | { 30, 40, 0 }, | 10 | { 30, 40, 0 }, |
12 | { 40, 100, -1 }, | 11 | { 40, 100, -1 }, |
13 | { 100, 300, -2 }, | 12 | { 100, 300, -2 }, |
14 | { -1, -1, -1 } }; | 13 | { -1, -1, -1 } }; |
15 | 14 | ||
16 | FlyTerrain :: FlyTerrain( int w, int h ) | 15 | FlyTerrain :: FlyTerrain( int w, int h ) |
17 | : Terrain( w, h, false, true ) | 16 | : Terrain( w, h, false, true ) |
18 | { | 17 | { |
19 | showScoreZones = true; | 18 | showScoreZones = true; |
20 | } | 19 | } |
21 | 20 | ||
22 | FlyTerrain :: ~FlyTerrain() | 21 | FlyTerrain :: ~FlyTerrain() |
23 | { | 22 | { |
24 | } | 23 | } |
25 | 24 | ||
26 | void FlyTerrain :: setPoint( int point ) | 25 | void FlyTerrain :: setPoint( int point ) |
diff --git a/noncore/games/sfcave-sdl/flyterrain.h b/noncore/games/sfcave-sdl/flyterrain.h index 63b5731..6258fa0 100644 --- a/noncore/games/sfcave-sdl/flyterrain.h +++ b/noncore/games/sfcave-sdl/flyterrain.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __FLYTERRAIN_H | 1 | #ifndef __FLYTERRAIN_H |
2 | #define __FLYTERRAIN_H | 2 | #define __FLYTERRAIN_H |
3 | 3 | ||
4 | #include <SDL.h> | 4 | #include <SDL/SDL.h> |
5 | 5 | ||
6 | #include "terrain.h" | 6 | #include "terrain.h" |
7 | 7 | ||
8 | class FlyTerrain : public Terrain | 8 | class FlyTerrain : public Terrain |
9 | { | 9 | { |
10 | public: | 10 | public: |
11 | FlyTerrain( int w, int h ); | 11 | FlyTerrain( int w, int h ); |
12 | ~FlyTerrain(); | 12 | ~FlyTerrain(); |
13 | 13 | ||
14 | void drawTerrain( SDL_Surface *screen ); | 14 | void drawTerrain( SDL_Surface *screen ); |
15 | int getScore( int difficulty, int dist ); | 15 | int getScore( int difficulty, int dist ); |
16 | 16 | ||
17 | void displayScoreZones( bool val ) { showScoreZones = val; } | 17 | void displayScoreZones( bool val ) { showScoreZones = val; } |
18 | 18 | ||
19 | protected: | 19 | protected: |
20 | bool showScoreZones; | 20 | bool showScoreZones; |
21 | 21 | ||
22 | static int flyScoreZones[][3]; | 22 | static int flyScoreZones[][3]; |
23 | 23 | ||
24 | void setPoint( int point ); | 24 | void setPoint( int point ); |
25 | }; | 25 | }; |
26 | 26 | ||
27 | 27 | ||
28 | #endif | 28 | #endif |
diff --git a/noncore/games/sfcave-sdl/font.h b/noncore/games/sfcave-sdl/font.h index 5f0674a..ed9c590 100644 --- a/noncore/games/sfcave-sdl/font.h +++ b/noncore/games/sfcave-sdl/font.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __FONT_H | 1 | #ifndef __FONT_H |
2 | #define __FONT_H | 2 | #define __FONT_H |
3 | 3 | ||
4 | #include "SDL.h" | 4 | #include <SDL/SDL.h> |
5 | #include "bfont.h" | 5 | #include "bfont.h" |
6 | 6 | ||
7 | #define FONT_MENU_HIGHLIGHTED 1 | 7 | #define FONT_MENU_HIGHLIGHTED 1 |
8 | #define FONT_MENU_UNHIGHLIGHTED 2 | 8 | #define FONT_MENU_UNHIGHLIGHTED 2 |
9 | #define FONT_WHITE_TEXT 3 | 9 | #define FONT_WHITE_TEXT 3 |
10 | #define FONT_COLOURED_TEXT 4 | 10 | #define FONT_COLOURED_TEXT 4 |
11 | #define FONT_HELP_FONT 5 | 11 | #define FONT_HELP_FONT 5 |
12 | 12 | ||
13 | class FontHandler | 13 | class FontHandler |
14 | { | 14 | { |
15 | public: | 15 | public: |
16 | static bool init(); | 16 | static bool init(); |
17 | static void cleanUp(); | 17 | static void cleanUp(); |
18 | 18 | ||
19 | static int TextWidth( int font, const char *text ); | 19 | static int TextWidth( int font, const char *text ); |
20 | static int FontHeight( int font ); | 20 | static int FontHeight( int font ); |
21 | static void draw( SDL_Surface *screen, int font, const char *text, int x, int y ); | 21 | static void draw( SDL_Surface *screen, int font, const char *text, int x, int y ); |
22 | static void changeColor( int font, int r, int g, int b ); | 22 | static void changeColor( int font, int r, int g, int b ); |
23 | 23 | ||
24 | static BFont *getFont( int font ); | 24 | static BFont *getFont( int font ); |
25 | private: | 25 | private: |
26 | static BFont *menuSelFont; | 26 | static BFont *menuSelFont; |
27 | static BFont *menuUnSelFont; | 27 | static BFont *menuUnSelFont; |
28 | static BFont *whiteFont; | 28 | static BFont *whiteFont; |
diff --git a/noncore/games/sfcave-sdl/game.cpp b/noncore/games/sfcave-sdl/game.cpp index 1ee0230..bf9c46f 100644 --- a/noncore/games/sfcave-sdl/game.cpp +++ b/noncore/games/sfcave-sdl/game.cpp | |||
@@ -1,29 +1,29 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <time.h> | 2 | #include <time.h> |
3 | 3 | ||
4 | #include <SDL.h> | 4 | #include <SDL/SDL.h> |
5 | #include <SDL_image.h> | 5 | #include <SDL/SDL_image.h> |
6 | 6 | ||
7 | #include "font.h" | 7 | #include "font.h" |
8 | 8 | ||
9 | #include "constants.h" | 9 | #include "constants.h" |
10 | #include "game.h" | 10 | #include "game.h" |
11 | #include "player.h" | 11 | #include "player.h" |
12 | #include "random.h" | 12 | #include "random.h" |
13 | #include "sound.h" | 13 | #include "sound.h" |
14 | #include "stringtokenizer.h" | 14 | #include "stringtokenizer.h" |
15 | 15 | ||
16 | #include "sfcave_game.h" | 16 | #include "sfcave_game.h" |
17 | #include "gates_game.h" | 17 | #include "gates_game.h" |
18 | #include "fly_game.h" | 18 | #include "fly_game.h" |
19 | #include "starfield.h" | 19 | #include "starfield.h" |
20 | 20 | ||
21 | Game :: Game( SFCave *p, int w, int h, int diff ) | 21 | Game :: Game( SFCave *p, int w, int h, int diff ) |
22 | { | 22 | { |
23 | parent = p; | 23 | parent = p; |
24 | sHeight = h; | 24 | sHeight = h; |
25 | sWidth = w; | 25 | sWidth = w; |
26 | difficulty = diff; | 26 | difficulty = diff; |
27 | replayIt = 0; | 27 | replayIt = 0; |
28 | replay = false; | 28 | replay = false; |
29 | terrain = 0; | 29 | terrain = 0; |
diff --git a/noncore/games/sfcave-sdl/gates_game.cpp b/noncore/games/sfcave-sdl/gates_game.cpp index 700a6ec..638658b 100644 --- a/noncore/games/sfcave-sdl/gates_game.cpp +++ b/noncore/games/sfcave-sdl/gates_game.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | #include "SDL_gfxPrimitives.h" | 1 | #include <SDL/SDL_gfxPrimitives.h> |
2 | 2 | ||
3 | #include "constants.h" | 3 | #include "constants.h" |
4 | #include "gates_game.h" | 4 | #include "gates_game.h" |
5 | #include "random.h" | 5 | #include "random.h" |
6 | 6 | ||
7 | GatesGame :: GatesGame( SFCave *p, int w, int h, int diff ) | 7 | GatesGame :: GatesGame( SFCave *p, int w, int h, int diff ) |
8 | : Game( p, w, h, diff ) | 8 | : Game( p, w, h, diff ) |
9 | { | 9 | { |
10 | gameName = "Gates"; | 10 | gameName = "Gates"; |
11 | difficulty = MENU_DIFFICULTY_EASY; | 11 | difficulty = MENU_DIFFICULTY_EASY; |
12 | blockUpdateRate = 200; | 12 | blockUpdateRate = 200; |
13 | 13 | ||
14 | terrain = new Terrain( w, h ); | 14 | terrain = new Terrain( w, h ); |
15 | player = new Player( w, h ); | 15 | player = new Player( w, h ); |
16 | highScore = 0; | 16 | highScore = 0; |
17 | } | 17 | } |
18 | 18 | ||
19 | GatesGame :: ~GatesGame() | 19 | GatesGame :: ~GatesGame() |
20 | { | 20 | { |
21 | // terrain and player get deleted by parent class | 21 | // terrain and player get deleted by parent class |
22 | } | 22 | } |
23 | 23 | ||
24 | void GatesGame :: init() | 24 | void GatesGame :: init() |
25 | { | 25 | { |
diff --git a/noncore/games/sfcave-sdl/gates_game.h b/noncore/games/sfcave-sdl/gates_game.h index 8499ff9..b44336a 100644 --- a/noncore/games/sfcave-sdl/gates_game.h +++ b/noncore/games/sfcave-sdl/gates_game.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __GATES_GAME_H | 1 | #ifndef __GATES_GAME_H |
2 | #define __GATES_GAME_H | 2 | #define __GATES_GAME_H |
3 | 3 | ||
4 | #include "SDL.h" | 4 | #include <SDL/SDL.h> |
5 | 5 | ||
6 | #include "rect.h" | 6 | #include "rect.h" |
7 | 7 | ||
8 | #include "sfcave.h" | 8 | #include "sfcave.h" |
9 | #include "terrain.h" | 9 | #include "terrain.h" |
10 | #include "player.h" | 10 | #include "player.h" |
11 | #include "game.h" | 11 | #include "game.h" |
12 | 12 | ||
13 | class GatesGame : public Game | 13 | class GatesGame : public Game |
14 | { | 14 | { |
15 | public: | 15 | public: |
16 | GatesGame( SFCave *p, int w, int h, int diff ); | 16 | GatesGame( SFCave *p, int w, int h, int diff ); |
17 | ~GatesGame(); | 17 | ~GatesGame(); |
18 | 18 | ||
19 | void init(); | 19 | void init(); |
20 | void update( int state ); | 20 | void update( int state ); |
21 | void draw( SDL_Surface *screen ); | 21 | void draw( SDL_Surface *screen ); |
22 | 22 | ||
23 | private: | 23 | private: |
24 | 24 | ||
25 | int gapHeight; | 25 | int gapHeight; |
26 | 26 | ||
27 | int gateDistance; | 27 | int gateDistance; |
28 | int nextGate; | 28 | int nextGate; |
diff --git a/noncore/games/sfcave-sdl/help.cpp b/noncore/games/sfcave-sdl/help.cpp index f1728f6..0a7924b 100644 --- a/noncore/games/sfcave-sdl/help.cpp +++ b/noncore/games/sfcave-sdl/help.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | #include "SDL.h" | 1 | #include <SDL/SDL.h> |
2 | #include "constants.h" | 2 | #include "constants.h" |
3 | 3 | ||
4 | #include "font.h" | 4 | #include "font.h" |
5 | #include "help.h" | 5 | #include "help.h" |
6 | #include "sfcave.h" | 6 | #include "sfcave.h" |
7 | #include "starfield.h" | 7 | #include "starfield.h" |
8 | 8 | ||
9 | Help :: Help( SFCave *p ) | 9 | Help :: Help( SFCave *p ) |
10 | { | 10 | { |
11 | parent = p; | 11 | parent = p; |
12 | stars = new StarField( false, 200 ); | 12 | stars = new StarField( false, 200 ); |
13 | 13 | ||
14 | loadText(); | 14 | loadText(); |
15 | 15 | ||
16 | init(); | 16 | init(); |
17 | } | 17 | } |
18 | 18 | ||
19 | Help :: ~Help() | 19 | Help :: ~Help() |
20 | { | 20 | { |
21 | delete stars; | 21 | delete stars; |
22 | } | 22 | } |
23 | 23 | ||
24 | void Help :: handleKeys( SDL_KeyboardEvent &key ) | 24 | void Help :: handleKeys( SDL_KeyboardEvent &key ) |
25 | { | 25 | { |
diff --git a/noncore/games/sfcave-sdl/help.h b/noncore/games/sfcave-sdl/help.h index dc9e80e..2cc32cd 100644 --- a/noncore/games/sfcave-sdl/help.h +++ b/noncore/games/sfcave-sdl/help.h | |||
diff --git a/noncore/games/sfcave-sdl/menu.cpp b/noncore/games/sfcave-sdl/menu.cpp index a4a4216..fb2a635 100644 --- a/noncore/games/sfcave-sdl/menu.cpp +++ b/noncore/games/sfcave-sdl/menu.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | #include <SDL_image.h> | 1 | #include <SDL/SDL_image.h> |
2 | #include "SDL_rotozoom.h" | 2 | #include <SDL/SDL_rotozoom.h> |
3 | 3 | ||
4 | #include "constants.h" | 4 | #include "constants.h" |
5 | #include "sfcave.h" | 5 | #include "sfcave.h" |
6 | #include "game.h" | 6 | #include "game.h" |
7 | #include "menu.h" | 7 | #include "menu.h" |
8 | #include "font.h" | 8 | #include "font.h" |
9 | #include "starfield.h" | 9 | #include "starfield.h" |
10 | 10 | ||
11 | MenuOption :: MenuOption( string text, int id ) | 11 | MenuOption :: MenuOption( string text, int id ) |
12 | { | 12 | { |
13 | menuText = text; | 13 | menuText = text; |
14 | menuId = id; | 14 | menuId = id; |
15 | nextMenu = 0; | 15 | nextMenu = 0; |
16 | highlighted = false; | 16 | highlighted = false; |
17 | } | 17 | } |
18 | 18 | ||
19 | MenuOption :: ~MenuOption() | 19 | MenuOption :: ~MenuOption() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | 23 | ||
24 | int MenuOption :: draw( SDL_Surface *screen, int y ) | 24 | int MenuOption :: draw( SDL_Surface *screen, int y ) |
25 | { | 25 | { |
26 | if ( highlighted ) | 26 | if ( highlighted ) |
diff --git a/noncore/games/sfcave-sdl/menu.h b/noncore/games/sfcave-sdl/menu.h index 6a5ef40..c263bcc 100644 --- a/noncore/games/sfcave-sdl/menu.h +++ b/noncore/games/sfcave-sdl/menu.h | |||
@@ -1,31 +1,31 @@ | |||
1 | #ifndef __MENU_H | 1 | #ifndef __MENU_H |
2 | #define __MENU_H | 2 | #define __MENU_H |
3 | 3 | ||
4 | #include <list> | 4 | #include <list> |
5 | using namespace std; | 5 | using namespace std; |
6 | 6 | ||
7 | #include <SDL.h> | 7 | #include <SDL/SDL.h> |
8 | 8 | ||
9 | class SFCave; | 9 | class SFCave; |
10 | class StarField; | 10 | class StarField; |
11 | class Menu; | 11 | class Menu; |
12 | 12 | ||
13 | class MenuOption | 13 | class MenuOption |
14 | { | 14 | { |
15 | public: | 15 | public: |
16 | MenuOption( string text, int id ); | 16 | MenuOption( string text, int id ); |
17 | ~MenuOption(); | 17 | ~MenuOption(); |
18 | 18 | ||
19 | void highlight( bool val ) { highlighted = val; } | 19 | void highlight( bool val ) { highlighted = val; } |
20 | int draw( SDL_Surface *screen, int y ); | 20 | int draw( SDL_Surface *screen, int y ); |
21 | void setNextMenu( Menu *item, bool down = true ); | 21 | void setNextMenu( Menu *item, bool down = true ); |
22 | Menu *getNextMenu() { return nextMenu; } | 22 | Menu *getNextMenu() { return nextMenu; } |
23 | int getMenuId() { return menuId; } | 23 | int getMenuId() { return menuId; } |
24 | bool isDownMenuTree() { return downMenuTree; } | 24 | bool isDownMenuTree() { return downMenuTree; } |
25 | 25 | ||
26 | private: | 26 | private: |
27 | int menuId; | 27 | int menuId; |
28 | string menuText; | 28 | string menuText; |
29 | bool highlighted; | 29 | bool highlighted; |
30 | bool downMenuTree; | 30 | bool downMenuTree; |
31 | 31 | ||
diff --git a/noncore/games/sfcave-sdl/player.cpp b/noncore/games/sfcave-sdl/player.cpp index f024d6b..b491e53 100644 --- a/noncore/games/sfcave-sdl/player.cpp +++ b/noncore/games/sfcave-sdl/player.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | #include <SDL.h> | 1 | #include <SDL/SDL.h> |
2 | #include "SDL_gfxPrimitives.h" | 2 | #include <SDL/SDL_gfxPrimitives.h> |
3 | 3 | ||
4 | #include "constants.h" | 4 | #include "constants.h" |
5 | #include "player.h" | 5 | #include "player.h" |
6 | #include "random.h" | 6 | #include "random.h" |
7 | #include "animatedimage.h" | 7 | #include "animatedimage.h" |
8 | 8 | ||
9 | Player :: Player( int w, int h ) | 9 | Player :: Player( int w, int h ) |
10 | { | 10 | { |
11 | sWidth = w; | 11 | sWidth = w; |
12 | sHeight = h; | 12 | sHeight = h; |
13 | 13 | ||
14 | thrust = 0.4; | 14 | thrust = 0.4; |
15 | gravity = 0.6; | 15 | gravity = 0.6; |
16 | maxUpSpeed = 4.0; | 16 | maxUpSpeed = 4.0; |
17 | maxDownSpeed = 5.0; | 17 | maxDownSpeed = 5.0; |
18 | 18 | ||
19 | explosion = new AnimatedImage( IMAGES_PATH "explosion.bmp", 15 ); | 19 | explosion = new AnimatedImage( IMAGES_PATH "explosion.bmp", 15 ); |
20 | init(); | 20 | init(); |
21 | } | 21 | } |
22 | 22 | ||
23 | Player :: ~Player() | 23 | Player :: ~Player() |
24 | { | 24 | { |
25 | if ( explosion ) | 25 | if ( explosion ) |
26 | delete explosion; | 26 | delete explosion; |
diff --git a/noncore/games/sfcave-sdl/rect.h b/noncore/games/sfcave-sdl/rect.h index dc9c9d5..30f082c 100644 --- a/noncore/games/sfcave-sdl/rect.h +++ b/noncore/games/sfcave-sdl/rect.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __RECT_H | 1 | #ifndef __RECT_H |
2 | #define __RECT_H | 2 | #define __RECT_H |
3 | 3 | ||
4 | #include "SDL.h" | 4 | #include <SDL/SDL.h> |
5 | 5 | ||
6 | class Rect | 6 | class Rect |
7 | { | 7 | { |
8 | public: | 8 | public: |
9 | Rect() { r.x = r.y = r.w = r.h = 0; } | 9 | Rect() { r.x = r.y = r.w = r.h = 0; } |
10 | Rect( int x, int y, int w, int h ) { setRect( x, y, w, h ); } | 10 | Rect( int x, int y, int w, int h ) { setRect( x, y, w, h ); } |
11 | ~Rect() {} | 11 | ~Rect() {} |
12 | 12 | ||
13 | void setRect( int x, int y, int w, int h ) { r.x = x; r.y = y; r.w = w; r.h = h; } | 13 | void setRect( int x, int y, int w, int h ) { r.x = x; r.y = y; r.w = w; r.h = h; } |
14 | SDL_Rect getRect() { return r; } | 14 | SDL_Rect getRect() { return r; } |
15 | int x() { return r.x; } | 15 | int x() { return r.x; } |
16 | int y() { return r.y; } | 16 | int y() { return r.y; } |
17 | int w() { return r.w; } | 17 | int w() { return r.w; } |
18 | int h() { return r.h; } | 18 | int h() { return r.h; } |
19 | 19 | ||
20 | void x( int x) { r.x = x; } | 20 | void x( int x) { r.x = x; } |
21 | void y( int y) { r.y = y; } | 21 | void y( int y) { r.y = y; } |
22 | void w( int w) { r.w = w; } | 22 | void w( int w) { r.w = w; } |
23 | void h( int h) { r.h = h; } | 23 | void h( int h) { r.h = h; } |
24 | 24 | ||
25 | void moveBy( int x, int y ) | 25 | void moveBy( int x, int y ) |
26 | { | 26 | { |
27 | r.x += x; | 27 | r.x += x; |
28 | r.y += y; | 28 | r.y += y; |
diff --git a/noncore/games/sfcave-sdl/sfcave-sdl.pro b/noncore/games/sfcave-sdl/sfcave-sdl.pro index a4eb918..a02eeb3 100644 --- a/noncore/games/sfcave-sdl/sfcave-sdl.pro +++ b/noncore/games/sfcave-sdl/sfcave-sdl.pro | |||
diff --git a/noncore/games/sfcave-sdl/sfcave.cpp b/noncore/games/sfcave-sdl/sfcave.cpp index dbd788c..5d1cdd5 100644 --- a/noncore/games/sfcave-sdl/sfcave.cpp +++ b/noncore/games/sfcave-sdl/sfcave.cpp | |||
@@ -1,32 +1,32 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | 3 | ||
4 | #include <time.h> | 4 | #include <time.h> |
5 | #include <sys/timeb.h> | 5 | #include <sys/timeb.h> |
6 | 6 | ||
7 | #include "SDL.h" | 7 | #include <SDL/SDL.h> |
8 | #include "SDL_gfxPrimitives.h" | 8 | #include <SDL/SDL_gfxPrimitives.h> |
9 | 9 | ||
10 | #include "constants.h" | 10 | #include "constants.h" |
11 | 11 | ||
12 | #include "sound.h" | 12 | #include "sound.h" |
13 | #include "menu.h" | 13 | #include "menu.h" |
14 | #include "help.h" | 14 | #include "help.h" |
15 | #include "game.h" | 15 | #include "game.h" |
16 | #include "terrain.h" | 16 | #include "terrain.h" |
17 | #include "random.h" | 17 | #include "random.h" |
18 | #include "sfcave.h" | 18 | #include "sfcave.h" |
19 | #include "font.h" | 19 | #include "font.h" |
20 | #include "settings.h" | 20 | #include "settings.h" |
21 | #include "util.h" | 21 | #include "util.h" |
22 | 22 | ||
23 | #include "sfcave_game.h" | 23 | #include "sfcave_game.h" |
24 | #include "gates_game.h" | 24 | #include "gates_game.h" |
25 | #include "fly_game.h" | 25 | #include "fly_game.h" |
26 | 26 | ||
27 | void start( int argc, char *argv[] ) | 27 | void start( int argc, char *argv[] ) |
28 | { | 28 | { |
29 | SFCave *app = new SFCave( argc, argv ); | 29 | SFCave *app = new SFCave( argc, argv ); |
30 | app->mainEventLoop(); | 30 | app->mainEventLoop(); |
31 | delete app; | 31 | delete app; |
32 | } | 32 | } |
diff --git a/noncore/games/sfcave-sdl/sfcave.h b/noncore/games/sfcave-sdl/sfcave.h index c707919..4e45ec2 100644 --- a/noncore/games/sfcave-sdl/sfcave.h +++ b/noncore/games/sfcave-sdl/sfcave.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __SFCAVE_H | 1 | #ifndef __SFCAVE_H |
2 | #define __SFCAVE_H | 2 | #define __SFCAVE_H |
3 | 3 | ||
4 | #include "SDL.h" | 4 | #include <SDL/SDL.h> |
5 | 5 | ||
6 | #include "terrain.h" | 6 | #include "terrain.h" |
7 | 7 | ||
8 | class Game; | 8 | class Game; |
9 | class Menu; | 9 | class Menu; |
10 | class Help; | 10 | class Help; |
11 | 11 | ||
12 | class SFCave | 12 | class SFCave |
13 | { | 13 | { |
14 | public: | 14 | public: |
15 | SFCave( int argc, char *argv[] ); | 15 | SFCave( int argc, char *argv[] ); |
16 | ~SFCave(); | 16 | ~SFCave(); |
17 | 17 | ||
18 | void initSDL( int argc, char *argv[] ); | 18 | void initSDL( int argc, char *argv[] ); |
19 | void mainEventLoop(); | 19 | void mainEventLoop(); |
20 | 20 | ||
21 | void setCrashed( bool val ); | 21 | void setCrashed( bool val ); |
22 | void changeState( int s ); | 22 | void changeState( int s ); |
23 | int getState() { return state; } | 23 | int getState() { return state; } |
24 | Game *getCurrentGame() { return currentGame; } | 24 | Game *getCurrentGame() { return currentGame; } |
25 | int getFPS() { return actualFPS; } | 25 | int getFPS() { return actualFPS; } |
26 | bool showFPS() { return showFps; } | 26 | bool showFPS() { return showFps; } |
27 | 27 | ||
28 | void setMenuStatusText( string statusText ); | 28 | void setMenuStatusText( string statusText ); |
diff --git a/noncore/games/sfcave-sdl/sfcave_game.cpp b/noncore/games/sfcave-sdl/sfcave_game.cpp index 8fdbbe5..ccdd625 100644 --- a/noncore/games/sfcave-sdl/sfcave_game.cpp +++ b/noncore/games/sfcave-sdl/sfcave_game.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | #include "SDL_gfxPrimitives.h" | 1 | #include <SDL/SDL_gfxPrimitives.h> |
2 | 2 | ||
3 | #include "constants.h" | 3 | #include "constants.h" |
4 | #include "sfcave_game.h" | 4 | #include "sfcave_game.h" |
5 | #include "random.h" | 5 | #include "random.h" |
6 | 6 | ||
7 | SFCaveGame :: SFCaveGame( SFCave *p, int w, int h, int diff ) | 7 | SFCaveGame :: SFCaveGame( SFCave *p, int w, int h, int diff ) |
8 | : Game( p, w, h, diff ) | 8 | : Game( p, w, h, diff ) |
9 | { | 9 | { |
10 | gameName = "SFCave"; | 10 | gameName = "SFCave"; |
11 | difficulty = MENU_DIFFICULTY_EASY; | 11 | difficulty = MENU_DIFFICULTY_EASY; |
12 | blockUpdateRate = 200; | 12 | blockUpdateRate = 200; |
13 | 13 | ||
14 | terrain = new Terrain( w, h ); | 14 | terrain = new Terrain( w, h ); |
15 | player = new Player( w, h ); | 15 | player = new Player( w, h ); |
16 | highScore = 0; | 16 | highScore = 0; |
17 | } | 17 | } |
18 | 18 | ||
19 | SFCaveGame :: ~SFCaveGame() | 19 | SFCaveGame :: ~SFCaveGame() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | void SFCaveGame :: init() | 23 | void SFCaveGame :: init() |
24 | { | 24 | { |
25 | blockDistance = 50; | 25 | blockDistance = 50; |
diff --git a/noncore/games/sfcave-sdl/sfcave_game.h b/noncore/games/sfcave-sdl/sfcave_game.h index 92a0f5d..6dddf5e 100644 --- a/noncore/games/sfcave-sdl/sfcave_game.h +++ b/noncore/games/sfcave-sdl/sfcave_game.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __SFCAVE_GAME_H | 1 | #ifndef __SFCAVE_GAME_H |
2 | #define __SFCAVE_GAME_H | 2 | #define __SFCAVE_GAME_H |
3 | 3 | ||
4 | #include "SDL.h" | 4 | #include <SDL/SDL.h> |
5 | 5 | ||
6 | #include "rect.h" | 6 | #include "rect.h" |
7 | 7 | ||
8 | #include "sfcave.h" | 8 | #include "sfcave.h" |
9 | #include "terrain.h" | 9 | #include "terrain.h" |
10 | #include "player.h" | 10 | #include "player.h" |
11 | #include "game.h" | 11 | #include "game.h" |
12 | 12 | ||
13 | class SFCaveGame : public Game | 13 | class SFCaveGame : public Game |
14 | { | 14 | { |
15 | public: | 15 | public: |
16 | SFCaveGame( SFCave *p, int w, int h, int diff ); | 16 | SFCaveGame( SFCave *p, int w, int h, int diff ); |
17 | ~SFCaveGame(); | 17 | ~SFCaveGame(); |
18 | 18 | ||
19 | void init(); | 19 | void init(); |
20 | void update( int state ); | 20 | void update( int state ); |
21 | void draw( SDL_Surface *screen ); | 21 | void draw( SDL_Surface *screen ); |
22 | 22 | ||
23 | private: | 23 | private: |
24 | 24 | ||
25 | int blockDistance; | 25 | int blockDistance; |
26 | int blockHeight; | 26 | int blockHeight; |
27 | int blockWidth; | 27 | int blockWidth; |
28 | int blockUpdateRate; | 28 | int blockUpdateRate; |
diff --git a/noncore/games/sfcave-sdl/sound.cpp b/noncore/games/sfcave-sdl/sound.cpp index 855f2e6..0be1abf 100644 --- a/noncore/games/sfcave-sdl/sound.cpp +++ b/noncore/games/sfcave-sdl/sound.cpp | |||
diff --git a/noncore/games/sfcave-sdl/sound.h b/noncore/games/sfcave-sdl/sound.h index d46b5bc..180429a 100644 --- a/noncore/games/sfcave-sdl/sound.h +++ b/noncore/games/sfcave-sdl/sound.h | |||
@@ -1,29 +1,29 @@ | |||
1 | #ifndef __SOUND_H | 1 | #ifndef __SOUND_H |
2 | #define __SOUND_H | 2 | #define __SOUND_H |
3 | 3 | ||
4 | #include <SDL.h> | 4 | #include <SDL/SDL.h> |
5 | #include "SDL_mixer.h" | 5 | #include <SDL/SDL_mixer.h> |
6 | 6 | ||
7 | #define NR_SOUNDS 3 | 7 | #define NR_SOUNDS 3 |
8 | 8 | ||
9 | class SoundHandler | 9 | class SoundHandler |
10 | { | 10 | { |
11 | public: | 11 | public: |
12 | static bool init(); | 12 | static bool init(); |
13 | static void cleanUp(); | 13 | static void cleanUp(); |
14 | 14 | ||
15 | static int playSound( int soundNr, int channel = -1, int nrLoops = 0, int playBeforeFinished = false ); | 15 | static int playSound( int soundNr, int channel = -1, int nrLoops = 0, int playBeforeFinished = false ); |
16 | static void stopSound( int channel, bool fadeOut, int nrMilliSecs = 1000 ); | 16 | static void stopSound( int channel, bool fadeOut, int nrMilliSecs = 1000 ); |
17 | static void setSoundsOn( bool val ); | 17 | static void setSoundsOn( bool val ); |
18 | static void setMusicOn( bool val ); | 18 | static void setMusicOn( bool val ); |
19 | static void playMusic( string musicFile ); | 19 | static void playMusic( string musicFile ); |
20 | static void playMusic( bool fadeIn = false ); | 20 | static void playMusic( bool fadeIn = false ); |
21 | static void stopMusic( bool fadeOut = false ); | 21 | static void stopMusic( bool fadeOut = false ); |
22 | static void setMusicVolume( int vol ); | 22 | static void setMusicVolume( int vol ); |
23 | 23 | ||
24 | 24 | ||
25 | private: | 25 | private: |
26 | static Mix_Music *music; | 26 | static Mix_Music *music; |
27 | static Mix_Chunk *sounds[NR_SOUNDS]; | 27 | static Mix_Chunk *sounds[NR_SOUNDS]; |
28 | static int soundChannels[NR_SOUNDS]; | 28 | static int soundChannels[NR_SOUNDS]; |
29 | static bool soundOn; | 29 | static bool soundOn; |
diff --git a/noncore/games/sfcave-sdl/starfield.cpp b/noncore/games/sfcave-sdl/starfield.cpp index 82edfc1..3b26895 100644 --- a/noncore/games/sfcave-sdl/starfield.cpp +++ b/noncore/games/sfcave-sdl/starfield.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | #include "SDL.h" | 1 | #include <SDL/SDL.h> |
2 | #include "SDL_gfxPrimitives.h" | 2 | #include <SDL/SDL_gfxPrimitives.h> |
3 | 3 | ||
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | 5 | ||
6 | #include "starfield.h" | 6 | #include "starfield.h" |
7 | #include "random.h" | 7 | #include "random.h" |
8 | #include "util.h" | 8 | #include "util.h" |
9 | 9 | ||
10 | #define VERTICAL_VELOCITY 0 | 10 | #define VERTICAL_VELOCITY 0 |
11 | 11 | ||
12 | StarField :: StarField( bool side, int nStars, int mx, int my, int minz, int maxz ) | 12 | StarField :: StarField( bool side, int nStars, int mx, int my, int minz, int maxz ) |
13 | { | 13 | { |
14 | nrStars = nStars; | 14 | nrStars = nStars; |
15 | maxX = mx; | 15 | maxX = mx; |
16 | maxY = my; | 16 | maxY = my; |
17 | minZ = minz; | 17 | minZ = minz; |
18 | maxZ = maxz; | 18 | maxZ = maxz; |
19 | 19 | ||
20 | min_brightness = 50; | 20 | min_brightness = 50; |
21 | top_star_speed = 6; | 21 | top_star_speed = 6; |
22 | 22 | ||
23 | sideways = side; | 23 | sideways = side; |
24 | 24 | ||
25 | if ( !sideways ) | 25 | if ( !sideways ) |
26 | { | 26 | { |
diff --git a/noncore/games/sfcave-sdl/starfield.h b/noncore/games/sfcave-sdl/starfield.h index ae9bd34..133cb54 100644 --- a/noncore/games/sfcave-sdl/starfield.h +++ b/noncore/games/sfcave-sdl/starfield.h | |||
diff --git a/noncore/games/sfcave-sdl/stringtokenizer.h b/noncore/games/sfcave-sdl/stringtokenizer.h index 3f299a6..51daa42 100644 --- a/noncore/games/sfcave-sdl/stringtokenizer.h +++ b/noncore/games/sfcave-sdl/stringtokenizer.h | |||
diff --git a/noncore/games/sfcave-sdl/terrain.cpp b/noncore/games/sfcave-sdl/terrain.cpp index b243f45..5943275 100644 --- a/noncore/games/sfcave-sdl/terrain.cpp +++ b/noncore/games/sfcave-sdl/terrain.cpp | |||
@@ -1,27 +1,27 @@ | |||
1 | #include "SDL.h" | 1 | #include <SDL/SDL.h> |
2 | #include "SDL_rotozoom.h" | 2 | #include <SDL/SDL_rotozoom.h> |
3 | #include "SDL_gfxPrimitives.h" | 3 | #include <SDL/SDL_gfxPrimitives.h> |
4 | 4 | ||
5 | #include "constants.h" | 5 | #include "constants.h" |
6 | #include "terrain.h" | 6 | #include "terrain.h" |
7 | #include "random.h" | 7 | #include "random.h" |
8 | #include "util.h" | 8 | #include "util.h" |
9 | #include "starfield.h" | 9 | #include "starfield.h" |
10 | 10 | ||
11 | Terrain :: Terrain( int w, int h, bool drawTop, bool drawBottom ) | 11 | Terrain :: Terrain( int w, int h, bool drawTop, bool drawBottom ) |
12 | { | 12 | { |
13 | sWidth = w; | 13 | sWidth = w; |
14 | sHeight = h; | 14 | sHeight = h; |
15 | speed = 1; | 15 | speed = 1; |
16 | segSize = sWidth/(MAPSIZE-2)+1; | 16 | segSize = sWidth/(MAPSIZE-2)+1; |
17 | this->drawTop = drawTop; | 17 | this->drawTop = drawTop; |
18 | this->drawBottom = drawBottom; | 18 | this->drawBottom = drawBottom; |
19 | 19 | ||
20 | stars = new StarField( true ); | 20 | stars = new StarField( true ); |
21 | 21 | ||
22 | SDL_Surface *tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, sWidth + 20, sHeight, 32, | 22 | SDL_Surface *tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, sWidth + 20, sHeight, 32, |
23 | 0x000000ff,0x0000ff00, 0x00ff0000, 0xff000000); | 23 | 0x000000ff,0x0000ff00, 0x00ff0000, 0xff000000); |
24 | terrainSurface = SDL_DisplayFormat( tmp ); | 24 | terrainSurface = SDL_DisplayFormat( tmp ); |
25 | SDL_FreeSurface( tmp ); | 25 | SDL_FreeSurface( tmp ); |
26 | 26 | ||
27 | initTerrain(); | 27 | initTerrain(); |
diff --git a/noncore/games/sfcave-sdl/terrain.h b/noncore/games/sfcave-sdl/terrain.h index 4070318..3cc9691 100644 --- a/noncore/games/sfcave-sdl/terrain.h +++ b/noncore/games/sfcave-sdl/terrain.h | |||
@@ -1,28 +1,28 @@ | |||
1 | #ifndef __TERRAIN_H | 1 | #ifndef __TERRAIN_H |
2 | #define __TERRAIN_H | 2 | #define __TERRAIN_H |
3 | 3 | ||
4 | #include <SDL.h> | 4 | #include <SDL/SDL.h> |
5 | 5 | ||
6 | class StarField; | 6 | class StarField; |
7 | class Terrain | 7 | class Terrain |
8 | { | 8 | { |
9 | public: | 9 | public: |
10 | Terrain( int w, int h, bool drawTop = true, bool drawBottom = true ); | 10 | Terrain( int w, int h, bool drawTop = true, bool drawBottom = true ); |
11 | virtual ~Terrain(); | 11 | virtual ~Terrain(); |
12 | 12 | ||
13 | virtual void initTerrain(); | 13 | virtual void initTerrain(); |
14 | virtual void moveTerrain( int amountToMove ); | 14 | virtual void moveTerrain( int amountToMove ); |
15 | virtual bool checkCollision( int x, int y, int h ); | 15 | virtual bool checkCollision( int x, int y, int h ); |
16 | virtual void drawTerrain( SDL_Surface *screen ); | 16 | virtual void drawTerrain( SDL_Surface *screen ); |
17 | 17 | ||
18 | int getMapTop( int pos ) { return mapTop[pos]; } | 18 | int getMapTop( int pos ) { return mapTop[pos]; } |
19 | int getMapBottom( int pos ) { return mapBottom[pos]; } | 19 | int getMapBottom( int pos ) { return mapBottom[pos]; } |
20 | int getMaxHeight() { return maxHeight; } | 20 | int getMaxHeight() { return maxHeight; } |
21 | void increaseMaxHeight( int amount ); | 21 | void increaseMaxHeight( int amount ); |
22 | 22 | ||
23 | int offset; | 23 | int offset; |
24 | protected: | 24 | protected: |
25 | 25 | ||
26 | int sWidth; | 26 | int sWidth; |
27 | int sHeight; | 27 | int sHeight; |
28 | 28 | ||
diff --git a/noncore/games/sfcave-sdl/util.cpp b/noncore/games/sfcave-sdl/util.cpp index f73e256..743f16e 100644 --- a/noncore/games/sfcave-sdl/util.cpp +++ b/noncore/games/sfcave-sdl/util.cpp | |||
@@ -1,25 +1,25 @@ | |||
1 | #include "SDL.h" | 1 | #include <SDL/SDL.h> |
2 | 2 | ||
3 | #include <dirent.h> | 3 | #include <dirent.h> |
4 | 4 | ||
5 | #include <vector> | 5 | #include <vector> |
6 | using namespace std; | 6 | using namespace std; |
7 | 7 | ||
8 | #include "util.h" | 8 | #include "util.h" |
9 | #include "random.h" | 9 | #include "random.h" |
10 | 10 | ||
11 | Uint32 getpixel(SDL_Surface *surface, int x, int y) | 11 | Uint32 getpixel(SDL_Surface *surface, int x, int y) |
12 | { | 12 | { |
13 | int bpp = surface->format->BytesPerPixel; | 13 | int bpp = surface->format->BytesPerPixel; |
14 | /* Here p is the address to the pixel we want to retrieve */ | 14 | /* Here p is the address to the pixel we want to retrieve */ |
15 | Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; | 15 | Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * bpp; |
16 | 16 | ||
17 | switch(bpp) { | 17 | switch(bpp) { |
18 | case 1: | 18 | case 1: |
19 | return *p; | 19 | return *p; |
20 | 20 | ||
21 | case 2: | 21 | case 2: |
22 | return *(Uint16 *)p; | 22 | return *(Uint16 *)p; |
23 | 23 | ||
24 | case 3: | 24 | case 3: |
25 | if(SDL_BYTEORDER == SDL_BIG_ENDIAN) | 25 | if(SDL_BYTEORDER == SDL_BIG_ENDIAN) |
diff --git a/noncore/games/sfcave-sdl/util.h b/noncore/games/sfcave-sdl/util.h index e3aa31a..a67707b 100644 --- a/noncore/games/sfcave-sdl/util.h +++ b/noncore/games/sfcave-sdl/util.h | |||