In a nutshell, the problem is bad search map coordinates for DOOR3304 impeded points when door is open. The search map is 320 x 320, yet there are points where y > 320. This causes a buffer overflow problem, resulting in heap corruption. The heap corruption causes the symptoms we all see with Beregost crashes.
A fix will be incorporated into a new version of BGT-WeiDU. The coded fix below can be used for BG1 and BG1Tutu, editing the COPY_EXISTING ~filename~ as necessary.
Note that while this should solve the random Beregost crashing, it may not cover all types of Beregost crashes. The most obvious of this case would be mods causing problems with objects/creatures in the area, or mod incompatibility (as we saw with BG2Fixpack: http://www.shsforums...post__p__478775).
Fix will only work on new games or saved games where you have not visited Beregost yet, since the area is saved into the BALDUR.SAV file once you have visited it.
BACKUP ~BeregostFix~
AUTHOR ~Asc64~
BEGIN ~BeregostFix~
//AR3300, FW3300, AR6700 (BG1, BGTutu, BGT)
COPY_EXISTING ~AR6700.ARE~ ~override~
READ_LONG 0xA4 nDoors
READ_LONG 0xA8 offDoors
READ_LONG 0x7C offPoints
READ_LONG 0x80 nPoints
SET i = 0
FOR (i = 0; i < nDoors; i += 1) BEGIN
READ_ASCII ( %offDoors% + %i% * 0xC8 + 0x20 ) DoorId
PATCH_IF ( "%DoorId%" STRING_EQUAL "DOOR3304" ) BEGIN
READ_LONG ( %offDoors% + %i% * 0xC8 + 0x48 ) idxPointsImpededOpen
READ_SHORT ( %offDoors% + %i% * 0xC8 + 0x4C ) nPointsImpededOpen
SET j = 0
FOR (j = %idxPointsImpededOpen%; j < %idxPointsImpededOpen% + %nPointsImpededOpen%; j += 1) BEGIN
READ_SHORT ( %offPoints% + %j% * 0x4) x
READ_SHORT ( %offPoints% + %j% * 0x4 + 0x2) y
PATCH_IF ( x = 243 && y = 326 ) BEGIN
WRITE_SHORT ( %offPoints% + %j% * 0x4) 233
WRITE_SHORT ( %offPoints% + %j% * 0x4 + 0x2) 302
END
PATCH_IF ( x = 243 && y = 327 ) BEGIN
WRITE_SHORT ( %offPoints% + %j% * 0x4) 233
WRITE_SHORT ( %offPoints% + %j% * 0x4 + 0x2) 304
END
PATCH_IF ( x = 242 && y = 325 ) BEGIN
WRITE_SHORT ( %offPoints% + %j% * 0x4) 232
WRITE_SHORT ( %offPoints% + %j% * 0x4 + 0x2) 304
END
PATCH_IF ( x = 233 && y = 303 ) BEGIN
END
END
END
END









