OB_FLAME.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 : OB_FLAME.CPP
  21. // Description : non-moving bullet attack (flamethrower)
  22. #include <OB_FLAME.h>
  23. BulletFlame::BulletFlame() : Bullet()
  24. {
  25. }
  26. //### begin alex 3/5 ###//
  27. void BulletFlame::init(char parentType, short parentRecno, short targetXLoc, short targetYLoc, char targetMobileType)
  28. {
  29. // note : BulletFlame should have at least one dummy moving frame for each direction
  30. Bullet::init(parentType, parentRecno, targetXLoc, targetYLoc, targetMobileType);
  31. //#### end alex 3/5 ####//
  32. cur_action = SPRITE_IDLE;
  33. // sound effect here
  34. }
  35. void BulletFlame::process_idle()
  36. {
  37. // Sprite::process_idle();
  38. if( ++cur_frame <= cur_sprite_stop()->frame_count )
  39. {
  40. // ----- warn/ attack target every frame -------//
  41. warn_target();
  42. check_hit();
  43. }
  44. else
  45. {
  46. cur_action = SPRITE_DIE;
  47. cur_frame = 1;
  48. }
  49. }
  50. //--------- Begin of function BulletFlame::display_layer -------//
  51. char BulletFlame::display_layer()
  52. {
  53. switch(mobile_type)
  54. {
  55. case UNIT_LAND:
  56. case UNIT_SEA:
  57. return 2;
  58. case UNIT_AIR:
  59. return 8;
  60. default:
  61. err_here();
  62. return 1;
  63. }
  64. }
  65. //--------- End of function BulletFlame::display_layer -------//