Moved detach(i) function to powder.c, made soap display connections when
it's double-joined, made portal in detach soap before teleportating (works strangely)
This commit is contained in:
parent
98115038c7
commit
a48e477fca
@ -33,6 +33,10 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
|
|||||||
if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (ptypes[r&0xFF].falldown== 0 && ptypes[r&0xFF].state != ST_GAS && (r&0xFF)!=PT_SPRK))
|
if (!r || (r&0xFF)==PT_PRTI || (r&0xFF)==PT_PRTO || (ptypes[r&0xFF].falldown== 0 && ptypes[r&0xFF].state != ST_GAS && (r&0xFF)!=PT_SPRK))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((r&0xFF) == PT_SOAP)
|
||||||
|
detach(r>>8);
|
||||||
|
|
||||||
for ( nnx=0; nnx<80; nnx++)
|
for ( nnx=0; nnx<80; nnx++)
|
||||||
if (!portalp[parts[i].tmp][count-1][nnx].type)
|
if (!portalp[parts[i].tmp][count-1][nnx].type)
|
||||||
{
|
{
|
||||||
|
@ -1,22 +1,5 @@
|
|||||||
#include <element.h>
|
#include <element.h>
|
||||||
|
|
||||||
void detach(int i)
|
|
||||||
{
|
|
||||||
if ((parts[i].ctype&2) == 2)
|
|
||||||
{
|
|
||||||
if ((parts[parts[i].tmp].ctype&4) == 4)
|
|
||||||
parts[parts[i].tmp].ctype ^= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((parts[i].ctype&4) == 4)
|
|
||||||
{
|
|
||||||
if ((parts[parts[i].tmp2].ctype&2) == 2)
|
|
||||||
parts[parts[i].tmp2].ctype ^= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
parts[i].ctype = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int update_SOAP(UPDATE_FUNC_ARGS)
|
int update_SOAP(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
|
@ -1583,7 +1583,7 @@ void draw_parts(pixel *vid)
|
|||||||
|
|
||||||
if (t==PT_SOAP)
|
if (t==PT_SOAP)
|
||||||
{
|
{
|
||||||
if (((parts[i].ctype&1) == 1) && ((parts[i].ctype&2) == 2))
|
if ((parts[i].ctype&7) == 7)
|
||||||
draw_line(vid, nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), 245, 245, 220, XRES+BARSIZE);
|
draw_line(vid, nx, ny, (int)(parts[parts[i].tmp].x+0.5f), (int)(parts[parts[i].tmp].y+0.5f), 245, 245, 220, XRES+BARSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
24
src/powder.c
24
src/powder.c
@ -548,6 +548,24 @@ int get_normal_interp(int pt, float x0, float y0, float dx, float dy, float *nx,
|
|||||||
return get_normal(pt, x, y, dx, dy, nx, ny);
|
return get_normal(pt, x, y, dx, dy, nx, ny);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//For soap only
|
||||||
|
void detach(int i)
|
||||||
|
{
|
||||||
|
if ((parts[i].ctype&2) == 2)
|
||||||
|
{
|
||||||
|
if ((parts[parts[i].tmp].ctype&4) == 4)
|
||||||
|
parts[parts[i].tmp].ctype ^= 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((parts[i].ctype&4) == 4)
|
||||||
|
{
|
||||||
|
if ((parts[parts[i].tmp2].ctype&2) == 2)
|
||||||
|
parts[parts[i].tmp2].ctype ^= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
parts[i].ctype = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void kill_part(int i)//kills particle number i
|
void kill_part(int i)//kills particle number i
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -574,11 +592,7 @@ void kill_part(int i)//kills particle number i
|
|||||||
}
|
}
|
||||||
if (parts[i].type == PT_SOAP)
|
if (parts[i].type == PT_SOAP)
|
||||||
{
|
{
|
||||||
if ((parts[i].ctype&2) == 2)
|
detach(i);
|
||||||
parts[parts[i].tmp].ctype ^= 4;
|
|
||||||
|
|
||||||
if ((parts[i].ctype&4) == 4)
|
|
||||||
parts[parts[i].tmp2].ctype ^= 2;
|
|
||||||
}
|
}
|
||||||
if (x>=0 && y>=0 && x<XRES && y<YRES) {
|
if (x>=0 && y>=0 && x<XRES && y<YRES) {
|
||||||
if ((pmap[y][x]>>8)==i)
|
if ((pmap[y][x]>>8)==i)
|
||||||
|
Loading…
Reference in New Issue
Block a user