File foobillard-codecleanup.diff of Package foobillard

Index: src/aiplayer.c
===================================================================
--- src/aiplayer.c.orig
+++ src/aiplayer.c
@@ -53,7 +53,7 @@ static int my_rand(int nr)
 }
 
 
-static double my_rand01()
+static double my_rand01(void)
 {
     return (double)rand()/(double)RAND_MAX;
 }
Index: src/ball.c
===================================================================
--- src/ball.c.orig
+++ src/ball.c
@@ -54,6 +54,7 @@
 
 //#define TEST_FRESNEL
 
+#ifdef USE_BALL_FRESNEL
 static int             fresnel_vert_prog_bind;
 static const unsigned char * fresnel_vert_prog_world_coord_str=
             "!!VP1.0 \n"
@@ -200,6 +201,7 @@ static const unsigned char * fresnel_ver
             "DP4   o[HPOS].w, c[3], v[OPOS];     \n"
             "ADD   o[HPOS].z, R3.z, -c[8].z;     \n"
             "END                                 \n";
+#endif
 #define fresnel_vert_prog_str fresnel_vert_prog_obj_coord_str
 
 
@@ -212,13 +214,15 @@ static char * shadowtexdata;
 static GLuint shadowtexbind;
 static int    depth;
 
-static GLfloat col_null [4] = {0.0, 0.0, 0.0, 0.0}; /* dont need any specular because of reflections */
+// static GLfloat col_null [4] = {0.0, 0.0, 0.0, 0.0}; /* dont need any specular because of reflections */
 static GLfloat col_spec [4] = {0.0, 0.0, 0.0, 1.0}; /* dont need any specular because of reflections */
 static GLfloat col_spec2[4] = {1.0, 1.0, 1.0, 1.0}; /* dont need any specular because of reflections */
 //static GLfloat col_refl [4] = {1.0, 1.0, 1.0, 0.28};
 static GLfloat col_refl [4] = {1.0, 1.0, 1.0, 0.28};
 static GLfloat col_refl3[4] = {1.0, 1.0, 1.0, 0.60};   /* for rendered cubemap */
+#ifdef USE_BALL_FRESNEL
 static GLfloat col_refl4[4] = {1.0, 1.0, 1.0, 1.0};   /* for rendered cubemap (fresnel) */
+#endif
 static GLfloat col_diff [4] = {0.7, 0.7, 0.7, 1.0};
 static GLfloat col_diff2[4] = {0.75, 0.75, 0.75, 1.0};
 static GLfloat col_diff3[4] = {0.69, 0.69, 0.69, 1.0};
@@ -259,7 +263,7 @@ void normalize_my(myfloat *v)
 }
 */
 
