OTORNADO.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 : OTORNADO.H
  21. //Description : Header file of Object Tornado
  22. //Ownership : Gilbert
  23. #ifndef __OTORNADO_H
  24. #define __OTORNADO_H
  25. #ifndef __OSPRITE_H
  26. #include <OSPRITE.h>
  27. #endif
  28. //#ifndef __OUNIT_H
  29. //#include <OUNIT.h>
  30. //#endif
  31. //#ifndef __OFIRM_H
  32. //#include <OFIRM.h>
  33. //#endif
  34. //--------- Define constant -----------//
  35. //----------- Define class Tornado -----------//
  36. #pragma pack(1)
  37. class Tornado : public Sprite
  38. {
  39. public:
  40. float attack_damage;
  41. short life_time;
  42. short dmg_offset_x;
  43. short dmg_offset_y;
  44. public:
  45. void init(short startX, short startY, short lifeTime);
  46. //void update_abs_pos(SpriteFrame* =0);
  47. //void draw();
  48. void pre_process();
  49. void process_move();
  50. void hit_target();
  51. void hit_building();
  52. void hit_plant();
  53. void hit_fire();
  54. short damage_x_loc() { return (cur_x + dmg_offset_x) >> ZOOM_X_SHIFT_COUNT; }
  55. short damage_y_loc() { return (cur_y + dmg_offset_y) >> ZOOM_Y_SHIFT_COUNT; }
  56. //--------- file functions -----------//
  57. int write_file(File* filePtr);
  58. int read_file(File* filePtr);
  59. };
  60. #pragma pack()
  61. //------- Define class TornadoArray ---------//
  62. class TornadoArray : public SpriteArray
  63. {
  64. public:
  65. TornadoArray(int initArraySize);
  66. short create_tornado();
  67. short add_tornado(int xLoc, int yLoc, short lifeTime); // unit attacks firm, townzone
  68. // short tornado_possible(int parentXLoc, int parentYLoc, int targetXLoc, int targetYLoc, char tornadoSpeed);
  69. #ifdef DEBUG
  70. Tornado* operator[](int recNo);
  71. #else
  72. Tornado* operator[](int recNo) { return (Tornado*) get_ptr(recNo); }
  73. #endif
  74. void process();
  75. void draw_dot();
  76. //--------- file functions -----------//
  77. int write_file(File* filePtr);
  78. int read_file(File* filePtr);
  79. };
  80. extern TornadoArray tornado_array;
  81. //-----------------------------------------//
  82. #endif