TPT: Fix STKM causing stacking and falling through some powders c14704ae49
This commit is contained in:
parent
2214ab4eb0
commit
08d1dd06ed
@ -1810,7 +1810,7 @@ void Simulation::init_can_move()
|
||||
// 1 = Swap
|
||||
// 2 = Both particles occupy the same space.
|
||||
// 3 = Varies, go run some extra checks
|
||||
int t, rt;
|
||||
int t, rt, stkm_move;
|
||||
for (rt=0;rt<PT_NUM;rt++)
|
||||
can_move[0][rt] = 0; // particles that don't exist shouldn't move...
|
||||
for (t=1;t<PT_NUM;t++)
|
||||
@ -1849,10 +1849,14 @@ void Simulation::init_can_move()
|
||||
{
|
||||
//spark shouldn't move
|
||||
can_move[PT_SPRK][t] = 0;
|
||||
//all stickman collisions are done in stickman update function
|
||||
can_move[PT_STKM][t] = 2;
|
||||
can_move[PT_STKM2][t] = 2;
|
||||
can_move[PT_FIGH][t] = 2;
|
||||
stkm_move = 0;
|
||||
if (elements[t].Properties&TYPE_LIQUID)
|
||||
stkm_move = 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++)
|
||||
{
|
||||
@ -1860,10 +1864,9 @@ void Simulation::init_can_move()
|
||||
can_move[t][PT_VOID] = 1;
|
||||
can_move[t][PT_BHOL] = 1;
|
||||
can_move[t][PT_NBHL] = 1;
|
||||
//all stickman collisions are done in stickman update function
|
||||
can_move[t][PT_STKM] = 2;
|
||||
can_move[t][PT_STKM2] = 2;
|
||||
can_move[PT_FIGH][t] = 2;
|
||||
can_move[t][PT_STKM] = 0;
|
||||
can_move[t][PT_STKM2] = 0;
|
||||
can_move[t][PT_FIGH] = 0;
|
||||
//INVIS behaviour varies with pressure
|
||||
can_move[t][PT_INVIS] = 3;
|
||||
//stop CNCT being displaced by other particles
|
||||
@ -2763,7 +2766,7 @@ int Simulation::create_part(int p, int x, int y, int tv)//the function for creat
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
create_part(-1,x,y,PT_SPAWN);
|
||||
create_part(-3,x,y,PT_SPAWN);
|
||||
elementCount[PT_SPAWN] = 1;
|
||||
break;
|
||||
case PT_STKM2:
|
||||
@ -2784,7 +2787,7 @@ int Simulation::create_part(int p, int x, int y, int tv)//the function for creat
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
create_part(-1,x,y,PT_SPAWN2);
|
||||
create_part(-3,x,y,PT_SPAWN2);
|
||||
elementCount[PT_SPAWN2] = 1;
|
||||
break;
|
||||
case PT_BIZR: case PT_BIZRG: case PT_BIZRS:
|
||||
|
@ -79,6 +79,7 @@ int Element_STKM::graphics(GRAPHICS_FUNC_ARGS)
|
||||
//#TPT-Directive ElementHeader Element_STKM static int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS)
|
||||
int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||
int r, rx, ry;
|
||||
int t = parts[i].type;
|
||||
float pp, d;
|
||||
float dt = 0.9;///(FPSB*FPSB); //Delta time in square
|
||||
float gvx, gvy;
|
||||
@ -187,7 +188,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||
{
|
||||
if (dl>dr)
|
||||
{
|
||||
if (!sim->eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
||||
if (!sim->eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||
{
|
||||
playerp->accs[2] = -3*gvy-3*gvx;
|
||||
playerp->accs[3] = 3*gvx-3*gvy;
|
||||
@ -197,7 +198,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sim->eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
||||
if (!sim->eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||
{
|
||||
playerp->accs[6] = -3*gvy-3*gvx;
|
||||
playerp->accs[7] = 3*gvx-3*gvy;
|
||||
@ -212,7 +213,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||
{
|
||||
if (dl<dr)
|
||||
{
|
||||
if (!sim->eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
||||
if (!sim->eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||
{
|
||||
playerp->accs[2] = 3*gvy-3*gvx;
|
||||
playerp->accs[3] = -3*gvx-3*gvy;
|
||||
@ -222,7 +223,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sim->eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
||||
if (!sim->eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||
{
|
||||
playerp->accs[6] = 3*gvy-3*gvx;
|
||||
playerp->accs[7] = -3*gvx-3*gvy;
|
||||
@ -234,7 +235,7 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||
|
||||
//Jump
|
||||
if (((int)(playerp->comm)&0x04) == 0x04 &&
|
||||
(!sim->eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL) || !sim->eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL)))
|
||||
(!sim->eval_move(t, playerp->legs[4], playerp->legs[5], NULL) || !sim->eval_move(t, playerp->legs[12], playerp->legs[13], NULL)))
|
||||
{
|
||||
parts[i].vy -= 4*gvy;
|
||||
playerp->accs[3] -= gvy;
|
||||
@ -385,27 +386,27 @@ int Element_STKM::run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
|
||||
playerp->legs[8] += (playerp->legs[8]-parts[i].x)*d;
|
||||
playerp->legs[9] += (playerp->legs[9]-parts[i].y)*d;
|
||||
|
||||
if (INBOND(playerp->legs[4], playerp->legs[5]) && !sim->eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
||||
if (INBOND(playerp->legs[4], playerp->legs[5]) && !sim->eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||
{
|
||||
playerp->legs[4] = playerp->legs[6];
|
||||
playerp->legs[5] = playerp->legs[7];
|
||||
}
|
||||
|
||||
if (INBOND(playerp->legs[12], playerp->legs[13]) && !sim->eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
||||
if (INBOND(playerp->legs[12], playerp->legs[13]) && !sim->eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||
{
|
||||
playerp->legs[12] = playerp->legs[14];
|
||||
playerp->legs[13] = playerp->legs[15];
|
||||
}
|
||||
|
||||
//This makes stick man "pop" from obstacles
|
||||
if (INBOND(playerp->legs[4], playerp->legs[5]) && !sim->eval_move(PT_DUST, playerp->legs[4], playerp->legs[5], NULL))
|
||||
if (INBOND(playerp->legs[4], playerp->legs[5]) && !sim->eval_move(t, playerp->legs[4], playerp->legs[5], NULL))
|
||||
{
|
||||
float 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;
|
||||
}
|
||||
|
||||
if (INBOND(playerp->legs[12], playerp->legs[13]) && !sim->eval_move(PT_DUST, playerp->legs[12], playerp->legs[13], NULL))
|
||||
if (INBOND(playerp->legs[12], playerp->legs[13]) && !sim->eval_move(t, playerp->legs[12], playerp->legs[13], NULL))
|
||||
{
|
||||
float t;
|
||||
t = playerp->legs[12]; playerp->legs[12] = playerp->legs[14]; playerp->legs[14] = t;
|
||||
|
Loading…
Reference in New Issue
Block a user