File: ScriptMoveType.h

package info (click to toggle)
spring 105.0.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 108,860 kB
  • sloc: cpp: 467,785; ansic: 302,607; python: 12,925; java: 12,201; awk: 5,889; sh: 2,371; xml: 655; perl: 405; php: 276; objc: 194; makefile: 75; sed: 2
file content (90 lines) | stat: -rw-r--r-- 2,235 bytes parent folder | download | duplicates (3)
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
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */

#ifndef SCRIPT_MOVE_TYPE_H
#define SCRIPT_MOVE_TYPE_H

#include "MoveType.h"

class CScriptMoveType : public AMoveType
{
	CR_DECLARE_DERIVED(CScriptMoveType)

	public:
		CScriptMoveType(CUnit* owner);
		virtual ~CScriptMoveType();

	public:
		bool Update() override;
		void ForceUpdates();

		void SetPhysics(const float3& pos, const float3& vel, const float3& rot);
		void SetPosition(const float3& pos);
		void SetVelocity(const float3& vel);
		void SetRelativeVelocity(const float3& rvel);
		void SetRotation(const float3& rot);
		void SetRotationVelocity(const float3& rvel);
		void SetHeading(short heading);
		void SetNoBlocking(bool state);

		enum ScriptNotifyState {
			HitNothing = 0,
			HitGround = 1,
			HitLimit = 2,
		};

	public: // null'ed virtuals
		void StartMoving(float3, float goalRadius) override {}
		void StartMoving(float3, float goalRadius, float speed) override {}
		void KeepPointingTo(float3, float distance, bool aggressive) override {}
		void KeepPointingTo(CUnit* unit, float distance, bool aggressive) override {}
		void StopMoving(bool callScript = false, bool hardStop = false, bool cancelRaw = false) override {}

		void SetGoal(const float3& pos, float distance = 0.0f) override {}
		void SetMaxSpeed(float speed) override {}
		void SetWantedMaxSpeed(float speed) override {}
		void LeaveTransport() override {}

	protected:
		void CheckLimits();
		void CheckNotify();

	public:
		/// velocity vector
		float3 velVec;
		/// relative velocity (to current direction)
		float3 relVel;

		/// angular position
		float3 rot;
		/// angular velocity
		float3 rotVel;

		float3 mins = {-1.0e9f, -1.0e9f, -1.0e9f};
		float3 maxs = {+1.0e9f, +1.0e9f, +1.0e9f};

		int tag = 0;

		float drag = 0.0f;
		float groundOffset = 0.0f;

		float gravityFactor = 0.0f;
		float windFactor = 0.0f;

		bool extrapolate = true;
		bool useRelVel = false;
		bool useRotVel = false;

		bool trackSlope = false;
		bool trackGround = false;
		bool trackLimits = false;

		bool noBlocking = false;

		bool groundStop = false;
		bool limitsStop = false;

	protected:
		ScriptNotifyState scriptNotify = HitNothing;
};

#endif // SCRIPT_MOVE_TYPE_H