forked from LemonHaze420/DCMoHo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblimp.cpp
More file actions
145 lines (115 loc) · 3.33 KB
/
Copy pathblimp.cpp
File metadata and controls
145 lines (115 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#include "Common.h"
#if 0
#include "Globals.h"
#include "Blimp.h"
//******************************************************************************************
void CBlimp::Init(CInitThing *i)
{
SUPERTYPE::Init(i);
mYaw = G0;
mBladeOri = ID_GMATRIX;
mEngineOri = ID_GMATRIX;
SitOnGround(); // for the editor.
}
//******************************************************************************************
#define BLIMP_SPEED G(0, 8000)
#define BLIMP_HEIGHT (-(G(6)))
#define BLIMP_ANGULAR_ROTATION G(0, 900)
#define BLIMP_BLADE_ROTATION G(0, 50000)
void CBlimp::Process()
{
mYaw += BLIMP_ANGULAR_ROTATION;
mOrientation.MakeRotationYaw(mYaw);
GINT hd = BLIMP_HEIGHT + MAP.GetMapHeight(mPos) - mPos.Z;
mVelocity = mOrientation * GVector(G0, BLIMP_SPEED, hd * G(0, 20000));
GMatrix m;
m.MakeRotationRoll(BLIMP_BLADE_ROTATION);
mBladeOri = mBladeOri * m;
mBladeOri.Normalise();
m.MakeRotationPitch(BLIMP_BLADE_ROTATION / 30);
mEngineOri = mEngineOri * m;
mEngineOri.Normalise();
SUPERTYPE::Process();
}
//******************************************************************************************
GMatrix CBlimp::GetRenderOrientation(SINT no)
{
switch (no)
{
case 1:
case 3:
return mEngineOri;
case 2:
case 4:
return mBladeOri;
default:
return SUPERTYPE::GetRenderOrientation(no);
};
}
//******************************************************************************************
//******************************************************************************************
void CFlyDroid::Init(CInitThing *i)
{
SUPERTYPE::Init(i);
mYaw = G0;
mFan1Ori = ID_GMATRIX;
mFan2Ori = ID_GMATRIX;
mRadarOri = ID_GMATRIX;
SitOnGround(); // for the editor.
}
//******************************************************************************************
#define FLYDROID_SPEED G(0, 8000)
#define FLYDROID_HEIGHT (-(G(9)))
#define FLYDROID_ANGULAR_ROTATION G(0, 900)
//#define FLYDROID_FAN_ROTATION G(0, 12353)
#define FLYDROID_FAN_ROTATION G(0, 17000)
#define FLYDROID_RADAR_ROTATION G(0, 4118)
void CFlyDroid::Process()
{
mYaw += FLYDROID_ANGULAR_ROTATION;
mOrientation.MakeRotationYaw(mYaw);
GINT hd = FLYDROID_HEIGHT + MAP.GetMapHeight(mPos) - mPos.Z;
mVelocity = mOrientation * GVector(G0, FLYDROID_SPEED, hd * G(0, 20000));
GMatrix m;
m.MakeRotationYaw(FLYDROID_FAN_ROTATION);
mFan1Ori = mFan1Ori * m;
mFan1Ori.Normalise();
mFan2Ori = mFan2Ori * m.Transpose();
mFan2Ori.Normalise();
m.MakeRotationYaw(FLYDROID_RADAR_ROTATION);
mRadarOri = mRadarOri * m;
mRadarOri.Normalise();
SINT gt = GAME.GetGameTurn();
if ((gt >= 256) && (gt < 256 + 32 * 3) && ((gt & 31) == 0))
{
CThing * t = SpawnThing(OID_CSoldier1);
if (t)
{
CInitThing i;
i.mPos = mPos;
t->Init(&i);
t->Move(mPos + GVector(G0, G0, G(2))); // because init does SitOnGround()
}
}
SUPERTYPE::Process();
}
//******************************************************************************************
GMatrix CFlyDroid::GetRenderOrientation(SINT no)
{
switch (no)
{
case 4: return mFan1Ori;
case 5: return mFan2Ori;
case 6: return mRadarOri;
default: return SUPERTYPE::GetRenderOrientation(no);
};
}
//******************************************************************************************
#ifdef LINK_EDITOR
void CFlyDroid::DeclareSpawnees()
{
SUPERTYPE::DeclareSpawnees();
WORLD.AccumulateOIDResources(OID_CSoldier1);
}
#endif
#endif