/FallingSandpaper/jni/setup.c

http://thelements.googlecode.com/ · C · 53 lines · 43 code · 4 blank · 6 comment · 4 complexity · c89c5a3c90f6791e07b6d101308ec591 MD5 · raw file

  1. /*
  2. * setup.c
  3. * -----------------------------
  4. * Defines the rsetup function, which initializes
  5. * all of the arrays and variables necessary.
  6. */
  7. #include "setup.h"
  8. void rsetup()
  9. {
  10. int j, o, k;
  11. loq = TPoints;
  12. cpoint = 0;
  13. play = 1;
  14. size = 4;
  15. unsigned char blankred = red[3];
  16. unsigned char blankgreen = green[3];
  17. unsigned char blankblue = blue[3];
  18. for (j = 0; j < TPoints; j++)
  19. {
  20. x[j] = 0;
  21. y[j] = 0;
  22. xvel[j] = 0;
  23. yvel[j] = 0;
  24. element[j] = 0;
  25. oldx[j] = 0;
  26. oldy[j] = 0;
  27. set[j] = 0;
  28. avail[j] = j;
  29. spawn[j] = -1;
  30. frozen[j] = 0;
  31. }
  32. for (j = 0; j < 8; j++)
  33. {
  34. username[j] = 0;
  35. password[j] = 0;
  36. }
  37. userlength = 0;
  38. passlength = 0;
  39. for (o = 0; o < HEIGHT; o++)
  40. {
  41. for (k = 0; k < WIDTH; k++)
  42. {
  43. allcoords[k][o] = -1; // -1 is empty
  44. colors[3 * (k + WIDTH * o)] = blankred; //0
  45. colors[3 * (k + WIDTH * o) + 1] = blankblue; //0
  46. colors[3 * (k + WIDTH * o) + 2] = blankgreen; //0
  47. }
  48. }
  49. }