NagyD / SDLPoP

An open-source port of Prince of Persia, based on the disassembly of the DOS version.
GNU General Public License v3.0
1.1k stars 140 forks source link

Skeletons that are not in the original level 3 room start falling from the wrong room. #284

Open dstarosta opened 2 years ago

dstarosta commented 2 years ago

The Guard (skeleton) room gets pointed to the room below even if the room below does not match the "skeleton reappear room".

The code should probably be changed to

    } else if (Guard.charid == charid_4_skeleton &&
                // should the level number be checked too?
        level.roomlinks[Guard.room - 1].down == /*3*/ custom->skeleton_reappear_room) {
           Guard.room = custom->skeleton_reappear_room;
           ...
         }

https://github.com/NagyD/SDLPoP/blob/133bb10463f7f76bba053e80e91e839d2652d754/src/seg002.c#L257

NagyD commented 2 years ago

Done: 8c85a54b8fbd1c7395013986c7137af6d89d7ef2 Is there any specific glitch caused by the old code?

dstarosta commented 2 years ago

Yeah, skeletons in different locations than the original room could start hanging in the air in another room as they get re-positioned to the room below after they fall out. The game does not process guards in rooms other than the drawn room. Sometimes if you visit the room, you start seeing weird skeleton frames for the hung skeleton which is probably caused by some issue with the assigned sequence.

Also, if the mod supports drawing fallen guards the room changes causes problems especially if the room ends up being 0.

dstarosta commented 1 year ago

I noticed another skeleton strangeness that causes loose tiles to shake (sometimes fall in my mod).

The "enter_guard" assigns sequence 63 when entering the room. https://github.com/NagyD/SDLPoP/blob/88c65dc172dc0b7498726e3f0ecd9ac37d7cc2b0/src/seg002.c#L205

But that sequence enum is misnamed. It is almost the same as sequence 90 but also causes the tiles on the guard's row to shake. It is really designed for a guard falling down and immediately stand engarde. It should be called something like "seq_63_guard_stand_after_fall". https://github.com/NagyD/SDLPoP/blob/88c65dc172dc0b7498726e3f0ecd9ac37d7cc2b0/src/seg005.c#L179

Sequence 90 (seq_90_en_garde which is really the guard_stand_active sequence) is almost the same but does not shake the floors and should be used in the "enter_guard" instead. It is used correctly in the "draw_sword()" method.

It seems like a bug from the original PoP. https://github.com/jmechner/Prince-of-Persia-Apple-II/blob/a9e276ce886f2200985e968b6cb5bda7edf5a2bb/01%20POP%20Source/Source/AUTO.S#L1873

NagyD commented 1 year ago

I noticed another skeleton strangeness that causes loose tiles to shake (sometimes fall in my mod). The "enter_guard" assigns sequence 63 when entering the room. But that sequence enum is misnamed. It is almost the same as sequence 90 but also causes the tiles on the guard's row to shake.

In my test, the loose tiles in the prince's row shake: (The prince has just climbed up from the room below.) 284_skeleton_shake_floor

Now that I think of it, every time a guard lands, the loose floors in the prince's row shake.

It is really designed for a guard falling down and immediately stand engarde. It should be called something like "seq_63_guard_stand_after_fall".

Renamed: 834ebf3453daafe8d5b674c6d13a9807a451f6c0