Page 1 of 1

Modifying the sword position of guards

Posted: August 9th, 2017, 4:58 pm
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?

Re: Modifying the sword position of guards

Posted: August 12th, 2017, 11:31 am
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...

Re: Modifying the sword position of guards

Posted: August 16th, 2017, 6:44 am
by R3
methinks this is what they call a "lethal weapon"... Image

Re: Modifying the sword position of guards

Posted: August 26th, 2017, 12:17 pm
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?

Re: Modifying the sword position of guards

Posted: August 27th, 2017, 10:37 am
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:

Re: Modifying the sword position of guards

Posted: August 31st, 2017, 12:45 pm
by Qwerty
Thanks! It works perfectly!

Re: Modifying the sword position of guards

Posted: August 31st, 2017, 6:14 pm
by Norbert
David is the hex master. :)

Re: Modifying the sword position of guards

Posted: September 10th, 2019, 5:30 am
by 4DPlayer
Worked for me too. I wonder the same would be possible for skeletons.

Re: Modifying the sword position of guards

Posted: September 15th, 2019, 2:54 pm
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).

Re: Modifying the sword position of guards

Posted: September 15th, 2019, 2:56 pm
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.

Re: Modifying the sword position of guards

Posted: March 18th, 2020, 3:26 pm
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 )

Re: Modifying the sword position of guards

Posted: March 18th, 2020, 3:43 pm
by Norbert
atrueprincefanfrom18 wrote: March 18th, 2020, 3:26 pmHe is an hexpert!
Hah. :D