~ubuntu-branches/debian/sid/astromenace/sid

« back to all changes in this revision

Viewing changes to AstroMenaceSource/ScriptEngine/Script.cpp

  • Committer: Package Import Robot
  • Author(s): Boris Pek
  • Date: 2013-04-09 02:04:25 UTC
  • Revision ID: package-import@ubuntu.com-20130409020425-a7fl9xk4diamw6di
Tags: upstream-1.3.1+repack
Import upstream version 1.3.1+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/************************************************************************************
 
2
 
 
3
        AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
 
4
        Copyright © 2006-2012 Michael Kurinnoy, Viewizard
 
5
 
 
6
 
 
7
        AstroMenace is free software: you can redistribute it and/or modify
 
8
        it under the terms of the GNU General Public License as published by
 
9
        the Free Software Foundation, either version 3 of the License, or
 
10
        (at your option) any later version.
 
11
 
 
12
        AstroMenace is distributed in the hope that it will be useful,
 
13
        but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
15
        GNU General Public License for more details.
 
16
 
 
17
        You should have received a copy of the GNU General Public License
 
18
        along with AstroMenace. If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
 
 
21
        Web Site: http://www.viewizard.com/
 
22
        Project: http://sourceforge.net/projects/openastromenace/
 
23
        E-mail: viewizard@viewizard.com
 
24
 
 
25
*************************************************************************************/
 
26
 
 
27
 
 
28
#include "../Game.h"
 
29
 
 
30
 
 
31
 
 
32
void SetID(CObject3D *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc);
 
33
void SetDebugInformation(CObject3D *Object, cXMLEntry *xmlEntry);
 
34
void SetShowDeleteOnHide(CObject3D *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc);
 
35
void SetShipRotation(CSpaceShip *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc);
 
36
void SetShipLocation(CSpaceShip *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc, float TimeOpLag);
 
37
void SetProjectileRotation(CProjectile *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc);
 
38
void SetProjectileLocation(CProjectile *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc, float TimeOpLag);
 
39
void SetRotation(CObject3D *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc);
 
40
void SetLocation(CObject3D *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc, float TimeOpLag);
 
41
void SetAIMode(CObject3D *Object, cXMLEntry *xmlEntry, cXMLDocument *xmlDoc);
 
42
 
 
43
 
 
44
 
 
45
 
 
46
// проверка, если конец уровня как всех убъем
 
47
 
 
48
extern CSpaceShip *StartSpaceShip;
 
49
extern CSpaceShip *EndSpaceShip;
 
50
extern CGroundObject *StartGroundObject;
 
51
extern CGroundObject *EndGroundObject;
 
52
 
 
53
// отображение коробок... отладка
 
54
extern int NeedShowBB;
 
55
// неубиваемость... отладка
 
56
extern bool UndeadDebugMode;
 
57
// показывать время при скорости 1.5
 
58
extern bool ShowGameTime;
 
59
 
 
60
 
 
61
 
 
62
 
 
63
//-----------------------------------------------------------------------------
 
64
// Конструктор, инициализация всех переменных
 
65
//-----------------------------------------------------------------------------
 
66
ScriptEngine::ScriptEngine()
 
67
{
 
68
        // еще нет времени
 
69
        TimeLastOp = 0;
 
70
        TimeOpLag = 0;
 
71
        StartTime = 0;
 
72
        xmlDoc = 0;
 
73
        xmlEntry = 0;
 
74
 
 
75
 
 
76
        NeedCheckSpaceShip = false;
 
77
        NeedCheckGroundObject = false;
 
78
        EndDelayMissionComplete = 0.0f;
 
79
        LastTimeMissionComplete = -1.0f;
 
80
 
 
81
        AsterQuant = 2.0f;
 
82
        AsterW = 280.0f;
 
83
        AsterH = 7.5f;
 
84
        AsterXPos = 0.0f;
 
85
        AsterYPos = -10.0f;
 
86
        AsterZPos = 340.0f;
 
87
        AsterRealNeed = 0.0f;
 
88
        AsterMaxSpeed = 5.0f;
 
89
        AsterMinFastSpeed = 35.0f;
 
90
        AsterFastCount = 0;
 
91
        AsterOn = false;
 
92
        AsterLastTime = -1.0f;
 
93
 
 
94
 
 
95
        // отладочный режим
 
96
        ShowDebugModeLine = false;
 
97
        NeedShowBB = 0;
 
98
        UndeadDebugMode = false;
 
99
}
 
100
 
 
101
 
 
102
 
 
103
 
 
104
 
 
105
 
 
106
//-----------------------------------------------------------------------------
 
107
// Деструктор
 
108
//-----------------------------------------------------------------------------
 
109
ScriptEngine::~ScriptEngine()
 
110
{
 
111
        delete xmlDoc;
 
112
}
 
113
 
 
114
 
 
115
 
 
116
 
 
117
 
 
118
 
 
119
//-----------------------------------------------------------------------------
 
120
// запустить скрипт на выполнение
 
121
//-----------------------------------------------------------------------------
 
122
bool ScriptEngine::RunScript(const char *FileName, float InitTime)
 
123
{
 
124
        // установка значений
 
125
        StartTime = TimeLastOp = InitTime;
 
126
 
 
127
        TimeOpLag = 0;
 
128
        xmlEntry = 0;
 
129
 
 
130
        NeedCheckSpaceShip = false;
 
131
        NeedCheckGroundObject = false;
 
132
        EndDelayMissionComplete = 0.0f;
 
133
        LastTimeMissionComplete = -1.0f;
 
134
 
 
135
        AsterQuant = 2.0f;
 
136
        AsterW = 280.0f;
 
137
        AsterH = 7.5f;
 
138
        AsterXPos = 0.0f;
 
139
        AsterYPos = -10.0f;
 
140
        AsterZPos = 340.0f;
 
141
        AsterRealNeed = 0.0f;
 
142
        AsterMaxSpeed = 5.0f;
 
143
        AsterMinFastSpeed = 35.0f;
 
144
        AsterFastCount = 0;
 
145
        AsterOn = false;
 
146
        AsterLastTime = -1.0f;
 
147
 
 
148
 
 
149
 
 
150
        // отладочный режим
 
151
        ShowDebugModeLine = false;
 
152
        NeedShowBB = 0;
 
153
        UndeadDebugMode = false;
 
154
        ShowGameTime = false;
 
155
 
 
156
 
 
157
        if (xmlDoc != 0)
 
158
        {
 
159
                delete xmlDoc;
 
160
                xmlDoc = 0;
 
161
        }
 
162
        xmlDoc = new cXMLDocument;
 
163
 
 
164
        // иним скрипт
 
165
        if (!xmlDoc->Load(FileName))
 
166
        {
 
167
                fprintf(stderr, "Can't find script file or file corrupted: %s\n", FileName);
 
168
                delete xmlDoc; xmlDoc = 0;
 
169
                return false;
 
170
        }
 
171
 
 
172
 
 
173
        // проверяем корневой элемент
 
174
        if (strcmp("AstroMenaceScript", xmlDoc->RootXMLEntry->Name))
 
175
        {
 
176
                fprintf(stderr, "Can't find AstroMenaceScript element in the: %s\n", FileName);
 
177
                delete xmlDoc; xmlDoc = 0;
 
178
                return false;
 
179
        }
 
180
 
 
181
 
 
182
        // переходим на действия
 
183
        xmlEntry  = xmlDoc->FindFirstChildEntryByName(xmlDoc->RootXMLEntry, "Action");
 
184
        if (xmlEntry == 0)
 
185
        {
 
186
                fprintf(stderr, "Can't find Action element in the: %s\n", FileName);
 
187
                delete xmlDoc; xmlDoc = 0;
 
188
                return false;
 
189
        }
 
190
 
 
191
        xmlEntry = xmlEntry->FirstChild;
 
192
        if (xmlEntry == 0)
 
193
        {
 
194
                fprintf(stderr, "Can't find Action element in the: %s\n", FileName);
 
195
                delete xmlDoc; xmlDoc = 0;
 
196
                return false;
 
197
        }
 
198
 
 
199
 
 
200
 
 
201
 
 
202
 
 
203
        // идем и выполняем то, что по времени 0 стоит, т.е. начальную инициализацию
 
204
        Update(StartTime);
 
205
        return true;
 
206
}
 
207
 
 
208
 
 
209
 
 
210
 
 
211
 
 
212
 
 
213
//-----------------------------------------------------------------------------
 
214
// проверяем скрипт
 
215
//-----------------------------------------------------------------------------
 
216
bool ScriptEngine::Update(float Time)
 
