View Issue Details

IDProjectCategoryView StatusLast Update
0002401FSSCPmultiplayerpublic2011-08-24 08:40
ReporterMatthTheGeek Assigned Tokarajorma  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.6.13 
Fixed in Version3.6.13 
Summary0002401: sexps set-camera-position and set-camera-facing-object only working for the host
DescriptionThose two sexps won't do anything for any other player than the host. I don't know if other sexps are affected by the same kind of issue. Can be tested at the end of WIH Forced Entry coop mission, which is in the bp2_multi svn, and that is attached (obviously at least 2 players are required for the issue to occur).

Confirmed in Nightly 7016.
TagsNo tags attached.

Activities

2011-02-20 00:33

 

bp2-mc06.fs2 (120,974 bytes)

2011-04-29 08:14

 

mantis_2401.patch (3,918 bytes)   
Index: parse/sexp.cpp
===================================================================
--- parse/sexp.cpp	(revision 7154)
+++ parse/sexp.cpp	(working copy)
@@ -17983,8 +17983,41 @@
 	}
 
 	cam->set_position(&camera_vec, camera_time, camera_acc_time, camera_dec_time);
+
+	multi_start_packet();
+	multi_send_float(camera_vec.xyz.x);
+	multi_send_float(camera_vec.xyz.y);
+	multi_send_float(camera_vec.xyz.z);
+	multi_send_float(camera_time);
+	multi_send_float(camera_acc_time);
+	multi_send_float(camera_dec_time);
+	multi_end_packet();
 }
 
+//CommanderDJ
+void multi_sexp_set_camera_position(int n)
+{
+	camera *cam = sexp_get_set_camera();
+	
+	if(cam == NULL)
+		return;
+
+	vec3d camera_vec;
+	float camera_time = 0.0f;
+	float camera_acc_time = 0.0f;
+	float camera_dec_time = 0.0f;
+
+	multi_get_float(camera_vec.xyz.x);
+	multi_get_float(camera_vec.xyz.y);
+	multi_get_float(camera_vec.xyz.z);
+	multi_get_float(camera_time);
+	multi_get_float(camera_acc_time);
+	multi_get_float(camera_dec_time);
+
+	cam->set_position(&camera_vec, camera_time, camera_acc_time, camera_dec_time);
+}
+
+
 void sexp_set_camera_rotation(int n)
 {
 	camera *cam = sexp_get_set_camera();
@@ -18056,6 +18089,35 @@
 	cam->set_rotation_facing(&location, rot_time, rot_acc_time, rot_dec_time);
 }
 
+//CommanderDJ
+//helper function for set_camera_facing_object
+void actually_set_camera_facing_object(char *object_name, float rot_time, float rot_acc_time, float rot_dec_time)
+{
+	object_ship_wing_point_team oswpt;
+	sexp_get_object_ship_wing_point_team(&oswpt, object_name);
+
+	switch (oswpt.type)
+	{
+		case OSWPT_TYPE_EXITED:
+		{
+			Warning(LOCATION, "Camera tried to face destroyed/departed object %s", object_name);
+			return;
+		}
+
+		case OSWPT_TYPE_TEAM:
+		case OSWPT_TYPE_SHIP:
+		case OSWPT_TYPE_WING:
+		case OSWPT_TYPE_WAYPOINT:
+		{
+			camera *cam = sexp_get_set_camera();
+			if(cam == NULL)
+				return;
+			cam->set_rotation_facing(&oswpt.objp->pos, rot_time, rot_acc_time, rot_dec_time);
+			return;
+		}
+	}
+}
+
 void sexp_set_camera_facing_object(int n)
 {
 	char *object_name = CTEXT(n);
@@ -18080,29 +18142,31 @@
 		}
 	}
 
