astyle
This commit is contained in:
parent
8b9ab03c14
commit
52d64e6132
668
powder.c
Executable file → Normal file
668
powder.c
Executable file → Normal file
@ -2300,368 +2300,368 @@ killed:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(t==PT_STKM)
|
if(t==PT_STKM)
|
||||||
{
|
{
|
||||||
//Tempirature handling
|
//Tempirature handling
|
||||||
if(parts[i].temp<-30)
|
if(parts[i].temp<-30)
|
||||||
parts[i].life -= 0.2;
|
parts[i].life -= 0.2;
|
||||||
if((parts[i].temp<36.6f) && (parts[i].temp>=-30))
|
if((parts[i].temp<36.6f) && (parts[i].temp>=-30))
|
||||||
parts[i].temp += 1;
|
parts[i].temp += 1;
|
||||||
|
|
||||||
//Death
|
//Death
|
||||||
if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind...
|
if(parts[i].life<=0 || pv[y/CELL][x/CELL]>=4.5f) //If his HP is less that 0 or there is very big wind...
|
||||||
{
|
{
|
||||||
for(r=-2; r<=1; r++)
|
for(r=-2; r<=1; r++)
|
||||||
{
|
{
|
||||||
create_part(-1, x+r, y-2, player[2]);
|
create_part(-1, x+r, y-2, player[2]);
|
||||||
create_part(-1, x+r+1, y+2, player[2]);
|
create_part(-1, x+r+1, y+2, player[2]);
|
||||||
create_part(-1, x-2, y+r+1, player[2]);
|
create_part(-1, x-2, y+r+1, player[2]);
|
||||||
create_part(-1, x+2, y+r, player[2]);
|
create_part(-1, x+2, y+r, player[2]);
|
||||||
}
|
}
|
||||||
kill_part(i); //Kill him
|
kill_part(i); //Kill him
|
||||||
goto killed;
|
goto killed;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Verlet integration
|
//Verlet integration
|
||||||
pp = 2*player[3]-player[5];
|
pp = 2*player[3]-player[5];
|
||||||
player[5] = player[3];
|
player[5] = player[3];
|
||||||
player[3] = pp;
|
player[3] = pp;
|
||||||
pp = 2*player[4]-player[6];
|
pp = 2*player[4]-player[6];
|
||||||
player[6] = player[4];
|
player[6] = player[4];
|
||||||
player[4] = pp;
|
player[4] = pp;
|
||||||
|
|
||||||
pp = 2*player[7]-player[9];
|
pp = 2*player[7]-player[9];
|
||||||
player[9] = player[7];
|
player[9] = player[7];
|
||||||
player[7] = pp;
|
player[7] = pp;
|
||||||
pp = 2*player[8]-player[10]+1;
|
pp = 2*player[8]-player[10]+1;
|
||||||
player[10] = player[8];
|
player[10] = player[8];
|
||||||
player[8] = pp;
|
player[8] = pp;
|
||||||
|
|
||||||
pp = 2*player[11]-player[13];
|
pp = 2*player[11]-player[13];
|
||||||
player[13] = player[11];
|
player[13] = player[11];
|
||||||
player[11] = pp;
|
player[11] = pp;
|
||||||
pp = 2*player[12]-player[14];
|
pp = 2*player[12]-player[14];
|
||||||
player[14] = player[12];
|
player[14] = player[12];
|
||||||
player[12] = pp;
|
player[12] = pp;
|
||||||
|
|
||||||
pp = 2*player[15]-player[17];
|
pp = 2*player[15]-player[17];
|
||||||
player[17] = player[15];
|
player[17] = player[15];
|
||||||
player[15] = pp;
|
player[15] = pp;
|
||||||
pp = 2*player[16]-player[18]+1;
|
pp = 2*player[16]-player[18]+1;
|
||||||
player[18] = player[16];
|
player[18] = player[16];
|
||||||
player[16] = pp;
|
player[16] = pp;
|
||||||
|
|
||||||
//Go left
|
//Go left
|
||||||
if (((int)(player[0])&0x01) == 0x01)
|
if (((int)(player[0])&0x01) == 0x01)
|
||||||
{
|
{
|
||||||
if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
|
if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
|
||||||
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
|
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
||||||
{
|
{
|
||||||
player[9] += 3;
|
player[9] += 3;
|
||||||
player[10] += 2;
|
player[10] += 2;
|
||||||
player[5] += 2;
|
player[5] += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
||||||
{
|
{
|
||||||
player[17] += 3;
|
player[17] += 3;
|
||||||
player[18] += 2;
|
player[18] += 2;
|
||||||
player[13] +=2;
|
player[13] +=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids
|
if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids
|
||||||
{
|
{
|
||||||
player[9] += 1;
|
player[9] += 1;
|
||||||
player[10] += 1;
|
player[10] += 1;
|
||||||
player[5] += 1;
|
player[5] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
||||||
{
|
{
|
||||||
player[17] += 1;
|
player[17] += 1;
|
||||||
player[18] += 1;
|
player[18] += 1;
|
||||||
player[13] +=1;
|
player[13] +=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Go right
|
//Go right
|
||||||
if (((int)(player[0])&0x02) == 0x02)
|
if (((int)(player[0])&0x02) == 0x02)
|
||||||
{
|
{
|
||||||
if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
|
if (pstates[pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF].state != ST_LIQUID
|
||||||
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
|
&& (pmap[(int)(parts[i].y+10)][(int)(parts[i].x)]&0xFF) != PT_LNTG)
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
||||||
{
|
{
|
||||||
player[9] -= 3;
|
player[9] -= 3;
|
||||||
player[10] += 2;
|
player[10] += 2;
|
||||||
player[5] -= 2;
|
player[5] -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
||||||
{
|
{
|
||||||
player[17] -= 3;
|
player[17] -= 3;
|
||||||
player[18] += 2;
|
player[18] += 2;
|
||||||
player[13] -= 2;
|
player[13] -= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
||||||
{
|
{
|
||||||
player[9] -= 1;
|
player[9] -= 1;
|
||||||
player[10] += 1;
|
player[10] += 1;
|
||||||
player[5] -= 1;
|
player[5] -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
||||||
{
|
{
|
||||||
player[17] -= 1;
|
player[17] -= 1;
|
||||||
player[18] += 1;
|
player[18] += 1;
|
||||||
player[13] -= 1;
|
player[13] -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Charge detector wall if foot inside
|
//Charge detector wall if foot inside
|
||||||
if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6)
|
if(bmap[(int)(player[8]+0.5)/CELL][(int)(player[7]+0.5)/CELL]==6)
|
||||||
set_emap((int)player[7]/CELL, (int)player[8]/CELL);
|
set_emap((int)player[7]/CELL, (int)player[8]/CELL);
|
||||||
if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6)
|
if(bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==6)
|
||||||
set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL);
|
set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL);
|
||||||
|
|
||||||
//Searching for particles near head
|
//Searching for particles near head
|
||||||
for(nx = -2; nx <= 2; nx++)
|
for(nx = -2; nx <= 2; nx++)
|
||||||
for(ny = 0; ny>=-2; ny--)
|
for(ny = 0; ny>=-2; ny--)
|
||||||
{
|
{
|
||||||
if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART)
|
if(!pmap[ny+y][nx+x] || (pmap[ny+y][nx+x]>>8)>=NPART)
|
||||||
continue;
|
continue;
|
||||||
if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM
|
if((pstates[pmap[ny+y][nx+x]&0xFF].state != ST_SOLID && (pmap[ny+y][nx+x]&0xFF)!=PT_STKM
|
||||||
&& (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL)
|
&& (pmap[ny+y][nx+x]&0xFF)!=PT_WHOL && (pmap[ny+y][nx+x]&0xFF)!=PT_BHOL)
|
||||||
|| (pmap[ny+y][nx+x]&0xFF) == PT_LNTG)
|
|| (pmap[ny+y][nx+x]&0xFF) == PT_LNTG)
|
||||||
{
|
{
|
||||||
player[2] = pmap[ny+y][nx+x]&0xFF; //Current element
|
player[2] = pmap[ny+y][nx+x]&0xFF; //Current element
|
||||||
}
|
}
|
||||||
if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
|
if((pmap[ny+y][nx+x]&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
|
||||||
{
|
{
|
||||||
if(parts[i].life<=95)
|
if(parts[i].life<=95)
|
||||||
parts[i].life += 5;
|
parts[i].life += 5;
|
||||||
else
|
else
|
||||||
parts[i].life = 100;
|
parts[i].life = 100;
|
||||||
kill_part(pmap[ny+y][nx+x]>>8);
|
kill_part(pmap[ny+y][nx+x]>>8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT)
|
if((pmap[ny+y][nx+x]&0xFF) == PT_NEUT)
|
||||||
{
|
{
|
||||||
parts[i].life -= (102-parts[i].life)/2;
|
parts[i].life -= (102-parts[i].life)/2;
|
||||||
kill_part(pmap[ny+y][nx+x]>>8);
|
kill_part(pmap[ny+y][nx+x]>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Head position
|
//Head position
|
||||||
nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01);
|
nx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01);
|
||||||
ny = y - 3*(player[1] == 0);
|
ny = y - 3*(player[1] == 0);
|
||||||
|
|
||||||
//Spawn
|
//Spawn
|
||||||
if(((int)(player[0])&0x08) == 0x08)
|
if(((int)(player[0])&0x08) == 0x08)
|
||||||
{
|
{
|
||||||
ny -= 2*(rand()%2)+1;
|
ny -= 2*(rand()%2)+1;
|
||||||
r = pmap[ny][nx];
|
r = pmap[ny][nx];
|
||||||
if(!((r>>8)>=NPART))
|
if(!((r>>8)>=NPART))
|
||||||
{
|
{
|
||||||
if(pstates[r&0xFF].state == ST_SOLID)
|
if(pstates[r&0xFF].state == ST_SOLID)
|
||||||
{
|
{
|
||||||
create_part(-1, nx, ny, PT_SPRK);
|
create_part(-1, nx, ny, PT_SPRK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
create_part(-1, nx, ny, player[2]);
|
create_part(-1, nx, ny, player[2]);
|
||||||
r = pmap[ny][nx];
|
r = pmap[ny][nx];
|
||||||
if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT)
|
if( ((r>>8) < NPART) && (r>>8)>=0 && player[2]!=PT_PHOT)
|
||||||
parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01);
|
parts[r>>8].vx = parts[r>>8].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01);
|
||||||
if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT)
|
if(((r>>8) < NPART) && (r>>8)>=0 && player[2] == PT_PHOT)
|
||||||
{
|
{
|
||||||
int random = abs(rand()%3-1)*3;
|
int random = abs(rand()%3-1)*3;
|
||||||
if (random==0)
|
if (random==0)
|
||||||
{
|
{
|
||||||
parts[r>>8].life = 0;
|
parts[r>>8].life = 0;
|
||||||
parts[r>>8].type = PT_NONE;
|
parts[r>>8].type = PT_NONE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parts[r>>8].vy = 0;
|
parts[r>>8].vy = 0;
|
||||||
parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
|
parts[r>>8].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Jump
|
//Jump
|
||||||
if (((int)(player[0])&0x04) == 0x04)
|
if (((int)(player[0])&0x04) == 0x04)
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])])
|
if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])])
|
||||||
{
|
{
|
||||||
parts[i].vy = -5;
|
parts[i].vy = -5;
|
||||||
player[10] += 1;
|
player[10] += 1;
|
||||||
player[18] += 1;
|
player[18] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Simulation of joints
|
//Simulation of joints
|
||||||
d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance
|
d = 25/(pow((player[3]-player[7]), 2) + pow((player[4]-player[8]), 2)+25) - 0.5; //Fast distance
|
||||||
player[7] -= (player[3]-player[7])*d;
|
player[7] -= (player[3]-player[7])*d;
|
||||||
player[8] -= (player[4]-player[8])*d;
|
player[8] -= (player[4]-player[8])*d;
|
||||||
player[3] += (player[3]-player[7])*d;
|
player[3] += (player[3]-player[7])*d;
|
||||||
player[4] += (player[4]-player[8])*d;
|
player[4] += (player[4]-player[8])*d;
|
||||||
|
|
||||||
d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5;
|
d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5;
|
||||||
player[15] -= (player[11]-player[15])*d;
|
player[15] -= (player[11]-player[15])*d;
|
||||||
player[16] -= (player[12]-player[16])*d;
|
player[16] -= (player[12]-player[16])*d;
|
||||||
player[11] += (player[11]-player[15])*d;
|
player[11] += (player[11]-player[15])*d;
|
||||||
player[12] += (player[12]-player[16])*d;
|
player[12] += (player[12]-player[16])*d;
|
||||||
|
|
||||||
d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5;
|
d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5;
|
||||||
parts[i].vx -= (player[3]-parts[i].x)*d;
|
parts[i].vx -= (player[3]-parts[i].x)*d;
|
||||||
parts[i].vy -= (player[4]-parts[i].y)*d;
|
parts[i].vy -= (player[4]-parts[i].y)*d;
|
||||||
player[3] += (player[3]-parts[i].x)*d;
|
player[3] += (player[3]-parts[i].x)*d;
|
||||||
player[4] += (player[4]-parts[i].y)*d;
|
player[4] += (player[4]-parts[i].y)*d;
|
||||||
|
|
||||||
d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5;
|
d = 36/(pow((player[11]-parts[i].x), 2) + pow((player[12]-parts[i].y), 2)+36) - 0.5;
|
||||||
parts[i].vx -= (player[11]-parts[i].x)*d;
|
parts[i].vx -= (player[11]-parts[i].x)*d;
|
||||||
parts[i].vy -= (player[12]-parts[i].y)*d;
|
parts[i].vy -= (player[12]-parts[i].y)*d;
|
||||||
player[11] += (player[11]-parts[i].x)*d;
|
player[11] += (player[11]-parts[i].x)*d;
|
||||||
player[12] += (player[12]-parts[i].y)*d;
|
player[12] += (player[12]-parts[i].y)*d;
|
||||||
|
|
||||||
//Side collisions checking
|
//Side collisions checking
|
||||||
for(nx = -3; nx <= 3; nx++)
|
for(nx = -3; nx <= 3; nx++)
|
||||||
{
|
{
|
||||||
if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)])
|
if(pmap[(int)(player[16]-2)][(int)(player[15]+nx)])
|
||||||
player[15] -= nx;
|
player[15] -= nx;
|
||||||
|
|
||||||
if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)])
|
if(pmap[(int)(player[8]-2)][(int)(player[7]+nx)])
|
||||||
player[7] -= nx;
|
player[7] -= nx;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Collision checks
|
//Collision checks
|
||||||
for(ny = -2-(int)parts[i].vy; ny<=0; ny++)
|
for(ny = -2-(int)parts[i].vy; ny<=0; ny++)
|
||||||
{
|
{
|
||||||
r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
|
r = pmap[(int)(player[8]+ny)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
|
||||||
|
|
||||||
//For left leg
|
//For left leg
|
||||||
if (r && (r&0xFF)!=PT_STKM)
|
if (r && (r&0xFF)!=PT_STKM)
|
||||||
{
|
{
|
||||||
if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks
|
if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG) //Liquid checks
|
||||||
{
|
{
|
||||||
if(parts[i].y<(player[8]-10))
|
if(parts[i].y<(player[8]-10))
|
||||||
parts[i].vy = 1;
|
parts[i].vy = 1;
|
||||||
else
|
else
|
||||||
parts[i].vy = 0;
|
parts[i].vy = 0;
|
||||||
if(abs(parts[i].vx)>1)
|
if(abs(parts[i].vx)>1)
|
||||||
parts[i].vx *= 0.5;
|
parts[i].vx *= 0.5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player[8] += ny-1;
|
player[8] += ny-1;
|
||||||
parts[i].vy -= 0.5*parts[i].vy;
|
parts[i].vy -= 0.5*parts[i].vy;
|
||||||
}
|
}
|
||||||
player[9] = player[7];
|
player[9] = player[7];
|
||||||
}
|
}
|
||||||
|
|
||||||
r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)];
|
r = pmap[(int)(player[16]+ny)][(int)(player[15]+0.5)];
|
||||||
|
|
||||||
//For right leg
|
//For right leg
|
||||||
if (r && (r&0xFF)!=PT_STKM)
|
if (r && (r&0xFF)!=PT_STKM)
|
||||||
{
|
{
|
||||||
if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG)
|
if(pstates[r&0xFF].state == ST_LIQUID || pstates[r&0xFF].state == ST_GAS || (r&0xFF)==PT_LNTG)
|
||||||
{
|
{
|
||||||
if(parts[i].y<(player[16]-10))
|
if(parts[i].y<(player[16]-10))
|
||||||
parts[i].vy = 1;
|
parts[i].vy = 1;
|
||||||
else
|
else
|
||||||
parts[i].vy = 0;
|
parts[i].vy = 0;
|
||||||
if(abs(parts[i].vx)>1)
|
if(abs(parts[i].vx)>1)
|
||||||
parts[i].vx *= 0.5;
|
parts[i].vx *= 0.5;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player[16] += ny-1;
|
player[16] += ny-1;
|
||||||
parts[i].vy -= 0.5*parts[i].vy;
|
parts[i].vy -= 0.5*parts[i].vy;
|
||||||
}
|
}
|
||||||
player[17] = player[15];
|
player[17] = player[15];
|
||||||
}
|
}
|
||||||
|
|
||||||
//If it falls too fast
|
//If it falls too fast
|
||||||
if (parts[i].vy>=30)
|
if (parts[i].vy>=30)
|
||||||
{
|
{
|
||||||
parts[i].y -= 10+ny;
|
parts[i].y -= 10+ny;
|
||||||
parts[i].vy = -10;
|
parts[i].vy = -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Keeping legs distance
|
//Keeping legs distance
|
||||||
if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1)
|
if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1)
|
||||||
{
|
{
|
||||||
player[7] += 0.2;
|
player[7] += 0.2;
|
||||||
player[15] -= 0.2;
|
player[15] -= 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1)
|
if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1)
|
||||||
{
|
{
|
||||||
player[3] += 0.2;
|
player[3] += 0.2;
|
||||||
player[11] -= 0.2;
|
player[11] -= 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If legs touch something
|
//If legs touch something
|
||||||
r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)];
|
r = pmap[(int)(player[8]+0.5)][(int)(player[7]+0.5)];
|
||||||
if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
||||||
{
|
{
|
||||||
parts[i].life -= (int)(rand()/1000)+38;
|
parts[i].life -= (int)(rand()/1000)+38;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r>0 && (r>>8)<NPART) //If hot or cold
|
if (r>0 && (r>>8)<NPART) //If hot or cold
|
||||||
{
|
{
|
||||||
if(parts[r>>8].temp>=50 || parts[r>>8].temp<=-30)
|
if(parts[r>>8].temp>=50 || parts[r>>8].temp<=-30)
|
||||||
{
|
{
|
||||||
parts[i].life -= 2;
|
parts[i].life -= 2;
|
||||||
player[16] -= 1;
|
player[16] -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r&0xFF)==PT_ACID) //If on acid
|
if ((r&0xFF)==PT_ACID) //If on acid
|
||||||
parts[i].life -= 5;
|
parts[i].life -= 5;
|
||||||
|
|
||||||
if ((r&0xFF)==PT_PLUT) //If on plut
|
if ((r&0xFF)==PT_PLUT) //If on plut
|
||||||
parts[i].life -= 1;
|
parts[i].life -= 1;
|
||||||
|
|
||||||
r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)];
|
r = pmap[(int)(player[16]+0.5)][(int)(player[15]+0.5)];
|
||||||
if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
if((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
||||||
{
|
{
|
||||||
parts[i].life -= (int)(rand()/1000)+38;
|
parts[i].life -= (int)(rand()/1000)+38;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(r>0 && (r>>8)<NPART) //If hot or cold
|
if(r>0 && (r>>8)<NPART) //If hot or cold
|
||||||
{
|
{
|
||||||
if(parts[r>>8].temp>=50 || parts[r>>8].temp<=-30)
|
if(parts[r>>8].temp>=50 || parts[r>>8].temp<=-30)
|
||||||
{
|
{
|
||||||
parts[i].life -= 2;
|
parts[i].life -= 2;
|
||||||
player[8] -= 1;
|
player[8] -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((r&0xFF)==PT_ACID) //If on acid
|
if ((r&0xFF)==PT_ACID) //If on acid
|
||||||
parts[i].life -= 5;
|
parts[i].life -= 5;
|
||||||
|
|
||||||
if ((r&0xFF)==PT_PLUT) //If on plut
|
if ((r&0xFF)==PT_PLUT) //If on plut
|
||||||
parts[i].life -= 1;
|
parts[i].life -= 1;
|
||||||
|
|
||||||
isplayer = 1;
|
isplayer = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t==PT_CLNE)
|
if(t==PT_CLNE)
|
||||||
{
|
{
|
||||||
@ -2892,9 +2892,9 @@ justdraw:
|
|||||||
if ((abs(x) == 0) && (abs(y) == 0))
|
if ((abs(x) == 0) && (abs(y) == 0))
|
||||||
blendpixel(vid,x+nx,y+ny,224,224,170,255);
|
blendpixel(vid,x+nx,y+ny,224,224,170,255);
|
||||||
else if (abs(y) != 0 && abs(x) != 0)
|
else if (abs(y) != 0 && abs(x) != 0)
|
||||||
blendpixel(vid,x+nx,y+ny,224,224,170,20);
|
blendpixel(vid,x+nx,y+ny,224,224,170,20);
|
||||||
else
|
else
|
||||||
blendpixel(vid,x+nx,y+ny,224,224,170,40);
|
blendpixel(vid,x+nx,y+ny,224,224,170,40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2978,8 +2978,8 @@ justdraw:
|
|||||||
}
|
}
|
||||||
} else if(t==PT_PLUT&&cmode == 3)
|
} else if(t==PT_PLUT&&cmode == 3)
|
||||||
{
|
{
|
||||||
int tempx;
|
int tempx;
|
||||||
int tempy;
|
int tempy;
|
||||||
cr = 0x40;
|
cr = 0x40;
|
||||||
cg = 0x70;
|
cg = 0x70;
|
||||||
cb = 0x20;
|
cb = 0x20;
|
||||||
@ -2998,8 +2998,8 @@ justdraw:
|
|||||||
}
|
}
|
||||||
} else if(t==PT_URAN&&cmode == 3)
|
} else if(t==PT_URAN&&cmode == 3)
|
||||||
{
|
{
|
||||||
int tempx;
|
int tempx;
|
||||||
int tempy;
|
int tempy;
|
||||||
cr = 0x70;
|
cr = 0x70;
|
||||||
cg = 0x70;
|
cg = 0x70;
|
||||||
cb = 0x20;
|
cb = 0x20;
|
||||||
@ -3183,9 +3183,9 @@ justdraw:
|
|||||||
if ((abs(x) == 0) && (abs(y) == 0))
|
if ((abs(x) == 0) && (abs(y) == 0))
|
||||||
blendpixel(vid,x+nx,y+ny,235,73,23,100);
|
blendpixel(vid,x+nx,y+ny,235,73,23,100);
|
||||||
else if (abs(y) != 0 && abs(x) != 0)
|
else if (abs(y) != 0 && abs(x) != 0)
|
||||||
blendpixel(vid,x+nx,y+ny,235,73,23,30);
|
blendpixel(vid,x+nx,y+ny,235,73,23,30);
|
||||||
else
|
else
|
||||||
blendpixel(vid,x+nx,y+ny,235,73,23,50);
|
blendpixel(vid,x+nx,y+ny,235,73,23,50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3197,11 +3197,11 @@ justdraw:
|
|||||||
for(y=-1; y<=1; y++)
|
for(y=-1; y<=1; y++)
|
||||||
{
|
{
|
||||||
if ((abs(x) == 0) && (abs(y) == 0))
|
if ((abs(x) == 0) && (abs(y) == 0))
|
||||||
blendpixel(vid,x+nx,y+ny,255,255,0,180);
|
blendpixel(vid,x+nx,y+ny,255,255,0,180);
|
||||||
else if (abs(y) != 0 && abs(x) != 0)
|
else if (abs(y) != 0 && abs(x) != 0)
|
||||||
blendpixel(vid,x+nx,y+ny,255,255,0,50);
|
blendpixel(vid,x+nx,y+ny,255,255,0,50);
|
||||||
else
|
else
|
||||||
blendpixel(vid,x+nx,y+ny,255,255,0,80);
|
blendpixel(vid,x+nx,y+ny,255,255,0,80);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user