permadeath
permadeath
Hello there...
Finally, i just registered.
Actually, i used to be there in the old popuw forums by the alias "the_mad_joob", for those who remember me.
Back in the days, i made a few gfx for pop1, which are currently available in pop1tp.
Now, i decided to use them in a dedicated mod.
I have almost everything.
But still, there is something i'd like to implement, a way to exit the game as soon as the prince dies.
More specifically, and to make it look not dirty, make it happen after the death music has been played, or maybe after the user had pressed a button (I would replace "press button to continue" by something else, then.).
Currently, i have absolutely no idea how to do it, and i must confess i want to avoid having to dig in the executable by myself.
Another tricky way would be to reduce the time to zero when he dies, but i'm not sure what would happen then.
In other words, i'm looking for help from someone who already has a decent knowledge of prince.exe structure.
Thx in advance for your time and long life to this forum =]
Finally, i just registered.
Actually, i used to be there in the old popuw forums by the alias "the_mad_joob", for those who remember me.
Back in the days, i made a few gfx for pop1, which are currently available in pop1tp.
Now, i decided to use them in a dedicated mod.
I have almost everything.
But still, there is something i'd like to implement, a way to exit the game as soon as the prince dies.
More specifically, and to make it look not dirty, make it happen after the death music has been played, or maybe after the user had pressed a button (I would replace "press button to continue" by something else, then.).
Currently, i have absolutely no idea how to do it, and i must confess i want to avoid having to dig in the executable by myself.
Another tricky way would be to reduce the time to zero when he dies, but i'm not sure what would happen then.
In other words, i'm looking for help from someone who already has a decent knowledge of prince.exe structure.
Thx in advance for your time and long life to this forum =]
Re: permadeath
Well, you were here in 2010 for a moment.xhul wrote:Finally, i just registered.

I do recognize your old nick from the The Dragon Temple graphics (listed here) and the Endless tomb graphics (listed here).
Your old avatar is still available here.
David should see your post sooner or later.xhul wrote:In other words, i'm looking for help from someone who already has a decent knowledge of prince.exe structure.

Re: permadeath
Yeah, that's me.
I had also designed a custom prince & jaffar, which took me quite some time.
Good to see some old faces =]
EDIT :
I guess i'll probably have to overwrite 2 separate jumps, that normally lead to a level restart.
One when a key is pressed, and the other when the mini-timer ends.
Then, use either an exit interrupt, or a jump to the code that is processed when [Ctrl]+[Q] is pressed.
Sounds quite possible if i manage to find the jump locations...
I had also designed a custom prince & jaffar, which took me quite some time.
Good to see some old faces =]
EDIT :
I guess i'll probably have to overwrite 2 separate jumps, that normally lead to a level restart.
One when a key is pressed, and the other when the mini-timer ends.
Then, use either an exit interrupt, or a jump to the code that is processed when [Ctrl]+[Q] is pressed.
Sounds quite possible if i manage to find the jump locations...
Re: permadeath
Don't worry, I'll help you.xhul wrote: i want to avoid having to dig in the executable by myself.

