DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл DayZPlayerCameraIronsights.c

См. исходные тексты.

Структуры данных

class  DayZPlayerCameraBase
 this is main camera class Подробнее...
 

Функции

void DayZPlayerCameraOptics (DayZPlayer pPlayer, HumanInputController pInput)
 
override void Init ()
 Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)
 
override EntityAI GetCurrentSightEntity ()
 
override bool GetCurrentSightInfo (out vector camPos, out vector camDir)
 
override void OnActivate (DayZPlayerCamera pPrevCamera, DayZPlayerCameraResult pPrevCameraResult)
 
override void AdjustCameraParameters (float pDt, inout DayZPlayerCameraResult pOutResult)
 
override float HoldBreathFOVEffect (float pDt)
 
override void SetCameraPP (bool state, DayZPlayerCamera launchedFrom)
 
override string GetCameraName ()
 
override void SetCameraPPDelay (DayZPlayerCamera pPrevCamera)
 
override void SendRecoilOffsetZ (float offset)
 

Переменные

class DayZPlayerCameraIronsights extends DayZPlayerCameraBase CONST_NEARPLANE_OPTICS = 0.06
 
float m_RecoilOffsetZ = 0.0
 

Функции

◆ AdjustCameraParameters()

override void AdjustCameraParameters ( float pDt,
inout DayZPlayerCameraResult pOutResult )
protected
412 {
413 pOutResult.m_iDirectBone = m_iBoneIndex;
414 pOutResult.m_iDirectBoneMode = 4;
415
416 pOutResult.m_fFovAbsolute = HoldBreathFOVEffect(pDt);
417
418 pOutResult.m_bUpdateWhenBlendOut = false;
419 pOutResult.m_fDistance = 0;
420 pOutResult.m_fUseHeading = 0;
421 pOutResult.m_fInsideCamera = 1.0;
422 pOutResult.m_fShootFromCamera = m_fShootFromCamera;
423
424 if (!m_opticsUsed)
426 else
427 pOutResult.m_fNearPlane = Math.Clamp(m_opticsUsed.GetNearPlaneValue() - m_RecoilOffsetZ, CONST_NEARPLANE_OPTICS, 10.0); //some sufficiently nonsensical max
428 }
int m_iBoneIndex
main bone
Definition DayZPlayerCamera1stPerson.c:189
ItemOptics m_opticsUsed
Definition DayZPlayerCamera_Base.c:74
override float HoldBreathFOVEffect(float pDt)
Definition DayZPlayerCameraIronsights.c:430
float m_RecoilOffsetZ
Definition DayZPlayerCameraIronsights.c:363
class DayZPlayerCameraIronsights extends DayZPlayerCameraBase CONST_NEARPLANE_OPTICS
float GetNearPlaneValue()
Definition ItemOptics.c:500
Definition EnMath.c:7
Definition EntityAI.c:95
float m_fShootFromCamera
1(default) - uses shoot from camera (+aiming sway), 0 pure weapon shoot (ironsights == 0)
Definition dayzplayer.c:71
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.

Перекрестные ссылки Math::Clamp(), CONST_NEARPLANE_OPTICS, ItemOptics::GetNearPlaneValue(), HoldBreathFOVEffect(), m_fShootFromCamera, m_iBoneIndex, m_opticsUsed и m_RecoilOffsetZ.

◆ DayZPlayerCameraOptics()

void DayZPlayerCameraOptics ( DayZPlayer pPlayer,
HumanInputController pInput )
protected
366 {
367 if (!temp_array)
368 temp_array = new array<float>;
370 }

Перекрестные ссылки m_fShootFromCamera.

Используется в ManBase::HideClothing(), ItemOptics::InitCameraOverrideProperties(), OnActivate() и DayZPlayerCameras::RegisterCameras().

◆ GetCameraName()

override string GetCameraName ( )
protected
577 {
578 return "DayZPlayerCameraOptics";
579 }

◆ GetCurrentSightEntity()

override EntityAI GetCurrentSightEntity ( )
protected
385 {
386 return m_opticsUsed;
387 }

Перекрестные ссылки m_opticsUsed.

Используется в HoldBreathFOVEffect().

◆ GetCurrentSightInfo()

override bool GetCurrentSightInfo ( out vector camPos,
out vector camDir )
protected
390 {
391 if (m_opticsUsed)
392 {
395 return true;
396 }
397 return false;
398 }
proto native bool UseWeaponIronsightsOverride(bool state)
switches into ironsights override settings
proto native void GetCameraPoint(out vector pos, out vector dir)
gets camera position & direction in model space of optics entity

Перекрестные ссылки ItemOptics::GetCameraPoint(), m_opticsUsed и ItemOptics::UseWeaponIronsightsOverride().

◆ HoldBreathFOVEffect()

