Ticket #2264: terrainModifier.diff

File terrainModifier.diff, 37.9 KB (added by sanderd17, 10 years ago)
  • binaries/data/mods/public/art/actors/structures/celts/wall_long.xml

     
    22<actor version="1">
    33  <castshadow/>
    44  <group>
    5     <variant frequency="100" name="celt wall long">
    6       <mesh>structural/celt_wall_long.dae</mesh>
    7       <textures>
    8         <texture file="structural/celt_murus.png" name="baseTex"/>
    9         <texture file="structural/celt_murus_norm.png" name="normTex"/>
    10         <texture file="structural/celt_murus_spec.png" name="specTex"/>
    11         <texture file="structural/ao/celt_wall_long.png" name="aoTex"/>
    12       </textures>
    13     </variant>
    14   </group>
    15   <group>
    16     <variant frequency="100" name="Idle"/>
    17     <variant name="death">
     5    <variant frequency="1" name="wall">
     6      <mesh>structural/slope_wall_propped.dae</mesh>
    187      <props>
    19         <prop actor="particle/destruction_smoke_med.xml" attachpoint="root"/>
    20         <prop actor="particle/destruction_dust_med.xml" attachpoint="root"/>
    21         <prop actor="particle/destruction_dust_med_gray.xml" attachpoint="root"/>
     8        <prop actor="structures/celts/wall_long_p.xml" attachpoint="wall" maxheight="20" minheight="-20"/>
    229      </props>
     10      <textures>
     11        <texture file="gaia/decal_farmland.png" name="baseTex"/>
     12        <texture file="gaia/decal_farmland_norm.png" name="normTex"/>
     13        <texture file="gaia/decal_farmland_spec.png" name="specTex"/>
     14      </textures>
    2315    </variant>
    2416  </group>
    25   <material>player_trans_ao_parallax_spec.xml</material>
     17  <material>basic_trans.xml</material>
    2618</actor>
  • binaries/data/mods/public/art/actors/structures/celts/wall_medium.xml

     
    22<actor version="1">
    33  <castshadow/>
    44  <group>
    5     <variant frequency="100" name="celt wall medium">
    6       <mesh>structural/celt_wall_medium.dae</mesh>
    7       <textures>
    8         <texture file="structural/celt_murus.png" name="baseTex"/>
    9         <texture file="structural/celt_murus_norm.png" name="normTex"/>
    10         <texture file="structural/celt_murus_spec.png" name="specTex"/>
    11         <texture file="structural/ao/celt_wall_medium.png" name="aoTex"/>
    12       </textures>
    13     </variant>
    14   </group>
    15   <group>
    16     <variant frequency="100" name="Idle"/>
    17     <variant name="death">
     5    <variant frequency="1" name="wall">
     6      <mesh>structural/slope_wall_propped.dae</mesh>
    187      <props>
    19         <prop actor="particle/destruction_smoke_med.xml" attachpoint="root"/>
    20         <prop actor="particle/destruction_dust_med.xml" attachpoint="root"/>
    21         <prop actor="particle/destruction_dust_med_gray.xml" attachpoint="root"/>
     8        <prop actor="structures/celts/wall_medium_p.xml" attachpoint="wall" maxheight="20" minheight="-20"/>
    229      </props>
     10      <textures>
     11        <texture file="gaia/decal_farmland.png" name="baseTex"/>
     12        <texture file="gaia/decal_farmland_norm.png" name="normTex"/>
     13        <texture file="gaia/decal_farmland_spec.png" name="specTex"/>
     14      </textures>
    2315    </variant>
    2416  </group>
    25    <material>player_trans_ao_parallax_spec.xml</material>
     17  <material>basic_trans.xml</material>
    2618</actor>
  • binaries/data/mods/public/art/actors/structures/celts/wall_medium_p.xml

    Cannot display: file marked as a binary type.
    svn:mime-type = application/xml
  • binaries/data/mods/public/art/actors/structures/celts/wall_short.xml

    Property changes on: binaries/data/mods/public/art/actors/structures/celts/wall_medium_p.xml
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/xml
    \ No newline at end of property
     
    22<actor version="1">
    33  <castshadow/>
    44  <group>
    5     <variant frequency="100" name="celt wall short">
    6       <mesh>structural/celt_wall_short.dae</mesh>
    7       <textures>
    8         <texture file="structural/celt_murus.png" name="baseTex"/>
    9         <texture file="structural/celt_murus_norm.png" name="normTex"/>
    10         <texture file="structural/celt_murus_spec.png" name="specTex"/>
    11         <texture file="structural/ao/celt_wall_short.png" name="aoTex"/>
    12       </textures>
    13     </variant>
    14   </group>
    15   <group>
    16     <variant frequency="100" name="Idle"/>
    17     <variant name="death">
     5    <variant frequency="1" name="wall">
     6      <mesh>structural/slope_wall_propped.dae</mesh>
    187      <props>
    19         <prop actor="particle/destruction_smoke_med.xml" attachpoint="root"/>
    20         <prop actor="particle/destruction_dust_med.xml" attachpoint="root"/>
    21         <prop actor="particle/destruction_dust_med_gray.xml" attachpoint="root"/>
     8        <prop actor="structures/celts/wall_short_p.xml" attachpoint="wall" maxheight="20" minheight="-20"/>
    229      </props>
     10      <textures>
     11        <texture file="gaia/decal_farmland.png" name="baseTex"/>
     12        <texture file="gaia/decal_farmland_norm.png" name="normTex"/>
     13        <texture file="gaia/decal_farmland_spec.png" name="specTex"/>
     14      </textures>
    2315    </variant>
    2416  </group>
    25   <material>player_trans_ao_parallax_spec.xml</material>
     17  <material>basic_trans.xml</material>
    2618</actor>
  • binaries/data/mods/public/art/actors/structures/celts/wall_short_p.xml

    Cannot display: file marked as a binary type.
    svn:mime-type = application/xml
  • binaries/data/mods/public/art/actors/structures/celts/wall_tower.xml

    Property changes on: binaries/data/mods/public/art/actors/structures/celts/wall_short_p.xml
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/xml
    \ No newline at end of property
     
    1 <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
     1<?xml version="1.0" encoding="utf-8"?>
    22<actor version="1">
    33  <castshadow/>
    44  <group>
    5     <variant>
    6       <mesh>structural/celt_wall_tower.dae</mesh>
     5    <variant frequency="1" name="wall">
     6      <mesh>structural/slope_wall_propped.dae</mesh>
    77      <props>
    8         <prop actor="props/structures/persians/wall_tower.xml" attachpoint="root"/>
    9         <prop actor="props/units/weapons/arrow_front.xml" attachpoint="loaded-projectile"/>
    10         <prop actor="props/units/weapons/arrow_front.xml" attachpoint="projectile"/>
     8        <prop actor="structures/celts/wall_tower_p.xml" attachpoint="wall" maxheight="20" minheight="-20"/>
    119      </props>
    1210      <textures>
    13         <texture file="structural/celt_murus.png" name="baseTex"/>
    14         <texture file="structural/celt_murus_norm.png" name="normTex"/>
    15         <texture file="structural/celt_murus_spec.png" name="specTex"/>
    16         <texture file="structural/ao/celt_wall_tower.png" name="aoTex"/>
    17       </textures>
     11        <texture file="gaia/decal_farmland.png" name="baseTex"/>
     12        <texture file="gaia/decal_farmland_norm.png" name="normTex"/>
     13        <texture file="gaia/decal_farmland_spec.png" name="specTex"/>
     14      </textures>
    1815    </variant>
    1916  </group>
    20   <group>
    21     <variant frequency="100" name="Idle"/>
    22     <variant name="garrisoned">
    23       <props>
    24         <prop actor="props/special/common/garrison_flag_celt.xml" attachpoint="garrisoned"/>
    25       </props>
    26     </variant>
    27     <variant name="death">
    28       <props>
    29         <prop actor="particle/destruction_smoke_small.xml" attachpoint="root"/>
    30         <prop actor="particle/destruction_dust_small.xml" attachpoint="root"/>
    31         <prop actor="particle/destruction_dust_small_gray.xml" attachpoint="root"/>
    32       </props>
    33     </variant>
    34   </group>
    35   <material>player_trans_ao_parallax_spec.xml</material>
     17  <material>basic_trans.xml</material>
    3618</actor>
  • binaries/data/mods/public/art/actors/structures/celts/wall_tower_p.xml

    Cannot display: file marked as a binary type.
    svn:mime-type = application/xml
  • binaries/data/mods/public/simulation/templates/structures/brit_wall_long.xml

    Property changes on: binaries/data/mods/public/art/actors/structures/celts/wall_tower_p.xml
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +application/xml
    \ No newline at end of property
     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_long">
    33  <Footprint>
    4     <Square width="38.5" depth="8.5"/>
     4    <Square width="38.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Identity>
     
    1111    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1212  </Identity>
    1313  <Obstruction>
    14     <Static width="37.0" depth="7.0"/>
     14    <Static width="37.0" depth="10.0"/>
    1515  </Obstruction>
     16  <TerrainModifier>
     17    <Type>
     18      slopeWall
     19    </Type>
     20  </TerrainModifier>
    1621  <VisualActor>
    1722    <Actor>structures/celts/wall_long.xml</Actor>
    1823  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/brit_wall_medium.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_medium">
    33  <Footprint>
    4     <Square width="26.5" depth="8.5"/>
     4    <Square width="26.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Health>
     
    1414    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1515  </Identity>
    1616  <Obstruction>
    17     <Static width="25.0" depth="7.0"/>
     17    <Static width="25.0" depth="10.0"/>
    1818  </Obstruction>
     19  <TerrainModifier>
     20    <Type>
     21      slopeWall
     22    </Type>
     23  </TerrainModifier>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_medium.xml</Actor>
    2126  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/brit_wall_short.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_short">
    33  <Footprint>
    4     <Square width="14.5" depth="8.5"/>
     4    <Square width="14.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Health>
     
    1414    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1515  </Identity>
    1616  <Obstruction>
    17     <Static width="13.0" depth="7.0"/>
     17    <Static width="13.0" depth="10.0"/>
    1818  </Obstruction>
     19  <TerrainModifier>
     20    <Type>
     21      slopeWall
     22    </Type>
     23  </TerrainModifier>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_short.xml</Actor>
    2126  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/brit_wall_tower.xml

     
    22<Entity parent="template_structure_defense_wall_tower">
    33  <Attack disable=""/>
    44  <Footprint>
    5     <Square width="10.0" depth="10.0"/>
    6     <Height>20.0</Height>
     5    <Square width="10.0" depth="13.0"/>
     6    <Height>9.0</Height>
    77  </Footprint>
    88  <GarrisonHolder disable=""/>
    99  <Identity>
     
    1313    <Tooltip>Does not shoot or garrison.</Tooltip>
    1414  </Identity>
    1515  <Obstruction>
    16     <Static width="9.0" depth="9.0"/>
     16    <Static width="9.0" depth="12.0"/>
    1717  </Obstruction>
     18  <TerrainModifier>
     19    <Type>
     20      slopeWall
     21    </Type>
     22  </TerrainModifier>
    1823  <RallyPoint disable=""/>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_tower.xml</Actor>
  • binaries/data/mods/public/simulation/templates/structures/celt_wall_long.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_long">
    33  <Footprint>
    4     <Square width="38.5" depth="8.5"/>
     4    <Square width="38.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Identity>
     
    1111    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1212  </Identity>
    1313  <Obstruction>
    14     <Static width="37.0" depth="7.0"/>
     14    <Static width="37.0" depth="10.0"/>
    1515  </Obstruction>
     16  <TerrainModifier>
     17    <Type>
     18      slopeWall
     19    </Type>
     20  </TerrainModifier>
    1621  <VisualActor>
    1722    <Actor>structures/celts/wall_long.xml</Actor>
    1823  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/celt_wall_medium.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_medium">
    33  <Footprint>
    4     <Square width="26.5" depth="8.5"/>
     4    <Square width="26.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Health>
     
    1414    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1515  </Identity>
    1616  <Obstruction>
    17     <Static width="25.0" depth="7.0"/>
     17    <Static width="25.0" depth="10.0"/>
    1818  </Obstruction>
     19  <TerrainModifier>
     20    <Type>
     21      slopeWall
     22    </Type>
     23  </TerrainModifier>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_medium.xml</Actor>
    2126  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/celt_wall_short.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_short">
    33  <Footprint>
    4     <Square width="14.5" depth="8.5"/>
     4    <Square width="14.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Health>
     
    1414    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1515  </Identity>
    1616  <Obstruction>
    17     <Static width="13.0" depth="7.0"/>
     17    <Static width="13.0" depth="10.0"/>
    1818  </Obstruction>
     19  <TerrainModifier>
     20    <Type>
     21      slopeWall
     22    </Type>
     23  </TerrainModifier>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_short.xml</Actor>
    2126  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/celt_wall_tower.xml

     
    22<Entity parent="template_structure_defense_wall_tower">
    33  <Attack disable=""/>
    44  <Footprint>
    5     <Square width="10.0" depth="10.0"/>
    6     <Height>20.0</Height>
     5    <Square width="10.0" depth="13.0"/>
     6    <Height>9.0</Height>
    77  </Footprint>
    88  <GarrisonHolder disable=""/>
    99  <Identity>
     
    1313    <Tooltip>Does not shoot or garrison.</Tooltip>
    1414  </Identity>
    1515  <Obstruction>
    16     <Static width="9.0" depth="9.0"/>
     16    <Static width="9.0" depth="12.0"/>
    1717  </Obstruction>
    1818  <RallyPoint disable=""/>
     19  <TerrainModifier>
     20    <Type>
     21      slopeWall
     22    </Type>
     23  </TerrainModifier>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_tower.xml</Actor>
    2126  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/gaul_wall_long.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_long">
    33  <Footprint>
    4     <Square width="38.5" depth="8.5"/>
     4    <Square width="38.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Identity>
     
    1111    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1212  </Identity>
    1313  <Obstruction>
    14     <Static width="37.0" depth="7.0"/>
     14    <Static width="37.0" depth="10.0"/>
    1515  </Obstruction>
     16  <TerrainModifier>
     17    <Type>
     18      slopeWall
     19    </Type>
     20  </TerrainModifier>
    1621  <VisualActor>
    1722    <Actor>structures/celts/wall_long.xml</Actor>
    1823  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/gaul_wall_medium.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_medium">
    33  <Footprint>
    4     <Square width="26.5" depth="8.5"/>
     4    <Square width="26.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Health>
     
    1414    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1515  </Identity>
    1616  <Obstruction>
    17     <Static width="25.0" depth="7.0"/>
     17    <Static width="25.0" depth="10.0"/>
    1818  </Obstruction>
     19  <TerrainModifier>
     20    <Type>
     21      slopeWall
     22    </Type>
     23  </TerrainModifier>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_medium.xml</Actor>
    2126  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/gaul_wall_short.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="template_structure_defense_wall_short">
    33  <Footprint>
    4     <Square width="14.5" depth="8.5"/>
     4    <Square width="14.5" depth="12.5"/>
    55    <Height>9.0</Height>
    66  </Footprint>
    77  <Health>
     
    1414    <History>The Romans called this wall 'Murus Gallicus'. Translated, it means 'Gaulish wall'. It was extremely resistant to assault by battering ram. Julius Caesar described a type of wood and stone wall, known as a Murus Gallicus, in his account of the Gallic Wars. These walls were made of a stone wall filled with rubble, with wooden logs inside for stability. Caesar noted how the flexibility of the wood added to the strength of the fort in case of battering ram attack.</History>
    1515  </Identity>
    1616  <Obstruction>
    17     <Static width="13.0" depth="7.0"/>
     17    <Static width="13.0" depth="10.0"/>
    1818  </Obstruction>
     19  <TerrainModifier>
     20    <Type>
     21      slopeWall
     22    </Type>
     23  </TerrainModifier>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_short.xml</Actor>
    2126  </VisualActor>
  • binaries/data/mods/public/simulation/templates/structures/gaul_wall_tower.xml

     
    22<Entity parent="template_structure_defense_wall_tower">
    33  <Attack disable=""/>
    44  <Footprint>
    5     <Square width="10.0" depth="10.0"/>
     5    <Square width="10.0" depth="13.0"/>
    66    <Height>20.0</Height>
    77  </Footprint>
    88  <GarrisonHolder disable=""/>
     
    1313    <Tooltip>Does not shoot or garrison.</Tooltip>
    1414  </Identity>
    1515  <Obstruction>
    16     <Static width="9.0" depth="9.0"/>
     16    <Static width="9.0" depth="12.0"/>
    1717  </Obstruction>
     18  <TerrainModifier>
     19    <Type>
     20      slopeWall
     21    </Type>
     22  </TerrainModifier>
    1823  <RallyPoint disable=""/>
    1924  <VisualActor>
    2025    <Actor>structures/celts/wall_tower.xml</Actor>
  • binaries/data/mods/public/simulation/templates/structures/iber_house.xml

     
    1919    <Radius>16</Radius>
    2020    <Weight>65536</Weight>
    2121  </TerritoryInfluence>
     22  <TerrainModifier>
     23    <Type>
     24      flatten
     25    </Type>
     26  </TerrainModifier>
    2227  <VisualActor>
    2328    <Actor>structures/iberians/house.xml</Actor>
    2429    <FoundationActor>structures/fndn_2x2.xml</FoundationActor>
  • binaries/data/mods/public/simulation/templates/template_structure_defense_wall.xml

     
    4848    <Radius>20</Radius>
    4949    <Weight>65536</Weight>
    5050  </TerritoryInfluence>
     51  <TerrainModifier disable=""/>
    5152  <Vision>
    5253    <Range>20</Range>
    5354  </Vision>
  • binaries/data/mods/public/simulation/templates/template_structure_defense_wall_long.xml

     
    1010    <SpawnEntityOnDeath>rubble/rubble_stone_wall_long</SpawnEntityOnDeath>
    1111  </Health>
    1212  <Identity>
    13     <Classes datatype="tokens">LongWall</Classes>
    14     <Tooltip>Long wall segments can be converted to gates.</Tooltip>
    15   </Identity>
    16 </Entity>
     13    <Classes datatype="tokens">LongWall</Classes>
     14    <Tooltip>Long wall segments can be converted to gates.</Tooltip>
     15  </Identity>
     16</Entity>
  • binaries/data/mods/public/simulation/templates/template_structure_defense_wall_tower.xml

     
    8585  <StatusBars>
    8686    <HeightOffset>20.0</HeightOffset>
    8787  </StatusBars>
     88  <TerrainModifier disable=""/>
    8889  <TerritoryInfluence>
    8990    <Root>false</Root>
    9091    <Radius>20</Radius>
  • binaries/data/mods/public/simulation/templates/template_structure_military_dock.xml

     
    5353    </SoundGroups>
    5454  </Sound>
    5555  <TerritoryDecay disable=""/>
     56  <TerrainModifier disable=""/>
    5657  <ProductionQueue>
    5758    <BatchTimeModifier>0.8</BatchTimeModifier>
    5859    <Entities datatype="tokens">
  • source/simulation2/TypeList.h

     
    148148INTERFACE(Terrain)
    149149COMPONENT(Terrain)
    150150
     151INTERFACE(TerrainModifier)
     152COMPONENT(TerrainModifierScripted)
     153
    151154INTERFACE(TerritoryInfluence)
    152155COMPONENT(TerritoryInfluence)
    153156
  • source/simulation2/components/CCmpTerrain.cpp

     
    2020#include "simulation2/system/Component.h"
    2121#include "ICmpTerrain.h"
    2222
     23#include "ICmpTerrainModifier.h"
    2324#include "ICmpObstructionManager.h"
    2425#include "ICmpRangeManager.h"
     26#include "ICmpPosition.h"
    2527#include "simulation2/MessageTypes.h"
     28#include "simulation2/helpers/Geometry.h"
    2629
    2730#include "graphics/Terrain.h"
    2831#include "renderer/Renderer.h"
    2932#include "renderer/WaterManager.h"
     33#include "graphics/Patch.h"
     34#include "maths/MathUtil.h"
    3035#include "maths/Vector3D.h"
    3136
    3237class CCmpTerrain : public ICmpTerrain
     
    4045
    4146    CTerrain* m_Terrain; // not null
    4247
     48    std::vector<u16> m_SimHeightmap;
     49    ssize_t m_MapSizePatches;
     50
     51
    4352    static std::string GetSchema()
    4453    {
    4554        return "<a:component type='system'/><empty/>";
     
    4857    virtual void Init(const CParamNode& UNUSED(paramNode))
    4958    {
    5059        m_Terrain = &GetSimContext().GetTerrain();
     60        m_MapSizePatches = 0;
    5161    }
    5262
    5363    virtual void Deinit()
     
    6878        return m_Terrain->GetVerticesPerSide() != 0;
    6979    }
    7080
     81
     82    virtual u16* GetSimHeightMap()
     83    {
     84        return &m_SimHeightmap[0];
     85    }
     86
     87    virtual void MakeVisualTerrainDirty()
     88    {
     89        if (m_Terrain->GetPatchesPerSide() != m_MapSizePatches)
     90            m_Terrain->Resize(m_MapSizePatches);
     91
     92        if (m_MapSizePatches)
     93            RecalculateVisualHeightmap();
     94    }
     95
    7196    virtual CFixedVector3D CalcNormal(entity_pos_t x, entity_pos_t z)
    7297    {
    7398        CFixedVector3D normal;
     
    83108    virtual entity_pos_t GetGroundLevel(entity_pos_t x, entity_pos_t z)
    84109    {
    85110        // TODO: this can crash if the terrain heightmap isn't initialised yet
    86 
    87111        return m_Terrain->GetExactGroundLevelFixed(x, z);
    88112    }
    89113
     
    94118
    95119    virtual u16 GetTilesPerSide()
    96120    {
    97         ssize_t tiles = m_Terrain->GetTilesPerSide();
     121        ssize_t tiles = m_MapSizePatches * PATCH_SIZE;
    98122        ENSURE(1 <= tiles && tiles <= 65535);
    99123        return (u16)tiles;
    100124    }
     
    101125
    102126    virtual u16 GetVerticesPerSide()
    103127    {
    104         ssize_t vertices = m_Terrain->GetVerticesPerSide();
    105         ENSURE(1 <= vertices && vertices <= 65535);
     128        ssize_t vertices = m_MapSizePatches * PATCH_SIZE + 1;
     129        ENSURE(1 < vertices && vertices <= 65535);
    106130        return (u16)vertices;
    107131    }
    108132
     
    111135        return m_Terrain;
    112136    }
    113137
     138    struct IterateHeightmapAverage
     139    {
     140        u16* heightmap;
     141        int pitch;
     142
     143        // weighted sum of the wanted heights
     144        fixed* avgHeightmap;
     145        // sum of the weights
     146        fixed* sumWeightmap;
     147
     148        void operator()(int i, int j, fixed weight, fixed newHeight)
     149        {
     150            if (weight > fixed::Zero())
     151            {
     152                fixed sumWeight = sumWeightmap[i+j*pitch] + weight;
     153                // avoid overflows by dividing before multiplying
     154                avgHeightmap[i+j*pitch] = (avgHeightmap[i+j*pitch]/sumWeight).Multiply(sumWeightmap[i+j*pitch]) + (newHeight/sumWeight).Multiply(weight);
     155               
     156                sumWeightmap[i+j*pitch] = sumWeight;
     157                int h = HEIGHT_UNITS_PER_METRE*avgHeightmap[i+j*pitch].ToInt_RoundToNearest();
     158                heightmap[i + j*pitch] = Clamp(h, 0, 65535);
     159            }
     160        }
     161    };
     162
     163    template<typename T>
     164    void IterateHeightmap(T& callback, CFixedVector2D pos, fixed angle, entity_id_t ent)
     165    {
     166        CmpPtr<ICmpTerrainModifier> CCmpTerrainModifier(GetSimContext(), ent);
     167        // get the bbox, multiply by sqrt(2)/2 (rounded up) to get half the size and take
     168        // account of possible rotations
     169        fixed BBoxSize = CCmpTerrainModifier->GetBBox()/2;
     170        fixed maxBBoxSize = BBoxSize*142/100;
     171        int numVerts = m_MapSizePatches*PATCH_SIZE + 1;
     172
     173        int i0 = ((pos.X - maxBBoxSize) / TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
     174        int i1 = ((pos.X + maxBBoxSize) / TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
     175        int j0 = ((pos.Y - maxBBoxSize) / TERRAIN_TILE_SIZE).ToInt_RoundToNegInfinity();
     176        int j1 = ((pos.Y + maxBBoxSize) / TERRAIN_TILE_SIZE).ToInt_RoundToInfinity();
     177        i0 = Clamp(i0, 0, numVerts);
     178        i1 = Clamp(i1, 0, numVerts);
     179        j0 = Clamp(j0, 0, numVerts);
     180        j1 = Clamp(j1, 0, numVerts);
     181
     182        fixed entHeight = m_Terrain->GetExactGroundLevelFixed(pos.X, pos.Y);
     183        for (int j = j0; j <= j1; ++j)
     184        {
     185            for (int i = i0; i <= i1; ++i)
     186            {
     187                CFixedVector2D pt = CFixedVector2D(fixed::FromInt(i*TERRAIN_TILE_SIZE), fixed::FromInt(j*TERRAIN_TILE_SIZE)) - CFixedVector2D(pos.X, pos.Y);
     188                pt = pt.Rotate(-angle);
     189                if (pt.X.Absolute() > BBoxSize || pt.Y.Absolute() > BBoxSize)
     190                    continue;
     191                fixed oldHeight = m_Terrain->GetVertexGroundLevelFixed(i, j);
     192                fixed newHeight, weight;
     193                CCmpTerrainModifier->GetNewHeight(pt, oldHeight, entHeight, newHeight, weight);
     194                callback(i, j, weight, newHeight);
     195            }
     196        }
     197        MakeDirty(i0, j0, i1, j1);
     198    }
     199
     200    void RecalculateVisualHeightmap()
     201    {
     202        u16* heightmap = m_Terrain->GetHeightMap();
     203        int pitch = m_MapSizePatches * PATCH_SIZE + 1;
     204        std::vector<u16> tempHeightmap(pitch*pitch);
     205        memcpy(&tempHeightmap[0], &m_SimHeightmap[0], pitch * pitch * sizeof(u16));
     206        memcpy(heightmap, &m_SimHeightmap[0], pitch * pitch * sizeof(u16));
     207
     208        IterateHeightmapAverage callback;
     209        callback.heightmap = &tempHeightmap[0];
     210        callback.pitch = pitch;
     211        std::vector<fixed> avgHeightmap(pitch * pitch, fixed::Zero());
     212        callback.avgHeightmap = &avgHeightmap[0];
     213        std::vector<fixed> sumWeightmap(pitch * pitch, fixed::Zero());
     214        callback.sumWeightmap = &sumWeightmap[0];
     215
     216        CComponentManager::InterfaceList ents = GetSimContext().GetComponentManager().GetEntitiesWithInterface(IID_TerrainModifier);
     217        for (CComponentManager::InterfaceList::const_iterator it = ents.begin(); it != ents.end(); ++it)
     218        {
     219            CmpPtr<ICmpPosition> cmpPosition(GetSimContext(), it->first);
     220            if (cmpPosition)
     221            {
     222                CFixedVector2D pos = cmpPosition->GetPosition2D();
     223                fixed angle = cmpPosition->GetRotation().Y;
     224
     225                IterateHeightmap(callback, pos, angle, it->first);
     226            }
     227        }
     228
     229        memcpy(heightmap, &tempHeightmap[0], pitch * pitch * sizeof(u16));
     230        m_Terrain->MakeDirty(RENDERDATA_UPDATE_VERTICES);
     231    }
     232
    114233    virtual void ReloadTerrain()
    115234    {
    116235        // TODO: should refactor this code to be nicer
     236        m_MapSizePatches = m_Terrain->GetPatchesPerSide();
     237        size_t size = (m_MapSizePatches * PATCH_SIZE + 1)*(m_MapSizePatches * PATCH_SIZE + 1);
     238        m_SimHeightmap.resize(size);
     239        if (m_Terrain->GetHeightMap())
     240            memcpy(&m_SimHeightmap[0], m_Terrain->GetHeightMap(), size*sizeof(u16));
     241        else
     242            memset(&m_SimHeightmap[0], 0, size*sizeof(u16));
    117243
    118244        u16 tiles = GetTilesPerSide();
    119245        u16 vertices = GetVerticesPerSide();
     
    138264        if (CRenderer::IsInitialised())
    139265            g_Renderer.GetWaterManager()->SetMapSize(vertices);
    140266
    141         MakeDirty(0, 0, tiles+1, tiles+1);
     267        MakeVisualTerrainDirty();
     268        MakeDirty(0, 0, tiles + 1, tiles + 1);
    142269    }
    143270
    144271    virtual void MakeDirty(i32 i0, i32 j0, i32 i1, i32 j1)
  • source/simulation2/components/ICmpTerrain.cpp

     
    2424BEGIN_INTERFACE_WRAPPER(Terrain)
    2525DEFINE_INTERFACE_METHOD_2("GetGroundLevel", entity_pos_t, ICmpTerrain, GetGroundLevel, entity_pos_t, entity_pos_t)
    2626DEFINE_INTERFACE_METHOD_2("CalcNormal", CFixedVector3D, ICmpTerrain, CalcNormal, entity_pos_t, entity_pos_t)
     27DEFINE_INTERFACE_METHOD_0("MakeVisualTerrainDirty", void, ICmpTerrain, MakeVisualTerrainDirty)
    2728END_INTERFACE_WRAPPER(Terrain)
  • source/simulation2/components/ICmpTerrain.h

     
    3232public:
    3333    virtual bool IsLoaded() = 0;
    3434
     35    virtual u16* GetSimHeightMap() = 0;
     36
     37    virtual void MakeVisualTerrainDirty() = 0;
     38
    3539    virtual CFixedVector3D CalcNormal(entity_pos_t x, entity_pos_t z) = 0;
    3640
    3741    virtual CVector3D CalcExactNormal(float x, float z) = 0;
  • source/simulation2/system/ComponentTest.h

     
    229229    virtual void ReloadTerrain()
    230230    {
    231231    }
     232
     233    virtual void MakeVisualTerrainDirty()
     234    {
     235    }
     236
     237    virtual u16* GetSimHeightMap()
     238    {
     239        return NULL;
     240    }
    232241};
  • source/tools/atlas/GameInterface/Handlers/ElevationHandlers.cpp

     
    4141    void Init()
    4242    {
    4343        m_Heightmap = g_Game->GetWorld()->GetTerrain()->GetHeightMap();
     44        CmpPtr<ICmpTerrain> cmpTerrain(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
     45        if (cmpTerrain)
     46            m_SimHeightmap = cmpTerrain->GetSimHeightMap();
    4447        m_VertsPerSide = g_Game->GetWorld()->GetTerrain()->GetVerticesPerSide();
    4548    }
    4649
     
    9093    void setNew(ssize_t x, ssize_t y, const u16& val)
    9194    {
    9295        m_Heightmap[y*m_VertsPerSide + x] = val;
     96        if (m_SimHeightmap)
     97            m_SimHeightmap[y*m_VertsPerSide + x] = val;
    9398    }
    9499
    95100    u16* m_Heightmap;
     101    u16* m_SimHeightmap;
    96102    ssize_t m_VertsPerSide;
    97103};
    98104