permadeath

David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: permadeath

Post by David »

xhul wrote: And, in case the player manages to actually drink it, he won't be able to bypass the restriction.
I don't think it can be done in the DOS version.
However, the Apple II version has a bug that makes it possible: viewtopic.php?p=12150#p12150

So on the hardest difficulty, the kid will begin with 1 HP and he can't get more, right? So any injury will be deadly.
xhul
Sheikh
Sheikh
Posts: 27
Joined: October 28th, 2014, 6:27 pm

Re: permadeath

Post by xhul »

Yep, to actually force a "no miss".
In that diff, the death message has been changed to "NOTHING IS IMPOSSIBLE".

About level 5 potion, i recently saw a vid where a dude was blocking him with the door, with a proper timing.
But yeah, that wasn't the pc version, so i guess you're right.
That reminded me that the fusion with the shadow actually adds a max point, and a regen.
Technically, the game probably runs the same routine as when drinking a big life potion.
I could fix the max hp thing easily by restricting it to 3 or 1, depending on the diff, but i guess i'll probably have to deal with that regen thing...
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: permadeath

Post by David »

xhul wrote: About level 5 potion, i recently saw a vid where a dude was blocking him with the door, with a proper timing.
I also remember a video like that. It was a 3D remake of PoP1.
Now I searched Youtube for "prince of persia" "level 5" shadow XBLA and found this:
http://www.youtube.com/watch?feature=pl ... Ftis#t=113 (around 2:00)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5786
Joined: April 9th, 2009, 10:58 pm

Re: permadeath

Post by Norbert »

xhul wrote:Additionally, you cannot play a difficulty if you haven't completed the previous one.
Hm... I dunno, I think I would prefer to just start with permadeath. :lol:
Having to play all the others first may be a bit of a drag...
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5786
Joined: April 9th, 2009, 10:58 pm

Re: permadeath

Post by Norbert »

The attached package may be useful to you.
Read its PRINCE.BAT file to see what exactly it's about.
Attachments
PoP1_choices.zip
Menu with xhul's choices.
(905.82 KiB) Downloaded 204 times
xhul
Sheikh
Sheikh
Posts: 27
Joined: October 28th, 2014, 6:27 pm

Re: permadeath

Post by xhul »

David wrote:
xhul wrote: About level 5 potion, i recently saw a vid where a dude was blocking him with the door, with a proper timing.
I also remember a video like that. It was a 3D remake of PoP1.
Now I searched Youtube for "prince of persia" "level 5" shadow XBLA and found this:
http://www.youtube.com/watch?feature=pl ... Ftis#t=113 (around 2:00)
Yeah, that's exactly what i was talking about, despite i remember having seen that on another 2D version.
Anyway, in the PC version, the fact that the shadow gives 1 additional life must be seen as a way to get back the potion he stole from you.
Norbert wrote:
xhul wrote:Additionally, you cannot play a difficulty if you haven't completed the previous one.
Hm... I dunno, I think I would prefer to just start with permadeath. :lol:
Having to play all the others first may be a bit of a drag...
Remember you can't save at all.
Also, the other difficulties are a good way to gradually train the player.
But don't worry, due to how i made it, you will easily be able to bypass that restriction.
Norbert wrote:The attached package may be useful to you.
Read its PRINCE.BAT file to see what exactly it's about.
Thx a lot dude, i really appreciate the help, but i got almost everything so far.
That mini-project is around 90% complete.
Be ready, cause it's coming quite soon.

EDIT :

Finally decided to turn the "no small life potions" & "no regeneration between levels" into one single difficulty : "no regeneration" (of any form).
Also, i realised that it could be harder than expected, mainly because of the mirror (current life set to 1 for the rest of the game).
I am currently checking the disassembly to bypass the life loss.
On my way, i will also try to skip the life regen provided by the shadow (level 12).
xhul
Sheikh
Sheikh
Posts: 27
Joined: October 28th, 2014, 6:27 pm

Re: permadeath

Post by xhul »

Alright, succeeded in removing the mirror damage (my first pop hack, yeah !).
All discoveries in this topic should definitely be regrouped in the prince.exe mods topic.
In the mean time, and since i'm too lazy about that, here is the modification.

FOR 1.4 PACKED :

Remove mirror damage :
At 0x517A, replace C7066A4C0100B80100 by A16A4C909090909090.

Now, i'm on my way to bypass the shadow regeneration.
Let's just hope it won't be too much pain...

EDIT :

STILL FOR 1.4 PACKED :

Remove extra life (max+1) from big potions and shadow fusion :
At 0x14A1, replace 40 by 90.

