From 1d05051ab16b2012c08f0405b4754f421aae4cf3 Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Tue, 4 Mar 2014 03:11:48 +0000 Subject: New level, remove more comments, more interfaces... I'm now preparing for the next public pre-release version. --- CHANGELOG.TXT | 4 +++- global.h | 8 +++---- levels.h | 55 +++++++++++++++++++++++++++++++++++------------- libcgh.h | 4 +++- main.cpp | 2 ++ menus.h | 2 +- towernbullet.h | 66 ++++++++++++++++++++++++++++++++++++++++++++-------------- 7 files changed, 104 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 1f26d2e..3ee7b53 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -3,14 +3,16 @@ Next version: 0.7.2-2_PR/0.7.3-0_PR TODOs: Couple of tests, new levels, pre-release preparation. +There's only one level left before the next pre-release version!! 0.7.x-x_PR will be another public pre-release version. Pre-Released versions: 0.7.2-1_PR (b71) New level "Trypophobia", however it seems that this level won't cause trypophobia at all! +New level "Photon fusion", using a slightly modified Tower8. Rewrote laser distance detection using vector2d calculations, -extending libcgh and bump its version at the same time. +extending libcgh and bump its version at the same time.(*2) Put the new level to the correct place. Bring back "Minesweeper" level, adjust it to the new interfaces. Convert Bullet from struct to class. diff --git a/global.h b/global.h index 38bc94d..d46c6cb 100644 --- a/global.h +++ b/global.h @@ -90,10 +90,10 @@ public: bool exist,inv; int whirem,whiskp,yelbrk; int exp1,exp2; - double lifetime; + double lifetime,rot; bool scollable,collable; double scale;int effbrk; - TColors alterColor; + TColors alterColor,alterColor2; void redir(vector2d targ) { bulletdir.x=bulletpos.x-targ.x; @@ -260,7 +260,7 @@ int coll,semicoll,mode,dsmc,restarts; double clrrange,clrrad,clrmaxrange,clrind; hgeSprite *clrcircle; bool IfCallLevel; -bool Dis8ref; +bool Dis8ref,t8special; int frameskips=0,stepskips=0; bool IfShowTip=false,FadeTip=false; hgeFont *TipFont; @@ -283,7 +283,7 @@ int creditsp;double creditfly,creditacc,credbrk; bool credstop,creddone; bool tfs; int fpslvl,clrmode; -static const char* GLOBAL_H_FN="global.h"; +//static const char* GLOBAL_H_FN="global.h"; void Throw(char *Filename,char *Info) { diff --git a/levels.h b/levels.h index a06e4ba..d0a165b 100644 --- a/levels.h +++ b/levels.h @@ -2871,15 +2871,41 @@ void Level7Part20() for(int i=0;i<50;++i) if(btails[i].isActive())btails[i].Update(); } -//Rearrange needed since here, see LEVELS.txt +int sttnt; +void Level7Part21() +{ + frameleft=AMinute+ThirtySeconds; + if (towcnt!=1&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + t8special=true; + sttnt=CreateTower8(400,300,2000,2,75,20); + for (int i=1;i<=towcnt;++i) + if (tower[i].RendColor==0x80FFFFFF) + tower[i].RendColor=0x00FFFFFF; + for (int i=1;i<=towcnt;++i) + if ((tower[i].RendColor>>24)<=0x80) + tower[i].RendColor=tower[i].RendColor+0x01FFFFFF; + else + { + ++part; + return; + } +} +void Level7Part22() +{ + tower[sttnt].towertimer=(frameleft/(double)(AMinute+ThirtySeconds))*1250+750; +} WOP wop[100]; -void Level7Part21()//Wave of Photon +void Level7Part23()//Wave of Photon { - memset(bnl,0,sizeof(bnl)); + memset(bnl,0,sizeof(bnl));t8special=false; frameleft=AMinute;All2pnt(); ykbrk=0.5f;++part; } -void Level7Part22() +void Level7Part24() { ykbrk-=hge->Timer_GetDelta(); if (ykbrk<0&&frameleft>TenSeconds/10*3) @@ -2918,7 +2944,8 @@ void Level7Part22() for (int i=0;i<100;++i) if (wop[i].active)wop[i].Update(); } -void Level7Part23()//3 circles +//Rearrange needed since here, see LEVELS.txt +void Level7Part25()//3 circles { frameleft=AMinute;clrtime=2;towcnt=0; DisableAllTower=false; @@ -2934,7 +2961,7 @@ void Level7Part23()//3 circles ++part;All2pnt();avabrk=1.0f;avacurbrk=0; } } -void L7P13Creator(vector2d p,int cnt,TColors col) +void L7P26Creator(vector2d p,int cnt,TColors col) { for (int i=0;iTimer_GetDelta(); avabrk=(frameleft/(double)AMinute)*0.5f+0.5f; if(avacurbrk>avabrk) { avacurbrk=0; - L7P13Creator(vector2d(400,250),60,red); - L7P13Creator(vector2d(350,336.6),60,green); - L7P13Creator(vector2d(450,336.6),60,blue); + L7P26Creator(vector2d(400,250),60,red); + L7P26Creator(vector2d(350,336.6),60,green); + L7P26Creator(vector2d(450,336.6),60,blue); } } BCircle scircles[200]; double rspd[200]; -void Level7Part25()//circles +void Level7Part27()//circles { frameleft=AMinute;clrtime=2;towcnt=0; DisableAllTower=false; @@ -2975,7 +3002,7 @@ void Level7Part25()//circles ++part;All2pnt();avabrk=1.0f;avacurbrk=1.0f;memset(scircles,0,sizeof(scircles)); } } -void Level7Part26() +void Level7Part28() { avacurbrk+=hge->Timer_GetDelta(); avabrk=0.1+(frameleft/(double)AMinute)*0.4f; @@ -3002,14 +3029,14 @@ void Level7Part26() } } } -void Level7Part27()//Minesweeper +void Level7Part29()//Minesweeper { frameleft=AMinute; if (bulcnt!=0)return (void)ClearAll(); Lasercnt=0; ++part; } -void Level7Part28()//Minesweeper-child +void Level7Part30()//Minesweeper-child { if (rand()%100>95) { diff --git a/libcgh.h b/libcgh.h index 15a6979..f78391c 100644 --- a/libcgh.h +++ b/libcgh.h @@ -1,7 +1,8 @@ //Chrisoft Bullet Lab Remix HGE //Chrisoft Game Helper header //Copyright Chrisoft 2014 -//libcgh version 0004 +//libcgh version 0005 +//Last full compatible version 0002 //^Modify that when big change is made^ #include #include @@ -25,6 +26,7 @@ struct vector2d x/=l;y/=l; } void Swap(){double t=x;x=y;y=t;} + void rotate(double rad){double tx=x*cos(rad)+y*sin(rad),ty=y*cos(rad)-x*sin(rad);x=tx,y=ty;} friend vector2d operator -(vector2d a,vector2d b) { return vector2d(a.x-b.x,a.y-b.y); diff --git a/main.cpp b/main.cpp index a297c67..76261fe 100644 --- a/main.cpp +++ b/main.cpp @@ -446,6 +446,8 @@ void CallLevels() if (level==7&&part==26)Level7Part26(); if (level==7&&part==27)Level7Part27(); if (level==7&&part==28)Level7Part28(); + if (level==7&&part==29)Level7Part29(); + if (level==7&&part==30)Level7Part30(); if (level==1&&part==5)level=2,part=0; if (level==2&&part==10)level=3,part=0; if (level==3&&part==7)level=4,part=0; diff --git a/menus.h b/menus.h index 50f96a1..2967fae 100644 --- a/menus.h +++ b/menus.h @@ -91,7 +91,7 @@ void StartGUI_FrameFnk() break; case 4: playerpos.x=400,playerpos.y=400,playerrot=0; - frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=false; + frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; level=1,part=1;frms=0,averfps=0.0;bsscale=1; towcnt=bulcnt=0;whrcnt=12;skyactive=false; score=0;Mult_Init();//Music_Init("./Resources/Music/CanonTechno.ogg"); diff --git a/towernbullet.h b/towernbullet.h index 374c76b..a13f7e6 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -80,11 +80,12 @@ int CreateBullet2(double x,double y,double bs,double rad,bool eff=false,bool inv bullet[i].bulletdir.y=sin(rad); bullet[i].bulletspeed=bs; bullet[i].alterColor=blue; + bullet[i].alterColor2=COLOR_COUNT; bullet[i].lifetime=0; bullet[i].scollable=true; bullet[i].collable=true; bullet[i].bulletaccel=bullet[i].limv=0; - bullet[i].scale=1; + bullet[i].scale=1;bullet[i].rot=0; if (eff)BulletEffect_Attatch(i); return i; } @@ -377,7 +378,11 @@ void ProcessBullet2(int i) } else { + if(bullet[i].alterColor2==COLOR_COUNT) bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + else + RenderAlter(vector2d(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2),bullet[i].alterColor,bullet[i].alterColor2,bullet[i].rot,0.6*bullet[i].scale), + Current_Position==1?bullet[i].rot+=(i&1?1:-1)*(1000/hge->Timer_GetFPS())*pi/1000:0; if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(); } } @@ -657,7 +662,16 @@ void ProcessBullet8(int i) { int cnt=rand()%4+2;if (Dis8ref)cnt=0; for (int ii=1;ii<=cnt;++ii) - CreateBullet2(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,rand()%100); + { + int pnt=CreateBullet2(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,rand()%100); + if (t8special) + { + bullet[pnt].alterColor=(TColors)(rand()%8); + bullet[pnt].alterColor2=(TColors)(rand()%8); + if(rand()%4==3)bullet[pnt].redir(vector2d(400,300)); + if(rand()%2==1)++ii; + } + } } bullet[i].exist=false; bullet[i].bulletpos.x=bullet[i].bulletpos.y=0; @@ -1274,7 +1288,7 @@ void ProcessTower8() tower[i].dblstate=true; tower[i].curtimer2=tower[i].towertimer2; tower[i].curshotcount=tower[i].shotcount; - if (!Dis8ref)BTarg.TargShow(),BTarg.targpos=playerpos; + if (!Dis8ref&&!t8special)BTarg.TargShow(),BTarg.targpos=playerpos; } } else @@ -1294,19 +1308,39 @@ void ProcessTower8() if (!Dis8ref)BTarg.TargHide(); continue; } - int pnt=CreateBullet8(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].effect); - if (Dis8ref) + if (!t8special) { - if (tower[i].towerpos.y<300) - DirectBullet(bullet[pnt],-pi/2);else DirectBullet(bullet[pnt],pi/2); + int pnt=CreateBullet8(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].effect); + if (Dis8ref) + { + if (tower[i].towerpos.y<300) + DirectBullet(bullet[pnt],-pi/2);else DirectBullet(bullet[pnt],pi/2); + } + if (tower[i].curshotcount==tower[i].shotcount) + tower[i].tdir=bullet[pnt].bulletdir; + else + { + bullet[pnt].bulletdir=tower[i].tdir; + bullet[pnt].dist=bullet[pnt].bulletdir.x*bullet[pnt].bulletdir.x+bullet[pnt].bulletdir.y*bullet[pnt].bulletdir.y; + bullet[pnt].dist=sqrt(bullet[pnt].dist); + } } - if (tower[i].curshotcount==tower[i].shotcount) - tower[i].tdir=bullet[pnt].bulletdir; else { - bullet[pnt].bulletdir=tower[i].tdir; - bullet[pnt].dist=bullet[pnt].bulletdir.x*bullet[pnt].bulletdir.x+bullet[pnt].bulletdir.y*bullet[pnt].bulletdir.y; - bullet[pnt].dist=sqrt(bullet[pnt].dist); + for(int j=0;j<5;++j) + { + int pnt=CreateBullet8(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].effect); + bullet[pnt].alterColor=white; + if (tower[i].curshotcount==tower[i].shotcount&&j==0) + tower[i].tdir=bullet[pnt].bulletdir; + else + { + bullet[pnt].bulletdir=tower[i].tdir; + bullet[pnt].bulletdir.ToUnitCircle(); + bullet[pnt].dist=1; + bullet[pnt].bulletdir.rotate(j*2*pi/5); + } + } } tower[i].curtimer2=tower[i].towertimer2; --tower[i].curshotcount; @@ -1847,10 +1881,10 @@ public: class WOP { private: - int trail[200];//Pointer to bullet[] in this trail - double brk,blim,rad,k,ml;//step break + int trail[200]; + double brk,blim,rad,k,ml; vector2d a,b; - Bullet hbul;//hidden header bullet, no col. + Bullet hbul; bool OutOfBound() { if (hbul.bulletpos.x<=-25||hbul.bulletpos.x>=825||hbul.bulletpos.y<=-25||hbul.bulletpos.y>=625) @@ -1861,7 +1895,7 @@ private: } public: bool active; - void Init(vector2d _a,vector2d _b,double _ml,double _bl)//ml=Max Length, bl=BLumia + void Init(vector2d _a,vector2d _b,double _ml,double _bl) { a=_a,b=_b,ml=_ml,blim=_bl;rad=0; if (fabs(b.x-a.x)<1e-6)return;k=(b.y-a.y)/(b.x-a.x); -- cgit v1.2.3