/TheElements/jni/setup.c

http://thelements.googlecode.com/ · C · 52 lines · 41 code · 4 blank · 7 comment · 4 complexity · 6157d8b339bb1e2f599836a0cfdcbaa7 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-1;
  12. cpoint = 0;
  13. //size = 4; if size stuff is failing this may need to be uncommented
  14. unsigned char blankred = red[3];
  15. unsigned char blankgreen = green[3];
  16. unsigned char blankblue = blue[3];
  17. for (j = 0; j < TPoints; j++)
  18. {
  19. x[j] = -1;
  20. y[j] = -1;
  21. xvel[j] = 0;
  22. yvel[j] = 0;
  23. element[j] = 0;
  24. oldx[j] = 0;
  25. oldy[j] = 0;
  26. set[j] = 0;
  27. avail[j] = j;
  28. spawn[j] = -1;
  29. frozen[j] = 0;
  30. }
  31. for (j = 0; j < 8; j++)
  32. {
  33. username[j] = 0;
  34. password[j] = 0;
  35. }
  36. userlength = 0;
  37. passlength = 0;
  38. for (o = 0; o < HEIGHT; o++)
  39. {
  40. for (k = 0; k < WIDTH; k++)
  41. {
  42. allcoords[k][o] = -1; // -1 is empty
  43. colors[3 * (k + WIDTH * o)] = blankred; //0
  44. colors[3 * (k + WIDTH * o) + 1] = blankblue; //0
  45. colors[3 * (k + WIDTH * o) + 2] = blankgreen; //0
  46. }
  47. }
  48. }