///////////////////////////////////JOURNAL EE

ACTION_IF GAME_IS ~bg2ee eet~ THEN BEGIN
  LOAD_TRA ~TotDG/Translations/%LANGUAGE%/setup_ee.tra~

  ADD_JOURNAL @200 @201 @203 @204 @205 @206 @207 @208 @209 @210 @211 @213 @214 @215 @216 @217 @218 @219 @220 @221 @222 @223 @224
END


////////////////////////////////Add CD_STATE_NOTVALID state

APPEND ~STATE.IDS~ ~0x80101FEF CD_STATE_NOTVALID~
            UNLESS ~CD_STATE_NOTVALID~ 


////////////////////////////////ADD SpellCastOnMeRES

APPEND ~trigger.ids~ ~0x00a1 SpellCastOnMeRES(S:Spell*,O:Caster*)~ 
              UNLESS ~SpellCastOnMeRES~


////////////////////////////////AREAS

COPY ~TotDG/AREAS/ARE~         ~override~
COPY ~TotDG/AREAS/BMP~         ~override~
COPY ~TotDG/AREAS/SLH~         ~override~
COPY ~TotDG/AREAS/WED~         ~override~

ACTION_IF GAME_IS ~bg2ee eet~ THEN BEGIN
  COPY ~TotDG/EE/AREAS/TIS~    ~override~      // use v2-format TIS files
  COPY ~TotDG/EE/AREAS/PVRZ~   ~override~      // PVRZ tiles for v2 TIS files
  COPY ~TotDG/EE/AREAS/MOS~    ~override~      // use larger MOS minimap files
END ELSE BEGIN // not Enhanced Edition
  COPY ~TotDG/AREAS/TIS~       ~override~      // use v1-format TIS files
  COPY ~TotDG/AREAS/MOS~       ~override~      // use smaller MOS minimap files
END


////////////////////////////////BAMS

COPY ~TotDG/BAMS~ ~override/~


////////////////////////////////PORTRAITS

COPY ~TotDG/PORTRAITS~ ~override/~


///////////////////////////////////STORES

COPY ~TotDG/STORES/DG01.sto~  ~override~
  SAY 0xc @48 // store name

COPY ~TotDG/STORES/DG02.sto~  ~override~
  SAY 0xc @48 // store name


//////////////////////////////////TEXT SCREEN

ACTION_IF GAME_IS ~bg2ee eet~ THEN BEGIN
  COPY ~TotDG/EE/TEXTSCREEN/DGTXT.mos~  ~override~ // use larger text screen background
END ELSE BEGIN // not Enhanced Edition
  COPY ~TotDG/TEXTSCREEN/DGTXT.mos~     ~override~ // use smaller text screen background
END

COPY ~TotDG/TEXTSCREEN/DGTXT.2da~ ~override~
    REPLACE ~1001~ @49


/////////////////////////////////SOUNDS

ACTION_IF ("%LANGUAGE%" STR_EQ "Polish") THEN BEGIN
  COPY ~TotDG/DeepAudio/Polish~ ~TotDG/SOUNDS~
END
 
LAF HANDLE_AUDIO
  STR_VAR audio_path = ~TotDG/SOUNDS~
END


/////////////////////////////////SPELLS

ACTION_DEFINE_ASSOCIATIVE_ARRAY spl_array BEGIN
  // unique-id, @NAME1, @NAME2, @DESC => SPL file
  01,  50,  50,  51  =>  DGGray.spl
  02,  52,  52,  51  =>  DGGold.spl
  03,  53,  53,  51  =>  DGGree.spl
  04,  54,  54,  51  =>  DGSilv.spl
  05,  55,  55,  51  =>  DGBlue.spl
  06,  56,  56,  51  =>  DGViol.spl
  07,  57,  57,  51  =>  DGYell.spl
  08,  58,  58,  51  =>  DGAmbe.spl
  09,  59,  59,  51  =>  DGBlac.spl
  10,  60,  60,  51  =>  DGRed.spl
  11,  61,  61,  62  =>  DGINN1.spl
  12,  63,  63,  64  =>  DGINN2.spl
  13,  65,  65,  66  =>  DGS01.spl
  14,  67,  67,  68  =>  DGS02.spl
  15,  69,  69,  70  =>  DGS03.spl
  16,  71,  71,  72  =>  DGS04.spl
  17,  73,  73,  74  =>  DGS05.spl
  18,  75,  75,  76  =>  DGS06.spl
  19,  77,  77,  78  =>  DGS07.spl
  20,  79,  79,  80  =>  DGS08.spl
  21,  81,  81,  82  =>  DGS09.spl
  22,  83,  83,  84  =>  DGSB1.spl
