diff --git a/src/elements/prti.c b/src/elements/prti.c index 57830abfd..8d8f68540 100644 --- a/src/elements/prti.c +++ b/src/elements/prti.c @@ -31,6 +31,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) detach(r>>8); diff --git a/src/elements/prto.c b/src/elements/prto.c index dcbc53cc0..1e7cde0ab 100644 --- a/src/elements/prto.c +++ b/src/elements/prto.c @@ -47,8 +47,31 @@ int update_PRTO(UPDATE_FUNC_ARGS) { player.spwn = 0; if (portalp[parts[i].tmp][randomness][nnx].type==PT_STKM2) 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); - 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].x = x+rx; parts[np].y = y+ry; diff --git a/src/elements/stkm.c b/src/elements/stkm.c index 08cb1baf2..d8286d58e 100644 --- a/src/elements/stkm.c +++ b/src/elements/stkm.c @@ -451,7 +451,10 @@ void STKM_interact(playerst* playerp, int i, int x, int y) { portalp[parts[r>>8].tmp][count][nnx] = parts[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; } }