Remove regeneration (cur+1) from small potions :
At 0x82F8, replace 01 by 00.

Remove full regeneration (cur=max) from big potions & shadow fusion :
At 0x14B7, replace 6A4C by B65F.

I'm almost good.
Noticed that i also have to bypass the full regeneration that automatically occurs when you enter the shadow room at level 12 (had forgotten about that one).
Working on it...

EDIT 2 :

@David : While i was digging, i found a few things with the modification you provided to disable regen between levels.
When the kid dies (level 2 and above), restarting the level causes an infinite die loop (normal, because he starts the level with 0 hp).
Strangely, when you die at level 13, the kid stays alive, but he is locked in an automatic "move left" action, and end up dying when he receives a tile on the head.
I'm currently thinking to find an alternate solution.

EDIT 3 :

STILL FOR 1.4 PACKED :

Remove full regeneration (cur=max) when entering shadow area (level 12) :
At 0x1540, replace 74 by 7D.
At 0x155A, replace B65F by 6A4C.

Now, just need to figure out the regen between levels.
The "cleanest" way would be to somehow save the current hp when a level is first entered, and restore it each time that level is restarted.
Working on it...
Last edited by xhul on November 7th, 2014, 1:46 pm, edited 3 times in total.
David
The Prince of Persia
The Prince of Persia
Posts: 2877
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: permadeath

Post by David »

So you found out these by yourself?
xhul wrote: Remove extra life (max+1) from big potions and shadow fusion :
At 0x14A1, replace 40 by 90.

Remove regeneration (cur+1) from small potions :
At 0x82F8, replace 01 by 00.

Remove full regeneration (cur=max) from big potions & shadow fusion :
At 0x14B7, replace 6A4C by B65F.
These seem to be all right.
Note that the red flash is not removed.
By the way, if you want to remove potions from the level, then why do you want to remove their effect?
xhul wrote: Remove mirror damage :
At 0x517C, replace C7066A4C0100B80100 by A36A4C909090909090.
This will restore the kid's full HP when he jumps through the mirror!

Your hack changes this part:

Code: Select all

(Disassembly from 1.4)
seg003:0851 A1 B6 5F                             mov     ax, hitp_max
seg003:0854 A3 2E 59                             mov     guardhp_curr, ax
seg003:0857 A3 2A 4C                             mov     guardhp_max, ax
seg003:085A C7 06 6A 4C 01 00                    mov     hitp_curr, 1 ; <-- this
seg003:0860 B8 01 00                             mov     ax, 1 ; <-- and this
seg003:0863 50                                   push    ax
seg003:0864 FF 36 B6 5F                          push    hitp_max
seg003:0868 9A 9C 11 00 00                       call    draw_kid_hp
The marked instructions are changed to:

Code: Select all

A3 6A 4C = mov hitp_curr, ax
90 90 90 90 90 90 = 5*NOP
Did you mean "mov ax, hitp_curr" instead?
That would be A1 6A 4C.
xhul wrote: Remove full regeneration (cur=max) when entering shadow area (level 12) :
At 0x155A, replace B65F by 6A4C.
I didn't even know about this special event. (Maybe it's a bug?)

Your hack does not work if the kid has at least 4 empty HPs. (The kid will regain HP in increments of 4 in that case.)
What happens here is that guardhp_delta is 4, and this is copied to hitp_delta.
This is done by the same code that makes sure that if you hurt the shadow, then the kid is also hurt.

Code: Select all

(Disassembly from 1.4)
seg000:132D                      do_delta_hp     proc far
seg000:132D 80 3E 4F 4D 01                       cmp     opp_charid, 1 ; shadow
seg000:1332 75 14                                jnz     loc_1348
seg000:1334 83 3E AA 10 0C                       cmp     current_level, 12
seg000:1339 75 0D                                jnz     loc_1348
seg000:133B 83 3E 0A 4C 00                       cmp     guardhp_delta, 0
seg000:1340 74 06                                jz      loc_1348
seg000:1342 A1 0A 4C                             mov     ax, guardhp_delta
seg000:1345 A3 B4 5F                             mov     hitp_delta, ax
seg000:1348                      loc_1348:
guardhp_delta is set to 4 when the shadow appears, because otherwise the shadow's HP is not drawn.

Code: Select all

(Disassembly from 1.4)
seg002:003B B8 04 00                             mov     ax, 4
seg002:003E A3 2A 4C                             mov     guardhp_max, ax
seg002:0041 A3 2E 59                             mov     guardhp_curr, ax
seg002:0044 A3 0A 4C                             mov     guardhp_delta, ax ; <-- here
Your hack changes this part:

