Page 47 of 47

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: April 2nd, 2022, 4:38 pm
by VelCheran
Yes, it took me time to remember that this works if you're one tile away from the wall, maybe I got it after this playthrough :D

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: June 2nd, 2022, 2:30 pm
by atrueprincefanfrom18

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: June 13th, 2022, 9:12 am
by atrueprincefanfrom18
I don't think we have this trick right? Or is it just a bug?

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: June 13th, 2022, 7:24 pm
by dmitry_s
It looks like a room switching bug. Can you upload the LEVELS.DAT file?

Does it work without spikes? Sometimes trobs can affect the logic like that trick with hanging on to a loose tile in the room above that puts you an extra room down.

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: June 14th, 2022, 5:59 am
by SuavePrince
atrueprincefanfrom18 wrote: June 2nd, 2022, 2:30 pm
Nice..that "trick" was discovered by the master yqwasx

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: June 14th, 2022, 6:32 am
by atrueprincefanfrom18
dmitry_s wrote: June 13th, 2022, 7:24 pm Can you upload the LEVELS.DAT file?
It's 0000276 tried it on SDLPoP.
dmitry_s wrote: June 13th, 2022, 7:24 pm It looks like a room switching bug.
The bug is Kid doesn't die even though he lands on spikes.

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: June 14th, 2022, 7:01 pm
by dmitry_s
atrueprincefanfrom18 wrote: June 14th, 2022, 6:32 am The bug is Kid doesn't die even though he lands on spikes.
The logic in the link below prevents switching the room when the last column of the room is a door top. But it does not do the same if the first tile in the next room is a wall (walls from non-existing rooms are handled elsewhere).

https://github.com/NagyD/SDLPoP/blob/13 ... 002.c#L474

So the scenario where there is some sort of a floor tile in the column 9 of a room and a (real) room on the right with a wall in column 0 is not handled by the game correctly. When prince comes close to the wall in the room on the right, the game switches to that room and you cannot see prince because of the wall. But the prince's room is now set to the room on the right.

The code that activates a spike animation/sound happens while the prince is landing. It checks spikes behind and at the prince which causes the spike to activate.

However, the code that checks the spike below is actually harmful uses prince's coordinates which is in the wrong room.

https://github.com/NagyD/SDLPoP/blob/13 ... 06.c#L1643

To fix the issue you would have to ensure the left room is shown when prince is hanging from the wall to the left of column 0 or is standing next to it.

Also, you cannot see prince from the room on the left either when he is standing right next to the wall. So the wall push function would have to push him a couple of pixels further to the left in that scenario.

Re: Guide to Prince of Persia tricks (Large Topic)

Posted: June 14th, 2022, 7:27 pm
by dmitry_s
Here is some barely tested code that seems to work.

The "looking right" block code of the "leave_room()" function. "Looking left" code probably also needs to be adjusted since the room now switches when prince is turned left next to the wall.

Code: Select all

	// looking right
        if (get_tile(Char.room, 10, Char.curr_row) == tiles_20_wall && char_x_right <= 62) {
            leave_dir = 0;
        } else {
    		if (curr_tile2 != tiles_20_wall &&
                        get_tile(Char.room, 9, Char.curr_row) != tiles_7_doortop_with_floor &&
    			curr_tile2 != tiles_12_doortop &&
    			char_x_right >= 201
    		) {
    			leave_dir = 1; // right
    		} else if (char_x_right <= 57) {
    			leave_dir = 0; // left
    		} else {
    			return -1;
    		}
        }
The "in_wall()" function.

Code: Select all

	short delta_x;
	delta_x = distance_to_edge_weight();
	if (delta_x >= 8 || get_tile_infrontof_char() == tiles_20_wall) {
		delta_x = 6 - delta_x;
		// pushed back by a wall in column 0
		if (Char.direction == dir_0_right && tile_col == 0) {
                     delta_x -= 4;
                }
	} else {
		delta_x += 4;
	}
	Char.x = char_dx_forward(delta_x);
	load_fram_det_col();
	get_tile_at_char();