From a270acfc54b3c4e555b7fd6c91093f96641cd52f Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Tue, 12 Jun 2012 16:30:27 +0100 Subject: [PATCH] =?UTF-8?q?OPS=20loading:=20don't=20replace=20existing=20p?= =?UTF-8?q?articles=20twice,=20and=20clear=20soap=20c=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/GameSave.cpp | 33 ------------------------------ src/simulation/Simulation.cpp | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index c500fc3d5..14a5837ee 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -625,39 +625,6 @@ void GameSave::readOPS(char * data, int dataLength) if(i >= partsDataLen) goto fail; particles[newIndex].tmp2 = partsData[i++]; } - - /*if ((sim->player.spwn == 1 && particles[newIndex].type==PT_STKM) || (sim->player2.spwn == 1 && particles[newIndex].type==PT_STKM2)) - { - particles[newIndex].type = PT_NONE; - } - else if (particles[newIndex].type == PT_STKM) - { - //STKM_init_legs(&player, newIndex); - sim->player.spwn = 1; - sim->player.elem = PT_DUST; - } - else if (particles[newIndex].type == PT_STKM2) - { - //STKM_init_legs(&player2, newIndex); - sim->player2.spwn = 1; - sim->player2.elem = PT_DUST; - } - else if (particles[newIndex].type == PT_FIGH) - { - //TODO: 100 should be replaced with a macro - unsigned char fcount = 0; - while (fcount < 100 && fcount < (sim->fighcount+1) && sim->fighters[fcount].spwn==1) fcount++; - if (fcount < 100 && sim->fighters[fcount].spwn==0) - { - particles[newIndex].tmp = fcount; - sim->fighters[fcount].spwn = 1; - sim->fighters[fcount].elem = PT_DUST; - sim->fighcount++; - //STKM_init_legs(&(sim->fighters[sim->fcount]), newIndex); - } - } - if (!sim->elements[particles[newIndex].type].Enabled) - particles[newIndex].type = PT_NONE;*/ newIndex++; } } diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 850f9783c..00fbe9627 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -37,10 +37,48 @@ int Simulation::Load(int fullX, int fullY, GameSave * save) x = int(tempPart.x + 0.5f); 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_SOAP) + { + tempPart.ctype = 0; + } + 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; + if(r = pmap[y][x]) { //Replace existing parts[r>>8] = tempPart; + pmap[y][x] = 0; } else {