Somewhere between blurry one and bottom right
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
else if (event == AGSE_POSTSCREENDRAW)
{
BITMAP* P = engine->GetVirtualScreen();
unsigned int32 **spriteMemRef = (unsigned int32 **)engine->GetRawBitmapSurface (P);
int x,y;
for (y = 0; y < screen_height; y++)
{
for (x = 0; x < screen_width; x++)
{
spriteMemRef[y][x]=0;
}
}
engine->ReleaseBitmapSurface(P);
engine->SetVirtualScreen(P);
}
BITMAP* ParticleGraph = engine->GetSpriteGraphic(pgraph+particles[h].frame);
engine->BlitSpriteTranslucent(px, py, ParticleGraph,tp);
//drawt.DrawImage(px, py, pgraph+particles[h].frame, tp, pwidth, pheight);
BITMAP* ParticleGraph = engine->GetSpriteGraphic(pgraph+particles[h].frame);
int32 w, h, d;
engine->GetBitmapDimensions(Particle_B, &w, &h, &d);
w=pwidth;
h=pheight;
engine->ReleaseBitmapSurface(Particle_B);
engine->BlitSpriteTranslucent(px, py, ParticleGraph,tp);
//WIND ENGINE
struct Particle{
int x;
int y;
int transp;
int life;
bool active;
int dx;
int dy;
int mlay;
int timlay;
int movedport;
int translay;
int translayHold;
int width;
int height;
int fx;
int fy;
bool doingcircle;
float angle;
float radius;
int doingCircleChance;
int angleLay;
int frame;
float anglespeed;
};
Particle particles[110];
Particle particlesF[10];
int WForceX[110];
int WForceY[110];
int raysizeF=4;
int dsizeF=0;
int raysize=100;
int dsize=0;
int creationdelay=0;
int creationdelayf=0;
bool found_Activeparticle=false;
int32 Random(int value)
{
return (rand() % value);
}
void CreateParticle(int xx, int yy, int ForceX, int ForceY)
{
int h=0;
bool foundparticle=false;
int fid=-1;
while (h <= dsize && !foundparticle)
{
if (particles[h].active==false)
{
foundparticle=true;
fid=h;
}
h++;
}
if (foundparticle)
{
int d=fid;
particles[d].x=xx;
particles[d].y=yy;
particles[d].dx=0;
particles[d].dy=0;
particles[d].life=20000;
particles[d].transp=55+Random(10);
particles[d].active=true;
particles[d].mlay=4+Random(2);
particles[d].timlay=0;
particles[d].translay=0;
particles[d].translayHold=19+Random(15);
particles[d].width=2+Random(2);
particles[d].height=particles[d].width;
particles[d].fx=0;
particles[d].fy=0;
particles[d].doingcircle=false;
particles[d].angle=0.0;
particles[d].radius=4.0+float(Random(6));
particles[d].doingCircleChance=Random(200);
particles[d].angleLay=0;
particles[d].frame=0;
particles[d].anglespeed=float(Random(20))/100.0;
WForceX[d]=ForceX;
WForceY[d]=ForceY;
if (dsize<(raysize-1)) dsize++;
}
}
void CreateParticleF(int xx, int yy, int ForceX, int ForceY)
{
int h=0;
bool foundparticle=false;
int fid=-1;
while (h <= dsizeF && !foundparticle)
{
if (particlesF[h].active==false)
{
foundparticle=true;
fid=h;
}
h++;
}
if (foundparticle)
{
int d=fid;
particlesF[d].x=xx;
particlesF[d].y=yy;
particlesF[d].dx=(-1)+Random(1);
particlesF[d].dy=(-1)+Random(1);
particlesF[d].life=20000;
particlesF[d].transp=45+Random(10);
particlesF[d].active=true;
particlesF[d].mlay=4+Random(2);
particlesF[d].timlay=0;
particlesF[d].translay=0;
particlesF[d].translayHold=19+Random(15);
particlesF[d].width=8+Random(2);
particlesF[d].height=particlesF[d].width;
particlesF[d].fx=0;
particlesF[d].fy=0;
particlesF[d].doingcircle=false;
particlesF[d].angle=0.0;
particlesF[d].radius=4.0+float(Random(6));
particlesF[d].doingCircleChance=Random(200);
particlesF[d].angleLay=0;
WForceX[d+100]=ForceX;
WForceY[d+100]=ForceY;
particlesF[d].frame=0;
if (dsizeF<(raysizeF-1)) dsizeF++;
}
}
//WIND ENGINE
///WING ENGINE UPDATE
void ParticleUpdate(int ForceX, int ForceY, int Transparency,int RoomWidth,int RoomHeight)
{
int ww=RoomWidth;
int hh=RoomHeight;
BITMAP* screen = engine->GetVirtualScreen();
found_Activeparticle=false;
creationdelay+=int(2.0);
if (creationdelay > 0)
{
int by=0;
while (by <2)
{
int dnx=Random(ww+250)-250;
int dny=Random(hh);
CreateParticle(dnx, dny, ForceX, ForceY);
by++;
}
int dnx=-(20+Random(50));
if (dnx<-160) dnx=-160;
if (dnx > ww+160) dnx=ww+160;
int dny=Random(hh);
CreateParticleF(dnx, dny, ForceX, ForceY);
found_Activeparticle=true;
creationdelay=0;
}
int h=dsize-1;
if (h < dsizeF-1)
{
h=dsizeF-1;
}
while (h>0)
{
if (particles[h].life>0)
{
found_Activeparticle=true;
particles[h].life-=int(2.0);
particles[h].doingCircleChance-=1;
int df=100-particles[h].transp;
df=10-(df/4);
int pwidth=particles[h].width+df;
int pheight=particles[h].height+df;
int px=particles[h].x-(pwidth/2);
int py=particles[h].y-(pheight/2);
int tp=particles[h].transp+Transparency;
if (tp>100) tp=100;
int pgraph=0;
int SplitBetweenTwo=Random(100);
if (SplitBetweenTwo<=50) pgraph=813;
else pgraph=4466;
if (tp!=100)
{
BITMAP* ParticleGraph = engine->GetSpriteGraphic(pgraph+particles[h].frame);
engine->BlitSpriteTranslucent(px, py, ParticleGraph,tp);
//drawt.DrawImage(px, py, pgraph+particles[h].frame, tp, pwidth, pheight);
}
particles[h].timlay+=int(4.0);
if (particles[h].timlay> particles[h].mlay)
{
particles[h].frame++;
if (particles[h].frame>6) particles[h].frame=0;
particles[h].timlay=0;
particles[h].x += particles[h].dx+particles[h].fx;
particles[h].y += particles[h].dy+particles[h].fy;
}
particles[h].translay+=1;
if (particles[h].translay>=particles[h].translayHold)
{
if (particles[h].transp<=99) particles[h].transp++;
else
{
particles[h].life=0;
found_Activeparticle=false;
}
}
if (particles[h].x>=ww-90 || particles[h].x<90)
{
if (particles[h].transp<=99)particles[h].transp++;
else
{
found_Activeparticle=false;
particles[h].life=0;
}
}
if (!particles[h].doingcircle && particles[h].angle==0.0
&& particles[h].doingCircleChance<=0)
{
particles[h].doingcircle=true;
}
if (particles[h].doingcircle)
{
particles[h].angleLay+=(1+WForceX[h]);
if (particles[h].angleLay> 12)
{
particles[h].angleLay=0;
particles[h].angle+=particles[h].anglespeed;
int Y=particles[h].y + int((sin(particles[h].angle)* particles[h].radius));
int X=particles[h].x + int((cos(particles[h].angle)* particles[h].radius));
particles[h].x=X;
particles[h].y=Y;
}
}
particles[h].fx=ForceX;
particles[h].fy=ForceY;
}
else
{
particles[h].active=false;
}
if (h<=9 && particlesF[h].life>0)
{
found_Activeparticle=true;
int pwidth=particlesF[h].width;
int pheight=particlesF[h].height;
int px=particlesF[h].x-(pwidth/2);
int py=particlesF[h].y-(pheight/2);
int pgraph=0;
int SplitBetweenTwo=Random(100);
if (SplitBetweenTwo<=50) pgraph=806;
else pgraph=4459;
int tp=particlesF[h].transp+Transparency;
if (tp>100) tp=100;
if (tp!=100)
{
BITMAP* Particle_B = engine->GetSpriteGraphic(pgraph+particlesF[h].frame);
engine->BlitSpriteTranslucent(px, py, Particle_B,tp);
//drawt2.DrawImage(px, py, pgraph+particlesF[h].frame, tp, pwidth, pheight);
}
particlesF[h].timlay+=int(4.0);
if (particlesF[h].timlay> particlesF[h].mlay)
{
particlesF[h].frame++;
if (particlesF[h].frame>6) particlesF[h].frame=0;
particlesF[h].timlay=0;
particlesF[h].x += particlesF[h].dx + ForceX;
particlesF[h].y += particlesF[h].dy + ForceY;
}
if (particlesF[h].x>=ww-90 || particlesF[h].x<90)
{
particlesF[h].translay+=1;
if (particlesF[h].translay>=particlesF[h].translayHold)
{
if (particlesF[h].transp<=99) particlesF[h].transp++;
else
{
found_Activeparticle=false;
particlesF[h].life=0;
}
}
}
}
else
{
if (h<=9) particlesF[h].active=false;
}
h--;
}
engine->ReleaseBitmapSurface(screen);
}
//WIND ENGINE UPDATE
int x, y;
BITMAP* src_a = engine->GetSpriteGraphic(sprite_a);
BITMAP* src_b = engine->GetSpriteGraphic(sprite_b);
unsigned long** pixel_a = (unsigned long**)engine->GetRawBitmapSurface(src_a);
unsigned long** pixel_b = (unsigned long**)engine->GetRawBitmapSurface(src_b);
for (y = 0; y < screen_height; y++)
{
for (x = 0; x < screen_width; x++)
{
unsigned long colorfromB = pixel_b[y][x];
pixel_a[y][(x-(rand() % 2)-2)]=colorfromB;
// pixel_a++;//=2;
// pixel_b++;//=2;
}
}
engine->ReleaseBitmapSurface(src_a);
engine->ReleaseBitmapSurface(src_b);
// }
}
int x, y;
BITMAP* src_a = engine->GetSpriteGraphic(sprite_a);
BITMAP* src_b = engine->GetSpriteGraphic(sprite_b);
unsigned short* pixel_a = *(unsigned short**)engine->GetRawBitmapSurface(src_a);
unsigned short* pixel_b = *(unsigned short**)engine->GetRawBitmapSurface(src_b);
for (y = 0; y < screen_height; y++)
{
for (x = 0; x < screen_width; x++)
{
unsigned short colorfromB = pixel_b[y,x];
pixel_a[y,(x-(rand() % 2)-2)]=colorfromB;
pixel_a++;
pixel_b++;
}
}
engine->ReleaseBitmapSurface(src_a);
engine->ReleaseBitmapSurface(src_b);
int i=0;
while (i <20)
{
while (d < x && CircleSize>0)
{
f=y2;
f1=0;
while (f < y)
{
f++;
f1++;
}
d1++;
d++;
}
i++;
}
int x=0;
while (x < width)//Width being 640 or 320 or whatever
{
int y=0;
while (y < height)//same as above
{
y++;
}
x++;
}
while (d < x && CircleSize>0)
{
f=y2;
f1=0;
while (f < y)
{
f++;
f1++;
}
d1++;
d++;
}
//CODE IS EXECUTED TILL 20 Dynamic Sprite FRAMES ARE CREATED.
waveFrames[waveFrameC]=DynamicSprite.CreateFromExistingSprite(waveFrames[0].Graphic, true);//waveFrameC
DrawingSurface*area = waveFrames[waveFrameC].GetDrawingSurface();
DrawingSurface*refarea = waveFrames[0].GetDrawingSurface();//waveFrameC-1
float Size=6.0;//2.0;
float IncX=2.6;
int CircleSize=((wvc+1)-waveFrameC);
int incBy=waveFrameC*FloatToInt(Size, eRoundNearest);//*6;
int incByx=FloatToInt(IntToFloat(incBy)*IncX, eRoundNearest);
int CentralX=cEgo.x;
int CentralY=cEgo.y-150;
int x=CentralX+(incByx);
int x2=CentralX-(incByx);
int y=CentralY+(incBy);
int y2=CentralY-(incBy);//180-(incBy);
int d=x2;
int d1=0;
int f=y2;
int f1=0;
float difX;
float difY;
float sum;
float distance;
int checkDist;
float gx=IntToFloat(waveFrameC)*Size*IncX;
int getXv=FloatToInt(gx, eRoundNearest);
int getX=CentralX-getXv;
int getY=CentralY-(waveFrameC*6);
while (d < x && CircleSize>0)//while
{
f=y2;
f1=0;
while (f < y)
{
//CALCULATE DISTANCE BETWEEN TWO POINTS
difX = IntToFloat(CentralX) - IntToFloat(d);
difY = IntToFloat(CentralY) - IntToFloat(f);
difX = Maths.RaiseToPower(difX, 2.0);
difY = Maths.RaiseToPower(difY, 2.0);
sum = difX+difY;
distance = Maths.Sqrt(sum);
checkDist = FloatToInt(distance, eRoundNearest);
if (checkDist<= incBy && checkDist>incBy-CircleSize)
{
area.DrawingColor=refarea.GetPixel(getX+d1, getY + (f1-1));
area.DrawPixel(d, f);
}
f++;
f1++;
}
d1++;
d++;
}
area.Release();
refarea.Release();
waveFrameC++;
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 2.557 seconds with 21 queries.