--------------------------------------------------------------------------
| 1546 | |
| 1547 | //-------------------------------------------------------------------------- |
| 1548 | U32 afxMagicMissile::packUpdate(NetConnection* con, U32 mask, BitStream* stream) |
| 1549 | { |
| 1550 | U32 retMask = Parent::packUpdate( con, mask, stream ); |
| 1551 | |
| 1552 | const bool isInitalUpdate = mask & GameBase::InitialUpdateMask; |
| 1553 | |
| 1554 | // InitialUpdateMask |
| 1555 | if ( stream->writeFlag( isInitalUpdate ) ) |
| 1556 | { |
| 1557 | Point3F pos; |
| 1558 | getTransform().getColumn( 3, &pos ); |
| 1559 | stream->writeCompressedPoint( pos ); |
| 1560 | F32 len = mCurrVelocity.len(); |
| 1561 | |
| 1562 | if ( stream->writeFlag( len > 0.02 ) ) |
| 1563 | { |
| 1564 | Point3F outVel = mCurrVelocity; |
| 1565 | outVel *= 1 / len; |
| 1566 | stream->writeNormalVector( outVel, 10 ); |
| 1567 | len *= 32.0; // 5 bits for fraction |
| 1568 | |
| 1569 | if ( len > 8191 ) |
| 1570 | len = 8191; |
| 1571 | |
| 1572 | stream->writeInt( (S32)len, 13 ); |
| 1573 | } |
| 1574 | |
| 1575 | stream->writeRangedU32( mCurrTick, 0, afxMagicMissileData::MaxLifetimeTicks ); |
| 1576 | |
| 1577 | if (choreographer) |
| 1578 | { |
| 1579 | S32 ghostIndex = con->getGhostIndex( choreographer ); |
| 1580 | if ( stream->writeFlag( ghostIndex != -1 ) ) |
| 1581 | { |
| 1582 | stream->writeRangedU32( U32(ghostIndex), |
| 1583 | 0, |
| 1584 | NetConnection::MaxGhostCount ); |
| 1585 | } |
| 1586 | else |
| 1587 | // have not recieved the ghost for the source object yet, try again later |
| 1588 | retMask |= GameBase::InitialUpdateMask; |
| 1589 | } |
| 1590 | else |
| 1591 | stream->writeFlag( false ); |
| 1592 | } |
| 1593 | |
| 1594 | // impact update |
| 1595 | if (stream->writeFlag(mask & ImpactMask)) |
| 1596 | { |
| 1597 | mathWrite(*stream, mCurrPosition); |
| 1598 | mathWrite(*stream, mCurrVelocity); |
| 1599 | stream->writeFlag(did_impact); |
| 1600 | } |
| 1601 | |
| 1602 | // guided update |
| 1603 | if (stream->writeFlag(mask & GuideMask)) |
| 1604 | { |
| 1605 | mathWrite(*stream, mCurrPosition); |
nothing calls this directly
no test coverage detected