217
{
 
218
        // скрипт не загружен
 
219
        if (xmlDoc == 0) return false;
 
220
 
 
221
        // находим дельту времени
 
222
        float TimeDelta = Time - TimeLastOp;
 
223
 
 
224
 
 
225
        // генерация астероидов
 
226
        if (AsterOn)
 
227
        {
 
228
                if (AsterLastTime == -1.0) AsterLastTime = Time;
 
229
                float TimeDelta = Time - AsterLastTime;
 
230
                AsterLastTime = Time;
 
231
 
 
232
                // складываем все
 
233
                float NeedGener = AsterQuant*TimeDelta+AsterRealNeed;
 
234
                // получаем целое кол-во на генерацию
 
235
                unsigned int NeedGenerInt = (unsigned int)NeedGener;
 
236
                // находим остаток... который нужно будет потом учесть
 
237
                AsterRealNeed = NeedGener - NeedGenerInt;
 
238
 
 
239
                while (NeedGenerInt>0)
 
240
                {
 
241
                        CAsteroid *CreateAsteroid = 0;
 
242
                        CreateAsteroid = new CAsteroid;
 
243
                        CreateAsteroid->Create(1);
 
244
                        if (AsterFastCount != 20)
 
245
                                CreateAsteroid->Speed = AsterMaxSpeed*vw_Randf1;
 
246
                        else
 
247
                                CreateAsteroid->Speed = AsterMinFastSpeed + AsterMaxSpeed*vw_Randf1;
 
248
                        CreateAsteroid->ShowDeleteOnHide = 0;
 
249
                        CreateAsteroid->SetRotation(VECTOR3D(0.0f, 180.0f, 0.0f));// !!!учесть камеру
 
250
 
 
251
                        if (AsterFastCount != 20)
 
252
                                CreateAsteroid->SetLocation(
 
253
                                VECTOR3D(AsterW*vw_Randf0+AsterXPos, AsterYPos*2+AsterH*vw_Randf1, AsterZPos+20.0f)
 
254
                                +GamePoint);
 
255
                        else
 
256
                                CreateAsteroid->SetLocation(
 
257
                                VECTOR3D(AsterW*vw_Randf0+AsterXPos, AsterYPos*2+AsterH*vw_Randf1, AsterZPos)
 
258
                                +GamePoint);
 
259
 
 
260
                        NeedGenerInt--;
 
261
                }
 
262
 
 
263
                AsterFastCount++;
 
264
                if (AsterFastCount > 30) AsterFastCount = 0;
 
265
        }
 
266
 
 
267
 
 
268
 
 
269
        // если нужно, смотрим когда заканчивать миссию
 
270
        if ((EndDelayMissionComplete>0.0f) || NeedCheckSpaceShip || NeedCheckGroundObject)
 
271
        {
 
272
                if (LastTimeMissionComplete == -1.0) LastTimeMissionComplete = Time;
 
273
                float TimeDeltaMissionComplete = Time - LastTimeMissionComplete;
 
274
                LastTimeMissionComplete = Time;
 
275
 
 
276
                // уменьшаем только тогда, когда уже никого нет... т.е. отступ это от смерти последнего
 
277
                bool NeedDecrease = true;
 
278
 
 
279
 
 
280
                // собственно сами проверки...
 
281
                if (NeedCheckSpaceShip)
 
282
                {
 
283
                        // если нет врагов
 
284
                        int count = 0;
 
285
                        CSpaceShip *Tmp1 = StartSpaceShip;
 
286
                        while (Tmp1 != 0)
 
287
                        {
 
288
                                // если это враг, и мы его показали (иначе он где-то там летает)
 
289
                                if ((Tmp1->ObjectStatus == 1) && (Tmp1->ShowDeleteOnHide != 0)) count++;
 
290
                                Tmp1 = Tmp1->Next;
 
291
                        }
 
292
                        if (count > 0) NeedDecrease = false;
 
293
 
 
294
                }
 
295
                if (NeedCheckGroundObject)
 
296
                {
 
297
                        // если нет врагов, которых можем уничтожить
 
298
                        int count = 0;
 
299
                        CGroundObject *Tmp1 = StartGroundObject;
 
300
                        while (Tmp1 != 0)
 
301
                        {
 
302
                                // если это враг, и мы его показали
 
303
                                if (NeedCheckCollision(Tmp1) && (Tmp1->ShowDeleteOnHide != 0)) count++;
 
304
                                Tmp1 = Tmp1->Next;
 
305
                        }
 
306
                        if (count > 0) NeedDecrease = false;
 
307
                }
 
308
 
 
309
 
 
310
                if (NeedDecrease) EndDelayMissionComplete -= TimeDeltaMissionComplete;
 
311
                if (EndDelayMissionComplete<=0.0f)
 
312
                {
 
313
                        EndDelayMissionComplete = 0.0f;
 
314
                        NeedCheckSpaceShip = false;
 
315
                        NeedCheckGroundObject = false;
 
316
                        SetGameMissionComplete();
 
317
                        return false;
 
318
                }
 
319
 
 
320
                // говорим, что скрипт еще не закончился!
 
321
                return true;
 
322
        }
 
323
 
 
324
 
 
325
 
 
326
 
 
327
 
 
328
 
 
329
        while (xmlEntry)
 
330
        {
 
331
                // TimeLine
 
332
                if (!strcmp(xmlEntry->Name, "TimeLine"))
 
333
                {
 
334
                        float onTime = 0.0f;
 
335
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "value") != 0)
 
336
                                onTime = xmlDoc->fGetEntryAttribute(xmlEntry, "value");
 
337
 
 
338
                        // если еще не время выполнять... нужно уйти из процедуры
 
339
                        if (onTime > TimeDelta) return true;
 
340
 
 
341
                        // считаем лаг, чтобы правильно вычеслить положение при создании
 
342
                        TimeOpLag = TimeDelta - onTime;
 
343
 
 
344
                        // дальше смотрим, что нужно сделать...
 
345
                        UpdateTimeLine();
 
346
 
 
347
                        TimeLastOp = Time - TimeOpLag;
 
348
                        TimeDelta = TimeOpLag;//Time - TimeLastOp;
 
349
                }
 
350
                else
 
351
                // Debug
 
352
                if (!strcmp(xmlEntry->Name, "Debug"))
 
353
                {
 
354
                        ShowDebugModeLine = false;
 
355
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "showline") != 0)
 
356
                                ShowDebugModeLine = xmlDoc->bGetEntryAttribute(xmlEntry, "showline");
 
357
 
 
358
                        NeedShowBB = 0;
 
359
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "showbb") != 0)
 
360
                                NeedShowBB = xmlDoc->iGetEntryAttribute(xmlEntry, "showbb");
 
361
 
 
362
                        UndeadDebugMode = false;
 
363
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "undead") != 0)
 
364
                                UndeadDebugMode = xmlDoc->bGetEntryAttribute(xmlEntry, "undead");
 
365
 
 
366
                        ShowGameTime = false;
 
367
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "time") != 0)
 
368
                                ShowGameTime = xmlDoc->bGetEntryAttribute(xmlEntry, "time");
 
369
 
 
370
                }
 
371
                else
 
372
                // StarSystem
 
373
                if (!strcmp(xmlEntry->Name, "StarSystem"))
 
374
                {
 
375
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "system") != 0)
 
376
                        {
 
377
                                int SystemNum = xmlDoc->iGetEntryAttribute(xmlEntry, "system");
 
378
                                VECTOR3D TmpBaseRotation(0.0f, 0.0f, 0.0f);
 
379
                                if (xmlDoc->GetEntryAttribute(xmlEntry, "anglex") != 0) TmpBaseRotation.x = xmlDoc->fGetEntryAttribute(xmlEntry, "anglex");
 
380
                                if (xmlDoc->GetEntryAttribute(xmlEntry, "angley") != 0) TmpBaseRotation.y = xmlDoc->fGetEntryAttribute(xmlEntry, "angley");
 
381
                                if (xmlDoc->GetEntryAttribute(xmlEntry, "anglez") != 0) TmpBaseRotation.z = xmlDoc->fGetEntryAttribute(xmlEntry, "anglez");
 
382
                                StarSystemInit(SystemNum, TmpBaseRotation);
 
383
                        }
 
384
                }
 
385
                else
 
386
                // Music
 
387
                if (!strcmp(xmlEntry->Name, "Music"))
 
388
                {
 
389
                        // если корабль игрока уничтожен - не меняем уже музыку в игре вообще,
 
390
                        // должна проигрываться только музыка поражения
 
391
                        if (PlayerFighter != 0)
 
392
                        if (PlayerFighter->Strength > 0.0f)
 
393
                        {
 
394
                                if (xmlDoc->GetEntryAttribute(xmlEntry, "theme") != 0)
 
395
                                {
 
396
                                        int Theme = xmlDoc->iGetEntryAttribute(xmlEntry, "theme");
 
397
                                        if (Theme == 1)
 
398
                                                StartMusicWithFade(2, 2.0f, 2.0f);
 
399
                                        if (Theme == 2)
 
400
                                                StartMusicWithFade(3, 1.5f, 2.0f);
 
401
                                }
 
402
                        }
 
403
                }
 
404
                else
 
405
                // CreatePlanet
 
406
                if (!strcmp(xmlEntry->Name, "CreatePlanet"))
 
407
                {
 
408
                        CPlanet *Planet = 0;
 
409
                        Planet = new CPlanet;
 
410
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "type") != 0)
 
411
                        {
 
412
                                Planet->Create(xmlDoc->iGetEntryAttribute(xmlEntry, "type"));
 
413
                                SetRotation(Planet, xmlEntry, xmlDoc);
 
414
                                SetLocation(Planet, xmlEntry, xmlDoc, 0.0f);
 
415
                                Planet->ShowDeleteOnHide = 0;
 
416
 
 
417
                                if (xmlDoc->GetEntryAttribute(xmlEntry, "speed") != 0) Planet->Speed = xmlDoc->fGetEntryAttribute(xmlEntry, "speed");
 
418
                        }
 
419
                }
 
420
                else
 
421
                // AsteroidField
 
422
                if (!strcmp(xmlEntry->Name, "AsteroidField"))
 
423
                {
 
424
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "status") != 0)
 
425
                        {
 
426
                                AsterOn = xmlDoc->bGetEntryAttribute(xmlEntry, "status");
 
427
                        }
 
428
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "persec") != 0) AsterQuant = xmlDoc->fGetEntryAttribute(xmlEntry, "persec");
 
429
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "w") != 0) AsterW = xmlDoc->fGetEntryAttribute(xmlEntry, "w");
 
430
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "h") != 0) AsterH = xmlDoc->fGetEntryAttribute(xmlEntry, "h");
 
431
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posx") != 0) AsterXPos = xmlDoc->fGetEntryAttribute(xmlEntry, "posx");
 
432
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posy") != 0) AsterYPos = xmlDoc->fGetEntryAttribute(xmlEntry, "posy");
 
433
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posz") != 0) AsterZPos = xmlDoc->fGetEntryAttribute(xmlEntry, "posz");
 
434
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "slow") != 0) AsterMaxSpeed = xmlDoc->fGetEntryAttribute(xmlEntry, "slow");
 
435
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "fast") != 0) AsterMinFastSpeed = xmlDoc->fGetEntryAttribute(xmlEntry, "fast");
 
436
                }
 
437
                else
 
438
                // Light
 
439
                if (!strcmp(xmlEntry->Name, "Light"))
 
440
                {
 
441
                        eLight *NewLight;
 
442
                        NewLight = new eLight;
 
443
 
 
444
                        NewLight->LightType = 0; // по умолчанию, солнце
 
445
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "type") != 0) NewLight->LightType = xmlDoc->iGetEntryAttribute(xmlEntry, "type");
 
446
 
 
447
                        NewLight->Diffuse[0] = 0.0f;
 
448
                        NewLight->Diffuse[1] = 0.0f;
 
449
                        NewLight->Diffuse[2] = 0.0f;
 
450
                        NewLight->Diffuse[3] = 1.0f;
 
451
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "diffr") != 0) NewLight->Diffuse[0] = xmlDoc->fGetEntryAttribute(xmlEntry, "diffr");
 
452
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "diffg") != 0) NewLight->Diffuse[1] = xmlDoc->fGetEntryAttribute(xmlEntry, "diffg");
 
453
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "diffb") != 0) NewLight->Diffuse[2] = xmlDoc->fGetEntryAttribute(xmlEntry, "diffb");
 
454
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "diffa") != 0) NewLight->Diffuse[3] = xmlDoc->fGetEntryAttribute(xmlEntry, "diffa");
 
455
 
 
456
                        NewLight->Specular[0] = 0.0f;
 
457
                        NewLight->Specular[1] = 0.0f;
 
458
                        NewLight->Specular[2] = 0.0f;
 
459
                        NewLight->Specular[3] = 1.0f;
 
460
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "specr") != 0) NewLight->Specular[0] = xmlDoc->fGetEntryAttribute(xmlEntry, "specr");
 
461
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "specg") != 0) NewLight->Specular[1] = xmlDoc->fGetEntryAttribute(xmlEntry, "specg");
 
462
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "specb") != 0) NewLight->Specular[2] = xmlDoc->fGetEntryAttribute(xmlEntry, "specb");
 
