]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
store complete entity in hero
[l2e.git] / src / main.cpp
index ff49b66bb578b11a9536fb476abcb7b868d6b75d..5be8305346ab493da8d7abba6d1af8e6e7336f29 100644 (file)
@@ -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);
@@ -509,35 +510,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 +551,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);