summaryrefslogtreecommitdiff
path: root/src/elements
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-04-18 15:12:16 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-04-18 15:12:16 (GMT)
commit2ca07515c1367e31999d71c82982aa232e206acb (patch)
treea9f2ec342fc977630b455d4bad8a973ce8fdb15a /src/elements
parentfa193eb7b4a76900a80bf9348a4877bf8943656e (diff)
downloadpowder-2ca07515c1367e31999d71c82982aa232e206acb.zip
powder-2ca07515c1367e31999d71c82982aa232e206acb.tar.gz
TPT: Fix fighters not going through portals correctly f41af45620
Diffstat (limited to 'src/elements')
-rw-r--r--src/elements/prti.cpp3
-rw-r--r--src/elements/prto.cpp25
-rw-r--r--src/elements/stkm.cpp5
3 files changed, 31 insertions, 2 deletions
diff --git a/src/elements/prti.cpp b/src/elements/prti.cpp
index f5b2374..384fd7e 100644
--- a/src/elements/prti.cpp
+++ b/src/elements/prti.cpp
@@ -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);
diff --git a/src/elements/prto.cpp b/src/elements/prto.cpp
index 32e7251..bbef6be 100644
--- a/src/elements/prto.cpp
+++ b/src/elements/prto.cpp
@@ -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;
diff --git a/src/elements/stkm.cpp b/src/elements/stkm.cpp
index 68ef1ed..e7eecf4 100644
--- a/src/elements/stkm.cpp
+++ b/src/elements/stkm.cpp
@@ -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;
}
}