Tiberian Technologies Scripts Reference Revision: 9000
Loading...
Searching...
No Matches
ConversationClass.h
1/* Renegade Scripts.dll
2Copyright 2013 Tiberian Technologies
3
4This file is part of the Renegade scripts.dll
5The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free
7Software Foundation; either version 2, or (at your option) any later
8version. See the file COPYING for more details.
9In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
10Only the source code to the module(s) containing the licenced code has to be released.
11*/
12#ifndef TT_INCLUDE_CONVERSATIONCLASS_H
13#define TT_INCLUDE_CONVERSATIONCLASS_H
14#include "engine_vector.h"
15#include "ReferencerClass.h"
16#include "PhysicalGameObj.h"
17#include "Vector3.h"
18class ConversationRemarkClass {
19public:
20 ConversationRemarkClass() : OratorID(0), TextID(0)
21 {
22 }
23 virtual ~ConversationRemarkClass()
24 {
25 }
26 ConversationRemarkClass(const ConversationRemarkClass & that) : OratorID(0), TextID(0)
27 {
28 *this = that;
29 }
30 ConversationRemarkClass const &operator = (ConversationRemarkClass const & that)
31 {
32 OratorID = that.OratorID;
33 TextID = that.TextID;
34 AnimationName = that.AnimationName;
35 return *this;
36 }
37 int Get_Orator_ID() const
38 {
39 return OratorID;
40 }
41 void Set_Orator_ID(int id)
42 {
43 OratorID = id;
44 }
45 uint32 Get_Text_ID() const
46 {
47 return TextID;
48 }
49 void Set_Text_ID(uint32 id)
50 {
51 TextID = id;
52 }
53 const char *Get_Animation_Name() const
54 {
55 return AnimationName;
56 }
57 void Set_Animation_Name(const char *name)
58 {
59 AnimationName = name;
60 }
61 bool operator ==(ConversationRemarkClass const & that)
62 {
63 if ((TextID == that.TextID) && (OratorID == that.OratorID))
64 {
65 return true;
66 }
67 return false;
68 }
69 bool operator !=(ConversationRemarkClass const & that)
70 {
71 if ((TextID != that.TextID) || (OratorID != that.OratorID))
72 {
73 return true;
74 }
75 return false;
76 }
77 bool Save(ChunkSaveClass &cload);
78 bool Load(ChunkLoadClass &cload);
79 void Load_Variables(ChunkLoadClass &cload);
80private:
81 int OratorID;
82 uint32 TextID;
83 StringClass AnimationName;
84};
85class OratorClass {
86private:
87 OratorClass(const OratorClass& that); // Disallow copying
88 void *unk; //0
89 ReferencerClass Owner; //4
90 Vector3 Position; //18
91 bool Arrived; //20
92 int Flags; //24
93 int OratorID;
94 int unk2C;
95 int FacingID;
96 bool unk34;
97public:
98 OratorClass& operator=(const OratorClass& that)
99 {
100 unk = that.unk;
101 Owner = that.Owner;
102 Position = that.Position;
103 Arrived = that.Arrived;
104 Flags = that.Flags;
105 OratorID = that.OratorID;
106 unk2C = that.unk2C;
107 FacingID = that.FacingID;
108 unk34 = that.unk34;
109 return *this;
110 }
111 OratorClass() : unk(0), Position(0, 0, 0), Arrived(false), Flags(0), OratorID(-1), unk2C(0), FacingID(0), unk34(false)
112 {
113 }
114 ~OratorClass()
115 {
116 }
117 bool operator ==(const OratorClass &that)
118 {
119 return OratorID == that.OratorID;
120 }
121 bool operator !=(const OratorClass &that)
122 {
123 return OratorID != that.OratorID;
124 }
125 bool Get_Flag(int flag)
126 {
127 return (Flags & flag) == flag;
128 }
129 PhysicalGameObj *Get_Game_Obj()
130 {
131 if (Owner)
132 {
133 return Owner->As_PhysicalGameObj();
134 }
135 return 0;
136 }
137 void Set_Flag(int flag, bool onoff)
138 {
139 int t = Flags & ~flag;
140 Flags &= ~flag;
141 if (onoff)
142 {
143 Flags = flag | t;
144 }
145 if (Flags & FLAG_DONT_MOVE)
146 {
147 Arrived = true;
148 }
149 }
150 Vector3 &Get_Position()
151 {
152 return Position;
153 }
154 void Set_Flags(int newflags)
155 {
156 Flags = newflags;
157 if (Flags & FLAG_DONT_MOVE)
158 {
159 Arrived = true;
160 }
161 }
162 void Set_Arrived(bool arrived)
163 {
164 Arrived = arrived;
165 }
166 void Initialize(PhysicalGameObj *obj)
167 {
168 Owner = obj;
169 }
170 void Set_Orator_ID(int id)
171 {
172 OratorID = id;
173 }
174 enum {
175 FLAG_DONT_MOVE = 1,
176 FLAG_DONT_TURN_HEAD = 2,
177 FLAG_TEMP_DONT_FACE = 4,
178 FLAG_DONT_FACE = 8,
179 };
180 void Set_Facing_ID(int id)
181 {
182 FacingID = id;
183 }
184 bool Save(ChunkSaveClass &cload);
185 bool Load(ChunkLoadClass &cload);
186 void Load_Variables(ChunkLoadClass &cload);
187};
188class ConversationClass : public RefCountClass {
189private:
190 ConversationClass(const ConversationClass& that);
191 ConversationClass& operator=(const ConversationClass& that);
192 StringClass Name;
193 int ID;
194 DynamicVectorClass<ConversationRemarkClass> Remarks;
195 DynamicVectorClass<OratorClass> Orators;
196 SoldierAIState AIState;
197 bool IsInnate;
198 bool IsKey;
199 float Probability;
200 int CategoryID;
201 int LookAtObjID;
202 int Priority;
203 float MaxDist;
204 bool IsInterruptable;
205public:
206 ConversationClass();
207 void Clear_Orators();
208 void Clear_Remarks();
209 ~ConversationClass();
210 int Get_Orator_Count() const
211 {
212 return Orators.Count();
213 }
214 void Add_Orator(OratorClass const&);
215 void Add_Remark(ConversationRemarkClass const&);
216 int Get_Remark_Count() const
217 {
218 return Remarks.Count();
219 }
220 bool Get_Remark_Info(int index,ConversationRemarkClass &remark)
221 {
222 if (index >= 0 && index < Remarks.Count())
223 {
224 remark = Remarks[index];
225 return true;
226 }
227 return false;
228 }
229 bool Save(ChunkSaveClass &cload);
230 bool Load(ChunkLoadClass &cload);
231 void Load_Variables(ChunkLoadClass &cload);
232 OratorClass *Get_Orator(int);
233 OratorClass *Find_Orator(int);
234 int Get_ID() const { return ID; }
235 void Set_ID(int id) { ID = id; }
236 const char *Get_Name() const { return Name; }
237 void Set_Name(const char *name) { Name = name; }
238 SoldierAIState Get_AI_State() const { return AIState; }
239 void Set_AI_State(SoldierAIState state) { AIState = state; }
240 bool Is_Innate() const { return IsInnate; }
241 void Set_Is_Innate(bool b) { IsInnate = b; }
242 bool Is_Key() const { return IsKey; }
243 void Set_Is_Key(bool b) { IsKey = b; }
244 float Get_Probability() const { return Probability; }
245 void Set_Probability(float f) { Probability = f; }
246 int Get_Category_ID() const { return CategoryID; }
247 void Set_Category_ID(int id) { CategoryID = id; }
248 int Get_Look_At_Obj_ID() const { return LookAtObjID; }
249 void Set_Look_At_Obj_ID(int id) { LookAtObjID = id; }
250 int Get_Priority() const { return Priority; }
251 void Set_Priority(int i) { Priority = i; }
252 float Get_Max_Dist() const { return MaxDist; }
253 void Set_Max_Dist(float f) { MaxDist = f; }
254 bool Is_Interruptable() const { return IsInterruptable; }
255 void Set_Is_Interruptable(bool b) { IsInterruptable = b; }
256};
257
258#endif