From e7174e25c6a6aef85014c1af3adf698e8446969b Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Wed, 26 Feb 2014 13:23:31 +0000 Subject: M resources/b_inter.png M trunk/CHANGELOG.TXT M trunk/VERSION.TXT M trunk/background.h M trunk/global.h M trunk/hge/sound.cpp M trunk/levels.h M trunk/main.cpp M trunk/towernbullet.h --- CHANGELOG.TXT | 18 ++++++++++-- VERSION.TXT | 2 +- background.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ global.h | 2 +- hge/sound.cpp | 2 +- levels.h | 24 ++++++++++++++++ main.cpp | 4 ++- towernbullet.h | 71 +++++++++++++++++++++++++++++++++++++++------ 8 files changed, 199 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 0aa6a66..e2b26ce 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,12 +1,24 @@ =================================================================== Next version: -0.7.1-7_PR/0.7.2-0_PR +0.7.2-1_PR TODOs: -More new things? +New levels, pre-release preparation, resource remaking. +0.7.x-x_PR will be another public pre-release version. Pre-Released versions: +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. +However it wouldn't be appropriate to put three new levels into one +build... +The real changelog is here: +New level "interference" (it's another small class "SimpleThing"). +New background interface, use background pictures easily. +Minor code cleanups. + 0.7.1-6_PR (b69) -Finish the new level. +Finish some new levels ("Great Circle" bring back & "rainbow +appearance"). Fusion bullet first work draft. Fix some of the warnings from the compiler. Adjust level difficulty. It was indeed too easy... diff --git a/VERSION.TXT b/VERSION.TXT index c6a8266..3867e66 100755 --- a/VERSION.TXT +++ b/VERSION.TXT @@ -1 +1 @@ -0.7.1-6_PR (b69) \ No newline at end of file +0.7.2-0_PR (b70) \ No newline at end of file diff --git a/background.h b/background.h index 62fe7a2..a2a6c17 100644 --- a/background.h +++ b/background.h @@ -458,6 +458,97 @@ public: TDSky sky; bool skyactive; +class PicBack +{ +public: + enum arMode + { + Centered, + Tiled, + Stretched + }; +private: + hgeQuad quad; + arMode Mode; + DWORD alpha,alim; + bool onfadein,onfadeout; + int fadebreak; + void DoFadeIn() + { + if (LOWFPS)fadebreak+=17;else ++fadebreak; + if (fadebreak>17)fadebreak=0;else return; + if (LOWFPS)if(alpha+0x20<=alim)alpha+=0x20;else alpha=alim; + else if (alpha+0x2<=alim)alpha+=2;else alpha=alim; + if (alpha>=alim)onfadein=false; + } + void DoFadeOut() + { + if (LOWFPS)fadebreak+=17;else ++fadebreak; + if (fadebreak>30)fadebreak=0;else return; + if (LOWFPS) + if (alpha<0x20)alpha=0;else alpha-=0x20; + else + if (alpha<0x2)alpha=0;else alpha-=0x2; + if (!alpha)onfadeout=0; + } + void RenderCenterAt(vector2d a) + { + vector2d s=vector2d(hge->Texture_GetWidth(quad.tex,true),hge->Texture_GetHeight(quad.tex,true)); + for(int i=0;i<4;++i)quad.v[i].col=SETA(0xFFFFFF,alpha); + quad.v[0].x=a.x-s.x/2.0f;quad.v[0].y=a.y-s.y/2.0f; + quad.v[1].x=a.x+s.x/2.0f;quad.v[1].y=a.y-s.y/2.0f; + quad.v[2].x=a.x+s.x/2.0f;quad.v[2].y=a.y+s.y/2.0f; + quad.v[3].x=a.x-s.x/2.0f;quad.v[3].y=a.y+s.y/2.0f; + hge->Gfx_RenderQuad(&quad); + } +public: + bool active(){return alpha;} + void Init(const char *tx,arMode _Mode,DWORD _alim) + { + quad.tex=hge->Texture_Load(tx);alim=_alim; + quad.v[0].tx=0,quad.v[0].ty=0; + quad.v[1].tx=1,quad.v[1].ty=0; + quad.v[2].tx=1,quad.v[2].ty=1; + quad.v[3].tx=0,quad.v[3].ty=1; + onfadein=onfadeout=false;alpha=0; + } + void Update() + { + if(onfadein)DoFadeIn();if(onfadeout)DoFadeOut(); + switch(Mode) + { + case Centered: + RenderCenterAt(vector2d(400,300)); + break; + case Tiled: + { + vector2d s=vector2d(hge->Texture_GetWidth(quad.tex,true),hge->Texture_GetHeight(quad.tex,true)); + for(int i=0;i*s.x<=800;++i) + for(int j=0;j*s.y<=600;++j) + RenderCenterAt(vector2d(s.x/2+i*s.x,s.y/2+j*s.y)); + } + break; + case Stretched: + for(int i=0;i<4;++i)quad.v[i].col=SETA(0xFFFFFF,alpha); + quad.v[0].x=0,quad.v[0].y=0; + quad.v[1].x=800,quad.v[1].y=0; + quad.v[2].x=800,quad.v[2].y=600; + quad.v[3].x=0,quad.v[3].y=600; + hge->Gfx_RenderQuad(&quad); + break; + } + } + void SetFadeIn() + { + alpha=0x01; + onfadein=true; + } + void SetFadeOut() + { + alpha=alim; + onfadeout=true; + } +}binter; DWORD ColorTransfer(DWORD a,DWORD t) { int r=GETR(a),g=GETG(a),b=GETB(a),sa=GETA(a); diff --git a/global.h b/global.h index 632c881..a7a8ea8 100644 --- a/global.h +++ b/global.h @@ -93,7 +93,7 @@ struct Bullet int whirem,whiskp,yelbrk; int exp1,exp2; double lifetime; - bool scollable; + bool scollable,collable; double scale;int effbrk; TColors alterColor; void redir(vector2d targ) diff --git a/hge/sound.cpp b/hge/sound.cpp index 5880b5a..9f6869c 100644 --- a/hge/sound.cpp +++ b/hge/sound.cpp @@ -420,7 +420,7 @@ int CALL HGE_Impl::Channel_GetPos_BySample(HCHANNEL chn) alGetSourcei((ALuint)chn,AL_SAMPLE_OFFSET,&res); return (int)res; } - else return -1.0f; + else return -1; } void CALL HGE_Impl::Channel_SetPos_BySample(HCHANNEL chn, int iSample) diff --git a/levels.h b/levels.h index 5d73cc1..773d0db 100644 --- a/levels.h +++ b/levels.h @@ -3016,6 +3016,30 @@ void Level7Part20() } } } +SimpleThing a,b; +void Level7Part21() +{ + frameleft=AMinute*2;clrtime=2;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Interference(fake)"); + } + if (Current_Position==1) + { + ++part;All2pnt();skyactive=false; + binter.Init("./Resources/b_inter.png",PicBack::Centered,0x80); + binter.SetFadeIn();a.Init(vector2d(260,292));b.Init(vector2d(523,292)); + } +} +void Level7Part22() +{ +//260,292;523,292 + a.Update(true);b.Update(false); +} //vvvvvvvvvvvvvvvvvvvvvv Old Levels vvvvvvvvvvvvvvvvvvvvvv// /* void Level1Part17()//33*b+1*r-discard? diff --git a/main.cpp b/main.cpp index 8ef33f6..d294780 100644 --- a/main.cpp +++ b/main.cpp @@ -414,6 +414,8 @@ void CallLevels() if (level==7&&part==18)Level7Part18(); if (level==7&&part==19)Level7Part19(); if (level==7&&part==20)Level7Part20(); + if (level==7&&part==21)Level7Part21(); + if (level==7&&part==22)Level7Part22(); /*if (level==1&&part==3)Level1Part3(); if (level==1&&part==4)Level1Part4(); if (level==1&&part==5)Level1Part5(); @@ -558,7 +560,7 @@ bool FrameFunc() //If we are at the main scene or tip scene(which towers and bullets should still appear..) //Render towers, bullets and player. if (Leaves.IsActive())Leaves.Update(); - + if (binter.active())binter.Update(); if (LE_Active||Head){if (!Head)Tail=Head=new Leaf_Anim(),Head->init(990);Head->Process();} shots=0; dsmc=0; diff --git a/towernbullet.h b/towernbullet.h index 52fbe38..83abca4 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -89,6 +89,7 @@ int CreateBullet2(double x,double y,double bs,double rad,bool eff=false,bool inv //bullet[i].bulletspr=new hgeSprite(SprSheet,0,0,24,24); //bullet[i].bulletspr->SetColor(0x80FFFFFF); bullet[i].scollable=true; + bullet[i].collable=true; bullet[i].bulletaccel=bullet[i].limv=0; bullet[i].scale=1; //bullet[i].bulletspr->SetHotSpot(12,12); @@ -403,15 +404,18 @@ void ProcessBullet2(int i) bullet[i].bullettype=0; return; } - if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7) + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable) //If collision is detected or the bullet flys out of screen, delete it. { - ++coll,scminus+=10000,Mult_BatClear(); - bullet[i].exist=false; - bullet[i].bulletpos.x=bullet[i].bulletpos.y=0; - bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; - bullet[i].dist=0; - bullet[i].bullettype=0; + ++coll,scminus+=10000,Mult_BatClear();bullet[i].collable=false; + if(!bullet[i].inv) + { + bullet[i].exist=false; + bullet[i].bulletpos.x=bullet[i].bulletpos.y=0; + bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; + bullet[i].dist=0; + bullet[i].bullettype=0; + } return; } else @@ -1922,7 +1926,6 @@ public: } }; class WOP -//module: { private: int trail[200];//Pointer to bullet[] in this trail @@ -1969,3 +1972,55 @@ public: if (OutOfBound())active=false; } }; +class SimpleThing +{ +private: + vector2d center; + int step,cnt; + double rad,dly,lr,ra; + SimpleBullet b[500]; + double r[500],mr[500]; + bool create,rot; +public: + void Init(vector2d _ctr) + { + center=_ctr;step=cnt=dly=lr=ra=0; + create=true;rot=false; + } + void Update(bool rv) + { + dly+=hge->Timer_GetDelta(); + if(dly>0.2&&create) + { + dly=0; + for(int i=0;i<10;++i) + { + b[cnt].bulletpos=center; + b[cnt].aC=blue;b[cnt].aC2=COLOR_COUNT; + r[cnt/10]=0;mr[cnt/10]=(lr+=2); + if (lr>620)create=false; + ++cnt; + } + } + bool all=!create; + if(!rot) + for(int i=0;i