Example #1
0
bool CScriptEntity::bfScriptAnimation()
{
    if (GetScriptControl() && !GetCurrentAction() && GetActionCount())
        ProcessScripts();

    if (
        GetScriptControl() &&
        GetCurrentAction() &&
        !GetCurrentAction()->m_tAnimationAction.m_bCompleted &&
        xr_strlen(GetCurrentAction()->m_tAnimationAction.m_caAnimationToPlay)) {

        if (m_tpScriptAnimation == m_tpNextAnimation)
            return			(true);

#ifdef DEBUG
        //if (!xr_strcmp("m_stalker_wounded",*object().cName()))
        //	Msg				("%6d Playing animation : %s , Object %s",Device.dwTimeGlobal,*GetCurrentAction()->m_tAnimationAction.m_caAnimationToPlay, *object().cName());
#endif
        m_tpScriptAnimation = m_tpNextAnimation;
        IKinematicsAnimated	*skeleton_animated = smart_cast<IKinematicsAnimated*>(object().Visual());
        LPCSTR				animation_id = *GetCurrentAction()->m_tAnimationAction.m_caAnimationToPlay;
        MotionID			animation = skeleton_animated->ID_Cycle(animation_id);
        CBlend				*result = 0;
        for (u16 i=0; i<MAX_PARTS; ++i) {
            CBlend			*blend = 0;
            if (result) {
                skeleton_animated->LL_PlayCycle(i,animation,TRUE,0,0);
                continue;
            }

            blend			= skeleton_animated->LL_PlayCycle(i,animation,TRUE,ScriptCallBack,this);
            if (!blend)
                continue;
            result			= blend;
            CMotionDef	*MD = skeleton_animated->LL_GetMotionDef( animation );
            VERIFY( MD );
            if ( m_use_animation_movement_controller || MD->flags|esmRootMover )
                m_object->create_anim_mov_ctrl	( blend, 0, true );
        }

        return				(true);
    }
    else {
        m_tpScriptAnimation.invalidate();
        return		(false);
    }
}
Example #2
0
LPCSTR CScriptEntity::GetPatrolPathName()
{
#ifdef DEBUG
    if (!GetScriptControl()) {
        ai().script_engine().script_log(eLuaMessageTypeError,"Object %s is not under script control while you are trying to get patrol path name!",*m_object->cName());
        return "";
    }
#endif
    if (m_tpActionQueue.empty())
        return				("");
    return					(*m_tpActionQueue.back()->m_tMovementAction.m_path_name);
}
BOOL CBaseMonster::net_Spawn (CSE_Abstract* DC) 
{
	if (!inherited::net_Spawn(DC))
		return(FALSE);

	CSE_Abstract							*e	= (CSE_Abstract*)(DC);
	R_ASSERT2								(ai().get_level_graph() && ai().get_cross_table() && (ai().level_graph().level_id() != u32(-1)),"There is no AI-Map, level graph, cross table, or graph is not compiled into the game graph!");
	monster_squad().register_member			((u8)g_Team(),(u8)g_Squad(),(u8)g_Group(), this);
	settings_overrides						();


	if (GetScriptControl()) {
		m_control_manager->animation().reset_data	();
		ProcessScripts						();
	}
	m_pPhysics_support->in_NetSpawn			(e);

	control().update_frame();
	control().update_schedule();

	// spawn inventory item
//	if (ai().get_alife()) {
//		
//		CSE_ALifeMonsterBase					*se_monster = smart_cast<CSE_ALifeMonsterBase*>(ai().alife().objects().object(ID()));
//		VERIFY									(se_monster);
//
//		if (se_monster->m_flags.is(CSE_ALifeMonsterBase::flNeedCheckSpawnItem)) {
//			float prob = Random.randF();
//			if ((prob < m_spawn_probability) || fsimilar(m_spawn_probability,1.f)) 
//				se_monster->m_flags.set(CSE_ALifeMonsterBase::flSkipSpawnItem, FALSE);
//
//			se_monster->m_flags.set(CSE_ALifeMonsterBase::flNeedCheckSpawnItem, FALSE);
//		}
//
//		if (!se_monster->m_flags.is(CSE_ALifeMonsterBase::flSkipSpawnItem)) {
//			CSE_Abstract	*object = Level().spawn_item (m_item_section,Position(),ai_location().level_vertex_id(),ID(),true);
//			CSE_ALifeObject	*alife_object = smart_cast<CSE_ALifeObject*>(object);
//			if (alife_object)
//				alife_object->m_flags.set	(CSE_ALifeObject::flCanSave,FALSE);
//
//			{
//				NET_Packet				P;
//				object->Spawn_Write		(P,TRUE);
//				Level().Send			(P,net_flags(TRUE));
//				F_entity_Destroy		(object);
//			}
//		}
//	}

	return(TRUE);
}
Example #4
0
void CCar::UpdateCL				( )
{
	inherited::UpdateCL();
	CExplosive::UpdateCL();
	if(m_car_weapon)
	{
		m_car_weapon->UpdateCL();
		if(m_memory)
			m_memory->set_camera(m_car_weapon->ViewCameraPos(), m_car_weapon->ViewCameraDir(), m_car_weapon->ViewCameraNorm());
	}
	ASCUpdate			();
	if(Owner()) return;
//	UpdateEx			(g_fov);
	VisualUpdate(90);
	if (GetScriptControl())
			ProcessScripts();

}