I need help with custom hacks

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with exit doors

Post by Emiliano »

Hi again, I would like to disable Jaffar's death triggers exit door in level 12b and change it to like other exit doors in other levels, just opened by stepping on a button linked to them, I would like to do this in some of my mods
It may involve Hex editing, doesn't it?
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with exit doors

Post by atrueprincefanfrom18 »

By default, in Level 12b after "first" Jaffar is killed, except the level opening door, you can go through all the level exit doors. I guess to prevent that you need to do hex editing and it was discussed somewhere, but I can't find it right now. If I find it, I'll let you know.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with exit doors

Post by Emiliano »

I guess it's better to ask David for this case
Don't you think so?
Last edited by Emiliano on June 17th, 2020, 7:37 pm, edited 1 time in total.
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with exit doors

Post by atrueprincefanfrom18 »

Emiliano Fierro wrote: June 17th, 2020, 7:34 pm It's better to ask David for this case
Don't you think so?
Then wait for 3 days ;)
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with exit doors

Post by atrueprincefanfrom18 »

It was already into the special events page :)
Check this.
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with exit doors

Post by Emiliano »

Thanks
65536
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with exit doors

Post by Emiliano »

I read the whole thread and I couldn't find a post that fully answers my request, I will wait for David
65536
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: Modifications to prince.exe (hex editing)

Post by Emiliano »

Hi there, I would like to fix this bug
You will see, in the left side I set loose floors and by the right side I set a poisonous blue potion I don't know if it is related
Even thought the colors are 199 199 199 and 255 255 255 in the bug for dungeon and, 93 93 93 and 52 52 52 for palace. I just don't like it and I would like to fix them
Thanks for the help
Attachments
Bug001b.png
Bug001b.png (8.67 KiB) Viewed 9003 times
Bug001.png
Bug001.png (7.92 KiB) Viewed 9003 times
Last edited by Emiliano on June 17th, 2020, 8:42 pm, edited 1 time in total.
65536
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: Modifications to prince.exe (hex editing)

Post by Emiliano »

And other hack:
I would like to make the skeletons swap their direction when the hear the prince's steps (like the other guards) instead of keeping it
See the images
Attachments
prince_037.png
prince_037.png (2.96 KiB) Viewed 9003 times
prince_036.png
prince_036.png (3.57 KiB) Viewed 9003 times
65536
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

I need help with custom hacks

Post by Emiliano »

