aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-11 09:44:43 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-11 09:44:43 +0000
commitf4832349efdf06d8a1a410c636045f505efb52f1 (patch)
treef2958f0e6194a46aa890cfe03a09c737a8afdc20
parent285f4f3379a68db34eec86cdc5c8d6f3c5597f5e (diff)
downloadbullet-lab-remix-f4832349efdf06d8a1a410c636045f505efb52f1.tar.xz
Complete and fix Supernova, add several interfaces.
-rwxr-xr-xCHANGELOG.TXT1
-rw-r--r--effects.h56
-rw-r--r--global.h14
-rw-r--r--levels.h54
-rw-r--r--libcgh.h15
-rw-r--r--towernbullet.h2
6 files changed, 88 insertions, 54 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index 9ceecdf..87f6e7d 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -7,6 +7,7 @@ Add missing tips.
Pre-Released versions:
0.8.0-1_PR (b75)
New level Supernova.
+Extend libcgh again. Adding operator ^ and method l().
0.8.0-0_PR (b74)
New level Achromatopsia.
diff --git a/effects.h b/effects.h
index 1b3c246..02f0daa 100644
--- a/effects.h
+++ b/effects.h
@@ -32,39 +32,39 @@ void SCEffect_Attatch(vector2d Target=vector2d(-100,-100))
}
void SCEffect_Process(int i)
{
- if (!bullet[i].exist||bullet[i].bullettype!=254)return;
- if (!DisablePlayer)
- {
- if (LOWFPS)
- {
- bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17;
- bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17;
- ++effskp;
- if (effskp==7)
- bullet[i].sccolor=bullet[i].sccolor-0x1F000000,effskp=0;
- }
- else
- {
- bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20;
- bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20;
- ++effskp;
- if (effskp==7)
- bullet[i].sccolor=bullet[i].sccolor-0x1000000,effskp=0;
- }
- }
- if (GETA(bullet[i].sccolor)<=0x0A||bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800||bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600)
+ if (!bullet[i].exist||bullet[i].bullettype!=254)return;
+ if (!DisablePlayer)
+ {
+ if (LOWFPS)
{
- bullet[i].exist=false;
- bullet[i].bulletpos.x=bullet[i].bulletpos.y=0;
- bullet[i].bulletdir.x=bullet[i].bulletdir.y=0;
- bullet[i].dist=0;
- bullet[i].bullettype=0;
+ bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17;
+ bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17;
+ ++effskp;
+ if (effskp==7)
+ bullet[i].sccolor=bullet[i].sccolor-0x1F000000,effskp=0;
}
else
{
- bulletspr[grey]->SetColor(bullet[i].sccolor);
- bulletspr[grey]->RenderEx(bullet[i].bulletpos.x+2.4,bullet[i].bulletpos.y+2.4,0,0.2,0);
+ bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20;
+ bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20;
+ ++effskp;
+ if (effskp==7)
+ bullet[i].sccolor=bullet[i].sccolor-0x1000000,effskp=0;
}
+ }
+ if (GETA(bullet[i].sccolor)<=0x0A||bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800||bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600)
+ {
+ bullet[i].exist=false;
+ bullet[i].bulletpos.x=bullet[i].bulletpos.y=0;
+ bullet[i].bulletdir.x=bullet[i].bulletdir.y=0;
+ bullet[i].dist=0;
+ bullet[i].bullettype=0;
+ }
+ else
+ {
+ bulletspr[grey]->SetColor(bullet[i].sccolor);
+ bulletspr[grey]->RenderEx(bullet[i].bulletpos.x+2.4,bullet[i].bulletpos.y+2.4,0,0.2,0);
+ }
}
void BulletEffect_Attatch(int n)
{
diff --git a/global.h b/global.h
index 07e54d8..8515de7 100644
--- a/global.h
+++ b/global.h
@@ -105,7 +105,7 @@ public:
bulletdir.y=sin(rad);
dist=1;
}
-}bullet[10000];
+}bullet[20000];
/*Something about bullets:
//bullettype:
//1: player dir-based green bullet
@@ -209,12 +209,12 @@ struct Target//An annoying circle
void TargGoto(vector2d pos)
{
double curspd=0.01f;
- if (GetDist(pos,targpos)>1)curspd=0.02f;else targpos=pos;
- if (GetDist(pos,targpos)>2)curspd=0.1f;
- if (GetDist(pos,targpos)>5)curspd=0.5f;
- if (GetDist(pos,targpos)>10)curspd=0.75f;
- if (GetDist(pos,targpos)>20)curspd=1.0f;
- if (GetDist(pos,targpos)>30)curspd=2.0f;
+ if (GetDist(pos,targpos)>1)curspd=0.25f;else targpos=pos;
+ if (GetDist(pos,targpos)>2)curspd=0.5f;
+ if (GetDist(pos,targpos)>5)curspd=1.0f;
+ if (GetDist(pos,targpos)>10)curspd=2.0f;
+ if (GetDist(pos,targpos)>20)curspd=3.0f;
+ if (GetDist(pos,targpos)>30)curspd=4.0f;
if (GetDist(pos,targpos)>40)curspd=5.0f;
targdir.x=targpos.x-pos.x;
targdir.y=targpos.y-pos.y;
diff --git a/levels.h b/levels.h
index cb98b8e..ad4ec17 100644
--- a/levels.h
+++ b/levels.h
@@ -3191,28 +3191,59 @@ void Levelm1Part12()
vector2d snextarg;
int snexcnt,snexstep;
Target snexTarg;
-void Levelm1Part13()//Additive blending
+void Levelm1Part13()//"Supernova"
{
- frameleft=AMinute*2;
+ frameleft=AMinute*2;PlayerSplit=false;
++bgbrk;if (LOWFPS)bgbrk+=16;
if (bgbrk<30)return;
- bgbrk=0;
+ bgbrk=0;towcnt=0;
if (!LOWFPS)
DBGColor=ColorTransfer(DBGColor,0xFF000000);
else
for (int i=1;i<=17;++i)DBGColor=ColorTransfer(DBGColor,0xFF000000);
if (DBGColor==0xFF000000)
{
- frameleft=AMinute,++part;
- bgdbbrk=re.NextInt(5,20),bgbrk=0;
- avabrk=2.0f;avacurbrk=0;snexTarg.Init(0.001,vector2d(400,300));
+ snexTarg.Init(0.001,vector2d(400,300));
+ ++part;avabrk=12.0f;avacurbrk=0;tbrk=0;
snexstep=0;snexcnt=10;snexTarg.TargShow();
}
}
+void snCircCreator(vector2d p,int cnt,TColors col,bool mode)
+{
+ if(mode)
+ for (int i=0;i<cnt;++i)
+ {
+ int pnt=CreateBullet2(p.x,p.y,6,acos((vector2d(400,300)-playerpos)^vector2d(1,0))+(i-0.5f)*(2*pi/cnt));
+ bullet[pnt].alterColor=col;bullet[pnt].addblend=true;
+ }
+ else
+ for (int i=0;i<cnt;++i)
+ {
+ int pnt=CreateBullet2(p.x,p.y,2,acos((vector2d(400,300)-playerpos)^vector2d(1,0))+i*(2*pi/cnt));
+ bullet[pnt].alterColor=col;bullet[pnt].addblend=true;
+ }
+}
void Levelm1Part14()
{
snexTarg.TargRender();
avacurbrk+=hge->Timer_GetDelta();
+ tbrk+=hge->Timer_GetDelta();
+ if((AMinute*2-frameleft)<TenSeconds)
+ {
+ if(tbrk>0.016)
+ {
+ tbrk=0;
+ snCircCreator(vector2d(400,300),60,(TColors)re.NextInt(0,7),true);
+ }
+ }
+ else
+ {
+ if(tbrk>0.5)
+ {
+ tbrk=0;
+ snCircCreator(vector2d(400,300),27,(TColors)re.NextInt(0,7),false);
+ }
+ }
switch (snexstep)
{
case 0:
@@ -3223,9 +3254,9 @@ void Levelm1Part14()
if(GetDist(snexTarg.targpos,snextarg)<0.01)
{
snexstep=2;
- avabrk=0;
- avacurbrk=0.05;
- snexcnt=100-(frameleft/(double)(AMinute*2))*50;
+ avabrk=(frameleft/(double)(AMinute*2))*0.01666+0.01667;
+ avacurbrk=0;
+ snexcnt=40-(frameleft/(double)(AMinute*2))*20;
}
break;
case 2:
@@ -3233,10 +3264,11 @@ void Levelm1Part14()
{
if(--snexcnt>0)
{
- avabrk=0;
+ avacurbrk=0;
+ for(int i=0;i<10;++i)
bullet[CreateBullet2(snexTarg.targpos.x,snexTarg.targpos.y,2,re.NextDouble(-pi,pi),true)].addblend=true;
}
- else snexstep=0,avabrk=2,avacurbrk=0;
+ else snexstep=0,avabrk=(frameleft/(double)(AMinute*2))*1+1.5f,avacurbrk=0;
}
break;
}
diff --git a/libcgh.h b/libcgh.h
index 3140946..1ca7d4a 100644
--- a/libcgh.h
+++ b/libcgh.h
@@ -1,7 +1,7 @@
//Chrisoft Bullet Lab Remix HGE
//Chrisoft Game Helper header
//Copyright Chrisoft 2014
-//libcgh version 0006
+//libcgh version 0007
//Last full compatible version 0002
//^Modify that when big change is made^
#include <hge.h>
@@ -20,13 +20,10 @@ struct vector2d
double x,y;
vector2d(double _x,double _y){x=_x;y=_y;}
vector2d(){x=y=0;}
- void ToUnitCircle()
- {
- double l=sqrt(sqr(x)+sqr(y));
- x/=l;y/=l;
- }
+ double l(){return sqrt(sqr(x)+sqr(y));}
+ void ToUnitCircle(){double len=l();x/=len;y/=len;}
void Swap(){double t=x;x=y;y=t;}
- void rotate(double rad){double tx=x*cos(rad)+y*sin(rad),ty=y*cos(rad)-x*sin(rad);x=tx,y=ty;}
+ void Rotate(double rad){double tx=x*cos(rad)+y*sin(rad),ty=y*cos(rad)-x*sin(rad);x=tx,y=ty;}
friend vector2d operator -(vector2d a,vector2d b)
{
return vector2d(a.x-b.x,a.y-b.y);
@@ -47,6 +44,10 @@ struct vector2d
{
return vector2d(b.x*a,b.y*a);
}
+ friend double operator ^(vector2d a,vector2d b)//cosine of angle
+ {
+ return (a|b)/a.l()/b.l();
+ }
};
inline vector2d ToUnitCircle(vector2d input)
{
diff --git a/towernbullet.h b/towernbullet.h
index 8106dc8..8d0969c 100644
--- a/towernbullet.h
+++ b/towernbullet.h
@@ -1474,7 +1474,7 @@ void ProcessTower8()
int pnt=CreateBullet8(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].effect);
bullet[pnt].alterColor=white;
bullet[pnt].redir(BTarg.targpos);
- bullet[pnt].bulletdir.rotate(j*2*pi/5);
+ bullet[pnt].bulletdir.Rotate(j*2*pi/5);
}
}
tower[i].curtimer2=tower[i].towertimer2;