Remember ctype when cloning lava

This commit is contained in:
jacksonmj 2012-06-10 22:53:40 +01:00
parent 3c14787064
commit 7707943981
4 changed files with 41 additions and 11 deletions

View File

@ -38,18 +38,26 @@ int update_BCLN(UPDATE_FUNC_ARGS) {
continue;
if ((r&0xFF)!=PT_CLNE && (r&0xFF)!=PT_PCLN &&
(r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM &&
(r&0xFF)!=PT_STKM2 && (r&0xFF)!=PT_PBCN &&
(r&0xFF)!=PT_PBCN && (r&0xFF)!=PT_STKM2 &&
(r&0xFF)<PT_NUM)
{
parts[i].ctype = r&0xFF;
if ((r&0xFF)==PT_LIFE)
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
parts[i].tmp = parts[r>>8].ctype;
}
}
}
else {
if (parts[i].ctype==PT_LIFE) create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype|(parts[i].tmp<<8));
else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
else
{
int np = create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
if (np>=0)
{
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && ptransitions[parts[i].tmp].tht==PT_LAVA)
parts[np].ctype = parts[i].tmp;
}
}
}
return 0;
}

View File

@ -34,14 +34,22 @@ int update_CLNE(UPDATE_FUNC_ARGS) {
(r&0xFF)<PT_NUM)
{
parts[i].ctype = r&0xFF;
if ((r&0xFF)==PT_LIFE)
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
parts[i].tmp = parts[r>>8].ctype;
}
}
}
else {
if (parts[i].ctype==PT_LIFE) create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype|(parts[i].tmp<<8));
else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
else
{
int np = create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
if (np>=0)
{
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && ptransitions[parts[i].tmp].tht==PT_LAVA)
parts[np].ctype = parts[i].tmp;
}
}
}
return 0;
}

View File

@ -49,7 +49,7 @@ int update_PBCN(UPDATE_FUNC_ARGS) {
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
{
parts[i].ctype = r&0xFF;
if ((r&0xFF)==PT_LIFE)
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
parts[i].tmp = parts[r>>8].ctype;
}
}
@ -100,8 +100,15 @@ int update_PBCN(UPDATE_FUNC_ARGS) {
create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8));
}
}
} else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
else
{
int np = create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
if (np>=0)
{
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && ptransitions[parts[i].tmp].tht==PT_LAVA)
parts[np].ctype = parts[i].tmp;
}
}
}
return 0;

View File

@ -58,7 +58,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
(r&0xFF)!=PT_PBCN && (r&0xFF)<PT_NUM)
{
parts[i].ctype = r&0xFF;
if ((r&0xFF)==PT_LIFE)
if ((r&0xFF)==PT_LIFE || (r&0xFF)==PT_LAVA)
parts[i].tmp = parts[r>>8].ctype;
}
}
@ -90,8 +90,15 @@ int update_PCLN(UPDATE_FUNC_ARGS) {
create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8));
}
}
} else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
else
{
int np = create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
if (np>=0)
{
if (parts[i].ctype==PT_LAVA && parts[i].tmp>0 && parts[i].tmp<PT_NUM && ptransitions[parts[i].tmp].tht==PT_LAVA)
parts[np].ctype = parts[i].tmp;
}
}
}
return 0;