aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCHANGELOG.TXT5
-rw-r--r--background.h14
-rw-r--r--levels.h464
-rw-r--r--main.cpp1
-rw-r--r--towernbullet.h13
5 files changed, 256 insertions, 241 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index 589d7ec..3b2f83d 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -13,8 +13,11 @@ However it wouldn't be appropriate to put three new levels into one
build...
The real changelog is here:
New level "interference" (it's another small class "SimpleThing").
-New level "diffraction" (yet another dull class).
+New level "diffraction" (yet another dull class), hopefully fixed a
+memory leak in this level (by using more memory!)
+Rearrange levels to the order they will appear in the final version.
New background interface, use background pictures easily.
+Make "Tiled" background mode work.
Fix a small glitch in Level3Part3-4. This level won't run correctly
under Low FPS Mode.
Minor code cleanups.
diff --git a/background.h b/background.h
index f43e2f5..1a69789 100644
--- a/background.h
+++ b/background.h
@@ -261,6 +261,7 @@ public:
}
void SetSpeed(float _speed){speed=_speed;}
void SetSkyA(float _skya){skya=_skya;}
+ void SetTime(float _timet){timet=_timet;}
void SkySetFadeIn(float _starta=0.0f,float _lima=1.0f)
{
skya=_starta;skylima=_lima;
@@ -484,12 +485,10 @@ private:
void DoFadeOut()
{
if (LOWFPS)fadebreak+=17;else ++fadebreak;
- if (fadebreak>30)fadebreak=0;else return;
- if (LOWFPS)
- if (alpha<0x20)alpha=0;else alpha-=0x20;
- else
- if (alpha<0x2)alpha=0;else alpha-=0x2;
- if (!alpha)onfadeout=0;
+ if (fadebreak>17)fadebreak=0;else return;
+ if (LOWFPS)if (alpha<0x20)alpha=0;else alpha-=0x20;
+ else if (alpha<0x2)alpha=0;else alpha-=0x2;
+ if (!alpha)onfadeout=false;
}
void RenderCenterAt(vector2d a)
{
@@ -506,6 +505,7 @@ public:
void Init(const char *tx,arMode _Mode,DWORD _alim)
{
quad.tex=hge->Texture_Load(tx);alim=_alim;
+ Mode=_Mode;
quad.v[0].tx=0,quad.v[0].ty=0;
quad.v[1].tx=1,quad.v[1].ty=0;
quad.v[2].tx=1,quad.v[2].ty=1;
@@ -548,7 +548,7 @@ public:
alpha=alim;
onfadeout=true;
}
-}binter;
+}binter,bdiff;
DWORD ColorTransfer(DWORD a,DWORD t)
{
int r=GETR(a),g=GETG(a),b=GETB(a),sa=GETA(a);
diff --git a/levels.h b/levels.h
index cfa2670..349cd09 100644
--- a/levels.h
+++ b/levels.h
@@ -2463,7 +2463,8 @@ void Level7Part3()
DBGColor=ColorTransfer(DBGColor,0xFFFFFFFF);
else
for (int i=1;i<=17;++i)DBGColor=ColorTransfer(DBGColor,0xFFFFFFFF);
- if (DBGColor==0xFFFFFFFF)skystp=skyactive=true,sky.SkySetFadeIn(),sky.SetSpeed(0);
+ if (DBGColor==0xFFFFFFFF)skystp=skyactive=true,sky.SkySetFadeIn(),sky.SetSpeed(0.1);
+ sky.SetTime(9);
}
else
{
@@ -2612,171 +2613,213 @@ void Level7Part7()
}
}
}
-//Rearrange needed since here, see LEVELS.txt
-BulletSine bnl[100];
-double ykbrk;
-void Level7Part8()//Photon school
+double sntang;
+void Level7Part8()
{
- memset(bnl,0,sizeof(bnl));
- frameleft=AMinute;
- ykbrk=0.5f;++part;
+ frameleft=AMinute;clrtime=2;towcnt=0;
+ DisableAllTower=false;
+ if (IfShowTip)
+ {
+ IfShowTip=false;
+ FadeTip=false;
+ Current_Position=2;
+ ShowTip("Rainbow!");
+ }
+ if (Current_Position==1)
+ {
+ ++part;All2pnt();avabrk=0.03f;avacurbrk=1.0f;sntang=-pi/2;
+ }
+}
+void rainbowCreator(double rl,double rr,double rad,TColors col,double speed,bool invi=false)
+{
+ double r=rand()%((int)(rr-rl)*10000)/10000.0f+rl;
+ int pnt=CreateBullet2(900+cos(rad)*r,700+sin(rad)*r,speed,rand()/32767.0f,true,invi);
+ bullet[pnt].alterColor=col;
}
void Level7Part9()
{
- ykbrk-=hge->Timer_GetDelta();
- if (ykbrk<0&&frameleft>TenSeconds/10*3)
+ //(600,600)->(250,600)
+ if (sntang>-pi)
{
- ykbrk=(double)frameleft/AMinute+0.5f;
- for (int i=0;i<100;++i)
- if (!bnl[i].active)
+ avacurbrk+=hge->Timer_GetDelta();
+ if (avacurbrk>avabrk)
{
- vector2d a,b;
- if (rand()%100>49)
- {
- if (rand()%100>49)a=vector2d(rand()%780+10,610);else a=vector2d(rand()%780+10,-10);
- }
- else
- {
- if (rand()%100>49)a=vector2d(-10,rand()%580+10);else a=vector2d(810,rand()%580+10);
- }
- if (rand()%100>49)
- {
- if (rand()%100>49)b=vector2d(rand()%780+10,610);else b=vector2d(rand()%780+10,-10);
- }
- else
- {
- if (rand()%100>49)b=vector2d(-10,rand()%580+10);else b=vector2d(810,rand()%580+10);
- }
- bnl[i].Init(a,b);
- break;
+ sntang-=pi/180;avacurbrk=0;
+ for(int i=0;i<6;++i)rainbowCreator(660,600,sntang,red,0,1);
+ for(int i=0;i<6;++i)rainbowCreator(610,550,sntang,orange,0,1);
+ for(int i=0;i<6;++i)rainbowCreator(560,500,sntang,yellow,0,1);
+ for(int i=0;i<6;++i)rainbowCreator(510,450,sntang,green,0,1);
+ for(int i=0;i<6;++i)rainbowCreator(460,410,sntang,blue,0,1);
+ for(int i=0;i<6;++i)rainbowCreator(420,360,sntang,dblue,0,1);
+ for(int i=0;i<6;++i)rainbowCreator(365,310,sntang,purple,0,1);
}
}
- for (int i=0;i<100;++i)
- if (bnl[i].active)bnl[i].Update();
-}
-WOP wop[100];
-void Level7Part10()//Wave of Photon
-{
- memset(bnl,0,sizeof(bnl));
- frameleft=AMinute;
- ykbrk=0.5f;++part;
-}
-void Level7Part11()
-{
- ykbrk-=hge->Timer_GetDelta();
- if (ykbrk<0&&frameleft>TenSeconds/10*3)
+ else
{
- ykbrk=(double)frameleft/AMinute/2.0f+0.2f;
- for (int i=0;i<100;++i)
- if (!wop[i].active)
+ avabrk=0.35+(frameleft/(double)AMinute)*0.4f;
+ avacurbrk+=hge->Timer_GetDelta();
+ if (avacurbrk>avabrk)
{
- vector2d a,b;
- if (rand()%100>49)
- {
- if (rand()%100>49)a=vector2d(rand()%780+10,610);else a=vector2d(rand()%780+10,-10);
- }
- else
- {
- if (rand()%100>49)a=vector2d(-10,rand()%580+10);else a=vector2d(810,rand()%580+10);
- }
- if (rand()%100>49)
- {
- if (rand()%100>49)b=vector2d(rand()%780+10,610);else b=vector2d(rand()%780+10,-10);
- }
- else
- {
- if (rand()%100>49)b=vector2d(-10,rand()%580+10);else b=vector2d(810,rand()%580+10);
- }
- wop[i].Init(a,b,1+(AMinute-frameleft)/(double)AMinute,0.02);
- break;
+ avacurbrk=0;
+ double spd=((AMinute-frameleft)/(double)AMinute)+1;
+ //======================
+ sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
+ for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
+ rainbowCreator(660,600,sntang,red,spd);
+ //======================
+ sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
+ for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
+ rainbowCreator(610,550,sntang,orange,spd);
+ //======================
+ sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
+ for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
+ rainbowCreator(560,500,sntang,yellow,spd);
+ //======================
+ sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
+ for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
+ rainbowCreator(510,450,sntang,green,spd);
+ //======================
+ sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
+ for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
+ rainbowCreator(460,410,sntang,blue,spd);
+ //======================
+ sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
+ for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
+ rainbowCreator(420,360,sntang,dblue,spd);
+ //======================
+ sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
+ for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
+ rainbowCreator(365,310,sntang,purple,spd);
+ sntang=-pi-0.1;
}
}
- for (int i=0;i<100;++i)
- if (wop[i].active)wop[i].Update();
}
-void Level7Part12()//3 circles
+SimpleThing aa,bb;
+void Level7Part10()
{
- frameleft=AMinute;clrtime=2;towcnt=0;
+ frameleft=AMinute*2;clrtime=2;towcnt=0;
DisableAllTower=false;
if (IfShowTip)
{
IfShowTip=false;
FadeTip=false;
Current_Position=2;
- ShowTip("It's not really here!");
+ ShowTip("Interference(fake)");
}
if (Current_Position==1)
{
- ++part;All2pnt();avabrk=1.0f;avacurbrk=0;
- }
-}
-void L7P13Creator(vector2d p,int cnt,TColors col)
-{
- for (int i=0;i<cnt;++i)
- {
- int pnt=CreateBullet2(p.x,p.y,6,frameleft*pi/AMinute+i*(2*pi/cnt));
- // ^
- // Nowhere can be safe!
- bullet[pnt].alterColor=col;
- bullet[pnt].bulletaccel=-0.003;bullet[pnt].limv=((AMinute-frameleft)/(double)AMinute)+1.0f;
+ ++part;All2pnt();skyactive=false;DBGColor=0xFF000000;
+ binter.Init("./Resources/b_inter.png",PicBack::Centered,0x80);
+ binter.SetFadeIn();aa.Init(vector2d(260,292));bb.Init(vector2d(523,292));
}
}
-void Level7Part13()
+void Level7Part11()
{
- avacurbrk+=hge->Timer_GetDelta();
- avabrk=(frameleft/(double)AMinute)*0.5f+0.5f;
- if(avacurbrk>avabrk)
- {
- avacurbrk=0;
- L7P13Creator(vector2d(400,250),60,red);
- L7P13Creator(vector2d(350,336.6),60,green);
- L7P13Creator(vector2d(450,336.6),60,blue);
- }
+//260,292;523,292
+ aa.Update(true);bb.Update(false);
}
-BCircle scircles[200];
-double rspd[200];
-void Level7Part14()//circles
+diffCreator dfc[200];
+void Level7Part12()
{
- frameleft=AMinute;clrtime=2;towcnt=0;
+ frameleft=AMinute*2;clrtime=2;towcnt=0;
DisableAllTower=false;
if (IfShowTip)
{
IfShowTip=false;
- FadeTip=false;
+ FadeTip=false;bulcnt=0;
+ aa.toPoint();bb.toPoint();
Current_Position=2;
- ShowTip("??????");
+ ShowTip("Diffraction(fake)");
}
if (Current_Position==1)
{
- ++part;All2pnt();avabrk=1.0f;avacurbrk=1.0f;memset(scircles,0,sizeof(scircles));
+ ++part;memset(dfc,0,sizeof(dfc));
+ binter.SetFadeOut();bdiff.Init("./resources/b_diff.png",PicBack::Tiled,0x80);
+ bdiff.SetFadeIn();
+ avabrk=2.0f;avacurbrk=0;
}
}
-void Level7Part15()
+void Level7Part13()
{
+ avabrk=1.0f+frameleft/(double)AMinute;
avacurbrk+=hge->Timer_GetDelta();
- avabrk=0.1+(frameleft/(double)AMinute)*0.4f;
- if(avacurbrk>avabrk)
+ if(avacurbrk>avabrk&&frameleft>=TenSeconds/5)
{
- avacurbrk=0;
for(int i=0;i<200;++i)
+ if (!dfc[i].isActive())
{
- if (scircles[i].GetRange()>510||scircles[i].GetRange()<1e-7)
+ if(rand()%100>75)
{
- scircles[i].Init(1,(rand()&1?1:-1)*(frameleft<TwentySeconds?0.0003:0.0002),36,vector2d(400,300),(TColors)(rand()%8),(TColors)(rand()%8));
- rspd[i]=0.575+(frameleft/(double)AMinute)*0.1;break;
+ if(rand()%100>49)
+ {
+ vector2d pos=vector2d(playerpos.x,rand()%600);
+ while (GetDist(pos,playerpos)<100)
+ pos=vector2d(playerpos.x,rand()%600);
+ dfc[i].init(pos);
+ }
+ else
+ {
+ vector2d pos=vector2d(rand()%800,playerpos.y);
+ while (GetDist(pos,playerpos)<100)
+ pos=vector2d(rand()%800,playerpos.y);
+ dfc[i].init(pos);
+ }
}
+ else
+ {
+ vector2d pos=vector2d(rand()%800,rand()%600);
+ while (GetDist(pos,playerpos)<100)
+ pos=vector2d(rand()%800,rand()%600);
+ dfc[i].init(pos);
+ }
+ break;
}
+ avacurbrk=0;
}
for(int i=0;i<200;++i)
+ if(dfc[i].isActive())dfc[i].update();
+}
+BulletSine bnl[100];
+double ykbrk;
+void Level7Part14()//Photon school
+{
+ memset(bnl,0,sizeof(bnl));
+ frameleft=AMinute;
+ ykbrk=0.5f;skyactive=true;bdiff.SetFadeOut();
+ if((DBGColor=ColorTransfer(DBGColor,0x00000000))==0x0)++part;
+}
+void Level7Part15()
+{
+ ykbrk-=hge->Timer_GetDelta();
+ if (ykbrk<0&&frameleft>TenSeconds/10*3)
{
- if (scircles[i].GetRange()>1e-7&&scircles[i].GetRange()<510)
+ ykbrk=(double)frameleft/AMinute+0.5f;
+ for (int i=0;i<100;++i)
+ if (!bnl[i].active)
{
- scircles[i].SetRange(scircles[i].GetRange()+(LOWFPS?17:1)*rspd[i]);
- if (rspd[i]>0.002)rspd[i]-=0.0005*(LOWFPS?17:1);
- if (rspd[i]<=0.002)rspd[i]=0.002;
- scircles[i].Update();
+ vector2d a,b;
+ if (rand()%100>49)
+ {
+ if (rand()%100>49)a=vector2d(rand()%780+10,610);else a=vector2d(rand()%780+10,-10);
+ }
+ else
+ {
+ if (rand()%100>49)a=vector2d(-10,rand()%580+10);else a=vector2d(810,rand()%580+10);
+ }
+ if (rand()%100>49)
+ {
+ if (rand()%100>49)b=vector2d(rand()%780+10,610);else b=vector2d(rand()%780+10,-10);
+ }
+ else
+ {
+ if (rand()%100>49)b=vector2d(-10,rand()%580+10);else b=vector2d(810,rand()%580+10);
+ }
+ bnl[i].Init(a,b);
+ break;
}
}
+ for (int i=0;i<100;++i)
+ if (bnl[i].active)bnl[i].Update();
}
double DTCircle;
BCircle Circles[20];
@@ -2928,169 +2971,130 @@ void Level7Part18()//Great circles-child2
Circles[i].Update();
}
}
-double sntang;
-void Level7Part19()
-{
- frameleft=AMinute;clrtime=2;towcnt=0;
- DisableAllTower=false;
- if (IfShowTip)
- {
- IfShowTip=false;
- FadeTip=false;
- Current_Position=2;
- ShowTip("??????");
- }
- if (Current_Position==1)
- {
- ++part;All2pnt();avabrk=0.03f;avacurbrk=1.0f;sntang=-pi/2;
- }
-}
-void L7P20Creator(double rl,double rr,double rad,TColors col,double speed,bool invi=false)
+//Rearrange needed since here, see LEVELS.txt
+WOP wop[100];
+void Level7Part19()//Wave of Photon
{
- double r=rand()%((int)(rr-rl)*10000)/10000.0f+rl;
- int pnt=CreateBullet2(900+cos(rad)*r,700+sin(rad)*r,speed,rand()/32767.0f,true,invi);
- bullet[pnt].alterColor=col;
+ memset(bnl,0,sizeof(bnl));
+ frameleft=AMinute;
+ ykbrk=0.5f;++part;
}
void Level7Part20()
{
- //(600,600)->(250,600)
- if (sntang>-pi)
- {
- avacurbrk+=hge->Timer_GetDelta();
- if (avacurbrk>avabrk)
- {
- sntang-=pi/180;avacurbrk=0;
- for(int i=0;i<6;++i)L7P20Creator(660,600,sntang,red,0,1);
- for(int i=0;i<6;++i)L7P20Creator(610,550,sntang,orange,0,1);
- for(int i=0;i<6;++i)L7P20Creator(560,500,sntang,yellow,0,1);
- for(int i=0;i<6;++i)L7P20Creator(510,450,sntang,green,0,1);
- for(int i=0;i<6;++i)L7P20Creator(460,410,sntang,blue,0,1);
- for(int i=0;i<6;++i)L7P20Creator(420,360,sntang,dblue,0,1);
- for(int i=0;i<6;++i)L7P20Creator(365,310,sntang,purple,0,1);
- }
- }
- else
+ ykbrk-=hge->Timer_GetDelta();
+ if (ykbrk<0&&frameleft>TenSeconds/10*3)
{
- avabrk=0.35+(frameleft/(double)AMinute)*0.4f;
- avacurbrk+=hge->Timer_GetDelta();
- if (avacurbrk>avabrk)
+ ykbrk=(double)frameleft/AMinute/2.0f+0.2f;
+ for (int i=0;i<100;++i)
+ if (!wop[i].active)
{
- avacurbrk=0;
- double spd=((AMinute-frameleft)/(double)AMinute)+1;
- //======================
- sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
- for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
- L7P20Creator(660,600,sntang,red,spd);
- //======================
- sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
- for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
- L7P20Creator(610,550,sntang,orange,spd);
- //======================
- sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
- for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
- L7P20Creator(560,500,sntang,yellow,spd);
- //======================
- sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
- for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
- L7P20Creator(510,450,sntang,green,spd);
- //======================
- sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
- for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
- L7P20Creator(460,410,sntang,blue,spd);
- //======================
- sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
- for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
- L7P20Creator(420,360,sntang,dblue,spd);
- //======================
- sntang=-pi+(rand()%(int)(pi/2*10000))/10000.0f;
- for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i)
- L7P20Creator(365,310,sntang,purple,spd);
- sntang=-pi-0.1;
+ vector2d a,b;
+ if (rand()%100>49)
+ {
+ if (rand()%100>49)a=vector2d(rand()%780+10,610);else a=vector2d(rand()%780+10,-10);
+ }
+ else
+ {
+ if (rand()%100>49)a=vector2d(-10,rand()%580+10);else a=vector2d(810,rand()%580+10);
+ }
+ if (rand()%100>49)
+ {
+ if (rand()%100>49)b=vector2d(rand()%780+10,610);else b=vector2d(rand()%780+10,-10);
+ }
+ else
+ {
+ if (rand()%100>49)b=vector2d(-10,rand()%580+10);else b=vector2d(810,rand()%580+10);
+ }
+ wop[i].Init(a,b,1+(AMinute-frameleft)/(double)AMinute,0.02);
+ break;
}
}
+ for (int i=0;i<100;++i)
+ if (wop[i].active)wop[i].Update();
}
-SimpleThing aa,bb;
-void Level7Part21()
+void Level7Part21()//3 circles
{
- frameleft=AMinute*2;clrtime=2;towcnt=0;
+ frameleft=AMinute;clrtime=2;towcnt=0;
DisableAllTower=false;
if (IfShowTip)
{
IfShowTip=false;
FadeTip=false;
Current_Position=2;
- ShowTip("Interference(fake)");
+ ShowTip("It's not really here!");
}
if (Current_Position==1)
{
- ++part;All2pnt();skyactive=false;DBGColor=0xFF000000;
- binter.Init("./Resources/b_inter.png",PicBack::Centered,0x80);
- binter.SetFadeIn();aa.Init(vector2d(260,292));bb.Init(vector2d(523,292));
+ ++part;All2pnt();avabrk=1.0f;avacurbrk=0;
+ }
+}
+void L7P13Creator(vector2d p,int cnt,TColors col)
+{
+ for (int i=0;i<cnt;++i)
+ {
+ int pnt=CreateBullet2(p.x,p.y,6,frameleft*pi/AMinute+i*(2*pi/cnt));
+ // ^
+ // Nowhere can be safe!
+ bullet[pnt].alterColor=col;
+ bullet[pnt].bulletaccel=-0.003;bullet[pnt].limv=((AMinute-frameleft)/(double)AMinute)+1.0f;
}
}
void Level7Part22()
{
-//260,292;523,292
- aa.Update(true);bb.Update(false);
+ avacurbrk+=hge->Timer_GetDelta();
+ avabrk=(frameleft/(double)AMinute)*0.5f+0.5f;
+ if(avacurbrk>avabrk)
+ {
+ avacurbrk=0;
+ L7P13Creator(vector2d(400,250),60,red);
+ L7P13Creator(vector2d(350,336.6),60,green);
+ L7P13Creator(vector2d(450,336.6),60,blue);
+ }
}
-diffCreator dfc[200];
-void Level7Part23()
+BCircle scircles[200];
+double rspd[200];
+void Level7Part23()//circles
{
- frameleft=AMinute*2;clrtime=2;towcnt=0;
+ frameleft=AMinute;clrtime=2;towcnt=0;
DisableAllTower=false;
if (IfShowTip)
{
IfShowTip=false;
FadeTip=false;
- aa.toPoint();bb.toPoint();
Current_Position=2;
- ShowTip("Diffraction(fake)");
+ ShowTip("??????");
}
if (Current_Position==1)
{
- ++part;memset(dfc,0,sizeof(dfc));
- avabrk=2.0f;avacurbrk=0;
+ ++part;All2pnt();avabrk=1.0f;avacurbrk=1.0f;memset(scircles,0,sizeof(scircles));
}
}
void Level7Part24()
{
- avabrk=1.0f+frameleft/(double)AMinute;
avacurbrk+=hge->Timer_GetDelta();
- if(avacurbrk>avabrk&&frameleft>=TenSeconds/5)
+ avabrk=0.1+(frameleft/(double)AMinute)*0.4f;
+ if(avacurbrk>avabrk)
{
+ avacurbrk=0;
for(int i=0;i<200;++i)
- if (!dfc[i].isActive())
{
- if(rand()%100>75)
- {
- if(rand()%100>49)
- {
- vector2d pos=vector2d(playerpos.x,rand()%600);
- while (GetDist(pos,playerpos)<100)
- pos=vector2d(playerpos.x,rand()%600);
- dfc[i].init(pos);
- }
- else
- {
- vector2d pos=vector2d(rand()%800,playerpos.y);
- while (GetDist(pos,playerpos)<100)
- pos=vector2d(rand()%800,playerpos.y);
- dfc[i].init(pos);
- }
- }
- else
+ if (scircles[i].GetRange()>510||scircles[i].GetRange()<1e-7)
{
- vector2d pos=vector2d(rand()%800,rand()%600);
- while (GetDist(pos,playerpos)<100)
- pos=vector2d(rand()%800,rand()%600);
- dfc[i].init(pos);
+ scircles[i].Init(1,(rand()&1?1:-1)*(frameleft<TwentySeconds?0.0003:0.0002),36,vector2d(400,300),(TColors)(rand()%8),(TColors)(rand()%8));
+ rspd[i]=0.575+(frameleft/(double)AMinute)*0.1;break;
}
- break;
}
- avacurbrk=0;
}
for(int i=0;i<200;++i)
- if(dfc[i].isActive())dfc[i].update();
+ {
+ if (scircles[i].GetRange()>1e-7&&scircles[i].GetRange()<510)
+ {
+ scircles[i].SetRange(scircles[i].GetRange()+(LOWFPS?17:1)*rspd[i]);
+ if (rspd[i]>0.002)rspd[i]-=0.0005*(LOWFPS?17:1);
+ if (rspd[i]<=0.002)rspd[i]=0.002;
+ scircles[i].Update();
+ }
+ }
}
//vvvvvvvvvvvvvvvvvvvvvv Old Levels vvvvvvvvvvvvvvvvvvvvvv//
/*
diff --git a/main.cpp b/main.cpp
index 9d091d4..43a432c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -567,6 +567,7 @@ bool FrameFunc()
//Render towers, bullets and player.
if (Leaves.IsActive())Leaves.Update();
if (binter.active())binter.Update();
+ if (bdiff.active())bdiff.Update();
if (LE_Active||Head){if (!Head)Tail=Head=new Leaf_Anim(),Head->init(990);Head->Process();}
shots=0;
dsmc=0;
diff --git a/towernbullet.h b/towernbullet.h
index 154a729..5afb1ef 100644
--- a/towernbullet.h
+++ b/towernbullet.h
@@ -1903,13 +1903,15 @@ public:
};
class diffCreator
{
-private:
+protected:
bool active;
double range;
+ int cnt;
vector2d center;
Bullet* C;
Bullet* target[200];
- int cnt;
+ vector2d created[200];
+private:
TColors rbGetColor(int a)
{
switch (a)
@@ -1926,7 +1928,7 @@ private:
bool test(vector2d a)
{
for(int i=0;i<cnt;++i)
- if(GetDist(a,target[i]->bulletpos)<9)return false;
+ if(GetDist(a,created[i])<12)return false;
return true;
}
public:
@@ -1948,6 +1950,7 @@ public:
{
if(test(a))
target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,0,true)],
+ created[cnt-1]=vector2d(a.x,a.y),
target[cnt-1]->inv=true,
target[cnt-1]->alterColor=red;
}
@@ -1957,6 +1960,7 @@ public:
{
if(test(a))
target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi,true)],
+ created[cnt-1]=vector2d(a.x,a.y),
target[cnt-1]->inv=true,
target[cnt-1]->alterColor=red;
}
@@ -1966,6 +1970,7 @@ public:
{
if(test(a))
target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi/2,true)],
+ created[cnt-1]=vector2d(a.x,a.y),
target[cnt-1]->inv=true,
target[cnt-1]->alterColor=red;
}
@@ -1975,6 +1980,7 @@ public:
{
if(test(a))
target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,-pi/2,true)],
+ created[cnt-1]=vector2d(a.x,a.y),
target[cnt-1]->inv=true,
target[cnt-1]->alterColor=red;
}
@@ -1982,6 +1988,7 @@ public:
a=center;
#define _bat \
target[cnt-1]->redir(center),\
+ created[cnt-1]=target[cnt-1]->bulletpos,\
target[cnt-1]->bulletdir.x=-target[cnt-1]->bulletdir.x,\
target[cnt-1]->bulletdir.y=-target[cnt-1]->bulletdir.y,\
target[cnt-1]->inv=true,\