@@ -41,7 +41,7 @@ extern "C" {
4141/******************************************************************************/
4242struct Camera local_cameras [4 ];
4343struct Camera previous_local_cameras [4 ];
44- struct Camera desired_local_cameras [4 ];
44+ struct Camera destination_local_cameras [4 ];
4545float interpolated_cam_mappos_x [4 ];
4646float interpolated_cam_mappos_y [4 ];
4747float interpolated_cam_mappos_z [4 ];
@@ -55,7 +55,7 @@ TbBool local_camera_ready;
5555void sync_camera_state (int cam_idx , struct Camera * cam )
5656{
5757 local_cameras [cam_idx ] = * cam ;
58- desired_local_cameras [cam_idx ] = * cam ;
58+ destination_local_cameras [cam_idx ] = * cam ;
5959 previous_local_cameras [cam_idx ] = * cam ;
6060 interpolated_cam_mappos_x [cam_idx ] = cam -> mappos .x .val ;
6161 interpolated_cam_mappos_y [cam_idx ] = cam -> mappos .y .val ;
@@ -100,21 +100,21 @@ void process_local_minimap_click(struct Packet* packet) {
100100 long pos_y = subtile_coord_center (packet -> actn_par2 );
101101 for (int i = CamIV_Isometric ; i <= CamIV_FrontView ; i ++ ) {
102102 if (i != CamIV_FirstPerson ) {
103- desired_local_cameras [i ].mappos .x .val = pos_x ;
104- desired_local_cameras [i ].mappos .y .val = pos_y ;
103+ destination_local_cameras [i ].mappos .x .val = pos_x ;
104+ destination_local_cameras [i ].mappos .y .val = pos_y ;
105105 }
106106 }
107107 }
108108}
109109
110110void update_local_first_person_camera (struct Thing * ctrltng )
111111{
112- struct Camera * cam = & desired_local_cameras [CamIV_FirstPerson ];
112+ struct Camera * cam = & destination_local_cameras [CamIV_FirstPerson ];
113113 int eye_height = get_creature_eye_height (ctrltng );
114114 update_first_person_position (cam , ctrltng , eye_height );
115115
116- long current_horizontal = desired_local_cameras [CamIV_FirstPerson ].rotation_angle_x ;
117- long current_vertical = desired_local_cameras [CamIV_FirstPerson ].rotation_angle_y ;
116+ long current_horizontal = destination_local_cameras [CamIV_FirstPerson ].rotation_angle_x ;
117+ long current_vertical = destination_local_cameras [CamIV_FirstPerson ].rotation_angle_y ;
118118 struct Packet * latest_packet = get_local_input_lag_packet_for_turn (CURRENT_TURN_FOR_CAMERA );
119119 if (latest_packet != NULL ) {
120120 long new_horizontal , new_vertical , new_roll ;
@@ -135,7 +135,7 @@ void update_local_cameras(void)
135135 return ;
136136 }
137137 for (int i = 0 ; i < 4 ; i ++ ) {
138- previous_local_cameras [i ] = desired_local_cameras [i ];
138+ previous_local_cameras [i ] = destination_local_cameras [i ];
139139 }
140140 struct PlayerInfo * my_player = get_my_player ();
141141 struct Thing * ctrltng = thing_get (my_player -> controlled_thing_idx );
@@ -152,8 +152,8 @@ void update_local_cameras(void)
152152 if (cam_idx == CamIV_FirstPerson || cam_idx == CamIV_Parchment ) {
153153 continue ;
154154 }
155- process_camera_controls (& desired_local_cameras [cam_idx ], local_packet , my_player );
156- view_process_camera_inertia (& desired_local_cameras [cam_idx ]);
155+ process_camera_controls (& destination_local_cameras [cam_idx ], local_packet , my_player );
156+ view_process_camera_inertia (& destination_local_cameras [cam_idx ]);
157157 }
158158 }
159159}
@@ -165,7 +165,7 @@ void interpolate_local_cameras(void)
165165 }
166166 for (int i = 0 ; i < 4 ; i ++ ) {
167167 struct Camera * prev = & previous_local_cameras [i ];
168- struct Camera * desired = & desired_local_cameras [i ];
168+ struct Camera * desired = & destination_local_cameras [i ];
169169 struct Camera * out = & local_cameras [i ];
170170 interpolated_cam_mappos_x [i ] = interpolate (interpolated_cam_mappos_x [i ], prev -> mappos .x .val , desired -> mappos .x .val );
171171 interpolated_cam_mappos_y [i ] = interpolate (interpolated_cam_mappos_y [i ], prev -> mappos .y .val , desired -> mappos .y .val );
@@ -184,40 +184,30 @@ void interpolate_local_cameras(void)
184184 }
185185}
186186
187- void sync_local_camera (struct Camera * cam )
187+ void sync_local_camera (struct PlayerInfo * player )
188188{
189- if (!local_camera_ready ) {
189+ if (!is_my_player ( player ) || ! local_camera_ready ) {
190190 return ;
191191 }
192- struct PlayerInfo * player = get_my_player ();
193- if (cam == & player -> cameras [CamIV_FirstPerson ]) {
194- sync_first_person_camera (cam , player );
192+ if (player -> acamera == & player -> cameras [CamIV_FirstPerson ]) {
193+ sync_first_person_camera (player -> acamera , player );
195194 return ;
196195 }
197196 for (int cam_idx = CamIV_Isometric ; cam_idx <= CamIV_FrontView ; cam_idx ++ ) {
198- if (cam == & player -> cameras [cam_idx ]) {
199- sync_camera_state (cam_idx , cam );
200- if (cam_idx != CamIV_Parchment ) {
201- if (player -> view_mode == PVM_ParchmentView ) {
202- reset_all_minimap_interpolation = true;
203- }
204- }
205- return ;
206- }
197+ sync_camera_state (cam_idx , & player -> cameras [cam_idx ]);
198+ }
199+ if (player -> view_mode == PVM_ParchmentView ) {
200+ reset_all_minimap_interpolation = true;
207201 }
208202}
209203
210- void set_local_desired_camera (struct Camera * cam )
204+ void set_local_camera_destination (struct PlayerInfo * player )
211205{
212- if (!local_camera_ready ) {
206+ if (!is_my_player ( player ) || ! local_camera_ready ) {
213207 return ;
214208 }
215- struct PlayerInfo * player = get_my_player ();
216209 for (int cam_idx = CamIV_Isometric ; cam_idx <= CamIV_FrontView ; cam_idx ++ ) {
217- if (cam == & player -> cameras [cam_idx ]) {
218- desired_local_cameras [cam_idx ] = * cam ;
219- break ;
220- }
210+ destination_local_cameras [cam_idx ] = player -> cameras [cam_idx ];
221211 }
222212}
223213
@@ -227,9 +217,6 @@ struct Camera* get_local_camera(struct Camera* cam)
227217 return cam ;
228218 }
229219 struct PlayerInfo * player = get_my_player ();
230- if ((player -> allocflags & PlaF_CompCtrl ) != 0 ) {
231- return cam ;
232- }
233220 for (int cam_idx = CamIV_Isometric ; cam_idx <= CamIV_FrontView ; cam_idx ++ ) {
234221 if (cam == & player -> cameras [cam_idx ]) {
235222 return & local_cameras [cam_idx ];
0 commit comments