Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
dayzplayercameras.c
Go to the documentation of this file.
2 {
3  static const int DAYZCAMERA_1ST = 1;
4  static const int DAYZCAMERA_3RD_ERC = 2;
5  static const int DAYZCAMERA_3RD_ERC_SPR = 3;
6  static const int DAYZCAMERA_3RD_ERC_RAISED = 4;
7  static const int DAYZCAMERA_3RD_CRO = 5;
8  static const int DAYZCAMERA_3RD_CRO_RAISED = 6;
9  static const int DAYZCAMERA_3RD_PRO = 7;
10  static const int DAYZCAMERA_3RD_PRO_RAISED = 8;
11  static const int DAYZCAMERA_3RD_ERC_RAISED_MELEE = 9;
12  static const int DAYZCAMERA_IRONSIGHTS = 10;
13  static const int DAYZCAMERA_OPTICS = 11;
14  static const int DAYZCAMERA_1ST_UNCONSCIOUS = 12;
15  static const int DAYZCAMERA_3RD_JUMP = 13;
16  static const int DAYZCAMERA_3RD_CLIMB = 14;
17 
18  static const int DAYZCAMERA_1ST_VEHICLE = 30;
19  static const int DAYZCAMERA_3RD_VEHICLE = 31;
20 
21  static const int PERITEMUD_INVALID = -1;
22  static const int PERITEMUD_EMPTYHANDED = 20;
23  static const int PERITEMUD_ONEHANDED = 25;
24  static const int PERITEMUD_TWOHANDED = 30;
25 
26  // some times for camera changes
27  static const float TIME_CAMERACHANGE_01 = 0.1;
28  static const float TIME_CAMERACHANGE_02 = 0.2;
29  static const float TIME_CAMERACHANGE_03 = 0.3;
30 
31 
32  static ref map<int,float> m_TransitionTimes = new map<int,float>;
33 
34 
36  // temporary moved out of the
37  static void RegisterCameras(DayZPlayerType pType)
38  {
39  pType.ResetCameraCreators();
40 
45  pType.RegisterCameraCreator(DAYZCAMERA_1ST, DayZPlayerCamera1stPerson);
46  pType.RegisterCameraCreator(DAYZCAMERA_3RD_ERC, DayZPlayerCamera3rdPersonErc);
47  pType.RegisterCameraCreator(DAYZCAMERA_3RD_ERC_SPR, DayZPlayerCamera3rdPersonErcSpr);
48  pType.RegisterCameraCreator(DAYZCAMERA_3RD_ERC_RAISED, DayZPlayerCamera3rdPersonErcRaised);
49  pType.RegisterCameraCreator(DAYZCAMERA_3RD_CRO, DayZPlayerCamera3rdPersonCrouch);
50  pType.RegisterCameraCreator(DAYZCAMERA_3RD_CRO_RAISED, DayZPlayerCamera3rdPersonCrouchRaised);
51  pType.RegisterCameraCreator(DAYZCAMERA_3RD_PRO, DayZPlayerCamera3rdPersonProne);
52  pType.RegisterCameraCreator(DAYZCAMERA_3RD_PRO_RAISED, DayZPlayerCamera3rdPersonProneRaised);
53  pType.RegisterCameraCreator(DAYZCAMERA_IRONSIGHTS, DayZPlayerCameraIronsights);
54  pType.RegisterCameraCreator(DAYZCAMERA_OPTICS, DayZPlayerCameraOptics);
55  pType.RegisterCameraCreator(DAYZCAMERA_3RD_ERC_RAISED_MELEE, DayZPlayerCamera3rdPersonErcRaisedMelee);
56  pType.RegisterCameraCreator(DAYZCAMERA_1ST_UNCONSCIOUS, DayZPlayerCamera1stPersonUnconscious);
57  pType.RegisterCameraCreator(DAYZCAMERA_3RD_JUMP, DayZPlayerCamera3rdPersonJump);
58  pType.RegisterCameraCreator(DAYZCAMERA_3RD_CLIMB, DayZPlayerCamera3rdPersonClimb);
59 
60  pType.RegisterCameraCreator(DAYZCAMERA_1ST_VEHICLE, DayZPlayerCamera1stPersonVehicle);
61  pType.RegisterCameraCreator(DAYZCAMERA_3RD_VEHICLE, DayZPlayerCamera3rdPersonVehicle);
62 
63 
66  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_CRO, 0.4, false);
67  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_PRO, 0.8, false);
68  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_PRO_RAISED, 0.8, false);
69  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_ERC_RAISED, 0.2, false);
70  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_ERC_RAISED_MELEE, 0.2, false);
71  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_ERC_SPR, 0.6, false);
72  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_RAISED, DAYZCAMERA_3RD_ERC_SPR, 0.7, false);
73  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_RAISED, DAYZCAMERA_3RD_PRO_RAISED, 0.8, false);
74  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_SPR, DAYZCAMERA_3RD_ERC, 0.3, false);
75  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_SPR, DAYZCAMERA_3RD_CRO, 0.3, false);
76  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_SPR, DAYZCAMERA_3RD_PRO, 0.5, false);
77  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_SPR, DAYZCAMERA_3RD_ERC_RAISED, 0.3, false);
78  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_SPR, DAYZCAMERA_3RD_JUMP, 0.1, false);
79  RegisterTransitionTime(DAYZCAMERA_3RD_JUMP, DAYZCAMERA_3RD_ERC_SPR, 0.2, false);
80  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_JUMP, 0.05, false);
81  RegisterTransitionTime(DAYZCAMERA_3RD_JUMP, DAYZCAMERA_3RD_ERC, 0.3, false);
82  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_3RD_CLIMB, 0.3, false);
83  RegisterTransitionTime(DAYZCAMERA_3RD_CLIMB, DAYZCAMERA_3RD_ERC, 0.3, false);
84 
86  RegisterTransitionTime(DAYZCAMERA_3RD_CRO, DAYZCAMERA_3RD_ERC, 0.4, false);
87  RegisterTransitionTime(DAYZCAMERA_3RD_CRO, DAYZCAMERA_3RD_PRO, 0.6, true);
88  RegisterTransitionTime(DAYZCAMERA_3RD_CRO, DAYZCAMERA_3RD_CRO_RAISED, 0.2, true);
89  RegisterTransitionTime(DAYZCAMERA_3RD_CRO, DAYZCAMERA_3RD_ERC_SPR, 0.6, false);
90 
92  RegisterTransitionTime(DAYZCAMERA_3RD_PRO, DAYZCAMERA_3RD_ERC, 0.9, false);
93  RegisterTransitionTime(DAYZCAMERA_3RD_PRO, DAYZCAMERA_3RD_CRO, 0.7, false);
94  RegisterTransitionTime(DAYZCAMERA_3RD_PRO, DAYZCAMERA_3RD_PRO_RAISED, 0.2, false);
95  RegisterTransitionTime(DAYZCAMERA_3RD_PRO, DAYZCAMERA_3RD_ERC_SPR, 0.6, false);
96  RegisterTransitionTime(DAYZCAMERA_3RD_PRO_RAISED, DAYZCAMERA_3RD_CRO, 0.7, false);
97  RegisterTransitionTime(DAYZCAMERA_3RD_PRO_RAISED, DAYZCAMERA_3RD_CRO_RAISED, 0.7, false);
98  RegisterTransitionTime(DAYZCAMERA_3RD_PRO_RAISED, DAYZCAMERA_3RD_ERC, 0.9, false);
99  RegisterTransitionTime(DAYZCAMERA_3RD_PRO_RAISED, DAYZCAMERA_3RD_ERC_RAISED, 0.9, false);
100  RegisterTransitionTime(DAYZCAMERA_3RD_PRO_RAISED, DAYZCAMERA_3RD_ERC_RAISED_MELEE, 0.9, false);
101 
103  RegisterTransitionTime(DAYZCAMERA_3RD_VEHICLE, DAYZCAMERA_3RD_ERC, 0.7, false);
104 
106  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_RAISED, DAYZCAMERA_IRONSIGHTS, TIME_CAMERACHANGE_02, true);
107  RegisterTransitionTime(DAYZCAMERA_3RD_CRO_RAISED, DAYZCAMERA_IRONSIGHTS, TIME_CAMERACHANGE_02, true);
108  RegisterTransitionTime(DAYZCAMERA_3RD_PRO_RAISED, DAYZCAMERA_IRONSIGHTS, TIME_CAMERACHANGE_02, true);
109  RegisterTransitionTime(DAYZCAMERA_1ST, DAYZCAMERA_IRONSIGHTS, TIME_CAMERACHANGE_01, true);
110 
111  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_IRONSIGHTS, TIME_CAMERACHANGE_02, true);
112  RegisterTransitionTime(DAYZCAMERA_3RD_CRO, DAYZCAMERA_IRONSIGHTS, TIME_CAMERACHANGE_02, true);
113  RegisterTransitionTime(DAYZCAMERA_3RD_PRO, DAYZCAMERA_IRONSIGHTS, TIME_CAMERACHANGE_02, true);
114 
116  RegisterTransitionTime(DAYZCAMERA_IRONSIGHTS, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_02, true);
117  RegisterTransitionTime(DAYZCAMERA_3RD_ERC_RAISED, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_03, true);
118  RegisterTransitionTime(DAYZCAMERA_3RD_CRO_RAISED, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_03, true);
119  RegisterTransitionTime(DAYZCAMERA_3RD_PRO_RAISED, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_03, true);
120 
121  RegisterTransitionTime(DAYZCAMERA_1ST, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_02, true); //handheld optics only
122  RegisterTransitionTime(DAYZCAMERA_3RD_ERC, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_02, true); //handheld optics only
123  RegisterTransitionTime(DAYZCAMERA_3RD_CRO, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_02, true); //handheld optics only
124  RegisterTransitionTime(DAYZCAMERA_3RD_PRO, DAYZCAMERA_OPTICS, TIME_CAMERACHANGE_02, true); //handheld optics only
125 
126  //Uncon camera transitions
127  RegisterTransitionTime(DAYZCAMERA_1ST_UNCONSCIOUS, DAYZCAMERA_3RD_PRO, 1.0, false);
128  RegisterTransitionTime(DAYZCAMERA_1ST_UNCONSCIOUS, DAYZCAMERA_1ST, 0.1, false);
129  RegisterTransitionTime(DAYZCAMERA_1ST_UNCONSCIOUS, DAYZCAMERA_1ST_VEHICLE, 0.5, false);
130  RegisterTransitionTime(DAYZCAMERA_1ST_UNCONSCIOUS, DAYZCAMERA_3RD_VEHICLE, 1.0, false);
131 
133  pType.RegisterCameraOnChangeFnStatic(DayZPlayerCameras, "OnCameraChange");
134  }
135 
136 
138  static void RegisterTransitionTime(int pFrom, int pTo, float pTime, bool pTwoWay)
139  {
140  int key = (pFrom * 65536) + pTo;
141  m_TransitionTimes.Set(key, pTime);
142  if (pTwoWay)
143  {
144  RegisterTransitionTime(pTo, pFrom, pTime, false);
145  }
146  }
147 
149  static float GetTransitionTime(int pFrom, int pTo)
150  {
151  int key = (pFrom * 65536) + pTo;
152  float val;
153 
154  if (m_TransitionTimes.Find(key, val))
155  {
156  return val;
157  }
158  else
159  {
160  return 0.3;
161  }
162  }
163 
164 
165 
166  static float OnCameraChange(DayZPlayer pPlayer, int pFrom, int pTo)
167  {
168  float transTime = GetTransitionTime(pFrom, pTo);
169  return transTime;
170  }
171 }
DayZPlayerCamera3rdPersonClimb
class DayZPlayerCamera3rdPersonJump extends DayZPlayerCamera3rdPersonErc DayZPlayerCamera3rdPersonClimb(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera3rdperson.c:241
DayZPlayerCamera3rdPersonErcRaised
Definition: dayzplayercamera3rdperson.c:358
DayZPlayerType
private void DayZPlayerType()
Definition: dayzplayer.c:512
DayZPlayerCameraOptics
void DayZPlayerCameraOptics(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercameraironsights.c:365
DayZPlayerCamera3rdPersonJump
void DayZPlayerCamera3rdPersonJump(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera3rdperson.c:2
DayZPlayer
Definition: dayzplayerimplement.c:72
DayZPlayerCameras
Definition: dayzplayercameras.c:1
DayZPlayerCamera3rdPersonProne
void DayZPlayerCamera3rdPersonProne(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera3rdperson.c:473
map
map
Definition: controlsxboxnew.c:3
DayZPlayerCamera3rdPersonCrouch
Definition: dayzplayercamera3rdperson.c:408
DayZPlayerCamera1stPerson
Definition: dayzplayercameravehicles.c:4
DayZPlayerCamera3rdPersonProneRaised
class DayZPlayerCamera3rdPersonProne extends DayZPlayerCamera3rdPersonProneBase DayZPlayerCamera3rdPersonProneRaised(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera3rdperson.c:557
DayZPlayerCamera1stPersonUnconscious
class DayZPlayerCamera1stPerson extends DayZPlayerCameraBase DayZPlayerCamera1stPersonUnconscious(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera1stperson.c:104
DayZPlayerCamera3rdPersonVehicle
void DayZPlayerCamera3rdPersonVehicle(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercameravehicles.c:33
DayZPlayerCamera3rdPersonErcSpr
void DayZPlayerCamera3rdPersonErcSpr(DayZPlayer pPlayer, HumanInputController pInput)
Definition: dayzplayercamera3rdperson.c:2
DayZPlayerCamera3rdPersonErc
Definition: dayzplayercamera3rdperson.c:186