So, wanting to move on in the game, I recompiled with debug symbols and ran it in GDB to try and find the source of the seg fault. Turns out it was pretty easy to find. There's a bit in Head::lookAt() where it tries to grab the orientation matrix for the parent of joint3Node but it never checks to make sure the parent exists. I'm sure in a perfect would it always would but in this case it was NULL. It tries to memcopy out this member of a null object and boom, seg fault.
I added a check that will use a fresh matrix (presumably identity) if the parent is NULL. Here's the diff for head.cpp that does the trick (just a one-line change). This fixed the crash for me. Just thought I'd offer this up as a possible bug fix.
Ollie
Code: Select all
diff --git a/engines/grim/costume/head.cpp b/engines/grim/costume/head.cpp
index fae1fbb..122ac82 100644
--- a/engines/grim/costume/head.cpp
+++ b/engines/grim/costume/head.cpp
@@ -105,7 +105,7 @@ void Head::lookAt(bool entering, const Math::Vector3d &point, float rate, const
// the orientation in parent space (as yaw/pitch/roll).
// Get the coordinate frame in which we need to produce the character head yaw/pitch/roll values.
- Math::Matrix4 parentWorldTM = _joint3Node->_parent->_matrix;
+ Math::Matrix4 parentWorldTM = (_joint3Node->_parent?_joint3Node->_parent->_matrix:Math::Matrix4());
// While we could compute the desired lookat direction directly in the above coordinate frame,
// it is preferrable to compute the lookat direction with respect to the head orientation in