From: Daniel Karbach Date: Sat, 6 Oct 2012 19:46:05 +0000 (+0200) Subject: added second map area X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=e11a18caf76cbc409573b7b05bb3b7f48c607e81;p=l2e.git added second map area --- diff --git a/src/main.cpp b/src/main.cpp index bf57b84..75bba63 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -239,83 +239,159 @@ int main(int argc, char **argv) { dekar.SetRing(caster.GetItem("rocketRingItem")); dekar.SetJewel(caster.GetItem("krakenRockItem")); - Tile tiles[64]; - - tiles[ 0].SetOffset(Vector(2, 1)); - tiles[ 1].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_WEST); - tiles[ 2].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles[ 3].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST); - tiles[ 4].SetOffset(Vector(0, 1)); - tiles[ 5].SetOffset(Vector(2, 0)); - tiles[ 6].SetOffset(Vector(2, 0)); - tiles[ 7].SetOffset(Vector(2, 0)); - - tiles[ 8].SetOffset(Vector(2, 1)); - tiles[ 9].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles[10].SetOffset(Vector(3, 0)); - tiles[11].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles[12].SetOffset(Vector(0, 2)); - tiles[13].SetOffset(Vector(1, 2)); - tiles[14].SetOffset(Vector(1, 2)); - tiles[15].SetOffset(Vector(1, 2)); - - tiles[16].SetOffset(Vector(2, 1)); - tiles[17].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles[18].SetOffset(Vector(3, 0)); - tiles[19].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles[20].SetOffset(Vector(0, 3)); - tiles[21].SetOffset(Vector(1, 3)); - tiles[22].SetOffset(Vector(1, 3)); - tiles[23].SetOffset(Vector(2, 3)); - - tiles[24].SetOffset(Vector(2, 1)); - tiles[25].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles[26].SetOffset(Vector(3, 0)); - tiles[27].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles[28].SetOffset(Vector(0, 4)); - tiles[29].SetOffset(Vector(1, 4)); - tiles[30].SetOffset(Vector(1, 4)); - tiles[31].SetOffset(Vector(2, 4)); - - tiles[32].SetOffset(Vector(2, 1)); - tiles[33].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles[34].SetOffset(Vector(3, 0)); - tiles[35].SetOffset(Vector(3, 0)); - tiles[36].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles[37].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles[38].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); - tiles[39].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST); - - tiles[40].SetOffset(Vector(2, 1)); - tiles[41].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles[42].SetOffset(Vector(3, 0)); - tiles[43].SetOffset(Vector(3, 0)); - tiles[44].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles[45].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles[46].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles[47].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST); - - tiles[48].SetOffset(Vector(2, 1)); - tiles[49].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); - tiles[50].SetOffset(Vector(3, 0)); - tiles[51].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); - tiles[52].SetOffset(Vector(0, 0)); - tiles[53].SetOffset(Vector(1, 0)); - tiles[54].SetOffset(Vector(1, 0)); - tiles[55].SetOffset(Vector(1, 0)); - - tiles[56].SetOffset(Vector(2, 1)); - tiles[57].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_WEST); - tiles[58].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH); - tiles[59].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST); - tiles[60].SetOffset(Vector(0, 1)); - tiles[61].SetOffset(Vector(1, 1)); - tiles[62].SetOffset(Vector(1, 1)); - tiles[63].SetOffset(Vector(1, 1)); - - Area areas[1]; - areas[0].SetTiles(tiles, 64); + Tile tiles1[64]; + + tiles1[ 0].SetOffset(Vector(2, 1)); + tiles1[ 1].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_WEST); + tiles1[ 2].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); + tiles1[ 3].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST); + tiles1[ 4].SetOffset(Vector(0, 1)); + tiles1[ 5].SetOffset(Vector(2, 0)); + tiles1[ 6].SetOffset(Vector(2, 0)); + tiles1[ 7].SetOffset(Vector(2, 0)); + + tiles1[ 8].SetOffset(Vector(2, 1)); + tiles1[ 9].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); + tiles1[10].SetOffset(Vector(3, 0)); + tiles1[11].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); + tiles1[12].SetOffset(Vector(0, 2)); + tiles1[13].SetOffset(Vector(1, 2)); + tiles1[14].SetOffset(Vector(1, 2)); + tiles1[15].SetOffset(Vector(1, 2)); + + tiles1[16].SetOffset(Vector(2, 1)); + tiles1[17].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); + tiles1[18].SetOffset(Vector(3, 0)); + tiles1[19].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); + tiles1[20].SetOffset(Vector(0, 3)); + tiles1[21].SetOffset(Vector(1, 3)); + tiles1[22].SetOffset(Vector(1, 3)); + tiles1[23].SetOffset(Vector(2, 3)); + + tiles1[24].SetOffset(Vector(2, 1)); + tiles1[25].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); + tiles1[26].SetOffset(Vector(3, 0)); + tiles1[27].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); + tiles1[28].SetOffset(Vector(0, 4)); + tiles1[29].SetOffset(Vector(1, 4)); + tiles1[30].SetOffset(Vector(1, 4)); + tiles1[31].SetOffset(Vector(2, 4)); + + tiles1[32].SetOffset(Vector(2, 1)); + tiles1[33].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); + tiles1[34].SetOffset(Vector(3, 0)); + tiles1[35].SetOffset(Vector(3, 0)); + tiles1[36].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); + tiles1[37].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); + tiles1[38].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); + tiles1[39].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH); + + tiles1[40].SetOffset(Vector(2, 1)); + tiles1[41].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); + tiles1[42].SetOffset(Vector(3, 0)); + tiles1[43].SetOffset(Vector(3, 0)); + tiles1[44].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH); + tiles1[45].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); + tiles1[46].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); + tiles1[47].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); + + tiles1[48].SetOffset(Vector(2, 1)); + tiles1[49].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_WEST); + tiles1[50].SetOffset(Vector(3, 0)); + tiles1[51].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_EAST); + tiles1[52].SetOffset(Vector(0, 0)); + tiles1[53].SetOffset(Vector(1, 0)); + tiles1[54].SetOffset(Vector(1, 0)); + tiles1[55].SetOffset(Vector(1, 0)); + + tiles1[56].SetOffset(Vector(2, 1)); + tiles1[57].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_WEST); + tiles1[58].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH); + tiles1[59].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST); + tiles1[60].SetOffset(Vector(0, 1)); + tiles1[61].SetOffset(Vector(1, 1)); + tiles1[62].SetOffset(Vector(1, 1)); + tiles1[63].SetOffset(Vector(1, 1)); + + Tile tiles2[64]; + + tiles2[ 0].SetOffset(Vector(2, 0)); + tiles2[ 1].SetOffset(Vector(2, 0)); + tiles2[ 2].SetOffset(Vector(2, 0)); + tiles2[ 3].SetOffset(Vector(2, 0)); + tiles2[ 4].SetOffset(Vector(2, 0)); + tiles2[ 5].SetOffset(Vector(2, 0)); + tiles2[ 6].SetOffset(Vector(2, 0)); + tiles2[ 7].SetOffset(Vector(2, 0)); + + tiles2[ 8].SetOffset(Vector(1, 2)); + tiles2[ 9].SetOffset(Vector(1, 2)); + tiles2[10].SetOffset(Vector(5, 3)); + tiles2[11].SetOffset(Vector(2, 0)); + tiles2[12].SetOffset(Vector(2, 0)); + tiles2[13].SetOffset(Vector(2, 0)); + tiles2[14].SetOffset(Vector(2, 0)); + tiles2[15].SetOffset(Vector(2, 0)); + + tiles2[16].SetOffset(Vector(3, 3)); + tiles2[17].SetOffset(Vector(0, 3)); + tiles2[18].SetOffset(Vector(0, 1)); + tiles2[19].SetOffset(Vector(2, 0)); + tiles2[20].SetOffset(Vector(2, 0)); + tiles2[21].SetOffset(Vector(2, 0)); + tiles2[22].SetOffset(Vector(2, 0)); + tiles2[23].SetOffset(Vector(2, 0)); + + tiles2[24].SetOffset(Vector(3, 4)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST | Tile::BLOCK_WEST); + tiles2[25].SetOffset(Vector(0, 4)); + tiles2[26].SetOffset(Vector(0, 1)); + tiles2[27].SetOffset(Vector(2, 0)); + tiles2[28].SetOffset(Vector(2, 0)); + tiles2[29].SetOffset(Vector(2, 0)); + tiles2[30].SetOffset(Vector(2, 0)); + tiles2[31].SetOffset(Vector(2, 0)); + + tiles2[32].SetOffset(Vector(5, 0)); + tiles2[33].SetOffset(Vector(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST); + tiles2[34].SetOffset(Vector(0, 1)); + tiles2[35].SetOffset(Vector(2, 0)); + tiles2[36].SetOffset(Vector(2, 0)); + tiles2[37].SetOffset(Vector(2, 0)); + tiles2[38].SetOffset(Vector(2, 0)); + tiles2[39].SetOffset(Vector(2, 0)); + + tiles2[40].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH); + tiles2[41].SetOffset(Vector(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST); + tiles2[42].SetOffset(Vector(0, 1)); + tiles2[43].SetOffset(Vector(2, 0)); + tiles2[44].SetOffset(Vector(2, 0)); + tiles2[45].SetOffset(Vector(2, 0)); + tiles2[46].SetOffset(Vector(2, 0)); + tiles2[47].SetOffset(Vector(2, 0)); + + tiles2[48].SetOffset(Vector(1, 0)); + tiles2[49].SetOffset(Vector(1, 0)); + tiles2[50].SetOffset(Vector(5, 4)); + tiles2[51].SetOffset(Vector(2, 0)); + tiles2[52].SetOffset(Vector(2, 0)); + tiles2[53].SetOffset(Vector(2, 0)); + tiles2[54].SetOffset(Vector(2, 0)); + tiles2[55].SetOffset(Vector(2, 0)); + + tiles2[56].SetOffset(Vector(2, 0)); + tiles2[57].SetOffset(Vector(2, 0)); + tiles2[58].SetOffset(Vector(2, 0)); + tiles2[59].SetOffset(Vector(2, 0)); + tiles2[60].SetOffset(Vector(2, 0)); + tiles2[61].SetOffset(Vector(2, 0)); + tiles2[62].SetOffset(Vector(2, 0)); + tiles2[63].SetOffset(Vector(2, 0)); + + Area areas[2]; + areas[0].SetTiles(tiles1, 64); areas[0].SetWidth(8); + areas[1].SetTiles(tiles2, 64); + areas[1].SetWidth(8); Trigger triggers[1]; triggers[0].SetTilePosition(Vector(2, 0)); @@ -324,10 +400,10 @@ int main(int argc, char **argv) { Sprite tileset(tilesetImg, tileSize, tileSize); Map map; - map.SetAreas(areas, 1); + map.SetAreas(areas, 2); map.SetTileset(&tileset); map.SetTriggers(triggers, 1); - map.SetWidth(1); + map.SetWidth(2); SDL_Surface *mapMaximImg(IMG_Load("test-data/maxim-map.png")); Sprite mapMaximSprite(mapMaximImg, 32, 64);