Killability of skeletons
Killability of skeletons
CusPop has a "Set up guard types" section, but those settings only change the enemy appearances. I would like to make skeletons unkillable regardless the levels they appear on. (And, make the prince die if he skills customly placed shadows, regardless the levels they appear on.) In the seg002.c file of David's conversion I found a comment "// You can't hurt skeletons" with a reference to loc_4276, that is also mentioned in the disassembly, as "cmp char_charid, charid_4_skeleton" plus "jz loc_42D6" (jump if/on zero). If I'm not mistaken this means it skips the hit point deduction if char_charid is equal to a skeleton. But where in PRINCE.EXE does the game set those char_charids for the enemies in each level?
Re: Killability of skeletons
Correct.Norbert wrote: "cmp char_charid, charid_4_skeleton" plus "jz loc_42D6" (jump if/on zero).
If I'm not mistaken this means it skips the hit point deduction if char_charid is equal to a skeleton.
It's in enter_guard(), in seg002.c:Norbert wrote: But where in PRINCE.EXE does the game set those char_charids for the enemies in each level?
Code: Select all
// level 3 has skeletons with infinite lives
if (current_level == 3) {
Char.charid = charid_4_skeleton;
} else {
Char.charid = charid_2_guard;
}
That is, invincibility should depend on the level's guard type, not the level number.
The relevant part of the disassembly: (I deleted some empty lines)
Code: Select all
seg002:0196 EB 06 jmp short loc_381E
seg002:0198 loc_3818:
seg002:0198 C7 06 88 58 00 00 mov curr_guard_color, 0 ; non-plain guards have only one color
seg002:019E loc_381E:
seg002:019E 83 3E 9E 0F 03 cmp current_level, 3 ; level 3 has skeletons with infinite lives
seg002:01A3 75 07 jnz loc_382C
seg002:01A5 C6 06 2D 3D 04 mov char_charid, charid_4_skeleton ; skeleton
seg002:01AA EB 05 jmp short loc_3831
seg002:01AC loc_382C:
seg002:01AC C6 06 2D 3D 02 mov char_charid, charid_2_guard ; guard
seg002:01B1 loc_3831:
Code: Select all
1556:0196 EB0F JMP 01A7
1556:0198 C70688580000 MOV WORD PTR [5888],0000
1556:019E B004 MOV AL,04
1556:01A0 83BFD40302 CMP WORD PTR [BX+03D4],+02
1556:01A5 7402 JZ 01A9
1556:01A7 B002 MOV AL,02
1556:01A9 A22D3D MOV [3D2D],AL
1556:01AC 90 NOP
1556:01AD 90 NOP
1556:01AE 90 NOP
1556:01AF 90 NOP
1556:01B0 90 NOP
Replace with: EB 0F C7 06 88 58 00 00 B0 04 83 BF D4 03 02 74 02 B0 02 A2 2D 3D 90 90 90 90 90
(I guess you meant "kills".)Norbert wrote: And, make the prince die if he skills customly placed shadows, regardless the levels they appear on.
Do you mean guards (placed in the editor) on levels with guard type=shadow (set with CusPoP), or the special shadow appearing on levels 5,6,12?
And maybe make shadow-guards placed in the editor look like the shadow? (Currently they look like the kid.)
This might require further changes to the part above.
Re: Killability of skeletons
Thanks for this information, with my limited assembly skills I would've never been able to come up with that.David wrote:Search: EB 06 C7 06 88 58 00 00 83 3E 9E 0F 03 75 07 C6 06 2D 3D 04 EB 05 C6 06 2D 3D 02
Replace with: EB 0F C7 06 88 58 00 00 B0 04 83 BF D4 03 02 74 02 B0 02 A2 2D 3D 90 90 90 90 90
Any idea why there's no match for this in version 1.3 and 1.4?
Code: Select all
norbert@stimpy ~/Desktop/CusPop-2.1/src/vers $ curl -L 'https://github.com/tmbinc/bgrep/raw/master/bgrep.c' | gcc -O2 -x c -o bgrep -
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 127 0 127 0 0 254 0 --:--:-- --:--:-- --:--:-- 254
100 4357 100 4357 0 0 6872 0 --:--:-- --:--:-- --:--:-- 6872
norbert@stimpy ~/Desktop/CusPop-2.1/src/vers $ ./bgrep 'EB 06 C7 06 88 58 00 00 83 3E 9E 0F 03 75 07 C6 06 2D 3D 04 EB 05 C6 06 2D 3D 02' *
bin.p0: 00003a16
bin.u0: 000050c6
norbert@stimpy ~/Desktop/CusPop-2.1/src/vers $
Re: Killability of skeletons
This is a common problem for many hacks.Norbert wrote:Any idea why there's no match for this in version 1.3 and 1.4?
I already wrote about that here: viewtopic.php?p=14678#p14678
This part of the code contains addresses of global (static) variables, and their addresses are different in each version.
Although you could use "??" instead of those bytes (in bgrep's argument), the *replacement* still needs concrete addresses. (At least in this case.)
I think it's time to start the disassembly of 1.3 and 1.4. Most names would be copy-pasted from 1.0.
(Wow, curl | gcc ! )
Re: Killability of skeletons
I cannot take credit for that though, it's from its README.David wrote:(Wow, curl | gcc ! )
Also made me smile.