Lighting.cpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. // Lighting.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "FinalSun.h"
  20. #include "Lighting.h"
  21. #include "mapdata.h"
  22. #include "variables.h"
  23. #ifdef _DEBUG
  24. #define new DEBUG_NEW
  25. #undef THIS_FILE
  26. static char THIS_FILE[] = __FILE__;
  27. #endif
  28. /////////////////////////////////////////////////////////////////////////////
  29. // Eigenschaftenseite CLighting
  30. IMPLEMENT_DYNCREATE(CLighting, CDialog)
  31. CLighting::CLighting() : CDialog(CLighting::IDD)
  32. {
  33. //{{AFX_DATA_INIT(CLighting)
  34. //}}AFX_DATA_INIT
  35. }
  36. CLighting::~CLighting()
  37. {
  38. }
  39. void CLighting::DoDataExchange(CDataExchange* pDX)
  40. {
  41. CDialog::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(CLighting)
  43. DDX_Control(pDX, IDC_RED2, m_Red2);
  44. DDX_Control(pDX, IDC_RED, m_Red);
  45. DDX_Control(pDX, IDC_LEVEL2, m_Level2);
  46. DDX_Control(pDX, IDC_LEVEL, m_Level);
  47. DDX_Control(pDX, IDC_GREEN2, m_Green2);
  48. DDX_Control(pDX, IDC_GREEN, m_Green);
  49. DDX_Control(pDX, IDC_BLUE2, m_Blue2);
  50. DDX_Control(pDX, IDC_BLUE, m_Blue);
  51. DDX_Control(pDX, IDC_AMBIENT2, m_Ambient2);
  52. DDX_Control(pDX, IDC_AMBIENT, m_Ambient);
  53. //}}AFX_DATA_MAP
  54. }
  55. BEGIN_MESSAGE_MAP(CLighting, CDialog)
  56. //{{AFX_MSG_MAP(CLighting)
  57. ON_EN_CHANGE(IDC_AMBIENT, OnChangeAmbient)
  58. ON_EN_CHANGE(IDC_LEVEL, OnChangeLevel)
  59. ON_EN_KILLFOCUS(IDC_AMBIENT, OnKillfocusAmbient)
  60. ON_EN_CHANGE(IDC_RED, OnChangeRed)
  61. ON_EN_CHANGE(IDC_GREEN, OnChangeGreen)
  62. ON_EN_CHANGE(IDC_BLUE, OnChangeBlue)
  63. ON_EN_CHANGE(IDC_AMBIENT2, OnChangeAmbient2)
  64. ON_EN_CHANGE(IDC_LEVEL2, OnChangeLevel2)
  65. ON_EN_CHANGE(IDC_RED2, OnChangeRed2)
  66. ON_EN_CHANGE(IDC_GREEN2, OnChangeGreen2)
  67. ON_EN_CHANGE(IDC_BLUE2, OnChangeBlue2)
  68. //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70. /////////////////////////////////////////////////////////////////////////////
  71. // Behandlungsroutinen für Nachrichten CLighting
  72. void CLighting::UpdateDialog()
  73. {
  74. CIniFile& ini=Map->GetIniFile();
  75. m_Ambient.SetWindowText(ini.sections["Lighting"].values["Ambient"]);
  76. m_Ambient2.SetWindowText(ini.sections["Lighting"].values["IonAmbient"]);
  77. m_Level.SetWindowText(ini.sections["Lighting"].values["Level"]);
  78. m_Level2.SetWindowText(ini.sections["Lighting"].values["IonLevel"]);
  79. m_Red.SetWindowText(ini.sections["Lighting"].values["Red"]);
  80. m_Red2.SetWindowText(ini.sections["Lighting"].values["IonRed"]);
  81. m_Green.SetWindowText(ini.sections["Lighting"].values["Green"]);
  82. m_Green2.SetWindowText(ini.sections["Lighting"].values["IonGreen"]);
  83. m_Blue.SetWindowText(ini.sections["Lighting"].values["Blue"]);
  84. m_Blue2.SetWindowText(ini.sections["Lighting"].values["IonBlue"]);
  85. //MessageBox(ini.sections["Lightning"].values["Ambient"]);
  86. }
  87. BOOL CLighting::OnInitDialog()
  88. {
  89. CDialog::OnInitDialog();
  90. #ifdef RA2_MODE
  91. SetDlgItemText(IDC_LIONSTORM, "Weather Storm Settings");
  92. #endif
  93. return TRUE; // return TRUE unless you set the focus to a control
  94. // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
  95. }
  96. void CLighting::OnChangeAmbient()
  97. {
  98. CIniFile& ini=Map->GetIniFile();
  99. CString ctext;
  100. m_Ambient.GetWindowText(ctext);
  101. CString text=(char*)(LPCTSTR)ctext;
  102. ini.sections["Lighting"].values["Ambient"]=text;
  103. }
  104. void CLighting::OnChangeLevel()
  105. {
  106. CIniFile& ini=Map->GetIniFile();
  107. CString ctext;
  108. m_Level.GetWindowText(ctext);
  109. CString text=(char*)(LPCTSTR)ctext;
  110. ini.sections["Lighting"].values["Level"]=text;
  111. }
  112. void CLighting::OnKillfocusAmbient()
  113. {
  114. }
  115. void CLighting::OnChangeRed()
  116. {
  117. CIniFile& ini=Map->GetIniFile();
  118. CString ctext;
  119. m_Red.GetWindowText(ctext);
  120. CString text=(char*)(LPCTSTR)ctext;
  121. ini.sections["Lighting"].values["Red"]=text;
  122. }
  123. void CLighting::OnChangeGreen()
  124. {
  125. CIniFile& ini=Map->GetIniFile();
  126. CString ctext;
  127. m_Green.GetWindowText(ctext);
  128. CString text=(char*)(LPCTSTR)ctext;
  129. ini.sections["Lighting"].values["Green"]=text;
  130. }
  131. void CLighting::OnChangeBlue()
  132. {
  133. CIniFile& ini=Map->GetIniFile();
  134. CString ctext;
  135. m_Blue.GetWindowText(ctext);
  136. CString text=(char*)(LPCTSTR)ctext;
  137. ini.sections["Lighting"].values["Blue"]=text;
  138. }
  139. void CLighting::OnChangeAmbient2()
  140. {
  141. CIniFile& ini=Map->GetIniFile();
  142. CString ctext;
  143. m_Ambient2.GetWindowText(ctext);
  144. CString text=(char*)(LPCTSTR)ctext;
  145. ini.sections["Lighting"].values["IonAmbient"]=text;
  146. }
  147. void CLighting::OnChangeLevel2()
  148. {
  149. CIniFile& ini=Map->GetIniFile();
  150. CString ctext;
  151. m_Level2.GetWindowText(ctext);
  152. CString text=(char*)(LPCTSTR)ctext;
  153. ini.sections["Lighting"].values["IonLevel"]=text;
  154. }
  155. void CLighting::OnChangeRed2()
  156. {
  157. CIniFile& ini=Map->GetIniFile();
  158. CString ctext;
  159. m_Red2.GetWindowText(ctext);
  160. CString text=(char*)(LPCTSTR)ctext;
  161. ini.sections["Lighting"].values["IonRed"]=text;
  162. }
  163. void CLighting::OnChangeGreen2()
  164. {
  165. CIniFile& ini=Map->GetIniFile();
  166. CString ctext;
  167. m_Green2.GetWindowText(ctext);
  168. CString text=(char*)(LPCTSTR)ctext;
  169. ini.sections["Lighting"].values["IonGreen"]=text;
  170. }
  171. void CLighting::OnChangeBlue2()
  172. {
  173. CIniFile& ini=Map->GetIniFile();
  174. CString ctext;
  175. m_Blue2.GetWindowText(ctext);
  176. CString text=(char*)(LPCTSTR)ctext;
  177. ini.sections["Lighting"].values["IonBlue"]=text;
  178. }