summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCHANGELOG.TXT11
-rw-r--r--global.h42
-rw-r--r--levels.h116
-rw-r--r--main.cpp37
-rw-r--r--menus.h4
-rw-r--r--scoresystem.h6
-rw-r--r--towernbullet.h44
7 files changed, 106 insertions, 154 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index c46e5b2..8b0cbe8 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -2,7 +2,7 @@
Next version:
0.7.3-0_PR
TODOs:
-Make multiplier function.
+Add MultPo's.
Test classic mode, difficulty adjustments. Merge code for Windows.
P.S.: Level 1 may be too hard now.
0.7.x-x_PR will be another public pre-release version.
@@ -13,8 +13,17 @@ New level "return to void". That's a 3 in 1 class. I used
particularly many "return(void)(...);" in this level (which I
always love to use).
This indicates all "normal" levels are completed.
+Multiplier system was fully adopted into BLR.
Fixed: Trypophobia stops if too many CLR's are used.
Fixed the problem in All2pnt().
+Make Laser::GetDist() private to avoid misusage.
+Remove unused statements:
+DWORD ColTrans(DWORD,DWORD,DWORD): replaced by
+DWORD ColorTransfer(DWORD,DWORD).
+void SaySomethingAndBye(char*): useless.
+void DirectBullet(Bullet&,double): this has been coexisted with
+the same method in the Bullet class for a long time. Now it's
+replaced by Bullet::setdir(double).
A Small bug in the Windows build is fixed.
File list in the Windows build is updated.
diff --git a/global.h b/global.h
index 9ffa13c..657b546 100644
--- a/global.h
+++ b/global.h
@@ -265,14 +265,13 @@ int frameskips=0,stepskips=0;
bool IfShowTip=false,FadeTip=false;
hgeFont *TipFont;
char lasttip[200];
-int p2t1,p2t2,p2t3,p2t4;
int whicnt,whrcnt,shots,clrusg;
bool yelattrib;
bool Complete=false;
-double linerad=0;
double bsscale;
long long score,scminus;
-int mult,multbrk,multbat;
+double mult,lsc;
+int multbrk,multbat;
int frms;double averfps;
int plrspd,plrslospd;
int TenSeconds=10000,TwentySeconds=20000,ThirtySeconds=30000,AMinute=60000;
@@ -407,43 +406,6 @@ void ClearAll(bool cbullet=true)
if (cbullet)All2pnt();
}
}
-void SaySomethingAndBye(char *text)
-{
- ClearAll();
- DisableAllTower=false;
- if (IfShowTip)
- {
- IfShowTip=false;
- FadeTip=false;
- Current_Position=2;
- ShowTip(text);
- return;
- }
- Current_Position=0;
- towcnt=bulcnt=0;
- memset(tower,0,sizeof(tower));
- memset(bullet,0,sizeof(bullet));
- gui->Enter();
-}
-DWORD ColTrans(DWORD src,DWORD dsr,DWORD speed)
-{
- DWORD sr=GETR(src),sg=GETG(src),sb=GETB(src);
- DWORD dr=GETR(dsr),dg=GETG(dsr),db=GETB(dsr);
- int times=1;if (LOWFPS)times=17;
- for (int i=1;i<=times;++i)
- {
- if (llabs(sr-dr)<speed)dr=sr;
- else
- sr-=(sr-dr)/llabs(sr-dr)*speed;
- if (llabs(sg-dg)<speed)dg=sg;
- else
- sg-=(sg-dg)/llabs(sg-dg)*speed;
- if (llabs(sb-db)<speed)db=sb;
- else
- sb-=(sb-db)/llabs(sb-db)*speed;
- }
- return ARGB(0xFF,sr,sg,sb);
-}
TextureRect GetTextureRect(int type,TColors color)
{
if (type==0)
diff --git a/levels.h b/levels.h
index 3c93499..b0813d1 100644
--- a/levels.h
+++ b/levels.h
@@ -82,15 +82,11 @@ void Level1Part2()
if (towers[tcnt-1]<-12)++roll;
for (int i=0;i<tcnt;++i)if (towers[i]<-12)towers[i]=612,dmt[i]=true;
if (roll==1)
- {
for (int i=1;i<=towcnt;++i)
if (tower[i].towertype==3)tower[i].t3t=5;
- }
if (roll==2)
- {
for (int i=1;i<=towcnt;++i)
if (tower[i].towertype==3)tower[i].t3t=0;
- }
if (roll==3&&!tendone)
{
for (int i=1;i<=towcnt;++i)
@@ -146,9 +142,7 @@ void Level1Part4()
if (labyred>=1500)CreateBullet6(rand()%800,rand()%600,2,0,1,12,true),labyred=0;
}
if (frameleft<=TenSeconds&&tower[1].towertimer>857)
- {
for (int i=1;i<=towcnt;++i)tower[i].towertimer=857;
- }
}
BCircle Level2Circle,Level2Circle2;
Bullet* fakes[12];
@@ -513,7 +507,7 @@ void Level3Part6()
if (l3p5brk>0.2)
{
l3p5brk=0;
- for (int i=1;i<=8;++i)DirectBullet(bullet[CreateBullet8(i*100-50,20,2,false)],-pi/2);
+ for (int i=1;i<=8;++i)bullet[CreateBullet8(i*100-50,20,2,false)].setdir(-pi/2);
}
}
void Level4Part0()
@@ -1826,7 +1820,7 @@ void Level6Part19()
for (int i=0;i<=beecnt;++i)
{
beewx[i]->bulletaccel=0.001;beewx[i]->limv=1;
- DirectBullet(*beewx[i],(double)(rand()%3140)/1000.0f);
+ beewx[i]->setdir((double)(rand()%3140)/1000.0f);
}
}
for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]);
@@ -1839,20 +1833,20 @@ void Level6Part19()
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],-5*pi/6);break;
- case 1:DirectBullet(bheader[i],-pi/2);break;
- case 2:DirectBullet(bheader[i],-pi/6);break;
- case 3:DirectBullet(bheader[i],-pi/2);break;
+ case 0:bheader[i].setdir(-5*pi/6);break;
+ case 1:bheader[i].setdir(-pi/2);break;
+ case 2:bheader[i].setdir(-pi/6);break;
+ case 3:bheader[i].setdir(-pi/2);break;
}
}
else
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],-pi/6);break;
- case 1:DirectBullet(bheader[i],-pi/2);break;
- case 2:DirectBullet(bheader[i],-5*pi/6);break;
- case 3:DirectBullet(bheader[i],-pi/2);break;
+ case 0:bheader[i].setdir(-pi/6);break;
+ case 1:bheader[i].setdir(-pi/2);break;
+ case 2:bheader[i].setdir(-5*pi/6);break;
+ case 3:bheader[i].setdir(-pi/2);break;
}
}
}
@@ -1890,7 +1884,7 @@ void Level6Part21()
for (int i=0;i<=beecnt;++i)
{
beewx[i]->bulletaccel=0.001;beewx[i]->limv=1;
- DirectBullet(*beewx[i],(double)(rand()%3140)/1000.0f);
+ beewx[i]->setdir((double)(rand()%3140)/1000.0f);
}
}
for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]);
@@ -1903,20 +1897,20 @@ void Level6Part21()
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],-5*pi/6);break;
- case 1:DirectBullet(bheader[i],-pi/2);break;
- case 2:DirectBullet(bheader[i],-pi/6);break;
- case 3:DirectBullet(bheader[i],-pi/2);break;
+ case 0:bheader[i].setdir(-5*pi/6);break;
+ case 1:bheader[i].setdir(-pi/2);break;
+ case 2:bheader[i].setdir(-pi/6);break;
+ case 3:bheader[i].setdir(-pi/2);break;
}
}
else
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],-pi/6);break;
- case 1:DirectBullet(bheader[i],-pi/2);break;
- case 2:DirectBullet(bheader[i],-5*pi/6);break;
- case 3:DirectBullet(bheader[i],-pi/2);break;
+ case 0:bheader[i].setdir(-pi/6);break;
+ case 1:bheader[i].setdir(-pi/2);break;
+ case 2:bheader[i].setdir(-5*pi/6);break;
+ case 3:bheader[i].setdir(-pi/2);break;
}
}
}
@@ -1954,7 +1948,7 @@ void Level6Part23()
for (int i=0;i<=beecnt;++i)
{
beewx[i]->bulletaccel=0.001;beewx[i]->limv=1;
- DirectBullet(*beewx[i],(double)(rand()%3140)/1000.0f);
+ beewx[i]->setdir((double)(rand()%3140)/1000.0f);
}
}
for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]);
@@ -1967,20 +1961,20 @@ void Level6Part23()
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],-5*pi/6);break;
- case 1:DirectBullet(bheader[i],-pi/2);break;
- case 2:DirectBullet(bheader[i],-pi/6);break;
- case 3:DirectBullet(bheader[i],-pi/2);break;
+ case 0:bheader[i].setdir(-5*pi/6);break;
+ case 1:bheader[i].setdir(-pi/2);break;
+ case 2:bheader[i].setdir(-pi/6);break;
+ case 3:bheader[i].setdir(-pi/2);break;
}
}
else
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],-pi/6);break;
- case 1:DirectBullet(bheader[i],-pi/2);break;
- case 2:DirectBullet(bheader[i],-5*pi/6);break;
- case 3:DirectBullet(bheader[i],-pi/2);break;
+ case 0:bheader[i].setdir(-pi/6);break;
+ case 1:bheader[i].setdir(-pi/2);break;
+ case 2:bheader[i].setdir(-5*pi/6);break;
+ case 3:bheader[i].setdir(-pi/2);break;
}
}
}
@@ -2018,7 +2012,7 @@ void Level6Part25()
for (int i=0;i<=beecnt;++i)
{
beewx[i]->bulletaccel=0.001;beewx[i]->limv=1;
- DirectBullet(*beewx[i],(double)(rand()%3140)/1000.0f);
+ beewx[i]->setdir((double)(rand()%3140)/1000.0f);
}
}
for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]);
@@ -2031,20 +2025,20 @@ void Level6Part25()
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],5*pi/6);break;
- case 1:DirectBullet(bheader[i],pi/2);break;
- case 2:DirectBullet(bheader[i],pi/6);break;
- case 3:DirectBullet(bheader[i],pi/2);break;
+ case 0:bheader[i].setdir(5*pi/6);break;
+ case 1:bheader[i].setdir(pi/2);break;
+ case 2:bheader[i].setdir(pi/6);break;
+ case 3:bheader[i].setdir(pi/2);break;
}
}
else
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],pi/6);break;
- case 1:DirectBullet(bheader[i],pi/2);break;
- case 2:DirectBullet(bheader[i],5*pi/6);break;
- case 3:DirectBullet(bheader[i],pi/2);break;
+ case 0:bheader[i].setdir(pi/6);break;
+ case 1:bheader[i].setdir(pi/2);break;
+ case 2:bheader[i].setdir(5*pi/6);break;
+ case 3:bheader[i].setdir(pi/2);break;
}
}
}
@@ -2082,7 +2076,7 @@ void Level6Part27()
for (int i=0;i<=beecnt;++i)
{
beewx[i]->bulletaccel=0.001;beewx[i]->limv=1;
- DirectBullet(*beewx[i],(double)(rand()%3140)/1000.0f);
+ beewx[i]->setdir((double)(rand()%3140)/1000.0f);
}
}
for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]);
@@ -2095,20 +2089,20 @@ void Level6Part27()
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],pi/3);break;
- case 1:DirectBullet(bheader[i],0);break;
- case 2:DirectBullet(bheader[i],5*pi/3);break;
- case 3:DirectBullet(bheader[i],0);break;
+ case 0:bheader[i].setdir(pi/3);break;
+ case 1:bheader[i].setdir(0);break;
+ case 2:bheader[i].setdir(5*pi/3);break;
+ case 3:bheader[i].setdir(0);break;
}
}
else
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],5*pi/3);break;
- case 1:DirectBullet(bheader[i],0);break;
- case 2:DirectBullet(bheader[i],pi/3);break;
- case 3:DirectBullet(bheader[i],0);break;
+ case 0:bheader[i].setdir(5*pi/3);break;
+ case 1:bheader[i].setdir(0);break;
+ case 2:bheader[i].setdir(pi/3);break;
+ case 3:bheader[i].setdir(0);break;
}
}
}
@@ -2146,7 +2140,7 @@ void Level6Part29()
for (int i=0;i<=beecnt;++i)
{
beewx[i]->bulletaccel=0.001;beewx[i]->limv=1;
- DirectBullet(*beewx[i],(double)(rand()%3140)/1000.0f);
+ beewx[i]->setdir((double)(rand()%3140)/1000.0f);
}
}
for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]);
@@ -2159,20 +2153,20 @@ void Level6Part29()
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],pi+pi/3);break;
- case 1:DirectBullet(bheader[i],pi);break;
- case 2:DirectBullet(bheader[i],pi+5*pi/3);break;
- case 3:DirectBullet(bheader[i],pi);break;
+ case 0:bheader[i].setdir(pi+pi/3);break;
+ case 1:bheader[i].setdir(pi);break;
+ case 2:bheader[i].setdir(pi+5*pi/3);break;
+ case 3:bheader[i].setdir(pi);break;
}
}
else
{
switch (seq)
{
- case 0:DirectBullet(bheader[i],pi+5*pi/3);break;
- case 1:DirectBullet(bheader[i],pi);break;
- case 2:DirectBullet(bheader[i],pi+pi/3);break;
- case 3:DirectBullet(bheader[i],pi);break;
+ case 0:bheader[i].setdir(pi+5*pi/3);break;
+ case 1:bheader[i].setdir(pi);break;
+ case 2:bheader[i].setdir(pi+pi/3);break;
+ case 3:bheader[i].setdir(pi);break;
}
}
}
diff --git a/main.cpp b/main.cpp
index 7bc75b3..ba9b5c5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -294,16 +294,17 @@ void ProcessPlayer()
}
void RefreshScore()
{
+ Mult_FrameFunc();
if (DisablePlayer)return;
- int multp=1;
- if (mode==2)multp=5;
+ mult+=0.01f*dsmc;
if (LOWFPS)
- score+=multp*16;
+ score+=16*mult;
else
- score+=multp;
- score+=100*shots;
- score-=scminus;
- score+=2000*dsmc;
+ score+=mult;
+ if(scminus){if(mult/2>0.1)mult/=2;else mult=0.5;}
+ score+=100*shots*mult;
+ score-=scminus*mult;
+ score+=2000*dsmc*mult;
++frms;
averfps=(averfps*(frms-1)+hge->Timer_GetFPS())/(double)frms;
}
@@ -573,9 +574,7 @@ bool FrameFunc()
if (bdiff.active())bdiff.Update();
if (LE_Active||Head){if (!Head)Tail=Head=new Leaf_Anim(),Head->init(990);Head->Process();}
shots=0;
- dsmc=0;
- scminus=0;
- Mult_FrameFunc();
+ dsmc=scminus=0;
Music_Update();
ProcessTower1();
ProcessTower2();
@@ -604,6 +603,7 @@ bool FrameFunc()
case 255:ProcessBullet255(i);break;
}
}
+ if (Current_Position==1)CallLevels();
ProcessPlayer();
RefreshScore();
{
@@ -612,8 +612,7 @@ bool FrameFunc()
{
if (BTarg.visible)BTarg.TargRender();
}
- if (!DisablePlayer)
- --frameleft;//If we are at the tip scene, disable the player movement.
+ if (!DisablePlayer)--frameleft;
if (!LOWFPS)
{
if (playerspeed<playerfulspd)playerspeed+=playerfulspd/400;
@@ -631,16 +630,8 @@ bool FrameFunc()
++part;
IfShowTip=true;
}
- if (Current_Position==1)
- {
- CallLevels();
- }
- if (shots)
- hge->Effect_Play(snd);
- if (Current_Position==2)
- {
- ShowTip(lasttip);
- }
+ if (shots)hge->Effect_Play(snd);
+ if (Current_Position==2)ShowTip(lasttip);
if (Current_Position==4)AboutScene();
if (Current_Position==5)DeathGUI->Render();
if (Current_Position==6)CompleteGUI->Render();
@@ -682,7 +673,7 @@ bool FrameFunc()
fnt->printf(5, 75, HGETEXT_LEFT, "Restarts: %d",restarts);
fnt->printf(5, 100, HGETEXT_LEFT, "Semi-Collisions: %d",semicoll);
fnt->printf(5, 125, HGETEXT_LEFT, "Clear Range Left: %d",clrtime+clrbns);
- fnt->printf(5, 150, HGETEXT_LEFT, "Multiplier: %d",mult);
+ fnt->printf(5, 150, HGETEXT_LEFT, "Multiplier: %.2lf",mult);
}
hge->Gfx_EndScene();
return false;
diff --git a/menus.h b/menus.h
index ee7e951..4932840 100644
--- a/menus.h
+++ b/menus.h
@@ -48,7 +48,7 @@ void StartGUI_FrameFnk()
score=0;Mult_Init();//Music_Init("./Resources/Music/CanonTechno.ogg");
lpst=4625568;lped=9234584;//Music_Play();
coll=semicoll=clrusg=0;playerLockX=playerLockY=false;
- Lock.Init(2);
+ Lock.Init(2);IfShowTip=true;lsc=0;
//Lock.SetTexture(SprSheet,151,264,2,8);
clrrad=pi/2;clrrange=0;
memset(tower,0,sizeof(tower));
@@ -100,7 +100,7 @@ void StartGUI_FrameFnk()
score=0;Mult_Init();//Music_Init("./Resources/Music/CanonTechno.ogg");
lpst=4625568;lped=9234584;//Music_Play();
coll=semicoll=clrusg=0;playerLockX=playerLockY=false;
- Lock.Init(2);
+ Lock.Init(2);IfShowTip=true;lsc=0;
//Lock.SetTexture(SprSheet,151,264,2,8);
clrrad=pi/2;clrrange=0;
memset(tower,0,sizeof(tower));
diff --git a/scoresystem.h b/scoresystem.h
index ba07d9e..afbeaac 100644
--- a/scoresystem.h
+++ b/scoresystem.h
@@ -13,7 +13,7 @@ HangUpText MT[255];
void NewMT()
{
int i=0;while (MT[i].Active())++i;
- char ttext[10];sprintf(ttext,"x%d",mult);
+ char ttext[10];sprintf(ttext,"x%.2lf",mult);
MT[i].Init("./Resources/charmap.fnt",ttext,1.0f,200,-50);
MT[i].Launch(vector2d(playerpos.x,playerpos.y-25));
}
@@ -104,10 +104,12 @@ void Mult_FrameFunc()
if (Current_Position!=1)return;
ProcessMT();ProcessMultpo();
--multbrk;
+ if(!dsmc)lsc+=hge->Timer_GetDelta();else lsc=0;
+ if(lsc>1&&mult>1.0f)mult-=hge->Timer_GetDelta()/20.0f;
if (multbrk<0)
{
multbrk=ThirtySeconds;
- mult+=multbat;
+ mult+=multbat;lsc=0;
NewMT();
if (multbat<5)++multbat;
}
diff --git a/towernbullet.h b/towernbullet.h
index 15899ac..38c55e4 100644
--- a/towernbullet.h
+++ b/towernbullet.h
@@ -8,12 +8,6 @@
#include "effects.h"
//static const char* TOWERNBULLET_H_FN="towernbullet.h";
-void DirectBullet(Bullet &a,double rad)
-{
- a.bulletdir.x=cos(rad);
- a.bulletdir.y=sin(rad);
- a.dist=1;
-}
void RenderAlter(vector2d p,TColors ca,TColors cb,double rot=0,double scl=1)
{
float x,y,w,h;
@@ -799,6 +793,7 @@ void ProcessBullet255(int i)
double dis=GetDist(bullet[i].bulletpos,playerpos);
if (dis<=6||bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800||bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600)
{
+ score+=mult*100;
bullet[i].exist=false;
bullet[i].bulletpos.x=bullet[i].bulletpos.y=0;
bullet[i].bulletdir.x=bullet[i].bulletdir.y=0;
@@ -1317,7 +1312,7 @@ void ProcessTower8()
if (Dis8ref)
{
if (tower[i].towerpos.y<300)
- DirectBullet(bullet[pnt],-pi/2);else DirectBullet(bullet[pnt],pi/2);
+ bullet[pnt].setdir(-pi/2);else bullet[pnt].setdir(pi/2);
}
if (tower[i].curshotcount==tower[i].shotcount)
tower[i].tdir=bullet[pnt].bulletdir;
@@ -1378,6 +1373,22 @@ private:
hgeDistortionMesh *graphic;
int Res;
vector2d data1[MaxRes],data2[MaxRes];
+ double GetDist()
+ {
+ double res=99999.9999f;
+ double tres=99999.9999f;
+ 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);
+ sa=data2[i]+RenCtr;sb=data2[i+1]+RenCtr;
+ if(GetDistSeg(sa,sb,playerpos)<tres)
+ tres=GetDistSeg(sa,sb,playerpos);
+ if (tres<res)res=tres;
+ }
+ return res;
+ }
public:
bool EnableColl;
vector2d RenCtr;
@@ -1431,23 +1442,6 @@ public:
graphic->SetColor(Res-1,0,color);graphic->SetColor(Res-1,1,color);
--Res;
}
- double GetDist()
- {
- double res=99999.9999f;
- double tres=99999.9999f;
- //Initalize: 999'99.9'999
- 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);
- sa=data2[i]+RenCtr;sb=data2[i+1]+RenCtr;
- if(GetDistSeg(sa,sb,playerpos)<tres)
- tres=GetDistSeg(sa,sb,playerpos);
- if (tres<res)res=tres;
- }
- return res;
- }
void Process()
{
Render();
@@ -1733,7 +1727,7 @@ public:
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;
+ for (int i=0;i<cnt;++i)Bul[i]=&bullet[CreateBullet8(400,300,0,false)],Bul[i]->setdir(srad),Bul[i]->scale=0.01;
Bul[0]->bulletspeed=2;Bul[0]->scale=1;
}
void stage0()