====== Scripts > Combine WM and HF ====== ^ Description | Combine the height in the water map with the heightfield, so that the heightfield has flat areas for the surface of the water bodies. | ^ Author | [[user>Aaron]] | ^ Created | 2011/03/02 | ^ Requires | L3DT v2.9 build 12 or later | ^ Download | {{:scripts:combine_WM_and_HF.zs|Combine WM and HF.zs}} | ===== Script contents ===== // Author: A. Torpy // Written: 02 Mar 2011 hvar pHF set pHF hvar pWM set pWM assert "Error: Heightfield is not initialised!" assert "Error: map is not initialised!" // create temp HF to contain WM as HF map TempMap // convert water map to temp HF //#define WMFLAG_INCLUDE_SEA 0x00000001 //#define WMFLAG_INCLUDE_LAKES 0x00000002 //#define WMFLAG_INCLUDE_WTABLE 0x00000004 //#define WMFLAG_INCLUDE_EDGES 0x00000008 //#define WMFLAG_SHOW_RESULT 0x00000010 //#define WMFLAG_SHOW_PROGRESS 0x00000020 assert "Error: cannot convert water map to heightmap!" // ask whether to copy over the heightfield, or save as HF_plus_WM? if > // // user returned 'yes'; store output in heightfield // // firstly, backup the heightfield L3DTio_Backup.BackupMap "HF" "Combine WM and HF" 0x0 "view.ShowMap \"HF\"" // combine // #define MIXMODE_REPLACE 0 // #define MIXMODE_ADD 1 // #define MIXMODE_SUB 2 // #define MIXMODE_USE_MAX 3 // #define MIXMODE_USE_MIN 4 // #define MIXMODE_MULTIPLY 5 assert "Error: cannot combine heightfield and water map heightmap!" // mark output map as visible //#define MAPFLAG_READY 1 //#define MAPFLAG_SAVED 2 //#define MAPFLAG_MOSAIC 3 //#define MAPFLAG_INVALID 4 //#define MAPFLAG_MODIFIED 5 //#define MAPFLAG_SEAMFIX 6 map.SetFlag pHF 1 true map.SetFlag pHF 5 true //show the map view.ShowMap "HF" else // // user returned 'no'; store output in separate map // // create output map hvar pHF2 set pHF2 if pHF2 // map arelady exists; backup & free L3DTio_Backup.BackupMap "HF_plus_WM" "Combine WM and HF" 0x0 "view.ShowMap \"HF_plus_WM\"" map.Free pHF2 else set pHF2 endif assert pHF2 "Error: cannot create output map!" // copy HF into output map assert pHF2 0 0 0x00000001> "Error: cannot copy heightfield into swap map!" // combine // #define MIXMODE_REPLACE 0 // #define MIXMODE_ADD 1 // #define MIXMODE_SUB 2 // #define MIXMODE_USE_MAX 3 // #define MIXMODE_USE_MIN 4 // #define MIXMODE_MULTIPLY 5 assert "Error: cannot combine heightfield and water map heightmap!" // mark output map as visible map.SetFlag pHF2 1 true map.SetFlag pHF2 5 true //show the map view.ShowMap "HF_plus_WM" endif return 0 ===== Comments ===== None.