View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002937 | FSSCP | SEXPs | public | 2013-10-15 09:10 | 2013-10-17 05:38 |
Reporter | niffiwan | Assigned To | Goober5000 | ||
Priority | high | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.7.1 | ||||
Target Version | 3.7.2 | ||||
Summary | 0002937: is-in-box sexp with optional reference ship causes ships to be hurled around | ||||
Description | It seems that if the 'is-in-box' sexp: 1) uses the optional ship reference argument and 2) is ever evaluated the player ship is instantly hurled away from the mission origin at ludicrous speed. You'll probably die fairly quickly from leaving the mission area. (actually, in the Diaspora mission it seems that the player ship, plus other ships in the 1st arg slot of the sexp, are hurled in an arc which may or may not leave the mission space. Spinning ships... wheeeeee.....) | ||||
Steps To Reproduce | See attached test mission. Play in r9641 for normal behaviour Play in r9642 for bizarre behaviour | ||||
Additional Information | Reported in BP:WIH act 3 here: http://www.hard-light.net/forums/index.php?topic=85081.0 Also found in a Diaspora Multiplayer mission currently in development | ||||
Tags | No tags attached. | ||||
|
|
|
It seem that vm_vec_unrotate in test_point_within_box is modifying the real position of the 1st arg to the sexp? |
|
mantis2937-svn.patch (1,749 bytes)
Index: code/parse/sexp.cpp =================================================================== --- code/parse/sexp.cpp (revision 9942) +++ code/parse/sexp.cpp (working copy) @@ -21024,20 +21024,26 @@ return; } -bool test_point_within_box(vec3d *test_point, vec3d *box_corner_1, vec3d *box_corner_2, object *reference_ship_obj) +bool test_point_within_box(const vec3d *point_to_test, vec3d *box_corner_1, vec3d *box_corner_2, object *reference_ship_obj) { + // don't modify the input object! + vec3d test_point; + test_point.xyz.x = point_to_test->xyz.x; + test_point.xyz.y = point_to_test->xyz.y; + test_point.xyz.z = point_to_test->xyz.z; + // If reference_ship is specified, rotate test_point into its reference frame if (reference_ship_obj != NULL) { vec3d tempv; - vm_vec_sub(&tempv, test_point, &reference_ship_obj->pos); - vm_vec_unrotate(test_point, &tempv, &reference_ship_obj->orient); + vm_vec_sub(&tempv, &test_point, &reference_ship_obj->pos); + vm_vec_unrotate(&test_point, &tempv, &reference_ship_obj->orient); } // Check to see if the test point is within the specified box as defined by two extreme corners - return ((test_point->xyz.x >= box_corner_1->xyz.x && test_point->xyz.x <= box_corner_2->xyz.x) && - (test_point->xyz.y >= box_corner_1->xyz.y && test_point->xyz.y <= box_corner_2->xyz.y) && - (test_point->xyz.z >= box_corner_1->xyz.z && test_point->xyz.z <= box_corner_2->xyz.z)); + return ((test_point.xyz.x >= box_corner_1->xyz.x && test_point.xyz.x <= box_corner_2->xyz.x) && + (test_point.xyz.y >= box_corner_1->xyz.y && test_point.xyz.y <= box_corner_2->xyz.y) && + (test_point.xyz.z >= box_corner_1->xyz.z && test_point.xyz.z <= box_corner_2->xyz.z)); } int sexp_is_in_box(int n) |
|
actually - what do you think of this patch? It seems to fix the issue for both the attached test mission & the Diaspora mission. |
|
I've committed a patch which does more or less the same thing, I think. Have a look. |
|
Yeah, that looks good. My only comment is that I'd remove the pointer assignment (test_point = &test_point_buf;) and rename the vec3d being tested to be test_point_buf. But that's really just a nitpick. Anyway, tested it successfully with both test missions I have. |
|
Cool. Resolving. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-10-15 09:10 | niffiwan | New Issue | |
2013-10-15 09:10 | niffiwan | Status | new => assigned |
2013-10-15 09:10 | niffiwan | Assigned To | => Goober5000 |
2013-10-15 09:11 | niffiwan | File Added: is-in-box.fs2 | |
2013-10-15 09:37 | niffiwan | Note Added: 0015329 | |
2013-10-15 09:49 | niffiwan | File Added: mantis2937-svn.patch | |
2013-10-15 09:50 | niffiwan | Note Added: 0015330 | |
2013-10-15 09:52 | niffiwan | Status | assigned => code review |
2013-10-15 09:57 | niffiwan | Note Edited: 0015330 | |
2013-10-16 06:36 | Goober5000 | Changeset attached | => fs2open trunk r9946 |
2013-10-16 06:37 | Goober5000 | Note Added: 0015332 | |
2013-10-16 08:21 | niffiwan | Note Added: 0015333 | |
2013-10-17 05:38 | Goober5000 | Note Added: 0015334 | |
2013-10-17 05:38 | Goober5000 | Status | code review => resolved |
2013-10-17 05:38 | Goober5000 | Resolution | open => fixed |