| Bugfix provided by Battle Bunny (JimG):
- There are some adjacent screens where the exit positions don't properly match, so it's possible to move into a wall on the next screen. When it happens, the player bounces off the wall and usually goes back to the previous location. However, there are a few cases where the game doesn't calculate the returning position properly, so the player is bounced around a few times and may arrive at an entirely different location, sometimes outside the map. This problem happens because the game uses a complicated formula for calculating connections between map segments based upon which keys had been pressed, which doesn't work properly if the player moved in diagonal. The correction ignores this calculation and instead saves the current and previous segment addresses, as bouncing back off a wall should always go back to where it just came from regardless of which keys were pressed. Fixed using the following patch:
org $9D3F call PSAVE ; 9D3F CD 34 F8 org $A2BA call PLOAD ; A2BA CD 53 F8 org $A30A call PLOAD ; A30A CD 53 F8 org $B318 call PSAVE ; B318 CD 34 F8 org $B353 call PSAVE ; B353 CD 34 F8
org $F834 PSAVE: PUSH HL ; F834 E5 LD HL, ($D1A5) ; F835 2A A5 D1 LD (ROWNUM), HL ; F838 22 88 F8 LD HL, ($D1A9) ; F83B 2A A9 D1 LD (COLNUM), HL ; F83E 22 8A F8 LD HL, (THISAD) ; F841 2A 83 F8 LD (PREVAD), HL ; F844 22 85 F8 POP HL ; F847 E1 LD ($D1A1), HL ; F848 22 A1 D1 LD (THISAD), HL ; F84B 22 83 F8 XOR A ; F84E AF LD (FLAGAD), A ; F84F 32 87 F8 RET ; F852 C9
PLOAD: LD A, (FLAGAD) ; F853 3A 87 F8 AND A ; F856 A7 JR NZ, NOSWAP ; F857 20 17 LD HL, (PREVAD) ; F859 2A 85 F8 LD ($D1A1), HL ; F85C 22 A1 D1 PUSH HL ; F85F E5 LD HL, (THISAD) ; F860 2A 83 F8 LD (PREVAD), HL ; F863 22 85 F8 POP HL ; F866 E1 LD (THISAD), HL ; F867 22 83 F8 INC A ; F86A 3C LD (FLAGAD), A ; F86B 32 87 F8 JR ROWCOL ; F86E 18 06 NOSWAP: LD HL, (THISAD) ; F870 2A 83 F8 LD ($D1A1), HL ; F873 22 A1 D1 ROWCOL: LD HL, (ROWNUM) ; F876 2A 88 F8 LD ($D1A5), HL ; F879 22 A5 D1 LD HL, (COLNUM) ; F87C 2A 8A F8 LD ($D1A9), HL ; F87F 22 A9 D1 RET ; F882 C9
THISAD: defw $0000 ; F883 00 00 PREVAD: defw $0000 ; F885 00 00 FLAGAD: defb $00 ; F887 00 ROWNUM: defw $0000 ; F888 00 00 COLNUM: defw $0000 ; F88A 00 00
Modified "BUGFIX" file provided by Einar Saukas. |