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/_drop_ship_a_i_8cpp_source.html | 239 +++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 Doc/doxygen/html/_drop_ship_a_i_8cpp_source.html (limited to 'Doc/doxygen/html/_drop_ship_a_i_8cpp_source.html') diff --git a/Doc/doxygen/html/_drop_ship_a_i_8cpp_source.html b/Doc/doxygen/html/_drop_ship_a_i_8cpp_source.html new file mode 100644 index 0000000..5c59103 --- /dev/null +++ b/Doc/doxygen/html/_drop_ship_a_i_8cpp_source.html @@ -0,0 +1,239 @@ + + + + + +Starshatter_Open: D:/SRC/StarshatterSVN/Stars45/DropShipAI.cpp Source File + + + + + + + + + + + + + +
+
+ + + + + + +
+
Starshatter_Open +
+
Open source Starshatter engine
+
+
+ + + + + +
+
+ +
+
+
+ +
+ + + + +
+ +
+ +
+
+
DropShipAI.cpp
+
+
+Go to the documentation of this file.
1 /* Project Starshatter 4.5
+
2  Destroyer Studios LLC
+
3  Copyright © 1997-2004. All Rights Reserved.
+
4 
+
5  SUBSYSTEM: Stars.exe
+
6  FILE: DropShipAI.cpp
+
7  AUTHOR: John DiCamillo
+
8 
+
9 
+
10  OVERVIEW
+
11  ========
+
12  Drop Ship (orbit/surface and surface/orbit) AI class
+
13 */
+
14 
+
15 #include "MemDebug.h"
+
16 #include "DropShipAI.h"
+
17 #include "TacticalAI.h"
+
18 #include "Ship.h"
+
19 #include "ShipCtrl.h"
+
20 #include "Drive.h"
+
21 #include "Sim.h"
+
22 #include "StarSystem.h"
+
23 #include "KeyMap.h"
+
24 
+
25 #include "Game.h"
+
26 
+
27 // +----------------------------------------------------------------------+
+
28 
+ +
30 : ShipAI(s)
+
31 {
+
32  seek_gain = 20;
+
33  seek_damp = 0.5;
+
34 
+
35  delete tactical;
+
36  tactical = 0;
+
37 }
+
38 
+ +
40 {
+
41 }
+
42 
+
43 // +--------------------------------------------------------------------+
+
44 
+
45 void
+ +
47 {
+
48  distance = 0;
+
49 
+
50  if (!ship) return;
+
51 
+
52  Sim* sim = Sim::GetSim();
+
53  SimRegion* self_rgn = ship->GetRegion();
+
54 
+
55  // if making orbit, go up:
+
56  if (self_rgn->Type() == Sim::AIR_SPACE) {
+
57  obj_w = self->Location() + Point(0, 1e3, 0);
+
58  }
+
59 
+
60  // if breaking orbit, head for terrain region:
+
61  else {
+
62  SimRegion* dst_rgn = sim->FindNearestTerrainRegion(ship);
+
63  Point dst = dst_rgn->GetOrbitalRegion()->Location() -
+
64  self_rgn->GetOrbitalRegion()->Location() +
+
65  Point(0, 0, -1e6);
+
66 
+
67  obj_w = dst.OtherHand();
+
68  }
+
69 
+
70  // distance from self to navpt:
+
71  distance = Point(obj_w - self->Location()).length();
+
72 
+
73  // transform into camera coords:
+ + +
76 }
+
77 
+
78 // +--------------------------------------------------------------------+
+
79 
+
80 void
+ +
82 {
+ +
84  magnitude = 0;
+
85 
+
86  if (other)
+ +
88  else
+ +
90 
+ + +
93 
+
94  // are we being asked to flee?
+
95  if (fabs(accumulator.yaw) == 1.0 && accumulator.pitch == 0.0) {
+
96  accumulator.pitch = -0.7f;
+
97  accumulator.yaw *= 0.25f;
+
98  }
+
99 
+
100  self->ApplyRoll((float) (accumulator.yaw * -0.4));
+
101  self->ApplyYaw((float) (accumulator.yaw * 0.2));
+
102 
+
103  if (fabs(accumulator.yaw) > 0.5 && fabs(accumulator.pitch) < 0.1)
+
104  accumulator.pitch -= 0.1f;
+
105 
+
106  if (accumulator.pitch != 0)
+
107  self->ApplyPitch((float) accumulator.pitch);
+
108 
+
109  // if not turning, roll to orient with world coords:
+
110  if (fabs(accumulator.yaw) < 0.1) {
+
111  Point vrt = ((Camera*) &(self->Cam()))->vrt();
+
112  double deflection = vrt.y;
+
113  if (deflection != 0) {
+
114  double theta = asin(deflection/vrt.length());
+
115  self->ApplyRoll(-theta);
+
116  }
+
117  }
+
118 
+
119  ship->SetThrottle(100);
+
120  ship->ExecFLCSFrame();
+
121 }
+
122 
+
+
+ + + + -- cgit v1.1