]> git.localhorst.tv Git - l2e.git/commitdiff
added second map area
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 6 Oct 2012 19:46:05 +0000 (21:46 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sat, 6 Oct 2012 19:46:05 +0000 (21:46 +0200)
src/main.cpp

index bf57b848a280d12fbb94b8b0ed179e18e211e24b..75bba636eebc5ddae6380c838963b71cf7052ba1 100644 (file)
@@ -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<int>(2, 1));
-               tiles[ 1].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_WEST);
-               tiles[ 2].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
-               tiles[ 3].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST);
-               tiles[ 4].SetOffset(Vector<int>(0, 1));
-               tiles[ 5].SetOffset(Vector<int>(2, 0));
-               tiles[ 6].SetOffset(Vector<int>(2, 0));
-               tiles[ 7].SetOffset(Vector<int>(2, 0));
-
-               tiles[ 8].SetOffset(Vector<int>(2, 1));
-               tiles[ 9].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
-               tiles[10].SetOffset(Vector<int>(3, 0));
-               tiles[11].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
-               tiles[12].SetOffset(Vector<int>(0, 2));
-               tiles[13].SetOffset(Vector<int>(1, 2));
-               tiles[14].SetOffset(Vector<int>(1, 2));
-               tiles[15].SetOffset(Vector<int>(1, 2));
-
-               tiles[16].SetOffset(Vector<int>(2, 1));
-               tiles[17].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
-               tiles[18].SetOffset(Vector<int>(3, 0));
-               tiles[19].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
-               tiles[20].SetOffset(Vector<int>(0, 3));
-               tiles[21].SetOffset(Vector<int>(1, 3));
-               tiles[22].SetOffset(Vector<int>(1, 3));
-               tiles[23].SetOffset(Vector<int>(2, 3));
-
-               tiles[24].SetOffset(Vector<int>(2, 1));
-               tiles[25].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
-               tiles[26].SetOffset(Vector<int>(3, 0));
-               tiles[27].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
-               tiles[28].SetOffset(Vector<int>(0, 4));
-               tiles[29].SetOffset(Vector<int>(1, 4));
-               tiles[30].SetOffset(Vector<int>(1, 4));
-               tiles[31].SetOffset(Vector<int>(2, 4));
-
-               tiles[32].SetOffset(Vector<int>(2, 1));
-               tiles[33].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
-               tiles[34].SetOffset(Vector<int>(3, 0));
-               tiles[35].SetOffset(Vector<int>(3, 0));
-               tiles[36].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
-               tiles[37].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
-               tiles[38].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
-               tiles[39].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST);
-
-               tiles[40].SetOffset(Vector<int>(2, 1));
-               tiles[41].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
-               tiles[42].SetOffset(Vector<int>(3, 0));
-               tiles[43].SetOffset(Vector<int>(3, 0));
-               tiles[44].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_SOUTH);
-               tiles[45].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH);
-               tiles[46].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH);
-               tiles[47].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST);
-
-               tiles[48].SetOffset(Vector<int>(2, 1));
-               tiles[49].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
-               tiles[50].SetOffset(Vector<int>(3, 0));
-               tiles[51].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
-               tiles[52].SetOffset(Vector<int>(0, 0));
-               tiles[53].SetOffset(Vector<int>(1, 0));
-               tiles[54].SetOffset(Vector<int>(1, 0));
-               tiles[55].SetOffset(Vector<int>(1, 0));
-
-               tiles[56].SetOffset(Vector<int>(2, 1));
-               tiles[57].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_WEST);
-               tiles[58].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_SOUTH);
-               tiles[59].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST);
-               tiles[60].SetOffset(Vector<int>(0, 1));
-               tiles[61].SetOffset(Vector<int>(1, 1));
-               tiles[62].SetOffset(Vector<int>(1, 1));
-               tiles[63].SetOffset(Vector<int>(1, 1));
-
-               Area areas[1];
-               areas[0].SetTiles(tiles, 64);
+               Tile tiles1[64];
+
+               tiles1[ 0].SetOffset(Vector<int>(2, 1));
+               tiles1[ 1].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_WEST);
+               tiles1[ 2].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
+               tiles1[ 3].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST);
+               tiles1[ 4].SetOffset(Vector<int>(0, 1));
+               tiles1[ 5].SetOffset(Vector<int>(2, 0));
+               tiles1[ 6].SetOffset(Vector<int>(2, 0));
+               tiles1[ 7].SetOffset(Vector<int>(2, 0));
+
+               tiles1[ 8].SetOffset(Vector<int>(2, 1));
+               tiles1[ 9].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
+               tiles1[10].SetOffset(Vector<int>(3, 0));
+               tiles1[11].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
+               tiles1[12].SetOffset(Vector<int>(0, 2));
+               tiles1[13].SetOffset(Vector<int>(1, 2));
+               tiles1[14].SetOffset(Vector<int>(1, 2));
+               tiles1[15].SetOffset(Vector<int>(1, 2));
+
+               tiles1[16].SetOffset(Vector<int>(2, 1));
+               tiles1[17].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
+               tiles1[18].SetOffset(Vector<int>(3, 0));
+               tiles1[19].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
+               tiles1[20].SetOffset(Vector<int>(0, 3));
+               tiles1[21].SetOffset(Vector<int>(1, 3));
+               tiles1[22].SetOffset(Vector<int>(1, 3));
+               tiles1[23].SetOffset(Vector<int>(2, 3));
+
+               tiles1[24].SetOffset(Vector<int>(2, 1));
+               tiles1[25].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
+               tiles1[26].SetOffset(Vector<int>(3, 0));
+               tiles1[27].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
+               tiles1[28].SetOffset(Vector<int>(0, 4));
+               tiles1[29].SetOffset(Vector<int>(1, 4));
+               tiles1[30].SetOffset(Vector<int>(1, 4));
+               tiles1[31].SetOffset(Vector<int>(2, 4));
+
+               tiles1[32].SetOffset(Vector<int>(2, 1));
+               tiles1[33].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
+               tiles1[34].SetOffset(Vector<int>(3, 0));
+               tiles1[35].SetOffset(Vector<int>(3, 0));
+               tiles1[36].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
+               tiles1[37].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
+               tiles1[38].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
+               tiles1[39].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH);
+
+               tiles1[40].SetOffset(Vector<int>(2, 1));
+               tiles1[41].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
+               tiles1[42].SetOffset(Vector<int>(3, 0));
+               tiles1[43].SetOffset(Vector<int>(3, 0));
+               tiles1[44].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_SOUTH);
+               tiles1[45].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH);
+               tiles1[46].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH);
+               tiles1[47].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH);
+
+               tiles1[48].SetOffset(Vector<int>(2, 1));
+               tiles1[49].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_WEST);
+               tiles1[50].SetOffset(Vector<int>(3, 0));
+               tiles1[51].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_EAST);
+               tiles1[52].SetOffset(Vector<int>(0, 0));
+               tiles1[53].SetOffset(Vector<int>(1, 0));
+               tiles1[54].SetOffset(Vector<int>(1, 0));
+               tiles1[55].SetOffset(Vector<int>(1, 0));
+
+               tiles1[56].SetOffset(Vector<int>(2, 1));
+               tiles1[57].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_WEST);
+               tiles1[58].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_SOUTH);
+               tiles1[59].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST);
+               tiles1[60].SetOffset(Vector<int>(0, 1));
+               tiles1[61].SetOffset(Vector<int>(1, 1));
+               tiles1[62].SetOffset(Vector<int>(1, 1));
+               tiles1[63].SetOffset(Vector<int>(1, 1));
+
+               Tile tiles2[64];
+
+               tiles2[ 0].SetOffset(Vector<int>(2, 0));
+               tiles2[ 1].SetOffset(Vector<int>(2, 0));
+               tiles2[ 2].SetOffset(Vector<int>(2, 0));
+               tiles2[ 3].SetOffset(Vector<int>(2, 0));
+               tiles2[ 4].SetOffset(Vector<int>(2, 0));
+               tiles2[ 5].SetOffset(Vector<int>(2, 0));
+               tiles2[ 6].SetOffset(Vector<int>(2, 0));
+               tiles2[ 7].SetOffset(Vector<int>(2, 0));
+
+               tiles2[ 8].SetOffset(Vector<int>(1, 2));
+               tiles2[ 9].SetOffset(Vector<int>(1, 2));
+               tiles2[10].SetOffset(Vector<int>(5, 3));
+               tiles2[11].SetOffset(Vector<int>(2, 0));
+               tiles2[12].SetOffset(Vector<int>(2, 0));
+               tiles2[13].SetOffset(Vector<int>(2, 0));
+               tiles2[14].SetOffset(Vector<int>(2, 0));
+               tiles2[15].SetOffset(Vector<int>(2, 0));
+
+               tiles2[16].SetOffset(Vector<int>(3, 3));
+               tiles2[17].SetOffset(Vector<int>(0, 3));
+               tiles2[18].SetOffset(Vector<int>(0, 1));
+               tiles2[19].SetOffset(Vector<int>(2, 0));
+               tiles2[20].SetOffset(Vector<int>(2, 0));
+               tiles2[21].SetOffset(Vector<int>(2, 0));
+               tiles2[22].SetOffset(Vector<int>(2, 0));
+               tiles2[23].SetOffset(Vector<int>(2, 0));
+
+               tiles2[24].SetOffset(Vector<int>(3, 4)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST | Tile::BLOCK_WEST);
+               tiles2[25].SetOffset(Vector<int>(0, 4));
+               tiles2[26].SetOffset(Vector<int>(0, 1));
+               tiles2[27].SetOffset(Vector<int>(2, 0));
+               tiles2[28].SetOffset(Vector<int>(2, 0));
+               tiles2[29].SetOffset(Vector<int>(2, 0));
+               tiles2[30].SetOffset(Vector<int>(2, 0));
+               tiles2[31].SetOffset(Vector<int>(2, 0));
+
+               tiles2[32].SetOffset(Vector<int>(5, 0));
+               tiles2[33].SetOffset(Vector<int>(3, 0)).SetFlags(Tile::BLOCK_NORTH | Tile::BLOCK_EAST);
+               tiles2[34].SetOffset(Vector<int>(0, 1));
+               tiles2[35].SetOffset(Vector<int>(2, 0));
+               tiles2[36].SetOffset(Vector<int>(2, 0));
+               tiles2[37].SetOffset(Vector<int>(2, 0));
+               tiles2[38].SetOffset(Vector<int>(2, 0));
+               tiles2[39].SetOffset(Vector<int>(2, 0));
+
+               tiles2[40].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH);
+               tiles2[41].SetOffset(Vector<int>(4, 0)).SetFlags(Tile::BLOCK_SOUTH | Tile::BLOCK_EAST);
+               tiles2[42].SetOffset(Vector<int>(0, 1));
+               tiles2[43].SetOffset(Vector<int>(2, 0));
+               tiles2[44].SetOffset(Vector<int>(2, 0));
+               tiles2[45].SetOffset(Vector<int>(2, 0));
+               tiles2[46].SetOffset(Vector<int>(2, 0));
+               tiles2[47].SetOffset(Vector<int>(2, 0));
+
+               tiles2[48].SetOffset(Vector<int>(1, 0));
+               tiles2[49].SetOffset(Vector<int>(1, 0));
+               tiles2[50].SetOffset(Vector<int>(5, 4));
+               tiles2[51].SetOffset(Vector<int>(2, 0));
+               tiles2[52].SetOffset(Vector<int>(2, 0));
+               tiles2[53].SetOffset(Vector<int>(2, 0));
+               tiles2[54].SetOffset(Vector<int>(2, 0));
+               tiles2[55].SetOffset(Vector<int>(2, 0));
+
+               tiles2[56].SetOffset(Vector<int>(2, 0));
+               tiles2[57].SetOffset(Vector<int>(2, 0));
+               tiles2[58].SetOffset(Vector<int>(2, 0));
+               tiles2[59].SetOffset(Vector<int>(2, 0));
+               tiles2[60].SetOffset(Vector<int>(2, 0));
+               tiles2[61].SetOffset(Vector<int>(2, 0));
+               tiles2[62].SetOffset(Vector<int>(2, 0));
+               tiles2[63].SetOffset(Vector<int>(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<int>(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);