aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCHANGELOG.TXT2
-rw-r--r--levels.h4
-rw-r--r--libcgh.h8
-rw-r--r--main.cpp77
-rw-r--r--towernbullet.h15
5 files changed, 77 insertions, 29 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index 87f6e7d..0b3151f 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -8,6 +8,8 @@ Pre-Released versions:
0.8.0-1_PR (b75)
New level Supernova.
Extend libcgh again. Adding operator ^ and method l().
+Modify clearrange behaviour in level hyper-threading.
+Modify the corresponding score bullet.
0.8.0-0_PR (b74)
New level Achromatopsia.
diff --git a/levels.h b/levels.h
index ad4ec17..14ef2f4 100644
--- a/levels.h
+++ b/levels.h
@@ -3149,6 +3149,7 @@ 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);
@@ -3164,7 +3165,6 @@ support hyper-threading?");
else
{
IfCallLevel=false;
- playerpos=vector2d(200,150);PlayerSplit=true;
return;
}
}
@@ -3184,7 +3184,7 @@ void Levelm1Part12()
tower[i].RendColor=tower[i].RendColor+0x01FFFFFF;
else
{
- IfCallLevel=false;
+ IfCallLevel=false;BTarg.TargHide();
return;
}
}
diff --git a/libcgh.h b/libcgh.h
index 1ca7d4a..5369bd8 100644
--- a/libcgh.h
+++ b/libcgh.h
@@ -2,7 +2,7 @@
//Chrisoft Game Helper header
//Copyright Chrisoft 2014
//libcgh version 0007
-//Last full compatible version 0002
+//Last full compatible version 0007
//^Modify that when big change is made^
#include <hge.h>
#include <hgefont.h>
@@ -52,13 +52,13 @@ struct vector2d
inline vector2d ToUnitCircle(vector2d input)
{
vector2d res=input;
- res.x=res.x/sqrt(sqr(input.x)+sqr(input.y));
- res.y=res.y/sqrt(sqr(input.x)+sqr(input.y));
+ res.x=res.x/input.l();
+ res.y=res.y/input.l();
return res;
}
inline double GetDist(const vector2d a,const vector2d b)
{
- return sqrtf((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
+ return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
}
inline double GetDistSeg(const vector2d a,const vector2d b,const vector2d c)
{
diff --git a/main.cpp b/main.cpp
index 5f2c096..618c8e9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -104,12 +104,19 @@ void Player_Clear_Expand()
clrrange+=13.6;
else
clrrange+=0.8;
+ int ds;
for (int i=1;i<=bulcnt;++i)
{
- double dis=GetDist(bullet[i].bulletpos,playerpos);
- if (dis<=clrrange&&bullet[i].exist&&!bullet[i].inv)
+ double dis=GetDist(bullet[i].bulletpos,playerpos);ds=0;
+ if(PlayerSplit)
+ for(int j=1;j<4;++j)
{
- CreateBullet255(bullet[i].bulletpos.x,bullet[i].bulletpos.y,10);
+ if(dis>GetDist(bullet[i].bulletpos,playerpos+splitData[j]))
+ dis=GetDist(bullet[i].bulletpos,playerpos+splitData[j]),ds=j;
+ }
+ if (bullet[i].bullettype!=255&&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;
@@ -130,7 +137,7 @@ void Player_Clear_Rotate()
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);
while (rad<0)rad+=2*pi;
- if (dis<=clrmaxrange&&bullet[i].exist&&!bullet[i].inv&&rad>normalizerad(clrrad)-pi/12&&rad<normalizerad(clrrad)+pi/12)
+ 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);
bullet[i].exist=false;
@@ -139,6 +146,24 @@ void Player_Clear_Rotate()
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()
@@ -146,10 +171,10 @@ void ProcessPlayer()
if (!clrcircle)
{
clrcircle=new hgeSprite(SprSheet,63,71,193,193);
- clrcircle->SetColor(0x30800000);
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);
@@ -219,6 +244,8 @@ void ProcessPlayer()
}
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(HGEK_X)==HGEKST_KEEP&&clrrange==0&&diffkey)
{
@@ -228,6 +255,8 @@ void ProcessPlayer()
}
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(HGEK_Z)==HGEKST_RELEASE&&clrrange==0&&!diffkey)
{
@@ -251,22 +280,27 @@ void ProcessPlayer()
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 (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=0;
}
else
{
- if (hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT&&clrrad-pi/2<1e-7&&clrtime+clrbns&&!diffkey)
+ if (hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_HIT&&clrrad-pi/2<1e-7&&!diffkey)
{
clrmaxrange=0;clrind=0;
}
- if (hge->Input_GetKeyStateEx(HGEK_X)==HGEKST_HIT&&clrrad-pi/2<1e-7&&clrtime+clrbns&&diffkey)
+ if (hge->Input_GetKeyStateEx(HGEK_X)==HGEKST_HIT&&clrrad-pi/2<1e-7&&diffkey)
{
clrmaxrange=0;clrind=0;
}
- if (hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_KEEP&&clrrange==0&&clrtime+clrbns&&!diffkey)
+ if (hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_KEEP&&clrrange==0&&!diffkey)
{
if (clrmaxrange<=400)
{
@@ -274,8 +308,10 @@ void ProcessPlayer()
}
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(HGEK_X)==HGEKST_KEEP&&clrrange==0&&clrtime+clrbns&&diffkey)
+ if (hge->Input_GetKeyStateEx(HGEK_X)==HGEKST_KEEP&&clrrange==0&&diffkey)
{
if (clrmaxrange<=400)
{
@@ -283,18 +319,25 @@ void ProcessPlayer()
}
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(HGEK_Z)==HGEKST_RELEASE&&clrrad-pi/2<1e-7&&clrtime+clrbns&&!diffkey&&clrmaxrange>50)
+ if (hge->Input_GetKeyStateEx(HGEK_Z)==HGEKST_RELEASE&&clrrad-pi/2<1e-7&&clrtime+clrbns&&!diffkey)
{
- Player_Clear_Rotate();--clrtime;++clrusg;
+ Player_Clear_Rotate();if(clrmaxrange<50)--clrtime,clrmaxrange=350;++clrusg;
}
- if (hge->Input_GetKeyStateEx(HGEK_X)==HGEKST_RELEASE&&clrrad-pi/2<1e-7&&clrtime+clrbns&&diffkey&&clrmaxrange>50)
+ if (hge->Input_GetKeyStateEx(HGEK_X)==HGEKST_RELEASE&&clrrad-pi/2<1e-7&&clrtime+clrbns&&diffkey)
{
- Player_Clear_Rotate();--clrtime;++clrusg;
+ Player_Clear_Rotate();if(clrmaxrange<50)--clrtime,clrmaxrange=350;++clrusg;
}
- if (clrrad-pi/2>1e-7)Player_Clear_Rotate(),
- clrcircle->RenderEx(playerpos.x+7.2,playerpos.y+7.2,clrind,(5*pi/2.0f-clrrad)/(2*pi)),
+ 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;
}
}
diff --git a/towernbullet.h b/towernbullet.h
index 8d0969c..51f6d93 100644
--- a/towernbullet.h
+++ b/towernbullet.h
@@ -269,7 +269,7 @@ int CreateBullet9(double x,double y,double bs,int explo,int cnt,int brk,bool eff
if (eff)BulletEffect_Attatch(i);
return i;
}
-void CreateBullet255(double x,double y,double bs)
+void CreateBullet255(double x,double y,double bs,int spno=0)
{
int i;
if (bulcnt==0)
@@ -284,8 +284,10 @@ void CreateBullet255(double x,double y,double bs)
bullet[i].bullettype=255;
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].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;
@@ -917,8 +919,9 @@ void ProcessBullet255(int i)
if (!DisablePlayer)
{
bullet[i].bulletspeed=10;
- bullet[i].bulletdir.x=bullet[i].bulletpos.x-playerpos.x;
- bullet[i].bulletdir.y=bullet[i].bulletpos.y-playerpos.y;
+ 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)
@@ -932,7 +935,7 @@ void ProcessBullet255(int i)
bullet[i].bulletpos.y-=bullet[i].bulletspeed*(bullet[i].bulletdir.y/bullet[i].dist)/20;
}
}
- double dis=GetDist(bullet[i].bulletpos,playerpos);
+ 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)
{
score+=mult*100;mult+=0.0002f;