-
+#if 0
 static int in_array_old( ElemArray * array, GLfloat * v, GLfloat tex_x, GLfloat tex_y )
 {
     int i;
@@ -283,7 +287,7 @@ static int in_array_old( ElemArray * arr
 
     return -1;
 }
-
+#endif
 
 static int in_array( ElemArray * array, GLfloat * v, GLfloat tex_x, GLfloat tex_y )
 {
@@ -496,7 +500,8 @@ void ball_subdivide_nonrec(float *v1, fl
     GLint i,j,k,x,y;
     double xf,yf,vl;
     int otherside;
-    double xt,yt,rho;
+    double xt,yt;
+//	double rho;
     int subdiv;
 
     if(depth==1) depth=0;
Index: src/billard3d.c
===================================================================
--- src/billard3d.c.orig
+++ src/billard3d.c
@@ -210,7 +210,9 @@ VMvect comp_dir;
 static int  human_human_mode=0;
 static int  act_player=0;   /* 0 or 1 */
 static char * player_names[]={"Human Player","AI Player","Human Player 2","AI Player 2"};
+/*
 static char * half_full_names[]={"any","full","half"};
+*/
 static int  b1_b2_hold=0;
 
 /*
@@ -686,7 +688,7 @@ void write_rc(FILE * f, int opt, char *
 }
 
 
-void save_config()
+void save_config(void)
 {
     int opt;
     FILE * f;
@@ -840,7 +842,7 @@ double angle_pm180(double ang)
 
 
 
-void toggle_queue_view()
+void toggle_queue_view(void)
 {
     queue_view = (queue_view==0)?1:0;
     if( queue_view ){
@@ -855,7 +857,7 @@ void toggle_queue_view()
     }
 }
 
-void birdview()
+void birdview(void)
 {
         if(options_free_view_on==0) options_free_view_on=1;
         if(queue_view) toggle_queue_view();
@@ -931,7 +933,7 @@ void init_player(struct Player * player,
 //    player[1].free_view_pos=vec_xyz(0,-1.0,1.5);
 }
 
-void init_players()
+void init_players(void)
 {
     init_player(&player[0],0);
     init_player(&player[1],human_human_mode?0:1);
@@ -1110,7 +1112,7 @@ void init_tournament_state( struct Tourn
     }
 }
 
-void restart_game_common();
+void restart_game_common(void);
 
 void tournament_state_setup_next_round( struct TournamentState_ * ts )
 {
@@ -1218,7 +1220,7 @@ void tournament_state_setup_next_match(
     printf("tournament_state_setup_next_match 8\n");
 }
 
-void create_players_text()
+void create_players_text(void)
 {
     player[0].text = textObj_new(player[0].name, options_player_fontname, 28);
     player[1].text = textObj_new(player[1].name, options_player_fontname, 28);
@@ -1243,7 +1245,7 @@ void copy_balls( BallsType * balls1, Bal
 }
 
 
-void queue_shot()
+void queue_shot(void)
 {
     VMvect dir, nx, ny, hitpoint;
 
@@ -1405,7 +1407,7 @@ double queue_offs_func( double t )
 }
 
 
-int net_get_send_req()
+int net_get_send_req(void)
 {
     char c;
     if( socket_read(g_socket,&c,1)==1 && c=='R' ){
@@ -1415,7 +1417,7 @@ int net_get_send_req()
 }
 
 
-int net_get_ack()
+int net_get_ack(void)
 {
     char c;
     if( socket_read(g_socket,&c,1)==1 && c=='A' ){
@@ -1425,7 +1427,7 @@ int net_get_ack()
 }
 
 
-int net_get_data()
+int net_get_data(void)
 {
     if( socket_read(g_socket,(char *)&g_net_data,sizeof(NetData))==sizeof(NetData) ){
         Xque=g_net_data.Xrot;
@@ -1441,21 +1443,21 @@ int net_get_data()
 }
 
 
-void net_send_send_req()
+void net_send_send_req(void)
 {
     char c='R';
     socket_write(g_socket,&c,1);
 }
 
 
-void net_send_ack()
+void net_send_ack(void)
 {
     char c='A';
     socket_write(g_socket,&c,1);
 }
 
 
-void net_send_data()
+void net_send_data(void)
 {
     g_net_data.Xrot=Xque;
     g_net_data.Zrot=Zque;
@@ -2314,7 +2316,7 @@ void cull_balls( BallsType balls, myvec
 #endif
 
 
-void draw_3D_winner_text()
+void draw_3D_winner_text(void)
 {
     static double ang=0.0;
     static double tprev=0.0;
@@ -2577,7 +2579,7 @@ void DisplayFunc_cubemap( int ballnr, in
 
 void create_cuberef_map(int ballnr, int texbind, VMvect cam_pos)
 {
-    int i, w, h, target, level;
+    int i, w, h, target = 0, level;
     double d, ang, ang1, ang2;
     double th, ph, cam_FOV2;
     VMvect dvec, ballvec, right, up, cam_pos_;
@@ -2903,7 +2905,7 @@ void DisplayFunc( void )
        eye_offs = rg_eye_dist/2.0*znear/zeye;
        glLoadIdentity();
        if       (i==0){
-           double eye_offs0;
+           double eye_offs0 = 0.;
            if (options_rgaim == 0) eye_offs0 = -eye_offs;
            if (options_rgaim == 1) eye_offs0 = -2.0*eye_offs;
            if (options_rgaim == 2) eye_offs0 = 0.0;
@@ -2916,7 +2918,7 @@ void DisplayFunc( void )
            glTranslatef( eye_offs0/znear*zeye, 0.0, 0.0 );
 
        }else if (i==1){
-           double eye_offs1;
+           double eye_offs1 = 0.;
            if (options_rgaim == 0) eye_offs1 = +eye_offs;
            if (options_rgaim == 1) eye_offs1 = 0.0;
            if (options_rgaim == 2) eye_offs1 = +2.0*eye_offs;
@@ -3236,8 +3238,9 @@ glTranslatef( -ball->r.x, -ball->r.y, -b
            glPopMatrix();
 
            glPopMatrix();
-/*           glMatrixMode(GL_PROJECTION);
-           glPopMatrix();*/
+/*         glMatrixMode(GL_PROJECTION);
+           glPopMatrix();
+*/
            glMatrixMode(GL_MODELVIEW);
        }
        glDisable(GL_BLEND);
@@ -3245,7 +3248,8 @@ glTranslatef( -ball->r.x, -ball->r.y, -b
    }
 
    if(1){   /* HUD stuff */
-/*       char str[200];
+/*
+       char str[200];
        if (gametype==GAME_8BALL){
            sprintf(str,"%s - %s",player[act_player].name,half_full_names[player[act_player].half_full]);
        }else if (gametype==GAME_9BALL){
@@ -3256,7 +3260,8 @@ glTranslatef( -ball->r.x, -ball->r.y, -b
                    minballnr=balls.ball[i].nr;
            }
            sprintf(str,"%s next:%d",player[act_player].name,minballnr);
-       }*/
+       }
+*/
 
 
        glDisable(GL_DEPTH_TEST);
@@ -3589,7 +3594,7 @@ static void SetMode(GLuint m)
    }
 }
 
