Fix STKM causing stacking and falling through some powders
This commit is contained in:
parent
06d2d5267e
commit
c14704ae49
@ -48,6 +48,7 @@ int graphics_STKM(GRAPHICS_FUNC_ARGS)
|
|||||||
|
|
||||||
int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
|
int t = parts[i].type;
|
||||||
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
|
||||||
float gvx, gvy;
|
float gvx, gvy;
|
||||||
@ -57,7 +58,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
playerp->elem = parts[i].ctype;
|
playerp->elem = parts[i].ctype;
|
||||||
playerp->frames++;
|
playerp->frames++;
|
||||||
|
|
||||||
//Tempirature handling
|
//Temperature handling
|
||||||
if (parts[i].temp<243)
|
if (parts[i].temp<243)
|
||||||
parts[i].life -= 1;
|
parts[i].life -= 1;
|
||||||
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
|
if ((parts[i].temp<309.6f) && (parts[i].temp>=243))
|
||||||
@ -132,7 +133,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
playerp->legs[15] = playerp->legs[13];
|
playerp->legs[15] = playerp->legs[13];
|
||||||
playerp->legs[13] = pp;
|
playerp->legs[13] = pp;
|
||||||
|
|
||||||
//Setting accseleration to 0
|
//Setting acceleration to 0
|
||||||
playerp->accs[0] = 0;
|
playerp->accs[0] = 0;
|
||||||
playerp->accs[1] = 0;
|
playerp->accs[1] = 0;
|
||||||
|
|
||||||
@ -155,7 +156,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
{
|
{
|
||||||
if (dl>dr)
|
if (dl>dr)
|
||||||
{
|
{
|
||||||
if (!eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
if (!eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||||
{
|
{
|
||||||
playerp->accs[2] = -3*gvy-3*gvx;
|
playerp->accs[2] = -3*gvy-3*gvx;
|
||||||
playerp->accs[3] = 3*gvx-3*gvy;
|
playerp->accs[3] = 3*gvx-3*gvy;
|
||||||
@ -165,7 +166,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
if (!eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||||
{
|
{
|
||||||
playerp->accs[6] = -3*gvy-3*gvx;
|
playerp->accs[6] = -3*gvy-3*gvx;
|
||||||
playerp->accs[7] = 3*gvx-3*gvy;
|
playerp->accs[7] = 3*gvx-3*gvy;
|
||||||
@ -180,7 +181,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
{
|
{
|
||||||
if (dl<dr)
|
if (dl<dr)
|
||||||
{
|
{
|
||||||
if (!eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
if (!eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||||
{
|
{
|
||||||
playerp->accs[2] = 3*gvy-3*gvx;
|
playerp->accs[2] = 3*gvy-3*gvx;
|
||||||
playerp->accs[3] = -3*gvx-3*gvy;
|
playerp->accs[3] = -3*gvx-3*gvy;
|
||||||
@ -190,7 +191,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
if (!eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||||
{
|
{
|
||||||
playerp->accs[6] = 3*gvy-3*gvx;
|
playerp->accs[6] = 3*gvy-3*gvx;
|
||||||
playerp->accs[7] = -3*gvx-3*gvy;
|
playerp->accs[7] = -3*gvx-3*gvy;
|
||||||
@ -202,7 +203,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
|
|
||||||
//Jump
|
//Jump
|
||||||
if (((int)(playerp->comm)&0x04) == 0x04 &&
|
if (((int)(playerp->comm)&0x04) == 0x04 &&
|
||||||
(!eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL) || !eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL)))
|
(!eval_move(t, playerp->legs[4], playerp->legs[5], NULL) || !eval_move(t, playerp->legs[12], playerp->legs[13], NULL)))
|
||||||
{
|
{
|
||||||
parts[i].vy -= 4*gvy;
|
parts[i].vy -= 4*gvy;
|
||||||
playerp->accs[3] -= gvy;
|
playerp->accs[3] -= gvy;
|
||||||
@ -353,27 +354,27 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
|||||||
playerp->legs[8] += (playerp->legs[8]-parts[i].x)*d;
|
playerp->legs[8] += (playerp->legs[8]-parts[i].x)*d;
|
||||||
playerp->legs[9] += (playerp->legs[9]-parts[i].y)*d;
|
playerp->legs[9] += (playerp->legs[9]-parts[i].y)*d;
|
||||||
|
|
||||||
if (INBOND(playerp->legs[4], playerp->legs[5]) && !eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
if (INBOND(playerp->legs[4], playerp->legs[5]) && !eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||||
{
|
{
|
||||||
playerp->legs[4] = playerp->legs[6];
|
playerp->legs[4] = playerp->legs[6];
|
||||||
playerp->legs[5] = playerp->legs[7];
|
playerp->legs[5] = playerp->legs[7];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (INBOND(playerp->legs[12], playerp->legs[13]) && !eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
if (INBOND(playerp->legs[12], playerp->legs[13]) && !eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||||
{
|
{
|
||||||
playerp->legs[12] = playerp->legs[14];
|
playerp->legs[12] = playerp->legs[14];
|
||||||
playerp->legs[13] = playerp->legs[15];
|
playerp->legs[13] = playerp->legs[15];
|
||||||
}
|
}
|
||||||
|
|
||||||
//This makes stick man "pop" from obstacles
|
//This makes stick man "pop" from obstacles
|
||||||
if (INBOND(playerp->legs[4], playerp->legs[5]) && !eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
if (INBOND(playerp->legs[4], playerp->legs[5]) && !eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||||
{
|
{
|
||||||
float t;
|
float t;
|
||||||
t = playerp->legs[4]; playerp->legs[4] = playerp->legs[6]; playerp->legs[6] = t;
|
t = playerp->legs[4]; playerp->legs[4] = playerp->legs[6]; playerp->legs[6] = t;
|
||||||
t = playerp->legs[5]; playerp->legs[5] = playerp->legs[7]; playerp->legs[7] = t;
|
t = playerp->legs[5]; playerp->legs[5] = playerp->legs[7]; playerp->legs[7] = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (INBOND(playerp->legs[12], playerp->legs[13]) && !eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
if (INBOND(playerp->legs[12], playerp->legs[13]) && !eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||||
{
|
{
|
||||||
float t;
|
float t;
|
||||||
t = playerp->legs[12]; playerp->legs[12] = playerp->legs[14]; playerp->legs[14] = t;
|
t = playerp->legs[12]; playerp->legs[12] = playerp->legs[14]; playerp->legs[14] = t;
|
||||||
|
25
src/powder.c
25
src/powder.c
@ -95,7 +95,7 @@ void init_can_move()
|
|||||||
// 1 = Swap
|
// 1 = Swap
|
||||||
// 2 = Both particles occupy the same space.
|
// 2 = Both particles occupy the same space.
|
||||||
// 3 = Varies, go run some extra checks
|
// 3 = Varies, go run some extra checks
|
||||||
int t, rt;
|
int t, rt, stkm_move;
|
||||||
for (rt=0;rt<PT_NUM;rt++)
|
for (rt=0;rt<PT_NUM;rt++)
|
||||||
can_move[0][rt] = 0; // particles that don't exist shouldn't move...
|
can_move[0][rt] = 0; // particles that don't exist shouldn't move...
|
||||||
for (t=1;t<PT_NUM;t++)
|
for (t=1;t<PT_NUM;t++)
|
||||||
@ -134,10 +134,14 @@ void init_can_move()
|
|||||||
{
|
{
|
||||||
//spark shouldn't move
|
//spark shouldn't move
|
||||||
can_move[PT_SPRK][t] = 0;
|
can_move[PT_SPRK][t] = 0;
|
||||||
//all stickman collisions are done in stickman update function
|
stkm_move = 0;
|
||||||
can_move[PT_STKM][t] = 2;
|
if (ptypes[t].properties&TYPE_LIQUID)
|
||||||
can_move[PT_STKM2][t] = 2;
|
stkm_move = 2;
|
||||||
can_move[PT_FIGH][t] = 2;
|
if (!t || t==PT_PRTO || t==PT_SPAWN || t==PT_SPAWN2)
|
||||||
|
stkm_move = 2;
|
||||||
|
can_move[PT_STKM][t] = stkm_move;
|
||||||
|
can_move[PT_STKM2][t] = stkm_move;
|
||||||
|
can_move[PT_FIGH][t] = stkm_move;
|
||||||
}
|
}
|
||||||
for (t=0;t<PT_NUM;t++)
|
for (t=0;t<PT_NUM;t++)
|
||||||
{
|
{
|
||||||
@ -145,10 +149,9 @@ void init_can_move()
|
|||||||
can_move[t][PT_VOID] = 1;
|
can_move[t][PT_VOID] = 1;
|
||||||
can_move[t][PT_BHOL] = 1;
|
can_move[t][PT_BHOL] = 1;
|
||||||
can_move[t][PT_NBHL] = 1;
|
can_move[t][PT_NBHL] = 1;
|
||||||
//all stickman collisions are done in stickman update function
|
can_move[t][PT_STKM] = 0;
|
||||||
can_move[t][PT_STKM] = 2;
|
can_move[t][PT_STKM2] = 0;
|
||||||
can_move[t][PT_STKM2] = 2;
|
can_move[t][PT_FIGH] = 0;
|
||||||
can_move[PT_FIGH][t] = 2;
|
|
||||||
//INVIS behaviour varies with pressure
|
//INVIS behaviour varies with pressure
|
||||||
can_move[t][PT_INVIS] = 3;
|
can_move[t][PT_INVIS] = 3;
|
||||||
//stop CNCT being displaced by other particles
|
//stop CNCT being displaced by other particles
|
||||||
@ -1052,7 +1055,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
create_part(-1,x,y,PT_SPAWN);
|
create_part(-3,x,y,PT_SPAWN);
|
||||||
ISSPAWN1 = 1;
|
ISSPAWN1 = 1;
|
||||||
break;
|
break;
|
||||||
case PT_STKM2:
|
case PT_STKM2:
|
||||||
@ -1077,7 +1080,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
create_part(-1,x,y,PT_SPAWN2);
|
create_part(-3,x,y,PT_SPAWN2);
|
||||||
ISSPAWN2 = 1;
|
ISSPAWN2 = 1;
|
||||||
break;
|
break;
|
||||||
case PT_BIZR: case PT_BIZRG: case PT_BIZRS:
|
case PT_BIZR: case PT_BIZRG: case PT_BIZRS:
|
||||||
|
Loading…
Reference in New Issue
Block a user