{"action":"closed","issue":{"url":"https://api.github.com/repos/angered-ghandi/OpenAOE/issues/36","repository_url":"https://api.github.com/repos/angered-ghandi/OpenAOE","labels_url":"https://api.github.com/repos/angered-ghandi/OpenAOE/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/angered-ghandi/OpenAOE/issues/36/comments","events_url":"https://api.github.com/repos/angered-ghandi/OpenAOE/issues/36/events","html_url":"https://github.com/angered-ghandi/OpenAOE/issues/36","id":167185518,"number":36,"title":"Data dump: Calculating world position of ramp corners","user":{"login":"Phrohdoh","id":4861023,"avatar_url":"https://avatars.githubusercontent.com/u/4861023?v=3","gravatar_id":"","url":"https://api.github.com/users/Phrohdoh","html_url":"https://github.com/Phrohdoh","followers_url":"https://api.github.com/users/Phrohdoh/followers","following_url":"https://api.github.com/users/Phrohdoh/following{/other_user}","gists_url":"https://api.github.com/users/Phrohdoh/gists{/gist_id}","starred_url":"https://api.github.com/users/Phrohdoh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phrohdoh/subscriptions","organizations_url":"https://api.github.com/users/Phrohdoh/orgs","repos_url":"https://api.github.com/users/Phrohdoh/repos","events_url":"https://api.github.com/users/Phrohdoh/events{/privacy}","received_events_url":"https://api.github.com/users/Phrohdoh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-23T14:01:23Z","updated_at":"2016-09-18T14:35:16Z","closed_at":"2016-09-18T14:35:16Z","body":"Here is a thought+data dump regarding getting the world-position of the ramp corners.\r\n\r\n```rust\r\nlet top    = cell_center_in_world_space + Vector3<i32>::new(0, -ramp_height, 0); // N\r\nlet right  = cell_center_in_world_space + Vector3<i32>::new(ramp_height, 0, 0); // E\r\nlet bottom = cell_center_in_world_space + Vector3<i32>::new(0, ramp_height, 0); // S\r\nlet left   = cell_center_in_world_space + Vector3<i32>::new(-ramp_height, 0, 0); // W\r\n```\r\n\r\nFor each of those new world positions we'll need to add a vec3 with a z component for the associated corner on the particular tile.\r\n\r\nLooking at the data we spit out from `empires.dat` I cannot come up with a way to create these associations automatically:\r\n\r\n```rust\r\nTerrain {\r\n    id: TerrainId(0),\r\n    enabled: true,\r\n    name: \"Grass\",\r\n    short_name: \"g_gr2\",\r\n    slp_id: Some(\r\n        SlpFileId(15001)\r\n    ),\r\n    sound_group_id: Some(\r\n        SoundGroupId(95)\r\n    ),\r\n    colors: [\r\n        99,\r\n        100,\r\n        101\r\n    ],\r\n    cliff_colors: [\r\n        157,\r\n        159\r\n    ],\r\n    pass_terrain_id: Some(\r\n        TerrainId(0)\r\n    ),\r\n    impass_terrain_id: Some(\r\n        TerrainId(16)\r\n    ),\r\n    animated: false,\r\n    animation_frames: 0,\r\n    pause_frames: 0,\r\n    frame_interval: 0,\r\n    pause_between_loops: 0,\r\n    frame: 0,\r\n    draw_frame: 0,\r\n    animate_last: 0,\r\n    frame_changed: 0,\r\n    elevation_graphics: [\r\n        TerrainFrameData {\r\n    \tframe_count: 9,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(0)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(9)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(10)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(11)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(12)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(13)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(14)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(15)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(16)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(17)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(18)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(19)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(20)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(21)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(22)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(23)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 1,\r\n    \tangle_count: 1,\r\n    \tframe_id: SlpFrameId(24)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 0,\r\n    \tangle_count: 0,\r\n    \tframe_id: SlpFrameId(25)\r\n        },\r\n        TerrainFrameData {\r\n    \tframe_count: 0,\r\n    \tangle_count: 0,\r\n    \tframe_id: SlpFrameId(25)\r\n        }\r\n    ],\r\n    terrain_to_draw: None,\r\n    terrain_width: 3,\r\n    terrain_height: 3,\r\n    terrain_borders: [\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(3),\r\n        TerrainBorderId(6),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(3),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(6),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(6),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(6),\r\n        TerrainBorderId(6),\r\n        TerrainBorderId(3),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0),\r\n        TerrainBorderId(0)\r\n    ],\r\n    terrain_units: [\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(168),\r\n    \tdensity: 3,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(177),\r\n    \tdensity: 3,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(167),\r\n    \tdensity: 0,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(170),\r\n    \tdensity: 0,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(171),\r\n    \tdensity: 3,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(172),\r\n    \tdensity: 0,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(173),\r\n    \tdensity: 3,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(174),\r\n    \tdensity: 3,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(175),\r\n    \tdensity: 3,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(176),\r\n    \tdensity: 3,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(186),\r\n    \tdensity: 1,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(304),\r\n    \tdensity: 1,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(305),\r\n    \tdensity: 1,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(306),\r\n    \tdensity: 1,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(310),\r\n    \tdensity: 0,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(311),\r\n    \tdensity: 0,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(312),\r\n    \tdensity: 0,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(313),\r\n    \tdensity: 0,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(332),\r\n    \tdensity: 0,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(333),\r\n    \tdensity: 0,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(334),\r\n    \tdensity: 0,\r\n    \tpriority: 1\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(134),\r\n    \tdensity: 1,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(136),\r\n    \tdensity: 1,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(140),\r\n    \tdensity: 1,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(141),\r\n    \tdensity: 1,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(144),\r\n    \tdensity: 1,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(146),\r\n    \tdensity: 1,\r\n    \tpriority: 0\r\n        },\r\n        TerrainUnit {\r\n    \tunit_id: UnitId(56),\r\n    \tdensity: 1,\r\n    \tpriority: 0\r\n        }\r\n    ]\r\n},\r\n```\r\n\r\nThe first `TerrainFrameData` contains all of the flat frames.\r\nAll of the following are ramps, some of which contain duplicate image data (so we could perhaps make a small optimization here if necessary, but that makes this more complex than necessary).\r\n\r\n![spritesheet](https://cloud.githubusercontent.com/assets/4861023/17078119/51bf9382-50af-11e6-937a-e0629d72241b.png)\r\n\r\n```rust\r\nmatch frame_index {\r\n  0..8 => flat,\r\n     9 => N,\r\n    10 => S,\r\n    11 => E,\r\n    12 => W,\r\n  \r\n    13 => NE,\r\n    14 => SE,\r\n    15 => NW,\r\n    16 => SW,\r\n  \r\n    17 => N,\r\n    18 => S,\r\n    19 => E,\r\n    20 => W,\r\n  \r\n    21 => N,\r\n    22 => S,\r\n    23 => W,\r\n    24 => E,\r\n}\r\n```\r\n\r\nref #33"}}
{"actor":{"display_login":"Phrohdoh"}}