END

ACTION_PHP_EACH spl_array AS strings => splfile BEGIN
  COPY ~TotDG/SPELLS/%splfile%~ ~override~
    SPRINT ref1 ( AT "strings_1" )
    SPRINT ref2 ( AT "strings_2" )
    SPRINT ref3 ( AT "strings_3" )
    SAY_EVALUATED NAME1              ~%ref1%~
    SAY_EVALUATED NAME2              ~%ref2%~
    SAY_EVALUATED IDENTIFIED_DESC    ~%ref3%~
    SAY_EVALUATED UNIDENTIFIED_DESC  ~%ref3%~
END


/////////////////////////////////ITEMS

ACTION_DEFINE_ASSOCIATIVE_ARRAY itm_array BEGIN
  // unique-id, @NAME1, @NAME2, @DESC, @UNIDENTIFIED_DESC => ITM file
  01,  85,   85,   86,   86   =>  DGFl.itm
  02,  87,   87,   88,   88   =>  DGBark.itm
  03,  89,   89,   90,   90   =>  DGI001.itm
  04,  91,   91,   92,   92   =>  DGI002.itm
  05,  93,   93,   94,   94   =>  DGI003.itm
  06,  95,   95,   96,   96   =>  DGI004.itm
  07,  97,   97,   98,   98   =>  DGI005.itm
  08,  99,   99,   100,  100  =>  DGI006.itm
  09,  101,  101,  102,  102  =>  DGI007.itm
  10,  103,  103,  104,  104  =>  DGI008.itm
  11,  105,  105,  106,  106  =>  DGI009.itm
  12,  107,  107,  108,  108  =>  DGI010.itm
  13,  109,  109,  110,  110  =>  DGI011.itm
  14,  111,  111,  112,  112  =>  DGI012.itm
  15,  113,  113,  114,  114  =>  DGI013.itm
  16,  115,  115,  116,  117  =>  DGI014.itm
  17,  118,  118,  119,  120  =>  DGI015.itm
  18,  121,  121,  122,  123  =>  DGI016.itm
  19,  124,  124,  125,  126  =>  DGI017.itm
  20,  127,  127,  128,  129  =>  DGI018.itm
  21,  130,  130,  131,  131  =>  DGI019.itm
  22,  132,  132,  133,  133  =>  DGI020.itm
  23,  134,  134,  135,  135  =>  DGxQ1.itm
  24,  136,  136,  137,  137  =>  DGxQ2.itm
  25,  138,  138,  139,  139  =>  DGxQ3.itm
  26,  140,  140,  141,  141  =>  DGxQ4.itm
  27,  142,  142,  143,  143  =>  DGIAmbe.itm
  28,  144,  144,  145,  145  =>  DGIBlue.itm
  29,  146,  146,  147,  147  =>  DGIGree.itm
  30,  148,  148,  149,  149  =>  DGIGray.itm
  31,  150,  150,  151,  151  =>  DGIBlac.itm
  32,  152,  152,  153,  153  =>  DGIViol.itm
  33,  154,  154,  155,  155  =>  DGIRed.itm
  34,  156,  156,  157,  157  =>  DGISilv.itm
  35,  158,  158,  159,  159  =>  DGIGold.itm
  36,  160,  160,  161,  161  =>  DGIYell.itm
  37,  142,  142,  162,  162  =>  DGIAmbe2.itm
  38,  163,  163,  164,  164  =>  DGxSCR.itm

  //SCROLLS

  39,  65,   65,   66,   66   =>  DGSCR01.itm
  40,  67,   67,   68,   68   =>  DGSCR02.itm
  41,  69,   69,   70,   70   =>  DGSCR03.itm
  42,  71,   71,   72,   72   =>  DGSCR04.itm
  43,  73,   73,   74,   74   =>  DGSCR05.itm
  44,  75,   75,   76,   76   =>  DGSCR06.itm
  45,  77,   77,   78,   78   =>  DGSCR07.itm
  46,  79,   79,   80,   80   =>  DGSCR08.itm
  47,  81,   81,   82,   82   =>  DGSCR09.itm
  48,  83,   83,   84,   84   =>  DGSCRB1.itm
