Prince character clipping does not work correctly with multiple open level doors

Open-source port of PoP that runs natively on Windows, Linux, etc.
Post Reply
dmitry_s
Developer
Developer
Posts: 148
Joined: July 27th, 2021, 7:22 am

Prince character clipping does not work correctly with multiple open level doors

Post by dmitry_s »

The character clipping when going up the stairs is driven off the "leveldoor_right" and "leveldoor_ybottom" variables.
https://github.com/NagyD/SDLPoP/blob/8d ... 06.c#L1650

The problem is if you have multiple doors the code is going to use coordinates of the last drawn door. So that clipping code should be calculating those values based on the kid's tile position instead of using those variables.

It is pretty easy to do for the right side clipping.

Code: Select all

if (get_tile(Char.room, char_col_left - 2, Char.curr_row) == tiles_16_level_door_left) {
        obj_clip_right = (col_xh[tile_col + 1] << 3) + 48; // col_xh needs to be moved into the "data.h" file instead of being a constant
        if (settings->tbl_level_type[current_level]) {
        	obj_clip_right += 8;
	}
        obj_clip_top = leveldoor_ybottom + 1;
}
But the bottom clipping variable is also used to draw the opening section of the door. So the same logic probably has to be done twice, when drawing the door and when clipping the character.

An interesting fact is PoP2 has the same bug. You can see the lack of clipping when going up the stairs, particular in cave levels. Also it does not immobilize controls so you can use left and right buttons to make the kid go up the screen.
Post Reply