Fix for Issue #111 for BitStream Issues

This commit is contained in:
DavidWyand-GG 2012-11-05 16:50:54 -05:00
parent 70415d0787
commit 1a3501440f
7 changed files with 18 additions and 15 deletions

View file

@ -21,6 +21,7 @@
//-----------------------------------------------------------------------------
#include "particle.h"
#include "console/consoleTypes.h"
#include "console/typeValidators.h"
#include "core/stream/bitStream.h"
#include "math/mRandom.h"
#include "math/mathIO.h"
@ -132,13 +133,13 @@ ParticleData::~ParticleData()
//-----------------------------------------------------------------------------
void ParticleData::initPersistFields()
{
addField( "dragCoefficient", TYPEID< F32 >(), Offset(dragCoefficient, ParticleData),
addFieldV( "dragCoefficient", TYPEID< F32 >(), Offset(dragCoefficient, ParticleData), new FRangeValidator(0, 5),
"Particle physics drag amount." );
addField( "windCoefficient", TYPEID< F32 >(), Offset(windCoefficient, ParticleData),
"Strength of wind on the particles." );
addField( "gravityCoefficient", TYPEID< F32 >(), Offset(gravityCoefficient, ParticleData),
addFieldV( "gravityCoefficient", TYPEID< F32 >(), Offset(gravityCoefficient, ParticleData), new FRangeValidator(-10, 10),
"Strength of gravity on the particles." );
addField( "inheritedVelFactor", TYPEID< F32 >(), Offset(inheritedVelFactor, ParticleData),
addFieldV( "inheritedVelFactor", TYPEID< F32 >(), Offset(inheritedVelFactor, ParticleData), &CommonValidators::NormalizedFloat,
"Amount of emitter velocity to add to particle initial velocity." );
addField( "constantAcceleration", TYPEID< F32 >(), Offset(constantAcceleration, ParticleData),
"Constant acceleration to apply to this particle." );

View file

@ -328,9 +328,9 @@ void Sim3DAudioEvent::pack(NetConnection *con, BitStream *bstream)
AssertFatal((1.0 - ((q.x * q.x) + (q.y * q.y) + (q.z * q.z))) >= (0.0 - 0.001),
"QuatF::normalize() is broken in Sim3DAudioEvent");
bstream->writeFloat(q.x,SoundRotBits);
bstream->writeFloat(q.y,SoundRotBits);
bstream->writeFloat(q.z,SoundRotBits);
bstream->writeSignedFloat(q.x,SoundRotBits);
bstream->writeSignedFloat(q.y,SoundRotBits);
bstream->writeSignedFloat(q.z,SoundRotBits);
bstream->writeFlag(q.w < 0.0);
}

View file

@ -96,7 +96,7 @@ void StdMoveList::clientWriteMovePacket(BitStream *bstream)
{
move[offset + i].sendCount++;
move[offset + i].pack(bstream,prevMove);
bstream->writeInt(move[offset + i].checksum,Move::ChecksumBits);
bstream->writeInt(move[offset + i].checksum & (~(0xFFFFFFFF << Move::ChecksumBits)),Move::ChecksumBits);
prevMove = &move[offset+i];
}
}

View file

@ -79,11 +79,11 @@ void ConnectionProtocol::buildSendPacketHeader(BitStream *stream, S32 packetType
stream->writeFlag(true);
stream->writeInt(mConnectSequence & 1, 1);
stream->writeInt(mLastSendSeq, 9);
stream->writeInt(mLastSeqRecvd, 9);
stream->writeInt(packetType, 2);
stream->writeInt(ackByteCount, 3);
stream->writeInt(mAckMask, ackByteCount * 8);
stream->writeInt(mLastSendSeq & 0x1FF, 9);
stream->writeInt(mLastSeqRecvd & 0x1FF, 9);
stream->writeInt(packetType & 0x3, 2);
stream->writeInt(ackByteCount & 0x7, 3);
stream->writeInt(mAckMask & (~(0xFFFFFFFF << ackByteCount*8)), ackByteCount * 8);
// if we're resending this header, we can't advance the
// sequence recieved (in case this packet drops and the prev one

View file

@ -336,6 +336,8 @@ S32 BitStream::readInt(S32 bitCount)
void BitStream::writeInt(S32 val, S32 bitCount)
{
AssertWarn((bitCount == 32) || ((val >> bitCount) == 0), "BitStream::writeInt: value out of range");
val = convertHostToLEndian(val);
writeBits(bitCount, &val);
}

View file

@ -508,8 +508,8 @@ void SFXDescription::packData( BitStream *stream )
Parent::packData( stream );
stream->writeFloat( mVolume, 6 );
stream->writeFloat( mPitch, 6 );
stream->writeFloat( mPriority, 6 );
stream->write( mPitch );
stream->write( mPriority );
stream->writeFlag( mIsLooping );
stream->writeFlag( mFadeLoops );

View file

@ -243,7 +243,7 @@ void NetConnection::eventWritePacket(BitStream *bstream, PacketNotify *notify)
packQueueTail->mNextEvent = ev;
packQueueTail = ev;
if(!bstream->writeFlag(ev->mSeqCount == prevSeq + 1))
bstream->writeInt(ev->mSeqCount, 7);
bstream->writeInt(ev->mSeqCount & 0x7F, 7);
prevSeq = ev->mSeqCount;