END

ACTION_PHP_EACH itm_array AS strings => itmfile BEGIN
  COPY ~TotDG/ITEMS/%itmfile%~ ~override~
    SPRINT ref1 ( AT "strings_1" )
    SPRINT ref2 ( AT "strings_2" )
    SPRINT ref3 ( AT "strings_3" )
    SPRINT ref4 ( AT "strings_4" )
    SAY_EVALUATED NAME1              ~%ref1%~
    SAY_EVALUATED NAME2              ~%ref2%~
    SAY_EVALUATED IDENTIFIED_DESC    ~%ref3%~
    SAY_EVALUATED UNIDENTIFIED_DESC  ~%ref4%~
END


//////////////////////////////////WINE OPTION

COPY_EXISTING ~merchant.sto~ ~override~ // Bel Dalemark's store in Waukeen's Promenade
  ADD_STORE_ITEM ~DGxQ1~ #10 #0 #0 ~IDENTIFIED~ #5


////////////////////////////////CREATURES

COPY ~TotDG/CREATURES/0xSTDG.cre~ ~override/0xSTDG.cre~
  SAY NAME1 @1
  SAY NAME2 @1
  SAY SELECT_COMMON1 @2 

COPY ~TotDG/CREATURES/0xGWDG.cre~ ~override/0xGWDG.cre~
  SAY NAME1 @3
  SAY NAME2 @3
  SAY SELECT_COMMON1 @4 

COPY ~TotDG/CREATURES/0xSWDG.cre~ ~override/0xSWDG.cre~
  SAY NAME1 @5
  SAY NAME2 @5
  SAY SELECT_COMMON1 @4 

COPY ~TotDG/CREATURES/0xRWDG.cre~ ~override/0xRWDG.cre~
  SAY NAME1 @6
  SAY NAME2 @6
  SAY SELECT_COMMON1 @4 

COPY ~TotDG/CREATURES/0xPriDG.cre~ ~override/0xPriDG.cre~
  SAY NAME1 @7
  SAY NAME2 @7

COPY ~TotDG/CREATURES/0xAlcDG.cre~ ~override/0xAlcDG.cre~
  SAY NAME1 @8
  SAY NAME2 @8

COPY ~TotDG/CREATURES/0xUDDG.cre~ ~override/0xUDDG.cre~
  SAY NAME1 @9
  SAY NAME2 @9

COPY ~TotDG/CREATURES/0xWizDG.cre~ ~override/0xWizDG.cre~
  SAY NAME1 @10
  SAY NAME2 @10

COPY ~TotDG/CREATURES/0xWi2DG.cre~ ~override/0xWi2DG.cre~
  SAY NAME1 @10
  SAY NAME2 @10

COPY ~TotDG/CREATURES/0xBegDG.cre~ ~override/0xBegDG.cre~
  SAY NAME1 @11
  SAY NAME2 @11

COPY ~TotDG/CREATURES/0xGUIDG.cre~ ~override/0xGUIDG.cre~
  SAY NAME1 @12
  SAY NAME2 @12
  SAY SELECT_COMMON1 @13 
  SAY SELECT_COMMON2 @13 

COPY ~TotDG/CREATURES/0xM1DG.cre~ ~override/0xM1DG.cre~
  SAY NAME1 @14
  SAY NAME2 @14
  SAY SELECT_COMMON1 @15 

COPY ~TotDG/CREATURES/0xM2DG.cre~ ~override/0xM2DG.cre~
  SAY NAME1 @16
  SAY NAME2 @16
  SAY SELECT_COMMON1 @17 

COPY ~TotDG/CREATURES/0xLov1DG.cre~ ~override/0xLov1DG.cre~
  SAY NAME1 @18
  SAY NAME2 @18
  SAY SELECT_COMMON1 @19 

COPY ~TotDG/CREATURES/0xLov2DG.cre~ ~override/0xLov2DG.cre~
  SAY NAME1 @20
  SAY NAME2 @20
  SAY SELECT_COMMON1 @21 

COPY ~TotDG/CREATURES/0xGirlDG.cre~ ~override/0xGirlDG.cre~
  SAY NAME1 @22
  SAY NAME2 @22
  SAY SELECT_COMMON1 @23 

