Modifying the sword position of guards

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.
Post Reply
Qwerty
Scholar Scribe
Scholar Scribe
Posts: 3
Joined: August 9th, 2017, 4:25 pm

Modifying the sword position of guards

Post by Qwerty »

Hello, I'm new to the forum. I have the following question/problem.
For an experiment, I made a new type of enemy based on the fat guard, only twice as big (intended as a boss). It works fine, save for one little detail: the guard's sword is positioned according to his original size. Is it possible somehow to change the coordinates of the sword so it wouldn't look that funny?
Attachments
princew3_000.png
princew3_000.png (5.98 KiB) Viewed 7511 times
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifying the sword position of guards

Post by David »

Qwerty wrote:Is it possible somehow to change the coordinates of the sword so it wouldn't look that funny?
Well, I know where are the coordinates stored in PRINCE.EXE.
But if you changed those then the sword would move for all guards and even the prince.

I'd say this would be easier to do with SDLPoP.
The position of the sword is determined here: https://github.com/NagyD/SDLPoP/blob/ma ... 06.c#L1929

I am trying to make a PRINCE.EXE hack as well, but there are not enough available bytes...
User avatar
R3
Vizier
Vizier
Posts: 99
Joined: June 19th, 2015, 8:17 am

Re: Modifying the sword position of guards

Post by R3 »

methinks this is what they call a "lethal weapon"... Image
Qwerty
Scholar Scribe
Scholar Scribe
Posts: 3
Joined: August 9th, 2017, 4:25 pm

Re: Modifying the sword position of guards

Post by Qwerty »

David wrote:
Qwerty wrote:Is it possible somehow to change the coordinates of the sword so it wouldn't look that funny?
Well, I know where are the coordinates stored in PRINCE.EXE.
But if you changed those then the sword would move for all guards and even the prince.

I'd say this would be easier to do with SDLPoP.
The position of the sword is determined here: https://github.com/NagyD/SDLPoP/blob/ma ... 06.c#L1929

I am trying to make a PRINCE.EXE hack as well, but there are not enough available bytes...
A very belated thank you for your reply.

I see that it's not really feasible to change the sword coordinates - but would it be possible to make the sword of certain guards invisible (~not drawn) instead?
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifying the sword position of guards

Post by David »

Qwerty wrote:I see that it's not really feasible to change the sword coordinates - but would it be possible to make the sword of certain guards invisible (~not drawn) instead?
I think I found how to do that.
Hex-edit PRINCE.EXE:
search: 80 3E 2E 3D 00 75 0E 80 3E 2D 3D 02 75 65 80 3E 2F 3D 00 7D 5E
change to: 80 3E 2D 3D 02 74 07 80 3E 2E 3D 00 EB 05 83 3E 9E 0F ## 74 5E -- where ## is the level where you want to hide the sword.

Technical details for the curious:
Spoiler: show
We are changing this: Char.sword != sword_0_sheathed || (Char.charid == charid_2_guard && Char.alive < 0) [SDLPoP]

Code: Select all

seg006:17B0 80 3E 2E 3D 00                       cmp     char.sword, 0
seg006:17B5 75 0E                                jnz     loc_8475
seg006:17B7 80 3E 2D 3D 02                       cmp     char.charid, charid_2_guard
seg006:17BC 75 65                                jnz     return
seg006:17BE 80 3E 2F 3D 00                       cmp     char.alive, 0
seg006:17C3 7D 5E                                jge     return
seg006:17C5                      loc_8475:
to this: charid == 2 ? level != 6 : sword != 0 (assuming ## is 6)

Code: Select all

seg006:17B0 80 3E 2D 3D 02                       cmp char.charid, charid_2_guard
seg006:17B5 74 07                                je  XXX
seg006:17B7 80 3E 2E 3D 00                       cmp char.sword, 0
seg006:17BC EB 05                                jmp YYY
seg006:17BE 83 3E 9E 0F 06       XXX:            cmp current_level, 6
seg006:17C3 74 5E                YYY:            je  return
seg006:17C5                      loc_8475:
Qwerty
Scholar Scribe
Scholar Scribe
Posts: 3
Joined: August 9th, 2017, 4:25 pm

Re: Modifying the sword position of guards

Post by Qwerty »

Thanks! It works perfectly!
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Modifying the sword position of guards

Post by Norbert »

David is the hex master. :)
4DPlayer

Re: Modifying the sword position of guards

Post by 4DPlayer »

Worked for me too. I wonder the same would be possible for skeletons.
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifying the sword position of guards

Post by David »

4DPlayer wrote: September 10th, 2019, 5:30 am Worked for me too. I wonder the same would be possible for skeletons.
search: 80 3E 2E 3D 00 75 0E 80 3E 2D 3D 02 75 65 80 3E 2F 3D 00 7D 5E
change to: 80 3E 2D 3D 00 75 07 80 3E 2E 3D 00 EB 05 83 3E 9E 0F ## 74 5E -- where ## is the level where you want to hide the sword.

The background is similar to the original hack, except instead of "charid == 2" this one has "charid != 0", so it works for skeletons as well (charid == 4).
4DPlayer

Re: Modifying the sword position of guards

Post by 4DPlayer »

David wrote: September 15th, 2019, 2:54 pm
4DPlayer wrote: September 10th, 2019, 5:30 am Worked for me too. I wonder the same would be possible for skeletons.
search: 80 3E 2E 3D 00 75 0E 80 3E 2D 3D 02 75 65 80 3E 2F 3D 00 7D 5E
change to: 80 3E 2D 3D 00 75 07 80 3E 2E 3D 00 EB 05 83 3E 9E 0F ## 74 5E -- where ## is the level where you want to hide the sword.

The background is similar to the original hack, except instead of "charid == 2" this one has "charid != 0", so it works for skeletons as well (charid == 4).
Alright! :P
Thanks for taking your time to find it.
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Modifying the sword position of guards

Post by atrueprincefanfrom18 »

Norbert wrote: August 31st, 2017, 6:14 pm David is the hex master. :)
He is an hexpert!
(Yes, not a typo: hex + expert = hexpert :D :D :D )
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 5743
Joined: April 9th, 2009, 10:58 pm

Re: Modifying the sword position of guards

Post by Norbert »

atrueprincefanfrom18 wrote: March 18th, 2020, 3:26 pmHe is an hexpert!
Hah. :D
Post Reply