diff options
author | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-05-09 12:15:44 +0000 |
---|---|---|
committer | chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> | 2014-05-09 12:15:44 +0000 |
commit | 3eee64398bdfde684199873793febadbd6fa4a19 (patch) | |
tree | ec32b6c263dd03edc0c7767f690087e2109a8631 /towernbullet.h | |
parent | 3a51283329635021b839c8abbea4fac6bd7fe688 (diff) | |
download | bullet-lab-remix-3eee64398bdfde684199873793febadbd6fa4a19.tar.xz |
Fix a bug in the credit scene.
Now the pause menu shouldn't be broken now...(It's so hard to reproduce
that I have to assume it *has* been fixed.(IT STILL HAPPENS!!!)
Close the "infinity CLR" "bug".
(Huge) Code cleanup, mainly removing duplicate code.
Allocate bullets dynamically. The array is freed every time a new game
is started.
Add a signal handler, print back trace on error(currently only available
for linux...).
Diffstat (limited to 'towernbullet.h')
-rw-r--r-- | towernbullet.h | 90 |
1 files changed, 9 insertions, 81 deletions
diff --git a/towernbullet.h b/towernbullet.h index 2ec514c..b0ca7e7 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -24,15 +24,7 @@ void RenderAlter(vector2d p,TColors ca,TColors cb,double rot=0,double scl=1) int CreateBullet1(double x,double y,double bs,bool eff=false) { ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].inv=false; bullet[i].bullettype=1; @@ -52,15 +44,7 @@ int CreateBullet1(double x,double y,double bs,bool eff=false) int CreateBullet2(double x,double y,double bs,double rad,bool eff=false,bool invi=false) { ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].addblend=false; bullet[i].extborder=false; @@ -89,15 +73,7 @@ void CreateBullet3(double x,double y,double bs,int dir,bool eff=false) void CreateBullet4(double x,double y,double bs,int yelbrk=0,bool eff=false) { ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].inv=false; bullet[i].bullettype=4; @@ -117,15 +93,7 @@ void CreateBullet4(double x,double y,double bs,int yelbrk=0,bool eff=false) void CreateBullet5(double x,double y,double bs,bool eff=false) { ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].inv=false; bullet[i].bullettype=5; @@ -144,15 +112,7 @@ void CreateBullet5(double x,double y,double bs,bool eff=false) int CreateBullet6(double x,double y,double bs,int explo,int exp1=8,int exp2=12,bool eff=false) { ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].inv=false; bullet[i].bullettype=6; @@ -176,15 +136,7 @@ int CreateBullet6(double x,double y,double bs,int explo,int exp1=8,int exp2=12,b int CreateBullet7(double x,double y,double bs,int explo,bool eff=false) { ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].inv=false; bullet[i].bullettype=7; @@ -208,15 +160,7 @@ int CreateBullet7(double x,double y,double bs,int explo,bool eff=false) int CreateBullet8(double x,double y,double bs,bool eff=false) { ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].inv=false; bullet[i].bullettype=8; @@ -238,15 +182,7 @@ int CreateBullet9(double x,double y,double bs,int explo,int cnt,int brk,bool eff //This creates bullet9 in random direction and as attrib 0 //change them if necessary. ++shots; - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].inv=false; bullet[i].bullettype=9; @@ -269,15 +205,7 @@ int CreateBullet9(double x,double y,double bs,int explo,int cnt,int brk,bool eff } void CreateBullet255(double x,double y,double bs,int spno=0) { - int i; - if (bulcnt==0) - bulcnt=i=1; - else - { - for (i=1;i<=bulcnt;++i) - if (!bullet[i].exist)break; - if (i>bulcnt)bulcnt=i; - } + int i=AllocBullet(); bullet[i].exist=true; bullet[i].bullettype=255; bullet[i].bulletpos.x=x; |