463
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "speca") != 0) NewLight->Specular[3] = xmlDoc->fGetEntryAttribute(xmlEntry, "speca");
 
464
 
 
465
                        NewLight->Ambient[0] = 0.0f;
 
466
                        NewLight->Ambient[1] = 0.0f;
 
467
                        NewLight->Ambient[2] = 0.0f;
 
468
                        NewLight->Ambient[3] = 1.0f;
 
469
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "ambir") != 0) NewLight->Ambient[0] = xmlDoc->fGetEntryAttribute(xmlEntry, "ambir");
 
470
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "ambig") != 0) NewLight->Ambient[1] = xmlDoc->fGetEntryAttribute(xmlEntry, "ambig");
 
471
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "ambib") != 0) NewLight->Ambient[2] = xmlDoc->fGetEntryAttribute(xmlEntry, "ambib");
 
472
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "ambia") != 0) NewLight->Ambient[3] = xmlDoc->fGetEntryAttribute(xmlEntry, "ambia");
 
473
 
 
474
                        NewLight->Direction = VECTOR3D(0.0f,0.0f,1.0f);
 
475
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "dirx") != 0) NewLight->Direction.x = xmlDoc->fGetEntryAttribute(xmlEntry, "dirx");
 
476
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "diry") != 0) NewLight->Direction.y = xmlDoc->fGetEntryAttribute(xmlEntry, "diry");
 
477
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "dirz") != 0) NewLight->Direction.z = xmlDoc->fGetEntryAttribute(xmlEntry, "dirz");
 
478
                        NewLight->Direction.Normalize();
 
479
 
 
480
                        NewLight->Location = VECTOR3D(0.0f,0.0f,0.0f);
 
481
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posx") != 0) NewLight->Location.x = xmlDoc->fGetEntryAttribute(xmlEntry, "posx");
 
482
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posy") != 0) NewLight->Location.y = xmlDoc->fGetEntryAttribute(xmlEntry, "posy");
 
483
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posz") != 0) NewLight->Location.z = xmlDoc->fGetEntryAttribute(xmlEntry, "posz");
 
484
 
 
485
 
 
486
                        NewLight->On = true;
 
487
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "status") != 0)
 
488
                                NewLight->On = xmlDoc->bGetEntryAttribute(xmlEntry, "status");
 
489
                }
 
490
                else
 
491
                // Label
 
492
                if (!strcmp(xmlEntry->Name, "Label"))
 
493
                {
 
494
                        // ничего не делаем
 
495
                        xmlEntry = xmlEntry->Next;
 
496
                        continue;
 
497
                }
 
498
                else
 
499
                // Goto
 
500
                if (!strcmp(xmlEntry->Name, "Goto"))
 
501
                {
 
502
                        // если есть указатель на метку
 
503
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "label") != 0)
 
504
                        {
 
505
                                // нужно перебрать все метки и остановится на нужной
 
506
                                cXMLEntry *tmpEntry = xmlDoc->FindFirstChildEntryByName(xmlDoc->FindFirstChildEntryByName(xmlDoc->RootXMLEntry, "Action"), "Label");
 
507
 
 
508
                                // перебор по всем меткам
 
509
                                while (tmpEntry)
 
510
                                {
 
511
                                //      if (!strcmp(tmpEntry->Name, "Label"))
 
512
                                        if (xmlDoc->GetEntryAttribute(tmpEntry, "name") != 0)
 
513
                                        if (!strcmp(xmlDoc->GetEntryAttribute(tmpEntry, "name"), xmlDoc->GetEntryAttribute(xmlEntry, "label")))
 
514
                                        {
 
515
                                                // ставим новый указатель
 
516
                                                xmlEntry = tmpEntry;
 
517
                                                return true;
 
518
                                        }
 
519
                                        // берем следующую метку
 
520
                                        tmpEntry = tmpEntry->Next;
 
521
                                }
 
522
                        }
 
523
                }
 
524
                else
 
525
                // MissionComplete
 
526
                if (!strcmp(xmlEntry->Name, "MissionComplete"))
 
527
                {
 
528
                        SetGameMissionComplete();
 
529
                }
 
530
                else
 
531
                // MissionCompleteAtNoEnemy
 
532
                if (!strcmp(xmlEntry->Name, "MissionCompleteAtNoEnemy"))
 
533
                {
 
534
                        bool SetGameMissionFlag = false;
 
535
                        NeedCheckSpaceShip = false;
 
536
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "ships") != 0) {NeedCheckSpaceShip = xmlDoc->bGetEntryAttribute(xmlEntry, "ships");SetGameMissionFlag = true;};
 
537
                        NeedCheckGroundObject = false;
 
538
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "grounds") != 0) {NeedCheckGroundObject = xmlDoc->bGetEntryAttribute(xmlEntry, "grounds");SetGameMissionFlag = true;};
 
539
                        EndDelayMissionComplete = 0.0f;
 
540
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "delay") != 0) {EndDelayMissionComplete = xmlDoc->fGetEntryAttribute(xmlEntry, "delay");SetGameMissionFlag = true;};
 
541
 
 
542
                        if (!SetGameMissionFlag)
 
543
                        {
 
544
                                // если время не выставили и нечего ждать, работаем как и с обычным завершением
 
545
                                SetGameMissionComplete();
 
546
                        }
 
547
                        else
 
548
                        {
 
549
                                LastTimeMissionComplete = Time;
 
550
                                return true;
 
551
                        }
 
552
                }
 
553
                else
 
554
                // Text
 
555
                if (!strcmp(xmlEntry->Name, "Text"))
 
556
                {
 
557
                        CGameLvlText *NewText;
 
558
                        NewText = new CGameLvlText;
 
559
 
 
560
 
 
561
                        NewText->Lifetime = -1.0f;
 
562
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "life") != 0) NewText->Lifetime = xmlDoc->fGetEntryAttribute(xmlEntry, "life");
 
563
 
 
564
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "text") != 0)
 
565
                        {
 
566
                                NewText->DrawText = new char[strlen(xmlDoc->GetEntryAttribute(xmlEntry, "text"))+1];
 
567
                                strcpy(NewText->DrawText, xmlDoc->GetEntryAttribute(xmlEntry, "text"));
 
568
                        }
 
569
 
 
570
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posx") != 0) NewText->PosX = xmlDoc->iGetEntryAttribute(xmlEntry, "posx");
 
571
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "posy") != 0) NewText->PosY = xmlDoc->iGetEntryAttribute(xmlEntry, "posy");
 
572
 
 
573
                        NewText->Color = 0;
 
574
                        if (xmlDoc->GetEntryAttribute(xmlEntry, "color") != 0) NewText->Color = xmlDoc->iGetEntryAttribute(xmlEntry, "color");
 
575
                }
 
576
                else
 
577
                {
 
578
                        // если тут - значит не нашли директиву, или произошла ошибка
 
579
                        fprintf(stderr, "ScriptEngine: tag %s not found, line %i.", xmlEntry->Name, xmlEntry->LineNumber);
 
580
                }
 
581
 
 
582
                // берем следующий элемент по порядку
 
583
                xmlEntry = xmlEntry->Next;
 
584
        }
 
585
 
 
586
        // выходим, скрипт закончился
 
587
        return false;
 
588
}
 
589
 
 
590
 
 
591
 
 
592
 
 
593
 
 
594
 
 
595
 
 
596
 
 
597
 
 
598
//-----------------------------------------------------------------------------
 
599
// проверяем скрипт дополнительно для TimeLine
 
600
//-----------------------------------------------------------------------------
 
601
void ScriptEngine::UpdateTimeLine()
 
602
{
 
603
        // получаем первый тэг
 
604
        cXMLEntry *TL = xmlEntry->FirstChild;
 
605
 
 
606
        while (TL)
 
607
        {
 
608
 
 
609
                // EarthFighter
 
610
                if (!strcmp(TL->Name, "EarthFighter"))
 
611
                {
 
612
                        CEarthSpaceFighter *Fighter = 0;
 
613
                        Fighter = new CEarthSpaceFighter;
 
614
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
615
                        else
 
616
                        {
 
617
                                TL = TL->Next;
 
618
                                continue;
 
619
                        }
 
620
 
 
621
                        SetID(Fighter, TL, xmlDoc);
 
622
                        if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
 
623
 
 
624
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
 
625
                        {
 
626
                                Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
627
                                Fighter->Speed = Fighter->NeedSpeed;
 
628
                        }
 
629
                        if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
 
630
                        {
 
631
                                Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
 
632
                                Fighter->SpeedLR = Fighter->NeedSpeedLR;
 
633
                        }
 
634
                        if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
 
635
                        {
 
636
                                Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
 
637
                                Fighter->SpeedUD = Fighter->NeedSpeedUD;
 
638
                        }
 
639
 
 
640
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
 
641
                        {
 
642
                                Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
 
643
                                Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
 
644
                        }
 
645
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
 
646
                        {
 
647
                                Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
 
648
                                Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
 
649
                        }
 
650
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
 
651
                        {
 
652
                                Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
 
653
                                Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
 
654
                        }
 
655
 
 
656
 
 
657
                        if (xmlDoc->GetEntryAttribute(TL, "armour") != 0) SetEarthSpaceFighterArmour(Fighter, xmlDoc->iGetEntryAttribute(TL, "armour"));
 
658
                        if (xmlDoc->GetEntryAttribute(TL, "weapon1") != 0) SetEarthSpaceFighterWeapon(Fighter, 1, xmlDoc->iGetEntryAttribute(TL, "weapon1"));
 
659
                        if (xmlDoc->GetEntryAttribute(TL, "weapon2") != 0) SetEarthSpaceFighterWeapon(Fighter, 2, xmlDoc->iGetEntryAttribute(TL, "weapon2"));
 
660
                        if (xmlDoc->GetEntryAttribute(TL, "weapon3") != 0) SetEarthSpaceFighterWeapon(Fighter, 3, xmlDoc->iGetEntryAttribute(TL, "weapon3"));
 
661
                        if (xmlDoc->GetEntryAttribute(TL, "weapon4") != 0) SetEarthSpaceFighterWeapon(Fighter, 4, xmlDoc->iGetEntryAttribute(TL, "weapon4"));
 
662
                        if (xmlDoc->GetEntryAttribute(TL, "weapon5") != 0) SetEarthSpaceFighterWeapon(Fighter, 5, xmlDoc->iGetEntryAttribute(TL, "weapon5"));
 
663
                        if (xmlDoc->GetEntryAttribute(TL, "weapon6") != 0) SetEarthSpaceFighterWeapon(Fighter, 6, xmlDoc->iGetEntryAttribute(TL, "weapon6"));
 
664
 
 
665
                        SetShowDeleteOnHide(Fighter, TL, xmlDoc);
 
666
                        SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
 
667
                        SetShipRotation(Fighter, TL, xmlDoc);
 
668
                        SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
 
669
 
 
670
                        // дальше смотрим, что нужно сделать...
 
671
                        cXMLEntry *TLEarthFighter = TL->FirstChild;
 
672
                        while (TLEarthFighter)
 
673
                        {
 
674
                                if (!strcmp(TLEarthFighter->Name, "TimeSheet"))
 
675
                                {
 
676
                                        // собираем новый элемент
 
677
                                        CTimeSheet *TimeSheet;
 
678
                                        TimeSheet = new CTimeSheet;
 
679
                                        Fighter->AttachTimeSheet(TimeSheet);
 
680
 
 
681
                                        if (xmlDoc->GetEntryAttribute(TLEarthFighter, "aimode") != 0)
 
682
                                        {
 
683
                                                TimeSheet->AI_Mode = xmlDoc->iGetEntryAttribute(TLEarthFighter, "aimode");
 
684
                                                TimeSheet->Time = 0.0f;
 
685
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "time") != 0)
 
686
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLEarthFighter, "time");
 
687
 
 
688
                                                TimeSheet->InUse = false;
 
689
 
 
690
                                                TimeSheet->Speed = 0.0f;
 
691
                                                TimeSheet->Acceler = 1.0f;//0-1
 
692
                                                TimeSheet->SpeedLR = 0.0f;
 
693
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
694
                                                TimeSheet->SpeedUD = 0.0f;
 
695
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
696
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
697
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
698
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
699
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
700
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
701
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
702
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
703
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
704
                                                TimeSheet->Fire = false;
 
705
                                                TimeSheet->BossFire = false;
 
706
                                                TimeSheet->Targeting = false;
 
707
                                        }
 
708
                                        else
 
709
                                        {
 
710
                                                TimeSheet->AI_Mode = 0;
 
711
 
 
712
                                                TimeSheet->Time = 0.0f;
 
713
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "time") != 0)
 
714
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLEarthFighter, "time");
 
