summaryrefslogtreecommitdiff
path: root/src/simulation
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-18 16:31:31 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-18 16:31:31 (GMT)
commit63da7a4afec50035c6aa37a29a8d60d38cab969f (patch)
tree171d714a358bad08994a11ce533f1f543c03b7c6 /src/simulation
parentce3bb6f75545818fdaedfe76f83e8d73e6c949ff (diff)
downloadpowder-63da7a4afec50035c6aa37a29a8d60d38cab969f.zip
powder-63da7a4afec50035c6aa37a29a8d60d38cab969f.tar.gz
Initialise stickman legs correctly
Diffstat (limited to 'src/simulation')
-rw-r--r--src/simulation/Simulation.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp
index 1190ad1..db0103c 100644
--- a/src/simulation/Simulation.cpp
+++ b/src/simulation/Simulation.cpp
@@ -50,35 +50,7 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
y = int(tempPart.y + 0.5f);
if ((player.spwn == 1 && tempPart.type==PT_STKM) || (player2.spwn == 1 && tempPart.type==PT_STKM2))
- {
continue;
- }
- else if (tempPart.type == PT_STKM)
- {
- //STKM_init_legs(&player, newIndex);
- player.spwn = 1;
- player.elem = PT_DUST;
- }
- else if (tempPart.type == PT_STKM2)
- {
- //STKM_init_legs(&player2, newIndex);
- player2.spwn = 1;
- player2.elem = PT_DUST;
- }
- else if (tempPart.type == PT_FIGH)
- {
- //TODO: 100 should be replaced with a macro
- unsigned char fcount = 0;
- while (fcount < 100 && fcount < (fighcount+1) && fighters[fcount].spwn==1) fcount++;
- if (fcount < 100 && fighters[fcount].spwn==0)
- {
- tempPart.tmp = fcount;
- fighters[fcount].spwn = 1;
- fighters[fcount].elem = PT_DUST;
- fighcount++;
- //STKM_init_legs(&(sim->fighters[sim->fcount]), newIndex);
- }
- }
if (!elements[tempPart.type].Enabled)
continue;
@@ -86,6 +58,7 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
{
//Replace existing
parts[r>>8] = tempPart;
+ i = r>>8;
pmap[y][x] = 0;
elementCount[parts[r>>8].type]--;
elementCount[tempPart.type]++;
@@ -102,6 +75,33 @@ int Simulation::Load(int fullX, int fullY, GameSave * save)
elementCount[tempPart.type]++;
}
+
+ if (tempPart.type == PT_STKM)
+ {
+ Element_STKM::STKM_init_legs(this, &player, i);
+ player.spwn = 1;
+ player.elem = PT_DUST;
+ }
+ else if (tempPart.type == PT_STKM2)
+ {
+ Element_STKM::STKM_init_legs(this, &player2, i);
+ player2.spwn = 1;
+ player2.elem = PT_DUST;
+ }
+ else if (tempPart.type == PT_FIGH)
+ {
+ //TODO: 100 should be replaced with a macro
+ unsigned char fcount = 0;
+ while (fcount < 100 && fcount < (fighcount+1) && fighters[fcount].spwn==1) fcount++;
+ if (fcount < 100 && fighters[fcount].spwn==0)
+ {
+ tempPart.tmp = fcount;
+ fighters[fcount].spwn = 1;
+ fighters[fcount].elem = PT_DUST;
+ fighcount++;
+ Element_STKM::STKM_init_legs(this, &(fighters[fcount]), i);
+ }
+ }
}
parts_lastActiveIndex = NPART-1;
force_stacking_check = 1;