I'm not sure how will players feel about that... It depends on how hard/long the levels are.xhul wrote: to exit the game as soon as the prince dies
Then you'd see the bad ending, I guess.xhul wrote: Another tricky way would be to reduce the time to zero when he dies, but i'm not sure what would happen then.
It would be more annoying than quitting, because it is shown for a few seconds and you can't interrupt it.
When "the mini-timer ends" there is no level restart. Instead, the game is restarted from the intro.xhul wrote: I guess i'll probably have to overwrite 2 separate jumps, that normally lead to a level restart.
One when a key is pressed, and the other when the mini-timer ends.
What should happen if the user presses Ctrl-A?
This means two cases: when the kid is alive, and when not.
And what about Ctrl-R, Ctrl-L to reload a saved game? (Or do you want to disable save/load?)
Re: permadeath
Hello David...
It will feature a bunch of difficulty levels, including the last one, called "master".
I wanted it to be very hard and i think it should wear its name properly =P
I was just wondering if you see the text or not, great you have that info.
Maybe the ultimate spare option then XD
So in my case, that should make things even easier =]
I guess i need to find a way to disable it, cause it would indeed represent a significant way to cheat.
I think the easiest way would be to disable it in both cases, if possible.
Anyway, i don't think the game bothers to handle it differently in the two cases, does it ?
If things are logically done, there must be a jump to some kind of level initialisation address somewhere...
Hopefully, pop handles free will.
No need to worry about that.
[Ctrl]+[L] will do nothing in that difficulty, since i intend to disable [Ctrl]+[G].
[Shift]+[L] will be disabled as well.
So, if we sum up things, here is what i need :
> after any form of death, redirect the button pressing to a program exit
> disable level restart ([Ctrl]+[A])
I am using packed 1.4, and i really hope it's not too hard to decypher...
Sounds pretty great =]David wrote:Don't worry, I'll help you.
Actually, my mod will only deal with the original levels.dat.David wrote:I'm not sure how will players feel about that... It depends on how hard/long the levels are.
It will feature a bunch of difficulty levels, including the last one, called "master".
I wanted it to be very hard and i think it should wear its name properly =P
You always have to consider spare solutions, and what's true in life in general somehow particularly applies to hacking.David wrote:Then you'd see the bad ending, I guess.
It would be more annoying than quitting, because it is shown for a few seconds and you can't interrupt it.
I was just wondering if you see the text or not, great you have that info.
Maybe the ultimate spare option then XD
Oh, you're right, i forgot that.David wrote:When "the mini-timer ends" there is no level restart. Instead, the game is restarted from the intro.
So in my case, that should make things even easier =]
Nice catch.David wrote:What should happen if the user presses Ctrl-A?
This means two cases: when the kid is alive, and when not.
I guess i need to find a way to disable it, cause it would indeed represent a significant way to cheat.
I think the easiest way would be to disable it in both cases, if possible.
Anyway, i don't think the game bothers to handle it differently in the two cases, does it ?
If things are logically done, there must be a jump to some kind of level initialisation address somewhere...
[Ctrl]+[R] would be considered a suicide.David wrote:And what about Ctrl-R, Ctrl-L to reload a saved game? (Or do you want to disable save/load?)
Hopefully, pop handles free will.
No need to worry about that.
[Ctrl]+[L] will do nothing in that difficulty, since i intend to disable [Ctrl]+[G].
[Shift]+[L] will be disabled as well.
So, if we sum up things, here is what i need :
> after any form of death, redirect the button pressing to a program exit
> disable level restart ([Ctrl]+[A])
I am using packed 1.4, and i really hope it's not too hard to decypher...
Re: permadeath
CusPop can already assist you in changing the "Restart level key" from "Control+A" to "None (deactivate)".xhul wrote:So, if we sum up things, here is what i need :
> after any form of death, redirect the button pressing to a program exit
> disable level restart ([Ctrl]+[A])
I am using packed 1.4, and i really hope it's not too hard to decypher...
I guess CusPop could use is an additional entry for the "Press Button to Continue" 'any key' in that section.
Re: permadeath
Nice !
CusPop seems to have been way improved since the last time i checked it, a few years back.
Thx a lot for the link =]
I only miss a way to redirect the level restart after death, then.
I was thinking, maybe a jump to the intro sequence would be more appropriate than just being kicked out of the game (less frustrating and faster to do a new attempt).
CusPop seems to have been way improved since the last time i checked it, a few years back.
Thx a lot for the link =]
I only miss a way to redirect the level restart after death, then.
I was thinking, maybe a jump to the intro sequence would be more appropriate than just being kicked out of the game (less frustrating and faster to do a new attempt).
Re: permadeath
@xhul, why did you register again with a new name? Did you forget about the old one?Norbert wrote: Well, you were here in 2010 for a moment.
This is the part that restarts the level it you press enter (or shift) when the kid died: (from the disassembly)xhul wrote: > after any form of death, redirect the button pressing to a program exit
Code: Select all
seg000:0538 83 3E 7E 4F 00 cmp rem_min, 0
seg000:053D 74 19 jz loc_558
seg000:053F 80 3E 65 43 06 cmp kid_alive, 6
seg000:0544 7E 12 jle loc_558
seg000:0546 80 3E C6 4C 00 cmp control_shift, 0
seg000:054B 75 06 jnz loc_553
seg000:054D 83 7E FA 0D cmp [bp+key], 0Dh ; enter
seg000:0551 75 05 jnz loc_558
seg000:0553 loc_553:
seg000:0553 C7 46 FA 01 00 mov [bp+key], 1 ; ctrl-a
seg000:0558 loc_558:
seg000:0558 83 7E FA 00 cmp [bp+key], 0
seg000:055C 75 05 jnz loc_563
seg000:055E 2B C0 sub ax, ax
seg000:0560 E9 84 03 jmp return
The default, 01, is the code of Ctrl-A.
Ctrl-R is 12.
Ctrl-Q would be 11, but it does not work here, because Ctrl-Q is checked elsewhere.
However, it might be possible to replace the whole MOV with a quit.
xhul wrote: > disable level restart ([Ctrl]+[A])
These can be done with CusPoP.xhul wrote: [Ctrl]+[L] will do nothing in that difficulty, since i intend to disable [Ctrl]+[G].
[Shift]+[L] will be disabled as well.
Though you might need to disable Ctrl-L in case someone copies a prince.sav from elsewhere.