715
                                                TimeSheet->InUse = false;
 
716
 
 
717
                                                TimeSheet->Speed = 0.0f;
 
718
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speed") != 0)
 
719
                                                        TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speed");
 
720
 
 
721
                                                TimeSheet->Acceler = 1.0f;//0-1
 
722
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "acceler") != 0)
 
723
                                                        TimeSheet->Acceler = xmlDoc->fGetEntryAttribute(TLEarthFighter, "acceler");
 
724
                                                Clamp(TimeSheet->Acceler, 0.0f, 1.0f);
 
725
 
 
726
                                                TimeSheet->SpeedLR = 0.0f;
 
727
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedlr") != 0)
 
728
                                                        TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedlr");
 
729
 
 
730
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
731
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "accelerlr") != 0)
 
732
                                                        TimeSheet->AccelerLR = xmlDoc->fGetEntryAttribute(TLEarthFighter, "accelerlr");
 
733
                                                Clamp(TimeSheet->AccelerLR, 0.0f, 1.0f);
 
734
 
 
735
                                                TimeSheet->SpeedUD = 0.0f;
 
736
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedud") != 0)
 
737
                                                        TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedud");
 
738
 
 
739
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
740
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "accelerud") != 0)
 
741
                                                        TimeSheet->AccelerUD = xmlDoc->fGetEntryAttribute(TLEarthFighter, "accelerud");
 
742
                                                Clamp(TimeSheet->AccelerUD, 0.0f, 1.0f);
 
743
 
 
744
 
 
745
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
746
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedbycamfb") != 0)
 
747
                                                        TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedbycamfb");
 
748
 
 
749
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
750
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "accelerbycamfb") != 0)
 
751
                                                        TimeSheet->AccelerByCamFB = xmlDoc->fGetEntryAttribute(TLEarthFighter, "accelerbycamfb");
 
752
                                                Clamp(TimeSheet->AccelerByCamFB, 0.0f, 1.0f);
 
753
 
 
754
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
755
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedbycamlr") != 0)
 
756
                                                        TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedbycamlr");
 
757
 
 
758
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
759
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "accelerbycamlr") != 0)
 
760
                                                        TimeSheet->AccelerByCamLR = xmlDoc->fGetEntryAttribute(TLEarthFighter, "accelerbycamlr");
 
761
                                                Clamp(TimeSheet->AccelerByCamLR, 0.0f, 1.0f);
 
762
 
 
763
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
764
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedbycamud") != 0)
 
765
                                                        TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedbycamud");
 
766
 
 
767
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
768
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "accelerbycamud") != 0)
 
769
                                                        TimeSheet->AccelerByCamUD = xmlDoc->fGetEntryAttribute(TLEarthFighter, "accelerbycamud");
 
770
                                                Clamp(TimeSheet->AccelerByCamUD, 0.0f, 1.0f);
 
771
 
 
772
 
 
773
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
774
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "rotx") != 0)
 
775
                                                        TimeSheet->Rotation.x = xmlDoc->fGetEntryAttribute(TLEarthFighter, "rotx");
 
776
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "roty") != 0)
 
777
                                                        TimeSheet->Rotation.y = xmlDoc->fGetEntryAttribute(TLEarthFighter, "roty");
 
778
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "rotz") != 0)
 
779
                                                        TimeSheet->Rotation.z = xmlDoc->fGetEntryAttribute(TLEarthFighter, "rotz");
 
780
 
 
781
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
782
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "rotacx") != 0)
 
783
                                                        TimeSheet->RotationAcceler.x = xmlDoc->fGetEntryAttribute(TLEarthFighter, "rotacx");
 
784
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "rotacy") != 0)
 
785
                                                        TimeSheet->RotationAcceler.y = xmlDoc->fGetEntryAttribute(TLEarthFighter, "rotacy");
 
786
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "rotacz") != 0)
 
787
                                                        TimeSheet->RotationAcceler.z = xmlDoc->fGetEntryAttribute(TLEarthFighter, "rotacz");
 
788
                                                Clamp(TimeSheet->RotationAcceler.x, 0.0f, 1.0f);
 
789
                                                Clamp(TimeSheet->RotationAcceler.y, 0.0f, 1.0f);
 
790
                                                Clamp(TimeSheet->RotationAcceler.z, 0.0f, 1.0f);
 
791
 
 
792
                                                TimeSheet->Fire = false;
 
793
                                                if (xmlDoc->GetEntryAttribute(TLEarthFighter, "fire") != 0)
 
794
                                                        if (xmlDoc->iGetEntryAttribute(TLEarthFighter, "fire") > 0)
 
795
                                                                TimeSheet->Fire = true;
 
796
                                                TimeSheet->BossFire = false;
 
797
                                                TimeSheet->Targeting = false;
 
798
                                        }
 
799
 
 
800
                                }
 
801
 
 
802
                                // берем следующий элемент
 
803
                                TLEarthFighter = TLEarthFighter->Next;
 
804
                        }
 
805
                }
 
806
                else
 
807
                // AlienFighter
 
808
                if (!strcmp(TL->Name, "AlienFighter"))
 
809
                {
 
810
                        CAlienSpaceFighter *Fighter = 0;
 
811
                        Fighter = new CAlienSpaceFighter;
 
812
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
813
                        else
 
814
                        {
 
815
                                TL = TL->Next;
 
816
                                continue;
 
817
                        }
 
818
 
 
819
                        SetID(Fighter, TL, xmlDoc);
 
820
                        if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
 
821
 
 
822
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
 
823
                        {
 
824
                                Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
825
                                Fighter->Speed = Fighter->NeedSpeed;
 
826
                        }
 
827
                        if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
 
828
                        {
 
829
                                Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
 
830
                                Fighter->SpeedLR = Fighter->NeedSpeedLR;
 
831
                        }
 
832
                        if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
 
833
                        {
 
834
                                Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
 
835
                                Fighter->SpeedUD = Fighter->NeedSpeedUD;
 
836
                        }
 
837
 
 
838
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
 
839
                        {
 
840
                                Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
 
841
                                Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
 
842
                        }
 
843
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
 
844
                        {
 
845
                                Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
 
846
                                Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
 
847
                        }
 
848
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
 
849
                        {
 
850
                                Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
 
851
                                Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
 
852
                        }
 
853
 
 
854
                        SetShowDeleteOnHide(Fighter, TL, xmlDoc);
 
855
                        SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
 
856
                        SetShipRotation(Fighter, TL, xmlDoc);
 
857
                        SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
 
858
 
 
859
                        // дальше смотрим, что нужно сделать...
 
860
                        cXMLEntry *TLAlienFighter = TL->FirstChild;
 
861
                        while (TLAlienFighter)
 
862
                        {
 
863
                                if (!strcmp(TLAlienFighter->Name, "TimeSheet"))
 
864
                                {
 
865
                                        // собираем новый элемент
 
866
                                        CTimeSheet *TimeSheet;
 
867
                                        TimeSheet = new CTimeSheet;
 
868
                                        Fighter->AttachTimeSheet(TimeSheet);
 
869
 
 
870
                                        if (xmlDoc->GetEntryAttribute(TLAlienFighter, "aimode") != 0)
 
871
                                        {
 
872
                                                TimeSheet->AI_Mode = xmlDoc->iGetEntryAttribute(TLAlienFighter, "aimode");
 
873
                                                TimeSheet->Time = 0.0f;
 
874
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "time") != 0)
 
875
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLAlienFighter, "time");
 
876
                                                TimeSheet->InUse = false;
 
877
 
 
878
                                                TimeSheet->Speed = 0.0f;
 
879
                                                TimeSheet->Acceler = 1.0f;//0-1
 
880
                                                TimeSheet->SpeedLR = 0.0f;
 
881
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
882
                                                TimeSheet->SpeedUD = 0.0f;
 
883
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
884
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
885
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
886
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
887
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
888
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
889
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
890
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
891
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
892
                                                TimeSheet->Fire = false;
 
893
                                                TimeSheet->BossFire = false;
 
894
                                                TimeSheet->Targeting = false;
 
895
                                        }
 
896
                                        else
 
897
                                        {
 
898
                                                TimeSheet->AI_Mode = 0;
 
899
 
 
900
                                                TimeSheet->Time = 0.0f;
 
901
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "time") != 0)
 
902
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLAlienFighter, "time");
 
903
                                                TimeSheet->InUse = false;
 
904
 
 
905
                                                TimeSheet->Speed = 0.0f;
 
906
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speed") != 0)
 
907
                                                        TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speed");
 
908
 
 
909
                                                TimeSheet->Acceler = 1.0f;//0-1
 
910
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "acceler") != 0)
 
911
                                                        TimeSheet->Acceler = xmlDoc->fGetEntryAttribute(TLAlienFighter, "acceler");
 
912
                                                Clamp(TimeSheet->Acceler, 0.0f, 1.0f);
 
913
 
 
914
                                                TimeSheet->SpeedLR = 0.0f;
 
915
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedlr") != 0)
 
916
                                                        TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedlr");
 
917
 
 
918
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
919
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "accelerlr") != 0)
 
