OPLASMA.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Seven Kingdoms: Ancient Adversaries
  3. *
  4. * Copyright 1997,1998 Enlight Software Ltd.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. // Filename : OPLASMA.H
  21. // Description : header file of class Plasma
  22. // Ownership : Gilbert
  23. #ifndef __OPLASMA_H
  24. #define __OPLASMA_H
  25. typedef unsigned char BYTE;
  26. typedef unsigned short U16;
  27. typedef signed long S32;
  28. // -------- Define Class Plasma --------//
  29. class Plasma
  30. {
  31. public:
  32. short max_x; // no. of column
  33. short max_y; // no. of row
  34. short *matrix; // 2D matrix of (max_x+1)*(max_y+1)
  35. int iparmx; // iparmx = parm.x * 16
  36. int recur1;
  37. int recur_level;
  38. public:
  39. Plasma();
  40. ~Plasma();
  41. void init(short x, short y);
  42. void deinit();
  43. void generate(int genMethod, int grainFactor, int randomSeed);
  44. void generate2(int genMethod, int grainFactor, int randomSeed);
  45. short get_pix(short x, short y);
  46. void plot(short x, short y, short value);
  47. void add_base_level(short baseLevel);
  48. int calc_tera_base_level(short minHeight);
  49. int stat(int groups, short *minHeights, int *freq);
  50. void shuffle_level(short minHeight, short maxHeight, short amplitude);
  51. private:
  52. void sub_divide(int x1, int y1, int x2, int y2);
  53. int new_sub_divide(int x1,int y1,int x2,int y2, int recur);
  54. U16 adjust(int xa,int ya,int x,int y,int xb,int yb);
  55. };
  56. #endif