forked from LemonHaze420/DCMoHo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcannonbl.cpp
More file actions
77 lines (60 loc) · 1.48 KB
/
Copy pathcannonbl.cpp
File metadata and controls
77 lines (60 loc) · 1.48 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
#include "Common.h"
#include "Globals.h"
#include "CannonBl.h"
//******************************************************************************************
void CCannonBall::Init(CInitThing *i)
{
SUPERTYPE::Init(i);
mLanded = FALSE;
}
//******************************************************************************************
void CCannonBall::Process()
{
GINT l = mVelocity.Magnitude();
if (l > G(0, 100))
{
GVector v = mVelocity / l;
GVector u = GVector(G0, G0, -G(1));
GVector r = v ^ u;
r.Normalise();
u = v ^ r;
mOrientation.Row[0] = r;
mOrientation.Row[1] = v;
mOrientation.Row[2] = -u;
mOrientation.TransposeInPlace();
}
if (!mLanded)
{
if (mVelocity.Z > G0) // going down!
{
if (!(COORDS_INVALID(CCellRef(mPos))))
{
GINT map_height = MAP.GetMapHeight(mPos);
if (mPos.Z + Radius() > map_height)
{
mLanded = TRUE;
MAP.Raindrop(CCellRef(mPos + GVector(GINT_HALF, GINT_HALF, G0)),
(G1 - G(0, 40000))); //er... the explosion does this as well!!
SuicideNext();
CThing *t = SpawnThing(OID_CFXExplosion2);
if (t)
{
CInitThing i;
i.mPos = mPos;
i.mPos.Z += G(2); // Down a bit...
t->Init(&i);
}
}
}
}
}
SUPERTYPE::Process();
}
//******************************************************************************************
#ifdef LINK_EDITOR
void CCannonBall::DeclareSpawnees()
{
SUPERTYPE::DeclareSpawnees();
WORLD.AccumulateOIDResources(OID_CFXExplosion2);
}
#endif