SpaceBubble  v0.98
general.h
Go to the documentation of this file.
1 
23 #ifndef __GENERAL_H__
24 #define __GENERAL_H__
25 
26 #include <wiiuse/wpad.h>
27 
28 #include "GRRLIB.h"
29 
30 #define PROGRAM_NAME "SpaceBubble"
31 #define PROGRAM_VERSION "0.98"
32 #define RELEASE_DATE "24-03-2011"
33 
34 // Check latest available version
35 #define URL1 "http://www.plaatsoft.nl/service/releasenotes4.html"
36 #define ID1 "UA-6887062-1"
37 
38 // Fetch Release notes
39 #define URL2 "http://www.plaatsoft.nl/service/releasenotes4.html"
40 #define ID2 "UA-6887062-1"
41 
42 // Set Get Today HighScore
43 #define URL3 "http://www.plaatsoft.nl/service/score_set_today.php"
44 #define ID3 "UA-6887062-1"
45 
46 // Set Get Global HighScore
47 #define URL4 "http://www.plaatsoft.nl/service/score_set_global.php"
48 #define ID4 "UA-6887062-1"
49 
50 #define URL_TOKEN " Version "
51 #define HIGHSCORE_FILENAME "sd:/apps/SpaceBubble/highscore.xml"
52 #define SETTING_FILENAME "sd:/apps/SpaceBubble/setting.xml"
53 #define TRACE_FILENAME "sd:/apps/SpaceBubble/spacebubble.trc"
54 #define GAME_DIRECTORY "sd:/apps/SpaceBubble/"
55 #define MP3_DIRECTORY "sd:/music/"
56 
57 #define WSP_POINTER_X 200
58 #define WSP_POINTER_Y 250
59 
60 #define GRRLIB_WHITESMOKE 0xFFFFFFFF
61 #define GRRLIB_WHITE_TRANS 0xFFFFFF44
62 #define GRRLIB_LIGHTRED 0x3333FFFF
63 #define GRRLIB_BLACK 0x000000FF
64 #define GRRLIB_BLACK_TRANS 0x00000044
65 #define GRRLIB_BLACK_TRANS_2 0x000000AA
66 #define GRRLIB_MAROON 0x800000FF
67 #define GRRLIB_GREEN 0x008000FF
68 #define GRRLIB_OLIVE 0x808000FF
69 #define GRRLIB_NAVY 0x000080FF
70 #define GRRLIB_PURPLE 0x800080FF
71 #define GRRLIB_TEAL 0x008080FF
72 #define GRRLIB_GRAY 0x808080FF
73 #define GRRLIB_SILVER 0xC0C0C0FF
74 #define GRRLIB_RED 0xFF0000FF
75 #define GRRLIB_LIME 0x00FF00FF
76 #define GRRLIB_YELLOW 0xFFFF00FF
77 #define GRRLIB_BLUE 0x0000FFFF
78 #define GRRLIB_FUCHSIA 0xFF00FFFF
79 #define GRRLIB_AQUA 0x00FFFFFF
80 #define GRRLIB_WHITE 0xFFFFFFFF
81 
82 #define IMAGE_COLOR 0xFFFFFFFF
83 #define IMAGE_COLOR1 0xEEEEEEEE
84 #define IMAGE_COLOR2 0xDDDDDDDD
85 #define IMAGE_COLOR3 0x44444444
86 #define IMAGE_COLOR4 0xAAAAAAAA
87 
88 #define MAX_BUTTONS 20
89 #define MAX_RUMBLE 4
90 #define MAX_BOARDSIZE 14
91 #define MAX_BUBBLES (MAX_BOARDSIZE*MAX_BOARDSIZE)
92 #define MAX_HORZ_PIXELS 640
93 #define MAX_VERT_PIXELS 480
94 #define MAX_SETTINGS 10
95 #define MAX_LEVEL 7
96 #define MAX_LEN 256
97 #define MAX_ANGLE 360
98 #define MIN_ALFA 127
99 #define MAX_ALFA 255
100 #define MAX_SIZE 1.0
101 #define MIN_BUBBLE_SIZE 1.0
102 #define MAX_BUBBLE_SIZE 1.1
103 #define MAX_SOUND_VOLUME 10
104 #define MAX_MUSIC_TRACK 9
105 #define MAX_LINES 200
106 #define MAX_BUFFER_SIZE 8192
107 #define MAX_IDLE_TIME 10
108 #define MAX_POINTER 4
109 
110 #define MAX_LOCAL_HIGHSCORE 100
111 #define MAX_TODAY_HIGHSCORE 50
112 #define MAX_GLOBAL_HIGHSCORE 50
113 
114 #define EXPLODE_STEP 4
115 #define OUT_OF_TIME 15
116 
117 #define IR_X_OFFSET 40
118 #define IR_Y_OFFSET 40
119 
120 #define SCROLLBAR_x 600
121 #define SCROLLBAR_Y_MIN 150
122 #define SCROLLBAR_Y_MAX 310
123 
124 #define MUSIC_MULTIPLER 5
125 #define EFFECT_MULTIPLER 20
126 
127 #define BUTTON_A (WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A)
128 #define BUTTON_HOME (WPAD_BUTTON_HOME | WPAD_CLASSIC_BUTTON_HOME)
129 #define BUTTON_1 (WPAD_BUTTON_1 | WPAD_CLASSIC_BUTTON_X)
130 #define BUTTON_2 (WPAD_BUTTON_2 | WPAD_CLASSIC_BUTTON_Y)
131 #define BUTTON_UP (WPAD_BUTTON_UP | WPAD_CLASSIC_BUTTON_UP)
132 #define BUTTON_DOWN (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_DOWN)
133 #define BUTTON_LEFT (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_LEFT)
134 #define BUTTON_RIGHT (WPAD_BUTTON_RIGHT | WPAD_CLASSIC_BUTTON_RIGHT)
135 #define BUTTON_PLUS (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS)
136 
137 // -----------------------------------------------------------
138 // ENUMS
139 // -----------------------------------------------------------
140 
141 enum
142 {
163 };
164 
165 enum
166 {
176 };
177 
178 // -----------------------------------------------------------
179 // TYPEDEFS
180 // -----------------------------------------------------------
181 
182 typedef struct
183 {
184  // png + jpg Image index
185  GRRLIB_texImg *background1;
186  GRRLIB_texImg *background2;
187 
188  GRRLIB_texImg *panel1;
189  GRRLIB_texImg *button1;
190  GRRLIB_texImg *button1select;
191  GRRLIB_texImg *button2;
192  GRRLIB_texImg *button2select;
193  GRRLIB_texImg *bar;
194  GRRLIB_texImg *barCursor;
195  GRRLIB_texImg *sound;
196 
197  GRRLIB_texImg *pointer1;
198  GRRLIB_texImg *pointer2;
199  GRRLIB_texImg *pointer3;
200  GRRLIB_texImg *pointer4;
201 
202  GRRLIB_texImg *scrollbar;
203  GRRLIB_texImg *scrollTop;
204  GRRLIB_texImg *scrollMiddle;
205  GRRLIB_texImg *scrollBottom;
206 
207  GRRLIB_texImg *noBubble;
208  GRRLIB_texImg *blueBubble;
209  GRRLIB_texImg *blueSelectBubble;
210  GRRLIB_texImg *yellowBubble;
211  GRRLIB_texImg *yellowSelectBubble;
212  GRRLIB_texImg *greenBubble;
213  GRRLIB_texImg *greenSelectBubble;
214  GRRLIB_texImg *redBubble;
215  GRRLIB_texImg *redSelectBubble;
216  GRRLIB_texImg *pinkBubble;
217  GRRLIB_texImg *pinkSelectBubble;
218  GRRLIB_texImg *lightblueBubble;
219  GRRLIB_texImg *lightblueSelectBubble;
220  GRRLIB_texImg *blackBubble;
221  GRRLIB_texImg *blackSelectBubble;
222  GRRLIB_texImg *whiteBubble;
223  GRRLIB_texImg *whiteSelectBubble;
224  GRRLIB_texImg *gameboard;
225 
226  GRRLIB_texImg *logo;
227  GRRLIB_texImg *logo1;
228  GRRLIB_texImg *logo2;
229  GRRLIB_texImg *logo3;
230  GRRLIB_texImg *logo4;
231  GRRLIB_texImg *logo5;
232  GRRLIB_texImg *logo6;
233 
234  GRRLIB_texImg *intro4;
235 }
236 image;
237 
239 
240 typedef struct
241 {
242  int x;
243  int y;
244  int color;
245  int width;
246  int height;
247  bool selected;
248  bool enabled;
249  bool check;
250  float size;
252  bool hint;
253 }
254 bubble;
255 
257 
258 typedef struct
259 {
260  int x;
261  int y;
262  int color;
263  int width;
264  int height;
265  int alfa;
266  float size;
267  bool enabled;
268  bool moveX;
269  bool moveY;
270 }
271 explode;
272 
274 
275 typedef struct
276 {
277  int x;
278  int y;
279  int width;
280  int height;
281  GRRLIB_texImg *image;
282 }
283 board;
284 
286 
287 typedef struct
288 {
289  time_t localTime;
290  int level;
291  int score;
292  char name[MAX_LEN];
293 }
294 highscore;
295 
297 
298 
299 typedef struct
300 {
301  time_t dt;
302  char score[MAX_LEN];
303  char name[MAX_LEN];
304  char location[MAX_LEN];
305 }
306 topscore;
307 
310 
311 
312 typedef struct
313 {
314  GRRLIB_texImg *image;
315  GRRLIB_texImg *imageSelect;
316  char name[MAX_LEN];
317  int x;
318  int y;
319 }
320 button;
321 
323 
324 
325 struct
326 {
327  // General game variables
328  time_t localTime;
329  time_t playTime;
330  time_t prevPlayTime;
331  time_t idleTime;
332  int score;
333  int level;
335  int maxTime;
337 
338  // Variables for score calculation
350  int rating;
351 }
352 game;
353 
354 typedef struct
355 {
356  ir_t ir;
357  int x;
358  int xOffset;
359  int y;
360  int yOffset;
361  int angle;
362  int rumble;
363  GRRLIB_texImg *image;
364 }
365 pointer;
366 
368 
653  #endif
654 
655 // -----------------------------------------------------------
656 // The End
657 // -----------------------------------------------------------
GRRLIB_texImg * background2
Definition: general.h:186
GRRLIB_texImg * yellowBubble
Definition: general.h:210
GRRLIB_texImg * button1
Definition: general.h:189
GRRLIB_texImg * pointer1
Definition: general.h:197
int angle
Definition: general.h:361
int bubbleOverFactor
Definition: general.h:343
Definition: general.h:155
GRRLIB_texImg * whiteBubble
Definition: general.h:222
bool moveX
Definition: general.h:268
GRRLIB_texImg * blackBubble
Definition: general.h:220
GRRLIB_texImg * gameboard
Definition: general.h:224
explode explodes[MAX_BUBBLES+1]
Definition: general.h:273
int timeBonus
Definition: general.h:339
GRRLIB_texImg * redSelectBubble
Definition: general.h:215
Definition: general.h:173
Definition: general.h:160
Definition: general.h:354
GRRLIB_texImg * pinkSelectBubble
Definition: general.h:217
Definition: general.h:157
GRRLIB_texImg * panel1
Definition: general.h:188
GRRLIB_texImg * redBubble
Definition: general.h:214
int yOffset
Definition: general.h:360
GRRLIB_texImg * scrollBottom
Definition: general.h:205
GRRLIB_texImg * logo2
Definition: general.h:228
GRRLIB_texImg * pointer3
Definition: general.h:199
GRRLIB_texImg * whiteSelectBubble
Definition: general.h:223
GRRLIB_texImg * logo6
Definition: general.h:232
GRRLIB_texImg * lightblueBubble
Definition: general.h:218
struct @2 game
Definition: general.h:168
int height
Definition: general.h:280
#define MAX_BUTTONS
Definition: general.h:88
int score
Definition: general.h:332
int x
Definition: general.h:357
ir_t ir
Definition: general.h:356
GRRLIB_texImg * sound
Definition: general.h:195
Definition: general.h:287
Definition: general.h:258
Definition: general.h:275
GRRLIB_texImg * lightblueSelectBubble
Definition: general.h:219
int x
Definition: general.h:242
int width
Definition: general.h:245
int timeBonusFactor
Definition: general.h:340
GRRLIB_texImg * intro4
Definition: general.h:234
#define MAX_LOCAL_HIGHSCORE
Definition: general.h:110
Definition: general.h:167
Definition: general.h:145
Definition: general.h:182
bool moveY
Definition: general.h:269
time_t idleTime
Definition: general.h:331
Definition: general.h:151
Definition: general.h:158
GRRLIB_texImg * pointer2
Definition: general.h:198
Definition: general.h:156
topscore globalHighScore[MAX_GLOBAL_HIGHSCORE+1]
Definition: general.h:309
int x
Definition: general.h:277
time_t localTime
Definition: general.h:328
image images
Definition: general.h:238
int height
Definition: general.h:246
int width
Definition: general.h:279
GRRLIB_texImg * logo5
Definition: general.h:231
Definition: general.h:154
#define MAX_POINTER
Definition: general.h:108
GRRLIB_texImg * pointer4
Definition: general.h:200
int totalClear
Definition: general.h:345
int level
Definition: general.h:333
Definition: general.h:240
pointer pointers[MAX_POINTER]
Definition: general.h:367
GRRLIB_texImg * image
Definition: general.h:363
int alfa
Definition: general.h:265
GRRLIB_texImg * blueSelectBubble
Definition: general.h:209
int y
Definition: general.h:278
GRRLIB_texImg * blackSelectBubble
Definition: general.h:221
int bubbleOverScore
Definition: general.h:344
GRRLIB_texImg * greenSelectBubble
Definition: general.h:213
Definition: general.h:169
Definition: general.h:162
Definition: general.h:170
GRRLIB_texImg * scrollTop
Definition: general.h:203
char name[MAX_NAME_SIZE]
Definition: settings.h:31
GRRLIB_texImg * logo
Definition: general.h:226
board gameboard[MAX_BUBBLES]
Definition: general.h:285
int rating
Definition: general.h:350
int color
Definition: general.h:244
button buttons[MAX_BUTTONS+1]
Definition: general.h:322
GRRLIB_texImg * blueBubble
Definition: general.h:208
Definition: general.h:312
time_t prevPlayTime
Definition: general.h:330
GRRLIB_texImg * image
Definition: general.h:281
GRRLIB_texImg * greenBubble
Definition: general.h:212
int possiblities
Definition: general.h:334
GRRLIB_texImg * yellowSelectBubble
Definition: general.h:211
Definition: general.h:161
bool selected
Definition: general.h:247
Definition: general.h:174
Definition: general.h:148
time_t playTime
Definition: general.h:329
GRRLIB_texImg * pinkBubble
Definition: general.h:216
Definition: general.h:172
int maxTime
Definition: general.h:335
bubble bubbles[MAX_BUBBLES+1]
Definition: general.h:256
int color
Definition: general.h:262
GRRLIB_texImg * button1select
Definition: general.h:190
#define MAX_LEN
Definition: general.h:96
#define MAX_GLOBAL_HIGHSCORE
Definition: general.h:112
Definition: general.h:171
int totalClearScore
Definition: general.h:347
bool hint
Definition: general.h:252
GRRLIB_texImg * button2select
Definition: general.h:192
bool sizeDirection
Definition: general.h:251
GRRLIB_texImg * background1
Definition: general.h:185
Definition: general.h:143
topscore todayHighScore[MAX_TODAY_HIGHSCORE+1]
Definition: general.h:308
GRRLIB_texImg * bar
Definition: general.h:193
highscore localHighScore[MAX_LOCAL_HIGHSCORE+1]
Definition: general.h:296
int xOffset
Definition: general.h:358
int extraBonus
Definition: general.h:348
int width
Definition: general.h:263
time_t dt
Definition: general.h:301
int selectScore
Definition: general.h:349
float size
Definition: general.h:250
GRRLIB_texImg * logo3
Definition: general.h:229
Definition: general.h:153
#define MAX_TODAY_HIGHSCORE
Definition: general.h:111
float size
Definition: general.h:266
GRRLIB_texImg * logo4
Definition: general.h:230
int height
Definition: general.h:264
int x
Definition: general.h:317
bool enabled
Definition: general.h:267
Definition: general.h:146
Definition: general.h:175
time_t localTime
Definition: general.h:289
GRRLIB_texImg * image
Definition: general.h:314
GRRLIB_texImg * barCursor
Definition: general.h:194
GRRLIB_texImg * button2
Definition: general.h:191
int y
Definition: general.h:359
int y
Definition: general.h:243
Definition: general.h:144
Definition: general.h:147
GRRLIB_texImg * scrollbar
Definition: general.h:202
int y
Definition: general.h:261
int y
Definition: general.h:318
int totalClearFactor
Definition: general.h:346
Definition: general.h:152
Definition: general.h:149
GRRLIB_texImg * logo1
Definition: general.h:227
#define MAX_BUBBLES
Definition: general.h:91
GRRLIB_texImg * imageSelect
Definition: general.h:315
Definition: general.h:299
int score
Definition: general.h:291
int level
Definition: general.h:290
Definition: general.h:159
bool check
Definition: general.h:249
int bubbleCount
Definition: general.h:336
int timeBonusScore
Definition: general.h:341
GRRLIB_texImg * scrollMiddle
Definition: general.h:204
int x
Definition: general.h:260
Definition: general.h:150
bool enabled
Definition: general.h:248
int bubbleOver
Definition: general.h:342
int rumble
Definition: general.h:362
GRRLIB_texImg * noBubble
Definition: general.h:207