/
clown.cpp
84 lines (60 loc) · 1.63 KB
/
clown.cpp
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
#include "Common.h"
#if 0
#include "Clown.h"
#include "Globals.h"
//******************************************************************************************
void CClown::Init(CInitThing *i)
{
SUPERTYPE::Init(i);
ChangeState(CS_ASLEEP, CStateInit());
}
//******************************************************************************************
void CClown::Process()
{
SUPERTYPE::Process();
}
//******************************************************************************************
#define CLOWN_BULLET_SPEED G(1)
void CClown::StateNormal()
{
SINT num = GAME.GetGameTurn() + mNumber * 43;
SINT n3 = num / 3;
if ((n3 * 3) == num)
{
if ((n3 % 16) < 3)
{
CThing *t = SpawnThing(OID_CPJBullet);
if (t)
{
CInitThing i;
GVector start = mPos + GVector(G0, G0, -G(0, 30000));
GVector v = (WORLD.GetPrimaryPosition() /*+ GVector(G0, G0, -G(0, 20000))*/ - start);
GINT l = v.Magnitude();
if (l > G(0, 1000))
{
v = v / l;
v = v * CLOWN_BULLET_SPEED;
i.mVelocity = v;
i.mVelocity += GVector(G(0, (RANDOM() % 4000)) - G(0, 2000),
G(0, (RANDOM() % 4000)) - G(0, 2000),
G(0, (RANDOM() % 1000)) - G(0, 500));
i.mVelocity += mVelocity / 2;
i.mPos = start + GetRenderThingEmitter(0);
t->Init(&i);
SOUND.PlaySample(SOUND_SHOT2, this);
}
}
SetAnimMode(AM_SHOOT);
}
}
SUPERTYPE::StateNormal();
}
//******************************************************************************************
#ifdef LINK_EDITOR
void CClown::DeclareSpawnees()
{
SUPERTYPE::DeclareSpawnees();
WORLD.AccumulateOIDResources(OID_CPJBullet);
}
#endif
#endif