920
                                                        TimeSheet->AccelerLR = xmlDoc->fGetEntryAttribute(TLAlienFighter, "accelerlr");
 
921
                                                Clamp(TimeSheet->AccelerLR, 0.0f, 1.0f);
 
922
 
 
923
                                                TimeSheet->SpeedUD = 0.0f;
 
924
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedud") != 0)
 
925
                                                        TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedud");
 
926
 
 
927
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
928
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "accelerud") != 0)
 
929
                                                        TimeSheet->AccelerUD = xmlDoc->fGetEntryAttribute(TLAlienFighter, "accelerud");
 
930
                                                Clamp(TimeSheet->AccelerUD, 0.0f, 1.0f);
 
931
 
 
932
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
933
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedbycamfb") != 0)
 
934
                                                        TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedbycamfb");
 
935
 
 
936
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
937
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "accelerbycamfb") != 0)
 
938
                                                        TimeSheet->AccelerByCamFB = xmlDoc->fGetEntryAttribute(TLAlienFighter, "accelerbycamfb");
 
939
                                                Clamp(TimeSheet->AccelerByCamFB, 0.0f, 1.0f);
 
940
 
 
941
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
942
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedbycamlr") != 0)
 
943
                                                        TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedbycamlr");
 
944
 
 
945
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
946
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "accelerbycamlr") != 0)
 
947
                                                        TimeSheet->AccelerByCamLR = xmlDoc->fGetEntryAttribute(TLAlienFighter, "accelerbycamlr");
 
948
                                                Clamp(TimeSheet->AccelerByCamLR, 0.0f, 1.0f);
 
949
 
 
950
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
951
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedbycamud") != 0)
 
952
                                                        TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedbycamud");
 
953
 
 
954
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
955
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "accelerbycamud") != 0)
 
956
                                                        TimeSheet->AccelerByCamUD = xmlDoc->fGetEntryAttribute(TLAlienFighter, "accelerbycamud");
 
957
                                                Clamp(TimeSheet->AccelerByCamUD, 0.0f, 1.0f);
 
958
 
 
959
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
960
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "rotx") != 0)
 
961
                                                        TimeSheet->Rotation.x = xmlDoc->fGetEntryAttribute(TLAlienFighter, "rotx");
 
962
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "roty") != 0)
 
963
                                                        TimeSheet->Rotation.y = xmlDoc->fGetEntryAttribute(TLAlienFighter, "roty");
 
964
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "rotz") != 0)
 
965
                                                        TimeSheet->Rotation.z = xmlDoc->fGetEntryAttribute(TLAlienFighter, "rotz");
 
966
 
 
967
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
968
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "rotacx") != 0)
 
969
                                                        TimeSheet->RotationAcceler.x = xmlDoc->fGetEntryAttribute(TLAlienFighter, "rotacx");
 
970
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "rotacy") != 0)
 
971
                                                        TimeSheet->RotationAcceler.y = xmlDoc->fGetEntryAttribute(TLAlienFighter, "rotacy");
 
972
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "rotacz") != 0)
 
973
                                                        TimeSheet->RotationAcceler.z = xmlDoc->fGetEntryAttribute(TLAlienFighter, "rotacz");
 
974
                                                Clamp(TimeSheet->RotationAcceler.x, 0.0f, 1.0f);
 
975
                                                Clamp(TimeSheet->RotationAcceler.y, 0.0f, 1.0f);
 
976
                                                Clamp(TimeSheet->RotationAcceler.z, 0.0f, 1.0f);
 
977
 
 
978
                                                TimeSheet->Fire = false;
 
979
                                                if (xmlDoc->GetEntryAttribute(TLAlienFighter, "fire") != 0)
 
980
                                                        if (xmlDoc->iGetEntryAttribute(TLAlienFighter, "fire") > 0)
 
981
                                                                TimeSheet->Fire = true;
 
982
                                                TimeSheet->BossFire = false;
 
983
 
 
984
                                                TimeSheet->Targeting = false;
 
985
                                        }
 
986
 
 
987
                                }
 
988
 
 
989
                                // берем следующий элемент
 
990
                                TLAlienFighter = TLAlienFighter->Next;
 
991
                        }
 
992
                }
 
993
                else
 
994
                // AlienMotherShip
 
995
                if (!strcmp(TL->Name, "AlienMotherShip"))
 
996
                {
 
997
                        CAlienSpaceMotherShip *Fighter = 0;
 
998
                        Fighter = new CAlienSpaceMotherShip;
 
999
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1000
                        else
 
1001
                        {
 
1002
                                TL = TL->Next;
 
1003
                                continue;
 
1004
                        }
 
1005
 
 
1006
                        SetID(Fighter, TL, xmlDoc);
 
1007
                        if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
 
1008
 
 
1009
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
 
1010
                        {
 
1011
                                Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
1012
                                Fighter->Speed = Fighter->NeedSpeed;
 
1013
                        }
 
1014
                        if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
 
1015
                        {
 
1016
                                Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
 
1017
                                Fighter->SpeedLR = Fighter->NeedSpeedLR;
 
1018
                        }
 
1019
                        if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
 
1020
                        {
 
1021
                                Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
 
1022
                                Fighter->SpeedUD = Fighter->NeedSpeedUD;
 
1023
                        }
 
1024
 
 
1025
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
 
1026
                        {
 
1027
                                Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
 
1028
                                Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
 
1029
                        }
 
1030
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
 
1031
                        {
 
1032
                                Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
 
1033
                                Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
 
1034
                        }
 
1035
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
 
1036
                        {
 
1037
                                Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
 
1038
                                Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
 
1039
                        }
 
1040
 
 
1041
                        SetShowDeleteOnHide(Fighter, TL, xmlDoc);
 
1042
                        SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
 
1043
                        SetShipRotation(Fighter, TL, xmlDoc);
 
1044
                        SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
 
1045
 
 
1046
                        // дальше смотрим, что нужно сделать...
 
1047
                        cXMLEntry *TLAlienMotherShip = TL->FirstChild;
 
1048
                        while (TLAlienMotherShip)
 
1049
                        {
 
1050
                                if (!strcmp(TLAlienMotherShip->Name, "TimeSheet"))
 
1051
                                {
 
1052
                                        // собираем новый элемент
 
1053
                                        CTimeSheet *TimeSheet;
 
1054
                                        TimeSheet = new CTimeSheet;
 
1055
                                        Fighter->AttachTimeSheet(TimeSheet);
 
1056
 
 
1057
                                        if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "aimode") != 0)
 
1058
                                        {
 
1059
                                                TimeSheet->AI_Mode = xmlDoc->iGetEntryAttribute(TLAlienMotherShip, "aimode");
 
1060
                                                TimeSheet->Time = 0.0f;
 
1061
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "time") != 0)
 
1062
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "time");
 
1063
                                                TimeSheet->InUse = false;
 
1064
 
 
1065
                                                TimeSheet->Speed = 0.0f;
 
1066
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1067
                                                TimeSheet->SpeedLR = 0.0f;
 
1068
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1069
                                                TimeSheet->SpeedUD = 0.0f;
 
1070
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1071
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1072
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1073
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1074
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1075
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1076
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1077
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1078
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1079
                                                TimeSheet->Fire = false;
 
1080
                                                TimeSheet->BossFire = false;
 
1081
                                                TimeSheet->Targeting = false;
 
1082
                                        }
 
1083
                                        else
 
1084
                                        {
 
1085
                                                TimeSheet->AI_Mode = 0;
 
1086
 
 
1087
                                                TimeSheet->Time = 0.0f;
 
1088
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "time") != 0)
 
1089
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "time");
 
1090
                                                TimeSheet->InUse = false;
 
1091
 
 
1092
                                                TimeSheet->Speed = 0.0f;
 
1093
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speed") != 0)
 
1094
                                                        TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speed");
 
1095
 
 
1096
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1097
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "acceler") != 0)
 
1098
                                                        TimeSheet->Acceler = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "acceler");
 
1099
                                                Clamp(TimeSheet->Acceler, 0.0f, 1.0f);
 
1100
 
 
1101
                                                TimeSheet->SpeedLR = 0.0f;
 
1102
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedlr") != 0)
 
1103
                                                        TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedlr");
 
1104
 
 
1105
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1106
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "accelerlr") != 0)
 
1107
                                                        TimeSheet->AccelerLR = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "accelerlr");
 
1108
                                                Clamp(TimeSheet->AccelerLR, 0.0f, 1.0f);
 
1109
 
 
1110
                                                TimeSheet->SpeedUD = 0.0f;
 
1111
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedud") != 0)
 
1112
                                                        TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedud");
 
1113
 
 
1114
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1115
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "accelerud") != 0)
 
1116
                                                        TimeSheet->AccelerUD = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "accelerud");
 
1117
                                                Clamp(TimeSheet->AccelerUD, 0.0f, 1.0f);
 
1118
 
 
1119
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1120
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedbycamfb") != 0)
 
1121
                                                        TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedbycamfb");
 
1122
 
 
1123
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1124
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "accelerbycamfb") != 0)
 
1125
                                                        TimeSheet->AccelerByCamFB = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "accelerbycamfb");
 
1126
                                                Clamp(TimeSheet->AccelerByCamFB, 0.0f, 1.0f);
 
1127
 
 
1128
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1129
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedbycamlr") != 0)
 
1130
                                                        TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedbycamlr");
 
1131
 
 
1132
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1133
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "accelerbycamlr") != 0)
 
1134
                                                        TimeSheet->AccelerByCamLR = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "accelerbycamlr");
 
1135
                                                Clamp(TimeSheet->AccelerByCamLR, 0.0f, 1.0f);
 
1136
 
 
1137
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1138
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedbycamud") != 0)
 
1139
                                                        TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedbycamud");
 
1140
 
 
1141
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1142
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "accelerbycamud") != 0)
 
1143
                                                        TimeSheet->AccelerByCamUD = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "accelerbycamud");
 
1144
                                                Clamp(TimeSheet->AccelerByCamUD, 0.0f, 1.0f);
 
1145
 
 
1146
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1147
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "rotx") != 0)
 
1148
                                                        TimeSheet->Rotation.x = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "rotx");
 
1149
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "roty") != 0)
 
1150
                                                        TimeSheet->Rotation.y = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "roty");
 
1151
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "rotz") != 0)
 
1152
                                                        TimeSheet->Rotation.z = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "rotz");
 
1153
 
 
1154
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1155
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "rotacx") != 0)
 
1156
                                                        TimeSheet->RotationAcceler.x = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "rotacx");
 
1157
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "rotacy") != 0)
 
1158
                                                        TimeSheet->RotationAcceler.y = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "rotacy");
 
1159
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "rotacz") != 0)
 
1160
                                                        TimeSheet->RotationAcceler.z = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "rotacz");
 
1161
                                                Clamp(TimeSheet->RotationAcceler.x, 0.0f, 1.0f);
 
1162
                                                Clamp(TimeSheet->RotationAcceler.y, 0.0f, 1.0f);
 
