diff options
-rwxr-xr-x | CHANGELOG.TXT | 6 | ||||
-rw-r--r-- | global.h | 1 | ||||
-rw-r--r-- | levels.h | 69 | ||||
-rw-r--r-- | main.cpp | 2 | ||||
-rw-r--r-- | towernbullet.h | 97 |
5 files changed, 169 insertions, 6 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 4bbc1b4..f290a26 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -13,10 +13,16 @@ 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 background interface, use background pictures easily. Minor code cleanups. Removed more useless comments, my code is still hard to comprehend, though. +Small interface and behaviour changes: +-If a bullet is effect-attatched and the effect is running, it won't +die. +-Bullet::redir now always make dist=1, for some bullet processing +doesn't use dist now. Don't copyleft, it's radical. 0.7.1-6_PR (b69) @@ -102,6 +102,7 @@ struct Bullet bulletdir.y=bulletpos.y-targ.y; dist=bulletdir.x*bulletdir.x+bulletdir.y*bulletdir.y; dist=sqrt(dist); + bulletdir.x/=dist;bulletdir.y/=dist;dist=1; } void setdir(double rad) { @@ -2398,7 +2398,7 @@ void Level7Part2() for (int i=1;i<=times;++i)DBGColor=ColorTransfer(DBGColor,0xFF0B0916); if (DBGColor==0xFF0B0916) { - if(bgbrk==2)bgbrk=3,bgdbbrk=0.075; + if(bgbrk==2)bgbrk=3,bgdbbrk=0.06; if(bgbrk==5)bgbrk=0,bgdbbrk=rand()%15+5; } } @@ -3001,7 +3001,7 @@ void Level7Part20() } } } -SimpleThing a,b; +SimpleThing aa,bb; void Level7Part21() { frameleft=AMinute*2;clrtime=2;towcnt=0; @@ -3015,15 +3015,74 @@ void Level7Part21() } if (Current_Position==1) { - ++part;All2pnt();skyactive=false; + ++part;All2pnt();skyactive=false;DBGColor=0xFF000000; binter.Init("./Resources/b_inter.png",PicBack::Centered,0x80); - binter.SetFadeIn();a.Init(vector2d(260,292));b.Init(vector2d(523,292)); + binter.SetFadeIn();aa.Init(vector2d(260,292));bb.Init(vector2d(523,292)); } } void Level7Part22() { //260,292;523,292 - a.Update(true);b.Update(false); + aa.Update(true);bb.Update(false); +} +diffCreator dfc[200]; +void Level7Part23() +{ + frameleft=AMinute*2;clrtime=2;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + aa.toPoint();bb.toPoint(); + Current_Position=2; + ShowTip("Diffraction(fake)"); + } + if (Current_Position==1) + { + ++part;memset(dfc,0,sizeof(dfc)); + avabrk=2.0f;avacurbrk=0; + } +} +void Level7Part24() +{ + avabrk=1.0f+frameleft/(double)AMinute; + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk) + { + 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 + { + 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(); } //vvvvvvvvvvvvvvvvvvvvvv Old Levels vvvvvvvvvvvvvvvvvvvvvv// /* @@ -446,6 +446,8 @@ void CallLevels() if (level==7&&part==20)Level7Part20(); if (level==7&&part==21)Level7Part21(); if (level==7&&part==22)Level7Part22(); + if (level==7&&part==23)Level7Part23(); + if (level==7&&part==24)Level7Part24(); if (level==1&&part==5)level=2,part=0; if (level==2&&part==10)level=3,part=0; if (level==3&&part==7)level=4,part=0; diff --git a/towernbullet.h b/towernbullet.h index e8fdbd1..d86aea2 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -362,7 +362,7 @@ void ProcessBullet2(int i) bullet[i].bullettype=0; return; } - if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable) + if (bullet[i].scale<1.2&&dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable) { ++coll,scminus+=10000,Mult_BatClear();bullet[i].collable=false; if(!bullet[i].inv) @@ -1895,4 +1895,99 @@ public: } } } + void toPoint() + { + for(int i=0;i<cnt;++i) + CreateBullet255(b[i].bulletpos.x,b[i].bulletpos.y,10); + } +}; +class diffCreator +{ +private: + bool active; + double range; + vector2d center; + Bullet* C; + Bullet* target[200]; + bool done[800][600]; + int cnt; + bool test(vector2d a) + { + for(int i=0;i<cnt;++i) + if(GetDist(a,target[i]->bulletpos)<16)return false; + return true; + } +public: + void init(vector2d _ctr) + { + active=true; + cnt=0;range=0; + center=_ctr; + C=&bullet[CreateBullet2(center.x,center.y,0,0,true)]; + C->alterColor=red; + } + bool isActive(){return active;} + void update() + { + range+=hge->Timer_GetDelta()*400; + vector2d a;bool all=true; + for(a=vector2d(center.x-20,center.y);a.x>-25;a.x-=20) + if(GetDist(a,center)<=range){ + if(test(a))target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,0,true)];} + else all=false; + for(a=vector2d(center.x+20,center.y);a.x<825;a.x+=20) + if(GetDist(a,center)<=range){ + if(test(a))target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi,true)];} + else all=false; + for(a=vector2d(center.x,center.y-20);a.y>-25;a.y-=20) + if(GetDist(a,center)<=range){ + if(test(a))target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi/2,true)];} + else all=false; + for(a=vector2d(center.x,center.y+20);a.y<625;a.y+=20) + if(GetDist(a,center)<=range){ + if(test(a))target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,-pi/2,true)];} + else all=false; + a=center; +#define _bat \ + target[cnt-1]->redir(center),\ + target[cnt-1]->bulletdir.x=-target[cnt-1]->bulletdir.x,\ + target[cnt-1]->bulletdir.y=-target[cnt-1]->bulletdir.y + for(int i=1;i<=5;++i) + for(int j=1;j<=6-i;++j) + if(GetDist(vector2d(a.x+i*20,a.y+j*20),center)<=range){ + if(test(vector2d(a.x+i*20,a.y+j*20))) + target[cnt++]=&bullet[CreateBullet2(a.x+i*20,a.y+j*20,0,0,true)],_bat;} + else all=false; + for(int i=1;i<=5;++i) + for(int j=1;j<=6-i;++j) + if(GetDist(vector2d(a.x-i*20,a.y+j*20),center)<=range){ + if(test(vector2d(a.x-i*20,a.y+j*20))) + target[cnt++]=&bullet[CreateBullet2(a.x-i*20,a.y+j*20,0,0,true)],_bat;} + else all=false; + for(int i=1;i<=5;++i) + for(int j=1;j<=6-i;++j) + if(GetDist(vector2d(a.x+i*20,a.y-j*20),center)<=range){ + if(test(vector2d(a.x+i*20,a.y-j*20))) + target[cnt++]=&bullet[CreateBullet2(a.x+i*20,a.y-j*20,0,0,true)],_bat;} + else all=false; + for(int i=1;i<=5;++i) + for(int j=1;j<=6-i;++j) + if(GetDist(vector2d(a.x-i*20,a.y-j*20),center)<=range){ + if(test(vector2d(a.x-i*20,a.y-j*20))) + target[cnt++]=&bullet[CreateBullet2(a.x-i*20,a.y-j*20,0,0,true)],_bat;} + else all=false; +#undef _bat + if(all) + { + BulletEffect_Death(*C,0x80FF3333); + C->exist=false; + for(int i=0;i<cnt;++i) + { + target[i]->bulletspeed=-0.5; + target[i]->bulletaccel=0.0005; + target[i]->limv=3; + } + active=false; + } + }; }; |