]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
added readme file
[l2e.git] / src / main.cpp
index ff49b66bb578b11a9536fb476abcb7b868d6b75d..793a76fa6f8b1c9e0b33690f2f772f28cfc4fc06 100644 (file)
@@ -102,7 +102,7 @@ int main(int argc, char **argv) {
        const int tileSize = 32;
        const float walkSpeed = 128.0f;
 
-       const bool battle(false);
+       bool battle(false);
 
 //     std::srand(std::time(0));
 
@@ -127,6 +127,7 @@ int main(int argc, char **argv) {
                Sprite::CreateTypeDescription();
                Stats::CreateTypeDescription();
                common::TargetingMode::CreateTypeDescription();
+               Entity::CreateTypeDescription();
 
                Arguments args;
                args.Read(argc, argv);
@@ -137,7 +138,7 @@ int main(int argc, char **argv) {
                        Parser(*i, source).Parse();
                }
 
-               switch (args.DetectRunLevel()) {
+               switch (args.GetRunLevel()) {
                        case Arguments::WRITE:
                        {
                                int length(std::strlen(args.OutfilePath()));
@@ -157,7 +158,15 @@ int main(int argc, char **argv) {
                                std::cout << source << std::endl;
                                return 0;
                        }
+                       case Arguments::SOURCE_WIKI: {
+                               TypeDescription::WriteSourceWiki(std::cout);
+                               return 0;
+                       }
+                       case Arguments::BATTLE:
+                               battle = true;
+                               break;
                        case Arguments::PLAY:
+                       case Arguments::MAP:
                                break;
                }
 
@@ -509,35 +518,19 @@ int main(int argc, char **argv) {
                triggers2[0].map = &map1;
                triggers2[0].target = Vector<int>(8, 3);
 
-               SimpleAnimation mapMaximAnimation(gameState.heroes[0].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true);
-               Entity mapMaxim;
-               mapMaxim.SetAnimation(&mapMaximAnimation);
-               mapMaxim.Position() = Vector<float>(64, 128);
-               mapMaxim.SpriteOffset() = Vector<float>(0, -32);
-
-               SimpleAnimation mapSelanAnimation(gameState.heroes[1].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true);
-               Entity mapSelan;
-               mapSelan.SetAnimation(&mapSelanAnimation);
-               mapSelan.Position() = Vector<float>(64, 128);
-               mapSelan.SpriteOffset() = Vector<float>(0, -32);
-               mapSelan.SetFlags(Entity::FLAG_NONBLOCKING);
-               mapMaxim.AddFollower(&mapSelan);
-
-               SimpleAnimation mapGuyAnimation(gameState.heroes[2].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true);
-               Entity mapGuy;
-               mapGuy.SetAnimation(&mapGuyAnimation);
-               mapGuy.Position() = Vector<float>(64, 128);
-               mapGuy.SpriteOffset() = Vector<float>(0, -32);
-               mapGuy.SetFlags(Entity::FLAG_NONBLOCKING);
-               mapSelan.AddFollower(&mapGuy);
-
-               SimpleAnimation mapDekarAnimation(gameState.heroes[3].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true);
-               Entity mapDekar;
-               mapDekar.SetAnimation(&mapDekarAnimation);
-               mapDekar.Position() = Vector<float>(64, 128);
-               mapDekar.SpriteOffset() = Vector<float>(0, -32);
-               mapDekar.SetFlags(Entity::FLAG_NONBLOCKING);
-               mapGuy.AddFollower(&mapDekar);
+               gameState.heroes[0].MapEntity().Position() = Vector<float>(64, 128);
+
+               gameState.heroes[1].MapEntity().Position() = Vector<float>(64, 128);
+               gameState.heroes[1].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING);
+               gameState.heroes[0].MapEntity().AddFollower(&gameState.heroes[1].MapEntity());
+
+               gameState.heroes[2].MapEntity().Position() = Vector<float>(64, 128);
+               gameState.heroes[2].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING);
+               gameState.heroes[1].MapEntity().AddFollower(&gameState.heroes[2].MapEntity());
+
+               gameState.heroes[3].MapEntity().Position() = Vector<float>(64, 128);
+               gameState.heroes[3].MapEntity().SetFlags(Entity::FLAG_NONBLOCKING);
+               gameState.heroes[2].MapEntity().AddFollower(&gameState.heroes[3].MapEntity());
 
                SDL_Surface *mapMonsterImg(IMG_Load("test-data/monster-map.png"));
                Sprite mapMonsterSprite(mapMonsterImg, 32, 32);
@@ -566,7 +559,7 @@ int main(int argc, char **argv) {
                } else {
                        MapState *mapState(new MapState(&map1));
 
-                       mapState->ControlEntity(&mapMaxim);
+                       mapState->ControlEntity(&gameState.heroes[0].MapEntity());
                        mapState->SetWalkingSpeed(walkSpeed);
                        mapMonster.StartAnimation(*mapState);