Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
vehiclecurve.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19/***********************************************************************************************
20 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
21 ***********************************************************************************************
22 * *
23 * Project Name : LevelEdit *
24 * *
25 * $Archive:: /VSS_Sync/wwmath/vehiclecurve.h $*
26 * *
27 * Author:: Patrick Smith *
28 * *
29 * $Modtime:: 6/13/01 2:18p $*
30 * *
31 * $Revision:: 6 $*
32 * *
33 *---------------------------------------------------------------------------------------------*
34 * Functions: *
35 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
36
37
38#if defined(_MSC_VER)
39#pragma once
40#endif
41
42#ifndef __VEHICLE_CURVE_H
43#define __VEHICLE_CURVE_H
44
45#include "curve.h"
46#include "vector.h"
47
48
50//
51// VehicleCurveClass
52//
53// A vehicle curve represents the path a vehicle would take through a series of points.
54// Each point on the curve passes through a turn-arc of the vehicle. The size of this
55// arc is determined by the turn radius which is used to initialize the curve.
56//
59{
60public:
61
63 // Public constructors/destructors
66 : m_IsDirty (true),
67 m_Radius (0),
68 m_LastTime (0),
69 m_Sharpness (0),
70 m_SharpnessPos (0, 0, 0),
71 Curve3DClass () { }
72
73 VehicleCurveClass (float radius)
74 : m_IsDirty (true),
75 m_Radius (radius),
76 m_LastTime (0),
77 m_Sharpness (0),
78 m_SharpnessPos (0, 0, 0),
79 Curve3DClass () { }
80
81 virtual ~VehicleCurveClass () {}
82
83
85 // Public methods
87
88 //
89 // Initialization
90 //
91 void Initialize_Arc (float radius);
92
93 //
94 // From Curve3DClass
95 //
96 void Evaluate (float time, Vector3 *set_val);
97 void Set_Key (int i,const Vector3 & point);
98 int Add_Key (const Vector3 & point,float t);
99 void Remove_Key (int i);
100 void Clear_Keys (void);
101
102 //
103 // Vehicle curve specific
104 //
105 float Get_Current_Sharpness (Vector3 *position) const { *position = m_SharpnessPos; return m_Sharpness; }
106 float Get_Last_Eval_Time (void) const { return m_LastTime; }
107
108 //
109 // Save-load support
110 //
111 virtual const PersistFactoryClass & Get_Factory(void) const;
112 virtual bool Save(ChunkSaveClass &csave);
113 virtual bool Load(ChunkLoadClass &cload);
114
115protected:
116
118 // Protected methods
120 void Update_Arc_List (void);
121 void Load_Variables (ChunkLoadClass &cload);
122
123
125 // Protected data types
127 typedef struct _ArcInfoStruct
128 {
133 float radius;
136
138 : center (0, 0, 0),
139 point_in (0, 0, 0),
140 point_out (0, 0, 0),
141 point_angle (0),
142 radius (0),
143 angle_in_delta (0),
144 angle_out_delta (0) { }
145
146 bool operator== (const _ArcInfoStruct &src) { return false; }
147 bool operator!= (const _ArcInfoStruct &src) { return true; }
148
150
152
154 // Protected member data
157 float m_Radius;
159
163};
164
166// Set_Key
168inline void
170{
171 m_IsDirty = true;
172 Curve3DClass::Set_Key (i, point);
173 return ;
174}
175
177// Add_Key
179inline int
180VehicleCurveClass::Add_Key (const Vector3 & point,float t)
181{
182 m_IsDirty = true;
183 return Curve3DClass::Add_Key (point, t);
184}
185
187// Remove_Key
189inline void
191{
192 m_IsDirty = true;
194 return ;
195}
196
198// Clear_Keys
200inline void
207
208
209#endif //__VEHICLE_CURVE_H
210
@ true
Definition bool.h:59
Curve3DClass(void)
Definition curve.cpp:87
virtual void Remove_Key(int i)
Definition curve.cpp:176
virtual void Clear_Keys(void)
Definition curve.cpp:183
virtual void Set_Key(int i, const Vector3 &point)
Definition curve.cpp:153
virtual int Add_Key(const Vector3 &point, float t)
Definition curve.cpp:161
int Add_Key(const Vector3 &point, float t)
void Evaluate(float time, Vector3 *set_val)
virtual ~VehicleCurveClass()
void Set_Key(int i, const Vector3 &point)
void Remove_Key(int i)
virtual bool Save(ChunkSaveClass &csave)
void Clear_Keys(void)
struct VehicleCurveClass::_ArcInfoStruct ArcInfoStruct
DynamicVectorClass< ArcInfoStruct > ARC_LIST
VehicleCurveClass(float radius)
float Get_Last_Eval_Time(void) const
void Load_Variables(ChunkLoadClass &cload)
void Initialize_Arc(float radius)
float Get_Current_Sharpness(Vector3 *position) const
virtual const PersistFactoryClass & Get_Factory(void) const
void Update_Arc_List(void)
virtual bool Load(ChunkLoadClass &cload)
else return(RetVal)
bool operator!=(const _ArcInfoStruct &src)
bool operator==(const _ArcInfoStruct &src)