TPT: Fix fighters not going through portals correctly f41af45620

This commit is contained in:
Simon Robertshaw 2012-04-18 16:12:16 +01:00
parent fa193eb7b4
commit 2ca07515c1
3 changed files with 31 additions and 2 deletions

View File

@ -29,6 +29,9 @@ int update_PRTI(UPDATE_FUNC_ARGS) {
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)
sim->detach(r>>8);

View File

@ -47,8 +47,31 @@ int update_PRTO(UPDATE_FUNC_ARGS) {
sim->player.spwn = 0;
if (sim->portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2)
sim->player2.spwn = 0;
if (sim->portalp[parts[i].tmp][randomness][nnx].type==PT_FIGH)
{
sim->fighcount--;
sim->fighters[(unsigned char)sim->portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 0;
}
np = sim->create_part(-1, x+rx, y+ry, sim->portalp[parts[i].tmp][randomness][nnx].type);
if (np<0) continue;
if (np<0)
{
if (sim->portalp[parts[i].tmp][randomness][nnx].type==PT_STKM)
sim->player.spwn = 1;
if (sim->portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2)
sim->player2.spwn = 1;
if (sim->portalp[parts[i].tmp][randomness][nnx].type==PT_FIGH)
{
sim->fighcount++;
sim->fighters[(unsigned char)sim->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
sim->fighters[(unsigned char)parts[np].tmp].spwn = 0;
sim->fighters[(unsigned char)sim->portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 1;
}
parts[np] = sim->portalp[parts[i].tmp][randomness][nnx];
parts[np].x = x+rx;
parts[np].y = y+ry;

View File

@ -453,7 +453,10 @@ void STKM_interact(Simulation * sim, playerst* playerp, int i, int x, int y)
{
sim->portalp[sim->parts[r>>8].tmp][count][nnx] = sim->parts[i];
sim->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 (sim->portalp[sim->parts[r>>8].tmp][count][nnx].type==PT_FIGH)
sim->fighcount++;
break;
}
}