void CStringTable::Load (LPCSTR xml_file) { CUIXml uiXml; string_path xml_file_full; strconcat (sizeof(xml_file_full),xml_file_full, xml_file, ".xml"); string_path _s; strconcat (sizeof(_s),_s, STRING_TABLE_PATH, "\\", *(pData->m_sLanguage) ); bool xml_result = uiXml.Init(CONFIG_PATH, _s, xml_file_full); if(!xml_result) Debug.fatal(DEBUG_INFO,"string table xml file not found %s, for language %s", xml_file_full, *(pData->m_sLanguage)); //общий список всех записей таблицы в файле int string_num = uiXml.GetNodesNum (uiXml.GetRoot(), "string"); for(int i=0; i<string_num; ++i) { LPCSTR string_name = uiXml.ReadAttrib(uiXml.GetRoot(), "string", i, "id", NULL); VERIFY3 (pData->m_StringTable.find(string_name) == pData->m_StringTable.end(), "duplicate string table id", string_name); LPCSTR string_text = uiXml.Read(uiXml.GetRoot(), "string:text", i, NULL); if(m_bWriteErrorsToLog && string_text) Msg("[string table] '%s' no translation in '%s'", string_name, *(pData->m_sLanguage)); VERIFY3 (string_text, "string table entry does not has a text", string_name); STRING_VALUE str_val = ParseLine(string_text, string_name, true); pData->m_StringTable[string_name] = str_val; } }
void CSE_ALifeOnlineOfflineGroup::try_switch_offline () { if (m_members.empty()) return; if (!can_switch_offline()) return; if (!can_switch_online()) { alife().switch_offline (this); return; } MEMBERS::iterator I = m_members.begin(); MEMBERS::iterator E = m_members.end(); for ( ; I != E; ++I) { VERIFY3 ((*I).second->g_Alive(),"Incorrect situation : some of the OnlineOffline group members is dead",(*I).second->name_replace()); VERIFY3 ((*I).second->can_switch_offline(),"Incorrect situation : some of the OnlineOffline group members cannot be switched online due to their personal properties",(*I).second->name_replace()); VERIFY3 ((*I).second->can_switch_online(),"Incorrect situation : some of the OnlineOffline group members cannot be switched online due to their personal properties",(*I).second->name_replace()); if (alife().graph().actor()->o_Position.distance_to((*I).second->o_Position) <= alife().offline_distance()) return; } alife().switch_offline (this); }
void CPurchaseList::process (const CGameObject &owner, const shared_str &name, const u32 &count, const float &probability) { VERIFY3 (count,"Invalid count for section in the purchase list",*name); VERIFY3 (!fis_zero(probability,EPS_S),"Invalid probability for section in the purchase list",*name); const Fvector &position = owner.Position(); const u32 &level_vertex_id = owner.ai_location().level_vertex_id(); const ALife::_OBJECT_ID &id = owner.ID(); CRandom random((u32)(CPU::QPC() & u32(-1))); u32 j = 0; for (u32 i=0; i<count; ++i) { if (random.randF() > probability) continue; ++j; Level().spawn_item (*name,position,level_vertex_id,id,false); } DEFICITS::const_iterator I = m_deficits.find(name); VERIFY3 (I == m_deficits.end(),"Duplicate section in the purchase list",*name); m_deficits.insert ( std::make_pair( name, (float)count*probability / _max((float)j,min_deficit_factor) ) ); }
void CPHSkeleton::UnsplitSingle(CPHSkeleton* SO) { //Msg("%o,received has %d,",this,m_unsplited_shels.size()); if (0==m_unsplited_shels.size()) return; //. hack CPhysicsShellHolder* obj = PPhysicsShellHolder(); CPhysicsShellHolder* O =SO->PPhysicsShellHolder(); VERIFY2(m_unsplited_shels.size(),"NO_SHELLS !!"); VERIFY2(!O->m_pPhysicsShell,"this has shell already!!!"); CPhysicsShell* newPhysicsShell=m_unsplited_shels.front().first; O->m_pPhysicsShell=newPhysicsShell; VERIFY(_valid(newPhysicsShell->mXFORM)); IKinematics *newKinematics=smart_cast<IKinematics*>(O->Visual()); IKinematics *pKinematics =smart_cast<IKinematics*>(obj->Visual()); Flags64 mask0,mask1; u16 split_bone=m_unsplited_shels.front().second; mask1.assign(pKinematics->LL_GetBonesVisible());//source bones mask pKinematics->LL_SetBoneVisible(split_bone,FALSE,TRUE); pKinematics->CalculateBones_Invalidate (); pKinematics->CalculateBones (TRUE); mask0.assign(pKinematics->LL_GetBonesVisible());//first part mask VERIFY2(mask0.flags,"mask0 -Zero"); mask0.invert(); mask1.and(mask0.flags);//second part mask newKinematics->LL_SetBoneRoot (split_bone); VERIFY2(mask1.flags,"mask1 -Zero"); newKinematics->LL_SetBonesVisible (mask1.flags); newKinematics->CalculateBones_Invalidate (); newKinematics->CalculateBones (TRUE); newPhysicsShell->set_Kinematics(newKinematics); VERIFY(_valid(newPhysicsShell->mXFORM)); newPhysicsShell->ResetCallbacks(split_bone,mask1); VERIFY(_valid(newPhysicsShell->mXFORM)); newPhysicsShell->ObjectInRoot().identity(); if(!newPhysicsShell->isEnabled())O->processing_deactivate(); newPhysicsShell->set_PhysicsRefObject(O); m_unsplited_shels.erase(m_unsplited_shels.begin()); O->setVisible(TRUE); O->setEnabled(TRUE); SO->CopySpawnInit (); CopySpawnInit (); VERIFY3(CheckObjectSize(pKinematics),*(O->cNameVisual()),"Object unsplit whith no size"); VERIFY3(CheckObjectSize(newKinematics),*(O->cNameVisual()),"Object unsplit whith no size"); }
bool CEditableObject::SaveObject(const char* fname) { if (IsModified()){ // update transform matrix Fmatrix mTransform,mScale,mTranslate,mRotate; if (!fsimilar(t_vRotate.magnitude(),0)||!fsimilar(t_vScale.magnitude(),1.73205f)||!fsimilar(t_vPosition.magnitude(),0)){ mRotate.setHPB (t_vRotate.y, t_vRotate.x, t_vRotate.z); mScale.scale (t_vScale); mTranslate.translate (t_vPosition); mTransform.mul (mTranslate,mRotate); mTransform.mulB_43 (mScale); TranslateToWorld (mTransform); t_vRotate.set (0,0,0); t_vPosition.set (0,0,0); t_vScale.set (1,1,1); } } // save object IWriter* F = FS.w_open(fname); if (F){ F->open_chunk (EOBJ_CHUNK_OBJECT_BODY); Save (*F); F->close_chunk (); FS.w_close (F); m_LoadName = fname; m_ObjectVersion = FS.get_file_age(fname); VERIFY3(m_ObjectVersion>0,"Invalid file age:",fname); return true; }else{ return false; } }
BOOL CObject::net_Spawn (CSE_Abstract* data) { PositionStack.clear (); VERIFY (_valid(renderable.xform)); if (0==Visual() && pSettings->line_exist( cNameSect(), "visual" ) ) cNameVisual_set (pSettings->r_string( cNameSect(), "visual" ) ); if (0==collidable.model) { if (pSettings->line_exist(cNameSect(),"cform")) { //LPCSTR cf = pSettings->r_string (*cNameSect(), "cform"); VERIFY3 (*NameVisual, "Model isn't assigned for object, but cform requisted",*cName()); collidable.model = xr_new<CCF_Skeleton> (this); } } R_ASSERT(spatial.space); spatial_register(); if (register_schedule()) shedule_register (); // reinitialize flags //. Props.bActiveCounter = 0; processing_activate (); setDestroy (false); MakeMeCrow (); return TRUE ; }
CSquadHierarchyHolder &CTeamHierarchyHolder::squad (u32 squad_id) const { VERIFY3 (squad_id < max_squad_count,"Squad id is invalid : ",*SeniorityHierarchy::to_string(squad_id)); if (!m_squads[squad_id]) m_squads[squad_id] = new CSquadHierarchyHolder(const_cast<CTeamHierarchyHolder*>(this)); return (*m_squads[squad_id]); }
void CSpaceRestrictionShape::build_border () { m_border.clear (); CCF_Shape *shape = smart_cast<CCF_Shape*>(m_restrictor->collidable.model); VERIFY (shape); xr_vector<CCF_Shape::shape_def>::const_iterator I = shape->Shapes().begin(); xr_vector<CCF_Shape::shape_def>::const_iterator E = shape->Shapes().end(); for ( ; I != E; ++I) fill_shape (*I); { m_border.erase ( std::remove_if( m_border.begin(), m_border.end(), CBorderMergePredicate(this) ), m_border.end() ); } process_borders (); VERIFY3 (!border().empty(),"space restrictor has no border",*m_restrictor->cName()); #ifdef DEBUG test_correctness (); #endif }
void CPatrolPathStorage::load_raw (const CLevelGraph *level_graph, const CGameLevelCrossTable *cross, const CGameGraph *game_graph, IReader &stream) { IReader *chunk = stream.open_chunk(WAY_PATROLPATH_CHUNK); if (!chunk) return; u32 chunk_iterator; for (IReader *sub_chunk = chunk->open_chunk_iterator(chunk_iterator); sub_chunk; sub_chunk = chunk->open_chunk_iterator(chunk_iterator,sub_chunk)) { R_ASSERT (sub_chunk->find_chunk(WAYOBJECT_CHUNK_VERSION)); R_ASSERT (sub_chunk->r_u16() == WAYOBJECT_VERSION); R_ASSERT (sub_chunk->find_chunk(WAYOBJECT_CHUNK_NAME)); shared_str patrol_name; sub_chunk->r_stringZ (patrol_name); const_iterator I = m_registry.find(patrol_name); VERIFY3 (I == m_registry.end(),"Duplicated patrol path found",*patrol_name); m_registry.insert ( std::make_pair( patrol_name, &xr_new<CPatrolPath>( patrol_name )->load_raw( level_graph, cross, game_graph, *sub_chunk ) ) ); } chunk->close (); }
XRCORE_API CLASS_ID __stdcall TEXT2CLSID(LPCSTR text) { VERIFY3(xr_strlen(text)<=8,"Beer from creator CLASS_ID:",text); char buf[9]; buf[8] = 0; strncpy_s(buf,sizeof(buf),text,8); size_t need = 8-xr_strlen(buf); while (need) { buf[8-need]=' '; need--; } return MK_CLSID(buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7]); }
float CPersonalMaxHealth::ffGetValue() { CSE_ALifeMonsterAbstract *l_tpALifeMonsterAbstract = smart_cast<CSE_ALifeMonsterAbstract*>(ef_storage().alife().member()); VERIFY3 (l_tpALifeMonsterAbstract,"Invalid object passed to the evaluation function ",m_caName); const CSE_ALifeGroupAbstract *l_tpALifeGroupAbstract = smart_cast<const CSE_ALifeGroupAbstract*>(ef_storage().alife().member()); if (!l_tpALifeGroupAbstract) return (l_tpALifeMonsterAbstract->m_fMaxHealthValue); else return (l_tpALifeMonsterAbstract->m_fMaxHealthValue*l_tpALifeGroupAbstract->m_wCount); }
float CPersonalMoraleFunction::ffGetValue() { if (ef_storage().non_alife().member()) return(ef_storage().non_alife().member()->m_fMorale); else { const CSE_ALifeMonsterAbstract *l_tpALifeMonsterAbstract = smart_cast<const CSE_ALifeMonsterAbstract*>(ef_storage().alife().member()); VERIFY3 (l_tpALifeMonsterAbstract,"Invalid object passed to the evaluation function ",m_caName); return(l_tpALifeMonsterAbstract->m_fMorale); } }
u32 CRestrictions::GetGroupCount(const shared_str& group_name) const { VERIFY (m_bInited); const restr_item* res = find_restr_item(m_rank, group_name); VERIFY3 (res, "group has no restrictions for rank", GetRankName(m_rank).c_str()); return res->second; }
GameGraph::_GRAPH_ID CALifeSmartTerrainTask::game_vertex_id () const { if (m_game_vertex_id == GameGraph::_GRAPH_ID(-1)) { VERIFY3 (ai().game_graph().valid_vertex_id(patrol_point().game_vertex_id()),*m_patrol_path_name,*m_patrol_point->name()); return (patrol_point().game_vertex_id()); } else { VERIFY(ai().game_graph().valid_vertex_id(m_game_vertex_id)); return m_game_vertex_id; } }
u32 CALifeSmartTerrainTask::level_vertex_id () const { if (m_level_vertex_id == u32(-1)) { VERIFY3 (ai().game_graph().valid_vertex_id(patrol_point().game_vertex_id()),*m_patrol_path_name,*m_patrol_point->name()); return (patrol_point().level_vertex_id()); } else { VERIFY2(ai().game_graph().valid_vertex_id(m_game_vertex_id), make_string("Vertex [%d] is not valid!!!", m_game_vertex_id)); return m_level_vertex_id; } }
SAAParam &CControlAnimationBase::AA_GetParams(LPCSTR anim_name) { // искать текущую анимацию в AA_VECTOR MotionID motion = smart_cast<IKinematicsAnimated*>(m_object->Visual())->LL_MotionID(anim_name); for (AA_VECTOR_IT it = m_attack_anims.begin(); it != m_attack_anims.end(); it++) { if (it->motion == motion) return (*it); } VERIFY3(FALSE, "Error! No animation in AA_VECTOR! Animation = ", anim_name); return (*(m_attack_anims.begin())); }
u32 CRestrictions::GetItemCount(const shared_str& item_sect) const { VERIFY (m_bInited); const shared_str& group_name = GetItemGroup(item_sect); VERIFY3 (group_name.size(), "item has no group", item_sect.c_str()); const restr_item* res = find_restr_item(m_rank, group_name); VERIFY4 (res, "group has no restrictions for rank", group_name.c_str(), GetRankName(m_rank).c_str()); return res->second; }
float CPersonalHealthFunction::ffGetValue() { if (ef_storage().non_alife().member()) { m_fMaxResultValue = ef_storage().non_alife().member()->GetMaxHealth(); return(ef_storage().non_alife().member()->GetfHealth()); } else { const CSE_ALifeMonsterAbstract *l_tpALifeMonsterAbstract = smart_cast<const CSE_ALifeMonsterAbstract*>(ef_storage().alife().member()); VERIFY3 (l_tpALifeMonsterAbstract,"Invalid object passed to the evaluation function ",m_caName); m_fMaxResultValue = l_tpALifeMonsterAbstract->g_MaxHealth(); return(l_tpALifeMonsterAbstract->get_health()); } }
void CGameSpawnConstructor::add_story_object (ALife::_STORY_ID id, CSE_ALifeDynamicObject *object, LPCSTR level_name) { if (id == INVALID_STORY_ID) return; ALife::STORY_P_PAIR_IT I = m_story_objects.find(id); if (I != m_story_objects.end()) { Msg ("Object %s, story id %d",object->name_replace(),object->m_story_id); Msg ("Object %s, story id %d",(*I).second->name_replace(),(*I).second->m_story_id); VERIFY3 (I == m_story_objects.end(),"There are several objects which has the same unique story ID, level ",level_name); } m_story_objects.insert (std::make_pair(id,object)); }
void CSpaceRestrictionComposition::test_correctness() { m_correct = true; m_test_storage.clear (); { RESTRICTIONS::iterator I = m_restrictions.begin(); RESTRICTIONS::iterator E = m_restrictions.end(); for ( ; I != E; ++I) m_test_storage.insert (m_test_storage.end(),(*I)->object().m_test_storage.begin(),(*I)->object().m_test_storage.end()); } { std::sort (m_test_storage.begin(),m_test_storage.end()); m_test_storage.erase ( std::unique( m_test_storage.begin(), m_test_storage.end() ), m_test_storage.end() ); } if (m_test_storage.empty()) { m_correct = false; return; } xr_vector<u32> nodes; { RESTRICTIONS::iterator I = m_restrictions.begin(); RESTRICTIONS::iterator E = m_restrictions.end(); for ( ; I != E; ++I) { VERIFY3 (!(*I)->object().m_test_storage.empty(),"Restrictor has no border",*(*I)->object().name()); nodes.clear (); ai().level_graph().set_mask (border()); ai().graph_engine().search (ai().level_graph(), (*I)->object().m_test_storage.back(), (*I)->object().m_test_storage.back(), &nodes, GraphEngineSpace::CFlooder()); ai().level_graph().clear_mask (border()); if (nodes.size() == 65535) m_correct = true; else m_correct = (m_test_storage.size() <= nodes.size()); if (!m_correct) break; } } }
int verify_func(tree* my_tree, const int argc, int* num) { assert(my_tree); assert(num); assert(argc > 0); int i = 0; for (i = 0; i < FUNC_NUM; ++i) if (strcmp(WORD(my_tree), (math_funcs[i]).name) == 0) break; VERIFY2(i == FUNC_NUM, TREE_BAD, "FUNC OPTIMIZE VERIFY: No such function found [%s][%08x]", WORD(my_tree), my_tree); if (argc != (math_funcs[i]).argc) tree_dump_in_order(strlog, my_tree, ">>"); VERIFY3(argc != (math_funcs[i]).argc, TREE_BAD, "FUNC OPTIMIZE VERIFY: Argument cound doesn't match definition, got [%d], needed [%d], function [%s]", argc, (math_funcs[i]).argc, WORD(my_tree)); *num = i; return TREE_OK; }
void xrServer::verify_entity (const CSE_Abstract *entity) const { VERIFY(entity->m_wVersion!=0); if (entity->ID_Parent != 0xffff) { xrS_entities::const_iterator J = entities.find(entity->ID_Parent); VERIFY3 (J != entities.end(),"SERVER : Cannot find parent in the map",entity->name_replace()); VERIFY3 ((*J).second,"SERVER : Null entity object in the map",entity->name_replace()); VERIFY3 ((*J).first == (*J).second->ID,"SERVER : ID mismatch - map key doesn't correspond to the real entity ID",(*J).second->name_replace()); VERIFY3 (std::find((*J).second->children.begin(),(*J).second->children.end(),entity->ID) != (*J).second->children.end(),"SERVER : Parent/Children relationship mismatch - Object has parent, but corresponding parent doesn't have children",(*J).second->name_replace()); } xr_vector<u16>::const_iterator I = entity->children.begin(); xr_vector<u16>::const_iterator E = entity->children.end(); for ( ; I != E; ++I) { VERIFY3 (*I != 0xffff,"SERVER : Invalid entity children id - 0xffff",entity->name_replace()); xrS_entities::const_iterator J = entities.find(*I); VERIFY3 (J != entities.end(),"SERVER : Cannot find children in the map",entity->name_replace()); VERIFY3 ((*J).second,"SERVER : Null entity object in the map",entity->name_replace()); VERIFY3 ((*J).first == (*J).second->ID,"SERVER : ID mismatch - map key doesn't correspond to the real entity ID",(*J).second->name_replace()); VERIFY3 ((*J).second->ID_Parent == entity->ID,"SERVER : Parent/Children relationship mismatch - Object has children, but children doesn't have parent",(*J).second->name_replace()); } }
void CSpaceRestrictionComposition::check_restrictor_type() { if (_GetItemCount(*m_space_restrictors) == 1) return; if (!ai().get_alife()) return; CObject *object = Level().Objects.FindObjectByName(m_space_restrictors); if (!object) return; CSpaceRestrictor *restrictor = smart_cast<CSpaceRestrictor*>(object); VERIFY3 (restrictor,"you are trying to use object as a restrictor",*m_space_restrictors); VERIFY2 (restrictor->restrictor_type() == RestrictionSpace::eRestrictorTypeNone,"you are trying to restrict yourself with restrictor with type eRestrictorTypeNone"); VERIFY2 (restrictor->restrictor_type() != RestrictionSpace::eRestrictorTypeNone,"impossible situation: wrong net_Spawn branch used"); }
bool xrServer::verify_entities () const { if (!_ve_initialized) { _ve_initialized = TRUE; if (strstr(Core.Params,"-~ve")) _ve_use=FALSE; } if (!_ve_use) return true; xrS_entities::const_iterator I = entities.begin(); xrS_entities::const_iterator E = entities.end(); for ( ; I != E; ++I) { VERIFY2 ((*I).first != 0xffff,"SERVER : Invalid entity id as a map key - 0xffff"); VERIFY2 ((*I).second,"SERVER : Null entity object in the map"); VERIFY3 ((*I).first == (*I).second->ID,"SERVER : ID mismatch - map key doesn't correspond to the real entity ID",(*I).second->name_replace()); verify_entity ((*I).second); } return (true); }
bool CEditableObject::LoadObject(const char* fname) { if (FS.exist(fname)){ int age = FS.get_file_age (fname); VERIFY3(age>0,"Invalid file age:",fname); IReader* F = FS.r_open (fname); R_ASSERT(F); IReader* OBJ = F->open_chunk (EOBJ_CHUNK_OBJECT_BODY); R_ASSERT2 (OBJ,"Corrupted file."); bool bRes = Load(*OBJ); OBJ->close(); FS.r_close(F); if (bRes){ m_LoadName = fname; m_ObjectVersion = age; } return bRes; } return false; }
void CMonsterHome::load(LPCSTR line) { m_path = 0; m_radius_min = 20.f; m_radius_middle = 30.f; m_radius_max = 40.f; min_move_dist = u32(7); max_move_dist = u32(10); if (m_object->spawn_ini() && m_object->spawn_ini()->section_exist(line)) { m_path = ai().patrol_paths().path(m_object->spawn_ini()->r_string(line,"path")); check_path (m_object,m_path); if (m_object->spawn_ini()->line_exist(line,"radius_min")) m_radius_min = m_object->spawn_ini()->r_float(line,"radius_min"); if (m_object->spawn_ini()->line_exist(line,"radius_max")) m_radius_max = m_object->spawn_ini()->r_float(line,"radius_max"); VERIFY3(m_radius_max > m_radius_min, "Error: Wrong home point radius specified for monster ", *m_object->cName()); if (m_object->spawn_ini()->line_exist(line,"radius_middle")) { m_radius_middle = m_object->spawn_ini()->r_float(line,"radius_middle"); if (m_radius_middle > m_radius_max || m_radius_middle < m_radius_min) { m_radius_middle = m_radius_min + (m_radius_max - m_radius_min)/2; } } else { m_radius_middle = m_radius_min + (m_radius_max - m_radius_min)/2; } if (m_object->spawn_ini()->line_exist(line,"min_move_dist")) { min_move_dist = m_object->spawn_ini()->r_u32(line,"min_move_dist");; } if (m_object->spawn_ini()->line_exist(line,"max_move_dist")) { max_move_dist = m_object->spawn_ini()->r_u32(line,"max_move_dist");; } if (min_move_dist >= max_move_dist) { min_move_dist = u32(7); max_move_dist = u32(10); } } m_aggressive = false; }
void CRestrictions::AddGroup(LPCSTR group, LPCSTR lst) {// private VERIFY (m_bInited); VERIFY(m_goups.find(group) == m_goups.end()); group_items& _new = m_goups[group]; string256 singleItem; u32 count = _GetItemCount(lst); for (u32 j = 0; j < count; ++j) { _GetItem(lst, j, singleItem); #ifdef DEBUG const shared_str& _exist = GetItemGroup(singleItem); VERIFY3(_exist.size()==0, "item has duplicate record in groups", singleItem); #endif _new.push_back (singleItem); } }
void CPatrolPathStorage::load (IReader &stream) { IReader *chunk; chunk = stream.open_chunk(0); u32 size = chunk->r_u32(); chunk->close (); m_registry.clear (); PATROL_REGISTRY::value_type pair; chunk = stream.open_chunk(1); for (u32 i=0; i<size; ++i) { IReader *chunk1; chunk1 = chunk->open_chunk(i); IReader *chunk2; chunk2 = chunk1->open_chunk(0); load_data (pair.first,*chunk2); chunk2->close (); chunk2 = chunk1->open_chunk(1); load_data (pair.second,*chunk2); chunk2->close (); chunk1->close (); const_iterator I = m_registry.find(pair.first); VERIFY3 (I == m_registry.end(),"Duplicated patrol path found ",*pair.first); #ifdef DEBUG pair.second->name (pair.first); #endif m_registry.insert (pair); } chunk->close (); }
void CMaterialManager::update (float time_delta, float volume, float step_time, bool standing) { VERIFY (GAMEMTL_NONE_IDX != m_my_material_idx); VERIFY (GAMEMTL_NONE_IDX != m_last_material_idx); SGameMtlPair *mtl_pair = GMLib.GetMaterialPair(m_my_material_idx,m_last_material_idx); VERIFY3 (mtl_pair,"Undefined material pair: ", *GMLib.GetMaterialByIdx(m_last_material_idx)->m_Name); Fvector position = m_object->Position(); if(m_movement_control->CharacterExist()) { position.y += m_movement_control->FootRadius(); } // ref_sound step if (!standing) { if (m_time_to_step < 0) { SoundVec& snd_array = mtl_pair->StepSounds; if(m_run_mode && mtl_pair->BreakingSounds.size() >0) snd_array = mtl_pair->BreakingSounds; if (snd_array.size() >0){ m_step_id = ::Random.randI(0, snd_array.size()); m_time_to_step = step_time; m_step_sound[m_step_id] = snd_array[m_step_id]; m_step_sound[m_step_id].play_at_pos (m_object,position); } } m_time_to_step -= time_delta; } else m_time_to_step = 0; for(int i=0; i<4; i++) if (m_step_sound[i]._feedback()) { m_step_sound[i].set_position (position ); m_step_sound[i].set_volume (1.f * volume); } }
void CSpaceRestrictorWrapper::build_border () { typedef CShapeData::ShapeVec ShapeVec; ShapeVec::const_iterator I = object().shapes.begin(); ShapeVec::const_iterator E = object().shapes.end(); for ( ; I != E; ++I) fill_shape (*I); { BORDER::iterator I = std::remove_if(m_border.begin(),m_border.end(),border_merge_predicate(this,m_level_graph)); m_border.erase (I,m_border.end()); } { std::sort (m_border.begin(),m_border.end()); BORDER::iterator I = std::unique(m_border.begin(),m_border.end()); m_border.erase (I,m_border.end()); std::sort (m_border.begin(),m_border.end(),sort_by_xz_predicate(m_level_graph)); } VERIFY3 (!m_border.empty(),"space restrictor has no border",object().name_replace()); }