COPY ~TotDG/CREATURES/0xEldDG.cre~ ~override/0xEldDG.cre~
  SAY NAME1 @24
  SAY NAME2 @24
  SAY INITIAL_MEETING @25 
  SAY SELECT_COMMON1 @26 
  SAY SELECT_COMMON2 @27 
  SAY SELECT_COMMON3 @26 

COPY ~TotDG/CREATURES/0xAlchDG.cre~ ~override/0xAlchDG.cre~
  SAY NAME1 @28
  SAY NAME2 @28
  SAY SELECT_COMMON1 @29 

COPY ~TotDG/CREATURES/0xAl2DG.cre~ ~override/0xAl2DG.cre~
  SAY NAME1 @14
  SAY NAME2 @14
  SAY SELECT_COMMON1 @15 

COPY ~TotDG/CREATURES/0xYM1DG.cre~ ~override/0xYM1DG.cre~
  SAY NAME1 @30
  SAY NAME2 @30
  SAY INITIAL_MEETING @31 
  SAY SELECT_COMMON1 @15 

COPY ~TotDG/CREATURES/0xYM2DG.cre~ ~override/0xYM2DG.cre~
  SAY NAME1 @30
  SAY NAME2 @30
  SAY INITIAL_MEETING @31 
  SAY SELECT_COMMON1 @15 

COPY ~TotDG/CREATURES/0xManDG.cre~ ~override/0xManDG.cre~
  SAY NAME1 @32
  SAY NAME2 @32
  SAY SELECT_COMMON1 @13 

COPY ~TotDG/CREATURES/0xTHI1DG.cre~ ~override/0xTHI1DG.cre~
  SAY NAME1 @33
  SAY NAME2 @33

COPY ~TotDG/CREATURES/0xTHI2DG.cre~ ~override/0xTHI2DG.cre~
  SAY NAME1 @34
  SAY NAME2 @34
  SAY SELECT_COMMON1 @35

COPY ~TotDG/CREATURES/0xGGuaDG.cre~ ~override/0xGGuaDG.cre~
  SAY NAME1 @36
  SAY NAME2 @36
  SAY SELECT_COMMON1 @15 

COPY ~TotDG/CREATURES/0xSGuaDG.cre~ ~override/0xSGuaDG.cre~
  SAY NAME1 @36
  SAY NAME2 @36
  SAY SELECT_COMMON1 @31 

COPY ~TotDG/CREATURES/0xRGuaDG.cre~ ~override/0xRGuaDG.cre~
  SAY NAME1 @36
  SAY NAME2 @36
  SAY SELECT_COMMON1 @17 

COPY ~TotDG/CREATURES/0xOldDG.cre~ ~override/0xOldDG.cre~
  SAY NAME1 @37
  SAY NAME2 @37
  SAY SELECT_COMMON1 @38 

COPY ~TotDG/CREATURES/0xInDG.cre~ ~override/0xInDG.cre~
  SAY NAME1 @39
  SAY NAME2 @39
  SAY SELECT_COMMON1 @31 

COPY ~TotDG/CREATURES/0xCom1DG.cre~ ~override/0xCom1DG.cre~
  SAY NAME1 @39
  SAY NAME2 @39
  SAY SELECT_COMMON1 @13 

COPY ~TotDG/CREATURES/0xCom2DG.cre~ ~override/0xCom2DG.cre~
  SAY NAME1 @39
  SAY NAME2 @39
  SAY SELECT_COMMON1 @15 

COPY ~TotDG/CREATURES/0xCom3DG.cre~ ~override/0xCom3DG.cre~
  SAY NAME1 @39
  SAY NAME2 @39
  SAY SELECT_COMMON1 @17 

COPY ~TotDG/CREATURES/0xCom4DG.cre~ ~override/0xCom4DG.cre~
  SAY NAME1 @39
  SAY NAME2 @39
  SAY SELECT_COMMON1 @15 

COPY ~TotDG/CREATURES/0xCom5DG.cre~ ~override/0xCom5DG.cre~
  SAY NAME1 @39
  SAY NAME2 @39
  SAY SELECT_COMMON1 @13 

COPY ~TotDG/CREATURES/0xLordDG.cre~ ~override/0xLordDG.cre~
  SAY NAME1 @40
  SAY NAME2 @40
  SAY SELECT_COMMON1 @41 

COPY ~TotDG/CREATURES/0xGreDG.cre~ ~override/0xGreDG.cre~
  SAY NAME1 @42
  SAY NAME2 @42