-	object_ship_wing_point_team oswpt;
-	sexp_get_object_ship_wing_point_team(&oswpt, object_name);
+	actually_set_camera_facing_object(object_name, rot_time, rot_acc_time, rot_dec_time);
+		
+	//multiplayer callback
+	multi_start_packet();
+	multi_send_string(object_name);
+	multi_send_float(rot_time);
+	multi_send_float(rot_acc_time);
+	multi_send_float(rot_dec_time);
+	multi_end_packet();
+}
 
-	switch (oswpt.type)
-	{
-		case OSWPT_TYPE_EXITED:
-		{
-			Warning(LOCATION, "Camera tried to face destroyed/departed object %s", object_name);
-			return;
-		}
-
-		case OSWPT_TYPE_TEAM:
-		case OSWPT_TYPE_SHIP:
-		case OSWPT_TYPE_WING:
-		case OSWPT_TYPE_WAYPOINT:
-		{
-			camera *cam = sexp_get_set_camera();
-			if(cam == NULL)
-				return;
-			cam->set_rotation_facing(&oswpt.objp->pos, rot_time, rot_acc_time, rot_dec_time);
-			return;
-		}
-	}
+//CommanderDJ
+void multi_sexp_set_camera_facing_object(int n)
+{
+	char *object_name;
+	float rot_time = 0.0f;
+	float rot_acc_time = 0.0f;
+	float rot_dec_time = 0.0f;
+	
+	multi_get_string(object_name);
+	multi_get_float(rot_time);
+	multi_get_float(rot_acc_time);
+	multi_get_float(rot_dec_time);
+	
+	actually_set_camera_facing_object(object_name, rot_time, rot_acc_time, rot_dec_time);
 }
 
 extern float VIEWER_ZOOM_DEFAULT;
@@ -21040,6 +21104,13 @@
 				muli_sexp_toggle_cutscene_bars(op_num == OP_CUTSCENES_SET_CUTSCENE_BARS );
 				break;
 
+			case OP_CUTSCENES_SET_CAMERA_FACING_OBJECT:
+				multi_sexp_set_camera_facing_object(op_num == OP_CUTSCENES_SET_CAMERA_FACING_OBJECT);
+				break;
+
+			case OP_CUTSCENES_SET_CAMERA_POSITION:
+				multi_sexp_set_camera_position(op_num == OP_CUTSCENES_SET_CAMERA_POSITION);
+
 			case OP_SET_CAMERA_SHUDDER:
 				multi_sexp_set_camera_shudder();
 				break;
mantis_2401.patch (3,918 bytes)   

CommanderDJ

2011-04-29 08:15

developer   ~0012672

Last edited: 2011-04-29 08:16

I've uploaded a .patch file which *should* fix the issue. I've made both SEXPs multi compatible by following Kara's guide on the forums. Someone should probably look over it though as I'm still new to the whole thing.

CommanderDJ

2011-04-29 15:29

developer   ~0012673

Last edited: 2011-04-29 15:58

Here's a test build based on the above patch (updated to a newer revision though):
http://www.mediafire.com/?3xh71kdctx49r8g SSE2
http://www.mediafire.com/?2bs3yd08rvbb32s Non-SSE

Extract, then paste the files into your root FS2 folder, select the build in the launcher and play as normal.

Issue History

Date Modified Username Field Change
2011-02-20 00:33 MatthTheGeek New Issue
2011-02-20 00:33 MatthTheGeek File Added: bp2-mc06.fs2
2011-04-29 08:14 CommanderDJ File Added: mantis_2401.patch
2011-04-29 08:15 CommanderDJ Note Added: 0012672
2011-04-29 08:16 CommanderDJ Note Edited: 0012672
2011-04-29 15:29 CommanderDJ Note Added: 0012673
2011-04-29 15:58 CommanderDJ Note Edited: 0012673
2011-08-19 10:10 karajorma Status new => assigned
2011-08-19 10:10 karajorma Assigned To => karajorma
2011-08-24 08:40 karajorma Status assigned => resolved
2011-08-24 08:40 karajorma Fixed in Version => 3.6.13
2011-08-24 08:40 karajorma Resolution open => fixed