Thread: [Tuxracer-checkins] CVS: tuxracer/src loop.c,1.10,1.11 main.c,1.26,1.27 tuxracer.h,1.25,1.26
Status: Beta
Brought to you by:
jfpatry
From: Jasmin P. <jf...@us...> - 2000-10-01 15:14:32
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv31555 Modified Files: loop.c main.c tuxracer.h Log Message: Added a field secs_since_start to game_data_t struct -- counts the seconds since the game was started. Index: loop.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/loop.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** loop.c 2000/09/30 17:17:43 1.10 --- loop.c 2000/10/01 15:14:28 1.11 *************** *** 167,174 **** } if ( mode_funcs[ g_game.mode ].loop_func != NULL ) { - /* Calculate the size of the time step from the last time we - ran the loop func, and call the mode's loop func */ - g_game.time_step = calc_time_step(); ( mode_funcs[ g_game.mode ].loop_func )( g_game.time_step ); } --- 167,174 ---- } + g_game.time_step = calc_time_step(); + g_game.secs_since_start += g_game.time_step; + if ( mode_funcs[ g_game.mode ].loop_func != NULL ) { ( mode_funcs[ g_game.mode ].loop_func )( g_game.time_step ); } Index: main.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/main.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** main.c 2000/09/30 19:15:59 1.26 --- main.c 2000/10/01 15:14:28 1.27 *************** *** 52,55 **** --- 52,56 ---- #include "save.h" #include "credits.h" + #include "joystick.h" *************** *** 101,104 **** --- 102,109 ---- flags |= SDL_INIT_AUDIO; } + + #ifdef HAVE_SDL_JOYSTICKOPEN + flags |= SDL_INIT_JOYSTICK; + #endif /* *************** *** 216,219 **** --- 221,227 ---- "See http://www.gnu.org/copyleft/gpl.html for details.\n\n" ); + /* Init the game clock */ + g_game.secs_since_start = 0; + /* Seed the random number generator */ srand( time(NULL) ); *************** *** 328,331 **** --- 336,340 ---- init_course_manager(); init_saved_games(); + init_joystick(); /* Read the tuxracer_init.tcl file */ Index: tuxracer.h =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/tuxracer.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** tuxracer.h 2000/09/30 17:29:39 1.25 --- tuxracer.h 2000/10/01 15:14:28 1.26 *************** *** 277,280 **** --- 277,281 ---- bool_t practicing; /* are we in practice mode? */ bool_t race_aborted; /* was the race quit prematurely? */ + scalar_t secs_since_start; /* seconds since game was started */ } game_data_t; |