//-------------------------------------------------------------------------- void Lightning::unpackUpdate(NetConnection* con, BitStream* stream) { Parent::unpackUpdate(con, stream); if (stream->readFlag()) { // Initial update Point3F pos; mathRead(*stream, &pos); setPosition( pos ); mathRead(*stream, &mObjScale); stream->read(&strikeWidth); stream->read(&chanceToHitTarget); stream->read(&strikeRadius); stream->read(&boltStartRadius); stream->read(&color.red); stream->read(&color.green); stream->read(&color.blue); stream->read(&fadeColor.red); stream->read(&fadeColor.green); stream->read(&fadeColor.blue); stream->read(&useFog); stream->read(&strikesPerMinute); } }
void Projectile::unpackUpdate(NetConnection* con, BitStream* stream) { Parent::unpackUpdate(con, stream); // initial update if (stream->readFlag()) { Point3F pos; stream->readCompressedPoint(&pos); if(stream->readFlag()) { stream->readNormalVector(&mCurrVelocity, 10); mCurrVelocity *= stream->readInt(13) / 32.0f; } else mCurrVelocity.set(0, 0, 0); mCurrDeltaBase = pos; mCurrBackDelta = mCurrPosition - pos; mCurrPosition = pos; setPosition(mCurrPosition); mCurrTick = stream->readRangedU32(0, MaxLivingTicks); if (stream->readFlag()) { mSourceObjectId = stream->readRangedU32(0, NetConnection::MaxGhostCount); mSourceObjectSlot = stream->readRangedU32(0, ShapeBase::MaxMountedImages - 1); NetObject* pObject = con->resolveGhost(mSourceObjectId); if (pObject != NULL) mSourceObject = dynamic_cast<ShapeBase*>(pObject); } else { mSourceObjectId = -1; mSourceObjectSlot = -1; mSourceObject = NULL; } } // explosion update if (stream->readFlag()) { Point3F explodePoint; Point3F explodeNormal; mathRead(*stream, &explodePoint); mathRead(*stream, &explodeNormal); stream->read(&mCollideHitType); // start the explosion visuals explode(explodePoint, explodeNormal, mCollideHitType); } // bounce update if (stream->readFlag()) { mathRead(*stream, &mCurrPosition); mathRead(*stream, &mCurrVelocity); } }
void Trigger::unpackUpdate(NetConnection* con, BitStream* stream) { Parent::unpackUpdate(con, stream); U32 i, size; // Transform if( stream->readFlag() ) { MatrixF temp; stream->readAffineTransform(&temp); setTransform(temp); } // Read the polyhedron if( stream->readFlag() ) { Polyhedron tempPH; stream->read(&size); tempPH.pointList.setSize(size); for (i = 0; i < tempPH.pointList.size(); i++) mathRead(*stream, &tempPH.pointList[i]); stream->read(&size); tempPH.planeList.setSize(size); for (i = 0; i < tempPH.planeList.size(); i++) mathRead(*stream, &tempPH.planeList[i]); stream->read(&size); tempPH.edgeList.setSize(size); for (i = 0; i < tempPH.edgeList.size(); i++) { Polyhedron::Edge& rEdge = tempPH.edgeList[i]; stream->read(&rEdge.face[0]); stream->read(&rEdge.face[1]); stream->read(&rEdge.vertex[0]); stream->read(&rEdge.vertex[1]); } setTriggerPolyhedron(tempPH); } if( stream->readFlag() ) { char buf[CMD_SIZE]; stream->readLongString(CMD_SIZE-1, buf); mEnterCommand = buf; } if( stream->readFlag() ) { char buf[CMD_SIZE]; stream->readLongString(CMD_SIZE-1, buf); mLeaveCommand = buf; } if( stream->readFlag() ) { char buf[CMD_SIZE]; stream->readLongString(CMD_SIZE-1, buf); mTickCommand = buf; } }
void BasicClouds::unpackUpdate( NetConnection *conn, BitStream *stream ) { Parent::unpackUpdate( conn, stream ); for ( U32 i = 0; i < TEX_COUNT; i++ ) { mLayerEnabled[i] = stream->readFlag(); stream->read( &mTexName[i] ); stream->read( &mTexScale[i] ); mathRead( *stream, &mTexDirection[i] ); stream->read( &mTexSpeed[i] ); mathRead( *stream, &mTexOffset[i] ); stream->read( &mHeight[i] ); } if ( isProperlyAdded() ) { // We could check if the height or texture have actually changed. _initBuffers(); _initTexture(); } }
virtual void unpack(NetConnection* con, BitStream *bstream) { S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize); if(con->isGhosting()) mObject = static_cast<ShapeBase*>(con->resolveObjectFromGhostIndex(gIndex)); // if(bstream->readFlag()) // mathRead(*bstream,&mTransform); // else // mTransform.identity(); mathRead(*bstream,&mTransform); if(bstream->readFlag()) { bstream->read(&(mScale.x)); mScale.y = mScale.x; mScale.z = mScale.x; } else mathRead(*bstream,&mScale); if(bstream->readFlag()) mathRead(*bstream,&mVelocity); else mVelocity = Point3F::Zero; bstream->read(&mReletive); }
//----------------------------------------------------------------------------- // unpackUpdate //----------------------------------------------------------------------------- void ParticleEmitterNode::unpackUpdate(NetConnection* con, BitStream* stream) { Parent::unpackUpdate(con, stream); if ( stream->readFlag() ) { MatrixF temp; Point3F tempScale; mathRead(*stream, &temp); mathRead(*stream, &tempScale); setScale(tempScale); setTransform(temp); } if ( stream->readFlag() ) { mEmitterDatablockId = stream->readFlag() ? stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast) : 0; ParticleEmitterData *emitterDB = NULL; Sim::findObject( mEmitterDatablockId, emitterDB ); if ( isProperlyAdded() ) setEmitterDataBlock( emitterDB ); } if ( stream->readFlag() ) { mActive = stream->readFlag(); stream->read( &mVelocity ); } }
void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream) { Parent::unpackUpdate(connection,bstream); if (bstream->readFlag()) { MatrixF mat; mathRead(*bstream,&mat); Parent::setTransform(mat); Parent::setRenderTransform(mat); VectorF scale; mathRead(*bstream, &scale); setScale(scale); } // powered? mPowered = bstream->readFlag(); if (mLightPlugin) { mLightPlugin->unpackUpdate(this, connection, bstream); } //.logicking >> if (bstream->readFlag()) updatePhysics(); //.logicking << }
void NavPath::unpackUpdate(NetConnection *conn, BitStream *stream) { Parent::unpackUpdate(conn, stream); mIsLooping = stream->readFlag(); mAlwaysRender = stream->readFlag(); mXray = stream->readFlag(); mRenderSearch = stream->readFlag(); if((mFromSet = stream->readFlag()) == true) mathRead(*stream, &mFrom); if((mToSet = stream->readFlag()) == true) mathRead(*stream, &mTo); if(stream->readFlag()) { mPoints.clear(); mFlags.clear(); mPoints.setSize(stream->readInt(32)); mFlags.setSize(mPoints.size()); for(U32 i = 0; i < mPoints.size(); i++) { Point3F p; mathRead(*stream, &p); mPoints[i] = p; mFlags[i] = stream->readInt(16); } resize(); } }
void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con, stream); MatrixF mat; Point3F scale; mathRead( *stream, &mat ); mathRead( *stream, &scale ); setScale( scale); setTransform(mat); mShapeName = stream->readSTString(); if ( stream->readFlag() ) // UpdateCollisionMask { U32 collisionType = CollisionMesh; stream->read( &collisionType ); // Handle it if we have changed CollisionType's if ( (MeshType)collisionType != mCollisionType ) { mCollisionType = (MeshType)collisionType; if ( isProperlyAdded() && mShapeInstance ) prepCollision(); } } if (stream->readFlag()) // SkinMask { NetStringHandle skinDesiredNameHandle = con->unpackNetStringHandleU(stream);; if (mSkinNameHandle != skinDesiredNameHandle) { mSkinNameHandle = skinDesiredNameHandle; reSkin(); } } stream->read( (U32*)&mDecalType ); mAllowPlayerStep = stream->readFlag(); mMeshCulling = stream->readFlag(); mUseOriginSort = stream->readFlag(); stream->read( &mRenderNormalScalar ); stream->read( &mForceDetail ); mPlayAmbient = stream->readFlag(); if ( mLightPlugin ) { mLightPlugin->unpackUpdate(this, con, stream); } if ( isProperlyAdded() ) _updateShouldTick(); }
void RigidBodyData::unpackData(BitStream* stream) { Parent::unpackData(stream); stream->read(&mShapeType); mathRead(*stream,&mRotation); mathRead(*stream,&mPos); stream->read(&mDampOnCollisionFactorL); stream->read(&mDampOnCollisionFactorA); mOnlyOnClient = stream->readFlag(); }
void SceneSpace::unpackUpdate( NetConnection* connection, BitStream* stream ) { Parent::unpackUpdate( connection, stream ); if( stream->readFlag() ) // TransformMask { mathRead( *stream, &mObjToWorld ); mathRead( *stream, &mObjScale ); setTransform( mObjToWorld ); } }
void RenderObjectExample::unpackUpdate(NetConnection *conn, BitStream *stream) { // Let the Parent read any info it sent Parent::unpackUpdate(conn, stream); if ( stream->readFlag() ) // TransformMask { mathRead(*stream, &mObjToWorld); mathRead(*stream, &mObjScale); setTransform( mObjToWorld ); } }
void MetaShapeRenderer::unpackUpdate(NetConnection *conn, BitStream *stream) { // Let the Parent read any info it sent Parent::unpackUpdate(conn, stream); if ( stream->readFlag() ) // TransformMask { mathRead(*stream, &mObjToWorld); mathRead(*stream, &mObjScale); setTransform( mObjToWorld ); mUpdatePolyList = true; } }
void VehicleBlocker::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con, stream); MatrixF mat; Point3F scale; Box3F objBox; mathRead(*stream, &mat); mathRead(*stream, &scale); mathRead(*stream, &mDimensions); mObjBox.minExtents.set(-mDimensions.x, -mDimensions.y, 0); mObjBox.maxExtents.set( mDimensions.x, mDimensions.y, mDimensions.z); setScale(scale); setTransform(mat); }
void Projectile::unpackUpdate(NetConnection* con, BitStream* stream) { Parent::unpackUpdate(con, stream); if ( stream->readFlag() ) // InitialUpdateMask { mCurrTick = stream->readRangedU32( 0, MaxLivingTicks ); if ( stream->readFlag() ) { mSourceObjectId = stream->readRangedU32( 0, NetConnection::MaxGhostCount ); mSourceObjectSlot = stream->readRangedU32( 0, ShapeBase::MaxMountedImages - 1 ); NetObject* pObject = con->resolveGhost( mSourceObjectId ); if ( pObject != NULL ) mSourceObject = dynamic_cast<ShapeBase*>( pObject ); } else { mSourceObjectId = -1; mSourceObjectSlot = -1; mSourceObject = NULL; } } if ( stream->readFlag() ) // ExplosionMask { Point3F explodePoint; Point3F explodeNormal; mathRead( *stream, &explodePoint ); mathRead( *stream, &explodeNormal ); stream->read( &mCollideHitType ); // start the explosion visuals explode( explodePoint, explodeNormal, mCollideHitType ); } if ( stream->readFlag() ) // BounceMask { Point3F pos; mathRead( *stream, &pos ); mathRead( *stream, &mCurrVelocity ); mCurrDeltaBase = pos; mCurrBackDelta = mCurrPosition - pos; mCurrPosition = pos; setPosition( mCurrPosition ); } }
void afxMooring::unpackUpdate(NetConnection * conn, BitStream * stream) { Parent::unpackUpdate(conn, stream); // InitialUpdate if (stream->readFlag()) { stream->read(&chor_id); ghost_cons_name = stream->readSTString(); if (chor_id != 0 && ghost_cons_name != ST_NULLSTRING) hookup_with_chor = true; } if (stream->readFlag()) { if (mDataBlock->track_pos_only) { Point3F pos; mathRead(*stream, &pos); setPosition(pos); } else { MatrixF mat; stream->readAffineTransform(&mat); setTransform(mat); setRenderTransform(mat); } } }
void GroundPlane::unpackUpdate( NetConnection* connection, BitStream* stream ) { Parent::unpackUpdate( connection, stream ); stream->read( &mSquareSize ); stream->read( &mScaleU ); stream->read( &mScaleV ); stream->read( &mMaterialName ); if( stream->readFlag() ) // UpdateMask { MatrixF mat; mathRead( *stream, &mat ); setTransform( mat ); } // If we're added then something possibly changed in // the editor... do an update of the material and the // geometry. if ( isProperlyAdded() ) { _updateMaterial(); mVertexBuffer = NULL; } }
void DecalRoadNodeEvent::unpack(NetConnection* conn, BitStream* stream) { mNodeList = new DecalRoadNodeList(); Parent::unpack( conn, stream ); U32 count = stream->readInt( 16 ); Point3F pos; F32 width; DecalRoadNodeList* list = static_cast<DecalRoadNodeList*>(mNodeList); for (U32 i=0; i<count; ++i) { mathRead( *stream, &pos ); stream->read( &width ); list->mPositions.push_back( pos ); list->mWidths.push_back( width ); } list->mTotalValidNodes = count; // Do we have a complete list? if (list->mPositions.size() >= mTotalNodes) list->mListComplete = true; }
void DecalData::unpackData( BitStream *stream ) { Parent::unpackData( stream ); stream->read( &lookupName ); stream->read( &size ); stream->read( &materialName ); _updateMaterial(); stream->read( &lifeSpan ); stream->read( &fadeTime ); stream->read( &texCoordCount ); for (S32 i = 0; i < texCoordCount; i++) mathRead(*stream, &texRect[i]); stream->read( &fadeStartPixelSize ); stream->read( &fadeEndPixelSize ); stream->read( &renderPriority ); stream->read( &clippingMasks ); stream->read( &clippingAngle ); stream->read( &texRows ); stream->read( &texCols ); stream->read( &frame ); stream->read( &randomize ); }
void SceneObject::unpackUpdate( NetConnection* conn, BitStream* stream ) { Parent::unpackUpdate( conn, stream ); // FlagMask if ( stream->readFlag() ) mObjectFlags = stream->readRangedU32( 0, getObjectFlagMax() ); // MountedMask if ( stream->readFlag() ) { if ( stream->readFlag() ) { S32 gIndex = stream->readInt( NetConnection::GhostIdBitSize ); SceneObject* obj = dynamic_cast<SceneObject*>( conn->resolveGhost( gIndex ) ); S32 node = -1; if ( stream->readFlag() ) // node != -1 node = stream->readInt( NumMountPointBits ); MatrixF xfm; mathRead( *stream, &xfm ); if ( !obj ) { conn->setLastError( "Invalid packet from server." ); return; } obj->mountObject( this, node, xfm ); } else unmount(); } }
void CloudLayer::unpackUpdate( NetConnection *conn, BitStream *stream ) { Parent::unpackUpdate( conn, stream ); String oldTextureName = mTextureName; stream->read( &mTextureName ); for ( U32 i = 0; i < TEX_COUNT; i++ ) { stream->read( &mTexScale[i] ); stream->read( &mTexSpeed[i] ); mathRead( *stream, &mTexDirection[i] ); } stream->read( &mBaseColor ); F32 oldCoverage = mCoverage; stream->read( &mCoverage ); stream->read( &mExposure ); stream->read( &mWindSpeed ); F32 oldHeight = mHeight; stream->read( &mHeight ); if ( isProperlyAdded() ) { if ( ( oldTextureName != mTextureName ) || ( ( oldCoverage == 0.0f ) != ( mCoverage == 0.0f ) ) ) _initTexture(); if ( oldHeight != mHeight ) _initBuffers(); } }
void PathCamera::unpackUpdate(NetConnection *con, BitStream *stream) { Parent::unpackUpdate(con,stream); // StateMask if (stream->readFlag()) mState = stream->readInt(StateBits); // PositionMask if (stream->readFlag()) { stream->read(&mPosition); delta.time = mPosition; delta.timeVec = 0; } // TargetMask if (stream->readFlag()) { mTargetSet = stream->readFlag(); if (mTargetSet) stream->read(&mTarget); } // WindowMask if (stream->readFlag()) { mSpline.removeAll(); stream->read(&mNodeBase); stream->read(&mNodeCount); for (S32 i = 0; i < mNodeCount; i++) { CameraSpline::Knot *knot = new CameraSpline::Knot(); mathRead(*stream, &knot->mPosition); mathRead(*stream, &knot->mRotation); stream->read(&knot->mSpeed); knot->mType = (CameraSpline::Knot::Type)stream->readInt(CameraSpline::Knot::NUM_TYPE_BITS); knot->mPath = (CameraSpline::Knot::Path)stream->readInt(CameraSpline::Knot::NUM_PATH_BITS); mSpline.push_back(knot); } } // Controlled by the client? if (stream->readFlag()) return; }
void RigidBody::readPacketData(GameConnection *connection, BitStream *stream) { Parent::readPacketData(connection, stream); if (stream->readFlag()) { Point3F pos; QuatF q; VectorF linVel,angVel; mathRead(*stream, &pos); mathRead(*stream, &q); mathRead(*stream, &linVel); mathRead(*stream, &angVel); } ///mDisableMove = stream->readFlag(); //stream->setCompressionPoint(mRigid.linPosition); }
void SoftBodyData::unpackData(BitStream* stream) { Parent::unpackData(stream); stream->read(&poseMatchKoef); stream->read(&attachedPointsNum); for (int i = 0;i<attachedPointsNum; i++) mathRead(*stream,&(attachedPoints[i])); }
void MissionArea::unpackUpdate(NetConnection *, BitStream * stream) { // ghost (initial) and regular updates share flag.. if(stream->readFlag()) { mathRead(*stream, &mArea); stream->read(&mFlightCeiling); stream->read(&mFlightCeilingRange); } }
//-------------------------------------------------------------------------- // unpackUpdate //-------------------------------------------------------------------------- void Splash::unpackUpdate(NetConnection* con, BitStream* stream) { Parent::unpackUpdate(con, stream); if( stream->readFlag() ) { mathRead(*stream, &mInitialPosition); setPosition( mInitialPosition ); } }
void ConvexShape::unpackUpdate( NetConnection *conn, BitStream *stream ) { Parent::unpackUpdate( conn, stream ); if ( stream->readFlag() ) // TransformMask { mathRead(*stream, &mObjToWorld); mathRead(*stream, &mObjScale); setTransform( mObjToWorld ); setScale( mObjScale ); } if ( stream->readFlag() ) // UpdateMask { stream->read( &mMaterialName ); if ( isProperlyAdded() ) _updateMaterial(); mSurfaces.clear(); const U32 surfCount = stream->readInt( 32 ); for ( S32 i = 0; i < surfCount; i++ ) { mSurfaces.increment(); MatrixF &mat = mSurfaces.last(); QuatF quat; Point3F pos; mathRead( *stream, &quat ); mathRead( *stream, &pos ); quat.setMatrix( &mat ); mat.setPosition( pos ); } if ( isProperlyAdded() ) _updateGeometry( true ); } }
void HexagonVolumeCollisionShape::unpackUpdate(NetConnection *connection, BitStream *bstream) { Parent::unpackUpdate(connection,bstream); if (bstream->readFlag()) { MatrixF mat; mathRead(*bstream,&mat); Parent::setTransform(mat); Parent::setRenderTransform(mat); VectorF scale; mathRead(*bstream, &scale); setScale(scale); } if (mLightPlugin) { mLightPlugin->unpackUpdate(this, connection, bstream); } }
void CoverPoint::unpackUpdate(NetConnection *conn, BitStream *stream) { Parent::unpackUpdate(conn, stream); mSize = (Size)stream->readInt(4); setOccupied(stream->readFlag()); mPeekLeft = stream->readFlag(); mPeekRight = stream->readFlag(); mPeekOver = stream->readFlag(); if(stream->readFlag()) // TransformMask { mathRead(*stream, &mObjToWorld); mathRead(*stream, &mObjScale); setTransform(mObjToWorld); } }
void ForestWindEmitter::unpackUpdate(NetConnection * con, BitStream * stream) { // Unpack Parent. Parent::unpackUpdate( con, stream ); MatrixF xfm; mathRead( *stream, &xfm ); Parent::setTransform( xfm ); U32 windMask = 0; if ( stream->readFlag() ) // EnabledMask mEnabled = stream->readFlag(); if ( stream->readFlag() ) // WindMask { stream->read( &mWindStrength ); stream->read( &mWindRadius ); mRadialEmitter = stream->readFlag(); stream->read( &mWindGustStrength ); stream->read( &mWindGustFrequency ); stream->read( &mWindGustYawAngle ); stream->read( &mWindGustYawFrequency ); stream->read( &mWindGustWobbleStrength ); stream->read( &mWindTurbulenceStrength ); stream->read( &mWindTurbulenceFrequency ); stream->readNormalVector( &mWindDirection, 8 ); windMask |= WindMask; mHasMount = stream->readFlag(); } // This does nothing if the masks are not set! if ( windMask != 0 && isProperlyAdded() ) { Point3F boxRad( 0, 0, 0 ); if ( !isRadialEmitter() ) boxRad.set( 10000.0f, 10000.0f, 10000.0f ); else boxRad.set( mWindRadius, mWindRadius, mWindRadius ); mObjBox.set( -boxRad, boxRad ); resetWorldBox(); _initWind( windMask ); } }