Пример #1
0
void CCharacterHitBox::Load(ILTMessage_Read *pMsg)
{
	AIASSERT( pMsg, m_hObject, "Load with no pMsg" );
	if (!pMsg)
	{
		return;
	}

	LOAD_HOBJECT(m_hModel);
	LOAD_VECTOR(m_vOffset);
	LOAD_BOOL(m_bCanActivate);
	LOAD_bool( m_bAnimControlsDims );
	LOAD_bool( m_bAnimControlsOffset );
	LOAD_bool( m_bFollowVisNode );
	LOAD_DWORD_CAST( m_hControllingAnim, HMODELANIM );

	m_pHitBoxUser = dynamic_cast<IHitBoxUser*>(g_pLTServer->HandleToObject(m_hModel));
	AIASSERT( m_pHitBoxUser, m_hModel, "Unable to get the HitBoxUser interface from m_hModel." );
}
Пример #2
0
void CAIActivityAbstract::Load(ILTMessage_Read *pMsg)
{
	LOAD_INT_CAST(m_eActStatus, ENUM_AIACTIVITY_STATUS);

	LOAD_INT(m_nActivityPriority);

	LOAD_FLOAT(m_fActivityUpdateRate);
	LOAD_TIME(m_fNextActivityUpdateTime);
	LOAD_TIME(m_fActivityActivateTime);
	LOAD_TIME(m_fActivityTimeOut);
	LOAD_TIME(m_fActivityExpirationTime);

	LOAD_INT(m_cPotentialParticipants);
	for (int i = 0; i < MAX_PARTICIPANTS; ++i)
	{
		LOAD_HOBJECT(m_aPotentialParticipants[i]);
	}

	m_pSquad = 0;
}
Пример #3
0
void CAINodeMgr::Load(ILTMessage_Read *pMsg)
{
	m_mapAINodes.clear( );

	LOAD_BOOL( m_bInitialized );

	uint32 cNodes;
	LOAD_DWORD( cNodes );

	EnumAINodeType eNodeType;
	HOBJECT hNode;
	AINode* pNode;

	for( uint32 iNode=0; iNode < cNodes; ++iNode )
	{
		LOAD_DWORD_CAST( eNodeType, EnumAINodeType );
		LOAD_HOBJECT( hNode );

		pNode = (AINode*)g_pLTServer->HandleToObject( hNode );
		m_mapAINodes.insert( AINODE_MAP::value_type(eNodeType, pNode) );
	}
}
Пример #4
0
void Body::Load(HMESSAGEREAD hRead, uint32 dwLoadFlags)
{
	if (!hRead) return;

	uint32 dwTime;
	LOAD_DWORD(dwTime);

	LTAnimTracker* pTracker = LTNULL;
	if ( (LT_OK == g_pModelLT->GetMainTracker(m_hObject, pTracker)) && pTracker )
	{
		g_pModelLT->SetCurAnimTime(pTracker, dwTime);
	}

	LOAD_DWORD_CAST(m_eBodyStatePrevious, BodyState);
	LOAD_HOBJECT(m_hHitBox);
	LOAD_VECTOR(m_vColor);
	LOAD_VECTOR(m_vDeathDir);
	LOAD_FLOAT(m_fStartTime);
	LOAD_FLOAT(m_fLifetime);
	LOAD_BOOL(m_bFirstUpdate);
	LOAD_BYTE_CAST(m_eModelId, ModelId);
	LOAD_BYTE_CAST(m_eModelSkeleton, ModelSkeleton);
	LOAD_BYTE_CAST(m_eDeathType, CharacterDeath);
	LOAD_BYTE_CAST(m_eDamageType, DamageType);
	LOAD_BYTE_CAST(m_eModelStyle, ModelStyle);
	LOAD_DWORD_CAST(m_eBodyState, BodyState);
	LOAD_HOBJECT(m_hChecker);
	LOAD_HOBJECT(m_hWeaponItem);

	SetState(m_eBodyState, LTTRUE);

	if ( m_pState )
	{
		m_pState->Load(hRead);
	}

	LTBOOL bAttachments;
	LOAD_BOOL(bAttachments);

	if ( bAttachments )
	{
		uint32 dwAttachmentsType;
		LOAD_DWORD(dwAttachmentsType);

		m_pAttachments = CAttachments::Create(dwAttachmentsType);

		_ASSERT(m_pAttachments);

		if (m_pAttachments)
		{
			AddAggregate(m_pAttachments);
		}
	}

	LOAD_INT(m_cSpears);

	for ( uint32 iSpear = 0 ; iSpear < kMaxSpears ; iSpear++ )
	{
		LOAD_HOBJECT(m_ahSpears[iSpear]);
	}

	m_DeathScene.Load(hRead);

	g_pCharacterMgr->AddDeathScene(&m_DeathScene);
}
Пример #5
0
void CAIGoalPickupWeapon::Load(ILTMessage_Read *pMsg)
{
	super::Load(pMsg);

	LOAD_HOBJECT( m_hWeaponItem );
}
Пример #6
0
void CAISensorNodeGuarded::Load(ILTMessage_Read *pMsg)
{
	super::Load(pMsg);

	LOAD_HOBJECT(m_hLastGuardNode);
}
Пример #7
0
void WorldModel::OnLoad( ILTMessage_Read *pMsg, uint32 dwSaveFlags )
{
	ASSERT( pMsg != NULL );

	m_ActivateTypeHandler.Load( pMsg );

	LOAD_bool( m_bIsKeyframed );
	LOAD_bool( m_bStartHidden );
	LOAD_HSTRING( m_hstrAttachments );
	LOAD_BOOL( m_bRemoveAttachments );
	LOAD_VECTOR( m_vAttachDir );
	LOAD_HOBJECT( m_hAttachDirObj );
	LOAD_ROTATION( m_hackInitialRot );
	LOAD_FLOAT( m_fStimRadius );
	LOAD_HOBJECT( m_hActivateParent );
	LOAD_bool( m_bCanActivate );

	// Load the object lists last...
	uint8	nObjsInList = 0;

	// First the Attachment list
	LOAD_BYTE( nObjsInList );
	m_AttachmentList.clear( );
	if( nObjsInList > 0 )
	{
		LTObjRefNotifier ref( *this );
		for( uint8 i = 0; i < nObjsInList; ++i )
		{
			LOAD_HOBJECT( ref );
			if( ref )
			{
				m_AttachmentList.push_back( ref );
			}
		}
	}

	// Then the other attachment list
	LOAD_BYTE( nObjsInList );
	m_AttachMsgObjList.clear( );
	if( nObjsInList > 0 )
	{
		LTObjRefNotifier ref( *this );
		for( uint8 i = 0; i < nObjsInList; ++i )
		{
			LOAD_HOBJECT( ref );
			if( ref )
			{
				m_AttachMsgObjList.push_back( ref );
			}
		}
	}

	// Then the Mark list
	LOAD_BYTE( nObjsInList );
	m_MarkList.clear( );
	if( nObjsInList > 0 )
	{
		LTObjRefNotifier ref( *this );
		for( uint8 i = 0; i < nObjsInList; ++i )
		{
			LOAD_HOBJECT( ref );
			if( ref )
			{
				m_MarkList.push_back( ref );
			}
		}
	}
}
Пример #8
0
void CAIGoalFlee::Load(ILTMessage_Read *pMsg)
{
	super::Load(pMsg);
	LOAD_HOBJECT(m_hCachedBestNode);
}
Пример #9
0
void Prop::Load(ILTMessage_Read *pMsg, uint32 dwLoadFlags)
{
	if (!pMsg) return;

	m_ActivateTypeHandler.Load( pMsg );

	LOAD_FLOAT(m_fAlpha);
    LOAD_BOOL(m_bMoveToFloor);
    LOAD_BOOL(m_bFirstUpdate);
	LOAD_bool( m_bCanDeactivate );
    LOAD_VECTOR(m_vScale);
    LOAD_VECTOR(m_vObjectColor);

	m_damage.Load(pMsg, dwLoadFlags);
	LOAD_BOOL(m_bTouchable);
	LOAD_DWORD_CAST(m_eState, EnumAIStateType);

/* THESE SHOULD NOT NEED TO BE SAVED - THEY ARE USED FOR INITIALIZING THE OBJECT ONLY!!!
// 8/4/02 - Remove after testing
	LOAD_DWORD(m_dwUsrFlgs);
	LOAD_DWORD(m_dwFlags);
	LOAD_DWORD(m_dwFlags2);
*/

	HMODELANIM hWorldAnim;
	uint32 cWorldAnims;
	LOAD_DWORD(cWorldAnims);
	for( uint32 iWorldAnim = 0; iWorldAnim < cWorldAnims; ++iWorldAnim )
	{
		LOAD_DWORD(hWorldAnim);
		m_lstWorldAnims.push_back(hWorldAnim);
	}

	if (pMsg->Readbool())
	{
		if(m_pDisturb == LTNULL)
		{
			m_pDisturb = debug_new(PropDisturbStruct);
		}
		m_pDisturb->Load(pMsg);
	}

	LOAD_bool( m_bActivatedOn );

	char szString[1024];

	LOAD_CHARSTRING( szString, ARRAY_LEN( szString ));
	m_sActivateOnCommand = szString;

	LOAD_CHARSTRING( szString, ARRAY_LEN( szString ));
	m_sActivateOffCommand = szString;

	LOAD_bool( m_bAttachmentShotOff );
	LOAD_HOBJECT( m_hAttachmentOwner );
	
	LOAD_FLOAT( m_fPitch );
	LOAD_FLOAT( m_fYaw );
	LOAD_FLOAT( m_fRoll );
	LOAD_FLOAT( m_fPitchVel );
	LOAD_FLOAT( m_fYawVel );
	LOAD_FLOAT( m_fRollVel );
	LOAD_bool( m_bRotatedToRest );
	LOAD_bool( m_bRotating );

	LOAD_bool( m_bFading );
	LOAD_FLOAT( m_fFadeStartTime );
	LOAD_FLOAT( m_fFadeDuration );
	LOAD_FLOAT( m_fStartAlpha );
	LOAD_FLOAT( m_fEndAlpha );
	LOAD_bool( m_bFadeRemoveWhenDone );

	LOAD_bool( m_bCanTransition );

	// We must remove aggregates before sending the message to the base classs...

	if( !m_bCanTransition )
	{
		// Disallow transitioning of this object through TransAMs...

		DestroyTransitionAggregate();
	}
}
Пример #10
0
void CTransitionAggregate::Load( ILTMessage_Read *pMsg, uint32 dwLoadFlags )
{
	if( !pMsg ) return;
	
	LOAD_HOBJECT( m_hObject );

	// The rest is dependent on the load type...

	if( dwLoadFlags != LOAD_TRANSITION ) return;
	
	HOBJECT hTransArea = g_pTransMgr->GetTransitionArea();
	if( !hTransArea ) return;
	
	TransitionArea *pTransArea = (TransitionArea*)g_pLTServer->HandleToObject( hTransArea );
	if( !pTransArea ) return;

	LTransform tfLocal;
	LTransform tfObjectWorld;
	LTVector vVelRel;
	LTransform const& tfTransAreaWorld = pTransArea->GetWorldTransform( );
	LTMatrix mRotation;
	tfTransAreaWorld.m_Rot.ConvertToMatrix( mRotation );

	LOAD_VECTOR( tfLocal.m_Pos );
	LOAD_ROTATION( tfLocal.m_Rot );
	LOAD_VECTOR( vVelRel );
	
	// Calc pos and rot based on offsets and current TransArea...

	tfObjectWorld.m_Pos = tfTransAreaWorld.m_Pos + ( mRotation * tfLocal.m_Pos );
	tfObjectWorld.m_Rot = tfTransAreaWorld.m_Rot * tfLocal.m_Rot;
	LTVector vVel = mRotation * vVelRel;

	if( IsPlayer( m_hObject ))
	{
		// Since the PlayerObj is controlled by the client we need to notify the
		// client of the rotation.  We are only worried about the Yaw since Roll doesn't 
		// matter and Pitch can be preserved on the client.


		CPlayerObj *pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject( m_hObject );
		if( !pPlayer ) return;

		
		LTFLOAT		fYaw;
		LTVector	vF = tfObjectWorld.m_Rot.Forward();

		// We don't care about Roll...

		vF.y = 0.0f; 
		vF.Normalize();

		// Yaw = arctan( vF.x / vF.z );
		// atan2 is well defined even for vF.z == 0

		fYaw = (LTFLOAT)atan2( vF.x, vF.z );
		
		// Inform the client of the correct camera/player orientation...

		LTVector vVec( 0.0f, fYaw, 0.0f );
		
		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_PLAYER_ORIENTATION );
		cMsg.Writeuint8( MID_ORIENTATION_YAW );
		cMsg.WriteLTVector( vVec );
		g_pLTServer->SendToClient(cMsg.Read(), pPlayer->GetClient(), MESSAGE_GUARANTEED);
		
	}

	g_pLTServer->SetObjectPos( m_hObject, &tfObjectWorld.m_Pos );
	g_pLTServer->SetObjectRotation( m_hObject, &tfObjectWorld.m_Rot );
	g_pPhysicsLT->SetVelocity( m_hObject, &vVel );
}
Пример #11
0
void CAIGoalAbstractTargeted::Load(ILTMessage_Read *pMsg)
{
	super::Load(pMsg);

	LOAD_HOBJECT(m_hTarget);
}