1163
                                                Clamp(TimeSheet->RotationAcceler.z, 0.0f, 1.0f);
 
1164
 
 
1165
                                                TimeSheet->Fire = false;
 
1166
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "fire") != 0)
 
1167
                                                        if (xmlDoc->iGetEntryAttribute(TLAlienMotherShip, "fire") > 0)
 
1168
                                                                TimeSheet->Fire = true;
 
1169
                                                TimeSheet->BossFire = false;
 
1170
                                                if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "bossfire") != 0)
 
1171
                                                        if (xmlDoc->iGetEntryAttribute(TLAlienMotherShip, "bossfire") > 0)
 
1172
                                                                TimeSheet->BossFire = true;
 
1173
 
 
1174
                                                TimeSheet->Targeting = false;
 
1175
                                        }
 
1176
 
 
1177
                                }
 
1178
 
 
1179
                                // берем следующий элемент
 
1180
                                TLAlienMotherShip = TLAlienMotherShip->Next;
 
1181
                        }
 
1182
                }
 
1183
                else
 
1184
                // PirateShip
 
1185
                if (!strcmp(TL->Name, "PirateShip"))
 
1186
                {
 
1187
                        CPirateShip *Fighter = 0;
 
1188
                        Fighter = new CPirateShip;
 
1189
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1190
                        else
 
1191
                        {
 
1192
                                TL = TL->Next;
 
1193
                                continue;
 
1194
                        }
 
1195
 
 
1196
                        SetID(Fighter, TL, xmlDoc);
 
1197
                        if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
 
1198
 
 
1199
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
 
1200
                        {
 
1201
                                Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
1202
                                Fighter->Speed = Fighter->NeedSpeed;
 
1203
                        }
 
1204
                        if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
 
1205
                        {
 
1206
                                Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
 
1207
                                Fighter->SpeedLR = Fighter->NeedSpeedLR;
 
1208
                        }
 
1209
                        if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
 
1210
                        {
 
1211
                                Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
 
1212
                                Fighter->SpeedUD = Fighter->NeedSpeedUD;
 
1213
                        }
 
1214
 
 
1215
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
 
1216
                        {
 
1217
                                Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
 
1218
                                Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
 
1219
                        }
 
1220
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
 
1221
                        {
 
1222
                                Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
 
1223
                                Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
 
1224
                        }
 
1225
                        if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
 
1226
                        {
 
1227
                                Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
 
1228
                                Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
 
1229
                        }
 
1230
 
 
1231
                        SetShowDeleteOnHide(Fighter, TL, xmlDoc);
 
1232
                        SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
 
1233
                        SetShipRotation(Fighter, TL, xmlDoc);
 
1234
                        SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
 
1235
 
 
1236
                        // дальше смотрим, что нужно сделать...
 
1237
                        cXMLEntry *TLPirateShip = TL->FirstChild;
 
1238
                        while (TLPirateShip)
 
1239
                        {
 
1240
                                if (!strcmp(TLPirateShip->Name, "TimeSheet"))
 
1241
                                {
 
1242
                                        // собираем новый элемент
 
1243
                                        CTimeSheet *TimeSheet;
 
1244
                                        TimeSheet = new CTimeSheet;
 
1245
                                        Fighter->AttachTimeSheet(TimeSheet);
 
1246
 
 
1247
                                        if (xmlDoc->GetEntryAttribute(TLPirateShip, "aimode") != 0)
 
1248
                                        {
 
1249
                                                TimeSheet->AI_Mode = xmlDoc->iGetEntryAttribute(TLPirateShip, "aimode");
 
1250
                                                TimeSheet->Time = 0.0f;
 
1251
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "time") != 0)
 
1252
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLPirateShip, "time");
 
1253
                                                TimeSheet->InUse = false;
 
1254
 
 
1255
                                                TimeSheet->Speed = 0.0f;
 
1256
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1257
                                                TimeSheet->SpeedLR = 0.0f;
 
1258
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1259
                                                TimeSheet->SpeedUD = 0.0f;
 
1260
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1261
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1262
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1263
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1264
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1265
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1266
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1267
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1268
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1269
                                                TimeSheet->Fire = false;
 
1270
                                                TimeSheet->BossFire = false;
 
1271
                                                TimeSheet->Targeting = false;
 
1272
                                        }
 
1273
                                        else
 
1274
                                        {
 
1275
                                                TimeSheet->AI_Mode = 0;
 
1276
 
 
1277
                                                TimeSheet->Time = 0.0f;
 
1278
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "time") != 0)
 
1279
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLPirateShip, "time");
 
1280
                                                TimeSheet->InUse = false;
 
1281
 
 
1282
                                                TimeSheet->Speed = 0.0f;
 
1283
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "speed") != 0)
 
1284
                                                        TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLPirateShip, "speed");
 
1285
 
 
1286
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1287
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "acceler") != 0)
 
1288
                                                        TimeSheet->Acceler = xmlDoc->fGetEntryAttribute(TLPirateShip, "acceler");
 
1289
                                                Clamp(TimeSheet->Acceler, 0.0f, 1.0f);
 
1290
 
 
1291
                                                TimeSheet->SpeedLR = 0.0f;
 
1292
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedlr") != 0)
 
1293
                                                        TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedlr");
 
1294
 
 
1295
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1296
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "accelerlr") != 0)
 
1297
                                                        TimeSheet->AccelerLR = xmlDoc->fGetEntryAttribute(TLPirateShip, "accelerlr");
 
1298
                                                Clamp(TimeSheet->AccelerLR, 0.0f, 1.0f);
 
1299
 
 
1300
                                                TimeSheet->SpeedUD = 0.0f;
 
1301
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedud") != 0)
 
1302
                                                        TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedud");
 
1303
 
 
1304
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1305
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "accelerud") != 0)
 
1306
                                                        TimeSheet->AccelerUD = xmlDoc->fGetEntryAttribute(TLPirateShip, "accelerud");
 
1307
                                                Clamp(TimeSheet->AccelerUD, 0.0f, 1.0f);
 
1308
 
 
1309
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1310
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedbycamfb") != 0)
 
1311
                                                        TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedbycamfb");
 
1312
 
 
1313
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1314
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "accelerbycamfb") != 0)
 
1315
                                                        TimeSheet->AccelerByCamFB = xmlDoc->fGetEntryAttribute(TLPirateShip, "accelerbycamfb");
 
1316
                                                Clamp(TimeSheet->AccelerByCamFB, 0.0f, 1.0f);
 
1317
 
 
1318
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1319
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedbycamlr") != 0)
 
1320
                                                        TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedbycamlr");
 
1321
 
 
1322
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1323
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "accelerbycamlr") != 0)
 
1324
                                                        TimeSheet->AccelerByCamLR = xmlDoc->fGetEntryAttribute(TLPirateShip, "accelerbycamlr");
 
1325
                                                Clamp(TimeSheet->AccelerByCamLR, 0.0f, 1.0f);
 
1326
 
 
1327
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1328
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedbycamud") != 0)
 
1329
                                                        TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedbycamud");
 
1330
 
 
1331
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1332
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "accelerbycamud") != 0)
 
1333
                                                        TimeSheet->AccelerByCamUD = xmlDoc->fGetEntryAttribute(TLPirateShip, "accelerbycamud");
 
1334
                                                Clamp(TimeSheet->AccelerByCamUD, 0.0f, 1.0f);
 
1335
 
 
1336
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1337
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "rotx") != 0)
 
1338
                                                        TimeSheet->Rotation.x = xmlDoc->fGetEntryAttribute(TLPirateShip, "rotx");
 
1339
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "roty") != 0)
 
1340
                                                        TimeSheet->Rotation.y = xmlDoc->fGetEntryAttribute(TLPirateShip, "roty");
 
1341
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "rotz") != 0)
 
1342
                                                        TimeSheet->Rotation.z = xmlDoc->fGetEntryAttribute(TLPirateShip, "rotz");
 
1343
 
 
1344
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1345
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "rotacx") != 0)
 
1346
                                                        TimeSheet->RotationAcceler.x = xmlDoc->fGetEntryAttribute(TLPirateShip, "rotacx");
 
1347
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "rotacy") != 0)
 
1348
                                                        TimeSheet->RotationAcceler.y = xmlDoc->fGetEntryAttribute(TLPirateShip, "rotacy");
 
1349
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "rotacz") != 0)
 
1350
                                                        TimeSheet->RotationAcceler.z = xmlDoc->fGetEntryAttribute(TLPirateShip, "rotacz");
 
1351
                                                Clamp(TimeSheet->RotationAcceler.x, 0.0f, 1.0f);
 
1352
                                                Clamp(TimeSheet->RotationAcceler.y, 0.0f, 1.0f);
 
1353
                                                Clamp(TimeSheet->RotationAcceler.z, 0.0f, 1.0f);
 
1354
 
 
1355
                                                TimeSheet->Fire = false;
 
1356
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "fire") != 0)
 
1357
                                                        if (xmlDoc->iGetEntryAttribute(TLPirateShip, "fire") > 0)
 
1358
                                                                TimeSheet->Fire = true;
 
1359
 
 
1360
                                                TimeSheet->BossFire = false;
 
1361
                                                if (xmlDoc->GetEntryAttribute(TLPirateShip, "bossfire") != 0)
 
1362
                                                        if (xmlDoc->iGetEntryAttribute(TLPirateShip, "bossfire") > 0)
 
1363
                                                                TimeSheet->BossFire = true;
 
1364
 
 
1365
                                                TimeSheet->Targeting = false;
 
1366
                                        }
 
1367
 
 
1368
                                }
 
1369
 
 
1370
                                // берем следующий элемент
 
1371
                                TLPirateShip = TLPirateShip->Next;
 
1372
                        }
 
1373
                }
 
1374
                else
 
1375
                // CreateAsteroid
 
1376
                if (!strcmp(TL->Name, "CreateAsteroid"))
 
1377
                {
 
1378
                        CAsteroid *Asteroid = 0;
 
1379
                        Asteroid = new CAsteroid;
 
1380
 
 
1381
                        // тип сейчас не задействован, всегда ставим 1
 
1382
                        Asteroid->Create(1);
 
1383
 
 
1384
                        SetID(Asteroid, TL, xmlDoc);
 
1385
                        if (ShowDebugModeLine) SetDebugInformation(Asteroid, TL);
 
1386
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0) Asteroid->Speed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
1387
                        SetShowDeleteOnHide(Asteroid, TL, xmlDoc);
 
1388
 
 
1389
                        SetRotation(Asteroid, TL, xmlDoc);
 
1390
                        SetLocation(Asteroid, TL, xmlDoc, TimeOpLag);
 
1391
 
 
1392
            if (xmlDoc->GetEntryAttribute(TL, "rotx") != 0)
 
1393
                                Asteroid->RotationSpeed.x = xmlDoc->fGetEntryAttribute(TL, "rotx");
 
