statistics.hh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /********************************************************************** <BR>
  2. This file is part of Crack dot Com's free source code release of
  3. Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
  4. information about compiling & licensing issues visit this URL</a>
  5. <PRE> If that doesn't help, contact Jonathan Clark at
  6. golgotha_source@usa.net (Subject should have "GOLG" in it)
  7. ***********************************************************************/
  8. #ifndef _STATISTICS_HH_
  9. #define _STATISTICS_HH_
  10. #include "arch.hh"
  11. #include "math/num_type.hh"
  12. #include "time/time.hh"
  13. class i4_parent_window_class;
  14. class g1_statistics_counter_class
  15. {
  16. public:
  17. enum {TOTAL_POLYS, OBJECT_POLYS, TERRAIN_POLYS,OBJECTS,
  18. TERRAIN, SPRITES, SFXS, FRAMES, LAST};
  19. sw32 counter_array[LAST];
  20. w32 current_counter;
  21. w32 t_frames;
  22. i4_time_class last_update_time;
  23. w32 get_value(w32 count_type)
  24. {
  25. if (count_type<LAST)
  26. return counter_array[count_type];
  27. else
  28. return 0;
  29. }
  30. void set_value(w32 count_type, w32 value)
  31. {
  32. if (count_type<LAST)
  33. counter_array[count_type] = value;
  34. }
  35. void set_current_counter(w32 count_type)
  36. {
  37. current_counter = count_type;
  38. }
  39. w32 get_current_counter()
  40. {
  41. return current_counter;
  42. }
  43. void increment_current_counter()
  44. {
  45. if (current_counter<LAST)
  46. counter_array[current_counter]++;
  47. }
  48. void increment(w32 inc)
  49. {
  50. if (inc<LAST)
  51. counter_array[inc]++;
  52. }
  53. void add(w32 inc, w32 amount)
  54. {
  55. if (inc<LAST)
  56. counter_array[inc] += amount;
  57. }
  58. void reset()
  59. {
  60. w32 i;
  61. for (i=0;i<LAST;i++)
  62. counter_array[i] = 0;
  63. t_frames=0;
  64. last_update_time.get();
  65. }
  66. void show();
  67. };
  68. extern g1_statistics_counter_class g1_stat_counter;
  69. #endif