From 5031291bf6ec26f2d60ab2fd7071e64cc5827304 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 25 Jul 2012 17:16:56 +0100 Subject: [PATCH] TPT: Save an extra tmp2 byte, for EXOT fed8b7b2ccc --- src/client/GameSave.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 7e3fbe72d..39b2e34c4 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -712,6 +712,11 @@ void GameSave::readOPS(char * data, int dataLength) { if(i >= partsDataLen) goto fail; particles[newIndex].tmp2 = partsData[i++]; + if(fieldDescriptor & 0x800) + { + if(i >= partsDataLen) goto fail; + particles[newIndex].tmp2 |= (((unsigned)partsData[i++]) << 8); + } } //Particle specific parsing: @@ -1538,7 +1543,7 @@ char * GameSave::serialiseOPS(int & dataLength) //Copy parts data /* Field descriptor format: | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | - | tmp2 | ctype[2] | vy | vx | dcololour | ctype[1] | tmp[2] | tmp[1] | life[2] | life[1] | temp dbl len| + | tmp2[2] | tmp2 | ctype[2] | vy | vx | dcololour | ctype[1] | tmp[2] | tmp[1] | life[2] | life[1] | temp dbl len| life[2] means a second byte (for a 16 bit field) if life[1] is present */ partsData = (unsigned char *)malloc(NPART * (sizeof(Particle)+1)); @@ -1655,11 +1660,16 @@ char * GameSave::serialiseOPS(int & dataLength) partsData[partsDataLen++] = vTemp; } - //Tmp2 (optional), 1 byte + //Tmp2 (optional), 1 or 2 bytes if(particles[i].tmp2) { fieldDesc |= 1 << 10; partsData[partsDataLen++] = particles[i].tmp2; + if(partsptr[i].tmp2 > 255) + { + fieldDesc |= 1 << 11; + partsData[partsDataLen++] = partsptr[i].tmp2 >> 8; + } } //Write the field descriptor;