OFLAME.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 : OFLAME.H
  21. // Description : header file of class Flame
  22. // Ownership : Gilbert
  23. #ifndef __OFLAME_H
  24. #define __OFLAME_H
  25. //---------- define constant -------//
  26. #define FLAME_GROW_STEP 4
  27. enum FlameType
  28. {
  29. FLAME_CENTRE_POINT,
  30. FLAME_RANDOM_POINTS,
  31. FLAME_WIDE
  32. };
  33. //-------- define class Flame ----------//
  34. class VgaBuf;
  35. class Flame
  36. {
  37. public:
  38. unsigned char* heat_map; // array of size map_width * map_height
  39. unsigned char* bitmap; // array of size map_width * map_height +4
  40. // to be drawn by IMGbltTrans and IMGbltAreaTrans
  41. unsigned seed;
  42. short map_width;
  43. short map_height;
  44. short decay;
  45. short smooth;
  46. short shade_base; // init -1, changed after gen_bitmap
  47. // parameter for init and displaying flame[0], flame[1]...
  48. public:
  49. static int grade(int flameStr) { return (FLAME_GROW_STEP * flameStr)/(20+ flameStr); }
  50. static int default_width(int flameGrade) { return flameGrade*8+40; }
  51. static int default_height(int flameGrade) { return flameGrade*12+28; }
  52. static int offset_x(int flameGrade) { return -4-4*flameGrade; } // (ZOOM_LOC_HEIGHT - Flame::default_width)/2
  53. static int offset_y(int flameGrade) { return 4-flameGrade*12; } // ZOOM_LOC_WIDTH - Flame::default_height
  54. static int base_width(int flameGrade) { return flameGrade *2 +4; }
  55. public:
  56. Flame();
  57. Flame(short width, short height, short flameWidth, FlameType);
  58. ~Flame();
  59. void init(short width, short height, short flameWidth, FlameType);
  60. void deinit();
  61. Flame& operator= (Flame &);
  62. void heat_up(short);
  63. void rise(short wind); // -1 to +1
  64. void gen_bitmap(unsigned char shadeColor = 0xb4);
  65. void mask_bottom();
  66. void mask_transparent();
  67. void draw_step(short left, short bottom, VgaBuf *vgabuf, short wind); // coordinate of left and bottom
  68. void flush_point(short x=-1, short y=-1);
  69. private:
  70. unsigned random(unsigned);
  71. };
  72. extern Flame flame[FLAME_GROW_STEP];
  73. #endif