Hi there, I made this post just because David always reads the posts in this forum, sorry :(
I supplicate you to keep this post at least until David replies :(
As the topic title says, I need some custom hacks for my next mod Lihinghntom's Twisty Levelset
First
(Default) Jaffar's death triggers exit door in level 12b
(Custom) Exit door can only be opened by stepping on a button linked to it
Second
(Default) A bug between a loose floor in the left side and a potion in the right side
(Custom) No bug between a loose floor and a potion
Third and last for now
(Default) Skeletons don't turn even if they hear the prince's steps
(Custom) Skeletons turn if they hear the prince's steps (behavior of the other guards)
Sincerely I really wonder if is this one possible

I guess it would be useful to have an answer in this same thread instead of various dispersed replies in the original topics
However you will see what to do
65536
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: I need help with custom hacks

Post by David »

Emiliano Fierro wrote: June 18th, 2020, 5:17 am First
(Default) Jaffar's death triggers exit door in level 12b
(Custom) Exit door can only be opened by stepping on a button linked to it
Search: C7 06 9C 40 02 00
Change to: 90 90 90 90 90 90 (offset is 0x9B78 in unpacked v1.0)

Details:

Code: Select all

in on_guard_killed():
seg006:15FF 83 3E 9E 0F 0D             cmp  current_level, 13 ; Jaffar's level: flash
seg006:1604 75 1D                      jnz  loc_82D3
seg006:1606 C7 06 94 4D 0F 00          mov  flash_color, colors_15_white_flash_texts ; white
seg006:160C C7 06 50 43 12 00          mov  flash_time, 18
seg006:1612 C7 06 1C 43 01 00          mov  is_show_time, 1
seg006:1618 C7 06 9C 40 02 00          mov  leveldoor_open, 2 ; <-- we remove this
seg006:161E B8 2B 00                   mov  ax, sound_43_Jaffar_death

Emiliano Fierro wrote: June 18th, 2020, 5:17 am Third and last for now
(Default) Skeletons don't turn even if they hear the prince's steps
(Custom) Skeletons turn if they hear the prince's steps (behavior of the other guards)
These will disable the skeleton always being active, because only inactive guards can turn around.

Search: 80 3E 2D 3D 04 75 10 C6 06 2E 3D 02
Change: 75 to EB (offset is 0x50F4 in unpacked v1.0)

Search: C6 06 2E 3D 02 0E E8 0B 00
Change: first 5 bytes to 90 90 90 90 90 (offset is 0x5780 in unpacked v1.0)

But now the skeleton's sword will disappear when it's inactive.
To fix this:
Search: 80 3E 2D 3D 02 75 65
Change: 75 to 7C (offset is 0x9D1C in unpacked v1.0)

Details:

Code: Select all

in enter_guard():
seg002:01BF 80 3E 2D 3D 04           cmp  char.charid, charid_4_skeleton ; skeleton
seg002:01C4 75 10                    jnz  loc_3856 ; <-- we change this to jmp
seg002:01C6 C6 06 2E 3D 02           mov  char.sword, 2

in autocontrol_skeleton():
seg002:0850 C6 06 2E 3D 02           mov   char.sword, 2 ; <-- we remove this
seg002:0855 0E                       push  cs
seg002:0856 E8 0B 00                 call  near ptr autocontrol_guard

in add_sword_to_objtable():
seg006:17B7 80 3E 2D 3D 02           cmp  char.charid, charid_2_guard ; guard
seg006:17BC 75 65                    jnz  return ; <-- we change this to jl
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

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

Re: I need help with custom hacks

Post by David »

Emiliano Fierro wrote: June 18th, 2020, 5:17 am Second
(Default) A bug between a loose floor in the left side and a potion in the right side
(Custom) No bug between a loose floor and a potion
This bug happens with both potions and swords. I made a fix for both.

To fix the bug with potions:
Search: 0E E8 6C FD
Change: 6C to 7A (offset is 0xA21E in unpacked v1.0)

To fix the bug with swords:
Search: 0E E8 45 FD
Change: 45 to 53 (offset is 0xA245 in unpacked v1.0)

Details:

Code: Select all

We replace two calls to set_redraw_anim_curr (seg007:018C) with calls to redraw_at_trob (seg007:019A).
set_redraw_anim_curr redraws both the potion (or sword) and the right half of the loose floor on the left.
redraw_at_trob redraws the left half of the floor under the potion (or sword) as well, hiding the edge of the loose floor.

The offsets in "call near" instructions are relative to the offset of the next instruction, that's why we need the subtractions.

in animate_potion():
seg007:041C 0E                    push  cs
seg007:041D E8 6C FD              call  near ptr set_redraw_anim_curr
seg007:0420

old: 0x018C - 0x0420 = 0xFD6C
new: 0x019A - 0x0420 = 0xFD7A

in animate_sword():
seg007:0443 0E                    push  cs
seg007:0444 E8 45 FD              call  near ptr set_redraw_anim_curr
seg007:0447

old: 0x018C - 0x0447 = 0xFD45
new: 0x019A - 0x0447 = 0xFD53
User avatar
Emiliano
Wizard Scribe
Wizard Scribe
Posts: 718
Joined: July 31st, 2019, 8:53 pm
Location: Mexico
Contact:

Re: I need help with custom hacks

Post by Emiliano »

Thanks, now it will look better :D
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: I need help with custom hacks

Post by atrueprincefanfrom18 »

On the other hand, if there are no special events, don't you think the level would be boring to play?
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
Post Reply