diff options
author | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-05-25 03:54:56 +0000 |
---|---|---|
committer | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-05-25 03:54:56 +0000 |
commit | d747c360427071a329bed01b1fb33aab6b87c568 (patch) | |
tree | c9bef1b080cf7eeaca86610a9c2dfe7966f0b7ed | |
parent | 63832a6bea48ad70b3507ee2d39036b81243d567 (diff) | |
download | bullet-lab-remix-d747c360427071a329bed01b1fb33aab6b87c568.tar.xz |
Content freeze -- nothing will be added or removed any more (music etc excluded).
Fix build failure in Archlinux.
Fix font issue in Archlinux.
realloc may change the base address... That's the cause of the crashes...
--now removing all Bullet* based implementations.
Affected parts:
Assessment: Constant patterns, pinball
All parts in level 2.
L4P2, and more
L5P5~6
L-1P17
L-1P19
L3P3
L7P12
L7P14
L7P25
Avoid memory leaks... I don't know if they have been really fixed...
-rwxr-xr-x | ChangeLog | 23 | ||||
-rwxr-xr-x | VERSION | 2 | ||||
-rw-r--r-- | global.h | 5 | ||||
-rw-r--r-- | levels.h | 244 | ||||
-rw-r--r-- | main.cpp | 7 | ||||
-rw-r--r-- | towernbullet.h | 224 |
6 files changed, 265 insertions, 240 deletions
@@ -12,13 +12,34 @@ One part of Level 3 fails randomly (really randomly?). Wishlist: Make more data stored in score.cfg. -Replace some boring levels. In-game music bring back. ~~Now Playing(Music Room)~~ ~~BLR script virtual machine~~(long long-term! probably the core of next BLR.) Pre-Released versions: +0.9.1-3 (r92) +I installed Archlinux alongside Debian recently. Now we officially support +Archlinux and Debian. +--------------------------------------------------------------------------------- +Content freeze -- nothing will be added or removed any more (music etc excluded). +Fix build failure in Archlinux. +Fix font issue in Archlinux. +realloc may change the base address... That's the cause of the crashes... +--now removing all Bullet* based implementations. +Affected parts: +Assessment: Constant patterns, pinball +All parts in level 2. +L4P2, and more +L5P5~6 +L-1P17 +L-1P19 +L3P3 +L7P12 +L7P14 +L7P25 +Avoid memory leaks... I don't know if they have been really fixed... + 0.9.1-2 (r91) Add built-in help. Now the pause menu should be fixed... @@ -1 +1 @@ -0.9.1-2 (r91)
\ No newline at end of file +0.9.1-3 (r92)
\ No newline at end of file @@ -313,7 +313,7 @@ fFristStartUp,fFast; int startLvl,startPrt,fFullScreen; char alterLog[64]; #ifdef WIN32 -static const int arFilecount=22; +static const int arFilecount=23; static const char* archive[]={ "./Resources/b_diff.png", "./Resources/b_inter.png", @@ -325,6 +325,7 @@ static const char* archive[]={ "./Resources/vdig.fnt", "./Resources/bdig.fnt", "./Resources/ss.png", +"./Resources/help.png", "./Resources/menus.png", "./Resources/title.png", "./Resources/credits.png", @@ -340,7 +341,7 @@ static const char* archive[]={ }; #endif //static const char* GLOBAL_H_FN="global.h"; -static const char* BLRVERSION="0.9.1-2 (r91)"; +static const char* BLRVERSION="0.9.1-3 (r92)"; static const char *months="JanFebMarAprMayJunJulAugSepOctNovDec"; char *parseDate(const char *date) { @@ -111,7 +111,7 @@ void Level1Part3() { frameleft=AMinute; if (towcnt!=50&&towcnt!=0)return ClearAll(); - DisableAllTower=false;bulcnt=0;free(bullet); + DisableAllTower=false;bulcnt=0;free(bullet);bullet=NULL; if (IfShowTip) { IfShowTip=false; @@ -150,7 +150,7 @@ void Level1Part4() for (int i=1;i<=towcnt;++i)tower[i].towertimer=857; } BCircle Level2Circle,Level2Circle2; -Bullet* fakes[12]; +int fakes[12]; double L2D; void Level2Part0() { @@ -160,7 +160,7 @@ void Level2Part0() ClearAll(); return; } - bulcnt=0;free(bullet); + bulcnt=0;free(bullet);bullet=NULL; DisableAllTower=false; if (IfShowTip) { @@ -201,7 +201,7 @@ 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)],fakes[i]->inv=true; + for (int i=0;i<6;++i)fakes[i]=CreateBullet6(400,300,0,999999999,1,1,false),bullet[fakes[i]].inv=true; ++part; } void Level2Part2() @@ -212,7 +212,7 @@ void Level2Part2() double base=Level2Circle.GetRad(); double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; for (int i=0;i<6;++i) - fakes[i]->bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)); + bullet[fakes[i]].bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)); if (L2D>=1.5) { L2D=0; @@ -224,8 +224,8 @@ void Level2Part2() void Level2Part3() { frameleft=AMinute; - for (int i=0;i<6;++i)fakes[i]->exist=false; - for (int i=0;i<6;++i)fakes[i]=&bullet[CreateBullet7(400,300,0,999999999,false)],fakes[i]->inv=true; + for (int i=0;i<6;++i)bullet[fakes[i]].exist=false; + for (int i=0;i<6;++i)fakes[i]=CreateBullet7(400,300,0,999999999,false),bullet[fakes[i]].inv=true; whicnt=3;clockrot=deltarot=0;++part; } void Level2Part4() @@ -236,7 +236,7 @@ void Level2Part4() double base=Level2Circle.GetRad(); double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; for (int i=0;i<6;++i) - fakes[i]->bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)); + bullet[fakes[i]].bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)); if (L2D>=5) { L2D=0; @@ -267,7 +267,7 @@ void Level2Part6() double base=Level2Circle.GetRad(); double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; for (int i=0;i<6;++i) - fakes[i]->bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)),fakes[i]->inv=true; + bullet[fakes[i]].bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)),bullet[fakes[i]].inv=true; if (L2D>=5) { L2D=0; @@ -286,7 +286,7 @@ void Level2Part7() double base=Level2Circle.GetRad(); double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; for (int i=0;i<6;++i) - fakes[i]->bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)),fakes[i]->inv=true; + bullet[fakes[i]].bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)),bullet[fakes[i]].inv=true; if (L2D>=5) { L2D=0; @@ -300,7 +300,7 @@ void Level2Part8() { frameleft=ThirtySeconds;L2D1=0; playerLockY=false; - for (int i=6;i<12;++i)fakes[i]=&bullet[CreateBullet6(400,300,0,999999999,1,1,false)],fakes[i]->inv=true; + for (int i=6;i<12;++i)fakes[i]=CreateBullet6(400,300,0,999999999,1,1,false),bullet[fakes[i]].inv=true; ++part; } void Level2Part9() @@ -313,9 +313,9 @@ void Level2Part9() double base2=Level2Circle2.GetRad(); double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; for (int i=0;i<6;++i) - fakes[i]->bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)); + bullet[fakes[i]].bulletpos=vector2d(400+r*cos(base+i*pi/3.0f),300+r*sin(base+i*pi/3.0f)); for (int i=6;i<12;++i) - fakes[i]->bulletpos=vector2d(400+r*cos(base2+i*pi/3.0f),300+r*sin(base2+i*pi/3.0f)); + bullet[fakes[i]].bulletpos=vector2d(400+r*cos(base2+i*pi/3.0f),300+r*sin(base2+i*pi/3.0f)); if (L2D1>=2) { L2D1=0; @@ -339,7 +339,7 @@ void Level3Part0() ClearAll(); return; } - bulcnt=0;free(bullet); + bulcnt=0;free(bullet);bullet=NULL; DisableAllTower=false; if (IfShowTip) { @@ -565,7 +565,7 @@ void Level4Part1() return; } } -Bullet* redirs[400];int cred; +int redirs[400];int cred; void Level4Part2() { frameleft=TenSeconds/2;clrtime=0; @@ -598,19 +598,19 @@ void Level4Part3() if (posx<766) { posx+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else { if (posy<566) { posy+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -633,19 +633,19 @@ void Level4Part5() if (posx2>10) { posx2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else { if (posy2>10) { posy2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -669,19 +669,19 @@ void Level4Part7() if (posx<766) { posx+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else { if (posy<566) { posy+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -704,19 +704,19 @@ void Level4Part9() if (posx2>10) { posx2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else { if (posy2>10) { posy2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -740,19 +740,19 @@ void Level4Part11() if (posx<766) { posx+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else { if (posy<566) { posy+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -775,19 +775,19 @@ void Level4Part13() if (posx2>10) { posx2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else { if (posy2>10) { posy2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -811,19 +811,19 @@ void Level4Part15() if (posx<766) { posx+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else { if (posy<566) { posy+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -846,19 +846,19 @@ void Level4Part17() if (posx2>10) { posx2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else { if (posy2>10) { posy2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -881,31 +881,31 @@ void Level4Part19() if (posx2>10) { posx2-=24; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else { if (posy2>10) { posy2-=24; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=2,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=2,doneredir=true; } if (posx<766) { posx+=24; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } else { if (posy<566) { posy+=24; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); } } @@ -1158,7 +1158,7 @@ void Level5Part4() laser[i].EnableColl=false; } } -Bullet* tbuls[1000];double lv5brk; +int tbuls[1000];double lv5brk; void Level5Part5() { frameleft=AMinute;All2pnt();towcnt=0;Lasercnt=0; @@ -1173,22 +1173,22 @@ void Level5Part6() for (int j=0;j<1000;++j) if (!tbuls[j]) { - tbuls[j]=&bullet[CreateBullet2(i*80,570,3,0.5*pi)]; + tbuls[j]=CreateBullet2(i*80,570,3,0.5*pi); break; } for (int j=0;j<1000;++j) - if (tbuls[j]&&tbuls[j]->bulletpos.y<150) + if (tbuls[j]&&bullet[tbuls[j]].bulletpos.y<150) { if (re.NextInt(1,1000)>=800) { if (re.NextInt(1,1000)>=500) - CreateBullet6(tbuls[j]->bulletpos.x,tbuls[j]->bulletpos.y,3,200,1,18); + CreateBullet6(bullet[tbuls[j]].bulletpos.x,bullet[tbuls[j]].bulletpos.y,3,200,1,18); else if (re.NextInt(1,1000)>=850) - CreateBullet9(tbuls[j]->bulletpos.x,tbuls[j]->bulletpos.y,3,500,18,300); + CreateBullet9(bullet[tbuls[j]].bulletpos.x,bullet[tbuls[j]].bulletpos.y,3,500,18,300); } - tbuls[j]->exist=false; - tbuls[j]=NULL; + bullet[tbuls[j]].exist=false; + tbuls[j]=0; } } double tbrk; @@ -1302,21 +1302,21 @@ void Level5Part12() if (posx<766) { posx+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999); } else { if (posy<566) { posy+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<=cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -1339,21 +1339,21 @@ void Level5Part14() if (posx2>10) { posx2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999); } else { if (posy2>10) { posy2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<=cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -1372,23 +1372,23 @@ void Level5Part16() if (posx<766) { posx+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx-400)*0.9+400,(posy-300)*0.9+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx-400)*0.9+400,(posy-300)*0.9+300,0,999999,1,999999); } else { if (posy<566) { posy+=12; - redirs[++cred]=&bullet[CreateBullet9(posx,posy,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx-400)*0.9+400,(posy-300)*0.9+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx-400)*0.95+400,(posy-300)*0.95+300,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx-400)*0.9+400,(posy-300)*0.9+300,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<=cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -1411,23 +1411,23 @@ void Level5Part18() if (posx2>10) { posx2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx2-400)*0.9+400,(posy2-300)*0.9+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx2-400)*0.9+400,(posy2-300)*0.9+300,0,999999,1,999999); } else { if (posy2>10) { posy2-=12; - redirs[++cred]=&bullet[CreateBullet9(posx2,posy2,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999)]; - redirs[++cred]=&bullet[CreateBullet9((posx2-400)*0.9+400,(posy2-300)*0.9+300,0,999999,1,999999)]; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx2-400)*0.95+400,(posy2-300)*0.95+300,0,999999,1,999999); + redirs[++cred]=CreateBullet9((posx2-400)*0.9+400,(posy2-300)*0.9+300,0,999999,1,999999); } else if (!doneredir) for (int i=0;i<=cred;++i) - redirs[i]->redir(ATarg.targpos),redirs[i]->bulletspeed=4,doneredir=true; + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; } } } @@ -3321,17 +3321,17 @@ void Levelm1Part16() for(int i=0;i<100;++i)if(fyg[i].isActive())fyg[i].Update(); fygs.Update(pi/7200*(0.5+frameleft/(double)(AMinute+ThirtySeconds))); } -Bullet* m17lead[4]; +int m17lead[4]; void Levelm1Part17() { frameleft=AMinute+ThirtySeconds;towcnt=0; All2pnt();memset(m17lead,0,sizeof(m17lead)); ++part; - m17lead[0]=&bullet[CreateBullet2(10,10,4,0)];m17lead[0]->redir(vector2d(780,10));m17lead[0]->alterColor=red; - m17lead[1]=&bullet[CreateBullet2(780,10,4,0)];m17lead[1]->redir(vector2d(780,580));m17lead[1]->alterColor=green; - m17lead[2]=&bullet[CreateBullet2(780,580,4,0)];m17lead[2]->redir(vector2d(10,580));m17lead[2]->alterColor=dblue; - m17lead[3]=&bullet[CreateBullet2(10,580,4,0)];m17lead[3]->redir(vector2d(10,10));m17lead[3]->alterColor=white; - for(int i=0;i<4;++i)m17lead[i]->inv=true;snexTarg.Init(0.001,vector2d(400,300)); + m17lead[0]=CreateBullet2(10,10,4,0);bullet[m17lead[0]].redir(vector2d(780,10));bullet[m17lead[0]].alterColor=red; + m17lead[1]=CreateBullet2(780,10,4,0);bullet[m17lead[1]].redir(vector2d(780,580));bullet[m17lead[1]].alterColor=green; + m17lead[2]=CreateBullet2(780,580,4,0);bullet[m17lead[2]].redir(vector2d(10,580));bullet[m17lead[2]].alterColor=dblue; + m17lead[3]=CreateBullet2(10,580,4,0);bullet[m17lead[3]].redir(vector2d(10,10));bullet[m17lead[3]].alterColor=white; + for(int i=0;i<4;++i)bullet[m17lead[i]].inv=true;snexTarg.Init(0.001,vector2d(400,300)); snexstep=0;snexTarg.TargShow();avabrk=5.0f;avacurbrk=0;tbrk=0; } void Levelm1Part18() @@ -3353,30 +3353,30 @@ void Levelm1Part18() } break; } - if(m17lead[0]->bulletpos.x>780.01f)m17lead[0]->bulletpos=vector2d(780,10),m17lead[0]->redir(vector2d(780,580)); - if(m17lead[0]->bulletpos.y>580.01f)m17lead[0]->bulletpos=vector2d(780,580),m17lead[0]->redir(vector2d(10,580)); - if(m17lead[0]->bulletpos.x<9.99f)m17lead[0]->bulletpos=vector2d(10,580),m17lead[0]->redir(vector2d(10,10)); - if(m17lead[0]->bulletpos.y<9.99f)m17lead[0]->bulletpos=vector2d(10,10),m17lead[0]->redir(vector2d(780,10)); + if(bullet[m17lead[0]].bulletpos.x>780.01f)bullet[m17lead[0]].bulletpos=vector2d(780,10),bullet[m17lead[0]].redir(vector2d(780,580)); + if(bullet[m17lead[0]].bulletpos.y>580.01f)bullet[m17lead[0]].bulletpos=vector2d(780,580),bullet[m17lead[0]].redir(vector2d(10,580)); + if(bullet[m17lead[0]].bulletpos.x<9.99f)bullet[m17lead[0]].bulletpos=vector2d(10,580),bullet[m17lead[0]].redir(vector2d(10,10)); + if(bullet[m17lead[0]].bulletpos.y<9.99f)bullet[m17lead[0]].bulletpos=vector2d(10,10),bullet[m17lead[0]].redir(vector2d(780,10)); - if(m17lead[1]->bulletpos.x>780.01)m17lead[1]->bulletpos=vector2d(780,10),m17lead[1]->redir(vector2d(780,580)); - if(m17lead[1]->bulletpos.y>580.01f)m17lead[1]->bulletpos=vector2d(780,580),m17lead[1]->redir(vector2d(10,580)); - if(m17lead[1]->bulletpos.x<9.99f)m17lead[1]->bulletpos=vector2d(10,580),m17lead[1]->redir(vector2d(10,10)); - if(m17lead[1]->bulletpos.y<9.99f)m17lead[1]->bulletpos=vector2d(10,10),m17lead[1]->redir(vector2d(780,10)); + if(bullet[m17lead[1]].bulletpos.x>780.01)bullet[m17lead[1]].bulletpos=vector2d(780,10),bullet[m17lead[1]].redir(vector2d(780,580)); + if(bullet[m17lead[1]].bulletpos.y>580.01f)bullet[m17lead[1]].bulletpos=vector2d(780,580),bullet[m17lead[1]].redir(vector2d(10,580)); + if(bullet[m17lead[1]].bulletpos.x<9.99f)bullet[m17lead[1]].bulletpos=vector2d(10,580),bullet[m17lead[1]].redir(vector2d(10,10)); + if(bullet[m17lead[1]].bulletpos.y<9.99f)bullet[m17lead[1]].bulletpos=vector2d(10,10),bullet[m17lead[1]].redir(vector2d(780,10)); - if(m17lead[2]->bulletpos.x>780.01f)m17lead[2]->bulletpos=vector2d(780,10),m17lead[2]->redir(vector2d(780,580)); - if(m17lead[2]->bulletpos.y>580.01f)m17lead[2]->bulletpos=vector2d(780,580),m17lead[2]->redir(vector2d(10,580)); - if(m17lead[2]->bulletpos.x<9.99f)m17lead[2]->bulletpos=vector2d(10,580),m17lead[2]->redir(vector2d(10,10)); - if(m17lead[2]->bulletpos.y<9.99f)m17lead[2]->bulletpos=vector2d(10,10),m17lead[2]->redir(vector2d(780,10)); + if(bullet[m17lead[2]].bulletpos.x>780.01f)bullet[m17lead[2]].bulletpos=vector2d(780,10),bullet[m17lead[2]].redir(vector2d(780,580)); + if(bullet[m17lead[2]].bulletpos.y>580.01f)bullet[m17lead[2]].bulletpos=vector2d(780,580),bullet[m17lead[2]].redir(vector2d(10,580)); + if(bullet[m17lead[2]].bulletpos.x<9.99f)bullet[m17lead[2]].bulletpos=vector2d(10,580),bullet[m17lead[2]].redir(vector2d(10,10)); + if(bullet[m17lead[2]].bulletpos.y<9.99f)bullet[m17lead[2]].bulletpos=vector2d(10,10),bullet[m17lead[2]].redir(vector2d(780,10)); - if(m17lead[3]->bulletpos.x>780.01f)m17lead[3]->bulletpos=vector2d(780,10),m17lead[3]->redir(vector2d(780,580)); - if(m17lead[3]->bulletpos.y>580.01f)m17lead[3]->bulletpos=vector2d(780,580),m17lead[3]->redir(vector2d(10,580)); - if(m17lead[3]->bulletpos.x<9.99f)m17lead[3]->bulletpos=vector2d(10,580),m17lead[3]->redir(vector2d(10,10)); - if(m17lead[3]->bulletpos.y<9.99f)m17lead[3]->bulletpos=vector2d(10,10),m17lead[3]->redir(vector2d(780,10)); + if(bullet[m17lead[3]].bulletpos.x>780.01f)bullet[m17lead[3]].bulletpos=vector2d(780,10),bullet[m17lead[3]].redir(vector2d(780,580)); + if(bullet[m17lead[3]].bulletpos.y>580.01f)bullet[m17lead[3]].bulletpos=vector2d(780,580),bullet[m17lead[3]].redir(vector2d(10,580)); + if(bullet[m17lead[3]].bulletpos.x<9.99f)bullet[m17lead[3]].bulletpos=vector2d(10,580),bullet[m17lead[3]].redir(vector2d(10,10)); + if(bullet[m17lead[3]].bulletpos.y<9.99f)bullet[m17lead[3]].bulletpos=vector2d(10,10),bullet[m17lead[3]].redir(vector2d(780,10)); if(tbrk>0.02+(frameleft/(double)(AMinute+ThirtySeconds))*0.08) { for(int i=0;i<4;++i) { - int pnt=CreateBullet2(m17lead[i]->bulletpos.x,m17lead[i]->bulletpos.y,0,0,true); + int pnt=CreateBullet2(bullet[m17lead[i]].bulletpos.x,bullet[m17lead[i]].bulletpos.y,0,0,true); bullet[pnt].redir(snexTarg.targpos); bullet[pnt].bulletaccel=0.002;bullet[pnt].limv=3; bullet[pnt].whirem=1500-(frameleft/(double)(AMinute+ThirtySeconds))*500; @@ -3385,7 +3385,7 @@ void Levelm1Part18() tbrk=0; } } -Bullet *m19lead[10],*m19gen[700]; +int m19lead[10],m19gen[700]; double m19rad; int m19step,m19cnt; bool m19pldir; @@ -3398,10 +3398,10 @@ void Levelm1Part19() avabrk=0.05;avacurbrk=0; for(int i=0;i<8;++i) { - m19lead[i]=&bullet[CreateBullet2(400,300,0,0)]; - m19lead[i]->bulletpos=vector2d(400+250*cos(m19rad+i*pi/4),300+250*sin(m19rad+i*pi/4)); - m19lead[i]->alterColor=(TColors)i; - m19lead[i]->inv=true; + m19lead[i]=CreateBullet2(400,300,0,0); + bullet[m19lead[i]].bulletpos=vector2d(400+250*cos(m19rad+i*pi/4),300+250*sin(m19rad+i*pi/4)); + bullet[m19lead[i]].alterColor=(TColors)i; + bullet[m19lead[i]].inv=true; } m19pldir=false;BTarg.targpos=playerpos; } @@ -3411,22 +3411,22 @@ void Levelm1Part20update() if(!m19pldir&&GetDist(playerpos,vector2d(400,300))<0.01)m19pldir=true; for(int i=0;i<m19cnt;++i) { - if(m19gen[i]->redattrib) + if(bullet[m19gen[i]].redattrib) { - if(m19gen[i]->redattrib>1) + if(bullet[m19gen[i]].redattrib>1) { double r=re.NextDouble(0,75-50*(frameleft/(double)(AMinute*2))),theta=re.NextDouble(-pi,pi); - m19gen[i]->bulletpos=vector2d(400+r*cos(theta),300+r*sin(theta)); - m19gen[i]->bulletspeed=0; + bullet[m19gen[i]].bulletpos=vector2d(400+r*cos(theta),300+r*sin(theta)); + bullet[m19gen[i]].bulletspeed=0; } else { - if(GetDist(m19gen[i]->bulletpos,vector2d(400,300))<4) + if(GetDist(bullet[m19gen[i]].bulletpos,vector2d(400,300))<4) { - m19gen[i]->redattrib=2; - m19gen[i]->setdir(re.NextDouble(-pi,pi)); - m19gen[i]->bulletaccel=0.0015; - m19gen[i]->limv=re.NextDouble(1,8-2*(frameleft/(double)(AMinute*2))); + bullet[m19gen[i]].redattrib=2; + bullet[m19gen[i]].setdir(re.NextDouble(-pi,pi)); + bullet[m19gen[i]].bulletaccel=0.0015; + bullet[m19gen[i]].limv=re.NextDouble(1,8-2*(frameleft/(double)(AMinute*2))); } } } @@ -3436,7 +3436,7 @@ void Levelm1Part20() { avacurbrk+=hge->Timer_GetDelta(); m19rad+=pi/(5400.0f+1800.0f*(frameleft/(double)(AMinute*2)))*(1000.0f/hge->Timer_GetFPS()); - for(int i=0;i<8;++i)m19lead[i]->bulletpos=vector2d(400+250*cos(m19rad+i*pi/4),300+250*sin(m19rad+i*pi/4)); + for(int i=0;i<8;++i)bullet[m19lead[i]].bulletpos=vector2d(400+250*cos(m19rad+i*pi/4),300+250*sin(m19rad+i*pi/4)); switch(m19step) { case 0: @@ -3444,14 +3444,14 @@ void Levelm1Part20() { for(int i=0;i<8;++i) { - m19gen[m19cnt]=&bullet[CreateBullet2(m19lead[i]->bulletpos.x,m19lead[i]->bulletpos.y,0,0)]; - m19gen[m19cnt]->redir(vector2d(400,300)); - m19gen[m19cnt]->alterColor=(TColors)i; - m19gen[m19cnt]->bulletaccel=0.002; - m19gen[m19cnt]->limv=3; - m19gen[m19cnt]->whirem=1000; - m19gen[m19cnt]->addblend=true; - m19gen[m19cnt++]->redattrib=re.NextInt(0,3)?0:1; + m19gen[m19cnt]=CreateBullet2(bullet[m19lead[i]].bulletpos.x,bullet[m19lead[i]].bulletpos.y,0,0); + bullet[m19gen[i]].redir(vector2d(400,300)); + bullet[m19gen[i]].alterColor=(TColors)i; + bullet[m19gen[i]].bulletaccel=0.002; + bullet[m19gen[i]].limv=3; + bullet[m19gen[i]].whirem=1000; + bullet[m19gen[i]].addblend=true; + bullet[m19gen[m19cnt++]].redattrib=re.NextInt(0,3)?0:1; } if(m19cnt/8>80-50*(frameleft/(double)(AMinute*2)))m19step=1,avabrk=3,tbrk=0; avacurbrk=0; @@ -3469,7 +3469,7 @@ void Levelm1Part20() tbrk=0; for(int i=0;i<8;++i) { - int pnt=CreateBullet2(m19lead[i]->bulletpos.x,m19lead[i]->bulletpos.y,0,0); + int pnt=CreateBullet2(bullet[m19lead[i]].bulletpos.x,bullet[m19lead[i]].bulletpos.y,0,0); bullet[pnt].redir(vector2d(400,300)); bullet[pnt].alterColor=(TColors)i; bullet[pnt].bulletdir.x=-bullet[pnt].bulletdir.x; @@ -37,6 +37,7 @@ #include <hgegui.h> #include <hgedistort.h> #include <hgerect.h> +#include <cassert> #include <cmath> #include <ctime> #include <cstdlib> @@ -1251,7 +1252,8 @@ int main(int argc,char *argv[]) #ifdef WIN32 if(!rbPanelFont.Init("C:/Windows/Fonts/cour.ttf",18))return 1; #else - if(!rbPanelFont.Init("/usr/share/fonts/truetype/freefont/FreeMono.ttf",18))return 1; + if(!rbPanelFont.Init("/usr/share/fonts/truetype/freefont/FreeMono.ttf",18)) + if(!rbPanelFont.Init("/usr/share/fonts/TTF/FreeMono.ttf",18))return 1; #endif fnt=new hgeFont("./Resources/charmap.fnt"); MenuFont=new hgeFont("./Resources/charmap.fnt"); @@ -1296,7 +1298,7 @@ int main(int argc,char *argv[]) hge->System_Log("%s: Starting from Level%dPart%d",MAIN_SRC_FN,startLvl,startPrt); playerpos.x=400,playerpos.y=400,playerrot=0; frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; - level=startLvl,part=startPrt;frms=0,averfps=0.0;bsscale=1; + level=startLvl,part=startPrt;frms=0,averfps=0.0;bsscale=1;DBGColor=0xFF000000; if(bullet){free(bullet);bullet=NULL;} towcnt=bulcnt=0;whrcnt=12;skyactive=false;PlayerSplit=false; score=0;Mult_Init();//Music_Init("./Resources/Music/CanonTechno.ogg"); @@ -1323,6 +1325,7 @@ int main(int argc,char *argv[]) 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); + if(bullet){free(bullet);bullet=NULL;} } hge->System_Shutdown(); hge->Release(); diff --git a/towernbullet.h b/towernbullet.h index b0ca7e7..6effdc4 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -1862,7 +1862,7 @@ TCTarg CTarg; class TROF { public: - Bullet *Bul[32]; + int Bul[64]; double rad1,rad2,drad,srad,dtrad,dtrad2; double range,drange,dtrange,cdtrange; int stage,cnt,ccnt,delay,cf; @@ -1870,8 +1870,8 @@ 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)],Bul[i]->setdir(srad),Bul[i]->scale=0.01; - Bul[0]->bulletspeed=2;Bul[0]->scale=1; + for (int i=0;i<cnt;++i)Bul[i]=CreateBullet8(400,300,0,false),bullet[Bul[i]].setdir(srad),bullet[Bul[i]].scale=0.01; + bullet[Bul[0]].bulletspeed=2;bullet[Bul[0]].scale=1; } void stage0() { @@ -1879,16 +1879,16 @@ public: 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 (ccnt==1)dtrange=GetDist(bullet[Bul[0]].bulletpos,bullet[Bul[1]].bulletpos); + bullet[Bul[ccnt]].bulletspeed=2;bullet[Bul[ccnt]].scale=1; } if (elasp>2) { stage=1; - drange=GetDist(Bul[cnt-1]->bulletpos,vector2d(400,300)); + drange=GetDist(bullet[Bul[ccnt-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; + for (int i=0;i<cnt;++i)bullet[Bul[i]].bulletspeed=0; cf=0; } } @@ -1897,26 +1897,26 @@ public: 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 (bullet[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)); + bullet[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)); + bullet[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 (bullet[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)); + bullet[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); + bullet[Bul[i]].bulletpos=vector2d(400+(drange+(cnt-i)*dtrange)*cos(rad2-pi),300+(drange+(cnt-i)*dtrange)*sin(rad2-pi)); + bullet[Bul[i]].bulletspeed=2,bullet[Bul[i]].redir(vector2d(400,300)), + bullet[Bul[i]].bulletdir=vector2d(-bullet[Bul[i]].bulletdir.x,-bullet[Bul[i]].bulletdir.y); } stage=2; } @@ -1984,7 +1984,7 @@ class BulletSine private: Bullet headb; vector2d a,b,lastgenerated; - Bullet* generated[400]; + int generated[400]; int gencnt; bool OutOfBound() { @@ -2007,8 +2007,8 @@ public: { ++gencnt; double rad=(gencnt&1)?(gencnt+1)/2*pi/18.0f:-gencnt/2*pi/18.0f; - generated[gencnt]=&bullet[CreateBullet2(headb.bulletpos.x,headb.bulletpos.y,0,rad,true)]; - generated[gencnt]->inv=true; + generated[gencnt]=CreateBullet2(headb.bulletpos.x,headb.bulletpos.y,0,rad,true); + bullet[generated[gencnt]].inv=true; lastgenerated=headb.bulletpos; } if (OutOfBound()) @@ -2016,8 +2016,8 @@ public: active=false; for (int i=1;i<=gencnt;++i) if (generated[i]) - generated[i]->bulletaccel=0.005,generated[i]->limv=2, - generated[i]->inv=false,generated[i]->collable=true; + bullet[generated[i]].bulletaccel=0.005,bullet[generated[i]].limv=2, + bullet[generated[i]].inv=false,bullet[generated[i]].collable=true; memset(generated,0,sizeof(generated)); } ProcessBullet2(headb); @@ -2080,7 +2080,7 @@ private: class Pile { private: - Bullet* pb[200]; + int pb[200]; int matrixx,matrixy,progress,cnt; double brk;TColors color; public: @@ -2096,9 +2096,9 @@ private: { if(pb[i]) { - if(pb[i]->bullettype==2) + if(bullet[pb[i]].bullettype==2) { - pb[i]->exist=false;pb[i]=0; + bullet[pb[i]].exist=false;pb[i]=0; } } } @@ -2115,8 +2115,8 @@ private: for(int i=0;i<10;++i) { vector2d ran=vector2d(re.NextDouble(0,50)+matrixx*50,re.NextDouble(0,50)+matrixy*50); - pb[cnt++]=&bullet[CreateBullet2(ran.x,ran.y,0,0,true)]; - pb[cnt-1]->alterColor=color; + pb[cnt++]=CreateBullet2(ran.x,ran.y,0,0,true); + bullet[pb[cnt-1]].alterColor=color; } } } @@ -2130,10 +2130,10 @@ private: { if(pb[i]) { - if(pb[i]->bullettype==2&&pb[i]->lifetime>1) + if(bullet[pb[i]].bullettype==2&&bullet[pb[i]].lifetime>1) { - BulletEffect_Death(*pb[i],ColorToDWORD(color)); - pb[i]->exist=false;pb[i]=0; + BulletEffect_Death(bullet[pb[i]],ColorToDWORD(color)); + bullet[pb[i]].exist=false;pb[i]=0; } else alldone=false; } @@ -2262,8 +2262,8 @@ protected: double range; int cnt; vector2d center; - Bullet* C; - Bullet* target[200]; + int C; + int target[200]; vector2d created[200]; private: TColors rbGetColor(int a) @@ -2291,8 +2291,8 @@ public: active=true; cnt=0;range=0; center=_ctr; - C=&bullet[CreateBullet2(center.x,center.y,0,0,true)]; - C->alterColor=red; + C=CreateBullet2(center.x,center.y,0,0,true); + bullet[C].alterColor=red; } bool isActive(){return active;} void update() @@ -2303,86 +2303,86 @@ public: if(GetDist(a,center)<=range) { if(test(a)) - target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,0,true)], + target[cnt++]=CreateBullet2(a.x,a.y,0,0,true), created[cnt-1]=vector2d(a.x,a.y), - target[cnt-1]->inv=true, - target[cnt-1]->alterColor=red; + bullet[target[cnt-1]].inv=true, + bullet[target[cnt-1]].alterColor=red; } else all=false; for(a=vector2d(center.x+15,center.y);a.x<825;a.x+=15) if(GetDist(a,center)<=range) { if(test(a)) - target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi,true)], + target[cnt++]=CreateBullet2(a.x,a.y,0,pi,true), created[cnt-1]=vector2d(a.x,a.y), - target[cnt-1]->inv=true, - target[cnt-1]->alterColor=red; + bullet[target[cnt-1]].inv=true, + bullet[target[cnt-1]].alterColor=red; } else all=false; for(a=vector2d(center.x,center.y-15);a.y>-25;a.y-=15) if(GetDist(a,center)<=range) { if(test(a)) - target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,pi/2,true)], + target[cnt++]=CreateBullet2(a.x,a.y,0,pi/2,true), created[cnt-1]=vector2d(a.x,a.y), - target[cnt-1]->inv=true, - target[cnt-1]->alterColor=red; + bullet[target[cnt-1]].inv=true, + bullet[target[cnt-1]].alterColor=red; } else all=false; for(a=vector2d(center.x,center.y+15);a.y<625;a.y+=15) if(GetDist(a,center)<=range) { if(test(a)) - target[cnt++]=&bullet[CreateBullet2(a.x,a.y,0,-pi/2,true)], + target[cnt++]=CreateBullet2(a.x,a.y,0,-pi/2,true), created[cnt-1]=vector2d(a.x,a.y), - target[cnt-1]->inv=true, - target[cnt-1]->alterColor=red; + bullet[target[cnt-1]].inv=true, + bullet[target[cnt-1]].alterColor=red; } else all=false; a=center; #define _bat \ - target[cnt-1]->redir(center),\ - created[cnt-1]=target[cnt-1]->bulletpos,\ - target[cnt-1]->bulletdir.x=-target[cnt-1]->bulletdir.x,\ - target[cnt-1]->bulletdir.y=-target[cnt-1]->bulletdir.y,\ - target[cnt-1]->inv=true,\ - target[cnt-1]->alterColor=rbGetColor(i+j); + bullet[target[cnt-1]].redir(center),\ + created[cnt-1]=bullet[target[cnt-1]].bulletpos,\ + bullet[target[cnt-1]].bulletdir.x=-bullet[target[cnt-1]].bulletdir.x,\ + bullet[target[cnt-1]].bulletdir.y=-bullet[target[cnt-1]].bulletdir.y,\ + bullet[target[cnt-1]].inv=true,\ + bullet[target[cnt-1]].alterColor=rbGetColor(i+j); for(int i=1;i<=6;++i) for(int j=1;j<=7-i;++j) if(GetDist(vector2d(a.x+i*15,a.y+j*15),center)<=range){ if(test(vector2d(a.x+i*15,a.y+j*15))) - target[cnt++]=&bullet[CreateBullet2(a.x+i*15,a.y+j*15,0,0,true)],_bat;} + target[cnt++]=CreateBullet2(a.x+i*15,a.y+j*15,0,0,true),_bat;} else all=false; for(int i=1;i<=6;++i) for(int j=1;j<=7-i;++j) if(GetDist(vector2d(a.x-i*15,a.y+j*15),center)<=range){ if(test(vector2d(a.x-i*15,a.y+j*15))) - target[cnt++]=&bullet[CreateBullet2(a.x-i*15,a.y+j*15,0,0,true)],_bat;} + target[cnt++]=CreateBullet2(a.x-i*15,a.y+j*15,0,0,true),_bat;} else all=false; for(int i=1;i<=6;++i) for(int j=1;j<=7-i;++j) if(GetDist(vector2d(a.x+i*15,a.y-j*15),center)<=range){ if(test(vector2d(a.x+i*15,a.y-j*15))) - target[cnt++]=&bullet[CreateBullet2(a.x+i*15,a.y-j*15,0,0,true)],_bat;} + target[cnt++]=CreateBullet2(a.x+i*15,a.y-j*15,0,0,true),_bat;} else all=false; for(int i=1;i<=6;++i) for(int j=1;j<=7-i;++j) if(GetDist(vector2d(a.x-i*15,a.y-j*15),center)<=range){ if(test(vector2d(a.x-i*15,a.y-j*15))) - target[cnt++]=&bullet[CreateBullet2(a.x-i*15,a.y-j*15,0,0,true)],_bat;} + target[cnt++]=CreateBullet2(a.x-i*15,a.y-j*15,0,0,true),_bat;} else all=false; #undef _bat if(all) { - BulletEffect_Death(*C,0x80FF3333); - C->exist=false; + BulletEffect_Death(bullet[C],0x80FF3333); + bullet[C].exist=false; for(int i=0;i<cnt;++i) { - target[i]->bulletspeed=-0.5; - target[i]->bulletaccel=0.0005; - target[i]->limv=3; - target[i]->inv=false; - target[i]->collable=true; + bullet[target[i]].bulletspeed=-0.5; + bullet[target[i]].bulletaccel=0.0005; + bullet[target[i]].limv=3; + bullet[target[i]].inv=false; + bullet[target[i]].collable=true; } active=false; } @@ -2394,7 +2394,7 @@ private: int mode,cnt,stage,spnr,dcorr; bool active;TColors col; double drad,rad,brk; - Bullet *targ[600]; + int targ[600]; public: bool isActive(){return active;} void Init(int _mode,double _drad,int _spnr,TColors _c,int _dcorr) @@ -2413,22 +2413,22 @@ public: bool dchk=(stage==1); for(int i=0;i<cnt;++i) { - if(targ[i]->bulletspeed>1&&GetDist(vector2d(400,300),targ[i]->bulletpos)>=200) - targ[i]->bulletspeed=0; - if(targ[i]->bulletspeed>1)dchk=false; + if(bullet[targ[i]].bulletspeed>1&&GetDist(vector2d(400,300),bullet[targ[i]].bulletpos)>=200) + bullet[targ[i]].bulletspeed=0; + if(bullet[targ[i]].bulletspeed>1)dchk=false; } if(dchk) { for(int i=0;i<cnt;++i) { - double rad=atan2(targ[i]->bulletdir.y,targ[i]->bulletdir.x); + double rad=atan2(bullet[targ[i]].bulletdir.y,bullet[targ[i]].bulletdir.x); int cc=(int)(rad/drad); if((cc/6+dcorr)&1) - targ[i]->bulletaccel=0.005, - targ[i]->limv=3; + bullet[targ[i]].bulletaccel=0.005, + bullet[targ[i]].limv=3; else - targ[i]->bulletaccel=-0.005, - targ[i]->limv=-3; + bullet[targ[i]].bulletaccel=-0.005, + bullet[targ[i]].limv=-3; } return(void)(active=false); } @@ -2440,9 +2440,9 @@ public: if(fabs(rad)>2*pi/spnr+pi/180)return(void)(stage=1); for(int i=0;i<spnr;++i) { - targ[cnt]=&bullet[CreateBullet2(400,300,2,rad+i*2*pi/spnr)], - targ[cnt]->inv=true, - targ[cnt++]->alterColor=col; + targ[cnt]=CreateBullet2(400,300,2,rad+i*2*pi/spnr), + bullet[targ[cnt]].inv=true, + bullet[targ[cnt++]].alterColor=col; } } } @@ -2454,20 +2454,20 @@ public: bool dchk=(stage==1); for(int i=0;i<cnt;++i) { - if(targ[i]->bulletspeed>1&&GetDist(vector2d(400,300),targ[i]->bulletpos)>=200) - targ[i]->bulletspeed=0; - if(targ[i]->bulletspeed>1)dchk=false; + if(bullet[targ[i]].bulletspeed>1&&GetDist(vector2d(400,300),bullet[targ[i]].bulletpos)>=200) + bullet[targ[i]].bulletspeed=0; + if(bullet[targ[i]].bulletspeed>1)dchk=false; } if(dchk) { if(re.NextInt(0,1)) for(int i=0;i<cnt;++i) - targ[i]->bulletaccel=-0.005, - targ[i]->limv=-3; + bullet[targ[i]].bulletaccel=-0.005, + bullet[targ[i]].limv=-3; else for(int i=0;i<cnt;++i) - targ[i]->bulletaccel=0.005, - targ[i]->limv=3; + bullet[targ[i]].bulletaccel=0.005, + bullet[targ[i]].limv=3; return(void)(active=false); } if(stage==0) @@ -2478,9 +2478,9 @@ public: if(fabs(rad)>2*pi/spnr+pi/180)return(void)(stage=1); for(int i=0;i<spnr;++i) { - targ[cnt]=&bullet[CreateBullet2(400,300,2,rad+i*2*pi/spnr)], - targ[cnt]->inv=true; - targ[cnt++]->alterColor=col; + targ[cnt]=CreateBullet2(400,300,2,rad+i*2*pi/spnr), + bullet[targ[cnt]].inv=true; + bullet[targ[cnt++]].alterColor=col; } } } @@ -2495,12 +2495,12 @@ public: if(fabs(rad)>2*pi/spnr+pi/180)return(void)(active=false); for(int i=0;i<spnr;++i) { - targ[cnt]=&bullet[CreateBullet2(400,300,2,rad+i*2*pi/spnr)]; - targ[cnt]->inv=true; - targ[cnt++]->alterColor=col; - targ[cnt]=&bullet[CreateBullet2(400,300,2,-rad+i*2*pi/spnr)]; - targ[cnt]->inv=true; - targ[cnt++]->alterColor=col; + targ[cnt]=CreateBullet2(400,300,2,rad+i*2*pi/spnr); + bullet[targ[cnt]].inv=true; + bullet[targ[cnt++]].alterColor=col; + targ[cnt]=CreateBullet2(400,300,2,-rad+i*2*pi/spnr); + bullet[targ[cnt]].inv=true; + bullet[targ[cnt++]].alterColor=col; } } } @@ -2613,7 +2613,7 @@ public: class yellowGroup { private: - Bullet *ylw[100]; + int ylw[100]; bool dirdone[100]; bool active; public: @@ -2626,7 +2626,7 @@ public: { int pnt=CreateBullet2(400,300,_yv,frameleft*pi/AMinute+i*(2*pi/_cnt)); bullet[pnt].alterColor=yellow; - ylw[i]=&bullet[pnt]; + ylw[i]=pnt; } } void Update() @@ -2634,20 +2634,20 @@ public: bool done=true; for (int i=0;i<100;++i) { - if(ylw[i]&&ylw[i]->lifetime>2&&!dirdone[i]&&ylw[i]->alterColor==yellow) - ylw[i]->redir(playerpos),dirdone[i]=true; - if(ylw[i]&&ylw[i]->lifetime>5&&ylw[i]->alterColor==yellow) + if(ylw[i]&&bullet[ylw[i]].lifetime>2&&!dirdone[i]&&bullet[ylw[i]].alterColor==yellow) + bullet[ylw[i]].redir(playerpos),dirdone[i]=true; + if(ylw[i]&&bullet[ylw[i]].lifetime>5&&bullet[ylw[i]].alterColor==yellow) { int cc=re.NextInt(0,5); for(int j=0;j<cc;++j) { - int pnt=CreateBullet2(ylw[i]->bulletpos.x,ylw[i]->bulletpos.y,0,re.NextDouble(-pi,pi)); + int pnt=CreateBullet2(bullet[ylw[i]].bulletpos.x,bullet[ylw[i]].bulletpos.y,0,re.NextDouble(-pi,pi)); if(!re.NextInt(0,3))bullet[pnt].redir(playerpos); bullet[pnt].bulletaccel=0.002;bullet[pnt].limv=3; } - BulletEffect_Death(*ylw[i],ColorToDWORD(yellow)); - ylw[i]->exist=false; - ylw[i]->bullettype=0; + BulletEffect_Death(bullet[ylw[i]],ColorToDWORD(yellow)); + bullet[ylw[i]].exist=false; + bullet[ylw[i]].bullettype=0; ylw[i]=0; } else done=false; @@ -2687,7 +2687,7 @@ public: class expSpinner { private: - Bullet *bullets[1000]; + int bullets[1000]; int arms,cnt,lc; double brk,len,dr,da; bool active; @@ -2712,8 +2712,8 @@ public: double rad=da+i*2*pi/(double)arms,drad=rad+lc*pi/15;int c=(lc&1)?1:-1; if(InBound(vector2d(400+len*cos(rad),300+len*sin(rad)))) { - bullets[cnt++]=&bullet[CreateBullet2( - 400+len*cos(rad),300+len*sin(rad),0,c*drad,true)]; + bullets[cnt++]=CreateBullet2( + 400+len*cos(rad),300+len*sin(rad),0,c*drad,true); c=-c;none=false; } } @@ -2721,28 +2721,28 @@ public: if(none) { active=false; - for(int i=0;i<cnt;++i)bullets[i]->bulletaccel=0.002,bullets[i]->limv=2; + for(int i=0;i<cnt;++i)bullet[bullets[i]].bulletaccel=0.002,bullet[bullets[i]].limv=2; } } }; class CPinBall { private: - Bullet* center; - Bullet* circles[10][30]; + int center; + int circles[10][30]; int layer;double rot,lifetime,drt; public: void Init(vector2d pos,int _lay) { center=0;memset(circles,0,sizeof(circles)); - center=&bullet[CreateBullet2(pos.x,pos.y,3,re.NextInt(-pi,pi),true)]; + center=CreateBullet2(pos.x,pos.y,3,re.NextInt(-pi,pi),true); layer=_lay;rot=0;lifetime=0.01;drt=re.NextDouble(-0.5*pi,0.5*pi); for(int i=0;i<layer;++i) { for(int j=0;j<(i+1)*3;++j) { - circles[i][j]=&bullet[CreateBullet2(pos.x,pos.y,3,0,true)]; - circles[i][j]->bulletpos=vector2d(pos.x+10*i*cos(rot+j*2*pi/((i+1)*3)),pos.y+10*i*sin(rot+j*2*pi/((i+1)*3))); + circles[i][j]=CreateBullet2(pos.x,pos.y,3,0,true); + bullet[circles[i][j]].bulletpos=vector2d(pos.x+10*i*cos(rot+j*2*pi/((i+1)*3)),pos.y+10*i*sin(rot+j*2*pi/((i+1)*3))); } } } @@ -2750,16 +2750,16 @@ public: void Update() { lifetime+=hge->Timer_GetDelta(); - vector2d pos=center->bulletpos; - if(pos.x<10*layer-5||pos.x>790-10*layer)center->bulletdir.x=-center->bulletdir.x; - if(pos.y<10*layer-5||pos.y>590-10*layer)center->bulletdir.y=-center->bulletdir.y; + vector2d pos=bullet[center].bulletpos; + if(pos.x<10*layer-5||pos.x>790-10*layer)bullet[center].bulletdir.x=-bullet[center].bulletdir.x; + if(pos.y<10*layer-5||pos.y>590-10*layer)bullet[center].bulletdir.y=-bullet[center].bulletdir.y; rot+=hge->Timer_GetDelta()*drt; for(int i=0;i<layer;++i) { for(int j=0;j<(i+1)*3;++j) { - circles[i][j]->bulletpos=vector2d(pos.x+10*i*cos(rot+j*2*pi/((i+1)*3)),pos.y+10*i*sin(rot+j*2*pi/((i+1)*3))); - circles[i][j]->bulletdir=center->bulletdir; + bullet[circles[i][j]].bulletpos=vector2d(pos.x+10*i*cos(rot+j*2*pi/((i+1)*3)),pos.y+10*i*sin(rot+j*2*pi/((i+1)*3))); + bullet[circles[i][j]].bulletdir=bullet[center].bulletdir; } } } |