Page 1 of 1

How to get unlimited time

Posted: August 26th, 2020, 1:50 am
by Emiliano
Hi guys I found but maybe I'm not the first one, the way to get unlimited time for a mod.
I don't know if this topic should go here or with the Hex editing because it is more about it.

Re: How to get unlimited time

Posted: August 26th, 2020, 3:00 pm
by Emiliano
Before getting a timeless mod please see this post of an expert
You must know it before starting

Re: How to get unlimited time

Posted: August 27th, 2020, 1:38 am
by Emiliano
Just like David said, I finished level 14 in a test and this happened, the time I took -1 minute, it is still counted to the left, look at the picture; to clear something I set 65535 minutes (FFFF in Hex).
Edit: time is still counted to the left, but without limit, according to this
-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, fixed my big mistake.

Re: How to get unlimited time

Posted: August 27th, 2020, 4:27 am
by Emiliano
I tested this with apoplexy, I started directly in level 14, maybe Jaffar's death can stop the time in this mode too
Let's see what David can tell us about it…

Re: How to get unlimited time

Posted: August 27th, 2020, 8:02 pm
by David
Emiliano Fierro wrote: August 27th, 2020, 4:27 am I tested this with apoplexy, I started directly in level 14, maybe Jaffar's death can stop the time in this mode too
Let's see what David can tell us about it…
Yes, Jaffar's death stops the time in this mode too.

You can see it in the saved game file:
* After Jaffar died, press Ctrl+G.
* Make a copy of PRINCE.SAV.
* Then wait some time and press Ctrl+G again.
* The two versions of the file should contain the same bytes.
(PRINCE.SAV contains the remaining minutes, remaining ticks, level number, and hit points; each on 2 bytes.)

Re: How to get unlimited time

Posted: August 27th, 2020, 8:53 pm
by Emiliano
In that case I don't know what happened here :| , I followed your instructions just like you said; these files were saved with seconds of difference, look at the AF 00 and the 09 00 ticks bytes
Do you know why this happened?

Edit: I thought this happened because I killed Jaffar by moving him to Room 0 below, but I killed him by spikes and happened again, the ticks bytes are different

Re: How to get unlimited time

Posted: August 27th, 2020, 9:03 pm
by Emiliano
If you are not convinced yet, please see this
(Different sav files of the second try)

Re: How to get unlimited time

Posted: August 27th, 2020, 9:39 pm
by David
Emiliano Fierro wrote: August 27th, 2020, 8:53 pm Edit: I thought this happened because I killed Jaffar by moving him to Room 0 below, but I killed him by spikes and happened again, the ticks bytes are different
That's strange.
Did the screen flash when Jaffar died? Time stops only then.

Maybe you could upload here your PRINCE.EXE and maybe LEVELS.DAT?

Re: How to get unlimited time

Posted: August 27th, 2020, 10:05 pm
by Emiliano
David wrote: August 27th, 2020, 9:39 pm Did the screen flash when Jaffar died? Time stops only then.
Yes it happened, in fact I tried a third time and still happened the same :|
David wrote: August 27th, 2020, 9:39 pm Maybe you could upload here your PRINCE.EXE and maybe LEVELS.DAT?
Are they useful unfinished? I applied some of the custom hacks and I guess can't be detected by diffpop

Do you think if I make a non timeless exe, would this be fixed?

The mod uses original graphics and audio, so simply copy the missing files from the original PoP1 package

Re: How to get unlimited time

Posted: August 27th, 2020, 10:28 pm
by Emiliano
Alright I'm sending LEVELS.DAT and PRINCE.EXE, level 12 is in current progress, levels 13 and 14 haven't been built and all the problems were generated in test mode
The Hex modifications were gotten by David
I also share the hacks in HEX EDITING applied to the mod, maybe you can find the mistake here below:

Shadow skill and hit points
(Original) C7 06 68 43 03 00 B8 04 00
(Replaced) C7 06 68 43 0A 00 B8 08 00

Loose floors and potion or sword bug fix
Potions
(Original) 0E E8 6C FD (0xA21E)
(Replaced) 0E E8 7A FD
Sword
(Original) 0E E8 45 FD (0xA245)
(Replaced) 0E E8 53 FD

Disable Special Event in level 1
(Original) 83 3E 9E 0F 01 75 22 B8 05 00
(Replaced) 83 3E 9E 0F 01 75 22 EB 1B 00

Disable Jaffar's death triggers exit door in level 12b
(Original) C7 06 9C 40 02 00 (0x9B78)
(Replaced) 90 90 90 90 90 90

Changing skeleton guards behavior
(Original) 80 3E 2D 3D 04 75 10 C6 06 2E 3D 02 (0x50F4)
(Replaced) 80 3E 2D 3D 04 EB 10 C6 06 2E 3D 02

