From 8898ad9b25fca6afe2374d293a981db02a83d7e9 Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Thu, 31 May 2012 14:46:27 +0000 Subject: Committing the documentation to svn to have it accessible online --- Doc/doxygen/html/_msn_obj_dlg_8cpp_source.html | 433 +++++++++++++++++++++++++ 1 file changed, 433 insertions(+) create mode 100644 Doc/doxygen/html/_msn_obj_dlg_8cpp_source.html (limited to 'Doc/doxygen/html/_msn_obj_dlg_8cpp_source.html') diff --git a/Doc/doxygen/html/_msn_obj_dlg_8cpp_source.html b/Doc/doxygen/html/_msn_obj_dlg_8cpp_source.html new file mode 100644 index 0000000..c7d1b67 --- /dev/null +++ b/Doc/doxygen/html/_msn_obj_dlg_8cpp_source.html @@ -0,0 +1,433 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/MsnObjDlg.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
MsnObjDlg.cpp
+
+
+Go to the documentation of this file.
1 /* Project Starshatter 5.0
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2007. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: Stars.exe
+
6  FILE: MsnObjDlg.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Mission Briefing Dialog Active Window class
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "MsnObjDlg.h"
+
17 #include "PlanScreen.h"
+
18 #include "Campaign.h"
+
19 #include "Mission.h"
+
20 #include "Ship.h"
+
21 #include "ShipDesign.h"
+
22 #include "ShipSolid.h"
+
23 #include "StarSystem.h"
+
24 
+
25 #include "Game.h"
+
26 #include "Mouse.h"
+
27 #include "Button.h"
+
28 #include "ComboBox.h"
+
29 #include "ListBox.h"
+
30 #include "Slider.h"
+
31 #include "ParseUtil.h"
+
32 #include "FormatUtil.h"
+
33 #include "Light.h"
+
34 #include "Solid.h"
+
35 #include "Keyboard.h"
+
36 
+
37 // +--------------------------------------------------------------------+
+
38 // DECLARE MAPPING FUNCTIONS:
+
39 DEF_MAP_CLIENT(MsnObjDlg, OnCommit);
+
40 DEF_MAP_CLIENT(MsnObjDlg, OnCancel);
+
41 DEF_MAP_CLIENT(MsnObjDlg, OnTabButton);
+
42 DEF_MAP_CLIENT(MsnObjDlg, OnSkin);
+
43 
+
44 // +--------------------------------------------------------------------+
+
45 
+ +
47 : FormWindow(s, 0, 0, s->Width(), s->Height()), MsnDlg(mgr),
+
48 objectives(0), sitrep(0), beauty(0), camview(0), player_desc(0),
+
49 ship(0)
+
50 {
+ +
52 
+
53  if (campaign)
+ +
55 
+
56  Init(def);
+
57 }
+
58 
+ +
60 {
+
61 }
+
62 
+
63 // +--------------------------------------------------------------------+
+
64 
+
65 void
+ +
67 {
+
68  objectives = FindControl(400);
+
69  sitrep = FindControl(401);
+
70  beauty = FindControl(300);
+
71  player_desc = FindControl(301);
+
72  cmb_skin = (ComboBox*) FindControl(302);
+
73 
+
74  RegisterMsnControls(this);
+
75 
+
76  if (commit)
+ +
78 
+
79  if (cancel)
+ +
81 
+
82  if (sit_button)
+ +
84 
+
85  if (pkg_button)
+ +
87 
+
88  if (nav_button)
+ +
90 
+
91  if (wep_button)
+ +
93 
+
94  if (cmb_skin) {
+ +
96  }
+
97 
+
98  if (beauty) {
+
99  scene.SetAmbient(Color(72,75,78));
+
100 
+
101  Point light_pos(3e6, 5e6, 4e6);
+
102 
+
103  Light* main_light = new Light(1.2f);
+
104  main_light->MoveTo(light_pos);
+
105  main_light->SetType(Light::LIGHT_DIRECTIONAL);
+
106  main_light->SetColor(Color::White);
+
107  main_light->SetShadow(true);
+
108 
+
109  scene.AddLight(main_light);
+
110 
+
111  Light* back_light = new Light(0.35f);
+
112  back_light->MoveTo(light_pos * -1);
+
113  back_light->SetType(Light::LIGHT_DIRECTIONAL);
+
114  back_light->SetColor(Color::White);
+
115  back_light->SetShadow(false);
+
116 
+
117  scene.AddLight(back_light);
+
118 
+
119  camview = new(__FILE__,__LINE__) CameraView(beauty, &cam, &scene);
+ + +
122 
+ +
124  }
+
125 }
+
126 
+
127 // +--------------------------------------------------------------------+
+
128 
+
129 void
+ +
131 {
+
132  bool update_scene = !shown;
+
133 
+ +
135  ShowMsnDlg();
+
136 
+
137  if (objectives) {
+
138  if (mission) {
+
139  if (mission->IsOK())
+ +
141  else
+
142  objectives->SetText("");
+
143  }
+
144  else {
+
145  objectives->SetText(Game::GetText("MsnDlg.no-mission"));
+
146  }
+
147  }
+
148 
+
149  if (sitrep) {
+
150  if (mission) {
+
151  if (mission->IsOK())
+ +
153  else
+
154  sitrep->SetText(Game::GetText("MsnDlg.found-errors") +
+
155  mission->ErrorMessage());
+
156  }
+
157  else {
+
158  sitrep->SetText(Game::GetText("MsnDlg.no-mission"));
+
159  }
+
160  }
+
161 
+
162  if (cmb_skin) {
+
163  cmb_skin->ClearItems();
+
164  cmb_skin->Hide();
+
165  }
+
166 
+
167  if (beauty) {
+
168  if (mission && mission->IsOK()) {
+
169  MissionElement* elem = mission->GetPlayer();
+
170 
+
171  if (elem) {
+
172  const ShipDesign* design = elem->GetDesign();
+
173 
+
174  if (design && camview && update_scene) {
+
175  double az = -PI/6;
+
176  double el = PI/8;
+
177  double zoom = 1.8;
+
178 
+
179  scene.Graphics().clear();
+
180 
+
181  if (elem->IsStarship()) {
+
182  az = -PI/8;
+
183  el = PI/12;
+
184  zoom = 1.7;
+
185  }
+
186 
+
187  if (design->beauty_cam.z > 0) {
+
188  az = design->beauty_cam.x;
+
189  el = design->beauty_cam.y;
+
190  zoom = design->beauty_cam.z;
+
191  }
+
192 
+
193  double r = design->radius;
+
194  double x = zoom * r * sin(az) * cos(el);
+
195  double y = zoom * r * cos(az) * cos(el);
+
196  double z = zoom * r * sin(el);
+
197 
+
198  cam.LookAt(Point(0,0,r/5), Point(x,z,y), Point(0,1,0));
+
199 
+
200  int n = design->lod_levels;
+
201 
+
202  if (n >= 1) {
+
203  Model* model = design->models[n-1].at(0);
+
204 
+
205  if (model) {
+
206  ship = new(__FILE__,__LINE__) ShipSolid(0);
+
207  ship->UseModel(model);
+
208  ship->CreateShadows(1);
+
209  ship->SetSkin(elem->GetSkin());
+
210 
+
211  Matrix o;
+
212  o.Pitch( 3 * DEGREES);
+
213  o.Roll( 13 * DEGREES);
+
214 
+
215  ship->SetOrientation(o);
+
216 
+ +
218  }
+
219  }
+
220  }
+
221 
+
222  if (cmb_skin && design && design->skins.size()) {
+
223  cmb_skin->Show();
+
224  cmb_skin->AddItem(Game::GetText("MsnDlg.default"));
+ +
226  ListIter<Skin> iter = ((ShipDesign*) design)->skins;
+
227 
+
228  while (++iter) {
+
229  Skin* s = iter.value();
+
230  cmb_skin->AddItem(s->Name());
+
231 
+
232  if (elem && elem->GetSkin() && !strcmp(s->Name(), elem->GetSkin()->Name())) {
+ +
234  }
+
235  }
+
236  }
+
237  }
+
238  }
+
239  }
+
240 
+
241  if (player_desc) {
+
242  player_desc->SetText("");
+
243 
+
244  if (mission && mission->IsOK()) {
+
245  MissionElement* elem = mission->GetPlayer();
+
246 
+
247  if (elem) {
+
248  const ShipDesign* design = elem->GetDesign();
+
249 
+
250  if (design) {
+
251  char txt[256];
+
252 
+
253  if (design->type <= Ship::ATTACK)
+
254  sprintf_s(txt, "%s %s", design->abrv, design->display_name);
+
255  else
+
256  sprintf_s(txt, "%s %s", design->abrv, elem->Name().data());
+
257 
+
258  player_desc->SetText(txt);
+
259  }
+
260  }
+
261  }
+
262  }
+
263 }
+
264 
+
265 // +--------------------------------------------------------------------+
+
266 
+
267 void
+ +
269 {
+
270  if (Keyboard::KeyDown(VK_RETURN)) {
+
271  OnCommit(0);
+
272  }
+
273 }
+
274 
+
275 // +--------------------------------------------------------------------+
+
276 
+
277 void
+ +
279 {
+
280  Text skin_name = cmb_skin->GetSelectedItem();
+
281 
+
282  if (mission && mission->IsOK()) {
+
283  MissionElement* elem = mission->GetPlayer();
+
284 
+
285  if (elem) {
+
286  const ShipDesign* design = elem->GetDesign();
+
287 
+
288  if (design) {
+
289  const Skin* skin = design->FindSkin(skin_name);
+
290 
+
291  elem->SetSkin(skin);
+
292 
+
293  if (ship)
+
294  ship->SetSkin(skin);
+
295  }
+
296  }
+
297  }
+
298 }
+
299 
+
300 void
+ +
302 {
+
303  MsnDlg::OnCommit(event);
+
304 }
+
305 
+
306 void
+ +
308 {
+
309  MsnDlg::OnCancel(event);
+
310 }
+
311 
+
312 void
+ +
314 {
+
315  MsnDlg::OnTabButton(event);
+
316 }
+
+
+ + + + -- cgit v1.1