BackCliffModifier.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. FinalSun/FinalAlert 2 Mission Editor
  3. Copyright (C) 1999-2024 Electronic Arts, Inc.
  4. Authored by Matthias Wagner
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. // BackCliffModifier.cpp: Implementierung der Klasse CBackCliffModifier.
  17. //
  18. //////////////////////////////////////////////////////////////////////
  19. #include "stdafx.h"
  20. #include "stdafx.h"
  21. #include "BackCliffModifier.h"
  22. #include <vector>
  23. #include "variables.h"
  24. #ifdef _DEBUG
  25. #undef THIS_FILE
  26. static char THIS_FILE[]=__FILE__;
  27. #define new DEBUG_NEW
  28. #endif
  29. //////////////////////////////////////////////////////////////////////
  30. // Konstruktion/Destruktion
  31. //////////////////////////////////////////////////////////////////////
  32. CBackCliffModifier::CBackCliffModifier()
  33. {
  34. }
  35. CBackCliffModifier::~CBackCliffModifier()
  36. {
  37. }
  38. void CBackCliffModifier::ModifyCurrentPos(DWORD *dwPos, BOOL bBeforePlacing, BOOL bSmall)
  39. {
  40. if(!bBeforePlacing)
  41. {
  42. if(m_direction==cd_verticdiag_top) (*dwPos)+=2+0*Map->GetIsoSize();
  43. if(m_direction==cd_verticdiag_bottom) (*dwPos)+=-2+0*Map->GetIsoSize();
  44. }
  45. }
  46. void CBackCliffModifier::ModifyStartPos(DWORD *dwPos, BOOL bSmall)
  47. {
  48. if(m_direction==cd_verticdiag_top) (*dwPos)+=1+1*Map->GetIsoSize();
  49. if(m_direction==cd_verticdiag_bottom) (*dwPos)+=-1+0*Map->GetIsoSize();
  50. if(m_direction==cd_horiz_right) (*dwPos)+=0+0*Map->GetIsoSize();
  51. if(m_direction==cd_horiz_left)
  52. {
  53. int ground=Map->GetFielddataAt(*dwPos)->wGround;
  54. (*dwPos)+=0+Map->GetIsoSize();
  55. if(ground==0xFFFF) ground=0;
  56. if((*tiledata)[ground].wTileSet==cliffset)
  57. {
  58. (*dwPos)-=Map->GetIsoSize();
  59. //ModifyStartPos(dwPos, bSmall);
  60. }
  61. }
  62. if(m_direction==cd_vertic_top)
  63. {
  64. int ground=Map->GetFielddataAt(*dwPos)->wGround;
  65. (*dwPos)+=1;
  66. if(ground==0xFFFF) ground=0;
  67. if((*tiledata)[ground].wTileSet==cliffset)
  68. {
  69. (*dwPos)-=1;
  70. //ModifyStartPos(dwPos, bSmall);
  71. }
  72. }
  73. }
  74. CString CBackCliffModifier::GetDataSection()
  75. {
  76. if(m_bAlternative) return ("CliffBackDataAlt");
  77. return("CliffBackData");
  78. }