246af3ca71a458dd3da15f78204c736bf7d64997
2 #include "player_replay.h"
5 void freecam_preupdate(void)
7 vg_camera
*cam
= &player_replay
.replay_freecam
;
9 v3_copy( cam
->angles
, angles
);
10 player_look( angles
, 1.0f
);
12 f32 decay
= vg_maxf(0.0f
,1.0f
-vg
.time_frame_delta
*10.0f
);
15 v3_sub( angles
, cam
->angles
, d
);
16 v3_muladds( player_replay
.freecam_w
, d
, 20.0f
, player_replay
.freecam_w
);
17 v3_muls( player_replay
.freecam_w
, decay
, player_replay
.freecam_w
);
18 v3_muladds( cam
->angles
, player_replay
.freecam_w
, vg
.time_frame_delta
,
20 cam
->angles
[1] = vg_clampf( cam
->angles
[1], -VG_PIf
*0.5f
,VG_PIf
*0.5f
);
22 vg_camera_update_transform( cam
);
24 v3f lookdir
= { 0.0f
, 0.0f
, -1.0f
},
25 sidedir
= { 1.0f
, 0.0f
, 0.0f
};
27 m3x3_mulv( cam
->transform
, lookdir
, lookdir
);
28 m3x3_mulv( cam
->transform
, sidedir
, sidedir
);
31 joystick_state( k_srjoystick_steer
, input
);
32 v2_muls( input
, vg
.time_frame_delta
*6.0f
*20.0f
, input
);
34 v3_muladds( player_replay
.freecam_v
, lookdir
, -input
[1],
35 player_replay
.freecam_v
);
36 v3_muladds( player_replay
.freecam_v
, sidedir
, input
[0],
37 player_replay
.freecam_v
);
39 v3_muls( player_replay
.freecam_v
, decay
, player_replay
.freecam_v
);
41 player_replay
.freecam_v
, vg
.time_frame_delta
, cam
->pos
);
44 int freecam_cmd( int argc
, const char *argv
[] )
47 player_replay
.freecam
= atoi(argv
[0]);
49 if( player_replay
.freecam
){
50 vg_camera_copy( &skaterift
.cam
, &player_replay
.replay_freecam
);