COPY_EXISTING ~AR0400.are~ ~override~
READ_LONG 0x54 "actors_offset"
READ_SHORT 0x58 "actors_num"
READ_SHORT 0x5a "infotrig_num"
READ_LONG 0x5c "infotrig_offset"
READ_LONG 0x60 "spawns_offset"
READ_LONG 0x64 "spawns_num"
READ_LONG 0x68 "entrances_offset"
READ_LONG 0x6c "entrances_num"
READ_LONG 0x70 "cont_offset"
READ_SHORT 0x74 "cont_num"
READ_SHORT 0x76 "items_num"
READ_LONG 0x78 "items_offset"
READ_LONG 0x7c "vert_offset"
READ_SHORT 0x80 "vert_num"
READ_SHORT 0x82 "amb_num"
READ_LONG 0x84 "amb_offset"
READ_LONG 0x88 "vars_offset"
READ_LONG 0x8c "vars_num"
READ_LONG 0xa0 "expbmp_offset"
READ_LONG 0xa4 "doors_num"
READ_LONG 0xa8 "doors_offset"
READ_LONG 0xac "anim_num"
READ_LONG 0xb0 "anim_offset"
READ_LONG 0xb4 "tiled_num"
READ_LONG 0xb8 "tiled_offset"
READ_LONG 0xbc "songs_offset"
READ_LONG 0xc0 "rest_spawns_offset"
READ_LONG 0xc4 "automap_offset"
READ_LONG 0xc8 "automap_num"
SET info_1=1
FOR( cnt=0; cnt<"%infotrig_num%"; cnt=cnt+1 ) BEGIN //info/triggers loop
READ_ASCII ("%infotrig_offset%"+0xc4*cnt) "info_name"
PATCH_IF (("%info_name%" STRING_COMPARE_CASE "tz25nn_ar0400_to_tzdr03")=0) BEGIN //if already exists
info_1=0
END
END
PATCH_IF (info_1=1) BEGIN //adding new Travel trigger *******************************
SET offset = ("%infotrig_offset%"+0xc4*"%infotrig_num%")
INSERT_BYTES offset 0xc4
WRITE_ASCII offset ~tz25nn_ar0400_to_tzdr03~
WRITE_SHORT (offset+0x20) 2 //travel trigger
WRITE_SHORT (offset+0x22) 5 //bounding box
WRITE_SHORT (offset+0x24) 1110 //bounding box
WRITE_SHORT (offset+0x26) 55 //bounding box
WRITE_SHORT (offset+0x28) 1220 //bounding box
WRITE_SHORT (offset+0x2a) 4 //vertices number
WRITE_LONG (offset+0x2c) "%vert_num%" //first vertex index
WRITE_LONG (offset+0x34) 30 //cursor frame number
WRITE_ASCII (offset+0x38) ~tzdr03~ //destination area
WRITE_ASCII (offset+0x40) ~Exit0400~ //entrance name
WRITE_LONG (offset+0x60) 0 //party required flag
WRITE_SHORT (offset+0x70) 20 //trap launch x
WRITE_SHORT (offset+0x72) 1100 //trap launch y
WRITE_ASCII (offset+0x7c) ~None~ //script
SET "infotrig_num"="%infotrig_num%"+1
WRITE_SHORT 0x5a "%infotrig_num%"
END
SET "info_ext"=0xc4*info_1
PATCH_IF ("%actors_offset%">="%infotrig_offset%") BEGIN
"actors_offset"="%actors_offset%"+"%info_ext%"
WRITE_LONG 0x54 "%actors_offset%"
END
PATCH_IF ("%spawns_offset%">="%infotrig_offset%") BEGIN
"spawns_offset"="%spawns_offset%"+"%info_ext%"
WRITE_LONG 0x60 "%spawns_offset%"
END
PATCH_IF ("%entrances_offset%">="%infotrig_offset%") BEGIN
"entrances_offset"="%entrances_offset%"+"%info_ext%"
WRITE_LONG 0x68 "%entrances_offset%"
END
PATCH_IF ("%cont_offset%">="%infotrig_offset%") BEGIN
"cont_offset"="%cont_offset%"+"%info_ext%"
WRITE_LONG 0x70 "%cont_offset%"
END
PATCH_IF ("%items_offset%">="%infotrig_offset%") BEGIN
"items_offset"="%items_offset%"+"%info_ext%"
WRITE_LONG 0x78 "%items_offset%"
END
PATCH_IF ("%vert_offset%">="%infotrig_offset%") BEGIN
"vert_offset"="%vert_offset%"+"%info_ext%"
WRITE_LONG 0x7c "%vert_offset%"
END
PATCH_IF ("%amb_offset%">="%infotrig_offset%") BEGIN
"amb_offset"="%amb_offset%"+"%info_ext%"
WRITE_LONG 0x84 "%amb_offset%"
END
PATCH_IF ("%vars_offset%">="%infotrig_offset%") BEGIN
"vars_offset"="%vars_offset%"+"%info_ext%"
WRITE_LONG 0x88 "%vars_offset%"
END
PATCH_IF ("%expbmp_offset%">="%infotrig_offset%") BEGIN
"expbmp_offset"="%expbmp_offset%"+"%info_ext%"
WRITE_LONG 0xa0 "%expbmp_offset%"
END
PATCH_IF ("%doors_offset%">="%infotrig_offset%") BEGIN
"doors_offset"="%doors_offset%"+"%info_ext%"
WRITE_LONG 0xa8 "%doors_offset%"
END
PATCH_IF ("%anim_offset%">="%infotrig_offset%") BEGIN
"anim_offset"="%anim_offset%"+"%info_ext%"
WRITE_LONG 0xb0 "%anim_offset%"
END
PATCH_IF ("%tiled_offset%">="%infotrig_offset%") BEGIN
"tiled_offset"="%tiled_offset%"+"%info_ext%"
WRITE_LONG 0xb8 "%tiled_offset%"
END
PATCH_IF ("%songs_offset%">="%infotrig_offset%") BEGIN
"songs_offset"="%songs_offset%"+"%info_ext%"
WRITE_LONG 0xbc "%songs_offset%"
END
PATCH_IF ("%rest_spawns_offset%">="%infotrig_offset%") BEGIN
"rest_spawns_offset"="%rest_spawns_offset%"+"%info_ext%"
WRITE_LONG 0xc0 "%rest_spawns_offset%"
END
PATCH_IF ("%automap_offset%">="%infotrig_offset%") BEGIN
"automap_offset"="%automap_offset%"+"%info_ext%"
WRITE_LONG 0xc4 "%automap_offset%"
END
PATCH_IF (info_1=1) BEGIN //adding vertices for the new trigger
SET offset = ("%vert_offset%"+0x04*"%vert_num%")
INSERT_BYTES offset (0x04*4)
WRITE_SHORT offset 5
WRITE_SHORT (offset+2) 1110
WRITE_SHORT (offset+4) 55
WRITE_SHORT (offset+6) 1130
WRITE_SHORT (offset+
55
WRITE_SHORT (offset+10) 1220
WRITE_SHORT (offset+12) 5
WRITE_SHORT (offset+14) 1220
SET "vert_num"="%vert_num%"+4
WRITE_SHORT 0x80 "%vert_num%"
END
SET "info_ext"=0x04*info_1*4
PATCH_IF ("%actors_offset%">="%vert_offset%") BEGIN
"actors_offset"="%actors_offset%"+"%info_ext%"
WRITE_LONG 0x54 "%actors_offset%"
END
PATCH_IF ("%spawns_offset%">="%vert_offset%") BEGIN
"spawns_offset"="%spawns_offset%"+"%info_ext%"
WRITE_LONG 0x60 "%spawns_offset%"
END
PATCH_IF ("%entrances_offset%">="%vert_offset%") BEGIN
"entrances_offset"="%entrances_offset%"+"%info_ext%"
WRITE_LONG 0x68 "%entrances_offset%"
END
PATCH_IF ("%cont_offset%">="%vert_offset%") BEGIN
"cont_offset"="%cont_offset%"+"%info_ext%"
WRITE_LONG 0x70 "%cont_offset%"
END
PATCH_IF ("%items_offset%">="%vert_offset%") BEGIN
"items_offset"="%items_offset%"+"%info_ext%"
WRITE_LONG 0x78 "%items_offset%"
END
PATCH_IF ("%infotrig_offset%">="%vert_offset%") BEGIN
"infotrig_offset"="%infotrig_offset%"+"%info_ext%"
WRITE_LONG 0x5c "%infotrig_offset%"
END
PATCH_IF ("%amb_offset%">="%vert_offset%") BEGIN
"amb_offset"="%amb_offset%"+"%info_ext%"
WRITE_LONG 0x84 "%amb_offset%"
END
PATCH_IF ("%vars_offset%">="%vert_offset%") BEGIN
"vars_offset"="%vars_offset%"+"%info_ext%"
WRITE_LONG 0x88 "%vars_offset%"
END
PATCH_IF ("%expbmp_offset%">="%vert_offset%") BEGIN
"expbmp_offset"="%expbmp_offset%"+"%info_ext%"
WRITE_LONG 0xa0 "%expbmp_offset%"
END
PATCH_IF ("%doors_offset%">="%vert_offset%") BEGIN
"doors_offset"="%doors_offset%"+"%info_ext%"
WRITE_LONG 0xa8 "%doors_offset%"
END
PATCH_IF ("%anim_offset%">="%vert_offset%") BEGIN
"anim_offset"="%anim_offset%"+"%info_ext%"
WRITE_LONG 0xb0 "%anim_offset%"
END
PATCH_IF ("%tiled_offset%">="%vert_offset%") BEGIN
"tiled_offset"="%tiled_offset%"+"%info_ext%"
WRITE_LONG 0xb8 "%tiled_offset%"
END
PATCH_IF ("%songs_offset%">="%vert_offset%") BEGIN
"songs_offset"="%songs_offset%"+"%info_ext%"
WRITE_LONG 0xbc "%songs_offset%"
END
PATCH_IF ("%rest_spawns_offset%">="%vert_offset%") BEGIN
"rest_spawns_offset"="%rest_spawns_offset%"+"%info_ext%"
WRITE_LONG 0xc0 "%rest_spawns_offset%"
END
PATCH_IF ("%automap_offset%">="%vert_offset%") BEGIN
"automap_offset"="%automap_offset%"+"%info_ext%"
WRITE_LONG 0xc4 "%automap_offset%"
END
SET "new_enter" ="%entrances_offset%" + (0x68*"%entrances_num%")
INSERT_BYTES "%new_enter%" 0x68
WRITE_ASCII "%new_enter%" ~tz25nn_ar0400_from_tzdr03~ #32 //changing entrance name
WRITE_SHORT "%new_enter%"+0x20 ~130~
WRITE_SHORT "%new_enter%"+0x22 ~1200~
WRITE_SHORT "%new_enter%"+0x24 ~12~
SET "%entrances_num%" = "%entrances_num%" + 1
WRITE_LONG 0x6c "%entrances_num%"
BUT_ONLY_IF_IT_CHANGES ~AR0400.are~