1 /********************************************************************
2   Mega Mario SRC
3     created:	2005/09/18
4 	created:	18:9:2005   10:13
5 	author:		Jens Wellmann (c)
6 *********************************************************************/
7 
8 
9 
10 #ifndef __GLOBAL_H__
11 #define __GLOBAL_H__
12 
13 //C++'s
14 
15 #include <stdlib.h>
16 //#include <stdio.h>
17 
18 //#ifndef __unix__
19 //#include <windows.h>
20 //#endif //not needed anymore
21 
22 #include <iostream>
23 #include <fstream>
24 
25 
26 #ifndef __GNUC__
27 #pragma warning(disable:4244)
28 #pragma warning(disable:4800)
29 #pragma warning(disable:4154)
30 #pragma warning(disable:4305)
31 #pragma warning(disable:4018)
32 #pragma warning(disable:4018)
33 #pragma warning(disable:4996)
34 #endif
35 
36 using std::string;
37 
38 using std::flush;
39 using std::ifstream;
40 using std::fstream;
41 using std::ofstream;
42 using std::cout;
43 using std::endl;
44 using std::iostream;
45 using std::stringstream;
46 using std::ios;
47 
48 #if defined( _MSC_VER ) && _MSC_VER < 1400 // no Visual Studio 8 and higher
49 using std::find_if;
50 #endif
51 
52 //SDL's
53 #include <SDL/SDL.h>
54 #include <SDL/SDL_mixer.h>
55 #include <SDL/SDL_image.h>
56 #include <SDL/SDL_ttf.h>
57 #include <SDL/SDL_opengl.h>
58 
59 #include "SDL_gfxPrimitives.h"
60 #include "SDL_gfxPrimitives_font.h"
61 
62 //Jensen's
63 #include "main.h"
64 #include "levels.h"
65 #include "functions.h"
66 #include "player.h"
67 #include "bonus.h"
68 #include "menu.h"
69 #include "enemy.h"
70 #include "particle.h"
71 #include "gamepad.h"
72 
73 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
74 //#define Use_OPENGL
75 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
76 
77 
78 #define CAPTION "MEGA MARIO"
79 
80 #define SCREEN_BPP 32
81 
82 
83 
84 #define ER cout<<"Nix da !!!"<<flush<<endl;
85 
86 
87 
88 
89 void loadGlobalSprites();
90 void unloadGlobalSprites();
91 void THEGAMEENDSHERE();
92 void instruct(char* path);
93 void drawGLscreen();
94 void InitOpenGL( void );
95 extern SDL_Surface *screen;
96 extern SDL_Surface *helpscreen;
97 extern SDL_Surface *cheatscreen;
98 
99 extern SDL_Event event;
100 
101 extern TTF_Font* font;
102 
103 extern Uint8 *keys;
104 extern double frame_multi;
105 extern bool Real_Fullscreen;
106 extern char* cheatcode;
107 
108 extern ofstream out_logfile;
109 
110 
111 struct HUD_STRUCT
112 {
113 	int score;
114 	int lifes;
115 	int coins;
116 };
117 
118 
119 extern bool HighQualityMusic_available;
120 #define MAXSONGS 50
121 struct s_music_archive
122 {
123 	Mix_Music *song[MAXSONGS];
124 	char* name[MAXSONGS];
125 	int allocatecount;
126 	char* currentsong;
127 };
128 extern s_music_archive MusicArchive;
129 
130 
131 extern HUD_STRUCT HUD;
132 
133 extern int WIDTH,GL_Width;
134 extern int HEIGHT,GL_Height;
135 
136 #ifndef __unix__
137 extern bool NoFrameCheck;
138 #endif
139 extern bool gameStarted,gameStartedVirtual,pixelation,show_blood,cheater,cheats_enabled;
140 extern int nosound;
141 
142 
143 extern SDL_Color HUDColor;
144 extern SDL_Color HUDColorbg;
145 
146 extern SDL_Rect tmp_rect;
147 extern int  cam_x,cam_y,bonus_activ;
148 //SDL_MapRGB(screen->format,255,0,0)
149 ////////////////////////////////
150 
151 #define PLAYSOUND1(nr) if(nosound)Mix_PlayChannel(1,SOUND[nr],0)
152 #define PLAYSOUND2(nr) if(nosound)Mix_PlayChannel(2,SOUND[nr],0)
153 #define PLAYSOUND0(nr) if(nosound)Mix_PlayChannel(0,SOUND[nr],0)
154 #define MAX_SOUNDS 20
155 extern int musicvolume,soundvolume;
156 extern Mix_Chunk *SOUND[MAX_SOUNDS];
157 
158 #define S_GROW 0
159 #define S_JUMP 1
160 #define S_CRACK 2
161 #define S_COIN 3
162 #define S_KICK 4
163 #define S_STOMP 5
164 #define S_FIREBALL 6
165 #define S_STAGE_CLEAR 7
166 #define S_1UP 8
167 #define S_DIE 9
168 #define S_GAMEOVER 10
169 #define S_PAUSE 11
170 #define S_PIPE 12
171 #define S_FLAG 13
172 #define S_BOWSERFALL 14
173 #define S_SHRINK 15
174 #define S_OUTPUT 16
175 #define S_TOCK 17
176 #define S_STOMP2 18
177 #define S_CANNON 19
178 /////////////////////////////////
179 
180 extern Uint32 magenta;
181 
182 #define ENEMYSPEED -2
183 #define MAXENEMY 200
184 extern int GOOMBAcount;
185 extern cGoomba *GOOMBA[MAXENEMY];
186 extern int GOOMBABIGcount;
187 extern cGoombaBig *GOOMBABIG[5];
188 extern int TURTLEcount;
189 extern cTurtle *TURTLE[MAXENEMY];
190 extern int TURTLEFLYcount;
191 extern cTurtleFly *TURTLEFLY[MAXENEMY];
192 extern int SPINYcount;
193 extern cSpiny *SPINY[MAXENEMY];
194 extern int FIRECIRCLEcount;
195 extern cFireCircle *FIRECIRCLE[MAXENEMY];
196 extern int CANNONcount;
197 extern cCannon *CANNON[MAXENEMY];
198 extern int KILLERBLUMEcount;
199 extern cKillerBlume *KILLERBLUME[MAXENEMY];
200 extern int BRETTcount;
201 extern cBrett *BRETT[MAXENEMY];
202 
203 extern cScene *LEVEL;
204 extern cPlayer *PLAYER;
205 extern cBonus* BONUS_DYNAMIC[5];
206 extern cCrack *CRACK;
207 extern cGlidder *GLIDDER;
208 extern cScore* SCORE;
209 extern cFire* FIRE;
210 extern cBowser* BOWSER;
211 extern cFireball *FIREBALL[2];
212 extern cBlood *BLOOD_GENERATOR;
213 extern cGamepad *Gamepad;
214 
215 #ifndef MAX_PATH
216 #define MAX_PATH PATH_MAX
217 #endif
218 
219 #ifndef DATADIR
220 #define DATADIR "data/"
221 #endif
222 
223 #endif
224 
225 
226