COPY ~TotDG/CREATURES/0xRedDG.cre~ ~override/0xRedDG.cre~
  SAY NAME1 @43
  SAY NAME2 @43

COPY ~TotDG/CREATURES/0xGolDG.cre~ ~override/0xGolDG.cre~
  SAY NAME1 @44
  SAY NAME2 @44

COPY ~TotDG/CREATURES/0xSilDG.cre~ ~override/0xSilDG.cre~
  SAY NAME1 @45
  SAY NAME2 @45

COPY ~TotDG/CREATURES/0xYHDG.cre~ ~override/0xYHDG.cre~
  SAY NAME1 @46
  SAY NAME2 @46

COPY ~TotDG/CREATURES/0xdreaDG.cre~ ~override/0xdreaDG.cre~
  SAY NAME1 @47
  SAY NAME2 @47


/////////////////////////////////DIALOGUES

COMPILE EVALUATE_BUFFER
        ~TotDG/DIALOGUES/0xAL2DG.d~
        ~TotDG/DIALOGUES/0xALcDG.d~
        ~TotDG/DIALOGUES/0xALchDG.d~
        ~TotDG/DIALOGUES/0xBEGDG.d~
        ~TotDG/DIALOGUES/0xComXDG.d~
        ~TotDG/DIALOGUES/0xDREaDG.d~
        ~TotDG/DIALOGUES/0xELDDG.d~
        ~TotDG/DIALOGUES/0xGGUADG.d~
        ~TotDG/DIALOGUES/0xGIRLDG.d~
        ~TotDG/DIALOGUES/0xGOLDG.d~
        ~TotDG/DIALOGUES/0xGreDG.d~
        ~TotDG/DIALOGUES/0xGUIDG.d~
        ~TotDG/DIALOGUES/0xINDG.d~
        ~TotDG/DIALOGUES/0xLordDG.d~
        ~TotDG/DIALOGUES/0xLov1DG.d~
        ~TotDG/DIALOGUES/0xLov2DG.d~
        ~TotDG/DIALOGUES/0xM1DG.d~
        ~TotDG/DIALOGUES/0xM2DG.d~
        ~TotDG/DIALOGUES/0xManDG.d~
        ~TotDG/DIALOGUES/0xOldDG.d~
        ~TotDG/DIALOGUES/0xPRIDG.d~
        ~TotDG/DIALOGUES/0xRedDG.d~
        ~TotDG/DIALOGUES/0xRGUADG.d~
        ~TotDG/DIALOGUES/0xSGUADG.d~
        ~TotDG/DIALOGUES/0xSilDG.d~
        ~TotDG/DIALOGUES/0xTHI2DG.d~
        ~TotDG/DIALOGUES/0xTHI1DG.d~
        ~TotDG/DIALOGUES/0xUDDG.d~
        ~TotDG/DIALOGUES/0xWIZDG.d~
        ~TotDG/DIALOGUES/0xYM1DG.d~
        ~TotDG/DIALOGUES/0xYM2DG.d~
        ~TotDG/DIALOGUES/0xSTDG.d~
        ~TotDG/DIALOGUES/0xGWDG.d~
        ~TotDG/DIALOGUES/0xSWDG.d~
        ~TotDG/DIALOGUES/0xRWDG.d~
        ~TotDG/DIALOGUES/0xWI2DG.d~


//////////////////////////////////SCRIPTS

COMPILE EVALUATE_BUFFER
        ~TotDG/SCRIPTS/0x1DG.baf~
        ~TotDG/SCRIPTS/0xALCDG.baf~
        ~TotDG/SCRIPTS/0xUDDG.baf~
        ~TotDG/SCRIPTS/0xGUIDG.baf~
        ~TotDG/SCRIPTS/0xLORDDG.baf~
        ~TotDG/SCRIPTS/0xPRIDG.baf~
        ~TotDG/SCRIPTS/0xSilDG.baf~
        ~TotDG/SCRIPTS/0xTHI1DG.baf~
        ~TotDG/SCRIPTS/0xTHI2DG.baf~
        ~TotDG/SCRIPTS/0xWIZDG.baf~
        ~TotDG/SCRIPTS/0xYHDG.baf~
        ~TotDG/SCRIPTS/0xYM2DG.baf~
        ~TotDG/SCRIPTS/0xSTDG.baf~
        ~TotDG/SCRIPTS/ARLDV1.baf~
        ~TotDG/SCRIPTS/ARLDV2.baf~
        ~TotDG/SCRIPTS/ARLDV3.baf~
        ~TotDG/SCRIPTS/ARLDV4.baf~
        ~TotDG/SCRIPTS/ARLDV5.baf~
        ~TotDG/SCRIPTS/ARLDV6.baf~
        ~TotDG/SCRIPTS/ARLDV7.baf~
        ~TotDG/SCRIPTS/ARLDV8.baf~

