OSNOWG.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 : SnowGround
  21. // Description: Header file of Snow Ground
  22. // Owner : Gilbert
  23. #ifndef __SNOWG_H
  24. #define __SNOWG_H
  25. #include <ODYNARRB.h>
  26. class SnowGround
  27. {
  28. public:
  29. int snow_map_id; // 0 for non-existing
  30. int minor_hp; // 0 to 99, promote if >=100
  31. short abs_x;
  32. short abs_y;
  33. short abs_x1;
  34. short abs_y1;
  35. short abs_x2;
  36. short abs_y2;
  37. public:
  38. void init(short absX, short absY, int snowMapId=0);
  39. void grow(int rate);
  40. int dying(int rate); // 1 when die
  41. int is_valid() { return snow_map_id; }
  42. };
  43. /*
  44. #define SNOW_ZONE_SIZE 20
  45. #if (SNOW_ZONE_SIZE < ZOOM_WIDTH / ZOOM_LOC_WIDTH || SNOW_ZONE_SIZE < ZOOM_HEIGHT / ZOOM_LOC_HEIGHT)
  46. #error
  47. #endif
  48. #define WIDTH_IN_ZONE ((MAX_MAP_WIDTH+SNOW_ZONE_SIZE-1)/SNOW_ZONE_SIZE)
  49. #define HEIGHT_IN_ZONE ((MAX_MAP_HEIGHT+SNOW_ZONE_SIZE-1)/SNOW_ZONE_SIZE)
  50. */
  51. #pragma pack(1)
  52. class SnowGroundArray
  53. {
  54. private:
  55. unsigned seed;
  56. public:
  57. long snow_thick;
  58. long snow_pattern;
  59. public:
  60. void init(long initSnowScale, long anyNumber);
  61. void inc_snow(int snowScale); // pass weather.snow_scale()
  62. void dec_snow(int decRate); // pass weather.temp_c()
  63. void process();
  64. int has_snow(short x, short y); // return 0 or snow map id
  65. int write_file(File* filePtr);
  66. int read_file(File* filePtr);
  67. private:
  68. unsigned rand_seed();
  69. };
  70. #pragma pack()
  71. extern SnowGroundArray snow_ground_array;
  72. #endif