Emiliano Fierro wrote: ↑September 3rd, 2020, 1:20 am
Hi again, I don't know if you have seen this before, for this you need to have a wall if there's no room at the left and put it in a corner, I can't hold using that wall and the four-tile jump failed with this
I've seen this before in the SNES-PC-set mod:
viewtopic.php?p=29854#p29854
This bug occurs both in DOS PoP and SDLPoP.
A similar thing happens if you try to climb down from such a ledge without releasing it: The prince will release the ledge even if you hold down Shift.
I figured out what happens in this case.
The prince releases the ledge here:
https://github.com/NagyD/SDLPoP/blob/v1 ... 005.c#L710
Code: Select all
if (! tile_is_floor(get_tile_above_char())) {
hang_fall();
}
Here the game checks if the prince is still hanging onto a floor, in case it was a loose floor which fell since he grabbed it.
If the tile is not a floor then the prince will fall.
In the first case shown in your video, get_tile_above_char() will call get_tile() with room = (room where the prince is), col = -1, row = -1.
get_tile() in turn calls find_room_of_tile():
https://github.com/NagyD/SDLPoP/blob/v1 ... g006.c#L46
The purpose of find_room_of_tile() is to normalize the room,column,row coordinates, so that the latter two are inside bounds (0 ≤ row ≤ 2 and 0 ≤ col ≤ 9).
There the game first checks if the current tile position is outside the current room leftwards, and since it is, the code "goes" to the room on the left side, which is room 0.
Code: Select all
if (tile_col < 0) {
tile_col += 10;
if (curr_room) {
curr_room = level.roomlinks[curr_room - 1].left;
}
Next the code checks if the current tile position is outside the current room upwards:
Code: Select all
if (tile_row < 0) {
tile_row += 3;
if (curr_room) {
curr_room = level.roomlinks[curr_room - 1].up;
}
curr_room is 0, so the condition of the inner if is false, therefore curr_room remains 0.
curr_room = 0 means get_tile() will return a tile from room 0, which is treated as being filled with walls.
Code: Select all
if (curr_room > 0) {
[...]
} else {
// wall in room 0
curr_tile2 = custom->level_edge_hit_tile; // tiles_20_wall
}
So get_tile() and then get_tile_above_char() returns wall (20), which is not a floor, and thus the prince falls.
The solution is to change find_room_of_tile() so that the if with condition (tile_row < 0) appears first.
That way find_room_of_tile() will first go up (room = room above, col = 2, row = -1) then left (room = room above-left, col = 2, row = 9), and it will return the actual tile which the prince is grabbing.
I fixed this now in SDLPoP:
https://github.com/NagyD/SDLPoP/commit/ ... d69a994f8b