Just a note on the file I posted:
What is happening?
In the original JSW, the code for jumping and moving up and down ramps, are set in one overall routine that detects wall blocks and stops movement.
Within the code of the original, was two sets of movement code that treated the movement going left and the movement going right differently.
The code for moving left omitted a check for head height blocks. This permits willies head to pass through blocks moving left. This also permits willies head to pass through blocks at head height when jumping. Another routine at #8df7 detects the passage through the block at head height and immediately pushes willy downward to cell align him into/onto the block below. In most cases this works well if willy is going upwards on a jump. If willy is going downwards on a jumping arc, then the code at #8df7 will appear to move willy suddenly downward. This is the characteristic jerk as willy hits a wall and slides down it into a gap.
This code blocks the movement of willies head through a wall tile. The result is that willy can not jump into slots cut out of walls in the same manner. Because willies body and head do not enter in a wall tile, willy will slide down walls at a normal speed, until his feet land on something.
The slight difference in the movement is why the game has cut outs in vertical walls only in left jumped to walls. The same style cut out that exist in right cut out walls normally have a platform below the cut out, on which willy can land. It also is the reason for the jerk jumping left in certain circumstances that are not replicated going right.
Various fixs can be applied and each fix might cure one or other problem.
1) stop willies head passing through a block.
This fix will stop the jumps into cut outs.
2) allow willies head to pass through a block going right.
This fix will enable jumps left and right into cut outs. But willy will pass through so many blocks it just looks wrong.
3) rewrite the lot.
This introduces so many new variables, that anything can happen. My thoughts on that are GOOD LUCK.
The demo program posted above changes its set of rules depending on what is happening.
1) If willy is walking up or down a ramp then it will check for willies head/body/above head(going up)/below head (going down).
When jumping the rules are changed. When jumping upward it checks above his head, his head and also his body. If not cell aligned it will check the third cell (lower body/under foot)
2) When jumping downward it ignores the head check and checks for his body and if free to move also checks the cell below his body (under foot). This double check for body and lower body/under foot is needed to ensure that willy is actually passing into a gap in which he can fit. (two cells high)
If the two cells are free then the code permits willies head to pass through a wall block. The code at #8df7 will detect the passage through a wall block and immediately pull willy downwards into the gap. This is what happens in the original game. The only difference in this demo is that it now happens going left or right, but willies head is blocked from passing into wall blocks when walking, walking on ramps, or even jumping upward.
Any modification will invariably introduce new problems. Simply because the original game appears to have been constructed around the non symmetry of code. Some of these problems are very easy to fix others are waiting to come to light.
Most of the labels I have in this area have been moved/change/deleted . I have had to use an unchanged version, to find the address I am referencing.
Over head wall check, that push's willy downward , as written by
The complete Jet Set Willy RAM disassembly 2017 11 13
© 1984 Software Projects Ltd. © 2017 Richard Dymond.
Created using SkoolKit 6.1.
Adjust Willy's attribute buffer location at 85D3 depending on his pixel y-coordinate
8DF7 LD A,($80B2) Pick up the attribute byte of the wall tile for the current room from 80B2
8DFA CP (HL) Is the top-left cell of Willy's sprite overlapping a wall tile?
8DFB JP Z,$8EBC Jump if so
8DFE INC HL Point HL at the top-right cell occupied by Willy's sprite
8DFF CP (HL) Is the top-right cell of Willy's sprite overlapping a wall tile?
8E00 JP Z,$8EBC Jump if so
The code at $8ebc will adjust his position
The top-left or top-right cell of Willy's sprite is overlapping a wall tile.
8EBC LD A,($85CF) Adjust Willy's pixel y-coordinate at 85CF so that the top row of cells of his sprite is just below the wall tile
8EBF ADD A,$10
8EC1 AND $F0
8EC3 LD ($85CF),A
8EC6 CALL $8E9C Adjust Willy's attribute buffer location at 85D3 to account for this new pixel y-coordinate
8EC9 LD A,$02 Set the airborne status indicator at 85D1 to 0x02: Willy has started falling
8ECB LD ($85D1),A
8ECE LD HL,$85D0 Reset bit 1 at 85D0: Willy is not moving left or right
8ED1 RES 1,(HL)
Edited by Norman Sword, 25 December 2017 - 01:37 PM.