Found a typo in the TP2:
REQUIRE_PREDICATE MOD_IS_INSTALLED ~BP-BGT_Worldmap.tp2~
should be
REQUIRE_PREDICATE MOD_IS_INSTALLED ~BP-BGT-Worldmap.tp2~
or even
REQUIRE_COMPONENT ~Setup-BP-BGT-Worldmap.tp2~
I'd also like to ask for some assistance - 2 mods, Wheels of Prophecy and Throne of Bhaal Revisited change WORLDM25.WMP. When ToBR makes changes after WoP the file is corrupted. Could you have a look at the code related to that? If it is fixed it could be a good addition to
BWP. Otherwise if installing the cloth style map for
ToB it is still corrupted.
This is the code from WoP:
COPY_EXISTING ~worldm25.wmp~ ~override~
READ_LONG 0x30 ~area_num~
READ_LONG 0x34 ~area_off~
READ_LONG 0x38 ~link_off~
READ_LONG 0x3c ~link_num~
WRITE_LONG 0x30 ~%area_num%~+1
WRITE_LONG 0x38 ~%link_off%~+0xf0
INSERT_BYTES ~%area_off%~+0xf0*~%area_num%~ 0xf0
WRITE_ASCII ~%area_off%~+0xf0*~%area_num%~ ~dw#teth~ #8
WRITE_ASCII ~%area_off%~+0xf0*~%area_num%~+0x8 ~ar4000~ #8
WRITE_ASCII ~%area_off%~+0xf0*~%area_num%~+0x10 ~ar4000~ #8
WRITE_LONG ~%area_off%~+0xf0*~%area_num%~+0x30 0x04
WRITE_LONG ~%area_off%~+0xf0*~%area_num%~+0x34 6
WRITE_LONG ~%area_off%~+0xf0*~%area_num%~+0x38 397
WRITE_LONG ~%area_off%~+0xf0*~%area_num%~+0x3c 56
WRITE_LONG ~%area_off%~+0xf0*~%area_num%~+0x40 61253
WRITE_LONG ~%area_off%~+0xf0*~%area_num%~+0x44 61253
BUT_ONLY_IF_IT_CHANGES
This is the code from ToBR:
COPY_EXISTING ~worldm25.wmp~ ~override~
// Read offsets and stuff.
READ_LONG 0x30 "area_num"
READ_LONG 0x34 "area_off"
READ_LONG 0x38 "link_off"
READ_LONG 0x3c "link_num"
READ_LONG 0xc "map_off"
SET "entry" = ("%map_off%" + 0xb8)
SET "outer_check" = 0
SET "inner_check" = 0
SET "num_ent" = 0
// New offsets
WRITE_LONG 0x30 ("%area_num%" + 1)
WRITE_LONG 0x38 ("%link_off%" + 0xf0)
WRITE_LONG 0x3c ("%link_num%" + 4)
// Add area to worldmap
INSERT_BYTES ("%area_off%" + (0xf0 * "%area_num%")) 0xf0
WRITE_ASCII ("%area_off%" + (0xf0 * "%area_num%")) ~ARTOBR~ // AR-name
WRITE_ASCII ("%area_off%" + 0x08 + (0xf0 * "%area_num%")) ~ARTOBR~ // AR-name
WRITE_ASCII ("%area_off%" + 0x10 + (0xf0 * "%area_num%")) ~ARTOBR~ // AR-name
WRITE_LONG ("%area_off%" + 0x34 + (0xf0 * "%area_num%")) 6 // Map icon
WRITE_LONG ("%area_off%" + 0x38 + (0xf0 * "%area_num%")) 400 // X coordinate
WRITE_LONG ("%area_off%" + 0x3C + (0xf0 * "%area_num%")) 50 // Y coordinate
SAY ("%area_off%" + 0x40 + (0xf0 * "%area_num%")) ~Tethyr Woods~ // Name of the area
SAY ("%area_off%" + 0x44 + (0xf0 * "%area_num%")) #-1 // Description
// Now, we add four area links, all from east
WRITE_SHORT ("%area_off%" + 0x50 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First N link
WRITE_SHORT ("%area_off%" + 0x58 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First W link
WRITE_SHORT ("%area_off%" + 0x60 + (0xf0 * "%area_num%")) ("%link_num%" + 4) // First S link
WRITE_SHORT ("%area_off%" + 0x68 + (0xf0 * "%area_num%")) ("%link_num%") // First E link
WRITE_SHORT ("%area_off%" + 0x6c + (0xf0 * "%area_num%")) 4 // Number of links from E
// Add links from WK to the new area
// We'll start by fixing the offsets
WHILE ("%outer_check%" = 0) BEGIN
READ_ASCII ("%entry%" + 0x8) "area" (2)
READ_ASCII ("%entry%" + 0x8) "spec_area" (6)
WHILE (("%spec_area%" STRING_COMPARE_CASE "AR3000" = 0) AND ("%inner_check%" = 0)) BEGIN
READ_SHORT ("%entry%" + 0x50) "nlink"
READ_SHORT ("%entry%" + 0x50 + 0x4) "#nlink"
WRITE_SHORT ("%entry%" + 0x50 + 0x4) ("%#nlink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8) "wlink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8) ("%wlink%" + 3)
READ_SHORT ("%entry%" + 0x50 + 0x8) "wlink"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x4) "#wlink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x4) ("%#wlink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) "slink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) ("%slink%" + 2)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) "slink"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4) "#slink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x4) ("%#slink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) "elink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) ("%elink%" + 1)
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) "elink"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) "#elink"
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8 + 0x4) ("%#elink%" + 1)
SET "inner_check" = 1
END
PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" = 0) OR ("%area%" STRING_COMPARE_CASE "G3" = 0)) BEGIN
SET "num_ent" = ("%num_ent%" + 1)
END ELSE
PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" != 0) AND ("%area%" STRING_COMPARE_CASE "G3" != 0)) BEGIN
SET "outer_check" = 1
END
SET "entry" = ("%entry%" + 0xf0)
END
// Re-read offsets
READ_LONG 0x30 "area_num"
READ_LONG 0x38 "link_off"
// Add four links to ARTOBR
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%nlink%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%nlink%")) ("%area_num%" - 1) // Add the last entry
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%nlink%")) ~CDExit~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%nlink%")) 4 // Unknown
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%wlink%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%wlink%")) ("%area_num%" - 1) // Add the last entry
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%wlink%")) ~CDExit~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%wlink%")) 4 // Unknown
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%slink%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%slink%")) ("%area_num%" - 1) // Add the last entry
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%slink%")) ~CDExit~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%slink%")) 4 // Unknown
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%elink%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%elink%")) ("%area_num%" - 1) // Add the last entry
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%elink%")) ~CDExit~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%elink%")) 4 // Unknown
// Check which link is largest
PATCH_IF (("%nlink%" > "%wlink%") AND ("%nlink%" > "%slink%") AND ("%nlink%" > "%elink%")) BEGIN
SET "link" = "%nlink%"
END
PATCH_IF (("%wlink%" > "%nlink%") AND ("%wlink%" > "%slink%") AND ("%wlink%" > "%elink%")) BEGIN
SET "link" = "%wlink%"
END
PATCH_IF (("%slink%" > "%wlink%") AND ("%slink%" > "%nlink%") AND ("%slink%" > "%elink%")) BEGIN
SET "link" = "%slink%"
END
PATCH_IF (("%elink%" > "%wlink%") AND ("%elink%" > "%slink%") AND ("%elink%" > "%nlink%")) BEGIN
SET "link" = "%elink%"
END
// Correct ALL other links after elink
// New variables
SET "entry" = ("%map_off%" + 0xb8)
SET "outer_c" = 0
// Let's WHILE a bit and search for area-links
WHILE ("%outer_c%" = 0) BEGIN
READ_ASCII ("%entry%" + 0x8) "area" (2)
PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" = 0) OR ("%area%" STRING_COMPARE_CASE "G3" = 0)) BEGIN
READ_SHORT ("%entry%" + 0x50) "nlink"
READ_SHORT ("%entry%" + 0x50 + 0x8) "wlink"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) "slink"
READ_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) "elink"
// And if they are larger, let's patch 'em
PATCH_IF ("%nlink%" > "%link%") BEGIN
WRITE_SHORT ("%entry%" + 0x50) ("%nlink%" + 4)
END
PATCH_IF ("%wlink%" > "%link%") BEGIN
WRITE_SHORT ("%entry%" + 0x50 + 0x8) ("%wlink%" + 4)
END
PATCH_IF ("%slink%" > "%link%") BEGIN
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8) ("%slink%" + 4)
END
PATCH_IF ("%elink%" > "%link%") BEGIN
WRITE_SHORT ("%entry%" + 0x50 + 0x8 + 0x8 + 0x8) ("%elink%" + 4)
END
END ELSE
PATCH_IF (("%area%" STRING_COMPARE_CASE "AR" != 0) AND ("%area%" STRING_COMPARE_CASE "G3" != 0)) BEGIN
SET "outer_c" = 1
END
SET "entry" = ("%entry%" + 0xf0)
END
// Add four new links from the new area
// Re-read offsets
READ_LONG 0x38 "link_off"
READ_LONG 0x3c "link_num"
// New offset
WRITE_LONG 0x3c ("%link_num%" + 4)
// Add link to WK
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 1 // WK
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitSW~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
// Add link to Oasis
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 7 // Oasis
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitW~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
// Add link to Seige Camp
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 4 // Seige Camp
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitNE~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
// Add link to Amekathan
INSERT_BYTES ("%link_off%" - 0x01 + (0xd8 * "%link_num%")) 0xd8
WRITE_LONG ("%link_off%" + (0xd8 * "%link_num%")) 3 // Amekathan
WRITE_ASCII ("%link_off%" + 0x04 + (0xd8 * "%link_num%")) ~ExitS~ // Entrance
WRITE_LONG ("%link_off%" + 0x28 + (0xd8 * "%link_num%")) 4 // Unknown
// Make Areas Visitable
FOR (index = 0 ; index < area_num ; index = index + 1) BEGIN
READ_ASCII ("%area_off%" + ("%index%" * 0xf0)) "areafile"
PATCH_IF ( ("AR5203" STRING_COMPARE_CASE "%areafile%" = 0) OR // Siege Camp
("AR6400" STRING_COMPARE_CASE "%areafile%" = 0) OR // North Woods
("AR6300" STRING_COMPARE_CASE "%areafile%" = 0) ) // Oasis
BEGIN
READ_BYTE ("%area_off%" + 0x30 + ("%index%" * 0xf0)) "flags"
WRITE_BYTE ("%area_off%" + 0x30 + ("%index%" * 0xf0)) ("%flags%" BOR 0b00000100)
END
END
// Change name of seige camp to "Outside Saradush"
FOR (index = 0 ; index < area_num ; index = index + 1) BEGIN
READ_ASCII ("%area_off%" + ("%index%" * 0xf0)) "areafile"
PATCH_IF ("AR5203" STRING_COMPARE_CASE "%areafile%" = 0) // Seige Camp
BEGIN
SAY ("%area_off%" + 0x40 + ("%index%" * 0xf0)) ~Outside Saradush~
SAY ("%area_off%" + 0x44 + ("%index%" * 0xf0)) ~Outside Saradush~
END
END
BUT_ONLY_IF_IT_CHANGES