Guard fight fail

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

Guard fight fail

Post by Emiliano »

First, I don't know if this should go here or somewhere else
I found a fail between a guard fight next to a tapestry with floor and I would like to fix it.
The guard stops being aggresive if you move him to the tapestry with floor and does not do anything else than turning to see the prince
watch the video to understand
65536
User avatar
atrueprincefanfrom18
Site Shah
Site Shah
Posts: 1782
Joined: January 21st, 2020, 2:53 pm
Contact:

Re: Guard fight fail

Post by atrueprincefanfrom18 »

This has already been discussed before in this thread. I don't know if it can be fixed. If it can be fixed it's David who can help you fix it. And if it can be fixed, it's in the correct thread! :D
Love to create new MODS :)

My complete list of mods until now!

My channel. Do consider subscribing it! :)
David
The Prince of Persia
The Prince of Persia
Posts: 2846
Joined: December 11th, 2008, 9:48 pm
Location: Hungary

Re: Guard fight fail

Post by David »

Emiliano Fierro wrote: June 20th, 2020, 1:04 am I found a fail between a guard fight next to a tapestry with floor and I would like to fix it.
The guard stops being aggresive if you move him to the tapestry with floor and does not do anything else than turning to see the prince
I've recently fixed this in SDLPoP:
https://github.com/NagyD/SDLPoP/commit/ ... 30f45eb150
https://github.com/NagyD/SDLPoP/commit/ ... aac97bb54f


I've also found how to fix this in PoP DOS:

Search: 80 3E F9 42 07 75 03 E9 31 FF 80 3E F9 42 0C 75 9C E9 27 FF
(The offset is 0x6B20 in unpacked v1.0.)
Change to: 8B 5E FE 39 5E FA 74 A5 3C 07 75 A1 3C 0C E9 2A FF 90 90 90

This hack is not perfect, though.
If either the guard or the prince is between a doortop on the left and a gate on the right (and they are adjacent tiles), and his opponent is on his left side, then the game thinks they can see each other.
I could solve this in SDLPoP (see the second commit), but in PoP DOS there is simply not enough space to do this properly.


Details:

Code: Select all

We change this part:
seg003:0A76 E8 20 00                        call  near ptr get_tile_at_kid
seg003:0A79 3C 14                           cmp   al, tiles_20_wall
seg003:0A7B 75 03                           jnz   loc_5270
seg003:0A7D E9 3B FF                        jmp   return_0
seg003:0A80                      loc_5270:
seg003:0A80 80 3E F9 42 07                  cmp   curr_tile2, tiles_7_doortop_with_floor
seg003:0A85 75 03                           jnz   loc_527A
seg003:0A87 E9 31 FF                        jmp   return_0
seg003:0A8A                      loc_527A:
seg003:0A8A 80 3E F9 42 0C                  cmp   curr_tile2, tiles_12_doortop
seg003:0A8F 75 9C                           jnz   loc_521D
seg003:0A91 E9 27 FF                        jmp   return_0

The new code is:
00000A80:i8B5EFE                         mov       bx,[bp-02] ; right_pos
00000A83:i395EFA                         cmp       [bp-06],bx ; left_pos
00000A86:i74A5                           je        file:00000A2D ; loc_521D
00000A88:i3C07                           cmp       al,07 ; tiles_7_doortop_with_floor
00000A8A:i75A1                           jne       file:00000A2D ; loc_521D
00000A8C:i3C0C                           cmp       al,0C ; tiles_12_doortop
00000A8E:iE92AFF                         jmpn      file:000009BB ; return_0
(followed by 3 NOPs)
Post Reply