home *** CD-ROM | disk | FTP | other *** search
/ WarCraft 2000 - Nuclear Epidemic / W2000.nrg / SOURCE.War2000 / MapDiscr.h < prev    next >
C/C++ Source or Header  |  1998-09-22  |  32KB  |  1,210 lines

  1. /*                    Map discription
  2.  *    
  3.  * This file describes map cells, animations, monsters, buildings,
  4.  * flying monsters, on-water monsters...
  5.  */
  6. #pragma pack(1)
  7. typedef unsigned short word;
  8. #include "AntiBug.h"
  9. #include "Icons.h"
  10. #define NBRANCH 4
  11. class Weapon;
  12. class SelGroup;
  13. //╬∩Φ±αφΦσ εΣφεΘ Ωδσ≥ΩΦ φα Ωα≡≥σ(ßστ Ωα≡≥ΦφΩΦ)
  14. struct MapCell{
  15.     //word Flags;        //╬∩Φ±√Γα■≥ ±ε±≥ε φΦσ Ωδσ≥ΩΦ
  16. //    bool LandLock:1;    //╩δσ≥Ωα φσΣε±≥≤∩φα Σδ  φατσ∞φ√⌡
  17.     bool WaterLock:1;    //╩δσ≥Ωα φσΣε±≥≤∩φα Σδ  ΓεΣφ√⌡
  18.     bool AirLock:1;        //╩δσ≥Ωα φσΣε±≥≤∩φα Σδ  δσ≥α■∙Φ⌡
  19.     bool TempLock:1;    //╧≡ΦτφαΩ Γ≡σ∞σφφεΘ φσΣε±≥≤∩φε±≥Φ
  20.     byte LayerID;        //═ΦµφΦΘ ±δεΘ φα Ωα≡≥σ-εß·σΩ≥ ≥Φ∩α ╠┼╤╥╬╨╬╞─┼═╚┼
  21.     word MonsterID;        //═ε∞σ≡ ∞εφ±≥≡α Γ ≥αßδΦ÷σ εß·σΩ≥εΓ  
  22.     word BuildingID;    //═ε∞σ≡ τΣαφΦ  Γ ≥αßδΦ÷σ εß·σΩ≥εΓ
  23.     word FlyID;            //╦σ≥α■∙ΦΘ εß·σΩ≥
  24. //    word TileID;        //═ε∞σ≡ Ωα≡≥ΦφΩΦ, ε∩Φ±√Γα■∙σΘ ∩εΓσ≡⌡φε±≥ⁿ
  25. };//8 bytes
  26.  
  27. //▌δσ∞σφ≥ Γ ≥αßδΦ÷σ εß·σΩ≥εΓ
  28. struct ObjectRef{
  29.     unsigned ObjID:8;    //╥Φ∩ εß·σΩ≥α
  30.     unsigned Location:2;//═ατσ∞φ√Θ/┬εΣφ√Θ/╦σ≥α■∙ΦΘ/┬±σ⌡ ≥Φ∩εΓ
  31.     void* lpObj;        //╤±√δΩα φα εß·σΩ≥
  32. };
  33. //╠αΩ±Φ∞αδⁿφεσ ΩεδΦ≈σ±≥Γε εß·σΩ≥εΓ
  34. #define MaxObject 8192
  35. //╠α±±ΦΓ εß·σΩ≥εΓ
  36. typedef ObjectRef ObjArray[MaxObject];
  37. //╬∩Φ±αφΦσ αφΦ∞α÷ΦΦ
  38. struct OneSlide{
  39.     word  FileID;   //═ε∞σ≡ ⌠αΘδα αφΦ∞α÷ΦΦ
  40.     small dx;        //╤∞σ∙σφΦσ ±∩≡αΘ≥α ∩ε πε≡Φτεφ≥αδΦ
  41.     small dy;        //-----/----- ∩ε Γσ≡≥ΦΩαδΦ
  42.     word  spr;        //═ε∞σ≡ ±∩≡αΘ≥α Γ Σαφφε∞ ⌠αΘδσ
  43.     word SoundID;   //═ε∞σ≡ τΓ≤Ωα
  44. };
  45. typedef OneSlide MovieType[256];
  46. typedef MovieType* lpOneMovie ;
  47. struct  Octant{
  48.     byte count;
  49.     byte ticks;
  50.     small gdx;
  51.     small gdy;
  52.     OneSlide* Movie;
  53. };
  54. typedef Octant Animation[8];
  55. //╚φ⌠ε≡∞α÷Φ  ε αφΦ∞α÷ΦΦ Φ σσ ∩≡Φ∞σφσφΦΦ
  56. struct MoreAnimation{
  57.     Octant* Anm;
  58.     word WhatFor;        //╩αΩ ß≤Σσ≥ Φ±∩εδⁿτεΓα≥ⁿ±  Σαφφα  αφΦ∞α÷Φ 
  59.     word Kind;          // 
  60.     //word Reserved;
  61. };
  62. typedef MoreAnimation AnimArray[32]; 
  63. typedef word WordArray[32768];
  64. typedef WordArray* lpWordArray;
  65. struct ObjIcon{
  66.     //word FileID;
  67.     word spr;
  68. };
  69. #include "Upgrade.h"
  70. //╬∩Φ±αφΦσ ≥Φ∩εΓ εß·σΩ≥εΓ(ΦΣσφ≥Φ⌠ΦΩα≥ε≡√)
  71. #define EmptyID 0
  72. //#define MonsterID 1
  73. class Crowd{
  74. public:
  75.     char* Message;
  76.     word Amount;
  77.     byte NI;
  78.     bool Active:1;
  79.     word MLSize;
  80.     word* MemList;
  81.     int LastDx;
  82.     int    LastDy;
  83.     int LastAbs;
  84.     int BestX;
  85.     int BestY;
  86.     int    BestLx;
  87.     int    BestLy;
  88.     int BestX1;
  89.     int BestY1;
  90.     int RealX;
  91.     int RealY;
  92.     int RealLx;
  93.     int RealLy;
  94.     int RealX1;
  95.     int RealY1;
  96.     int PrevDX;
  97.     int PrevDY;
  98.     int DestX;
  99.     int DestY;
  100.     int NInside;
  101.     int NMembers;
  102.     int Usage;//=0-≡στσ≡Γ
  103.               //=1-ε≥≡ Σ ε⌡≡αφ√
  104.               //=2-ε≥≡ Σ τα⌡Γα≥≈ΦΩεΓ
  105.  
  106.     int Stage;//=0-
  107.     word ForAtt[32];
  108.     int FUNC;
  109.     Crowd();
  110.     void CreateCrowd(byte NI);
  111.     void Disband();
  112.     bool DisbandHalf();
  113.     void FindNewPosition();
  114.     void HandleCrowd();
  115.     int  Funct(int x,int y,int Lx,int Ly);
  116.     void SendCrowd();
  117.     void GetSize();
  118.     void AddToAttackQueue(word ID);
  119.     bool HandleAttacks(byte PRIO);
  120.     void HandleDefence();
  121. };
  122. //╬∩Φ±αφΦσ ßατεΓεπε ≥Φ∩α, εß∙σπε Σδ  Γ±σ⌡ εß·σΩ≥εΓ
  123. class GeneralObject{
  124. public:
  125.     char* Message;
  126.     bool cpbBase:1;
  127.     bool cpbFarm:1;
  128.     bool OnCost:1;
  129.     bool OnOil:1;
  130.     bool NoSearchVictim:1;
  131.     bool NoAnswer:1;
  132.     bool NeedNoHelp:1;
  133.     bool Enabled:1;
  134.     bool OnWater:1;
  135.     bool Warrior:1;
  136.     bool OnAir:1;
  137.     bool Teleport:1;
  138.     bool Transport:1;
  139.     bool SATT:1;
  140.     bool UATT:1;
  141.     bool WATT:1;
  142.     bool AATT:1;
  143.     bool P100:1;
  144.     bool T3X3:1;
  145.     bool FWEAP:1;//επφσφφεσ ε≡≤µΦσ
  146.     bool AGold:1;
  147.     bool AWood:1;
  148.     bool Submarine:1;
  149.     bool RefreshLife:1;
  150.     bool CanFly:1;
  151.     bool CanAttWall:1;
  152.     bool CanFear:1;
  153.     bool UseMagic:1;
  154.     bool canNucAttack:1;
  155.     bool AntiNuc:1;
  156.     bool UFO:1;
  157.     bool UFOTrans:1;
  158.     bool CanRepair:1;
  159.     bool ExtMenu:1;
  160.     bool CanDest:1;
  161.     word MagAgainst;
  162.     word MagWith;
  163.     word IDforUFO;
  164.     word capMagic;
  165.     byte Kind;
  166.     word MaxAutoAmount;
  167.     word Useful[NBRANCH];//∩εδστφε±≥ⁿ εß·σΩ≥α Σδ  ΩαµΣεΘ Φτ ε≥≡α±δσΘ
  168.     word SpUsef[NBRANCH];//≤Σσδⁿφα  ∩εδστφε±≥ⁿ
  169.     word AbsNeedPrio;
  170.     word AbsNeedCount;
  171.     word LifeShotLost;
  172.     int     cost;
  173.     word delay;
  174.     short wepX;
  175.     short wepY;
  176.     byte WepSpeed;
  177.     byte WepDelay;
  178.     byte  VisRadius;
  179.     byte  VisSpots;
  180.     byte  SpotType;
  181.     byte  SpotSize;
  182.     byte  DangerZone;
  183.     word NUpgrades;
  184.     word* Upg;
  185.     char Wdx[8];
  186.     char Wdy[8];
  187.     byte NIcons;
  188.     word* IRefs;
  189.     word NWeap;
  190.     byte NStages;
  191.     Weapon* MWeap[12];
  192.     byte SWPIndex[12];
  193.     short HitSound;
  194.     short ClickSound;
  195.     short OrderSound;
  196.     short DeathSound;
  197.     short BornSound;
  198.     short AttackSound;
  199.     short TreeSound;
  200.     short GoldSound;
  201.     word LockID;
  202.     byte NLockUnits;
  203.     /////DON'T CHANGE STRUCTURE AND ORDER UNDER THIS LINE/////
  204.     /////          L O A D I N G  Z O N E                /////
  205.     word NameIndex;
  206.     word PreCreateMessage;
  207.     word PostCreateMessage;
  208.     //ObjIcon Icon;
  209.     //╚φΣσΩ± ∩σ≡σφατφα≈σφΦ 
  210.     //╩δ■≈ Σε∩≤±Ωα Ω ∩≡εΦτΓεΣ±≥Γ≤
  211.     int ProduceAccess;
  212.     //╩δ■≈ Σε±≥≤∩α Σδ  ±ετΣαφΦ  
  213.     int CreationAccess; 
  214.     //┼±δΦ Object1.ProdiuceAcess & Object2.CreationAccess!=0 ≥ε
  215.     // Oject1 ∞εµσ≥ ∩≡εΦτΓσ±≥Φ Object2
  216.     //╩δα±± εß·σΩ≥α
  217.     word ObjType;
  218.     //  =0 - ╠εφ±≥≡
  219.     //  =1 - ╟ΣαφΦσ
  220.     //  =2 - ╙∞σφΦσ
  221.     //  =3 - ╙±εΓσ≡°σφ±≥ΓεΓαφΦσ
  222.  
  223.     //╧≡Φ ±ετΣαφΦΦ Σαφφ√Θ εß·σΩ≥ ∞εµσ≥ Σσδα≥ⁿ Σε±≥≤∩φ√∞Φ Σ≡≤πΦσ
  224.     //εß·σΩ≥√,Ωε≥ε≡√σ ≡αφσσ ß√δΦ φσΣε±≥≤∩φ√, ∞εµφε ε≥Ω≡√Γα≥ⁿ Σε±≥≤∩ φσ ßεδσσ,
  225.     //≈σ∞ Ω ≈σ≥√≡σ∞ εß·σΩ≥α∞. OpenAccess ±εΣσ≡µΦ≥ ΦφΣσΩ±√ ε≥Ω≡√Γασ∞√⌡
  226.     //εß·σΩ≥εΓ. ▌≥ε Φ σ±≥ⁿ τφαφΦ .
  227.     word OpenAccess[2];
  228.     //╚τεß≡σ≥σφΦ . ┬ ±Φ±≥σ∞σ σ±≥ⁿ ∞α±±ΦΓ ±∩Φ±ΩεΓ Φτεß≡σ≥σφΦΘ.
  229.     //ΩαµΣ√Θ ²δσ∞σφ≥ Γ ±∩Φ±Ωσ ±εΣσ≡µΦ≥ φε∞σ≡ ε≥Ω≡√Γασ∞επε εß·σΩ≥α,
  230.     //∞ΦφΦ∞αδⁿφ√Θ ≤≡εΓσφⁿ ÷ΦΓΦδΦτεΓαφφε±≥Φ, φσεß⌡εΣΦ∞√Θ Σδ 
  231.     //Φτεß≡σ≥σφΦ  Σαφφεπε εß·σΩ≥α. ┬σ≡ε ≥φε±≥ⁿ ≥επε, ≈≥ε ⌡ε≥ⁿ 
  232.     //≈≥ε-≥ε ß≤Σσ≥ Φτεß≡σ≥σφε ∩≡Φ ±ετΣαφΦΦ, ε∩≡σΣσδ σ≥± 
  233.     //∞≤Σ≡ε±≥ⁿ■.
  234.     byte SizeX;
  235.     byte SizeY;
  236.     word Visdom;
  237.     //╟Γ≤ΩΦ Σδ  ≡ατδΦ≈φ√⌡ ±εß√≥ΦΘ
  238.     Weapon* Weap;
  239.     //word sndChoose;            //╟Γ≤Ω ∩≡Φ Γ√ßε≡σ εß·σΩ≥α
  240.     //word sndUnderAttack;    //╟Γ≤Ω,ΩεπΣα εß·σΩ≥α εßΦµα■≥
  241.     //╤∩ε±εßφε±≥Φ εß·σΩ≥α
  242.     bool cpbRotation:1;        //╧εΓε≡ε≥√
  243.     bool cpbMoving:1;        //─ΓΦµσφΦσ
  244.     bool cpbSpending:1;     //┬≡σ∞  Σδ  Σε±≤πα Φ ∩≡ΦΩεδα
  245.     bool cpbNearAttack:1;    //┴δΦµφΦΘ ßεΘ
  246.     bool cpbFarAttack:1;    //╧ε≡αµσφΦσ φα ≡α±±≥ε φΦΦ
  247.     bool cpbCarry:1;        //╤∩ε±εßφε±≥ⁿ φσ±≥Φ ∩≡σΣ∞σ≥
  248.     bool cpbPatrol:1;       //╤∩ε±εßφε±≥ⁿ ∩α≥≡≤δΦ≡εΓα≥ⁿ
  249.     bool cpbBuild:1;        //╤≥≡εΦ≥σδⁿ±≥Γε
  250.     bool cpbCreation:1;     //╤ετΣαφΦσ ∞εφ±≥≡α
  251.     bool cpbResearch:1;     //╤∩ε±εßφε±≥ⁿ Φ±±δσΣεΓα≥ⁿ φσΦτΓσ±≥φεσ τφαφΦσ
  252.     bool cpbResource:1;     //╚±∩εδⁿτεΓαφΦσ Γ Ωα≈σ±≥Γσ ≡σ±≤≡±α
  253.     bool cpbDamage:1;       //═αδΦ≈Φσ αφΦ∞α÷ΦΦ Σδ  ∩εΓ≡σµΣσφφεπε ±ε±≥ε φΦ   
  254.     bool cpbDeath:1;        //═αδΦ≈Φσ αφΦ∞α÷ΦΦ Σδ  πΦßσδΦ
  255.     bool cbpAccess:1;       //─ε±≥≤∩φε Γ Σαφφ√Θ ∞ε∞σφ≥
  256.     //bool cpbOneAccess:1;    //╧ε±δσ ±ετΣαφΦ  cpbAccess=false
  257.     bool cpbBuilding:1;        //▀Γδ σ≥±  τΣαφΦσ∞
  258.     word  Resrvd;
  259.     //╨σ±≤≡±√, φσεß⌡εΣΦ∞√σ Σδ  ∩ε±≥≡εΘΩΦ(∩≡εΦτΓεΣ±≥Γα)
  260.     byte ResourceID[4];     //╚φΣσΩ± φσεß⌡εΣΦ∞επε ≡σ±≤≡±α
  261.     word ResAmount[4];      //╤ΩεδⁿΩε φσεß⌡εΣΦ∞ε Σδ  ∩ε±≥≡εΘΩΦ 
  262.     word NAnm;            //╩εδΦ≈σ±≥Γε Σε±≥≤∩φ√⌡ αφΦ∞α÷ΦΘ
  263.     MoreAnimation *lpFAnim;//└φΦ∞α÷Φ  ± ε∩Φ±αφΦσ∞ ∩≡Φ∞σφσφΦ  
  264.     void GetMonsterCostString(char* st);
  265.     void CloseGO();
  266. };
  267. //╩δα±± ΓΦΣΦ∞√⌡ εß·σΩ≥εΓ-∞εφ±≥≡√,τΣαφΦ 
  268. class Visuals : public GeneralObject
  269. {
  270. public:
  271. //┴ατεΓ√σ ∩εΩατα≥σδΦ
  272.     union{
  273.         struct{
  274.             word MaxLife;
  275.             word MaxShield;
  276.             word Strength;
  277.             word PsychoForce;
  278.             word Dextrity;
  279.             word MinDamage;
  280.             word MaxDamage;
  281.             word Productivity;
  282.             word AttackRange;
  283.             word Reserved1;
  284.             word Reserved2;
  285.             word Reserved3;
  286.             word Reserved4;
  287.             word Reserved5;
  288.             word Reserved6;
  289.             word Reserved7;
  290.         } Basic;
  291.         word Index[16];
  292.     } info;
  293.     //╚φ⌠ε≡∞α÷Φ  εß ε≡≤µΦΦ Σαδⁿφσπε ∩ε≡αµσφΦ 
  294. };
  295. //Upgrade-τα∞σφα εΣφεπε ≥Φ∩α εß·σΩ≥εΓ φα Σ≡≤πεΘ
  296. class ObjectUpgrade : public GeneralObject
  297. {
  298. public:
  299.     word SourceTypeIndex[8];
  300.     word FinalTypeIndex[8];
  301. };
  302. //Upgrade - Σδ  Visuals-≤δ≤≈°σφΦσ ∩α≡α∞σ≥≡εΓ Σδ  π≡≤∩∩√ εß·σΩ≥εΓ;
  303. class ParameterUpgrade : public GeneralObject
  304. {
  305.     word ObjectIndex[8];
  306.     byte ChangedParameter[8];
  307.     byte AdditionalValue[8];
  308. };
  309.  
  310. class OneObject;
  311. typedef void ReportFn(OneObject* Sender);
  312. //╬∩Φ±αφΦσ Ωε∞αφΣφεπε ßδεΩα
  313. //╧≡ΦΩατ√ 1-πε ≤≡εΓφ 
  314. struct Order1{
  315.     //╙Ωατα≥σδⁿ φα ε≥δεµσφφ√Θ ∩≡ΦΩατ, σ±δΦ NULL ≥ε φσ≥ 
  316.     //ε≥δεµσφφεπε ∩≡ΦΩατα 
  317.     Order1* NextOrder;
  318.     //╙≡εΓσφⁿ ∩≡Φε≡Φ≥σ≥α Γ√∩εδφσφΦ  Ωε∞αφΣ√
  319.     //0-φΦµαΘ°ΦΘ ≤≡εΓσφⁿ ∩≡Φε≡Φ≥σ≥α
  320.     //─αφφεσ ταΣαφΦσ ∞εµσ≥ ß√≥ⁿ ε≥δεµσφε ≥εδⁿΩε Γ ≥ε∞ ±δ≤≈ασ,
  321.     //σ±δΦ ∩≡Φε≡Φ≥σ≥ ∩≡σ≡√ΓαφΦ  Γ√°σ ∩≡Φε≡Φ≥σ≥α Γ√∩εδφσφΦ 
  322.     byte PrioryLevel;
  323.     byte OrderType;
  324.     byte OrderTime;//=0 if very fast
  325.     //=1 - ±≥ε ≥ⁿ φα ∞σ±≥σ 
  326.     //=2 - ∩σ≡σΘ≥Φ Γ ≥ε≈Ω≤ ± Ωεε≡ΣΦφα≥α∞Φ (x,y)
  327.     //=3 - ±δσΣεΓα≥ⁿ τα εß·σΩ≥ε∞ (obj)
  328.     //=4 - ∩≡σ±δσΣεΓα≥ⁿ Φ α≥αΩεΓα≥ⁿ εß·σΩ≥ (obj)
  329.     //=5 - ∩ε±≥≡εΦ≥ⁿ εß·σΩ≥
  330.     //=6 - ±ετΣα≥ⁿ εß·σΩ≥
  331.     //=7 - ∩α≥≡≤δΦ≡εΓα≥ⁿ
  332.     //╚φ⌠ε≡∞α÷Φ  ∩ε ΩαµΣε∞≤ ≥Φ∩≤ ∩≡ΦΩατεΓ
  333.     ReportFn* DoLink;
  334.     union{
  335.         struct{
  336.             byte VisibilityRadius;
  337.         } Stand;
  338.         struct{
  339.             byte x;
  340.             byte y;
  341.             word PrevDist;
  342.             byte Times;
  343.         } MoveToXY;
  344.         struct{
  345.             byte xd;
  346.             byte yd;
  347.             byte time;
  348.             word BuildID;
  349.             word BSN;
  350.         } UFO;
  351.         struct{
  352.             byte x;
  353.             byte y;
  354.             byte wep;
  355.         } AttackXY;
  356.         struct{
  357.             word ObjIndex;
  358.             word SN;
  359.             word PrevDist;
  360.             byte wep;
  361.         } MoveToObj;
  362.         struct{
  363.             byte x;
  364.             byte y;
  365.             byte x1;
  366.             byte y1;
  367.             byte dir;
  368.         } Patrol;
  369.         struct{
  370.             word ObjIndex;
  371.             word Progress;
  372.             word NStages;
  373.             byte PStep;
  374.         }Produce;
  375.         struct{
  376.             word OldUpgrade;
  377.             word NewUpgrade;
  378.             word Stage;
  379.             word NStages;
  380.         }PUpgrade;
  381.         struct{
  382.             byte dir;
  383.         }MoveFrom;
  384.         struct{
  385.             byte x;
  386.             byte y;
  387.             byte ResID;
  388.         }TakeRes;
  389.  
  390.     }info;
  391. };
  392. class Legion;
  393. class Nation;
  394. //╚φ⌠ε≡∞α÷Φ  Σδ  ΩαµΣεπε ΦφΣΦΓΦΣ≤≤∞α
  395. class OneObject{
  396. public:
  397.     Nation* Nat;
  398.     Crowd* CrowdRef;
  399.     union{
  400.         GeneralObject* General;
  401.         Visuals* Visual;
  402.         ObjectUpgrade* OUpgrade;
  403.         ParameterUpgrade* PUpgrade;
  404.     } Ref;
  405.     //-----------new path algoritm variables----------------
  406.     bool NeedPath;
  407.     byte CPdestX;
  408.     byte CPdestY;
  409.     byte* PathX;
  410.     byte* PathY;
  411.     word NIPoints;
  412.     word CurIPoint;
  413. //--------------------------------------------//
  414. //-----------begin of saving cluster----------//
  415. //--------------------------------------------//
  416.     word Index;//φε∞σ≡ ²≥επε ∞εφ±≥≡α
  417.     word NIndex;//ΦφΣσΩ± Γ φα÷Φεφαδⁿφε∞ ±∩Φ±Ωσ
  418.     bool Selected:1;
  419.     bool Borg:1;
  420.     bool Invert:1;
  421.     bool Push:1;
  422.     bool Sdoxlo:1;
  423.     //bool inMotion:1;//┬√∩εδφ σ≥±  ∩≡ΦΩατ ε ∩σ≡σ∞σ∙σφΦΦ
  424.     bool isMoving:1;
  425.     bool XYChanged:1;
  426.     bool Removed:1;
  427.     bool Important:1;//─σδασ≥ ≈≥ε-≥ε Γαµφεσ
  428.     bool Attack:1;
  429.     bool Egoist:1;
  430.     bool NoMotion:1;//φσ ±ΣΓΦπα≥ⁿ±  φΦ ∩≡≥ ΩαΩΦ⌡ ≤±δεΓΦ ⌡,Ω≡ε∞σ ∩≡ΦΩατα ∩ε α≡∞ΦΦ
  431.     bool NoFire:1;//φσ ε≥Ω≡√Γα≥ⁿ επεφⁿ ∩ε Γ≡απ≤ Φ φσ ∩≡ΦΓδσΩα≥ⁿ ΓφΦ∞αφΦ 
  432.     bool NoInitiate:1;//φσ ΦφΦ÷ΦΦ≡εΓα≥ⁿ ±≡αµσφΦσ
  433.     bool WasInMobilZone:1;//┴√δ Γ τεφσ ∞εßΦδΦτα÷ΦΦ
  434.     bool TempFlag:1;//Γ≡σ∞σφφ√Θ ⌠δαπ, Φ±∩εδⁿτ≤σ∞√Θ Σδ  ±ε≡≥Φ≡εΓΩΦ ε≥≡ Σα
  435.     bool Mobilised:1;
  436.     bool MoveInRect:1;//≤±≥αφεΓδσφ, σ±δΦ ±≡σΣΦ ≡ΦΩατεΓ σ±≥ⁿ ∩≡ΦΩατ ε ∩σ≡σ∞σ∙σφΦΦ π≡≤∩∩√
  437.     bool DrawUp:1;//╤╥╨╨PP╬╚╥▄╤▀!!!
  438.     bool PathBroken:1;//┼±δΦ ⌡ε≥ⁿ ≡ατ ß√δα ∩≡σπ≡αΣα φα ∩≤≥Φ
  439.     bool capBuilding:1;
  440.     bool cpbMoving:1;
  441.     bool capBuild:1;
  442.     bool capBase:1;
  443.     bool Ready:1;
  444.     bool NoSearchVictim:1;
  445.     bool NoAnswer:1;
  446.     bool NeedNoHelp:1;
  447.     bool OnWater:1;
  448.     bool AskMade:1;
  449.     bool FlyAttackMode:1;
  450.     bool Teleport:1;
  451.     bool capTeleport:1;
  452.     bool StandGround:1;
  453.     bool Invisible:1;
  454.     //bool WATT:1;
  455.     //bool AATT:1;
  456.     //bool P100:1;
  457.     //bool T3X3:1;
  458.     //bool DoubleForce:1;
  459.     //bool TripleForce:1;
  460.     //bool QuadraForce:1;
  461.     bool Slow:1;
  462.     bool Transport:1;
  463.     bool Absent:1;
  464.     bool InFire:1;
  465.     bool RefreshLife:1;
  466.     bool DoWalls:1;
  467.     bool Use_AI:1;
  468.     bool AntiNuc:1;
  469.     bool UFOTrans:1;
  470.     bool Repair:1;
  471.     word MagSrcID;
  472.     byte AbRes;
  473.     byte xForce;
  474.     word MTime;
  475.     word capMagic;
  476.     word Magic;
  477.     word NUstages;
  478.     word Ustage;
  479.     word Serial;
  480.     byte Kind;
  481.     byte Lx;
  482.     byte Ly;
  483.     byte Wait;
  484.     word Life;
  485.     word MaxLife;
  486.     byte x;
  487.     byte y;
  488.     byte DstX;
  489.     byte DstY;
  490.     byte destX;
  491.     byte destY;
  492.     byte destX1;
  493.     byte destY1;
  494.     byte lastX;
  495.     byte lastY;
  496.     short wepX;
  497.     short wepY;
  498.     word delay;
  499.     byte MaxDelay;
  500.     byte Npush;
  501.     byte MemoryTime;
  502.     byte StandTime;
  503.     byte NStages;
  504.     byte Stage;
  505.     byte NNUM;
  506.     char Addx;
  507.     char Addy;
  508.     word EnemyDist;
  509.     word EnemyID;
  510.     word EnemySN;
  511.     byte NMask;
  512.     byte RStage;
  513.     byte RType;
  514.     byte RAmount;
  515.     word NearBase;
  516.     byte  VisRadius;
  517.     byte  VisSpots;
  518.     byte  SpotType;
  519.     byte  SpotSize;
  520.     byte  DangerZone;
  521.     //╥σΩ≤∙σσ ΓΦΣΦ∞εσ ±ε±≥ε φΦσ ∞εφ±≥≡α
  522.     byte Direction;                // ═α∩≡αΓδσφΦσ ∞εφ±≥≡α 0..7
  523.     byte CurrentSprite;            // ═ε∞σ≡ ±∩≡αΘ≥α, Ωε≥ε≡√Θ Σεδµσφ
  524.                                 // ≡Φ±εΓα≥ⁿ± 
  525.     byte Ticks;                    // ╧≡ε°δε ≥ΦΩεΓ ± ∞ε∞σφ≥α ±∞σφ√ ΩαΣ≡α
  526.     byte TicksPerChange;        // ╥ΦΩεΓ φα ±∞σφ≤ ΩαΣ≡α
  527.     byte AnmStandKind;
  528.     byte AnmGoKind;
  529.     byte Media;//=0-terrain,=1-on water,=2-on air
  530. //-----------------------------------------------//
  531. //-------------end of saving cluster-------------//
  532. //-----------------------------------------------//
  533.     Octant* CurAnm;                // ╥σΩ≤∙α  Γ√∩εδφ σ∞α  αφΦ∞α÷Φ 
  534.     word* Inside;
  535.     word* TimeInside;
  536.     word NInside;
  537.     //Flying objects only:
  538.     int  RealX;//1 pixel=16 length units
  539.     int  RealY;
  540.     int  DestX;
  541.     int  DestY;
  542.     int  RealVx;
  543.     int  RealVy;
  544.     int  BestDist;
  545.     int  BestHeight;
  546.     int     Height;
  547.     byte RealDir;
  548.     //for all objects
  549.     Legion* Wars;
  550.     //byte bx;
  551.     //byte by;
  552.     SelGroup* GroupIndex;
  553.     
  554. //╙Ωατα≥σδⁿ φα ≥σΩ≤∙ΦΘ ∩≡ΦΩατ 1-πε ≤≡εΓφ 
  555. //╥Φ∩√ ∩≡ΦΩατεΓ:
  556. //    ╧σ≡σΘ≥Φ(x,y)->(x1,y1) ∩ε ε∩≥Φ∞αδⁿφε∞≤ ∩≤≥Φ;
  557. //    └≥αΩεΓα≥ⁿ εß·σΩ≥(obj_index)- ≤Σαδσφφ√Θ ΦδΦ ßδΦτΩΦΘ
  558. //    ╙∞σ≡σ≥ⁿ
  559. //    ╤ετΣα≥ⁿ ²Ωτσ∞∩δ ≡ εß·σΩ≥α(obj)...
  560.     Order1* LocalOrder;
  561. //╙Ωατα≥σδⁿ φα ∩≡ε÷σΣ≤≡≤, Ωε≥ε≡εΘ ±εεß∙ασ≥±  ε ≥σΩ≤∙σ∞ ±ε±≥ε φΦΦ 
  562. //εß·σΩ≥α Γ ∩≡ε÷σ±±σ Γ√∩εδφσφΦ  ∩≡ΦΩατα
  563.     //ReportFn* OrderReport;
  564. //╟φα≈σφΦ  MessageType:
  565. //    00000001 - └φΦ∞α÷Φ  ταΓσ≡°σφα
  566. //    00000010 - ┬±σ Ωε∞αφΣ√ Φτ ß≤⌠σ≡α Φ±∩εδφσφ√
  567. //    00000100 - ╚τ∞σφΦδΦ±ⁿ Ωεε≡ΣΦφα≥√ εß·σΩ≥α
  568. //    00001000 - ═σΓετ∞εµφε ε±≤∙σ±≥ΓΦ≥ⁿ ∩σ≡σ∞σ∙σφΦσ
  569. //╥σ ±εß√≥Φ , Ωε≥ε≡√σ Γ√τ√Γα■≥ τ≥≤ ∩≡ε÷σΣ≤≡≤, εß≡αßα≥√Γα■≥±  
  570. //Γ ±εε≥Γσ≥±≥ΓΦΦ ± ⌠δαπα∞Φ
  571.     //word MessageFlags;
  572. //╬∩Φ±αφΦσ ∩≡σ≡√ΓαφΦΘ
  573.     byte PrioryLevel;
  574.     //byte MessageKind;
  575. //  =0 - φσ ß√δε ∩≡σ≡√ΓαφΦΘ
  576. //    =1 - ╧ε∞επΦ≥σ! ∞σφ  ßⁿ■≥!
  577. //    =2 - ▀ ≤ßⁿ■ ≥σß !
  578. //    =3 - ταΣαφΦσ ∩≡σ≡Γαφε
  579.     //word Sender;
  580. //  =\0xFFFF - ∩≡σ≡√ΓαφΦσ ε≥ Φπ≡εΩα, Φφα≈σ φε∞σ≡
  581. //  εß·σΩ≥α, ∩ε±δαΓ°σπε ±εεß∙σφΦσ.
  582.  
  583. //╙Ωατα≥σδⁿ φα ß≤⌠σ≡ Ωε∞αφΣ, Ωε≥ε≡√σ Γ√∩εδφ ■≥±  ∩ε±δσΣεΓα≥σδⁿφε
  584. //∩≡ε÷σΣ≤≡εΘ ∩≡ε±≈σ≥α ±δσΣ≤■∙σπε ±ε±≥ε φΦ ,≥ε σ±≥ⁿ ΓΦΣεΦτ∞σφ ■≥ 
  585. //∩≡σΣ√Σ≤∙Φσ ∩σ≡σ∞σφφ√σ. ┼±δΦ InLineCom=NULL-φσ≈σπε Φ±∩εδφ ≥ⁿ 
  586.     char* InLineCom;
  587.     int LineOffset;//╙Ωατα≥σδⁿ φα ≥σΩ≤∙≤■ Ωε∞αφΣ≤(ε≥φε±Φ≥σδⁿφ√Θ)
  588. /*            ╬∩Φ±αφΦσ Ωε∞αφΣ ∩±σΓΣεα±±σ∞ßδσ≡α (≤≡εΓσφⁿ 0)
  589.     00                    1        ═σ∩≡αΓΦδⁿφα  Ωε∞αφΣα(comUNKNOWN)
  590.     01                    1        ╬Ωεφ≈αφΦσ ∩≡ε÷σΣ≤≡√, ΓετΓ≡α≥(comRET)
  591.     02                    1        ╬≥δεµΦ≥ⁿ ΣαδⁿφσΘ°σσ Γ√∩εδφσφΦσ 
  592.                                 Σε εΩεφ≈αφΦ  Γ√∩εδφσφΦ  ≥σΩ≤∙σΘ
  593.                                 αφΦ∞α÷ΦΦ
  594.     03                    1        ╦εΩαδⁿφεσ ταΣαφΦσ ≤≡εΓφ  1 Γ√∩εδφσφε    
  595.     04 db(x) db(y)        3        ╙±≥αφεΓΦ≥ⁿ ≥σΩ≤∙≤■ Ωεε≡ΣΦφα≥≤
  596.     05 db(direction)    2        ╙±≥αφεΓΦ≥ⁿ ≥σΩ≤∙σσ φα∩≡αΓδσφΦσ
  597.  
  598.     06 db(dtype)                ╟απ≡≤τΦ≥ⁿ ≡σπΦ±≥≡ (stype) αφΦ∞α÷ΦσΘ 
  599.        db(stype)                ≥Φ∩α (dtype) ± α≥≡Φß≤≥ε∞ (kind)
  600.        dw(kind)            5        cm MoreAnimation, dtype=WhatFor;
  601.                                 kind=kind. ╟φα≈σφΦ  (stype):
  602.                                     0-Stand
  603.                                     1-Move
  604.                                     2-Attack
  605.                                     3-Death
  606.                                     4-Spending
  607.                                     5-Working
  608.                                     ...
  609.  
  610.     07 dd(address)        5        ┴στ≤±δεΓφ√Θ ∩σ≡σ⌡εΣ ∩ε αΣ≡σ±≤ Γ ∩α∞ ≥Φ
  611.  */
  612.     //╨σπΦ±≥≡√ αφΦ∞α÷ΦΦ-Σδ  ≤±Ωε≡σφΦ  Σε±≥≤∩α Ω αφΦ∞α÷Φ ∞
  613.     MoreAnimation ARegs[5];
  614.     Weapon* Weap;
  615.     void DefaultSettings(GeneralObject* GO);
  616.     void LoadAnimation(int Reg,byte WhatFor,word Kind);
  617.     void SendFlyTo(int x,int y,byte prio);
  618.     void MakeProcess();
  619.     void MakePreProcess();
  620.     void MakeWPreProcess();
  621.     void SendTo(int x,int y,int);
  622.     void WSendTo(int x2,int y2,int Prio);
  623.     void AttackObj(word OID,int Prio);
  624.     void WAttackObj(word OID,int Prio);
  625.     void FlyAttack(word OID,byte Prio);
  626.     void AttackPoint(byte x,byte y,byte wep,int Prio);
  627.     void ComplexAttack(word OID,byte wep,int Prio);
  628.     void ProcessFly();
  629.     void CreatePath(int x1,int y1);
  630.     void CreateSimplePath(int x1,int y1);
  631.     void CreatePrePath(int x1,int y1);
  632.     void CreateWPath(int txt1,int tyt1);
  633.     void CreatePreWPath(int txt1,int tyt1);
  634.     void CreateSimpleWPath(int txt1,int tyt1);
  635.     void MoveFrom(int dir);
  636.     void WMoveFrom(int dir);
  637.     void FreeAsmLink();
  638.     void LoadCurAnm(int reg);
  639.     void Die();
  640.     void Eliminate();
  641.     void MakeDamage(int Fundam,int Persist,OneObject* Sender);
  642.     void SearchSupport(word OBJ);//╧εΦ±Ω ∩ε∞ε∙φΦΩεΓ τα∞ε≈Φ≥ⁿ OBJ
  643.     void SearchVictim();
  644.     void FreeOrdBlock(Order1* p );
  645.     void ClearOrders();
  646.     void ProcessMotion();
  647.     void ProcessAttackMotion();
  648.     void SendInGroup(byte tx,byte ty,byte x0,byte y0,byte x1,byte y1);
  649.     void NextStage();
  650.     bool BuildObj(word OID,int Prio);
  651.     int CheckAbility(word ID);
  652.     void Produce(word ID);
  653.     bool BuildWall(word OID,int Prio);
  654.     bool DamageWall(word OID,int Prio);
  655.     word FindNearestBase();
  656.     bool TakeResource(byte x,byte y,byte ResID,int Prio);
  657.     void PerformUpgrade(word NewU);
  658.     word FindNearestPort();
  659.     bool BuildOnWater(word OID,int Prio);
  660.     bool GetOil(word OID,int Prio);
  661.     void SetDstPoint(byte x,byte y);
  662.     void Patrol(int x1,int y1,int x2,int y2,byte prio);
  663.     //void Repair(int x,int y,byte prio);
  664.     void EnableDoubleForce();
  665.     void DisableDoubleForce();
  666.     void EnableTripleForce();
  667.     void DiasableTripleForce();
  668.     void EnableQuadraForce();
  669.     void DisableQuadraForce();
  670.     void ContinueAttackPoint(byte x,byte y,int Prio);
  671.     void ContinueAttackWall(byte x,byte y,int Prio);
  672.     void NuclearAttack(byte x,byte y);
  673.     void MakeMeUFO();
  674.     void WaitForRepair();
  675.     inline int GetMinDam(){
  676.         return Ref.Visual->info.Basic.MinDamage;
  677.     };
  678.     inline int GetMaxDam(){
  679.         return Ref.Visual->info.Basic.MaxDamage;
  680.     }
  681.     bool GoToTransport(word MID,byte Prio);
  682.     bool UnloadPassangers(byte x ,byte y);
  683.     void MakeMeFly(word MagID);
  684.     void MakeMeSit();
  685. //#pragma warning( disable )
  686.     inline byte DistTo(byte xx,byte yy){
  687.         __asm{
  688.             xor        eax,eax
  689.             xor        ecx,ecx
  690.             xor        edx,edx
  691.             mov        al,xx
  692.             mov        ebx,this
  693.             mov        dl,[ebx]this.x
  694.             sub        ax,dx
  695.             jge        uui
  696.             neg        ax
  697. uui:        mov        cl,yy
  698.             mov        dl,[ebx]this.y
  699.             sub        cx,dx
  700.             jge        uux
  701.             neg        cx
  702. uux:        cmp        cx,ax
  703.             jl        uuz
  704.             mov        ax,cx
  705. uuz:
  706.         };
  707.     };
  708. //#pragma warning( default )
  709.     void CloseObject();
  710. };
  711. //╬∩Φ±αφΦσ ε≡≤µΦ 
  712. class Nation;
  713. class Weapon{
  714. public:
  715.     Visuals* Vis;//ε≡≤µΦσ ε⌠ε≡∞δ σ≥±  ΩαΩ ε≥Σσδⁿφα  φα÷Φ 
  716.     word NatIndex;
  717.     byte FShift;//φα≈. ±∞σ∙σφΦσ Φ±≥ε≈φΦΩα ∩ε≡αµσφΦ 
  718.     byte MinDamage;
  719.     byte MaxDamage;
  720.     byte Force;
  721.     byte FDecrement;//φα±ΩεδⁿΩε ≤∞σφⁿ°ασ≥±  ±Φδα ε≡≤µΦ  ∩≡Φ ∩ε∩αΣαφΦΦ
  722.     byte Probab1;//Γσ≡ε ≥φε±≥ⁿ ∩≡εΣΦ≥ⁿ 1 ε≡≤µΦσ(0..255)
  723.     byte Probab2;//Γσ≡ε ≥φε±≥ⁿ ∩ε≡εΣΦ≥ⁿ 2 ε≡≤µΦ (0..2555)
  724.     short ExplPath;//∩≤≥ⁿ, ∩≡ε⌡εΣΦ∞√Θ Σε ΣσδσφΦ 
  725.     byte DirectFactor;//±≥σ∩σφⁿ Ωε≡≡σδ ÷ΦΦ φα∩≡αΓδσφΦ  ∩σ≡σ∞σ∙σφΦ 
  726.                       //∩ε≡εµΣασ∞επε ε≡≤µΦ  Φ ∩ε≡εµΣα■∙σπε
  727.                       //0-φσταΓΦ±Φ∞√, 255-±εΓ∩αΣα■≥
  728.     //word        ar1;
  729.     //word        ar2;
  730.     word        atime;
  731.     byte Transparent;
  732.     Weapon* NextWeapon;//╬≡≤µΦσ,∩ε≡εµΣασ∞εσ Γ ≥ε≈Ωσ ∩ε≡αµσφΦ 
  733.     Octant* Fly;
  734.     Octant* Action;
  735.     byte NMask;
  736.     void CreateWeapon(Nation* WNat,word Ind,byte ExplCount,byte Kind);
  737.     void CreateNWeapon(int r1,int r2,int time);
  738.     //Kind: 0-simple weapon
  739.     //1-weak division weapon
  740.     //2-middle division
  741.     //3-strong division,NUCLEAR-like weapon
  742.     //4-super strong weapon.Total elimination.
  743.     short SoundID;
  744.     
  745. };
  746. //╬∩Φ±αφΦσ ²δσ∞σφ≥α αφΦ∞α÷ΦΦ(ε≡≤µΦσ Γ ΣσΘ±≥ΓΦΦ)
  747. class AnmObject{
  748. public:
  749.     byte xm;//Map coordinates
  750.     byte ym;
  751.     byte xm0;
  752.     byte ym0;
  753.     int x;
  754.     int y;
  755.     int vx;
  756.     int vy;
  757.     short v;
  758.     word ASerial;
  759.     byte PhDir;//(0..255);-⌠ΦτΦ≈σ±Ωεσ φα∩≡αΓδσφΦσ
  760.     byte Direction;//φα∩≡αΓδσφΦσ Φτ εΩ≥αφ≥α
  761.     byte NMask;
  762.     OneObject* Sender;
  763.     Weapon* Wpn;
  764.     word Path;
  765.     word MaxPath;
  766.     bool Visible:1;
  767.     bool OneTime:1;
  768.     bool SATT:1;
  769.     bool UATT:1;
  770.     bool WATT:1;
  771.     bool AATT:1;
  772.     bool P100:1;
  773.     bool T3X3:1;
  774.     bool AnmLead:1;
  775.     byte Transparent;
  776.     byte Nanm;
  777.     byte Canm;
  778.     byte Force;
  779.     byte Decrement;
  780.     word MinDamage;
  781.     word MaxDamage;
  782.     OneSlide* Kino;
  783.     byte destX;
  784.     byte destY;
  785.     word DestObj;
  786.     word DSerial;
  787. };
  788. class City;
  789. class Needness{
  790. public:
  791.     byte NeedType;//==0-monster,==1-Upgrade
  792.     word MonID;
  793.     byte GroupSize;
  794.     byte Amount;
  795.     word Probability;
  796.     word MoneyPercent;
  797. };
  798. struct SWPAR{
  799.     word Range;
  800.     byte MinMagic;
  801.     bool Enabled:1;
  802.     bool Fly:1;
  803. };
  804. struct sAI_Req{
  805.     byte Kind;//0-unit,1-upgrade,2-group
  806.     word ObjID;
  807.     word Amount;
  808. };
  809. struct sAI_Devlp{
  810.     byte Kind;//0-unit,1-upgrade
  811.     byte ConKind;//0-unit,2-group
  812.     word ObjID;
  813.     word ConID;
  814.     word Amount;
  815.     word GoldPercent;
  816.     word AtnPercent;
  817. };
  818. //╬∩Φ±αφΦσ φα÷ΦΦ Γ ÷σδε∞
  819. class Nation{
  820. public:
  821.     char SCRIPT[16];
  822.     int NMon;
  823.     GeneralObject* Mon[2048];
  824.     City* CITY;
  825.     int NGidot;
  826.     int NFarms;
  827.     word* PAble[2048];
  828.     word PACount[2048];
  829.     int BranchPercent[NBRANCH];
  830.     Upgrade UPG;
  831.     int NOct;
  832.     int NSlides;
  833.     //AI Statements
  834.     int CasheSize;
  835.     int TAX_PERCENT;
  836.     int CASH_PUSH_PROBABILITY;
  837.     int NationalAI;//0..32768-determines speed of development
  838.     int AI_Level_MIN;
  839.     int AI_Level_MAX;
  840.     int AI_Forward;
  841.     short DangerSound;
  842.     short VictorySound;
  843.     short ConstructSound;
  844.     short BuildDieSound;
  845.     short UnitDieSound;
  846.     word  LastAttackTime;
  847.     byte MagicDelay;
  848.     word NLmenus;
  849.     word* Lmenus;
  850.     word NAmenus;
  851.     word* Amenus;
  852.     word NWmenus;
  853.     word* Wmenus;
  854.     word NCmenus;
  855.     word* Cmenus;
  856.     word NNeed;
  857.     Needness NEED[1024];
  858.     //ENDAI
  859.     byte NNUM;
  860.     Octant* Animations;
  861.     OneSlide* Slides;
  862.     MoreAnimation* Finf;
  863.     int  NFinf;
  864.     byte palette[256];
  865.     word CivilisationLevel;
  866.     byte NMask;
  867.     word NIcons;
  868.     WIcon* wIcons[1024];
  869.     word TOWN0ID;
  870.     word TOWN1ID;
  871.     word TOWN2ID;
  872.     word SubmID;
  873.     word PortID;
  874.     word RefineryID;
  875.     word FoundaryID;
  876.     word TankerID;
  877.     word OilBaseID;
  878.     word TOWNHALL1;
  879.     word TOWNHALL2;
  880.     word LUMBERMILL;
  881.     word WMagic[256];
  882.     word NCOND;
  883.     word CLSize[256];//Access controlling
  884.     word* CLRef[256];
  885.     //Strange weapon prameters
  886.     word SWRange[256];
  887.     SWPAR SWP[256];
  888.     //-------------NEW AI--------------
  889.     word NGrp;        //Groups of types definition
  890.     word GRSize[32];
  891.     word* GRRef[32];
  892.     word  GAmount[32];//Result of calculation
  893.     word N_AI_Levels;
  894.     word N_AI_Req[256];
  895.     word N_AI_Devlp[256];
  896.     sAI_Req* AI_Req[256];
  897.     sAI_Devlp* AI_Devlp[256];
  898.     word AI_Level;
  899.     //---------------------------------
  900.     void CreateNation(LPCSTR NationFile,byte NMask,byte NIndex);
  901.     bool CreateTerrainAt(int x,int y,int n);
  902.     bool CreateOnWater(int xp,int yp,int n);
  903.     bool CreateOnFly(int xf,int yf,int n);
  904.     void AssignWeapon(Weapon* Wpn,int i);
  905.     int CreateBuilding(word ID,byte x,byte y);
  906.     bool CheckBuilding(word ID,byte x,byte y);
  907.     void GetUpgradeCostString(char* st,word UI);
  908.     void GetTax(byte RC_Type,int RC_Amount);
  909.     void CloseNation();
  910. };
  911. //╬≥≡ Σ ∞εφ±≥≡εΓ
  912. class Legion{
  913. public:
  914.     word* Member;//╙Ωατα≥σδⁿ φα ±∩Φ±εΩ ≈δσφεΓ δσπΦεφα
  915.     word NMemb;//╩εδ-Γε ≈δσφεΓ
  916.     word NNeed;//φσεß⌡εΣΦ∞ε Σδ  Ωε∞∩δσΩ≥α÷ΦΦ
  917.     byte NMask;//φα÷Φ 
  918.     byte minx;
  919.     byte miny;
  920.     byte maxx;
  921.     byte maxy;
  922.     byte XL1;
  923.     byte YL1;
  924.     byte SizeX1;//ΩαΩεΘ Σεδµσφ ß√≥ⁿ ≡ατ∞σ≡ ∩ε OX εßδα±≥ⁿ τα∙Φ≥φΦΩεΓ
  925.     byte SizeY1;//------/------ ∩ε OY
  926.     byte XL2;
  927.     byte YL2;
  928.     byte SizeX2;//------------/---------------- εßδα±≥ⁿ ±≥≡σδΩεΓ
  929.     byte SizeY2;
  930.     byte maxDeplX;//≡ατ∞σ≡ ε≥≡ Σα ∩ε ⌡, ∩≡Φ Ωε≥ε≡ε∞ ≤µσ φ≤µφε ∩ε±≥≡εσφΦσ
  931.     byte maxDeplY;
  932.     byte critDeplX;//∩ε±≡εσφΦσ αß±εδ■≥φε φσεß⌡εΣΦ∞ε,Φφα≈σ ≡ατπ≡ε∞
  933.     byte critDeplY;
  934.     word MobilTimer;//Γ≡σ∞  φα π≡≤∩∩Φ≡εΓΩ≤
  935.     word Order3Time;
  936.     word NoMmobilTimer;//Γ≡σ∞ , Γ ≥σ≈σφΦσ Ωε≥ε≡επε φεΓ√Θ ∩≡ΦΩατ ε π≡≤∩∩Φ≡εΓΩσ
  937.                        //Φπφε≡Φ≡≤σ≥± 
  938.     word EnemyID;
  939.     
  940.     byte destX;
  941.     byte destY;
  942.     byte destX1;
  943.     byte destY1;
  944.     byte FinX;
  945.     byte FinY;
  946.     byte Ordering;//±≥σ∩σφⁿ ≤∩ε≡ Σε≈σφφε±≥Φ 
  947.     //⌠δαπΦ ≡σαΩ÷ΦΦ ε≥≡ Σα φα ±εß√≥Φ 
  948.     bool NoMotion:1;//φσ ±ΣΓΦπα≥ⁿ±  φΦ ∩≡≥ ΩαΩΦ⌡ ≤±δεΓΦ ⌡,Ω≡ε∞σ ∩≡ΦΩατα ∩ε α≡∞ΦΦ
  949.     bool NoFire:1;//φσ ε≥Ω≡√Γα≥ⁿ επεφⁿ ∩ε Γ≡απ≤ Φ φσ ∩≡ΦΓδσΩα≥ⁿ ΓφΦ∞αφΦ 
  950.     bool NoInitiate:1;//φσ ΦφΦ÷ΦΦ≡εΓα≥ⁿ ±≡αµσφΦσ
  951.     //∩ε ≤∞εδ≈αφΦ■ Γ±σ ⌠δαπΦ=false-±α∞εΓεδⁿφεσ ΦτßΦ≡αφΦσ ≥αΩ≥ΦΩΦ ±≡αµσφΦ 
  952.     //⌠δαπΦ ±ε±≥ε φΦ  ε≥≡ Σα
  953.     bool Mobil:1;//ε≥≡ Σ ∞εßΦδΦτεΓαφ
  954.     bool inWar;//ε≥≡ Σ ΓεΓδσ≈σφ Γ Γεσφφ√σ ΣσΘ±≥ΓΦ 
  955.     bool NotExists;//∩εδφ√Θ ≡ατπ≡ε∞  ε≥≡ Σα
  956.     bool CheckMobility:1;//∩≡εΓσ≡ ≥ⁿ ±≥σ∩σφⁿ ≤∩ε≡ Σε≈σφφε±≥Φ
  957.     bool TempMobil;//∩≡ε∞σµ≤≥ε≈φα  ∞εßΦδΦτα÷Φ 
  958.     bool StonesInside:1;//Γ ±σ≡σΣΦφσ ≡α±∩εδεµσφΦ  σ±≥ⁿ φσ≤±≥≡αφΦ∞√σ ∩≡σπ≡αΣ√
  959.     //⌠δαπΦ ∩≡ΦΩατεΓ
  960.     bool needMobil;//∩≡ΦΩατ ε ∞εßΦδΦτα÷ΦΦ
  961.     bool needCompose:1;//φσεß⌡εΣΦ∞α π≡≤∩∩Φ≡εΓΩα
  962.     bool needMoveTo:1;
  963.     bool needDestroyObj:1;
  964.     bool needCompactness:1;//∩ε ∩≤≥Φ ε≥≡ Σ ∩εΣµΦΣασ≥ ε≥±≥αΓ°Φ⌡
  965.     void CreateLegionInSquare(byte x,byte y,byte x1,byte y1,byte Mask);
  966.     void CreateSmartLegionInSquare(byte x,byte y,byte x1,byte y1,byte Mask);
  967.     void CreateLegionFromSelection(byte Mask);
  968.     void CreateSmartLegionFromSelection(byte Mask);
  969.     void CreateLegionNearPoint(byte x,byte y,byte MaxRadius,word NMem,byte Mask);
  970.     void CreateSmartLegionNearPoint(byte x,byte y,byte MaxRadius,word NMem,byte Mask);
  971.     void CreateMobilZone(byte x,byte y);
  972.     void FastCreateMobilZone(byte x,byte y);
  973.     char GetOrderDegree();
  974.     //0-φΦΩαΩεπε ∩ε≡ ΣΩα φσ≥, ΓεΘ±Ωε ≡α±±σ φε
  975.     //1-∩ε≡ ΣεΩ φσΣε±≥α≥ε≈σφ Σδ  φε≡∞αδⁿφεπε ⌠≤φΩ÷ΦεφΦ≡εΓαφΦ 
  976.     //2-∩ε≡ ΣεΩ, Σε±≥α≥ε≈φ√Θ Σδ  ∩σ≡σ∞σ∙σφΦ 
  977.     //3-∞ΦφΦ∞αδⁿφ√Θ ßσ±∩ε≡ ΣεΩ,≥Γα≡Φ ≥εδⁿΩε φα εΣφ≤ Ωδσ≥Ω≤ φσ ΓδστδΦ
  978.     //4-ΦΣσαδⁿφ√Θ ∩ε≡ ΣεΩ
  979.     void Compose();
  980.     void Mobilisate();
  981.     void MoveTo(byte x,byte y);
  982.     void AttackObj(word ObjID);
  983.     void CalculateArea();//τα∩εδφσφΦσ ∩εδσΘ minx,miny,maxx,maxy
  984.     void CalculateBestComposition();//∩ε τφα≈σφΦ ∞ 
  985.     //min..,max..,NMemb->NNeed,SizeX1,SizeY1
  986.     void CalculateSoldiers();//±≈Φ≥ασ≥ Φ ß√±≥≡ε ±ε≡≥Φ≡≤σ≥ ±εδΣα≥,
  987.     //ε∩≡σΣσδ σ≥ ταφΦ∞ασ∞≤■ ε≥≡ Σε∞ εßδα±≥ⁿ
  988.     void CreateFinalZone(byte x,byte y);
  989.     void PreProcess();
  990.     void Process();//∩≡εΣεδµΦ≥ⁿ Γ√∩εδφσφΦσ ∩≡ΦΩατα
  991.     bool MobilisationIsDone();
  992.     bool CompositionIsDone();
  993.     void SendSoldiers();
  994.     void SendTo(byte x,byte y);
  995.  
  996. };
  997. class SelGroup{
  998. public:
  999.     word* Member;
  1000.     word* SerialN;
  1001.     word NMemb;
  1002.     bool CanMove:1;
  1003.     bool CanSearchVictim:1;
  1004.     bool CanHelpToFriend:1;
  1005.     bool Egoizm:1;
  1006.     SelGroup();
  1007.     void CreateFromSelection(byte NI);
  1008.     void SelectMembers(byte NI);
  1009.     void DeleteMembers(byte NI);
  1010. };
  1011.  
  1012.  
  1013. //╠α±±ΦΓ Γ±σ ∞εφ±≥≡εΓ φα Ωα≡≥σ
  1014. #define MaxObj 8192
  1015. #define maximage 2048
  1016. extern OneObject* Group[MaxObj];
  1017. extern RLCTable MImage[maximage];
  1018. extern RLCTable miniMImage[maximage];
  1019. void LoadMonsters();
  1020. #define maxmap 256  //Don't change it!
  1021. typedef byte SimpMap[maxmap][maxmap];
  1022. extern MapCell map[maxmap][maxmap];
  1023. extern SimpMap TrMap;
  1024. void LoadLock();
  1025. #define MaxAsmCount 16384
  1026. #define OneAsmSize 256
  1027. #define OneAShift 8;
  1028. #define MaxOrdCount 32768
  1029. #define OneOrdSize 32;
  1030. #define OneOShift 5;
  1031. char* GetAsmBlock();
  1032. void FreeAsmBlock(char* p );
  1033. void InitAsmBuf();
  1034. Order1* GetOrdBlock();
  1035. //void FreeOrdBlock(Order1* p );
  1036. void InitOrdBuf();
  1037. extern Order1  OrdBuf[MaxOrdCount];
  1038. extern bool    AsmUsage[MaxAsmCount];
  1039. extern int    msx;
  1040. extern int msy;
  1041. extern void Except();
  1042. //╨ατ∞σ≡ ε≈σ≡σΣΦ φα Γ√∩εδφσφΦσ(2^n only !)
  1043. #define StSize 8192
  1044. #define StMask StSize-1;
  1045. extern word ComStc[StSize];
  1046. extern word StHead;
  1047. extern word StTile;
  1048. #define FreeTime 600;
  1049. void CarryOutOrder();
  1050. void InitStack();
  1051. extern RLCTable rlc;
  1052. extern RLCFont rlf;
  1053. extern RLCFont rlf1;
  1054. extern RLCTable mon;
  1055. extern RLCTable rlc_s;
  1056. extern RLCFont rlf_s;
  1057. extern RLCFont rlf1_s;
  1058. extern RLCTable mon_s;
  1059. void doooo();
  1060. extern byte LLock[maxmap][maxmap];
  1061. extern word Mops[maxmap][maxmap];
  1062. extern word Creator;
  1063. extern Nation NAT;
  1064. extern int    smapx;
  1065. extern int    smapy;
  1066. extern int    smaplx;
  1067. extern int    smaply;
  1068. extern int minix;
  1069. extern int    miniy;
  1070. extern HWND hwnd;
  1071. void MakePostProcess();
  1072. void MakeWPostProcess();
  1073. void PrepareProcessing();
  1074. extern int Flips;
  1075. extern word Died[maxmap][maxmap];
  1076. //extern void FreeOrdBlock(Order1* p );
  1077. extern int    mapx;
  1078. extern int    mapy;
  1079. //byte CreateExObj(Weapon* Wep,short x,short y,
  1080. //                 short dx,short dy,short v,byte Mask,OneObject* Send);
  1081. void CreateExObjD(Weapon* Wep,int x,int y,
  1082.                  short PDir,short v,byte Mask,OneObject* Send);
  1083. //byte CreateExObjDPoint(Weapon* Wep,short x,short y,
  1084. //                 short dx,short dy,short v,byte Mask,OneObject* Send,byte dsx,byte dsy);
  1085. byte AttackByWeapon(Weapon* Wep,short x,short y,OneObject* Send,word DOBJ);
  1086. void InitExplosions();
  1087. void ProcessExpl();
  1088. extern Weapon FlyFire1;
  1089. extern Weapon Vibux1;
  1090. void CloseExplosions();
  1091. short rando();
  1092. extern byte PlayerMask;
  1093. extern bool EgoFlag;
  1094. void AddAsk(word ReqID,byte x,byte y,char zdx,char zdy);
  1095. extern SelGroup SelSet[80];
  1096. extern Weapon* WPLIST[1024];
  1097. typedef void HandlePro(int);
  1098. void InitZones();
  1099. int CreateZone(int x,int y,int lx,int ly,HandlePro* HPro,int Index,char* Hint);
  1100. void ControlZones();
  1101. void DeleteZone(int i);
  1102. void ShowProp();
  1103. void InitPrpBar();
  1104. void ShowAbility();
  1105. extern word* Selm[8];
  1106. extern word* SerN[8];
  1107. extern word NSL[8];
  1108. void CmdCreateSelection(byte NI,byte x,byte y,byte x1,byte y1);
  1109. void CmdSendToXY(byte NI,byte x,byte y);
  1110. void CmdAttackObj(byte NI,word ObjID);
  1111. void CmdCreateTerrain(byte NI,byte x,byte y,word Type);
  1112. void CmdCreateBuilding(byte NI,byte x,byte y,word Type);
  1113. void CmdProduceObj(byte NI,word Type);
  1114. void CmdMemSelection(byte NI,byte Index);
  1115. void CmdRememSelection(byte NI,byte Index);
  1116. void CmdBuildObj(byte NI,word ObjID);
  1117. void CmdBuildWall(byte NI);
  1118. void CmdRepairWall(byte NI,word LIN);
  1119. void CmdDamageWall(byte NI,word LIN);
  1120. void CmdTakeRes(byte NI,byte x,byte y,byte ResID);
  1121. void CmdPerformUpgrade(byte NI,word UI);
  1122. void CmdCreateKindSelection(byte NI,byte x,byte y,byte x1,byte y1,byte Kind);
  1123. void CmdCreateTypeSelection(byte NI,byte x,byte y,byte x1,byte y1,word Type);
  1124. void CmdCreateGoodSelection(byte NI,word x,word y,word x1,word y1);
  1125. void CmdCreateGoodKindSelection(byte NI,word x,word y,word x1,word y1,byte Kind);
  1126. void CmdCreateGoodTypeSelection(byte NI,word x,word y,word x1,word y1,word Type);
  1127. void CmdSetDst(byte NI,byte x,byte y);
  1128. void CmdSendToPoint(byte NI,byte x,byte y);
  1129. void CmdAttackToXY(byte NI,byte x,byte y);
  1130. void CmdStop(byte NI);
  1131. void CmdStandGround(byte NI);
  1132. void CmdPatrol(byte NI,byte x,byte y);
  1133. void CmdRepair(byte NI,byte x,byte y);
  1134. void CmdGetResource(byte NI,byte x,byte y);
  1135. void CmdComplexAttackPoint(byte NI,byte x,byte y,byte kind);
  1136. void CmdComplexAttack(byte NI,word ID,byte kind);
  1137. void CmdSendToTransport(byte NI,word ID);
  1138. void CmdUnload(byte NI,byte x,byte y);
  1139. void CmdDie(byte NI);
  1140. void CmdContinueAttackPoint(byte NI,byte x,byte y);
  1141. void CmdContinueAttackWall(byte NI,byte x,byte y);
  1142. void CmdSitDown(byte NI);
  1143. void CmdNucAtt(byte NI,byte x,byte y);
  1144. void CmdChooseSelType(byte NI,word ID);
  1145. void CmdChooseUnSelType(byte NI,word ID);
  1146. extern Nation NATIONS[8];
  1147. extern byte MyNation;
  1148. void InitEBuf();
  1149. void ExecuteBuffer();
  1150. extern char Prompt[80];
  1151. extern int PromptTime;
  1152. extern byte tmap[maxmap][maxmap];
  1153. bool CheckCost(byte NI,byte ResID,word Amount);
  1154. void CreateWaterMap();
  1155. extern byte WLock[256][256];//Water locking map
  1156. extern byte WMap[256][256];//Static locking map
  1157. extern int SCRSizeX;
  1158. extern int SCRSizeY;
  1159. extern int RSCRSizeX;
  1160. extern int RSCRSizeY;
  1161. extern int COPYSizeX;
  1162. void CmdGetOil(byte NI,word UI);
  1163. //DEBUGGING definitions. Remove this definitions in retail version
  1164. //#define DEBLEVEL1
  1165. //#define DEBLEVEL2
  1166. //#define DEBLEVEL3
  1167. //#define DEBLEVEL4
  1168. extern byte NLocks[64][64];
  1169. inline void IncLock(byte x,byte y){
  1170.     NLocks[y>>2][x>>2]++;
  1171. };
  1172. inline void DecLock(byte x,byte y){
  1173.     NLocks[y>>2][x>>2]--;
  1174. };
  1175. extern bool FASTMODE;
  1176. extern word MAXOBJECT;
  1177. void SetupHint();
  1178. void AssignHint(char* s,int time);
  1179. void GetChar(GeneralObject* GO,char* s);
  1180. void ProcessHint();
  1181. extern OneObject OBJECTS[8192];
  1182. extern short TSin[257];
  1183. extern short TCos[257];
  1184. extern short TAtg[257];
  1185. void SetFlyMarkers();
  1186. void ClearFlyMarkers();
  1187. typedef void UniqMethood(int n,int x,int y);
  1188. void HandleSW();
  1189. void CreateStrangeObject(int i,byte NI,int x,int y,word ID);
  1190. void ShowRLCItemMutno(int x,int y,lpRLCTable lprt,int n);
  1191. void ShowRLCItemFired(int x,int y,lpRLCTable lprt,int n);
  1192. byte CreateUniExObj(Weapon* Wep,int x,int y,
  1193.                  short v,byte Mask,
  1194.                  OneObject* Send,
  1195.                  byte dsx,byte dsy,
  1196.                  word DOBJ);
  1197. byte CreateLeadingObject(Weapon* Wep,int x,int y,
  1198.                  short v,byte Mask,
  1199.                  OneObject* Send,
  1200.                  word DestAnm);
  1201. bool CheckAttAbility(OneObject* OB,word Patient);
  1202. void PrepareToEdit();
  1203. void PrepareToGame();
  1204. extern int MaxSizeX;
  1205. extern int MaxSizeY;
  1206. extern bool MiniMode;
  1207. void SetMiniMode();
  1208. void ClearMiniMode();
  1209. extern int Shifter;
  1210. extern int Multip;