Fix fighters not going through portals correctly

This commit is contained in:
jacksonmj 2012-03-13 18:26:56 +00:00
parent e83a1a21ae
commit f41af45620
3 changed files with 31 additions and 2 deletions

View File

@ -31,6 +31,9 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
continue; continue;
} }
if ((r&0xFF)==PT_STKM || (r&0xFF)==PT_STKM2 || (r&0xFF)==PT_FIGH)
continue;// Handling these is a bit more complicated, and is done in STKM_interact()
if ((r&0xFF) == PT_SOAP) if ((r&0xFF) == PT_SOAP)
detach(r>>8); detach(r>>8);

View File

@ -47,8 +47,31 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
player.spwn = 0; player.spwn = 0;
if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2) if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2)
player2.spwn = 0; player2.spwn = 0;
if (portalp[parts[i].tmp][randomness][nnx].type==PT_FIGH)
{
fighcount--;
fighters[(unsigned char)portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 0;
}
np = create_part(-1,x+rx,y+ry,portalp[parts[i].tmp][randomness][nnx].type); np = create_part(-1,x+rx,y+ry,portalp[parts[i].tmp][randomness][nnx].type);
if (np<0) continue; if (np<0)
{
if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM)
player.spwn = 1;
if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2)
player2.spwn = 1;
if (portalp[parts[i].tmp][randomness][nnx].type==PT_FIGH)
{
fighcount++;
fighters[(unsigned char)portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 1;
}
continue;
}
if (parts[np].type==PT_FIGH)
{
// Release the fighters[] element allocated by create_part, the one reserved when the fighter went into the portal will be used
fighters[(unsigned char)parts[np].tmp].spwn = 0;
fighters[(unsigned char)portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 1;
}
parts[np] = portalp[parts[i].tmp][randomness][nnx]; parts[np] = portalp[parts[i].tmp][randomness][nnx];
parts[np].x = x+rx; parts[np].x = x+rx;
parts[np].y = y+ry; parts[np].y = y+ry;

View File

@ -451,7 +451,10 @@ void STKM_interact(playerst* playerp, int i, int x, int y)
{ {
portalp[parts[r>>8].tmp][count][nnx] = parts[i]; portalp[parts[r>>8].tmp][count][nnx] = parts[i];
kill_part(i); kill_part(i);
playerp->spwn = 1;//stop SPWN creating a new STKM while he is in portal //stop new STKM/fighters being created to replace the ones in the portal:
playerp->spwn = 1;
if (portalp[parts[r>>8].tmp][count][nnx].type==PT_FIGH)
fighcount++;
break; break;
} }
} }