1394
                        if (xmlDoc->GetEntryAttribute(TL, "roty") != 0)
 
1395
                                Asteroid->RotationSpeed.y = xmlDoc->fGetEntryAttribute(TL, "roty");
 
1396
                        if (xmlDoc->GetEntryAttribute(TL, "rotz") != 0)
 
1397
                                Asteroid->RotationSpeed.z = xmlDoc->fGetEntryAttribute(TL, "rotz");
 
1398
                }
 
1399
                else
 
1400
                // CreateBasePart
 
1401
                if (!strcmp(TL->Name, "CreateBasePart"))
 
1402
                {
 
1403
                        CBasePart *BasePart = 0;
 
1404
                        BasePart = new CBasePart;
 
1405
 
 
1406
                        // тип части
 
1407
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) BasePart->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1408
                        else
 
1409
                        {
 
1410
                                TL = TL->Next;
 
1411
                                continue;
 
1412
                        }
 
1413
 
 
1414
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0) BasePart->Speed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
1415
 
 
1416
                        SetID(BasePart, TL, xmlDoc);
 
1417
                        if (ShowDebugModeLine) SetDebugInformation(BasePart, TL);
 
1418
                        SetShowDeleteOnHide(BasePart, TL, xmlDoc);
 
1419
 
 
1420
                        SetRotation(BasePart, TL, xmlDoc);
 
1421
                        SetLocation(BasePart, TL, xmlDoc, TimeOpLag);
 
1422
                }
 
1423
                else
 
1424
                // CreateBigAsteroid
 
1425
                if (!strcmp(TL->Name, "CreateBigAsteroid"))
 
1426
                {
 
1427
                        CBigAsteroid *BigAsteroid = 0;
 
1428
                        BigAsteroid = new CBigAsteroid;
 
1429
 
 
1430
                        // тип части
 
1431
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) BigAsteroid->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1432
                        else
 
1433
                        {
 
1434
                                TL = TL->Next;
 
1435
                                continue;
 
1436
                        }
 
1437
 
 
1438
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0) BigAsteroid->Speed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
1439
 
 
1440
                        SetID(BigAsteroid, TL, xmlDoc);
 
1441
                        if (ShowDebugModeLine) SetDebugInformation(BigAsteroid, TL);
 
1442
                        SetShowDeleteOnHide(BigAsteroid, TL, xmlDoc);
 
1443
 
 
1444
                        SetRotation(BigAsteroid, TL, xmlDoc);
 
1445
                        SetLocation(BigAsteroid, TL, xmlDoc, TimeOpLag);
 
1446
                }
 
1447
                else
 
1448
                // CreateMBuilding
 
1449
                if (!strcmp(TL->Name, "CreateMBuilding"))
 
1450
                {
 
1451
                        CMilitaryBuilding *GroundObject = 0;
 
1452
                        GroundObject = new CMilitaryBuilding;
 
1453
 
 
1454
                        // тип части
 
1455
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1456
                        else
 
1457
                        {
 
1458
                                TL = TL->Next;
 
1459
                                continue;
 
1460
                        }
 
1461
 
 
1462
                        SetID(GroundObject, TL, xmlDoc);
 
1463
                        if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
 
1464
                        SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
 
1465
                        SetAIMode(GroundObject, TL, xmlDoc); // на тот случае если просто ставим и все...
 
1466
 
 
1467
                        SetRotation(GroundObject, TL, xmlDoc);
 
1468
                        SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
 
1469
 
 
1470
                        // дальше смотрим, что нужно сделать...
 
1471
                        cXMLEntry *TLGroundObject = TL->FirstChild;
 
1472
                        while (TLGroundObject)
 
1473
                        {
 
1474
                                if (!strcmp(TLGroundObject->Name, "TimeSheet"))
 
1475
                                {
 
1476
                                        // собираем новый элемент
 
1477
                                        CTimeSheet *TimeSheet;
 
1478
                                        TimeSheet = new CTimeSheet;
 
1479
                                        GroundObject->AttachTimeSheet(TimeSheet);
 
1480
 
 
1481
                                        if (xmlDoc->GetEntryAttribute(TLGroundObject, "aimode") != 0)
 
1482
                                        {
 
1483
                                                TimeSheet->AI_Mode = xmlDoc->iGetEntryAttribute(TLGroundObject, "aimode");
 
1484
                                                TimeSheet->Time = 0.0f;
 
1485
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
 
1486
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
 
1487
                                                TimeSheet->InUse = false;
 
1488
 
 
1489
                                                TimeSheet->Speed = 0.0f;
 
1490
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1491
                                                TimeSheet->SpeedLR = 0.0f;
 
1492
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1493
                                                TimeSheet->SpeedUD = 0.0f;
 
1494
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1495
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1496
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1497
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1498
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1499
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1500
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1501
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1502
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1503
                                                TimeSheet->Fire = false;
 
1504
                                                TimeSheet->BossFire = false;
 
1505
                                                TimeSheet->Targeting = false;
 
1506
                                        }
 
1507
                                        else
 
1508
                                        {
 
1509
                                                TimeSheet->AI_Mode = 0;
 
1510
 
 
1511
                                                TimeSheet->Time = 0.0f;
 
1512
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
 
1513
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
 
1514
                                                TimeSheet->InUse = false;
 
1515
 
 
1516
                                                TimeSheet->Speed = 0.0f;
 
1517
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1518
                                                TimeSheet->SpeedLR = 0.0f;
 
1519
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1520
                                                TimeSheet->SpeedUD = 0.0f;
 
1521
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1522
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1523
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1524
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1525
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1526
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1527
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1528
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1529
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1530
 
 
1531
                                                TimeSheet->Fire = false;
 
1532
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "fire") != 0)
 
1533
                                                        if (xmlDoc->iGetEntryAttribute(TLGroundObject, "fire") > 0)
 
1534
                                                                TimeSheet->Fire = true;
 
1535
 
 
1536
                                                TimeSheet->BossFire = false;
 
1537
 
 
1538
                                                TimeSheet->Targeting = false;
 
1539
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "targeting") != 0)
 
1540
                                                        if (xmlDoc->iGetEntryAttribute(TLGroundObject, "targeting") != 0) TimeSheet->Targeting = true;
 
1541
                                        }
 
1542
 
 
1543
                                }
 
1544
 
 
1545
                                // берем следующий элемент
 
1546
                                TLGroundObject = TLGroundObject->Next;
 
1547
                        }
 
1548
                }
 
1549
                else
 
1550
                // CreateBuilding
 
1551
                if (!strcmp(TL->Name, "CreateBuilding"))
 
1552
                {
 
1553
                        CBuilding *GroundObject = 0;
 
1554
                        GroundObject = new CBuilding;
 
1555
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1556
                        else
 
1557
                        {
 
1558
                                TL = TL->Next;
 
1559
                                continue;
 
1560
                        }
 
1561
 
 
1562
                        SetID(GroundObject, TL, xmlDoc);
 
1563
                        if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
 
1564
                        SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
 
1565
 
 
1566
                        SetRotation(GroundObject, TL, xmlDoc);
 
1567
                        SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
 
1568
                }
 
1569
                else
 
1570
                // CreateMine
 
1571
                if (!strcmp(TL->Name, "CreateMine"))
 
1572
                {
 
1573
                        CProjectile *Mine = 0;
 
1574
                        Mine = new CProjectile;
 
1575
                        // т.к. мины у нас с 214-217, делаем +213
 
1576
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0)
 
1577
                        {
 
1578
                                int MineType = xmlDoc->iGetEntryAttribute(TL, "type")+213;
 
1579
                                if (MineType < 214) MineType = 214;
 
1580
                                if (MineType > 217) MineType = 217;
 
1581
                                Mine->Create(MineType);
 
1582
                        }
 
1583
                        else
 
1584
                        {
 
1585
                                TL = TL->Next;
 
1586
                                continue;
 
1587
                        }
 
1588
 
 
1589
                        Mine->ProjectileType = 1;
 
1590
 
 
1591
                        // по умолчанию враг
 
1592
                        Mine->ObjectStatus = 1;
 
1593
                        if (xmlDoc->GetEntryAttribute(TL, "status") != 0) Mine->ObjectStatus = xmlDoc->iGetEntryAttribute(TL, "status");
 
1594
 
 
1595
                        // общий - пенальти, если не игрок
 
1596
                        float CurrentPenalty = GameNPCWeaponPenalty*1.0f;
 
1597
                        // если игрок или свои - ничего не надо...
 
1598
                        if (Mine->ObjectStatus >= 2) CurrentPenalty = 1.0f;
 
1599
 
 
1600
                        Mine->DamageHull = Mine->DamageHull/CurrentPenalty;
 
1601
                        Mine->DamageSystems = Mine->DamageSystems/CurrentPenalty;
 
1602
                        Mine->SpeedStart = Mine->SpeedEnd = Mine->Speed = Mine->SpeedStart/CurrentPenalty;
 
1603
 
 
1604
                        SetID(Mine, TL, xmlDoc);
 
1605
                        if (ShowDebugModeLine) SetDebugInformation(Mine, TL);
 
1606
                        SetShowDeleteOnHide(Mine, TL, xmlDoc);
 
1607
 
 
1608
 
 
1609
                        SetProjectileRotation(Mine, TL, xmlDoc);
 
1610
                        SetProjectileLocation(Mine, TL, xmlDoc, TimeOpLag);
 
1611
                }
 
1612
                else
 
1613
                // CreateTracked
 
1614
                if (!strcmp(TL->Name, "CreateTracked"))
 
