summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-04-02 13:12:38 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-04-02 13:12:38 +0000
commit9884abca9d646fe3b27d95efc3a6d2211de45968 (patch)
treed2cb9a7b2a00e6d2b4dbdfcaad4fa7c7cbb02e55
parent4f8c05c5dac35b386fdfe09d2f3d086fcc2cbada (diff)
downloadbullet-lab-remix-9884abca9d646fe3b27d95efc3a6d2211de45968.tar.xz
New level, modify laser.
-rwxr-xr-xCHANGELOG.TXT5
-rw-r--r--levels.h110
-rw-r--r--main.cpp2
-rw-r--r--towernbullet.h44
4 files changed, 149 insertions, 12 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index 3471abe..f2db720 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -14,6 +14,10 @@ New assessment level "density test"...
New assessment level "pinball"...
New assessment level "Road blocks"...
New assessment level "Extreme speeds"...
+New assessment level "Messed up"...
+Laser extentions, add LineLaser for two-point laser inheriting all
+Laser interfaces.
+Modify laser collision parameters.
Level corrections.
Improve density test.
Add screen shot. Press S for a screen shot.
@@ -36,6 +40,7 @@ Add circ2pnt.
0.8.1-1_PR (b77)
All parts from level -1 to 7 are completed!
Fixed the crash in the mingw-w64 build.
+Switch to mingw-w64 for building Windows version now.
Complete GUI bring back.
Fix a bug appeared after the cross-plantform port(when forked
from BLRI).
diff --git a/levels.h b/levels.h
index eee8125..ce91c64 100644
--- a/levels.h
+++ b/levels.h
@@ -3858,10 +3858,13 @@ void Levelm2Part14()
}
if(assetime>120)
{
- avacurbrk+=hge->Timer_GetDelta();
- if(avacurbrk>1)
- CreateBullet6(re.NextDouble(0,800),re.NextDouble(0,600),2,0,1,12,true),
- avacurbrk=0;
+ avacurbrk-=hge->Timer_GetDelta();
+ if(avacurbrk<0)
+ {
+ CreateBullet6(re.NextDouble(10,790),re.NextDouble(10,590),2,0,1,12,true);
+ avacurbrk=1-0.75*(assetime-120.0f)/60.0f;
+ if(avacurbrk<0.2)avacurbrk=0.2;
+ }
}
}
}
@@ -3998,13 +4001,13 @@ void Levelm2Part21()
FadeTip=false;
Current_Position=2;
ShowTip("Test 11 - Extreme speeds");
- All2pnt();
+ All2pnt();towcnt=0;
return;
}
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- for (int i=1;i<=33;++i)CreateTower8(i*24-12,12,500,10,20,30);
+ for (int i=1;i<=33;++i)CreateTower8(i*24-12,12,500,6,20,30);
for (int i=1;i<=towcnt;++i)
if (tower[i].RendColor==0x80FFFFFF)
tower[i].RendColor=0x00FFFFFF;
@@ -4016,6 +4019,8 @@ void Levelm2Part21()
void Levelm2Part22()
{
frameleft=Infinity;
+ double nspd=6+4*assetime/120.0f;if(nspd>10)nspd=10;
+ for(int i=1;i<=33;++i)tower[i].bulletspeed=nspd;
tbrk-=hge->Timer_GetDelta();
if (tbrk>0)return;
tbrk=3-2*(assetime/120.0f);
@@ -4026,3 +4031,96 @@ void Levelm2Part22()
bullet[p].alterColor=orange;
}
}
+SimpLL SLL[200];
+void Levelm2Part23()
+{
+ frameleft=Infinity;Dis8ref=true;tbrk=0;
+ DisableAllTower=false;
+ if (IfShowTip)
+ {
+ IfShowTip=false;
+ FadeTip=false;
+ Current_Position=2;
+ ShowTip("Test 12 - Messed up");
+ All2pnt();towcnt=0;
+ return;
+ }
+ if (towcnt!=0)return ClearAll(false);
+ ++part;tbrk=avacurbrk=avabrk=0;memset(SLL,0,sizeof(SLL));
+}
+void Levelm2Part24()
+{
+ frameleft=Infinity;
+ tbrk-=hge->Timer_GetDelta();
+ if(tbrk<0)
+ {
+ tbrk=3-2.5*(assetime/120.0f);
+ if(tbrk<0.5)tbrk=0.5;
+ int cnt=12+12*assetime/120.0f;
+ if(cnt>24)cnt=24;
+ for(int i=0;i<cnt;++i)
+ {
+ vector2d dir=vector2d(400-playerpos.x,300-playerpos.y);
+ dir.ToUnitCircle();dir=50*dir;dir.Rotate(i*2*pi/cnt);
+ int pnt=CreateBullet2(400+dir.x,300+dir.y,0,0,true);
+ bullet[pnt].limv=-2;bullet[pnt].bulletaccel=-0.001;bullet[pnt].whirem=500;
+ bullet[pnt].redir(vector2d(400,300));
+ }
+ }
+ avacurbrk+=hge->Timer_GetDelta();
+ if(avacurbrk>avabrk)
+ {
+ avacurbrk=0;avabrk=4-3*assetime/120.0f;if(avabrk<0.5)avabrk=0.5;
+ vector2d a,b;int cnt=re.NextInt(5,10);
+ for (int i=0;i<cnt;++i)
+ {
+ if (re.NextInt(1,100)>=50)
+ {
+ if (re.NextInt(1,100)>=50)a=vector2d(re.NextDouble(10,790),610);else a=vector2d(re.NextDouble(10,790),-10);
+ }
+ else
+ {
+ if (re.NextInt(1,100)>=50)a=vector2d(-10,re.NextDouble(10,590));else a=vector2d(810,re.NextDouble(10,590));
+ }
+ if (re.NextInt(1,100)>=50)
+ {
+ if (re.NextInt(1,100)>=50)b=vector2d(re.NextDouble(10,790),610);else b=vector2d(re.NextDouble(10,790),-10);
+ }
+ else
+ {
+ if (re.NextInt(1,100)>=50)b=vector2d(-10,re.NextDouble(10,590));else b=vector2d(810,re.NextDouble(10,590));
+ }
+ for(int i=0;i<200;++i)
+ if(!SLL[i].active)
+ {
+ SLL[i].InitLine(a,b,0.1,SETA(ColorToDWORD(blue),0x80));
+ SLL[i].active=true;SLL[i].stp=0;SLL[i].brk=0;
+ break;
+ }
+ }
+ }
+ for(int i=0;i<200;++i)
+ if(SLL[i].active)
+ {
+ SLL[i].Process();
+ SLL[i].brk+=hge->Timer_GetDelta();
+ if(SLL[i].stp==2)
+ if(SLL[i].brk>0.02)
+ {
+ SLL[i].SetWidth(SLL[i].GetWidth()-0.2);
+ if(SLL[i].GetWidth()<1)SLL[i].EnableColl=false;
+ if(SLL[i].GetWidth()<0.05)SLL[i].active=false;
+ SLL[i].brk=0;
+ }
+ if(SLL[i].stp==0)
+ if(SLL[i].brk>0.02)
+ {
+ SLL[i].SetWidth(SLL[i].GetWidth()+0.2);
+ if(SLL[i].GetWidth()>2)SLL[i].EnableColl=true;
+ if(SLL[i].GetWidth()>4)SLL[i].stp=1;
+ SLL[i].brk=0;
+ }
+ if(SLL[i].stp==1)
+ if(SLL[i].brk>5){SLL[i].brk=0;SLL[i].stp=2;}
+ }
+}
diff --git a/main.cpp b/main.cpp
index ca92a69..121c1ad 100644
--- a/main.cpp
+++ b/main.cpp
@@ -545,6 +545,8 @@ void CallLevels()
if (level==-2&&part==20)Levelm2Part20();
if (level==-2&&part==21)Levelm2Part21();
if (level==-2&&part==22)Levelm2Part22();
+ if (level==-2&&part==23)Levelm2Part23();
+ if (level==-2&&part==24)Levelm2Part24();
if (level==1&&part==5)level=2,part=0;
if (level==2&&part==10)
diff --git a/towernbullet.h b/towernbullet.h
index 3fc2fcd..2cba49c 100644
--- a/towernbullet.h
+++ b/towernbullet.h
@@ -1559,16 +1559,16 @@ private:
vector2d data1[MaxRes],data2[MaxRes];
double GetDist()
{
- double res=99999.9999f;
- double tres=99999.9999f;
+ double res=99999.9999f,tres;
+ static vector2d correction=vector2d(8.4,8.4);
for (int i=0;i<Res-1;++i)
{
vector2d sa,sb;
sa=data1[i]+RenCtr;sb=data1[i+1]+RenCtr;
- tres=GetDistSeg(sa,sb,playerpos);
+ tres=GetDistSeg(sa,sb,playerpos+correction);
sa=data2[i]+RenCtr;sb=data2[i+1]+RenCtr;
- if(GetDistSeg(sa,sb,playerpos)<tres)
- tres=GetDistSeg(sa,sb,playerpos);
+ if(GetDistSeg(sa,sb,playerpos+correction)<tres)
+ tres=GetDistSeg(sa,sb,playerpos+correction);
if (tres<res)res=tres;
}
return res;
@@ -1631,7 +1631,7 @@ public:
Render();
if (EnableColl)
{
- if (GetDist()<4.0f&&clrrange<1e-5&&clrrad-pi/2<1e-7)
+ if (GetDist()<3.0f&&clrrange<1e-5&&clrrad-pi/2<1e-7)
{
if (!LOWFPS)++collbrk;else collbrk+=17;
if (collbrk>200)
@@ -2828,3 +2828,35 @@ public:
}
}
};
+class LineLaser:public Laser
+{
+protected:
+ double width;
+ vector2d a,b;
+ DWORD color;
+public:
+ void SetColl(bool col){EnableColl=col;}
+ void InitLine(vector2d _a,vector2d _b,double _w,DWORD _c)
+ {
+ a=_a;b=_b;color=_c;Init(2);
+ SetTexture(SprSheet,151,264,2,8);
+ SetWidth(_w);RenCtr=vector2d(0,0);
+ }
+ void SetWidth(double _w)
+ {
+ width=_w;
+ vector2d dir(a-b);dir.ToUnitCircle();
+ vector2d pd=dir;pd.Rotate(pi/2);
+ Setdata(0,a-width*pd,a+width*pd,color);
+ for(int i=1;i<MaxRes;++i)Setdata(i,b-width*pd,b+width*pd,color);
+ }
+ double GetWidth(){return width;}
+ //use Laser::Process...
+};
+class SimpLL:public LineLaser
+{
+public:
+ bool active;
+ int stp;
+ double brk;
+};