Code: Select all

(Disassembly from 1.4)
seg000:1348                      loc_1348:
seg000:1348 A1 6A 4C                             mov     ax, hitp_curr
seg000:134B 03 06 B4 5F                          add     ax, hitp_delta
seg000:134F 79 02                                jns     loc_1353
seg000:1351 2B C0                                sub     ax, ax
seg000:1353                      loc_1353:
seg000:1353 3B 06 B6 5F                          cmp     ax, hitp_max
seg000:1357 7E 03                                jle     loc_135C
seg000:1359 A1 B6 5F                             mov     ax, hitp_max ; <-- changed to hitp_curr
seg000:135C                      loc_135C:
seg000:135C A3 6A 4C                             mov     hitp_curr, ax
That is: if the current HP would go *above* the max HP, then don't change the current HP.

Code: Select all

ax = hitp_curr + hitp_delta;
if (ax < 0) ax = 0;
if (ax > hitp_max) ax = hitp_max;
//                      ^^^^^^^^ changed to hitp_curr
hitp_curr = ax;
A better solution would be to change the check from guardhp_delta != 0 (jz) to guardhp_delta < 0 (jge).
That is: Search 83 3E 0A 4C 00 74 06, replace 74 with 7D.
xhul wrote: When the kid dies (level 2 and above), restarting the level causes an infinite die loop (normal, because he starts the level with 0 hp).
When I wrote that hack, I didn't know there would be a version where restarting is enabled but regeneration is disabled.
(You posted the difficulty levels after my "disable HP regen" post.)
xhul wrote: The "cleanest" way would be to somehow save the current hp when a level is first entered, and restore it each time that level is restarted.
This is already done with the max hp.

(Hey, you had an EDIT 4. Did you delete it?)
xhul
Sheikh
Sheikh
Posts: 27
Joined: October 28th, 2014, 6:27 pm

Re: permadeath

Post by xhul »

David wrote:So you found out these by yourself?
Actually, i started asm on a 486, something like 10 years ago.
Had a very long break, but it's good to speak some little x86 language again =]
David wrote:These seem to be all right.
Note that the red flash is not removed.
By the way, if you want to remove potions from the level, then why do you want to remove their effect?
I decided to leave levels.dat alone.
I will be fine with screen flashing or sfx playing.
David wrote:Did you mean "mov ax, hitp_curr" instead?
That would be A1 6A 4C.
Thx a lot for that quick fix =]
David wrote:I didn't even know about this special event. (Maybe it's a bug?)
Looks to me like a special regen for the fight with the shadow, in case the player takes some time to realise what he has to do to survive.
David wrote:A better solution would be to change the check from guardhp_delta != 0 (jz) to guardhp_delta < 0 (jge).
That is: Search 83 3E 0A 4C 00 74 06, replace 74 with 7D.
Lol, didn't even realise that this code also handled that.
Hopefully, you're there =]
David wrote:When I wrote that hack, I didn't know there would be a version where restarting is enabled but regeneration is disabled.
(You posted the difficulty levels after my "disable HP regen" post.)
Definitely.
David wrote:This is already done with the max hp.
Yeah, i already saw that.
Even if there was a free mem loc to hold current hp, there won't be any space to actually store to it.
However, i found a way to do it, but it doesn't support game loading, and only works in games where max hp isn't altered (which actually fits the difficulty where i want to use it).
It involves saving current hp instead of max, and set max to the appropriate fixed value in the ini section (as well as hp in demo level).
@3E36 : B65F<>6A4C
@4B5A : 833EAA10007408A1DA458946FEEB05C746FE04008B46FEA36A4CA3B65F<>B8XX00833EAA10017F087403B8YY00A3DA45A3B65FA1DA45A36A4C9090 (XX = fixed max hp) (YY = hp in demo)
@4EA0 : B65F<>6A4C
I think i will use that.
David wrote:(Hey, you had an EDIT 4. Did you delete it?)
Actually, yes, cause i found that it would be a bit hard to do.
But if you're curious, i wanted to make the game handle cur & max hp as if it was one single value.
I already found that it could simply be done like this :
@1557 : 7E03A1<>9090A3
The good point is that it would totally remove the necessity to modify all those regeneration situations.
Graphically speaking, instead of having empty life triangles when damaged, they would simply be removed.
The problem is, that the display routine is not supposed to "erase" those triangles, so they remain visible.
However, the kid's life area is properly updated when entering a new level, so i think it may be possible to do it every time he takes damage, or by modifying the display routine itself.
Either way, it seems quite out of reach for me, and the other method seems to work like a charm anyway.
Post Reply