Modifying the sword position of guards

Discussions about all other tools (CusPop, SAV/HOF editors) and hex editing.

Moderator: English Moderator Team

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

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 174 times

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

Re: Modifying the sword position of guards

Post by David » August 12th, 2017, 11:31 am

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 » August 16th, 2017, 6:44 am

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

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: 1505
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Modifying the sword position of guards

Post by David » August 27th, 2017, 10:37 am

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 » August 31st, 2017, 12:45 pm

Thanks! It works perfectly!

User avatar
Norbert
The Prince of Persia
The Prince of Persia
Posts: 3167
Joined: April 9th, 2009, 10:58 pm
Contact:

Re: Modifying the sword position of guards

Post by Norbert » August 31st, 2017, 6:14 pm

David is the hex master. :)

Post Reply