home *** CD-ROM | disk | FTP | other *** search
/ WarCraft 2000 - Nuclear Epidemic / W2000.nrg / SOURCE.War2000 / Nuclear.cpp < prev    next >
C/C++ Source or Header  |  1998-07-16  |  2KB  |  95 lines

  1. #include "ddini.h"
  2. #include "ResFile.h"
  3. #include "FastDraw.h"
  4. #include "mgraph.h"
  5. #include "mouse.h"
  6. #include "menu.h"
  7. #include "MapDiscr.h"
  8. #include "multipl.h"
  9. #include "fog.h"
  10. #include "walls.h"
  11. #include "Nature.h"
  12. extern short TSin[257];
  13. extern short TCos[257];
  14. extern short TAtg[257];
  15. extern int NUCLUSE[4];
  16. class HugeExplosion{
  17. public:
  18.     bool Enabled;
  19.     int x;
  20.     int y;
  21.     int Radius1;
  22.     int Radius2;
  23.     int r1;
  24.     int r2;
  25.     int vr1;
  26.     int vr2;
  27.     int NR1;
  28.     int NR2;
  29.     HugeExplosion();
  30.     void CreateExpl(int x,int y,int r1,int r2,int time);
  31.     void HandleExpl();
  32. };
  33. HugeExplosion::HugeExplosion(){
  34.     Enabled=false;
  35. };
  36. void HugeExplosion::CreateExpl(int ex,int ey,int er1,int er2,int time){
  37.     x=ex<<7;
  38.     y=ey<<7;
  39.     Radius1=er1;
  40.     Radius2=er2;
  41.     NR1=5;
  42.     Radius1=er1;
  43.     Radius2=er2;
  44.     r1=32;
  45.     r2=64;
  46.     vr1=div(er1-32,time).quot;
  47.     vr2=div(er2-64,time).quot;
  48.     Enabled=true;
  49. };
  50. void HugeExplosion::HandleExpl(){
  51.     if(Enabled){
  52.         for(int j=0;j<0;j++){
  53.             byte angl=rando()&255;
  54.             int rad=rando()&511;
  55.             int xx=x+((rad*TSin[angl])>>8);
  56.             int yy=y+((rad*TCos[angl])>>8);
  57.             byte xxx=byte(xx>>7);
  58.             byte yyy=byte(xx>>7);
  59.             word MID=Mops[yyy][xxx];
  60.             if(MID!=0xFFFF&&int(Group[MID]))
  61.                 Group[MID]->Life=0;
  62.             CreateExObjD(WPLIST[NUCLUSE[rando()&3]],xx,yy,angl,8,255,NULL);
  63.             r1++;
  64.         };
  65.         int rx=r2;
  66.         if(rx>30)rx=50;
  67.         for(j=0;j<rx;j++){
  68.             byte angl=rando()&255;
  69.             int rr=r2+(rando()&127);
  70.             int xx=x+((rr*TSin[angl])>>8);
  71.             int yy=y+((rr*TCos[angl])>>8);
  72.             byte xxx=byte(xx>>7);
  73.             byte yyy=byte(yy>>7);
  74.             word MID=Mops[yyy][xxx];
  75.             if(MID!=0xFFFF&&int(Group[MID]))
  76.                 Group[MID]->Life=0;
  77.             CreateExObjD(WPLIST[NUCLUSE[rando()&3]],xx,yy,angl,16,255,NULL);
  78.             r2++;
  79.         };
  80.         if(r2>Radius2)Enabled=false;
  81.     };
  82. };
  83. //USAGE
  84. static HugeExplosion HUGEX[64];
  85. void AddHugExp(int ex,int ey,int er1,int er2,int time){
  86.     for(int i=0;HUGEX[i].Enabled&&i<64;i++);
  87.     if(i<64)
  88.         HUGEX[i].CreateExpl(ex,ey,er1,er2,time);
  89. };
  90. void HandleHExpls(){
  91.     for(int i=0;i<64;i++)HUGEX[i].HandleExpl();
  92. };
  93.  
  94.  
  95.