OHILLRES.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 : OHILLRES.H
  21. // Description : Header file for class HillRes
  22. // Ownership : Gilbert
  23. #ifndef __OHILLRES_H
  24. #define __OHILLRES_H
  25. #ifndef __ORESDB_H
  26. #include <ORESDB.h>
  27. #endif
  28. //---------- Define constant -------//
  29. enum
  30. {
  31. HIGH_HILL_PRIORITY = 7,
  32. LOW_HILL_PRIORITY = 3,
  33. };
  34. //---------- Define struct HillBlockRec ------//
  35. // ####### begin Gilbert 28/1 #######//
  36. struct HillBlockRec
  37. {
  38. enum { PATTERN_ID_LEN = 3, SUB_PATTERN_ID_LEN =3, PRIORITY_LEN = 1,
  39. OFFSET_LEN=3, FILE_NAME_LEN = 8, BITMAP_PTR_LEN = 4 };
  40. char pattern_id[PATTERN_ID_LEN];
  41. char sub_pattern_id[SUB_PATTERN_ID_LEN];
  42. char priority[PRIORITY_LEN];
  43. char special_flag;
  44. char layer;
  45. char bitmap_type;
  46. char offset_x[OFFSET_LEN];
  47. char offset_y[OFFSET_LEN];
  48. char file_name[FILE_NAME_LEN];
  49. char bitmap_ptr[BITMAP_PTR_LEN];
  50. };
  51. //---------- Define struct HillBlockInfo ------//
  52. struct HillBlockInfo
  53. {
  54. short block_id;
  55. char pattern_id;
  56. char sub_pattern_id;
  57. char special_flag;
  58. char priority; // high value on top
  59. char layer; // 1= draw together with backgroud, 2= sort together with units
  60. char bitmap_type; // W=whole square; T=transparent; O=oversize
  61. short offset_x;
  62. short offset_y;
  63. char* bitmap_ptr;
  64. public:
  65. short bitmap_width() { return *(short *)bitmap_ptr; }
  66. short bitmap_height() { return *(((short *)bitmap_ptr)+1); }
  67. void draw(int xLoc, int yLoc, int layerMask=-1);
  68. void draw_at(int absBaseX, int absBaseY, int layerMask=-1);
  69. };
  70. //----------- Define class HillRes ---------------//
  71. class HillRes
  72. {
  73. public:
  74. HillBlockInfo* hill_block_info_array;
  75. short hill_block_count;
  76. short * first_block_index; // array index of first hill block of each pattern
  77. short max_pattern_id;
  78. char init_flag;
  79. ResourceDb res_bitmap;
  80. public:
  81. HillRes();
  82. void init();
  83. void deinit();
  84. // find exact
  85. short locate(char patternId, char subPattern, char searchPriority, char specialFlag);
  86. // return hill block id of any one of the subPattern
  87. short scan(char patternId, char searchPriority, char specialFlag, char findFirst);
  88. //-------- function related to HillBlock ---------//
  89. HillBlockInfo* operator[](int hillBlockId);
  90. short first_block(int hillPatternId);
  91. private:
  92. void load_hill_block_info();
  93. };
  94. // ####### end Gilbert 28/1 #######//
  95. extern HillRes hill_res;
  96. //----------------------------------------------------//
  97. #endif