On Monkey Island, there's a puzzle involving a lava flume ride:
|
Broken Lava Textures |
|
|
Unfortunately, the first thing that's immediately obvious is that the lava texture is rendered improperly. After bisecting, it turns out that this is due to
this recent commit to fix the lines in the intro bitmaps. After testing the retail version in a debugger, I found that it used both
GL_CLAMP and
GL_REPEAT. I'm not sure if the approach is correct, but it looked like only textures that were smaller than 128x128 used GL_REPEAT, while larger textures seemed to use GL_CLAMP. An implementation of this was submitted as
PR #910. Here's what the Lava Puzzle looks like now:
|
The Lava Puzzle, Less Broken! Still Not Working! |
This puzzle is configured from the set
lav, which starts a separate Lua script:
lava_flume2.lua. This script contains the logic for building the puzzle and controlling the raft, separate from the normal game controls and logic. This is all contained in the variable
flume. In this puzzle, the locations of the logs can be in 1 of 4 different
orientations, appearing at different stopping locations. There are
always four logs. In the game script, the paths that Guybrush might take
are represented as a graph of connected nodes, with each node
containing information as to whether the node is blocked with a log, the
node's coordinates, etc. As you can see in the screen shot above, Guybrush does not collide with the stuck logs, he just passes through them instead of bumping them into the lava stream.
So, why doesn't Guybrush collide with the stuck logs? In the script, it appears that the collisions are detected by turning on the collision mode to
COLLISION_SPHERE. This in turn calls into ResidualVM using the functions
SetActorCollisionMode and
SetActorCollisionScale, which configure collision detection between the actor and other actors. When these collision modes are active, the collision check between actors occurs in the ResidualVM function
handeCollisionWith in actor.cpp. I commented this function to see what collisions were being checked and got no print outs during the lava puzzle. I did get some collisions with Timmy the Monkey on the beach in the set
mib though, which provides an easier testing location than the lava puzzle and also displays broken behavior. In this scene, Timmy is randomly running around, including through the legs of Guybrush, when he should stop by colliding with Guybrush. Using a debugger, I discovered the call in the retail version for determining a collision and found that Timmy does register a collision whenever he's close to Guybrush. In ResidualVM, this doesn't happen. This is likely the root cause of the bug.
|
Timmy on the Beach |
There are also other problems with the lava puzzle as well, such as the boat bouncing back and forth the second time through the puzzle, and being able to see through the bottom of Guybrush's boat. The second problem is likely related to the
issue with doors
Since this blog entry is getting long, in the next entries, I'll discuss fixing these issues.
No comments:
Post a Comment