override float HoldBreathFOVEffect ( float pDt)
protected
431 {
432 //hotfix; two cameras exist and update simultaneously during transition, even if optics/weapons is no longer present!
433 /*PlayerBase player = PlayerBase.Cast(m_pPlayer);
434 if (player && player.GetCurrentCamera() != this)
435 return 0.6;*/
436
438 if (optics)
439 {
440 if (optics.GetCurrentStepFOV() >= GameConstants.DZPLAYER_CAMERA_FOV_EYEZOOM && (m_pPlayer.IsHoldingBreath() || m_pPlayer.GetEyeZoomLevel()))
441 {
443 }
444 else if (m_isEntering) //sets FOV immediatelly to avoid "floating camera" effect
445 {
446 m_fFovAbsolute = optics.GetCurrentStepFOV();
447 m_isEntering = false;
448 }
449 else
450 {
451 m_fFovAbsolute = Math.SmoothCD(m_fFovAbsolute, optics.GetCurrentStepFOV(), m_fFovAbsVel, 0.1, 1000, pDt);
452 //m_fFovAbsolute = optics.GetCurrentStepFOV();
453 }
454 return m_fFovAbsolute;
455 }
456 else
457 {
458 //Error("optic camera, but there is no optic item or optic on weapon"); //camera update ticks on transitions as well, caused problems
459 return 0.6; //TODO figure some other way to get original FOV here!
460 }
461 }
float m_fFovAbsVel[1]
Definition DayZPlayerCamera_Base.c:572
override EntityAI GetCurrentSightEntity()
Definition DayZPlayerCameraIronsights.c:384
override int GetEyeZoomLevel()
Definition DayZPlayerImplement.c:291
Definition constants.c:638
Definition ItemOptics.c:2
DayZPlayer m_pPlayer
data
Definition dayzplayer.c:135
float m_fFovAbsolute
fov absolute value override - -1.0 default, if set - overrides absolute fov setting
Definition dayzplayer.c:60
const float DZPLAYER_CAMERA_FOV_EYEZOOM
FOV (vertical angle/2) in radians. Take care to modify also in "basicDefines.hpp".
Definition constants.c:932
static proto float SmoothCD(float val, float target, inout float velocity[], float smoothTime, float maxVelocity, float dt)
Does the CD smoothing function - easy in | easy out / S shaped smoothing.

Перекрестные ссылки GameConstants::DZPLAYER_CAMERA_FOV_EYEZOOM, GetCurrentSightEntity(), DayZPlayer::GetEyeZoomLevel(), m_fFovAbsolute, m_fFovAbsVel, m_pPlayer и Math::SmoothCD().

Используется в AdjustCameraParameters().

◆ Init()

override void Init ( )
protected

Launched from 'DayZGame.DeferredInit' to make earlier access, use, and updates impossible (downside of a non-static system)

pre-init arrays

373 {
375 {
376 SetCameraNV(true);
377 }
378 else
379 {
380 SetCameraNV(false);
381 }
382 }
void SetCameraNV(bool nightvision)
Definition DayZPlayerCamera_Base.c:401
bool IsWorking()
Definition ItemOptics.c:192
bool IsNVOptic()
Definition ItemOptics.c:427

Перекрестные ссылки ItemOptics::IsNVOptic(), ItemOptics::IsWorking(), m_opticsUsed и SetCameraNV().

Используется в DayZPlayerCameraBase() и DayZPlayerCameraBase::DayZPlayerCameraIronsights().

◆ OnActivate()

override void OnActivate ( DayZPlayerCamera pPrevCamera,
DayZPlayerCameraResult pPrevCameraResult )
protected
401 {
403
405 if (player && m_opticsUsed)
406 {
407 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(player.HideClothing,m_CameraPPDelay*1000,false,m_opticsUsed,true);
408 }
409 }
float m_CameraPPDelay
Definition DayZPlayerCamera_Base.c:576
Definition PlayerBaseClient.c:2
proto native CGame GetGame()
const int CALL_CATEGORY_GUI
Definition tools.c:9

Перекрестные ссылки CALL_CATEGORY_GUI, GetGame(), m_CameraPPDelay, m_opticsUsed и m_pPlayer.

◆ SendRecoilOffsetZ()

override void SendRecoilOffsetZ ( float offset)
protected
602 {
604 }

Перекрестные ссылки m_RecoilOffsetZ.

◆ SetCameraPP()