1615
                {
 
1616
                        CTracked *GroundObject = 0;
 
1617
                        GroundObject = new CTracked;
 
1618
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1619
                        else
 
1620
                        {
 
1621
                                TL = TL->Next;
 
1622
                                continue;
 
1623
                        }
 
1624
 
 
1625
                        SetID(GroundObject, TL, xmlDoc);
 
1626
                        if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
 
1627
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
 
1628
                        {
 
1629
                                GroundObject->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
1630
                                GroundObject->Speed = GroundObject->NeedSpeed;
 
1631
                        }
 
1632
 
 
1633
                        SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
 
1634
                        SetAIMode(GroundObject, TL, xmlDoc); // на тот случае если просто ставим и все...
 
1635
                        SetRotation(GroundObject, TL, xmlDoc);
 
1636
                        SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
 
1637
 
 
1638
                        // дальше смотрим, что нужно сделать...
 
1639
                        cXMLEntry *TLGroundObject = TL->FirstChild;
 
1640
                        while (TLGroundObject)
 
1641
                        {
 
1642
                                if (!strcmp(TLGroundObject->Name, "TimeSheet"))
 
1643
                                {
 
1644
                                        // собираем новый элемент
 
1645
                                        CTimeSheet *TimeSheet;
 
1646
                                        TimeSheet = new CTimeSheet;
 
1647
                                        GroundObject->AttachTimeSheet(TimeSheet);
 
1648
 
 
1649
                                        if (xmlDoc->GetEntryAttribute(TLGroundObject, "aimode") != 0)
 
1650
                                        {
 
1651
                                                TimeSheet->AI_Mode = xmlDoc->iGetEntryAttribute(TLGroundObject, "aimode");
 
1652
                                                TimeSheet->Time = 0.0f;
 
1653
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
 
1654
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
 
1655
                                                TimeSheet->InUse = false;
 
1656
 
 
1657
                                                TimeSheet->Speed = 0.0f;
 
1658
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1659
                                                TimeSheet->SpeedLR = 0.0f;
 
1660
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1661
                                                TimeSheet->SpeedUD = 0.0f;
 
1662
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1663
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1664
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1665
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1666
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1667
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1668
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1669
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1670
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1671
                                                TimeSheet->Fire = false;
 
1672
                                                TimeSheet->BossFire = false;
 
1673
                                                TimeSheet->Targeting = false;
 
1674
                                        }
 
1675
                                        else
 
1676
                                        {
 
1677
                                                TimeSheet->AI_Mode = 0;
 
1678
 
 
1679
                                                TimeSheet->Time = 0.0f;
 
1680
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
 
1681
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
 
1682
                                                TimeSheet->InUse = false;
 
1683
 
 
1684
                                                TimeSheet->Speed = 0.0f;
 
1685
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "speed") != 0)
 
1686
                                                        TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLGroundObject, "speed");
 
1687
 
 
1688
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1689
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "acceler") != 0)
 
1690
                                                        TimeSheet->Acceler = xmlDoc->fGetEntryAttribute(TLGroundObject, "acceler");
 
1691
                                                Clamp(TimeSheet->Acceler, 0.0f, 1.0f);
 
1692
 
 
1693
                                                TimeSheet->SpeedLR = 0.0f;
 
1694
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1695
                                                TimeSheet->SpeedUD = 0.0f;
 
1696
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1697
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1698
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1699
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1700
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1701
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1702
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1703
 
 
1704
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1705
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotx") != 0)
 
1706
                                                        TimeSheet->Rotation.x = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotx");
 
1707
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "roty") != 0)
 
1708
                                                        TimeSheet->Rotation.y = xmlDoc->fGetEntryAttribute(TLGroundObject, "roty");
 
1709
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotz") != 0)
 
1710
                                                        TimeSheet->Rotation.z = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotz");
 
1711
 
 
1712
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1713
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotacx") != 0)
 
1714
                                                        TimeSheet->RotationAcceler.x = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotacx");
 
1715
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotacy") != 0)
 
1716
                                                        TimeSheet->RotationAcceler.y = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotacy");
 
1717
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotacz") != 0)
 
1718
                                                        TimeSheet->RotationAcceler.z = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotacz");
 
1719
                                                Clamp(TimeSheet->RotationAcceler.x, 0.0f, 1.0f);
 
1720
                                                Clamp(TimeSheet->RotationAcceler.y, 0.0f, 1.0f);
 
1721
                                                Clamp(TimeSheet->RotationAcceler.z, 0.0f, 1.0f);
 
1722
 
 
1723
                                                TimeSheet->Fire = false;
 
1724
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "fire") != 0)
 
1725
                                                        if (xmlDoc->iGetEntryAttribute(TLGroundObject, "fire") > 0)
 
1726
                                                                TimeSheet->Fire = true;
 
1727
 
 
1728
                                                TimeSheet->BossFire = false;
 
1729
 
 
1730
                                                TimeSheet->Targeting = false;
 
1731
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "targeting") != 0)
 
1732
                                                        if (xmlDoc->iGetEntryAttribute(TLGroundObject, "targeting") > 0)
 
1733
                                                                TimeSheet->Targeting = true;
 
1734
                                        }
 
1735
 
 
1736
                                }
 
1737
 
 
1738
                                // берем следующий элемент
 
1739
                                TLGroundObject = TLGroundObject->Next;
 
1740
                        }
 
1741
                }
 
1742
                else
 
1743
                // CreateWheeled
 
1744
                if (!strcmp(TL->Name, "CreateWheeled"))
 
1745
                {
 
1746
                        CWheeled *GroundObject = 0;
 
1747
                        GroundObject = new CWheeled;
 
1748
                        if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
 
1749
                        else
 
1750
                        {
 
1751
                                TL = TL->Next;
 
1752
                                continue;
 
1753
                        }
 
1754
 
 
1755
                        SetID(GroundObject, TL, xmlDoc);
 
1756
                        if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
 
1757
                        if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
 
1758
                        {
 
1759
                                GroundObject->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
 
1760
                                GroundObject->Speed = GroundObject->NeedSpeed;
 
1761
                        }
 
1762
 
 
1763
                        SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
 
1764
                        SetAIMode(GroundObject, TL, xmlDoc); // на тот случае если просто ставим и все...
 
1765
                        SetRotation(GroundObject, TL, xmlDoc);
 
1766
                        SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
 
1767
 
 
1768
                        // дальше смотрим, что нужно сделать...
 
1769
                        cXMLEntry *TLGroundObject = TL->FirstChild;
 
1770
                        while (TLGroundObject)
 
1771
                        {
 
1772
                                if (!strcmp(TLGroundObject->Name, "TimeSheet"))
 
1773
                                {
 
1774
                                        // собираем новый элемент
 
1775
                                        CTimeSheet *TimeSheet;
 
1776
                                        TimeSheet = new CTimeSheet;
 
1777
                                        GroundObject->AttachTimeSheet(TimeSheet);
 
1778
 
 
1779
                                        if (xmlDoc->GetEntryAttribute(TLGroundObject, "aimode") != 0)
 
1780
                                        {
 
1781
                                                TimeSheet->AI_Mode = xmlDoc->iGetEntryAttribute(TLGroundObject, "aimode");
 
1782
                                                TimeSheet->Time = 0.0f;
 
1783
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
 
1784
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
 
1785
                                                TimeSheet->InUse = false;
 
1786
 
 
1787
                                                TimeSheet->Speed = 0.0f;
 
1788
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1789
                                                TimeSheet->SpeedLR = 0.0f;
 
1790
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1791
                                                TimeSheet->SpeedUD = 0.0f;
 
1792
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1793
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1794
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1795
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1796
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1797
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1798
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1799
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1800
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1801
                                                TimeSheet->Fire = false;
 
1802
                                                TimeSheet->BossFire = false;
 
1803
                                                TimeSheet->Targeting = false;
 
1804
                                        }
 
1805
                                        else
 
1806
                                        {
 
1807
                                                TimeSheet->AI_Mode = 0;
 
1808
 
 
1809
                                                TimeSheet->Time = 0.0f;
 
1810
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
 
1811
                                                        TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
 
1812
                                                TimeSheet->InUse = false;
 
1813
 
 
1814
                                                TimeSheet->Speed = 0.0f;
 
1815
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "speed") != 0)
 
1816
                                                        TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLGroundObject, "speed");
 
1817
 
 
1818
 
 
1819
                                                TimeSheet->Acceler = 1.0f;//0-1
 
1820
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "acceler") != 0)
 
1821
                                                        TimeSheet->Acceler = xmlDoc->fGetEntryAttribute(TLGroundObject, "acceler");
 
1822
                                                Clamp(TimeSheet->Acceler, 0.0f, 1.0f);
 
1823
 
 
1824
                                                TimeSheet->SpeedLR = 0.0f;
 
1825
                                                TimeSheet->AccelerLR = 1.0f;//0-1
 
1826
                                                TimeSheet->SpeedUD = 0.0f;
 
1827
                                                TimeSheet->AccelerUD = 1.0f;//0-1
 
1828
                                                TimeSheet->SpeedByCamFB = 0.0f;
 
1829
                                                TimeSheet->AccelerByCamFB = 1.0f;//0-1
 
1830
                                                TimeSheet->SpeedByCamLR = 0.0f;
 
1831
                                                TimeSheet->AccelerByCamLR = 1.0f;//0-1
 
1832
                                                TimeSheet->SpeedByCamUD = 0.0f;
 
1833
                                                TimeSheet->AccelerByCamUD = 1.0f;//0-1
 
1834
 
 
1835
                                                TimeSheet->Rotation = VECTOR3D(0.0f, 0.0f, 0.0f);
 
1836
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotx") != 0)
 
1837
                                                        TimeSheet->Rotation.x = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotx");
 
1838
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "roty") != 0)
 
1839
                                                        TimeSheet->Rotation.y = xmlDoc->fGetEntryAttribute(TLGroundObject, "roty");
 
1840
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotz") != 0)
 
1841
                                                        TimeSheet->Rotation.z = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotz");
 
1842
 
 
1843
                                                TimeSheet->RotationAcceler = VECTOR3D(1.0f, 1.0f, 1.0f);//0-1
 
1844
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotacx") != 0)
 
1845
                                                        TimeSheet->RotationAcceler.x = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotacx");
 
1846
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotacy") != 0)
 
1847
                                                        TimeSheet->RotationAcceler.y = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotacy");
 
1848
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "rotacz") != 0)
 
1849
                                                        TimeSheet->RotationAcceler.z = xmlDoc->fGetEntryAttribute(TLGroundObject, "rotacz");
 
1850
                                                Clamp(TimeSheet->RotationAcceler.x, 0.0f, 1.0f);
 
1851
                                                Clamp(TimeSheet->RotationAcceler.y, 0.0f, 1.0f);
 
1852
                                                Clamp(TimeSheet->RotationAcceler.z, 0.0f, 1.0f);
 
1853
 
 
1854
                                                TimeSheet->Fire = false;
 
1855
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "fire") != 0)
 
1856
                                                        if (xmlDoc->iGetEntryAttribute(TLGroundObject, "fire") > 0)
 
1857
                                                                TimeSheet->Fire = true;
 
1858
 
 
1859
                                                TimeSheet->BossFire = false;
 
1860
 
 
1861
                                                TimeSheet->Targeting = false;
 
1862
                                                if (xmlDoc->GetEntryAttribute(TLGroundObject, "targeting") != 0)
 
1863
                                                        if (xmlDoc->iGetEntryAttribute(TLGroundObject, "targeting") != 0) TimeSheet->Targeting = true;
 
1864
                                        }
 
1865
 
 
1866
                                }
 
1867
 
 
1868
                                // берем следующий элемент
 
1869
                                TLGroundObject = TLGroundObject->Next;
 
1870
                        }
 
1871
                }
 
1872
                else
 
1873
                {
 
1874
                        // если тут - значит не нашли директиву, или произошла ошибка
 
1875
                        fprintf(stderr, "ScriptEngine: tag %s not found, line %i.", TL->Name, TL->LineNumber);
 
1876
                }
 
1877
 
 
1878
 
 
1879
                // берем следующий элемент по порядку
 
1880
                TL = TL->Next;
 
1881
        }
 
1882
}
 
1883
 
 
1884
 
 
1885
 
 
1886