(Ctrl-L is not in CusPoP.)
And of course disable cheat mode.
Re: permadeath
Wow, that was fast !
I see the code has already some kind of dedicated events related to keys, great (only one byte to overwrite is nice).
FAT THX !
Be sure that if my prog allows a credit section, you'll be there =]
Also, thx for the [Ctrl]+[L] thing, i didn't think of that potential breach. Nice catch again.
About my old pseudo, i wasn't sure i had created one, and didn't take enough time to verify that.
It's fun to read me back in 2010 XD
I'm gonna try everything as soon as possible, and i'll leave a feedback here.
You rock.
I see the code has already some kind of dedicated events related to keys, great (only one byte to overwrite is nice).
FAT THX !
Be sure that if my prog allows a credit section, you'll be there =]
Also, thx for the [Ctrl]+[L] thing, i didn't think of that potential breach. Nice catch again.
About my old pseudo, i wasn't sure i had created one, and didn't take enough time to verify that.
It's fun to read me back in 2010 XD
I'm gonna try everything as soon as possible, and i'll leave a feedback here.
You rock.
Re: permadeath
I took a more in-depth look at cuspop (web version), and it appears that [Ctrl]+[L] isn't handled =/
I guess there's a reason for that (must be an annoying hack or something).
Also, i wanted to completely disable cheats and it seems cuspop only allow to modify the parameter name.
I tried an empty field and didn't get any error.
No sure it didn't break anything, though.
I guess there's a reason for that (must be an annoying hack or something).
Also, i wanted to completely disable cheats and it seems cuspop only allow to modify the parameter name.
I tried an empty field and didn't get any error.
No sure it didn't break anything, though.
Re: permadeath
Probably because it is handled at a different place than the other keys (because it can be used at other times; actually it is handled at *two* places).xhul wrote: I took a more in-depth look at cuspop (web version), and it appears that [Ctrl]+[L] isn't handled =/
I guess there's a reason for that (must be an annoying hack or something).
Disabling Ctrl-L:
Note 1: You could use other values if you wanted to assign this functionality to another key.
Note 2: Ctrl-L will be treated just like any other key, i.e. load first level. (But it's possible to disable that.)
Part 1: (everywhere except the demo level)
Code: Select all
seg000:04F2 83 7E FA 0C cmp [bp+key], 0Ch ; ctrl-l
seg000:04F6 75 0B jnz loc_503
seg000:04F8 0E push cs
seg000:04F9 E8 3C 19 call near ptr load_game
seg000:04FC 0B C0 or ax, ax
seg000:04FE 75 09 jnz loc_509
seg000:0500 E9 E4 03 jmp return
(This is not Alt-255, because FF will be sign-extended to FFFF.)
(If you use 00: shift will load the game!)
Part 2: (demo level)
Code: Select all
seg006:0D05 9A 33 0E 79 0C call key_test_quit
seg006:0D0A 89 46 FE mov [bp+key], ax
seg006:0D0D 3D 0C 00 cmp ax, 0Ch ; ctrl-L
seg006:0D10 75 10 jnz loc_79D2
seg006:0D12 9A 38 1E 00 00 call load_game
seg006:0D17 0B C0 or ax, ax ; did the user press a key while demo?
seg006:0D19 74 2A jz return
(00 00 won't work, because here it means "if no key is pressed".)
That means that any parameter will activate cheats, because of how parameter checking works:xhul wrote: Also, i wanted to completely disable cheats and it seems cuspop only allow to modify the parameter name.
I tried an empty field and didn't get any error.
No sure it didn't break anything, though.
A parameter is considered matching if it *starts* with the given string.
In Arabian Nightmares, it seems that all cheat keys were disabled one-by-one.
But there is another way to disable cheats:
Disabling cheat mode:
Code: Select all
seg000:0179 B8 7D 00 mov ax, offset param_megahit ; "megahit"
seg000:017C 50 push ax ; param
seg000:017D 9A 54 0E 79 0C call check_param
seg000:0182 3D 01 00 cmp ax, 1
seg000:0185 1B C9 sbb cx, cx ; to bool
seg000:0187 41 inc cx
seg000:0188 89 0E 9C 00 mov cheats_enabled, cx
Re: permadeath
A room has already been reserved for you in the credits, thx again =]
I'll create a dedicated topic for my mod as soon as it's finished (should come fast).
But you've been warned, it is old-school =P
I'll create a dedicated topic for my mod as soon as it's finished (should come fast).
But you've been warned, it is old-school =P
Re: permadeath
Everything seems to work like a charm, as far as what i've tested.
Looks like i may need one more thing, though.
In one of my difficulties, i would like to turn off auto life regen between levels.
Not sure if it's hard to do or not, but i ask just in case...
Looks like i may need one more thing, though.
In one of my difficulties, i would like to turn off auto life regen between levels.
Not sure if it's hard to do or not, but i ask just in case...
Re: permadeath
Disabling HP regeneration:xhul wrote: i would like to turn off auto life regen between levels.
The game already has a mechanism for disabling HP regeneration between level 12 and 13.
(I called it "seamless". It also disables showing the level number.)
We just have to change it so that it is activated on every level after level 1 (instead of activated by the "seamless" flag).
(Note that showing the level number is checked elsewhere, so it's not affected by this hack.)
Code: Select all
seg003:021F 83 3E 86 58 00 cmp seamless, 0
seg003:0224 75 1D jnz loc_4A33
seg003:0226 83 3E 9E 0F 00 cmp current_level, 0 ; HP on demo level
seg003:022B 74 08 jz loc_4A25
seg003:022D A1 08 46 mov ax, hitp_beg_lev
seg003:0230 89 46 FE mov [bp+hitpoints], ax
seg003:0233 EB 05 jmp short loc_4A2A
seg003:0235 loc_4A25:
seg003:0235 C7 46 FE 04 00 mov [bp+hitpoints], 4 ; HP on demo level
seg003:023A loc_4A2A:
seg003:023A 8B 46 FE mov ax, [bp+hitpoints]
seg003:023D A3 98 4C mov hitp_curr, ax
seg003:0240 A3 F2 5F mov hitp_max, ax
seg003:0243 loc_4A33:
1.0: Search 83 3E 86 58 00 75 1D, replace with 83 3E 9E 0F 01 7F 1D
1.3: Search 83 3E 78 5A 00 75 1D, replace with 83 3E B0 10 01 7F 1D
1.4: Search 83 3E 4A 58 00 75 1D, replace with 83 3E AA 10 01 7F 1D
(cmp current_level,1 & jg loc_....)
Note: This also disables the setting of HP when loading a saved game. (But you disabled ctrl-L, so it's not a problem.)
---
By the way, are you going to disable the potions level?
I bumped into it while I was testing this hack with PoP 1.4.
Re: permadeath
Wow, thanks.
I think i'm good with prince.exe.
If you're interested, here is how it will work in my mod.
Let's spoil a little bit...
DEFAULT CHANGES (all difficulties)
custom graphics : kid.dat , pv.dat , vdungeon.dat , vizier.dat , vpalace.dat
level 15 removed (copy protection)
warping removed ([shift]+[L])
default level palette in all levels
cheating removed ("improved" parameter)
saving removed ([Ctrl]+[G])
loading removed ([Ctrl]+[L])
SPECIFIC CHANGES
soldier : no restrictions (only no save/load compared to the original pop)
knight : no big life potions (levels.dat)
warrior : no small life potions (levels.dat)
lord : no regen between levels (prince.exe)
prince : 1 life at start (prince.exe)
king : permadeath (prince.exe)
All restrictions will be cumulative, so, for example, the last difficulty has all of those at once.
Now, let's just hope all the changes won't interfer with each other...
Additionally, you cannot play a difficulty if you haven't completed the previous one.
With such system, i intend to exploit the "die and retry" aspect of the game as much as possible.
Of course, prince.hof files will be handled separately for each diff.
ABOUT LEVELS.DAT
The idea in this mod was to rediscover the original levels in a different (more difficult) way, in order to actually extend the life of the game.
Only the small & big life potions will be altered (see above).
I was just wondering about something in level 5, though.
Instead of just removing it, i thought of replacing the big pot stoled by the shadow by an empty one.
That way, the shadow animation would still be coherent.
And, in case the player manages to actually drink it, he won't be able to bypass the restriction.
That is probably the best way to handle it "correctly", i guess.
MOD NAME
I thought of many different titles, and finally came up with "king of persia" (i know, not very original, but that fits the whole mod idea so much).
According to my quick web researchs, no mod is already called like that.
There is a user with that name, though.
I think i'm good with prince.exe.
If you're interested, here is how it will work in my mod.
Let's spoil a little bit...
DEFAULT CHANGES (all difficulties)
custom graphics : kid.dat , pv.dat , vdungeon.dat , vizier.dat , vpalace.dat
level 15 removed (copy protection)
warping removed ([shift]+[L])
default level palette in all levels
cheating removed ("improved" parameter)
saving removed ([Ctrl]+[G])
loading removed ([Ctrl]+[L])
SPECIFIC CHANGES
soldier : no restrictions (only no save/load compared to the original pop)
knight : no big life potions (levels.dat)
warrior : no small life potions (levels.dat)
lord : no regen between levels (prince.exe)
prince : 1 life at start (prince.exe)
king : permadeath (prince.exe)
All restrictions will be cumulative, so, for example, the last difficulty has all of those at once.
Now, let's just hope all the changes won't interfer with each other...
Additionally, you cannot play a difficulty if you haven't completed the previous one.
With such system, i intend to exploit the "die and retry" aspect of the game as much as possible.
Of course, prince.hof files will be handled separately for each diff.
ABOUT LEVELS.DAT
The idea in this mod was to rediscover the original levels in a different (more difficult) way, in order to actually extend the life of the game.
Only the small & big life potions will be altered (see above).
I was just wondering about something in level 5, though.
Instead of just removing it, i thought of replacing the big pot stoled by the shadow by an empty one.
That way, the shadow animation would still be coherent.
And, in case the player manages to actually drink it, he won't be able to bypass the restriction.
That is probably the best way to handle it "correctly", i guess.
MOD NAME
I thought of many different titles, and finally came up with "king of persia" (i know, not very original, but that fits the whole mod idea so much).
According to my quick web researchs, no mod is already called like that.
There is a user with that name, though.