ORAIN3.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 : ORAIN3.CPP
  21. // Description: class rain spot
  22. // Ownership : Gilbert
  23. #include <ORAIN.h>
  24. #include <OVGABUF.h>
  25. #include <COLOR.h>
  26. #include <OWORLDMT.h>
  27. // -------- Begin of function RainSpot::init -------//
  28. void RainSpot::init(Rain *, short destX, short destY, short maxStep)
  29. {
  30. // rain_ptr = rain;
  31. center_x = destX;
  32. center_y = destY;
  33. step = 0;
  34. max_step = maxStep;
  35. }
  36. // -------- End of function RainSpot::init -------//
  37. // -------- Begin of function RainSpot::fall -------//
  38. void RainSpot::fall()
  39. {
  40. step ++;
  41. }
  42. // -------- End of function RainSpot::fall -------//
  43. // -------- Begin of function RainSpot::draw_step -------//
  44. void RainSpot::draw_step(VgaBuf *vgabuf)
  45. {
  46. fall();
  47. short x,y;
  48. /*
  49. x = center_x - step;
  50. y = center_y - step/2;
  51. vgabuf->draw_pixel(x,y,0x73);
  52. x = center_x - step/2;
  53. y = center_y - step;
  54. vgabuf->draw_pixel(x,y,0x73);
  55. x = center_x + step/2;
  56. y = center_y - step;
  57. vgabuf->draw_pixel(x,y,0x73);
  58. x = center_x + step;
  59. y = center_y - step/2;
  60. vgabuf->draw_pixel(x,y,0x73);
  61. */
  62. // BUGHERE : didn't check ZOOM_X1,Y1,X2,Y2
  63. x = center_x - step;
  64. y = center_y - step;
  65. // ##### begin Gilbert 8/5 ######//
  66. if( x >= ZOOM_X1 && x < ZOOM_X2 && y >= ZOOM_Y1 && y < ZOOM_Y2)
  67. vgabuf->draw_pixel(x,y,VGA_GRAY+12);
  68. x = center_x - step;
  69. y = center_y + step/2;
  70. if( x >= ZOOM_X1 && x < ZOOM_X2 && y >= ZOOM_Y1 && y < ZOOM_Y2)
  71. vgabuf->draw_pixel(x,y,VGA_GRAY+12);
  72. x = center_x + step;
  73. y = center_y - step;
  74. if( x >= ZOOM_X1 && x < ZOOM_X2 && y >= ZOOM_Y1 && y < ZOOM_Y2)
  75. vgabuf->draw_pixel(x,y,VGA_GRAY+12);
  76. x = center_x + step;
  77. y = center_y + step/2;
  78. if( x >= ZOOM_X1 && x < ZOOM_X2 && y >= ZOOM_Y1 && y < ZOOM_Y2)
  79. vgabuf->draw_pixel(x,y,VGA_GRAY+12);
  80. // ##### end Gilbert 8/5 ######//
  81. }
  82. // -------- End of function RainSpot::draw_step -------//
  83. // -------- Begin of function RainSpot::is_goal -------//
  84. int RainSpot::is_goal()
  85. {
  86. return step > max_step;
  87. }
  88. // -------- End of function RainSpot::is_goal -------//