Advertisement
Weegee

Untitled

Aug 18th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. int loop_game(struct player * pl, struct windowlist * list_win, struct timer * timer, struct obstaclelist * list_ob, struct bulletlist * list_bu)
  2. {
  3. /* Time between the start and now */
  4. /* TODO: Declare elapsed as float -> run functions every half second etc. */
  5. unsigned int elapsed = (unsigned int) (time(NULL) - timer->begin);
  6.  
  7. /* If the elapsed time is different from the one stored in the timer struct ... */
  8. if (elapsed != timer->elapsed)
  9. {
  10. /* ... store it in the timer struct and update the timer displayed in the game window */
  11. timer->elapsed = elapsed;
  12. loop_timer_display(timer, list_win->win_game);
  13. loop_bullets(list_win->win_game, list_bu, pl, list_ob);
  14. loop_obstacles(list_win->win_game, list_ob, list_bu, pl);
  15. }
  16.  
  17. /* Update information windows */
  18. set_info(list_win->win_ammo, pl->ammo);
  19. set_info(list_win->win_health, pl->health);
  20. set_info(list_win->win_score, pl->score);
  21.  
  22. if (pl->health == 0)
  23. {
  24. /* Debug */
  25. fprintf(debuglog, "loop_game()\n\tThe player is dead! Returning 0\n");
  26. fflush(debuglog);
  27. return 0;
  28. }
  29. else
  30. {
  31. loop_player(list_win->win_game, list_win->win_health, pl, list_bu, list_ob);
  32.  
  33. return 1;
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement