Merge branch 'master' of github.com:FacialTurd/The-Powder-Toy
This commit is contained in:
commit
899969cc8a
@ -154,7 +154,6 @@ extern int sys_pause;
|
|||||||
extern int framerender;
|
extern int framerender;
|
||||||
|
|
||||||
extern int mousex, mousey;
|
extern int mousex, mousey;
|
||||||
extern int death;
|
|
||||||
|
|
||||||
struct sign
|
struct sign
|
||||||
{
|
{
|
||||||
@ -193,10 +192,6 @@ int GRID_MODE;
|
|||||||
int VINE_MODE;
|
int VINE_MODE;
|
||||||
int DEBUG_MODE;
|
int DEBUG_MODE;
|
||||||
int GENERATION;
|
int GENERATION;
|
||||||
int isplayer2;
|
|
||||||
int playerspawn;
|
|
||||||
int player2spawn;
|
|
||||||
int death2;
|
|
||||||
int ISSPAWN1;
|
int ISSPAWN1;
|
||||||
int ISSPAWN2;
|
int ISSPAWN2;
|
||||||
extern sign signs[MAXSIGNS];
|
extern sign signs[MAXSIGNS];
|
||||||
@ -209,7 +204,7 @@ extern int do_open;
|
|||||||
extern int sys_pause;
|
extern int sys_pause;
|
||||||
extern int sys_shortcuts;
|
extern int sys_shortcuts;
|
||||||
extern int legacy_enable; //Used to disable new features such as heat, will be set by commandline or save.
|
extern int legacy_enable; //Used to disable new features such as heat, will be set by commandline or save.
|
||||||
extern int death, death2, framerender;
|
extern int framerender;
|
||||||
extern pixel *vid_buf;
|
extern pixel *vid_buf;
|
||||||
|
|
||||||
extern unsigned char last_major, last_minor, update_flag;
|
extern unsigned char last_major, last_minor, update_flag;
|
||||||
|
@ -313,6 +313,7 @@ int update_CLST(UPDATE_FUNC_ARGS);
|
|||||||
int update_MISC(UPDATE_FUNC_ARGS);
|
int update_MISC(UPDATE_FUNC_ARGS);
|
||||||
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
|
int update_legacy_PYRO(UPDATE_FUNC_ARGS);
|
||||||
int update_legacy_all(UPDATE_FUNC_ARGS);
|
int update_legacy_all(UPDATE_FUNC_ARGS);
|
||||||
|
int run_stickman(float* playerp, UPDATE_FUNC_ARGS);
|
||||||
|
|
||||||
|
|
||||||
struct particle
|
struct particle
|
||||||
@ -932,10 +933,8 @@ int wireless[CHANNELS][2];
|
|||||||
|
|
||||||
extern int gravwl_timeout;
|
extern int gravwl_timeout;
|
||||||
|
|
||||||
extern int isplayer;
|
extern float player[28];
|
||||||
extern float player[27];
|
extern float player2[28];
|
||||||
|
|
||||||
extern float player2[27];
|
|
||||||
|
|
||||||
extern int gravityMode;
|
extern int gravityMode;
|
||||||
extern int airMode;
|
extern int airMode;
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
#include <element.h>
|
#include <element.h>
|
||||||
|
|
||||||
int update_SPAWN(UPDATE_FUNC_ARGS) {
|
int update_SPAWN(UPDATE_FUNC_ARGS) {
|
||||||
ISSPAWN1 = 1;
|
if (!player[27])
|
||||||
if (death)
|
create_part(-1, x, y, PT_STKM);
|
||||||
{
|
|
||||||
playerspawn = create_part(-1,x,y,PT_STKM);
|
|
||||||
isplayer = 1;
|
|
||||||
death = 0;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int update_STKM(UPDATE_FUNC_ARGS) {
|
int update_STKM(UPDATE_FUNC_ARGS)
|
||||||
|
{
|
||||||
|
run_stickman(player, UPDATE_FUNC_SUBCALL_ARGS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int run_stickman(float* playerp, UPDATE_FUNC_ARGS) {
|
||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
float pp, d;
|
float pp, d;
|
||||||
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
|
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
|
||||||
|
|
||||||
if ((parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT)
|
if ((parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT)
|
||||||
player[2] = parts[i].ctype;
|
playerp[2] = parts[i].ctype;
|
||||||
|
|
||||||
//Tempirature handling
|
//Tempirature handling
|
||||||
if (parts[i].temp<243)
|
if (parts[i].temp<243)
|
||||||
@ -25,20 +27,15 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
|
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
|
||||||
parts[i].temp += 1;
|
parts[i].temp += 1;
|
||||||
|
|
||||||
if (isplayer) { //Already a stickman in the simulation
|
|
||||||
death = 1;
|
|
||||||
parts[i].type = PT_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Death
|
//Death
|
||||||
if (parts[i].life<1 || death || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
|
if (parts[i].life<1 || (pv[y/CELL][x/CELL]>=4.5f && playerp[2] != SPC_AIR) ) //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, playerp[2]);
|
||||||
create_part(-1, x+r+1, y+2, player[2]);
|
create_part(-1, x+r+1, y+2, playerp[2]);
|
||||||
create_part(-1, x-2, y+r+1, player[2]);
|
create_part(-1, x-2, y+r+1, playerp[2]);
|
||||||
create_part(-1, x+2, y+r, player[2]);
|
create_part(-1, x+2, y+r, playerp[2]);
|
||||||
}
|
}
|
||||||
kill_part(i); //Kill him
|
kill_part(i); //Kill him
|
||||||
return 1;
|
return 1;
|
||||||
@ -47,146 +44,146 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
parts[i].vy += -0.7*dt; //Head up!
|
parts[i].vy += -0.7*dt; //Head up!
|
||||||
|
|
||||||
//Verlet integration
|
//Verlet integration
|
||||||
pp = 2*player[3]-player[5]+player[19]*dt*dt;;
|
pp = 2*playerp[3]-playerp[5]+playerp[19]*dt*dt;;
|
||||||
player[5] = player[3];
|
playerp[5] = playerp[3];
|
||||||
player[3] = pp;
|
playerp[3] = pp;
|
||||||
pp = 2*player[4]-player[6]+player[20]*dt*dt;;
|
pp = 2*playerp[4]-playerp[6]+playerp[20]*dt*dt;;
|
||||||
player[6] = player[4];
|
playerp[6] = playerp[4];
|
||||||
player[4] = pp;
|
playerp[4] = pp;
|
||||||
|
|
||||||
pp = 2*player[7]-player[9]+player[21]*dt*dt;;
|
pp = 2*playerp[7]-playerp[9]+playerp[21]*dt*dt;;
|
||||||
player[9] = player[7];
|
playerp[9] = playerp[7];
|
||||||
player[7] = pp;
|
playerp[7] = pp;
|
||||||
pp = 2*player[8]-player[10]+(player[22]+1)*dt*dt;;
|
pp = 2*playerp[8]-playerp[10]+(playerp[22]+1)*dt*dt;;
|
||||||
player[10] = player[8];
|
playerp[10] = playerp[8];
|
||||||
player[8] = pp;
|
playerp[8] = pp;
|
||||||
|
|
||||||
pp = 2*player[11]-player[13]+player[23]*dt*dt;;
|
pp = 2*playerp[11]-playerp[13]+playerp[23]*dt*dt;;
|
||||||
player[13] = player[11];
|
playerp[13] = playerp[11];
|
||||||
player[11] = pp;
|
playerp[11] = pp;
|
||||||
pp = 2*player[12]-player[14]+player[24]*dt*dt;;
|
pp = 2*playerp[12]-playerp[14]+playerp[24]*dt*dt;;
|
||||||
player[14] = player[12];
|
playerp[14] = playerp[12];
|
||||||
player[12] = pp;
|
playerp[12] = pp;
|
||||||
|
|
||||||
pp = 2*player[15]-player[17]+player[25]*dt*dt;;
|
pp = 2*playerp[15]-playerp[17]+playerp[25]*dt*dt;;
|
||||||
player[17] = player[15];
|
playerp[17] = playerp[15];
|
||||||
player[15] = pp;
|
playerp[15] = pp;
|
||||||
pp = 2*player[16]-player[18]+(player[26]+1)*dt*dt;;
|
pp = 2*playerp[16]-playerp[18]+(playerp[26]+1)*dt*dt;;
|
||||||
player[18] = player[16];
|
playerp[18] = playerp[16];
|
||||||
player[16] = pp;
|
playerp[16] = pp;
|
||||||
|
|
||||||
//Setting acceleration to 0
|
//Setting acceleration to 0
|
||||||
player[19] = 0;
|
playerp[19] = 0;
|
||||||
player[20] = 0;
|
playerp[20] = 0;
|
||||||
|
|
||||||
player[21] = 0;
|
playerp[21] = 0;
|
||||||
player[22] = 0;
|
playerp[22] = 0;
|
||||||
|
|
||||||
player[23] = 0;
|
playerp[23] = 0;
|
||||||
player[24] = 0;
|
playerp[24] = 0;
|
||||||
|
|
||||||
player[25] = 0;
|
playerp[25] = 0;
|
||||||
player[26] = 0;
|
playerp[26] = 0;
|
||||||
|
|
||||||
//Go left
|
//Go left
|
||||||
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
|
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
|
||||||
if (((int)(player[0])&0x01) == 0x01 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
|
if (((int)(playerp[0])&0x01) == 0x01 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
|
||||||
{
|
{
|
||||||
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
|
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
|
||||||
&& (r&0xFF) != PT_LNTG))
|
&& (r&0xFF) != PT_LNTG))
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
if (pmap[(int)(playerp[8]-1)][(int)(playerp[7])])
|
||||||
{
|
{
|
||||||
player[21] = -3;
|
playerp[21] = -3;
|
||||||
player[22] = -2;
|
playerp[22] = -2;
|
||||||
player[19] = -2;
|
playerp[19] = -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(playerp[16]-1)][(int)(playerp[15])])
|
||||||
{
|
{
|
||||||
player[25] = -3;
|
playerp[25] = -3;
|
||||||
player[26] = -2;
|
playerp[26] = -2;
|
||||||
player[23] = -2;
|
playerp[23] = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])]) //It should move another way in liquids
|
if (pmap[(int)(playerp[8]-1)][(int)(playerp[7])]) //It should move another way in liquids
|
||||||
{
|
{
|
||||||
player[21] = -1;
|
playerp[21] = -1;
|
||||||
player[22] = -1;
|
playerp[22] = -1;
|
||||||
player[19] = -1;
|
playerp[19] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(playerp[16]-1)][(int)(playerp[15])])
|
||||||
{
|
{
|
||||||
player[25] = -1;
|
playerp[25] = -1;
|
||||||
player[26] = -1;
|
playerp[26] = -1;
|
||||||
player[23] = -1;
|
playerp[23] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Go right
|
//Go right
|
||||||
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
|
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
|
||||||
if (((int)(player[0])&0x02) == 0x02 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
|
if (((int)(playerp[0])&0x02) == 0x02 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
|
||||||
{
|
{
|
||||||
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
|
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
|
||||||
&& (r&0xFF) != PT_LNTG))
|
&& (r&0xFF) != PT_LNTG))
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
if (pmap[(int)(playerp[8]-1)][(int)(playerp[7])])
|
||||||
{
|
{
|
||||||
player[21] = 3;
|
playerp[21] = 3;
|
||||||
player[22] = -2;
|
playerp[22] = -2;
|
||||||
player[19] = 2;
|
playerp[19] = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(playerp[16]-1)][(int)(playerp[15])])
|
||||||
{
|
{
|
||||||
player[25] = 3;
|
playerp[25] = 3;
|
||||||
player[26] = -2;
|
playerp[26] = -2;
|
||||||
player[23] = 2;
|
playerp[23] = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-1)][(int)(player[7])])
|
if (pmap[(int)(playerp[8]-1)][(int)(playerp[7])])
|
||||||
{
|
{
|
||||||
player[21] = 1;
|
playerp[21] = 1;
|
||||||
player[22] = -1;
|
playerp[22] = -1;
|
||||||
player[19] = 1;
|
playerp[19] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pmap[(int)(player[16]-1)][(int)(player[15])])
|
if (pmap[(int)(playerp[16]-1)][(int)(playerp[15])])
|
||||||
{
|
{
|
||||||
player[25] = 1;
|
playerp[25] = 1;
|
||||||
player[26] = -1;
|
playerp[26] = -1;
|
||||||
player[23] = 1;
|
playerp[23] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Jump
|
//Jump
|
||||||
if (((int)(player[0])&0x04) == 0x04 && (
|
if (((int)(playerp[0])&0x04) == 0x04 && (
|
||||||
(pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF)>=PT_NUM ||
|
(pmap[(int)(playerp[8]-0.5)][(int)(playerp[7])]&0xFF)>=PT_NUM ||
|
||||||
ptypes[pmap[(int)(player[8]-0.5)][(int)(player[7])]&0xFF].state != ST_GAS ||
|
ptypes[pmap[(int)(playerp[8]-0.5)][(int)(playerp[7])]&0xFF].state != ST_GAS ||
|
||||||
(pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF)>=PT_NUM ||
|
(pmap[(int)(playerp[16]-0.5)][(int)(playerp[15])]&0xFF)>=PT_NUM ||
|
||||||
ptypes[pmap[(int)(player[16]-0.5)][(int)(player[15])]&0xFF].state != ST_GAS))
|
ptypes[pmap[(int)(playerp[16]-0.5)][(int)(playerp[15])]&0xFF].state != ST_GAS))
|
||||||
{
|
{
|
||||||
if (pmap[(int)(player[8]-0.5)][(int)(player[7])] || pmap[(int)(player[16]-0.5)][(int)(player[15])])
|
if (pmap[(int)(playerp[8]-0.5)][(int)(playerp[7])] || pmap[(int)(playerp[16]-0.5)][(int)(playerp[15])])
|
||||||
{
|
{
|
||||||
parts[i].vy = -5;
|
parts[i].vy = -5;
|
||||||
player[22] -= 1;
|
playerp[22] -= 1;
|
||||||
player[26] -= 1;
|
playerp[26] -= 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]==WL_DETECT)
|
if (bmap[(int)(playerp[8]+0.5)/CELL][(int)(playerp[7]+0.5)/CELL]==WL_DETECT)
|
||||||
set_emap((int)player[7]/CELL, (int)player[8]/CELL);
|
set_emap((int)playerp[7]/CELL, (int)playerp[8]/CELL);
|
||||||
if (bmap[(int)(player[16]+0.5)/CELL][(int)(player[15]+0.5)/CELL]==WL_DETECT)
|
if (bmap[(int)(playerp[16]+0.5)/CELL][(int)(playerp[15]+0.5)/CELL]==WL_DETECT)
|
||||||
set_emap((int)(player[15]+0.5)/CELL, (int)(player[16]+0.5)/CELL);
|
set_emap((int)(playerp[15]+0.5)/CELL, (int)(playerp[16]+0.5)/CELL);
|
||||||
|
|
||||||
//Searching for particles near head
|
//Searching for particles near head
|
||||||
for (rx=-2; rx<3; rx++)
|
for (rx=-2; rx<3; rx++)
|
||||||
@ -202,7 +199,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
|
|
||||||
if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT)
|
if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT)
|
||||||
{
|
{
|
||||||
player[2] = r&0xFF; //Current element
|
playerp[2] = r&0xFF; //Current element
|
||||||
}
|
}
|
||||||
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
|
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
|
||||||
{
|
{
|
||||||
@ -220,15 +217,15 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
kill_part(r>>8);
|
kill_part(r>>8);
|
||||||
}
|
}
|
||||||
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
|
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
|
||||||
player[2] = SPC_AIR;
|
playerp[2] = SPC_AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Head position
|
//Head position
|
||||||
rx = x + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01);
|
rx = x + 3*((((int)playerp[1])&0x02) == 0x02) - 3*((((int)playerp[1])&0x01) == 0x01);
|
||||||
ry = y - 3*(player[1] == 0);
|
ry = y - 3*(playerp[1] == 0);
|
||||||
|
|
||||||
//Spawn
|
//Spawn
|
||||||
if (((int)(player[0])&0x08) == 0x08)
|
if (((int)(playerp[0])&0x08) == 0x08)
|
||||||
{
|
{
|
||||||
ry -= 2*(rand()%2)+1;
|
ry -= 2*(rand()%2)+1;
|
||||||
r = pmap[ry][rx];
|
r = pmap[ry][rx];
|
||||||
@ -241,13 +238,13 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
int np = -1;
|
int np = -1;
|
||||||
if (player[2] == SPC_AIR)
|
if (playerp[2] == SPC_AIR)
|
||||||
create_parts(rx + 3*((((int)player[1])&0x02) == 0x02) - 3*((((int)player[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR);
|
create_parts(rx + 3*((((int)playerp[1])&0x02) == 0x02) - 3*((((int)playerp[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR);
|
||||||
else
|
else
|
||||||
np = create_part(-1, rx, ry, player[2]);
|
np = create_part(-1, rx, ry, playerp[2]);
|
||||||
if ( (np < NPART) && np>=0 && player[2] != PT_PHOT && player[2] != SPC_AIR)
|
if ( (np < NPART) && np>=0 && playerp[2] != PT_PHOT && playerp[2] != SPC_AIR)
|
||||||
parts[np].vx = parts[np].vx + 5*((((int)player[1])&0x02) == 0x02) - 5*(((int)(player[1])&0x01) == 0x01);
|
parts[np].vx = parts[np].vx + 5*((((int)playerp[1])&0x02) == 0x02) - 5*(((int)(playerp[1])&0x01) == 0x01);
|
||||||
if ((np < NPART) && np>=0 && player[2] == PT_PHOT)
|
if ((np < NPART) && np>=0 && playerp[2] == PT_PHOT)
|
||||||
{
|
{
|
||||||
int random = abs(rand()%3-1)*3;
|
int random = abs(rand()%3-1)*3;
|
||||||
if (random==0)
|
if (random==0)
|
||||||
@ -257,8 +254,8 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
parts[np].vy = 0;
|
parts[np].vy = 0;
|
||||||
if (((int)player[1])&(0x01|0x02))
|
if (((int)playerp[1])&(0x01|0x02))
|
||||||
parts[np].vx = (((((int)player[1])&0x02) == 0x02) - (((int)(player[1])&0x01) == 0x01))*random;
|
parts[np].vx = (((((int)playerp[1])&0x02) == 0x02) - (((int)(playerp[1])&0x01) == 0x01))*random;
|
||||||
else
|
else
|
||||||
parts[np].vx = random;
|
parts[np].vx = random;
|
||||||
}
|
}
|
||||||
@ -269,53 +266,53 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//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((playerp[3]-playerp[7]), 2) + pow((playerp[4]-playerp[8]), 2)+25) - 0.5; //Fast distance
|
||||||
player[7] -= (player[3]-player[7])*d;
|
playerp[7] -= (playerp[3]-playerp[7])*d;
|
||||||
player[8] -= (player[4]-player[8])*d;
|
playerp[8] -= (playerp[4]-playerp[8])*d;
|
||||||
player[3] += (player[3]-player[7])*d;
|
playerp[3] += (playerp[3]-playerp[7])*d;
|
||||||
player[4] += (player[4]-player[8])*d;
|
playerp[4] += (playerp[4]-playerp[8])*d;
|
||||||
|
|
||||||
d = 25/(pow((player[11]-player[15]), 2) + pow((player[12]-player[16]), 2)+25) - 0.5;
|
d = 25/(pow((playerp[11]-playerp[15]), 2) + pow((playerp[12]-playerp[16]), 2)+25) - 0.5;
|
||||||
player[15] -= (player[11]-player[15])*d;
|
playerp[15] -= (playerp[11]-playerp[15])*d;
|
||||||
player[16] -= (player[12]-player[16])*d;
|
playerp[16] -= (playerp[12]-playerp[16])*d;
|
||||||
player[11] += (player[11]-player[15])*d;
|
playerp[11] += (playerp[11]-playerp[15])*d;
|
||||||
player[12] += (player[12]-player[16])*d;
|
playerp[12] += (playerp[12]-playerp[16])*d;
|
||||||
|
|
||||||
d = 36/(pow((player[3]-parts[i].x), 2) + pow((player[4]-parts[i].y), 2)+36) - 0.5;
|
d = 36/(pow((playerp[3]-parts[i].x), 2) + pow((playerp[4]-parts[i].y), 2)+36) - 0.5;
|
||||||
parts[i].vx -= (player[3]-parts[i].x)*d;
|
parts[i].vx -= (playerp[3]-parts[i].x)*d;
|
||||||
parts[i].vy -= (player[4]-parts[i].y)*d;
|
parts[i].vy -= (playerp[4]-parts[i].y)*d;
|
||||||
player[3] += (player[3]-parts[i].x)*d;
|
playerp[3] += (playerp[3]-parts[i].x)*d;
|
||||||
player[4] += (player[4]-parts[i].y)*d;
|
playerp[4] += (playerp[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((playerp[11]-parts[i].x), 2) + pow((playerp[12]-parts[i].y), 2)+36) - 0.5;
|
||||||
parts[i].vx -= (player[11]-parts[i].x)*d;
|
parts[i].vx -= (playerp[11]-parts[i].x)*d;
|
||||||
parts[i].vy -= (player[12]-parts[i].y)*d;
|
parts[i].vy -= (playerp[12]-parts[i].y)*d;
|
||||||
player[11] += (player[11]-parts[i].x)*d;
|
playerp[11] += (playerp[11]-parts[i].x)*d;
|
||||||
player[12] += (player[12]-parts[i].y)*d;
|
playerp[12] += (playerp[12]-parts[i].y)*d;
|
||||||
|
|
||||||
//Side collisions checking
|
//Side collisions checking
|
||||||
for (rx = -3; rx <= 3; rx++)
|
for (rx = -3; rx <= 3; rx++)
|
||||||
{
|
{
|
||||||
r = pmap[(int)(player[16]-2)][(int)(player[15]+rx)];
|
r = pmap[(int)(playerp[16]-2)][(int)(playerp[15]+rx)];
|
||||||
if (r && ((r&0xFF)>=PT_NUM || (ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)))
|
if (r && ((r&0xFF)>=PT_NUM || (ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)))
|
||||||
player[15] -= rx;
|
playerp[15] -= rx;
|
||||||
|
|
||||||
r = pmap[(int)(player[8]-2)][(int)(player[7]+rx)];
|
r = pmap[(int)(playerp[8]-2)][(int)(playerp[7]+rx)];
|
||||||
if (r && ((r&0xFF)>=PT_NUM || (ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)))
|
if (r && ((r&0xFF)>=PT_NUM || (ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)))
|
||||||
player[7] -= rx;
|
playerp[7] -= rx;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Collision checks
|
//Collision checks
|
||||||
for (ry = -2-(int)parts[i].vy; ry<=0; ry++)
|
for (ry = -2-(int)parts[i].vy; ry<=0; ry++)
|
||||||
{
|
{
|
||||||
r = pmap[(int)(player[8]+ry)][(int)(player[7]+0.5)]; //This is to make coding more pleasant :-)
|
r = pmap[(int)(playerp[8]+ry)][(int)(playerp[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 ((r&0xFF)<PT_NUM && (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)) //Liquid checks
|
if ((r&0xFF)<PT_NUM && (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)) //Liquid checks
|
||||||
{
|
{
|
||||||
if (parts[i].y<(player[8]-10))
|
if (parts[i].y<(playerp[8]-10))
|
||||||
parts[i].vy = 1*dt;
|
parts[i].vy = 1*dt;
|
||||||
else
|
else
|
||||||
parts[i].vy = 0;
|
parts[i].vy = 0;
|
||||||
@ -326,21 +323,21 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
{
|
{
|
||||||
if ((r&0xFF)>=PT_NUM || ptypes[r&0xFF].state != ST_GAS)
|
if ((r&0xFF)>=PT_NUM || ptypes[r&0xFF].state != ST_GAS)
|
||||||
{
|
{
|
||||||
player[8] += ry-1;
|
playerp[8] += ry-1;
|
||||||
parts[i].vy -= 0.5*parts[i].vy*dt;
|
parts[i].vy -= 0.5*parts[i].vy*dt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player[9] = player[7];
|
playerp[9] = playerp[7];
|
||||||
}
|
}
|
||||||
|
|
||||||
r = pmap[(int)(player[16]+ry)][(int)(player[15]+0.5)];
|
r = pmap[(int)(playerp[16]+ry)][(int)(playerp[15]+0.5)];
|
||||||
|
|
||||||
//For right leg
|
//For right leg
|
||||||
if (r && (r&0xFF)!=PT_STKM)
|
if (r && (r&0xFF)!=PT_STKM)
|
||||||
{
|
{
|
||||||
if ((r&0xFF)<PT_NUM && (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG))
|
if ((r&0xFF)<PT_NUM && (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG))
|
||||||
{
|
{
|
||||||
if (parts[i].y<(player[16]-10))
|
if (parts[i].y<(playerp[16]-10))
|
||||||
parts[i].vy = 1*dt;
|
parts[i].vy = 1*dt;
|
||||||
else
|
else
|
||||||
parts[i].vy = 0;
|
parts[i].vy = 0;
|
||||||
@ -351,11 +348,11 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
{
|
{
|
||||||
if ((r&0xFF)>=PT_NUM || ptypes[r&0xFF].state != ST_GAS)
|
if ((r&0xFF)>=PT_NUM || ptypes[r&0xFF].state != ST_GAS)
|
||||||
{
|
{
|
||||||
player[16] += ry-1;
|
playerp[16] += ry-1;
|
||||||
parts[i].vy -= 0.5*parts[i].vy*dt;
|
parts[i].vy -= 0.5*parts[i].vy*dt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player[17] = player[15];
|
playerp[17] = playerp[15];
|
||||||
}
|
}
|
||||||
|
|
||||||
//If it falls too fast
|
//If it falls too fast
|
||||||
@ -368,20 +365,20 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Keeping legs distance
|
//Keeping legs distance
|
||||||
if (pow((player[7] - player[15]), 2)<16 && pow((player[8]-player[16]), 2)<1)
|
if (pow((playerp[7] - playerp[15]), 2)<16 && pow((playerp[8]-playerp[16]), 2)<1)
|
||||||
{
|
{
|
||||||
player[21] -= 0.2;
|
playerp[21] -= 0.2;
|
||||||
player[25] += 0.2;
|
playerp[25] += 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pow((player[3] - player[11]), 2)<16 && pow((player[4]-player[12]), 2)<1)
|
if (pow((playerp[3] - playerp[11]), 2)<16 && pow((playerp[4]-playerp[12]), 2)<1)
|
||||||
{
|
{
|
||||||
player[19] -= 0.2;
|
playerp[19] -= 0.2;
|
||||||
player[23] += 0.2;
|
playerp[23] += 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)(playerp[8]+0.5)][(int)(playerp[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;
|
||||||
@ -392,7 +389,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243) //If hot or cold
|
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243) //If hot or cold
|
||||||
{
|
{
|
||||||
parts[i].life -= 2;
|
parts[i].life -= 2;
|
||||||
player[26] -= 1;
|
playerp[26] -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +399,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
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)(playerp[16]+0.5)][(int)(playerp[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;
|
||||||
@ -413,7 +410,7 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
|
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
|
||||||
{
|
{
|
||||||
parts[i].life -= 2;
|
parts[i].life -= 2;
|
||||||
player[22] -= 1;
|
playerp[22] -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +420,6 @@ int update_STKM(UPDATE_FUNC_ARGS) {
|
|||||||
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;
|
parts[i].ctype = playerp[2];
|
||||||
parts[i].ctype = player[2];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,430 +1,14 @@
|
|||||||
#include <element.h>
|
#include <element.h>
|
||||||
|
|
||||||
int update_SPAWN2(UPDATE_FUNC_ARGS) {
|
int update_SPAWN2(UPDATE_FUNC_ARGS) {
|
||||||
ISSPAWN2 = 1;
|
if (!player2[27])
|
||||||
if (death2)
|
create_part(-1, x, y, PT_STKM2);
|
||||||
{
|
|
||||||
player2spawn = create_part(-1,x,y,PT_STKM2);
|
|
||||||
isplayer2 = 1;
|
|
||||||
death2 = 0;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int update_STKM2(UPDATE_FUNC_ARGS) {
|
int update_STKM2(UPDATE_FUNC_ARGS) {
|
||||||
int r, rx, ry;
|
run_stickman(player2, UPDATE_FUNC_SUBCALL_ARGS);
|
||||||
float pp, d;
|
|
||||||
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
|
|
||||||
|
|
||||||
if ((parts[i].ctype>0 && parts[i].ctype<PT_NUM && ptypes[parts[i].ctype].falldown>0) || parts[i].ctype==SPC_AIR || parts[i].ctype == PT_NEUT || parts[i].ctype == PT_PHOT)
|
|
||||||
player2[2] = parts[i].ctype;
|
|
||||||
|
|
||||||
//Tempirature handling
|
|
||||||
if (parts[i].temp<243)
|
|
||||||
parts[i].life -= 1;
|
|
||||||
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
|
|
||||||
parts[i].temp += 1;
|
|
||||||
|
|
||||||
if (isplayer2) { //Already a stickman2 in the simulation
|
|
||||||
death2 = 1;
|
|
||||||
parts[i].type = PT_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Death
|
|
||||||
if (parts[i].life<1 || death2 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind...
|
|
||||||
{
|
|
||||||
for (r=-2; r<=1; r++)
|
|
||||||
{
|
|
||||||
create_part(-1, x+r, y-2, player2[2]);
|
|
||||||
create_part(-1, x+r+1, y+2, player2[2]);
|
|
||||||
create_part(-1, x-2, y+r+1, player2[2]);
|
|
||||||
create_part(-1, x+2, y+r, player2[2]);
|
|
||||||
}
|
|
||||||
kill_part(i); //Kill him
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
parts[i].vy += -0.7*dt; //Head up!
|
|
||||||
|
|
||||||
//Verlet integration
|
|
||||||
pp = 2*player2[3]-player2[5]+player2[19]*dt*dt;;
|
|
||||||
player2[5] = player2[3];
|
|
||||||
player2[3] = pp;
|
|
||||||
pp = 2*player2[4]-player2[6]+player2[20]*dt*dt;;
|
|
||||||
player2[6] = player2[4];
|
|
||||||
player2[4] = pp;
|
|
||||||
|
|
||||||
pp = 2*player2[7]-player2[9]+player2[21]*dt*dt;;
|
|
||||||
player2[9] = player2[7];
|
|
||||||
player2[7] = pp;
|
|
||||||
pp = 2*player2[8]-player2[10]+(player2[22]+1)*dt*dt;;
|
|
||||||
player2[10] = player2[8];
|
|
||||||
player2[8] = pp;
|
|
||||||
|
|
||||||
pp = 2*player2[11]-player2[13]+player2[23]*dt*dt;;
|
|
||||||
player2[13] = player2[11];
|
|
||||||
player2[11] = pp;
|
|
||||||
pp = 2*player2[12]-player2[14]+player2[24]*dt*dt;;
|
|
||||||
player2[14] = player2[12];
|
|
||||||
player2[12] = pp;
|
|
||||||
|
|
||||||
pp = 2*player2[15]-player2[17]+player2[25]*dt*dt;;
|
|
||||||
player2[17] = player2[15];
|
|
||||||
player2[15] = pp;
|
|
||||||
pp = 2*player2[16]-player2[18]+(player2[26]+1)*dt*dt;;
|
|
||||||
player2[18] = player2[16];
|
|
||||||
player2[16] = pp;
|
|
||||||
|
|
||||||
//Setting acceleration to 0
|
|
||||||
player2[19] = 0;
|
|
||||||
player2[20] = 0;
|
|
||||||
|
|
||||||
player2[21] = 0;
|
|
||||||
player2[22] = 0;
|
|
||||||
|
|
||||||
player2[23] = 0;
|
|
||||||
player2[24] = 0;
|
|
||||||
|
|
||||||
player2[25] = 0;
|
|
||||||
player2[26] = 0;
|
|
||||||
|
|
||||||
//Go left
|
|
||||||
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
|
|
||||||
if (((int)(player2[0])&0x01) == 0x01 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
|
|
||||||
{
|
|
||||||
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
|
|
||||||
&& (r&0xFF) != PT_LNTG))
|
|
||||||
{
|
|
||||||
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
|
|
||||||
{
|
|
||||||
player2[21] = -3;
|
|
||||||
player2[22] = -2;
|
|
||||||
player2[19] = -2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
|
|
||||||
{
|
|
||||||
player2[25] = -3;
|
|
||||||
player2[26] = -2;
|
|
||||||
player2[23] = -2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pmap[(int)(player2[8]-1)][(int)(player2[7])]) //It should move another way in liquids
|
|
||||||
{
|
|
||||||
player2[21] = -1;
|
|
||||||
player2[22] = -1;
|
|
||||||
player2[19] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
|
|
||||||
{
|
|
||||||
player2[25] = -1;
|
|
||||||
player2[26] = -1;
|
|
||||||
player2[23] = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Go right
|
|
||||||
r = pmap[(int)(parts[i].y+10)][(int)(parts[i].x)];
|
|
||||||
if (((int)(player2[0])&0x02) == 0x02 && (((r&0xFF)>=PT_NUM) || ptypes[r&0xFF].state != ST_GAS))
|
|
||||||
{
|
|
||||||
if (r>=PT_NUM || (ptypes[r&0xFF].state != ST_LIQUID
|
|
||||||
&& (r&0xFF) != PT_LNTG))
|
|
||||||
{
|
|
||||||
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
|
|
||||||
{
|
|
||||||
player2[21] = 3;
|
|
||||||
player2[22] = -2;
|
|
||||||
player2[19] = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
|
|
||||||
{
|
|
||||||
player2[25] = 3;
|
|
||||||
player2[26] = -2;
|
|
||||||
player2[23] = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (pmap[(int)(player2[8]-1)][(int)(player2[7])])
|
|
||||||
{
|
|
||||||
player2[21] = 1;
|
|
||||||
player2[22] = -1;
|
|
||||||
player2[19] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pmap[(int)(player2[16]-1)][(int)(player2[15])])
|
|
||||||
{
|
|
||||||
player2[25] = 1;
|
|
||||||
player2[26] = -1;
|
|
||||||
player2[23] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Jump
|
|
||||||
if (((int)(player2[0])&0x04) == 0x04 && (
|
|
||||||
(pmap[(int)(player2[8]-0.5)][(int)(player2[7])]&0xFF)>=PT_NUM ||
|
|
||||||
ptypes[pmap[(int)(player2[8]-0.5)][(int)(player2[7])]&0xFF].state != ST_GAS ||
|
|
||||||
(pmap[(int)(player2[16]-0.5)][(int)(player2[15])]&0xFF)>=PT_NUM ||
|
|
||||||
ptypes[pmap[(int)(player2[16]-0.5)][(int)(player2[15])]&0xFF].state != ST_GAS))
|
|
||||||
{
|
|
||||||
if (pmap[(int)(player2[8]-0.5)][(int)(player2[7])] || pmap[(int)(player2[16]-0.5)][(int)(player2[15])])
|
|
||||||
{
|
|
||||||
parts[i].vy = -5;
|
|
||||||
player2[22] -= 1;
|
|
||||||
player2[26] -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Charge detector wall if foot inside
|
|
||||||
if (bmap[(int)(player2[8]+0.5)/CELL][(int)(player2[7]+0.5)/CELL]==WL_DETECT)
|
|
||||||
set_emap((int)player2[7]/CELL, (int)player2[8]/CELL);
|
|
||||||
if (bmap[(int)(player2[16]+0.5)/CELL][(int)(player2[15]+0.5)/CELL]==WL_DETECT)
|
|
||||||
set_emap((int)(player2[15]+0.5)/CELL, (int)(player2[16]+0.5)/CELL);
|
|
||||||
|
|
||||||
//Searching for particles near head
|
|
||||||
for (rx=-2; rx<3; rx++)
|
|
||||||
for (ry=-2; ry<3; ry++)
|
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
|
||||||
{
|
|
||||||
r = pmap[y+ry][x+rx];
|
|
||||||
if (!r || (r>>8)>=NPART)
|
|
||||||
r = photons[y+ry][x+rx];
|
|
||||||
|
|
||||||
if ((!r || (r>>8)>=NPART) && !bmap[(y+ry)/CELL][(x+rx)/CELL])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ptypes[r&0xFF].falldown!=0 || (r&0xFF) == PT_NEUT || (r&0xFF) == PT_PHOT)
|
|
||||||
{
|
|
||||||
player2[2] = r&0xFF; //Current element
|
|
||||||
}
|
|
||||||
if ((r&0xFF) == PT_PLNT && parts[i].life<100) //Plant gives him 5 HP
|
|
||||||
{
|
|
||||||
if (parts[i].life<=95)
|
|
||||||
parts[i].life += 5;
|
|
||||||
else
|
|
||||||
parts[i].life = 100;
|
|
||||||
kill_part(r>>8);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((r&0xFF) == PT_NEUT)
|
|
||||||
{
|
|
||||||
if (parts[i].life<=100) parts[i].life -= (102-parts[i].life)/2;
|
|
||||||
else parts[i].life *= 0.9f;
|
|
||||||
kill_part(r>>8);
|
|
||||||
}
|
|
||||||
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
|
|
||||||
player2[2] = SPC_AIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Head position
|
|
||||||
rx = x + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01);
|
|
||||||
ry = y - 3*(player2[1] == 0);
|
|
||||||
|
|
||||||
//Spawn
|
|
||||||
if (((int)(player2[0])&0x08) == 0x08)
|
|
||||||
{
|
|
||||||
ry -= 2*(rand()%2)+1;
|
|
||||||
r = pmap[ry][rx];
|
|
||||||
if (!((r>>8)>=NPART))
|
|
||||||
{
|
|
||||||
if (ptypes[r&0xFF].state == ST_SOLID)
|
|
||||||
{
|
|
||||||
create_part(-1, rx, ry, PT_SPRK);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int np = -1;
|
|
||||||
if (player2[2] == SPC_AIR)
|
|
||||||
create_parts(rx + 3*((((int)player2[1])&0x02) == 0x02) - 3*((((int)player2[1])&0x01) == 0x01), ry, 4, 4, SPC_AIR);
|
|
||||||
else
|
|
||||||
np = create_part(-1, rx, ry, player2[2]);
|
|
||||||
if ((np < NPART) && np>=0 && player2[2] != PT_PHOT && player2[2] != SPC_AIR)
|
|
||||||
parts[np].vx = parts[np].vx + 5*((((int)player2[1])&0x02) == 0x02) - 5*(((int)(player2[1])&0x01) == 0x01);
|
|
||||||
if ((np < NPART) && np>=0 && player2[2] == PT_PHOT)
|
|
||||||
{
|
|
||||||
int random = abs(rand()%3-1)*3;
|
|
||||||
if (random==0)
|
|
||||||
{
|
|
||||||
kill_part(np);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parts[np].vy = 0;
|
|
||||||
if (((int)player2[1])&(0x01|0x02))
|
|
||||||
parts[np].vx = (((((int)player2[1])&0x02) == 0x02) - (((int)(player2[1])&0x01) == 0x01))*random;
|
|
||||||
else
|
|
||||||
parts[np].vx = random;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Simulation of joints
|
|
||||||
d = 25/(pow((player2[3]-player2[7]), 2) + pow((player2[4]-player2[8]), 2)+25) - 0.5; //Fast distance
|
|
||||||
player2[7] -= (player2[3]-player2[7])*d;
|
|
||||||
player2[8] -= (player2[4]-player2[8])*d;
|
|
||||||
player2[3] += (player2[3]-player2[7])*d;
|
|
||||||
player2[4] += (player2[4]-player2[8])*d;
|
|
||||||
|
|
||||||
d = 25/(pow((player2[11]-player2[15]), 2) + pow((player2[12]-player2[16]), 2)+25) - 0.5;
|
|
||||||
player2[15] -= (player2[11]-player2[15])*d;
|
|
||||||
player2[16] -= (player2[12]-player2[16])*d;
|
|
||||||
player2[11] += (player2[11]-player2[15])*d;
|
|
||||||
player2[12] += (player2[12]-player2[16])*d;
|
|
||||||
|
|
||||||
d = 36/(pow((player2[3]-parts[i].x), 2) + pow((player2[4]-parts[i].y), 2)+36) - 0.5;
|
|
||||||
parts[i].vx -= (player2[3]-parts[i].x)*d;
|
|
||||||
parts[i].vy -= (player2[4]-parts[i].y)*d;
|
|
||||||
player2[3] += (player2[3]-parts[i].x)*d;
|
|
||||||
player2[4] += (player2[4]-parts[i].y)*d;
|
|
||||||
|
|
||||||
d = 36/(pow((player2[11]-parts[i].x), 2) + pow((player2[12]-parts[i].y), 2)+36) - 0.5;
|
|
||||||
parts[i].vx -= (player2[11]-parts[i].x)*d;
|
|
||||||
parts[i].vy -= (player2[12]-parts[i].y)*d;
|
|
||||||
player2[11] += (player2[11]-parts[i].x)*d;
|
|
||||||
player2[12] += (player2[12]-parts[i].y)*d;
|
|
||||||
|
|
||||||
//Side collisions checking
|
|
||||||
for (rx = -3; rx <= 3; rx++)
|
|
||||||
{
|
|
||||||
r = pmap[(int)(player2[16]-2)][(int)(player2[15]+rx)];
|
|
||||||
if (r && ((r&0xFF)>=PT_NUM || (ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)))
|
|
||||||
player2[15] -= rx;
|
|
||||||
|
|
||||||
r = pmap[(int)(player2[8]-2)][(int)(player2[7]+rx)];
|
|
||||||
if (r && ((r&0xFF)>=PT_NUM || (ptypes[r&0xFF].state != ST_GAS && ptypes[r&0xFF].state != ST_LIQUID)))
|
|
||||||
player2[7] -= rx;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Collision checks
|
|
||||||
for (ry = -2-(int)parts[i].vy; ry<=0; ry++)
|
|
||||||
{
|
|
||||||
r = pmap[(int)(player2[8]+ry)][(int)(player2[7]+0.5)]; //This is to make coding more pleasant :-)
|
|
||||||
|
|
||||||
//For left leg
|
|
||||||
if (r && (r&0xFF)!=PT_STKM2)
|
|
||||||
{
|
|
||||||
if ((r&0xFF)<PT_NUM && (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG)) //Liquid checks
|
|
||||||
{
|
|
||||||
if (parts[i].y<(player2[8]-10))
|
|
||||||
parts[i].vy = 1*dt;
|
|
||||||
else
|
|
||||||
parts[i].vy = 0;
|
|
||||||
if (abs(parts[i].vx)>1)
|
|
||||||
parts[i].vx *= 0.5*dt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((r&0xFF)>=PT_NUM || ptypes[r&0xFF].state != ST_GAS)
|
|
||||||
{
|
|
||||||
player2[8] += ry-1;
|
|
||||||
parts[i].vy -= 0.5*parts[i].vy*dt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player2[9] = player2[7];
|
|
||||||
}
|
|
||||||
|
|
||||||
r = pmap[(int)(player2[16]+ry)][(int)(player2[15]+0.5)];
|
|
||||||
|
|
||||||
//For right leg
|
|
||||||
if (r && (r&0xFF)!=PT_STKM2)
|
|
||||||
{
|
|
||||||
if ((r&0xFF)<PT_NUM && (ptypes[r&0xFF].state == ST_LIQUID || (r&0xFF) == PT_LNTG))
|
|
||||||
{
|
|
||||||
if (parts[i].y<(player2[16]-10))
|
|
||||||
parts[i].vy = 1*dt;
|
|
||||||
else
|
|
||||||
parts[i].vy = 0;
|
|
||||||
if (abs(parts[i].vx)>1)
|
|
||||||
parts[i].vx *= 0.5*dt;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((r&0xFF)>=PT_NUM || ptypes[r&0xFF].state != ST_GAS)
|
|
||||||
{
|
|
||||||
player2[16] += ry-1;
|
|
||||||
parts[i].vy -= 0.5*parts[i].vy*dt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
player2[17] = player2[15];
|
|
||||||
}
|
|
||||||
|
|
||||||
//If it falls too fast
|
|
||||||
if (parts[i].vy>=30)
|
|
||||||
{
|
|
||||||
parts[i].y -= (10+ry)*dt;
|
|
||||||
parts[i].vy = -10*dt;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//Keeping legs distance
|
|
||||||
if (pow((player2[7] - player2[15]), 2)<16 && pow((player2[8]-player2[16]), 2)<1)
|
|
||||||
{
|
|
||||||
player2[21] -= 0.2;
|
|
||||||
player2[25] += 0.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pow((player2[3] - player2[11]), 2)<16 && pow((player2[4]-player2[12]), 2)<1)
|
|
||||||
{
|
|
||||||
player2[19] -= 0.2;
|
|
||||||
player2[23] += 0.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
//If legs touch something
|
|
||||||
r = pmap[(int)(player2[8]+0.5)][(int)(player2[7]+0.5)];
|
|
||||||
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
|
||||||
{
|
|
||||||
parts[i].life -= (int)(rand()/1000)+38;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r>0 && (r>>8)<NPART)
|
|
||||||
{
|
|
||||||
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243) //If hot or cold
|
|
||||||
{
|
|
||||||
parts[i].life -= 2;
|
|
||||||
player2[26] -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((r&0xFF)==PT_ACID) //If on acid
|
|
||||||
parts[i].life -= 5;
|
|
||||||
|
|
||||||
if ((r&0xFF)==PT_PLUT) //If on plut
|
|
||||||
parts[i].life -= 1;
|
|
||||||
|
|
||||||
r = pmap[(int)(player2[16]+0.5)][(int)(player2[15]+0.5)];
|
|
||||||
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
|
||||||
{
|
|
||||||
parts[i].life -= (int)(rand()/1000)+38;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r>0 && (r>>8)<NPART) //If hot or cold
|
|
||||||
{
|
|
||||||
if (parts[r>>8].temp>=323 || parts[r>>8].temp<=243)
|
|
||||||
{
|
|
||||||
parts[i].life -= 2;
|
|
||||||
player2[22] -= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((r&0xFF)==PT_ACID) //If on acid
|
|
||||||
parts[i].life -= 5;
|
|
||||||
|
|
||||||
if ((r&0xFF)==PT_PLUT) //If on plut
|
|
||||||
parts[i].life -= 1;
|
|
||||||
|
|
||||||
isplayer2 = 1;
|
|
||||||
parts[i].ctype = player2[2];
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1750,8 +1750,6 @@ void draw_parts(pixel *vid)
|
|||||||
draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s);
|
draw_line(vid , player[3], player[4], player[7], player[8], 255, 255, 255, s);
|
||||||
draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s);
|
draw_line(vid , nx, ny+3, player[11], player[12], 255, 255, 255, s);
|
||||||
draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s);
|
draw_line(vid , player[11], player[12], player[15], player[16], 255, 255, 255, s);
|
||||||
|
|
||||||
isplayer = 1; //It's a secret. Tssss...
|
|
||||||
}
|
}
|
||||||
else if (t==PT_STKM2)
|
else if (t==PT_STKM2)
|
||||||
{
|
{
|
||||||
@ -1777,8 +1775,6 @@ void draw_parts(pixel *vid)
|
|||||||
draw_line(vid , player2[3], player2[4], player2[7], player2[8], 100, 100, 255, s);
|
draw_line(vid , player2[3], player2[4], player2[7], player2[8], 100, 100, 255, s);
|
||||||
draw_line(vid , nx, ny+3, player2[11], player2[12], 100, 100, 255, s);
|
draw_line(vid , nx, ny+3, player2[11], player2[12], 100, 100, 255, s);
|
||||||
draw_line(vid , player2[11], player2[12], player2[15], player2[16], 100, 100, 255, s);
|
draw_line(vid , player2[11], player2[12], player2[15], player2[16], 100, 100, 255, s);
|
||||||
|
|
||||||
isplayer2 = 1; //It's a secret. Tssss...
|
|
||||||
}
|
}
|
||||||
if (cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_GPMP && t!=PT_PBCN && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
|
if (cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_GPMP && t!=PT_PBCN && t!=PT_FILT && t!=PT_HSWC && t!=PT_PCLN && t!=PT_DEUT && t!=PT_WIFI)//nothing display but show needed color changes
|
||||||
{
|
{
|
||||||
@ -3266,8 +3262,6 @@ void draw_parts(pixel *vid)
|
|||||||
draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s);
|
draw_line(vid , player[3], player[4], player[7], player[8], R, G, B, s);
|
||||||
draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s);
|
draw_line(vid , nx, ny+3, player[11], player[12], R, G, B, s);
|
||||||
draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s);
|
draw_line(vid , player[11], player[12], player[15], player[16], R, G, B, s);
|
||||||
|
|
||||||
isplayer = 1; //It's a secret. Tssss...
|
|
||||||
}
|
}
|
||||||
else if (t==PT_STKM2) //Stick man should be visible in heat mode
|
else if (t==PT_STKM2) //Stick man should be visible in heat mode
|
||||||
{
|
{
|
||||||
@ -3291,8 +3285,6 @@ void draw_parts(pixel *vid)
|
|||||||
draw_line(vid , player2[3], player2[4], player2[7], player2[8], R, G, B, s);
|
draw_line(vid , player2[3], player2[4], player2[7], player2[8], R, G, B, s);
|
||||||
draw_line(vid , nx, ny+3, player2[11], player2[12], R, G, B, s);
|
draw_line(vid , nx, ny+3, player2[11], player2[12], R, G, B, s);
|
||||||
draw_line(vid , player2[11], player2[12], player2[15], player2[16], R, G, B, s);
|
draw_line(vid , player2[11], player2[12], player2[15], player2[16], R, G, B, s);
|
||||||
|
|
||||||
isplayer2 = 1; //It's a secret. Tssss...
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
29
src/main.c
29
src/main.c
@ -180,7 +180,7 @@ int aheat_enable; //Ambient heat
|
|||||||
int decorations_enable = 1;
|
int decorations_enable = 1;
|
||||||
int hud_enable = 1;
|
int hud_enable = 1;
|
||||||
int active_menu = 0;
|
int active_menu = 0;
|
||||||
int death = 0, framerender = 0;
|
int framerender = 0;
|
||||||
int amd = 1;
|
int amd = 1;
|
||||||
int FPSB = 0;
|
int FPSB = 0;
|
||||||
int MSIGN =-1;
|
int MSIGN =-1;
|
||||||
@ -712,7 +712,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
|
|||||||
j = PT_DUST;//goto corrupt;
|
j = PT_DUST;//goto corrupt;
|
||||||
}
|
}
|
||||||
gol[x][y]=0;
|
gol[x][y]=0;
|
||||||
if (j)// && !(isplayer == 1 && j==PT_STKM))
|
if (j)// && !(player[27] == 1 && j==PT_STKM))
|
||||||
{
|
{
|
||||||
if (pmap[y][x] && (pmap[y][x]>>8)<NPART)
|
if (pmap[y][x] && (pmap[y][x]>>8)<NPART)
|
||||||
{
|
{
|
||||||
@ -786,6 +786,8 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
|
|||||||
player[17] = parts[i].x+3;
|
player[17] = parts[i].x+3;
|
||||||
player[18] = parts[i].y+12;
|
player[18] = parts[i].y+12;
|
||||||
|
|
||||||
|
player[27] = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (parts[i].type == PT_STKM2)
|
if (parts[i].type == PT_STKM2)
|
||||||
{
|
{
|
||||||
@ -811,6 +813,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
|
|||||||
player2[17] = parts[i].x+3;
|
player2[17] = parts[i].x+3;
|
||||||
player2[18] = parts[i].y+12;
|
player2[18] = parts[i].y+12;
|
||||||
|
|
||||||
|
player2[27] = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1133,7 +1136,7 @@ void clear_sim(void)
|
|||||||
memset(wireless, 0, sizeof(wireless));
|
memset(wireless, 0, sizeof(wireless));
|
||||||
memset(gol2, 0, sizeof(gol2));
|
memset(gol2, 0, sizeof(gol2));
|
||||||
memset(portalp, 0, sizeof(portalp));
|
memset(portalp, 0, sizeof(portalp));
|
||||||
death = death2 = ISSPAWN1 = ISSPAWN2 = 0;
|
ISSPAWN1 = ISSPAWN2 = 0;
|
||||||
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
|
||||||
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
memset(fire_bg, 0, XRES*YRES*PIXELSIZE);
|
||||||
memset(fire_r, 0, sizeof(fire_r));
|
memset(fire_r, 0, sizeof(fire_r));
|
||||||
@ -2105,11 +2108,6 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if(sdl_key=='d' && isplayer)
|
|
||||||
//{
|
|
||||||
// death = 1;
|
|
||||||
// //death = !(death);
|
|
||||||
//}
|
|
||||||
if (sdl_key=='f')
|
if (sdl_key=='f')
|
||||||
{
|
{
|
||||||
framerender = 1;
|
framerender = 1;
|
||||||
@ -2145,7 +2143,7 @@ int main(int argc, char *argv[])
|
|||||||
free(load_data);
|
free(load_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sdl_key=='s' && ((sdl_mod & (KMOD_CTRL)) || !isplayer2))
|
if (sdl_key=='s' && ((sdl_mod & (KMOD_CTRL)) || !player2[27]))
|
||||||
{
|
{
|
||||||
if (it > 50)
|
if (it > 50)
|
||||||
it = 50;
|
it = 50;
|
||||||
@ -2279,7 +2277,7 @@ int main(int argc, char *argv[])
|
|||||||
bsy = 0;
|
bsy = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sdl_key=='d' && ((sdl_mod & (KMOD_CTRL)) || !isplayer2))
|
if (sdl_key=='d' && ((sdl_mod & (KMOD_CTRL)) || !player2[27]))
|
||||||
DEBUG_MODE = !DEBUG_MODE;
|
DEBUG_MODE = !DEBUG_MODE;
|
||||||
if (sdl_key=='i')
|
if (sdl_key=='i')
|
||||||
{
|
{
|
||||||
@ -2363,7 +2361,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdl_key=='w' && (!isplayer2 || (sdl_mod & (KMOD_SHIFT)))) //Gravity, by Moach
|
if (sdl_key=='w' && (!player2[27] || (sdl_mod & (KMOD_SHIFT)))) //Gravity, by Moach
|
||||||
{
|
{
|
||||||
++gravityMode; // cycle gravity mode
|
++gravityMode; // cycle gravity mode
|
||||||
itc = 51;
|
itc = 51;
|
||||||
@ -2990,9 +2988,8 @@ int main(int argc, char *argv[])
|
|||||||
gravityMode = 0;
|
gravityMode = 0;
|
||||||
airMode = 0;
|
airMode = 0;
|
||||||
|
|
||||||
death = death2 = 0;
|
player2[27] = 0;
|
||||||
isplayer2 = 0;
|
player[27] = 0;
|
||||||
isplayer = 0;
|
|
||||||
ISSPAWN1 = 0;
|
ISSPAWN1 = 0;
|
||||||
ISSPAWN2 = 0;
|
ISSPAWN2 = 0;
|
||||||
}
|
}
|
||||||
@ -3584,14 +3581,14 @@ int main(int argc, char *argv[])
|
|||||||
sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE);
|
sdl_blit(0, 0, XRES+BARSIZE, YRES+MENUSIZE, vid_buf, XRES+BARSIZE);
|
||||||
|
|
||||||
//Setting an element for the stick man
|
//Setting an element for the stick man
|
||||||
if (isplayer==0)
|
if (player[27]==0)
|
||||||
{
|
{
|
||||||
if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT)
|
if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT)
|
||||||
player[2] = sr;
|
player[2] = sr;
|
||||||
else
|
else
|
||||||
player[2] = PT_DUST;
|
player[2] = PT_DUST;
|
||||||
}
|
}
|
||||||
if (isplayer2==0)
|
if (player2[27]==0)
|
||||||
{
|
{
|
||||||
if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT)
|
if ((sr<PT_NUM && ptypes[sr].falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT)
|
||||||
player2[2] = sr;
|
player2[2] = sr;
|
||||||
|
40
src/powder.c
40
src/powder.c
@ -7,9 +7,8 @@
|
|||||||
|
|
||||||
int gravwl_timeout = 0;
|
int gravwl_timeout = 0;
|
||||||
|
|
||||||
int isplayer = 0;
|
float player[28]; //[0] is a command cell, [3]-[18] are legs positions, [19]-[26] are accelerations, [27] shows if player was spawned
|
||||||
float player[27]; //[0] is a command cell, [3]-[18] are legs positions, [19] is index, [19]-[26] are accelerations
|
float player2[28];
|
||||||
float player2[27];
|
|
||||||
|
|
||||||
particle *parts;
|
particle *parts;
|
||||||
particle *cb_parts;
|
particle *cb_parts;
|
||||||
@ -291,13 +290,11 @@ int try_move(int i, int x, int y, int nx, int ny)
|
|||||||
{
|
{
|
||||||
if (parts[i].type == PT_STKM)
|
if (parts[i].type == PT_STKM)
|
||||||
{
|
{
|
||||||
death = 1;
|
player[27] = 0;
|
||||||
isplayer = 0;
|
|
||||||
}
|
}
|
||||||
if (parts[i].type == PT_STKM2)
|
if (parts[i].type == PT_STKM2)
|
||||||
{
|
{
|
||||||
death2 = 1;
|
player2[27] = 0;
|
||||||
isplayer2 = 0;
|
|
||||||
}
|
}
|
||||||
parts[i].type=PT_NONE;
|
parts[i].type=PT_NONE;
|
||||||
return 0;
|
return 0;
|
||||||
@ -306,13 +303,11 @@ int try_move(int i, int x, int y, int nx, int ny)
|
|||||||
{
|
{
|
||||||
if (parts[i].type == PT_STKM)
|
if (parts[i].type == PT_STKM)
|
||||||
{
|
{
|
||||||
death = 1;
|
player[27] = 0;
|
||||||
isplayer = 0;
|
|
||||||
}
|
}
|
||||||
if (parts[i].type == PT_STKM2)
|
if (parts[i].type == PT_STKM2)
|
||||||
{
|
{
|
||||||
death2 = 1;
|
player2[27] = 0;
|
||||||
isplayer2 = 0;
|
|
||||||
}
|
}
|
||||||
parts[i].type=PT_NONE;
|
parts[i].type=PT_NONE;
|
||||||
if (!legacy_enable)
|
if (!legacy_enable)
|
||||||
@ -576,13 +571,11 @@ void kill_part(int i)//kills particle number i
|
|||||||
y = (int)(parts[i].y+0.5f);
|
y = (int)(parts[i].y+0.5f);
|
||||||
if (parts[i].type == PT_STKM)
|
if (parts[i].type == PT_STKM)
|
||||||
{
|
{
|
||||||
death = 1;
|
player[27] = 0;
|
||||||
isplayer = 0;
|
|
||||||
}
|
}
|
||||||
if (parts[i].type == PT_STKM2)
|
if (parts[i].type == PT_STKM2)
|
||||||
{
|
{
|
||||||
death2 = 1;
|
player2[27] = 0;
|
||||||
isplayer2 = 0;
|
|
||||||
}
|
}
|
||||||
if (parts[i].type == PT_SPAWN)
|
if (parts[i].type == PT_SPAWN)
|
||||||
{
|
{
|
||||||
@ -618,6 +611,13 @@ inline void part_change_type(int i, int x, int y, int t)//changes the type of pa
|
|||||||
return;
|
return;
|
||||||
if (!ptypes[t].enabled)
|
if (!ptypes[t].enabled)
|
||||||
t = PT_NONE;
|
t = PT_NONE;
|
||||||
|
|
||||||
|
if (parts[i].type == PT_STKM)
|
||||||
|
player[27] = 0;
|
||||||
|
|
||||||
|
if (parts[i].type == PT_STKM2)
|
||||||
|
player2[27] = 0;
|
||||||
|
|
||||||
parts[i].type = t;
|
parts[i].type = t;
|
||||||
if (t==PT_PHOT || t==PT_NEUT)
|
if (t==PT_PHOT || t==PT_NEUT)
|
||||||
{
|
{
|
||||||
@ -900,7 +900,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
}
|
}
|
||||||
if (t==PT_STKM)
|
if (t==PT_STKM)
|
||||||
{
|
{
|
||||||
if (isplayer==0)
|
if (player[27]==0)
|
||||||
{
|
{
|
||||||
parts[i].x = (float)x;
|
parts[i].x = (float)x;
|
||||||
parts[i].y = (float)y;
|
parts[i].y = (float)y;
|
||||||
@ -931,7 +931,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
player[17] = x+3;
|
player[17] = x+3;
|
||||||
player[18] = y+12;
|
player[18] = y+12;
|
||||||
|
|
||||||
isplayer = 1;
|
player[27] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -942,7 +942,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
}
|
}
|
||||||
if (t==PT_STKM2)
|
if (t==PT_STKM2)
|
||||||
{
|
{
|
||||||
if (isplayer2==0)
|
if (player2[27]==0)
|
||||||
{
|
{
|
||||||
parts[i].x = (float)x;
|
parts[i].x = (float)x;
|
||||||
parts[i].y = (float)y;
|
parts[i].y = (float)y;
|
||||||
@ -973,7 +973,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
player2[17] = x+3;
|
player2[17] = x+3;
|
||||||
player2[18] = y+12;
|
player2[18] = y+12;
|
||||||
|
|
||||||
isplayer2 = 1;
|
player2[27] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2389,8 +2389,6 @@ void update_particles(pixel *vid)//doesn't update the particles themselves, but
|
|||||||
pthread_t *InterThreads;
|
pthread_t *InterThreads;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
isplayer = 0; //Needed for player spawning
|
|
||||||
isplayer2 = 0;
|
|
||||||
memset(pmap, 0, sizeof(pmap));
|
memset(pmap, 0, sizeof(pmap));
|
||||||
memset(photons, 0, sizeof(photons));
|
memset(photons, 0, sizeof(photons));
|
||||||
r = rand()%2;
|
r = rand()%2;
|
||||||
|
Loading…
Reference in New Issue
Block a user