From 4f062725e3d2d104a40432b341ae2345ade5cfca Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Mon, 3 Mar 2014 23:28:31 +0000 Subject: Remove useless statements, and some interface-compatible changes. --- towernbullet.h | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 8 deletions(-) (limited to 'towernbullet.h') diff --git a/towernbullet.h b/towernbullet.h index 1440bc1..374c76b 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -787,9 +787,6 @@ void ProcessBullet255(int i) bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; bullet[i].dist=0; bullet[i].bullettype=0; -#ifndef NO_FREE - if (bullet[i].bulletspr)free(bullet[i].bulletspr); -#endif } else { @@ -1513,7 +1510,7 @@ public: ProcessBullet2(untitledbul),x=untitledbul.bulletpos.x,y=untitledbul.bulletpos.y; else untitledlas.EnableColl=true, - untitledlas.Process();//printf("%lf\n",untitledlas.GetDist()); + untitledlas.Process(); if (!untitledbul.exist)y=-1; if (y>pos&&!done&&!las) { @@ -1546,7 +1543,7 @@ public: { untitledlas.RenCtr=vector2d(x+7.2,y+7.2); untitledlas.Render();untitledlas.EnableColl=true; - untitledlas.Process();printf("%lf\n",untitledlas.GetDist()); + untitledlas.Process(); if (!reverse) { if (range1Timer_GetFPS()),range2=range1; @@ -1686,6 +1683,81 @@ public: } }; TCTarg CTarg; +#undef rad1 +#undef rad2 +class TROF +{ +public: + Bullet *Bul[32]; + double rad1,rad2,drad,srad,dtrad,dtrad2; + double range,drange,dtrange,cdtrange; + int stage,cnt,ccnt,delay,cf; + double elasp; + void init() + { + stage=0;rad1=rad2=srad;elasp=0.0f;ccnt=0; + for (int i=0;iscale=0.01; + Bul[0]->bulletspeed=2;Bul[0]->scale=1; + } + void stage0() + { + elasp+=hge->Timer_GetDelta(); + if ((int)(elasp/0.15f)>ccnt&&ccntbulletpos,Bul[1]->bulletpos); + Bul[ccnt]->bulletspeed=2;Bul[ccnt]->scale=1; + } + if (elasp>2) + { + stage=1; + drange=GetDist(Bul[cnt-1]->bulletpos,vector2d(400,300)); + dtrad=(drad-srad);while (dtrad>pi/6.0f)dtrad-=pi/6.0f;dtrad/=delay; + dtrad2=(2*pi-drad+srad);while (dtrad2>pi/6.0f)dtrad2-=pi/6.0f;dtrad2/=delay; + for (int i=0;ibulletspeed=0; + cf=0; + } + } + void stage1() + { + cf+=(LOWFPS?17:1); + rad1=srad+dtrad*cf;rad2=srad-dtrad2*cf; + for (int i=0;ibullettype==8) + { + if (i&1) + Bul[i]->bulletpos=vector2d(400+(drange+(cnt-i)*dtrange)*cos(rad1-pi),300+(drange+(cnt-i)*dtrange)*sin(rad1-pi)); + else + Bul[i]->bulletpos=vector2d(400+(drange+(cnt-i)*dtrange)*cos(rad2-pi),300+(drange+(cnt-i)*dtrange)*sin(rad2-pi)); + } + if (cf>delay) + { + cf=delay; + rad1=srad+dtrad*cf;rad2=srad-dtrad2*cf; + for (int i=0;ibullettype==8) + { + if (i&1) + Bul[i]->bulletpos=vector2d(400+(drange+(cnt-i)*dtrange)*cos(rad1-pi),300+(drange+(cnt-i)*dtrange)*sin(rad1-pi)); + else + Bul[i]->bulletpos=vector2d(400+(drange+(cnt-i)*dtrange)*cos(rad2-pi),300+(drange+(cnt-i)*dtrange)*sin(rad2-pi)); + Bul[i]->bulletspeed=2,Bul[i]->redir(vector2d(400,300)), + Bul[i]->bulletdir=vector2d(-Bul[i]->bulletdir.x,-Bul[i]->bulletdir.y); + } + stage=2; + } + } + void stage2(){} + void update() + { + switch(stage) + { + case 0:stage0();break; + case 1:stage1();break; + case 2:stage2();break; + } + } +}; class BCircle { private: @@ -1763,12 +1835,11 @@ public: if (OutOfBound()) { active=false; - //Release them! for (int i=1;i<=gencnt;++i) - if (generated[i])//explosion prevention + if (generated[i]) generated[i]->bulletaccel=0.005,generated[i]->limv=2, generated[i]->inv=false,generated[i]->collable=true; - memset(generated,0,sizeof(generated));//therefore we won't touch those fucking things accidently + memset(generated,0,sizeof(generated)); } ProcessBullet2(headb); } -- cgit v1.2.3