void add_blend (const shared_str &animation_id, const shared_str &animation_set_id, const shared_str &visual_id, const std::pair<LPCSTR,LPCSTR> *blend_id) { if (!blend_id) return; BLEND_ID query = std::make_pair( std::make_pair( animation_id, animation_set_id ), std::make_pair( shared_str(blend_id->first), shared_str(blend_id->second) ) ); BLEND_STATS::iterator I = g_blend_stats.find(query); if (I != g_blend_stats.end()) { ++((*I).second); return; } g_blend_stats.insert ( std::make_pair ( query, 1 ) ); }
void ETextureThumbnail::FillInfo(PropItemVec& items) { STextureParams& F = m_TexParams; PHelper().CreateCaption (items, "Format", get_token_name(tfmt_token,F.fmt)); PHelper().CreateCaption (items, "Type", get_token_name(ttype_token,F.type)); PHelper().CreateCaption (items, "Width", shared_str().sprintf("%d",_Width())); PHelper().CreateCaption (items, "Height", shared_str().sprintf("%d",_Height())); PHelper().CreateCaption (items, "Alpha", _Alpha()?"on":"off"); }
shared_str CInifile::r_string_wb(LPCSTR S, LPCSTR L) { LPCSTR _base = r_string(S,L); if (0==_base) return shared_str(0); string4096 _original; strcpy_s (_original,_base); u32 _len = xr_strlen(_original); if (0==_len) return shared_str(""); if ('"'==_original[_len-1]) _original[_len-1]=0; // skip end if ('"'==_original[0]) return shared_str(&_original[0] + 1); // skip begin return shared_str(_original); }
void __fastcall TfrmSoundLib::OnItemsFocused(ListItemsVec& items) { PropItemVec props; RegisterModifiedTHM (); m_Snd.destroy (); m_THM_Current.clear (); if (!items.empty()){ for (ListItemsIt it=items.begin(); it!=items.end(); it++){ ListItem* prop = *it; if (prop){ ESoundThumbnail* thm=FindUsedTHM(prop->Key()); if (!thm) m_THM_Used.push_back(thm=xr_new<ESoundThumbnail>(prop->Key())); m_THM_Current.push_back(thm); thm->FillProp (props); } } } ButtonValue* B=0; if (m_THM_Current.size()==1) { ESoundThumbnail* thm=m_THM_Current.back(); u32 size=0; u32 time=0; PlaySound(thm->SrcName(), size, time); CanvasValue* C=0; C=PHelper().CreateCanvas (props,"Attenuation", "", 64); C->tag = (int)this; C->OnDrawCanvasEvent.bind (this,&TfrmSoundLib::OnAttenuationDraw); // C->OnTestEqual.bind (this,&TfrmSoundLib::OnPointDataTestEqual); B=PHelper().CreateButton (props,"Auto Att", "By Min,By Max",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&TfrmSoundLib::OnAttClick); PHelper().CreateCaption (props,"File Length", shared_str().sprintf("%.2f Kb",float(size)/1024.f)); PHelper().CreateCaption (props,"Total Time", shared_str().sprintf("%.2f sec",float(time)/1000.f)); if (!m_Flags.is(flReadOnly)){ B=PHelper().CreateButton(props,"Control", "Play,Stop",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&TfrmSoundLib::OnControlClick); } } if (!m_Flags.is(flReadOnly)){ B=PHelper().CreateButton (props,"Auto Play", bAutoPlay?"on":"off",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&TfrmSoundLib::OnControl2Click); } m_ItemProps->AssignItems (props); }
shared_str clear_brackets(LPCSTR src) { if (0==src) return shared_str(0); if( NULL == strchr(src,'"') ) return shared_str(src); string512 _original; u32 _len = xr_strlen(strcpy(_original,src)); if (0==_len) return shared_str(""); if ('"'==_original[_len-1]) _original[_len-1]=0; // skip end if ('"'==_original[0]) return shared_str(&_original[0] + 1); // skip begin return shared_str(_original); }
shared_str victims_table::get_name_by_id (u8 id) const { size_t name_index = static_cast<size_t>(id); if (name_index > m_data.size()) return shared_str(); return m_data[name_index]; }
void CObjectHandler::OnItemTake (CInventoryItem *inventory_item) { inherited::OnItemTake (inventory_item); m_inventory_actual = false; planner().add_item (inventory_item); if (planner().object().g_Alive()) switch_torch (inventory_item,true); if (inventory_item->useful_for_NPC() && (inventory_item->object().cNameSect() == m_item_to_spawn)) { m_item_to_spawn = shared_str(); m_ammo_in_box_to_spawn = 0; } CWeapon *weapon = smart_cast<CWeapon*>(inventory_item); if (weapon) planner().object().weapon_shot_effector().Initialize( weapon->camMaxAngle, weapon->camRelaxSpeed_AI, weapon->camMaxAngleHorz, weapon->camStepAngleHorz, weapon->camDispertionFrac ); }
//------------------------------------------------------------------------------ void ESceneLightTools::FillProp(LPCSTR pref, PropItemVec& items) { ButtonValue* B = 0; // hemisphere //. PHelper().CreateRToken32(items, PrepareKey(pref,"Common\\Hemisphere\\Light Control"), &m_HemiControl, &*lcontrols.begin(), lcontrols.size()); // sun PHelper().CreateFlag32 (items, PrepareKey(pref,"Common\\Sun Shadow\\Visible"), &m_Flags, flShowSun); PHelper().CreateAngle (items, PrepareKey(pref,"Common\\Sun Shadow\\Altitude"), &m_SunShadowDir.x, -PI_DIV_2,0); PHelper().CreateAngle (items, PrepareKey(pref,"Common\\Sun Shadow\\Longitude"), &m_SunShadowDir.y, 0,PI_MUL_2); // light controls PHelper().CreateFlag32 (items, PrepareKey(pref,"Common\\Controls\\Draw Name"), &m_Flags, flShowControlName); PHelper().CreateCaption (items,PrepareKey(pref,"Common\\Controls\\Count"), shared_str().sprintf("%d",lcontrols.size())); // B=PHelper().CreateButton(items,PHelper().PrepareKey(pref,"Common\\Controls\\Edit"), "Append", ButtonValue::flFirstOnly); // B->OnBtnClickEvent = OnControlAppendClick; RTokenVecIt _I = lcontrols.begin(); RTokenVecIt _E = lcontrols.end(); for (;_I!=_E; _I++){ if (_I->equal(LCONTROL_HEMI)||_I->equal(LCONTROL_STATIC)||_I->equal(LCONTROL_SUN)){ PHelper().CreateCaption(items, PrepareKey(pref,"Common\\Controls\\System",*_I->name),""); }else{ B=PHelper().CreateButton(items, PrepareKey(pref,"Common\\Controls\\User",*_I->name),"Rename,Remove",ButtonValue::flFirstOnly); B->OnBtnClickEvent.bind (this,&ESceneLightTools::OnControlRenameRemoveClick); } } inherited::FillProp(pref, items); }
shared_str bone_table::get_name_by_id (s16 id) const { bone_table_t::const_iterator tmp_iter = std::find_if( m_data.begin(), m_data.end(), bone_id_searcher(id)); if (tmp_iter == m_data.end()) return shared_str(); return tmp_iter->first; }
void SSceneSummary::STextureInfo::FillProp (PropItemVec& items, LPCSTR main_pref, u32& mem_use) { if (file_name.size()){ int tex_mem = info.MemoryUsage(*file_name); mem_use += tex_mem; AnsiString pref = PrepareKey(AnsiString(main_pref).c_str(),*file_name).c_str(); PropValue* V=0; V=PHelper().CreateChoose(items,PrepareKey(pref.c_str(),"Texture"), &file_name, smTexture); V->Owner()->Enable(FALSE); PHelper().CreateCaption(items,PrepareKey(pref.c_str(),"Format"), info.FormatString()); PHelper().CreateCaption(items,PrepareKey(pref.c_str(),"Size"), shared_str().printf("%d x %d x %s",info.width,info.height,info.HasAlpha()?"32b":"24b")); PHelper().CreateCaption(items,PrepareKey(pref.c_str(),"Memory Usage"), shared_str().printf("%d Kb",iFloor(tex_mem/1024))); PHelper().CreateCaption(items,PrepareKey(pref.c_str(),"Effective Area"),shared_str().printf("%3.2f m^2",effective_area)); PHelper().CreateCaption(items,PrepareKey(pref.c_str(),"Pixel Density"), shared_str().printf("%3.2f p/m",_sqrt((pixel_area*info.width*info.height)/effective_area))); /* //. убрал из-за кол-ва > 4096 AnsiString tmp = "on demand"; for (objinf_map_it o_it=objects.begin(); o_it!=objects.end(); o_it++){ tmp += AnsiString().sprintf("%s%s[%d*%3.2f]",tmp.Length()?"; ":"",o_it->first.c_str(),o_it->second.ref_count,o_it->second.area); } PHelper().CreateCaption(items,PrepareKey(pref.c_str(),"Objects"), tmp.c_str()); */ if (info.flags.is_any(STextureParams::flDiffuseDetail|STextureParams::flBumpDetail)){ if (0!=info.detail_name.size()){ V=PHelper().CreateChoose(items,PrepareKey(pref.c_str(),"Detail Texture"), &info.detail_name,smTexture); V->Owner()->Enable(FALSE); PHelper().CreateCaption(items,PrepareKey(pref.c_str(), "Detail Scale"), shared_str().printf("%3.2f",info.detail_scale)); }else{ PHelper().CreateCaption(items,PrepareKey(pref.c_str(), "Detail Texture"), "INVALID"); ELog.Msg(mtError,"Empty details on texture: '%s'",*file_name); } } if (info.bump_mode==STextureParams::tbmUse){ if (0!=info.bump_name.size()){ V=PHelper().CreateChoose(items,PrepareKey(pref.c_str(),"Bump Texture"), &info.bump_name,smTexture); V->Owner()->Enable(FALSE); }else{ PHelper().CreateCaption(items,PrepareKey(pref.c_str(), "Bump Texture"), "INVALID"); ELog.Msg(mtError,"Empty bump on texture: '%s'",*file_name); } } ButtonValue* B = PHelper().CreateButton(items,PrepareKey(pref.c_str(),"Highlight Texture"), "Select,Density =,Density +,Clear", 0); B->OnBtnClickEvent.bind(this,&SSceneSummary::STextureInfo::OnHighlightClick); B->tag = (int)(*file_name); } }
void CMincer::Load (LPCSTR section) { inherited::Load(section); m_telekinetics.set_destroing_particles(shared_str(pSettings->r_string(section,"tearing_particles"))); m_telekinetics.set_throw_power(pSettings->r_float(section,"throw_out_impulse")); m_torn_particles=pSettings->r_string(section,"torn_particles"); m_tearing_sound.create(pSettings->r_string(section,"body_tearing_sound"),st_Effect,sg_SourceType); m_fActorBlowoutRadiusPercent=pSettings->r_float(section,"actor_blowout_radius_percent"); //pSettings->r_fvector3(section,whirlwind_center); }
void __fastcall TfrmSoundLib::OnControlClick(ButtonValue* V, bool& bModif, bool& bSafe) { switch (V->btn_num){ case 0: m_Snd.play(0,sm_2D); break; case 1: m_Snd.stop(); break; case 2:{ bAutoPlay=!bAutoPlay; V->value[V->btn_num] = shared_str().sprintf("Auto (%s)",bAutoPlay?"on":"off"); }break; } bModif = false; }
shared_str _ListToSequence(const RStringVec& lst) { xr_string out; if (lst.size()){ out = *lst.front(); for (RStringVec::const_iterator s_it=lst.begin()+1; s_it!=lst.end(); s_it++){ out += ","; out += **s_it; } } return shared_str (out.c_str()); }
void account_manager::search_for_email_raw(search_for_email_params_t const & email, found_email_cb found_email_cb) { VERIFY(!m_found_email_cb); m_found_email_cb = found_email_cb; GPResult tmp_res = m_gamespy_gp->ProfileSearch( shared_str(), shared_str(), email.m_t1.c_str(), &account_manager::search_profile_cb, this ); if (tmp_res != GP_NO_ERROR) { m_found_email_cb.clear(); found_email_cb(false, CGameSpy_GP::TryToTranslate(tmp_res).c_str()); return; } }
void CCustomPreferences::Load(CInifile* I) { psDeviceFlags.flags = R_U32_SAFE ("editor_prefs","device_flags", psDeviceFlags.flags); psSoundFlags.flags = R_U32_SAFE ("editor_prefs","sound_flags", psSoundFlags.flags) Tools->m_Settings.flags = R_U32_SAFE ("editor_prefs","tools_settings",Tools->m_Settings.flags); view_np = R_FLOAT_SAFE ("editor_prefs","view_np" ,view_np ); view_fp = R_FLOAT_SAFE ("editor_prefs","view_fp" ,view_fp ); view_fov = R_FLOAT_SAFE ("editor_prefs","view_fov" ,view_fov ); fog_color = R_U32_SAFE ("editor_prefs","fog_color" ,fog_color ); fog_fogness = R_FLOAT_SAFE ("editor_prefs","fog_fogness" ,fog_fogness ); cam_fly_speed = R_FLOAT_SAFE ("editor_prefs","cam_fly_speed" ,cam_fly_speed ); cam_fly_alt = R_FLOAT_SAFE ("editor_prefs","cam_fly_alt" ,cam_fly_alt ); cam_sens_rot = R_FLOAT_SAFE ("editor_prefs","cam_sens_rot" ,cam_sens_rot ); cam_sens_move = R_FLOAT_SAFE ("editor_prefs","cam_sens_move" ,cam_sens_move ); tools_sens_move = R_FLOAT_SAFE ("editor_prefs","tools_sens_move" ,tools_sens_move ); tools_sens_rot = R_FLOAT_SAFE ("editor_prefs","tools_sens_rot" ,tools_sens_rot ); tools_sens_scale = R_FLOAT_SAFE ("editor_prefs","tools_sens_scale" ,tools_sens_scale ); bp_lim_depth = R_BOOL_SAFE ("editor_prefs","bp_lim_depth" ,bp_lim_depth ); bp_cull = R_BOOL_SAFE ("editor_prefs","bp_lim_depth" ,bp_cull ); bp_depth_tolerance = R_FLOAT_SAFE ("editor_prefs","tools_sens_rot" ,bp_depth_tolerance ); snap_angle = R_FLOAT_SAFE ("editor_prefs","snap_angle" ,snap_angle ); snap_move = R_FLOAT_SAFE ("editor_prefs","snap_move" ,snap_move ); snap_moveto = R_FLOAT_SAFE ("editor_prefs","snap_moveto" ,snap_moveto ); grid_cell_size = R_FLOAT_SAFE ("editor_prefs","grid_cell_size" ,grid_cell_size ); grid_cell_count = R_U32_SAFE ("editor_prefs","grid_cell_count" ,grid_cell_count ); scene_undo_level = R_U32_SAFE ("editor_prefs","scene_undo_level" ,scene_undo_level ); scene_recent_count = R_U32_SAFE ("editor_prefs","scene_recent_count",scene_recent_count ); scene_clear_color = R_U32_SAFE ("editor_prefs","scene_clear_color" ,scene_clear_color ); object_flags.flags = R_U32_SAFE ("editor_prefs","object_flags" ,object_flags.flags ); // read recent list for (u32 i=0; i<scene_recent_count; i++){ shared_str fn = R_STRING_SAFE ("editor_prefs",AnsiString().sprintf("recent_files_%d",i).c_str(),shared_str("") ); if (fn.size()) scene_recent_list.push_back(*fn); } sWeather = R_STRING_SAFE ("editor_prefs", "weather", shared_str("") ); // load shortcuts LoadShortcuts (I); UI->LoadSettings (I); }
IC void CSpaceRestrictionManager::join_restrictions (shared_str &restrictions, shared_str update) { string4096 m_temp1; string4096 m_temp2; strcpy (m_temp2,*restrictions); for (u32 i=0, n=_GetItemCount(*update), count = xr_strlen(m_temp2); i<n; ++i) if (!restriction_presented(m_temp2,_GetItem(*update,i,m_temp1))) { if (count) strcat (m_temp2,","); strcat (m_temp2,m_temp1); ++count; } restrictions = shared_str(m_temp2); }
IC void CSpaceRestrictionManager::difference_restrictions (shared_str &restrictions, shared_str update) { string4096 m_temp1; string4096 m_temp2; strcpy (m_temp2,""); for (u32 i=0, n=_GetItemCount(*restrictions), count = 0; i<n; ++i) if (!restriction_presented(update,_GetItem(*restrictions,i,m_temp1))) { if (count) strcat (m_temp2,","); strcat (m_temp2,m_temp1); ++count; } restrictions = shared_str(m_temp2); }
void CSE_ALifeTraderAbstract::spawn_supplies () { CSE_ALifeDynamicObject *dynamic_object = smart_cast<CSE_ALifeDynamicObject*>(this); VERIFY (dynamic_object); CSE_Abstract *abstract = dynamic_object->alife().spawn_item("device_pda",base()->o_Position,dynamic_object->m_tNodeID,dynamic_object->m_tGraphID,base()->ID); CSE_ALifeItemPDA *pda = smart_cast<CSE_ALifeItemPDA*>(abstract); pda->m_original_owner = base()->ID; #ifdef XRGAME_EXPORTS character_profile (); m_SpecificCharacter = shared_str(); m_community_index = NO_COMMUNITY_INDEX; pda->m_specific_character = specific_character(); #endif if(m_SpecificCharacter.size()) { //если в custom data объекта есть //секция [dont_spawn_character_supplies] //то не вызывать spawn из selected_char.SupplySpawn() bool specific_character_supply = true; if (xr_strlen(dynamic_object->m_ini_string)) { #pragma warning(push) #pragma warning(disable:4238) CInifile ini( &IReader ( (void*)(*dynamic_object->m_ini_string), xr_strlen(dynamic_object->m_ini_string) ), FS.get_path("$game_config$")->m_Path ); #pragma warning(pop) if (ini.section_exist("dont_spawn_character_supplies")) specific_character_supply = false; } if(specific_character_supply) { CSpecificCharacter selected_char; selected_char.Load(m_SpecificCharacter); dynamic_object->spawn_supplies(selected_char.SupplySpawn()); } } }
shared_str game_sv_GameState::parse_level_version (const shared_str &server_options) { const char* map_ver = strstr(server_options.c_str(), map_ver_string); string128 result_version; if (map_ver) { map_ver += sizeof(map_ver_string); if (strchr(map_ver, '/')) strncpy_s(result_version, map_ver, strchr(map_ver, '/') - map_ver); else xr_strcpy(result_version, map_ver); } else { xr_strcpy(result_version, default_map_version); } return shared_str(result_version); }
void register_file_mapping(void* address, const u32& size, LPCSTR file_name) { FILE_MAPPINGS::const_iterator I = g_file_mappings.find(*(u32*)&address); VERIFY(I == g_file_mappings.end()); g_file_mappings.insert(std::make_pair(*(u32*)&address, std::make_pair(size, shared_str(file_name)))); // Msg ("++register_file_mapping(%2d): [0x%08x]%s", g_file_mapped_count + 1, *((u32*)&address), file_name); g_file_mapped_memory += size; ++g_file_mapped_count; #ifdef USE_MEMORY_MONITOR // memory_monitor::monitor_alloc (addres,size,"file mapping"); string512 temp; xr_sprintf(temp, sizeof(temp), "file mapping: %s", file_name); memory_monitor::monitor_alloc(address, size, temp); #endif // USE_MEMORY_MONITOR }
void statistics_collector::load_settings() { u32 file_count = m_wpn_collection->settings->line_count(CSV_SETTINGS); for (u32 i = 0; i != file_count; ++i) { LPCSTR key = NULL; LPCSTR value = NULL; if (m_wpn_collection->settings->r_line(CSV_SETTINGS, i, &key, &value) && key) { csv_files::iterator new_file_iter = m_all_params.insert( std::make_pair(shared_str(key), xr_new<params_collection>())).first; if (value) { get_string_collection(value, *new_file_iter->second); } } } }
shared_str const xr_dsa::sign (private_key_t const & priv_key, u8 const* data, u32 const data_size) { BN_bin2bn(priv_key.m_value, sizeof(priv_key.m_value), m_dsa->priv_key); unsigned int sign_size = DSA_size(m_dsa); u8* sign_dest = static_cast<u8*>( _alloca(sign_size)); BIGNUM tmp_sign_res_bn; BN_init (&tmp_sign_res_bn); DSA_sign (0, data, data_size, sign_dest, &sign_size, m_dsa); BN_bin2bn (sign_dest, sign_size, &tmp_sign_res_bn); return shared_str(BN_bn2hex(&tmp_sign_res_bn)); }
void UIPlayerItem::InitIconParams(CUIXml& uiXml) { VERIFY(m_player_node_root); int temp_number = uiXml.GetNodesNum(m_player_node_root, ICONPARAM_NODE_NAME); for (int i = 0; i < temp_number; ++i) { XML_NODE* icon_param_node = uiXml.NavigateToNode(ICONPARAM_NODE_NAME, i); if (!icon_param_node) break; LPCSTR param_name = uiXml.ReadAttrib(icon_param_node, "name", "param_name_not_set_in_name_attribute"); CUIStatic* temp_static = new CUIStatsIcon(); VERIFY(temp_static); this->AttachChild(temp_static); temp_static->SetAutoDelete(true); CUIXmlInit::InitStatic(uiXml, ICONPARAM_NODE_NAME, i, temp_static); m_icon_params.insert(std::make_pair(shared_str(param_name), temp_static)); } }
void AddOne (const char *split) { logCS.Enter (); #ifdef DEBUG OutputDebugString (split); OutputDebugString ("\n"); #endif // DUMP_PHASE; { shared_str temp = shared_str(split); // DUMP_PHASE; LogFile.push_back (temp); } //exec CallBack if (LogExecCB&&LogCB)LogCB(split); logCS.Leave (); }
void TfrmEditLightAnim::UpdateProperties() { // fill data PropItemVec items; if (m_CurrentItem){ PHelper().CreateName (items, "Name", &m_CurrentItem->cName, m_CurrentOwner); PHelper().CreateFloat (items, "FPS", &m_CurrentItem->fFPS, 0.1f,1000,1.f,1); S32Value* V; V=PHelper().CreateS32 (items, "Frame Count", &m_CurrentItem->iFrameCount,1,100000,1); V->OnAfterEditEvent.bind(this,&TfrmEditLightAnim::OnFrameCountAfterEdit); u32 frame = sePointer->Value; PHelper().CreateCaption (items, "Current\\Frame", shared_str().sprintf("%d",frame)); u32* val = m_CurrentItem->GetKey(sePointer->Value); if (val){ PHelper().CreateColor(items,"Current\\Color", val); PHelper().CreateU8 (items, "Current\\Alpha", ((u8*)val)+3, 0x00, 0xFF); } } m_Props->AssignItems (items); UpdateView (); }
void BattlEyeServer::KickPlayer( int player, char* reason ) { xrClientData* tmp_client = static_cast<xrClientData*>( Level().Server->GetClientByID(static_cast<ClientID>(player)) ); if (!tmp_client) { Msg( "! No such player found : %i", player ); return; } LPCSTR reason2; STRCONCAT( reason2, "@", tmp_client->ps->getName(), " ", CStringTable().translate("ui_st_kicked_by_battleye").c_str(), " ", reason ); Msg( reason2 ); if( g_be_message_out )// self { if ( Level().game ) { Level().game->CommonMessageOut( reason2 + 1 ); } } if (Level().Server->GetServerClient() == tmp_client) { // " Disconnecting : %s ! Server's Client kicked by BattlEye Server. Reason: %s", NET_Packet P; P.w_begin ( M_GAMEMESSAGE ); P.w_u32 ( GAME_EVENT_SERVER_DIALOG_MESSAGE ); P.w_stringZ ( reason2 ); Level().Server->SendBroadcast( tmp_client->ID, P ); // to all, except self Level().OnSessionTerminate( reason2 ); //to self Engine.Event.Defer("KERNEL:disconnect"); return; } Level().Server->AddCheater(shared_str(reason2), tmp_client->ID); }
void CKinematics::Load(const char* N, IReader *data, u32 dwFlags) { //Msg ("skeleton: %s",N); inherited::Load (N, data, dwFlags); pUserData = NULL; m_lod = NULL; // loading lods IReader* LD = data->open_chunk(OGF_S_LODS); if (LD) { string_path short_name; strcpy_s (short_name,sizeof(short_name),N); if (strext(short_name)) *strext(short_name)=0; // From stream { string_path lod_name; LD->r_string (lod_name, sizeof(lod_name)); //. strconcat (sizeof(name_load),name_load, short_name, ":lod:", lod_name.c_str()); m_lod = ::Render->model_CreateChild(lod_name, NULL); VERIFY3(m_lod,"Cant create LOD model for", N); //. VERIFY2 (m_lod->Type==MT_HIERRARHY || m_lod->Type==MT_PROGRESSIVE || m_lod->Type==MT_NORMAL,lod_name.c_str()); /* strconcat (name_load, short_name, ":lod:1"); m_lod = ::Render->model_CreateChild(name_load,LD); VERIFY (m_lod->Type==MT_SKELETON_GEOMDEF_PM || m_lod->Type==MT_SKELETON_GEOMDEF_ST); */ } LD->close (); } #ifndef _EDITOR // User data IReader* UD = data->open_chunk(OGF_S_USERDATA); pUserData = UD?xr_new<CInifile>(UD,FS.get_path("$game_config$")->m_Path):0; if (UD) UD->close(); #endif // Globals bone_map_N = xr_new<accel> (); bone_map_P = xr_new<accel> (); bones = xr_new<vecBones> (); bone_instances = NULL; // Load bones #pragma todo("container is created in stack!") xr_vector<shared_str> L_parents; R_ASSERT (data->find_chunk(OGF_S_BONE_NAMES)); visimask.zero (); int dwCount = data->r_u32(); // Msg ("!!! %d bones",dwCount); // if (dwCount >= 64) Msg ("!!! More than 64 bones is a crazy thing! (%d), %s",dwCount,N); VERIFY3 (dwCount < 64, "More than 64 bones is a crazy thing!",N); for (; dwCount; dwCount--) { string256 buf; // Bone u16 ID = u16(bones->size()); data->r_stringZ (buf,sizeof(buf)); strlwr(buf); CBoneData* pBone = CreateBoneData(ID); pBone->name = shared_str(buf); pBone->child_faces.resize (children.size()); bones->push_back (pBone); bone_map_N->push_back (mk_pair(pBone->name,ID)); bone_map_P->push_back (mk_pair(pBone->name,ID)); // It's parent data->r_stringZ (buf,sizeof(buf)); strlwr(buf); L_parents.push_back (buf); data->r (&pBone->obb,sizeof(Fobb)); visimask.set (u64(1)<<ID,TRUE); } std::sort (bone_map_N->begin(),bone_map_N->end(),pred_sort_N); std::sort (bone_map_P->begin(),bone_map_P->end(),pred_sort_P); // Attach bones to their parents iRoot = BI_NONE; for (u32 i=0; i<bones->size(); i++) { shared_str P = L_parents[i]; CBoneData* B = (*bones)[i]; if (!P||!P[0]) { // no parent - this is root bone R_ASSERT (BI_NONE==iRoot); iRoot = u16(i); B->SetParentID(BI_NONE); continue; } else { u16 ID = LL_BoneID(P); R_ASSERT (ID!=BI_NONE); (*bones)[ID]->children.push_back(B); B->SetParentID(ID); } } R_ASSERT (BI_NONE != iRoot); // Free parents L_parents.clear(); // IK data IReader* IKD = data->open_chunk(OGF_S_IKDATA); if (IKD){ for (u32 i=0; i<bones->size(); i++) { CBoneData* B = (*bones)[i]; u16 vers = (u16)IKD->r_u32(); IKD->r_stringZ (B->game_mtl_name); IKD->r (&B->shape,sizeof(SBoneShape)); B->IK_data.Import(*IKD,vers); Fvector vXYZ,vT; IKD->r_fvector3 (vXYZ); IKD->r_fvector3 (vT); B->bind_transform.setXYZi(vXYZ); B->bind_transform.translate_over(vT); B->mass = IKD->r_float(); IKD->r_fvector3 (B->center_of_mass); } // calculate model to bone converting matrix (*bones)[LL_GetBoneRoot()]->CalculateM2B(Fidentity); IKD->close(); } // after load process { for (u16 child_idx=0; child_idx<(u16)children.size(); child_idx++) LL_GetChild(child_idx)->AfterLoad (this,child_idx); } // unique bone faces { for (u32 bone_idx=0; bone_idx<bones->size(); bone_idx++) { CBoneData* B = (*bones)[bone_idx]; for (u32 child_idx=0; child_idx<children.size(); child_idx++){ CBoneData::FacesVec faces = B->child_faces[child_idx]; std::sort (faces.begin(),faces.end()); CBoneData::FacesVecIt new_end = std::unique(faces.begin(),faces.end()); faces.erase (new_end,faces.end()); B->child_faces[child_idx].clear_and_free(); B->child_faces[child_idx] = faces; } } } // reset update_callback Update_Callback = NULL; // reset update frame wm_frame = u32(-1); LL_Validate (); }
LPCSTR CScriptIniFile::update(LPCSTR file_name) { string_path S1; FS.update_path(S1, "$game_config$", file_name); return (*shared_str(S1)); }
void CInventoryOwner::reinit () { CAttachmentOwner::reinit (); m_item_to_spawn = shared_str(); m_ammo_in_box_to_spawn = 0; }
void CCustomObject::AnimationFillProp(LPCSTR pref, PropItemVec& items) { PropValue* V = PHelper().CreateFlag32(items,PrepareKey(pref,"Flags\\Motionable"),&m_CO_Flags, flMotion); V->OnChangeEvent.bind(this,&CCustomObject::OnMotionableChange); if (Motionable()){ PHelper().CreateCaption (items,PrepareKey(pref,"Motion\\Hint"), "Make KEY only on Parent CS"); ButtonValue* B = PHelper().CreateButton (items,PrepareKey(pref,"Motion\\Files"), "Import,Export", 0); B->OnBtnClickEvent.bind(this,&CCustomObject::OnMotionFilesClick); B = PHelper().CreateButton (items,PrepareKey(pref,"Motion\\Commands"), "+ K,- K,Scale,Norm,Clamp", 0); B->OnBtnClickEvent.bind(this,&CCustomObject::OnMotionCommandsClick); B = PHelper().CreateButton (items,PrepareKey(pref,"Motion\\Controls"), " |<<, +<<, <<, >, ||, >>, >>+, >>|", 0); B->OnBtnClickEvent.bind(this,&CCustomObject::OnMotionControlClick); PHelper().CreateFlag32 (items,PrepareKey(pref,"Motion\\Flags\\Auto Key"), &m_CO_Flags, flAutoKey); V = PHelper().CreateFlag32 (items,PrepareKey(pref,"Motion\\Flags\\Camera View"), &m_CO_Flags, flCameraView); V->OnChangeEvent.bind(this,&CCustomObject::OnMotionCameraViewChange); V = PHelper().CreateFloat (items,PrepareKey(pref,"Motion\\Start Frame (sec)"), &m_MotionParams->min_t, -10000.f, m_MotionParams->max_t, 1.f/30.f, 3); V->OnChangeEvent.bind(this,&CCustomObject::OnMotionFrameChange); V = PHelper().CreateFloat (items,PrepareKey(pref,"Motion\\End Frame (sec)"), &m_MotionParams->max_t, m_MotionParams->min_t, 10000.f, 1.f/30.f, 3); V->OnChangeEvent.bind(this,&CCustomObject::OnMotionFrameChange); V = PHelper().CreateFloat (items,PrepareKey(pref,"Motion\\Current Frame (sec)"), &m_MotionParams->t_current, -10000.f, 10000.f, 1.f/30.f, 3); V->OnChangeEvent.bind(this,&CCustomObject::OnMotionCurrentFrameChange); V = PHelper().CreateFloat (items,PrepareKey(pref,"Motion\\ChangeKeyTime(sec)"), &m_MotionParams->tmp, -10000.f, 10000.f, 1.f/30.f, 3); V->OnChangeEvent.bind(this,&CCustomObject::OnMotionKeyTimeChange); PHelper().CreateCaption (items,PrepareKey(pref,"Motion\\Key Count"), shared_str().sprintf("%d",m_Motion->KeyCount())); PHelper().CreateCaption (items,PrepareKey(pref,"Motion\\Length (sec)"), shared_str().sprintf("%3.2f",m_Motion->GetLength())); } }