1
1
#include " mkcamera.h"
2
2
#include " mk10menu.h"
3
3
#include < iostream>
4
+ #include " MKCharacter.h"
4
5
MKCamera* TheCamera;
5
6
6
7
void MKCamera::SetPosition (FVector * pos)
@@ -45,14 +46,19 @@ void MKCamera::HookedSetPosition(FVector * pos)
45
46
oneTime = pos->Y ;
46
47
TheMenu->m_bYObtained = true ;
47
48
}
49
+
48
50
if (TheMenu->m_bCustomCameras )
49
51
{
50
52
if (GetObj (PLAYER1) && GetObj (PLAYER2))
51
53
{
52
54
FVector plrPos;
53
55
FVector p2;
54
- GetCharacterPosition (&plrPos, PLAYER1);
55
- GetCharacterPosition (&p2, PLAYER2);
56
+ FVector eyePos[2 ];
57
+ FVector middle;
58
+ if (GetObj (PLAYER1))
59
+ GetCharacterPosition (&plrPos, PLAYER1);
60
+ if (GetObj (PLAYER2))
61
+ GetCharacterPosition (&p2, PLAYER2);
56
62
switch (TheMenu->m_nCurrentCustomCamera )
57
63
{
58
64
case CAMERA_3RDPERSON:
@@ -110,6 +116,35 @@ void MKCamera::HookedSetPosition(FVector * pos)
110
116
pos->Z = 134 .0f + plrPos.Z ;
111
117
112
118
119
+ TheMenu->camPos = *pos;
120
+ break ;
121
+ case CAMERA_HEAD_TRACKING:
122
+ if (TheMenu->m_bUsePlayerTwoAsTracker )
123
+ {
124
+ if (GetObj (PLAYER2))
125
+ {
126
+ GetObj (PLAYER2)->GetBonePos (" LeftEye" , &eyePos[0 ]);
127
+ GetObj (PLAYER2)->GetBonePos (" RightEye" , &eyePos[1 ]);
128
+ }
129
+ }
130
+
131
+ else
132
+ {
133
+ if (GetObj (PLAYER1))
134
+ {
135
+ GetObj (PLAYER1)->GetBonePos (" LeftEye" , &eyePos[0 ]);
136
+ GetObj (PLAYER1)->GetBonePos (" RightEye" , &eyePos[1 ]);
137
+ }
138
+ }
139
+
140
+ middle = (eyePos[0 ] + eyePos[1 ]) / 2.0 ;
141
+
142
+
143
+ pos->X = middle.X + TheMenu->m_fAdjustCustomHeadCameraX ;
144
+ pos->Y = middle.Y ;
145
+ pos->Z = middle.Z + TheMenu->m_fAdjustCustomHeadCameraZ ;
146
+
147
+
113
148
TheMenu->camPos = *pos;
114
149
break ;
115
150
}
@@ -131,20 +166,25 @@ void MKCamera::HookedSetPosition(FVector * pos)
131
166
132
167
void MKCamera::HookedSetRotation (FRotator * rot)
133
168
{
169
+
134
170
if (TheMenu->m_bCustomCameras )
135
171
{
136
172
if (GetObj (PLAYER1) && GetObj (PLAYER2))
137
173
{
138
174
FVector p1, p2;
175
+ FRotator headRot;
176
+ if (GetObj (PLAYER1))
177
+ GetCharacterPosition (&p1,PLAYER1);
178
+ if (GetObj (PLAYER2))
179
+ GetCharacterPosition (&p2, PLAYER2);
180
+
139
181
switch (TheMenu->m_nCurrentCustomCamera )
140
182
{
141
183
case CAMERA_3RDPERSON:
142
184
rot->Pitch = -900 ;
143
185
rot->Yaw = 16000 ;
144
186
rot->Roll = 0 ;
145
187
TheMenu->camRot = *rot;
146
- GetCharacterPosition (&p1, PLAYER1);
147
- GetCharacterPosition (&p2, PLAYER2);
148
188
149
189
if (p2.Y < p1.Y )
150
190
{
@@ -159,8 +199,6 @@ void MKCamera::HookedSetRotation(FRotator * rot)
159
199
rot->Yaw = 16000 ;
160
200
rot->Roll = 0 ;
161
201
TheMenu->camRot = *rot;
162
- GetCharacterPosition (&p1, PLAYER1);
163
- GetCharacterPosition (&p2, PLAYER2);
164
202
165
203
if (p2.Y < p1.Y )
166
204
{
@@ -175,8 +213,6 @@ void MKCamera::HookedSetRotation(FRotator * rot)
175
213
rot->Yaw = 16000 ;
176
214
rot->Roll = 0 ;
177
215
TheMenu->camRot = *rot;
178
- GetCharacterPosition (&p1, PLAYER1);
179
- GetCharacterPosition (&p2, PLAYER2);
180
216
181
217
if (p2.Y < p1.Y )
182
218
{
@@ -190,14 +226,50 @@ void MKCamera::HookedSetRotation(FRotator * rot)
190
226
rot->Yaw = 16000 ;
191
227
rot->Roll = 0 ;
192
228
TheMenu->camRot = *rot;
193
- GetCharacterPosition (&p1, PLAYER1);
194
- GetCharacterPosition (&p2, PLAYER2);
195
229
196
230
if (p2.Y < p1.Y )
197
231
{
198
232
rot->Yaw = -16000 ;
199
233
}
200
234
235
+ TheMenu->camRot = *rot;
236
+ break ;
237
+ case CAMERA_HEAD_TRACKING:
238
+ if (TheMenu->m_bUsePlayerTwoAsTracker )
239
+ {
240
+ if (GetObj (PLAYER2))
241
+ GetObj (PLAYER2)->GetBoneRot (" Head" , &headRot);
242
+ }
243
+ else
244
+ {
245
+ if (GetObj (PLAYER1))
246
+ GetObj (PLAYER1)->GetBoneRot (" Head" , &headRot);
247
+ }
248
+
249
+ rot->Pitch = headRot.Pitch + TheMenu->m_fAdjustCustomHeadCameraY ;
250
+ rot->Yaw = 16000 + headRot.Yaw ;
251
+ rot->Roll = headRot.Roll / 100 ;
252
+ TheMenu->camRot = *rot;
253
+
254
+ if (TheMenu->m_bUsePlayerTwoAsTracker )
255
+ {
256
+ if (GetObj (PLAYER1))
257
+ GetCharacterPosition (&p2, PLAYER1);
258
+ if (GetObj (PLAYER2))
259
+ GetCharacterPosition (&p1, PLAYER2);
260
+ }
261
+ else
262
+ {
263
+ if (GetObj (PLAYER1))
264
+ GetCharacterPosition (&p1, PLAYER1);
265
+ if (GetObj (PLAYER2))
266
+ GetCharacterPosition (&p2, PLAYER2);
267
+ }
268
+
269
+ if (p2.Y < p1.Y && !TheMenu->m_bDontFlipCamera )
270
+ {
271
+ rot->Yaw = -16000 - headRot.Yaw ;
272
+ }
201
273
TheMenu->camRot = *rot;
202
274
break ;
203
275
}
0 commit comments