SPRITEST.CPP 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <conio.h>
  2. #include "engine.h"
  3. #include "db.h"
  4. #include "misc.h"
  5. #include "textio.h"
  6. #define kNumSprites 2048
  7. #define kIterations 10000
  8. short spriteId[kNumSprites];
  9. void faketimerhandler( void ) {};
  10. void main( void )
  11. {
  12. int i;
  13. tioInit();
  14. tioPrint("Initializing");
  15. dbInit();
  16. tioPrint("Creating %d sprites", kNumSprites);
  17. for (i = 0; tioGauge(i, kNumSprites); i++)
  18. spriteId[i] = insertsprite((short)Random(kMaxSectors), (short)Random(kMaxStatus));
  19. while ( !kbhit() )
  20. {
  21. tioPrint("Changing sectors for %d sprites", kIterations);
  22. for (i = 0; tioGauge(i, kIterations); i++)
  23. changespritesect(spriteId[Random(kNumSprites)], (short)Random(kMaxSectors));
  24. tioPrint("Changing statnums for %d sprites", kIterations);
  25. for (i = 0; tioGauge(i, kIterations); i++)
  26. changespritestat(spriteId[Random(kNumSprites)], (short)Random(kMaxStatus));
  27. tioPrint("Deleting and reinserting %d sprites", kIterations);
  28. for (i = 0; tioGauge(i, kIterations); i++)
  29. {
  30. int j = Random(kNumSprites);
  31. deletesprite(spriteId[j]);
  32. spriteId[j] = insertsprite((short)Random(kMaxSectors), (short)Random(kMaxStatus));
  33. }
  34. }
  35. }