void CBulletManager::Load () { m_fTracerWidth = pSettings->r_float(BULLET_MANAGER_SECTION, "tracer_width"); m_fTracerLengthMax = pSettings->r_float(BULLET_MANAGER_SECTION, "tracer_length_max"); m_fTracerLengthMin = pSettings->r_float(BULLET_MANAGER_SECTION, "tracer_length_min"); m_fGravityConst = pSettings->r_float(BULLET_MANAGER_SECTION, "gravity_const"); m_fAirResistanceK = pSettings->r_float(BULLET_MANAGER_SECTION, "air_resistance_k"); m_dwStepTime = pSettings->r_u32 (BULLET_MANAGER_SECTION, "time_step"); m_fMinBulletSpeed = pSettings->r_float(BULLET_MANAGER_SECTION, "min_bullet_speed"); m_fCollisionEnergyMin = pSettings->r_float(BULLET_MANAGER_SECTION, "collision_energy_min"); m_fCollisionEnergyMax = pSettings->r_float(BULLET_MANAGER_SECTION, "collision_energy_max"); m_fHPMaxDist = pSettings->r_float(BULLET_MANAGER_SECTION, "hit_probability_max_dist"); LPCSTR whine_sounds = pSettings->r_string(BULLET_MANAGER_SECTION, "whine_sounds"); int cnt = _GetItemCount(whine_sounds); xr_string tmp; for (int k=0; k<cnt; ++k){ m_WhineSounds.push_back (ref_sound()); m_WhineSounds.back().create(_GetItem(whine_sounds,k,tmp),st_Effect,sg_SourceType); } LPCSTR explode_particles= pSettings->r_string(BULLET_MANAGER_SECTION, "explode_particles"); cnt = _GetItemCount(explode_particles); for (int k=0; k<cnt; ++k) m_ExplodeParticles.push_back (_GetItem(explode_particles,k,tmp)); }
void duk_push_sphere_sound(duk_context* ctx, sound_t* sound) { ref_sound(sound); duk_push_object(ctx); duk_push_pointer(ctx, sound); duk_put_prop_string(ctx, -2, "\xFF" "ptr"); duk_push_c_function(ctx, js_Sound_finalize, DUK_VARARGS); duk_set_finalizer(ctx, -2); duk_push_c_function(ctx, js_Sound_toString, DUK_VARARGS); duk_put_prop_string(ctx, -2, "toString"); duk_push_c_function(ctx, js_Sound_isPlaying, DUK_VARARGS); duk_put_prop_string(ctx, -2, "isPlaying"); duk_push_c_function(ctx, js_Sound_isSeekable, DUK_VARARGS); duk_put_prop_string(ctx, -2, "isSeekable"); duk_push_c_function(ctx, js_Sound_getLength, DUK_VARARGS); duk_put_prop_string(ctx, -2, "getLength"); duk_push_c_function(ctx, js_Sound_getPan, DUK_VARARGS); duk_put_prop_string(ctx, -2, "getPan"); duk_push_c_function(ctx, js_Sound_getPitch, DUK_VARARGS); duk_put_prop_string(ctx, -2, "getPitch"); duk_push_c_function(ctx, js_Sound_getPosition, DUK_VARARGS); duk_put_prop_string(ctx, -2, "getPosition"); duk_push_c_function(ctx, js_Sound_getRepeat, DUK_VARARGS); duk_put_prop_string(ctx, -2, "getRepeat"); duk_push_c_function(ctx, js_Sound_getVolume, DUK_VARARGS); duk_put_prop_string(ctx, -2, "getVolume"); duk_push_c_function(ctx, js_Sound_setPan, DUK_VARARGS); duk_put_prop_string(ctx, -2, "setPan"); duk_push_c_function(ctx, js_Sound_setPitch, DUK_VARARGS); duk_put_prop_string(ctx, -2, "setPitch"); duk_push_c_function(ctx, js_Sound_setPosition, DUK_VARARGS); duk_put_prop_string(ctx, -2, "setPosition"); duk_push_c_function(ctx, js_Sound_setRepeat, DUK_VARARGS); duk_put_prop_string(ctx, -2, "setRepeat"); duk_push_c_function(ctx, js_Sound_setVolume, DUK_VARARGS); duk_put_prop_string(ctx, -2, "setVolume"); duk_push_c_function(ctx, js_Sound_pause, DUK_VARARGS); duk_put_prop_string(ctx, -2, "pause"); duk_push_c_function(ctx, js_Sound_play, DUK_VARARGS); duk_put_prop_string(ctx, -2, "play"); duk_push_c_function(ctx, js_Sound_reset, DUK_VARARGS); duk_put_prop_string(ctx, -2, "reset"); duk_push_c_function(ctx, js_Sound_stop, DUK_VARARGS); duk_put_prop_string(ctx, -2, "stop"); }
void CAI_Crow::SSound::Load (LPCSTR prefix) { string_path fn; if (FS.exist(fn,"$game_sounds$",prefix,".ogg")){ m_Sounds.push_back (ref_sound()); ::Sound->create (m_Sounds.back(),prefix,st_Effect,sg_SourceType); } for (int i=0; (i<MAX_SND_COUNT)&&(m_Sounds.size()<MAX_SND_COUNT); ++i){ string64 name; sprintf_s (name,"%s_%d",prefix,i); if (FS.exist(fn,"$game_sounds$",name,".ogg")){ m_Sounds.push_back(ref_sound()); ::Sound->create(m_Sounds.back(),name,st_Effect,sg_SourceType); } } R_ASSERT(m_Sounds.size()); }
sound_t* load_sound(const char* path, bool streaming) { sound_t* sound; if (!(sound = calloc(1, sizeof(sound_t)))) goto on_error; if (!(sound->path = strdup(path))) goto on_error; if (!reload_sound(sound)) goto on_error; return ref_sound(sound); on_error: if (sound != NULL) { free(sound->path); free(sound); } return NULL; }
void CActor::Load (LPCSTR section ) { // Msg ("Loading actor: %s",section); inherited::Load (section); material().Load (section); CInventoryOwner::Load (section); memory().Load (section); m_location_manager->Load (section); if (GameID() == GAME_SINGLE) OnDifficultyChanged (); ////////////////////////////////////////////////////////////////////////// ISpatial* self = smart_cast<ISpatial*> (this); if (self) { self->spatial.type |= STYPE_VISIBLEFORAI; self->spatial.type &= ~STYPE_REACTTOSOUND; } ////////////////////////////////////////////////////////////////////////// // m_PhysicMovementControl: General //m_PhysicMovementControl->SetParent (this); Fbox bb;Fvector vBOX_center,vBOX_size; // m_PhysicMovementControl: BOX vBOX_center= pSettings->r_fvector3 (section,"ph_box2_center" ); vBOX_size = pSettings->r_fvector3 (section,"ph_box2_size" ); bb.set (vBOX_center,vBOX_center); bb.grow(vBOX_size); character_physics_support()->movement()->SetBox (2,bb); // m_PhysicMovementControl: BOX vBOX_center= pSettings->r_fvector3 (section,"ph_box1_center" ); vBOX_size = pSettings->r_fvector3 (section,"ph_box1_size" ); bb.set (vBOX_center,vBOX_center); bb.grow(vBOX_size); character_physics_support()->movement()->SetBox (1,bb); // m_PhysicMovementControl: BOX vBOX_center= pSettings->r_fvector3 (section,"ph_box0_center" ); vBOX_size = pSettings->r_fvector3 (section,"ph_box0_size" ); bb.set (vBOX_center,vBOX_center); bb.grow(vBOX_size); character_physics_support()->movement()->SetBox (0,bb); //// m_PhysicMovementControl: Foots //Fvector vFOOT_center= pSettings->r_fvector3 (section,"ph_foot_center" ); //Fvector vFOOT_size = pSettings->r_fvector3 (section,"ph_foot_size" ); //bb.set (vFOOT_center,vFOOT_center); bb.grow(vFOOT_size); ////m_PhysicMovementControl->SetFoots (vFOOT_center,vFOOT_size); // m_PhysicMovementControl: Crash speed and mass float cs_min = pSettings->r_float (section,"ph_crash_speed_min" ); float cs_max = pSettings->r_float (section,"ph_crash_speed_max" ); float mass = pSettings->r_float (section,"ph_mass" ); character_physics_support()->movement()->SetCrashSpeeds (cs_min,cs_max); character_physics_support()->movement()->SetMass (mass); if(pSettings->line_exist(section,"stalker_restrictor_radius")) character_physics_support()->movement()->SetActorRestrictorRadius(CPHCharacter::rtStalker,pSettings->r_float(section,"stalker_restrictor_radius")); if(pSettings->line_exist(section,"stalker_small_restrictor_radius")) character_physics_support()->movement()->SetActorRestrictorRadius(CPHCharacter::rtStalkerSmall,pSettings->r_float(section,"stalker_small_restrictor_radius")); if(pSettings->line_exist(section,"medium_monster_restrictor_radius")) character_physics_support()->movement()->SetActorRestrictorRadius(CPHCharacter::rtMonsterMedium,pSettings->r_float(section,"medium_monster_restrictor_radius")); character_physics_support()->movement()->Load(section); m_fWalkAccel = pSettings->r_float(section,"walk_accel"); m_fJumpSpeed = pSettings->r_float(section,"jump_speed"); m_fRunFactor = pSettings->r_float(section,"run_coef"); m_fRunBackFactor = pSettings->r_float(section,"run_back_coef"); m_fWalkBackFactor = pSettings->r_float(section,"walk_back_coef"); m_fCrouchFactor = pSettings->r_float(section,"crouch_coef"); m_fClimbFactor = pSettings->r_float(section,"climb_coef"); m_fSprintFactor = pSettings->r_float(section,"sprint_koef"); m_fWalk_StrafeFactor = READ_IF_EXISTS(pSettings, r_float, section, "walk_strafe_coef", 1.0f); m_fRun_StrafeFactor = READ_IF_EXISTS(pSettings, r_float, section, "run_strafe_coef", 1.0f); m_fCamHeightFactor = pSettings->r_float(section,"camera_height_factor"); character_physics_support()->movement() ->SetJumpUpVelocity(m_fJumpSpeed); float AirControlParam = pSettings->r_float (section,"air_control_param" ); character_physics_support()->movement() ->SetAirControlParam(AirControlParam); m_fPickupInfoRadius = pSettings->r_float(section,"pickup_info_radius"); m_fSleepTimeFactor = pSettings->r_float(section,"sleep_time_factor"); character_physics_support()->in_Load (section); //загрузить параметры эффектора // LoadShootingEffector ("shooting_effector"); LoadSleepEffector ("sleep_effector"); //загрузить параметры смещения firepoint m_vMissileOffset = pSettings->r_fvector3(section,"missile_throw_offset"); //Weapons = xr_new<CWeaponList> (this); if(!g_pGamePersistent->bDedicatedServer) { LPCSTR hit_snd_sect = pSettings->r_string(section,"hit_sounds"); for(int hit_type=0; hit_type<(int)ALife::eHitTypeMax; ++hit_type) { LPCSTR hit_name = ALife::g_cafHitType2String((ALife::EHitType)hit_type); LPCSTR hit_snds = pSettings->r_string(hit_snd_sect, hit_name); int cnt = _GetItemCount(hit_snds); string128 tmp; VERIFY (cnt!=0); for(int i=0; i<cnt;++i) { sndHit[hit_type].push_back (ref_sound()); sndHit[hit_type].back().create (_GetItem(hit_snds,i,tmp),st_Effect,sg_SourceType); } char buf[256]; ::Sound->create (sndDie[0], strconcat(buf,*cName(),"\\die0"), st_Effect,SOUND_TYPE_MONSTER_DYING); ::Sound->create (sndDie[1], strconcat(buf,*cName(),"\\die1"), st_Effect,SOUND_TYPE_MONSTER_DYING); ::Sound->create (sndDie[2], strconcat(buf,*cName(),"\\die2"), st_Effect,SOUND_TYPE_MONSTER_DYING); ::Sound->create (sndDie[3], strconcat(buf,*cName(),"\\die3"), st_Effect,SOUND_TYPE_MONSTER_DYING); m_HeavyBreathSnd.create (pSettings->r_string(section,"heavy_breath_snd"), st_Effect,SOUND_TYPE_MONSTER_INJURING); m_BloodSnd.create (pSettings->r_string(section,"heavy_blood_snd"), st_Effect,SOUND_TYPE_MONSTER_INJURING); } } if( psActorFlags.test(AF_PSP) ) cam_Set (eacLookAt); else cam_Set (eacFirstEye); // sheduler shedule.t_min = shedule.t_max = 1; // настройки дисперсии стрельбы m_fDispBase = pSettings->r_float (section,"disp_base" ); m_fDispBase = deg2rad(m_fDispBase); m_fDispAim = pSettings->r_float (section,"disp_aim" ); m_fDispAim = deg2rad(m_fDispAim); m_fDispVelFactor = pSettings->r_float (section,"disp_vel_factor" ); m_fDispAccelFactor = pSettings->r_float (section,"disp_accel_factor" ); m_fDispCrouchFactor = pSettings->r_float (section,"disp_crouch_factor"); m_fDispCrouchNoAccelFactor = pSettings->r_float (section,"disp_crouch_no_acc_factor"); LPCSTR default_outfit = READ_IF_EXISTS(pSettings,r_string,section,"default_outfit",0); SetDefaultVisualOutfit (default_outfit); invincibility_fire_shield_1st = READ_IF_EXISTS(pSettings,r_string,section,"Invincibility_Shield_1st",0); invincibility_fire_shield_3rd = READ_IF_EXISTS(pSettings,r_string,section,"Invincibility_Shield_3rd",0); //----------------------------------------- m_AutoPickUp_AABB = READ_IF_EXISTS(pSettings,r_fvector3,section,"AutoPickUp_AABB",Fvector().set(0.02f, 0.02f, 0.02f)); m_AutoPickUp_AABB_Offset = READ_IF_EXISTS(pSettings,r_fvector3,section,"AutoPickUp_AABB_offs",Fvector().set(0, 0, 0)); CStringTable string_table; m_sCharacterUseAction = "character_use"; m_sDeadCharacterUseAction = "dead_character_use"; m_sDeadCharacterUseOrDragAction = "dead_character_use_or_drag"; m_sCarCharacterUseAction = "car_character_use"; m_sInventoryItemUseAction = "inventory_item_use"; m_sInventoryBoxUseAction = "inventory_box_use"; //--------------------------------------------------------------------- m_sHeadShotParticle = READ_IF_EXISTS(pSettings,r_string,section,"HeadShotParticle",0); }
BOOL CLevel::Load_GameSpecific_After() { // loading static particles string_path fn_game; if (FS.exist(fn_game, "$level$", "level.ps_static")) { IReader *F = FS.r_open (fn_game); CParticlesObject* pStaticParticles; u32 chunk = 0; string256 ref_name; Fmatrix transform; Fvector zero_vel={0.f,0.f,0.f}; for (IReader *OBJ = F->open_chunk_iterator(chunk); OBJ; OBJ = F->open_chunk_iterator(chunk,OBJ)) { OBJ->r_stringZ (ref_name,sizeof(ref_name)); OBJ->r (&transform,sizeof(Fmatrix));transform.c.y+=0.01f; pStaticParticles = CParticlesObject::Create(ref_name,FALSE,false); pStaticParticles->UpdateParent (transform,zero_vel); pStaticParticles->Play (); m_StaticParticles.push_back (pStaticParticles); } FS.r_close (F); } if (!g_dedicated_server) { // loading static sounds VERIFY (m_level_sound_manager); m_level_sound_manager->Load (); // loading sound environment if ( FS.exist(fn_game, "$level$", "level.snd_env")) { IReader *F = FS.r_open (fn_game); ::Sound->set_geometry_env(F); FS.r_close (F); } // loading SOM if (FS.exist(fn_game, "$level$", "level.som")) { IReader *F = FS.r_open (fn_game); ::Sound->set_geometry_som(F); FS.r_close (F); } // loading random (around player) sounds if (pSettings->section_exist("sounds_random")){ CInifile::Sect& S = pSettings->r_section("sounds_random"); Sounds_Random.reserve (S.Data.size()); for (CInifile::SectCIt I=S.Data.begin(); S.Data.end()!=I; ++I) { Sounds_Random.push_back (ref_sound()); Sound->create (Sounds_Random.back(),*I->first,st_Effect,sg_SourceType); } Sounds_Random_dwNextTime= Device.TimerAsync () + 50000; Sounds_Random_Enabled = FALSE; } // Сбрасываем состояния дождя при загрузке уровня во избежание пропажи звука. Real Wolf. if (g_pGamePersistent->pEnvironment) { if (auto rain = g_pGamePersistent->pEnvironment->eff_Rain) { rain->InvalidateState(); } } } if (!g_dedicated_server) { // loading scripts ai().script_engine().remove_script_process(ScriptEngine::eScriptProcessorLevel); if (pLevel->section_exist("level_scripts") && pLevel->line_exist("level_scripts","script")) ai().script_engine().add_script_process(ScriptEngine::eScriptProcessorLevel,xr_new<CScriptProcess>("level",pLevel->r_string("level_scripts","script"))); else ai().script_engine().add_script_process(ScriptEngine::eScriptProcessorLevel,xr_new<CScriptProcess>("level","")); } BlockCheatLoad(); return TRUE; }