X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain.cpp;h=5be8305346ab493da8d7abba6d1af8e6e7336f29;hb=d2d8ff1fd5f55e8b43d48ae5e75c216492e2f032;hp=ff49b66bb578b11a9536fb476abcb7b868d6b75d;hpb=616330670a0c3d9d4554c145e997129747d05979;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index ff49b66..5be8305 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(8, 3); - SimpleAnimation mapMaximAnimation(gameState.heroes[0].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); - Entity mapMaxim; - mapMaxim.SetAnimation(&mapMaximAnimation); - mapMaxim.Position() = Vector(64, 128); - mapMaxim.SpriteOffset() = Vector(0, -32); - - SimpleAnimation mapSelanAnimation(gameState.heroes[1].MapSprite(), (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); - Entity mapSelan; - mapSelan.SetAnimation(&mapSelanAnimation); - mapSelan.Position() = Vector(64, 128); - mapSelan.SpriteOffset() = Vector(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(64, 128); - mapGuy.SpriteOffset() = Vector(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(64, 128); - mapDekar.SpriteOffset() = Vector(0, -32); - mapDekar.SetFlags(Entity::FLAG_NONBLOCKING); - mapGuy.AddFollower(&mapDekar); + gameState.heroes[0].MapEntity().Position() = Vector(64, 128); + + gameState.heroes[1].MapEntity().Position() = Vector(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(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(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);