diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-25 16:16:56 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-25 16:16:56 (GMT) |
| commit | 5031291bf6ec26f2d60ab2fd7071e64cc5827304 (patch) | |
| tree | 3f048e24517d98bc9a83e1afc24678ac5254ecd9 /src/client/GameSave.cpp | |
| parent | 6585a4640b9d1d24d821fb2147fe6182a709f088 (diff) | |
| download | powder-5031291bf6ec26f2d60ab2fd7071e64cc5827304.zip powder-5031291bf6ec26f2d60ab2fd7071e64cc5827304.tar.gz | |
TPT: Save an extra tmp2 byte, for EXOT fed8b7b2ccc
Diffstat (limited to 'src/client/GameSave.cpp')
| -rw-r--r-- | src/client/GameSave.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index 7e3fbe7..39b2e34 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; |
