1
/************************************************************************************
3
AstroMenace (Hardcore 3D space shooter with spaceship upgrade possibilities)
4
Copyright © 2006-2012 Michael Kurinnoy, Viewizard
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.
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.
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/>.
21
Web Site: http://www.viewizard.com/
22
Project: http://sourceforge.net/projects/openastromenace/
23
E-mail: viewizard@viewizard.com
25
*************************************************************************************/
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);
46
// проверка, если конец уровня как всех убъем
48
extern CSpaceShip *StartSpaceShip;
49
extern CSpaceShip *EndSpaceShip;
50
extern CGroundObject *StartGroundObject;
51
extern CGroundObject *EndGroundObject;
53
// отображение коробок... отладка
54
extern int NeedShowBB;
55
// неубиваемость... отладка
56
extern bool UndeadDebugMode;
57
// показывать время при скорости 1.5
58
extern bool ShowGameTime;
63
//-----------------------------------------------------------------------------
64
// Конструктор, инициализация всех переменных
65
//-----------------------------------------------------------------------------
66
ScriptEngine::ScriptEngine()
76
NeedCheckSpaceShip = false;
77
NeedCheckGroundObject = false;
78
EndDelayMissionComplete = 0.0f;
79
LastTimeMissionComplete = -1.0f;
89
AsterMinFastSpeed = 35.0f;
92
AsterLastTime = -1.0f;
96
ShowDebugModeLine = false;
98
UndeadDebugMode = false;
106
//-----------------------------------------------------------------------------
108
//-----------------------------------------------------------------------------
109
ScriptEngine::~ScriptEngine()
119
//-----------------------------------------------------------------------------
120
// запустить скрипт на выполнение
121
//-----------------------------------------------------------------------------
122
bool ScriptEngine::RunScript(const char *FileName, float InitTime)
124
// установка значений
125
StartTime = TimeLastOp = InitTime;
130
NeedCheckSpaceShip = false;
131
NeedCheckGroundObject = false;
132
EndDelayMissionComplete = 0.0f;
133
LastTimeMissionComplete = -1.0f;
141
AsterRealNeed = 0.0f;
142
AsterMaxSpeed = 5.0f;
143
AsterMinFastSpeed = 35.0f;
146
AsterLastTime = -1.0f;
151
ShowDebugModeLine = false;
153
UndeadDebugMode = false;
154
ShowGameTime = false;
162
xmlDoc = new cXMLDocument;
165
if (!xmlDoc->Load(FileName))
167
fprintf(stderr, "Can't find script file or file corrupted: %s\n", FileName);
168
delete xmlDoc; xmlDoc = 0;
173
// проверяем корневой элемент
174
if (strcmp("AstroMenaceScript", xmlDoc->RootXMLEntry->Name))
176
fprintf(stderr, "Can't find AstroMenaceScript element in the: %s\n", FileName);
177
delete xmlDoc; xmlDoc = 0;
182
// переходим на действия
183
xmlEntry = xmlDoc->FindFirstChildEntryByName(xmlDoc->RootXMLEntry, "Action");
186
fprintf(stderr, "Can't find Action element in the: %s\n", FileName);
187
delete xmlDoc; xmlDoc = 0;
191
xmlEntry = xmlEntry->FirstChild;
194
fprintf(stderr, "Can't find Action element in the: %s\n", FileName);
195
delete xmlDoc; xmlDoc = 0;
203
// идем и выполняем то, что по времени 0 стоит, т.е. начальную инициализацию
213
//-----------------------------------------------------------------------------
215
//-----------------------------------------------------------------------------
216
bool ScriptEngine::Update(float Time)
218
// скрипт не загружен
219
if (xmlDoc == 0) return false;
221
// находим дельту времени
222
float TimeDelta = Time - TimeLastOp;
225
// генерация астероидов
228
if (AsterLastTime == -1.0) AsterLastTime = Time;
229
float TimeDelta = Time - AsterLastTime;
230
AsterLastTime = Time;
233
float NeedGener = AsterQuant*TimeDelta+AsterRealNeed;
234
// получаем целое кол-во на генерацию
235
unsigned int NeedGenerInt = (unsigned int)NeedGener;
236
// находим остаток... который нужно будет потом учесть
237
AsterRealNeed = NeedGener - NeedGenerInt;
239
while (NeedGenerInt>0)
241
CAsteroid *CreateAsteroid = 0;
242
CreateAsteroid = new CAsteroid;
243
CreateAsteroid->Create(1);
244
if (AsterFastCount != 20)
245
CreateAsteroid->Speed = AsterMaxSpeed*vw_Randf1;
247
CreateAsteroid->Speed = AsterMinFastSpeed + AsterMaxSpeed*vw_Randf1;
248
CreateAsteroid->ShowDeleteOnHide = 0;
249
CreateAsteroid->SetRotation(VECTOR3D(0.0f, 180.0f, 0.0f));// !!!учесть камеру
251
if (AsterFastCount != 20)
252
CreateAsteroid->SetLocation(
253
VECTOR3D(AsterW*vw_Randf0+AsterXPos, AsterYPos*2+AsterH*vw_Randf1, AsterZPos+20.0f)
256
CreateAsteroid->SetLocation(
257
VECTOR3D(AsterW*vw_Randf0+AsterXPos, AsterYPos*2+AsterH*vw_Randf1, AsterZPos)
264
if (AsterFastCount > 30) AsterFastCount = 0;
269
// если нужно, смотрим когда заканчивать миссию
270
if ((EndDelayMissionComplete>0.0f) || NeedCheckSpaceShip || NeedCheckGroundObject)
272
if (LastTimeMissionComplete == -1.0) LastTimeMissionComplete = Time;
273
float TimeDeltaMissionComplete = Time - LastTimeMissionComplete;
274
LastTimeMissionComplete = Time;
276
// уменьшаем только тогда, когда уже никого нет... т.е. отступ это от смерти последнего
277
bool NeedDecrease = true;
280
// собственно сами проверки...
281
if (NeedCheckSpaceShip)
285
CSpaceShip *Tmp1 = StartSpaceShip;
288
// если это враг, и мы его показали (иначе он где-то там летает)
289
if ((Tmp1->ObjectStatus == 1) && (Tmp1->ShowDeleteOnHide != 0)) count++;
292
if (count > 0) NeedDecrease = false;
295
if (NeedCheckGroundObject)
297
// если нет врагов, которых можем уничтожить
299
CGroundObject *Tmp1 = StartGroundObject;
302
// если это враг, и мы его показали
303
if (NeedCheckCollision(Tmp1) && (Tmp1->ShowDeleteOnHide != 0)) count++;
306
if (count > 0) NeedDecrease = false;
310
if (NeedDecrease) EndDelayMissionComplete -= TimeDeltaMissionComplete;
311
if (EndDelayMissionComplete<=0.0f)
313
EndDelayMissionComplete = 0.0f;
314
NeedCheckSpaceShip = false;
315
NeedCheckGroundObject = false;
316
SetGameMissionComplete();
320
// говорим, что скрипт еще не закончился!
332
if (!strcmp(xmlEntry->Name, "TimeLine"))
335
if (xmlDoc->GetEntryAttribute(xmlEntry, "value") != 0)
336
onTime = xmlDoc->fGetEntryAttribute(xmlEntry, "value");
338
// если еще не время выполнять... нужно уйти из процедуры
339
if (onTime > TimeDelta) return true;
341
// считаем лаг, чтобы правильно вычеслить положение при создании
342
TimeOpLag = TimeDelta - onTime;
344
// дальше смотрим, что нужно сделать...
347
TimeLastOp = Time - TimeOpLag;
348
TimeDelta = TimeOpLag;//Time - TimeLastOp;
352
if (!strcmp(xmlEntry->Name, "Debug"))
354
ShowDebugModeLine = false;
355
if (xmlDoc->GetEntryAttribute(xmlEntry, "showline") != 0)
356
ShowDebugModeLine = xmlDoc->bGetEntryAttribute(xmlEntry, "showline");
359
if (xmlDoc->GetEntryAttribute(xmlEntry, "showbb") != 0)
360
NeedShowBB = xmlDoc->iGetEntryAttribute(xmlEntry, "showbb");
362
UndeadDebugMode = false;
363
if (xmlDoc->GetEntryAttribute(xmlEntry, "undead") != 0)
364
UndeadDebugMode = xmlDoc->bGetEntryAttribute(xmlEntry, "undead");
366
ShowGameTime = false;
367
if (xmlDoc->GetEntryAttribute(xmlEntry, "time") != 0)
368
ShowGameTime = xmlDoc->bGetEntryAttribute(xmlEntry, "time");
373
if (!strcmp(xmlEntry->Name, "StarSystem"))
375
if (xmlDoc->GetEntryAttribute(xmlEntry, "system") != 0)
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);
387
if (!strcmp(xmlEntry->Name, "Music"))
389
// если корабль игрока уничтожен - не меняем уже музыку в игре вообще,
390
// должна проигрываться только музыка поражения
391
if (PlayerFighter != 0)
392
if (PlayerFighter->Strength > 0.0f)
394
if (xmlDoc->GetEntryAttribute(xmlEntry, "theme") != 0)
396
int Theme = xmlDoc->iGetEntryAttribute(xmlEntry, "theme");
398
StartMusicWithFade(2, 2.0f, 2.0f);
400
StartMusicWithFade(3, 1.5f, 2.0f);
406
if (!strcmp(xmlEntry->Name, "CreatePlanet"))
409
Planet = new CPlanet;
410
if (xmlDoc->GetEntryAttribute(xmlEntry, "type") != 0)
412
Planet->Create(xmlDoc->iGetEntryAttribute(xmlEntry, "type"));
413
SetRotation(Planet, xmlEntry, xmlDoc);
414
SetLocation(Planet, xmlEntry, xmlDoc, 0.0f);
415
Planet->ShowDeleteOnHide = 0;
417
if (xmlDoc->GetEntryAttribute(xmlEntry, "speed") != 0) Planet->Speed = xmlDoc->fGetEntryAttribute(xmlEntry, "speed");
422
if (!strcmp(xmlEntry->Name, "AsteroidField"))
424
if (xmlDoc->GetEntryAttribute(xmlEntry, "status") != 0)
426
AsterOn = xmlDoc->bGetEntryAttribute(xmlEntry, "status");
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");
439
if (!strcmp(xmlEntry->Name, "Light"))
442
NewLight = new eLight;
444
NewLight->LightType = 0; // по умолчанию, солнце
445
if (xmlDoc->GetEntryAttribute(xmlEntry, "type") != 0) NewLight->LightType = xmlDoc->iGetEntryAttribute(xmlEntry, "type");
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");
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");
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");
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();
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");
487
if (xmlDoc->GetEntryAttribute(xmlEntry, "status") != 0)
488
NewLight->On = xmlDoc->bGetEntryAttribute(xmlEntry, "status");
492
if (!strcmp(xmlEntry->Name, "Label"))
495
xmlEntry = xmlEntry->Next;
500
if (!strcmp(xmlEntry->Name, "Goto"))
502
// если есть указатель на метку
503
if (xmlDoc->GetEntryAttribute(xmlEntry, "label") != 0)
505
// нужно перебрать все метки и остановится на нужной
506
cXMLEntry *tmpEntry = xmlDoc->FindFirstChildEntryByName(xmlDoc->FindFirstChildEntryByName(xmlDoc->RootXMLEntry, "Action"), "Label");
508
// перебор по всем меткам
511
// if (!strcmp(tmpEntry->Name, "Label"))
512
if (xmlDoc->GetEntryAttribute(tmpEntry, "name") != 0)
513
if (!strcmp(xmlDoc->GetEntryAttribute(tmpEntry, "name"), xmlDoc->GetEntryAttribute(xmlEntry, "label")))
515
// ставим новый указатель
519
// берем следующую метку
520
tmpEntry = tmpEntry->Next;
526
if (!strcmp(xmlEntry->Name, "MissionComplete"))
528
SetGameMissionComplete();
531
// MissionCompleteAtNoEnemy
532
if (!strcmp(xmlEntry->Name, "MissionCompleteAtNoEnemy"))
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;};
542
if (!SetGameMissionFlag)
544
// если время не выставили и нечего ждать, работаем как и с обычным завершением
545
SetGameMissionComplete();
549
LastTimeMissionComplete = Time;
555
if (!strcmp(xmlEntry->Name, "Text"))
557
CGameLvlText *NewText;
558
NewText = new CGameLvlText;
561
NewText->Lifetime = -1.0f;
562
if (xmlDoc->GetEntryAttribute(xmlEntry, "life") != 0) NewText->Lifetime = xmlDoc->fGetEntryAttribute(xmlEntry, "life");
564
if (xmlDoc->GetEntryAttribute(xmlEntry, "text") != 0)
566
NewText->DrawText = new char[strlen(xmlDoc->GetEntryAttribute(xmlEntry, "text"))+1];
567
strcpy(NewText->DrawText, xmlDoc->GetEntryAttribute(xmlEntry, "text"));
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");
574
if (xmlDoc->GetEntryAttribute(xmlEntry, "color") != 0) NewText->Color = xmlDoc->iGetEntryAttribute(xmlEntry, "color");
578
// если тут - значит не нашли директиву, или произошла ошибка
579
fprintf(stderr, "ScriptEngine: tag %s not found, line %i.", xmlEntry->Name, xmlEntry->LineNumber);
582
// берем следующий элемент по порядку
583
xmlEntry = xmlEntry->Next;
586
// выходим, скрипт закончился
598
//-----------------------------------------------------------------------------
599
// проверяем скрипт дополнительно для TimeLine
600
//-----------------------------------------------------------------------------
601
void ScriptEngine::UpdateTimeLine()
603
// получаем первый тэг
604
cXMLEntry *TL = xmlEntry->FirstChild;
610
if (!strcmp(TL->Name, "EarthFighter"))
612
CEarthSpaceFighter *Fighter = 0;
613
Fighter = new CEarthSpaceFighter;
614
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
621
SetID(Fighter, TL, xmlDoc);
622
if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
624
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
626
Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
627
Fighter->Speed = Fighter->NeedSpeed;
629
if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
631
Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
632
Fighter->SpeedLR = Fighter->NeedSpeedLR;
634
if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
636
Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
637
Fighter->SpeedUD = Fighter->NeedSpeedUD;
640
if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
642
Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
643
Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
645
if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
647
Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
648
Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
650
if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
652
Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
653
Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
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"));
665
SetShowDeleteOnHide(Fighter, TL, xmlDoc);
666
SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
667
SetShipRotation(Fighter, TL, xmlDoc);
668
SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
670
// дальше смотрим, что нужно сделать...
671
cXMLEntry *TLEarthFighter = TL->FirstChild;
672
while (TLEarthFighter)
674
if (!strcmp(TLEarthFighter->Name, "TimeSheet"))
676
// собираем новый элемент
677
CTimeSheet *TimeSheet;
678
TimeSheet = new CTimeSheet;
679
Fighter->AttachTimeSheet(TimeSheet);
681
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "aimode") != 0)
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");
688
TimeSheet->InUse = false;
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;
710
TimeSheet->AI_Mode = 0;
712
TimeSheet->Time = 0.0f;
713
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "time") != 0)
714
TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLEarthFighter, "time");
715
TimeSheet->InUse = false;
717
TimeSheet->Speed = 0.0f;
718
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speed") != 0)
719
TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speed");
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);
726
TimeSheet->SpeedLR = 0.0f;
727
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedlr") != 0)
728
TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedlr");
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);
735
TimeSheet->SpeedUD = 0.0f;
736
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedud") != 0)
737
TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedud");
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);
745
TimeSheet->SpeedByCamFB = 0.0f;
746
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedbycamfb") != 0)
747
TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedbycamfb");
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);
754
TimeSheet->SpeedByCamLR = 0.0f;
755
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedbycamlr") != 0)
756
TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedbycamlr");
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);
763
TimeSheet->SpeedByCamUD = 0.0f;
764
if (xmlDoc->GetEntryAttribute(TLEarthFighter, "speedbycamud") != 0)
765
TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLEarthFighter, "speedbycamud");
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);
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");
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);
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;
802
// берем следующий элемент
803
TLEarthFighter = TLEarthFighter->Next;
808
if (!strcmp(TL->Name, "AlienFighter"))
810
CAlienSpaceFighter *Fighter = 0;
811
Fighter = new CAlienSpaceFighter;
812
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
819
SetID(Fighter, TL, xmlDoc);
820
if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
822
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
824
Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
825
Fighter->Speed = Fighter->NeedSpeed;
827
if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
829
Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
830
Fighter->SpeedLR = Fighter->NeedSpeedLR;
832
if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
834
Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
835
Fighter->SpeedUD = Fighter->NeedSpeedUD;
838
if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
840
Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
841
Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
843
if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
845
Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
846
Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
848
if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
850
Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
851
Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
854
SetShowDeleteOnHide(Fighter, TL, xmlDoc);
855
SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
856
SetShipRotation(Fighter, TL, xmlDoc);
857
SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
859
// дальше смотрим, что нужно сделать...
860
cXMLEntry *TLAlienFighter = TL->FirstChild;
861
while (TLAlienFighter)
863
if (!strcmp(TLAlienFighter->Name, "TimeSheet"))
865
// собираем новый элемент
866
CTimeSheet *TimeSheet;
867
TimeSheet = new CTimeSheet;
868
Fighter->AttachTimeSheet(TimeSheet);
870
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "aimode") != 0)
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;
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;
898
TimeSheet->AI_Mode = 0;
900
TimeSheet->Time = 0.0f;
901
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "time") != 0)
902
TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLAlienFighter, "time");
903
TimeSheet->InUse = false;
905
TimeSheet->Speed = 0.0f;
906
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speed") != 0)
907
TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speed");
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);
914
TimeSheet->SpeedLR = 0.0f;
915
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedlr") != 0)
916
TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedlr");
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);
923
TimeSheet->SpeedUD = 0.0f;
924
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedud") != 0)
925
TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedud");
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);
932
TimeSheet->SpeedByCamFB = 0.0f;
933
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedbycamfb") != 0)
934
TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedbycamfb");
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);
941
TimeSheet->SpeedByCamLR = 0.0f;
942
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedbycamlr") != 0)
943
TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedbycamlr");
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);
950
TimeSheet->SpeedByCamUD = 0.0f;
951
if (xmlDoc->GetEntryAttribute(TLAlienFighter, "speedbycamud") != 0)
952
TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLAlienFighter, "speedbycamud");
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);
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");
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);
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;
984
TimeSheet->Targeting = false;
989
// берем следующий элемент
990
TLAlienFighter = TLAlienFighter->Next;
995
if (!strcmp(TL->Name, "AlienMotherShip"))
997
CAlienSpaceMotherShip *Fighter = 0;
998
Fighter = new CAlienSpaceMotherShip;
999
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1006
SetID(Fighter, TL, xmlDoc);
1007
if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
1009
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
1011
Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
1012
Fighter->Speed = Fighter->NeedSpeed;
1014
if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
1016
Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
1017
Fighter->SpeedLR = Fighter->NeedSpeedLR;
1019
if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
1021
Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
1022
Fighter->SpeedUD = Fighter->NeedSpeedUD;
1025
if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
1027
Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
1028
Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
1030
if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
1032
Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
1033
Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
1035
if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
1037
Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
1038
Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
1041
SetShowDeleteOnHide(Fighter, TL, xmlDoc);
1042
SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
1043
SetShipRotation(Fighter, TL, xmlDoc);
1044
SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
1046
// дальше смотрим, что нужно сделать...
1047
cXMLEntry *TLAlienMotherShip = TL->FirstChild;
1048
while (TLAlienMotherShip)
1050
if (!strcmp(TLAlienMotherShip->Name, "TimeSheet"))
1052
// собираем новый элемент
1053
CTimeSheet *TimeSheet;
1054
TimeSheet = new CTimeSheet;
1055
Fighter->AttachTimeSheet(TimeSheet);
1057
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "aimode") != 0)
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;
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;
1085
TimeSheet->AI_Mode = 0;
1087
TimeSheet->Time = 0.0f;
1088
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "time") != 0)
1089
TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "time");
1090
TimeSheet->InUse = false;
1092
TimeSheet->Speed = 0.0f;
1093
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speed") != 0)
1094
TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speed");
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);
1101
TimeSheet->SpeedLR = 0.0f;
1102
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedlr") != 0)
1103
TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedlr");
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);
1110
TimeSheet->SpeedUD = 0.0f;
1111
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedud") != 0)
1112
TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedud");
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);
1119
TimeSheet->SpeedByCamFB = 0.0f;
1120
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedbycamfb") != 0)
1121
TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedbycamfb");
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);
1128
TimeSheet->SpeedByCamLR = 0.0f;
1129
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedbycamlr") != 0)
1130
TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedbycamlr");
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);
1137
TimeSheet->SpeedByCamUD = 0.0f;
1138
if (xmlDoc->GetEntryAttribute(TLAlienMotherShip, "speedbycamud") != 0)
1139
TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLAlienMotherShip, "speedbycamud");
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);
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");
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);
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;
1174
TimeSheet->Targeting = false;
1179
// берем следующий элемент
1180
TLAlienMotherShip = TLAlienMotherShip->Next;
1185
if (!strcmp(TL->Name, "PirateShip"))
1187
CPirateShip *Fighter = 0;
1188
Fighter = new CPirateShip;
1189
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) Fighter->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1196
SetID(Fighter, TL, xmlDoc);
1197
if (ShowDebugModeLine) SetDebugInformation(Fighter, TL);
1199
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
1201
Fighter->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
1202
Fighter->Speed = Fighter->NeedSpeed;
1204
if (xmlDoc->GetEntryAttribute(TL, "speedlr") != 0)
1206
Fighter->NeedSpeedLR = xmlDoc->fGetEntryAttribute(TL, "speedlr");
1207
Fighter->SpeedLR = Fighter->NeedSpeedLR;
1209
if (xmlDoc->GetEntryAttribute(TL, "speedud") != 0)
1211
Fighter->NeedSpeedUD = xmlDoc->fGetEntryAttribute(TL, "speedud");
1212
Fighter->SpeedUD = Fighter->NeedSpeedUD;
1215
if (xmlDoc->GetEntryAttribute(TL, "speedbycamfb") != 0)
1217
Fighter->NeedSpeedByCamFB = xmlDoc->fGetEntryAttribute(TL, "speedbycamfb");
1218
Fighter->SpeedByCamFB = Fighter->NeedSpeedByCamFB;
1220
if (xmlDoc->GetEntryAttribute(TL, "speedbycamlr") != 0)
1222
Fighter->NeedSpeedByCamLR = xmlDoc->fGetEntryAttribute(TL, "speedbycamlr");
1223
Fighter->SpeedByCamLR = Fighter->NeedSpeedByCamLR;
1225
if (xmlDoc->GetEntryAttribute(TL, "speedbycamud") != 0)
1227
Fighter->NeedSpeedByCamUD = xmlDoc->fGetEntryAttribute(TL, "speedbycamud");
1228
Fighter->SpeedByCamUD = Fighter->NeedSpeedByCamUD;
1231
SetShowDeleteOnHide(Fighter, TL, xmlDoc);
1232
SetAIMode(Fighter, TL, xmlDoc); // на тот случае если просто ставим и все...
1233
SetShipRotation(Fighter, TL, xmlDoc);
1234
SetShipLocation(Fighter, TL, xmlDoc, TimeOpLag);
1236
// дальше смотрим, что нужно сделать...
1237
cXMLEntry *TLPirateShip = TL->FirstChild;
1238
while (TLPirateShip)
1240
if (!strcmp(TLPirateShip->Name, "TimeSheet"))
1242
// собираем новый элемент
1243
CTimeSheet *TimeSheet;
1244
TimeSheet = new CTimeSheet;
1245
Fighter->AttachTimeSheet(TimeSheet);
1247
if (xmlDoc->GetEntryAttribute(TLPirateShip, "aimode") != 0)
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;
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;
1275
TimeSheet->AI_Mode = 0;
1277
TimeSheet->Time = 0.0f;
1278
if (xmlDoc->GetEntryAttribute(TLPirateShip, "time") != 0)
1279
TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLPirateShip, "time");
1280
TimeSheet->InUse = false;
1282
TimeSheet->Speed = 0.0f;
1283
if (xmlDoc->GetEntryAttribute(TLPirateShip, "speed") != 0)
1284
TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLPirateShip, "speed");
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);
1291
TimeSheet->SpeedLR = 0.0f;
1292
if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedlr") != 0)
1293
TimeSheet->SpeedLR = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedlr");
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);
1300
TimeSheet->SpeedUD = 0.0f;
1301
if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedud") != 0)
1302
TimeSheet->SpeedUD = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedud");
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);
1309
TimeSheet->SpeedByCamFB = 0.0f;
1310
if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedbycamfb") != 0)
1311
TimeSheet->SpeedByCamFB = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedbycamfb");
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);
1318
TimeSheet->SpeedByCamLR = 0.0f;
1319
if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedbycamlr") != 0)
1320
TimeSheet->SpeedByCamLR = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedbycamlr");
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);
1327
TimeSheet->SpeedByCamUD = 0.0f;
1328
if (xmlDoc->GetEntryAttribute(TLPirateShip, "speedbycamud") != 0)
1329
TimeSheet->SpeedByCamUD = xmlDoc->fGetEntryAttribute(TLPirateShip, "speedbycamud");
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);
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");
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);
1355
TimeSheet->Fire = false;
1356
if (xmlDoc->GetEntryAttribute(TLPirateShip, "fire") != 0)
1357
if (xmlDoc->iGetEntryAttribute(TLPirateShip, "fire") > 0)
1358
TimeSheet->Fire = true;
1360
TimeSheet->BossFire = false;
1361
if (xmlDoc->GetEntryAttribute(TLPirateShip, "bossfire") != 0)
1362
if (xmlDoc->iGetEntryAttribute(TLPirateShip, "bossfire") > 0)
1363
TimeSheet->BossFire = true;
1365
TimeSheet->Targeting = false;
1370
// берем следующий элемент
1371
TLPirateShip = TLPirateShip->Next;
1376
if (!strcmp(TL->Name, "CreateAsteroid"))
1378
CAsteroid *Asteroid = 0;
1379
Asteroid = new CAsteroid;
1381
// тип сейчас не задействован, всегда ставим 1
1382
Asteroid->Create(1);
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);
1389
SetRotation(Asteroid, TL, xmlDoc);
1390
SetLocation(Asteroid, TL, xmlDoc, TimeOpLag);
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");
1401
if (!strcmp(TL->Name, "CreateBasePart"))
1403
CBasePart *BasePart = 0;
1404
BasePart = new CBasePart;
1407
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) BasePart->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1414
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0) BasePart->Speed = xmlDoc->fGetEntryAttribute(TL, "speed");
1416
SetID(BasePart, TL, xmlDoc);
1417
if (ShowDebugModeLine) SetDebugInformation(BasePart, TL);
1418
SetShowDeleteOnHide(BasePart, TL, xmlDoc);
1420
SetRotation(BasePart, TL, xmlDoc);
1421
SetLocation(BasePart, TL, xmlDoc, TimeOpLag);
1424
// CreateBigAsteroid
1425
if (!strcmp(TL->Name, "CreateBigAsteroid"))
1427
CBigAsteroid *BigAsteroid = 0;
1428
BigAsteroid = new CBigAsteroid;
1431
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) BigAsteroid->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1438
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0) BigAsteroid->Speed = xmlDoc->fGetEntryAttribute(TL, "speed");
1440
SetID(BigAsteroid, TL, xmlDoc);
1441
if (ShowDebugModeLine) SetDebugInformation(BigAsteroid, TL);
1442
SetShowDeleteOnHide(BigAsteroid, TL, xmlDoc);
1444
SetRotation(BigAsteroid, TL, xmlDoc);
1445
SetLocation(BigAsteroid, TL, xmlDoc, TimeOpLag);
1449
if (!strcmp(TL->Name, "CreateMBuilding"))
1451
CMilitaryBuilding *GroundObject = 0;
1452
GroundObject = new CMilitaryBuilding;
1455
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1462
SetID(GroundObject, TL, xmlDoc);
1463
if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
1464
SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
1465
SetAIMode(GroundObject, TL, xmlDoc); // на тот случае если просто ставим и все...
1467
SetRotation(GroundObject, TL, xmlDoc);
1468
SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
1470
// дальше смотрим, что нужно сделать...
1471
cXMLEntry *TLGroundObject = TL->FirstChild;
1472
while (TLGroundObject)
1474
if (!strcmp(TLGroundObject->Name, "TimeSheet"))
1476
// собираем новый элемент
1477
CTimeSheet *TimeSheet;
1478
TimeSheet = new CTimeSheet;
1479
GroundObject->AttachTimeSheet(TimeSheet);
1481
if (xmlDoc->GetEntryAttribute(TLGroundObject, "aimode") != 0)
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;
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;
1509
TimeSheet->AI_Mode = 0;
1511
TimeSheet->Time = 0.0f;
1512
if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
1513
TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
1514
TimeSheet->InUse = false;
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
1531
TimeSheet->Fire = false;
1532
if (xmlDoc->GetEntryAttribute(TLGroundObject, "fire") != 0)
1533
if (xmlDoc->iGetEntryAttribute(TLGroundObject, "fire") > 0)
1534
TimeSheet->Fire = true;
1536
TimeSheet->BossFire = false;
1538
TimeSheet->Targeting = false;
1539
if (xmlDoc->GetEntryAttribute(TLGroundObject, "targeting") != 0)
1540
if (xmlDoc->iGetEntryAttribute(TLGroundObject, "targeting") != 0) TimeSheet->Targeting = true;
1545
// берем следующий элемент
1546
TLGroundObject = TLGroundObject->Next;
1551
if (!strcmp(TL->Name, "CreateBuilding"))
1553
CBuilding *GroundObject = 0;
1554
GroundObject = new CBuilding;
1555
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1562
SetID(GroundObject, TL, xmlDoc);
1563
if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
1564
SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
1566
SetRotation(GroundObject, TL, xmlDoc);
1567
SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
1571
if (!strcmp(TL->Name, "CreateMine"))
1573
CProjectile *Mine = 0;
1574
Mine = new CProjectile;
1575
// т.к. мины у нас с 214-217, делаем +213
1576
if (xmlDoc->GetEntryAttribute(TL, "type") != 0)
1578
int MineType = xmlDoc->iGetEntryAttribute(TL, "type")+213;
1579
if (MineType < 214) MineType = 214;
1580
if (MineType > 217) MineType = 217;
1581
Mine->Create(MineType);
1589
Mine->ProjectileType = 1;
1591
// по умолчанию враг
1592
Mine->ObjectStatus = 1;
1593
if (xmlDoc->GetEntryAttribute(TL, "status") != 0) Mine->ObjectStatus = xmlDoc->iGetEntryAttribute(TL, "status");
1595
// общий - пенальти, если не игрок
1596
float CurrentPenalty = GameNPCWeaponPenalty*1.0f;
1597
// если игрок или свои - ничего не надо...
1598
if (Mine->ObjectStatus >= 2) CurrentPenalty = 1.0f;
1600
Mine->DamageHull = Mine->DamageHull/CurrentPenalty;
1601
Mine->DamageSystems = Mine->DamageSystems/CurrentPenalty;
1602
Mine->SpeedStart = Mine->SpeedEnd = Mine->Speed = Mine->SpeedStart/CurrentPenalty;
1604
SetID(Mine, TL, xmlDoc);
1605
if (ShowDebugModeLine) SetDebugInformation(Mine, TL);
1606
SetShowDeleteOnHide(Mine, TL, xmlDoc);
1609
SetProjectileRotation(Mine, TL, xmlDoc);
1610
SetProjectileLocation(Mine, TL, xmlDoc, TimeOpLag);
1614
if (!strcmp(TL->Name, "CreateTracked"))
1616
CTracked *GroundObject = 0;
1617
GroundObject = new CTracked;
1618
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1625
SetID(GroundObject, TL, xmlDoc);
1626
if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
1627
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
1629
GroundObject->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
1630
GroundObject->Speed = GroundObject->NeedSpeed;
1633
SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
1634
SetAIMode(GroundObject, TL, xmlDoc); // на тот случае если просто ставим и все...
1635
SetRotation(GroundObject, TL, xmlDoc);
1636
SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
1638
// дальше смотрим, что нужно сделать...
1639
cXMLEntry *TLGroundObject = TL->FirstChild;
1640
while (TLGroundObject)
1642
if (!strcmp(TLGroundObject->Name, "TimeSheet"))
1644
// собираем новый элемент
1645
CTimeSheet *TimeSheet;
1646
TimeSheet = new CTimeSheet;
1647
GroundObject->AttachTimeSheet(TimeSheet);
1649
if (xmlDoc->GetEntryAttribute(TLGroundObject, "aimode") != 0)
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;
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;
1677
TimeSheet->AI_Mode = 0;
1679
TimeSheet->Time = 0.0f;
1680
if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
1681
TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
1682
TimeSheet->InUse = false;
1684
TimeSheet->Speed = 0.0f;
1685
if (xmlDoc->GetEntryAttribute(TLGroundObject, "speed") != 0)
1686
TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLGroundObject, "speed");
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);
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
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");
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);
1723
TimeSheet->Fire = false;
1724
if (xmlDoc->GetEntryAttribute(TLGroundObject, "fire") != 0)
1725
if (xmlDoc->iGetEntryAttribute(TLGroundObject, "fire") > 0)
1726
TimeSheet->Fire = true;
1728
TimeSheet->BossFire = false;
1730
TimeSheet->Targeting = false;
1731
if (xmlDoc->GetEntryAttribute(TLGroundObject, "targeting") != 0)
1732
if (xmlDoc->iGetEntryAttribute(TLGroundObject, "targeting") > 0)
1733
TimeSheet->Targeting = true;
1738
// берем следующий элемент
1739
TLGroundObject = TLGroundObject->Next;
1744
if (!strcmp(TL->Name, "CreateWheeled"))
1746
CWheeled *GroundObject = 0;
1747
GroundObject = new CWheeled;
1748
if (xmlDoc->GetEntryAttribute(TL, "type") != 0) GroundObject->Create(xmlDoc->iGetEntryAttribute(TL, "type"));
1755
SetID(GroundObject, TL, xmlDoc);
1756
if (ShowDebugModeLine) SetDebugInformation(GroundObject, TL);
1757
if (xmlDoc->GetEntryAttribute(TL, "speed") != 0)
1759
GroundObject->NeedSpeed = xmlDoc->fGetEntryAttribute(TL, "speed");
1760
GroundObject->Speed = GroundObject->NeedSpeed;
1763
SetShowDeleteOnHide(GroundObject, TL, xmlDoc);
1764
SetAIMode(GroundObject, TL, xmlDoc); // на тот случае если просто ставим и все...
1765
SetRotation(GroundObject, TL, xmlDoc);
1766
SetLocation(GroundObject, TL, xmlDoc, TimeOpLag);
1768
// дальше смотрим, что нужно сделать...
1769
cXMLEntry *TLGroundObject = TL->FirstChild;
1770
while (TLGroundObject)
1772
if (!strcmp(TLGroundObject->Name, "TimeSheet"))
1774
// собираем новый элемент
1775
CTimeSheet *TimeSheet;
1776
TimeSheet = new CTimeSheet;
1777
GroundObject->AttachTimeSheet(TimeSheet);
1779
if (xmlDoc->GetEntryAttribute(TLGroundObject, "aimode") != 0)
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;
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;
1807
TimeSheet->AI_Mode = 0;
1809
TimeSheet->Time = 0.0f;
1810
if (xmlDoc->GetEntryAttribute(TLGroundObject, "time") != 0)
1811
TimeSheet->Time = xmlDoc->fGetEntryAttribute(TLGroundObject, "time");
1812
TimeSheet->InUse = false;
1814
TimeSheet->Speed = 0.0f;
1815
if (xmlDoc->GetEntryAttribute(TLGroundObject, "speed") != 0)
1816
TimeSheet->Speed = xmlDoc->fGetEntryAttribute(TLGroundObject, "speed");
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);
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
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");
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);
1854
TimeSheet->Fire = false;
1855
if (xmlDoc->GetEntryAttribute(TLGroundObject, "fire") != 0)
1856
if (xmlDoc->iGetEntryAttribute(TLGroundObject, "fire") > 0)
1857
TimeSheet->Fire = true;
1859
TimeSheet->BossFire = false;
1861
TimeSheet->Targeting = false;
1862
if (xmlDoc->GetEntryAttribute(TLGroundObject, "targeting") != 0)
1863
if (xmlDoc->iGetEntryAttribute(TLGroundObject, "targeting") != 0) TimeSheet->Targeting = true;
1868
// берем следующий элемент
1869
TLGroundObject = TLGroundObject->Next;
1874
// если тут - значит не нашли директиву, или произошла ошибка
1875
fprintf(stderr, "ScriptEngine: tag %s not found, line %i.", TL->Name, TL->LineNumber);
1879
// берем следующий элемент по порядку