// called only in "fast-mode" void CArtefact::UpdateCL () { inherited::UpdateCL (); if (o_fastmode || m_activationObj) UpdateWorkload (Device.dwTimeDelta); }
void CBulletManager::CommitRenderSet () // @ the end of frame { m_BulletsRendered = m_Bullets ; if (g_mt_config.test(mtBullets)) { Device.seqParallel.push_back (fastdelegate::FastDelegate0<>(this,&CBulletManager::UpdateWorkload)); } else { UpdateWorkload (); } }
void CArtefact::shedule_Update (u32 dt) { inherited::shedule_Update (dt); ////////////////////////////////////////////////////////////////////////// // check "fast-mode" border if (H_Parent()) o_switch_2_slow (); else { Fvector center; Center(center); BOOL rendering = (Device.dwFrame==o_render_frame); float cam_distance = Device.vCameraPosition.distance_to(center)-Radius(); if (rendering || (cam_distance < FASTMODE_DISTANCE)) o_switch_2_fast (); else o_switch_2_slow (); } if (!o_fastmode) UpdateWorkload (dt); }
void CAI_Crow::shedule_Update (u32 DT) { float fDT = float(DT)/1000.F; spatial.type &=~STYPE_VISIBLEFORAI; inherited::shedule_Update(DT); if (st_target!=st_current) { switch(st_target) { case eFlyUp: switch2_FlyUp(); break; case eFlyIdle: switch2_FlyIdle(); break; case eDeathFall: switch2_DeathFall();break; case eDeathDead: switch2_DeathDead();break; } st_current = st_target; } switch (st_current) { case eFlyIdle: if (Position().y>vOldPosition.y) st_target = eFlyUp; break; case eFlyUp: if (Position().y<=vOldPosition.y) st_target = eFlyIdle; break; case eDeathFall: state_DeathFall(); break; } if ((eDeathFall!=st_current)&&(eDeathDead!=st_current)){ // At random times, change the direction (goal) of the plane if(fGoalChangeTime<=0) { fGoalChangeTime += fGoalChangeDelta+fGoalChangeDelta*Random.randF(-0.5f,0.5f); Fvector vP; vP.set(Device.vCameraPosition.x,Device.vCameraPosition.y+fMinHeight,Device.vCameraPosition.z); vGoalDir.x = vP.x+vVarGoal.x*Random.randF(-0.5f,0.5f); vGoalDir.y = vP.y+vVarGoal.y*Random.randF(-0.5f,0.5f); vGoalDir.z = vP.z+vVarGoal.z*Random.randF(-0.5f,0.5f); } fGoalChangeTime -= fDT; // sounds if (fIdleSoundTime<=0){ fIdleSoundTime = fIdleSoundDelta+fIdleSoundDelta*Random.randF(-0.5f,0.5f); //if (st_current==eFlyIdle) ::Sound->play_at_pos(m_Sounds.m_idle.GetRandom(),H_Root(),Position()); } fIdleSoundTime -= fDT; } m_Sounds.m_idle.SetPosition (Position()); // work if (o_workload_rframe == (Device.dwFrame-1)) ; else UpdateWorkload (fDT); }
void CAI_Crow::renderable_Render () { UpdateWorkload (Device.fTimeDelta); inherited::renderable_Render (); o_workload_rframe = Device.dwFrame ; }
// called as usual void CCustomZone::shedule_Update(u32 dt) { m_zone_flags.set(eZoneIsActive, FALSE); if (IsEnabled()) { const Fsphere& s = CFORM()->getSphere(); Fvector P; XFORM().transform_tiny (P,s.P); // update feel_touch_update (P,s.R); //пройтись по всем объектам в зоне //и проверить их состояние for(OBJECT_INFO_VEC_IT it = m_ObjectInfoMap.begin(); m_ObjectInfoMap.end() != it; ++it) { CGameObject* pObject = (*it).object; if (!pObject) continue; CEntityAlive* pEntityAlive = smart_cast<CEntityAlive*>(pObject); SZoneObjectInfo& info = (*it); info.dw_time_in_zone += dt; if((!info.small_object && m_iDisableHitTime != -1 && (int)info.dw_time_in_zone > m_iDisableHitTime) || (info.small_object && m_iDisableHitTimeSmall != -1 && (int)info.dw_time_in_zone > m_iDisableHitTimeSmall)) { if(!pEntityAlive || !pEntityAlive->g_Alive()) info.zone_ignore = true; } if(m_iDisableIdleTime != -1 && (int)info.dw_time_in_zone > m_iDisableIdleTime) { if(!pEntityAlive || !pEntityAlive->g_Alive()) StopObjectIdleParticles( pObject ); } //если есть хотя бы один не дисабленый объект, то //зона считается активной if(info.zone_ignore == false) m_zone_flags.set(eZoneIsActive,TRUE); } if(eZoneStateIdle == m_eZoneState) CheckForAwaking(); inherited::shedule_Update(dt); // check "fast-mode" border float cam_distance = Device.vCameraPosition.distance_to(P)-s.R; if (cam_distance>FASTMODE_DISTANCE && !m_zone_flags.test(eAlwaysFastmode) ) o_switch_2_slow (); else o_switch_2_fast (); if (!m_zone_flags.test(eFastMode)) UpdateWorkload (dt); }; UpdateOnOffState (); if( !IsGameTypeSingle() && Local() ) { if(Device.dwTimeGlobal > m_ttl) DestroyObject (); } }
// called only in "fast-mode" void CCustomZone::UpdateCL () { inherited::UpdateCL (); if (m_zone_flags.test(eFastMode)) UpdateWorkload (Device.dwTimeDelta); }