override void SetCameraPP ( bool state,
DayZPlayerCamera launchedFrom )
protected
464 {
465 //Print("SetCameraPP - optics");
466 if (PlayerBase.Cast(m_pPlayer) && launchedFrom.Type() != PlayerBase.Cast(m_pPlayer).GetCurrentPlayerCamera().Type())
467 {
468 //Print("DayZPlayerCameraOptics | SetCameraPP | skipping, wrong camera type active!");
469 return;
470 }
471
472 if (!state || !m_opticsUsed)
473 {
474 m_RequesterADS.Stop();
475
476 if (IsCameraNV())
477 {
479 }
480 else
481 {
483 }
484
485 if (m_weaponUsed)
486 {
487 m_weaponUsed.HideWeaponBarrel(false);
488 }
489 }
490 else
491 {
494 float gauss = 0.0;
495 temp_array = {false, 0.0, 0.0, 0.0, 0.0, 1.0};
496
497 // 1x scopes only
498 if (m_opticsUsed.AllowsDOF() && !NVGoggles.Cast(m_opticsUsed))
499 {
500 if (m_weaponUsed)
501 {
502 if (m_opticsUsed.GetOpticsDOF().Count() == 6)
503 {
504 temp_array = m_opticsUsed.GetOpticsDOF();
505 }
506 else
507 {
508 temp_array = m_weaponUsed.GetWeaponDOF(); //TODO should some optics have own DOF settings (different eye point)?
509 }
510
511 if (temp_array.Count() != 6)
512 temp_array = {false, 0.0, 0.0, 0.0, 0.0, 1.0};
513 }
514
515 m_RequesterADS.SetValuesIronsights(temp_array); //DOF only
516
517 // optics NV mode
519 {
520 SetCameraNV(true);
522 }
523 else
524 {
525 if (IsCameraNV())
526 {
528 }
529 else
530 {
532 }
533 }
534 }
535 else //magnifying scopes
536 {
537 // optics mask
539 {
541 }
542
543 //optics lens
545 {
547 }
548
549 //optics blur
550 if (m_opticsUsed.GetOpticsPPBlur() != 0)
551 {
553 }
554
555 m_RequesterADS.SetValuesOptics(mask_values,lens_values,gauss);
556
557 // optics NV mode
559 {
560 SetCameraNV(true);
562 }
563 else
564 {
565 SetNVPostprocess(NVTypes.NONE); //magnifying optics do not combine with other NV sources (would render NV optics obsolete)
566 }
567 }
568
569 if (m_weaponUsed)
570 {
571 m_weaponUsed.HideWeaponBarrel(true);
572 }
573 }
574 }
Weapon_Base m_weaponUsed
Definition DayZPlayerCamera_Base.c:73
NVTypes
Definition DayZPlayerCamera_Base.c:55
bool IsCameraNV()
Definition DayZPlayerCamera_Base.c:406
void SetNVPostprocess(int NVtype)
DayZPlayerCameraOptics handles this separately, otherwise it takes active NVType from PlayerBase::Get...
Definition DayZPlayerCamera_Base.c:477
int GetCameraNVType()
Definition DayZPlayerCamera_Base.c:416
int GetCurrentNVType()
Definition ItemOptics.c:432
ref array< float > GetOpticsPPLens()
Definition ItemOptics.c:491
float GetOpticsPPBlur()
Definition ItemOptics.c:495
bool AllowsDOF()
returns 'true' for non-magnifying optics
Definition ItemOptics.c:422
ref array< float > GetOpticsPPMask()
Definition ItemOptics.c:487
ref array< float > GetOpticsDOF()
Definition ItemOptics.c:483

Перекрестные ссылки ItemOptics::AllowsDOF(), GetCameraNVType(), ItemOptics::GetCurrentNVType(), ItemOptics::GetOpticsDOF(), ItemOptics::GetOpticsPPBlur(), ItemOptics::GetOpticsPPLens(), ItemOptics::GetOpticsPPMask(), IsCameraNV(), ItemOptics::IsNVOptic(), m_opticsUsed, m_pPlayer, m_weaponUsed, SetCameraNV() и SetNVPostprocess().

◆ SetCameraPPDelay()

override void SetCameraPPDelay ( DayZPlayerCamera pPrevCamera)
protected
582 {
583 if (pPrevCamera.GetCameraName() == "DayZPlayerCameraIronsights")
584 {
586 }
587 else if (pPrevCamera.GetCameraName() == "DayZPlayerCamera1stPerson")
588 {
589 m_CameraPPDelay = DayZPlayerCameras.TIME_CAMERACHANGE_02 - 0.05; //changed to accomodate handheld optics, had to be changed here also
590 }
591 else if (!pPrevCamera.IsCamera3rdRaised())
592 {
594 }
595 else
596 {
598 }
599 }
Definition DayZPlayerCameras.c:2
static const float TIME_CAMERACHANGE_02
Definition DayZPlayerCameras.c:28
static const float TIME_CAMERACHANGE_03
Definition DayZPlayerCameras.c:29

Перекрестные ссылки m_CameraPPDelay, DayZPlayerCameras::TIME_CAMERACHANGE_02 и DayZPlayerCameras::TIME_CAMERACHANGE_03.

Переменные

◆ CONST_NEARPLANE_OPTICS

class DayZPlayerCameraIronsights extends DayZPlayerCameraBase CONST_NEARPLANE_OPTICS = 0.06

Используется в AdjustCameraParameters().

◆ m_RecoilOffsetZ

float m_RecoilOffsetZ = 0.0
protected

Используется в AdjustCameraParameters() и SendRecoilOffsetZ().