-void restart_game_common()
+void restart_game_common(void)
 {
     player[0].half_full=BALL_ANY;
     player[1].half_full=BALL_ANY;
@@ -3608,7 +3613,7 @@ void restart_game_common()
 
 
 
-void restart_game_tournment()
+void restart_game_tournment(void)
 {
     restart_game_common();
     g_motion_ratio=1.0;
@@ -3618,7 +3623,7 @@ void restart_game_tournment()
 }
 
 
-void restart_game_training()
+void restart_game_training(void)
 {
     restart_game_common();
     g_motion_ratio=1.0;
@@ -3629,7 +3634,7 @@ void restart_game_training()
 }
 
 
-void restart_game_match()
+void restart_game_match(void)
 {
     restart_game_common();
     g_motion_ratio=1.0;
@@ -3640,7 +3645,7 @@ void restart_game_match()
 }
 
 
-void restart_game()
+void restart_game(void)
 {
     switch(options_gamemode){
     case options_gamemode_tournament: restart_game_tournment(); break;
@@ -3892,7 +3897,7 @@ void KeyUp( int key, int modifiers )
 }
 
 
-void host_network_game()
+void host_network_game(void)
 {
     int i;
     int dummy=42;
@@ -3937,7 +3942,7 @@ void host_network_game()
 }
 
 
-void join_network_game()
+void join_network_game(void)
 {
     int i;
     int dummy=42;
@@ -3994,7 +3999,7 @@ void join_network_game()
 }
 
 
-void free_cuberef_tex()
+void free_cuberef_tex(void)
 {
     int i;
     for( i=0 ; i<cuberef_allballs_texbind_nr ; i++ ){
@@ -4005,9 +4010,9 @@ void free_cuberef_tex()
 }
 
 
-void reassign_and_gen_cuberef_tex()
+void reassign_and_gen_cuberef_tex(void)
 {
-    int i,j,k,l, layer, w, h, target;
+    int i,j,k,l, layer, w, h, target = 0;
     char * data;
 
     if( cuberef_allballs_texbind!=0 || balls.nr!=cuberef_allballs_texbind_nr ) free_cuberef_tex();
@@ -4354,7 +4359,7 @@ void menu_cb( int id, void * arg )
 }
 
 
-void init_menu()
+void init_menu(void)
 {
     char str[256];
 
Index: src/billmove.c
===================================================================
--- src/billmove.c.orig
+++ src/billmove.c
@@ -409,7 +409,7 @@ void record_move_log_event( enum event_t
 }
 
 
-int my_rand(nr)
+int my_rand(int nr)
 {
     return rand()%nr;
 }
Index: src/billmove.h
===================================================================
--- src/billmove.h.orig
+++ src/billmove.h
@@ -130,11 +130,11 @@ int        BM_get_nth_ball_hit(int n);
 int        BM_get_nth_ball_hit_by_ind(int ind, int n);
 VMvect     BM_get_1st_ball_hit_pos(void);
 int        BM_get_balls_hit(void);
-int        BM_get_balls_hit_last();
-int        BM_get_walls_hit_last();
-double     BM_get_balls_hit_strength_last();
+int        BM_get_balls_hit_last(void);
+int        BM_get_walls_hit_last(void);
+double     BM_get_balls_hit_strength_last(void);
 void       BM_get_balls_hit_strength_last_index(int index, double * strength, double * toffs);
-double     BM_get_walls_hit_strength_last();
+double     BM_get_walls_hit_strength_last(void);
 void       BM_get_walls_hit_strength_last_index(int index, double * strength, double * toffs);
 
 BallType * BM_get_ball_by_nr( int nr, BallsType *pballs );
Index: src/bumpref.c
===================================================================
--- src/bumpref.c.orig
+++ src/bumpref.c
@@ -360,13 +360,15 @@ BumpRefType bumpref_setup_vp_ts_rc(
 /* dont call this 1st time inside a GL display list */
 /* doesnt have any effect when called 1st */
 {
-#ifdef USE_NV_BUMPREF
     BumpRefType bumpref;
-/*    static int init=0;
+#ifdef USE_NV_BUMPREF
+#if 0
+    static int init=0;
     static int bumpref_list;
     static int g_cubemap_bind=0;
     static int g_normalmap_bind=0;
-    static unsigned int    vert_prog_bind;*/
+    static unsigned int    vert_prog_bind;
+#endif
 
     static unsigned char * vert_prog_str=
             "!!VP1.0 \n"
@@ -534,7 +536,10 @@ BumpRefType bumpref_setup_vp_ts_rc(
     }
 
     return bumpref ;
-#endif /* ifdef USE_NV_BUMPREF */
+#else  /* ifdef USE_NV_BUMPREF */
+	memset(&bumpref,'\0',sizeof(bumpref));
+	return bumpref;   
+#endif
 }
 
 void bumpref_use(BumpRefType * bumpref)
@@ -596,7 +601,7 @@ void bumpref_use(BumpRefType * bumpref)
 
 
 
-void bumpref_restore()
+void bumpref_restore(void)
 {
 #ifdef USE_NV_BUMPREF
     glDisable(GL_REGISTER_COMBINERS_NV);
@@ -644,8 +649,8 @@ int bump_create_bumpmap( char * map_name
 
 BumpRefType bump_setup_vp_rc( char * map_name, double strength, int texgen )
 {
-#ifdef USE_NV_BUMPREF
     BumpRefType bumpref;
+#ifdef USE_NV_BUMPREF
     float const0[]={0.5,0.5,0.5,1.0};
     float const1[]={0.5,0.5,0.5,1.0};
 
@@ -1117,6 +1122,9 @@ BumpRefType bump_setup_vp_rc( char * map
     bumpref.init=1;
 
     return(bumpref);
+#else
+	memset(&bumpref,'\0',sizeof(bumpref));
+	return bumpref;   
 #endif
 }
 
@@ -1195,7 +1203,7 @@ void bump_use( BumpRefType * bumpref )
 
 
 
-void bump_restore()
+void bump_restore(void)
 {
 #ifdef USE_NV_BUMPREF
     glDisable(GL_REGISTER_COMBINERS_NV);
Index: src/bumpref.h
===================================================================
--- src/bumpref.h.orig
+++ src/bumpref.h
@@ -55,7 +55,7 @@ extern "C" {
                                       );
 
     void bumpref_use( BumpRefType * bumpref );
-    void bumpref_restore();
+    void bumpref_restore(void);
 
 
     /* bump only */
@@ -67,7 +67,7 @@ extern "C" {
     void bump_set_spec( BumpRefType * bumpref, float r, float g, float b );
 
     void bump_use( BumpRefType * bump );
-    void bump_restore();
+    void bump_restore(void);
 
 
 /*int bumpref_create_cubemap( char * posx_name,
Index: src/font.c
===================================================================
--- src/font.c.orig
+++ src/font.c
@@ -57,7 +57,7 @@ struct TessData {
 };
 
 
-struct TessData * new_tessdata()
+struct TessData * new_tessdata(void)
 {
     struct TessData * tessdata;
     tessdata=malloc(sizeof(struct TessData));
Index: src/helpscreen.c
===================================================================
--- src/helpscreen.c.orig
+++ src/helpscreen.c
@@ -108,7 +108,7 @@ void create_help_screen(int win_width, i
 }
 
 
-void delete_help_screen()
+void delete_help_screen(void)
 {
     glDeleteLists(help_screen_obj, 1);
     for(text=text0;*text!=(textObj *)0;text++){
Index: src/helpscreen.h
===================================================================
--- src/helpscreen.h.orig
+++ src/helpscreen.h
@@ -21,6 +21,6 @@
 
 #ifndef HELPSCREEN_H
 #define HELPSCREEN_H
-void delete_help_screen();
+void delete_help_screen(void);
 int draw_help_screen(int win_width, int win_height);
 #endif /* HELPSCREEN_H */
Index: src/net_socket.c
===================================================================
--- src/net_socket.c.orig
+++ src/net_socket.c
@@ -74,7 +74,7 @@ void fireman(void)
 
 
 
-int host_create_socket()
+int host_create_socket(void)
 {
     int s, t;
 
@@ -128,7 +128,7 @@ int client_call_socket_once(char *hostna
 }
 
 
-int net_sock_time_us()
+int net_sock_time_us(void)
 // gives back time in microseconds
 {
 #ifndef _WIN32
Index: src/net_socket.h
===================================================================
--- src/net_socket.h.orig
+++ src/net_socket.h
@@ -2,7 +2,7 @@
 #define NET_SOCKET_H
 
 
-int host_create_socket();
+int host_create_socket(void);
 
 
 int client_call_socket(char *hostname);
Index: src/png_loader.c
===================================================================
--- src/png_loader.c.orig
+++ src/png_loader.c
@@ -43,7 +43,7 @@ int load_png(char * file_name, int * w,
     int bit_depth, color_type, interlace_type,
         compression_type, filter_type;
     int rowbytes, channels;
-    int i;
+    unsigned int i;
     char * buff;
     char ** row_pointers;
 
Index: src/queue.h
===================================================================
--- src/queue.h.orig
+++ src/queue.h
@@ -24,7 +24,7 @@
 
 void delete_queue_texbind( void );
 void create_queue_texbind( void );
-int create_queue();
+int create_queue(double (*)(double));
 void draw_queue( VMvect pos, GLfloat Xrot, GLfloat Zrot, GLfloat zoffs,
                  GLfloat xoffs, GLfloat yoffs, int spheretexbind, VMvect * lightpos, int lightnr );
 
Index: src/vmath.h
===================================================================
--- src/vmath.h.orig
+++ src/vmath.h
@@ -107,10 +107,10 @@ int          vec_equal        ( struct V
 int          vec_nearly_equal ( struct Vect v1, struct Vect v2, VMfloat tolerance );
 
 struct Vect  vec_xyz( VMfloat x, VMfloat y, VMfloat z );
-struct Vect  vec_ex();
-struct Vect  vec_ey();
-struct Vect  vec_ez();
-struct Vect  vec_null();
+struct Vect  vec_ex(void);
+struct Vect  vec_ey(void);
+struct Vect  vec_ez(void);
+struct Vect  vec_null(void);
 void         rot_ax( struct Vect ax, struct Vect *v, int nr, VMfloat phi );
 void         shape_rot_ax( struct Vect ax, struct Shape *s, struct Vect m, VMfloat phi,
                            struct Vect nax, VMfloat sc_x, VMfloat sc_y, VMfloat sc_z );
openSUSE Build Service is sponsored by