MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / MissileControl

Function MissileControl

TombEngine/Objects/TR5/Object/tr5_missile.cpp:24–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22int DebrisFlags;
23
24void MissileControl(short itemNumber)
25{
26 auto* fx = &EffectList[itemNumber];
27
28 if (fx->flag1 == 2)
29 {
30 fx->pos.Orientation.z += 16 * fx->speed;
31
32 if (fx->speed > 64)
33 fx->speed -= 4;
34
35 if (fx->pos.Orientation.x > -12288)
36 {
37 if (fx->fallspeed < 512)
38 fx->fallspeed += 36;
39 fx->pos.Orientation.x -= fx->fallspeed;
40 }
41 }
42 else
43 {
44 auto orient = Geometry::GetOrientToPoint(
45 Vector3(fx->pos.Position.x, fx->pos.Position.y + CLICK(1), fx->pos.Position.z),
46 LaraItem->Pose.Position.ToVector3());
47
48 int dh;
49 if (fx->flag1)
50 dh = fx->flag1 != 1 ? 768 : 384;
51 else
52 {
53 if (fx->counter)
54 fx->counter--;
55
56 dh = 256;
57 }
58
59 if (fx->speed < 192)
60 {
61 if (fx->flag1 == 0 || fx->flag1 == 1)
62 fx->speed++;
63
64 int dy = orient.y - fx->pos.Orientation.y;
65 if (abs(dy) > abs(ANGLE(180.0f)))
66 dy = -dy;
67 dy /= 8;
68
69 int dx = orient.x - fx->pos.Orientation.x;
70 if (abs(dx) > abs(ANGLE(180.0f)))
71 dx = -dx;
72 dx /= 8;
73
74 if (dy <= dh)
75 {
76 if (dy < -dh)
77 dy = -dh;
78 }
79 else
80 dy = dh;
81

Callers

nothing calls this directly

Calls 15

GetOrientToPointFunction · 0.85
ANGLEFunction · 0.85
phd_cosFunction · 0.85
phd_sinFunction · 0.85
GetPointCollisionFunction · 0.85
TriggerExplosionSparksFunction · 0.85
TriggerShockwaveFunction · 0.85
ExplodeFXFunction · 0.85
SoundEffectFunction · 0.85
KillEffectFunction · 0.85
ItemNearLaraFunction · 0.85
DoDamageFunction · 0.85

Tested by

no test coverage detected