(Original) C6 06 2E 3D 02 0E E8 0B 00 (0x5780)
(Replaced) 90 90 90 90 90 0E E8 0B 00

(Original) 80 3E 2D 3D 02 75 65 (0x9D1C)
(Replaced) 80 3E 2D 3D 02 7C 65

Remove the shadow from level 5
(Original) 83 3E 9E 0F 05 75 23 (0x5017)
(Replaced) 83 3E 9E 0F CC 75 23

Remove the shadow from level 6
(Original) 83 3E 9E 0F 06 75 29 (0x4FE7)
(Replaced) 83 3E 9E 0F CC 75 29

Don't show the shadow's HP
(Original) 83 3E 9E 0F 0C 75 6A (0x2A29)
(Replaced) 83 3E 9E 0F CC 75 6A

Number of minutes
(Original) 3C 00 C7 06 (60 minutes) (0x60D3)
(Replaced) FF FF C7 06

Remove running entry
(Original) 83 3E 9E 0F 0D 75 05
(Replaced) 83 3E 9E 0F CC 75 05

Enable level ending music on level 13
(Original) 83 3E 9E 0F 0D 74 23 (0x88CA)
(Replaced) 83 3E 9E 0F CC 74 23

Make both the prince and the shadow lose a HP when either is hurt
(Original) 80 3E 8B 4D 01 75 14 83 3E 9E 0F 0C 75 0D 83 3E 4A 4C 00 74 06 A1 4A 4C A3 F0 5F
(Replaced) 80 3E 9E 0F 0C 75 14 A1 4A 4C 0B 06 F0 5F 79 0B A3 4A 4C A3 F0 5F 90 90 90 90 90

Swap chompers direction
(Original) C7 46 F6 00 00 A0 27 3D 98 8B D8 D1 E3 8B 87 74 22 89 46 F8 (0xAD2E)
(Replaced) BE 00 00 8A 1E 27 3D 30 FF D1 E3 8B 87 74 22 04 09 89 46 F8

(Original) FF 46 F6 FF 46 F8 83 7E F6 0A 7C AE (0xAD8A)
(Replaced) 46 FF 4E F8 90 90 81 FE 0A 00 7C AE

Stop automatic time count in timeless mods
(Original) FF 0E 7E 4F 74 3D
(Replaced) FF 0E 7E 4F 7E 3D

Re: How to get unlimited time

Posted: August 28th, 2020, 8:22 am
by David
Emiliano Fierro wrote: August 27th, 2020, 10:28 pm I also share the hacks in HEX EDITING applied to the mod, maybe you can find the mistake here below:
Thank you for the list!

The problem is indeed caused by one of those edits:
Emiliano Fierro wrote: August 27th, 2020, 10:28 pm Disable Jaffar's death triggers exit door in level 12b
(Original) C7 06 9C 40 02 00 (0x9B78)
(Replaced) 90 90 90 90 90 90
This hack disables setting the exit open flag. That flag is used by the special event which opens the exit.
However, the same flag is used for stopping the time.

If I undo this hack then time will stop when Jaffar dies.

You should undo the hack above, and use this instead:

Search: 83 3E 9C 40 02 75 1A
Change: 75 to EB (offset is 0x5578 in unpacked v1.0)

Details:

Code: Select all

seg002:0643                      Jaffar_exit     proc far
seg002:0643 83 3E 9C 40 02                       cmp     leveldoor_open, 2 ; is Jaffar dead?
seg002:0648 75 1A                                jnz     locret_3CE4 ; <-- change to JMP

Re: How to get unlimited time

Posted: August 28th, 2020, 8:41 am
by Emiliano
Thanks a lot David, I will do it later today :D
I also need to edit the file where I copied all the custom hacks you helped me with ;)
Edit: Thanks a lot again, I did the new hack and it worked properly, now both SAV files have the same bytes :D

Re: How to get unlimited time

Posted: August 31st, 2020, 4:08 am
by Emiliano
Emiliano Fierro wrote: August 27th, 2020, 1:38 am Just like David said, I finished level 14 in a test and this happened, the time I took -1 minute, it is still counted to the left, look at the picture; to clear something I set 65535 minutes (FFFF in Hex).
Edit: time is still counted to the left, but without limit, according to this
-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, fixed my big mistake.
This time count is just this way, once in a playtest with Apoplexy I started directly on Room 5 of level 14 to see the minimum time reachable and it still appeared as -2:59, so if you want to play(test) my mod just subtract (-2:59) * yes in negative numbers, to your negative time left, then multiply by -1 and you will get the time it took you to finish the mod.