Stickman go through portals
This commit is contained in:
parent
7d283335d4
commit
a96afc863e
@ -322,6 +322,8 @@ 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);
|
int run_stickman(float* playerp, UPDATE_FUNC_ARGS);
|
||||||
|
void STKM_init_legs(float* playerp, int i);
|
||||||
|
void STKM_interact(float* playerp, int i, int x, int y);
|
||||||
|
|
||||||
|
|
||||||
struct particle
|
struct particle
|
||||||
|
@ -49,6 +49,10 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
|
|||||||
}
|
}
|
||||||
else if (portalp[parts[i].tmp][randomness-1][nnx].type)
|
else if (portalp[parts[i].tmp][randomness-1][nnx].type)
|
||||||
{
|
{
|
||||||
|
if (portalp[parts[i].tmp][randomness-1][nnx].type==PT_STKM)
|
||||||
|
player[27] = 0;
|
||||||
|
if (portalp[parts[i].tmp][randomness-1][nnx].type==PT_STKM2)
|
||||||
|
player2[27] = 0;
|
||||||
np = create_part(-1,x+rx,y+ry,portalp[parts[i].tmp][randomness-1][nnx].type);
|
np = create_part(-1,x+rx,y+ry,portalp[parts[i].tmp][randomness-1][nnx].type);
|
||||||
if (np<0) continue;
|
if (np<0) continue;
|
||||||
parts[np] = portalp[parts[i].tmp][randomness-1][nnx];
|
parts[np] = portalp[parts[i].tmp][randomness-1][nnx];
|
||||||
|
@ -215,6 +215,10 @@ int run_stickman(float* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
}
|
}
|
||||||
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
|
if (bmap[(ry+y)/CELL][(rx+x)/CELL]==WL_FAN)
|
||||||
playerp[2] = SPC_AIR;
|
playerp[2] = SPC_AIR;
|
||||||
|
if ((r&0xFF)==PT_PRTI)
|
||||||
|
STKM_interact(playerp, i, rx, ry);
|
||||||
|
if (!parts[i].type)//STKM_interact may kill STKM
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Head position
|
//Head position
|
||||||
@ -352,48 +356,82 @@ int run_stickman(float* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//If legs touch something
|
//If legs touch something
|
||||||
r = pmap[(int)(playerp[8]+0.5)][(int)(playerp[7]+0.5)];
|
STKM_interact(playerp, i, (int)(playerp[7]+0.5), (int)(playerp[8]+0.5));
|
||||||
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
STKM_interact(playerp, i, (int)(playerp[15]+0.5), (int)(playerp[16]+0.5));
|
||||||
{
|
if (!parts[i].type)
|
||||||
parts[i].life -= (int)(rand()/1000)+38;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
playerp[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)(playerp[16]+0.5)][(int)(playerp[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;
|
|
||||||
playerp[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;
|
|
||||||
|
|
||||||
parts[i].ctype = playerp[2];
|
parts[i].ctype = playerp[2];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void STKM_interact(float* playerp, int i, int x, int y)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
if (x<0 || y<0 || x>=XRES || y>=YRES || !parts[i].type)
|
||||||
|
return;
|
||||||
|
r = pmap[y][x];
|
||||||
|
if (r && (r>>8)<NPART)
|
||||||
|
{
|
||||||
|
if ((r&0xFF)==PT_SPRK && r && (r>>8)<NPART) //If on charge
|
||||||
|
{
|
||||||
|
parts[i].life -= (int)(rand()*20/RAND_MAX)+32;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ptypes[r&0xFF].hconduct && (parts[r>>8].temp>=323 || parts[r>>8].temp<=243))
|
||||||
|
{
|
||||||
|
parts[i].life -= 2;
|
||||||
|
playerp[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;
|
||||||
|
|
||||||
|
if ((r&0xFF)==PT_PRTI && parts[i].type)
|
||||||
|
{
|
||||||
|
int nnx, count;
|
||||||
|
parts[r>>8].tmp = (int)((parts[r>>8].temp-73.15f)/100+1);
|
||||||
|
if (parts[r>>8].tmp>=CHANNELS) parts[r>>8].tmp = CHANNELS-1;
|
||||||
|
else if (parts[r>>8].tmp<0) parts[r>>8].tmp = 0;
|
||||||
|
for (count=1; count<=8; count++)
|
||||||
|
for (nnx=0; nnx<80; nnx++)
|
||||||
|
if (!portalp[parts[r>>8].tmp][count-1][nnx].type)
|
||||||
|
{
|
||||||
|
portalp[parts[r>>8].tmp][count-1][nnx] = parts[i];
|
||||||
|
kill_part(i);
|
||||||
|
playerp[27] = 1;//stop SPWN creating a new STKM while he is in portal
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void STKM_init_legs(float* playerp, int i)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
x = (int)(parts[i].x+0.5f);
|
||||||
|
y = (int)(parts[i].y+0.5f);
|
||||||
|
|
||||||
|
player[3] = x-1;
|
||||||
|
player[4] = y+6;
|
||||||
|
player[5] = x-1;
|
||||||
|
player[6] = y+6;
|
||||||
|
|
||||||
|
player[7] = x-3;
|
||||||
|
player[8] = y+12;
|
||||||
|
player[9] = x-3;
|
||||||
|
player[10] = y+12;
|
||||||
|
|
||||||
|
player[11] = x+1;
|
||||||
|
player[12] = y+6;
|
||||||
|
player[13] = x+1;
|
||||||
|
player[14] = y+6;
|
||||||
|
|
||||||
|
player[15] = x+3;
|
||||||
|
player[16] = y+12;
|
||||||
|
player[17] = x+3;
|
||||||
|
player[18] = y+12;
|
||||||
|
}
|
||||||
|
45
src/main.c
45
src/main.c
@ -980,54 +980,13 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char
|
|||||||
else if (parts[i-1].type == PT_STKM)
|
else if (parts[i-1].type == PT_STKM)
|
||||||
{
|
{
|
||||||
//player[2] = PT_DUST;
|
//player[2] = PT_DUST;
|
||||||
|
STKM_init_legs(player, i-1);
|
||||||
player[3] = parts[i-1].x-1; //Setti-1ng legs posi-1ti-1ons
|
|
||||||
player[4] = parts[i-1].y+6;
|
|
||||||
player[5] = parts[i-1].x-1;
|
|
||||||
player[6] = parts[i-1].y+6;
|
|
||||||
|
|
||||||
player[7] = parts[i-1].x-3;
|
|
||||||
player[8] = parts[i-1].y+12;
|
|
||||||
player[9] = parts[i-1].x-3;
|
|
||||||
player[10] = parts[i-1].y+12;
|
|
||||||
|
|
||||||
player[11] = parts[i-1].x+1;
|
|
||||||
player[12] = parts[i-1].y+6;
|
|
||||||
player[13] = parts[i-1].x+1;
|
|
||||||
player[14] = parts[i-1].y+6;
|
|
||||||
|
|
||||||
player[15] = parts[i-1].x+3;
|
|
||||||
player[16] = parts[i-1].y+12;
|
|
||||||
player[17] = parts[i-1].x+3;
|
|
||||||
player[18] = parts[i-1].y+12;
|
|
||||||
|
|
||||||
player[27] = 1;
|
player[27] = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (parts[i-1].type == PT_STKM2)
|
else if (parts[i-1].type == PT_STKM2)
|
||||||
{
|
{
|
||||||
//player2[2] = PT_DUST;
|
//player2[2] = PT_DUST;
|
||||||
|
STKM_init_legs(player2, i-1);
|
||||||
player2[3] = parts[i-1].x-1; //Setti-1ng legs posi-1ti-1ons
|
|
||||||
player2[4] = parts[i-1].y+6;
|
|
||||||
player2[5] = parts[i-1].x-1;
|
|
||||||
player2[6] = parts[i-1].y+6;
|
|
||||||
|
|
||||||
player2[7] = parts[i-1].x-3;
|
|
||||||
player2[8] = parts[i-1].y+12;
|
|
||||||
player2[9] = parts[i-1].x-3;
|
|
||||||
player2[10] = parts[i-1].y+12;
|
|
||||||
|
|
||||||
player2[11] = parts[i-1].x+1;
|
|
||||||
player2[12] = parts[i-1].y+6;
|
|
||||||
player2[13] = parts[i-1].x+1;
|
|
||||||
player2[14] = parts[i-1].y+6;
|
|
||||||
|
|
||||||
player2[15] = parts[i-1].x+3;
|
|
||||||
player2[16] = parts[i-1].y+12;
|
|
||||||
player2[17] = parts[i-1].x+3;
|
|
||||||
player2[18] = parts[i-1].y+12;
|
|
||||||
|
|
||||||
player2[27] = 1;
|
player2[27] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
44
src/powder.c
44
src/powder.c
@ -930,27 +930,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
parts[i].life = 100;
|
parts[i].life = 100;
|
||||||
parts[i].ctype = 0;
|
parts[i].ctype = 0;
|
||||||
parts[i].temp = ptypes[t].heat;
|
parts[i].temp = ptypes[t].heat;
|
||||||
|
STKM_init_legs(player, i);
|
||||||
player[3] = x-1; //Setting legs positions
|
|
||||||
player[4] = y+6;
|
|
||||||
player[5] = x-1;
|
|
||||||
player[6] = y+6;
|
|
||||||
|
|
||||||
player[7] = x-3;
|
|
||||||
player[8] = y+12;
|
|
||||||
player[9] = x-3;
|
|
||||||
player[10] = y+12;
|
|
||||||
|
|
||||||
player[11] = x+1;
|
|
||||||
player[12] = y+6;
|
|
||||||
player[13] = x+1;
|
|
||||||
player[14] = y+6;
|
|
||||||
|
|
||||||
player[15] = x+3;
|
|
||||||
player[16] = y+12;
|
|
||||||
player[17] = x+3;
|
|
||||||
player[18] = y+12;
|
|
||||||
|
|
||||||
player[27] = 1;
|
player[27] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -972,27 +952,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
parts[i].life = 100;
|
parts[i].life = 100;
|
||||||
parts[i].ctype = 0;
|
parts[i].ctype = 0;
|
||||||
parts[i].temp = ptypes[t].heat;
|
parts[i].temp = ptypes[t].heat;
|
||||||
|
STKM_init_legs(player2, i);
|
||||||
player2[3] = x-1; //Setting legs positions
|
|
||||||
player2[4] = y+6;
|
|
||||||
player2[5] = x-1;
|
|
||||||
player2[6] = y+6;
|
|
||||||
|
|
||||||
player2[7] = x-3;
|
|
||||||
player2[8] = y+12;
|
|
||||||
player2[9] = x-3;
|
|
||||||
player2[10] = y+12;
|
|
||||||
|
|
||||||
player2[11] = x+1;
|
|
||||||
player2[12] = y+6;
|
|
||||||
player2[13] = x+1;
|
|
||||||
player2[14] = y+6;
|
|
||||||
|
|
||||||
player2[15] = x+3;
|
|
||||||
player2[16] = y+12;
|
|
||||||
player2[17] = x+3;
|
|
||||||
player2[18] = y+12;
|
|
||||||
|
|
||||||
player2[27] = 1;
|
player2[27] = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user