[Civ2] Hex editing SAV file for units

axx

Warlord
Joined
Feb 19, 2011
Messages
172
So, I've been reading Allard Hofelt's hex editing guide, specifically the units' section and I'm interested which byte determines the unit's "moves left". Sadly I can't find any info, not even in the ancient Apolyton's pages.

I saved a file (version MGE, which has 32 bytes for each unit) and after moving a horseman only 1 turn saved it again and compared the two. For this unit the difference (besides X-Y coordinates) is in bytes 5, 9 and 12:
  • byte 5: before = 00hex, after = 40hex (=64dec)
  • byte 9: before = 00hex, after = 03hex
  • byte 12: before = FFhex, after = 02hex
Any ideas what these 3 bytes represent?

regards
 
  • Like
Reactions: axx
Thanks for the info! Did some more testing:
  • byte 5 just signals that the unit started movement (00hex if it hasn't moved and 40hex if it started movement). Basically the second bit is important.
  • byte 9 - correct!
  • byte 12 is still a mystery. Moving 6 times on a road with a horseman it changes FF -> 06 -> 06 -> 07 -> 07 -> 06 -> 07. Moving a trireme FF -> 05 -> 05 -> 05.
BTW great job on the patcher. It helps immensely.
 
Byte 12 could be related to movement direction. Ranging from 0 to 7.
For example in accordance with NumPad keys:
Num8 - 7
Num9 - 0
Num6 - 1
Num3 - 2
Num2 - 3
Num1 - 4
Num4 - 5
Num7 - 6
 
Back
Top Bottom