void CWeaponPistol::Load (LPCSTR section) { inherited::Load (section); HUD_SOUND::LoadSound(section, "snd_close", sndClose, m_eSoundClose); animGet (mhud_pistol.mhud_empty, pSettings->r_string(*hud_sect, "anim_empty")); animGet (mhud_pistol.mhud_shot_l, pSettings->r_string(*hud_sect, "anim_shot_last")); animGet (mhud_pistol.mhud_close, pSettings->r_string(*hud_sect, "anim_close")); animGet (mhud_pistol.mhud_show_empty, pSettings->r_string(*hud_sect, "anim_draw_empty")); animGet (mhud_pistol.mhud_reload_empty, pSettings->r_string(*hud_sect, "anim_reload_empty")); string128 str; strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_empty"),"_r"); animGet (mhud_pistol_r.mhud_empty, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_shot_last"),"_r"); animGet (mhud_pistol_r.mhud_shot_l, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_close"),"_r"); animGet (mhud_pistol_r.mhud_close, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_draw_empty"),"_r"); animGet (mhud_pistol_r.mhud_show_empty, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_reload_empty"),"_r"); animGet (mhud_pistol_r.mhud_reload_empty, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_idle"),"_r"); animGet (wm_mhud_r.mhud_idle, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_reload"),"_r"); animGet (wm_mhud_r.mhud_reload, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_draw"),"_r"); animGet (wm_mhud_r.mhud_show, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_holster"),"_r"); animGet (wm_mhud_r.mhud_hide, str); strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_shoot"),"_r"); animGet (wm_mhud_r.mhud_shots, str); if(IsZoomEnabled()){ strconcat(sizeof(str),str,pSettings->r_string(*hud_sect, "anim_idle_aim"),"_r"); animGet (wm_mhud_r.mhud_idle_aim, str); } }
bool CWeapon::Action(u16 cmd, u32 flags) { if(inherited::Action(cmd, flags)) return true; switch(cmd) { case kWPN_FIRE: { //если оружие чем-то занято, то ничего не делать { if(IsPending()) return false; if(flags&CMD_START) FireStart (); else FireEnd (); }; } return true; case kWPN_NEXT: { return SwitchAmmoType(flags); } case kWPN_ZOOM: if(IsZoomEnabled()) { if(b_toggle_weapon_aim) { if(flags&CMD_START) { if(!IsZoomed()) { if(!IsPending()) { if(GetState()!=eIdle) SwitchState(eIdle); OnZoomIn (); } }else OnZoomOut (); } }else { if(flags&CMD_START) { if(!IsZoomed() && !IsPending()) { if(GetState()!=eIdle) SwitchState(eIdle); OnZoomIn (); } }else if(IsZoomed()) OnZoomOut (); } return true; }else return false; case kWPN_ZOOM_INC: case kWPN_ZOOM_DEC: if(IsZoomEnabled() && IsZoomed()) { if(cmd==kWPN_ZOOM_INC) ZoomInc(); else ZoomDec(); return true; }else return false; } return false; }
void CWeaponMagazined::InitAddons() { ////////////////////////////////////////////////////////////////////////// // Прицел m_fIronSightZoomFactor = READ_IF_EXISTS(pSettings, r_float, cNameSect(), "ironsight_zoom_factor", 50.0f); if (IsScopeAttached()) { if (m_eScopeStatus == ALife::eAddonAttachable) { m_sScopeName = pSettings->r_string(cNameSect(), "scope_name"); m_iScopeX = pSettings->r_s32(cNameSect(), "scope_x"); m_iScopeY = pSettings->r_s32(cNameSect(), "scope_y"); shared_str scope_tex_name; scope_tex_name = pSettings->r_string(*m_sScopeName, "scope_texture"); m_fScopeZoomFactor = pSettings->r_float(*m_sScopeName, "scope_zoom_factor"); if (m_UIScope) xr_delete(m_UIScope); m_UIScope = xr_new<CUIStaticItem>(); // m_UIScope->Init(*scope_tex_name, "hud\\default", 0, 0, alNone); m_UIScope->Init(*scope_tex_name, "hud\\scopes", 0, 0, alNone); // KD: special shader that account screen resolution } else if (m_eScopeStatus == ALife::eAddonPermanent) { m_fScopeZoomFactor = pSettings->r_float(cNameSect(), "scope_zoom_factor"); shared_str scope_tex_name; scope_tex_name = pSettings->r_string(cNameSect(), "scope_texture"); if (m_UIScope) xr_delete(m_UIScope); m_UIScope = xr_new<CUIStaticItem>(); // m_UIScope->Init(*scope_tex_name, "hud\\default", 0, 0, alNone); m_UIScope->Init(*scope_tex_name, "hud\\scopes", 0, 0, alNone); // KD: special shader that account screen resolution } } else { if (m_UIScope) xr_delete(m_UIScope); if (IsZoomEnabled()) m_fIronSightZoomFactor = pSettings->r_float(cNameSect(), "scope_zoom_factor"); } if (IsSilencerAttached() && SilencerAttachable()) { m_sFlameParticlesCurrent = m_sSilencerFlameParticles; m_sSmokeParticlesCurrent = m_sSilencerSmokeParticles; m_pSndShotCurrent = &sndSilencerShot; //сила выстрела LoadFireParams(*cNameSect(), ""); //подсветка от выстрела LoadLights(*cNameSect(), "silencer_"); ApplySilencerKoeffs(); } else { m_sFlameParticlesCurrent = m_sFlameParticles; m_sSmokeParticlesCurrent = m_sSmokeParticles; m_pSndShotCurrent = &sndShot; //сила выстрела LoadFireParams(*cNameSect(), ""); //подсветка от выстрела LoadLights(*cNameSect(), ""); } inherited::InitAddons(); }
void CWeaponMagazined::Load(LPCSTR section) { inherited::Load(section); // Sounds HUD_SOUND::LoadSound(section, "snd_draw", sndShow, m_eSoundShow); HUD_SOUND::LoadSound(section, "snd_holster", sndHide, m_eSoundHide); HUD_SOUND::LoadSound(section, "snd_shoot", sndShot, m_eSoundShot); HUD_SOUND::LoadSound(section, "snd_empty", sndEmptyClick, m_eSoundEmptyClick); HUD_SOUND::LoadSound(section, "snd_reload", sndReload, m_eSoundReload); HUD_SOUND::LoadSound(section, "snd_SightsUp", sndSightsUp, m_eSoundSightsUp); //added by Daemonion for ironsight audio in weapon parameters - sights being raised HUD_SOUND::LoadSound(section, "snd_SightsDown", sndSightsDown, m_eSoundSightsDown); //added by Daemonion for ironsight audio in weapon parameters - sights being lowered m_pSndShotCurrent = &sndShot; // HUD :: Anims R_ASSERT(m_pHUD); animGet(mhud.mhud_idle, pSettings->r_string(*hud_sect, "anim_idle")); animGet(mhud.mhud_reload, pSettings->r_string(*hud_sect, "anim_reload")); animGet(mhud.mhud_show, pSettings->r_string(*hud_sect, "anim_draw")); animGet(mhud.mhud_hide, pSettings->r_string(*hud_sect, "anim_holster")); animGet(mhud.mhud_shots, pSettings->r_string(*hud_sect, "anim_shoot")); if (pSettings->line_exist(*hud_sect, "anim_idle_sprint")) animGet(mhud.mhud_idle_sprint, pSettings->r_string(*hud_sect, "anim_idle_sprint")); if (IsZoomEnabled()) animGet(mhud.mhud_idle_aim, pSettings->r_string(*hud_sect, "anim_idle_aim")); //звуки и партиклы глушителя, еслит такой есть if (m_eSilencerStatus == ALife::eAddonAttachable) { if (pSettings->line_exist(section, "silencer_flame_particles")) m_sSilencerFlameParticles = pSettings->r_string(section, "silencer_flame_particles"); if (pSettings->line_exist(section, "silencer_smoke_particles")) m_sSilencerSmokeParticles = pSettings->r_string(section, "silencer_smoke_particles"); HUD_SOUND::LoadSound(section, "snd_silncer_shot", sndSilencerShot, m_eSoundShot); } // [7/20/2005] if (pSettings->line_exist(section, "dispersion_start")) m_iShootEffectorStart = pSettings->r_u8(section, "dispersion_start"); else m_iShootEffectorStart = 0; // [7/20/2005] // [7/21/2005] if (pSettings->line_exist(section, "fire_modes")) { m_bHasDifferentFireModes = true; shared_str FireModesList = pSettings->r_string(section, "fire_modes"); int ModesCount = _GetItemCount(FireModesList.c_str()); m_aFireModes.clear(); for (int i = 0; i < ModesCount; i++) { string16 sItem; _GetItem(FireModesList.c_str(), i, sItem); int FireMode = atoi(sItem); m_aFireModes.push_back(FireMode); } m_iCurFireMode = ModesCount - 1; m_iPrefferedFireMode = READ_IF_EXISTS(pSettings, r_s16, section, "preffered_fire_mode", -1); } else m_bHasDifferentFireModes = false; // [7/21/2005] }