EXTEND_TOP   ~AR0400.bcs~ ~TotDG/SCRIPTS/AR0400.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR0500.bcs~ ~TotDG/SCRIPTS/AR0500.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR0522.bcs~ ~TotDG/SCRIPTS/AR0522.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR0509.bcs~ ~TotDG/SCRIPTS/AR0509.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR0802.bcs~ ~TotDG/SCRIPTS/AR0802.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR0809.bcs~ ~TotDG/SCRIPTS/AR0809.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR0900.bcs~ ~TotDG/SCRIPTS/AR0900.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR1000.bcs~ ~TotDG/SCRIPTS/AR1000.baf~ EVALUATE_BUFFER
EXTEND_TOP   ~AR5500.bcs~ ~TotDG/SCRIPTS/AR5500.baf~ EVALUATE_BUFFER


//////////////////////////////////NPC REACTIONS

COMPILE EVALUATE_BUFFER ~TotDG/DIALOGUES/DialApp.d~
EXTEND_BOTTOM   ~ARLDV1.bcs~ ~TotDG/SCRIPTS/ARLDV1AddOn.baf~ EVALUATE_BUFFER
EXTEND_BOTTOM   ~AR1000.bcs~ ~TotDG/SCRIPTS/AR1000AddOn.baf~ EVALUATE_BUFFER
EXTEND_BOTTOM   ~AR0900.bcs~ ~TotDG/SCRIPTS/AR0900AddOn.baf~ EVALUATE_BUFFER


///////////////////////////////////////////////
///////////////////////////////////////////////
///////////////////////////////////////////////

// map icon index in mapicons.bam
ACTION_IF GAME_IS ~eet~ BEGIN
  ACTION_DEFINE_ASSOCIATIVE_ARRAY remapped_icons BEGIN 9 => 178 END
END ELSE ACTION_IF GAME_IS ~bg2ee~ BEGIN
  INCLUDE ~%MOD_FOLDER%/Worldmap/add_map_icons_ee.tpa~
  LAF ADD_MAP_ICONS_EE STR_VAR path_to_icons = EVAL ~%MOD_FOLDER%/Worldmap/ee/icon.bam~ patch_to_pvrz = EVAL ~%MOD_FOLDER%/Worldmap/ee~ RET new_icon_index END
  ACTION_DEFINE_ASSOCIATIVE_ARRAY remapped_icons BEGIN 9 => ~%new_icon_index%~ END
  STRING_SET 23084 @4000300 //Traveling Hours -> Hours
  STRING_SET 5684 @4000301 //Destination Unreachable -> Unreachable
END ELSE BEGIN //bg2, bgt
  INCLUDE ~%MOD_FOLDER%/Worldmap/add_map_icons.tpa~
  LAF ADD_MAP_ICONS STR_VAR path_to_icons = EVAL ~%MOD_FOLDER%/Worldmap/bg/icon.bam~ RET new_icon_index END
  ACTION_DEFINE_ASSOCIATIVE_ARRAY remapped_icons BEGIN 9 => ~%new_icon_index%~ END
END

// patch WMP using TBL files
INCLUDE ~%MOD_FOLDER%/Worldmap/add_worldmap_tbl.tpa~
LAF ADD_WORLDMAP_TBL
  INT_VAR
  verbose = 0
  inclSv = include_saves
  add_x = wmp_xCoord_SoA
  add_y = wmp_yCoord_SoA
  patch_bp_files = 1
  patch_mastarea = 1
  STR_VAR
  path_to_areas = EVAL ~%MOD_FOLDER%/Worldmap/areas_bg2.tbl~
  path_to_areas_bp = EVAL ~%MOD_FOLDER%/Worldmap/areas.tbl~
  path_to_links = EVAL ~%MOD_FOLDER%/Worldmap/links.tbl~
  path_to_trans = EVAL ~%MOD_FOLDER%/Translations/%LANGUAGE%/worldmap.tra~
  icons_table = remapped_icons
END


// end of main component
