[Xbubble-commits] xbubble/src timer.c,1.1,1.2 timer.h,1.1,1.2 xbubble.c,1.1,1.2
Martin Quinson
xbubble-devel@lists.alioth.debian.org
Wed, 27 Apr 2005 14:43:25 +0000
Update of /cvsroot/xbubble/xbubble/src
In directory haydn:/tmp/cvs-serv14029/src
Modified Files:
timer.c timer.h xbubble.c
Log Message:
cleanups
Index: timer.h
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/timer.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- timer.h 5 Dec 2004 20:41:01 -0000 1.1
+++ timer.h 27 Apr 2005 14:43:23 -0000 1.2
@@ -3,9 +3,9 @@
long get_closest_itimer_interval( long usec );
void start_timer( long usec, void (*handler)(int));
-void stop_timer();
+void stop_timer(void);
void timer_sleep( long ms );
-void block_timer();
-void unblock_timer();
+void block_timer(void);
+void unblock_timer(void);
#endif /* _TIMER_H */
Index: xbubble.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/xbubble.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xbubble.c 5 Dec 2004 20:41:01 -0000 1.1
+++ xbubble.c 27 Apr 2005 14:43:23 -0000 1.2
@@ -29,9 +29,6 @@
#include "setting.h"
#include "gettext.h"
-/*
-#include <mcheck.h>
-*/
#include "cell.h"
#include "game.h"
#include "timer.h"
@@ -51,15 +48,15 @@
int win_height;
int fps;
unsigned long frame_duration;
-char *data_dir;
-char *theme;
+const char *data_dir;
+const char *theme;
int colors[NB_CELLS];
int nb_levels;
-int level[MAX_NB_LEVELS][NB_CELLS];
+int levels[MAX_NB_LEVELS][NB_CELLS];
#define level_handicap(X) ( DEFAULT_HANDICAP + 3000*( NORMAL - (X)))
-void usage() {
+static void usage() {
printf(_("Usage: xbubble [-d display] [-s scale] [-f framerate] [-r resourcepath] [-t theme]\n\n"));
exit(1);
}
@@ -73,7 +70,7 @@
colors[i] = 0;
}
-void play_single_player_game( int *handicap ) {
+static void play_single_player_game( int *handicap ) {
int i;
int won = 1;
int again = 1;
@@ -84,7 +81,7 @@
ruleset.max_fire_delay = handicap[0];
for ( i = 0; again && i < nb_levels; won && i++ ) {
- game = new_game( SINGLE_PLAYER, &ruleset, level[i], i+1,
+ game = new_game( SINGLE_PLAYER, &ruleset, levels[i], i+1,
score, NORMAL );
result = play_game(game);
@@ -96,7 +93,7 @@
printf(_("CONGRATULATIONS !!!\n"));
}
-void play_challenge_game( int *handicap ) {
+static void play_challenge_game( int *handicap ) {
enum GameResult result;
int level=1;
int score[2] = { 0, 0 };
@@ -116,7 +113,7 @@
} while (result != ABORTED);
}
-void play_match( enum GameMode mode, int *handicap, enum Level level ) {
+static void play_match( enum GameMode mode, int *handicap, enum Level level ) {
int round;
int done;
int score[2];
@@ -155,7 +152,7 @@
while ( screen_2p( mode, rounds, games ) == S3_CONTINUE );
}
-void play_demo( enum Level level ) {
+static void play_demo( enum Level level ) {
int not_done;
RuleSet_t ruleset[2]={ DEFAULT_RULE_SET, DEFAULT_RULE_SET };
int score[2] = { 0, 0 };
@@ -173,17 +170,18 @@
while ( not_done );
}
-void play_xbubble() {
+static void play_xbubble() {
int quit, level;
int choice[2];
int handicap[2];
quit = 0;
+ int preset=S1_SINGLE_PLAYER;
while ( ! quit ) {
handicap[0] = level_handicap(NORMAL);
handicap[1] = level_handicap(NORMAL);
- switch ( screen_main() ) {
+ switch (preset=screen_main(preset) ) {
case S1_SINGLE_PLAYER:
/* select handicap */
@@ -221,11 +219,19 @@
play_challenge_game( handicap );
}
break;
-
+
case S1_DEMO:
play_demo( VERY_HARD );
break;
+ case S1_SETTINGS:
+ choice[0] = screen_settings(S6_KEY);
+ while ( choice[0] != S6_BACK && choice[0] != S6_ESCAPE) {
+ screen_unimplemented();
+ choice[0] = screen_settings(choice[0]);
+ }
+ break;
+
case S1_ESCAPE:
case S1_QUIT:
quit = 1;
@@ -329,8 +335,8 @@
/* set window title name, name, class, etc. */
sprintf( app_name, _("XBubble @ %d fps v%s"), fps, VERSION );
XStoreName( display, win, app_name );
- class_hint.res_name = "xbubble";
- class_hint.res_class = "XBubble";
+ class_hint.res_name = (char *)"xbubble";
+ class_hint.res_class = (char *)"XBubble";
wm_hint.flags = InputHint | StateHint;
wm_hint.input = True;
wm_hint.initial_state = NormalState;
Index: timer.c
===================================================================
RCS file: /cvsroot/xbubble/xbubble/src/timer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- timer.c 5 Dec 2004 20:41:01 -0000 1.1
+++ timer.c 27 Apr 2005 14:43:23 -0000 1.2
@@ -24,6 +24,8 @@
#include <signal.h>
#include <sys/time.h>
+#include "timer.h"
+
struct timeval interval;
extern int fps;