From eaa6a19cd0537c0bb8d57d743f894f58c62d378a Mon Sep 17 00:00:00 2001 From: "chirs241097@gmail.com" Date: Sun, 2 Mar 2014 02:58:08 +0000 Subject: New interface for background class, other minor level changes. --- CHANGELOG.TXT | 4 +++- background.h | 14 ++++++++------ levels.h | 16 ++++++++-------- main.cpp | 10 ++-------- towernbullet.h | 4 +++- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 3b2f83d..53ac014 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -2,7 +2,8 @@ Next version: 0.7.2-1_PR TODOs: -New levels, pre-release preparation, resource remaking. +Couple of tests, new levels, pre-release preparation, resource +remaking. 0.7.x-x_PR will be another public pre-release version. Pre-Released versions: @@ -18,6 +19,7 @@ memory leak in this level (by using more memory!) Rearrange levels to the order they will appear in the final version. New background interface, use background pictures easily. Make "Tiled" background mode work. +Add SetScale to background class. Make you dizzy easily... Fix a small glitch in Level3Part3-4. This level won't run correctly under Low FPS Mode. Minor code cleanups. diff --git a/background.h b/background.h index 1a69789..728f005 100644 --- a/background.h +++ b/background.h @@ -474,6 +474,7 @@ private: DWORD alpha,alim; bool onfadein,onfadeout; int fadebreak; + double scale; void DoFadeIn() { if (LOWFPS)fadebreak+=17;else ++fadebreak; @@ -490,9 +491,9 @@ private: else if (alpha<0x2)alpha=0;else alpha-=0x2; if (!alpha)onfadeout=false; } - void RenderCenterAt(vector2d a) + void RenderCenterAt(vector2d a,double scl) { - vector2d s=vector2d(hge->Texture_GetWidth(quad.tex,true),hge->Texture_GetHeight(quad.tex,true)); + 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; @@ -502,10 +503,11 @@ private: } 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; + Mode=_Mode;scale=1; 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; @@ -518,14 +520,14 @@ public: switch(Mode) { case Centered: - RenderCenterAt(vector2d(400,300)); + RenderCenterAt(vector2d(400,300),scale); break; case Tiled: { - vector2d s=vector2d(hge->Texture_GetWidth(quad.tex,true),hge->Texture_GetHeight(quad.tex,true)); + 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)); + RenderCenterAt(vector2d(s.x/2+i*s.x,s.y/2+j*s.y),scale); } break; case Stretched: diff --git a/levels.h b/levels.h index 349cd09..41be41a 100644 --- a/levels.h +++ b/levels.h @@ -2000,8 +2000,8 @@ void Level6Part20() } void Level6Part21() { - avacurbrk+=hge->Timer_GetDelta(); //Well, you killed process. - sixbrk+=hge->Timer_GetDelta(); //Yeah, this is the 2014th line. + avacurbrk+=hge->Timer_GetDelta(); + sixbrk+=hge->Timer_GetDelta(); if (frameleftTimer_GetDelta(); if (ykbrk<0&&frameleft>TenSeconds/10*3) { - ykbrk=(double)frameleft/AMinute+0.5f; + ykbrk=(double)frameleft/AMinute*0.75f+0.75f; for (int i=0;i<100;++i) if (!bnl[i].active) { @@ -2827,7 +2827,7 @@ int CCnt,state; void Level7Part16()//Great circles { towcnt=0; - frameleft=Infinity; + 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; @@ -2917,7 +2917,7 @@ void Level7Part17()//Great circles-child1 Circles[10].SetRange(Circles[10].GetRange()-0.1), Circles[11].SetRange(Circles[11].GetRange()-0.1); } - if (Circles[12].GetRange()>=380&&CCnt>=13)//96 + if (Circles[12].GetRange()>=420&&CCnt>=13)//96 { int times=1;if (LOWFPS)times=17; for (int i=1;i<=times;++i) @@ -2967,7 +2967,7 @@ void Level7Part18()//Great circles-child2 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(380+30*sin(Circles[i].GetDT())); + if (i==12||i==13)Circles[i].SetRange(420+30*sin(Circles[i].GetDT())); Circles[i].Update(); } } diff --git a/main.cpp b/main.cpp index 43a432c..94b90e6 100644 --- a/main.cpp +++ b/main.cpp @@ -172,15 +172,9 @@ void ProcessPlayer() playerrot+=0.00174533*17; double realspd; if (hge->Input_GetKeyState(HGEK_SHIFT)) - if (LOWFPS) - realspd=playerslospeed*17; - else - realspd=playerslospeed; + realspd=playerslospeed*(1000.0f/hge->Timer_GetFPS()); else - if (LOWFPS) - realspd=playerspeed*17; - else - realspd=playerspeed; + realspd=playerspeed*(1000.0f/hge->Timer_GetFPS()); if (hge->Input_GetKeyState(HGEK_LEFT)&&!playerLockX) { if (playerpos.x>10) diff --git a/towernbullet.h b/towernbullet.h index 5afb1ef..854d161 100644 --- a/towernbullet.h +++ b/towernbullet.h @@ -1783,6 +1783,7 @@ public: ++gencnt; double rad=(gencnt&1)?(gencnt+1)/2*pi/18.0f:-gencnt/2*pi/18.0f; generated[gencnt]=&bullet[CreateBullet2(headb.bulletpos.x,headb.bulletpos.y,0,rad,true)]; + generated[gencnt]->inv=true; lastgenerated=headb.bulletpos; } if (OutOfBound()) @@ -1791,7 +1792,8 @@ public: //Release them! for (int i=1;i<=gencnt;++i) if (generated[i])//explosion prevention - generated[i]->bulletaccel=0.005,generated[i]->limv=2; + generated[i]->bulletaccel=0.005,generated[i]->limv=2, + generated[i]->inv=false,generated[i]->collable=true; memset(generated,0,sizeof(generated));//therefore we won't touch those fucking things accidently } ProcessBullet2(headb); -- cgit v1.2.3