diff options
Diffstat (limited to 'archive/blr2/src')
-rw-r--r-- | archive/blr2/src/background.h | 574 | ||||
-rw-r--r-- | archive/blr2/src/effects.h | 104 | ||||
-rw-r--r-- | archive/blr2/src/global.h | 549 | ||||
-rw-r--r-- | archive/blr2/src/hgeft.cpp | 98 | ||||
-rw-r--r-- | archive/blr2/src/hgeft.h | 75 | ||||
-rw-r--r-- | archive/blr2/src/levels.h | 4305 | ||||
-rw-r--r-- | archive/blr2/src/libcgh.h | 140 | ||||
-rw-r--r-- | archive/blr2/src/libcghEx.cpp | 113 | ||||
-rw-r--r-- | archive/blr2/src/loading.h | 384 | ||||
-rw-r--r-- | archive/blr2/src/main.cpp | 1349 | ||||
-rw-r--r-- | archive/blr2/src/menus.h | 1536 | ||||
-rw-r--r-- | archive/blr2/src/music.h | 34 | ||||
-rw-r--r-- | archive/blr2/src/scorec.h | 258 | ||||
-rw-r--r-- | archive/blr2/src/scoresystem.h | 158 | ||||
-rw-r--r-- | archive/blr2/src/towernbullet.h | 2892 |
15 files changed, 12569 insertions, 0 deletions
diff --git a/archive/blr2/src/background.h b/archive/blr2/src/background.h new file mode 100644 index 0000000..849438c --- /dev/null +++ b/archive/blr2/src/background.h @@ -0,0 +1,574 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Background drawing Implementations +// Copyright Chrisoft 2014 +#include <list> +const char* BACKGROUND_H_FN="background.h"; + +double deltaBG; +//******************************************** +//Full-screen Leaves Background +//******************************************** +class BG_Leaves +{ +private: + DWORD alpha,alim; + bool onfadein,onfadeout; + int fadebreak; + hgeSprite* BGSpr; + HTEXTURE LeafTex; + void DoFadeIn() + { + if (LOWFPS)fadebreak+=17;else ++fadebreak; + if (fadebreak>17)fadebreak=0;else return; + if (LOWFPS)if(alpha+0x20<=alim)alpha+=0x20;else{} + else if (alpha+0x2<=alim)alpha+=2; + 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; + } +public: + bool IsActive() + { + return alpha?true:false; + } + void Init(DWORD limalpha) + { + LeafTex=hge->Texture_Load("./Resources/b_leaves.png"); + BGSpr=new hgeSprite(LeafTex,0,0,200,150); + BGSpr->SetColor(0x00CCCCCC); + onfadein=onfadeout=false;alpha=0x00;alim=limalpha;fadebreak=0; + + } + void SetFadeIn() + { + alpha=0x01; + onfadein=true; + } + void SetFadeOut() + { + alpha=alim; + onfadeout=true; + } + void Update() + { + double tx,ty,dt; + if (onfadein)DoFadeIn(); + if (onfadeout)DoFadeOut(); + dt=hge->Timer_GetDelta(); + deltaBG+=dt; + tx=200*cosf(deltaBG/10); + ty=150*sinf(deltaBG/10); + BGSpr->SetColor(ARGB(alpha,0xCC,0xCC,0xCC)); + for (int i=-1;i<5;++i) + for (int j=-1;j<5;++j) + BGSpr->Render(i*199.0f+tx,j*149.0f+ty); + } +}; +BG_Leaves Leaves; +//******************************************** +//Animated Leaves Background +//******************************************** +HTEXTURE TLeaf; +HTEXTURE TSflake; +bool LE_Active; +double lescale; +HTEXTURE letex;TextureRect letr; +DWORD lecolor; +class Leaf_Node +{ +private: + hgeSprite* Leaf; + double Rotation,DRotate; + double x,y,dx,dy; +public: + void init() + { + Leaf=new hgeSprite(letex,letr.x,letr.y,letr.w,letr.h); + Leaf->SetColor(lecolor); + x=rand()%908-108;y=-108; + dx=rand()%200/100.0f-1.0f;dx*=0.075; + dy=rand()%200/100.0f+0.5f;dy*=0.075; + Rotation=0;DRotate=rand()%100/10000.0f;DRotate*=0.1; + } + bool Update() + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + { + Rotation+=DRotate; + x+=dx;y+=dy; + } + if (x>908||x<-108||y>708)return 1; + Leaf->RenderEx(x,y,Rotation,lescale); + return 0; + } +}; +class Leaf_Anim +{ +public: + std::list<Leaf_Node> llist; + double brk; + void Init() + { + llist.clear(); + brk=rand()%1000/1250.0f; + } + void Update() + { + brk-=hge->Timer_GetDelta(); + if(brk<0) + { + brk=rand()%1000/1250.0f; + Leaf_Node a;a.init(); + llist.push_back(a); + } + for(std::list<Leaf_Node>::iterator i=llist.begin();i!=llist.end();++i) + { + if(i->Update()) + { + std::list<Leaf_Node>::iterator r=i;++r; + llist.erase(i);i=--r; + } + } + } +}Leaf; +//******************************************** +//3D-sky Background +//Based on a hge tutorial +//******************************************** +static const DWORD skyTopColors[3] = {0xFF15092A, 0xFF6C6480, 0xFF89B9D0}; +static const DWORD skyBtmColors[3] = {0xFF303E57, 0xFFAC7963, 0xFFCAD7DB}; +static const DWORD seaTopColors[3] = {0xFF3D546B, 0xFF927E76, 0xFF86A2AD}; +static const DWORD seaBtmColors[3] = {0xFF1E394C, 0xFF2F4E64, 0xFF2F4E64}; +static const int skyseq[9]={0, 0, 1, 2, 2, 2, 1, 0, 0}; +class TDSky +{ +#define ScreenWidth 800 +#define ScreenHeight 600 +#define Stars 100 +#define SeaDisize 16 +#define SkyHeight (ScreenHeight*0.6f) +#define StarsHeight (SkyHeight*0.9f) +#define OrbitRadius (ScreenWidth*0.43f) +private: + HTEXTURE skyitem; + hgeQuad skygrad; + hgeSprite *sun,*moon,*glow,*seaglow,*star; + hgeDistortionMesh *sea,*skylyr; + float timet,speed,skya,skylima,seq_residue; + int seq_id; + float starX[Stars],starY[Stars],starS[Stars],starA[Stars],seaP[SeaDisize]; + hgeColor colWhite,colSkyTop,colSkyBtm,colSeaTop,colSeaBtm; + hgeColor colSun,colSunGlow; + hgeColor colMoon,colMoonGlow,colSeaGlow; + float sunX,sunY,sunS,sunGlowS; + float moonX,moonY,moonS,moonGlowS; + float seaGlowX,seaGlowSX,seaGlowSY; + bool skyOnFadeIn,skyOnFadeOut; + float GetTime() + { + struct tm *t=0; + time_t tt=time(NULL); + t=localtime(&tt); + float tmp=0; + if(t) + { + tmp=t->tm_sec; + tmp=t->tm_min+tmp/60.0f; + tmp=t->tm_hour+tmp/60.0f; + } + return tmp; + } + void SkyDoFadeIn() + { + float dlt=1.0f/hge->Timer_GetFPS(); + if (skya+dlt<skylima)skya+=dlt; + else skya=skylima,skyOnFadeIn=false; + } + void SkyDoFadeOut() + { + float dlt=1.0f/hge->Timer_GetFPS(); + if (skya-dlt>0)skya-=dlt; + else skya=0.0f,skyOnFadeOut=false; + } +public: + bool Init() + { + skyitem=hge->Texture_Load("./Resources/e_skyitem.png"); + if(!skyitem) return false; + skygrad.tex=0;skygrad.blend=BLEND_DEFAULT; + for(int i=0;i<4;++i)skygrad.v[i].z=0.5; + skygrad.v[0].tx=0;skygrad.v[0].ty=0; + skygrad.v[1].tx=1;skygrad.v[1].ty=0; + skygrad.v[2].tx=1;skygrad.v[2].ty=1; + skygrad.v[3].tx=0;skygrad.v[3].ty=1; + skygrad.v[0].x=0;skygrad.v[0].y=0; + skygrad.v[1].x=800;skygrad.v[1].y=0; + skygrad.v[2].x=800;skygrad.v[2].y=600; + skygrad.v[3].x=0;skygrad.v[3].y=600; + sea=new hgeDistortionMesh(SeaDisize, SeaDisize); + sea->SetTextureRect(0, 0, ScreenWidth, ScreenHeight-SkyHeight); + sun=new hgeSprite(skyitem,81,0,114,114); + sun->SetHotSpot(57,57); + moon=new hgeSprite(skyitem,0,0,81,81); + moon->SetHotSpot(40,40); + star=new hgeSprite(skyitem,195,0,9,9); + star->SetHotSpot(5,5); + glow=new hgeSprite(skyitem,204,0,128,128); + glow->SetHotSpot(64,64); + glow->SetBlendMode(BLEND_COLORADD | BLEND_ALPHABLEND | BLEND_NOZWRITE); + seaglow=new hgeSprite(skyitem,204,96,128,32); + seaglow->SetHotSpot(64,0); + seaglow->SetBlendMode(BLEND_COLORADD | BLEND_ALPHAADD | BLEND_NOZWRITE); + skylyr=new hgeDistortionMesh(16, 16); + skylyr->SetTexture(skyitem); + skylyr->SetTextureRect(0,128,512,512); + skylyr->SetBlendMode(BLEND_ALPHAADD); + colWhite.SetHWColor(0xFFFFFFFF); + timet=GetTime(); + speed=skya=0.0f; + for(int i=0;i<Stars;++i) + { + starX[i]=rand()%ScreenWidth; + starY[i]=rand()%((int)StarsHeight); + starS[i]=(rand()%60+10.0f)/100.0f; + } + for(int i=0;i<SeaDisize;++i) + { + seaP[i]=i+(rand()%300-150.0f)/10.0f; + } + return true; + } + void Deinit() + { + delete seaglow;delete glow; + delete star;delete moon; + delete sun; + delete sea;delete skylyr; + hge->Texture_Free(skyitem); + } + void SetSpeed(float _speed){speed=_speed;} + void SetSkyA(float _skya){skya=_skya;} + void SetTime(float _timet){timet=_timet;} + void SkySetFadeIn(float _starta=0.0f,float _lima=1.0f) + { + skya=_starta;skylima=_lima; + skyOnFadeIn=true;skyOnFadeOut=false; + } + void SkySetFadeOut(float _starta=0.0f) + { + if (_starta>1E-4)skya=_starta; + skyOnFadeIn=false;skyOnFadeOut=true; + } + void Update() + { + int i, j, k; + float zenith,a,dy,fTime; + float posX,s1,s2; + const float cellw=ScreenWidth/(SeaDisize-1); + hgeColor col1,col2; + DWORD dwCol1,dwCol2; + if(speed==0.0f) timet=GetTime(); + else + { + timet+=hge->Timer_GetDelta()*speed; + if(timet>=24.0f) timet-=24.0f; + } + seq_id=(int)(timet/3); + seq_residue=timet/3-seq_id; + zenith=-(timet/12.0f*pi-pi/2.0f); + col1.SetHWColor(skyTopColors[skyseq[seq_id]]); + col2.SetHWColor(skyTopColors[skyseq[seq_id+1]]); + colSkyTop=col2*seq_residue + col1*(1.0f-seq_residue); + col1.SetHWColor(skyBtmColors[skyseq[seq_id]]); + col2.SetHWColor(skyBtmColors[skyseq[seq_id+1]]); + colSkyBtm=col2*seq_residue + col1*(1.0f-seq_residue); + col1.SetHWColor(seaTopColors[skyseq[seq_id]]); + col2.SetHWColor(seaTopColors[skyseq[seq_id+1]]); + colSeaTop=col2*seq_residue + col1*(1.0f-seq_residue); + col1.SetHWColor(seaBtmColors[skyseq[seq_id]]); + col2.SetHWColor(seaBtmColors[skyseq[seq_id+1]]); + colSeaBtm=col2*seq_residue + col1*(1.0f-seq_residue); + if(seq_id>=6 || seq_id<2) + for(int i=0; i<Stars; ++i) + { + a=1.0f-starY[i]/StarsHeight; + //a*=hge->Random_Float(0.6f, 1.0f); + a*=(rand()%40+60.0f)/100.0f; + if(seq_id>=6) a*=sinf((timet-18.0f)/12.0f*pi); + else a*=sinf((1.0f-timet/6.0f)*pi/2); + starA[i]=a; + } + if(seq_id==2) a=sinf(seq_residue*pi/2); + else if(seq_id==5) a=cosf(seq_residue*pi/2); + else if(seq_id>2 && seq_id<5) a=1.0f; + else a=0.0f; + colSun.SetHWColor(0xFFEAE1BE); + colSun=colSun*(1-a)+colWhite*a; + a=(cosf(timet/6.0f*pi)+1.0f)/2.0f; + if(seq_id>=2 && seq_id<=6) + { + colSunGlow=colWhite*a; + colSunGlow.a=1.0f; + } + else colSunGlow.SetHWColor(0xFF000000); + sunX=ScreenWidth*0.5f+cosf(zenith)*OrbitRadius; + sunY=SkyHeight*1.2f+sinf(zenith)*OrbitRadius; + sunS=1.0f-0.3f*sinf((timet-6.0f)/12.0f*pi); + sunGlowS=3.0f*(1.0f-a)+3.0f; + if(seq_id>=6) a=sinf((timet-18.0f)/12.0f*pi); + else a=sinf((1.0f-timet/6.0f)*pi/2); + colMoon.SetHWColor(0x20FFFFFF); + colMoon=colMoon*(1-a)+colWhite*a; + colMoonGlow=colWhite; + colMoonGlow.a=0.5f*a; + moonX=ScreenWidth*0.5f+cosf(zenith-pi)*OrbitRadius; + moonY=SkyHeight*1.2f+sinf(zenith-pi)*OrbitRadius; + moonS=1.0f-0.3f*sinf((timet+6.0f)/12.0f*pi); + moonGlowS=a*0.4f+0.5f; + if(timet>19.0f || timet<4.5f) + { + a=0.2f; + if(timet>19.0f && timet<20.0f) a*=(timet-19.0f); + else if(timet>3.5f && timet<4.5f) a*=1.0f-(timet-3.5f); + colSeaGlow=colMoonGlow; + colSeaGlow.a=a; + seaGlowX=moonX; + seaGlowSX=moonGlowS*3.0f; + seaGlowSY=moonGlowS*2.0f; + } + else if(timet>6.5f && timet<19.0f) + { + a=0.3f; + if(timet<7.5f) a*=(timet-6.5f); + else if(timet>18.0f) a*=1.0f-(timet-18.0f); + colSeaGlow=colSunGlow; + colSeaGlow.a=a; + seaGlowX=sunX; + seaGlowSX=sunGlowS; + seaGlowSY=sunGlowS*0.6f; + } + else colSeaGlow.a=0.0f; + for(i=1; i<SeaDisize-1; ++i) + { + a=float(i)/(SeaDisize-1); + col1=colSeaTop*(1-a)+colSeaBtm*a; + dwCol1=col1.GetHWColor(); + fTime=2.0f*hge->Timer_GetTime(); + a*=20; + for(j=0; j<SeaDisize; ++j) + { + sea->SetColor(j, i, dwCol1); + dy=a*sinf(seaP[i]+(float(j)/(SeaDisize-1)-0.5f)*pi*16.0f-fTime); + sea->SetDisplacement(j, i, 0.0f, dy, HGEDISP_NODE); + } + } + float t=0.1*hge->Timer_GetTime(); + skylyr->SetTextureRect(128+sin(t)*128.0f,256+cos(t)*128.0f,256,128); + if (skyOnFadeIn)SkyDoFadeIn(); + if (skyOnFadeOut)SkyDoFadeOut(); + for (int i=-8;i<8;++i) + for (int j=-8;j<8;++j) + { + skylyr->SetColor(j+8,i+8,ARGB((int)(skya*((i+9)*16-16)),0xFF,0xFF,0xFF)); + skylyr->SetDisplacement(j+8,i+8,j*(16.0f*((i+9)/16.0f)+64.0f),i*24,HGEDISP_CENTER); + } + dwCol1=colSeaTop.GetHWColor(); + dwCol2=colSeaBtm.GetHWColor(); + for(j=0; j<SeaDisize; ++j) + { + sea->SetColor(j, 0, dwCol1); + sea->SetColor(j, SeaDisize-1, dwCol2); + } + if(timet>19.0f || timet<5.0f) + { + a=0.12f; + if(timet>19.0f && timet<20.0f) a*=(timet-19.0f); + else if(timet>4.0f && timet<5.0f) a*=1.0f-(timet-4.0f); + posX=moonX; + } + else if(timet>7.0f && timet<17.0f) + { + a=0.14f; + if(timet<8.0f) a*=(timet-7.0f); + else if(timet>16.0f) a*=1.0f-(timet-16.0f); + posX=sunX; + } + else a=0.0f; + if(a!=0.0f) + { + k=(int)floorf(posX/cellw); + s1=(1.0f-(posX-k*cellw)/cellw); + s2=(1.0f-((k+1)*cellw-posX)/cellw); + if(s1>0.7f) s1=0.7f; + if(s2>0.7f) s2=0.7f; + s1*=a;s2*=a; + for(i=0; i<SeaDisize; i+=2) + { + a=sinf(float(i)/(SeaDisize-1)*pi/2); + col1.SetHWColor(sea->GetColor(k,i)); + col1+=colSun*s1*(1-a); + col1.Clamp(); + sea->SetColor(k, i, col1.GetHWColor()); + col1.SetHWColor(sea->GetColor(k+1,i)); + col1+=colSun*s2*(1-a); + col1.Clamp(); + sea->SetColor(k+1, i, col1.GetHWColor()); + } + } + } + void Render() + { +#ifdef WIN32 + skygrad.tex=0; + skygrad.blend=BLEND_DEFAULT; +#endif + skygrad.v[0].col=skygrad.v[1].col=colSkyTop.GetHWColor(); + skygrad.v[2].col=skygrad.v[3].col=colSkyBtm.GetHWColor(); + hge->Gfx_RenderQuad(&skygrad); + if(seq_id>=6 || seq_id<2) + for(int i=0; i<Stars; ++i) + { + star->SetColor((DWORD(starA[i]*255.0f)<<24) | 0xFFFFFF); + star->RenderEx(starX[i], starY[i], 0.0f, starS[i]); + } + glow->SetColor(colSunGlow.GetHWColor()); + glow->RenderEx(sunX, sunY, 0.0f, sunGlowS); + sun->SetColor(colSun.GetHWColor()); + sun->RenderEx(sunX, sunY, 0.0f, sunS); + glow->SetColor(colMoonGlow.GetHWColor()); + glow->RenderEx(moonX, moonY, 0.0f, moonGlowS); + moon->SetColor(colMoon.GetHWColor()); + moon->RenderEx(moonX, moonY, 0.0f, moonS); + sea->Render(0, SkyHeight); + seaglow->SetColor(colSeaGlow.GetHWColor()); + seaglow->RenderEx(seaGlowX, SkyHeight, 0.0f, seaGlowSX, seaGlowSY); + skylyr->Render(ScreenWidth/8*3,ScreenHeight/3*2); + } +}; +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; + double scale; + 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>17)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=false; + } + void RenderCenterAt(vector2d a,double scl) + { + vector2d s=vector2d(hge->Texture_GetWidth(quad.tex,true)*scl,hge->Texture_GetHeight(quad.tex,true)*scl); + 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 SetScale(double _scl){scale=_scl;} + void Init(const char *tx,arMode _Mode,DWORD _alim) + { + quad.tex=hge->Texture_Load(tx);alim=_alim; + Mode=_Mode;scale=1;quad.blend=BLEND_DEFAULT; +#ifdef WIN32 + vector2d srl=vector2d(hge->Texture_GetWidth(quad.tex,true), + hge->Texture_GetHeight(quad.tex,true)); + vector2d srm=vector2d(hge->Texture_GetWidth(quad.tex,false), + hge->Texture_GetHeight(quad.tex,false)); + srm.x=srl.x/srm.x;srm.y=srl.y/srm.y; + quad.v[0].tx=0;quad.v[0].ty=0; + quad.v[1].tx=srm.x;quad.v[1].ty=0; + quad.v[2].tx=srm.x;quad.v[2].ty=srm.y; + quad.v[3].tx=0;quad.v[3].ty=srm.y; +#else + 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; +#endif + onfadein=onfadeout=false;alpha=0; + } + void Update() + { + if(onfadein)DoFadeIn();if(onfadeout)DoFadeOut(); + switch(Mode) + { + case Centered: + RenderCenterAt(vector2d(400,300),scale); + break; + case Tiled: + { + vector2d s=vector2d(hge->Texture_GetWidth(quad.tex,true)*scale,hge->Texture_GetHeight(quad.tex,true)*scale); + 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),scale); + } + 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,bdiff; +DWORD ColorTransfer(DWORD a,DWORD t) +{ + int r=GETR(a),g=GETG(a),b=GETB(a),sa=GETA(a); + int tr=GETR(t),tg=GETG(t),tb=GETB(t),ta=GETA(t); + if (sa<ta)++sa;if (sa>ta)--sa; + if (r<tr)++r;if (r>tr)--r; + if (g<tg)++g;if (g>tg)--g; + if (b<tb)++b;if (b>tb)--b; + a=SETR(a,r);a=SETG(a,g);a=SETB(a,b);a=SETA(a,sa); + return a; +} diff --git a/archive/blr2/src/effects.h b/archive/blr2/src/effects.h new file mode 100644 index 0000000..d71a445 --- /dev/null +++ b/archive/blr2/src/effects.h @@ -0,0 +1,104 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Effects Implementations +// Copyright Chrisoft 2014 +//static const char* EFFECTS_H_FN="effects.h"; + +void SCEffect_Attatch(vector2d Target=vector2d(-100,-100)) +{ + int cnt=rand()%8+3; + if(Target.x<-50&&Target.y<-50)Target=playerpos; + for (int ii=1;ii<=cnt;++ii) + { + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].bullettype=254; + bullet[i].bulletpos.x=Target.x+3; + bullet[i].bulletpos.y=Target.y+3; + bullet[i].bulletdir.x=rand()%100-50; + bullet[i].bulletdir.y=rand()%100-50; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=rand()%4+2; + bullet[i].sccolor=0x80FFFFFF; + } +} +void SCEffect_Process(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=254)return; + if (!DisablePlayer) + { + if (LOWFPS) + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + ++effskp; + if (effskp==7) + bullet[i].sccolor=bullet[i].sccolor-0x1F000000,effskp=0; + } + else + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + ++effskp; + if (effskp==7) + bullet[i].sccolor=bullet[i].sccolor-0x1000000,effskp=0; + } + } + if (GETA(bullet[i].sccolor)<=0x0A||bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800||bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600) + { + 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; + } + else + { + bulletspr[grey]->SetColor(bullet[i].sccolor); + bulletspr[grey]->RenderEx(bullet[i].bulletpos.x+2.4,bullet[i].bulletpos.y+2.4,0,0.2,0); + } +} +void BulletEffect_Attatch(int n) +{ + bullet[n].scale=2; + bullet[n].effbrk=17; +} +void BulletEffect_Process(int n) +{ + if (bullet[n].scale<=1){bullet[n].scale=1;return;} + if (LOWFPS) + bullet[n].effbrk-=17; + else + --bullet[n].effbrk; + if (bullet[n].effbrk<=0) + bullet[n].scale-=0.04,bullet[n].effbrk=17; +} +int BulletEffect_Death(Bullet a,DWORD color) +{ + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].bullettype=253; + bullet[i].bulletpos.x=a.bulletpos.x; + bullet[i].bulletpos.y=a.bulletpos.y; + bullet[i].bulletdir.x=bullet[i].bulletdir.y=bullet[i].dist=0; + bullet[i].bulletspeed=0; + bullet[i].alterColor=circle; + bullet[i].scollable=false; + bullet[i].scale=1; + bullet[i].sccolor=SETA(color,0x80); + bullet[i].effbrk=7; + return i; +} +void BulletDeath_Process(int i) +{ + if (!bullet[i].exist)return; + if (LOWFPS) + bullet[i].effbrk-=17; + else + --bullet[i].effbrk; + if (GETA(bullet[i].sccolor)<=10)return (void)(bullet[i].exist=false); + if (bullet[i].effbrk<=0&&Current_Position==1) + bullet[i].effbrk=7,bullet[i].scale+=0.1,bullet[i].sccolor=SETA(bullet[i].sccolor,GETA(bullet[i].sccolor)-6); + bulletspr[circle]->SetColor(bullet[i].sccolor); + bulletspr[circle]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale); +} diff --git a/archive/blr2/src/global.h b/archive/blr2/src/global.h new file mode 100644 index 0000000..a20c5d1 --- /dev/null +++ b/archive/blr2/src/global.h @@ -0,0 +1,549 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Global varibles and implementations +// Copyright Chrisoft 2014 +#include <hge.h> +#include <hgefont.h> +#define MaxRes 80 +#define Resd 20.0f +#define MaxBulCnt 20000 +HGE *hge=0; +HEFFECT snd,menuin,menuout,menumov; +hgeQuad quad; +hgeFont *fnt,*vdig,*bdig; +hgeSprite *spr,*titlespr; +int Current_Position;//Where we are now +/*Scenes: +0: main menu +1: game scene +2: tip scene +3: start menu +4: about scene +5: death scene +6: complete scene +7: new highscore scene +8: highscore scene +9: highscore view scene +10: highscore details scene +11: Pause scene +12: BackToTitle Confirmation +13: Options scene +14: Player Profile scene +15: Help scene +*/ +HTEXTURE SprSheet,TexTitle,TexCredits,MenuTex,HelpTex; +/* +Texture Mapping: +SprSheet:ss.png +Bullet Blue 0,0,24,24 +Bullet Dark Blue 24,0,24,24 +Bullet Green 48,0,24,24 +Bullet Orange 72,0,24,24 +Bullet Pnt 96,0,24,24 +Bullet Purple 120,0,24,24 +Bullet Red 144,0,24,24 +Bullet White 168,0,24,24 +Bullet Yellow 192,0,24,24 +Cursor 216,0,24,24 +Player 0,24,24,24 +Bullet Circle 24,24,24,24 +Tower Blue 0,48,44,44 +Tower Dark Blue 0,92,44,44 +Tower Green 0,136,44,44 +Tower Orange 0,180,44,44 +Tower Purple 48,24,44,44 +Tower Red 92,24,44,44 +Tower White 136,24,44,44 +Tower Yellow 180,24,44,44 +Target 63,71,193,193 +Laser Module 0,264,248,8 +Ribbon Module 151,264,2,8 +Multiplier"+1" 0,272,48,48 +MultPo spawn efct 48,272,48,48 +Text:blnsns.png +"Multiplier bonus!" 0,235,163,21 +Menus and titles: menus.png +Menu items... +Classic Mode 0,0,256,128 +Assessment Mode 256,0,256,128 +Free Play Mode 0,128,256,128 +Titles... +Select a Mode 256,128,256,64 +Options 256,192,256,64 +Player Preference 0,256,256,64 +You Are Dead! 256,256,256,64 +It Ends Here! 0,320,256,64 +View Highscore for..0,376,256,64 +Highscore details 0,448,256,64 +Left Arrow 256,320,26,15 +Right Arrow 256,335,26,15 +Ribbon 256,350,64,16 +*/ +enum TColors +{green=0,blue,yellow,purple,red,white,dblue,orange,grey,circle,COLOR_COUNT}; +hgeSprite *bulletspr[COLOR_COUNT],*towerspr[COLOR_COUNT]; +const double zero=1e-5; +vector2d playerpos; +bool playerLockX,playerLockY; +bool DisableAllTower; +bool DisablePlayer; +bool LOWFPS,diffkey,showdebug; +int VidMode=-1; +hgeTTFont rbPanelFont; +inline double GetDist(vector2d,vector2d); +class Bullet +{ +public: + vector2d bulletpos,bulletdir,limpos; + double dist; + int bullettype,redexplo,redattrib,oriexplo,whicnt; + DWORD sccolor; + /*In Orange bullets + //redattrib also serves as oraattrib to determine if they will explode or change direction + //redexplo also serves as orange explo + //yelbrk serves as direction-change timer + //whicnt describes how much one will explode into (into an exactly circle)*/ + double bulletspeed,bulletaccel,limv; + int exist,inv,addblend; + int whirem,whiskp,yelbrk; + int exp1,exp2; + double lifetime,rot; + bool scollable,collable,extborder; + double scale;int effbrk; + TColors alterColor,alterColor2; + void redir(vector2d targ) + { + bulletdir.x=bulletpos.x-targ.x; + bulletdir.y=bulletpos.y-targ.y; + dist=bulletdir.x*bulletdir.x+bulletdir.y*bulletdir.y; + dist=sqrt(dist); + bulletdir.x/=dist;bulletdir.y/=dist;dist=1; + } + void setdir(double rad) + { + bulletdir.x=cos(rad); + bulletdir.y=sin(rad); + dist=1; + } +}*bullet=NULL; +/*Something about bullets: +//bullettype: +//1: player dir-based green bullet +//2: degree-based blue bullet (for clocks only)[are they clocks?] +//3: 12direction-based blue bullet +//4: yellow chaser bullet +//5: purple slow down bullet +//6: red exploding bullet +//7: white stalled bullet +//8: Orange Redir bullet +//9: dark Blue bullet +//254: Semi-collision effect +//255: Score point*/ +struct Tower +{ + vector2d towerpos; + int towertype; + int towertimer,curtimer; + int towertimer2,curtimer2,shotcount,curshotcount; + bool dblstate; + double bulletspeed; + int redexplo,whicnt,yelbrk; + int exp1,exp2; + int t3t; + bool exist,effect; + double offset; + DWORD RendColor; +}tower[250]; +//t3t is for Tower3 +//0:All 12 directions +//1:four default directions +//2:random left/right +//3:random up/down +struct Target//An annoying circle +{ + hgeSprite *targspr; + vector2d targpos,targdir; + double rot,rotspd; + bool isonshow,isonhide,visible; + void Init(double _rotspd,vector2d ipos) + { + targspr=new hgeSprite(SprSheet,63,71,193,193); + targspr->SetHotSpot(96.5f,96.5f); + rotspd=_rotspd; + rot=0; + targpos=ipos; + } + void TargShow() + { + if (!visible) + isonshow=true,isonhide=false,visible=true; + } + void TargHide() + { + if (visible) + isonhide=true,isonshow=false; + } + void TargShowProc() + { + if (LOWFPS) + targspr->SetColor(SETA(targspr->GetColor(),GETA(targspr->GetColor())+17)); + else + targspr->SetColor(SETA(targspr->GetColor(),GETA(targspr->GetColor())+1)); + if (GETA(targspr->GetColor())>=0x80) + isonshow=isonhide=false,targspr->SetColor(SETA(targspr->GetColor(),0x80)); + } + void TargHideProc() + { + if (LOWFPS) + if(GETA(targspr->GetColor())<17) + targspr->SetColor(SETA(targspr->GetColor(),0)); + else + targspr->SetColor(SETA(targspr->GetColor(),GETA(targspr->GetColor())-17)); + else + targspr->SetColor(SETA(targspr->GetColor(),GETA(targspr->GetColor())-1)); + if (GETA(targspr->GetColor())==0x00) + isonshow=isonhide=visible=false; + } + void TargFollowPlayer() + { + double curspd=0.01f; + if (GetDist(playerpos,targpos)>1)curspd=0.02f;else targpos=playerpos; + if (GetDist(playerpos,targpos)>2)curspd=0.1f; + if (GetDist(playerpos,targpos)>5)curspd=0.5f; + if (GetDist(playerpos,targpos)>10)curspd=0.75f; + if (GetDist(playerpos,targpos)>20)curspd=1.0f; + if (GetDist(playerpos,targpos)>30)curspd=2.0f; + if (GetDist(playerpos,targpos)>40)curspd=5.0f; + targdir.x=targpos.x-playerpos.x; + targdir.y=targpos.y-playerpos.y; + double dist=sqr(targdir.x)+sqr(targdir.y); + dist=sqrt(dist); + if (dist<1e-4)return; + if (LOWFPS) + targpos.x-=targdir.x/dist*curspd*17/20, + targpos.y-=targdir.y/dist*curspd*17/20; + else + targpos.x-=targdir.x/dist*curspd/20, + targpos.y-=targdir.y/dist*curspd/20; + } + void TargGoto(vector2d pos) + { + double curspd=0.01f; + if (GetDist(pos,targpos)>1)curspd=0.25f;else targpos=pos; + if (GetDist(pos,targpos)>2)curspd=0.5f; + if (GetDist(pos,targpos)>5)curspd=1.0f; + if (GetDist(pos,targpos)>10)curspd=2.0f; + if (GetDist(pos,targpos)>20)curspd=3.0f; + if (GetDist(pos,targpos)>30)curspd=4.0f; + if (GetDist(pos,targpos)>40)curspd=5.0f; + targdir.x=targpos.x-pos.x; + targdir.y=targpos.y-pos.y; + double dist=sqr(targdir.x)+sqr(targdir.y); + dist=sqrt(dist); + if (dist<1e-4)return; + if (LOWFPS) + targpos.x-=targdir.x/dist*curspd*17/20, + targpos.y-=targdir.y/dist*curspd*17/20; + else + targpos.x-=targdir.x/dist*curspd/20, + targpos.y-=targdir.y/dist*curspd/20; + } + void TargRender() + { + if (isonshow)TargShowProc();if(isonhide)TargHideProc(); + targspr->RenderEx(targpos.x+7,targpos.y+7,rot,0.8); + if (!DisableAllTower) + { + if (LOWFPS) + rot+=17*rotspd; + else + rot+=rotspd; + } + } +}ATarg,BTarg; +int bulcnt=0,towcnt=0,linecnt=0; +double playerrot; +double playerspeed; +double playerslospeed; +double playerfulspd=0.2; +double playerfulslospd=0.05; +double clockrot,deltarot,deltadelta; +double whirot,dwhirot; +hgeSprite *playerspr; +DWORD DBGColor; +int frameleft,infofade; +int level,part,clrtime,clrbns; +int coll,semicoll,mode,dsmc,restarts; +double clrrange,clrrad,clrmaxrange,clrind,assetime,asts; +hgeSprite *clrcircle; +bool Dis8ref,t8special; +int frameskips=0,stepskips=0; +bool IfCallLevel,IfShowTip,FadeTip,PlayerSplit,charge; +RandomEngine re; +hgeFont *TipFont,*MenuFont; +char lasttip[200]; +int whicnt,whrcnt,shots,clrusg; +bool yelattrib,Complete; +double bsscale; +long long score,scminus; +double mult,lsc; +int multbrk,multbat; +int frms;double averfps; +int plrspd,plrslospd; +int TenSeconds=600,TwentySeconds=1200,ThirtySeconds=1800,AMinute=3600; +int Infinity=1000000000; +int effskp=0; +hgeSprite *Credits,*CreditsRail; +int creditsp;double creditfly,creditacc,credbrk; +bool credstop,creddone; +hgeSprite *Helpspr,*NHelpspr,*HlpL,*HlpR; +double Helpscroll,Hlpyofst;int Helpslide; +bool hshl; +bool tfs; +double scale; +#ifndef WIN32 +double yos; +#endif +int fpslvl,clrmode,sfxvol,bgmvol; +const vector2d splitData[4]={vector2d(0,0),vector2d(400,0),vector2d(0,300),vector2d(400,300)}; +//options from command line arguments +bool fNoSound, +#ifdef WIN32 +noHideConsole, +#endif +fFristStartUp,fFast; +int startLvl,startPrt,fFullScreen; +char alterLog[64]; +#ifdef WIN32 +static const int arFilecount=23; +static const char* archive[]={ +"./Resources/b_diff.png", +"./Resources/b_inter.png", +"./Resources/b_null.png", +"./Resources/e_sflake.png", +"./Resources/e_skyitem.png", +"./Resources/blnsns.png", +"./Resources/charmap.fnt", +"./Resources/vdig.fnt", +"./Resources/bdig.fnt", +"./Resources/ss.png", +"./Resources/help.png", +"./Resources/menus.png", +"./Resources/title.png", +"./Resources/credits.png", +"./Resources/b_leaves.png", +"./Resources/e_leaf.png", +"./Resources/tap.ogg", +"./Resources/menuin.ogg", +"./Resources/menuout.ogg", +"./Resources/Music/BLR2_TR01.ogg", +"./Resources/Music/BLR2_TR07.ogg", +"./Resources/Music/BLR2_TR09.ogg", +"./Resources/Music/CanonTechno.ogg" +}; +#endif +//static const char* GLOBAL_H_FN="global.h"; +static const char* BLRVERSION="1.0.0-0 (r100)"; +static const char *months="JanFebMarAprMayJunJulAugSepOctNovDec"; +char *parseDate(const char *date) +{ + char ms[8]; + int y,d,m;sscanf(date,"%s %d %d",ms,&d,&y); + m=(strstr(months,ms)-months)/3+1; + char *r=new char[16]; + sprintf(r,"%04d-%02d-%02d",y,m,d); + return r; +} +static char* BuiltDate=parseDate(__DATE__); + +void Throw(char *Filename,char *Info) +{ + fprintf(stderr,"%s: %s\n",Filename,Info); + hge->System_Log("%s: %s\n",Filename,Info); +} +void Error(const char *EC,bool hgecreated=false) +{ + hge->System_Log("%s\n",EC); +#ifdef WIN32 + MessageBox(NULL,EC,"Error!",MB_ICONERROR); +#endif + if (hgecreated) + { + hge->System_Shutdown(); + hge->Release(); + } +#ifdef WIN32 + for(int i=0;i<arFilecount;++i)remove(archive[i]); + _rmdir("./Resources/Music"); + _rmdir("./Resources"); +#endif + exit(1); +} +void ShowTip(const char *tip) +{ + if (strcmp(tip,lasttip)!=0) + { + TipFont->SetColor(0x00FFFFFF); + } + memcpy(lasttip,tip,sizeof(lasttip)); + DisableAllTower=true; + DisablePlayer=true; + if (hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT) + FadeTip=true; + double width=TipFont->GetStringWidth(tip); + TipFont->printf(400-width/2,400,HGETEXT_LEFT,tip); + if (FadeTip) + { + if (LOWFPS) + { + if (TipFont->GetColor()>>24>=0x08) + TipFont->SetColor(TipFont->GetColor()-0x8000000); + else + { + DisableAllTower=false; + DisablePlayer=false; + Current_Position=1; + } + } + else + { + if (TipFont->GetColor()>>24>=0x01) + TipFont->SetColor(TipFont->GetColor()-0x1000000); + else + { + DisableAllTower=false; + DisablePlayer=false; + Current_Position=1; + } + } + return; + } + if (!LOWFPS) + { + if (TipFont->GetColor()>>24<=0xFE) + TipFont->SetColor(TipFont->GetColor()+0x01000000); + } + else + { + if (TipFont->GetColor()>>24<=0xF7) + TipFont->SetColor(TipFont->GetColor()+0x08000000); + } +} +void All2pnt();//forward that... + +int AllocBullet() +{ + int i; + if (bulcnt==0) + { + bulcnt=i=1; + bullet=(Bullet*)malloc(sizeof(Bullet)*(bulcnt+1)); + } + else + { + for (i=1;i<=bulcnt;++i) + if (!bullet[i].exist)break; + if (i>bulcnt) + { + bulcnt=i; + Bullet *nblt=(Bullet*)realloc(bullet,sizeof(Bullet)*(bulcnt+1)); + if(!nblt)Error("Error allocating bullets!",1); + bullet=nblt; + } + } + return i; +} +void SigHandler(int pm) +{ + hge->System_Log("Oops, the application ate a piece of DE AD BE EF!"); +#if defined(__GNUC__) && !defined(MINGW_BUILD) + void *strs[64];unsigned cnt; + char **str;cnt=backtrace(strs,64); + str=backtrace_symbols(strs,cnt); + for(unsigned i=0;i<cnt;++i) + hge->System_Log("%s",str[i]); +#endif + hge->System_Shutdown(); + exit(1); +} +void ClearAll(bool cbullet=true) +{ + DisableAllTower=true; + bool none=true; + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist)continue; + if (LOWFPS) + { + if (tower[i].RendColor>>24>=0x08) + { + tower[i].RendColor=tower[i].RendColor-0x8000000; + none=false; + } + } + else + { + if (tower[i].RendColor>>24>=0x01) + { + tower[i].RendColor=tower[i].RendColor-0x1000000; + none=false; + } + } + } + if (none) + { + towcnt=0; + memset(tower,0,sizeof(tower)); + if (cbullet)All2pnt(); + } +} +TextureRect GetTextureRect(int type,TColors color) +{ + if (type==0) + { + switch(color) + { + case green:return TextureRect(48,0,24,24); + case blue:return TextureRect(0,0,24,24); + case yellow:return TextureRect(192,0,24,24); + case purple:return TextureRect(120,0,24,24); + case red:return TextureRect(144,0,24,24); + case white:return TextureRect(168,0,24,24); + case dblue:return TextureRect(24,0,24,24); + case orange:return TextureRect(72,0,24,24); + case grey:return TextureRect(96,0,24,24); + case circle:return TextureRect(24,24,24,24); + default:return TextureRect(0,0,0,0); + } + } + if (type==1) + { + switch(color) + { + case green:return TextureRect(0,136,44,44); + case blue:return TextureRect(0,48,44,44); + case yellow:return TextureRect(180,24,44,44); + case purple:return TextureRect(48,24,44,44); + case red:return TextureRect(92,24,44,44); + case white:return TextureRect(136,24,44,44); + case dblue:return TextureRect(0,92,44,44); + case orange:return TextureRect(0,180,44,44); + default:return TextureRect(0,0,0,0); + } + } + return TextureRect(0,0,0,0); +} +DWORD ColorToDWORD(TColors a) +{ + switch(a) + { + case green:return 0xCCFF00; + case blue:return 0x33CCFF; + case yellow:return 0xFFFF00; + case purple:return 0x9966FF; + case red:return 0xFFFF3333; + case white:return 0xFFFEFEFE; + case dblue:return 0xFF0000FF; + case orange:return 0xFFFF8800; + default:return 0xFF000000; + } +} diff --git a/archive/blr2/src/hgeft.cpp b/archive/blr2/src/hgeft.cpp new file mode 100644 index 0000000..479027b --- /dev/null +++ b/archive/blr2/src/hgeft.cpp @@ -0,0 +1,98 @@ +// Freetype2 ext4hge implementations -*- C++ -*- +#include "hgeft.h" +static const char* HGEFT_SRC_FN="hgeft.cpp"; +void hgeTTChar::Free(){if(quad.tex)hge->Texture_Free(quad.tex),quad.tex=0;} +bool hgeTTChar::SetChar(wchar_t ch,FT_Face ttfface) +{ + FT_GlyphSlot slot=ttfface->glyph; + FT_UInt glyph_index=FT_Get_Char_Index(ttfface,ch); + FT_Error err=FT_Load_Glyph(ttfface,glyph_index,FT_LOAD_DEFAULT); + if(err){hge->System_Log("%s: Glyph load failed!",HGEFT_SRC_FN);return false;} + err=FT_Render_Glyph(ttfface->glyph,FT_RENDER_MODE_NORMAL); + if(err){hge->System_Log("%s: Glyph render failed!",HGEFT_SRC_FN);return false;} + _w=slot->advance.x>>6;_h=slot->bitmap.rows;//we are one line only. + rw=slot->bitmap.width;rh=slot->bitmap.rows; + xofst=slot->bitmap_left; + yofst=slot->bitmap.rows-slot->bitmap_top; + quad.tex=hge->Texture_Create( + slot->bitmap.width?slot->bitmap.width:1, + slot->bitmap.rows?slot->bitmap.rows:1); + DWORD* tx=hge->Texture_Lock(quad.tex,false,0,0, + slot->bitmap.width?slot->bitmap.width:1, + slot->bitmap.rows?slot->bitmap.rows:1); + memset(tx,0,sizeof(DWORD)*(slot->bitmap.width?slot->bitmap.width:1)*(slot->bitmap.rows?slot->bitmap.rows:1)); + int ptr=0; + for(int i=0;i<slot->bitmap.rows;++i) + for(int j=0;j<slot->bitmap.width;++j) + { +#ifdef WIN32 + tx[i*slot->bitmap.width+j]=ARGB(slot->bitmap.buffer[ptr],255,255,255); +#else + tx[(slot->bitmap.rows-i-1)*slot->bitmap.width+j]=ARGB(slot->bitmap.buffer[ptr],255,255,255); + //In OpenGL, textures are locked upside down... +#endif + ptr++; + } + hge->Texture_Unlock(quad.tex); + quad.blend=BLEND_ALPHABLEND; + 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; + return true; +} +void hgeTTChar::Render(double x,double y,DWORD col) +{ + for(int i=0;i<4;++i)quad.v[i].col=col; + quad.v[0].x=x;quad.v[0].y=y-rh+yofst; + quad.v[1].x=x+rw;quad.v[1].y=y-rh+yofst; + quad.v[2].x=x+rw;quad.v[2].y=y+yofst; + quad.v[3].x=x;quad.v[3].y=y+yofst; + hge->Gfx_RenderQuad(&quad); +} +bool hgeTTFont::Init(const char *ttf,int size) +{ + FT_Error err=FT_Init_FreeType(&libft); + if(err){hge->System_Log("%s: Failed to initialize freetype",HGEFT_SRC_FN);return false;} + err=FT_New_Face(libft,ttf,0,&ttfface); + if(err){hge->System_Log("%s: Failed to load font: %s",HGEFT_SRC_FN,ttf);return false;} + err=FT_Set_Char_Size(ttfface,0,size*64,96,96); + return true; +} +void hgeTTFont::UpdateString(const wchar_t *format, ...) +{ + for(int i=0;buf[i]!='\0';++i)chars[i].Free(); + memset(buf,0,sizeof(buf));memset(chars,0,sizeof(chars)); + va_list vl; + va_start(vl,format); + vswprintf(buf,1024,format,vl); + va_end(vl); + buf[1024]='\0'; + w=h=0; + for(int i=0;buf[i]!='\0';++i) + { + chars[i].SetChar(buf[i],ttfface); + w+=chars[i].w(); + if(chars[i].h()>h)h=chars[i].h(); + } +} +void hgeTTFont::Render(double x,double y,DWORD color,int align) +{ + int cur; + if(align==0) + { + cur=x; + for(int i=0;buf[i]!='\0';++i) + { + chars[i].Render(cur,y,color); + cur+=chars[i].w(); + } + } + if(align==1) + { + cur=x; + for(int i=wcslen(buf)-1;i>=0;--i) + { + chars[i].Render(cur,y,color); + cur-=chars[i].w(); + } + } +} diff --git a/archive/blr2/src/hgeft.h b/archive/blr2/src/hgeft.h new file mode 100644 index 0000000..1badc74 --- /dev/null +++ b/archive/blr2/src/hgeft.h @@ -0,0 +1,75 @@ +// Freetype2 ext4hge header -*- C++ -*- +/* + * Freetype2 extention for hge + * by Chris Xiong + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of the nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Note: freetype 2.5.2 or newer is required. + * This library is somehow buggy, known bugs: + * * blinking charcter... + * * segmentation fault(fixed now,not a problem of the library) + * * Slow... but it's hard to improve... + * * Only support a single line... + * + */ +#ifndef HGEEFT_H +#define HGEEFT_H +#include <cstring> +#include <cwchar> +#include "./include/hge.h" +#include <ft2build.h> +#include FT_FREETYPE_H +extern HGE* hge; +class hgeTTChar +{ +private: + hgeQuad quad; + int rw,rh,_w,_h,yofst; +public: + double w(){return _w;} + double h(){return _h;} + void Free(); + bool SetChar(wchar_t ch,FT_Face ttfface); + void Render(double x,double y,DWORD col); +}; +class hgeTTFont +{ +protected: + FT_Library libft; + FT_Face ttfface; + wchar_t buf[1025]; + hgeTTChar chars[1024]; + double w,h; +public: + bool Init(const char *ttf,int size); + double GetWidth(){return w;} + double GetHeight(){return h;} + void UpdateString(const wchar_t *format, ...); + void Render(double x,double y,DWORD color,int align); +}; +#endif diff --git a/archive/blr2/src/levels.h b/archive/blr2/src/levels.h new file mode 100644 index 0000000..58d7505 --- /dev/null +++ b/archive/blr2/src/levels.h @@ -0,0 +1,4305 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Level Implementations +// Copyright Chrisoft 2014 +/* +How to write a classic level/part... +Classic parts need only one procedure, like this. + frameleft=...; + if (towercnt==/!=...)return ClearAll(); + DisableAllTower=false;bulcnt=0;memset(bullet,0,sizeof(bullet)); + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip(""); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + for (int i=1;i<=towcnt;++i) + if (tower[i].towerspr->GetColor()==0x80FFFFFF) + tower[i].towerspr->SetColor(0x00FFFFFF); + for (int i=1;i<=towcnt;++i) + if ((tower[i].towerspr->GetColor()>>24)<=0x80) + tower[i].towerspr->SetColor(tower[i].towerspr->GetColor()+0x01FFFFFF); + else + { + IfCallLevel=false; + return; + } +*/ +/* +How to write an "advanced" part... +"Advanced" parts usually need two or more parts, ont for initalize and one for things to do every frame. +Write on your own thought... +*/ +bool squashrev; +int posx,posy,fskp,posx2,posy2; +bool doneredir; +int pnt1,pnt2; +//Let's start now! +double towers[16];int tcnt; +double dscroll,roll,tbrk; +bool sout,tendone;bool dmt[16]; +//static const char* LEVEL_H_FN="levels.h"; +void Level1Part0(){++part;} +void Level1Part1() +{ + if(DBGColor!=0xFF888820) + { + for(int i=0;i<3;++i) + DBGColor=ColorTransfer(DBGColor,0xFF888820); + return; + } + CreateTower1(400,300,857,2); + frameleft=AMinute*2;clrtime=1; + tcnt=1;sout=false;dscroll=-0.025f;memset(dmt,true,sizeof(dmt)); + for (int i=0;i<tcnt;++i) + { + towers[i]=600+600.0f/(double)tcnt*i+12; + CreateTower3(200,towers[i],428,3,4); + CreateTower3(600,towers[i],428,3,4); + } + ++part;roll=0;tendone=false; + ShowTip("\ +Level 1-Down by the Bank\n\ +Everything going on properly?\n\ +"); + Current_Position=2; +} +void Level1Part2() +{ + for (int i=0;i<tcnt;++i) + { + if (LOWFPS)towers[i]+=17*dscroll;else towers[i]+=dscroll; + tower[2*(i+1)].towerpos.y=tower[2*(i+1)+1].towerpos.y=towers[i]; + if (towers[i]<=300&&towers[i]>=290&&dmt[i]) + { + NewMultpo(tower[2*(i+1)+1].towerpos); + NewMultpo(tower[2*(i+1)].towerpos); + dmt[i]=false; + } + } + if (!sout) + { + 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) + if (tower[i].towertype==3)tower[i].t3t=4; + tcnt=10; + tendone=true; + for (int i=0;i<tcnt;++i) + { + towers[i]=600+600.0f/(double)tcnt*i+12; + CreateTower3(200,towers[i],428,3,4); + CreateTower3(600,towers[i],428,3,4); + } + } + } +} +void Level1Part3() +{ + frameleft=AMinute;clrtime=1; + if (towcnt!=50&&towcnt!=0)return ClearAll(); + DisableAllTower=false;bulcnt=0;free(bullet);bullet=NULL; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Double-directed Labyrinth!"); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + for (int i=1;i<=25;++i) + CreateTower3(772,i*24-24,1714,2,2), + CreateTower3(28,i*24-12,1714,2,2); + 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; + } +} +int labyred; +void Level1Part4() +{ + if (frameleft<=TwentySeconds) + { + if (LOWFPS)labyred+=17;else ++labyred; + if (labyred>=1500)CreateBullet6(re.NextDouble(0,800),re.NextDouble(0,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; +int fakes[12]; +double L2D; +void Level2Part0() +{ + frameleft=50;L2D=0; + if (towcnt==50) + { + ClearAll(); + return; + } + bulcnt=0;free(bullet);bullet=NULL; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("\ +Level 2-Polygon Mystery\n\ +Place yourself correctly!\ +"); + IfCallLevel=false; + } + if (Current_Position==1) + { + frameleft=0; + return; + } +} +void Level2Part1() +{ + frameleft=AMinute;clrtime=1; + Level2Circle.Init(230,pi/12000,96,vector2d(400,300)); + Level2Circle2.Init(270,-pi/12000,96,vector2d(400,300)); + CreateTower3_fixeddir(400,50,300,3,-2.0f/3.0f*pi); + CreateTower3_fixeddir(400,51,300,3,-1.0f/3.0f*pi); + //======= + CreateTower3_fixeddir(400,550,300,3,2.0f/3.0f*pi); + CreateTower3_fixeddir(400,549,300,3,1.0f/3.0f*pi); + //======= + CreateTower3_fixeddir(616.51,175,300,3,0); + CreateTower3_fixeddir(616.51,176,300,3,-1.0f/3.0f*pi); + //======= + CreateTower3_fixeddir(183.49,175,300,3,-pi); + CreateTower3_fixeddir(183.49,176,300,3,-2.0f/3.0f*pi); + //======= + CreateTower3_fixeddir(616.51,425,300,3,0); + CreateTower3_fixeddir(616.51,424,300,3,1.0f/3.0f*pi); + //======= + 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]=CreateBullet6(400,300,0,999999999,1,1,false),bullet[fakes[i]].inv=true; + ++part;tbrk=0; +} +void Level2Part2() +{ + Level2Circle.Update(); + Level2Circle2.Update(); + L2D+=hge->Timer_GetDelta(); + double base=Level2Circle.GetRad(); + double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; + for (int i=0;i<6;++i) + 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;tbrk+=1; + for (int i=0;i<6;++i) + { + CreateBullet6(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f),2,0,1,6,true); + clockrot=0; + if(tbrk>=5)NewMultpo(vector2d(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f))); + } + if(tbrk>=5)tbrk=0; + } +} +void Level2Part3() +{ + frameleft=AMinute;clrtime=1; + 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;tbrk=0; +} +void Level2Part4() +{ + Level2Circle.Update(); + Level2Circle2.Update(); + L2D+=hge->Timer_GetDelta(); + double base=Level2Circle.GetRad(); + double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; + for (int i=0;i<6;++i) + 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;tbrk+=1; + for (int i=0;i<6;++i) + { + CreateBullet7(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f),2,0,true); + if(tbrk>=5)NewMultpo(vector2d(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f))); + } + if(tbrk>=5)tbrk=0; + } +} +void Level2Part5() +{ + frameleft=TenSeconds/2; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("You've got 5 seconds to choose a fine place..."); + return; + } + ++part;tbrk=0; +} +Laser Lock; +void Level2Part6() +{ + Level2Circle.Update(); + Level2Circle2.Update(); + L2D+=hge->Timer_GetDelta(); + double base=Level2Circle.GetRad(); + double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; + for (int i=0;i<6;++i) + 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;tbrk+=1; + for (int i=0;i<6;++i) + { + CreateBullet7(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f),2,0,true); + if(tbrk>=5)NewMultpo(vector2d(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f))); + } + if(tbrk>=5)tbrk=0; + } + if (frameleft<TenSeconds/20)++part,frameleft=AMinute,clrtime=1; +} +void Level2Part7() +{ + if (!playerLockY)playerLockY=true; + Level2Circle.Update(); + Level2Circle2.Update(); + L2D+=hge->Timer_GetDelta(); + double base=Level2Circle.GetRad(); + double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; + for (int i=0;i<6;++i) + 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;tbrk+=1; + for (int i=0;i<6;++i) + { + CreateBullet7(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f),2,0,true); + if(tbrk>=5)NewMultpo(vector2d(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f))); + } + if(tbrk>=5)tbrk=0; + } +} +double L2D1; +void Level2Part8() +{ + frameleft=ThirtySeconds;L2D1=0; + playerLockY=false;clrtime=2; + for (int i=6;i<12;++i)fakes[i]=CreateBullet6(400,300,0,999999999,1,1,false),bullet[fakes[i]].inv=true; + ++part;tbrk=0; +} +void Level2Part9() +{ + Level2Circle.Update(); + Level2Circle2.Update(); + L2D+=hge->Timer_GetDelta(); + L2D1+=hge->Timer_GetDelta(); + double base=Level2Circle.GetRad(); + double base2=Level2Circle2.GetRad(); + double r=(Level2Circle.GetRange()+Level2Circle2.GetRange())/2.0f; + for (int i=0;i<6;++i) + 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) + 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;tbrk+=1; + for (int i=0;i<6;++i) + { + CreateBullet6(403+r*cos(base2+i*pi/3.0f),303+r*sin(base2+i*pi/3.0f),2,0,1,6,true); + clockrot=0; + if(tbrk>=5)NewMultpo(vector2d(403+r*cos(base2+i*pi/3.0f),303+r*sin(base2+i*pi/3.0f))); + } + } + if (L2D>=5) + { + L2D=0;tbrk+=1; + for (int i=0;i<6;++i) + { + CreateBullet7(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f),2,0,true); + if(tbrk>=5)NewMultpo(vector2d(403+r*cos(base+i*pi/3.0f),303+r*sin(base+i*pi/3.0f))); + } + } + if(tbrk>=5)tbrk=0; +} +void Level3Part0() +{ + frameleft=50; + if (towcnt==50) + { + ClearAll(); + return; + } + bulcnt=0;free(bullet);bullet=NULL; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("\ +Level 3-Missing Colour\n\ +A negative omen...\ +"); + IfCallLevel=false; + } + if (Current_Position==1) + { + frameleft=0; + return; + } +} +void Level3Part1() +{ + frameleft=ThirtySeconds;clrtime=0; + if (towcnt!=1&&towcnt!=0)return ClearAll(); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Meet my new weapon...Is it cool?"); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower8(400,300,857,3,57,30,false); + 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 + { + IfCallLevel=false; + return; + } +} +void Level3Part2() +{ + frameleft=ThirtySeconds;clrtime=0; + if (towcnt!=4&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("What about quad reflective towers...?"); + All2pnt(); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower8(30,10,1250,3,57,15,false); + CreateTower8(746,10,1250,3,57,15,false); + CreateTower8(30,556,1250,3,57,15,false); + CreateTower8(746,556,1250,3,57,15,false); + 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 + { + IfCallLevel=false; + return; + } +} +TROF fr[6][6]; +int cur; +double elasped; +void Level3Part3() +{ + frameleft=AMinute;clrtime=1; + if (towcnt!=1&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + All2pnt(); + ShowTip("Precise mode is not so precise as expected..."); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower8(400,300,999999999,0,999999999,0,false); + 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 + { + for (int k=0;k<6;++k) + for (int i=0;i<6;++i) + { + fr[k][i].cnt=10; + fr[k][i].drad=(i+1)*pi/3.0f; + fr[k][i].srad=i*pi/3.0f; + fr[k][i].delay=750; + fr[k][i].stage=-1; + if (k==0)fr[k][i].init(); + } + ++part; + elasped=0;cur=0; + return; + } +} +void Level3Part4() +{ + if (frameleft<TwentySeconds&&tower[1].towertimer==999999999) + { + tower[1].towertimer=tower[1].curtimer=1500; + tower[1].towertimer2=100; + tower[1].bulletspeed=3;tower[1].shotcount=tower[1].curshotcount=10; + } + for (int k=0;k<6;++k) + for (int i=0;i<6;++i) + fr[k][i].update(); + elasped+=hge->Timer_GetDelta(); + if (elasped>3) + { + elasped=0;++cur; + if (cur>=6)cur=0; + double sr=re.NextInt(0,9)*pi/30.0f; + for (int i=0;i<6;++i) + { + fr[cur][i].drad=(i+1)*pi/3.0f+sr; + fr[cur][i].srad=i*pi/3.0f+sr; + fr[cur][i].init(); + } + } +} +double l3p5brk; +void Level3Part5() +{ + frameleft=ThirtySeconds;clrtime=2; + if (towcnt!=0)return ClearAll(false); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + All2pnt();BTarg.TargHide(); + ShowTip("Well, here is a..."); + return; + } + ++part;l3p5brk=0; +} +void Level3Part6() +{ + l3p5brk+=hge->Timer_GetDelta(); + if (l3p5brk>0.2) + { + l3p5brk=0; + for (int i=1;i<=8;++i)bullet[CreateBullet8(i*100-50,20,2,false)].setdir(-pi/2); + } +} +void Level4Part0() +{ + frameleft=50;All2pnt();towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("\ +Level 4-Reunion\n\ +What was the weather like yesterday?...\n\ +"); + IfCallLevel=false; + } + if (Current_Position==1) + { + frameleft=0;bulcnt=0;BTarg.TargHide(); + return; + } +} +void Level4Part1() +{ + frameleft=ThirtySeconds;clrtime=0; + if (towcnt!=1&&towcnt!=0)return ClearAll(); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Where is this idea from?"); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower9(400,300,1000,4,750,36,750); + 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 + { + IfCallLevel=false; + return; + } +} +int redirs[400];int cred; +void Level4Part2() +{ + frameleft=TenSeconds/2;clrtime=0; + if (towcnt==1) + { + ClearAll(); + return; + } + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("..."); + } + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + ATarg.TargShow(); + posx=10,posy=10,doneredir=false; + } +} +void Level4Part3() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>30) + { + fskp=0; + if (posx<766) + { + posx+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + { + if (posy<566) + { + posy+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part4() +{ + frameleft=TenSeconds/2;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx2=766,posy2=566,doneredir=false; + } +} +void Level4Part5() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>30) + { + fskp=0; + if (posx2>10) + { + posx2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + { + if (posy2>10) + { + posy2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part6() +{ + frameleft=TenSeconds/10*4;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + ATarg.TargShow(); + posx=10,posy=10,doneredir=false; + } +} +void Level4Part7() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>30) + { + fskp=0; + if (posx<766) + { + posx+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + { + if (posy<566) + { + posy+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part8() +{ + frameleft=TenSeconds/10*4;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx2=766,posy2=566,doneredir=false; + } +} +void Level4Part9() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>30) + { + fskp=0; + if (posx2>10) + { + posx2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + { + if (posy2>10) + { + posy2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part10() +{ + frameleft=TenSeconds/10*3;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + ATarg.TargShow(); + posx=10,posy=10,doneredir=false; + } +} +void Level4Part11() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx<766) + { + posx+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + { + if (posy<566) + { + posy+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part12() +{ + frameleft=TenSeconds/10*3;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx2=766,posy2=566,doneredir=false; + } +} +void Level4Part13() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx2>10) + { + posx2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + { + if (posy2>10) + { + posy2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part14() +{ + frameleft=TenSeconds/10*2;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + ATarg.TargShow(); + posx=10,posy=10,doneredir=false; + } +} +void Level4Part15() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx<766) + { + posx+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + { + if (posy<566) + { + posy+=12; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part16() +{ + frameleft=TenSeconds/10*2;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx2=766,posy2=566,doneredir=false; + } +} +void Level4Part17() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx2>10) + { + posx2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + { + if (posy2>10) + { + posy2-=12; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level4Part18() +{ + frameleft=TenSeconds;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx=10,posy=10,posx2=766,posy2=566,doneredir=false; + } +} +void Level4Part19() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>33) + { + fskp=0; + if (posx2>10) + { + posx2-=24; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + { + if (posy2>10) + { + posy2-=24; + redirs[++cred]=CreateBullet9(posx2,posy2,0,999999,1,999999); + } + else + if (!doneredir) + for (int i=0;i<=cred;++i) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=2,doneredir=true; + } + if (posx<766) + { + posx+=24; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + else + { + if (posy<566) + { + posy+=24; + redirs[++cred]=CreateBullet9(posx,posy,0,999999,1,999999); + } + } + + } +} +double rot1,dta1,rot2,dta2,spd2,elsp1; +void Level4Part20() +{ + frameleft=AMinute;All2pnt();towcnt=0; + DisableAllTower=false;clrtime=0; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Double Spinner...?"); + } + if (Current_Position==1) + { + BTarg.TargHide();ATarg.TargHide();CreateTower3(400,300,999999999,0,0); + rot1=dta1=rot2=dta2=elsp1=0;spd2=1;++part;IfCallLevel=true; + return; + } +} +void Level4Part21() +{ + elsp1+=hge->Timer_GetDelta(); + if (elsp1<=0.3)return; + elsp1=0; + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + { + dta1+=2*pi/180;dta2-=2*pi/180;spd2=1+4.0f*((AMinute-frameleft)/(double)AMinute); + rot1+=dta1;rot2+=dta2; + } + for (int i=0;i<6;++i)CreateBullet2(400,300,4,rot1+i*pi/3); + for (int i=0;i<6;++i)CreateBullet2(400,300,spd2,rot2+i*pi/3); +} +void Level4Part22() +{ + frameleft=AMinute;clrtime=1; + if (towcnt==1) + { + ClearAll(); + return; + } + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Have problem breathing?\n...so try this!"); + } + if (Current_Position==1) + { + ++part; + pnt1=CreateTower3(10,10,50,20,1); + pnt2=CreateTower3(790,10,50,20,1); + CreateTower9(400,10,2000,2,2000,6,1000); + } +} +void Level4Part23() +{ + if (!LOWFPS) + tower[pnt1].towerpos.x+=0.006,tower[pnt2].towerpos.x-=0.006; + else + tower[pnt1].towerpos.x+=0.006*17,tower[pnt2].towerpos.x-=0.006*17; +} +void Level4Part24() +{ + frameleft=AMinute;clrtime=0; + if (towcnt!=5&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false;All2pnt(); + Current_Position=2; + ShowTip("Let's meet a more classical circle-drawing part...\n\ +...as the end of this level...\nCan you draw perfectly?"); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower4(400,300,2000,2.5); + CreateTower1(9,9,2000,3); + CreateTower1(767,11,2000,3); + CreateTower1(9,567,2000,3); + CreateTower1(767,567,2000,3); + 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 Level4Part25() +{ + if(re.NextInt(0,599)==10)NewMultpo(); + for (int i=2;i<=5;++i) + tower[i].towertimer=((frameleft)/(double)AMinute)*1800+200; +} +void Level5Part0() +{ + frameleft=50;All2pnt();towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + LE_Active=true;letex=TLeaf;lescale=0.75; + letr=TextureRect(0,0,108,108);lecolor=0xCCCC3333; + Leaf.Init(); + Current_Position=2; + ShowTip("\ +Level 5-Crazy Autumn\n\ +Autumn is considered as a miserable season for \n\ +thousands of years...\n\ +This autumn, however, is coming too fast...\ +"); + IfCallLevel=false; + } + if (Current_Position==1) + { + frameleft=0; + return; + } +} +void Level5Part1() +{ + frameleft=ThirtySeconds;clrtime=0; + if (towcnt!=2&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower9(400,300,2000,3,1000,36,750); + CreateTower4(400,50,2000,2.5,0); + 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 + { + IfCallLevel=false; + return; + } +} +void Level5Part2() +{ + frameleft=ThirtySeconds;clrtime=0; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false;All2pnt(); + Current_Position=2; + ShowTip("What if your cheaser is faster than you..."); + return; + } + tower[2].bulletspeed=4;IfCallLevel=false; +} +int pos,lsrbrk; +bool rev; +/**********************\ + * Vortex of Leaves * +\**********************/ +void Level5Part3() +{ + frameleft=AMinute;clrtime=2; + if (towcnt!=0)return (void)ClearAll(); + Lasercnt=12; + for (int i=1;i<=12;++i) + { + laser[i].Init(32); + laser[i].SetTexture(SprSheet,0,264,248,8); + laser[i].RenCtr.x=406,laser[i].RenCtr.y=306; + } + ++part; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false;All2pnt(); + Current_Position=2; + ShowTip("Vortex of leaves..."); + return; + } +} +void Level5Part4() +{ + bool shot=false; + if (LOWFPS)lsrbrk+=16; + if (++lsrbrk>=100)lsrbrk=0,shot=true,++pos; + if (pos==32) + { + pos=0;rev=!rev; + for (int i=1;i<=bulcnt;++i) + if (bullet[i].bullettype==2&&bullet[i].bulletspeed<1e-5) + bullet[i].bulletaccel=0.001, + bullet[i].limv=1+1.5*(frameleft/(double)AMinute); + } + for (int i=1;i<=12;++i) + { + double initrad=pi/6.0f*(i-1); + double dist; + for (int j=0;j<32;++j) + { + dist=j*Resd; + double trad; + if (rev)trad=initrad-j*pi/36.0f;else trad=initrad+j*pi/36.0f; + vector2d t,tt,s; + t.x=cos(trad)*dist; + t.y=sin(trad)*dist; + dist=(j+1)*Resd; + if (rev)trad=initrad-(j+1)*pi/36.0f;else trad=initrad+(j+1)*pi/36.0f; + tt.x=cos(trad)*dist;tt.y=sin(trad)*dist; + tt.x-=t.x;tt.y-=t.y;trad=tt.x;tt.x=tt.y;tt.y=-trad; + trad=sqrt(sqr(tt.x)+sqr(tt.y)); + tt.x/=trad;tt.y/=trad; + //pos: 0~8, mult:0~8 + //pos: 24~32, mult: 8~0 + if (pos>=24) + tt.x*=(32-pos)/1.5f,tt.y*=(32-pos)/1.5f; + else + if (pos<=8) + tt.x*=pos/1.5f,tt.y*=pos/1.5f; + else + tt.x*=5.33f,tt.y*=5.33f; + //We only consider collisions when pos is between 9 and 23. + if (pos>9&&pos<23)laser[i].EnableColl=true;else laser[i].EnableColl=false; + s.x=t.x+tt.x;s.y=t.y+tt.y; + if (j==31) + for (int k=31;k<MaxRes;++k) + laser[i].Setdata(k,t,s,0xEEFF8800); + else + laser[i].Setdata(j,t,s,0xEEFF8800); + trad=initrad+j*pi/36.0f; + if (shot&&j==pos)bullet[CreateBullet2(400+t.x,300+t.y,0.0f,re.NextDouble(0,pi),1)].alterColor=orange; + if (shot&&j==pos&&re.NextInt(0,249)==99)NewMultpo(vector2d(400+t.x,300+t.y)); + } + if (pos>8&&pos<23) + laser[i].EnableColl=true; + else + laser[i].EnableColl=false; + } +} +int tbuls[1000];double lv5brk; +void Level5Part5() +{ + frameleft=AMinute;All2pnt();towcnt=0;Lasercnt=0; + memset(tbuls,0,sizeof(tbuls));lv5brk=0;++part; + clrtime=1; +} +void Level5Part6() +{ + lv5brk+=hge->Timer_GetDelta(); + if (lv5brk<=0.3)return; + lv5brk=0; + for (int i=1;i<=9;++i) + for (int j=0;j<1000;++j) + if (!tbuls[j]) + { + tbuls[j]=CreateBullet2(i*80,570,3,0.5*pi); + break; + } + for (int j=0;j<1000;++j) + if (tbuls[j]&&bullet[tbuls[j]].bulletpos.y<150) + { + if (re.NextInt(1,1000)>=800) + { + if (re.NextInt(1,1000)>=500) + CreateBullet6(bullet[tbuls[j]].bulletpos.x,bullet[tbuls[j]].bulletpos.y,3,200,1,18); + else + if (re.NextInt(1,1000)>=850) + CreateBullet9(bullet[tbuls[j]].bulletpos.x,bullet[tbuls[j]].bulletpos.y,3,500,18,300); + } + BulletEffect_Death(bullet[tbuls[j]],ColorToDWORD(blue)); + bullet[tbuls[j]].exist=false; + tbuls[j]=0; + } +} +void Level5Part7() +{ + frameleft=ThirtySeconds;Dis8ref=true;tbrk=0;clrtime=1; + if (towcnt!=33&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2;All2pnt(); + ShowTip("Threatening effect of high speed bullets"); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + for (int i=1;i<=33;++i)CreateTower8(i*24-12,12,500,10,20,30); + 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;tcnt=0; + return; + } +} +void Level5Part8() +{ + tbrk+=hge->Timer_GetDelta(); + if (tbrk<=3)return; + tbrk=0;int tg;++tcnt; + if (re.NextInt(1,1000)>=500)tg=CreateBullet9(200,12,8,300,12,200);else tg=CreateBullet9(600,12,8,300,12,200); + bullet[tg].redir(playerpos); + if (tcnt>4)NewMultpo(),tcnt=0; +} +void Level5Part9() +{ + frameleft=ThirtySeconds;Dis8ref=true;tbrk=0;clrtime=1; + if (towcnt!=66&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2;All2pnt(); + ShowTip("Do not panic!"); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + for (int i=1;i<=33;++i)CreateTower8(i*24-12,12,750,1,1,1),CreateTower8(i*24-12,588,750,1,1,1); + 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;tcnt=0; + return; + } +} +void Level5Part10() +{ + tbrk+=hge->Timer_GetDelta(); + if (tbrk<=3)return; + tbrk=0;++tcnt; + if(tcnt>4)NewMultpo(),tcnt=0; + for (int i=0;i<6;++i) + { + int p=CreateBullet2(playerpos.x+cos(i*pi/3.0f)*6,12+sin(i*pi/3.0f)*6,2,-pi/2); + bullet[p].alterColor=orange; + } +} +void Level5Part11() +{ + frameleft=TenSeconds/10*2;clrtime=0;Dis8ref=false; + if (towcnt==66) + { + ClearAll(); + return; + } + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("They are getting out of control...\n\ +Have you noticed that strange things are happening?..."); + } + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1;All2pnt(); + ATarg.TargShow(); + posx=10,posy=10,doneredir=false; + } +} +void Level5Part12() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx<766) + { + posx+=12; + 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]=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) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level5Part13() +{ + frameleft=TenSeconds/10*2;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx2=766,posy2=566,doneredir=false; + } +} +void Level5Part14() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx2>10) + { + posx2-=12; + 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]=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) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level5Part15() +{ + frameleft=TenSeconds/10*2;clrtime=0; + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx=10,posy=10,doneredir=false; +} +void Level5Part16() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx<766) + { + posx+=12; + 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]=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) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +void Level5Part17() +{ + frameleft=TenSeconds/2;clrtime=0; + DisableAllTower=false; + if (Current_Position==1) + { + ++part;memset(redirs,0,sizeof(redirs));cred=-1; + posx2=766,posy2=566,doneredir=false; + } +} +void Level5Part18() +{ + if (!LOWFPS)++fskp;else fskp+=17; + if (fskp>15) + { + fskp=0; + if (posx2>10) + { + posx2-=12; + 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]=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) + bullet[redirs[i]].redir(ATarg.targpos),bullet[redirs[i]].bulletspeed=4,doneredir=true; + } + } +} +double ntrot,ntbrk; +int ntcnt; +void Level5Part19() +{ + frameleft=AMinute;clrtime=1;ntrot=ntbrk=0;ntcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("You are the fish in my barrel."); + } + if (Current_Position==1) + { + ++part;All2pnt(); + ATarg.TargHide();tbrk=0; + } +} +void Level5Part20() +{ + ntbrk+=hge->Timer_GetDelta();tbrk+=hge->Timer_GetDelta(); + if(LOWFPS)ntrot+=16*pi/960.0f;else ntrot+=pi/960.0f; + if(ntbrk<0.01)return; + ntbrk=0;++ntcnt;if (ntcnt>15)ntcnt=0; + int rtatr; + if(frameleft>ThirtySeconds*1.5)rtatr=2; + if(frameleft<=ThirtySeconds*1.5&&frameleft>TenSeconds*4.2)rtatr=0; + if(frameleft<=TenSeconds*4.2&&frameleft>TenSeconds*2.2)rtatr=3; + if(frameleft<=TenSeconds*2.2&&frameleft>TwentySeconds)rtatr=0; + if(frameleft<=TwentySeconds)rtatr=4; + for(int i=0;i<rtatr;++i) + { + int a; + if(ntcnt==0) + a=CreateBullet9(400+250*sin(ntrot+i*2*pi/rtatr),300+250*cos(ntrot+i*2*pi/rtatr),2,500,1,500,true); + else + a=CreateBullet9(400+250*sin(ntrot+i*2*pi/rtatr),300+250*cos(ntrot+i*2*pi/rtatr),2,999999999,1,999999999,true); + bullet[a].redattrib=1;bullet[a].redir(vector2d(400,300)); + bullet[a].bulletdir.x=-bullet[a].bulletdir.x; + bullet[a].bulletdir.y=-bullet[a].bulletdir.y; + if(tbrk>5)NewMultpo(vector2d(400+250*sin(ntrot+i*2*pi/rtatr),300+250*cos(ntrot+i*2*pi/rtatr))); + } + if(tbrk>5)tbrk=0; +} +void Level5Part21() +{ + frameleft=ThirtySeconds; + All2pnt();clrtime=1; + Lasercnt=0; + CTarg.Init(18,75,5.0f); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("This is the UNBREAKABLE jail."); + } + if (Current_Position==1) + { + CreateTower1(30,10,500,2); + CreateTower1(746,10,500,2); + CreateTower1(30,556,500,2); + CreateTower1(746,556,500,2); + ++part; + } +} +void Level5Part22() +{ + int times=1;if (LOWFPS)times=16; + for (int i=1;i<=times;++i) + CTarg.SetRange(CTarg.GetRange()-0.002f); + CTarg.Update(); +} +void Level6Part0() +{ + frameleft=TenSeconds;All2pnt();towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + LE_Active=true;letex=TSflake;lescale=0.2; + letr=TextureRect(0,0,350,350);lecolor=0xCC3366CC; + Leaf.Init(); + Current_Position=2; + ShowTip("\ +Level 6-Peaceful(?) Winter\n\ +Look, there's a question mark in the title...\ +"); + } + if (Current_Position==1) + { + if (!LOWFPS) + DBGColor=ColorTransfer(DBGColor,0xFF60A0FF); + else + for (int i=1;i<=17;++i)DBGColor=ColorTransfer(DBGColor,0xFF60A0FF); + if(DBGColor==0xFF60A0FF)++part; + return; + } +} +void Level6Part1() +{ + //Some component of this level is in towernbullet... + frameleft=ThirtySeconds;clrtime=1; + DisableAllTower=false; + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + whicnt=10; + CreateTower7(400,300,750,3,500); + 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 + { + IfCallLevel=false; + return; + } +} +int spcnt;double sixrad,sixbrk; +void Level6Part2() +{ + if (towcnt)return ClearAll(false); + All2pnt();frameleft=TenSeconds; + ++part;spcnt=2;sixrad=sixbrk=0; + whicnt=1;DisableAllTower=false; + tbrk=0;clrtime=3; +} +void Level6Part3() +{ + sixbrk+=hge->Timer_GetDelta(); + if (sixrad>2*pi){if(tbrk<1)NewMultpo(vector2d(400,300)),tbrk=100;return;} + if (sixbrk<0.04)return; + sixbrk=0; + sixrad+=pi/25.0f; + for (int i=0;i<spcnt;++i) + { + int pnt=CreateBullet7(400,300,2,1500); + bullet[pnt].setdir(pi/2+sixrad+((double)i/(double)spcnt)*2.0f*pi); + } +} +void Level6Part4() +{ + frameleft=TenSeconds;whrcnt=9; + ++part;spcnt=3;sixrad=sixbrk=0; + whicnt=1;DisableAllTower=false; + tbrk=0; +} +void Level6Part5() +{ + sixbrk+=hge->Timer_GetDelta(); + if (sixrad>2*pi){if(tbrk<1)NewMultpo(vector2d(400,300)),tbrk=100;return;} + if (sixbrk<0.04)return; + sixbrk=0; + sixrad+=pi/25.0f; + for (int i=0;i<spcnt;++i) + { + int pnt=CreateBullet7(400,300,2.2,1500); + bullet[pnt].setdir(pi/2+sixrad+((double)i/(double)spcnt)*2.0f*pi); + } +} +void Level6Part6() +{ + frameleft=TenSeconds;tbrk=0; + ++part;spcnt=4;sixrad=sixbrk=0; + whicnt=1;DisableAllTower=false; +} +void Level6Part7() +{ + sixbrk+=hge->Timer_GetDelta(); + if (sixrad>2*pi){if(tbrk<1)NewMultpo(vector2d(400,300)),tbrk=100;return;} + if (sixbrk<0.04)return; + sixbrk=0; + sixrad+=pi/25.0f; + for (int i=0;i<spcnt;++i) + { + int pnt=CreateBullet7(400,300,2.4,1500); + bullet[pnt].setdir(pi/2+sixrad+((double)i/(double)spcnt)*2.0f*pi); + } +} +void Level6Part8() +{ + frameleft=TenSeconds;whrcnt=6; + ++part;spcnt=5;sixrad=sixbrk=0; + whicnt=1;DisableAllTower=false; + tbrk=0; +} +void Level6Part9() +{ + sixbrk+=hge->Timer_GetDelta(); + if (sixrad>2*pi){if(tbrk<1)NewMultpo(vector2d(400,300)),tbrk=100;return;} + if (sixbrk<0.04)return; + sixbrk=0; + sixrad+=pi/25.0f; + for (int i=0;i<spcnt;++i) + { + int pnt=CreateBullet7(400,300,2.6,1500); + bullet[pnt].setdir(pi/2+sixrad+((double)i/(double)spcnt)*2.0f*pi); + } +} +void Level6Part10() +{ + frameleft=TenSeconds;whrcnt=6; + ++part;spcnt=6;sixrad=sixbrk=0; + whicnt=1;DisableAllTower=false; + tbrk=0; +} +void Level6Part11() +{ + sixbrk+=hge->Timer_GetDelta(); + if (sixrad>2*pi){if(tbrk<1)NewMultpo(vector2d(400,300)),tbrk=100;return;} + if (sixbrk<0.04)return; + sixbrk=0; + sixrad+=pi/25.0f; + for (int i=0;i<spcnt;++i) + { + int pnt=CreateBullet7(400,300,2.6,1500); + bullet[pnt].setdir(pi/2+sixrad+((double)i/(double)spcnt)*2.0f*pi); + } +} +void Level6Part12() +{ + frameleft=AMinute;clrtime=1; + if (towcnt!=8&&towcnt) + { + ClearAll(false); + return; + } + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Get out before you are squashed..."); + } + if (Current_Position==1) + { + ++part;squashrev=false;All2pnt(); + tbrk=0; + CreateTower3(10,10,400,2,1); + CreateTower3(766,10,400,2,1); + CreateTower3(10,566,400,2,1); + CreateTower3(766,566,400,2,1); + CreateTower1(9,9,1000,1.5); + CreateTower1(767,11,1000,1.5); + CreateTower1(9,567,1000,1.5); + CreateTower1(767,567,1000,1.5); + } +} +void Level6Part13() +{ + tbrk+=hge->Timer_GetDelta(); + if(tbrk>=12) + { + for(int i=1;i<=4;++i)NewMultpo(tower[i].towerpos); + tbrk=0; + } + if (!squashrev) + { + if (!LOWFPS) + { + tower[1].towerpos.x+=0.01; + tower[1].towerpos.y+=0.007354; + tower[2].towerpos.x-=0.01; + tower[2].towerpos.y+=0.007354; + tower[3].towerpos.x+=0.01; + tower[3].towerpos.y-=0.007354; + tower[4].towerpos.x-=0.01; + tower[4].towerpos.y-=0.007354; + } + else + { + tower[1].towerpos.x+=0.16; + tower[1].towerpos.y+=0.117664; + tower[2].towerpos.x-=0.16; + tower[2].towerpos.y+=0.117664; + tower[3].towerpos.x+=0.16; + tower[3].towerpos.y-=0.117664; + tower[4].towerpos.x-=0.16; + tower[4].towerpos.y-=0.117664; + } + } + else + { + if (!LOWFPS) + { + tower[1].towerpos.x-=0.01; + tower[1].towerpos.y-=0.007354; + tower[2].towerpos.x+=0.01; + tower[2].towerpos.y-=0.007354; + tower[3].towerpos.x-=0.01; + tower[3].towerpos.y+=0.007354; + tower[4].towerpos.x+=0.01; + tower[4].towerpos.y+=0.007354; + } + else + { + tower[1].towerpos.x-=0.16; + tower[1].towerpos.y-=0.117664; + tower[2].towerpos.x+=0.16; + tower[2].towerpos.y-=0.117664; + tower[3].towerpos.x-=0.16; + tower[3].towerpos.y+=0.117664; + tower[4].towerpos.x+=0.16; + tower[4].towerpos.y+=0.117664; + } + } + if (tower[1].towerpos.x>766||tower[1].towerpos.x<10)squashrev=!squashrev; +} +double avabrk,avacurbrk; +bool dir; +void Level6Part14()//Avalanche +{ + frameleft=AMinute;clrtime=1; + if (towcnt) + { + ClearAll(false); + return; + } + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Avalanche..."); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=1.0f;avacurbrk=tbrk=0;dir=false; + } +} +void Level6Part15() +{ + avacurbrk+=hge->Timer_GetDelta(); + tbrk+=hge->Timer_GetDelta(); + avabrk=((double)frameleft/(double)AMinute)*0.04f+0.01f; + if (avacurbrk>avabrk) + { + avacurbrk=0; + int pnt=CreateBullet2(re.NextDouble(10,790),200,-6.25,3*pi/2.0f); + bullet[pnt].limv=re.NextInt(2,8);bullet[pnt].bulletaccel=0.005; + } + if (tbrk>6)NewMultpo(vector2d(re.NextDouble(20,780),re.NextDouble(20,150))),tbrk=0; +} +void Level6Part16() +{ + frameleft=AMinute;clrtime=2; + if (towcnt) + { + ClearAll(false); + return; + } + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("?.."); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=1.0f; + avacurbrk=0;dir=false;ATarg.TargShow(); + ATarg.targpos=vector2d(400,300); + whicnt=3;avacurbrk=0; + } +} +void Level6Part17() +{ + avacurbrk+=hge->Timer_GetDelta(); + avabrk=((double)frameleft/(double)AMinute)*0.8f+0.2f; + if (avacurbrk>avabrk) + { + avacurbrk=0; + int pnt; + if (re.NextInt(1,100)<=80) + pnt=CreateBullet7(ATarg.targpos.x,ATarg.targpos.y,3,500); + else + pnt=CreateBullet6(ATarg.targpos.x,ATarg.targpos.y,4,1000); + bullet[pnt].dist=1;bullet[pnt].bulletdir=vector2d(0,0); + if(re.NextInt(0,19)==14)NewMultpo(); + } +} +//begin hexagon +Bullet bheader[100],*beewx[1500]; +static int sxcnt,seq,beecnt; +bool brdir; +double offset; +void Level6Part18() +{ + DisableAllTower=false;clrtime=3; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Hexagon loops"); + } + if (Current_Position==1) + { + sxcnt=-1;beecnt=-1;brdir=false;frameleft=TenSeconds;offset=86; + memset(bheader,0,sizeof(bheader)); + memset(beewx,0,sizeof(beewx)); + avacurbrk=1;avabrk=1;sixbrk=0.1;seq=3; + for (int i=1;i<=5;++i) + { + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,10,2,-pi/6); + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,10,2,-5*pi/6); + } + ++part;ATarg.TargHide();All2pnt(); + } +} +void Level6Part19() +{ + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + if (frameleft<TenSeconds/10*1&&!brdir) + { + brdir=true; + for (int i=0;i<=beecnt;++i) + { + beewx[i]->bulletaccel=0.001;beewx[i]->limv=1; + beewx[i]->setdir(re.NextDouble(0,pi)); + } + } + for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]); + if (avacurbrk>avabrk) + { + avacurbrk=0;++seq;seq%=4; + for (int i=0;i<=sxcnt;++i) + { + if (i&1) + { + switch (seq) + { + 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: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; + } + } + } + } + if (sixbrk>0.2&&!brdir) + { + sixbrk=0; + if (bheader[0].bulletpos.y>610)return; + for (int i=0;i<=sxcnt;++i) + { + beewx[++beecnt]=&bullet[CreateBullet2(bheader[i].bulletpos.x,bheader[i].bulletpos.y,0,pi,true)]; + } + } +} +void Level6Part20() +{ + sxcnt=-1;beecnt=-1;brdir=false;frameleft=TwentySeconds;offset=43; + memset(bheader,0,sizeof(bheader)); + memset(beewx,0,sizeof(beewx)); + avacurbrk=0.5;avabrk=0.5;sixbrk=0.1;seq=3; + for (int i=1;i<=10;++i) + { + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,10,2,-pi/6); + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,10,2,-5*pi/6); + } + ++part; +} +void Level6Part21() +{ + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + if (frameleft<TenSeconds/10*11&&!brdir) + { + brdir=true; + for (int i=0;i<=beecnt;++i) + { + beewx[i]->bulletaccel=0.001;beewx[i]->limv=1; + beewx[i]->setdir(re.NextDouble(0,pi)); + } + } + for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]); + if (avacurbrk>avabrk) + { + avacurbrk=0;++seq;seq%=4; + for (int i=0;i<=sxcnt;++i) + { + if (i&1) + { + switch (seq) + { + 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: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; + } + } + } + } + if (sixbrk>0.2&&!brdir) + { + sixbrk=0; + if (bheader[0].bulletpos.y>610)return; + for (int i=0;i<=sxcnt;++i) + { + beewx[++beecnt]=&bullet[CreateBullet2(bheader[i].bulletpos.x,bheader[i].bulletpos.y,0,pi,true)]; + } + } +} +void Level6Part22() +{ + sxcnt=-1;beecnt=-1;brdir=false;frameleft=TenSeconds/10*7;offset=43; + memset(bheader,0,sizeof(bheader)); + memset(beewx,0,sizeof(beewx)); + avacurbrk=0.25;avabrk=0.25;sixbrk=0.1;seq=3; + for (int i=1;i<=10;++i) + { + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,10,4,-pi/6); + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,10,4,-5*pi/6); + } + ++part; +} +void Level6Part23() +{ + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + if (frameleft<TenSeconds/10*1&&!brdir) + { + brdir=true; + for (int i=0;i<=beecnt;++i) + { + beewx[i]->bulletaccel=0.001;beewx[i]->limv=1; + beewx[i]->setdir(re.NextDouble(0,pi)); + } + } + for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]); + if (avacurbrk>avabrk) + { + avacurbrk=0;++seq;seq%=4; + for (int i=0;i<=sxcnt;++i) + { + if (i&1) + { + switch (seq) + { + 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: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; + } + } + } + } + if (sixbrk>0.1&&!brdir) + { + sixbrk=0; + if (bheader[0].bulletpos.y>610)return; + for (int i=0;i<=sxcnt;++i) + { + beewx[++beecnt]=&bullet[CreateBullet2(bheader[i].bulletpos.x,bheader[i].bulletpos.y,0,pi,true)]; + } + } +} +void Level6Part24() +{ + sxcnt=-1;beecnt=-1;brdir=false;frameleft=TenSeconds/10*7;offset=43; + memset(bheader,0,sizeof(bheader)); + memset(beewx,0,sizeof(beewx)); + avacurbrk=0.25;avabrk=0.25;sixbrk=0.1;seq=3; + for (int i=1;i<=10;++i) + { + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,590,4,pi/6); + CreateBullet2(bheader[++sxcnt],offset+2*(i-1)*offset,590,4,5*pi/6); + } + ++part; +} +void Level6Part25() +{ + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + if (frameleft<TenSeconds/10*1&&!brdir) + { + brdir=true; + for (int i=0;i<=beecnt;++i) + { + beewx[i]->bulletaccel=0.001;beewx[i]->limv=1; + beewx[i]->setdir(re.NextDouble(0,pi)); + } + } + for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]); + if (avacurbrk>avabrk) + { + avacurbrk=0;++seq;seq%=4; + for (int i=0;i<=sxcnt;++i) + { + if (i&1) + { + switch (seq) + { + 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: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; + } + } + } + } + if (sixbrk>0.1&&!brdir) + { + sixbrk=0; + if (bheader[0].bulletpos.y<-10)return; + for (int i=0;i<=sxcnt;++i) + { + beewx[++beecnt]=&bullet[CreateBullet2(bheader[i].bulletpos.x,bheader[i].bulletpos.y,0,pi,true)]; + } + } +} +void Level6Part26() +{ + sxcnt=-1;beecnt=-1;brdir=false;frameleft=TenSeconds/10*7;offset=43; + memset(bheader,0,sizeof(bheader)); + memset(beewx,0,sizeof(beewx)); + avacurbrk=0.25;avabrk=0.25;sixbrk=0.1;seq=3; + for (int i=1;i<=10;++i) + { + CreateBullet2(bheader[++sxcnt],790,offset+2*(i-1)*offset,4,5*pi/3); + CreateBullet2(bheader[++sxcnt],790,offset+2*(i-1)*offset,4,pi/3); + } + ++part; +} +void Level6Part27() +{ + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + if (frameleft<TenSeconds/10*1&&!brdir) + { + brdir=true; + for (int i=0;i<=beecnt;++i) + { + beewx[i]->bulletaccel=0.001;beewx[i]->limv=1; + beewx[i]->setdir(re.NextDouble(0,pi)); + } + } + for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]); + if (avacurbrk>avabrk) + { + avacurbrk=0;++seq;seq%=4; + for (int i=0;i<=sxcnt;++i) + { + if (i&1) + { + switch (seq) + { + 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: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; + } + } + } + } + if (sixbrk>0.1&&!brdir) + { + sixbrk=0; + if (bheader[0].bulletpos.x<-10)return; + for (int i=0;i<=sxcnt;++i) + { + beewx[++beecnt]=&bullet[CreateBullet2(bheader[i].bulletpos.x,bheader[i].bulletpos.y,0,pi,true)]; + } + } +} +void Level6Part28() +{ + sxcnt=-1;beecnt=-1;brdir=false;frameleft=TenSeconds+TenSeconds/10*9;offset=43; + memset(bheader,0,sizeof(bheader)); + memset(beewx,0,sizeof(beewx)); + avacurbrk=0.25;avabrk=0.25;sixbrk=0.1;seq=3; + for (int i=1;i<=10;++i) + { + CreateBullet2(bheader[++sxcnt],10,offset+2*(i-1)*offset,4,pi+5*pi/3); + CreateBullet2(bheader[++sxcnt],10,offset+2*(i-1)*offset,4,pi+pi/3); + } + ++part; +} +void Level6Part29() +{ + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + if (frameleft<TenSeconds/10*6&&!brdir) + { + brdir=true; + for (int i=0;i<=beecnt;++i) + { + beewx[i]->bulletaccel=0.001;beewx[i]->limv=1; + beewx[i]->setdir(re.NextDouble(0,pi)); + } + } + for (int i=0;i<=sxcnt;++i)ProcessBullet2(bheader[i]); + if (avacurbrk>avabrk) + { + avacurbrk=0;++seq;seq%=4; + for (int i=0;i<=sxcnt;++i) + { + if (i&1) + { + switch (seq) + { + 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: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; + } + } + } + } + if (sixbrk>0.1&&!brdir) + { + sixbrk=0; + if (bheader[0].bulletpos.x>810)return; + for (int i=0;i<=sxcnt;++i) + { + beewx[++beecnt]=&bullet[CreateBullet2(bheader[i].bulletpos.x,bheader[i].bulletpos.y,0,pi,true)]; + } + } +} +void Level6Part30()//Hyperfluid! +{ + frameleft=AMinute;clrtime=2; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Hyperfluid!"); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=0.2f;avacurbrk=0;sixbrk=-1;tbrk=0; + } +} +void Level6Part999999999()//well this is not an easter egg! +{ + avabrk=(frameleft/(double)AMinute)*0.15f+0.05f; + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + tbrk+=hge->Timer_GetDelta(); + if(tbrk>10)tbrk=0,NewMultpo(vector2d(re.NextDouble(40,100),re.NextDouble(30,75))); + if (avacurbrk>avabrk) + { + avacurbrk=0; + for (int i=1;i<=re.NextInt(1,10);++i) + if (re.NextInt(1,1000)>500) + { + int pnt=CreateBullet2(10,re.NextDouble(10,590),0,-3*pi/4); + bullet[pnt].bulletaccel=0.0025;bullet[pnt].limv=6; + } + else + { + int pnt=CreateBullet2(re.NextDouble(10,790),10,0,-3*pi/4); + bullet[pnt].bulletaccel=0.0025;bullet[pnt].limv=6; + } + } + if (sixbrk>0.5) + { + sixbrk=0; + for (int i=1;i<=re.NextInt(1,10);++i) + { + int pnt=CreateBullet2(re.NextDouble(10,790),590,1,pi/2); + bullet[pnt].alterColor=white; + } + } +} +int bgbrk; +double bgdbbrk; +void Level7Part0() +{ + frameleft=50;All2pnt();towcnt=0;bgbrk=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + LE_Active=false; + Current_Position=2; + ShowTip("\ +Level 7-Rainbow of Spring\n\ +Will there be a clearer day?\ +"); + frameleft=TenSeconds;++part; + } +} +bool skystp; +void Level7Part1() +{ + ++bgbrk;if (LOWFPS)bgbrk+=16; + if (bgbrk<30)return; + bgbrk=0; + if (!LOWFPS) + DBGColor=ColorTransfer(DBGColor,0xFF0B0916); + else + for (int i=1;i<=17;++i)DBGColor=ColorTransfer(DBGColor,0xFF0B0916); + if (DBGColor==0xFF0B0916) + { + frameleft=AMinute,++part;tbrk=0;clrtime=2; + bgdbbrk=re.NextInt(5,20),bgbrk=0; + avabrk=0.2f;avacurbrk=0;skystp=false; + } +} +void Level7Part2() +{ + if (bgbrk==1||bgbrk==4) + { + int times=5;if (LOWFPS)times*=16; + for (int i=1;i<=times;++i)DBGColor=ColorTransfer(DBGColor,0xFF23459A); + if (DBGColor==0xFF23459A) + { + if(bgbrk==1)bgbrk=2; + if(bgbrk==4)bgbrk=5; + } + } + if (bgbrk==2||bgbrk==5) + { + int times=1;if (LOWFPS)times*=16; + for (int i=1;i<=times;++i)DBGColor=ColorTransfer(DBGColor,0xFF0B0916); + if (DBGColor==0xFF0B0916) + { + if(bgbrk==2)bgbrk=3,bgdbbrk=0.06; + if(bgbrk==5)bgbrk=0,bgdbbrk=re.NextInt(5,20); + } + } + if (bgbrk==3||bgbrk==0) + { + bgdbbrk-=hge->Timer_GetDelta(); + if (bgdbbrk<=0) + { + if (bgbrk==0)bgbrk=1; + if (bgbrk==3)bgbrk=4; + } + } + avabrk=(frameleft/(double)AMinute)*0.15f+0.15f; + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); + tbrk+=hge->Timer_GetDelta(); + if (tbrk>10)tbrk=0,NewMultpo(vector2d(re.NextDouble(200,600),re.NextDouble(500,575))); + if (avacurbrk>avabrk) + { + avacurbrk=0; + for (int i=1;i<=re.NextInt(1,10);++i) + { + if (re.NextInt(1,1000)>=500) + { + int pnt=CreateBullet2(10,re.NextDouble(10,590),0,-3*pi/4); + bullet[pnt].bulletaccel=0.0025;bullet[pnt].limv=6; + } + else + { + int pnt=CreateBullet2(re.NextDouble(10,790),10,0,-3*pi/4); + bullet[pnt].bulletaccel=0.0025;bullet[pnt].limv=6; + } + if (re.NextInt(1,1000)>=500) + { + int pnt=CreateBullet2(780,re.NextDouble(10,590),0,-pi/4); + bullet[pnt].bulletaccel=0.0025;bullet[pnt].limv=6; + } + else + { + int pnt=CreateBullet2(re.NextDouble(10,790),10,0,-pi/4); + bullet[pnt].bulletaccel=0.0025;bullet[pnt].limv=6; + } + } + } +} +void Level7Part3() +{ + frameleft=TenSeconds; + if (!skystp) + { + ++bgbrk;if (LOWFPS)bgbrk+=16; + if (bgbrk<30)return; + bgbrk=0; + if (!LOWFPS) + DBGColor=ColorTransfer(DBGColor,0xFFFFFFFF); + else + for (int i=1;i<=17;++i)DBGColor=ColorTransfer(DBGColor,0xFFFFFFFF); + if (DBGColor==0xFFFFFFFF)skystp=skyactive=true,sky.SkySetFadeIn(),sky.SetSpeed(0.01); + sky.SetTime(9); + } + else + { + ++bgbrk;if (LOWFPS)bgbrk+=16; + if (bgbrk<30)return; + bgbrk=0; + if (!LOWFPS) + DBGColor=ColorTransfer(DBGColor,0x00FFFFFF); + else + for (int i=1;i<=17;++i)DBGColor=ColorTransfer(DBGColor,0x00FFFFFF); + if (DBGColor==0x00FFFFFF) + ++part; + } +} +void Level7Part4() +{ + frameleft=(AMinute+ThirtySeconds);clrtime=3; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Rainbow tower..."); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + towcnt=0; + deltadelta=pi/720; + CreateTower6(400,300,600,2,1000,3,72); + ++part;All2pnt(); +} +void Level7Part5() +{ + ++frameskips; + if (tower[1].towertype==6) + { + if (frameskips>TenSeconds/5) + { + frameskips=0; + towcnt=0; + CreateTower9(400,300,600,2,1500,72,1200); + } + } + if (tower[1].towertype==9) + { + if (frameskips>TenSeconds/5) + { + frameskips=0; + towcnt=0; + CreateTower4(400,300,500,1,500); + } + } + if (tower[1].towertype==4) + { + if (frameskips>TenSeconds/5) + { + frameskips=0; + towcnt=0; + CreateTower1(400,300,50,4); + } + } + if (tower[1].towertype==1) + { + if (frameskips>TenSeconds/5) + { + frameskips=0; + towcnt=0; + CreateTower2(400,300,50,4); + } + } + if (tower[1].towertype==2) + { + if (frameskips>TenSeconds/2) + { + frameskips=0; + towcnt=0; + CreateTower8(400,300,500,5,20,50); + } + } + if (tower[1].towertype==8) + { + BTarg.TargHide(); + if (frameskips>TenSeconds/5) + { + frameskips=0; + towcnt=0; + CreateTower5(400,300,50,5); + } + } + if (tower[1].towertype==5) + { + if (frameskips>TenSeconds/5) + { + frameskips=0; + towcnt=0; + CreateTower6(400,300,600,2,1000,3,72); + } + } +} +void Level7Part6() +{ + frameleft=AMinute;clrtime=2;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Hit Z..."); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=1.0f;avacurbrk=0; + } +} +void Level7Part7() +{ + avabrk=frameleft/(double)AMinute*0.5f+0.5f; + avacurbrk+=hge->Timer_GetDelta(); + if (avacurbrk>avabrk) + { + if(re.NextInt(0,4)==0)NewMultpo(); + avacurbrk=0; + bool lasta,lastb; + lasta=re.NextInt(1,1000)<500;lastb=re.NextInt(1,1000)<500; + for (int i=0;i<31;++i) + { + int rf=re.NextInt(0,999); + if ((lasta&&rf<600)||(!lasta&&rf<250)) + { + int pnt=CreateBullet2(-15,i*20,2,pi); + bullet[pnt].alterColor=(TColors)(i%8); + bullet[pnt].limv=2+2*(AMinute-frameleft)/(double)AMinute;bullet[pnt].bulletaccel=0.002; + lasta=true; + }else lasta=false; + rf=re.NextInt(0,999); + if ((lastb&&rf<600)||(!lastb&&rf<250)) + { + int pnt=CreateBullet2(815,i*20-10,2,0); + bullet[pnt].alterColor=(TColors)(i%8); + bullet[pnt].limv=2+2*(AMinute-frameleft)/(double)AMinute;bullet[pnt].bulletaccel=0.002; + lastb=true; + }else lastb=false; + } + } +} +double sntang; +void Level7Part8() +{ + frameleft=AMinute;clrtime=2;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Rainbow!"); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=0.03f;avacurbrk=1.0f;sntang=-pi/2; + } +} +void rainbowCreator(double rl,double rr,double rad,TColors col,double speed,bool invi=false) +{ + double r=re.NextDouble(rr,rl); + int pnt=CreateBullet2(900+cos(rad)*r,700+sin(rad)*r,speed,re.NextDouble(0,pi),true,invi); + bullet[pnt].alterColor=col; +} +void Level7Part9() +{ + if (sntang>-pi) + { + avacurbrk+=hge->Timer_GetDelta(); + if (avacurbrk>avabrk) + { + sntang-=pi/180;avacurbrk=0; + for(int i=0;i<6;++i)rainbowCreator(660,600,sntang,red,0,1); + for(int i=0;i<6;++i)rainbowCreator(610,550,sntang,orange,0,1); + for(int i=0;i<6;++i)rainbowCreator(560,500,sntang,yellow,0,1); + for(int i=0;i<6;++i)rainbowCreator(510,450,sntang,green,0,1); + for(int i=0;i<6;++i)rainbowCreator(460,410,sntang,blue,0,1); + for(int i=0;i<6;++i)rainbowCreator(420,360,sntang,dblue,0,1); + for(int i=0;i<6;++i)rainbowCreator(365,310,sntang,purple,0,1); + } + } + else + { + avabrk=0.25+(frameleft/(double)AMinute)*0.5f; + avacurbrk+=hge->Timer_GetDelta(); + if (avacurbrk>avabrk) + { + avacurbrk=0; + if(re.NextInt(0,19)==7)NewMultpo(); + double spd=((AMinute-frameleft)/(double)AMinute)+1; + for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i) + sntang=re.NextDouble(-pi,-pi/2), + rainbowCreator(660,600,sntang,red,spd); + for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i) + sntang=re.NextDouble(-pi,-pi/2), + rainbowCreator(610,550,sntang,orange,spd); + for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i) + sntang=re.NextDouble(-pi,-pi/2), + rainbowCreator(560,500,sntang,yellow,spd); + for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i) + sntang=re.NextDouble(-pi,-pi/2), + rainbowCreator(510,450,sntang,green,spd); + for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i) + sntang=re.NextDouble(-pi,-pi/2), + rainbowCreator(460,410,sntang,blue,spd); + for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i) + sntang=re.NextDouble(-pi,-pi/2), + rainbowCreator(420,360,sntang,dblue,spd); + for(int i=0;i<((AMinute-frameleft)/(double)AMinute)*20;++i) + sntang=re.NextDouble(-pi,-pi/2), + rainbowCreator(365,310,sntang,purple,spd); + sntang=-pi-0.1; + } + } +} +SimpleThing aa,bb; +void Level7Part10() +{ + frameleft=AMinute*2;clrtime=1;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Interference(fake)"); + } + if (Current_Position==1) + { + ++part;All2pnt();skyactive=false;DBGColor=0xFF000000; + binter.Init("./Resources/b_inter.png",PicBack::Centered,0x80); + binter.SetFadeIn();aa.Init(vector2d(260,292));bb.Init(vector2d(523,292)); + } +} +void Level7Part11() +{ +//260,292;523,292 + aa.Update(true);bb.Update(false); +} +diffCreator dfc[200]; +void Level7Part12() +{ + frameleft=AMinute*2;clrtime=3;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false;bulcnt=0; + aa.toPoint();bb.toPoint(); + Current_Position=2; + ShowTip("Diffraction(fake)"); + } + if (Current_Position==1) + { + ++part;memset(dfc,0,sizeof(dfc)); + binter.SetFadeOut();bdiff.Init("./resources/b_diff.png",PicBack::Tiled,0x80); + bdiff.SetFadeIn();bdiff.SetScale(0.5); + avabrk=2.0f;avacurbrk=0; + } +} +void Level7Part13() +{ + avabrk=1.0f+frameleft/(double)AMinute; + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk&&frameleft>=TenSeconds/5) + { + for(int i=0;i<200;++i) + if (!dfc[i].isActive()) + { + if(re.NextInt(1,100)>=75) + { + if(re.NextInt(1,100)>=50) + { + vector2d pos=vector2d(playerpos.x,re.NextDouble(0,600)); + while (GetDist(pos,playerpos)<100) + pos=vector2d(playerpos.x,re.NextDouble(0,600)); + dfc[i].init(pos); + } + else + { + vector2d pos=vector2d(re.NextDouble(0,800),playerpos.y); + while (GetDist(pos,playerpos)<100) + pos=vector2d(re.NextDouble(0,800),playerpos.y); + dfc[i].init(pos); + } + } + else + { + vector2d pos=vector2d(re.NextDouble(0,800),re.NextDouble(0,600)); + while (GetDist(pos,playerpos)<100) + pos=vector2d(re.NextDouble(0,800),re.NextDouble(0,600)); + dfc[i].init(pos); + if(re.NextInt(0,7)==3)NewMultpo(pos); + } + break; + } + avacurbrk=0; + } + for(int i=0;i<200;++i) + if(dfc[i].isActive())dfc[i].update(); +} +BulletSine bnl[100]; +double ykbrk; +void Level7Part14()//Photon school +{ + memset(bnl,0,sizeof(bnl)); + frameleft=AMinute;clrtime=2; + ykbrk=0.5f;skyactive=true;bdiff.SetFadeOut(); + if((DBGColor=ColorTransfer(DBGColor,0x00000000))==0x0)++part; +} +void Level7Part15() +{ + ykbrk-=hge->Timer_GetDelta(); + if (ykbrk<0&&frameleft>TenSeconds/10*3) + { + ykbrk=(double)frameleft/AMinute*0.75f+0.75f; + for (int i=0;i<100;++i) + if (!bnl[i].active) + { + vector2d a,b; + if (re.NextInt(1,100)>=50) + { + if (re.NextInt(1,100)>=50)a=vector2d(re.NextDouble(10,790),610);else a=vector2d(re.NextDouble(10,790),-10); + } + else + { + if (re.NextInt(1,100)>=50)a=vector2d(-10,re.NextDouble(10,590));else a=vector2d(810,re.NextDouble(10,590)); + } + if (re.NextInt(1,100)>=50) + { + if (re.NextInt(1,100)>=50)b=vector2d(re.NextDouble(10,790),610);else b=vector2d(re.NextDouble(10,790),-10); + } + else + { + if (re.NextInt(1,100)>=50)b=vector2d(-10,re.NextDouble(10,590));else b=vector2d(810,re.NextDouble(10,590)); + } + bnl[i].Init(a,b); + break; + } + } + for (int i=0;i<100;++i) + if (bnl[i].active)bnl[i].Update(); +} +double DTCircle; +BCircle Circles[20]; +int CCnt,state; +void Level7Part16()//Great circles +{ + towcnt=0;clrtime=0; + frameleft=Infinity;All2pnt(); + Circles[0].Init(444,20*pi/50000.0f,6,vector2d(400,300)); + Circles[1].Init(444,-20*pi/50000.0f,6,vector2d(400,300)); + CCnt=1;state=0; + DTCircle=0.0f; + ++part;playerpos.x=400,playerpos.y=300; +} +void Level7Part17()//Great circles-child1 +{ + frameleft=Infinity; + DTCircle+=hge->Timer_GetDelta(); + if (DTCircle>1&&CCnt<3) + { + Circles[2].Init(444,10*pi/50000.0f,12,vector2d(400,300)); + Circles[3].Init(444,-10*pi/50000.0f,12,vector2d(400,300)); + CCnt=3; + } + if (DTCircle>2&&CCnt<5) + { + Circles[4].Init(444,8*pi/50000.0f,18,vector2d(400,300)); + Circles[5].Init(444,-8*pi/50000.0f,18,vector2d(400,300)); + CCnt=5; + } + if (DTCircle>3&&CCnt<7) + { + Circles[6].Init(444,8*pi/50000.0f,27,vector2d(400,300)); + Circles[7].Init(444,-8*pi/50000.0f,27,vector2d(400,300)); + CCnt=7; + } + if (DTCircle>4&&CCnt<9) + { + Circles[8].Init(444,6*pi/50000.0f,45,vector2d(400,300)); + Circles[9].Init(444,-6*pi/50000.0f,45,vector2d(400,300)); + CCnt=9; + } + if (DTCircle>5&&CCnt<11) + { + Circles[10].Init(444,6*pi/50000.0f,60,vector2d(400,300)); + Circles[11].Init(444,-6*pi/50000.0f,60,vector2d(400,300)); + CCnt=11; + } + if (DTCircle>5&&CCnt<13) + { + Circles[12].Init(444,3*pi/50000.0f,96,vector2d(400,300)); + Circles[13].Init(444,-3*pi/50000.0f,96,vector2d(400,300)); + CCnt=13; + } + if (Circles[0].GetRange()>=50) + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + Circles[0].SetRange(Circles[0].GetRange()-0.1), + Circles[1].SetRange(Circles[1].GetRange()-0.1); + } + if (Circles[2].GetRange()>=100&&CCnt>=3) + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + Circles[2].SetRange(Circles[2].GetRange()-0.1), + Circles[3].SetRange(Circles[3].GetRange()-0.1); + } + if (Circles[4].GetRange()>=150&&CCnt>=5) + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + Circles[4].SetRange(Circles[4].GetRange()-0.1), + Circles[5].SetRange(Circles[5].GetRange()-0.1); + } + if (Circles[6].GetRange()>=210&&CCnt>=7) + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + Circles[6].SetRange(Circles[6].GetRange()-0.1), + Circles[7].SetRange(Circles[7].GetRange()-0.1); + } + if (Circles[8].GetRange()>=270&&CCnt>=9) + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + Circles[8].SetRange(Circles[8].GetRange()-0.1), + Circles[9].SetRange(Circles[9].GetRange()-0.1); + } + if (Circles[10].GetRange()>=320&&CCnt>=11) + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + Circles[10].SetRange(Circles[10].GetRange()-0.1), + Circles[11].SetRange(Circles[11].GetRange()-0.1); + } + if (Circles[12].GetRange()>=420&&CCnt>=13) + { + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + Circles[12].SetRange(Circles[12].GetRange()-0.1), + Circles[13].SetRange(Circles[13].GetRange()-0.1); + } + else + { + if (CCnt>=13)++part; + for (int i=1;i<=CCnt;++i) + Circles[i].SetDT(i*pi); + } + for (int i=0;i<=CCnt;++i)Circles[i].Update(); + state=0; + towerspr[red]->RenderStretch(770,0,800,30); + towerspr[green]->RenderStretch(380,280,420,320); +} +void Level7Part18()//Great circles-child2 +{ + if(state) + { + towerspr[green]->RenderStretch(770,0,800,30); + towerspr[red]->RenderStretch(380,280,420,320); + } + else + { + towerspr[red]->RenderStretch(770,0,800,30); + towerspr[green]->RenderStretch(380,280,420,320); + } + hgeRect col; + if (state) + { + col=hgeRect(380,280,420,320); + if (col.TestPoint(playerpos.x,playerpos.y))++part; + } + else + { + col=hgeRect(770,0,800,30); + if (col.TestPoint(playerpos.x,playerpos.y))state=1; + } + frameleft=Infinity; + for (int i=0;i<=CCnt;++i) + { + if (i==0||i==1)Circles[i].SetRange(50+10*sin(Circles[i].GetDT())); + if (i==2||i==3)Circles[i].SetRange(100+10*sin(Circles[i].GetDT())); + if (i==4||i==5)Circles[i].SetRange(150+10*sin(Circles[i].GetDT())); + if (i==6||i==7)Circles[i].SetRange(210+20*sin(Circles[i].GetDT())); + if (i==8||i==9)Circles[i].SetRange(270+20*sin(Circles[i].GetDT())); + if (i==10||i==11)Circles[i].SetRange(320+20*sin(Circles[i].GetDT())); + if (i==12||i==13)Circles[i].SetRange(420+30*sin(Circles[i].GetDT())); + Circles[i].Update(); + } +} +BTail btails[50]; +void Level7Part19() +{ + frameleft=AMinute*2;clrtime=3;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Warning: Trypophobia caution ahead!"); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=1.0f;avacurbrk=1.0f;memset(btails,0,sizeof(btails)); + } +} +void Level7Part20() +{ + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk) + { + avacurbrk=0;avabrk=(frameleft/(double)(AMinute*2))*0.7+0.3; + for(int i=0;i<50;++i) + if(!btails[i].isActive()) + {btails[i].Create();break;} + if(re.NextInt(0,24)==15)NewMultpo(); + } + for(int i=0;i<50;++i) + if(btails[i].isActive())btails[i].Update(); +} +int sttnt; +void Level7Part21() +{ + frameleft=AMinute+ThirtySeconds;All2pnt();clrtime=1; + 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 Level7Part23()//Wave of Photon +{ + memset(bnl,0,sizeof(bnl));t8special=false; + frameleft=AMinute;All2pnt();towcnt=0; + ykbrk=0.5f;++part;clrtime=1; +} +void Level7Part24() +{ + ykbrk-=hge->Timer_GetDelta(); + if (ykbrk<0&&frameleft>TenSeconds/10*3) + { + ykbrk=(double)frameleft/AMinute/2.0f+0.2f; + for (int i=0;i<100;++i) + if (!wop[i].active) + { + vector2d a,b; + if (re.NextInt(1,100)>=50) + { + if (re.NextInt(1,100)>=50)a=vector2d(re.NextDouble(10,790),610);else a=vector2d(re.NextDouble(10,790),-10); + } + else + { + if (re.NextInt(1,100)>=50)a=vector2d(-10,re.NextDouble(10,590));else a=vector2d(810,re.NextDouble(10,590)); + } + if (re.NextInt(1,100)>=50) + { + if (re.NextInt(1,100)>=50)b=vector2d(re.NextDouble(10,790),610);else b=vector2d(re.NextDouble(10,790),-10); + } + else + { + if (re.NextInt(1,100)>=50)b=vector2d(-10,re.NextDouble(10,590));else b=vector2d(810,re.NextDouble(10,590)); + } + if (re.NextInt(1,100)>=80) + { + vector2d d=playerpos-a; + b=playerpos; + while(b.x>-5&&b.x<805&&b.y>-5&&b.y<605)b=b+d; + } + wop[i].Init(a,b,1+(AMinute-frameleft)/(double)AMinute,0.02); + break; + } + } + for (int i=0;i<100;++i) + if (wop[i].active)wop[i].Update(); +} +RTV rtv[100]; +void Level7Part25() +{ + frameleft=AMinute+ThirtySeconds; + All2pnt();towcnt=Lasercnt=0; + ++part;memset(rtv,0,sizeof(rtv)); + avabrk=1;avacurbrk=0.7;clrtime=1; +} +void Level7Part26() +{ + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk&&frameleft>TenSeconds/3) + { + avacurbrk=0;avabrk=frameleft/(double)(AMinute+ThirtySeconds)*1.25+0.75; + for(int i=0;i<100;++i)if(!rtv[i].isActive()) + { + int spinner=6; + if(frameleft<AMinute)spinner=8; + if(frameleft<ThirtySeconds)spinner=12; + if(re.NextInt(1,100)>=40)rtv[i].Init(1,(re.NextInt(0,1)?1:-1)*pi/123,spinner,(TColors)(re.NextInt(0,7)),re.NextInt(0,11)); + else if(re.NextInt(0,1)) + rtv[i].Init(2,(re.NextInt(0,1)?1:-1)*pi/60,spinner,(TColors)(re.NextInt(0,7)),re.NextInt(0,11)); + else + rtv[i].Init(3,pi/48,spinner,(TColors)(re.NextInt(0,7)),re.NextInt(0,11)); + break; + } + } + for(int i=0;i<100;++i)if(rtv[i].isActive())rtv[i].Update(); +} +//Level-1 stats from here +void Levelm1Part0() +{ + frameleft=50;All2pnt();towcnt=0;bgbrk=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + LE_Active=false; + Current_Position=2; + ShowTip("\ +Level -1-Over the Horizon\n\ +Level -1! Getting ready?\ +"); + frameleft=TenSeconds;++part; + } +} +void Levelm1Part1()//3 circles +{ + frameleft=AMinute;clrtime=2;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("RGB..."); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=1.0f;avacurbrk=0;tbrk=0; + } +} +void CircCreator(vector2d p,int cnt,TColors col) +{ + for (int i=0;i<cnt;++i) + { + int pnt=CreateBullet2(p.x,p.y,6,frameleft*pi/AMinute+i*(2*pi/cnt)); + // ^ + // Nowhere can be safe! + bullet[pnt].alterColor=col; + bullet[pnt].bulletaccel=-0.003;bullet[pnt].limv=((AMinute-frameleft)/(double)AMinute)+1.0f; + } +} +void Levelm1Part2() +{ + avacurbrk+=hge->Timer_GetDelta(); + tbrk+=hge->Timer_GetDelta(); + avabrk=(frameleft/(double)AMinute)*0.5f+0.5f; + if(tbrk>8)tbrk=0,NewMultpo(vector2d(400,300)); + if(avacurbrk>avabrk) + { + avacurbrk=0; + CircCreator(vector2d(400,250),60,red); + CircCreator(vector2d(350,336.6),60,green); + CircCreator(vector2d(450,336.6),60,blue); + } +} +BCircle scircles[200]; +double rspd[200]; +void Levelm1Part3()//circles +{ + frameleft=AMinute;clrtime=1;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("??????"); + } + if (Current_Position==1) + { + ++part;All2pnt();avabrk=1.0f;avacurbrk=1.0f;memset(scircles,0,sizeof(scircles)); + } +} +void Levelm1Part4() +{ + avacurbrk+=hge->Timer_GetDelta(); + avabrk=0.1+(frameleft/(double)AMinute)*0.4f; + if(avacurbrk>avabrk) + { + avacurbrk=0; + for(int i=0;i<200;++i) + { + if (scircles[i].GetRange()>510||scircles[i].GetRange()<1e-7) + { + scircles[i].Init(1,(re.NextInt(0,1)?1:-1)*(frameleft<TwentySeconds?0.0003:0.0002),36,vector2d(400,300),(TColors)re.NextInt(0,7),(TColors)re.NextInt(0,7)); + rspd[i]=0.575+(frameleft/(double)AMinute)*0.1;break; + } + } + } + for(int i=0;i<200;++i) + { + if (scircles[i].GetRange()>1e-7&&scircles[i].GetRange()<510) + { + scircles[i].SetRange(scircles[i].GetRange()+(LOWFPS?17:1)*rspd[i]); + if (rspd[i]>0.002)rspd[i]-=0.0005*(LOWFPS?17:1); + if (rspd[i]<=0.002)rspd[i]=0.002; + scircles[i].Update(); + } + } +} +void Levelm1Part5()//Spiky +{ + frameleft=AMinute+ThirtySeconds; + for(int i=0;i<200;++i) + if (scircles[i].GetRange()>1e-7&&scircles[i].GetRange()<510) + scircles[i].circ2pnt(); + towcnt=0;clrtime=1; + Lasercnt=0; + ++part;avabrk=1;avacurbrk=0.5; +} +void Levelm1Part6()//Spiky-child +{ + avacurbrk+=hge->Timer_GetDelta(); + if (avacurbrk>avabrk) + { + avacurbrk=0;avabrk=frameleft/(double)(AMinute+ThirtySeconds)*0.4+0.1; + for (int i=0;i<1000;++i) + { + if (!noname[i].Exist()) + { + if (frameleft<TenSeconds) + noname[i].Init(re.NextDouble(0,800),4,100,150,60,0x8033CCFF); + else if (frameleft<TwentySeconds) + noname[i].Init(re.NextDouble(0,800),4,100,150,65,0x8033CCFF); + else noname[i].Init(re.NextDouble(0,800),4,100,150,75,0x8033CCFF); + break; + } + } + if(re.NextInt(0,19)==8)NewMultpo(); + } + for (int i=0;i<1000;++i)if (noname[i].Exist())noname[i].Process(); +} +achromaGroup aca,acb; +void Levelm1Part7()//Achromatopsia1 +{ + frameleft=AMinute;for(int i=0;i<1000;++i)if(noname[i].Exist())noname[i].noname2pnt(); + aca.Init(red,0.075);acb.Init(green,0.075);clrtime=1; + ++part;avabrk=2.0f;avacurbrk=0;achromab=false; +} +void Levelm1Part8()//Achromatopsia1-child +{ + avacurbrk+=hge->Timer_GetDelta(); + if (avacurbrk>avabrk) + { + avacurbrk=0;avabrk=2; + aca.Reverse();acb.Reverse(); + if(re.NextInt(0,7)==3)NewMultpo(vector2d(re.NextInt(10,790),re.NextInt(500,590))); + } + aca.Update(1);acb.Update(); +} +void Levelm1Part9()//Achromatopsia2 +{ + frameleft=AMinute;clrtime=1; + aca.Init(red,1);acb.Init(green,1); + ++part;avabrk=1.5f;avacurbrk=0;achromab=true; +} +void Levelm1Part10()//Achromatopsia2-child +{ + avacurbrk+=hge->Timer_GetDelta(); + if (avacurbrk>avabrk) + { + avacurbrk=0;avabrk=2; + aca.Reverse();acb.Reverse(); + } + aca.Update();acb.Update(); +} +void Levelm1Part11() +{ + frameleft=AMinute+ThirtySeconds;clrtime=2; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("I've heard that all of you\n\ +support hyper-threading?"); + return; + } + ++frameskips; + if(!PlayerSplit)playerpos=vector2d(200,150),PlayerSplit=true; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower8(400,300,857,3,57,20,false); + for (int i=1;i<=towcnt;++i) + if (tower[i].RendColor==0x80FFFFFF) + { + aca.achroma2pnt();acb.achroma2pnt(); + 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 + { + IfCallLevel=false; + return; + } +} +void Levelm1Part12() +{ + frameleft=ThirtySeconds;if(tower[towcnt].towertype!=6)towcnt=0; + DisableAllTower=false; + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower6(400,300,2500,2,2000,3,12); + 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 + { + IfCallLevel=false;BTarg.TargHide(); + return; + } +} +int m19lead[10],m19gen[700]; +double m19rad; +int m19step,m19cnt; +bool m19pldir; +void Levelm1Part13()//Gravity Vortex +{ + frameleft=AMinute*2;towcnt=0;PlayerSplit=false; + clrtime=2; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Who's collecting such great power here?"); + return; + } + if (!LOWFPS) + DBGColor=ColorTransfer(DBGColor,0xFF000000); + else + for (int i=1;i<=17;++i)DBGColor=ColorTransfer(DBGColor,0xFF000000); + if (DBGColor==0xFF000000) + { + All2pnt();memset(m19lead,0,sizeof(m19lead)); + memset(m19gen,0,sizeof(m19gen)); + ++part;m19rad=m19step=m19cnt=0; + avabrk=0.05;avacurbrk=0; + for(int i=0;i<8;++i) + { + 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; + } +} +void Levelm1Part20update() +{ + if(!m19pldir)BTarg.TargGoto(vector2d(400,300)),playerpos=BTarg.targpos; + if(!m19pldir&&GetDist(playerpos,vector2d(400,300))<0.01)m19pldir=true; + for(int i=0;i<m19cnt;++i) + { + if(bullet[m19gen[i]].redattrib) + { + if(bullet[m19gen[i]].redattrib>1) + { + double r=re.NextDouble(0,75-50*(frameleft/(double)(AMinute*2))),theta=re.NextDouble(-pi,pi); + bullet[m19gen[i]].bulletpos=vector2d(400+r*cos(theta),300+r*sin(theta)); + bullet[m19gen[i]].bulletspeed=0; + } + else + { + if(GetDist(bullet[m19gen[i]].bulletpos,vector2d(400,300))<4) + { + 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))); + } + } + } + } +} +void Levelm1Part14() +{ + 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)bullet[m19lead[i]].bulletpos=vector2d(400+250*cos(m19rad+i*pi/4),300+250*sin(m19rad+i*pi/4)); + switch(m19step) + { + case 0: + if(avacurbrk>avabrk) + { + for(int i=0;i<8;++i) + { + m19gen[m19cnt]=CreateBullet2(bullet[m19lead[i]].bulletpos.x,bullet[m19lead[i]].bulletpos.y,0,0); + bullet[m19gen[m19cnt]].redir(vector2d(400,300)); + bullet[m19gen[m19cnt]].alterColor=(TColors)i; + bullet[m19gen[m19cnt]].bulletaccel=0.002; + bullet[m19gen[m19cnt]].limv=3; + bullet[m19gen[m19cnt]].whirem=1000; + bullet[m19gen[m19cnt]].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; + } + Levelm1Part20update(); + break; + case 1: + if(avacurbrk>avabrk) + { + m19step=0;avabrk=0.05;memset(m19gen,0,sizeof(m19gen));m19cnt=0; + } + tbrk+=hge->Timer_GetDelta(); + if(tbrk>0.05) + { + tbrk=0; + for(int i=0;i<8;++i) + { + 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; + bullet[pnt].bulletdir.y=-bullet[pnt].bulletdir.y; + bullet[pnt].bulletaccel=0.002;bullet[pnt].limv=2; + bullet[pnt].whirem=2500;bullet[pnt].addblend=true; + } + } + Levelm1Part20update(); + break; + } +} +vector2d snextarg; +int snexcnt,snexstep; +Target snexTarg; +void Levelm1Part15()//"Supernova" +{ + frameleft=AMinute*2;clrtime=1; + ++bgbrk;if (LOWFPS)bgbrk+=16; + if (bgbrk<30)return; + bgbrk=0;towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Super...\n\ +...nova!!"); + return; + } + if (Current_Position==1) + { + snexTarg.Init(0.001,vector2d(400,300)); + All2pnt(); + ++part;avabrk=12.0f;avacurbrk=0;tbrk=0; + snexstep=0;snexcnt=10;snexTarg.TargShow(); + } +} +void snCircCreator(vector2d p,int cnt,TColors col,bool mode) +{ + if(mode) + for (int i=0;i<cnt;++i) + { + int pnt=CreateBullet2(p.x,p.y,6,acos((playerpos-vector2d(400,300))^vector2d(1,0))+(i-0.5f)*(2*pi/cnt)); + bullet[pnt].redir(playerpos);bullet[pnt].bulletdir.Rotate((i+0.5f)*(2*pi/cnt)); + bullet[pnt].alterColor=col;bullet[pnt].addblend=true; + } + else + for (int i=0;i<cnt;++i) + { + int pnt=CreateBullet2(p.x,p.y,2,acos((playerpos-vector2d(400,300))^vector2d(1,0))+i*(2*pi/cnt)); + bullet[pnt].redir(playerpos);bullet[pnt].bulletdir.Rotate(i*(2*pi/cnt)); + bullet[pnt].alterColor=col;bullet[pnt].addblend=true; + } +} +void Levelm1Part16() +{ + snexTarg.TargRender(); + avacurbrk+=hge->Timer_GetDelta(); + tbrk+=hge->Timer_GetDelta(); + if((AMinute*2-frameleft)<TenSeconds) + { + if(tbrk>0.016&&(AMinute*2-frameleft)>TenSeconds/5) + { + tbrk=0; + snCircCreator(vector2d(400,300),144,(TColors)re.NextInt(0,7),true); + } + } + else + { + if(tbrk>0.5) + { + tbrk=0; + snCircCreator(vector2d(400,300),27,(TColors)re.NextInt(0,7),false); + } + } + switch (snexstep) + { + case 0: + if(avacurbrk>avabrk)snexstep=1,snextarg=playerpos; + break; + case 1: + snexTarg.TargGoto(snextarg); + if(GetDist(snexTarg.targpos,snextarg)<0.01) + { + snexstep=2; + avabrk=(frameleft/(double)(AMinute*2))*0.01666+0.01667; + avacurbrk=0; + snexcnt=40-(frameleft/(double)(AMinute*2))*20; + } + break; + case 2: + if(avacurbrk>avabrk) + { + if(--snexcnt>0) + { + avacurbrk=0; + for(int i=0;i<10;++i) + bullet[CreateBullet2(snexTarg.targpos.x,snexTarg.targpos.y,2,re.NextDouble(-pi,pi),true)].addblend=true; + } + else snexstep=0,avabrk=(frameleft/(double)(AMinute*2))*1+1.5f,avacurbrk=0; + } + break; + } +} +yellowGroup fyg[100]; +//Spinner fygs; +void Levelm1Part17() +{ + frameleft=AMinute+ThirtySeconds;clrtime=2; + All2pnt();towcnt=0;memset(fyg,0,sizeof(fyg)); + ++part;avabrk=1;avacurbrk=0.5;//fygs.Init(3,20); +} +void Levelm1Part18() +{ + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk) + { + avacurbrk=0; + for(int i=0;i<100;++i) + if(!fyg[i].isActive()) + { + if(frameleft>AMinute) + fyg[i].Init(12,2.5-1.5*(frameleft/(double)(AMinute+ThirtySeconds))); + else + fyg[i].Init(36,2.5-1.5*(frameleft/(double)(AMinute+ThirtySeconds))); + break; + } + CircCreator(vector2d(400,300),36,blue); + } + for(int i=0;i<100;++i)if(fyg[i].isActive())fyg[i].Update(); + //fygs.Update(pi/7200*(0.5+frameleft/(double)(AMinute+ThirtySeconds))); +} +int m17lead[4]; +void Levelm1Part19() +{ + frameleft=AMinute+ThirtySeconds;towcnt=0;clrtime=1; + All2pnt();memset(m17lead,0,sizeof(m17lead)); + ++part;avabrk=0; + 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 Levelm1Part20() +{ + snexTarg.TargRender();avacurbrk+=hge->Timer_GetDelta(); + tbrk+=hge->Timer_GetDelta();avabrk+=hge->Timer_GetDelta(); + if(avabrk>10)NewMultpo(),avabrk=0; + switch (snexstep) + { + case 0: + if(avacurbrk>avabrk)snexstep=1,snextarg=playerpos; + break; + case 1: + snexTarg.TargGoto(snextarg); + if(GetDist(snexTarg.targpos,snextarg)<0.01) + { + snexstep=0; + avabrk=(frameleft/(double)(AMinute*2))*3+2; + avacurbrk=0; + } + break; + } + 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(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(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(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(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; + bullet[pnt].alterColor=i==0?red:i==1?green:i==2?dblue:white; + } + tbrk=0; + } +} +void Levelm1Part21() +{ + //some part of this level is in towernbullet... + frameleft=AMinute*1.5;clrtime=1; + if (towcnt!=4&&towcnt!=0)return ClearAll(false); + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Zzz..."); + All2pnt(); + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + CreateTower8(30,10,1500,3,20,30,false); + CreateTower8(746,10,1500,3,20,30,false); + CreateTower8(30,556,1500,3,20,30,false); + CreateTower8(746,556,1500,3,20,30,false); + 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 + { + IfCallLevel=false; + return; + } +} +void Levelm2Part0() +{ + frameleft=10;All2pnt();towcnt=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("\ +Level -2-Assessments\n\ +Welcome to assessment mode!\n\ +You won't step to the next level until\n\ +you have a collision.\n\ +Good luck and go for the highest score!\ +"); + } + if (Current_Position==1) + { + if((DBGColor=ColorTransfer(DBGColor,0xFF1B2065))!=0xFF1B2065) + DBGColor=ColorTransfer(DBGColor,0xFF1B2065),frameleft=10; + else{++part;IfShowTip=true;bulcnt=0;return;} + } +} +Tower* dbtows[200]; +double dbroll[10]; +void Levelm2Part1() +{ + frameleft=Infinity;tbrk=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 1 - Directed bullet"); + return; + } + for(int i=0;i<5;++i) + { + dbroll[i]=-i*120-20; + for(int j=0;j<20;++j) + dbtows[i*20+j]=&tower[CreateTower1(j*40+10,dbroll[i],4000,4)]; + } + ++part; +} +void Levelm2Part2() +{ + frameleft=Infinity; + tbrk+=hge->Timer_GetDelta(); + for(int i=0;i<5;++i) + { + dbroll[i]+=0.05*(1000.0f/hge->Timer_GetFPS()); + if(dbroll[i]>600)dbroll[i]=-20; + for(int j=0;j<20;++j) + { + dbtows[i*20+j]->towerpos=vector2d(j*40+10,dbroll[i]); + if(tbrk>0.033&&dbtows[i*20+j]->towertimer>2000)dbtows[i*20+j]->towertimer-=2; + } + } + if(tbrk>0.033)tbrk=0; +} +void Levelm2Part3() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 2 - Random bullets"); + All2pnt(); + return; + } + if (towcnt!=1&&towcnt!=0)return ClearAll(false); + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + CreateTower2(400,300,999999999,0); + 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;assetime=tbrk=0; + return; + } +} +int rcnt; +void Levelm2Part4() +{ + frameleft=Infinity; + tbrk-=hge->Timer_GetDelta(); + if(tbrk<0) + { + tbrk=0.5; + if(assetime>=5)tbrk=re.NextDouble(0.25,0.5); + if(assetime>=10)tbrk=re.NextDouble(0.1,0.2); + if(assetime>=20)tbrk=re.NextDouble(0.05,0.08); + if(assetime>=30)tbrk=re.NextDouble(0.02,0.035); + if(assetime>=60)tbrk=0.02;if(assetime>=90)tbrk=0.01; + if(assetime<90)rcnt=1;if(assetime>=90)rcnt=2; + if(assetime>=120)rcnt=4;if(assetime>=150)rcnt=8; + if(assetime>=180)rcnt=16; + double rspeed=re.NextDouble(0.5+3*assetime/180.0f,1+9*assetime/180.0f); + for(int i=0;i<rcnt;++i) + CreateBullet2(400,300,rspeed,re.NextDouble(-pi,pi)); + } +} + +expSpinner es; +void Levelm2Part5() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 3 - Constant patterns"); + All2pnt(); + return; + } + if (towcnt!=0)return ClearAll(false); + if(Current_Position==1) + { + ++part;avabrk=0;avacurbrk=0; + } +} +void Levelm2Part6() +{ + frameleft=Infinity; + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk) + { + avacurbrk=0; + avabrk=6-2*assetime/120.0f; + if(avabrk<3)avabrk=1; + es.Init(3+5*assetime/120.0f,10,re.NextInt(-pi,pi)); + } + if(es.isActive())es.Update(); +} + +BCircle asscircles[200]; +void Levelm2Part7() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 4 - Crossing 1"); + All2pnt(); + return; + } + if (towcnt!=0)return ClearAll(false); + if(Current_Position==1) + { + memset(asscircles,0,sizeof(asscircles)); + ++part;avabrk=0;avacurbrk=0; + } +} +void Levelm2Part8() +{ + frameleft=Infinity; + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk) + { + shots=1; + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>800||asscircles[i].GetRange()<1e-7) + { + asscircles[i].Init(1,assetime/120.0f*0.00025,36,vector2d(250,300),blue);break; + } + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>800||asscircles[i].GetRange()<1e-7) + { + asscircles[i].Init(1,-assetime/120.0f*0.00025,36,vector2d(550,300),blue);break; + } + avacurbrk=0; + avabrk=3-assetime/60; + if(avabrk<0.5)avabrk=0.5; + } + for(int i=0;i<200;++i) + { + if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) + { + asscircles[i].SetRange(asscircles[i].GetRange()+(LOWFPS?17:1)*0.05); + asscircles[i].Update(); + } + } +} +void Levelm2Part9() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 5 - Crossing 2"); + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) + asscircles[i].circ2pnt(); + return; + } + if(Current_Position==1) + { + memset(asscircles,0,sizeof(asscircles)); + ++part;avabrk=0;avacurbrk=0; + } +} +void Levelm2Part10() +{ + frameleft=Infinity; + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk) + { + shots=1; + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>800||asscircles[i].GetRange()<1e-7) + { + asscircles[i].Init(1,0.0001,36+(24*assetime/120.0f),vector2d(400,300),blue);break; + } + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>800||asscircles[i].GetRange()<1e-7) + { + asscircles[i].Init(1,-0.0001,36+(24*assetime/120.0f),vector2d(400,300),blue);break; + } + avacurbrk=0; + avabrk=2-assetime/60; + if(avabrk<0.3)avabrk=0.3; + } + for(int i=0;i<200;++i) + { + if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) + { + asscircles[i].SetRange(asscircles[i].GetRange()+(LOWFPS?17:1)*0.05); + asscircles[i].Update(); + } + } +} +double assrad; +SELineLaser trap[100]; +void Levelm2Part11() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 6 - Trappy"); + for(int i=0;i<200;++i) + if (asscircles[i].GetRange()>1e-7&&asscircles[i].GetRange()<800) + asscircles[i].circ2pnt(); + return; + } + if(Current_Position==1) + { + memset(asscircles,0,sizeof(asscircles)); + ++part;avabrk=0;avacurbrk=0;tbrk=0;memset(trap,0,sizeof(trap)); + } +} +void Levelm2Part12() +{ + frameleft=Infinity; + avacurbrk+=hge->Timer_GetDelta(); + for(int i=0;i<100;++i) + if(trap[i].isActive())trap[i].Update(); + if(avacurbrk>avabrk) + { + bool sh=re.NextInt(0,1); + for(int c=0;c<(assetime>30?(assetime-30)/30:1);++c,sh^=1) + for(int i=0;i<100;++i) + if(!trap[i].isActive()) + { + if(sh)trap[i].Init(re.NextInt(10,590),1); + else trap[i].Init(re.NextInt(10,790),0); + break; + } + avacurbrk=0; + if(assetime<60)avabrk=3-2*assetime/60.0f; + else avabrk=2.5-(assetime-60)/120.0f; + } +} +double asssrd1; +void Levelm2Part13() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 7 - Sine wave"); + All2pnt(); + return; + } + if (towcnt!=0)return ClearAll(false); + if(Current_Position==1) + { + ++part;tbrk=asssrd1=avacurbrk=0; + } +} +void Levelm2Part14() +{ + frameleft=Infinity; + tbrk+=hge->Timer_GetDelta(); + if(tbrk>0.075) + { + tbrk=0; + asssrd1+=pi/45; + //right + for(int i=0;i<5;++i) + CreateBullet2(810,120*(i+1)+120*sin(asssrd1),2,0,true); + //right2 + if(assetime>15) + { + for(int i=0;i<5;++i) + CreateBullet2(810,120*(i+1)+120*sin(asssrd1+pi/12),2,0,true); + } + //left + if(assetime>30) + { + for(int i=0;i<5;++i) + CreateBullet2(-10,120*(i+1)+120*sin(asssrd1),2,pi,true); + } + //left2 + if(assetime>45) + { + for(int i=0;i<5;++i) + CreateBullet2(-10,120*(i+1)+120*sin(asssrd1+pi/12),2,pi,true); + } + if(assetime>60) + { + avacurbrk-=hge->Timer_GetDelta(); + if(avacurbrk<0) + { + CreateBullet1(0,0,3,0);CreateBullet1(800,0,3,0); + CreateBullet1(0,600,3,0);CreateBullet1(800,600,3,0); + avacurbrk=0.5-0.3*(assetime-60.0f)/60.0f; + if(avacurbrk<0.1)avacurbrk=0.1; + } + } + } +} +int resvpos,rpbcnt; +double delx; +void Levelm2Part15() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 8 - Density test"); + All2pnt(); + return; + } + if (towcnt!=0)return ClearAll(false); + if(Current_Position==1) + { + ++part;tbrk=asssrd1=avacurbrk=0;resvpos=re.NextInt(0,49);rpbcnt=0; + } +} +void Levelm2Part16() +{ + frameleft=Infinity; + tbrk-=hge->Timer_GetDelta(); + if(tbrk<0) + { + tbrk=0.1-0.05*(assetime/120.0f);if(tbrk<0.05)tbrk=0.05; + if(re.NextInt(0,100)==37&&!rpbcnt) + { + rpbcnt=6;int oldrp=resvpos; + for(resvpos=re.NextInt(0,49);abs(resvpos-oldrp)>20||abs(resvpos-oldrp)<5;resvpos=re.NextInt(0,49)); + delx=re.NextDouble(300,650); + } + for(int i=0;i<50;++i) + { + if(abs(i-resvpos)>2) + { + int pnt=CreateBullet2(810,12*i,1+3*assetime/180.0f,0,true); + if(rpbcnt>0)bullet[pnt].limpos=vector2d(delx,12*i); + } + } + if(rpbcnt)--rpbcnt; + if(resvpos==0)resvpos+=re.NextInt(0,1); + else if(resvpos==49)resvpos+=re.NextInt(-1,0); + else resvpos+=re.NextInt(-1,1); + } +} +CPinBall pinballs[200]; +void Levelm2Part17() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 9 - Pinball"); + All2pnt(); + return; + } + if (towcnt!=0)return ClearAll(false); + if(Current_Position==1) + { + ++part;tbrk=0;memset(pinballs,0,sizeof(pinballs)); + } +} +void Levelm2Part18() +{ + frameleft=Infinity; + //Always clean up! + for(int i=0;i<200;++i)if(pinballs[i].Getlifetime()>5)pinballs[i].Kill(); + tbrk-=hge->Timer_GetDelta(); + if(tbrk<0) + { + tbrk=1.25-0.5*assetime/120.0f;if(tbrk<0.5)tbrk=0.5; + for(int i=0;i<200;++i) + if(pinballs[i].Getlifetime()==0) + { + int lay=4+4*assetime/120.0f;if(lay>8)lay=9; + lay=re.NextInt(3,lay); + vector2d pos; + while(1) + { + pos=vector2d(re.NextDouble(100,600),re.NextDouble(100,500)); + bool place=(GetDist(pos,playerpos)>=100); + for(int j=0;j<200;++j) + if(pinballs[j].Getlifetime()>0&&j!=i) + if(GetDist(pinballs[j].Position(),pos)<pinballs[j].Radius()+lay*10.0) + {place=false;break;} + if(place)break; + } + pinballs[i].Init(pos,lay); + break; + } + } + for(int i=0;i<200;++i) + if(pinballs[i].Getlifetime()>0) + { + vector2d pos=pinballs[i].Position(); + if(pos.x<pinballs[i].Radius()-5||pos.x>790-pinballs[i].Radius()) + pinballs[i].Delta().x=-pinballs[i].Delta().x,++pinballs[i].Getlifetime(),pinballs[i].UpdateDelta(); + if(pos.y<pinballs[i].Radius()-5||pos.y>590-pinballs[i].Radius()) + pinballs[i].Delta().y=-pinballs[i].Delta().y,++pinballs[i].Getlifetime(),pinballs[i].UpdateDelta(); + for(int j=i+1;j<200;++j) + if(pinballs[j].Getlifetime()>0&&pinballs[j].Getlifetime()<=5) + if(GetDist(pinballs[j].Position(),pinballs[i].Position())<pinballs[j].Radius()+pinballs[i].Radius()) + { + double sqrdis=sqr(GetDist(pinballs[j].Position(),pinballs[i].Position())); + vector2d colline(pinballs[j].Position().x-pinballs[i].Position().x, + pinballs[j].Position().y-pinballs[i].Position().y); + double vp=pinballs[i].Delta()|colline; + double wp=pinballs[j].Delta()|colline; + vector2d ddelta((wp-vp)*colline.x/sqrdis,(wp-vp)*colline.y/sqrdis); + pinballs[i].Delta().x+=ddelta.x;pinballs[i].Delta().y+=ddelta.y; + pinballs[j].Delta().x-=ddelta.x;pinballs[j].Delta().y-=ddelta.y; + //prevent them to stick together... + vector2d stkprv=0.05*(pinballs[j].Radius()/sqrt(sqrdis)-1)*colline; + pinballs[j].Position()=pinballs[j].Position()-stkprv; + pinballs[i].UpdateDelta();pinballs[j].UpdateDelta(); + } + pinballs[i].Update(); + } +} +void Levelm2Part19() +{ + frameleft=Infinity; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 10 - Road blocks"); + All2pnt(); + return; + } + if (towcnt!=0)return ClearAll(false); + if(Current_Position==1) + { + ++part;tbrk=0;memset(pinballs,0,sizeof(pinballs)); + } +} +void Levelm2Part20() +{ + frameleft=Infinity; + tbrk-=hge->Timer_GetDelta(); + if(tbrk<0) + { + tbrk=2-1*(assetime/120.0f);if(tbrk<0.75)tbrk=0.75; + delx=re.NextDouble(350,700); + resvpos=re.NextInt(0,49); + for(int i=0;i<50;++i) + { + int pnt=CreateBullet2(810,12*i,1+2*assetime/180.0f,0,true); + if(abs(i-resvpos)<=3)bullet[pnt].limpos=vector2d(delx,12*i); + } + } +} +void Levelm2Part21() +{ + frameleft=Infinity;Dis8ref=true;tbrk=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 11 - Extreme speeds"); + All2pnt();towcnt=0; + return; + } + ++frameskips; + if (frameskips<10&&!LOWFPS)return; + frameskips=0; + for (int i=1;i<=33;++i)CreateTower8(i*24-12,12,500,6,20,30); + 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 Levelm2Part22() +{ + frameleft=Infinity; + double nspd=6+4*assetime/120.0f;if(nspd>10)nspd=10; + for(int i=1;i<=33;++i)tower[i].bulletspeed=nspd; + tbrk-=hge->Timer_GetDelta(); + if (tbrk>0)return; + tbrk=3-2*(assetime/120.0f); + if(tbrk<0.5)tbrk=0.5; + for (int i=0;i<6;++i) + { + int p=CreateBullet2(playerpos.x+cos(i*pi/3.0f)*6,12+sin(i*pi/3.0f)*6,2,-pi/2); + bullet[p].alterColor=orange; + } +} +SimpLL SLL[200]; +void Levelm2Part23() +{ + frameleft=Infinity;Dis8ref=true;tbrk=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Test 12 - Messed up"); + All2pnt();towcnt=0; + return; + } + if (towcnt!=0)return ClearAll(false); + ++part;tbrk=avacurbrk=avabrk=0;memset(SLL,0,sizeof(SLL)); +} +void Levelm2Part24() +{ + frameleft=Infinity; + tbrk-=hge->Timer_GetDelta(); + if(tbrk<0) + { + tbrk=3-2.5*(assetime/120.0f); + if(tbrk<0.5)tbrk=0.5; + /*int cnt=12+12*assetime/120.0f; + if(cnt>24)cnt=24; + for(int i=0;i<cnt;++i) + { + vector2d dir=vector2d(400-playerpos.x,300-playerpos.y); + dir.ToUnitCircle();dir=50*dir;dir.Rotate(i*2*pi/cnt); + int pnt=CreateBullet2(400+dir.x,300+dir.y,0,0,true); + bullet[pnt].limv=-2;bullet[pnt].bulletaccel=-0.001;bullet[pnt].whirem=500; + bullet[pnt].redir(vector2d(400,300)); + }*/ + } + avacurbrk+=hge->Timer_GetDelta(); + if(avacurbrk>avabrk) + { + avacurbrk=0;avabrk=4-3*assetime/120.0f;if(avabrk<0.5)avabrk=0.5; + vector2d a,b;int cnt=re.NextInt(5,10); + for (int i=0;i<cnt;++i) + { + if (re.NextInt(1,100)>=50) + { + if (re.NextInt(1,100)>=50)a=vector2d(re.NextDouble(10,790),610);else a=vector2d(re.NextDouble(10,790),-10); + } + else + { + if (re.NextInt(1,100)>=50)a=vector2d(-10,re.NextDouble(10,590));else a=vector2d(810,re.NextDouble(10,590)); + } + if (re.NextInt(1,100)>=50) + { + if (re.NextInt(1,100)>=50)b=vector2d(re.NextDouble(10,790),610);else b=vector2d(re.NextDouble(10,790),-10); + } + else + { + if (re.NextInt(1,100)>=50)b=vector2d(-10,re.NextDouble(10,590));else b=vector2d(810,re.NextDouble(10,590)); + } + for(int i=0;i<200;++i) + if(!SLL[i].active) + { + SLL[i].InitLine(a,b,0.1,SETA(ColorToDWORD(blue),0x80)); + SLL[i].active=true;SLL[i].stp=0;SLL[i].brk=0;SLL[i].EnableColl=false; + break; + } + } + } + for(int i=0;i<200;++i) + if(SLL[i].active) + { + SLL[i].Process(); + SLL[i].brk+=hge->Timer_GetDelta(); + if(SLL[i].stp==2) + if(SLL[i].brk>0.02) + { + SLL[i].SetWidth(SLL[i].GetWidth()-0.2); + if(SLL[i].GetWidth()<1)SLL[i].EnableColl=false; + if(SLL[i].GetWidth()<0.05)SLL[i].active=false; + SLL[i].brk=0; + } + if(SLL[i].stp==0) + if(SLL[i].brk>0.02) + { + SLL[i].SetWidth(SLL[i].GetWidth()+0.2); + if(SLL[i].GetWidth()>1)SLL[i].EnableColl=true; + if(SLL[i].GetWidth()>4)SLL[i].stp=1; + SLL[i].brk=0; + } + if(SLL[i].stp==1) + if(SLL[i].brk>5){SLL[i].brk=0;SLL[i].stp=2;} + } +} +void Levelm2Part25() +{ + frameleft=Infinity;Dis8ref=true;tbrk=0; + DisableAllTower=false; + if (IfShowTip) + { + IfShowTip=false; + FadeTip=false; + Current_Position=2; + ShowTip("Bonus test - Lunatic Lunar!"); + All2pnt();towcnt=0; + for(int i=0;i<200;++i)if(SLL[i].active)SLL[i].llsrtopnt(10); + return; + } + ++part;tbrk=0;memset(SLL,0,sizeof(SLL));avabrk=1; +} +void Levelm2Part26() +{ + frameleft=Infinity; + tbrk-=hge->Timer_GetDelta(); + if(tbrk<0) + { + tbrk=0.05; + int cnt=1; + if(!re.NextInt(0,19))avabrk=avabrk?0:1; + for(int i=0;i<cnt;++i) + { + if(avabrk) + { + int cc=assetime/120.0f*18+18; + vector2d centre(re.NextDouble(380,420),re.NextDouble(280,320)); + double rnd=atan2(playerpos.y-centre.y,playerpos.x-centre.x),spd=assetime/120.0f*4+6; + if(re.NextInt(0,3)) + rnd+=re.NextDouble(-assetime/120.0f*pi/24,assetime/120.0f*pi/24); + for(int i=0;i<cc;++i) + CreateBullet2(centre.x,centre.y,spd,i*2*pi/cc+rnd,false); + } + else + { + vector2d pos=vector2d(400+re.NextDouble(-20,20),300+re.NextDouble(-20,20)); + double spd=assetime/120.0f*4+6; + int cc=assetime/120.0f*18+18; + double rnd=atan2(playerpos.y-pos.y,playerpos.x-pos.x); + if(re.NextInt(0,3)) + rnd+=re.NextDouble(-assetime/120.0f*pi/24,assetime/120.0f*pi/24); + for(int i=0;i<cc;++i) + { + double dir=i*2*pi/cc+rnd,ran=re.NextDouble(-pi,pi); + for(int i=0;i<6;++i) + CreateBullet2(pos.x+6*sin(ran+i*(pi/3)),pos.y+6*cos(ran+i*(pi/3)),spd,dir,false); + CreateBullet2(pos.x,pos.y,spd,dir,false); + } + } + } + } +} diff --git a/archive/blr2/src/libcgh.h b/archive/blr2/src/libcgh.h new file mode 100644 index 0000000..324ba42 --- /dev/null +++ b/archive/blr2/src/libcgh.h @@ -0,0 +1,140 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Chrisoft Game Helper header +// Copyright Chrisoft 2014 +// libcgh version 0007 +// Last full compatible version 0007 +// ^Modify that when big change is made^ +#include <hge.h> +#include <hgefont.h> +#include <hgedistort.h> +#include <hgecolor.h> +#include <math.h> +#ifndef libcgh_H +#define libcgh_H +#define pi 3.1415926535 +#define sqr(x) ((x)*(x)) +//static const char* LIBCGH_H_FN="libcgh.h"; + +struct vector2d +{ + double x,y; + vector2d(double _x,double _y){x=_x;y=_y;} + vector2d(){x=y=0;} + double l(){return sqrt(sqr(x)+sqr(y));} + void ToUnitCircle(){double len=l();x/=len;y/=len;} + 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); + } + friend vector2d operator +(vector2d a,vector2d b) + { + return vector2d(a.x+b.x,a.y+b.y); + } + friend double operator |(vector2d a,vector2d b)//dot product + { + return a.x*b.x+a.y*b.y; + } + friend double operator *(vector2d a,vector2d b)//length of cross product + { + return a.x*b.y-b.x*a.y; + } + friend vector2d operator *(double a,vector2d b) + { + return vector2d(b.x*a,b.y*a); + } + friend double operator ^(vector2d a,vector2d b)//cosine of angle + { + return (a|b)/a.l()/b.l(); + } +}; +inline vector2d ToUnitCircle(vector2d input) +{ + vector2d res=input; + res.x=res.x/input.l(); + res.y=res.y/input.l(); + return res; +} +inline double GetDist(const vector2d a,const vector2d b) +{ + return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y)); +} +inline double GetDistSeg(const vector2d a,const vector2d b,const vector2d c) +{ + double l2=GetDist(a,b)*GetDist(a,b); + if (l2==0.0)return GetDist(c,a); + double t=((c-a)|(b-a))/l2; + if (t<0)return GetDist(c,a); + else if (t>1)return GetDist(c,b); + vector2d projection=a+t*(b-a); + return GetDist(c,projection); +} +inline double normalizerad(double a) +{ + while (a<0)a+=2*pi; + while (a>2*pi)a-=2*pi; + return a; +} +struct TextureRect +{ + double x,y,w,h; + TextureRect(){} + TextureRect(double _x,double _y,double _w,double _h){x=_x,y=_y,w=_w,h=_h;} +}; +class RandomEngine +{ +private: + unsigned int cseed; +public: + void SetSeed(unsigned int seed); + int NextInt(int min,int max); + double NextDouble(double min,double max); +}; +class CircleIndicator +{ +private: + hgeDistortionMesh *circle; + double value,radius,thk; + DWORD ccolour; + bool gradient; + BYTE alpha; +public: + void Init(double _r,double _thk,BYTE _a,bool _gr,HTEXTURE _Texture,TextureRect _TR,DWORD _cc=0); + void SetAlpha(BYTE _alpha); + void SetValue(double _value); + void Render(double x,double y); +}; +class LinearProgresser +{ +private: + double a,b,val; + double Elapsed,Limit; +public: + void Init(double _a,double _b,double _Lim); + void Launch(); + void Update(double DT); + double GetA(); + double GetB(); + double GetValue(); + double GetPercentage(); + double GetDelta(); + double GetElapsed(); +}; +class HangUpText +{ +private: + hgeFont *TFont; + vector2d Position; + double Elapsed,Limit,dlim,delta; + BYTE alim,alpha; + char Text[255]; + LinearProgresser Progresser,Progalpha; + bool done; +public: + bool Active(); + void Init(const char *Font,const char *_Text,double _tlim,double _alim,double _dlim,DWORD _color=0x00FFFFFF); + void Launch(vector2d pos); + void Process(double DT); +}; +#endif diff --git a/archive/blr2/src/libcghEx.cpp b/archive/blr2/src/libcghEx.cpp new file mode 100644 index 0000000..a8fa698 --- /dev/null +++ b/archive/blr2/src/libcghEx.cpp @@ -0,0 +1,113 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Chrisoft Game Helper Extras implementations +// Copyright Chrisoft 2014 +#include "libcgh.h" +#include <cmath> +#include <cstring> +//static const char* LIBCGH_SRC_FN="libcghEx.cpp"; + +void RandomEngine::SetSeed(unsigned int seed){cseed=seed;} +int RandomEngine::NextInt(int min,int max) +{ + if (min>max){int t=min;min=max;max=t;} + cseed*=214013;cseed+=2531011; + return min+(cseed^cseed>>15)%(max-min+1); +} +double RandomEngine::NextDouble(double min,double max) +{ + if (min>max){double t=min;min=max;max=t;} + cseed*=214013;cseed+=2531011; + return min+(cseed>>16)*(1.0f/65535.0f)*(max-min); +} +void CircleIndicator::Init(double _r,double _thk,BYTE _a,bool _gr,HTEXTURE _Texture,TextureRect _TR,DWORD _cc) +{ + circle=new hgeDistortionMesh(1025,3); + circle->SetTexture(_Texture); + circle->SetTextureRect(_TR.x,_TR.y,_TR.w,_TR.h); + radius=_r;thk=_thk;gradient=_gr;alpha=_a; + if (_gr)ccolour=SETA(0x00FF0000,alpha);else ccolour=_cc; + for (int i=0;i<=1024;++i) + { + double tang,tx,ty; + tang=(double)i/1024.0f*pi*2-pi/2; + tx=-cos(tang)*radius;ty=sin(tang)*radius; + circle->SetDisplacement(i,2,tx,ty,HGEDISP_TOPLEFT); + tx*=thk;ty*=thk; + circle->SetDisplacement(i,1,tx,ty,HGEDISP_TOPLEFT); + tx*=thk;ty*=thk; + circle->SetDisplacement(i,0,tx,ty,HGEDISP_TOPLEFT); + } +} +void CircleIndicator::SetAlpha(BYTE _alpha){alpha=_alpha;} +void CircleIndicator::SetValue(double _value) +{ + value=_value; + for (int i=0;i<=1024;++i) + { + int tr=(int)((1.0f-value)*255); + int tg=(int)(value*255); + DWORD tcolour=ARGB(alpha,tr,tg,0); + hgeColorHSV *tc=new hgeColorHSV(tcolour); + if (tc->v<0.85)tc->v=0.85; + if (gradient)tcolour=SETA(tc->GetHWColor(),alpha);else tcolour=SETA(ccolour,alpha); + if ((double)i/1024.0f<=value) + { + circle->SetColor(i,0,tcolour); + circle->SetColor(i,1,SETA(0x00FFFFFF,alpha)); + circle->SetColor(i,2,tcolour); + } + else + { + circle->SetColor(i,0,0x00000000); + circle->SetColor(i,1,0x00000000); + circle->SetColor(i,2,0x00000000); + } + delete tc; + } +} +void CircleIndicator::Render(double x,double y){circle->Render(x,y);} + +void LinearProgresser::Init(double _a,double _b,double _Lim){a=_a,b=_b,Limit=_Lim;} +void LinearProgresser::Launch(){Elapsed=0;val=a;} +void LinearProgresser::Update(double DT){if (Elapsed+DT>=Limit)return (void)(val=b,Elapsed=Limit);Elapsed+=DT;val=(b-a)*(Elapsed/Limit)+a;} +double LinearProgresser::GetValue(){return val;} +double LinearProgresser::GetA(){return a;} +double LinearProgresser::GetB(){return b;} +double LinearProgresser::GetPercentage(){return (Elapsed/Limit);} +double LinearProgresser::GetDelta(){return val-a;} +double LinearProgresser::GetElapsed(){return Elapsed;} + +bool HangUpText::Active(){return TFont&&!done;} +void HangUpText::Init(const char *Font,const char *_Text,double _tlim,double _alim,double _dlim,DWORD _color) +{ + TFont=new hgeFont(Font); + TFont->SetScale(0.8); + strcpy(Text,_Text); + Limit=_tlim;alim=_alim;dlim=_dlim;TFont->SetColor(_color); + Progresser.Init(0,dlim,Limit);Progalpha.Init(0,255,Limit/2); +} +void HangUpText::Launch(vector2d pos) +{ + Position=pos;Elapsed=0;delta=0;Progresser.Launch();Progalpha.Launch();done=false; +} +void HangUpText::Process(double DT) +{ + Progresser.Update(DT); + Position.y-=delta; + delta=Progresser.GetDelta(); + Position.y+=delta; + if (Progresser.GetElapsed()>Limit/2&&Progalpha.GetA()<Progalpha.GetB()) + { + Progalpha.Init(255,0,Limit/2); + Progalpha.Launch(); + } + if (Progalpha.GetA()>Progalpha.GetB()&&Progresser.GetElapsed()>=Limit) + { + delete TFont;TFont=0; + return (void)(done=true); + } + Progalpha.Update(DT); + if(!TFont)return; + TFont->SetColor(SETA(TFont->GetColor(),Progalpha.GetValue())); + TFont->printf(Position.x,Position.y,HGETEXT_CENTER,Text); +} diff --git a/archive/blr2/src/loading.h b/archive/blr2/src/loading.h new file mode 100644 index 0000000..acf59aa --- /dev/null +++ b/archive/blr2/src/loading.h @@ -0,0 +1,384 @@ +unsigned char Loading[]= +{0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D,0x49,0x48,0x44,0x52,0x00,0x00,0x00,0x60, +0x00,0x00,0x00,0x20,0x08,0x06,0x00,0x00,0x00,0xED,0xC0,0x7D,0x54,0x00,0x00,0x00,0x09,0x70,0x48, +0x59,0x73,0x00,0x00,0x0B,0x13,0x00,0x00,0x0B,0x13,0x01,0x00,0x9A,0x9C,0x18,0x00,0x00,0x0A,0x4D, +0x69,0x43,0x43,0x50,0x50,0x68,0x6F,0x74,0x6F,0x73,0x68,0x6F,0x70,0x20,0x49,0x43,0x43,0x20,0x70, +0x72,0x6F,0x66,0x69,0x6C,0x65,0x00,0x00,0x78,0xDA,0x9D,0x53,0x77,0x58,0x93,0xF7,0x16,0x3E,0xDF, +0xF7,0x65,0x0F,0x56,0x42,0xD8,0xF0,0xB1,0x97,0x6C,0x81,0x00,0x22,0x23,0xAC,0x08,0xC8,0x10,0x59, +0xA2,0x10,0x92,0x00,0x61,0x84,0x10,0x12,0x40,0xC5,0x85,0x88,0x0A,0x56,0x14,0x15,0x11,0x9C,0x48, +0x55,0xC4,0x82,0xD5,0x0A,0x48,0x9D,0x88,0xE2,0xA0,0x28,0xB8,0x67,0x41,0x8A,0x88,0x5A,0x8B,0x55, +0x5C,0x38,0xEE,0x1F,0xDC,0xA7,0xB5,0x7D,0x7A,0xEF,0xED,0xED,0xFB,0xD7,0xFB,0xBC,0xE7,0x9C,0xE7, +0xFC,0xCE,0x79,0xCF,0x0F,0x80,0x11,0x12,0x26,0x91,0xE6,0xA2,0x6A,0x00,0x39,0x52,0x85,0x3C,0x3A, +0xD8,0x1F,0x8F,0x4F,0x48,0xC4,0xC9,0xBD,0x80,0x02,0x15,0x48,0xE0,0x04,0x20,0x10,0xE6,0xCB,0xC2, +0x67,0x05,0xC5,0x00,0x00,0xF0,0x03,0x79,0x78,0x7E,0x74,0xB0,0x3F,0xFC,0x01,0xAF,0x6F,0x00,0x02, +0x00,0x70,0xD5,0x2E,0x24,0x12,0xC7,0xE1,0xFF,0x83,0xBA,0x50,0x26,0x57,0x00,0x20,0x91,0x00,0xE0, +0x22,0x12,0xE7,0x0B,0x01,0x90,0x52,0x00,0xC8,0x2E,0x54,0xC8,0x14,0x00,0xC8,0x18,0x00,0xB0,0x53, +0xB3,0x64,0x0A,0x00,0x94,0x00,0x00,0x6C,0x79,0x7C,0x42,0x22,0x00,0xAA,0x0D,0x00,0xEC,0xF4,0x49, +0x3E,0x05,0x00,0xD8,0xA9,0x93,0xDC,0x17,0x00,0xD8,0xA2,0x1C,0xA9,0x08,0x00,0x8D,0x01,0x00,0x99, +0x28,0x47,0x24,0x02,0x40,0xBB,0x00,0x60,0x55,0x81,0x52,0x2C,0x02,0xC0,0xC2,0x00,0xA0,0xAC,0x40, +0x22,0x2E,0x04,0xC0,0xAE,0x01,0x80,0x59,0xB6,0x32,0x47,0x02,0x80,0xBD,0x05,0x00,0x76,0x8E,0x58, +0x90,0x0F,0x40,0x60,0x00,0x80,0x99,0x42,0x2C,0xCC,0x00,0x20,0x38,0x02,0x00,0x43,0x1E,0x13,0xCD, +0x03,0x20,0x4C,0x03,0xA0,0x30,0xD2,0xBF,0xE0,0xA9,0x5F,0x70,0x85,0xB8,0x48,0x01,0x00,0xC0,0xCB, +0x95,0xCD,0x97,0x4B,0xD2,0x33,0x14,0xB8,0x95,0xD0,0x1A,0x77,0xF2,0xF0,0xE0,0xE2,0x21,0xE2,0xC2, +0x6C,0xB1,0x42,0x61,0x17,0x29,0x10,0x66,0x09,0xE4,0x22,0x9C,0x97,0x9B,0x23,0x13,0x48,0xE7,0x03, +0x4C,0xCE,0x0C,0x00,0x00,0x1A,0xF9,0xD1,0xC1,0xFE,0x38,0x3F,0x90,0xE7,0xE6,0xE4,0xE1,0xE6,0x66, +0xE7,0x6C,0xEF,0xF4,0xC5,0xA2,0xFE,0x6B,0xF0,0x6F,0x22,0x3E,0x21,0xF1,0xDF,0xFE,0xBC,0x8C,0x02, +0x04,0x00,0x10,0x4E,0xCF,0xEF,0xDA,0x5F,0xE5,0xE5,0xD6,0x03,0x70,0xC7,0x01,0xB0,0x75,0xBF,0x6B, +0xA9,0x5B,0x00,0xDA,0x56,0x00,0x68,0xDF,0xF9,0x5D,0x33,0xDB,0x09,0xA0,0x5A,0x0A,0xD0,0x7A,0xF9, +0x8B,0x79,0x38,0xFC,0x40,0x1E,0x9E,0xA1,0x50,0xC8,0x3C,0x1D,0x1C,0x0A,0x0B,0x0B,0xED,0x25,0x62, +0xA1,0xBD,0x30,0xE3,0x8B,0x3E,0xFF,0x33,0xE1,0x6F,0xE0,0x8B,0x7E,0xF6,0xFC,0x40,0x1E,0xFE,0xDB, +0x7A,0xF0,0x00,0x71,0x9A,0x40,0x99,0xAD,0xC0,0xA3,0x83,0xFD,0x71,0x61,0x6E,0x76,0xAE,0x52,0x8E, +0xE7,0xCB,0x04,0x42,0x31,0x6E,0xF7,0xE7,0x23,0xFE,0xC7,0x85,0x7F,0xFD,0x8E,0x29,0xD1,0xE2,0x34, +0xB1,0x5C,0x2C,0x15,0x8A,0xF1,0x58,0x89,0xB8,0x50,0x22,0x4D,0xC7,0x79,0xB9,0x52,0x91,0x44,0x21, +0xC9,0x95,0xE2,0x12,0xE9,0x7F,0x32,0xF1,0x1F,0x96,0xFD,0x09,0x93,0x77,0x0D,0x00,0xAC,0x86,0x4F, +0xC0,0x4E,0xB6,0x07,0xB5,0xCB,0x6C,0xC0,0x7E,0xEE,0x01,0x02,0x8B,0x0E,0x58,0xD2,0x76,0x00,0x40, +0x7E,0xF3,0x2D,0x8C,0x1A,0x0B,0x91,0x00,0x10,0x67,0x34,0x32,0x79,0xF7,0x00,0x00,0x93,0xBF,0xF9, +0x8F,0x40,0x2B,0x01,0x00,0xCD,0x97,0xA4,0xE3,0x00,0x00,0xBC,0xE8,0x18,0x5C,0xA8,0x94,0x17,0x4C, +0xC6,0x08,0x00,0x00,0x44,0xA0,0x81,0x2A,0xB0,0x41,0x07,0x0C,0xC1,0x14,0xAC,0xC0,0x0E,0x9C,0xC1, +0x1D,0xBC,0xC0,0x17,0x02,0x61,0x06,0x44,0x40,0x0C,0x24,0xC0,0x3C,0x10,0x42,0x06,0xE4,0x80,0x1C, +0x0A,0xA1,0x18,0x96,0x41,0x19,0x54,0xC0,0x3A,0xD8,0x04,0xB5,0xB0,0x03,0x1A,0xA0,0x11,0x9A,0xE1, +0x10,0xB4,0xC1,0x31,0x38,0x0D,0xE7,0xE0,0x12,0x5C,0x81,0xEB,0x70,0x17,0x06,0x60,0x18,0x9E,0xC2, +0x18,0xBC,0x86,0x09,0x04,0x41,0xC8,0x08,0x13,0x61,0x21,0x3A,0x88,0x11,0x62,0x8E,0xD8,0x22,0xCE, +0x08,0x17,0x99,0x8E,0x04,0x22,0x61,0x48,0x34,0x92,0x80,0xA4,0x20,0xE9,0x88,0x14,0x51,0x22,0xC5, +0xC8,0x72,0xA4,0x02,0xA9,0x42,0x6A,0x91,0x5D,0x48,0x23,0xF2,0x2D,0x72,0x14,0x39,0x8D,0x5C,0x40, +0xFA,0x90,0xDB,0xC8,0x20,0x32,0x8A,0xFC,0x8A,0xBC,0x47,0x31,0x94,0x81,0xB2,0x51,0x03,0xD4,0x02, +0x75,0x40,0xB9,0xA8,0x1F,0x1A,0x8A,0xC6,0xA0,0x73,0xD1,0x74,0x34,0x0F,0x5D,0x80,0x96,0xA2,0x6B, +0xD1,0x1A,0xB4,0x1E,0x3D,0x80,0xB6,0xA2,0xA7,0xD1,0x4B,0xE8,0x75,0x74,0x00,0x7D,0x8A,0x8E,0x63, +0x80,0xD1,0x31,0x0E,0x66,0x8C,0xD9,0x61,0x5C,0x8C,0x87,0x45,0x60,0x89,0x58,0x1A,0x26,0xC7,0x16, +0x63,0xE5,0x58,0x35,0x56,0x8F,0x35,0x63,0x1D,0x58,0x37,0x76,0x15,0x1B,0xC0,0x9E,0x61,0xEF,0x08, +0x24,0x02,0x8B,0x80,0x13,0xEC,0x08,0x5E,0x84,0x10,0xC2,0x6C,0x82,0x90,0x90,0x47,0x58,0x4C,0x58, +0x43,0xA8,0x25,0xEC,0x23,0xB4,0x12,0xBA,0x08,0x57,0x09,0x83,0x84,0x31,0xC2,0x27,0x22,0x93,0xA8, +0x4F,0xB4,0x25,0x7A,0x12,0xF9,0xC4,0x78,0x62,0x3A,0xB1,0x90,0x58,0x46,0xAC,0x26,0xEE,0x21,0x1E, +0x21,0x9E,0x25,0x5E,0x27,0x0E,0x13,0x5F,0x93,0x48,0x24,0x0E,0xC9,0x92,0xE4,0x4E,0x0A,0x21,0x25, +0x90,0x32,0x49,0x0B,0x49,0x6B,0x48,0xDB,0x48,0x2D,0xA4,0x53,0xA4,0x3E,0xD2,0x10,0x69,0x9C,0x4C, +0x26,0xEB,0x90,0x6D,0xC9,0xDE,0xE4,0x08,0xB2,0x80,0xAC,0x20,0x97,0x91,0xB7,0x90,0x0F,0x90,0x4F, +0x92,0xFB,0xC9,0xC3,0xE4,0xB7,0x14,0x3A,0xC5,0x88,0xE2,0x4C,0x09,0xA2,0x24,0x52,0xA4,0x94,0x12, +0x4A,0x35,0x65,0x3F,0xE5,0x04,0xA5,0x9F,0x32,0x42,0x99,0xA0,0xAA,0x51,0xCD,0xA9,0x9E,0xD4,0x08, +0xAA,0x88,0x3A,0x9F,0x5A,0x49,0x6D,0xA0,0x76,0x50,0x2F,0x53,0x87,0xA9,0x13,0x34,0x75,0x9A,0x25, +0xCD,0x9B,0x16,0x43,0xCB,0xA4,0x2D,0xA3,0xD5,0xD0,0x9A,0x69,0x67,0x69,0xF7,0x68,0x2F,0xE9,0x74, +0xBA,0x09,0xDD,0x83,0x1E,0x45,0x97,0xD0,0x97,0xD2,0x6B,0xE8,0x07,0xE9,0xE7,0xE9,0x83,0xF4,0x77, +0x0C,0x0D,0x86,0x0D,0x83,0xC7,0x48,0x62,0x28,0x19,0x6B,0x19,0x7B,0x19,0xA7,0x18,0xB7,0x19,0x2F, +0x99,0x4C,0xA6,0x05,0xD3,0x97,0x99,0xC8,0x54,0x30,0xD7,0x32,0x1B,0x99,0x67,0x98,0x0F,0x98,0x6F, +0x55,0x58,0x2A,0xF6,0x2A,0x7C,0x15,0x91,0xCA,0x12,0x95,0x3A,0x95,0x56,0x95,0x7E,0x95,0xE7,0xAA, +0x54,0x55,0x73,0x55,0x3F,0xD5,0x79,0xAA,0x0B,0x54,0xAB,0x55,0x0F,0xAB,0x5E,0x56,0x7D,0xA6,0x46, +0x55,0xB3,0x50,0xE3,0xA9,0x09,0xD4,0x16,0xAB,0xD5,0xA9,0x1D,0x55,0xBB,0xA9,0x36,0xAE,0xCE,0x52, +0x77,0x52,0x8F,0x50,0xCF,0x51,0x5F,0xA3,0xBE,0x5F,0xFD,0x82,0xFA,0x63,0x0D,0xB2,0x86,0x85,0x46, +0xA0,0x86,0x48,0xA3,0x54,0x63,0xB7,0xC6,0x19,0x8D,0x21,0x16,0xC6,0x32,0x65,0xF1,0x58,0x42,0xD6, +0x72,0x56,0x03,0xEB,0x2C,0x6B,0x98,0x4D,0x62,0x5B,0xB2,0xF9,0xEC,0x4C,0x76,0x05,0xFB,0x1B,0x76, +0x2F,0x7B,0x4C,0x53,0x43,0x73,0xAA,0x66,0xAC,0x66,0x91,0x66,0x9D,0xE6,0x71,0xCD,0x01,0x0E,0xC6, +0xB1,0xE0,0xF0,0x39,0xD9,0x9C,0x4A,0xCE,0x21,0xCE,0x0D,0xCE,0x7B,0x2D,0x03,0x2D,0x3F,0x2D,0xB1, +0xD6,0x6A,0xAD,0x66,0xAD,0x7E,0xAD,0x37,0xDA,0x7A,0xDA,0xBE,0xDA,0x62,0xED,0x72,0xED,0x16,0xED, +0xEB,0xDA,0xEF,0x75,0x70,0x9D,0x40,0x9D,0x2C,0x9D,0xF5,0x3A,0x6D,0x3A,0xF7,0x75,0x09,0xBA,0x36, +0xBA,0x51,0xBA,0x85,0xBA,0xDB,0x75,0xCF,0xEA,0x3E,0xD3,0x63,0xEB,0x79,0xE9,0x09,0xF5,0xCA,0xF5, +0x0E,0xE9,0xDD,0xD1,0x47,0xF5,0x6D,0xF4,0xA3,0xF5,0x17,0xEA,0xEF,0xD6,0xEF,0xD1,0x1F,0x37,0x30, +0x34,0x08,0x36,0x90,0x19,0x6C,0x31,0x38,0x63,0xF0,0xCC,0x90,0x63,0xE8,0x6B,0x98,0x69,0xB8,0xD1, +0xF0,0x84,0xE1,0xA8,0x11,0xCB,0x68,0xBA,0x91,0xC4,0x68,0xA3,0xD1,0x49,0xA3,0x27,0xB8,0x26,0xEE, +0x87,0x67,0xE3,0x35,0x78,0x17,0x3E,0x66,0xAC,0x6F,0x1C,0x62,0xAC,0x34,0xDE,0x65,0xDC,0x6B,0x3C, +0x61,0x62,0x69,0x32,0xDB,0xA4,0xC4,0xA4,0xC5,0xE4,0xBE,0x29,0xCD,0x94,0x6B,0x9A,0x66,0xBA,0xD1, +0xB4,0xD3,0x74,0xCC,0xCC,0xC8,0x2C,0xDC,0xAC,0xD8,0xAC,0xC9,0xEC,0x8E,0x39,0xD5,0x9C,0x6B,0x9E, +0x61,0xBE,0xD9,0xBC,0xDB,0xFC,0x8D,0x85,0xA5,0x45,0x9C,0xC5,0x4A,0x8B,0x36,0x8B,0xC7,0x96,0xDA, +0x96,0x7C,0xCB,0x05,0x96,0x4D,0x96,0xF7,0xAC,0x98,0x56,0x3E,0x56,0x79,0x56,0xF5,0x56,0xD7,0xAC, +0x49,0xD6,0x5C,0xEB,0x2C,0xEB,0x6D,0xD6,0x57,0x6C,0x50,0x1B,0x57,0x9B,0x0C,0x9B,0x3A,0x9B,0xCB, +0xB6,0xA8,0xAD,0x9B,0xAD,0xC4,0x76,0x9B,0x6D,0xDF,0x14,0xE2,0x14,0x8F,0x29,0xD2,0x29,0xF5,0x53, +0x6E,0xDA,0x31,0xEC,0xFC,0xEC,0x0A,0xEC,0x9A,0xEC,0x06,0xED,0x39,0xF6,0x61,0xF6,0x25,0xF6,0x6D, +0xF6,0xCF,0x1D,0xCC,0x1C,0x12,0x1D,0xD6,0x3B,0x74,0x3B,0x7C,0x72,0x74,0x75,0xCC,0x76,0x6C,0x70, +0xBC,0xEB,0xA4,0xE1,0x34,0xC3,0xA9,0xC4,0xA9,0xC3,0xE9,0x57,0x67,0x1B,0x67,0xA1,0x73,0x9D,0xF3, +0x35,0x17,0xA6,0x4B,0x90,0xCB,0x12,0x97,0x76,0x97,0x17,0x53,0x6D,0xA7,0x8A,0xA7,0x6E,0x9F,0x7A, +0xCB,0x95,0xE5,0x1A,0xEE,0xBA,0xD2,0xB5,0xD3,0xF5,0xA3,0x9B,0xBB,0x9B,0xDC,0xAD,0xD9,0x6D,0xD4, +0xDD,0xCC,0x3D,0xC5,0x7D,0xAB,0xFB,0x4D,0x2E,0x9B,0x1B,0xC9,0x5D,0xC3,0x3D,0xEF,0x41,0xF4,0xF0, +0xF7,0x58,0xE2,0x71,0xCC,0xE3,0x9D,0xA7,0x9B,0xA7,0xC2,0xF3,0x90,0xE7,0x2F,0x5E,0x76,0x5E,0x59, +0x5E,0xFB,0xBD,0x1E,0x4F,0xB3,0x9C,0x26,0x9E,0xD6,0x30,0x6D,0xC8,0xDB,0xC4,0x5B,0xE0,0xBD,0xCB, +0x7B,0x60,0x3A,0x3E,0x3D,0x65,0xFA,0xCE,0xE9,0x03,0x3E,0xC6,0x3E,0x02,0x9F,0x7A,0x9F,0x87,0xBE, +0xA6,0xBE,0x22,0xDF,0x3D,0xBE,0x23,0x7E,0xD6,0x7E,0x99,0x7E,0x07,0xFC,0x9E,0xFB,0x3B,0xFA,0xCB, +0xFD,0x8F,0xF8,0xBF,0xE1,0x79,0xF2,0x16,0xF1,0x4E,0x05,0x60,0x01,0xC1,0x01,0xE5,0x01,0xBD,0x81, +0x1A,0x81,0xB3,0x03,0x6B,0x03,0x1F,0x04,0x99,0x04,0xA5,0x07,0x35,0x05,0x8D,0x05,0xBB,0x06,0x2F, +0x0C,0x3E,0x15,0x42,0x0C,0x09,0x0D,0x59,0x1F,0x72,0x93,0x6F,0xC0,0x17,0xF2,0x1B,0xF9,0x63,0x33, +0xDC,0x67,0x2C,0x9A,0xD1,0x15,0xCA,0x08,0x9D,0x15,0x5A,0x1B,0xFA,0x30,0xCC,0x26,0x4C,0x1E,0xD6, +0x11,0x8E,0x86,0xCF,0x08,0xDF,0x10,0x7E,0x6F,0xA6,0xF9,0x4C,0xE9,0xCC,0xB6,0x08,0x88,0xE0,0x47, +0x6C,0x88,0xB8,0x1F,0x69,0x19,0x99,0x17,0xF9,0x7D,0x14,0x29,0x2A,0x32,0xAA,0x2E,0xEA,0x51,0xB4, +0x53,0x74,0x71,0x74,0xF7,0x2C,0xD6,0xAC,0xE4,0x59,0xFB,0x67,0xBD,0x8E,0xF1,0x8F,0xA9,0x8C,0xB9, +0x3B,0xDB,0x6A,0xB6,0x72,0x76,0x67,0xAC,0x6A,0x6C,0x52,0x6C,0x63,0xEC,0x9B,0xB8,0x80,0xB8,0xAA, +0xB8,0x81,0x78,0x87,0xF8,0x45,0xF1,0x97,0x12,0x74,0x13,0x24,0x09,0xED,0x89,0xE4,0xC4,0xD8,0xC4, +0x3D,0x89,0xE3,0x73,0x02,0xE7,0x6C,0x9A,0x33,0x9C,0xE4,0x9A,0x54,0x96,0x74,0x63,0xAE,0xE5,0xDC, +0xA2,0xB9,0x17,0xE6,0xE9,0xCE,0xCB,0x9E,0x77,0x3C,0x59,0x35,0x59,0x90,0x7C,0x38,0x85,0x98,0x12, +0x97,0xB2,0x3F,0xE5,0x83,0x20,0x42,0x50,0x2F,0x18,0x4F,0xE5,0xA7,0x6E,0x4D,0x1D,0x13,0xF2,0x84, +0x9B,0x85,0x4F,0x45,0xBE,0xA2,0x8D,0xA2,0x51,0xB1,0xB7,0xB8,0x4A,0x3C,0x92,0xE6,0x9D,0x56,0x95, +0xF6,0x38,0xDD,0x3B,0x7D,0x43,0xFA,0x68,0x86,0x4F,0x46,0x75,0xC6,0x33,0x09,0x4F,0x52,0x2B,0x79, +0x91,0x19,0x92,0xB9,0x23,0xF3,0x4D,0x56,0x44,0xD6,0xDE,0xAC,0xCF,0xD9,0x71,0xD9,0x2D,0x39,0x94, +0x9C,0x94,0x9C,0xA3,0x52,0x0D,0x69,0x96,0xB4,0x2B,0xD7,0x30,0xB7,0x28,0xB7,0x4F,0x66,0x2B,0x2B, +0x93,0x0D,0xE4,0x79,0xE6,0x6D,0xCA,0x1B,0x93,0x87,0xCA,0xF7,0xE4,0x23,0xF9,0x73,0xF3,0xDB,0x15, +0x6C,0x85,0x4C,0xD1,0xA3,0xB4,0x52,0xAE,0x50,0x0E,0x16,0x4C,0x2F,0xA8,0x2B,0x78,0x5B,0x18,0x5B, +0x78,0xB8,0x48,0xBD,0x48,0x5A,0xD4,0x33,0xDF,0x66,0xFE,0xEA,0xF9,0x23,0x0B,0x82,0x16,0x7C,0xBD, +0x90,0xB0,0x50,0xB8,0xB0,0xB3,0xD8,0xB8,0x78,0x59,0xF1,0xE0,0x22,0xBF,0x45,0xBB,0x16,0x23,0x8B, +0x53,0x17,0x77,0x2E,0x31,0x5D,0x52,0xBA,0x64,0x78,0x69,0xF0,0xD2,0x7D,0xCB,0x68,0xCB,0xB2,0x96, +0xFD,0x50,0xE2,0x58,0x52,0x55,0xF2,0x6A,0x79,0xDC,0xF2,0x8E,0x52,0x83,0xD2,0xA5,0xA5,0x43,0x2B, +0x82,0x57,0x34,0x95,0xA9,0x94,0xC9,0xCB,0x6E,0xAE,0xF4,0x5A,0xB9,0x63,0x15,0x61,0x95,0x64,0x55, +0xEF,0x6A,0x97,0xD5,0x5B,0x56,0x7F,0x2A,0x17,0x95,0x5F,0xAC,0x70,0xAC,0xA8,0xAE,0xF8,0xB0,0x46, +0xB8,0xE6,0xE2,0x57,0x4E,0x5F,0xD5,0x7C,0xF5,0x79,0x6D,0xDA,0xDA,0xDE,0x4A,0xB7,0xCA,0xED,0xEB, +0x48,0xEB,0xA4,0xEB,0x6E,0xAC,0xF7,0x59,0xBF,0xAF,0x4A,0xBD,0x6A,0x41,0xD5,0xD0,0x86,0xF0,0x0D, +0xAD,0x1B,0xF1,0x8D,0xE5,0x1B,0x5F,0x6D,0x4A,0xDE,0x74,0xA1,0x7A,0x6A,0xF5,0x8E,0xCD,0xB4,0xCD, +0xCA,0xCD,0x03,0x35,0x61,0x35,0xED,0x5B,0xCC,0xB6,0xAC,0xDB,0xF2,0xA1,0x36,0xA3,0xF6,0x7A,0x9D, +0x7F,0x5D,0xCB,0x56,0xFD,0xAD,0xAB,0xB7,0xBE,0xD9,0x26,0xDA,0xD6,0xBF,0xDD,0x77,0x7B,0xF3,0x0E, +0x83,0x1D,0x15,0x3B,0xDE,0xEF,0x94,0xEC,0xBC,0xB5,0x2B,0x78,0x57,0x6B,0xBD,0x45,0x7D,0xF5,0x6E, +0xD2,0xEE,0x82,0xDD,0x8F,0x1A,0x62,0x1B,0xBA,0xBF,0xE6,0x7E,0xDD,0xB8,0x47,0x77,0x4F,0xC5,0x9E, +0x8F,0x7B,0xA5,0x7B,0x07,0xF6,0x45,0xEF,0xEB,0x6A,0x74,0x6F,0x6C,0xDC,0xAF,0xBF,0xBF,0xB2,0x09, +0x6D,0x52,0x36,0x8D,0x1E,0x48,0x3A,0x70,0xE5,0x9B,0x80,0x6F,0xDA,0x9B,0xED,0x9A,0x77,0xB5,0x70, +0x5A,0x2A,0x0E,0xC2,0x41,0xE5,0xC1,0x27,0xDF,0xA6,0x7C,0x7B,0xE3,0x50,0xE8,0xA1,0xCE,0xC3,0xDC, +0xC3,0xCD,0xDF,0x99,0x7F,0xB7,0xF5,0x08,0xEB,0x48,0x79,0x2B,0xD2,0x3A,0xBF,0x75,0xAC,0x2D,0xA3, +0x6D,0xA0,0x3D,0xA1,0xBD,0xEF,0xE8,0x8C,0xA3,0x9D,0x1D,0x5E,0x1D,0x47,0xBE,0xB7,0xFF,0x7E,0xEF, +0x31,0xE3,0x63,0x75,0xC7,0x35,0x8F,0x57,0x9E,0xA0,0x9D,0x28,0x3D,0xF1,0xF9,0xE4,0x82,0x93,0xE3, +0xA7,0x64,0xA7,0x9E,0x9D,0x4E,0x3F,0x3D,0xD4,0x99,0xDC,0x79,0xF7,0x4C,0xFC,0x99,0x6B,0x5D,0x51, +0x5D,0xBD,0x67,0x43,0xCF,0x9E,0x3F,0x17,0x74,0xEE,0x4C,0xB7,0x5F,0xF7,0xC9,0xF3,0xDE,0xE7,0x8F, +0x5D,0xF0,0xBC,0x70,0xF4,0x22,0xF7,0x62,0xDB,0x25,0xB7,0x4B,0xAD,0x3D,0xAE,0x3D,0x47,0x7E,0x70, +0xFD,0xE1,0x48,0xAF,0x5B,0x6F,0xEB,0x65,0xF7,0xCB,0xED,0x57,0x3C,0xAE,0x74,0xF4,0x4D,0xEB,0x3B, +0xD1,0xEF,0xD3,0x7F,0xFA,0x6A,0xC0,0xD5,0x73,0xD7,0xF8,0xD7,0x2E,0x5D,0x9F,0x79,0xBD,0xEF,0xC6, +0xEC,0x1B,0xB7,0x6E,0x26,0xDD,0x1C,0xB8,0x25,0xBA,0xF5,0xF8,0x76,0xF6,0xED,0x17,0x77,0x0A,0xEE, +0x4C,0xDC,0x5D,0x7A,0x8F,0x78,0xAF,0xFC,0xBE,0xDA,0xFD,0xEA,0x07,0xFA,0x0F,0xEA,0x7F,0xB4,0xFE, +0xB1,0x65,0xC0,0x6D,0xE0,0xF8,0x60,0xC0,0x60,0xCF,0xC3,0x59,0x0F,0xEF,0x0E,0x09,0x87,0x9E,0xFE, +0x94,0xFF,0xD3,0x87,0xE1,0xD2,0x47,0xCC,0x47,0xD5,0x23,0x46,0x23,0x8D,0x8F,0x9D,0x1F,0x1F,0x1B, +0x0D,0x1A,0xBD,0xF2,0x64,0xCE,0x93,0xE1,0xA7,0xB2,0xA7,0x13,0xCF,0xCA,0x7E,0x56,0xFF,0x79,0xEB, +0x73,0xAB,0xE7,0xDF,0xFD,0xE2,0xFB,0x4B,0xCF,0x58,0xFC,0xD8,0xF0,0x0B,0xF9,0x8B,0xCF,0xBF,0xAE, +0x79,0xA9,0xF3,0x72,0xEF,0xAB,0xA9,0xAF,0x3A,0xC7,0x23,0xC7,0x1F,0xBC,0xCE,0x79,0x3D,0xF1,0xA6, +0xFC,0xAD,0xCE,0xDB,0x7D,0xEF,0xB8,0xEF,0xBA,0xDF,0xC7,0xBD,0x1F,0x99,0x28,0xFC,0x40,0xFE,0x50, +0xF3,0xD1,0xFA,0x63,0xC7,0xA7,0xD0,0x4F,0xF7,0x3E,0xE7,0x7C,0xFE,0xFC,0x2F,0xF7,0x84,0xF3,0xFB, +0x25,0xD2,0x9F,0x33,0x00,0x00,0x00,0x20,0x63,0x48,0x52,0x4D,0x00,0x00,0x7A,0x25,0x00,0x00,0x80, +0x83,0x00,0x00,0xF9,0xFF,0x00,0x00,0x80,0xE9,0x00,0x00,0x75,0x30,0x00,0x00,0xEA,0x60,0x00,0x00, +0x3A,0x98,0x00,0x00,0x17,0x6F,0x92,0x5F,0xC5,0x46,0x00,0x00,0x03,0x40,0x49,0x44,0x41,0x54,0x78, +0xDA,0xEC,0x5A,0xED,0x71,0xE2,0x40,0x0C,0x7D,0x64,0xEE,0x3F,0x7B,0x15,0x9C,0xAF,0x82,0x38,0x15, +0x9C,0xA9,0xE0,0xA0,0x82,0x90,0x0A,0xC2,0x55,0x00,0x54,0xC0,0xA5,0x02,0xE8,0xC0,0x50,0x81,0x49, +0x05,0x71,0x07,0xB8,0x03,0x7C,0x15,0xE8,0xFE,0x68,0x27,0x42,0xD1,0x62,0xC2,0x67,0x48,0xF6,0xCD, +0x78,0x6C,0xCB,0xFB,0xA1,0x5D,0xAD,0xA4,0xB7,0x0B,0x2D,0x22,0x42,0xC4,0xE5,0x70,0x13,0xA7,0x20, +0x1A,0x20,0x1A,0x20,0x22,0x1A,0x20,0x1A,0x20,0xE2,0x32,0xF8,0xC6,0x77,0x07,0x20,0xE5,0xE7,0x8A, +0xAF,0x6B,0x80,0xD7,0x3B,0x05,0x50,0x03,0x98,0x5D,0xAB,0x07,0xA4,0x00,0x0A,0xBE,0xEE,0xAF,0x48, +0x7F,0xAF,0xF7,0x44,0xE9,0xDD,0x07,0x30,0x60,0x03,0x5D,0x85,0x07,0x7C,0x26,0xF4,0x01,0x4C,0xF9, +0xF9,0x16,0xC0,0x43,0xCC,0x01,0xE7,0x0F,0x4B,0xD6,0x73,0xF4,0x80,0x33,0xE1,0x2F,0xDF,0xDB,0x00, +0x9E,0xBE,0x8A,0x01,0x64,0x12,0x5F,0x9E,0xA0,0xBC,0x47,0xC6,0xF7,0x92,0x93,0xAE,0x44,0x69,0x18, +0x61,0x57,0x3D,0x6A,0x55,0x7F,0x17,0x7D,0x53,0x96,0x2F,0x0F,0x9A,0x39,0x22,0x02,0x11,0x65,0xF4, +0x8A,0x21,0xCB,0x76,0xB9,0x52,0x22,0x2A,0xE8,0x2D,0xA6,0x44,0xE4,0x8C,0xF2,0x09,0x11,0xE5,0xAA, +0xEC,0x9A,0x88,0x06,0xFC,0x7D,0x25,0xEA,0xFB,0x3A,0x8E,0x88,0x26,0x46,0x1F,0xC3,0x80,0xDE,0x21, +0x59,0xC1,0x7D,0x65,0xDC,0xE6,0x54,0xB5,0xB7,0xE2,0xF1,0x40,0xF5,0x3D,0x35,0xF4,0xED,0xAA,0x71, +0x67,0xEF,0x98,0xB3,0x8D,0xEB,0x10,0x0F,0xF0,0x0C,0xC4,0x05,0x12,0x61,0x0A,0xA0,0x23,0x56,0x6A, +0x02,0xE0,0xC5,0x28,0xEF,0x98,0xC5,0xB4,0xB9,0x0C,0x14,0x0D,0x2E,0xC4,0xEA,0x93,0x18,0x35,0xAC, +0x5A,0xDD,0x87,0xF7,0x9E,0x47,0x7E,0xD6,0x7A,0x24,0x00,0x72,0x00,0x3F,0x85,0x2C,0x17,0xF5,0x64, +0x5B,0xF9,0xB1,0xA8,0xFA,0xCD,0x01,0x21,0x27,0xE7,0x7B,0xCD,0x4C,0xA3,0x05,0xE0,0x3B,0x4F,0x8C, +0x37,0xD0,0x54,0xD4,0x99,0x8A,0x41,0xCF,0x79,0xA0,0x2D,0x36,0x52,0x29,0xEA,0x49,0x0C,0xC5,0xE4, +0x97,0x5C,0xB6,0xC5,0x75,0xE7,0x01,0xC3,0x58,0x90,0xE1,0xAA,0xCB,0xEF,0x1D,0xD1,0xBF,0x5C,0x24, +0xA9,0x58,0x44,0x32,0xE4,0xDD,0x71,0xF9,0x3B,0x7E,0x4F,0x8E,0x12,0xBC,0xF7,0x0C,0x41,0x7D,0x51, +0xBE,0x6B,0x7C,0x97,0x21,0x23,0xE1,0x4B,0xBA,0xBA,0x15,0x9A,0xD6,0x86,0x4B,0xAF,0x55,0x3B,0xBA, +0xDE,0x6A,0xC7,0x10,0x04,0xD5,0xBF,0xDB,0xA2,0xAF,0xEF,0xBB,0xD8,0xD2,0x77,0xA2,0xC2,0xD2,0xDE, +0x21,0x68,0x5F,0x0F,0xF8,0x2D,0x42,0xC5,0xDC,0xF8,0xFE,0xA4,0x56,0x5C,0x57,0xBC,0x8F,0x8D,0xF2, +0x56,0x3B,0xA9,0xF0,0x98,0x59,0xC0,0xE5,0xC7,0x7B,0xE8,0x5E,0x19,0x09,0xBC,0x6E,0x48,0xF8,0x95, +0xD1,0x46,0xA9,0xDE,0xCF,0xCA,0x82,0x5C,0x43,0xC7,0x52,0xDE,0xDE,0xF2,0x6D,0x9B,0xDC,0xED,0x51, +0xE7,0x14,0xA8,0x77,0x90,0x57,0xE7,0xCE,0x01,0x4D,0x1B,0x1D,0xF7,0x01,0xEA,0x1C,0x8A,0x4A,0x78, +0x82,0xDB,0x92,0xD4,0x2F,0x92,0x84,0x17,0x22,0x4C,0x58,0x8A,0x3C,0xAA,0xB2,0xCF,0x81,0x6F,0x72, +0x40,0x7D,0x25,0x5B,0x2A,0x56,0x65,0x4D,0xF6,0x29,0xCF,0xAD,0x64,0x48,0x9C,0x88,0xFE,0x3D,0x6B, +0x3B,0xFB,0x51,0x84,0xB7,0x7A,0xC2,0x31,0xB9,0x16,0xCA,0x25,0x2A,0x76,0x0E,0xC4,0x24,0x96,0x7C, +0xAF,0x8C,0xEF,0x72,0x40,0x72,0x82,0x7F,0x89,0xD8,0xAF,0x59,0x97,0xC7,0x40,0xE5,0x96,0x63,0x63, +0x2C,0xC6,0xD8,0x07,0xB0,0x62,0x4A,0xBC,0x32,0x16,0x8B,0x64,0x7A,0x64,0xB0,0x3F,0x2D,0xDB,0xCA, +0x82,0x9A,0x30,0x34,0x98,0x10,0x31,0x6B,0x78,0x51,0x1B,0x96,0x54,0x6D,0xDA,0xF4,0xC6,0xA7,0x10, +0x4C,0x67,0x6D,0xF4,0xE1,0x94,0x7C,0xCD,0x75,0x56,0xA2,0x0D,0x52,0x9B,0xB7,0x26,0x16,0x54,0x18, +0x6C,0x64,0x18,0x60,0x34,0xA9,0xEA,0xC3,0x23,0x57,0x63,0xB5,0xE6,0x30,0x0B,0xC8,0x0E,0x66,0x41, +0xFF,0xC4,0xEA,0x7C,0x10,0xAB,0x24,0xC3,0xE6,0x6F,0x0A,0x1D,0xC5,0x14,0x4A,0x83,0x73,0xFB,0xF8, +0x3A,0x02,0xD0,0x0B,0x24,0x3A,0xD9,0x8E,0xF6,0xC2,0x3F,0x6A,0x23,0x75,0x6C,0x94,0xBC,0xE7,0xE8, +0xB1,0x8E,0x23,0xDE,0x07,0xF4,0x8C,0x5C,0x21,0xD9,0x55,0x8D,0xD7,0xDF,0x55,0xB4,0x6C,0x03,0x2D, +0xFE,0x5B,0x8A,0xDB,0x71,0x53,0x93,0x70,0x6C,0xAC,0x8D,0xD0,0x74,0xCB,0xEF,0xCF,0x0D,0xE7,0x23, +0x8E,0x43,0xC7,0x0F,0x36,0xE6,0x5C,0x85,0xA7,0x2A,0xC0,0x2A,0xBA,0xA2,0x8F,0x85,0x30,0x4A,0x26, +0x06,0x58,0x22,0xFC,0xE3,0x92,0x2E,0xA7,0xC7,0x95,0x18,0xE7,0x4C,0x43,0x96,0x2F,0x78,0x4C,0x35, +0xBF,0xDF,0x8B,0x8D,0xE3,0x4C,0x1C,0x79,0xA7,0x4C,0xD1,0xA5,0x7E,0x96,0xEC,0x8D,0x01,0x22,0x6C, +0xE4,0x0D,0x79,0xA6,0x66,0x8F,0xB8,0x18,0x0D,0xFD,0xEC,0x18,0x07,0x36,0x9A,0x9E,0x60,0x74,0x0E, +0xDD,0x8B,0x44,0x0F,0x78,0xFF,0x51,0x78,0xE8,0x38,0x3C,0x1A,0xE0,0x1A,0x11,0x43,0x50,0x34,0x40, +0x34,0x40,0x44,0x34,0xC0,0xD7,0xC5,0xFF,0x01,0x00,0xCC,0x01,0x97,0x8B,0x00,0x58,0xE9,0x5F,0x00, +0x00,0x00,0x00,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82}; +unsigned char LoadCircle[]= +{0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D,0x49,0x48,0x44,0x52,0x00,0x00,0x00,0x30, +0x00,0x00,0x00,0x2E,0x08,0x06,0x00,0x00,0x00,0x6E,0xDE,0x9A,0x6C,0x00,0x00,0x00,0x09,0x70,0x48, +0x59,0x73,0x00,0x00,0x0B,0x13,0x00,0x00,0x0B,0x13,0x01,0x00,0x9A,0x9C,0x18,0x00,0x00,0x0A,0x4D, +0x69,0x43,0x43,0x50,0x50,0x68,0x6F,0x74,0x6F,0x73,0x68,0x6F,0x70,0x20,0x49,0x43,0x43,0x20,0x70, +0x72,0x6F,0x66,0x69,0x6C,0x65,0x00,0x00,0x78,0xDA,0x9D,0x53,0x77,0x58,0x93,0xF7,0x16,0x3E,0xDF, +0xF7,0x65,0x0F,0x56,0x42,0xD8,0xF0,0xB1,0x97,0x6C,0x81,0x00,0x22,0x23,0xAC,0x08,0xC8,0x10,0x59, +0xA2,0x10,0x92,0x00,0x61,0x84,0x10,0x12,0x40,0xC5,0x85,0x88,0x0A,0x56,0x14,0x15,0x11,0x9C,0x48, +0x55,0xC4,0x82,0xD5,0x0A,0x48,0x9D,0x88,0xE2,0xA0,0x28,0xB8,0x67,0x41,0x8A,0x88,0x5A,0x8B,0x55, +0x5C,0x38,0xEE,0x1F,0xDC,0xA7,0xB5,0x7D,0x7A,0xEF,0xED,0xED,0xFB,0xD7,0xFB,0xBC,0xE7,0x9C,0xE7, +0xFC,0xCE,0x79,0xCF,0x0F,0x80,0x11,0x12,0x26,0x91,0xE6,0xA2,0x6A,0x00,0x39,0x52,0x85,0x3C,0x3A, +0xD8,0x1F,0x8F,0x4F,0x48,0xC4,0xC9,0xBD,0x80,0x02,0x15,0x48,0xE0,0x04,0x20,0x10,0xE6,0xCB,0xC2, +0x67,0x05,0xC5,0x00,0x00,0xF0,0x03,0x79,0x78,0x7E,0x74,0xB0,0x3F,0xFC,0x01,0xAF,0x6F,0x00,0x02, +0x00,0x70,0xD5,0x2E,0x24,0x12,0xC7,0xE1,0xFF,0x83,0xBA,0x50,0x26,0x57,0x00,0x20,0x91,0x00,0xE0, +0x22,0x12,0xE7,0x0B,0x01,0x90,0x52,0x00,0xC8,0x2E,0x54,0xC8,0x14,0x00,0xC8,0x18,0x00,0xB0,0x53, +0xB3,0x64,0x0A,0x00,0x94,0x00,0x00,0x6C,0x79,0x7C,0x42,0x22,0x00,0xAA,0x0D,0x00,0xEC,0xF4,0x49, +0x3E,0x05,0x00,0xD8,0xA9,0x93,0xDC,0x17,0x00,0xD8,0xA2,0x1C,0xA9,0x08,0x00,0x8D,0x01,0x00,0x99, +0x28,0x47,0x24,0x02,0x40,0xBB,0x00,0x60,0x55,0x81,0x52,0x2C,0x02,0xC0,0xC2,0x00,0xA0,0xAC,0x40, +0x22,0x2E,0x04,0xC0,0xAE,0x01,0x80,0x59,0xB6,0x32,0x47,0x02,0x80,0xBD,0x05,0x00,0x76,0x8E,0x58, +0x90,0x0F,0x40,0x60,0x00,0x80,0x99,0x42,0x2C,0xCC,0x00,0x20,0x38,0x02,0x00,0x43,0x1E,0x13,0xCD, +0x03,0x20,0x4C,0x03,0xA0,0x30,0xD2,0xBF,0xE0,0xA9,0x5F,0x70,0x85,0xB8,0x48,0x01,0x00,0xC0,0xCB, +0x95,0xCD,0x97,0x4B,0xD2,0x33,0x14,0xB8,0x95,0xD0,0x1A,0x77,0xF2,0xF0,0xE0,0xE2,0x21,0xE2,0xC2, +0x6C,0xB1,0x42,0x61,0x17,0x29,0x10,0x66,0x09,0xE4,0x22,0x9C,0x97,0x9B,0x23,0x13,0x48,0xE7,0x03, +0x4C,0xCE,0x0C,0x00,0x00,0x1A,0xF9,0xD1,0xC1,0xFE,0x38,0x3F,0x90,0xE7,0xE6,0xE4,0xE1,0xE6,0x66, +0xE7,0x6C,0xEF,0xF4,0xC5,0xA2,0xFE,0x6B,0xF0,0x6F,0x22,0x3E,0x21,0xF1,0xDF,0xFE,0xBC,0x8C,0x02, +0x04,0x00,0x10,0x4E,0xCF,0xEF,0xDA,0x5F,0xE5,0xE5,0xD6,0x03,0x70,0xC7,0x01,0xB0,0x75,0xBF,0x6B, +0xA9,0x5B,0x00,0xDA,0x56,0x00,0x68,0xDF,0xF9,0x5D,0x33,0xDB,0x09,0xA0,0x5A,0x0A,0xD0,0x7A,0xF9, +0x8B,0x79,0x38,0xFC,0x40,0x1E,0x9E,0xA1,0x50,0xC8,0x3C,0x1D,0x1C,0x0A,0x0B,0x0B,0xED,0x25,0x62, +0xA1,0xBD,0x30,0xE3,0x8B,0x3E,0xFF,0x33,0xE1,0x6F,0xE0,0x8B,0x7E,0xF6,0xFC,0x40,0x1E,0xFE,0xDB, +0x7A,0xF0,0x00,0x71,0x9A,0x40,0x99,0xAD,0xC0,0xA3,0x83,0xFD,0x71,0x61,0x6E,0x76,0xAE,0x52,0x8E, +0xE7,0xCB,0x04,0x42,0x31,0x6E,0xF7,0xE7,0x23,0xFE,0xC7,0x85,0x7F,0xFD,0x8E,0x29,0xD1,0xE2,0x34, +0xB1,0x5C,0x2C,0x15,0x8A,0xF1,0x58,0x89,0xB8,0x50,0x22,0x4D,0xC7,0x79,0xB9,0x52,0x91,0x44,0x21, +0xC9,0x95,0xE2,0x12,0xE9,0x7F,0x32,0xF1,0x1F,0x96,0xFD,0x09,0x93,0x77,0x0D,0x00,0xAC,0x86,0x4F, +0xC0,0x4E,0xB6,0x07,0xB5,0xCB,0x6C,0xC0,0x7E,0xEE,0x01,0x02,0x8B,0x0E,0x58,0xD2,0x76,0x00,0x40, +0x7E,0xF3,0x2D,0x8C,0x1A,0x0B,0x91,0x00,0x10,0x67,0x34,0x32,0x79,0xF7,0x00,0x00,0x93,0xBF,0xF9, +0x8F,0x40,0x2B,0x01,0x00,0xCD,0x97,0xA4,0xE3,0x00,0x00,0xBC,0xE8,0x18,0x5C,0xA8,0x94,0x17,0x4C, +0xC6,0x08,0x00,0x00,0x44,0xA0,0x81,0x2A,0xB0,0x41,0x07,0x0C,0xC1,0x14,0xAC,0xC0,0x0E,0x9C,0xC1, +0x1D,0xBC,0xC0,0x17,0x02,0x61,0x06,0x44,0x40,0x0C,0x24,0xC0,0x3C,0x10,0x42,0x06,0xE4,0x80,0x1C, +0x0A,0xA1,0x18,0x96,0x41,0x19,0x54,0xC0,0x3A,0xD8,0x04,0xB5,0xB0,0x03,0x1A,0xA0,0x11,0x9A,0xE1, +0x10,0xB4,0xC1,0x31,0x38,0x0D,0xE7,0xE0,0x12,0x5C,0x81,0xEB,0x70,0x17,0x06,0x60,0x18,0x9E,0xC2, +0x18,0xBC,0x86,0x09,0x04,0x41,0xC8,0x08,0x13,0x61,0x21,0x3A,0x88,0x11,0x62,0x8E,0xD8,0x22,0xCE, +0x08,0x17,0x99,0x8E,0x04,0x22,0x61,0x48,0x34,0x92,0x80,0xA4,0x20,0xE9,0x88,0x14,0x51,0x22,0xC5, +0xC8,0x72,0xA4,0x02,0xA9,0x42,0x6A,0x91,0x5D,0x48,0x23,0xF2,0x2D,0x72,0x14,0x39,0x8D,0x5C,0x40, +0xFA,0x90,0xDB,0xC8,0x20,0x32,0x8A,0xFC,0x8A,0xBC,0x47,0x31,0x94,0x81,0xB2,0x51,0x03,0xD4,0x02, +0x75,0x40,0xB9,0xA8,0x1F,0x1A,0x8A,0xC6,0xA0,0x73,0xD1,0x74,0x34,0x0F,0x5D,0x80,0x96,0xA2,0x6B, +0xD1,0x1A,0xB4,0x1E,0x3D,0x80,0xB6,0xA2,0xA7,0xD1,0x4B,0xE8,0x75,0x74,0x00,0x7D,0x8A,0x8E,0x63, +0x80,0xD1,0x31,0x0E,0x66,0x8C,0xD9,0x61,0x5C,0x8C,0x87,0x45,0x60,0x89,0x58,0x1A,0x26,0xC7,0x16, +0x63,0xE5,0x58,0x35,0x56,0x8F,0x35,0x63,0x1D,0x58,0x37,0x76,0x15,0x1B,0xC0,0x9E,0x61,0xEF,0x08, +0x24,0x02,0x8B,0x80,0x13,0xEC,0x08,0x5E,0x84,0x10,0xC2,0x6C,0x82,0x90,0x90,0x47,0x58,0x4C,0x58, +0x43,0xA8,0x25,0xEC,0x23,0xB4,0x12,0xBA,0x08,0x57,0x09,0x83,0x84,0x31,0xC2,0x27,0x22,0x93,0xA8, +0x4F,0xB4,0x25,0x7A,0x12,0xF9,0xC4,0x78,0x62,0x3A,0xB1,0x90,0x58,0x46,0xAC,0x26,0xEE,0x21,0x1E, +0x21,0x9E,0x25,0x5E,0x27,0x0E,0x13,0x5F,0x93,0x48,0x24,0x0E,0xC9,0x92,0xE4,0x4E,0x0A,0x21,0x25, +0x90,0x32,0x49,0x0B,0x49,0x6B,0x48,0xDB,0x48,0x2D,0xA4,0x53,0xA4,0x3E,0xD2,0x10,0x69,0x9C,0x4C, +0x26,0xEB,0x90,0x6D,0xC9,0xDE,0xE4,0x08,0xB2,0x80,0xAC,0x20,0x97,0x91,0xB7,0x90,0x0F,0x90,0x4F, +0x92,0xFB,0xC9,0xC3,0xE4,0xB7,0x14,0x3A,0xC5,0x88,0xE2,0x4C,0x09,0xA2,0x24,0x52,0xA4,0x94,0x12, +0x4A,0x35,0x65,0x3F,0xE5,0x04,0xA5,0x9F,0x32,0x42,0x99,0xA0,0xAA,0x51,0xCD,0xA9,0x9E,0xD4,0x08, +0xAA,0x88,0x3A,0x9F,0x5A,0x49,0x6D,0xA0,0x76,0x50,0x2F,0x53,0x87,0xA9,0x13,0x34,0x75,0x9A,0x25, +0xCD,0x9B,0x16,0x43,0xCB,0xA4,0x2D,0xA3,0xD5,0xD0,0x9A,0x69,0x67,0x69,0xF7,0x68,0x2F,0xE9,0x74, +0xBA,0x09,0xDD,0x83,0x1E,0x45,0x97,0xD0,0x97,0xD2,0x6B,0xE8,0x07,0xE9,0xE7,0xE9,0x83,0xF4,0x77, +0x0C,0x0D,0x86,0x0D,0x83,0xC7,0x48,0x62,0x28,0x19,0x6B,0x19,0x7B,0x19,0xA7,0x18,0xB7,0x19,0x2F, +0x99,0x4C,0xA6,0x05,0xD3,0x97,0x99,0xC8,0x54,0x30,0xD7,0x32,0x1B,0x99,0x67,0x98,0x0F,0x98,0x6F, +0x55,0x58,0x2A,0xF6,0x2A,0x7C,0x15,0x91,0xCA,0x12,0x95,0x3A,0x95,0x56,0x95,0x7E,0x95,0xE7,0xAA, +0x54,0x55,0x73,0x55,0x3F,0xD5,0x79,0xAA,0x0B,0x54,0xAB,0x55,0x0F,0xAB,0x5E,0x56,0x7D,0xA6,0x46, +0x55,0xB3,0x50,0xE3,0xA9,0x09,0xD4,0x16,0xAB,0xD5,0xA9,0x1D,0x55,0xBB,0xA9,0x36,0xAE,0xCE,0x52, +0x77,0x52,0x8F,0x50,0xCF,0x51,0x5F,0xA3,0xBE,0x5F,0xFD,0x82,0xFA,0x63,0x0D,0xB2,0x86,0x85,0x46, +0xA0,0x86,0x48,0xA3,0x54,0x63,0xB7,0xC6,0x19,0x8D,0x21,0x16,0xC6,0x32,0x65,0xF1,0x58,0x42,0xD6, +0x72,0x56,0x03,0xEB,0x2C,0x6B,0x98,0x4D,0x62,0x5B,0xB2,0xF9,0xEC,0x4C,0x76,0x05,0xFB,0x1B,0x76, +0x2F,0x7B,0x4C,0x53,0x43,0x73,0xAA,0x66,0xAC,0x66,0x91,0x66,0x9D,0xE6,0x71,0xCD,0x01,0x0E,0xC6, +0xB1,0xE0,0xF0,0x39,0xD9,0x9C,0x4A,0xCE,0x21,0xCE,0x0D,0xCE,0x7B,0x2D,0x03,0x2D,0x3F,0x2D,0xB1, +0xD6,0x6A,0xAD,0x66,0xAD,0x7E,0xAD,0x37,0xDA,0x7A,0xDA,0xBE,0xDA,0x62,0xED,0x72,0xED,0x16,0xED, +0xEB,0xDA,0xEF,0x75,0x70,0x9D,0x40,0x9D,0x2C,0x9D,0xF5,0x3A,0x6D,0x3A,0xF7,0x75,0x09,0xBA,0x36, +0xBA,0x51,0xBA,0x85,0xBA,0xDB,0x75,0xCF,0xEA,0x3E,0xD3,0x63,0xEB,0x79,0xE9,0x09,0xF5,0xCA,0xF5, +0x0E,0xE9,0xDD,0xD1,0x47,0xF5,0x6D,0xF4,0xA3,0xF5,0x17,0xEA,0xEF,0xD6,0xEF,0xD1,0x1F,0x37,0x30, +0x34,0x08,0x36,0x90,0x19,0x6C,0x31,0x38,0x63,0xF0,0xCC,0x90,0x63,0xE8,0x6B,0x98,0x69,0xB8,0xD1, +0xF0,0x84,0xE1,0xA8,0x11,0xCB,0x68,0xBA,0x91,0xC4,0x68,0xA3,0xD1,0x49,0xA3,0x27,0xB8,0x26,0xEE, +0x87,0x67,0xE3,0x35,0x78,0x17,0x3E,0x66,0xAC,0x6F,0x1C,0x62,0xAC,0x34,0xDE,0x65,0xDC,0x6B,0x3C, +0x61,0x62,0x69,0x32,0xDB,0xA4,0xC4,0xA4,0xC5,0xE4,0xBE,0x29,0xCD,0x94,0x6B,0x9A,0x66,0xBA,0xD1, +0xB4,0xD3,0x74,0xCC,0xCC,0xC8,0x2C,0xDC,0xAC,0xD8,0xAC,0xC9,0xEC,0x8E,0x39,0xD5,0x9C,0x6B,0x9E, +0x61,0xBE,0xD9,0xBC,0xDB,0xFC,0x8D,0x85,0xA5,0x45,0x9C,0xC5,0x4A,0x8B,0x36,0x8B,0xC7,0x96,0xDA, +0x96,0x7C,0xCB,0x05,0x96,0x4D,0x96,0xF7,0xAC,0x98,0x56,0x3E,0x56,0x79,0x56,0xF5,0x56,0xD7,0xAC, +0x49,0xD6,0x5C,0xEB,0x2C,0xEB,0x6D,0xD6,0x57,0x6C,0x50,0x1B,0x57,0x9B,0x0C,0x9B,0x3A,0x9B,0xCB, +0xB6,0xA8,0xAD,0x9B,0xAD,0xC4,0x76,0x9B,0x6D,0xDF,0x14,0xE2,0x14,0x8F,0x29,0xD2,0x29,0xF5,0x53, +0x6E,0xDA,0x31,0xEC,0xFC,0xEC,0x0A,0xEC,0x9A,0xEC,0x06,0xED,0x39,0xF6,0x61,0xF6,0x25,0xF6,0x6D, +0xF6,0xCF,0x1D,0xCC,0x1C,0x12,0x1D,0xD6,0x3B,0x74,0x3B,0x7C,0x72,0x74,0x75,0xCC,0x76,0x6C,0x70, +0xBC,0xEB,0xA4,0xE1,0x34,0xC3,0xA9,0xC4,0xA9,0xC3,0xE9,0x57,0x67,0x1B,0x67,0xA1,0x73,0x9D,0xF3, +0x35,0x17,0xA6,0x4B,0x90,0xCB,0x12,0x97,0x76,0x97,0x17,0x53,0x6D,0xA7,0x8A,0xA7,0x6E,0x9F,0x7A, +0xCB,0x95,0xE5,0x1A,0xEE,0xBA,0xD2,0xB5,0xD3,0xF5,0xA3,0x9B,0xBB,0x9B,0xDC,0xAD,0xD9,0x6D,0xD4, +0xDD,0xCC,0x3D,0xC5,0x7D,0xAB,0xFB,0x4D,0x2E,0x9B,0x1B,0xC9,0x5D,0xC3,0x3D,0xEF,0x41,0xF4,0xF0, +0xF7,0x58,0xE2,0x71,0xCC,0xE3,0x9D,0xA7,0x9B,0xA7,0xC2,0xF3,0x90,0xE7,0x2F,0x5E,0x76,0x5E,0x59, +0x5E,0xFB,0xBD,0x1E,0x4F,0xB3,0x9C,0x26,0x9E,0xD6,0x30,0x6D,0xC8,0xDB,0xC4,0x5B,0xE0,0xBD,0xCB, +0x7B,0x60,0x3A,0x3E,0x3D,0x65,0xFA,0xCE,0xE9,0x03,0x3E,0xC6,0x3E,0x02,0x9F,0x7A,0x9F,0x87,0xBE, +0xA6,0xBE,0x22,0xDF,0x3D,0xBE,0x23,0x7E,0xD6,0x7E,0x99,0x7E,0x07,0xFC,0x9E,0xFB,0x3B,0xFA,0xCB, +0xFD,0x8F,0xF8,0xBF,0xE1,0x79,0xF2,0x16,0xF1,0x4E,0x05,0x60,0x01,0xC1,0x01,0xE5,0x01,0xBD,0x81, +0x1A,0x81,0xB3,0x03,0x6B,0x03,0x1F,0x04,0x99,0x04,0xA5,0x07,0x35,0x05,0x8D,0x05,0xBB,0x06,0x2F, +0x0C,0x3E,0x15,0x42,0x0C,0x09,0x0D,0x59,0x1F,0x72,0x93,0x6F,0xC0,0x17,0xF2,0x1B,0xF9,0x63,0x33, +0xDC,0x67,0x2C,0x9A,0xD1,0x15,0xCA,0x08,0x9D,0x15,0x5A,0x1B,0xFA,0x30,0xCC,0x26,0x4C,0x1E,0xD6, +0x11,0x8E,0x86,0xCF,0x08,0xDF,0x10,0x7E,0x6F,0xA6,0xF9,0x4C,0xE9,0xCC,0xB6,0x08,0x88,0xE0,0x47, +0x6C,0x88,0xB8,0x1F,0x69,0x19,0x99,0x17,0xF9,0x7D,0x14,0x29,0x2A,0x32,0xAA,0x2E,0xEA,0x51,0xB4, +0x53,0x74,0x71,0x74,0xF7,0x2C,0xD6,0xAC,0xE4,0x59,0xFB,0x67,0xBD,0x8E,0xF1,0x8F,0xA9,0x8C,0xB9, +0x3B,0xDB,0x6A,0xB6,0x72,0x76,0x67,0xAC,0x6A,0x6C,0x52,0x6C,0x63,0xEC,0x9B,0xB8,0x80,0xB8,0xAA, +0xB8,0x81,0x78,0x87,0xF8,0x45,0xF1,0x97,0x12,0x74,0x13,0x24,0x09,0xED,0x89,0xE4,0xC4,0xD8,0xC4, +0x3D,0x89,0xE3,0x73,0x02,0xE7,0x6C,0x9A,0x33,0x9C,0xE4,0x9A,0x54,0x96,0x74,0x63,0xAE,0xE5,0xDC, +0xA2,0xB9,0x17,0xE6,0xE9,0xCE,0xCB,0x9E,0x77,0x3C,0x59,0x35,0x59,0x90,0x7C,0x38,0x85,0x98,0x12, +0x97,0xB2,0x3F,0xE5,0x83,0x20,0x42,0x50,0x2F,0x18,0x4F,0xE5,0xA7,0x6E,0x4D,0x1D,0x13,0xF2,0x84, +0x9B,0x85,0x4F,0x45,0xBE,0xA2,0x8D,0xA2,0x51,0xB1,0xB7,0xB8,0x4A,0x3C,0x92,0xE6,0x9D,0x56,0x95, +0xF6,0x38,0xDD,0x3B,0x7D,0x43,0xFA,0x68,0x86,0x4F,0x46,0x75,0xC6,0x33,0x09,0x4F,0x52,0x2B,0x79, +0x91,0x19,0x92,0xB9,0x23,0xF3,0x4D,0x56,0x44,0xD6,0xDE,0xAC,0xCF,0xD9,0x71,0xD9,0x2D,0x39,0x94, +0x9C,0x94,0x9C,0xA3,0x52,0x0D,0x69,0x96,0xB4,0x2B,0xD7,0x30,0xB7,0x28,0xB7,0x4F,0x66,0x2B,0x2B, +0x93,0x0D,0xE4,0x79,0xE6,0x6D,0xCA,0x1B,0x93,0x87,0xCA,0xF7,0xE4,0x23,0xF9,0x73,0xF3,0xDB,0x15, +0x6C,0x85,0x4C,0xD1,0xA3,0xB4,0x52,0xAE,0x50,0x0E,0x16,0x4C,0x2F,0xA8,0x2B,0x78,0x5B,0x18,0x5B, +0x78,0xB8,0x48,0xBD,0x48,0x5A,0xD4,0x33,0xDF,0x66,0xFE,0xEA,0xF9,0x23,0x0B,0x82,0x16,0x7C,0xBD, +0x90,0xB0,0x50,0xB8,0xB0,0xB3,0xD8,0xB8,0x78,0x59,0xF1,0xE0,0x22,0xBF,0x45,0xBB,0x16,0x23,0x8B, +0x53,0x17,0x77,0x2E,0x31,0x5D,0x52,0xBA,0x64,0x78,0x69,0xF0,0xD2,0x7D,0xCB,0x68,0xCB,0xB2,0x96, +0xFD,0x50,0xE2,0x58,0x52,0x55,0xF2,0x6A,0x79,0xDC,0xF2,0x8E,0x52,0x83,0xD2,0xA5,0xA5,0x43,0x2B, +0x82,0x57,0x34,0x95,0xA9,0x94,0xC9,0xCB,0x6E,0xAE,0xF4,0x5A,0xB9,0x63,0x15,0x61,0x95,0x64,0x55, +0xEF,0x6A,0x97,0xD5,0x5B,0x56,0x7F,0x2A,0x17,0x95,0x5F,0xAC,0x70,0xAC,0xA8,0xAE,0xF8,0xB0,0x46, +0xB8,0xE6,0xE2,0x57,0x4E,0x5F,0xD5,0x7C,0xF5,0x79,0x6D,0xDA,0xDA,0xDE,0x4A,0xB7,0xCA,0xED,0xEB, +0x48,0xEB,0xA4,0xEB,0x6E,0xAC,0xF7,0x59,0xBF,0xAF,0x4A,0xBD,0x6A,0x41,0xD5,0xD0,0x86,0xF0,0x0D, +0xAD,0x1B,0xF1,0x8D,0xE5,0x1B,0x5F,0x6D,0x4A,0xDE,0x74,0xA1,0x7A,0x6A,0xF5,0x8E,0xCD,0xB4,0xCD, +0xCA,0xCD,0x03,0x35,0x61,0x35,0xED,0x5B,0xCC,0xB6,0xAC,0xDB,0xF2,0xA1,0x36,0xA3,0xF6,0x7A,0x9D, +0x7F,0x5D,0xCB,0x56,0xFD,0xAD,0xAB,0xB7,0xBE,0xD9,0x26,0xDA,0xD6,0xBF,0xDD,0x77,0x7B,0xF3,0x0E, +0x83,0x1D,0x15,0x3B,0xDE,0xEF,0x94,0xEC,0xBC,0xB5,0x2B,0x78,0x57,0x6B,0xBD,0x45,0x7D,0xF5,0x6E, +0xD2,0xEE,0x82,0xDD,0x8F,0x1A,0x62,0x1B,0xBA,0xBF,0xE6,0x7E,0xDD,0xB8,0x47,0x77,0x4F,0xC5,0x9E, +0x8F,0x7B,0xA5,0x7B,0x07,0xF6,0x45,0xEF,0xEB,0x6A,0x74,0x6F,0x6C,0xDC,0xAF,0xBF,0xBF,0xB2,0x09, +0x6D,0x52,0x36,0x8D,0x1E,0x48,0x3A,0x70,0xE5,0x9B,0x80,0x6F,0xDA,0x9B,0xED,0x9A,0x77,0xB5,0x70, +0x5A,0x2A,0x0E,0xC2,0x41,0xE5,0xC1,0x27,0xDF,0xA6,0x7C,0x7B,0xE3,0x50,0xE8,0xA1,0xCE,0xC3,0xDC, +0xC3,0xCD,0xDF,0x99,0x7F,0xB7,0xF5,0x08,0xEB,0x48,0x79,0x2B,0xD2,0x3A,0xBF,0x75,0xAC,0x2D,0xA3, +0x6D,0xA0,0x3D,0xA1,0xBD,0xEF,0xE8,0x8C,0xA3,0x9D,0x1D,0x5E,0x1D,0x47,0xBE,0xB7,0xFF,0x7E,0xEF, +0x31,0xE3,0x63,0x75,0xC7,0x35,0x8F,0x57,0x9E,0xA0,0x9D,0x28,0x3D,0xF1,0xF9,0xE4,0x82,0x93,0xE3, +0xA7,0x64,0xA7,0x9E,0x9D,0x4E,0x3F,0x3D,0xD4,0x99,0xDC,0x79,0xF7,0x4C,0xFC,0x99,0x6B,0x5D,0x51, +0x5D,0xBD,0x67,0x43,0xCF,0x9E,0x3F,0x17,0x74,0xEE,0x4C,0xB7,0x5F,0xF7,0xC9,0xF3,0xDE,0xE7,0x8F, +0x5D,0xF0,0xBC,0x70,0xF4,0x22,0xF7,0x62,0xDB,0x25,0xB7,0x4B,0xAD,0x3D,0xAE,0x3D,0x47,0x7E,0x70, +0xFD,0xE1,0x48,0xAF,0x5B,0x6F,0xEB,0x65,0xF7,0xCB,0xED,0x57,0x3C,0xAE,0x74,0xF4,0x4D,0xEB,0x3B, +0xD1,0xEF,0xD3,0x7F,0xFA,0x6A,0xC0,0xD5,0x73,0xD7,0xF8,0xD7,0x2E,0x5D,0x9F,0x79,0xBD,0xEF,0xC6, +0xEC,0x1B,0xB7,0x6E,0x26,0xDD,0x1C,0xB8,0x25,0xBA,0xF5,0xF8,0x76,0xF6,0xED,0x17,0x77,0x0A,0xEE, +0x4C,0xDC,0x5D,0x7A,0x8F,0x78,0xAF,0xFC,0xBE,0xDA,0xFD,0xEA,0x07,0xFA,0x0F,0xEA,0x7F,0xB4,0xFE, +0xB1,0x65,0xC0,0x6D,0xE0,0xF8,0x60,0xC0,0x60,0xCF,0xC3,0x59,0x0F,0xEF,0x0E,0x09,0x87,0x9E,0xFE, +0x94,0xFF,0xD3,0x87,0xE1,0xD2,0x47,0xCC,0x47,0xD5,0x23,0x46,0x23,0x8D,0x8F,0x9D,0x1F,0x1F,0x1B, +0x0D,0x1A,0xBD,0xF2,0x64,0xCE,0x93,0xE1,0xA7,0xB2,0xA7,0x13,0xCF,0xCA,0x7E,0x56,0xFF,0x79,0xEB, +0x73,0xAB,0xE7,0xDF,0xFD,0xE2,0xFB,0x4B,0xCF,0x58,0xFC,0xD8,0xF0,0x0B,0xF9,0x8B,0xCF,0xBF,0xAE, +0x79,0xA9,0xF3,0x72,0xEF,0xAB,0xA9,0xAF,0x3A,0xC7,0x23,0xC7,0x1F,0xBC,0xCE,0x79,0x3D,0xF1,0xA6, +0xFC,0xAD,0xCE,0xDB,0x7D,0xEF,0xB8,0xEF,0xBA,0xDF,0xC7,0xBD,0x1F,0x99,0x28,0xFC,0x40,0xFE,0x50, +0xF3,0xD1,0xFA,0x63,0xC7,0xA7,0xD0,0x4F,0xF7,0x3E,0xE7,0x7C,0xFE,0xFC,0x2F,0xF7,0x84,0xF3,0xFB, +0x25,0xD2,0x9F,0x33,0x00,0x00,0x00,0x20,0x63,0x48,0x52,0x4D,0x00,0x00,0x7A,0x25,0x00,0x00,0x80, +0x83,0x00,0x00,0xF9,0xFF,0x00,0x00,0x80,0xE9,0x00,0x00,0x75,0x30,0x00,0x00,0xEA,0x60,0x00,0x00, +0x3A,0x98,0x00,0x00,0x17,0x6F,0x92,0x5F,0xC5,0x46,0x00,0x00,0x03,0x6A,0x49,0x44,0x41,0x54,0x78, +0xDA,0xD4,0x99,0xDB,0x8B,0x4D,0x51,0x1C,0xC7,0x3F,0x73,0x30,0x33,0xB9,0x1B,0x91,0x26,0xE4,0x96, +0x41,0x23,0x64,0xBC,0x10,0x21,0x22,0x49,0xE4,0xC1,0x03,0x25,0xA6,0x49,0xE3,0x6F,0xF0,0xE4,0x4D, +0xA3,0x88,0x72,0x8B,0x79,0x91,0x86,0x22,0x21,0x91,0x68,0x94,0x6B,0x6E,0x33,0xEE,0x23,0x14,0x66, +0x18,0x53,0x43,0x72,0x3B,0xE3,0xFA,0xF5,0x60,0x4D,0x9D,0x8E,0x73,0xF6,0x59,0x6B,0xED,0x7D,0xCE, +0x71,0xBE,0xB5,0xDA,0x9D,0xCE,0xDA,0xBF,0xB5,0xBE,0xEB,0xB7,0x7E,0xD7,0x5D,0x24,0x89,0x42,0x46, +0xCF,0x88,0xE4,0x14,0x03,0x53,0x81,0xF1,0x40,0x15,0x30,0x0E,0x18,0x06,0xF4,0x06,0x3E,0x03,0xED, +0xC0,0x33,0xE0,0x16,0xF0,0x04,0x68,0x02,0xF4,0x3F,0x10,0x98,0x02,0xD4,0x00,0xCB,0x80,0x11,0x0E, +0xEF,0x3D,0x07,0x4E,0x00,0x07,0x80,0x47,0xA1,0x76,0x20,0xC9,0x67,0xCC,0x94,0x74,0x51,0xD1,0xE0, +0xB4,0xA4,0xE9,0x9E,0xFB,0x70,0x26,0x50,0x26,0xE9,0xB0,0xB2,0x83,0x7A,0x49,0xFD,0x5D,0x09,0x14, +0x39,0x18,0xF1,0x2C,0xA3,0xF6,0xC1,0x59,0xB4,0xC9,0x37,0xC0,0x12,0xE0,0xAE,0xED,0x0B,0x31,0xCB, +0x79,0x6B,0x81,0xCB,0x59,0xDE,0x3C,0x40,0x39,0x70,0x07,0x58,0x1E,0xA5,0x0D,0x54,0x2B,0x3F,0x58, +0x15,0xC5,0x15,0x5A,0x09,0x1C,0xCD,0xA3,0x9B,0x5F,0x08,0x9C,0x0F,0x9A,0x10,0x44,0x60,0x0C,0x70, +0x0D,0x18,0x9A,0x47,0x02,0x6D,0xC6,0xF6,0x5E,0xF9,0xD8,0x40,0x7D,0x9E,0x37,0x0F,0x30,0x1C,0xD8, +0xE3,0xA3,0x81,0x1A,0x60,0x9F,0xC7,0x82,0x5D,0xE6,0x50,0x9A,0x4C,0x90,0xEA,0x6D,0x22,0xEE,0x67, +0xA0,0x1A,0x98,0x06,0xFC,0x06,0xFA,0x38,0xCA,0x5D,0x03,0x1C,0xB2,0x35,0xE2,0x52,0x49,0x4F,0x3D, +0x8C,0xEE,0x8A,0xA4,0x05,0x92,0x7A,0x49,0x2A,0x49,0x21,0xB7,0xD8,0x3C,0xE7,0x48,0x3A,0x22,0xE9, +0xAB,0x83,0xEC,0xBB,0x2E,0x81,0x6C,0xBD,0xE3,0xC6,0x5B,0x25,0xCD,0xF7,0x88,0xA2,0xF3,0x24,0x7D, +0x72,0x58,0x67,0xB5,0x2D,0x81,0x46,0x07,0xA1,0xED,0x92,0x26,0xF9,0xA6,0x01,0x46,0x1B,0x3F,0x2D, +0xD7,0x6A,0xB4,0x21,0x30,0x5A,0x52,0xDC,0x52,0x60,0xA7,0xA4,0x09,0x21,0x36,0xEF,0xAA,0xF1,0xB8, +0xA4,0x8A,0xE4,0xF7,0x63,0x49,0x6E,0x73,0x05,0x50,0x6A,0x61,0x54,0x1F,0x81,0xB9,0x40,0x4B,0x04, +0x9E,0xA6,0x1E,0x38,0x65,0x31,0xAF,0x14,0x58,0x14,0xE4,0x46,0x87,0x03,0x63,0x2D,0x17,0xDD,0x05, +0x3C,0x88,0xD0,0x5D,0xD6,0x59,0xCE,0x9B,0x1C,0x44,0x60,0x06,0x50,0x69,0x21,0xE4,0x3D,0xB0,0x3D, +0x62,0x7F,0x7F,0x09,0xB8,0x62,0x59,0x7F,0xA4,0x25,0x30,0xD1,0x5C,0xA3,0x4C,0xD8,0x0B,0x74,0x64, +0x21,0x68,0xD9,0x68,0xB4,0xC2,0x54,0x7A,0x29,0x09,0x94,0x03,0x43,0x32,0x08,0x88,0x03,0xFB,0xB3, +0x14,0x75,0x6D,0x34,0x50,0x02,0xF4,0x4D,0x47,0xA0,0x9F,0x99,0x10,0x84,0x5F,0xC0,0x97,0x2C,0x11, +0x68,0xB5,0x98,0xD3,0x03,0xE8,0x95,0x8E,0xC0,0x77,0x13,0xE6,0x03,0xB3,0x6F,0x43,0x22,0x1B,0xB0, +0xAD,0xAC,0x62,0xE9,0x7E,0xBC,0x05,0xDE,0x65,0x78,0xF9,0x37,0xF0,0xC3,0x63,0x73,0x03,0xCD,0x08, +0xC2,0x08,0x1F,0xA2,0x89,0x04,0x9E,0x05,0xA5,0xAD,0x21,0xD1,0x60,0x2A,0xAD,0xB2,0x0C,0x25,0x2B, +0x16,0x57,0xF8,0x5B,0x3A,0x02,0xD7,0x81,0x7B,0x19,0x04,0xF4,0x75,0x6C,0x9F,0x74,0x63,0x14,0x30, +0x1A,0x38,0x17,0x40,0x62,0xB2,0x25,0x81,0xAE,0x74,0x04,0xDE,0x98,0x91,0xC9,0x88,0x56,0x78,0x10, +0xF8,0x69,0x9E,0xD3,0x81,0x0B,0xC6,0x61,0x24,0x62,0xB6,0xA5,0x06,0xF4,0x8F,0xAD,0x24,0xE5,0x16, +0x55,0x16,0x39,0x49,0x9B,0xA4,0x41,0x8E,0xF9,0xCE,0xBD,0x24,0x19,0xF7,0x93,0x5A,0x28,0x27,0x2D, +0xF3,0xA1,0x17,0x92,0x06,0x04,0x25,0x73,0x3D,0x25,0x3D,0xB4,0x10,0xB4,0xC7,0x91,0x40,0x2A,0x99, +0xCD,0xE6,0xBF,0xE5,0x0E,0xD9,0xEF,0xA6,0xA0,0x64,0xAE,0x5B,0xD5,0x0D,0x16,0xAA,0xDC,0x00,0x6C, +0x74,0xB8,0x42,0xB1,0x34,0x69,0xC1,0x7D,0xC7,0xB4,0xE4,0xB6,0x4D,0x45,0x36,0x52,0xD2,0x07,0x8B, +0xD3,0x78,0x6B,0x3A,0x75,0x36,0x1A,0x78,0x1C,0x41,0x9B,0xE5,0x71,0x2A,0xD9,0xA9,0x4E,0xE6,0x15, +0xB0,0xDB,0xE2,0x34,0x0E,0x9A,0xC4,0x2E,0x57,0x68,0x70,0xE9,0x4A,0x6C,0x01,0x5E,0x67,0x10,0x78, +0x35,0x87,0x9B,0xEF,0x30,0x29,0xBC,0x35,0x81,0x0F,0x40,0x6D,0x80,0xC0,0x9D,0xC0,0xF1,0x1C,0x12, +0xD8,0x01,0x74,0xFA,0xB4,0x16,0x37,0xA7,0xB8,0x8B,0x5B,0x3D,0xCA,0xC6,0x96,0x10,0x77,0xBF,0x2E, +0x6C,0x7B,0xFD,0x40,0x42,0xE1,0xBD,0xCD,0xB3,0xEE,0xF5,0x25,0xD0,0x6C,0x5C,0x7B,0x5A,0xD9,0x36, +0xDD,0xE9,0x5A,0xD3,0xA1,0x9B,0x0D,0x6C,0xCA,0x71,0x67,0xEE,0x58,0x42,0x14,0x77,0xEE,0x8D,0x46, +0x89,0x16,0x53,0x4D,0xB9,0xE2,0x97,0x69,0xF0,0x36,0x86,0xFD,0x3E,0x90,0x2F,0xF4,0x00,0xCE,0x02, +0x8B,0x0B,0x95,0x00,0xFC,0xFD,0x02,0x7A,0x06,0x58,0x5A,0xA8,0x04,0xBA,0x71,0x0A,0x58,0x97,0x2F, +0x02,0x37,0x12,0x2A,0xBA,0x30,0xA8,0x74,0x8D,0x03,0x51,0x8D,0x98,0xE9,0x4E,0xD7,0x48,0x7A,0xE9, +0xE9,0x52,0x8F,0x85,0xFD,0x4A,0x19,0x15,0xCA,0x4D,0xF5,0x15,0xB7,0x98,0x5B,0x64,0x6E,0x49,0x31, +0x70,0x33,0x55,0xEE,0x95,0x0F,0x02,0x91,0x22,0x46,0x81,0xE3,0xCF,0x00,0xD2,0xF0,0xF4,0x75,0x05, +0xC1,0xEC,0xA0,0x00,0x00,0x00,0x00,0x49,0x45,0x4E,0x44,0xAE,0x42,0x60,0x82}; diff --git a/archive/blr2/src/main.cpp b/archive/blr2/src/main.cpp new file mode 100644 index 0000000..3c1bec1 --- /dev/null +++ b/archive/blr2/src/main.cpp @@ -0,0 +1,1349 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Main Code +// Copyright Chrisoft 2014 +//Now that we use BSD license, so let's paste it here. +//(although it may be awful) +/* + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of the nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ +//#define Debug +#include <hge.h> +#include <hgefont.h> +#include <hgegui.h> +#include <hgedistort.h> +#include <hgerect.h> +#include <cassert> +#include <cmath> +#include <ctime> +#include <cstdlib> +#include <cstring> +#include <cstdio> +#include <csignal> +#ifdef WIN32 +#include <io.h> +#include <direct.h> +#include <shlwapi.h> +#include <shellapi.h> +#include <windows.h> +#include <mmsystem.h> +#endif +#if defined(__GNUC__) && !defined(MINGW_BUILD) +#include <execinfo.h> +#endif +#include "libcgh.h" +#include "hgeft.h" +#include "global.h" +#include "music.h" +#include "scoresystem.h" +#include "towernbullet.h" +#include "background.h" +#include "levels.h" +#include "scorec.h" +#include "menus.h" +static const char* MAIN_SRC_FN="main.cpp"; +#ifdef WIN32 +void Expand(const char *source,const char *dist) +{ + char cmd[255]; + sprintf(cmd,"%s -F:* %s",source,dist); + int res=(int)ShellExecuteA(NULL,"open","expand.exe",cmd,NULL,SW_HIDE); + if (res<32) Error("Error while decompressing resources!\nCheck if expand.exe works correctly."); +} +void firststartup() +{ + if (MessageBoxA(NULL,"It seems that you are running BLR for the First time!\nLet's do some \ +basic settings first!\n\nUse vsync?","First Start Up",0x00000024)==6) + fpslvl=2; + else + fpslvl=0; + if (MessageBoxA(NULL,"Enable Fullscreen?","First Start Up",0x00000024)==6) + tfs=1; + else + tfs=0; + diffkey=false;VidMode=0; + plrspd=3;plrslospd=3;clrbns=clrmode=0;bgmvol=15;sfxvol=10; + hge->System_Log("%s: Finishing first start up configuraion...",MAIN_SRC_FN); + Options_Writeback(); + Score_Initailize(); +} +#else +void firststartup() +{ + fpslvl=2;tfs=0;VidMode=0;diffkey=false; + plrspd=3;plrslospd=3;clrbns=clrmode=0;bgmvol=15;sfxvol=10; + hge->System_Log("%s: Finishing (stubbed) first start up configuraion...",MAIN_SRC_FN); + Options_Writeback(); + Score_Initailize(); +} +#endif +void Player_Clear_Expand() +{ + if (LOWFPS) + clrrange+=13.6; + else + clrrange+=0.8; + int ds; + for (int i=1;i<=bulcnt;++i) + { + if(bullet[i].bullettype>=253)continue; + double dis=GetDist(bullet[i].bulletpos,playerpos);ds=0; + if(PlayerSplit) + for(int j=1;j<4;++j) + { + if(dis>GetDist(bullet[i].bulletpos,playerpos+splitData[j])) + dis=GetDist(bullet[i].bulletpos,playerpos+splitData[j]),ds=j; + } + if(dis<=clrrange&&bullet[i].exist&&!bullet[i].inv) + { + CreateBullet255(bullet[i].bulletpos.x,bullet[i].bulletpos.y,10,ds); + 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; + } + } +} +void Player_Clear_Rotate() +{ + if (LOWFPS) + clrrad+=pi/450*17; + else + clrrad+=pi/450; + for (int i=1;i<=bulcnt;++i) + { + if(bullet[i].bullettype>=253)continue; + double dis=GetDist(bullet[i].bulletpos,playerpos); + double rad=atan2l(bullet[i].bulletpos.y-playerpos.y,bullet[i].bulletpos.x-playerpos.x); + hge->Gfx_RenderLine(playerpos.x+8,playerpos.y+8,playerpos.x+cos(clrrad)*clrmaxrange,playerpos.y+sin(clrrad)*clrmaxrange); + rad=normalizerad(rad); + if(dis<=clrmaxrange&&bullet[i].exist&&!bullet[i].inv&&rad>normalizerad(clrrad)-pi/12&&rad<normalizerad(clrrad)+pi/12) + { + CreateBullet255(bullet[i].bulletpos.x,bullet[i].bulletpos.y,10); + 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; + } + if(PlayerSplit) + for(int j=1;j<4;++j) + { + vector2d plsp=playerpos+splitData[j]; + double dis=GetDist(bullet[i].bulletpos,plsp); + double rad=atan2l(bullet[i].bulletpos.y-plsp.y,bullet[i].bulletpos.x-plsp.x); + hge->Gfx_RenderLine(plsp.x+8,plsp.y+8,plsp.x+cos(clrrad)*clrmaxrange,plsp.y+sin(clrrad)*clrmaxrange); + while (rad<0)rad+=2*pi; + if (bullet[i].bullettype!=255&&dis<=clrmaxrange&&bullet[i].exist&&!bullet[i].inv&&rad>normalizerad(clrrad)-pi/12&&rad<normalizerad(clrrad)+pi/12) + { + CreateBullet255(bullet[i].bulletpos.x,bullet[i].bulletpos.y,10,j); + 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; + } + } + } +} +void ProcessPlayer() +{ + if (!clrcircle) + { + clrcircle=new hgeSprite(SprSheet,63,71,193,193); + clrcircle->SetHotSpot(96.5f,96.5f); + clrcircle->SetBlendMode(BLEND_ALPHAADD); + } + if(clrmode)clrcircle->SetColor(0x30008080);else clrcircle->SetColor(0x30800000); + if (playerLockX) + { + Lock.Setdata(0,vector2d(playerpos.x-1,0),vector2d(playerpos.x-1,600),0xC0FFFFFF); + for (int i=1;i<80;++i) + Lock.Setdata(i,vector2d(playerpos.x+1,0),vector2d(playerpos.x+1,600),0xC0FFFFFF); + Lock.Render(); + } + if (playerLockY) + { + Lock.Setdata(0,vector2d(0,playerpos.y+5),vector2d(800,playerpos.y+5),0xC0FFFFFF); + for (int i=1;i<80;++i) + Lock.Setdata(i,vector2d(0,playerpos.y+7),vector2d(800,playerpos.y+7),0xC0FFFFFF); + Lock.Render(); + } + if(!PlayerSplit) + playerspr->RenderEx(playerpos.x+8.4,playerpos.y+8.4,playerrot,0.7,0); + else + { + for(int i=0;i<4;++i) + playerspr->RenderEx(playerpos.x+splitData[i].x+8.4,playerpos.y+splitData[i].y+8.4,playerrot,0.7,0); + } + if (DisablePlayer)return; + playerrot+=0.00174533*17; + double realspd; + if (hge->Input_GetKeyState(HGEK_SHIFT)) + realspd=playerslospeed*(1000.0f/hge->Timer_GetFPS()); + else + realspd=playerspeed*(1000.0f/hge->Timer_GetFPS()); + if (hge->Input_GetKeyState(HGEK_LEFT)&&!playerLockX) + if (playerpos.x>10)playerpos.x-=realspd; + if (hge->Input_GetKeyState(HGEK_RIGHT)&&!playerLockX) + if ((playerpos.x<770&&!PlayerSplit)||(playerpos.x<370&&PlayerSplit))playerpos.x+=realspd; + if (hge->Input_GetKeyState(HGEK_UP)&&!playerLockY) + if (playerpos.y>10)playerpos.y-=realspd; + if (hge->Input_GetKeyState(HGEK_DOWN)&&!playerLockY) + if ((playerpos.y<570&&!PlayerSplit)||(playerpos.y<270&&PlayerSplit))playerpos.y+=realspd; + if(mode==2)return; + if (!clrmode) + { + if (hge->Input_GetKeyStateEx(diffkey?HGEK_X:HGEK_Z)==HGEKST_HIT&&clrmaxrange==0) + {clrind=0;charge=1;} + if (hge->Input_GetKeyStateEx(diffkey?HGEK_X:HGEK_Z)==HGEKST_KEEP&&charge) + { + if (clrmaxrange<=400) + {if (LOWFPS)clrmaxrange+=1.6;else clrmaxrange+=0.1;} + if (!LOWFPS)clrind+=0.001*pi;else clrind+=0.016*pi; + clrcircle->RenderEx(playerpos.x+7.2,playerpos.y+7.2,clrind,2*clrmaxrange/193.0f); + if(PlayerSplit)for(int i=1;i<4;++i) + clrcircle->RenderEx(playerpos.x+splitData[i].x+7.2,playerpos.y+splitData[i].y+7.2,clrind,2*clrmaxrange/193.0f); + } + if (hge->Input_GetKeyStateEx(diffkey?HGEK_X:HGEK_Z)==HGEKST_RELEASE&&charge) + { + charge=0; + if (clrmaxrange<=50) + { + if (clrtime+clrbns>0) + {--clrtime;clrmaxrange=350;Player_Clear_Expand();++clrusg;} + else clrmaxrange=0; + } + else{Player_Clear_Expand();++clrusg;} + } + if (clrrange!=0) + { + Player_Clear_Expand(); + clrcircle->RenderEx(playerpos.x+7.2,playerpos.y+7.2,clrind,2*(clrmaxrange-clrrange)/193.0f); + if(PlayerSplit)for(int i=1;i<4;++i) + clrcircle->RenderEx(playerpos.x+splitData[i].x+7.2,playerpos.y+splitData[i].y+7.2,clrind,2*(clrmaxrange-clrrange)/193.0f); + clrind+=(LOWFPS?0.016*pi:0.001*pi); + } + if (clrrange>=clrmaxrange)clrrange=clrmaxrange=0; + } + else + { + if (hge->Input_GetKeyStateEx(diffkey?HGEK_X:HGEK_Z)==HGEKST_HIT&&clrmaxrange==0) + {clrind=0;charge=1;} + if (hge->Input_GetKeyStateEx(diffkey?HGEK_X:HGEK_Z)==HGEKST_KEEP&&charge) + { + if (clrmaxrange<=400) + {if (LOWFPS)clrmaxrange+=1.6;else clrmaxrange+=0.1;} + if (!LOWFPS)clrind+=0.001*pi;else clrind+=0.016*pi; + clrcircle->RenderEx(playerpos.x+7.2,playerpos.y+7.2,clrind,2*clrmaxrange/193.0f); + if(PlayerSplit)for(int i=1;i<4;++i) + clrcircle->RenderEx(playerpos.x+splitData[i].x+7.2,playerpos.y+splitData[i].y+7.2,clrind,2*clrmaxrange/193.0f); + } + if (hge->Input_GetKeyStateEx(diffkey?HGEK_X:HGEK_Z)==HGEKST_RELEASE&&charge) + { + charge=0; + if (clrmaxrange<=50) + { + if(clrtime+clrbns>0) + {--clrtime;clrmaxrange=350;Player_Clear_Rotate();++clrusg;} + else clrmaxrange=0; + }else{Player_Clear_Rotate();++clrusg;} + } + if (clrrad-pi/2>1e-7) + { + Player_Clear_Rotate(); + clrcircle->RenderEx(playerpos.x+7.2,playerpos.y+7.2,clrind,2*clrmaxrange/193.0f*(5*pi/2.0f-clrrad)/(2*pi)); + if(PlayerSplit)for(int i=1;i<4;++i) + clrcircle->RenderEx(playerpos.x+splitData[i].x+7.2,playerpos.y+splitData[i].y+7.2,clrind,2*clrmaxrange/193.0f*(5*pi/2.0f-clrrad)/(2*pi)); + clrind+=(LOWFPS?0.016*pi:0.001*pi); + } + if (5*pi/2-clrrad<1e-7)clrrad=pi/2,clrmaxrange=0; + } +} +void RefreshScore() +{ + Mult_FrameFunc(); + if(DisablePlayer)return; + mult+=0.01f*dsmc; + score+=16*mult; + if(scminus){if(mult/2>0.1)mult/=2;else mult=0.1;} + score+=100*shots*mult; + score-=scminus*mult; + score+=2000*dsmc*mult; + ++frms; + averfps=(averfps*(frms-1)+hge->Timer_GetFPSf())/(double)frms; +} +void CallLevels() +{ + //Use this to call level procedures. + if((mode==1)&&coll!=0){deathMenu.Init(-200);return;} + if((mode==2)&&coll!=0){asts+=assetime;assetime=0;++part;coll=0;IfCallLevel=IfShowTip=true;return;} + if(!IfCallLevel) return; + if(mode==2)assetime+=hge->Timer_GetDelta(); + //Check Complete here + if(level==1&&part==0)Level1Part0(); + if(level==1&&part==1)Level1Part1(); + if(level==1&&part==2)Level1Part2(); + if(level==1&&part==3)Level1Part3(); + if(level==1&&part==4)Level1Part4(); + if(level==2&&part==0)Level2Part0(); + if(level==2&&part==1)Level2Part1(); + if(level==2&&part==2)Level2Part2(); + if(level==2&&part==3)Level2Part3(); + if(level==2&&part==4)Level2Part4(); + if(level==2&&part==5)Level2Part5(); + if(level==2&&part==6)Level2Part6(); + if(level==2&&part==7)Level2Part7(); + if(level==2&&part==8)Level2Part8(); + if(level==2&&part==9)Level2Part9(); + if(level==3&&part==0)Level3Part0(); + if(level==3&&part==1)Level3Part1(); + if(level==3&&part==2)Level3Part2(); + if(level==3&&part==3)Level3Part3(); + if(level==3&&part==4)Level3Part4(); + if(level==3&&part==5)Level3Part5(); + if(level==3&&part==6)Level3Part6(); + if(level==4&&part==0)Level4Part0(); + if(level==4&&part==1)Level4Part1(); + if(level==4&&part==2)Level4Part2(); + if(level==4&&part==3)Level4Part3(); + if(level==4&&part==4)Level4Part4(); + if(level==4&&part==5)Level4Part5(); + if(level==4&&part==6)Level4Part6(); + if(level==4&&part==7)Level4Part7(); + if(level==4&&part==8)Level4Part8(); + if(level==4&&part==9)Level4Part9(); + if(level==4&&part==10)Level4Part10(); + if(level==4&&part==11)Level4Part11(); + if(level==4&&part==12)Level4Part12(); + if(level==4&&part==13)Level4Part13(); + if(level==4&&part==14)Level4Part14(); + if(level==4&&part==15)Level4Part15(); + if(level==4&&part==16)Level4Part16(); + if(level==4&&part==17)Level4Part17(); + if(level==4&&part==18)Level4Part18(); + if(level==4&&part==19)Level4Part19(); + if(level==4&&part==20)Level4Part20(); + if(level==4&&part==21)Level4Part21(); + if(level==4&&part==22)Level4Part22(); + if(level==4&&part==23)Level4Part23(); + if(level==4&&part==24)Level4Part24(); + if(level==4&&part==25)Level4Part25(); + if(level==5&&part==0)Level5Part0(); + if(level==5&&part==1)Level5Part1(); + if(level==5&&part==2)Level5Part2(); + if(level==5&&part==3)Level5Part3(); + if(level==5&&part==4)Level5Part4(); + if(level==5&&part==5)Level5Part5(); + if(level==5&&part==6)Level5Part6(); + if(level==5&&part==7)Level5Part7(); + if(level==5&&part==8)Level5Part8(); + if(level==5&&part==9)Level5Part9(); + if(level==5&&part==10)Level5Part10(); + if(level==5&&part==11)Level5Part11(); + if(level==5&&part==12)Level5Part12(); + if(level==5&&part==13)Level5Part13(); + if(level==5&&part==14)Level5Part14(); + if(level==5&&part==15)Level5Part15(); + if(level==5&&part==16)Level5Part16(); + if(level==5&&part==17)Level5Part17(); + if(level==5&&part==18)Level5Part18(); + if(level==5&&part==19)Level5Part19(); + if(level==5&&part==20)Level5Part20(); + if(level==5&&part==21)Level5Part21(); + if(level==5&&part==22)Level5Part22(); + if(level==6&&part==0)Level6Part0(); + if(level==6&&part==1)Level6Part1(); + if(level==6&&part==2)Level6Part2(); + if(level==6&&part==3)Level6Part3(); + if(level==6&&part==4)Level6Part4(); + if(level==6&&part==5)Level6Part5(); + if(level==6&&part==6)Level6Part6(); + if(level==6&&part==7)Level6Part7(); + if(level==6&&part==8)Level6Part8(); + if(level==6&&part==9)Level6Part9(); + if(level==6&&part==10)Level6Part10(); + if(level==6&&part==11)Level6Part11(); + if(level==6&&part==12)Level6Part12(); + if(level==6&&part==13)Level6Part13(); + if(level==6&&part==14)Level6Part14(); + if(level==6&&part==15)Level6Part15(); + if(level==6&&part==16)Level6Part16(); + if(level==6&&part==17)Level6Part17(); + if(level==6&&part==18)Level6Part18(); + if(level==6&&part==19)Level6Part19(); + if(level==6&&part==20)Level6Part20(); + if(level==6&&part==21)Level6Part21(); + if(level==6&&part==22)Level6Part22(); + if(level==6&&part==23)Level6Part23(); + if(level==6&&part==24)Level6Part24(); + if(level==6&&part==25)Level6Part25(); + if(level==6&&part==26)Level6Part26(); + if(level==6&&part==27)Level6Part27(); + if(level==6&&part==28)Level6Part28(); + if(level==6&&part==29)Level6Part29(); + if(level==6&&part==30)Level6Part30(); + if(level==6&&part==31)Level6Part999999999(); + if(level==7&&part==0)Level7Part0(); + if(level==7&&part==1)Level7Part1(); + if(level==7&&part==2)Level7Part2(); + if(level==7&&part==3)Level7Part3(); + if(level==7&&part==4)Level7Part4(); + if(level==7&&part==5)Level7Part5(); + if(level==7&&part==6)Level7Part6(); + if(level==7&&part==7)Level7Part7(); + if(level==7&&part==8)Level7Part8(); + if(level==7&&part==9)Level7Part9(); + if(level==7&&part==10)Level7Part10(); + if(level==7&&part==11)Level7Part11(); + if(level==7&&part==12)Level7Part12(); + if(level==7&&part==13)Level7Part13(); + if(level==7&&part==14)Level7Part14(); + if(level==7&&part==15)Level7Part15(); + if(level==7&&part==16)Level7Part16(); + if(level==7&&part==17)Level7Part17(); + 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==7&&part==23)Level7Part23(); + if(level==7&&part==24)Level7Part24(); + if(level==7&&part==25)Level7Part25(); + if(level==7&&part==26)Level7Part26(); + if(level==-1&&part==0)Levelm1Part0(); + if(level==-1&&part==1)Levelm1Part1(); + if(level==-1&&part==2)Levelm1Part2(); + if(level==-1&&part==3)Levelm1Part3(); + if(level==-1&&part==4)Levelm1Part4(); + if(level==-1&&part==5)Levelm1Part5(); + if(level==-1&&part==6)Levelm1Part6(); + if(level==-1&&part==7)Levelm1Part7(); + if(level==-1&&part==8)Levelm1Part8(); + if(level==-1&&part==9)Levelm1Part9(); + if(level==-1&&part==10)Levelm1Part10(); + if(level==-1&&part==11)Levelm1Part11(); + if(level==-1&&part==12)Levelm1Part12(); + if(level==-1&&part==13)Levelm1Part13(); + if(level==-1&&part==14)Levelm1Part14(); + if(level==-1&&part==15)Levelm1Part15(); + if(level==-1&&part==16)Levelm1Part16(); + if(level==-1&&part==17)Levelm1Part17(); + if(level==-1&&part==18)Levelm1Part18(); + if(level==-1&&part==19)Levelm1Part19(); + if(level==-1&&part==20)Levelm1Part20(); + if(level==-1&&part==21)Levelm1Part21(); + if(level==-2&&part==0)Levelm2Part0(); + if(level==-2&&part==1)Levelm2Part1(); + if(level==-2&&part==2)Levelm2Part2(); + if(level==-2&&part==3)Levelm2Part3(); + if(level==-2&&part==4)Levelm2Part4(); + if(level==-2&&part==5)Levelm2Part5(); + if(level==-2&&part==6)Levelm2Part6(); + if(level==-2&&part==7)Levelm2Part7(); + if(level==-2&&part==8)Levelm2Part8(); + if(level==-2&&part==9)Levelm2Part9(); + if(level==-2&&part==10)Levelm2Part10(); + if(level==-2&&part==11)Levelm2Part11(); + if(level==-2&&part==12)Levelm2Part12(); + if(level==-2&&part==13)Levelm2Part13(); + if(level==-2&&part==14)Levelm2Part14(); + if(level==-2&&part==15)Levelm2Part15(); + if(level==-2&&part==16)Levelm2Part16(); + if(level==-2&&part==17)Levelm2Part17(); + if(level==-2&&part==18)Levelm2Part18(); + if(level==-2&&part==19)Levelm2Part19(); + if(level==-2&&part==20)Levelm2Part20(); + if(level==-2&&part==21)Levelm2Part21(); + if(level==-2&&part==22)Levelm2Part22(); + if(level==-2&&part==23)Levelm2Part23(); + if(level==-2&&part==24)Levelm2Part24(); + if(level==-2&&part==25)Levelm2Part25(); + if(level==-2&&part==26)Levelm2Part26(); + + if(level==1&&part==5)level=2,part=0; + if(level==2&&part==10) + { + if(mode==3&&coll>10){completeMenu.Init(-200);return;} + if(mode==1&&restarts>1){completeMenu.Init(-200);return;} + level=3,part=0; + } + if(level==3&&part==7) + { + if(mode==3&&coll>40){completeMenu.Init(-200);return;} + if(mode==1&&restarts>2){completeMenu.Init(-200);return;} + level=4,part=0; + } + if(level==4&&part==26) + { + if(mode==3&&coll>75){completeMenu.Init(-200);return;} + if(mode==1&&restarts>3){completeMenu.Init(-200);return;} + level=5,part=0; + } + if(level==5&&part==23) + { + if(mode==3&&coll>125){completeMenu.Init(-200);return;} + if(mode==1&&restarts>5){completeMenu.Init(-200);return;} + level=6,part=0; + } + if(level==6&&part==32) + { + if(mode==3&&coll>200){completeMenu.Init(-200);return;} + if(mode==1&&restarts>8){completeMenu.Init(-200);return;} + level=7,part=0; + } + if(level==7&&part==27) + { + if(mode==3&&coll>50){completeMenu.Init(-200);return;} + if(mode==1&&restarts>2){completeMenu.Init(-200);return;} + level=-1,part=0; + } + if(level==-1&&part==22){completeMenu.Init(-200);return;} + if(level==-2&&part>26){completeMenu.Init(-200);return;} +} +bool ProcessCurCred() +{ + CreditsRail->RenderEx(400,300,0,4,1); + if(creditsp!=1) + Credits->Render(creditfly,300); + else + { + Credits->SetTextureRect(4,209,230,76); + Credits->Render(creditfly-30,330); + Credits->SetTextureRect(9,290,140,47); + Credits->Render(creditfly-30,400); + vdig->printf(creditfly-50,240,HGETEXT_LEFT,"%s",BLRVERSION); + bdig->printf(creditfly-50,310,HGETEXT_LEFT,"%s",BuiltDate); + } + if (credstop)credbrk+=hge->Timer_GetDelta(); + if (credbrk>=4.5&&!creddone)creddone=true,credstop=false,creditacc=0,credbrk=0; + if (!credstop)for (int i=1;i<=17;++i)creditfly-=creditacc; + if (creditfly<-300)return true; + for (int i=1;i<=17;++i)if (creditacc<2)creditacc+=0.015; + if (abs(creditfly-400)<5&&!creddone&&!credstop)credstop=true; + return false; +} +void AboutScene() +{ + if (ProcessCurCred()) + creditfly=1200,creditacc=0,credstop=creddone=false,++creditsp, + Credits->SetTextureRect(0,creditsp*200,600,200), + Credits->SetHotSpot(300,100); + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT||creditsp>11) + { + Current_Position=0; + mainMenu.Init(850); + Music_Stop(); + } +} +void HelpScene(bool fake=false) +{ + if(!fake)if(Hlpyofst>0)Hlpyofst-=40;else Hlpyofst=0; + else if(Hlpyofst<400)Hlpyofst+=40;else Hlpyofst=400,hshl=0; + if(Helpslide>1)MenuFont->Render(30,80+Hlpyofst,HGETEXT_LEFT,"Last"), + HlpL->Render(0,85+Hlpyofst); + if(Helpslide<6)MenuFont->Render(770,80+Hlpyofst,HGETEXT_RIGHT,"Next"), + HlpR->Render(775,85+Hlpyofst); + if(Helpscroll==0)Helpspr->Render(0,100+Hlpyofst); + else + { + Helpspr->Render(Helpscroll,100+Hlpyofst); + if(Helpscroll>0)NHelpspr->Render(Helpscroll-800,100+Hlpyofst); + else NHelpspr->Render(Helpscroll+800,100+Hlpyofst); + if(Helpscroll>0)Helpscroll+=30;else Helpscroll-=30; + if(fabs(Helpscroll)>=800) + { + Helpscroll=0;Helpspr->SetTextureRect(0,400*(Helpslide-1),800,400); + } + } + if(fake)return; + if(Helpscroll==0) + { + if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT&&Helpslide>1) + { + --Helpslide;NHelpspr->SetTextureRect(0,400*(Helpslide-1),800,400); + Helpscroll=1; + } + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&Helpslide<6) + { + ++Helpslide;NHelpspr->SetTextureRect(0,400*(Helpslide-1),800,400); + Helpscroll=-1; + } + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT) + { + Current_Position=0;mainMenu.Init(1000);hshl=1; + } + } +} +bool Foclost() +{ + if(Current_Position==1)pauseMenu.Init(-200); + return false; +} +bool FrameFunc() +{ + float dt=hge->Timer_GetDelta(); + static float t=0.0f; + float tx,ty; + if (Current_Position==1&&hge->Input_GetKeyState(HGEK_ESCAPE))pauseMenu.Init(-200); + int MMR=-1,SMR=-1,OMR=-1,PPMR=-1,PMR=-1,RTTMR=-1,DMR=-1,CMR=-1,HSMR=-1,HSVMR=-1,HSDMR=-1; + if (mainMenu.isActive())MMR=mainMenu.Update(); + if (startMenu.isActive())SMR=startMenu.Update(); + if (optionMenu.isActive())OMR=optionMenu.Update(); + if (playerPreferenceMenu.isActive())PPMR=playerPreferenceMenu.Update(); + if (pauseMenu.isActive())PMR=pauseMenu.Update(); + if (returnToTitleMenu.isActive())RTTMR=returnToTitleMenu.Update(); + if (deathMenu.isActive())DMR=deathMenu.Update(); + if (completeMenu.isActive())CMR=completeMenu.Update(); + if (newHighScoreGUI.isActive())newHighScoreGUI.Update(); + if (highScoreMenu.isActive())HSMR=highScoreMenu.Update(); + if (highScoreViewMenu.isActive())HSVMR=highScoreViewMenu.Update(); + if (highScoreDetailsMenu.isActive())HSDMR=highScoreDetailsMenu.Update(); + if (Current_Position==0) + { + if(!mainMenu.isActive())return true; + if(~MMR) + { + switch(MMR) + { + case 0:Current_Position=3;startMenu.Init();mainMenu.Leave();break; + case 1:Current_Position=8;highScoreMenu.Init(-200);mainMenu.Leave();break; + case 2: + Current_Position=13; + optionMenu.Init(-200); + break; + case 3: + Current_Position=15; + Helpspr->SetTextureRect(0,0,800,400); + NHelpspr->SetTextureRect(0,400,800,400); + Helpslide=1;Hlpyofst=400;Helpscroll=0; + break; + case 4: + Credits->SetHotSpot(300,100); + CreditsRail->SetHotSpot(300,100); + creditsp=0; + Music_Init("./Resources/Music/BLR2_TR09.ogg"); + lpst=lped=0;Music_Play(); + creditfly=1200;creditacc=0;credstop=creddone=false; + Credits->SetTextureRect(0,0,600,200); + Current_Position=4; + mainMenu.Leave(); + break; + case 5:break; + } + mainMenu.Leave(); + return false; + } + } + if (Current_Position==3) + { + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT) + { + startMenu.Leave();mainMenu.Init(800);Current_Position=0; + } + if(~SMR) + { + startMenu.Leave(); + switch(SMR) + { + case 0: + playerpos.x=400,playerpos.y=400,playerrot=0; + frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; + level=1,part=1;frms=0,averfps=0.0;bsscale=1; + 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"); + lpst=4607901;lped=9215893;//Music_Play(); + coll=semicoll=clrusg=0;playerLockX=playerLockY=false; + Lock.Init(2);IfShowTip=true;lsc=0; + clrrad=pi/2;clrrange=0;re.SetSeed(time(NULL)); + FadeTip=false;memset(lasttip,0,sizeof(lasttip)); + memset(tower,0,sizeof(tower)); + Complete=false; + Current_Position=1; + Level1Part1(); + IfCallLevel=true; + mode=1; + break; + case 1: + playerpos.x=400,playerpos.y=400,playerrot=0; + frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; + level=-2,part=0;frms=0,averfps=0.0;bsscale=1;assetime=asts=0; + 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"); + lpst=4607901;lped=9215893;Music_Play(); + coll=semicoll=clrusg=0;playerLockX=playerLockY=false; + Lock.Init(2);IfShowTip=true;lsc=0; + clrrad=pi/2;clrrange=0;re.SetSeed(time(NULL)); + FadeTip=false;memset(lasttip,0,sizeof(lasttip)); + memset(tower,0,sizeof(tower)); + Complete=false; + Current_Position=1; + IfCallLevel=true; + mode=2; + break; + case 2: + playerpos.x=400,playerpos.y=400,playerrot=0; + frameleft=ThirtySeconds;infofade=0xFF;Dis8ref=t8special=false; + level=1,part=1;frms=0,averfps=0.0;bsscale=1; + 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"); + lpst=4607901;lped=9215893;//Music_Play(); + coll=semicoll=clrusg=0;playerLockX=playerLockY=false; + Lock.Init(2);IfShowTip=true;lsc=0; + clrrad=pi/2;clrrange=0;re.SetSeed(time(NULL)); + FadeTip=false;memset(lasttip,0,sizeof(lasttip)); + memset(tower,0,sizeof(tower)); + Complete=false; + Current_Position=1; + Level1Part1(); + IfCallLevel=true; + mode=3; + break; + } + return false; + } + } + if (Current_Position==5) + { + if(~DMR) + { + if(DMR==1) + { + IfCallLevel=true; + IfShowTip=true; + Current_Position=1; + score=-abs(score); + mult=1;multbat=1;multbrk=TenSeconds; + ++restarts;part=0; + clockrot=deltarot=0; + coll=towcnt=bulcnt=0; + DisableAllTower=DisablePlayer=false; + } + if(DMR==2) + {Current_Position=0;mainMenu.Init(-200);} + deathMenu.Leave(); + return false; + } + } + if (Current_Position==6) + { + if(~CMR) + { + if(CMR==1) + {Current_Position=7;newHighScoreGUI.Init();} + if(CMR==2) + {Current_Position=0;mainMenu.Init(-200);} + completeMenu.Leave(); + return false; + } + } + if (Current_Position==8) + { + if(~HSMR) + { + if(HSMR<=2) + {Current_Position=9;highScoreViewMenu.Init(-200,HSMR);} + if(HSMR==3) + {Current_Position=0;mainMenu.Init(-200);} + highScoreMenu.Leave(); + return false; + } + } + if (Current_Position==9) + { + if(~HSVMR) + { + if(HSVMR<=highScoreViewMenu.GetViewCount()&&HSVMR) + {Current_Position=10;highScoreDetailsMenu.Init(-200,highScoreViewMenu.View(),HSVMR);} + if(HSVMR==6) + {Current_Position=8;highScoreMenu.Init(-200);} + if(HSVMR&&(HSVMR<=highScoreViewMenu.GetViewCount()||HSVMR==6)) + highScoreViewMenu.Leave(); + return false; + } + } + if (Current_Position==10) + { + if(~HSDMR) + { + highScoreViewMenu.Init(-200,highScoreDetailsMenu.View()); + highScoreDetailsMenu.Leave();Current_Position=9; + return false; + } + } + if (Current_Position==11) + { + //I am cornered!! + if(!pauseMenu.isActive())Current_Position=1,DisableAllTower=DisablePlayer=0; + if(~PMR) + { + pauseMenu.Leave(); + if(PMR==2)returnToTitleMenu.Init(-200),Current_Position=12; + else Music_Resume(); + return false; + } + } + if (Current_Position==12) + { + if(~RTTMR) + { + returnToTitleMenu.Leave(); + if(RTTMR==1)pauseMenu.Init(-200); + if(RTTMR==2)mainMenu.Init(-200),Current_Position=0; + } + } + if (Current_Position==13) + { + if(~OMR) + { + if(OMR==6||OMR==7)optionMenu.Leave(); + if(OMR==6) + { + playerPreferenceMenu.Init(-200); + Current_Position=14; + } + if(OMR==7) + { + Options_Writeback(); + mainMenu.Init(-200); + Current_Position=0; + } + return false; + } + } + if (Current_Position==14) + { + if(~PPMR) + { + if(PPMR==5) + { + if(AP_Update(plrspd,plrslospd,clrbns)<=10000) + optionMenu.Init(850), + Current_Position=13, + playerPreferenceMenu.Leave(); + else playerPreferenceMenu.Shake(); + } + return false; + } + } + t+=dt; + tx=50*cosf(t/60); + ty=50*sinf(t/60); + quad.v[0].tx=tx; quad.v[0].ty=ty; + quad.v[1].tx=tx+800/64; quad.v[1].ty=ty; + quad.v[2].tx=tx+800/64; quad.v[2].ty=ty+600/64; + quad.v[3].tx=tx; quad.v[3].ty=ty+600/64; + //Rendering*********************************************************************************** + //Super Spliter!*****Super Spliter!*****Super Spliter!*****Super Spliter!*****Super Spliter!** + //******Super Spliter!*****Super Spliter!*****Super Spliter!*****Super Spliter!*************** + hge->Gfx_BeginScene(); +#ifndef WIN32 + hge->Gfx_SetTransform(0,0,0,yos,0,scale,scale); +#else + hge->Gfx_SetTransform(0,0,0,0,0,scale,scale); +#endif + for(int i=0;i<4;i++)quad.v[i].col=DBGColor; + hge->Gfx_Clear(SETA(DBGColor,0xFF)); + if (skyactive)sky.Update(),sky.Render(); + hge->Gfx_RenderQuad(&quad); + int bulinuse=0; + if (Current_Position==1||Current_Position==2||Current_Position==5||Current_Position==11||Current_Position==12) + { + //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 (bdiff.active())bdiff.Update(); + if (LE_Active)Leaf.Update(); + shots=0; + dsmc=scminus=0; + Music_Update(); + ProcessTower1(); + ProcessTower2(); + ProcessTower3(); + ProcessTower4(); + ProcessTower5(); + ProcessTower6(); + ProcessTower7(); + ProcessTower8(); + ProcessTower9(); + ProcessLaser(); + for (int i=1;i<=bulcnt;++i) + { + if(bullet[i].exist)++bulinuse; + switch (bullet[i].bullettype) + { + case 1:ProcessBullet1(i);break; + case 2:ProcessBullet2(i);break; + case 4:ProcessBullet4(i);break; + case 5:ProcessBullet5(i);break; + case 6:ProcessBullet6(i);break; + case 7:ProcessBullet7(i);break; + case 8:ProcessBullet8(i);break; + case 9:ProcessBullet9(i);break; + case 253:BulletDeath_Process(i);break; + case 254:SCEffect_Process(i);break; + case 255:ProcessBullet255(i);break; + } + } + if (Current_Position==1)CallLevels(); + ProcessPlayer(); + RefreshScore(); + { + if (ATarg.visible)ATarg.TargFollowPlayer(),ATarg.TargRender(); + } + { + if (BTarg.visible)BTarg.TargRender(); + } + if (!DisablePlayer)--frameleft; + if (!LOWFPS) + { + if (playerspeed<playerfulspd)playerspeed+=playerfulspd/400; + if (playerslospeed<playerfulslospd)playerslospeed+=playerfulslospd/400; + } + else + { + if (playerspeed<playerfulspd)playerspeed+=playerfulspd/25; + if (playerslospeed<playerfulslospd)playerslospeed+=playerfulslospd/25; + } + } + if (frameleft==0&&Current_Position==1) + { + IfCallLevel=true; + ++part; + IfShowTip=true; + } + if(Current_Position==1&&shots)hge->Effect_PlayEx(snd,sfxvol/15.0,0,1,false); + if(mainMenu.isActive())mainMenu.Render(); + if(startMenu.isActive())startMenu.Render(); + if(optionMenu.isActive())optionMenu.Render(); + if(playerPreferenceMenu.isActive())playerPreferenceMenu.Render(); + if(pauseMenu.isActive())pauseMenu.Render(); + if(returnToTitleMenu.isActive())returnToTitleMenu.Render(); + if(deathMenu.isActive())deathMenu.Render(); + if(completeMenu.isActive())completeMenu.Render(); + if(newHighScoreGUI.isActive())newHighScoreGUI.Render(); + if(highScoreMenu.isActive())highScoreMenu.Render(); + if(highScoreViewMenu.isActive())highScoreViewMenu.Render(); + if(highScoreDetailsMenu.isActive())highScoreDetailsMenu.Render(); + if(Current_Position==15)HelpScene();if(hshl)HelpScene(1); + if(Current_Position==0||Current_Position==3||Current_Position==8|| + Current_Position==9||Current_Position==10||Current_Position==13||Current_Position==14) + { + titlespr->Render(160,0); + } + if (Current_Position==2)ShowTip(lasttip); + if (Current_Position==4)AboutScene(); + fnt->SetColor(0xFFFFFFFF); + rbPanelFont.UpdateString(L" FPS: %.2f",hge->Timer_GetFPSf()); + rbPanelFont.Render(785,595,0xFFFFFFFF,1); + if (Current_Position==1||Current_Position==2) + { + rbPanelFont.UpdateString(L"AF: %.2f",averfps); + rbPanelFont.Render(785,575,0xFFFFFFFF,1); + if (playerpos.x<220&&playerpos.y<200) + { + if (!LOWFPS&&infofade>=0x33)--infofade; + if (LOWFPS&&infofade>0x33)infofade-=16; + } + else + { + if (!LOWFPS&&infofade<0xFF)++infofade; + if (LOWFPS&&infofade<=0xEF)infofade+=16; + } + if(hge->Input_GetKeyStateEx(HGEK_A)==HGEKST_HIT)showdebug^=1; + if(showdebug) + { + fnt->SetColor(0xFFFFFFFF); + fnt->printf(795, 0, HGETEXT_RIGHT, "Allocated bullets %d",bulcnt); + fnt->printf(795, 25, HGETEXT_RIGHT, bulcnt?"%d in use (%.2f%%)":"%d in use (?%)",bulinuse,(double)bulinuse/bulcnt); + fnt->printf(795, 50, HGETEXT_RIGHT, "Player pos (%.2f,%.2f)",playerpos.x,playerpos.y); + } + fnt->SetColor(SETA(0xFFFFFF,infofade)); + fnt->printf(5, 0, HGETEXT_LEFT, "Frames to go: %d",frameleft); + fnt->printf(5, 25, HGETEXT_LEFT, "Score: %lld",score); + fnt->printf(5, 50, HGETEXT_LEFT, "Level %d",level); + if (mode==3) + fnt->printf(5, 75, HGETEXT_LEFT, "Collisions: %d",coll); + else if (mode==2) + fnt->printf(5, 75, HGETEXT_LEFT, "Elapsed Time: %.2lf",assetime); + else + fnt->printf(5, 75, HGETEXT_LEFT, "Restarts: %d",restarts); + fnt->printf(5, 100, HGETEXT_LEFT, "Semi-Collisions: %d",semicoll); + if(mode==2) + fnt->printf(5, 125, HGETEXT_LEFT, "Multiplier: %.2lf",mult); + else + { + fnt->printf(5, 125, HGETEXT_LEFT, "Clear Range Left: %d",clrtime+clrbns); + fnt->printf(5, 150, HGETEXT_LEFT, "Multiplier: %.2lf",mult); + } + } + hge->Gfx_EndScene(); + if(hge->Input_GetKeyStateEx(HGEK_S)==HGEKST_HIT&&Current_Position!=7)hge->System_Snapshot(); + return false; +} +void printHelp(char *exec,const char* str="") +{ + printf("Usage: %s [options]...\n",exec); + puts("To run the game normally, just start without arguments."); + puts("Options:"); + puts("--help Print this help and exit."); + puts("--version Print version and exit."); + puts("--start=x,y Start free play mode directly from level x part y. The part must be valid."); + puts("--nosound Forcibly use no sound."); + puts("--fullscreen=1/0 Forcibly use fullscreen/windowed. This will override your configuration."); + puts("--vidmode=0~4 Forcibly use specific video mode instead the one in the configuration."); + puts(" 0 800x600 (native resolution)"); + puts(" 1 640x480"); + puts(" 2 960x720"); + puts(" 3 1024x768"); + puts(" 4 1280x960"); + puts("--firststartup Forcibly run first start up. The score file will be preserved if exist."); + puts("--fast Fast mode. All levels are two times shorter."); + puts("--logfile=... Use an alternate log file name instead of the default \"BLRLOG.txt\"."); +#ifdef WIN32 + puts("--nohideconsole Do not hide console.\n"); +#endif + if(strcmp(str,""))printf("%s\n",str); + exit(0); +} +void parseArgs(int argc,char *argv[]) +{ + for(int i=1;i<argc;++i) + { + if(!strcmp(argv[i],"--help"))printHelp(argv[0]); + if(!strcmp(argv[i],"--version")) + { + printf("Bullet Lab Remix II %s\n",BLRVERSION); + printf("Built Date: %s\n",BuiltDate); + exit(0); + } + bool valid=false; + if(!strcmp(argv[i],"--nosound"))fNoSound=true,valid=true; + if(!strcmp(argv[i],"--fast"))fFast=true,valid=true; + if(!strcmp(argv[i],"--firststartup"))fFristStartUp=true,valid=true; + if(!strncmp(argv[i],"--fullscreen",12)) + { + char *ptr=argv[i];while(*ptr!='='&&*ptr)++ptr; + if(!*ptr)printHelp(argv[0],"--fullscreen need a parameter!\n"); + ++ptr; + int para=strtol(ptr,&ptr,10); + if(*ptr||(para!=1&¶!=0))printHelp(argv[0],"Invalid parameter for --fullscreen!\n"); + if(para)fFullScreen=2;else fFullScreen=1; + valid=true; + } + if(!strncmp(argv[i],"--vidmode",9)) + { + char *ptr=argv[i];while(*ptr!='='&&*ptr)++ptr; + if(!*ptr)printHelp(argv[0],"--vidmode need a parameter!\n"); + ++ptr; + int para=strtol(ptr,&ptr,10); + if(*ptr||(para<0||para>4))printHelp(argv[0],"Invalid parameter for --vidmode!\n"); + if(para)VidMode=para; + valid=true; + } + if(!strncmp(argv[i],"--start",7)) + { + char *ptr=argv[i];while(*ptr!='='&&*ptr)++ptr; + if(!*ptr)printHelp(argv[0],"--start need two parameters!"); + ++ptr;startLvl=strtol(ptr,&ptr,10); + if(*ptr!=',')printHelp(argv[0],"Invalid parameter for --start!\n"); + ++ptr;startPrt=strtol(ptr,&ptr,10); + if(*ptr)printHelp(argv[0],"Invalid parameter for --start!\n"); + valid=true; + } + if(!strncmp(argv[i],"--logfile",9)) + { + char *ptr=argv[i];while(*ptr!='='&&*ptr)++ptr; + if(!*ptr)printHelp(argv[0],"--logfile need a parameter!"); + ++ptr;strcpy(alterLog,ptr); + valid=true; + } +#ifdef WIN32 + if(!strncmp(argv[i],"--nohideconsole",15))noHideConsole=true,valid=true; +#endif + if(!valid) + { + char err[256];sprintf(err,"Unknown option: %s\n",argv[i]); + printHelp(argv[0],err); + } + } +} +int main(int argc,char *argv[]) +{ + signal(SIGSEGV,SigHandler); + parseArgs(argc,argv); +#ifdef WIN32 + if(!noHideConsole)FreeConsole(); +#endif + srand(time(NULL)); + hge=hgeCreate(HGE_VERSION); + if(alterLog[0]) + hge->System_SetState(HGE_LOGFILE, alterLog); + else + hge->System_SetState(HGE_LOGFILE, "BLRLOG.txt"); + hge->System_Log("%s: Bullet Lab Remix Log File",MAIN_SRC_FN); +#ifdef WIN32 +#ifdef MINGW_BUILD + hge->System_Log("%s: Build: MinGW_w64 cross build",MAIN_SRC_FN); +#else + hge->System_Log("%s: Build: Win32 build",MAIN_SRC_FN); +#endif +#else + hge->System_Log("%s: Build: Unix build",MAIN_SRC_FN); +#endif + hge->System_Log("%s: Version: %s",MAIN_SRC_FN,BLRVERSION); + hge->System_Log("%s: Built Date: %s",MAIN_SRC_FN,BuiltDate); +#ifdef WIN32 + if (_mkdir("./Resources")!=0||_mkdir("./Resources/Music")!=0) + Error("Cannot decompress resources!\nDetailed Information: An error occured while creating folder.\n\nTry restarting the game."); + hge->System_Log("%s: Folders created successfully.",MAIN_SRC_FN); + Expand("BLRData.dtp","Resources"); + Expand("BLRMusic.dtp","Resources/Music"); + hge->System_Log("%s: Resources decompressed successfully.",MAIN_SRC_FN); +#endif + hge->System_SetState(HGE_FRAMEFUNC, FrameFunc); + hge->System_SetState(HGE_FOCUSLOSTFUNC, Foclost); + hge->System_SetState(HGE_DONTSUSPEND, true); + hge->System_SetState(HGE_TITLE, "Bullet Lab Remix"); + hge->System_SetState(HGE_WINDOWED, true); + hge->System_SetState(HGE_SCREENWIDTH, 800); + hge->System_SetState(HGE_SCREENHEIGHT, 600); + hge->System_SetState(HGE_SCREENBPP, 32); + if(fNoSound)hge->System_SetState(HGE_USESOUND,false); +#ifdef WIN32 + hge->System_SetState(HGE_ICON, MAKEINTRESOURCE(1)); +#endif + if((access(".blrrc",R_OK))==-1) + { + hge->System_Log("%s: Config file not found. Calling first startup.",MAIN_SRC_FN); + firststartup(); + } + if(fFristStartUp)firststartup(); + hge->System_Log("%s: Loading config file",MAIN_SRC_FN); + freopen(".blrrc","r",stdin); + char tch=getchar(); + if (tch!=';'){} + tch=getchar(); + if (tch!='C'){} + tch=getchar(); + if (tch!='B'){} + tch=getchar(); + if (tch!='L'){} + fpslvl=0; + LOWFPS=true;//always LowFPS, deprecate 1000 FPS mode... + hge->System_SetState(HGE_FPS,61); + tch=getchar();//VSync + if (tch==1) + { + hge->System_SetState(HGE_FPS,HGEFPS_VSYNC); + fpslvl=2; + } + if(fFast)TenSeconds/=2,TwentySeconds/=2,ThirtySeconds/=2,AMinute/=2; + tch=getchar();//FULLSCRREEN + tfs=false; + if (tch==1) + hge->System_SetState(HGE_WINDOWED, false),tfs=true; + if(fFullScreen==2)hge->System_SetState(HGE_WINDOWED, false),tfs=true; + if(fFullScreen==1)hge->System_SetState(HGE_WINDOWED, true),tfs=false; + tch=getchar();//resolution + if(VidMode==-1)VidMode=tch; + switch(VidMode) + { + case 0:break; + case 1: + hge->System_SetState(HGE_SCREENWIDTH, 640); + hge->System_SetState(HGE_SCREENHEIGHT, 480); + break; + case 2: + hge->System_SetState(HGE_SCREENWIDTH, 960); + hge->System_SetState(HGE_SCREENHEIGHT, 720); + break; + case 3: + hge->System_SetState(HGE_SCREENWIDTH, 1024); + hge->System_SetState(HGE_SCREENHEIGHT, 768); + break; + case 4: + hge->System_SetState(HGE_SCREENWIDTH, 1280); + hge->System_SetState(HGE_SCREENHEIGHT, 960); + break; + } + scale=VidMode?VidMode==1?0.8:VidMode==2?1.2:VidMode==3?1.28:VidMode==4?1.6:0:1; +#ifndef WIN32 + yos=VidMode?VidMode==1?120:VidMode==2?-120:VidMode==3?-168:VidMode==4?-360:0:0; +#endif + tch=getchar();//Key binding + if (tch==1)diffkey=true; + bgmvol=getchar();sfxvol=getchar(); + plrspd=tch=getchar(); + playerfulspd=(tch)*0.08f; + playerspeed=playerfulspd; + plrslospd=tch=getchar(); + playerfulslospd=(tch)*0.02f; + playerslospeed=playerfulslospd; + tch=getchar(); + clrbns=tch; + tch=getchar(); + clrmode=tch; + fclose(stdin); + if (AP_Update(plrspd,plrslospd,clrbns)>10000)Error("Invalid configuration!\nTry removing .blrrc and run the game again."); + hge->System_Log("%s: Loading Score file",MAIN_SRC_FN); + Score_Init(); +#ifdef Debug + playerspeed=playerfulspd=0.2; + playerslospeed=playerfulslospd=0.05; +#endif + Current_Position=0; + LE_Active=false; + if(hge->System_Initiate()) + { + hge->System_Log("%s: Loading Resources...",MAIN_SRC_FN); + quad.tex=hge->Texture_Load("./Resources/b_null.png"); + SprSheet=hge->Texture_Load("./Resources/ss.png"); + TLeaf=hge->Texture_Load("./Resources/e_leaf.png"); + TSflake=hge->Texture_Load("./Resources/e_sflake.png"); + TexTitle=hge->Texture_Load("./Resources/title.png"); + TexCredits=hge->Texture_Load("./Resources/credits.png"); + MenuTex=hge->Texture_Load("./Resources/menus.png"); + HelpTex=hge->Texture_Load("./Resources/help.png"); + sky.Init(); + snd=hge->Effect_Load("./Resources/tap.ogg"); + menumov=hge->Effect_Load("./Resources/tap.ogg"); + menuin=hge->Effect_Load("./Resources/tap.ogg"); + menuout=hge->Effect_Load("./Resources/tap.ogg"); + if(!quad.tex||!SprSheet||!TexTitle||!TexCredits) + Error("Error Loading Resources!",true); + titlespr=new hgeSprite(TexTitle,0,0,640,320); + playerspr=new hgeSprite(SprSheet,0,24,24,24); + playerspr->SetHotSpot(12,12); + playerspr->SetColor(0xC0FFFFFF); + ATarg.Init(-0.001,vector2d(400,300)); + BTarg.Init(-0.001,vector2d(400,300)); + BTarg.targspr->SetColor(0xFFC00000); + quad.blend=BLEND_ALPHABLEND | BLEND_COLORMUL | BLEND_NOZWRITE; + DBGColor=0xFFFFFFFF; + for(int i=0;i<4;i++) + { + quad.v[i].z=0.5f; + quad.v[i].col=DBGColor; + } + 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->System_Log("%s: Loading Fonts...",MAIN_SRC_FN); +#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)) + 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"); + TipFont=new hgeFont("./Resources/charmap.fnt"); + MultFnt=new hgeFont("./Resources/charmap.fnt"); + vdig=new hgeFont("./Resources/vdig.fnt"); + bdig=new hgeFont("./Resources/bdig.fnt"); + fnt->SetScale(0.8); + MenuFont->SetScale(0.8); + TipFont->SetScale(0.8); + MultFnt->SetScale(0.8); + spr=new hgeSprite(SprSheet,216,0,24,24); + Credits=new hgeSprite(TexCredits,0,0,600,200); + CreditsRail=new hgeSprite(TexCredits,0,2400,600,200); + Helpspr=new hgeSprite(HelpTex,0,0,800,400); + NHelpspr=new hgeSprite(HelpTex,0,0,800,400); + HlpL=new hgeSprite(MenuTex,256,320,26,15); + HlpR=new hgeSprite(MenuTex,256,335,26,15); + for (int ii=0;ii<COLOR_COUNT;++ii) + { + TColors i=(TColors)ii; + TextureRect a=GetTextureRect(0,i); + bulletspr[i]=new hgeSprite(SprSheet,a.x,a.y,a.w,a.h); + bulletspr[i]->SetHotSpot(12,12);bulletspr[i]->SetColor(0x80FFFFFF); + } + for (int ii=0;ii<grey;++ii) + { + TColors i=(TColors)ii; + TextureRect a=GetTextureRect(1,i); + towerspr[i]=new hgeSprite(SprSheet,a.x,a.y,a.w,a.h); + towerspr[i]->SetHotSpot(22,22);bulletspr[i]->SetColor(0x80FFFFFF); + } + mainMenu.Init_Once();if(!startLvl)mainMenu.Init(-200); + startMenu.Init_Once();optionMenu.Init_Once(); + pauseMenu.Init_Once();returnToTitleMenu.Init_Once(); + deathMenu.Init_Once();completeMenu.Init_Once(); + playerPreferenceMenu.Init_Once();highScoreMenu.Init_Once(); + highScoreViewMenu.Init_Once();highScoreDetailsMenu.Init_Once(); + if(fNoSound)hge->System_Log("%s: Sound is disabled.",MAIN_SRC_FN); + if(startLvl) + { + 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;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/BLR2_TR07.ogg"); + lpst=0;lped=0;Music_Play(); + coll=semicoll=clrusg=0;playerLockX=playerLockY=false; + Lock.Init(2);IfShowTip=true;lsc=0; + clrrad=pi/2;clrrange=0;re.SetSeed(time(NULL)); + memset(tower,0,sizeof(tower)); + Complete=false;Current_Position=1; + IfCallLevel=true; + mode=3; + } + hge->System_Start(); + delete titlespr;delete fnt; + delete playerspr;delete spr; + for (int ii=0;ii<COLOR_COUNT;++ii) + { + TColors i=(TColors)ii; + delete bulletspr[i]; + if(i<grey)delete towerspr[i]; + } + hge->Effect_Free(snd);hge->Effect_Free(menuin); + hge->Effect_Free(menuout);hge->Effect_Free(menumov); + 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(); +#ifdef WIN32 + for(int i=0;i<arFilecount;++i)remove(archive[i]); + _rmdir("./Resources/Music"); + _rmdir("./Resources"); +#endif + return 0; +} diff --git a/archive/blr2/src/menus.h b/archive/blr2/src/menus.h new file mode 100644 index 0000000..30d8b0a --- /dev/null +++ b/archive/blr2/src/menus.h @@ -0,0 +1,1536 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Menu Implementations +// Copyright Chrisoft 2014 +// The menu rewrite is almost complete... +//static const char* MENUS_H_FN="menus.h"; +void TriggerSound(int type) +{ + switch(type) + { + case 0:hge->Effect_PlayEx(menumov,sfxvol/15.0,0,1,false);break; + case 1:hge->Effect_Play(menuin);break; + case 2:hge->Effect_Play(menuout);break; + } +} +void ConfigureQuad(hgeQuad *quad,double x,double y,double w,double h) +{ + quad->tex=0;quad->blend=BLEND_ALPHABLEND; + 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; + quad->v[0].x=x;quad->v[0].y=y; + quad->v[1].x=x+w;quad->v[1].y=y; + quad->v[2].x=x+w;quad->v[2].y=y+h; + quad->v[3].x=x;quad->v[3].y=y+h; +} +int AP_Update(int plrspd,int plrslospd,int clrbns) +{ + int res=0; + if (plrspd<=4)res+=plrspd*1200;else res+=5000; + switch (plrslospd) + { + case 1:res+=4000;break; + case 2:res+=3200;break; + case 3:res+=2000;break; + case 4:res+=1500;break; + case 5:res+=700;break; + } + switch (clrbns) + { + case 0:break; + case 1:res+=1500;break; + case 2:res+=2700;break; + case 3:res+=4000;break; + case 4:res+=5500;break; + } + return res; +} +void Options_Writeback() +{ + freopen(".blrrc","w",stdout); + printf(";CBL"); + printf("%c",fpslvl==2?1:0); + printf("%c",tfs?1:0); + printf("%c",VidMode); + printf("%c",diffkey?1:0); + printf("%c%c",bgmvol,sfxvol); + printf("%c%c%c%c",plrspd,plrslospd,clrbns,clrmode); + fclose(stdout); +} +char *getRank() +{ + static char retval[256]; + //sprintf something to retval + if(mode!=2) + { + if(level<=6)sprintf(retval,"Still need more effort!"); + if(level<=3)sprintf(retval,"Try more..."); + if(level==7)sprintf(retval,"You've done it!"); + if(level==-1)sprintf(retval,"Why do you come to Earth?"); + } + else + { + if(asts>900)sprintf(retval,"Contact me immediately!!"); + if(asts<=900)sprintf(retval,"Perfect player."); + if(asts<=600)sprintf(retval,"That's awesome."); + if(asts<=450)sprintf(retval,"Not so bad..."); + if(asts<=120)sprintf(retval,"Are you kidding?"); + } + return retval; +} +static const char* MMStr[]={ + "Start", + "Highscore", + "Options", + "Help", + "About", + "Exit" +}; +static const char* OMStr[]={ + "Fullscreen", + "VSync", + "Clear Range Key", + "Resolution", + "Music Volume", + "SFX Volume", + "Player Preference", + "Save and Exit", + "On", + "Off", + "X", + "Z", + "800x600", + "640x480", + "960x720", + "1024x768", + "1280x960", + "?" +}; +static const char *PPMStr[]={ + "Moving Speed", + "Precise Moving Speed", + "Clear Range Bonus", + "Clear Range Mode", + "Ability Point", + "Back", + "Expand", + "Rotate" +}; +static const char *PMStr[]={ + "Paused...", + "Return to Game", + "Return to Title" +}; +static const char *RTTMStr[]={ + "Really?", + "I've pressed the wrong key...", + "Do return to title!" +}; +static const char *DMStr[]={ + "Continue? You score will be set to minus!", + "Continue!", + "No thanks..." +}; +static const char *CMStr[]={ + "Keep this in your highscore record?", + "Yes", + "No thanks..." +}; +static const char *HSMStr[]={ + "Classic Mode", + "Assessment Mode", + "Free Play Mode", + "Back" +}; +class MainMenu +{ +private: + bool active,onIn,onOut; + int selected; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + xoffset=start;onIn=true;active=true; + selected=0;dyoffset=yoffset=-selected*30; + ConfigureQuad(&UpperGradient,xoffset-140,250,320,100); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,420,320,110); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + if(DBGColor!=0xFF0A0A0A) + { + for(int i=0;i<6;++i)DBGColor=ColorTransfer(DBGColor,0xFF0A0A0A); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + if(onIn) + { + if(fabs(xoffset-650)<hge->Timer_GetDelta()*1600)return xoffset=650,onIn=false,-1; + if(xoffset<650) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,250,320,100); + ConfigureQuad(&LowerGradient,xoffset-140,420,320,110); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<6-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=5,TriggerSound(0); + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(selected==4?2:1),selected; + return -1; + } + void Render() + { + for(int i=0;i<6;++i) + { + double calcy=i*30+dyoffset+360; + if(calcy>249.9&&calcy<500.1) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,MMStr[i]); + } + Ribb->RenderEx(xoffset-50,355,0,3,1); + Ribb->RenderEx(xoffset-50,382,0,3,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + } +}mainMenu; +class StartMenu +{ +private: + bool active,onIn,onOut; + double xoffset,yoffset,moffset; + int selected; + hgeQuad LeftGradient,RightGradient,LowerGradient; + hgeSprite *clzk,*azmt,*fpmd,*msel; +public: + bool isActive(){return active;} + void Init_Once() + { + clzk=new hgeSprite(MenuTex,0,0,256,128); + azmt=new hgeSprite(MenuTex,256,0,256,128); + fpmd=new hgeSprite(MenuTex,0,128,256,128); + msel=new hgeSprite(MenuTex,256,128,256,64); + clzk->SetHotSpot(128,64); + azmt->SetHotSpot(128,64); + fpmd->SetHotSpot(128,64); + } + void Init() + { + active=true;onIn=true;yoffset=275; + selected=0;xoffset=-selected*300;moffset=450; + ConfigureQuad(&LowerGradient,0,400+yoffset,800,120); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + ConfigureQuad(&LeftGradient,0,320+yoffset,100,200); + LeftGradient.v[0].col=LeftGradient.v[3].col=SETA(DBGColor,0xFF); + LeftGradient.v[1].col=LeftGradient.v[2].col=SETA(DBGColor,0x00); + ConfigureQuad(&RightGradient,700,320+yoffset,100,200); + RightGradient.v[0].col=RightGradient.v[3].col=SETA(DBGColor,0x00); + RightGradient.v[1].col=RightGradient.v[2].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + LeftGradient.v[0].col=LeftGradient.v[3].col=SETA(DBGColor,0xFF); + LeftGradient.v[1].col=LeftGradient.v[2].col=SETA(DBGColor,0x00); + RightGradient.v[0].col=RightGradient.v[3].col=SETA(DBGColor,0x00); + RightGradient.v[1].col=RightGradient.v[2].col=SETA(DBGColor,0xFF); + if(onIn) + { + bool alldone=true; + if(fabs(yoffset-0)<hge->Timer_GetDelta()*800) + yoffset=0; + else + alldone=false,yoffset-=hge->Timer_GetDelta()*800; + if(fabs(moffset-0)<hge->Timer_GetDelta()*1200) + moffset=0; + else alldone=false,moffset-=hge->Timer_GetDelta()*1200; + if(alldone)onIn=false; + } + if(onOut) + { + bool alldone=true; + if(fabs(yoffset-275)<hge->Timer_GetDelta()*800) + yoffset=275; + else + alldone=false,yoffset+=hge->Timer_GetDelta()*800; + if(fabs(moffset-450)<hge->Timer_GetDelta()*1200) + moffset=450; + else alldone=false,moffset+=hge->Timer_GetDelta()*800; + if(alldone)onOut=active=false; + } + if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); + if(fabs(xoffset-(-selected*300))<hge->Timer_GetDelta()*1000) + xoffset=-selected*300; + else + { + if(xoffset<-selected*300)xoffset+=hge->Timer_GetDelta()*1000; + if(xoffset>-selected*300)xoffset-=hge->Timer_GetDelta()*1000; + } + ConfigureQuad(&LowerGradient,0,400+yoffset,800,120); + ConfigureQuad(&LeftGradient,0,320+yoffset,100,200); + ConfigureQuad(&RightGradient,700,320+yoffset,100,200); + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)TriggerSound(2); + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(1),selected; + return -1; + } + void Render() + { + clzk->Render(400+xoffset,fabs((xoffset+0))*0.075+400+yoffset); + azmt->Render(700+xoffset,fabs((xoffset+300))*0.075+400+yoffset); + fpmd->Render(1000+xoffset,fabs((xoffset+600))*0.075+400+yoffset); + hge->Gfx_RenderQuad(&LowerGradient); + hge->Gfx_RenderQuad(&LeftGradient); + hge->Gfx_RenderQuad(&RightGradient); + msel->Render(0,moffset+200); + } +}startMenu; +class OptionsMenu +{ +private: + bool active,onIn,onOut,onSwitch,onSwitchi; + int selected; + double xoffset,yoffset,dyoffset,swoffset,moffset; + hgeSprite *Ribb,*optt; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + optt=new hgeSprite(MenuTex,256,192,256,64); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + xoffset=start;onIn=active=true;onSwitch=onSwitchi=false; + selected=0;dyoffset=yoffset=-selected*30;moffset=350; + ConfigureQuad(&UpperGradient,xoffset-140,250,500,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,430,500,100); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + if(onIn) + { + bool alldone=true; + if(fabs(xoffset-450)<hge->Timer_GetDelta()*1600)xoffset=450;else + { + alldone=false; + if(xoffset<450) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(fabs(moffset-0)<hge->Timer_GetDelta()*1200) + moffset=0; + else alldone=false,moffset-=hge->Timer_GetDelta()*1200; + if(alldone)return onIn=false,-1; + } + if(onOut) + { + bool alldone=true; + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset<850)alldone=false; + if(fabs(moffset-450)<hge->Timer_GetDelta()*1200) + moffset=450; + else alldone=false,moffset+=hge->Timer_GetDelta()*800; + if(alldone)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,250,500,100); + ConfigureQuad(&LowerGradient,xoffset-140,430,500,100); + if(!onSwitch) + { + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<8-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=7,TriggerSound(0); + } + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT)return -1; + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + { + if(selected==7&&!(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT)) + return -1; + TriggerSound(selected==7?2:0); + if(onSwitch||onSwitchi)return -1; + if(selected<=5) + { + onSwitch=true; + swoffset=100; + } + if(selected==0)tfs=!tfs; + if(selected==1) + { + fpslvl=fpslvl==2?0:2; + if(fpslvl==2)hge->System_SetState(HGE_FPS,HGEFPS_VSYNC); + if(fpslvl==0)hge->System_SetState(HGE_FPS,61); + } + if(selected==2)diffkey=!diffkey; + if(selected==3) + { + ++VidMode; + if(VidMode>4)VidMode=0; + } + if(selected==4) + { + ++bgmvol; + if(bgmvol>15)bgmvol=0; + } + if(selected==5) + { + ++sfxvol; + if(sfxvol>15)sfxvol=0; + } + return selected; + } + if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT) + { + if(onSwitch||onSwitchi)return -1; + TriggerSound(0); + if(selected<=5){onSwitchi=true;swoffset=0;} + if(selected==0)tfs=!tfs; + if(selected==1) + { + fpslvl=fpslvl==2?0:2; + if(fpslvl==2)hge->System_SetState(HGE_FPS,HGEFPS_VSYNC); + if(fpslvl==0)hge->System_SetState(HGE_FPS,61); + } + if(selected==2)diffkey=!diffkey; + if(selected==3) + { + --VidMode; + if(VidMode<0)VidMode=4; + } + if(selected==4) + { + --bgmvol; + if(bgmvol<0)bgmvol=15; + } + if(selected==5) + { + --sfxvol; + if(sfxvol<0)sfxvol=15; + } + return selected; + } + return -1; + } + void Render() + { + for(int i=0;i<8;++i) + { + double calcy=i*30+dyoffset+360; + if(calcy>249.9&&calcy<500.1) + { + MenuFont->SetColor(0xFFFFFFFF); + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,OMStr[i]); + if(i==0) + { + if(!(onSwitch||onSwitchi)||selected!=0) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,OMStr[tfs?8:9]); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?9:8]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?8:9]); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?8:9]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[tfs?9:8]); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==1) + { + if(!(onSwitch||onSwitchi)||selected!=1) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?8:9]); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?9:8]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?8:9]); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?8:9]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[fpslvl==2?9:8]); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==2) + { + if(!(onSwitch||onSwitchi)||selected!=2) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,OMStr[diffkey?10:11]); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?11:10]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?10:11]); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?10:11]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,OMStr[diffkey?11:10]); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==3) + { + if(!(onSwitch||onSwitchi)||selected!=3) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode+12]:OMStr[17]); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode==0?16:VidMode+11]:OMStr[17]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode+12]:OMStr[17]); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode+12]:OMStr[17]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,VidMode>=0&&VidMode<=4?OMStr[VidMode==4?12:VidMode+13]:OMStr[17]); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==4) + { + if(!(onSwitch||onSwitchi)||selected!=4) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",bgmvol); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",bgmvol==0?15:bgmvol-1); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",bgmvol); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",bgmvol); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",bgmvol==15?0:bgmvol+1); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==5) + { + if(!(onSwitch||onSwitchi)||selected!=5) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",sfxvol); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",sfxvol==0?15:sfxvol-1); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",sfxvol); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",sfxvol); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",sfxvol==15?0:sfxvol+1); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + } + } + Ribb->RenderEx(xoffset-50,353,0,6,1); + Ribb->RenderEx(xoffset-50,380,0,6,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + optt->Render(300,moffset+300); + } +}optionMenu; +class PlayerPreferenceMenu +{ +private: + bool active,onIn,onOut,onSwitch,onSwitchi; + int selected; + double xoffset,yoffset,dyoffset,swoffset,moffset; + double shaketime,shakeoffset,shakedelay; + hgeSprite *Ribb,*optt; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + optt=new hgeSprite(MenuTex,0,256,256,64); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + xoffset=start;onIn=active=true;onSwitch=onSwitchi=false; + selected=0;dyoffset=yoffset=-selected*30;moffset=350;shaketime=0; + ConfigureQuad(&UpperGradient,xoffset-140,250,520,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,430,520,100); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + void Shake(){shaketime=0.2;shakeoffset=10;shakedelay=0.033;} + int Update() + { + if(onIn) + { + bool alldone=true; + if(fabs(xoffset-430)<hge->Timer_GetDelta()*1600)xoffset=430;else + { + alldone=false; + if(xoffset<430) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(fabs(moffset-0)<hge->Timer_GetDelta()*1200) + moffset=0; + else alldone=false,moffset-=hge->Timer_GetDelta()*1200; + if(alldone)return onIn=false,-1; + } + if(onOut) + { + bool alldone=true; + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset<850)alldone=false; + if(fabs(moffset-450)<hge->Timer_GetDelta()*1200) + moffset=450; + else alldone=false,moffset+=hge->Timer_GetDelta()*800; + if(alldone)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,250,520,100); + ConfigureQuad(&LowerGradient,xoffset-140,430,520,100); + if(!onSwitch) + { + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0) + TriggerSound(0),--selected==4?--selected:0; + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<6-1) + TriggerSound(0),++selected==4?++selected:0; + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)TriggerSound(0),selected=5; + } + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT&&hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT)return -1; + if(hge->Input_GetKeyStateEx(HGEK_RIGHT)==HGEKST_HIT) + { + TriggerSound(1); + if(onSwitch||onSwitchi)return -1; + if(selected<=3) + { + onSwitch=true; + swoffset=100; + } + if(selected==0)++plrspd>5?plrspd=1:0; + if(selected==1)++plrslospd>5?plrslospd=1:0; + if(selected==2)++clrbns>4?clrbns=0:0; + if(selected==3)clrmode=!clrmode; + if(selected<=3)return selected; + } + if(hge->Input_GetKeyStateEx(HGEK_LEFT)==HGEKST_HIT) + { + TriggerSound(1); + if(onSwitch||onSwitchi)return -1; + if(selected<=3){onSwitchi=true;swoffset=0;} + if(selected==0)--plrspd<1?plrspd=5:0; + if(selected==1)--plrslospd<1?plrslospd=5:0; + if(selected==2)--clrbns<0?clrbns=4:0; + if(selected==3)clrmode=!clrmode; + if(selected<=3)return selected; + } + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(selected==5?2:1),selected; + return -1; + } + void Render() + { + for(int i=0;i<6;++i) + { + double calcy=i*30+dyoffset+360; + if(calcy>249.9&&calcy<500.1) + { + MenuFont->SetColor(0xFFFFFFFF); + MenuFont->printf(xoffset-50,calcy,HGETEXT_LEFT,PPMStr[i]); + if(i==0) + { + if(!(onSwitch||onSwitchi)||selected!=0) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",plrspd); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd==1?5:plrspd-1); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrspd==5?1:plrspd+1); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==1) + { + if(!(onSwitch||onSwitchi)||selected!=1) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",plrslospd); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd==1?5:plrslospd-1); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",plrslospd==5?1:plrslospd+1); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==2) + { + if(!(onSwitch||onSwitchi)||selected!=2) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,"%d",clrbns); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns==0?4:clrbns-1); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,"%d",clrbns==4?0:clrbns+1); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==3) + { + if(!(onSwitch||onSwitchi)||selected!=3) + MenuFont->printf(xoffset+200,calcy,HGETEXT_LEFT,PPMStr[clrmode?7:6]); + else + { + if(onSwitch) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?6:7]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?7:6]); + swoffset-=hge->Timer_GetDelta()*400; + if(swoffset<0)swoffset=0,onSwitch=false; + } + if(onSwitchi) + { + MenuFont->SetColor(SETA(0xFFFFFF,255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+100+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?7:6]); + MenuFont->SetColor(SETA(0xFFFFFF,255.0f-255.0f*(swoffset/100.0f))); + MenuFont->printf(xoffset+200+swoffset,calcy,HGETEXT_LEFT,PPMStr[clrmode?6:7]); + swoffset+=hge->Timer_GetDelta()*400; + if(swoffset>100)swoffset=0,onSwitchi=false; + } + } + } + if(i==4) + { + if(shaketime>0) + { + shaketime-=hge->Timer_GetDelta(); + shakedelay-=hge->Timer_GetDelta(); + if(shakedelay<0) + {shakeoffset=-shakeoffset;shakedelay=0.033;} + if(shaketime<=0)shaketime=shakeoffset=0; + } + MenuFont->printf(xoffset+200+shakeoffset,calcy,HGETEXT_LEFT,"%d/10000",AP_Update(plrspd,plrslospd,clrbns)); + } + } + } + Ribb->RenderEx(xoffset-80,355,0,7,1); + Ribb->RenderEx(xoffset-80,382,0,7,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + optt->Render(125,moffset+300); + } +}playerPreferenceMenu; +class PauseMenu +{ +private: + bool active,onIn,onOut; + int selected; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + //special things to do.. + Music_Pause(); + Current_Position=11; + DisableAllTower=DisablePlayer=true; + xoffset=start;onIn=true;active=true; + selected=1;dyoffset=yoffset=-selected*30; + ConfigureQuad(&UpperGradient,xoffset-140,190,320,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,340,320,100); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){if(!onIn)onOut=true;} + int Update() + { + if(onIn) + { + if(fabs(xoffset-350)<hge->Timer_GetDelta()*1600)return xoffset=350,onIn=false,-1; + if(xoffset<350) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850) + { + active=onOut=false; + if(selected==1)Current_Position=1,DisableAllTower=DisablePlayer=false; + return -1; + } + } + ConfigureQuad(&UpperGradient,xoffset-140,190,320,100); + ConfigureQuad(&LowerGradient,xoffset-140,340,320,110); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(1),selected; + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT&&!onIn)return TriggerSound(1),1; + return -1; + } + void Render() + { + for(int i=0;i<3;++i) + { + double calcy=i*30+dyoffset+300; + if(calcy>189.9&&calcy<440.1) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,PMStr[i]); + } + Ribb->RenderEx(xoffset-50,295,0,4,1); + Ribb->RenderEx(xoffset-50,322,0,4,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + } +}pauseMenu; +class ReturnToTitleMenu +{ +private: + bool active,onIn,onOut; + int selected; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + xoffset=start;onIn=true;active=true; + selected=1;dyoffset=yoffset=-selected*30; + ConfigureQuad(&UpperGradient,xoffset-140,190,320,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,340,320,100); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + //The background color is likely on a change here... + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + if(onIn) + { + if(fabs(xoffset-350)<hge->Timer_GetDelta()*1600)return xoffset=350,onIn=false,-1; + if(xoffset<350) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,190,320,100); + ConfigureQuad(&LowerGradient,xoffset-140,340,320,110); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(1),selected; + return -1; + } + void Render() + { + for(int i=0;i<3;++i) + { + double calcy=i*30+dyoffset+300; + if(calcy>189.9&&calcy<440.1) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,RTTMStr[i]); + } + Ribb->RenderEx(xoffset-50,295,0,6.5,1); + Ribb->RenderEx(xoffset-50,322,0,6.5,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + } +}returnToTitleMenu; +class DeathMenu +{ +private: + bool active,onIn,onOut; + int selected; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb,*DeathTitle; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + DeathTitle=new hgeSprite(MenuTex,256,256,256,64); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + //Magical things, again... + Current_Position=5;Music_Stop(); + DisableAllTower=true;DisablePlayer=true; + xoffset=start;onIn=true;active=true; + selected=1;dyoffset=yoffset=-selected*30; + ConfigureQuad(&UpperGradient,xoffset-140,290,600,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,100); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + //The background color is likely on a change here... + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + if(onIn) + { + if(fabs(xoffset-300)<hge->Timer_GetDelta()*1600)return xoffset=300,onIn=false,-1; + if(xoffset<300) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,110); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(1),selected; + return -1; + } + void Render() + { + for(int i=0;i<3;++i) + { + double calcy=i*30+dyoffset+400; + if(calcy>289.9&&calcy<540.1) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,DMStr[i]); + } + Ribb->RenderEx(xoffset-50,395,0,3.75,1); + Ribb->RenderEx(xoffset-50,422,0,3.75,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + MenuFont->printf(xoffset-100,250,HGETEXT_LEFT,"You scored %lld at level %d",score,level); + MenuFont->printf(xoffset-100,280,HGETEXT_LEFT,"Average FPS: %lf\n",averfps); + DeathTitle->Render(xoffset-200,200); + } +}deathMenu; +class CompleteMenu +{ +private: + bool active,onIn,onOut; + int selected; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb,*CompleteTitle; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + CompleteTitle=new hgeSprite(MenuTex,0,320,256,64); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + //Magical things, again... + Current_Position=6;Music_Stop(); + DisableAllTower=true;DisablePlayer=true; + xoffset=start;onIn=true;active=true; + selected=1;dyoffset=yoffset=-selected*30; + ConfigureQuad(&UpperGradient,xoffset-140,390,600,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,540,600,100); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + //The background color is likely on a change here... + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + if(onIn) + { + if(fabs(xoffset-300)<hge->Timer_GetDelta()*1600)return xoffset=300,onIn=false,-1; + if(xoffset<300) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,390,600,100); + ConfigureQuad(&LowerGradient,xoffset-140,540,600,110); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<3-1)++selected,TriggerSound(0); + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(1),selected; + return -1; + } + void Render() + { + for(int i=0;i<3;++i) + { + double calcy=i*30+dyoffset+500; + if(calcy>389.9&&calcy<640.1) + MenuFont->printf(xoffset-100,calcy,HGETEXT_LEFT,CMStr[i]); + } + Ribb->RenderEx(xoffset-150,495,0,3.75,1); + Ribb->RenderEx(xoffset-150,522,0,3.75,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + if(~CheckHighScore()) + MenuFont->printf(xoffset-100,250,HGETEXT_LEFT,"New Highscore %lld!",score); + else + MenuFont->printf(xoffset-100,250,HGETEXT_LEFT,"Score %lld",score); + MenuFont->printf(xoffset-100,280,HGETEXT_LEFT,"Your Ranking: %s",getRank()); + if(mode==2) + { + MenuFont->printf(xoffset-100,310,HGETEXT_LEFT,"Time elapsed: %.2fs",((int)(asts*100))/100.0); + MenuFont->printf(xoffset-100,340,HGETEXT_LEFT,"Semi-collisions %d",semicoll); + MenuFont->printf(xoffset-100,370,HGETEXT_LEFT,"Average FPS: %.2f",averfps); + } + else + { + if(mode==1) + MenuFont->printf(xoffset-100,310,HGETEXT_LEFT,"Restarts %d",restarts); + else + MenuFont->printf(xoffset-100,310,HGETEXT_LEFT,"Collisions %d",coll); + MenuFont->printf(xoffset-100,340,HGETEXT_LEFT,"Semi-collisions %d",semicoll); + MenuFont->printf(xoffset-100,370,HGETEXT_LEFT,"CLR Usage %d",clrusg); + MenuFont->printf(xoffset-100,400,HGETEXT_LEFT,"Average FPS: %.2f",averfps); + } + CompleteTitle->Render(xoffset-200,200); + } +}completeMenu; +class NewHighScoreGUI +{ +private: + bool active,onIn,onOut,toogleundl; + double xoffset; + void nameins(char a) + { + if (newlen<=14) + newname[newlen++]=a; + } + void namedel() + { + if (newlen>0)newname[--newlen]=0; + } +public: + bool isActive(){return active;} + void Init() + { + Current_Position=7;active=true; + memset(newname,0,sizeof(newname));newlen=0;tbframebrk=0;toogleundl=false; + TipFont->SetColor(0xFFFFFFFF);xoffset=-500;onIn=true;onOut=false; + } + void Leave(){onOut=true;} + void Update() + { + if(onIn) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>0)xoffset=0,onIn=false; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>650)onOut=active=false; + } + int key=hge->Input_GetKey(); + if (key>=0x30&&key<=0x39)nameins('0'+key-0x30); + #ifdef WIN32 + if (key>=0x41&&key<=0x5A) + if (GetKeyState(VK_CAPITAL)&1)nameins('A'+key-0x41);else nameins('a'+key-0x41); + #else + if (key>=0x41&&key<=0x5A) + nameins('A'+key-0x41); + #endif + if (key==HGEK_SPACE)nameins('_'); + if (key==HGEK_BACKSPACE)namedel(); + if (key==HGEK_ENTER) + { + TriggerSound(1); + InsertHighScore();Leave(); + Current_Position=0;mainMenu.Init(-200); + /*switch (mode) + { + case 4:view=1;HSViewGUI_Init();break; + case 1:view=2;HSViewGUI_Init();break; + case 2:view=3;HSViewGUI_Init();break; + case 3:view=4;HSViewGUI_Init();break; + }*/ + } + } + void Render() + { + if (LOWFPS)tbframebrk+=17;else ++tbframebrk; + if (tbframebrk>=500)toogleundl=!toogleundl,tbframebrk=0; + TipFont->printf(200+xoffset,200,HGETEXT_LEFT,"Please Enter Your Honorable Name..."); + if (!toogleundl) + TipFont->printf(200+xoffset,240,HGETEXT_LEFT,"%s",newname); + else + TipFont->printf(200+xoffset,240,HGETEXT_LEFT,"%s_",newname); + } +}newHighScoreGUI; +class HighScoreMenu +{ +private: + bool active,onIn,onOut; + int selected; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb,*HSTitle; + hgeQuad UpperGradient,LowerGradient; +public: + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + HSTitle=new hgeSprite(MenuTex,0,376,256,64); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start) + { + xoffset=start;onIn=true;active=true; + selected=0;dyoffset=yoffset=-selected*30; + ConfigureQuad(&UpperGradient,xoffset-140,290,600,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,100); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + if(onIn) + { + if(fabs(xoffset-500)<hge->Timer_GetDelta()*1600)return xoffset=500,onIn=false,-1; + if(xoffset<500) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,110); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<4-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=4-1,TriggerSound(0); + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(selected==4-1?2:1),selected; + return -1; + } + void Render() + { + for(int i=0;i<4;++i) + { + double calcy=i*30+dyoffset+400; + if(calcy>289.9&&calcy<540.1) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,HSMStr[i]); + } + Ribb->RenderEx(xoffset-50,395,0,4.5,1); + Ribb->RenderEx(xoffset-50,422,0,4.5,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + HSTitle->Render(xoffset-250,300); + } +}highScoreMenu; +class HighScoreViewMenu +{ +private: + bool active,onIn,onOut; + int selected,view; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb; + hgeQuad UpperGradient,LowerGradient; +public: + int View(){return view;} + int GetViewCount(){return view==0?Ncnt:view==1?Excnt:view==2?FPMcnt:0;} + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start,int _v) + { + xoffset=start;onIn=true;active=true; + selected=1;dyoffset=yoffset=-selected*30;view=_v; + ConfigureQuad(&UpperGradient,xoffset-140,290,600,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,120); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + if(onIn) + { + if(fabs(xoffset-400)<hge->Timer_GetDelta()*1600)return xoffset=400,onIn=false,-1; + if(xoffset<400) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,120); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>1)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<7-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)selected=7-1,TriggerSound(0); + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(selected==7-1?2:1),selected; + return -1; + } + void Render() + { + if(dyoffset+400>289.9) + MenuFont->printf(xoffset,dyoffset+400,HGETEXT_LEFT,"Highscore - %s",HSMStr[view]); +#define WrapCnt \ + (view==0?Ncnt:view==1?Excnt:view==2?FPMcnt:0) +#define WrapRec\ + (view==0?NRec:view==1?ExRec:view==2?FPMRec:FPMRec) + for(unsigned i=1;i<=5;++i) + { + double calcy=i*30+dyoffset+400; + if(calcy>289.9&&calcy<540.1) + { + if(i<=WrapCnt) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,"%u. %s - %lld",i,WrapRec[i].name,WrapRec[i].score); + else MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,"%u. ----------",i); + } + } + double calcy=6*30+dyoffset+400; + if(calcy>289.9&&calcy<540.1) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,"back"); + Ribb->RenderEx(xoffset-50,395,0,7,1); + Ribb->RenderEx(xoffset-50,422,0,7,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + } +}highScoreViewMenu; +class HighScoreDetailsMenu +{ +private: + bool active,onIn,onOut; + int selected,view,no; + double xoffset,yoffset,dyoffset; + hgeSprite *Ribb,*HSTitle; + hgeQuad UpperGradient,LowerGradient; +public: + int View(){return view;} + bool isActive(){return active;} + void Init_Once() + { + Ribb=new hgeSprite(MenuTex,256,350,64,16); + HSTitle=new hgeSprite(MenuTex,0,448,256,64); + Ribb->SetColor(0xCCFFFFFF); + } + void Init(double start,int _v,int _n) + { + xoffset=start;onIn=true;active=true;no=_n; + selected=0;dyoffset=yoffset=-selected*30;view=_v; + ConfigureQuad(&UpperGradient,xoffset-140,290,600,50); + UpperGradient.v[0].col=UpperGradient.v[1].col=SETA(DBGColor,0xFF); + UpperGradient.v[2].col=UpperGradient.v[3].col=SETA(DBGColor,0x00); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,130); + LowerGradient.v[0].col=LowerGradient.v[1].col=SETA(DBGColor,0x00); + LowerGradient.v[2].col=LowerGradient.v[3].col=SETA(DBGColor,0xFF); + } + void Leave(){onOut=true;} + int Update() + { + if(onIn) + { + if(fabs(xoffset-400)<hge->Timer_GetDelta()*1600)return xoffset=400,onIn=false,-1; + if(xoffset<400) + xoffset+=hge->Timer_GetDelta()*1600; + else + xoffset-=hge->Timer_GetDelta()*1600; + } + if(onOut) + { + xoffset+=hge->Timer_GetDelta()*1600; + if(xoffset>=850)active=onOut=false; + } + ConfigureQuad(&UpperGradient,xoffset-140,290,600,100); + ConfigureQuad(&LowerGradient,xoffset-140,440,600,130); + if(hge->Input_GetKeyStateEx(HGEK_UP)==HGEKST_HIT&&selected>0)--selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_DOWN)==HGEKST_HIT&&selected<(view==1?6:7)-1)++selected,TriggerSound(0); + if(hge->Input_GetKeyStateEx(HGEK_ESCAPE)==HGEKST_HIT)TriggerSound(0),selected=(view==1?6:7)-1; + yoffset=-selected*30; + if(fabs(dyoffset-yoffset)<7)dyoffset=yoffset; + if(dyoffset<yoffset)dyoffset+=hge->Timer_GetDelta()*400; + if(dyoffset>yoffset)dyoffset-=hge->Timer_GetDelta()*400; + if(onIn||onOut)return -1; + if(hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT||hge->Input_GetKeyStateEx(HGEK_ENTER)==HGEKST_HIT) + return TriggerSound(selected==(view==1?5:7)-1?2:1),selected; + return -1; + } + void Render() + { +#define WrapCnt \ + (view==0?Ncnt:view==1?Excnt:view==2?FPMcnt:0) +#define WrapRec\ + (view==0?NRec:view==1?ExRec:view==2?FPMRec:FPMRec) + if(dyoffset+400>289.9) + MenuFont->printf(xoffset,dyoffset+400,HGETEXT_LEFT,"No. %d of %s",no,HSMStr[view]); + if(view==1) + { + if(dyoffset+430>289.9&&dyoffset+430<540.1) + MenuFont->printf(xoffset,dyoffset+430,HGETEXT_LEFT,"Scored %lld by %s",WrapRec[no].score,WrapRec[no].name); + if(dyoffset+460>289.9&&dyoffset+460<540.1) + MenuFont->printf(xoffset,dyoffset+460,HGETEXT_LEFT,"Time elapsed %.2fs",WrapRec[no].rescol/100.0); + if(dyoffset+490>289.9&&dyoffset+490<540.1) + MenuFont->printf(xoffset,dyoffset+490,HGETEXT_LEFT,"Semi-Collisions %d",WrapRec[no].scoll); + if(dyoffset+520>289.9&&dyoffset+520<540.1) + MenuFont->printf(xoffset,dyoffset+520,HGETEXT_LEFT,"Average FPS %d.%d",WrapRec[no].af_int,WrapRec[no].af_fric); + } + else + { + if(dyoffset+430>289.9&&dyoffset+430<540.1) + MenuFont->printf(xoffset,dyoffset+430,HGETEXT_LEFT,"Scored %lld by %s",WrapRec[no].score,WrapRec[no].name); + if(dyoffset+460>289.9&&dyoffset+460<540.1) + { + if(view==0) + MenuFont->printf(xoffset,dyoffset+460,HGETEXT_LEFT,"Restarts %d",WrapRec[no].rescol); + else + MenuFont->printf(xoffset,dyoffset+460,HGETEXT_LEFT,"Collisions %d",WrapRec[no].rescol); + } + if(dyoffset+490>289.9&&dyoffset+490<540.1) + MenuFont->printf(xoffset,dyoffset+490,HGETEXT_LEFT,"Semi-Collisions %d",WrapRec[no].scoll); + if(dyoffset+520>289.9&&dyoffset+520<540.1) + MenuFont->printf(xoffset,dyoffset+520,HGETEXT_LEFT,"CLR Usage %d",WrapRec[no].clrusg); + if(dyoffset+550>289.9&&dyoffset+550<540.1) + MenuFont->printf(xoffset,dyoffset+550,HGETEXT_LEFT,"Average FPS %d.%d",WrapRec[no].af_int,WrapRec[no].af_fric); + } + double calcy=(view==1?5:6)*30+dyoffset+400; + if(calcy>289.9&&calcy<540.1) + MenuFont->printf(xoffset,calcy,HGETEXT_LEFT,"back"); + Ribb->RenderEx(xoffset-50,395,0,6,1); + Ribb->RenderEx(xoffset-50,422,0,6,1); + hge->Gfx_RenderQuad(&UpperGradient); + hge->Gfx_RenderQuad(&LowerGradient); + HSTitle->Render(xoffset-250,300); + } +}highScoreDetailsMenu; diff --git a/archive/blr2/src/music.h b/archive/blr2/src/music.h new file mode 100644 index 0000000..ef09c41 --- /dev/null +++ b/archive/blr2/src/music.h @@ -0,0 +1,34 @@ +//Chrisoft Bullet Lab Remix HGE -*- C++ -*- +//In Game Music Implementations +//Copyright Chrisoft 2014 +HEFFECT Mus; +HCHANNEL Muc; +int lpst,lped; +//static const char* MUSIC_H_FN="music.h"; + +void Music_Init(const char* file) +{ + Mus=hge->Effect_Load(file); +} +void Music_Play() +{ + Muc=hge->Effect_PlayEx(Mus,bgmvol/15.0,0,1.0,true); +} +void Music_Update() +{ + if (!lpst||!lped)return; + int Mucpos=hge->Channel_GetPos_BySample(Muc); + if (Mucpos>=lped)hge->Channel_SetPos_BySample(Muc,lpst); +} +void Music_Stop() +{ + hge->Channel_Stop(Muc); +} +void Music_Pause() +{ + hge->Channel_Pause(Muc); +} +void Music_Resume() +{ + hge->Channel_Resume(Muc); +} diff --git a/archive/blr2/src/scorec.h b/archive/blr2/src/scorec.h new file mode 100644 index 0000000..abca9c6 --- /dev/null +++ b/archive/blr2/src/scorec.h @@ -0,0 +1,258 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Score Recording Implementations +// Copyright Chrisoft 2014 +//static const char* SCOREC_H_FN="scorec.h"; + +struct TRecord +{ + long long score; + int len,rescol,scoll,clrusg; + int af_int,af_fric; + char name[16]; +}ERec[10],NRec[10],ExRec[10],FPMRec[10]; +unsigned int Ecnt,Ncnt,Excnt,FPMcnt; +unsigned int header,seprt; +char newname[16]; +int newlen,tbframebrk; +unsigned int Getuint() +{ + unsigned int c1,c2,c3,c4,res; + c1=c2=c3=c4=0; + c1=getchar();c2=getchar();c3=getchar();c4=getchar(); + res=(c1<<24)+(c2<<16)+(c3<<8)+c4; + return res; +} +int Getint() +{ + return (int)Getuint(); +} +long long Getll() +{ + long long c1,c2,c3,c4,c5,c6,c7,c8,res; + c1=c2=c3=c4=c5=c6=c7=c8=0; + c1=getchar();c2=getchar();c3=getchar();c4=getchar(); + c5=getchar();c6=getchar();c7=getchar();c8=getchar(); + res=(c1<<56)+(c2<<48)+(c3<<40)+(c4<<32)+(c5<<24)+(c6<<16)+(c7<<8)+c8; + return res; +} +void Putuint(unsigned int a) +{ + unsigned int c1,c2,c3,c4; + c1=a&0xFF000000;c1>>=24;c2=a&0x00FF0000;c2>>=16; + c3=a&0x0000FF00;c3>>=8;c4=a&0x000000FF; + printf("%c%c%c%c",c1,c2,c3,c4); +} +void Putint(int a) +{ + Putuint((unsigned int)a); +} +void Putll(unsigned long long a) +{ + unsigned long long c1,c2,c3,c4,c5,c6,c7,c8; + c1=a&0xFF00000000000000LL;c1>>=56LL; + c2=a&0x00FF000000000000LL;c2>>=48LL; + c3=a&0x0000FF0000000000LL;c3>>=40LL; + c4=a&0x000000FF00000000LL;c4>>=32LL; + c5=a&0x00000000FF000000LL;c5>>=24LL; + c6=a&0x0000000000FF0000LL;c6>>=16LL; + c7=a&0x000000000000FF00LL;c7>>=8LL; + c8=a&0x00000000000000FFLL; + printf("%c%c%c%c%c%c%c%c",(int)c1,(int)c2,(int)c3,(int)c4,(int)c5,(int)c6,(int)c7,(int)c8); +} +TRecord GetTRecord() +{ + TRecord res; + res.len=Getint(); + memset(res.name,0,sizeof(res.name)); + for (int i=0;i<res.len;++i)scanf("%c",&res.name[i]); + res.score=Getll(); + res.rescol=Getint(); + res.scoll=Getint(); + res.clrusg=Getint(); + res.af_int=Getint();res.af_fric=Getint(); + return res; +} +void PutTRecord(TRecord a) +{ + Putint(a.len); + for (int i=0;i<a.len;++i)printf("%c",a.name[i]); + Putll(a.score); + Putint(a.rescol); + Putint(a.scoll); + Putint(a.clrusg); + Putint(a.af_int);Putint(a.af_fric); +} +void Score_Init() +{ + freopen(".blrscore","r",stdin); + header=Getuint(); + if (header!=0x3b424c53)//0x3b424c53=";BLS" + { + fclose(stdin); + Error("Error when loading score file!"); + } + seprt=Getuint(); + if (seprt!=0xd1ffa0c0) + { + fclose(stdin); + Error("Error when loading score file!"); + } + Ecnt=Getuint(); + for (unsigned int i=1;i<=Ecnt;++i)ERec[i]=GetTRecord(); + seprt=Getuint(); + if (seprt!=0xd1ffa0c1) + { + fclose(stdin); + Error("Error when loading score file!"); + } + Ncnt=Getuint(); + for (unsigned int i=1;i<=Ncnt;++i)NRec[i]=GetTRecord(); + seprt=Getuint(); + if (seprt!=0xd1ffa0c2) + { + fclose(stdin); + Error("Error when loading score file!"); + } + Excnt=Getuint(); + for (unsigned int i=1;i<=Excnt;++i)ExRec[i]=GetTRecord(); + seprt=Getuint(); + if (seprt!=0xd1ffa0c3) + { + fclose(stdin); + Error("Error when loading score file!"); + } + FPMcnt=Getuint(); + for (unsigned int i=1;i<=FPMcnt;++i)FPMRec[i]=GetTRecord(); + fclose(stdin); +} +int CheckHighScore() +{ + unsigned i; + switch (mode) + { + case 4: + for (i=1;i<=Ecnt;++i) + if (ERec[i].score<score)break; + if (i==5&&ERec[i].score>score)return -1; + if (Ecnt<5&&ERec[Ecnt].score>score)return Ecnt+1; + return i; + break; + case 1: + for (i=1;i<=Ncnt;++i) + if (NRec[i].score<score)break; + if (i==5&&NRec[i].score>score)return -1; + if (Ncnt<5&&NRec[Ncnt].score>score)return Ncnt+1; + return i; + break; + case 2: + for (i=1;i<=Excnt;++i) + if (ExRec[i].score<score)break; + if (i==5&&ExRec[i].score>score)return -1; + if (Excnt<5&&ExRec[Ncnt].score>score)return Excnt+1; + return i; + break; + case 3: + for (i=1;i<=FPMcnt;++i) + if (FPMRec[i].score<score)break; + if (i==5&&FPMRec[i].score>score)return -1; + if (FPMcnt<5&&FPMRec[Ncnt].score>score)return FPMcnt+1; + return i; + break; + } + return 100; +} +void Score_Write() +{ + freopen(".blrscore","w",stdout); + Putuint(0x3b424c53); + Putuint(0xd1ffa0c0); + Putint(Ecnt); + for (unsigned i=1;i<=Ecnt;++i) + PutTRecord(ERec[i]); + Putuint(0xd1ffa0c1); + Putint(Ncnt); + for (unsigned i=1;i<=Ncnt;++i) + PutTRecord(NRec[i]); + Putuint(0xd1ffa0c2); + Putint(Excnt); + for (unsigned i=1;i<=Excnt;++i) + PutTRecord(ExRec[i]); + Putuint(0xd1ffa0c3); + Putint(FPMcnt); + for (unsigned i=1;i<=FPMcnt;++i) + PutTRecord(FPMRec[i]); + fclose(stdout); +} +void Score_Initailize() +{ + if(access(".blrscore",R_OK)==0)return; + freopen(".blrscore","w",stdout); + Putuint(0x3b424c53); + Putuint(0xd1ffa0c0);Putuint(0); + Putuint(0xd1ffa0c1);Putuint(0); + Putuint(0xd1ffa0c2);Putuint(0); + Putuint(0xd1ffa0c3);Putuint(0); + fclose(stdout); +} +void InsertHighScore() +{ + unsigned pos=CheckHighScore(); + switch (mode) + { + case 4: + //deprecated... + if (pos<=Ecnt) + for (unsigned i=5;i>pos;--i) + ERec[i]=ERec[i-1]; + else ++Ecnt; + if (Ecnt<5)++Ecnt; + ERec[pos].score=score; + ERec[pos].len=newlen; + memcpy(ERec[pos].name,newname,sizeof(newname)); + ERec[pos].clrusg=clrusg; + ERec[pos].rescol=restarts;ERec[pos].scoll=semicoll; + ERec[pos].af_int=(int)averfps; + ERec[pos].af_fric=(int)(averfps*10)%10*10+(int)(averfps*100)%10; + break; + case 1: + if (pos<=Ncnt) + for (unsigned i=5;i>pos;--i) + NRec[i]=NRec[i-1]; + if (Ncnt<5)++Ncnt; + NRec[pos].score=score; + NRec[pos].len=newlen; + memcpy(NRec[pos].name,newname,sizeof(newname)); + NRec[pos].clrusg=clrusg; + NRec[pos].rescol=restarts;NRec[pos].scoll=semicoll; + NRec[pos].af_int=(int)averfps; + NRec[pos].af_fric=(int)(averfps*10)%10*10+(int)(averfps*100)%10; + break; + case 2: + if (pos<=Excnt) + for (unsigned i=5;i>pos;--i) + ExRec[i]=ExRec[i-1]; + if (Excnt<5)++Excnt; + ExRec[pos].score=score; + ExRec[pos].len=newlen; + memcpy(ExRec[pos].name,newname,sizeof(newname)); + ExRec[pos].clrusg=clrusg; + ExRec[pos].rescol=asts*100;ExRec[pos].scoll=semicoll; + ExRec[pos].af_int=(int)averfps; + ExRec[pos].af_fric=(int)(averfps*10)%10*10+(int)(averfps*100)%10; + break; + case 3: + if (pos<=FPMcnt) + for (unsigned i=5;i>pos;--i) + FPMRec[i]=FPMRec[i-1]; + if (FPMcnt<5)++FPMcnt; + FPMRec[pos].score=score; + FPMRec[pos].len=newlen; + memcpy(FPMRec[pos].name,newname,sizeof(newname)); + FPMRec[pos].clrusg=clrusg; + FPMRec[pos].rescol=coll;FPMRec[pos].scoll=semicoll; + FPMRec[pos].af_int=(int)averfps; + FPMRec[pos].af_fric=(int)(averfps*10)%10*10+(int)(averfps*100)%10; + break; + } + Score_Write(); +} diff --git a/archive/blr2/src/scoresystem.h b/archive/blr2/src/scoresystem.h new file mode 100644 index 0000000..c8efc79 --- /dev/null +++ b/archive/blr2/src/scoresystem.h @@ -0,0 +1,158 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Multiplier implementations +// Copyright Chrisoft 2014 +CircleIndicator MultTimer; +hgeFont *MultFnt; +hgeSprite *MB; +int valbrk; +//static const char* SCORESYSTEM_H_FN="scoresystem.h"; + +//Multiplier Indicator + +HangUpText MT[255]; +void NewMT() +{ + int i=0;while (MT[i].Active())++i; + 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)); +} +void ProcessMT() +{ + for (int i=0;i<=255;++i)if (MT[i].Active())MT[i].Process(hge->Timer_GetDelta()); +} + +//Multiplier +1 +class MultPo +{ +private: + hgeSprite *Mult,*SpwnEfx; + double Lifetime,LifeLim,speed; + vector2d position,direction; + int blinkbrk; + bool Active,blnkshow,followplyr; +public: + bool IsActive(){return Active;} + void Init(double _lt,double _speed,vector2d _pos,vector2d _dir) + { + Lifetime=0;LifeLim=_lt;speed=_speed;position=_pos;direction=_dir; + Mult=new hgeSprite(SprSheet,0,272,48,48);Active=true;blinkbrk=0;blnkshow=true; + Mult->SetHotSpot(24,24);followplyr=false;SpwnEfx=new hgeSprite(SprSheet,48,272,48,48); + SpwnEfx->SetHotSpot(24,24); + } + void Process() + { + if(GetDist(playerpos,position)<=64)followplyr=true; + if(!clrmode) + { + if(clrrange!=0&&GetDist(playerpos,position)<=clrmaxrange)followplyr=true; + } + else + { + if(clrrad-pi/2>1e-7&&GetDist(playerpos,position)<=clrmaxrange)followplyr=true; + } + if(followplyr) + { + direction=ToUnitCircle(playerpos-position); + speed=0.4; + }else Lifetime+=hge->Timer_GetDelta(); + if(GetDist(playerpos,position)<=9) + { + ++mult,NewMT(),Active=false; + delete Mult;delete SpwnEfx;return; + } + if(Lifetime>LifeLim) + { + delete Mult;delete SpwnEfx; + return (void)(Active=false); + } + if(Lifetime<LifeLim*0.03) + { + double siz=(LifeLim*0.03-Lifetime)/(LifeLim*0.03)*3; + SpwnEfx->SetColor(SETA(SpwnEfx->GetColor(),Lifetime/(LifeLim*0.03)*255)); + SpwnEfx->RenderEx(position.x,position.y,0,siz); + } + if(Lifetime>LifeLim*0.8) + { + if (!LOWFPS)++blinkbrk;else blinkbrk+=17; + if (blinkbrk>200)blinkbrk=0,blnkshow=!blnkshow; + if (blnkshow) + Mult->RenderEx(position.x,position.y,0,0.8); + } + else + Mult->RenderEx(position.x,position.y,0,0.8); + if(!followplyr) + { + if (position.x>780||position.x<20)direction.x=-direction.x; + if (position.y>780||position.y<20)direction.y=-direction.y; + } + int times=1;if (LOWFPS)times=17; + for (int i=1;i<=times;++i) + position.x+=direction.x*speed,position.y+=direction.y*speed; + } +}; +MultPo Multpo[255]; +void NewMultpo(vector2d pos=vector2d(-99,-99)) +{ + int i=0;while (Multpo[i].IsActive())++i; + if (pos.x+99<=1e-6&&pos.y+99<=1e-6) + pos.x=re.NextInt(20,770),pos.y=re.NextInt(20,570); + vector2d dir=ToUnitCircle(vector2d(rand()%1000-500,rand()%1000-500)); + Multpo[i].Init(7.5,0.02,pos,dir); +} +void ProcessMultpo() +{ + for (int i=0;i<=255;++i)if(Multpo[i].IsActive())Multpo[i].Process(); +} +//Auto Multipliers + +void Mult_Init() +{ + MultTimer.Init(50,0.95,0xC0,false,SprSheet,TextureRect(151,264,2,8),0x00FF0000); + multbrk=TenSeconds;multbat=mult=1;valbrk=0; + MB=new hgeSprite(MultFnt->GetTexture(),0,235,163,21); + MB->SetHotSpot(81.5,10.5); + memset(Multpo,0,sizeof(Multpo)); +} +double GetHscle() +{ + if (multbrk<=TenSeconds/10.0f*0.2f)return (TenSeconds/10.0f*0.3f-multbrk)/(TenSeconds/10.0f)*10; + if (multbrk<=TenSeconds/10.0f*4.5f)return 1.0f; + return (multbrk-TenSeconds/10.0f*4.15f)/(multbrk-TenSeconds/10.0f)*10; +} +int GetAlpha() +{ + if (multbrk<=TenSeconds/10.0f*0.2f)return (int)(255-255*(TenSeconds/10.0f*0.2f-multbrk)/(TenSeconds/50.0f)); + if (multbrk<=TenSeconds/10.0f*4.5f)return 0xFF; + return (int)(255*(TenSeconds/2-multbrk)/(TenSeconds/10)); +} +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;lsc=0; + NewMT(); + if (multbat<5)++multbat; + } + if (multbrk<TenSeconds/2) + { + ++valbrk; + if (LOWFPS||valbrk>30) + MultTimer.SetValue((double)multbrk/((double)TenSeconds/2.0f)); + if (valbrk>30)valbrk=0; + MultTimer.Render(playerpos.x+8.4,playerpos.y+8.4); + MB->SetColor(SETA(0x00FFFFFF,0.8*GetAlpha())); + MB->RenderEx(playerpos.x+8.4,playerpos.y-26.4,0,GetHscle(),1.0f); + } +} +void Mult_BatClear() +{ + multbrk=ThirtySeconds; + multbat=1; +} diff --git a/archive/blr2/src/towernbullet.h b/archive/blr2/src/towernbullet.h new file mode 100644 index 0000000..8acf516 --- /dev/null +++ b/archive/blr2/src/towernbullet.h @@ -0,0 +1,2892 @@ +// Chrisoft Bullet Lab Remix HGE -*- C++ -*- +// Towers and Bullets Implementations +// Copyright Chrisoft 2014 +#include "effects.h" +//static const char* TOWERNBULLET_H_FN="towernbullet.h"; + +void RenderAlter(vector2d p,TColors ca,TColors cb,double rot=0,double scl=1) +{ + float x,y,w,h; + bulletspr[ca]->GetTextureRect(&x,&y,&w,&h); + bulletspr[ca]->SetTextureRect(x,y,12,h); + bulletspr[ca]->SetHotSpot(12,12); + bulletspr[ca]->RenderEx(p.x,p.y,rot,scl); + bulletspr[ca]->SetTextureRect(x,y,w,h); + bulletspr[ca]->SetHotSpot(12,12); + + bulletspr[cb]->GetTextureRect(&x,&y,&w,&h); + bulletspr[cb]->SetTextureRect(x,y,12,h); + bulletspr[cb]->SetHotSpot(12,12); + bulletspr[cb]->RenderEx(p.x,p.y,rot+pi,scl); + bulletspr[cb]->SetTextureRect(x,y,w,h); + bulletspr[cb]->SetHotSpot(12,12); +} +int CreateBullet1(double x,double y,double bs,bool eff=false) +{ + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].inv=false; + bullet[i].bullettype=1; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir.x=x-playerpos.x; + bullet[i].bulletdir.y=y-playerpos.y; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].alterColor=green;bullet[i].alterColor2=COLOR_COUNT; + bullet[i].scollable=true; + bullet[i].scale=1; + if (eff)BulletEffect_Attatch(i); + return i; +} +int CreateBullet2(double x,double y,double bs,double rad,bool eff=false,bool invi=false) +{ + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].addblend=false; + bullet[i].extborder=false; + bullet[i].inv=invi; + bullet[i].bullettype=2; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir=vector2d(cos(rad),sin(rad)); + bullet[i].limpos=vector2d(-999,-999); + bullet[i].bulletspeed=bs; + bullet[i].alterColor=blue; + bullet[i].alterColor2=COLOR_COUNT; + bullet[i].lifetime=0; + bullet[i].whirem=0; + bullet[i].scollable=true; + bullet[i].collable=true; + bullet[i].bulletaccel=bullet[i].limv=0; + bullet[i].scale=1;bullet[i].rot=0; + if (eff)BulletEffect_Attatch(i); + return i; +} +void CreateBullet3(double x,double y,double bs,int dir,bool eff=false) +{ + CreateBullet2(x,y,bs,dir*0.5235987756,eff,false); +} +void CreateBullet4(double x,double y,double bs,int yelbrk=0,bool eff=false) +{ + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].inv=false; + bullet[i].bullettype=4; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir.x=x-playerpos.x; + bullet[i].bulletdir.y=y-playerpos.y; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].yelbrk=yelbrk; + bullet[i].scollable=true; + bullet[i].scale=1;bullet[i].lifetime=0; + bullet[i].alterColor=yellow;bullet[i].alterColor2=COLOR_COUNT; + if (eff)BulletEffect_Attatch(i); +} +void CreateBullet5(double x,double y,double bs,bool eff=false) +{ + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].inv=false; + bullet[i].bullettype=5; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir.x=x-playerpos.x; + bullet[i].bulletdir.y=y-playerpos.y; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].alterColor=purple;bullet[i].alterColor2=COLOR_COUNT; + bullet[i].scollable=true; + bullet[i].scale=1; + if (eff)BulletEffect_Attatch(i); +} +int CreateBullet6(double x,double y,double bs,int explo,int exp1=8,int exp2=12,bool eff=false) +{ + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].inv=false; + bullet[i].bullettype=6; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir.x=re.NextDouble(-1,1); + bullet[i].bulletdir.y=re.NextDouble(-1,1); + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].alterColor=red;bullet[i].alterColor2=COLOR_COUNT; + bullet[i].redattrib=0; + bullet[i].exp1=exp1; + bullet[i].exp2=exp2; + bullet[i].oriexplo=bullet[i].redexplo=explo; + bullet[i].scollable=true; + bullet[i].scale=1; + if (eff)BulletEffect_Attatch(i); + return i; +} +int CreateBullet7(double x,double y,double bs,int explo,bool eff=false) +{ + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].inv=false; + bullet[i].bullettype=7; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir.x=re.NextDouble(-1,1); + bullet[i].bulletdir.y=re.NextDouble(-1,1); + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].alterColor=white;bullet[i].alterColor2=COLOR_COUNT; + bullet[i].oriexplo=bullet[i].redexplo=explo; + bullet[i].redattrib=0; + bullet[i].whirem=whicnt; + bullet[i].whiskp=0; + bullet[i].scollable=true; + bullet[i].scale=1; + if (eff)BulletEffect_Attatch(i); + return i; +} +int CreateBullet8(double x,double y,double bs,bool eff=false) +{ + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].inv=false; + bullet[i].bullettype=8; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir.x=x-playerpos.x; + bullet[i].bulletdir.y=y-playerpos.y; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].alterColor=dblue;bullet[i].alterColor2=COLOR_COUNT; + bullet[i].scollable=true; + bullet[i].scale=1; + if (eff)BulletEffect_Attatch(i); + return i; +} +int CreateBullet9(double x,double y,double bs,int explo,int cnt,int brk,bool eff=false) +{ + //This creates bullet9 in random direction and as attrib 0 + //change them if necessary. + ++shots; + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].inv=false; + bullet[i].bullettype=9; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].bulletdir.x=re.NextDouble(-1,1); + bullet[i].bulletdir.y=re.NextDouble(-1,1); + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].oriexplo=bullet[i].redexplo=explo; + bullet[i].redattrib=0; + bullet[i].whicnt=cnt; + bullet[i].yelbrk=brk; + bullet[i].alterColor=orange;bullet[i].alterColor2=COLOR_COUNT; + bullet[i].scollable=true; + bullet[i].scale=1; + if (eff)BulletEffect_Attatch(i); + return i; +} +void CreateBullet255(double x,double y,double bs,int spno=0) +{ + int i=AllocBullet(); + bullet[i].exist=true; + bullet[i].bullettype=255; + bullet[i].bulletpos.x=x; + bullet[i].bulletpos.y=y; + bullet[i].redattrib=spno; + vector2d spos=playerpos+splitData[spno]; + bullet[i].bulletdir.x=x-spos.x; + bullet[i].bulletdir.y=y-spos.y; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + bullet[i].bulletspeed=bs; + bullet[i].exp1=re.NextInt(0,9)?0:1; +} +void All2pnt() +{ + for (int i=1;i<=bulcnt;++i) + { + if(bullet[i].bullettype<200&&bullet[i].exist) + { + CreateBullet255(bullet[i].bulletpos.x,bullet[i].bulletpos.y,10); + 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; + } + } +} +void ProcessBullet1(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=1)return; + if (!DisablePlayer) + { + if (LOWFPS) + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + } + else + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + } + } + BulletEffect_Process(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) + { + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7)++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; + } + else + { + bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(); + } +} +void ProcessBullet2(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=2)return; + if (Current_Position==1)bullet[i].lifetime+=hge->Timer_GetDelta(); + if (!DisablePlayer) + { + //experimental new coor processing code, FPS independent + if (bullet[i].whirem<=0) + { + if (bullet[i].bulletaccel>0&&bullet[i].bulletspeed<bullet[i].limv)bullet[i].bulletspeed+=bullet[i].bulletaccel*(1000.0f/hge->Timer_GetFPS()); + if (bullet[i].bulletaccel<0&&bullet[i].bulletspeed>bullet[i].limv)bullet[i].bulletspeed+=bullet[i].bulletaccel*(1000.0f/hge->Timer_GetFPS()); + } + else + bullet[i].whirem-=1000.0f/hge->Timer_GetFPS(); + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x)/20*(1000.0f/hge->Timer_GetFPS()); + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y)/20*(1000.0f/hge->Timer_GetFPS()); + if(GetDist(bullet[i].bulletpos,bullet[i].limpos)<1) + { + BulletEffect_Death(bullet[i],ColorToDWORD(bullet[i].alterColor)); + bullet[i].exist=false; + bullet[i].bulletpos.x=bullet[i].bulletpos.y=-999; + bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; + bullet[i].dist=0; + bullet[i].bullettype=0;return; + } + } + BulletEffect_Process(i); + if(PlayerSplit) + { + bool rndr=true; + for(int j=0;j<4;++j) + { + double dis=GetDist(bullet[i].bulletpos,playerpos+splitData[j]); + if (bullet[i].bulletpos.x<=-25||bullet[i].bulletpos.x>=825||bullet[i].bulletpos.y<=-25||bullet[i].bulletpos.y>=625) + { + bullet[i].exist=false;rndr=false; + bullet[i].bulletpos.x=bullet[i].bulletpos.y=-999; + bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; + bullet[i].dist=0; + bullet[i].bullettype=0; + return; + } + if (bullet[i].scale<1.2&&dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable) + { + ++coll,scminus+=10000,Mult_BatClear();bullet[i].collable=false;rndr=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 + { + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(playerpos+splitData[j]); + } + } + if(rndr) + { + 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; + } + } + else + { + double dis=GetDist(bullet[i].bulletpos,playerpos); + if ((!bullet[i].extborder&&(bullet[i].bulletpos.x<=-25||bullet[i].bulletpos.x>=825||bullet[i].bulletpos.y<=-25||bullet[i].bulletpos.y>=625))|| + (bullet[i].extborder&&(bullet[i].bulletpos.x<=-225||bullet[i].bulletpos.x>=1025||bullet[i].bulletpos.y<=-225||bullet[i].bulletpos.y>=825))) + { + bullet[i].exist=false; + bullet[i].bulletpos.x=bullet[i].bulletpos.y=-999; + bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; + bullet[i].dist=0; + bullet[i].bullettype=0; + return; + } + if (bullet[i].scale<1.2&&dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable) + { + ++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 + { + if(bullet[i].alterColor2==COLOR_COUNT) + { + if(bullet[i].addblend)bulletspr[bullet[i].alterColor]->SetBlendMode(0); + bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + if(bullet[i].addblend)bulletspr[bullet[i].alterColor]->SetBlendMode(2); + } + 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(); + } + } +} +//There is no need for ProcessBullet3() because they are in fact bullet2 +void ProcessBullet4(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=4)return; + if (Current_Position==1)bullet[i].lifetime+=hge->Timer_GetDelta(); + if (!DisablePlayer) + { + if (LOWFPS) + bullet[i].whirem+=17; + else + ++bullet[i].whirem; + if ((yelattrib&&bullet[i].whirem>=bullet[i].yelbrk)||!yelattrib) + { + bullet[i].whirem=0; + bullet[i].bulletdir.x=bullet[i].bulletpos.x-playerpos.x; + bullet[i].bulletdir.y=bullet[i].bulletpos.y-playerpos.y; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + } + if (LOWFPS) + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + } + else + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + } + } + BulletEffect_Process(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) + { + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7)++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; + } + else + { + bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(); + } +} +void ProcessBullet5(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=5)return; + if (!DisablePlayer) + { + if (LOWFPS) + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + } + else + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + } + } + BulletEffect_Process(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) + { + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7)playerspeed*=0.9,playerslospeed*=0.9; + 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; + } + else + { + bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + } +} +void ProcessBullet6(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=6)return; + if (!DisablePlayer) + { + if (LOWFPS) + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + } + else + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + } + } + if (!LOWFPS) + { + if (bullet[i].redattrib==0) + --bullet[i].redexplo; + else + bullet[i].redexplo-=2; + } + else + { + if (bullet[i].redattrib==0) + bullet[i].redexplo-=17; + else + bullet[i].redexplo-=34; + } + if (bullet[i].redexplo<=0&&!DisableAllTower) + { + if (bullet[i].redattrib==0) + { + for (int j=1;j<=bullet[i].exp1;++j) + { + int pnt=CreateBullet6(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,bullet[i].oriexplo,bullet[i].exp1,bullet[i].exp2,bullet[i].scale>1.5?true:false); + bullet[pnt].setdir(2*pi/(double)bullet[i].exp1*j); + bullet[pnt].redattrib=1; + } + } + else + { + for (int j=1;j<=bullet[i].exp2;++j) + CreateBullet2(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,2*pi/(double)bullet[i].exp2*j+clockrot,bullet[i].scale>1.5?true:false); + clockrot+=deltarot; + deltarot+=0.004363322313; + } + 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; + } + BulletEffect_Process(i); + if(PlayerSplit) + { + bool rndr=true; + for(int j=0;j<4;++j) + { + double dis=GetDist(bullet[i].bulletpos,playerpos+splitData[j]); + if (bullet[i].bulletpos.x<=-25||bullet[i].bulletpos.x>=825||bullet[i].bulletpos.y<=-25||bullet[i].bulletpos.y>=625) + { + bullet[i].exist=false;rndr=false; + bullet[i].bulletpos.x=bullet[i].bulletpos.y=-999; + bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; + bullet[i].dist=0; + bullet[i].bullettype=0; + return; + } + if (bullet[i].scale<1.2&&dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable) + { + ++coll,scminus+=10000,Mult_BatClear();bullet[i].collable=false;rndr=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 + { + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(playerpos+splitData[j]); + } + } + if(rndr) + { + 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; + } + } + else + { + double dis=GetDist(bullet[i].bulletpos,playerpos); + if (bullet[i].bulletpos.x<=-25||bullet[i].bulletpos.x>=825||bullet[i].bulletpos.y<=-25||bullet[i].bulletpos.y>=625) + { + bullet[i].exist=false; + bullet[i].bulletpos.x=bullet[i].bulletpos.y=-999; + bullet[i].bulletdir.x=bullet[i].bulletdir.y=0; + bullet[i].dist=0; + bullet[i].bullettype=0; + return; + } + if (bullet[i].scale<1.2&&dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&bullet[i].collable) + { + ++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 + { + 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(); + } + } +} +void ProcessBullet7(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=7)return; + if (!DisablePlayer) + { + if (LOWFPS) + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + } + else + { + bullet[i].bulletpos.x-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bsscale*bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + } + } + if (!LOWFPS) + { + if (bullet[i].redattrib==0) + --bullet[i].redexplo; + else + bullet[i].redexplo-=2; + } + else + { + if (bullet[i].redattrib==0) + bullet[i].redexplo-=17; + else + bullet[i].redexplo-=34; + } + if (bullet[i].redexplo<=0&&!DisableAllTower) + { + if (bullet[i].redattrib==0) + { + int pnt=CreateBullet7(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,bullet[i].oriexplo,bullet[i].scale>1.5?true:false); + + bullet[pnt].bulletdir.x=0; + bullet[pnt].bulletdir.y=0; + bullet[pnt].dist=1; + bullet[pnt].redattrib=1; + 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; + } + else + { + if (!LOWFPS) + ++bullet[i].whiskp; + else + bullet[i].whiskp+=17; + if (bullet[i].whiskp>50) + { + for (int j=1;j<=whrcnt;++j) + { + int pnt=CreateBullet2(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,j*2.0f*pi/(double)whrcnt+whirot,bullet[i].scale>1.5?true:false); + if(level==6&&part==1) + { + bullet[pnt].limv=8; + bullet[pnt].bulletaccel=0.005; + bullet[pnt].bulletspeed=0; + } + if (level==6&&part>=2&&part<=11&&(j&1)) + { + bullet[pnt].limv=5; + bullet[pnt].bulletaccel=0.005; + bullet[pnt].bulletspeed=0; + bullet[pnt].redir(playerpos); + bullet[pnt].bulletdir.Rotate((j>>1&1?1:-1)*pi/72); + } + } + whirot+=dwhirot; + dwhirot+=0.004363322313; + bullet[i].whiskp=0; + --bullet[i].whirem; + } + if (bullet[i].whirem<=0) + { + 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; + } + } + } + BulletEffect_Process(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) + { + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7)++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; + } + else + { + bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(); + } +} +void ProcessBullet8(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=8)return; + if (!DisablePlayer) + { + if (LOWFPS) + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + } + else + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + } + } + BulletEffect_Process(i); + if(bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800||bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600) + { + int cnt=re.NextInt(2,5);if (Dis8ref)cnt=0; + if(PlayerSplit)cnt=re.NextInt(0,2); + if(bullet[i].redattrib) + { + if(re.NextInt(0,3))//more possibility to reflect + { + if(bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800)bullet[i].bulletdir.x=-bullet[i].bulletdir.x; + if(bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600)bullet[i].bulletdir.y=-bullet[i].bulletdir.y; + } + else//vanish or reflect?... + { + cnt=4-4*(frameleft/(double)(AMinute*1.5)); + for (int ii=1;ii<=cnt;++ii) + CreateBullet2(bullet[i].bulletpos.x,bullet[i].bulletpos.y,2,re.NextDouble(-pi,pi)); + 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 + { + for (int ii=1;ii<=cnt;++ii) + { + int pnt=CreateBullet2(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,re.NextDouble(-pi,pi)); + if (t8special) + { + bullet[pnt].alterColor=(TColors)(re.NextInt(0,7)); + bullet[pnt].alterColor2=(TColors)(re.NextInt(0,7)); + if(re.NextInt(0,3)==3)bullet[pnt].redir(vector2d(400,300)); + if(re.NextInt(0,1))++ii; + } + } + 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; + } + } + if(PlayerSplit) + { + for(int j=0;j<4;++j) + { + double dis=GetDist(bullet[i].bulletpos,playerpos+splitData[j]); + if (dis<=6) + { + if (dis<=6){if(clrrange<1e-5&&clrrad-pi/2<1e-7)++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; + } + else + { + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(playerpos+splitData[j]); + } + } + 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 + { + double dis=GetDist(bullet[i].bulletpos,playerpos); + if (dis<=6) + { + if (dis<=6){if(clrrange<1e-5&&clrrad-pi/2<1e-7)++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;return; + } + else + { + bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(); + } + } +} +void ProcessBullet9(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=9)return; + if (!DisablePlayer) + { + if (LOWFPS) + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + if (bullet[i].redattrib==0) + { + bullet[i].redexplo-=17; + if (bullet[i].redexplo<=0) + { + for (int ii=0;ii<bullet[i].whicnt;++ii) + { + int pnt=CreateBullet9(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,0,0,bullet[i].yelbrk); + bullet[pnt].setdir(2*pi/(double)bullet[i].whicnt*ii); + bullet[pnt].redattrib=1; + } + 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; + } + } + if (bullet[i].redattrib==1) + { + bullet[i].yelbrk-=17; + if (bullet[i].yelbrk<=0) + { + bullet[i].redir(playerpos); + bullet[i].redattrib=2; + } + } + } + else + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + if (bullet[i].redattrib==0) + { + --bullet[i].redexplo; + if (bullet[i].redexplo<=0) + { + for (int ii=0;ii<bullet[i].whicnt;++ii) + { + int pnt=CreateBullet9(bullet[i].bulletpos.x,bullet[i].bulletpos.y,bullet[i].bulletspeed,0,0,bullet[i].yelbrk); + bullet[pnt].setdir(2*pi/(double)bullet[i].whicnt*ii); + bullet[pnt].redattrib=1; + } + 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; + } + } + if (bullet[i].redattrib==1) + { + --bullet[i].yelbrk; + if (bullet[i].yelbrk<=0) + { + bullet[i].redir(playerpos); + bullet[i].redattrib=2; + } + } + } + } + BulletEffect_Process(i); + double dis=GetDist(bullet[i].bulletpos,playerpos); + if (dis<=6||bullet[i].bulletpos.x<=-100||bullet[i].bulletpos.x>=900||bullet[i].bulletpos.y<=-100||bullet[i].bulletpos.y>=700) + { + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7)++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; + } + else + { + bulletspr[bullet[i].alterColor]->RenderEx(bullet[i].bulletpos.x+7.2,bullet[i].bulletpos.y+7.2,0,0.6*bullet[i].scale,0); + if (dis<=16&&bullet[i].scollable)++semicoll,++dsmc,bullet[i].scollable=false,SCEffect_Attatch(); + } +} +void ProcessBullet255(int i) +{ + if (!bullet[i].exist||bullet[i].bullettype!=255)return; + if (!DisablePlayer) + { + bullet[i].bulletspeed=10; + vector2d spos=playerpos+splitData[bullet[i].redattrib]; + bullet[i].bulletdir.x=bullet[i].bulletpos.x-spos.x; + bullet[i].bulletdir.y=bullet[i].bulletpos.y-spos.y; + bullet[i].dist=bullet[i].bulletdir.x*bullet[i].bulletdir.x+bullet[i].bulletdir.y*bullet[i].bulletdir.y; + bullet[i].dist=sqrt(bullet[i].dist); + if (LOWFPS) + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20*17; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20*17; + } + else + { + bullet[i].bulletpos.x-=bullet[i].bulletspeed*(bullet[i].bulletdir.x/bullet[i].dist)/20; + bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20; + } + } + double dis=GetDist(bullet[i].bulletpos,playerpos+splitData[bullet[i].redattrib]); + if (dis<=6||bullet[i].bulletpos.x<=-10||bullet[i].bulletpos.x>=800||bullet[i].bulletpos.y<=-10||bullet[i].bulletpos.y>=600) + { + if(bullet[i].exp1)score+=mult*100;else mult+=0.01; + 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; + } + else + { + if(bullet[i].exp1) + { + bulletspr[green]->SetColor(0x40FFFFFF); + bulletspr[green]->SetBlendMode(BLEND_ALPHAADD); + bulletspr[green]->RenderEx(bullet[i].bulletpos.x+6,bullet[i].bulletpos.y+6,0,0.5,0); + bulletspr[green]->SetBlendMode(BLEND_ALPHABLEND); + bulletspr[green]->SetColor(0x80FFFFFF); + } + else + { + bulletspr[grey]->SetColor(0x20FFFFFF); + bulletspr[grey]->SetBlendMode(BLEND_ALPHAADD); + bulletspr[grey]->RenderEx(bullet[i].bulletpos.x+6,bullet[i].bulletpos.y+6,0,0.5,0); + bulletspr[grey]->SetBlendMode(BLEND_ALPHABLEND); + } + } +} +int CreateTower1(double x,double y,int timer,double bs,double offset=0,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero) + { + return i; + } + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=1; + tower[i].bulletspeed=bs; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + tower[i].offset=offset; + return i; +} +int CreateTower2(double x,double y,int timer,double bs,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero)return i; + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=2; + tower[i].bulletspeed=bs; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + return i; +} +int CreateTower3(double x,double y,int timer,double bs,int t3t,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero)return i; + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=3; + tower[i].bulletspeed=bs; + tower[i].t3t=t3t; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + return i; +} +int CreateTower3_fixeddir(double x,double y,int timer,double bs,double rad,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero)return i; + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=3; + tower[i].bulletspeed=bs; + tower[i].offset=rad;tower[i].t3t=999; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + return i; +} +int CreateTower4(double x,double y,int timer,double bs,int yelbrk=0,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero) + { + return i; + } + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=4; + tower[i].bulletspeed=bs; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].yelbrk=yelbrk; + tower[i].effect=eff; + return i; +} +int CreateTower5(double x,double y,int timer,double bs,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero) + { + return i; + } + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=5; + tower[i].bulletspeed=bs; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + return i; +} +int CreateTower6(double x,double y,int timer,double bs,int redexplo,int exp1=8,int exp2=12,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero) + { + return i; + } + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=6; + tower[i].bulletspeed=bs; + tower[i].redexplo=redexplo; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].exp1=exp1;tower[i].exp2=exp2; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + return i; +} +int CreateTower7(double x,double y,int timer,double bs,int redexplo,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero) + { + return i; + } + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=7; + tower[i].bulletspeed=bs; + tower[i].redexplo=redexplo; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].whicnt=whicnt; + tower[i].effect=eff; + return i; +} +int CreateTower8(double x,double y,int timer,double bs,int timer2,int scnt,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero) + { + return i; + } + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=8; + tower[i].bulletspeed=bs; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towertimer2=tower[i].curtimer2=timer2; + tower[i].shotcount=tower[i].curshotcount=scnt; + tower[i].dblstate=false; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + return i; +} +int CreateTower9(double x,double y,int timer,double bs,int explo,int cnt,int brk,bool eff=false) +{ + int i; + if (towcnt==0) + towcnt=i=1; + else + { + for (i=1;i<=towcnt;++i) + { + if (!tower[i].exist)break; + if (abs(tower[i].towerpos.x-x)<=zero&&abs(tower[i].towerpos.y-y)<=zero) + { + return i; + } + } + if (i>towcnt) + towcnt=i; + } + tower[i].exist=true; + tower[i].towertype=9; + tower[i].bulletspeed=bs; + tower[i].redexplo=explo; + tower[i].whicnt=cnt; + tower[i].yelbrk=brk; + tower[i].towertimer=tower[i].curtimer=timer; + tower[i].towerpos.x=x,tower[i].towerpos.y=y; + tower[i].RendColor=0x80FFFFFF; + tower[i].effect=eff; + return i; +} +void ProcessTower1() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=1)continue; + towerspr[green]->SetColor(tower[i].RendColor); + towerspr[green]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + if (fabs(tower[i].offset)>1e-7) + { + double trad=atan2l(tower[i].towerpos.y-playerpos.y,tower[i].towerpos.x-playerpos.x)+tower[i].offset; + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,trad,tower[i].effect); + } + else + CreateBullet1(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].effect); + } + } +} +void ProcessTower2() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=2)continue; + towerspr[blue]->SetColor(tower[i].RendColor); + towerspr[blue]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + for (int j=1;j<=12;++j) + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,j*0.5236+clockrot,tower[i].effect); + clockrot+=deltarot; + deltarot+=deltadelta; + } + } +} +void ProcessTower3() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=3)continue; + towerspr[blue]->SetColor(tower[i].RendColor); + towerspr[blue]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + if (tower[i].t3t==999) + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].offset,tower[i].effect); + if (tower[i].t3t==0) + for (int j=1;j<=12;++j) + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,j,tower[i].effect); + if (tower[i].t3t==1) + { + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,12,tower[i].effect); + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,3,tower[i].effect); + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,6,tower[i].effect); + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,9,tower[i].effect); + } + if (tower[i].t3t==4) + { + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi/4.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi*3/4.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi*5/4.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi*7/4.0f,tower[i].effect); + } + if (tower[i].t3t==5) + { + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi/4.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi*3/4.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi*5/4.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi*7/4.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,0,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi/2.0f,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi,tower[i].effect); + CreateBullet2(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,pi*3/2.0f,tower[i].effect); + } + if (tower[i].t3t==2) + { + if (re.NextInt(0,1)) + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,12,tower[i].effect); + else + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,6,tower[i].effect); + } + if (tower[i].t3t==3) + { + if (re.NextInt(0,1)) + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,3,tower[i].effect); + else + CreateBullet3(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,9,tower[i].effect); + } + } + } +} +void ProcessTower4() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=4)continue; + towerspr[yellow]->SetColor(tower[i].RendColor); + towerspr[yellow]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + CreateBullet4(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].yelbrk,tower[i].effect); + } + } +} +void ProcessTower5() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=5)continue; + towerspr[purple]->SetColor(tower[i].RendColor); + towerspr[purple]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + CreateBullet5(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].effect); + } + } +} +void ProcessTower6() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=6)continue; + towerspr[red]->SetColor(tower[i].RendColor); + towerspr[red]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + CreateBullet6(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].redexplo,tower[i].exp1,tower[i].exp2,tower[i].effect); + } + } +} +void ProcessTower7() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=7)continue; + towerspr[white]->SetColor(tower[i].RendColor); + towerspr[white]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + CreateBullet7(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].redexplo,tower[i].effect); + } + } +} +void ProcessTower8() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=8)continue; + towerspr[dblue]->SetColor(tower[i].RendColor); + towerspr[dblue]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (!tower[i].dblstate) + { + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + tower[i].dblstate=true; + tower[i].curtimer2=tower[i].towertimer2; + tower[i].curshotcount=tower[i].shotcount; + if (!Dis8ref&&!t8special)BTarg.TargShow(); + if (!Dis8ref)BTarg.targpos=playerpos; + if (PlayerSplit) + { + int r=0; + for(int i=1;i<4;++i) + if(GetDist(playerpos+splitData[r],vector2d(400,300))> + GetDist(playerpos+splitData[i],vector2d(400,300)))r=i; + BTarg.targpos=playerpos+splitData[r]; + } + } + } + else + { + if (LOWFPS) + tower[i].curtimer2-=17; + else + --tower[i].curtimer2; + if (tower[i].curtimer2<=0) + { + if (tower[i].curshotcount<=0) + { + tower[i].curtimer=tower[i].towertimer; + tower[i].dblstate=false; + tower[i].curtimer2=tower[i].towertimer2; + tower[i].curshotcount=tower[i].shotcount; + if (!Dis8ref)BTarg.TargHide(); + continue; + } + if (!t8special) + { + int pnt=CreateBullet8(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].effect); + if(level==-1&&part==21)bullet[pnt].redattrib=1;else bullet[pnt].redattrib=0; + if (Dis8ref) + { + if (tower[i].towerpos.y<300) + bullet[pnt].setdir(-pi/2);else bullet[pnt].setdir(pi/2); + } + else bullet[pnt].redir(BTarg.targpos); + } + else + { + 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; + bullet[pnt].redir(BTarg.targpos); + bullet[pnt].bulletdir.Rotate(j*2*pi/5); + } + } + tower[i].curtimer2=tower[i].towertimer2; + --tower[i].curshotcount; + } + } + } +} +void ProcessTower9() +{ + for (int i=1;i<=towcnt;++i) + { + if (!tower[i].exist||tower[i].towertype!=9)continue; + towerspr[orange]->SetColor(tower[i].RendColor); + towerspr[orange]->RenderEx(tower[i].towerpos.x+7.2,tower[i].towerpos.y+7.2,0,0.545); + if (DisableAllTower)continue; + if (LOWFPS) + tower[i].curtimer-=17; + else + --tower[i].curtimer; + if (tower[i].curtimer<=0) + { + tower[i].curtimer=tower[i].towertimer; + CreateBullet9(tower[i].towerpos.x,tower[i].towerpos.y,tower[i].bulletspeed,tower[i].redexplo,tower[i].whicnt,tower[i].yelbrk,tower[i].effect); + } + } +} +//Laser Implementation +int Lasercnt; +class Laser +{ +private: + hgeDistortionMesh *graphic; + int Res; + vector2d data1[MaxRes],data2[MaxRes]; + double GetDist() + { + double res=99999.9999f,tres; + static vector2d correction=vector2d(8.4,8.4); + 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+correction); + sa=data2[i]+RenCtr;sb=data2[i+1]+RenCtr; + if(GetDistSeg(sa,sb,playerpos+correction)<tres) + tres=GetDistSeg(sa,sb,playerpos+correction); + if (tres<res)res=tres; + } + return res; + } +public: + bool EnableColl; + vector2d RenCtr; + int collbrk,scollbrk; + void SetRes(int _Res){Res=_Res;} + void Render() + { + graphic->Render(RenCtr.x,RenCtr.y); + } + void Init(int _Res=0) + { + graphic=new hgeDistortionMesh(MaxRes,2); + graphic->Clear(0x00000000); + collbrk=scollbrk=0; + Res=_Res; + EnableColl=false; + } + void SetTexture(HTEXTURE Texture,double x=0.0f,double y=0.0f,double w=0.0f,double h=0.0f) + { + graphic->SetTexture(Texture); + if (x||y||w||h)graphic->SetTextureRect(x,y,w,h); + } + void Setdata(int x,vector2d pa,vector2d pb,DWORD color) + { + data1[x]=pa;data2[x]=pb; + graphic->SetDisplacement(x,0,data1[x].x,data1[x].y,HGEDISP_TOPLEFT); + graphic->SetDisplacement(x,1,data2[x].x,data2[x].y,HGEDISP_TOPLEFT); + graphic->SetColor(x,0,color);graphic->SetColor(x,1,color); + } + bool InsPoint(vector2d pa,vector2d pb,DWORD color) + { + if (Res==MaxRes)return false; + data1[++Res-1]=pa;data2[Res-1]=pb; + graphic->SetDisplacement(Res-1,0,data1[Res].x,data1[Res].y,HGEDISP_TOPLEFT); + graphic->SetDisplacement(Res-1,1,data2[Res].x,data2[Res].y,HGEDISP_TOPLEFT); + graphic->SetColor(Res-1,0,color);graphic->SetColor(Res-1,1,color); + return true; + } + void RemoveLastPoint(DWORD color) + { + for (int i=2;i<=Res;++i) + { + data1[i-1]=data1[i]; + data2[i-1]=data2[i]; + graphic->SetDisplacement(i-1,0,data1[i-1].x,data1[i-1].y,HGEDISP_TOPLEFT); + graphic->SetDisplacement(i-1,1,data2[i-1].x,data2[i-1].y,HGEDISP_TOPLEFT); + graphic->SetColor(i-1,0,color);graphic->SetColor(i-1,1,color); + } + graphic->SetDisplacement(Res-1,0,data1[Res].x,data1[Res].y,HGEDISP_TOPLEFT); + graphic->SetDisplacement(Res-1,1,data2[Res].x,data2[Res].y,HGEDISP_TOPLEFT); + graphic->SetColor(Res-1,0,color);graphic->SetColor(Res-1,1,color); + --Res; + } + void Process() + { + Render(); + if (EnableColl) + { + if (GetDist()<3.0f&&clrrange<1e-5&&clrrad-pi/2<1e-7) + { + if (!LOWFPS)++collbrk;else collbrk+=17; + if (collbrk>200) + ++coll,scminus+=10000,collbrk=0,Mult_BatClear(); + } + } + if (GetDist()<9.0f) + { + if (!LOWFPS)++scollbrk;else scollbrk+=17; + if (scollbrk>200) + ++semicoll,scollbrk=0,++dsmc,SCEffect_Attatch(); + } + + } +}laser[200]; +void ProcessLaser() +{ + //Well, I only cares rendering and collision checking.. + //Change laser data in the level code. + for (int i=1;i<=Lasercnt;++i)laser[i].Process(); +} +//Special bullet creation and processing code for some level... +void CreateBullet2(Bullet &Tar,double x,double y,double bs,double rad,bool eff=false) +{ + Tar.exist=true; + Tar.bullettype=2; + Tar.bulletpos.x=x; + Tar.bulletpos.y=y; + Tar.bulletdir.x=cos(rad); + Tar.bulletdir.y=sin(rad); + Tar.bulletspeed=bs; + Tar.alterColor=blue; + Tar.scale=1; + Tar.scollable=true; + Tar.bulletaccel=0; +} +void ProcessBullet2(Bullet &xbul,bool colchk=true) +{ + if (!xbul.exist||xbul.bullettype!=2)return; + if (!xbul.dist)xbul.dist=1; + if (xbul.bulletaccel>0&&xbul.bulletspeed<xbul.limv)xbul.bulletspeed+=xbul.bulletaccel*(1000.0f/hge->Timer_GetFPS()); + if (xbul.bulletaccel<0&&xbul.bulletspeed>xbul.limv)xbul.bulletspeed+=xbul.bulletaccel*(1000.0f/hge->Timer_GetFPS()); + xbul.bulletpos.x-=xbul.bulletspeed*(xbul.bulletdir.x/xbul.dist)/20*(1000.0f/hge->Timer_GetFPS()); + xbul.bulletpos.y-=xbul.bulletspeed*(xbul.bulletdir.y/xbul.dist)/20*(1000.0f/hge->Timer_GetFPS()); + double dis=GetDist(xbul.bulletpos,playerpos); + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&colchk&&xbul.collable) + { + ++coll,scminus+=10000,Mult_BatClear();xbul.collable=false; + return; + } + if (dis<=16&&xbul.scollable)++semicoll,++dsmc,xbul.scollable=false,SCEffect_Attatch(); + if (colchk)bulletspr[xbul.alterColor]->RenderEx(xbul.bulletpos.x+7.2,xbul.bulletpos.y+7.2,0,0.6*xbul.scale); +} +//"Noname" +class Noname01dotpas +{ +private: + Laser untitledlas; + Bullet untitledbul; + double x,y,range1,range2; + double r1lim,r2lim; + bool las,reverse,done; + int PMod,pos,boomlim; + DWORD color; +public: + bool Exist() + { + return (fabs(y)>1e-6); + } + void Init(int x,int pmd,double _r1lim,double _r2lim,int _boomlim,DWORD _color) + { + untitledlas.Init(); + this->x=x,this->y=2;color=_color; + CreateBullet2(untitledbul,x,2,0,3*pi/2); + untitledbul.bulletaccel=0.0005; + untitledbul.limv=2;untitledbul.collable=true; + las=false; + reverse=false; + done=false; + PMod=pmd; + r1lim=_r1lim;r2lim=_r2lim;boomlim=_boomlim; + if (re.NextInt(0,100)>boomlim) + pos=re.NextInt(0,600); + else + pos=999; + untitledlas.SetTexture(SprSheet,0,264,248,8); + } + void noname2pnt() + { + if(!las) + CreateBullet255(untitledbul.bulletpos.x,untitledbul.bulletpos.y,10); + else + { + for (int i=0;i<60;++i) + { + double trad=(i/60.0f)*pi*2; + vector2d a; + if (!(i%PMod)) + { + a.x=cos(trad)*range2;a.y=sin(trad)*range2; + } + else + { + a.x=cos(trad)*range1;a.y=sin(trad)*range1; + } + a=a+untitledbul.bulletpos; + CreateBullet255(a.x,a.y,10); + } + } + } + void Process() + { + if (!las) + ProcessBullet2(untitledbul),x=untitledbul.bulletpos.x,y=untitledbul.bulletpos.y; + else + untitledlas.EnableColl=true, + untitledlas.Process(); + if (!untitledbul.exist)y=-1; + if (y>pos&&!done&&!las) + { + las=true; + range1=range2=2; + for (int i=0;i<60;++i) + { + double trad=(i/60.0f)*pi*2; + vector2d a,b; + a.x=cos(trad)*range1;a.y=sin(trad)*range1; + b.x=cos(trad)*(range1-10);b.y=sin(trad)*(range1-10); + untitledlas.InsPoint(a,b,color); + } + int i=60; + double trad=1.0f/60*pi*2; + vector2d a,b; + if (!(i%PMod)) + { + a.x=cos(trad)*range2;a.y=sin(trad)*range2; + b.x=cos(trad)*(range2-10);b.y=sin(trad)*(range2-10); + } + else + { + a.x=cos(trad)*range1;a.y=sin(trad)*range1; + b.x=cos(trad)*(range1-10);b.y=sin(trad)*(range1-10); + } + for (int i=60;i<MaxRes;++i)untitledlas.InsPoint(a,b,color); + }else + if (las) + { + untitledlas.RenCtr=vector2d(x+7.2,y+7.2); + untitledlas.Render();untitledlas.EnableColl=true; + untitledlas.Process(); + if (!reverse) + { + if (range1<r1lim)range1+=0.2*(1000.0/hge->Timer_GetFPS()),range2=range1; + if (range1>=r1lim&&range2<r2lim)range2+=0.1*(1000.0/hge->Timer_GetFPS()); + if (range2>=r2lim)reverse=true; + } + else + { + if (range2>=r1lim)range2-=0.1*(1000.0/hge->Timer_GetFPS());else range1-=0.2*(1000.0/hge->Timer_GetFPS()),range2=range1; + if (range1<=2)las=false,done=true; + } + for (int i=0;i<60;++i) + { + double trad=(i/60.0f)*pi*2; + vector2d a,b; + if (!(i%PMod)) + { + a.x=cos(trad)*range2;a.y=sin(trad)*range2; + b.x=cos(trad)*(range2-10);b.y=sin(trad)*(range2-10); + } + else + { + a.x=cos(trad)*range1;a.y=sin(trad)*range1; + b.x=cos(trad)*(range1-10);b.y=sin(trad)*(range1-10); + } + untitledlas.Setdata(i,a,b,color); + } + int i=60; + double trad=pi*2; + vector2d a,b; + if (!(i%PMod)) + { + a.x=cos(trad)*range2;a.y=sin(trad)*range2; + b.x=cos(trad)*(range2-10);b.y=sin(trad)*(range2-10); + } + else + { + a.x=cos(trad)*range1;a.y=sin(trad)*range1; + b.x=cos(trad)*(range1-10);b.y=sin(trad)*(range1-10); + } + for (int i=60;i<MaxRes;++i) + untitledlas.Setdata(60,a,b,color); + } + } +}noname[1000]; +//"CTarg" +class SimpleBullet +{ +public: + TColors aC,aC2; + vector2d bulletpos; + int scollable,lastcoll; + double rot; + bool Update_SimpBul() + { + if (lastcoll) + { + ++lastcoll; + if (LOWFPS)lastcoll+=16; + } + if (scollable) + { + ++scollable; + if (LOWFPS)scollable+=16; + } + if (lastcoll>=200)lastcoll=0; + if (scollable>=200)scollable=0; + if (aC2==COLOR_COUNT)bulletspr[aC]->RenderEx(bulletpos.x+7.2,bulletpos.y+7.2,0,0.6,0);//blink hack + else RenderAlter(vector2d(bulletpos.x+7.2,bulletpos.y+7.2),aC,aC2,rot,0.6); + double dis=GetDist(bulletpos,playerpos); + if (dis<=6&&clrrange<1e-5&&clrrad-pi/2<1e-7&&!lastcoll) + { + ++coll,scminus+=10000;lastcoll=1;Mult_BatClear(); + return true;//Collision + } + else + { + if (dis<=16&&!scollable)++semicoll,++dsmc,scollable=1,SCEffect_Attatch(); + return false; + } + } +}; +class TCTarg +{ +private: + Target Targ; + SimpleBullet CircBul[37]; + int BulLim,bul; + double radian,range; + double Ubrk,Ulim; +public: + void Init(int _BulLim,double _InitRange,double _Ulim) + { + Targ.Init(-0.01,playerpos); + Targ.TargShow(); + BulLim=_BulLim; + Ulim=_Ulim; + bul=BulLim; + radian=0; + range=_InitRange; + for (int i=1;i<=BulLim;++i) + { + CircBul[i].bulletpos=vector2d(3+Targ.targpos.x+range*sin(radian-i*(2*pi/BulLim)), + 3+Targ.targpos.y-range*cos(radian-i*(2*pi/BulLim))); + CircBul[i].aC=blue;CircBul[i].aC2=COLOR_COUNT;CircBul[i].rot=0; + CircBul[i].scollable=0; + } + } + double GetRange() + { + return range; + } + void SetRange(double _range) + { + range=_range; + } + void Update() + { + Targ.TargRender(); + if (LOWFPS)radian+=17*60*pi/50000.0f;else radian+=60*pi/50000.0f; + Ubrk+=hge->Timer_GetDelta(); + hgeColorRGB tcol; + tcol.a=tcol.r=1; + tcol.b=tcol.g=Ubrk>Ulim?0.0f:(Ulim-Ubrk)/Ulim; + Targ.targspr->SetColor(tcol.GetHWColor()); + if (Ubrk>Ulim) + { + Targ.TargFollowPlayer(); + if (GetDist(Targ.targpos,playerpos)<4.0f)Ubrk=0.0f; + } + for (int i=1;i<=bul;++i) + { + CircBul[i].bulletpos=vector2d(3+Targ.targpos.x+range*sin(radian-i*(2*pi/BulLim))-6, + 3+Targ.targpos.y-range*cos(radian-i*(2*pi/BulLim))-6); + CircBul[i].Update_SimpBul(); + } + } +}; +TCTarg CTarg; +#undef rad1 +#undef rad2 +class TROF +{ +public: + int Bul[64]; + double rad1,rad2,drad,srad,dtrad,dtrad2; + double range,drange,dtrange,cdtrange; + int stage,cnt,ccnt,delay,cf; + double elasp; + void init() + { + stage=0;rad1=rad2=srad;elasp=0.0f;ccnt=0; + 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[i]].inv=true; + bullet[Bul[0]].bulletspeed=2;bullet[Bul[0]].scale=1; + } + void stage0() + { + elasp+=hge->Timer_GetDelta(); + if ((int)(elasp/0.15f)>ccnt&&ccnt<cnt-1) + { + ccnt=(int)(elasp/0.2f); + 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;NewMultpo(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)bullet[Bul[i]].bulletspeed=0; + cf=0; + } + } + void stage1() + { + cf+=(LOWFPS?17:1); + rad1=srad+dtrad*cf;rad2=srad-dtrad2*cf; + for (int i=0;i<cnt;++i) + if (bullet[Bul[i]].bullettype==8) + { + if (i&1) + bullet[Bul[i]].bulletpos=vector2d(400+(drange+(cnt-i)*dtrange)*cos(rad1-pi),300+(drange+(cnt-i)*dtrange)*sin(rad1-pi)); + else + 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 (bullet[Bul[i]].bullettype==8) + { + if (i&1) + bullet[Bul[i]].bulletpos=vector2d(400+(drange+(cnt-i)*dtrange)*cos(rad1-pi),300+(drange+(cnt-i)*dtrange)*sin(rad1-pi)); + else + 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); + bullet[Bul[i]].inv=false; + } + stage=2; + } + } + void stage2(){} + void update() + { + switch(stage) + { + case 0:stage0();break; + case 1:stage1();break; + case 2:stage2();break; + } + } +}; +class BCircle +{ +private: + SimpleBullet Bullets[360]; + int BCnt; + double radian,range,DT,drad; + vector2d Centre; +public: + void Init(double _irange,double _drad,int _Cnt,vector2d _Centre,TColors _Col=blue,TColors _Col2=COLOR_COUNT) + { + range=_irange; + BCnt=_Cnt; + radian=0; + DT=0.0f; + drad=_drad; + Centre=_Centre; + for (int i=1;i<=BCnt;++i) + { + Bullets[i].bulletpos=vector2d(3+Centre.x+range*sin(radian-i*(2*pi/BCnt))-6, + 3+Centre.y-range*cos(radian-i*(2*pi/BCnt))-6); + Bullets[i].aC=_Col;Bullets[i].aC2=_Col2; + Bullets[i].rot=0; + } + } + double GetRange(){return range;} + void SetRange(double _range){range=_range;} + void SetDT(double _DT){DT=_DT;} + double GetDT(){return DT;} + double GetRad(){return radian;} + void circ2pnt() + { + for(int i=1;i<=BCnt;++i) + CreateBullet255(Bullets[i].bulletpos.x,Bullets[i].bulletpos.y,10); + } + void Update() + { + DT+=hge->Timer_GetDelta(); + if (LOWFPS)radian+=17*drad;else radian+=drad; + for (int i=1;i<=BCnt;++i) + { + Bullets[i].bulletpos=vector2d(3+Centre.x+range*sin(radian-i*(2*pi/BCnt))-6, + 3+Centre.y-range*cos(radian-i*(2*pi/BCnt))-6); + Bullets[i].rot+=(LOWFPS?17:1)*pi/1000; + Bullets[i].Update_SimpBul(); + } + } +}; +class BulletSine +{ +private: + Bullet headb; + vector2d a,b,lastgenerated; + int generated[400]; + int gencnt; + bool OutOfBound() + { + if (headb.bulletpos.x<=-25||headb.bulletpos.x>=825||headb.bulletpos.y<=-25||headb.bulletpos.y>=625) + return true;return false; + } +public: + bool active; + void Init(vector2d _a,vector2d _b) + { + a=_a;b=_b;lastgenerated=_a; + CreateBullet2(headb,a.x,a.y,6,0); + headb.redir(b); + active=true;memset(generated,0,sizeof(generated)); + gencnt=0; + } + void Update() + { + if (GetDist(lastgenerated,headb.bulletpos)>4.0f) + { + ++gencnt; + double rad=(gencnt&1)?(gencnt+1)/2*pi/18.0f:-gencnt/2*pi/18.0f; + generated[gencnt]=CreateBullet2(headb.bulletpos.x,headb.bulletpos.y,0,rad,true); + bullet[generated[gencnt]].inv=true; + lastgenerated=headb.bulletpos; + } + if (OutOfBound()) + { + active=false; + for (int i=1;i<=gencnt;++i) + if (generated[i]) + 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); + } +}; +class WOP +{ +private: + int trail[200]; + double brk,blim,rad,k,ml; + vector2d a,b; + Bullet hbul; + bool OutOfBound() + { + if (hbul.bulletpos.x<=-25||hbul.bulletpos.x>=825||hbul.bulletpos.y<=-25||hbul.bulletpos.y>=625) + { + for (int i=0;i<200;++i)if (trail[i])return false; + return true; + }return false; + } +public: + bool active; + 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); + CreateBullet2(hbul,a.x,a.y,7,0);hbul.redir(b); + active=true;memset(trail,0,sizeof(trail)); + } + void Update() + { + if (Current_Position!=1)return; + ProcessBullet2(hbul,false); + brk+=hge->Timer_GetDelta(); + if (brk>blim) + { + brk=0; + for (int i=0;i<200;++i) + { + if (trail[i]) + if (bullet[trail[i]].lifetime>ml)BulletEffect_Death(bullet[trail[i]],0x8000CCFF),bullet[trail[i]].exist=false,trail[i]=0; + } + rad+=pi/16.0f; + vector2d uv=ToUnitCircle(vector2d(1,-k));uv.Swap(); + int pnt=0;while (trail[pnt])++pnt; + trail[pnt]=CreateBullet2(hbul.bulletpos.x+uv.x*50*sin(rad),hbul.bulletpos.y+uv.y*50*sin(rad),0,0,true); + pnt=0;while (trail[pnt])++pnt; + trail[pnt]=CreateBullet2(hbul.bulletpos.x-uv.x*50*sin(rad),hbul.bulletpos.y-uv.y*50*sin(rad),0,0,true); + } + if (OutOfBound())active=false; + } +}; +class BTail +{ +//devide the screen into a 16*12 matrix, put random colored bullets, arranged +//in the shape of the snake, on to it. +//^Maybe this description is too bad to understand. See the code. +//Partly based on class WOP +private: + class Pile + { + private: + int pb[200]; + int matrixx,matrixy,progress,cnt; + double brk;TColors color; + public: + int getProgress(){return progress;} + void create(int _x,int _y,TColors _col) + { + matrixx=_x;matrixy=_y;color=_col; + progress=1;cnt=0; + } + void kill() + { + for(int i=0;i<cnt;++i) + { + if(pb[i]) + { + if(bullet[pb[i]].bullettype==2) + { + bullet[pb[i]].exist=false;pb[i]=0; + } + } + } + } + void update() + { + if(!progress)return; + if(progress<10) + { + brk+=hge->Timer_GetDelta(); + if(brk>0.03) + { + brk=0;if(progress++>5)return (void)(progress=10); + for(int i=0;i<10;++i) + { + vector2d ran=vector2d(re.NextDouble(0,50)+matrixx*50,re.NextDouble(0,50)+matrixy*50); + pb[cnt++]=CreateBullet2(ran.x,ran.y,0,0,true); + bullet[pb[cnt-1]].alterColor=color; + } + } + } + else + { + brk+=hge->Timer_GetDelta(); + if(brk>0.03) + { + bool alldone=true; + for(int i=0;i<cnt;++i) + { + if(pb[i]) + { + if(bullet[pb[i]].bullettype==2&&bullet[pb[i]].lifetime>1) + { + BulletEffect_Death(bullet[pb[i]],ColorToDWORD(color)); + bullet[pb[i]].exist=false;pb[i]=0; + } + else alldone=false; + } + } + if(alldone)progress=0; + } + } + } + }; + Pile piles[30]; + bool tactive; + int listx[30],listy[30],cnt; + TColors pcolor;double tlifetime; + bool check(int x,int y) + { + if(x<0||x>15)return false; + if(y<0||y>12)return false; + for(int i=0;i<cnt;++i) + if(x==listx[i]&&y==listy[i])return false; + return true; + } +public: + bool isActive(){return tactive;} + void Create() + { + pcolor=(TColors)re.NextInt(0,7);tactive=true; + cnt=0;memset(listx,0,sizeof(listx)); + memset(listy,0,sizeof(listy));tlifetime=0; + listx[cnt++]=re.NextInt(0,15);listy[cnt-1]=re.NextInt(0,11); + piles[cnt-1].create(listx[cnt-1],listy[cnt-1],pcolor); + } + void Update() + { + tlifetime+=hge->Timer_GetDelta(); + if(tlifetime>15) + { + tactive=false; + for(int i=0;i<30;++i) + if(piles[i].getProgress())piles[i].kill(); + } + if(piles[cnt-1].getProgress()==10) + { + int dlx[4],dly[4],dcnt=0; + if(check(listx[cnt-1]+1,listy[cnt-1])) + dlx[dcnt]=listx[cnt-1]+1,dly[dcnt++]=listy[cnt-1]; + if(check(listx[cnt-1]-1,listy[cnt-1])) + dlx[dcnt]=listx[cnt-1]-1,dly[dcnt++]=listy[cnt-1]; + if(check(listx[cnt-1],listy[cnt-1]+1)) + dlx[dcnt]=listx[cnt-1],dly[dcnt++]=listy[cnt-1]+1; + if(check(listx[cnt-1],listy[cnt-1]-1)) + dlx[dcnt]=listx[cnt-1],dly[dcnt++]=listy[cnt-1]-1; + if(dcnt&&cnt<30) + { + int rd=re.NextInt(0,dcnt-1); + listx[cnt++]=dlx[rd];listy[cnt-1]=dly[rd]; + piles[cnt-1].create(listx[cnt-1],listy[cnt-1],pcolor); + } + } + bool none=true; + for(int i=0;i<30;++i) + if(piles[i].getProgress())none=false,piles[i].update(); + if(none)tactive=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<cnt;++i) + { + b[i].bulletpos=vector2d(center.x+r[i/10]*cos(i/10*pi/12+pi/5*(i%10)),center.y+r[i/10]*sin(i/10*pi/12+pi/5*(i%10))); + if(r[i/10]<mr[i/10])r[i/10]+=(LOWFPS?17:1)*0.01,all=false; + else r[i/10]=mr[i/10]; + b[i].Update_SimpBul(); + } + if(all||rot) + { + rot=true; + rv?rad+=(LOWFPS?17:1)*ra:rad-=(LOWFPS?17:1)*ra; + if(ra<pi/7200)ra+=(LOWFPS?17:1)*pi/630000000.0f; + for(int i=0;i<cnt;++i) + { + b[i].bulletpos=vector2d(center.x+r[i/10]*cos(i/10*pi/12+rad+pi/5*(i%10)),center.y+r[i/10]*sin(i/10*pi/12+rad+pi/5*(i%10))); + b[i].Update_SimpBul(); + } + } + } + void toPoint() + { + for(int i=0;i<cnt;++i) + CreateBullet255(b[i].bulletpos.x,b[i].bulletpos.y,10); + } +}; +class diffCreator +{ +protected: + bool active; + double range; + int cnt; + vector2d center; + int C; + int target[200]; + vector2d created[200]; +private: + TColors rbGetColor(int a) + { + switch (a) + { + case 2:return orange; + case 3:return yellow; + case 4:return green; + case 5:return blue; + case 6:return dblue; + case 7:return purple; + default:return circle; + } + } + bool test(vector2d a) + { + for(int i=0;i<cnt;++i) + if(GetDist(a,created[i])<12)return false; + return true; + } +public: + void init(vector2d _ctr) + { + active=true; + cnt=0;range=0; + center=_ctr; + C=CreateBullet2(center.x,center.y,0,0,true); + bullet[C].alterColor=red; + } + bool isActive(){return active;} + void update() + { + range+=hge->Timer_GetDelta()*400; + vector2d a;bool all=true; + for(a=vector2d(center.x-15,center.y);a.x>-25;a.x-=15) + if(GetDist(a,center)<=range) + { + if(test(a)) + target[cnt++]=CreateBullet2(a.x,a.y,0,0,true), + created[cnt-1]=vector2d(a.x,a.y), + 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++]=CreateBullet2(a.x,a.y,0,pi,true), + created[cnt-1]=vector2d(a.x,a.y), + 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++]=CreateBullet2(a.x,a.y,0,pi/2,true), + created[cnt-1]=vector2d(a.x,a.y), + 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++]=CreateBullet2(a.x,a.y,0,-pi/2,true), + created[cnt-1]=vector2d(a.x,a.y), + bullet[target[cnt-1]].inv=true, + bullet[target[cnt-1]].alterColor=red; + } + else all=false; + a=center; +#define _bat \ + 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++]=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++]=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++]=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++]=CreateBullet2(a.x-i*15,a.y-j*15,0,0,true),_bat;} + else all=false; +#undef _bat + if(all) + { + BulletEffect_Death(bullet[C],0x80FF3333); + bullet[C].exist=false; + for(int i=0;i<cnt;++i) + { + 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; + } + }; +}; +class RTV +{ +private: + int mode,cnt,stage,spnr,dcorr; + bool active;TColors col; + double drad,rad,brk; + int targ[600]; +public: + bool isActive(){return active;} + void Init(int _mode,double _drad,int _spnr,TColors _c,int _dcorr) + { + mode=_mode;drad=_drad;rad=0;spnr=_spnr; + brk=0;active=true;cnt=0;stage=0;col=_c; + memset(targ,0,sizeof(targ));dcorr=_dcorr; + } + void Update() + { + switch(mode) + { + case 1: + { + brk+=hge->Timer_GetDelta(); + bool dchk=(stage==1); + for(int i=0;i<cnt;++i) + { + 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(bullet[targ[i]].bulletdir.y,bullet[targ[i]].bulletdir.x); + int cc=(int)(rad/drad); + if((cc/6+dcorr)&1) + bullet[targ[i]].bulletaccel=0.005, + bullet[targ[i]].limv=3; + else + bullet[targ[i]].bulletaccel=-0.005, + bullet[targ[i]].limv=-3; + } + return(void)(active=false); + } + if(stage==0) + { + if(brk>0.05) + { + brk=0;rad+=drad; + if(fabs(rad)>2*pi/spnr+pi/180)return(void)(stage=1); + for(int i=0;i<spnr;++i) + { + targ[cnt]=CreateBullet2(400,300,2,rad+i*2*pi/spnr), + bullet[targ[cnt]].inv=true, + bullet[targ[cnt++]].alterColor=col; + } + } + } + } + break; + case 2: + { + brk+=hge->Timer_GetDelta(); + bool dchk=(stage==1); + for(int i=0;i<cnt;++i) + { + 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) + bullet[targ[i]].bulletaccel=-0.005, + bullet[targ[i]].limv=-3; + else + for(int i=0;i<cnt;++i) + bullet[targ[i]].bulletaccel=0.005, + bullet[targ[i]].limv=3; + return(void)(active=false); + } + if(stage==0) + { + if(brk>0.05) + { + brk=0;rad+=drad; + if(fabs(rad)>2*pi/spnr+pi/180)return(void)(stage=1); + for(int i=0;i<spnr;++i) + { + targ[cnt]=CreateBullet2(400,300,2,rad+i*2*pi/spnr), + bullet[targ[cnt]].inv=true; + bullet[targ[cnt++]].alterColor=col; + } + } + } + } + break; + case 3: + { + brk+=hge->Timer_GetDelta(); + if(brk>0.05) + { + brk=0;rad+=drad; + if(fabs(rad)>2*pi/spnr+pi/180)return(void)(active=false); + for(int i=0;i<spnr;++i) + { + 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; + } + } + } + break; + } + } +}; +bool achromab,achromaB[100]; +class achromaGroup +{ +private: + class achromaBullet:public SimpleBullet + { + private: + bool active; + double spd,acc,lim; + public: + bool isActive(){return active;} + void achromaInit(vector2d pos,TColors initcol,double _lim) + { + bulletpos=pos;spd=0;acc=0.0005;lim=_lim;rot=0; + lastcoll=0;aC=initcol;aC2=COLOR_COUNT; + active=true; + } + void Reverse() + { + spd=0; + if(aC==green)aC=red; + else if(aC==red)aC=green; + } + void achromaUpdate() + { + if(aC==red)lastcoll=1;//ignore coll for red. + bulletpos.y+=spd*(1000.0f/hge->Timer_GetFPS()); + if(spd+acc*(1000.0f/hge->Timer_GetFPS())<lim)spd+=acc*(1000.0f/hge->Timer_GetFPS()); + if(bulletpos.y>610)active=false; + Update_SimpBul(); + } + }bullets[1000]; +public: + double crbrk,llim;TColors col; + void Init(TColors initcol,double _llim) + { + col=initcol;llim=_llim; + crbrk=re.NextDouble(0,frameleft/(double)(AMinute+ThirtySeconds))*(part==36?0.07:0.02)+0.03; + } + void Reverse() + { + if(col==red)col=green; + else if(col==green)col=red; + for(int i=0;i<1000;++i)if(bullets[i].isActive())bullets[i].Reverse(); + } + void achroma2pnt() + { + for(int i=0;i<1000;++i)if(bullets[i].isActive())CreateBullet255(bullets[i].bulletpos.x,bullets[i].bulletpos.y,10); + } + void Update(int msk=0) + { + crbrk-=hge->Timer_GetDelta(); + if(achromab) + { + if(crbrk<=0) + { + crbrk=re.NextDouble(0,frameleft/(double)AMinute)*(part==36?0.07:0.02)+0.03; + for(int i=0;i<1000;++i) + if(!bullets[i].isActive()) + { + bullets[i].achromaInit(vector2d(re.NextDouble(10,790),-5),col,llim); + break; + } + } + for(int i=0;i<1000;++i)if(bullets[i].isActive())bullets[i].achromaUpdate(); + } + else + { + if(crbrk<=0) + { + crbrk=1; + if(msk) + { + memset(achromaB,0,sizeof(achromaB)); + for(int i=0;i<80;++i)achromaB[i]=re.NextInt(0,1); + } + for(int i=0;i<80;++i) + { + if(achromaB[i]&&col==green) + { + for(int j=0;j<1000;++j) + if(!bullets[j].isActive()) + { + bullets[j].achromaInit(vector2d(i*10,-5),col,llim); + break; + } + } + if(!achromaB[i]&&col==red) + { + for(int j=0;j<500;++j) + if(!bullets[j].isActive()) + { + bullets[j].achromaInit(vector2d(i*10,-5),col,llim); + break; + } + } + } + } + for(int i=0;i<500;++i)if(bullets[i].isActive())bullets[i].achromaUpdate(); + } + } +}; +class yellowGroup +{ +private: + int ylw[100]; + bool dirdone[100]; + bool active; +public: + bool isActive(){return active;} + void Init(int _cnt,double _yv) + { + memset(ylw,0,sizeof(ylw));active=true; + memset(dirdone,0,sizeof(dirdone)); + for (int i=0;i<_cnt;++i) + { + int pnt=CreateBullet2(400,300,_yv,frameleft*pi/AMinute+i*(2*pi/_cnt)); + bullet[pnt].alterColor=yellow; + ylw[i]=pnt; + } + } + void Update() + { + bool done=true; + for (int i=0;i<100;++i) + { + 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(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(bullet[ylw[i]],ColorToDWORD(yellow)); + bullet[ylw[i]].exist=false; + bullet[ylw[i]].bullettype=0; + ylw[i]=0; + } + else done=false; + } + if(done)active=false; + } +}; +class Spinner +{ +private: + SimpleBullet abullet[40][100]; + int arms; + double rad,rstep; +public: + void Init(int _arms,double _rstep) + { + memset(abullet,0,sizeof(abullet)); + arms=_arms;rstep=_rstep;rad=0; + for(int i=0;i<arms;++i) + for(int j=0;j*rstep<505;++j) + { + abullet[i][j].aC=blue;abullet[i][j].aC2=COLOR_COUNT; + } + } + void Update(double delta) + { + for(int i=0;i<arms;++i) + for(int j=0;j*rstep<505;++j) + { + double crad=rad+i*(2*pi/arms); + abullet[i][j].bulletpos=vector2d(400+j*rstep*cos(crad),300+j*rstep*sin(crad)); + abullet[i][j].Update_SimpBul(); + } + rad+=hge->Timer_GetDelta()*1000*delta; + } +}; +class expSpinner +{ +private: + int bullets[1000]; + int arms,cnt,lc; + double brk,len,dr,da; + bool active; + bool InBound(vector2d pos) + { + if (pos.x<=-25||pos.x>=825||pos.y<=-25||pos.y>=625) + return false;return true; + } +public: + void Init(int _arms,double _drange,double _drad) + { + arms=_arms;lc=cnt=len=0;dr=_drange;da=_drad;active=true; + } + bool isActive(){return active;} + void Update() + { + brk+=hge->Timer_GetDelta(); + if(brk<0.03)return;brk=0; + bool none=true; + for(int i=0;i<arms;++i) + { + 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++]=CreateBullet2( + 400+len*cos(rad),300+len*sin(rad),0,c*drad,true); + c=-c;none=false; + } + } + len+=dr;++lc; + if(none) + { + active=false; + for(int i=0;i<cnt;++i)bullet[bullets[i]].bulletaccel=0.002,bullet[bullets[i]].limv=2; + } + } +}; +class CPinBall +{ +private: + int center; + int circles[10][30]; + int layer,lifetime;double rot,drt; + vector2d delta; +public: + vector2d& Delta(){return delta;} + vector2d& Position(){return bullet[center].bulletpos;} + double Radius(){return layer*10.0-5;} + void Init(vector2d pos,int _lay) + { + center=0;memset(circles,0,sizeof(circles));double speed=re.NextDouble(2,5); + center=CreateBullet2(pos.x,pos.y,speed,re.NextInt(-pi,pi),true); + delta=speed*bullet[center].bulletdir; + layer=_lay;rot=0;lifetime=1;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]=CreateBullet2(pos.x,pos.y,0,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))); + } + } + } + void Kill() + { + BulletEffect_Death(bullet[center],ColorToDWORD(blue)); + bullet[center].exist=bullet[center].bullettype=0; + for(int i=0;i<layer;++i) + for(int j=0;j<(i+1)*3;++j) + { + BulletEffect_Death(bullet[circles[i][j]],ColorToDWORD(blue)); + bullet[circles[i][j]].exist=bullet[circles[i][j]].bullettype=0; + } + lifetime=0; + } + int& Getlifetime(){return lifetime;} + void UpdateDelta() + { + vector2d tdt=ToUnitCircle(delta); + bullet[center].bulletdir=tdt;bullet[center].bulletspeed=delta.l(); + } + void Update() + { + vector2d pos=bullet[center].bulletpos; + rot+=hge->Timer_GetDelta()*drt; + for(int i=0;i<layer;++i) + for(int j=0;j<(i+1)*3;++j) + 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))); + } +}; +class LineLaser:public Laser +{ +protected: + double width; + vector2d a,b; + DWORD color; +public: + void SetColl(bool col){EnableColl=col;} + void InitLine(vector2d _a,vector2d _b,double _w,DWORD _c) + { + a=_a;b=_b;color=_c;Init(2); + SetTexture(SprSheet,151,264,2,8); + SetWidth(_w);RenCtr=vector2d(0,0); + } + void SetWidth(double _w) + { + width=_w; + vector2d dir(a-b);dir.ToUnitCircle(); + vector2d pd=dir;pd.Rotate(pi/2); + Setdata(0,a-width*pd,a+width*pd,color); + for(int i=1;i<MaxRes;++i)Setdata(i,b-width*pd,b+width*pd,color); + } + double GetWidth(){return width;} + void llsrtopnt(double dis) + { + vector2d dir=a-b;dir.ToUnitCircle();dir=dis*dir; + vector2d x=b; + while(!(x.x<=-25||x.x>=825||x.y<=-25||x.y>=625)) + { + CreateBullet255(x.x,x.y,10); + x=x+dir; + } + } + //use Laser::Process... +}; +class SimpLL:public LineLaser +{ +public: + bool active; + int stp; + double brk; +}; +class SELineLaser +{ +private: + LineLaser lsr; + bool active,h; + double brk,x; +public: + bool isActive(){return active;} + void Init(int _x,bool _h) + { + x=_x;h=_h; + if(h) + lsr.InitLine(vector2d(0,x),vector2d(800,x),0,SETA(ColorToDWORD(blue),0x80)); + else + lsr.InitLine(vector2d(x,0),vector2d(x,600),0,SETA(ColorToDWORD(blue),0x80)); + active=true;brk=0.05; + } + void Update() + { + lsr.Process(); + brk-=hge->Timer_GetDelta(); + if(brk<0) + { + brk=0.05; + lsr.SetWidth(lsr.GetWidth()+0.2); + if(lsr.GetWidth()>1)lsr.SetColl(true); + if(lsr.GetWidth()>6) + { + int t=0; + if(!re.NextInt(0,2)) + { + if(h?playerpos.y>x:playerpos.x>x)t=1; + vector2d px; + vector2d dir=h?vector2d(-1,0):vector2d(0,-1);dir=18*dir; + for(int c=0,tt=t;c<2;++c,dir=-1*dir,tt=t^1) + { + px=h?vector2d(playerpos.x,x):vector2d(x,playerpos.y); + if(c)px=px+dir; + while(!(px.x<=-25||px.x>=825||px.y<=-25||px.y>=625)) + { + tt^=1; + int pnt=CreateBullet2(px.x,px.y,0,0); + bullet[pnt].bulletdir=(tt?1:-1)*(h?vector2d(0,1):vector2d(1,0)); + bullet[pnt].limv=3;bullet[pnt].bulletaccel=0.001; + px=px+dir; + } + } + } + else + { + vector2d dir=h?vector2d(-1,0):vector2d(0,-1);dir=18*dir; + vector2d px=h?vector2d(800+re.NextInt(-18,0),x):vector2d(x,600+re.NextInt(-18,0)); + while(!(px.x<=-25||px.x>=825||px.y<=-25||px.y>=625)) + { + t^=1; + int pnt=CreateBullet2(px.x,px.y,0,0); + bullet[pnt].bulletdir=(t?1:-1)*(h?vector2d(0,1):vector2d(1,0)); + bullet[pnt].limv=3;bullet[pnt].bulletaccel=0.001; + px=px+dir; + } + } + active=false; + } + } + } +}; |