Fix STKM causing stacking and falling through some powders

This commit is contained in:
jacksonmj 2012-06-17 23:54:47 +01:00
parent 06d2d5267e
commit c14704ae49
2 changed files with 26 additions and 22 deletions

View File

@ -48,6 +48,7 @@ int graphics_STKM(GRAPHICS_FUNC_ARGS)
int 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;
@ -57,7 +58,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
playerp->elem = parts[i].ctype;
playerp->frames++;
//Tempirature handling
//Temperature handling
if (parts[i].temp<243)
parts[i].life -= 1;
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[13] = pp;
//Setting accseleration to 0
//Setting acceleration to 0
playerp->accs[0] = 0;
playerp->accs[1] = 0;
@ -155,7 +156,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
{
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[3] = 3*gvx-3*gvy;
@ -165,7 +166,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
}
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[7] = 3*gvx-3*gvy;
@ -180,7 +181,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
{
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[3] = -3*gvx-3*gvy;
@ -190,7 +191,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
}
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[7] = -3*gvx-3*gvy;
@ -202,7 +203,7 @@ int run_stickman(playerst* playerp, UPDATE_FUNC_ARGS) {
//Jump
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;
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[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[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[13] = playerp->legs[15];
}
//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;
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]) && !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;
t = playerp->legs[12]; playerp->legs[12] = playerp->legs[14]; playerp->legs[14] = t;

View File

@ -95,7 +95,7 @@ void 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++)
@ -134,10 +134,14 @@ void 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 (ptypes[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++)
{
@ -145,10 +149,9 @@ void 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
@ -1052,7 +1055,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
{
return -1;
}
create_part(-1,x,y,PT_SPAWN);
create_part(-3,x,y,PT_SPAWN);
ISSPAWN1 = 1;
break;
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;
}
create_part(-1,x,y,PT_SPAWN2);
create_part(-3,x,y,PT_SPAWN2);
ISSPAWN2 = 1;
break;
case PT_BIZR: case PT_BIZRG: case PT_BIZRS: