Join GitHub today
SCI32: Fix QFG4 cave tentacle #1463
Fixes wriggling and retraction when hero travels over the pit, bug #10615
This supersedes an arithmetic workaround added in commit 259f262.
To test the room at the beginning of the game...
As I experimented with different patches, I found I got different results after playing through the first two rooms to get there naturally (or restored a natural savegame). And medium speeds could be symptomatic when fast and slow were fine. I kept adjusting the patches' delay/speed value until I got consistent results.
To test the room at the end of the game...
You can then levitate down & up, standing on either side of the pit floor.
Clicking the cloth on hero only works if standing on the upper right.
Using the cloth at any other position yields a generic message, accomplishing nothing.
Grr. Separate caching wasn't redundant. After a mage player uses the cloth, the handsOn() allows them to adjust the slider to an inappropriate speed before casting levitate.
Not an obvious exploit or a dangerous one. It'd just cause hero to outpace the tentacle and get it stuck in an edge case.
Fixed. The patch sets its own speed for crossing after handsOff().
Caching takes place when the cloth is used.
*sigh* Bytes were available,..
Caching takes place when the cloth is used AND just before crossing.
Technically if the slider is adjusted between using the cloth and an abort... the second cache in state 5 is skipped, and the new value will be discarded, restoring the original speed instead.
I think I've sharpened that edge case enough. =)
Vertical levitation scripts exist, but they do not carry hero across from left to right. With those, hero levitates down to the pit floor, manually walks to the other side, then levitates up via a separate casting.
From the wiki
Fighters and rogues each have a second script (crossByHandLeft, tightRopeLeft) to travel *horizontally* over the pit in the opposite direction, from the left side.
Mages do not.
When sLevitateOverPit starts, it advances through states 0-3 then does handsOn().
script 710 - sLevitateOverPit::changeState()
So skipping directly to state 5 with register=0 set for rightward movement (from the left side) should never happen.
script 710 - sLevitateOverPit::handleEvent()
sLevitateOverPit only responds to events in state 3, when the cloth has been unfurled.
Levitate delegates its effects to scripts within each room.
Room 710 does schedule other levitation scripts, distinct from the horizontal crossing.
From the wiki
script 21 - levitateSpell::doVerb(4)
If not specifically using the cloth to float leftward, g73_mouseDownHandler and g6_regions get sent event 89.
regions is an EventHandler List with one element, rm710. (ancestry: Rgn/Room/GloryRm)
script 710 - rm710::doVerb(89)
None of those scripts reference sLevitateOverPit. They send hero up and down independently.