Thanks for the fix! This solved the issue with Jim, but I now run into a second bug with Luke in the same event: After taking out Jim I go and start the scene with Luke, participate a few times and stop, then attack -- but the game doesn't register that he's knocked out, so he finishes the sex scene immediately after, go to the cells and find Rob's body -> bad end.
Presumably there should be a variable set that Luke's been knocked out that doesn't register properly.
This didn't fail on my test playthrough while I was nursing the walkthrough, but I tried a bunch of stuff and figured out the conditions that cause it to fail.
The rescue scene has an important timer that fires every 5 in-game minutes. If your game clock ends with 0 or 5 when you start to 'Participate' with Luke, you will probably fail outright on the fourth Participate. If your game clock ends with 4 or 9, you can participate four times but will get caught by Luke while you're attacking Luke, because the timer fires before gangDown(2) is set.
I don't know if this same bug manifests in the Windows version or not. If the bug is only in the HTML version, and someone can provide a Windows RAGS save from the gangster's den area, I can try to compare the order of events from the Windows vs HTML versions to see if anything needs to be fixed.
Until then, if you load a save that's broken at this point you can probably fix it by changing the minutes in CDate to end in something other than [0459].
Or even more easily, in my playthrough it also seems sufficient to only 'participate' two or three times rather than four.