summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-03 23:28:31 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-03-03 23:28:31 +0000
commit4f062725e3d2d104a40432b341ae2345ade5cfca (patch)
tree02f4e52646c632a57551e68fa4309a9c8555e92b
parenta404f537e1f260040063b65461213800c896e15c (diff)
downloadbullet-lab-remix-4f062725e3d2d104a40432b341ae2345ade5cfca.tar.xz
Remove useless statements, and some interface-compatible changes.
-rwxr-xr-xCHANGELOG.TXT14
-rw-r--r--background.h17
-rw-r--r--effects.h26
-rw-r--r--global.h3
-rw-r--r--levels.h174
-rw-r--r--main.cpp20
-rw-r--r--scorec.h2
-rw-r--r--towernbullet.h87
8 files changed, 135 insertions, 208 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index dac52c6..1f26d2e 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -1,9 +1,8 @@
===================================================================
Next version:
-0.7.2-2_PR
+0.7.2-2_PR/0.7.3-0_PR
TODOs:
-Couple of tests, new levels, pre-release preparation, resource
-remaking.
+Couple of tests, new levels, pre-release preparation.
0.7.x-x_PR will be another public pre-release version.
Pre-Released versions:
@@ -14,11 +13,16 @@ Rewrote laser distance detection using vector2d calculations,
extending libcgh and bump its version at the same time.
Put the new level to the correct place.
Bring back "Minesweeper" level, adjust it to the new interfaces.
-Remake the credits page, it grows from 350KiB to 6MiB.
+Convert Bullet from struct to class.
+Other minor changes to the level WOP.
+Minor cleanups and code style adjustments. Add missing free's and
+delete's.
+Remake the credits page, it grows from 350KiB to 6MiB. (And so I'll
+enable PNG compression later.)
0.7.2-0_PR (b70)
I wasn't willing to bump the build number because I want the svn
-revision to chease the build number.
+revision to chase the build number.
However it wouldn't be appropriate to put three new levels into one
build...
The real changelog is here:
diff --git a/background.h b/background.h
index 728f005..18621e7 100644
--- a/background.h
+++ b/background.h
@@ -13,7 +13,7 @@ private:
DWORD alpha,alim;
bool onfadein,onfadeout;
int fadebreak;
- hgeSprite* BGSpr[6][6];
+ hgeSprite* BGSpr;
HTEXTURE LeafTex;
void DoFadeIn()
{
@@ -41,12 +41,8 @@ public:
void Init(DWORD limalpha)
{
LeafTex=hge->Texture_Load("./Resources/b_leaves.png");
- for (int i=0;i<6;++i)
- for (int j=0;j<6;++j)
- {
- BGSpr[i][j]=new hgeSprite(LeafTex,0,0,200,150);
- BGSpr[i][j]->SetColor(0x00CCCCCC);
- }
+ BGSpr=new hgeSprite(LeafTex,0,0,200,150);
+ BGSpr->SetColor(0x00CCCCCC);
onfadein=onfadeout=false;alpha=0x00;alim=limalpha;fadebreak=0;
}
@@ -69,10 +65,10 @@ public:
deltaBG+=dt;
tx=200*cosf(deltaBG/10);
ty=150*sinf(deltaBG/10);
+ BGSpr->SetColor(ARGB(alpha,0xCC,0xCC,0xCC));
for (int i=-1;i<5;++i)
for (int j=-1;j<5;++j)
- BGSpr[i+1][j+1]->SetColor(ARGB(alpha,0xCC,0xCC,0xCC)),
- BGSpr[i+1][j+1]->Render(i*199.0f+tx,j*149.0f+ty);
+ BGSpr->Render(i*199.0f+tx,j*149.0f+ty);
}
};
BG_Leaves Leaves;
@@ -99,7 +95,6 @@ public:
Leaf_Anim *Last,*Next;
void init(int _lim)
{
- //Leaf=new hgeSprite(letex,0,0,108,108);
Leaf=new hgeSprite(letex,letr.x,letr.y,letr.w,letr.h);
Leaf->SetColor(lecolor);
x=rand()%908-108;
@@ -123,7 +118,7 @@ public:
if (this->Last)
this->Last->Next=this->Next;
delete this->Leaf;
- delete this;//Not sure this will work?..--Answer: This worked...
+ delete this;
}
void Update()
{
diff --git a/effects.h b/effects.h
index 27054b0..ab63cbf 100644
--- a/effects.h
+++ b/effects.h
@@ -1,7 +1,6 @@
//Chrisoft Bullet Lab Remix HGE
//Effects Implementations
//Copyright Chrisoft 2014
-#define NO_FREE 1
//static const char* EFFECTS_H_FN="effects.h";
void SCEffect_Attatch()
@@ -20,43 +19,37 @@ void SCEffect_Attatch()
}
bullet[i].exist=true;
bullet[i].bullettype=254;
- bullet[i].bulletpos.x=playerpos.x;
- bullet[i].bulletpos.y=playerpos.y;
+ bullet[i].bulletpos.x=playerpos.x+3;
+ bullet[i].bulletpos.y=playerpos.y+3;
bullet[i].bulletdir.x=rand()%100-50;
bullet[i].bulletdir.y=rand()%100-50;
bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y;
bullet[i].dist=sqrt(bullet[i].dist);
bullet[i].bulletspeed=rand()%4+2;
- //bullet[i].bulletspr=new hgeSprite(SprSheet,96,0,24,24);
- //bullet[i].bulletspr->SetColor(0x80FFFFFF);
bullet[i].sccolor=0x80FFFFFF;
}
}
void SCEffect_Process(int i)
{
- //for (int i=1;i<=bulcnt;++i)
- //{
- if (!bullet[i].exist||bullet[i].bullettype!=254)return;//If this bullet doesn't exist or is not of this type, do not render it.
+ 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;//Process bullet's x coor.
- bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17;//Process bullet's y coor.
+ 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;//Process bullet's x coor.
- bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20;//Process bullet's y coor.
+ 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;
}
- //bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20;//Process bullet's x coor.
- //bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20;//Process bullet's y coor.
}
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)
{
@@ -65,17 +58,12 @@ void SCEffect_Process(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
{
- //bullet[i].bulletspr->RenderEx(bullet[i].bulletpos.x+2.4,bullet[i].bulletpos.y+2.4,0,0.2,0);
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 393b3bd..38bc94d 100644
--- a/global.h
+++ b/global.h
@@ -8,12 +8,10 @@
#define Resd 20.0f
HGE *hge=0;
HEFFECT snd;
-HTEXTURE tex;
hgeQuad quad;
hgeGUI *gui;
hgeFont *fnt;
hgeSprite *spr,*titlespr;
-//Here are some Varibles in Bullet Lab
int Current_Position;//Where we are now
/*Scenes:
0: main menu
@@ -126,7 +124,6 @@ public:
//255: Score point*/
struct Tower
{
- //hgeSprite *towerspr;//So will this one.
vector2d towerpos;
int towertype;
int towertimer,curtimer;
diff --git a/levels.h b/levels.h
index 1bf8b25..a06e4ba 100644
--- a/levels.h
+++ b/levels.h
@@ -16,11 +16,9 @@ Classic parts need only one procedure, like this.
ShowTip("");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
for (int i=1;i<=towcnt;++i)
if (tower[i].towerspr->GetColor()==0x80FFFFFF)
tower[i].towerspr->SetColor(0x00FFFFFF);
@@ -35,7 +33,7 @@ Classic parts need only one procedure, like this.
*/
/*
How to write an "advanced" part...
-"Advanced" parts usually need two parts, ont for initalize and one for things to do every frame.
+"Advanced" parts usually need two or more parts, ont for initalize and one for things to do every frame.
Write on your own thought...
*/
bool squashrev;
@@ -49,10 +47,7 @@ bool sout,tendone;bool dmt[16];
//static const char* LEVEL_H_FN="levels.h";
void Level1Part1()
{
- //Level procedure
- //Simple Level procedures should only run once during a level
if ((tower[CreateTower1(400,300,857,2)].RendColor>>24)>=0x80)IfCallLevel=false;
- //Current_Position=2;
frameleft=AMinute*2;
tcnt=1;sout=false;dscroll=-0.025f;memset(dmt,true,sizeof(dmt));
for (int i=0;i<tcnt;++i)
@@ -70,7 +65,6 @@ Everything going on properly?\n\
}
void Level1Part2()
{
- //Process the action here...
for (int i=0;i<tcnt;++i)
{
if (LOWFPS)towers[i]+=17*dscroll;else towers[i]+=dscroll;
@@ -124,12 +118,9 @@ void Level1Part3()
ShowTip("Double-directed Labyrinth!");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
- //CreateTower1(400,300,857,2);
for (int i=1;i<=25;++i)
CreateTower3(772,i*24-24,1714,2,2),
CreateTower3(28,i*24-12,1714,2,2);
@@ -211,20 +202,6 @@ void Level2Part1()
CreateTower3_fixeddir(183.49,425,300,3,-pi);
CreateTower3_fixeddir(183.49,424,300,3,2.0f/3.0f*pi);
for (int i=0;i<6;++i)fakes[i]=&bullet[CreateBullet6(400,300,0,999999999,1,1,false)];
- /*CreateTower1(30,10,500,3);
- CreateTower1(31,10,500,3,pi/16);
- CreateTower1(30,11,500,3,-pi/16);
- CreateTower1(746,10,500,3);
- CreateTower1(745,10,500,3,pi/16);
- CreateTower1(746,11,500,3,-pi/16);
- CreateTower1(30,556,500,3);
- CreateTower1(31,556,500,3,pi/16);
- CreateTower1(30,555,500,3,-pi/16);
- CreateTower1(746,556,500,3);
- CreateTower1(745,556,500,3,pi/16);
- CreateTower1(746,555,500,3,pi/16);*/
- //To prevent to be criticized... I made this much easier to play...
- //...But a lot harder to write...
++part;
}
void Level2Part2()
@@ -394,11 +371,9 @@ void Level3Part1()
ShowTip("Meet my new weapon...Is it cool?");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
CreateTower8(400,300,857,3,57,30,false);
for (int i=1;i<=towcnt;++i)
if (tower[i].RendColor==0x80FFFFFF)
@@ -426,11 +401,9 @@ void Level3Part2()
All2pnt();
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
CreateTower8(30,10,1250,3,57,15,false);
CreateTower8(746,10,1250,3,57,15,false);
CreateTower8(30,556,1250,3,57,15,false);
@@ -447,85 +420,7 @@ void Level3Part2()
return;
}
}
-#undef rad1
-#undef rad2
-class TRotateFucker
-{
-public:
- Bullet *Bul[32];
- double rad1,rad2,drad,srad,dtrad,dtrad2;
- double range,drange,dtrange,cdtrange;
- //cdtrange: dist to centre from the tail bullet
- //dtrange : dist limit of cdtrange
- //drange : disired range of rotate start
- //range : current movement range
- int stage,cnt,ccnt,delay,cf;
- double elasp;
- void init()
- {
- stage=0;rad1=rad2=srad;elasp=0.0f;ccnt=0;
- for (int i=0;i<cnt;++i)Bul[i]=&bullet[CreateBullet8(400,300,0,false)],DirectBullet(*Bul[i],srad),Bul[i]->scale=0.01;
- Bul[0]->bulletspeed=2;Bul[0]->scale=1;
- }
- void stage0()
- {
- elasp+=hge->Timer_GetDelta();
- if ((int)(elasp/0.15f)>ccnt&&ccnt<cnt-1)
- {
- ccnt=(int)(elasp/0.2f);
- if (ccnt==1)dtrange=GetDist(Bul[0]->bulletpos,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;i<cnt;++i)Bul[i]->bulletspeed=0;
- cf=0;
- }
- }
- void stage1()
- {
- cf+=(LOWFPS?17:1);
- rad1=srad+dtrad*cf;rad2=srad-dtrad2*cf;
- for (int i=0;i<cnt;++i)
- if (Bul[i]->bullettype==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;i<cnt;++i)
- if (Bul[i]->bullettype==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;
- }
- }
-}fr[6][6];
+TROF fr[6][6];
int cur;
double elasped;
void Level3Part3()
@@ -542,11 +437,9 @@ void Level3Part3()
ShowTip("Precise mode is not so precise as expected...");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
CreateTower8(400,300,999999999,0,999999999,0,false);
for (int i=1;i<=towcnt;++i)
if (tower[i].RendColor==0x80FFFFFF)
@@ -656,11 +549,9 @@ void Level4Part1()
ShowTip("Where is this idea from?");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
CreateTower9(400,300,1000,4,750,36,750);
for (int i=1;i<=towcnt;++i)
if (tower[i].RendColor==0x80FFFFFF)
@@ -1098,11 +989,9 @@ void Level4Part24()
...as the end of this level...\nCan you draw perfectly?");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
CreateTower4(400,300,2000,2.5);
CreateTower1(9,9,2000,3);
CreateTower1(767,11,2000,3);
@@ -1154,11 +1043,9 @@ void Level5Part1()
frameleft=ThirtySeconds;
if (towcnt!=2&&towcnt!=0)return ClearAll(false);
DisableAllTower=false;
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
CreateTower9(400,300,2000,3,1000,36,750);
CreateTower4(400,50,2000,2.5,0);
for (int i=1;i<=towcnt;++i)
@@ -1316,11 +1203,9 @@ void Level5Part7()
ShowTip("Threatening effect of high speed bullets");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
for (int i=1;i<=33;++i)CreateTower8(i*24-12,12,500,10,20,30);
for (int i=1;i<=towcnt;++i)
if (tower[i].RendColor==0x80FFFFFF)
@@ -1355,11 +1240,9 @@ void Level5Part9()
ShowTip("Do not panic!");
return;
}
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
for (int i=1;i<=33;++i)CreateTower8(i*24-12,12,750,1,1,1),CreateTower8(i*24-12,588,750,1,1,1);
for (int i=1;i<=towcnt;++i)
if (tower[i].RendColor==0x80FFFFFF)
@@ -1572,16 +1455,16 @@ void Level5Part20()
if (ntbrk<0.01)return;
ntbrk=0;++ntcnt;if (ntcnt>15)ntcnt=0;
int a;if (ntcnt==0)
- a=CreateBullet9(400+250*sin(ntrot),300+250*cos(ntrot),2,500,1,500);
+ a=CreateBullet9(400+250*sin(ntrot),300+250*cos(ntrot),2,500,1,500,true);
else
- a=CreateBullet9(400+250*sin(ntrot),300+250*cos(ntrot),2,999999999,1,999999999);
+ a=CreateBullet9(400+250*sin(ntrot),300+250*cos(ntrot),2,999999999,1,999999999,true);
bullet[a].redattrib=1;bullet[a].redir(vector2d(400,300));
bullet[a].bulletdir.x=-bullet[a].bulletdir.x;
bullet[a].bulletdir.y=-bullet[a].bulletdir.y;
if (ntcnt==0)
- a=CreateBullet9(400+250*sin(ntrot+pi),300+250*cos(ntrot+pi),2,500,1,500);
+ a=CreateBullet9(400+250*sin(ntrot+pi),300+250*cos(ntrot+pi),2,500,1,500,true);
else
- a=CreateBullet9(400+250*sin(ntrot+pi),300+250*cos(ntrot+pi),2,999999999,1,999999999);
+ a=CreateBullet9(400+250*sin(ntrot+pi),300+250*cos(ntrot+pi),2,999999999,1,999999999,true);
bullet[a].redattrib=1;bullet[a].redir(vector2d(400,300));
bullet[a].bulletdir.x=-bullet[a].bulletdir.x;
bullet[a].bulletdir.y=-bullet[a].bulletdir.y;
@@ -1633,11 +1516,9 @@ void Level6Part1()
//Some component of this level is in towernbullet...
frameleft=ThirtySeconds;
DisableAllTower=false;
- //Consider Low FPS mode here.
++frameskips;
if (frameskips<10&&!LOWFPS)return;
frameskips=0;
- //Create your towers
whicnt=10;
CreateTower7(400,300,750,3,500);
for (int i=1;i<=towcnt;++i)
@@ -2370,7 +2251,6 @@ Will there be a clearer day?\
frameleft=TenSeconds;++part;
}
}
-//change the color to dark grey. lightning.
bool skystp;
void Level7Part1()
{
@@ -2450,7 +2330,6 @@ void Level7Part2()
}
}
}
-//Add a background transform here...
void Level7Part3()
{
frameleft=TenSeconds;
@@ -2508,7 +2387,7 @@ void Level7Part5()
{
frameskips=0;
towcnt=0;
- CreateTower9(400,300,600,2,1500,72,1200);//Orange
+ CreateTower9(400,300,600,2,1500,72,1200);
}
}
if (tower[1].towertype==9)
@@ -2517,7 +2396,7 @@ void Level7Part5()
{
frameskips=0;
towcnt=0;
- CreateTower4(400,300,500,1,500);//Yellow
+ CreateTower4(400,300,500,1,500);
}
}
if (tower[1].towertype==4)
@@ -2526,7 +2405,7 @@ void Level7Part5()
{
frameskips=0;
towcnt=0;
- CreateTower1(400,300,50,4);//Green
+ CreateTower1(400,300,50,4);
}
}
if (tower[1].towertype==1)
@@ -2535,7 +2414,7 @@ void Level7Part5()
{
frameskips=0;
towcnt=0;
- CreateTower2(400,300,50,4);//Cyan
+ CreateTower2(400,300,50,4);
}
}
if (tower[1].towertype==2)
@@ -2544,7 +2423,7 @@ void Level7Part5()
{
frameskips=0;
towcnt=0;
- CreateTower8(400,300,500,5,20,50);//Blue
+ CreateTower8(400,300,500,5,20,50);
}
}
if (tower[1].towertype==8)
@@ -2554,7 +2433,7 @@ void Level7Part5()
{
frameskips=0;
towcnt=0;
- CreateTower5(400,300,50,5);//Purple
+ CreateTower5(400,300,50,5);
}
}
if (tower[1].towertype==5)
@@ -2563,7 +2442,7 @@ void Level7Part5()
{
frameskips=0;
towcnt=0;
- CreateTower6(400,300,600,2,1000,3,72);//Red
+ CreateTower6(400,300,600,2,1000,3,72);
}
}
}
@@ -2638,7 +2517,6 @@ void rainbowCreator(double rl,double rr,double rad,TColors col,double speed,bool
}
void Level7Part9()
{
- //(600,600)->(250,600)
if (sntang>-pi)
{
avacurbrk+=hge->Timer_GetDelta();
@@ -2662,31 +2540,24 @@ void Level7Part9()
{
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);
@@ -2838,7 +2709,6 @@ void Level7Part17()//Great circles-child1
{
frameleft=Infinity;
DTCircle+=hge->Timer_GetDelta();
- //Create New Circles here.
if (DTCircle>1&&CCnt<3)
{
Circles[2].Init(444,10*pi/50000.0f,12,vector2d(400,300));
@@ -2875,49 +2745,49 @@ void Level7Part17()//Great circles-child1
Circles[13].Init(444,-3*pi/50000.0f,96,vector2d(400,300));
CCnt=13;
}
- if (Circles[0].GetRange()>=50)//6
+ if (Circles[0].GetRange()>=50)
{
int times=1;if (LOWFPS)times=17;
for (int i=1;i<=times;++i)
Circles[0].SetRange(Circles[0].GetRange()-0.1),
Circles[1].SetRange(Circles[1].GetRange()-0.1);
}
- if (Circles[2].GetRange()>=100&&CCnt>=3)//12
+ if (Circles[2].GetRange()>=100&&CCnt>=3)
{
int times=1;if (LOWFPS)times=17;
for (int i=1;i<=times;++i)
Circles[2].SetRange(Circles[2].GetRange()-0.1),
Circles[3].SetRange(Circles[3].GetRange()-0.1);
}
- if (Circles[4].GetRange()>=150&&CCnt>=5)//18
+ if (Circles[4].GetRange()>=150&&CCnt>=5)
{
int times=1;if (LOWFPS)times=17;
for (int i=1;i<=times;++i)
Circles[4].SetRange(Circles[4].GetRange()-0.1),
Circles[5].SetRange(Circles[5].GetRange()-0.1);
}
- if (Circles[6].GetRange()>=210&&CCnt>=7)//27
+ if (Circles[6].GetRange()>=210&&CCnt>=7)
{
int times=1;if (LOWFPS)times=17;
for (int i=1;i<=times;++i)
Circles[6].SetRange(Circles[6].GetRange()-0.1),
Circles[7].SetRange(Circles[7].GetRange()-0.1);
}
- if (Circles[8].GetRange()>=270&&CCnt>=9)//45
+ if (Circles[8].GetRange()>=270&&CCnt>=9)
{
int times=1;if (LOWFPS)times=17;
for (int i=1;i<=times;++i)
Circles[8].SetRange(Circles[8].GetRange()-0.1),
Circles[9].SetRange(Circles[9].GetRange()-0.1);
}
- if (Circles[10].GetRange()>=320&&CCnt>=11)//60
+ if (Circles[10].GetRange()>=320&&CCnt>=11)
{
int times=1;if (LOWFPS)times=17;
for (int i=1;i<=times;++i)
Circles[10].SetRange(Circles[10].GetRange()-0.1),
Circles[11].SetRange(Circles[11].GetRange()-0.1);
}
- if (Circles[12].GetRange()>=420&&CCnt>=13)//96
+ if (Circles[12].GetRange()>=420&&CCnt>=13)
{
int times=1;if (LOWFPS)times=17;
for (int i=1;i<=times;++i)
@@ -3132,14 +3002,14 @@ void Level7Part26()
}
}
}
-void Level7Part27()//Minesweeper?-
+void Level7Part27()//Minesweeper
{
frameleft=AMinute;
if (bulcnt!=0)return (void)ClearAll();
Lasercnt=0;
++part;
}
-void Level7Part28()//Minesweeper?-child
+void Level7Part28()//Minesweeper-child
{
if (rand()%100>95)
{
diff --git a/main.cpp b/main.cpp
index 4541606..a297c67 100644
--- a/main.cpp
+++ b/main.cpp
@@ -61,7 +61,7 @@
#include "menus.h"
static const char* MAIN_SRC_FN="main.cpp";
#ifdef WIN32
-void Expand(char source[],char dist[])
+void Expand(const char *source,const char *dist)
{
char cmd[255];
sprintf(cmd,"%s -F:* %s",source,dist);
@@ -588,7 +588,6 @@ bool FrameFunc()
{
case 1:ProcessBullet1(i);break;
case 2:ProcessBullet2(i);break;
- //No ProcessBullet3() needed
case 4:ProcessBullet4(i);break;
case 5:ProcessBullet5(i);break;
case 6:ProcessBullet6(i);break;
@@ -771,11 +770,10 @@ int main()
playerspeed=playerfulspd=0.2;
playerslospeed=playerfulslospd=0.05;
#endif
- Current_Position=0;//We are at the main menu at first
+ Current_Position=0;
LE_Active=false;
if(hge->System_Initiate())
{
- //nonamecnt=1;
quad.tex=hge->Texture_Load("./Resources/b_null.png");
SprSheet=hge->Texture_Load("./Resources/ss.png");
TLeaf=hge->Texture_Load("./Resources/e_leaf.png");
@@ -786,7 +784,7 @@ int main()
snd=hge->Effect_Load("./Resources/tap.ogg");
titlespr=new hgeSprite(TexTitle,0,0,640,320);
playerspr=new hgeSprite(SprSheet,0,24,24,24);
- playerspr->SetHotSpot(12,12);//Set player anchor
+ playerspr->SetHotSpot(12,12);
playerspr->SetColor(0xC0FFFFFF);
ATarg.Init(-0.001,vector2d(400,300));
BTarg.Init(-0.001,vector2d(400,300));
@@ -840,10 +838,16 @@ int main()
delete gui;delete titlespr;
delete fnt;delete playerspr;
delete spr;
- hge->Texture_Free(tex);
- hge->Texture_Free(quad.tex);
+ for (int ii=0;ii<COLOR_COUNT;++ii)
+ {
+ TColors i=(TColors)ii;
+ delete bulletspr[i];
+ if(i<grey)delete towerspr[i];
+ }
+ hge->Texture_Free(SprSheet);hge->Texture_Free(TLeaf);
+ hge->Texture_Free(quad.tex);hge->Texture_Free(TSflake);
+ hge->Texture_Free(TexTitle);hge->Texture_Free(TexCredits);
}
- // Clean up and shutdown
hge->System_Shutdown();
hge->Release();
#ifdef WIN32
diff --git a/scorec.h b/scorec.h
index cc17f81..69d0cf0 100644
--- a/scorec.h
+++ b/scorec.h
@@ -18,7 +18,6 @@ unsigned int Getuint()
{
unsigned int c1,c2,c3,c4,res;
c1=c2=c3=c4=0;
- //scanf("%c%c%c%c",&c1,&c2,&c3,&c4);
c1=getchar();c2=getchar();c3=getchar();c4=getchar();
res=(c1<<24)+(c2<<16)+(c3<<8)+c4;
return res;
@@ -31,7 +30,6 @@ long long Getll()
{
long long c1,c2,c3,c4,c5,c6,c7,c8,res;
c1=c2=c3=c4=c5=c6=c7=c8=0;
- //scanf("%c%c%c%c%c%c%c%c",&c1,&c2,&c3,&c4,&c5,&c6,&c7,&c8);
c1=getchar();c2=getchar();c3=getchar();c4=getchar();
c5=getchar();c6=getchar();c7=getchar();c8=getchar();
res=(c1<<56)+(c2<<48)+(c3<<40)+(c4<<32)+(c5<<24)+(c6<<16)+(c7<<8)+c8;
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 (range1<r1lim)range1+=0.2*(1000.0/hge->Timer_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;i<cnt;++i)Bul[i]=&bullet[CreateBullet8(400,300,0,false)],DirectBullet(*Bul[i],srad),Bul[i]->scale=0.01;
+ Bul[0]->bulletspeed=2;Bul[0]->scale=1;
+ }
+ void stage0()
+ {
+ elasp+=hge->Timer_GetDelta();
+ if ((int)(elasp/0.15f)>ccnt&&ccnt<cnt-1)
+ {
+ ccnt=(int)(elasp/0.2f);
+ if (ccnt==1)dtrange=GetDist(Bul[0]->bulletpos,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;i<cnt;++i)Bul[i]->bulletspeed=0;
+ cf=0;
+ }
+ }
+ void stage1()
+ {
+ cf+=(LOWFPS?17:1);
+ rad1=srad+dtrad*cf;rad2=srad-dtrad2*cf;
+ for (int i=0;i<cnt;++i)
+ if (Bul[i]->bullettype==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;i<cnt;++i)
+ if (Bul[i]->bullettype==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);
}